Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * #%L
   * Wikitty :: api
   * %%
   * Copyright (C) 2009 - 2010 CodeLutin
   * %%
   * 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.addons;
 
 import java.util.Set;
Util method to manage Label (add and find)

Author(s):
poussin
Version:
$Revision$ Last update: $Date$ by : $Author$
 
 public class WikittyLabelUtil {

    
to use log facility, just put in your code: log.info(\"...\");
 
     static private Log log = LogFactory.getLog(WikittyLabelUtil.class);

    
Add label on this wikitty. You must store your wikitty after

Parameters:
wikitty
label
 
     static public void addLabel(Wikitty wikittyString label) {
         if (!WikittyLabelHelper.hasExtension(wikitty)) {
             WikittyLabelHelper.addExtension(wikitty);
         }
         WikittyLabelHelper.addLabels(wikittylabel);
     }
    
Add label on this entity. You must store your entiry after

Parameters:
entity
label
 
     static public void addLabel(BusinessEntityImpl entityString label) {
         Wikitty w = entity.getWikitty();
         addLabel(wlabel);
     }

    
Add new lable to the wikitty object. You must only used this method, if you don't have the Wikitty Object because this method restore and save version in WikittyService. If you have Wikitty present in your space, your wikitty become obsolete and you lose your change :( If you have wikitty or business entity you must used

Deprecated:
since 3.4 use
Parameters:
proxy
wikittyId object'id
label label to add
 
     @Deprecated
     static public void addLabel(WikittyProxy proxyString wikittyIdString label) {
         Wikitty w = proxy.restore(wikittyId);
         WikittyLabelImpl l = new WikittyLabelImpl(w);
         l.addLabels(label);
         proxy.store(l);
     }

    
Add new lable to the wikitty object. You must only used this method, if you don't have the Wikitty Object because this method restore and save version in WikittyService. If you have Wikitty present in your space, your wikitty become obsolete and you lose your change :( If you have wikitty or business entity you must used

Parameters:
client
wikittyId object'id
label label to add
    static public void addLabel(WikittyClient clientString wikittyIdString label) {
        Wikitty w = client.restore(wikittyId);
        WikittyLabelImpl l = new WikittyLabelImpl(w);
        l.addLabels(label);
        client.store(l);
    }

    
Recherche tous les objets qui ont ce label

Deprecated:
since 3.4 use
Parameters:
proxy
label
firstIndex
endIndex
Returns:
    @Deprecated
    static public PagedResult<WikittyfindAllByLabel(WikittyProxy proxy,
            String labelint firstIndexint endIndex) {
        WikittyLabelImpl l = new WikittyLabelImpl();
        l.addLabels(label);
        Criteria criteria = Search.query(l.getWikitty()).criteria()
                .setFirstIndex(firstIndex).setEndIndex(endIndex);
        PagedResult<Wikittyresult = proxy.findAllByCriteria(criteria);
        return result;
    }

    
Recherche tous les objets qui ont ce label

Parameters:
client
label
first
limit
Returns:
    static public WikittyQueryResult<WikittyfindAllByLabel(WikittyClient client,
            String labelint firstIndexint limit) {
        WikittyQuery query = new WikittyQueryMaker()
                .eq(.label).end()
                .setFirst(firstIndex).setLimit(limit);
        WikittyQueryResult<Wikittyresult = client.findAllByQuery(Wikitty.classquery);
        return result;
    }

    
Recherche le premier objet qui a ce label

Deprecated:
since 3.4 use
Parameters:
proxy
label
Returns:
    @Deprecated
    static public Wikitty findByLabel(WikittyProxy proxyString label) {
        WikittyLabelImpl l = new WikittyLabelImpl();
        l.addLabels(label);
        Criteria criteria = Search.query(l.getWikitty()).criteria();
        Wikitty result = proxy.findByCriteria(criteria);
        return result;
    }

    
Recherche le premier objet qui a ce label

Parameters:
proxy
label
Returns:
    static public Wikitty findByLabel(WikittyClient proxyString label) {
         WikittyQuery query = new WikittyQueryMaker()
                .eq(.label).end();
        Wikitty result = proxy.findByQuery(Wikitty.classquery);
        return result;
    }

    
Retrieve all labels applied on a wikitty object.

Deprecated:
since 3.4 use
Parameters:
proxy
wikittyId
Returns:
set of label
    @Deprecated
    static public Set<StringfindAllAppliedLabels(WikittyProxy proxyString wikittyId) {
        Wikitty w = proxy.restore(wikittyId);
        Set<Stringresult = WikittyLabelHelper.getLabels(w);
        return result;
    }

    
Retrieve all labels applied on a wikitty object.

Parameters:
client
wikittyId
Returns:
set of label
    static public Set<StringfindAllAppliedLabels(WikittyClient proxyString wikittyId) {
        Wikitty w = proxy.restore(wikittyId);
        Set<Stringresult = WikittyLabelHelper.getLabels(w);
        return result;
    }
New to GrepCode? Check out our FAQ X