Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * #%L
   * Wikitty :: api
   * %%
   * Copyright (C) 2009 - 2010 CodeLutin, Benjamin Poussin
   * %%
   * This program is free software: you can redistribute it and/or modify
   * it under the terms of the GNU Lesser General Public License as 
   * published by the Free Software Foundation, either version 3 of the 
  * License, or (at your option) any later version.
  * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Lesser Public License for more details.
  * 
  * You should have received a copy of the GNU General Lesser Public 
  * License along with this program.  If not, see
  * <http://www.gnu.org/licenses/lgpl-3.0.html>.
  * #L%
  */
 
 package org.nuiton.wikitty.storage;
 
WikittyStorage is used to abstract data and extension storage in WikittyService.

Author(s):
poussin
Version:
$Revision$ Last update: $Date$ by : $Author$
 
 public interface WikittyStorage {

    
Store wikitty in storage. if force is true, wikitty in argument is all time stored. if wikitty already stored and deleted, wikitty is born again new version is computed as follow:
 if version in wikitty > version in database
   newversion = version in wikitty
 else
   newversion = version in database + 1
 

Parameters:
transaction transaction
wikitties wikitty collection
force boolean force non version version increment on saved wikitty or force version on wikitty creation (version 0.0)
Returns:
information usefull for client side update data
 
     public WikittyEvent store(WikittyTransaction transactionCollection<Wikittywikittiesboolean force);

    
Return true if id exists in storage.

Parameters:
transaction transaction
id id to check
Returns:
true if wikitty id exists
 
     public boolean exists(WikittyTransaction transactionString id);

    
Return true if wikitty object with this id are marked deleted.

Parameters:
transaction transaction
id id to check
Returns:
true if wikitty id is deleted
 
     public boolean isDeleted(WikittyTransaction transactionString id);

    
Restore list of wikitty object.

Parameters:
transaction transaction
id list of wikitty id
fqFieldName list of field that must be loaded, other fields can be not loaded
Returns:
found wikitty
Throws:
org.nuiton.wikitty.WikittyException if wikitty not found
 
     public Wikitty restore(WikittyTransaction transactionString id,
             String ... fqFieldNamethrows WikittyException;

    
Delete all object with id argument. Delete don't fail if wikitty don't existe or is already deleted.

Parameters:
transaction transaction
idList
Returns:
delete response (can be empty if no wikitty are realy deleted
Throws:
org.nuiton.wikitty.WikittyException If id is not valid or don't exist.
    public WikittyEvent delete(WikittyTransaction transactionCollection<StringidListthrows WikittyException;

    
Scan all wikitties with specific scanner, even if the wikitty is deleted.

Parameters:
transaction transaction
scanner scanner
    public void scanWikitties(WikittyTransaction transactionScanner scanner);

    
Call each time wikitty is scan.
    public static interface Scanner {
        void scan(String wikittyId);
    }

    
Remove all wikitty.

Parameters:
transaction transaction
    public WikittyEvent clear(WikittyTransaction transaction);

    
Return some statistique about the data

Parameters:
transaction
Returns:
Since:
3.0.5
    public DataStatistic getDataStatistic(WikittyTransaction transaction);

    
    static public class DataStatistic {
        protected long activeWikitties = -1;
        protected long deletedWikitties = -1;

        
Use this constructor when your implementation don't support statistic
        public DataStatistic() {
        }
        public DataStatistic(long activeWikittieslong deletedWikitties) {
            this. = activeWikitties;
            this. = deletedWikitties;
        }
        
Return number of non deleted wikitties, or negative value if this information can't be retrieved

Returns:
        public long getActiveWikitties() {
            return ;
        }

        
Return number of deleted wikitties, or negative value if this information can't be retrieved

Returns:
        public long getDeletedWikitties() {
            return ;
        }

        
Return number of non deleted and deleted wikitties, or negative value if this information can't be retrieved

Returns:
        public long getTotalWikitties() {
            long result = getActiveWikitties() + getDeletedWikitties();
            return result;
        }
    }
New to GrepCode? Check out our FAQ X