Changeset 28493

Show
Ignore:
Timestamp:
01/04/08 20:51:30 (1 year ago)
Author:
sfermigier
Message:

Cosmit.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • org.nuxeo.ecm.core/branches/1.4/nuxeo-core-api/src/main/java/org/nuxeo/ecm/core/api/Sorter.java

    r28347 r28493  
    2121 
    2222import java.util.Comparator; 
     23import java.io.Serializable; 
    2324 
    2425/** 
     
    2829 * 
    2930 */ 
    30 public interface Sorter extends Comparator<DocumentModel>
     31public interface Sorter extends Comparator<DocumentModel>, Serializable
    3132 
    3233} 
  • org.nuxeo.ecm.platform/branches/5.1/nuxeo-platform-audit-client/src/test/java/org/nuxeo/ecm/platform/audit/web/TestRegisterAuditAction.java

    r18892 r28493  
    3232    ActionService as; 
    3333 
     34    @Override 
    3435    public void setUp() throws Exception { 
    3536        super.setUp(); 
    36         deploy("actions-bundle.xml"); 
    37         deploy("nxauditclient-bundle.xml"); 
     37        deployContrib("actions-bundle.xml"); 
     38        deployContrib("nxauditclient-bundle.xml"); 
    3839        as = (ActionService) runtime.getComponent(ActionService.ID); 
    3940    } 
    4041 
     42    @Override 
    4143    public void tearDown() throws Exception { 
    4244        super.tearDown(); 
     
    4446 
    4547    public void testRegistration() { 
    46  
    4748        Action act1 = as.getActionRegistry().getAction("TAB_CONTENT_HISTORY"); 
    4849 
    4950        assertEquals("action.view.history", act1.getLabel()); 
    50  
    5151        assertEquals("/icons/file.gif", act1.getIcon()); 
    52  
    5352        assertEquals("/incl/tabs/document_history.xhtml", act1.getLink()); 
    54  
    5553        assertTrue(act1.isEnabled()); 
    5654    } 
  • org.nuxeo.ecm.platform/branches/5.1/nuxeo-platform-audit-core/src/test/java/org/nuxeo/ecm/platform/audit/TestEventConfService.java

    r19481 r28493  
    3232    private NXAuditEvents service; 
    3333 
     34    @Override 
    3435    public void setUp() throws Exception { 
    3536        super.setUp(); 
    36         deploy("nxaudit-test-definitions.xml"); 
     37        deployContrib("nxaudit-test-definitions.xml"); 
    3738 
    3839        service = NXAudit.getNXAuditEventsService(); 
  • org.nuxeo.ecm.platform/branches/5.1/nuxeo-platform-audit-io/src/main/java/org/nuxeo/ecm/platform/audit/io/IOAuditAdapter.java

    r28476 r28493  
    8686    } 
    8787 
    88     protected CoreSession getCoreSession(String repo) throws Exception { 
     88    protected static CoreSession getCoreSession(String repo) throws Exception { 
    8989        CoreSession coreSession; 
    9090        try { 
     
    9999    } 
    100100 
    101     protected Logs getLogService() throws Exception { 
     101    protected static Logs getLogService() throws Exception { 
    102102        Logs logService; 
    103103        try { 
     
    114114    } 
    115115 
    116     private long createLogEntry(DocumentMessage doc) throws AuditException { 
     116    private static long createLogEntry(DocumentMessage doc) throws AuditException { 
    117117        NXAuditEvents service = NXAudit.getNXAuditEventsService(); 
    118118        LogEntry logEntry = service.computeLogEntry(doc); 
     
    123123            throw new AuditException(e); 
    124124        } 
    125         logService.addLogEntries(Arrays.asList(new LogEntry[] { logEntry })); 
     125        logService.addLogEntries(Arrays.asList(logEntry)); 
    126126        return logEntry.getId(); 
    127127    } 
     
    214214            DocumentRef docRef = new IdRef(logEntry.getDocUUID()); 
    215215 
    216             List<LogEntry> logEntries = null; 
    217             logEntries = docLogs.get(docRef); 
     216            List<LogEntry> logEntries = docLogs.get(docRef); 
    218217            if (logEntries == null) { 
    219218                logEntries = new ArrayList<LogEntry>(); 
     
    223222        } 
    224223 
    225         IOAuditResources resources = new IOAuditResources(docLogs); 
    226         return resources; 
     224        return new IOAuditResources(docLogs); 
    227225    } 
    228226 
     
    294292        } 
    295293 
    296         IOAuditResources newResources = new IOAuditResources(newResourcesMap); 
    297  
    298         return newResources; 
     294        return new IOAuditResources(newResourcesMap); 
    299295    } 
    300296} 
  • org.nuxeo.ecm.platform/branches/5.1/nuxeo-platform-audit-io/src/main/java/org/nuxeo/ecm/platform/audit/io/IOLogEntryBase.java

    r28460 r28493  
    4747/** 
    4848 * Audit log entry importer/exporter. 
    49  * 
     49 * <p> 
    5050 * Could be overriden to externalize additional information of a redefined 
    5151 * LogEntry. 
     
    6060 
    6161 
    62     public void write(List<LogEntry> logEntries, OutputStream out) 
     62    public static void write(List<LogEntry> logEntries, OutputStream out) 
    6363            throws IOException { 
    6464        Document jdoc = writeDocument(logEntries); 
     
    6666    } 
    6767 
    68     private Document writeDocument(List<LogEntry> logEntries) { 
     68    private static Document writeDocument(List<LogEntry> logEntries) { 
    6969        Document document = DocumentFactory.getInstance().createDocument(); 
    7070        document.setName("logEntries"); 
     
    8585     * @param logEntry 
    8686     */ 
    87     protected void writeLogEntry(Element logEntryElement, LogEntry logEntry) { 
     87    protected static void writeLogEntry(Element logEntryElement, LogEntry logEntry) { 
    8888        logEntryElement.addAttribute("category", logEntry.getCategory()); 
    8989        logEntryElement.addAttribute("comment", logEntry.getComment()); 
     
    100100    } 
    101101 
    102     public List<LogEntry> read(InputStream in) throws IOException { 
     102    public static List<LogEntry> read(InputStream in) throws IOException { 
    103103        Document jDoc = loadXML(in); 
    104104        return readDocument(jDoc); 
     
    110110     * @param doc 
    111111     */ 
    112     protected List<LogEntry> readDocument(Document doc) { 
     112    protected static List<LogEntry> readDocument(Document doc) { 
    113113        List<LogEntry> logEntries = new ArrayList<LogEntry>(); 
    114114 
    115115        Element rootElement = doc.getRootElement(); 
    116         Iterator it = rootElement.elementIterator(); 
     116        Iterator<Element> it = rootElement.elementIterator(); 
    117117        while (it.hasNext()) { 
    118             Element logEntryElement = (Element) it.next(); 
     118            Element logEntryElement = it.next(); 
    119119 
    120120            LogEntry logEntry = readLogEntry(logEntryElement); 
     
    131131     * @param logEntry 
    132132     */ 
    133     protected LogEntry readLogEntry(Element logEntryElement) { 
     133    protected static LogEntry readLogEntry(Element logEntryElement) { 
    134134        LogEntryBase logEntry = new LogEntryBase(); 
    135135 
     
    160160     * @return 
    161161     */ 
    162     protected DateFormat getDateFormat() { 
     162    protected static DateFormat getDateFormat() { 
    163163        return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 
    164164    } 
    165165 
    166     protected void writeXML(Document doc, OutputStream out) throws IOException { 
     166    protected static void writeXML(Document doc, OutputStream out) throws IOException { 
    167167        OutputFormat format = OutputFormat.createPrettyPrint(); 
    168168        XMLWriter writer = new XMLWriter(out, format); 
     
    170170    } 
    171171 
    172     private Document loadXML(InputStream in) throws IOException { 
     172    private static Document loadXML(InputStream in) throws IOException { 
    173173        try { 
    174174            // the SAXReader is closing the stream so that we need to copy the 
     
    186186    } 
    187187 
    188     public List<LogEntry> translate(List<LogEntry> docLogs, DocumentRef newRef) { 
     188    public static List<LogEntry> translate(List<LogEntry> docLogs, DocumentRef newRef) { 
    189189        List<LogEntry> newList = new ArrayList<LogEntry>(); 
    190190        for (LogEntry logEntry : docLogs) { 
     
    202202     * @return 
    203203     */ 
    204     private LogEntry translate(LogEntry logEntry, DocumentRef newRef) { 
     204    private static LogEntry translate(LogEntry logEntry, DocumentRef newRef) { 
    205205        LogEntryBase newLogEntry = new LogEntryImpl(); 
    206206 
  • org.nuxeo.ecm.platform/branches/5.1/nuxeo-platform-audit-search/src/main/java/org/nuxeo/ecm/platform/audit/search/resources/indexing/AuditIndexableResourceImpl.java

    r22566 r28493  
    6969    public Serializable getValueFor(String indexableDataName) 
    7070            throws IndexingException { 
    71  
    7271        login(); 
    73  
    7472        Serializable value = getLogEntryDataMapFor(logUUID).get( 
    7573                indexableDataName); 
    76  
    7774        logout(); 
    78  
    7975        return value; 
    8076    } 
     
    8985        } 
    9086 
    91         LogEntry entry = null
     87        LogEntry entry
    9288        try { 
    9389            entry = logsRemote.getLogEntryByID(logUUID); 
     
    110106    } 
    111107 
    112     protected Map<String, Serializable> getLogEntryDataMap(LogEntry entry) { 
     108    protected static Map<String, Serializable> getLogEntryDataMap(LogEntry entry) { 
    113109        Map<String, Serializable> dataMap = new HashMap<String, Serializable>(); 
    114110        dataMap.put(BuiltinLogEntryData.LOG_ID, entry.getId()); 
  • org.nuxeo.ecm.platform/branches/5.1/nuxeo-platform-cache-server/src/test/java/org/nuxeo/ecm/platform/cache/server/TestCacheLocalReplication.java

    r21687 r28493  
    6464    } 
    6565 
     66    @Override 
    6667    protected void tearDown() throws Exception { 
    67  
    6868        if (cacheClient != null) { 
    6969            cacheClient.stopService(); 
    7070        } 
    71  
    7271        super.tearDown(); 
    7372    } 
  • org.nuxeo.ecm.platform/branches/5.1/nuxeo-platform-comment/src/main/java/org/nuxeo/ecm/platform/comment/impl/CommentManagerImpl.java

    r28456 r28493  
    368368     */ 
    369369    @Deprecated 
    370     private String getCurrentUser(DocumentModel target) throws ClientException { 
     370    private static String getCurrentUser(DocumentModel target) throws ClientException { 
    371371        String sid = target.getSessionId(); 
    372372        CoreSession userSession = getUserSession(sid); 
  • org.nuxeo.ecm.platform/branches/5.1/nuxeo-platform-comment/src/main/java/org/nuxeo/ecm/platform/comment/service/CommentService.java

    r21754 r28493  
    5454    } 
    5555 
     56    @Override 
    5657    public void unregisterContribution(Object contribution, 
    5758            String extensionPoint, ComponentInstance contributor) { 
  • org.nuxeo.ecm.platform/branches/5.1/nuxeo-platform-directory-core/src/main/java/org/nuxeo/ecm/directory/AbstractDirectory.java

    r25305 r28493  
    2828import java.util.Map; 
    2929import java.util.Map.Entry; 
     30import java.io.Serializable; 
    3031 
    3132import org.nuxeo.ecm.core.api.ClientException; 
     
    101102     * two values are integers/longs, numbering comparison is used. 
    102103     */ 
    103     public static class EntryComparator implements Comparator<DocumentModel> { 
     104    public static class EntryComparator implements Comparator<DocumentModel>, 
     105            Serializable { 
    104106 
     107        private static final long serialVersionUID = -5027588251188034085L; 
     108         
    105109        static final Collator collator = Collator.getInstance(); 
    106110 
  • org.nuxeo.ecm.platform/branches/5.1/nuxeo-platform-directory-core/src/main/java/org/nuxeo/ecm/directory/InverseReference.java

    r25305 r28493  
    4545    } 
    4646 
     47    @Override 
    4748    @XNode("@directory") 
    4849    public void setTargetDirectoryName(String targetDirectoryName) { 
  • org.nuxeo.ecm.platform/branches/5.1/nuxeo-platform-directory-sql/src/main/java/org/nuxeo/ecm/directory/sql/repository/Table.java

    r21690 r28493  
    110110     */ 
    111111    public String getCreateSql(Dialect dialect) { 
    112         StringBuffer buf = new StringBuffer(); 
     112        StringBuilder buf = new StringBuilder(); 
    113113        char openQuote = dialect.openQuote(); 
    114114        char closeQuote = dialect.closeQuote(); 
     
    168168     */ 
    169169    public String getDropSql(Dialect dialect) { 
    170         StringBuffer buf = new StringBuffer(); 
     170        StringBuilder buf = new StringBuilder(); 
    171171        buf.append("drop table "); 
    172172        if (dialect.supportsIfExistsBeforeTableName()) { 
     
    191191    } 
    192192 
     193    @Override 
    193194    public String toString() { 
    194195        return getClass().getSimpleName() + '(' + name + ')'; 
  • org.nuxeo.ecm.platform/branches/5.1/nuxeo-platform-directory-sql/src/main/java/org/nuxeo/ecm/directory/sql/repository/Update.java

    r20218 r28493  
    6565     * names. 
    6666     * 
    67      * @param icolumns a returned list of columns bound to free parameters. 
    6867     * @return the SQL insert statement. 
    6968     */ 
     
    9695     */ 
    9796    public void setWhere(String whereString) { 
    98         this.where = whereString; 
     97        where = whereString; 
    9998    } 
    10099} 
  • org.nuxeo.ecm.platform/branches/5.1/nuxeo-platform-filemanager-api/src/main/java/org/nuxeo/ecm/platform/filemanager/api/FileManager.java

    r27315 r28493  
    8181           Blob input, String path, String fullName) throws Exception; 
    8282 
    83  
    84  
    8583   /** 
    8684    * Creates a Folder. 
     
    9593           String fullname, String path) throws Exception; 
    9694 
    97  
    9895} 
  • org.nuxeo.ecm.platform/branches/5.1/nuxeo-platform-filemanager-api/src/main/java/org/nuxeo/ecm/platform/filemanager/utils/FileManagerUtils.java

    r28476 r28493  
    127127    } 
    128128 
    129  
    130  
    131129    /** 
    132130     * Looking if an existing Document with the same filename exists. 
     
    175173    } 
    176174 
    177  
    178175} 
  • org.nuxeo.ecm.platform/branches/5.1/nuxeo-platform-filemanager-core/src/main/java/org/nuxeo/ecm/platform/filemanager/service/FileManagerService.java

    r28460 r28493  
    142142            String fullname, String path) throws ClientException, IOException { 
    143143 
    144         if (!folderImporters.isEmpty()) { 
     144        if (folderImporters.isEmpty()) { 
     145            return defaultCreateFolder(documentManager, fullname, path); 
     146        } else { 
    145147            // use the last registered folder importer 
    146             FolderImporter folderImporter = folderImporters.get(folderImporters.size() - 1); 
     148            FolderImporter folderImporter = folderImporters.get( 
     149                    folderImporters.size() - 1); 
    147150            return folderImporter.create(documentManager, fullname, path, true, 
    148151                    getTypeService()); 
    149         } else { 
    150             return defaultCreateFolder(documentManager, fullname, path); 
    151152        } 
    152153    } 
     
    281282 
    282283            // update the file part and the size property 
    283             Long size = Long.valueOf(input.getByteArray().length)
     284            Long size = (long) input.getByteArray().length
    284285            docModel.setProperty("file", "content", input); 
    285286            docModel.setProperty("common", "size", size); 
     
    294295 
    295296            // TODO : Get type Id from mime/type of the upload 
    296             Long size = Long.valueOf(input.getByteArray().length)
     297            Long size = (long) input.getByteArray().length
    297298            docModel = documentManager.createDocumentModel(path, docId, 
    298299                    typeName); 
     
    361362 
    362363            log.debug("Updated the document: " + doc.getName()); 
    363  
    364364        } 
    365365        return doc; 
  • org.nuxeo.ecm.platform/branches/5.1/nuxeo-platform-filemanager-core/src/main/java/org/nuxeo/ecm/platform/filemanager/service/extension/FolderImporter.java

    r28476 r28493  
    3131 
    3232    DocumentModel create(CoreSession documentManager, String fullname, 
    33             String path, boolean overwrite, TypeManager typeManager) throws IOException, ClientException; 
     33            String path, boolean overwrite, TypeManager typeManager) 
     34            throws IOException, ClientException; 
    3435 
    3536    String getName(); 
  • org.nuxeo.ecm.platform/branches/5.1/nuxeo-platform-filemanager-core/src/main/java/org/nuxeo/ecm/platform/filemanager/utils/FileManagerUtils.java

    r28476 r28493  
    175175    } 
    176176 
    177  
    178177} 
  • org.nuxeo.ecm.platform/branches/5.1/nuxeo-platform-forms-layout-client/src/main/java/org/nuxeo/ecm/platform/forms/layout/facelets/FaceletHandlerHelper.java

    r28244 r28493  
    108108    public TagAttribute createIdAttribute(String base) { 
    109109        String value = generateUniqueId(base); 
    110         TagAttribute idAttr = new TagAttribute( 
    111                 tagConfig.getTag().getLocation(), "", "id", "id", value); 
    112         return idAttr; 
     110        return new TagAttribute(tagConfig.getTag().getLocation(), "", "id", 
     111                "id", value); 
    113112    } 
    114113 
     
    120119    public TagAttribute createAttribute(String name, Serializable value) { 
    121120        if (value == null || value instanceof String) { 
    122             TagAttribute idAttr = new TagAttribute( 
    123                     tagConfig.getTag().getLocation(), "", name, name, 
    124                     (String) value); 
    125             return idAttr; 
     121            return new TagAttribute(tagConfig.getTag().getLocation(), "", 
     122                    name, name, (String) value); 
    126123        } 
    127124        return null; 
    128125    } 
    129126 
    130     public TagAttributes getTagAttributes(TagAttribute... attributes) { 
     127    public static TagAttributes getTagAttributes(TagAttribute... attributes) { 
    131128        if (attributes == null || attributes.length == 0) { 
    132129            return null; 
    133130        } 
    134         TagAttributes res = new TagAttributes(attributes); 
    135         return res; 
    136     } 
    137  
    138     public TagAttributes getTagAttributes(List<TagAttribute> attributes) { 
     131        return new TagAttributes(attributes); 
     132    } 
     133 
     134    public static TagAttributes getTagAttributes(List<TagAttribute> attributes) { 
    139135        return getTagAttributes(attributes.toArray(new TagAttribute[]{})); 
    140136    } 
    141137 
    142     public TagAttributes addTagAttribute(TagAttributes orig, 
     138    public static TagAttributes addTagAttribute(TagAttributes orig, 
    143139            TagAttribute newAttr) { 
    144140        if (orig == null) { 
     
    194190        // fill with widget properties 
    195191        Map<String, Serializable> properties = widget.getProperties(); 
    196         TagAttribute attr; 
    197192        if (properties != null) { 
    198193            for (Map.Entry<String, Serializable> property : properties.entrySet()) { 
    199                 attr = createAttribute(property.getKey(), property.getValue()); 
     194                TagAttribute attr = createAttribute(property.getKey(), 
     195                        property.getValue()); 
    200196                if (attr != null) { 
    201197                    attrs.add(attr); 
     
    203199            } 
    204200        } 
    205         TagAttributes attributes = getTagAttributes(attrs); 
    206         return attributes; 
     201        return getTagAttributes(attrs); 
    207202    } 
    208203 
     
    266261                tagConfig, attributes, new LeafFaceletHandler(), 
    267262                HtmlMessage.COMPONENT_TYPE, null); 
    268         ComponentHandler message = new ComponentHandler(config); 
    269         return message; 
     263        return new ComponentHandler(config); 
    270264    } 
    271265} 
  • org.nuxeo.ecm.platform/branches/5.1/nuxeo-platform-forms-layout-client/src/main/java/org/nuxeo/ecm/platform/forms/layout/facelets/LayoutRowTagHandler.java

    r27477 r28493  
    6464            while (ctx.includeDefinition(parent, 
    6565                    TemplateClientHelper.generateRowNumber(rowCounter))) { 
    66                 this.nextHandler.apply(ctx, parent); 
     66                nextHandler.apply(ctx, parent); 
    6767                rowCounter++; 
    6868            } 
  • org.nuxeo.ecm.platform/branches/5.1/nuxeo-platform-forms-layout-client/src/main/java/org/nuxeo/ecm/platform/forms/layout/facelets/LayoutRowWidgetTagHandler.java

    r27477 r28493  
    6262        while (ctx.includeDefinition(parent, 
    6363                TemplateClientHelper.generateWidgetNumber(widgetCounter))) { 
    64             this.nextHandler.apply(ctx, parent); 
     64            nextHandler.apply(ctx, parent); 
    6565            widgetCounter++; 
    6666        } 
  • org.nuxeo.ecm.platform/branches/5.1/nuxeo-platform-forms-layout-client/src/main/java/org/nuxeo/ecm/platform/forms/layout/facelets/LeafFaceletHandler.java

    r26053 r28493  
    4444 
    4545    public void apply(FaceletContext ctx, UIComponent parent) 
    46             throws IOException, FacesException, FaceletException, ELException { 
     46            throws IOException, FacesException, ELException { 
    4747    } 
    4848 
     49    @Override 
    4950    public String toString() { 
    5051        return "FaceletHandler Tail"; 
  • org.nuxeo.ecm.platform/branches/5.1/nuxeo-platform-forms-layout-client/src/main/java/org/nuxeo/ecm/platform/forms/layout/facelets/SubWidgetTagHandler.java

    r26053 r28493  
    6363        while (ctx.includeDefinition(parent, 
    6464                TemplateClientHelper.generateSubWidgetNumber(subWidgetCounter))) { 
    65             this.nextHandler.apply(ctx, parent); 
     65            nextHandler.apply(ctx, parent); 
    6666            subWidgetCounter++; 
    6767        } 
  • org.nuxeo.ecm.platform/branches/5.1/nuxeo-platform-forms-layout-client/src/main/java/org/nuxeo/ecm/platform/forms/layout/facelets/WidgetTagHandler.java

    r28244 r28493  
    148148 
    149149    public boolean apply(FaceletContext ctx, UIComponent parent, String name) 
    150             throws IOException, FacesException, FaceletException, ELException { 
     150            throws IOException, FacesException, ELException { 
    151151        if (widgetInstance == null) { 
    152152            return false; 
  • org.nuxeo.ecm.platform/branches/5.1/nuxeo-platform-forms-layout-client/src/main/java/org/nuxeo/ecm/platform/forms/layout/facelets/library/LayoutTagLibrary.java

    r26053 r28493  
    4545        super(Namespace); 
    4646 
    47         this.addTag