Changeset 15108

Show
Ignore:
Timestamp:
04/01/07 12:26:03 (2 years ago)
Author:
sfermigier
Message:

Cosmit.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • org.nuxeo.ecm.platform.ui.web/trunk/src/org/nuxeo/ecm/platform/ui/web/api/NavigationContext.java

    r14797 r15108  
    243243 
    244244    /** 
    245      * Return the current documentManager if any or create a new session to the 
    246      * currently selected repository location 
     245     * Returns the current documentManager if any or create a new session to the 
     246     * currently selected repository location. 
    247247     * 
    248248     * @throws ClientException 
     
    255255     * @return 
    256256     */ 
    257     public String navigateToDocument(DocumentModel docModel, VersionModel versionModel) throws ClientException; 
    258  
    259     /** 
    260      * get the currentDocument ant put it in Page context 
     257    public String navigateToDocument(DocumentModel docModel, 
     258            VersionModel versionModel) throws ClientException; 
     259 
     260    /** 
     261     * Gets the currentDocument and puts it in Page context. 
     262     * 
    261263     * @return 
    262264     */ 
     
    264266 
    265267    /** 
    266      * get the currentDomain ant put it in Page context 
     268     * Gets the currentDomain and puts it in Page context. 
     269     * 
    267270     * @return 
    268271     */ 
     
    270273 
    271274    /** 
    272      * get the currentWorkspace ant put it in Page context 
     275     * Gets the currentWorkspace and puts it in Page context. 
     276     * 
    273277     * @return 
    274278     */ 
     
    276280 
    277281    /** 
    278      * get the currentContentRootWorkspace and put it in Page context 
     282     * Gets the currentContentRootWorkspace and puts it in Page context. 
     283     * 
    279284     * @return 
    280285     */ 
     
    282287 
    283288    /** 
    284      * get the current ServerLocation and put it in Page Context 
     289     * Gets the current ServerLocation and puts it in Page Context. 
     290     * 
    285291     * @return 
    286292     */ 
     
    288294 
    289295    /** 
    290      * get children of currentDocuments and put it in Page context 
     296     * Gets children of currentDocuments and put it in Page context. 
     297     * 
    291298     * @return 
    292299     */ 
     
    295302 
    296303    /** 
    297      * get the current Content Root (Workspaces, Sections, Templates ...) 
     304     * Gets the current Content Root (Workspaces, Sections, Templates...). 
     305     * 
    298306     * @return 
    299307     */ 
     
    301309 
    302310    /** 
    303      * get the current Workspace 
     311     * Gets the current Workspace. 
     312     * 
    304313     * @return 
    305314     */ 
    306315    public DocumentModel getCurrentWorkspace(); 
    307316 
    308  
    309     /** 
    310      * set the current ContentRoot 
     317    /** 
     318    * Sets the current ContentRoot. 
     319     * 
    311320     * @param currentContentRoot 
    312321     */ 
  • org.nuxeo.ecm.platform.ui.web/trunk/src/org/nuxeo/ecm/platform/ui/web/api/WebActions.java

    r13814 r15108  
    1717import java.util.List; 
    1818 
    19 import javax.annotation.security.PermitAll; 
    2019import javax.ejb.Remote; 
    21 import javax.ejb.Remove; 
    2220 
    23 import org.jboss.seam.annotations.Destroy; 
    2421import org.nuxeo.ecm.platform.actions.Action; 
    2522import org.nuxeo.ecm.platform.actions.ActionContext; 
  • org.nuxeo.ecm.platform.ui.web/trunk/src/org/nuxeo/ecm/platform/ui/web/pathelements/ArchivedVersionsPathElement.java

    r13464 r15108  
    2626public class ArchivedVersionsPathElement implements PathElement { 
    2727 
     28    public static final String TYPE = "ArchivedVersionsPathElement"; 
     29 
    2830    private static final long serialVersionUID = 8965065837815754773L; 
    2931 
    3032    private DocumentModel docModel; 
    31  
    32     public static final String TYPE = "ArchivedVersionsPathElement"; 
    3333 
    3434    public ArchivedVersionsPathElement(DocumentModel docModel) { 
  • org.nuxeo.ecm.platform.ui.web/trunk/src/org/nuxeo/ecm/platform/ui/web/pathelements/DocumentPathElement.java

    r13464 r15108  
    2323public class DocumentPathElement implements PathElement { 
    2424 
     25    public static final String TYPE = "DocumentPathElement"; 
     26 
    2527    private static final long serialVersionUID = 3539843847014749832L; 
    2628 
    2729    protected DocumentModel docModel; 
    28  
    29     public static final String TYPE = "DocumentPathElement"; 
    3030 
    3131    public DocumentPathElement(DocumentModel docModel) { 
  • org.nuxeo.ecm.platform.ui.web/trunk/src/org/nuxeo/ecm/platform/ui/web/pathelements/TextPathElement.java

    r13464 r15108  
    2121public class TextPathElement implements PathElement { 
    2222 
     23    public static final String TYPE = "TextPathElement"; 
     24 
    2325    private static final long serialVersionUID = -2697484542006976062L; 
    24  
    25     public static final String TYPE = "TextPathElement"; 
    2626 
    2727    private String name; 
     
    3131    } 
    3232 
    33     /* (non-Javadoc) 
    34      * @see org.nuxeo.ecm.webapp.context.PathElement#getName() 
    35      */ 
    3633    public String getName() { 
    3734        return name; 
    3835    } 
    3936 
    40     /* (non-Javadoc) 
    41      * @see org.nuxeo.ecm.webapp.context.PathElement#getType() 
    42      */ 
    4337    public String getType() { 
    4438        return TYPE; 
  • org.nuxeo.ecm.platform.ui.web/trunk/src/org/nuxeo/ecm/platform/ui/web/pathelements/VersionDocumentPathElement.java

    r13464 r15108  
    2525public class VersionDocumentPathElement extends DocumentPathElement { 
    2626 
     27    public static final String TYPE = "VersionDocumentPathElement"; 
     28 
    2729    private static final long serialVersionUID = -2151946234154284611L; 
    28     public static final String TYPE = "VersionDocumentPathElement"; 
    2930 
    3031    public VersionDocumentPathElement(DocumentModel docModel) { 
     
    3233    } 
    3334 
    34     /* 
    35      * (non-Javadoc) 
    36      * 
    37      * @see org.nuxeo.ecm.platform.ui.web.pathelements#getName() 
    38      */ 
    3935    public String getName() { 
    4036        try { 
     
    4945    } 
    5046 
    51     /* 
    52      * (non-Javadoc) 
    53      * 
    54      * @see org.nuxeo.ecm.platform.ui.web.pathelements#getType() 
    55      */ 
    5647    public String getType() { 
    5748        return TYPE; 
  • org.nuxeo.ecm.platform.ui.web/trunk/src/org/nuxeo/ecm/platform/ui/web/resolver/ContextStringWrapper.java

    r15094 r15108  
    1313    private String value; 
    1414 
    15     public ContextStringWrapper(String val) { 
    16         this.value = val
     15    public ContextStringWrapper(String value) { 
     16        this.value = value
    1717    } 
    1818 
     
    2525    } 
    2626 
     27    @Override 
    2728    public String toString() { 
    2829        return this.value; 
    2930    } 
    3031 
     32    // FIXME: this doesn't implement the equals() contract (not symetric). 
     33    @Override 
    3134    public boolean equals(Object val) { 
    32         return this.value.equals(val); 
     35        return value.equals(val); 
     36    } 
     37 
     38    @Override 
     39    public int hashCode() { 
     40        return value.hashCode(); 
    3341    } 
    3442 
  • org.nuxeo.ecm.platform.ui.web/trunk/src/org/nuxeo/ecm/platform/ui/web/rest/RestHelper.java

    r14130 r15108  
    11package org.nuxeo.ecm.platform.ui.web.rest; 
    22 
    3 import static org.jboss.seam.ScopeType.CONVERSATION; 
    43import static org.jboss.seam.ScopeType.EVENT; 
    5  
    6 import java.awt.List; 
    74 
    85import org.apache.commons.logging.Log; 
     
    2320public class RestHelper { 
    2421 
    25        private String repositoryName
     22    private static Log log = LogFactory.getLog(RestHelper.class)
    2623 
    27        private String documentId
     24    private String repositoryName
    2825 
    29        private String currentTab
     26    private String documentId
    3027 
    31         @In(create = true) 
    32         NavigationContext navigationContext; 
     28    private String currentTab; 
    3329 
    34        @In(create = true) 
    35        WebActions webActions
     30    @In(create = true) 
     31    NavigationContext navigationContext
    3632 
    37         private static Log log = LogFactory.getLog(RestHelper.class); 
     33    @In(create = true) 
     34    WebActions webActions; 
    3835 
    39        @Begin(id = "#{conversationIdGenerator.currentOrNewMainConversationId}", join = true) 
    40        public String initContextFromRestRequest() { 
    41                String outcome = null; 
     36    @Begin(id = "#{conversationIdGenerator.currentOrNewMainConversationId}", join = true) 
     37    public String initContextFromRestRequest() { 
     38        String outcome = null; 
    4239 
    43                if ((repositoryName != null) 
    44                         && ((navigationContext.getSelectedServerLocation() == null) || 
    45                        (!navigationContext.getSelectedServerLocation().getName().equals(repositoryName)))) { 
     40        if ((repositoryName != null) 
     41                && ((navigationContext.getSelectedServerLocation() == null) || (!navigationContext.getSelectedServerLocation().getName().equals( 
     42                        repositoryName)))) { 
    4643 
    47                         RepositoryLocation repo = new RepositoryLocation(repositoryName); 
    48                         try { 
    49                                 navigationContext.setCurrentServerLocation(repo); 
    50                                 // do some navigation 
    51                                 DocumentRef docRef = new IdRef(documentId); 
    52                                 outcome = navigationContext.navigateTo(repo, docRef); 
    53                                 if ((currentTab != null)&&(!currentTab.equals(FancyURLConfig.DEFAULT_TAB_NAME))) 
    54                                         webActions.setCurrentTabAction(currentTab); 
    55                         } catch (ClientException e) { 
    56                                 // TODO Auto-generated catch block 
    57                                 e.printStackTrace(); 
    58                         } 
    59                         // use redirect to get context initialized 
    60                         // return outcome; 
    61                 } 
    62                 if ((documentId != null) 
    63                         && (!navigationContext.getCurrentDocument().getId().equals( 
    64                                                 documentId))) { 
    65                         // do some navigation 
    66                         DocumentRef docRef = new IdRef(documentId); 
    67                         try { 
    68                                 outcome = navigationContext.navigateToRef(docRef); 
    69                         } catch (ClientException e) { 
    70                                 // TODO Auto-generated catch block 
    71                                 e.printStackTrace(); 
    72                         } 
    73                 } 
     44            RepositoryLocation repo = new RepositoryLocation(repositoryName); 
     45            try { 
     46                navigationContext.setCurrentServerLocation(repo); 
     47                // do some navigation 
     48                DocumentRef docRef = new IdRef(documentId); 
     49                outcome = navigationContext.navigateTo(repo, docRef); 
     50                if ((currentTab != null) 
     51                        && (!currentTab.equals(FancyURLConfig.DEFAULT_TAB_NAME))) { 
     52                    webActions.setCurrentTabAction(currentTab); 
     53                } 
     54            } catch (ClientException e) { 
     55                // TODO Auto-generated catch block 
     56                e.printStackTrace(); 
     57            } 
     58            // use redirect to get context initialized 
     59            // return outcome; 
     60        } 
     61        if ((documentId != null) 
     62            && (!navigationContext.getCurrentDocument().getId().equals( 
     63                        documentId))) { 
     64            // do some navigation 
     65            DocumentRef docRef = new IdRef(documentId); 
     66            try { 
     67                outcome = navigationContext.navigateToRef(docRef); 
     68            } catch (ClientException e) { 
     69                // TODO Auto-generated catch block 
     70                e.printStackTrace(); 
     71            } 
     72        } 
    7473 
    75                 if ((currentTab != null) 
    76                                 && (!webActions.getCurrentTabAction().getId() 
    77                                                 .equals(currentTab))) { 
    78                         if (!currentTab.equals(FancyURLConfig.DEFAULT_TAB_NAME)) 
    79                                 webActions.setCurrentTabAction(currentTab); 
    80                 } 
     74        if ((currentTab != null) 
     75                && (!webActions.getCurrentTabAction().getId() 
     76                        .equals(currentTab))) { 
     77            if (!currentTab.equals(FancyURLConfig.DEFAULT_TAB_NAME)) { 
     78                webActions.setCurrentTabAction(currentTab); 
     79            } 
     80        } 
    8181 
    82                return null; 
    83        
     82        return null; 
     83   
    8484 
    85        @Begin(id = "#{conversationIdGenerator.currentOrNewMainConversationId}", join = true) 
    86        public String getCurrentTab() { 
    87                String cTab = webActions.getCurrentTabAction().getId(); 
    88                log.debug("Retrive currentTab :" + cTab); 
    89                return cTab; 
    90        
     85    @Begin(id = "#{conversationIdGenerator.currentOrNewMainConversationId}", join = true) 
     86    public String getCurrentTab() { 
     87        String cTab = webActions.getCurrentTabAction().getId(); 
     88        log.debug("Retrive currentTab :" + cTab); 
     89        return cTab; 
     90   
    9191 
    92        @Begin(id = "#{conversationIdGenerator.currentOrNewMainConversationId}", join = true) 
    93        public void setCurrentTab(String currentTab) { 
    94                log.debug("setting curentTab from URL :" + currentTab); 
    95                // log.debug("navigationContext contains :" + 
    96                // webActions.getCurrentTabAction().getId()); 
    97                this.currentTab = currentTab; 
    98                // if (!currentTab.equals(webActions.getCurrentTabAction().getId())) 
    99                // webActions.setCurrentTabAction(currentTab); 
    100        
     92    @Begin(id = "#{conversationIdGenerator.currentOrNewMainConversationId}", join = true) 
     93    public void setCurrentTab(String currentTab) { 
     94        log.debug("setting curentTab from URL :" + currentTab); 
     95        // log.debug("navigationContext contains :" + 
     96        // webActions.getCurrentTabAction().getId()); 
     97        this.currentTab = currentTab; 
     98        // if (!currentTab.equals(webActions.getCurrentTabAction().getId())) 
     99        // webActions.setCurrentTabAction(currentTab); 
     100   
    101101 
    102        @Begin(id = "#{conversationIdGenerator.currentOrNewMainConversationId}", join = true) 
    103        public String getDocumentId() { 
    104                String dId = navigationContext.getCurrentDocument().getId(); 
    105                log.debug("getting DocumentId from context : " + dId); 
    106                return dId; 
    107        
     102    @Begin(id = "#{conversationIdGenerator.currentOrNewMainConversationId}", join = true) 
     103    public String getDocumentId() { 
     104        String dId = navigationContext.getCurrentDocument().getId(); 
     105        log.debug("getting DocumentId from context : " + dId); 
     106        return dId; 
     107   
    108108 
    109        @Begin(id = "#{conversationIdGenerator.currentOrNewMainConversationId}", join = true) 
    110        public void setDocumentId(String documentId) { 
    111                log.debug("Setting DocumentId from URL : " + documentId); 
    112                // log.debug("navigationContext contains : " + 
    113                // navigationContext.getCurrentDocument().getId()); 
    114                this.documentId = documentId; 
     109    @Begin(id = "#{conversationIdGenerator.currentOrNewMainConversationId}", join = true) 
     110    public void setDocumentId(String documentId) { 
     111        log.debug("Setting DocumentId from URL : " + documentId); 
     112        // log.debug("navigationContext contains : " + 
     113        // navigationContext.getCurrentDocument().getId()); 
     114        this.documentId = documentId; 
    115115 
    116        
     116   
    117117 
    118        @Begin(id = "#{conversationIdGenerator.currentOrNewMainConversationId}", join = true) 
    119        public String getRepositoryName() { 
    120                return navigationContext.getCurrentServerLocation().getName(); 
    121        
     118    @Begin(id = "#{conversationIdGenerator.currentOrNewMainConversationId}", join = true) 
     119    public String getRepositoryName() { 
     120        return navigationContext.getCurrentServerLocation().getName(); 
     121   
    122122 
    123        @Begin(id = "#{conversationIdGenerator.currentOrNewMainConversationId}", join = true) 
    124        public void setRepositoryName(String repositoryName) { 
    125                this.repositoryName = repositoryName; 
    126        
     123    @Begin(id = "#{conversationIdGenerator.currentOrNewMainConversationId}", join = true) 
     124    public void setRepositoryName(String repositoryName) { 
     125        this.repositoryName = repositoryName; 
     126   
    127127 
    128128} 
  • org.nuxeo.ecm.platform.ui.web/trunk/src/org/nuxeo/ecm/platform/ui/web/rest/RestURLMaker.java

    r14759 r15108  
    2525    NavigationContext navigationContext; 
    2626 
    27         @In(value="org.jboss.seam.core.manager") 
    28         public Manager conversationManager; 
    29  
    30         @In 
    31         private TypeManager typeManager; 
    32  
    33  
    34         private String baseURL=""; 
    35  
    36         /* 
    37          * return url like http://server:8080/nuxeo/nxdoc/repo/uuid/view/tab 
    38          */ 
    39         public String getDocumentFullURL(RepositoryLocation repo, DocumentRef docRef,String view, String tab, Boolean propagateConversation) 
    40         { 
    41                 String returnURL=getDocumentURL(repo, docRef, view, tab, propagateConversation); 
    42  
    43                 returnURL=BaseURL.getServerURL() + returnURL.substring(1); 
    44  
    45                 return returnURL; 
    46         } 
    47  
    48         /* 
    49          * return url like /nuxeo/nxdoc/repo/uuid/view/tab 
    50          */ 
    51         public String getDocumentURL(RepositoryLocation repo, DocumentRef docRef,String view, String tab, Boolean propagateConversation) 
    52         { 
    53                 String returnURL=""; 
    54  
    55                 if (FancyURLConfig.USE_FANCY_URL) 
    56                 { 
    57                         DocumentLocation docLoc = new DocumentLocationImpl(repo,docRef); 
    58                         DocumentView dv = new DocumentViewImpl(docLoc,view,tab,null); 
    59  
    60                         returnURL=FancyURLMapper.getFancyURL(dv); 
    61                         if (propagateConversation) 
    62                                 returnURL+="?"+getConversationPropagationSuffix(); 
    63                 } 
    64                 else 
    65                 { 
    66                         returnURL = getSimpleURL(repo, docRef, view, tab); 
    67                         if (propagateConversation) 
    68                                 returnURL+="&"+getConversationPropagationSuffix(); 
    69                 } 
    70  
    71                 return "/"+BaseURL.getWebAppName()+returnURL; 
    72         } 
    73  
    74         public String getDocumentURL(DocumentRef docRef,String view, String tab) 
    75         { 
    76                 RepositoryLocation repo = navigationContext.getCurrentServerLocation(); 
    77                 return getDocumentURL(repo, docRef, view, tab,true); 
    78         } 
    79  
    80         public String getDocumentURL(DocumentRef docRef) 
    81         { 
    82                 RepositoryLocation repo = navigationContext.getCurrentServerLocation(); 
    83                 return getDocumentURL(repo, docRef, FancyURLConfig.DEFAULT_VIEW_ID, FancyURLConfig.DEFAULT_TAB_NAME,true); 
    84         } 
    85  
    86         public String getDocumentURLFromDocumentModel(DocumentModel doc) 
    87         { 
    88                 String jsfViewId=getDefaultViewId(doc); 
    89                 RepositoryLocation repo = navigationContext.getCurrentServerLocation(); 
    90                 return getDocumentURL(repo, doc.getRef(), jsfViewId, FancyURLConfig.DEFAULT_TAB_NAME,true); 
    91         } 
    92  
    93         public String getDocumentURLFromDocumentModelWithTab(DocumentModel doc,String tabId) 
    94         { 
    95                 String jsfViewId=getDefaultViewId(doc); 
    96                 RepositoryLocation repo = navigationContext.getCurrentServerLocation(); 
    97                 return getDocumentURL(repo, doc.getRef(), jsfViewId, tabId,true); 
    98         } 
    99  
    100         public String getDocumentURL() 
    101         { 
    102                 DocumentModel currentDoc=navigationContext.getCurrentDocument(); 
    103                 return getDocumentURLFromDocumentModel(currentDoc); 
    104         } 
    105  
    106         public String getDocumentURLForParentConversation() 
    107         { 
    108                 DocumentModel currentDoc=navigationContext.getCurrentDocument(); 
    109                 String url = getDocumentURL(currentDoc.getRef()); 
    110  
    111                 url=url.replace(getConversationPropagationSuffix(), getMainConversationPropagationSuffix()); 
    112                 return url; 
    113         } 
    114  
    115  
    116         public String getDocumentPermLink() 
    117         { 
    118                 DocumentModel currentDoc=navigationContext.getCurrentDocument(); 
    119                 RepositoryLocation repo = navigationContext.getCurrentServerLocation(); 
    120                 return getDocumentURL(repo, currentDoc.getRef(), FancyURLConfig.DEFAULT_VIEW_ID, FancyURLConfig.DEFAULT_TAB_NAME,false); 
    121         } 
    122  
    123         public String switchTabForCurrentDocument(String tab) 
    124         { 
    125                 DocumentModel currentDoc=navigationContext.getCurrentDocument(); 
    126                 RepositoryLocation repo = navigationContext.getCurrentServerLocation(); 
    127                 return getDocumentURL(repo, currentDoc.getRef(), FancyURLConfig.DEFAULT_VIEW_ID, tab,true); 
    128         } 
     27    @In(value="org.jboss.seam.core.manager") 
     28    public Manager conversationManager; 
     29 
     30    @In 
     31    private TypeManager typeManager; 
     32 
     33    private String baseURL=""; 
     34 
     35    /** 
     36     * @return url like http://server:8080/nuxeo/nxdoc/repo/uuid/view/tab 
     37     */ 
     38    public String getDocumentFullURL(RepositoryLocation repo, 
     39            DocumentRef docRef, String view, String tab, 
     40            Boolean propagateConversation) { 
     41        String returnURL = getDocumentURL(repo, docRef, view, tab, 
     42                propagateConversation); 
     43 
     44        returnURL = BaseURL.getServerURL() + returnURL.substring(1); 
     45 
     46        return returnURL; 
     47    } 
     48 
     49    /** 
     50     * @return url like /nuxeo/nxdoc/repo/uuid/view/tab 
     51     */ 
     52    public String getDocumentURL(RepositoryLocation repo, DocumentRef docRef, 
     53            String view, String tab, Boolean propagateConversation) { 
     54        String returnURL = ""; 
     55 
     56        if (FancyURLConfig.USE_FANCY_URL) { 
     57            DocumentLocation docLoc = new DocumentLocationImpl(repo, docRef); 
     58            DocumentView dv = new DocumentViewImpl(docLoc, view, tab, null); 
     59 
     60            returnURL = FancyURLMapper.getFancyURL(dv); 
     61            if (propagateConversation) { 
     62                returnURL += "?" + getConversationPropagationSuffix(); 
     63            } 
     64        } else { 
     65            returnURL = getSimpleURL(repo, docRef, view, tab); 
     66            if (propagateConversation) { 
     67                returnURL += "&" + getConversationPropagationSuffix(); 
     68            } 
     69        } 
     70 
     71        return "/" + BaseURL.getWebAppName() + returnURL; 
     72    } 
     73 
     74    public String getDocumentURL(DocumentRef docRef, String view, String tab) { 
     75        RepositoryLocation repo = navigationContext.getCurrentServerLocation(); 
     76        return getDocumentURL(repo, docRef, view, tab, true); 
     77    } 
     78 
     79    public String getDocumentURL(DocumentRef docRef) { 
     80        RepositoryLocation repo = navigationContext.getCurrentServerLocation(); 
     81        return getDocumentURL(repo, docRef, FancyURLConfig.DEFAULT_VIEW_ID, 
     82                FancyURLConfig.DEFAULT_TAB_NAME, true); 
     83    } 
     84 
     85    public String getDocumentURLFromDocumentModel(DocumentModel doc) { 
     86        String jsfViewId = getDefaultViewId(doc); 
     87        RepositoryLocation repo = navigationContext.getCurrentServerLocation(); 
     88        return getDocumentURL(repo, doc.getRef(), jsfViewId, 
     89                FancyURLConfig.DEFAULT_TAB_NAME, true); 
     90    } 
     91 
     92    public String getDocumentURLFromDocumentModelWithTab(DocumentModel doc, 
     93            String tabId) { 
     94        String jsfViewId = getDefaultViewId(doc); 
     95        RepositoryLocation repo = navigationContext.getCurrentServerLocation(); 
     96        return getDocumentURL(repo, doc.getRef(), jsfViewId, tabId, true); 
     97    } 
     98 
     99    public String getDocumentURL() { 
     100        DocumentModel currentDoc = navigationContext.getCurrentDocument(); 
     101        return getDocumentURLFromDocumentModel(currentDoc); 
     102    } 
     103 
     104    public String getDocumentURLForParentConversation() { 
     105        DocumentModel currentDoc = navigationContext.getCurrentDocument(); 
     106        String url = getDocumentURL(currentDoc.getRef()); 
     107 
     108        url = url.replace(getConversationPropagationSuffix(), 
     109                getMainConversationPropagationSuffix()); 
     110        return url; 
     111    } 
     112 
     113    public String getDocumentPermLink() { 
     114        DocumentModel currentDoc = navigationContext.getCurrentDocument(); 
     115        RepositoryLocation repo = navigationContext.getCurrentServerLocation(); 
     116        return getDocumentURL(repo, currentDoc.getRef(), 
     117                FancyURLConfig.DEFAULT_VIEW_ID, 
     118                FancyURLConfig.DEFAULT_TAB_NAME, false); 
     119    } 
     120 
     121    public String switchTabForCurrentDocument(String tab) { 
     122        DocumentModel currentDoc = navigationContext.getCurrentDocument(); 
     123        RepositoryLocation repo = navigationContext.getCurrentServerLocation(); 
     124        return getDocumentURL(repo, currentDoc.getRef(), 
     125                FancyURLConfig.DEFAULT_VIEW_ID, tab, true); 
     126    } 
    129127 
    130128    @Factory(value = "baseURL", scope = CONVERSATION) 
    131     public String getBaseURL() 
    132     { 
    133         if (baseURL.equals("")) 
    134         { 
    135                 baseURL=BaseURL.getBaseURL(); 
    136         } 
    137         return baseURL; 
     129    public String getBaseURL() { 
     130        if (baseURL.equals("")) { 
     131            baseURL = BaseURL.getBaseURL(); 
     132        } 
     133        return baseURL; 
    138134    } 
    139135 
    140136    @Factory(value = "needBaseURL", scope = CONVERSATION) 
    141     public boolean getNeedBaseURL() 
    142     { 
    143         return FancyURLConfig.NEED_BASE_URL; 
    144     } 
    145  
    146  
    147         private String getSimpleURL(RepositoryLocation repo, DocumentRef docRef,String view, String tab) 
    148         { 
    149                 String returnURL=""; 
    150  
    151                 returnURL+="/" + view + ".faces?"; 
    152                 returnURL+=FancyURLConfig.GET_URL_Server_Param + "=" + repo.getName() + "&"; 
    153                 returnURL+=FancyURLConfig.GET_URL_Doc_Param + "=" + docRef.toString() + "&"; 
    154                 returnURL+=FancyURLConfig.GET_URL_Tab_Param + "=" + tab; 
    155  
    156                 // XXX deal with encoding 
    157                 return returnURL; 
    158         } 
    159  
    160         private String getConversationPropagationSuffix() 
    161         { 
    162                 String suffix=""; 
    163  
    164                 suffix+=conversationManager.getConversationIdParameter()+"=" + conversationManager.getCurrentConversationId(); 
    165                 if (conversationManager.isLongRunningConversation()) 
    166                         suffix+="&"+conversationManager.getConversationIsLongRunningParameter() + "true"; 
    167  
    168                 return suffix; 
    169         } 
    170  
    171         private String getMainConversationPropagationSuffix() 
    172         { 
    173                 String suffix=""; 
    174  
    175                 String cId=conversationManager.getCurrentConversationId(); 
    176                 if (conversationManager.isNestedConversation()) 
    177                         cId =conversationManager.getParentConversationId(); 
    178  
    179                 suffix+=conversationManager.getConversationIdParameter()+"=" + cId; 
    180                 if (conversationManager.isLongRunningConversation()) 
    181                         suffix+="&"+conversationManager.getConversationIsLongRunningParameter() + "true"; 
    182  
    183                 return suffix; 
    184         } 
    185  
    186  
    187         private  Map<String,String> type2ViewMapper = new HashMap<String,String>(); 
    188  
    189         private String getDefaultViewId(DocumentModel doc) 
    190         { 
    191                 String docType=doc.getType(); 
    192  
    193                 if (type2ViewMapper.containsKey(docType)) 
    194                         return type2ViewMapper.get(docType); 
    195  
    196                 String viewId = typeManager.getType(docType).getDefaultView(); 
    197  
    198                 // cache it for later use 
    199                 type2ViewMapper.put(docType, viewId); 
    200  
    201                 return viewId; 
    202  
    203  
    204         } 
     137    public boolean getNeedBaseURL() { 
     138        return FancyURLConfig.NEED_BASE_URL; 
     139    } 
     140 
     141    private String getSimpleURL(RepositoryLocation repo, DocumentRef docRef, 
     142            String view, String tab) { 
     143        String returnURL = ""; 
     144 
     145        returnURL += "/" + view + ".faces?"; 
     146        returnURL += FancyURLConfig.GET_URL_Server_Param + "=" + repo.getName() 
     147                + "&"; 
     148        returnURL += FancyURLConfig.GET_URL_Doc_Param + "=" + docRef.toString() 
     149                + "&"; 
     150        returnURL += FancyURLConfig.GET_URL_Tab_Param + "=" + tab; 
     151 
     152        // XXX deal with encoding 
     153        return returnURL; 
     154    } 
     155 
     156    private String getConversationPropagationSuffix() { 
     157        String suffix = ""; 
     158 
     159        suffix += conversationManager.getConversationIdParameter() + "=" 
     160                + conversationManager.getCurrentConversationId(); 
     161        if (conversationManager.isLongRunningConversation()) { 
     162            suffix += "&" 
     163                    + conversationManager.getConversationIsLongRunningParameter() 
     164                    + "true"; 
     165        } 
     166 
     167        return suffix; 
     168    } 
     169 
     170    private String getMainConversationPropagationSuffix() { 
     171        String suffix = ""; 
     172 
     173        String cId = conversationManager.getCurrentConversationId(); 
     174        if (conversationManager.isNestedConversation()) { 
     175            cId = conversationManager.getParentConversationId(); 
     176        } 
     177 
     178        suffix += conversationManager.getConversationIdParameter() + "=" + cId; 
     179        if (conversationManager.isLongRunningConversation()) { 
     180            suffix += "&" 
     181                    + conversationManager.getConversationIsLongRunningParameter() 
     182                    + "true"; 
     183        } 
     184 
     185        return suffix; 
     186    } 
     187 
     188    private Map<String, String> type2ViewMapper = new HashMap<String, String>(); 
     189 
     190    private String getDefaultViewId(DocumentModel doc) { 
     191        String docType = doc.getType(); 
     192 
     193        if (type2ViewMapper.containsKey(docType)) { 
     194            return type2ViewMapper.get(docType); 
     195        } 
     196 
     197        String viewId = typeManager.getType(docType).getDefaultView(); 
     198 
     199        // cache it for later use 
     200        type2ViewMapper.put(docType, viewId); 
     201 
     202        return viewId; 
     203    } 
    205204 
    206205} 
  • org.nuxeo.ecm.platform.ui.web/trunk/src/org/nuxeo/ecm/platform/ui/web/tag/handler/DocumentLinkTagHandler.java

    r14130 r15108  
    6363    @Override 
    6464    /** 
    65      * Set action after component has been created 
     65     * Sets action after component has been created. 
    6666     * 
    6767     */ 
     
    113113        return viewName; 
    114114    } 
     115 
    115116} 
  • org.nuxeo.ecm.platform.ui.web/trunk/src/org/nuxeo/ecm/platform/ui/web/tag/handler/MethodResultTagHandler.java

    r14031 r15108  
    1717import java.io.IOException; 
    1818 
    19 import javax.el.ELException; 
    2019import javax.el.MethodExpression; 
    2120import javax.el.ValueExpression; 
    22 import javax.faces.FacesException; 
    2321import javax.faces.component.UIComponent; 
    2422 
     
    2624 
    2725import com.sun.facelets.FaceletContext; 
    28 import com.sun.facelets.FaceletException; 
    29 import com.sun.facelets.el.LegacyValueBinding; 
    3026import com.sun.facelets.tag.MetaTagHandler; 
    3127import com.sun.facelets.tag.TagAttribute; 
     
    6157 
    6258    public void apply(FaceletContext ctx, UIComponent parent) 
    63             throws IOException, FacesException, FaceletException, ELException
     59            throws IOException
    6460        String nameStr = name.getValue(ctx); 
    6561        // resolve given value as a method binding, paramtypes ignored for now 
  • org.nuxeo.ecm.platform.ui.web/trunk/src/org/nuxeo/ecm/platform/ui/web/tag/handler/RestDocumentLinkTagHandler.java

    r15094 r15108  
    44import javax.el.MethodExpression; 
    55import javax.el.ValueExpression; 
    6 import javax.faces.application.Application; 
    7 import javax.faces.component.ActionSource; 
    86import javax.faces.component.UIComponent; 
    97import javax.faces.component.ValueHolder; 
    10 import javax.faces.el.MethodBinding; 
    118 
    129import org.apache.commons.logging.Log; 
    1310import org.apache.commons.logging.LogFactory; 
    1411import org.nuxeo.ecm.platform.ui.web.binding.MethodValueExpression; 
    15 import org.nuxeo.ecm.platform.ui.web.tag.jsf.GenericValueHolderRule; 
    16  
    17 import sun.rmi.runtime.GetThreadPoolAction; 
    1812 
    1913import com.sun.facelets.FaceletContext; 
     
    5347        return mr; 
    5448    } 
    55  
    5649 <