Changeset 28462

Show
Ignore:
Timestamp:
01/03/08 17:34:09 (8 months ago)
Author:
sfermigier
Message:

Fowarrd port.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • org.nuxeo.ecm.core/trunk/nuxeo-core-api/src/main/java/org/nuxeo/ecm/core/api/WrappedException.java

    r24982 r28462  
    4646    } 
    4747 
     48    @SuppressWarnings({"ThrowableInstanceNeverThrown"}) 
    4849    public static WrappedException wrap(Throwable t) { 
    4950        if (t == null) { 
  • org.nuxeo.ecm.core/trunk/nuxeo-core-api/src/main/java/org/nuxeo/ecm/core/api/impl/blob/LazyBlob.java

    r28346 r28462  
    7373    private transient File file; 
    7474 
    75     private long length; 
     75    private final long length; 
    7676 
    7777    static { 
  • org.nuxeo.ecm.core/trunk/nuxeo-core-api/src/main/java/org/nuxeo/ecm/core/api/security/ACE.java

    r28342 r28462  
    4141 
    4242    /** 
    43      * @return Returns the username. 
     43     * @return the username. 
    4444     */ 
    4545    public String getUsername() { 
     
    4848 
    4949    /** 
    50      * @return Returns the permission. 
     50     * @return the permission. 
    5151     */ 
    5252    public String getPermission() { 
     
    5757     * Checks if this privilege is granted. 
    5858     * 
    59      * @return Returns true if the privilege is granted 
     59     * @return true if the privilege is granted 
    6060     */ 
    6161    public boolean isGranted() { 
  • org.nuxeo.ecm.core/trunk/nuxeo-core-io/src/main/java/org/nuxeo/ecm/core/io/impl/plugins/DocumentModelUpdater.java

    r27340 r28462  
    5959    } 
    6060 
     61    @SuppressWarnings({"ThrowableInstanceNeverThrown"}) 
    6162    @Override 
    6263    public DocumentTranslationMap write(ExportedDocument xdoc) throws IOException { 
  • org.nuxeo.ecm.core/trunk/nuxeo-core-jcr-connector/src/main/java/org/nuxeo/ecm/core/repository/jcr/FilteredNodeIterator.java

    r19318 r28462  
    3232public class FilteredNodeIterator implements NodeIterator { 
    3333 
    34     private NodeIterator delegate; // property iterator delegate 
     34    private final NodeIterator delegate; // property iterator delegate 
    3535    private Node next; 
    3636    private final NodeFilter filter; 
  • org.nuxeo.ecm.core/trunk/nuxeo-core-jcr-connector/src/main/java/org/nuxeo/ecm/core/repository/jcr/JCRDocument.java

    r28360 r28462  
    9090 
    9191    // XXX AT: log dirty fields for NXP-666 compatibility 
    92     protected List<String> dirtyFields; 
     92    protected final List<String> dirtyFields; 
    9393 
    9494    /** 
  • org.nuxeo.ecm.core/trunk/nuxeo-core-jcr-connector/src/main/java/org/nuxeo/ecm/core/repository/jcr/JCRDocumentProxy.java

    r28360 r28462  
    6262 
    6363    // referred doc 
    64     JCRDocument doc; 
     64    final JCRDocument doc; 
    6565 
    6666    /** 
  • org.nuxeo.ecm.core/trunk/nuxeo-core/src/main/java/org/nuxeo/ecm/core/api/DocumentModelFactory.java

    r28181 r28462  
    334334            return prop.getValue(); 
    335335        } else { 
    336             Map<String, Object> subMap = exportComplexProperty(sid, docRef, 
    337                     prop); 
    338             return subMap; 
     336            return exportComplexProperty(sid, docRef, prop); 
    339337        } 
    340338    } 
  • org.nuxeo.ecm.platform/trunk/nuxeo-platform-actions-core/src/main/java/org/nuxeo/ecm/platform/actions/ActionService.java

    r25224 r28462  
    2020package org.nuxeo.ecm.platform.actions; 
    2121 
    22 import java.util.ArrayList; 
    23 import java.util.Collections; 
    24 import java.util.Iterator; 
    25 import java.util.List; 
     22import java.util.*; 
    2623 
    2724import org.apache.commons.logging.Log; 
     
    207204                        List<FilterRule> mergedRules = new ArrayList<FilterRule>(); 
    208205 
    209                         for (FilterRule rule : oldFilter.getRules()) { 
    210                             mergedRules.add(rule); 
    211                         } 
    212                         for (FilterRule rule : newFilter.getRules()) { 
    213                             mergedRules.add(rule); 
    214                         } 
     206                        mergedRules.addAll(Arrays.asList(oldFilter.getRules())); 
     207                        mergedRules.addAll(Arrays.asList(newFilter.getRules())); 
    215208                        oldFilter.setRules(mergedRules.toArray(new FilterRule[mergedRules.size()])); 
    216209                    } else { 
     
    299292     * @return a merged Action 
    300293     */ 
    301     protected Action mergeActions(Action existingOne, Action newOne) { 
     294    protected static Action mergeActions(Action existingOne, Action newOne) { 
    302295        // Icon 
    303296        String newIcon = newOne.getIcon(); 
     
    345338        // order 
    346339        int newOrder = newOne.getOrder(); 
    347         if ((newOrder > 0) && (newOrder != existingOne.getOrder())) { 
     340        if (newOrder > 0 && newOrder != existingOne.getOrder()) { 
    348341            existingOne.setOrder(newOrder); 
    349342        } 
     
    366359 
    367360    public void remove() { 
    368  
    369361    } 
    370362 
  • org.nuxeo.ecm.platform/trunk/nuxeo-platform-api/src/main/java/org/nuxeo/ecm/platform/api/login/SystemSession.java

    r21891 r28462  
    3030 *@deprecated use instead {@link Framework#login()} 
    3131 */ 
     32@Deprecated 
    3233public class SystemSession { 
    3334 
  • org.nuxeo.ecm.platform/trunk/nuxeo-platform-audit-api/src/main/java/org/nuxeo/ecm/platform/audit/api/BuiltinLogEntryData.java

    r21941 r28462  
    4848    public static final String LOG_DOC_LIFE_CYCLE = "docLifeCycle"; 
    4949 
     50    private BuiltinLogEntryData() { 
     51    } 
     52 
    5053} 
  • org.nuxeo.ecm.platform/trunk/nuxeo-platform-audit-io/src/main/java/org/nuxeo/ecm/platform/audit/io/IOLogEntryBase.java

    r25914 r28462  
    1313 * 
    1414 * Contributors: 
    15  *       
     15 * 
    1616 * 
    1717 * $Id: $ 
     
    4747/** 
    4848 * Audit log entry importer/exporter. 
    49  *  
     49 * 
    5050 * Could be overriden to externalize additional information of a redefined 
    5151 * LogEntry. 
    52  *  
     52 * 
    5353 * @author DM 
    5454 */ 
     
    5959    public final static String LOGENTRY_TAG = "logEntry"; 
    6060 
    61     public IOLogEntryBase() { 
    62  
    63     } 
    6461 
    6562    public void write(List<LogEntry> logEntries, OutputStream out) 
     
    8481    /** 
    8582     * Could be overriden to put other (additional) data. 
    86      *  
     83     * 
    8784     * @param logEntryElement 
    8885     * @param logEntry 
     
    110107    /** 
    111108     * Will translate from a jdoc to a list of LogEntry objects. 
    112      *  
     109     * 
    113110     * @param doc 
    114111     */ 
     
    130127    /** 
    131128     * Could be overriden to get other (additional) data. 
    132      *  
     129     * 
    133130     * @param logEntryElement 
    134131     * @param logEntry 
     
    160157    /** 
    161158     * Specifies date-string conversion. 
    162      *  
     159     * 
    163160     * @return 
    164161     */ 
     
    200197    /** 
    201198     * Should be overridden if log data structure is changed. 
    202      *  
     199     * 
    203200     * @param logEntry 
    204201     * @param newRef 
  • org.nuxeo.ecm.platform/trunk/nuxeo-platform-audit-search/src/main/java/org/nuxeo/ecm/platform/audit/search/resources/indexing/api/ResourceType.java

    r21963 r28462  
    3030    public static final String AUDIT = "audit"; 
    3131 
     32    private ResourceType() { 
     33    } 
     34 
    3235} 
  • org.nuxeo.ecm.platform/trunk/nuxeo-platform-cache-client/src/main/java/org/nuxeo/ecm/platform/cache/client/ClientCacheServiceFactory.java

    r19196 r28462  
    3131public class ClientCacheServiceFactory { 
    3232 
    33     private static final Log log = LogFactory 
    34             .getLog(ClientCacheServiceFactory.class); 
     33    private static final Log log = LogFactory.getLog(ClientCacheServiceFactory.class); 
    3534 
    3635    private static CacheService cacheService; 
     36 
     37    private ClientCacheServiceFactory() { 
     38    } 
    3739 
    3840    /** 
     
    4749            //cacheService = new CacheService(); 
    4850            try { 
    49                 cacheService = CacheServiceFactory.getCacheService(ClientCacheServiceFactory.class.getName()); 
     51                cacheService = CacheServiceFactory.getCacheService( 
     52                        ClientCacheServiceFactory.class.getName()); 
    5053                //cacheService.init(); 
    5154            } catch (Exception e) { 
  • org.nuxeo.ecm.platform/trunk/nuxeo-platform-cache-jboss/src/main/java/org/nuxeo/ecm/platform/cache/CacheServiceFactory.java

    r21687 r28462  
    4141    // FIXME: make this configurable 
    4242    private static final String POJO_CACHE_SERVICE_NAME = "jboss.cache:service=TreeCache"; 
     43 
     44    private CacheServiceFactory() { 
     45    } 
    4346 
    4447    private static CacheService createMBeanCacheService() 
  • org.nuxeo.ecm.platform/trunk/nuxeo-platform-cache-jboss/src/main/java/org/nuxeo/ecm/platform/cache/CacheableObjectKeys.java

    r20672 r28462  
    2727public class CacheableObjectKeys { 
    2828 
     29    private CacheableObjectKeys() { 
     30    } 
     31 
    2932    /** 
    3033     * 
     
    3336     */ 
    3437    public static String getCacheKey(DataModel dataModel) { 
    35         final String path = CacheableObjectTypes.CORE_OBJ_DATA_MODEL 
     38        return CacheableObjectTypes.CORE_OBJ_DATA_MODEL 
    3639                + dataModel.getSchema(); 
    37         return path; 
    3840    } 
    3941 
     
    4749        //final String path = CacheableObjectTypes.CORE_OBJ_DOCUMENT_MODEL 
    4850        //        + docModel.getPathAsString(); 
    49         final String path = getCacheKey(docModel.getRef()); 
    50         return path; 
     51        return getCacheKey(docModel.getRef()); 
    5152    } 
    5253 
     
    6566                            + docRef.type()); 
    6667        } 
    67         final String path = CacheableObjectTypes.CORE_OBJ_DOCUMENT_MODEL 
    68                 + Integer.toString(docRef.type()) + "/" + docRef.reference(); 
    69         return path; 
     68        return CacheableObjectTypes.CORE_OBJ_DOCUMENT_MODEL 
     69                + Integer.toString(docRef.type()) + '/' + docRef.reference(); 
    7070 
    7171        // return docRef.toString(); 
     
    8787     */ 
    8888    public static String getCacheKeyForDocPath(String docPath) { 
    89         final String path = CacheableObjectTypes.CORE_OBJ_DOCUMENT_MODEL 
    90                 + Integer.toString(DocumentRef.PATH) + "/" + docPath; 
    9189 
    92         return path; 
     90        return CacheableObjectTypes.CORE_OBJ_DOCUMENT_MODEL 
     91                + Integer.toString(DocumentRef.PATH) + '/' + docPath; 
    9392    } 
    9493 
     
    9998     */ 
    10099    public static String getCacheKeyForDocUUID(String docPath) { 
    101         final String path = CacheableObjectTypes.CORE_OBJ_DOCUMENT_MODEL 
    102                 + Integer.toString(DocumentRef.ID) + "/" + docPath; 
    103100 
    104         return path; 
     101        return CacheableObjectTypes.CORE_OBJ_DOCUMENT_MODEL 
     102                + Integer.toString(DocumentRef.ID) + '/' + docPath; 
    105103    } 
    106104 
     
    114112     */ 
    115113    public static String getCacheKey(DocumentRef docRef, String childName) { 
    116         final String path = getCacheKey(docRef) + "/child/" + childName; 
    117         return path; 
     114        return getCacheKey(docRef) + "/child/" + childName; 
    118115    } 
    119116 
     
    136133     */ 
    137134    public static String getCacheKey(DocumentRef docRef, VersionModel version) { 
    138         final String path = getCacheKey(docRef) + "/ver/" + version.getLabel(); 
    139         return path; 
     135        return getCacheKey(docRef) + "/ver/" + version.getLabel(); 
    140136    } 
    141137 
     
    148144        } 
    149145    } 
     146 
    150147} 
  • org.nuxeo.ecm.platform/trunk/nuxeo-platform-comment-api/src/main/java/org/nuxeo/ecm/platform/comment/api/CommentManager.java

    r23003 r28462  
    4040     * so one should use CommentManager.createComment(docModel, comment, author) 
    4141     */ 
    42     public DocumentModel createComment(DocumentModel docModel, 
     42    @Deprecated 
     43    DocumentModel createComment(DocumentModel docModel, 
    4344            String comment) throws ClientException; 
    4445 
    45     public DocumentModel createComment(DocumentModel docModel, 
     46    DocumentModel createComment(DocumentModel docModel, 
    4647            String comment, String author) throws ClientException; 
    4748 
  • org.nuxeo.ecm.platform/trunk/nuxeo-platform-comment/src/main/java/org/nuxeo/ecm/platform/comment/impl/CommentManagerImpl.java

    r27786 r28462  
    298298    } 
    299299 
    300     private void notifyEvent(DocumentModel docModel, String eventType, 
     300    private static void notifyEvent(DocumentModel docModel, String eventType, 
    301301            DocumentModel parent, DocumentModel child, NuxeoPrincipal principal) 
    302302            throws ClientException { 
     
    357357    } 
    358358 
    359     private CoreSession getUserSession(String sid) { 
     359    private static CoreSession getUserSession(String sid) { 
    360360        return CoreInstance.getInstance().getSession(sid); 
    361361    } 
     
    365365     * @deprecated if the caller is remote, we cannot obtain the session 
    366366     */ 
     367    @Deprecated 
    367368    private String getCurrentUser(DocumentModel target) throws ClientException { 
    368369        String sid = target.getSessionId(); 
     
    386387    } 
    387388 
    388     private Date getCommentTimeStamp(DocumentModel comment) { 
     389    private static Date getCommentTimeStamp(DocumentModel comment) { 
    389390        Calendar creationDate = (Calendar) comment.getProperty("dublincore", 
    390391                "created"); 
     
    438439    } 
    439440 
    440     private NuxeoPrincipal getAuthor(DocumentModel docModel) 
     441    private static NuxeoPrincipal getAuthor(DocumentModel docModel) 
    441442            throws ClientException { 
    442443        String[] contributors = (String[]) docModel.getProperty("dublincore", 
  • org.nuxeo.ecm.platform/trunk/nuxeo-platform-content-template-manager/src/main/java/org/nuxeo/ecm/platform/content/template/factories/SimpleTemplateBasedFactory.java

    r23629 r28462  
    1515public class SimpleTemplateBasedFactory extends BaseContentFactory { 
    1616 
    17  
    1817    private List<TemplateItemDescriptor> template; 
    1918 
     
    2322 
    2423        // If we already have children : exit !!! 
    25         if (session.getChildren(eventDoc.getRef()).size()>0) 
     24        if (!session.getChildren(eventDoc.getRef()).isEmpty()) { 
    2625            return; 
     26        } 
    2727 
    28         for (TemplateItemDescriptor item : template) 
    29         { 
     28        for (TemplateItemDescriptor item : template) { 
    3029            DocumentModel newChild = session.createDocumentModel( 
    31                     eventDoc.getPathAsString(), item.getId(), item.getTypeName()); 
     30                    eventDoc.getPathAsString(), item.getId(), 
     31                    item.getTypeName()); 
    3232            newChild.setProperty("dublincore", "title", item.getTitle()); 
    33             newChild.setProperty("dublincore", "description", item.getDescription()); 
     33            newChild.setProperty("dublincore", "description", 
     34                    item.getDescription()); 
    3435            newChild = session.createDocument(newChild); 
    3536 
    36             if ((item.getAcl()!=null) && (item.getAcl().size()>0)) 
    37             { 
     37            if (item.getAcl() != null && !item.getAcl().isEmpty()) { 
    3838                ACP acp = session.getACP(newChild.getRef()); 
    3939                ACL existingACL = acp.getACL(ACL.LOCAL_ACL); 
    40                 if (existingACL==null) 
    41                 { 
     40                if (existingACL == null) { 
    4241                    existingACL = new ACLImpl(); 
    4342                } 
    44                 for (ACEDescriptor ace : item.getAcl()) 
    45                 { 
    46                     existingACL.add(new ACE(ace.getUserName(),ace.getPermission(),ace.getGranted())); 
     43                for (ACEDescriptor ace : item.getAcl()) { 
     44                    existingACL.add(new ACE(ace.getUserName(), 
     45                            ace.getPermission(), ace.getGranted())); 
    4746                } 
    4847                acp.addACL(existingACL); 
    49                 session.setACP(newChild.getRef(),acp, true); 
     48                session.setACP(newChild.getRef(), acp, true); 
    5049            } 
    5150        } 
    52  
    5351    } 
    5452 
  • org.nuxeo.ecm.platform/trunk/nuxeo-platform-content-template-manager/src/main/java/org/nuxeo/ecm/platform/content/template/service/ContentTemplateServiceImpl.java

    r23629 r28462  
    1414import org.nuxeo.runtime.model.DefaultComponent; 
    1515 
    16 public class ContentTemplateServiceImpl extends DefaultComponent implements ContentTemplateService{ 
     16public class ContentTemplateServiceImpl extends DefaultComponent 
     17        implements ContentTemplateService { 
    1718 
    18       public static final String NAME = "org.nuxeo.ecm.platform.content.template.service.TemplateService"; 
    19       public static final String FACTORY_DECLARATION_EP ="factory"; 
    20       public static final String FACTORY_BINDING_EP ="factoryBinding"; 
     19    public static final String NAME = "org.nuxeo.ecm.platform.content.template.service.TemplateService"; 
     20    public static final String FACTORY_DECLARATION_EP = "factory"; 
     21    public static final String FACTORY_BINDING_EP = "factoryBinding"; 
    2122 
    22       private static final Log log = LogFactory.getLog(ContentTemplateServiceImpl.class); 
     23    private static final Log log = LogFactory.getLog( 
     24            ContentTemplateServiceImpl.class); 
    2325 
    24       private Map<String,ContentFactoryDescriptor> factories; 
     26    private Map<String, ContentFactoryDescriptor> factories; 
    2527 
    26       private Map<String,FactoryBindingDescriptor> factoryBindings; 
     28    private Map<String, FactoryBindingDescriptor> factoryBindings; 
    2729 
    28       private Map<String,ContentFactory> factoryInstancesByType; 
     30    private Map<String, ContentFactory> factoryInstancesByType; 
    2931 
    30       @Override 
    31       public void activate(ComponentContext context) { 
    32           factories = new HashMap<String, ContentFactoryDescriptor>(); 
    33           factoryBindings = new HashMap<String, FactoryBindingDescriptor>(); 
    34           factoryInstancesByType = new HashMap<String, ContentFactory>(); 
     32    @Override 
     33    public void activate(ComponentContext context) { 
     34        factories = new HashMap<String, ContentFactoryDescriptor>(); 
     35        factoryBindings = new HashMap<String, FactoryBindingDescriptor>(); 
     36        factoryInstancesByType = new HashMap<String, ContentFactory>(); 
    3537 
    36           // register our Repo init listener 
    37           RepositoryInitializationHandler.setInstance(new RepositoryInitializationListener()); 
     38        // register our Repo init listener 
     39        RepositoryInitializationHandler.setInstance( 
     40                new RepositoryInitializationListener()); 
    3841<