diff --git a/config/alfresco/messages/webclient.properties b/config/alfresco/messages/webclient.properties index 008ead0554..fd0e318d1a 100644 --- a/config/alfresco/messages/webclient.properties +++ b/config/alfresco/messages/webclient.properties @@ -166,6 +166,7 @@ choose_icon=Choose icon security=Security all_formats=All Formats rules_count=Number of rules applied to this Space +working_copy_document=Working Copy # Properties username=User Name diff --git a/source/java/org/alfresco/web/bean/BrowseBean.java b/source/java/org/alfresco/web/bean/BrowseBean.java index a0c3c2cc4b..2e9077e61c 100644 --- a/source/java/org/alfresco/web/bean/BrowseBean.java +++ b/source/java/org/alfresco/web/bean/BrowseBean.java @@ -662,7 +662,7 @@ public class BrowseBean implements IContextListener results = this.searchService.query( Repository.getStoreRef(), - "lucene", query, null, null); + SearchService.LANGUAGE_LUCENE, query, null, null); if (logger.isDebugEnabled()) logger.debug("Search results returned: " + results.length()); @@ -777,7 +777,7 @@ public class BrowseBean implements IContextListener public NodePropertyResolver resolverlocked = new NodePropertyResolver() { public Object get(Node node) { - return Repository.isNodeLocked(node, lockService); + return node.isLocked(); } }; diff --git a/source/java/org/alfresco/web/bean/DocumentDetailsBean.java b/source/java/org/alfresco/web/bean/DocumentDetailsBean.java index 151742098b..0eca57163f 100644 --- a/source/java/org/alfresco/web/bean/DocumentDetailsBean.java +++ b/source/java/org/alfresco/web/bean/DocumentDetailsBean.java @@ -32,6 +32,7 @@ import javax.transaction.UserTransaction; import org.alfresco.error.AlfrescoRuntimeException; import org.alfresco.model.ContentModel; import org.alfresco.repo.content.MimetypeMap; +import org.alfresco.service.cmr.coci.CheckOutCheckInService; import org.alfresco.service.cmr.lock.LockService; import org.alfresco.service.cmr.repository.ContentData; import org.alfresco.service.cmr.repository.CopyService; @@ -85,6 +86,7 @@ public class DocumentDetailsBean protected VersionService versionService; protected OwnableService ownableService; protected NavigationBean navigator; + protected CheckOutCheckInService cociService; private Map panels = new HashMap(5, 1.0f); @@ -1152,7 +1154,7 @@ public class DocumentDetailsBean */ public boolean isLocked() { - return Repository.isNodeLocked(getDocument(), this.lockService); + return getDocument().isLocked(); } /** @@ -1165,6 +1167,25 @@ public class DocumentDetailsBean return getDocument().hasAspect(ContentModel.ASPECT_WORKING_COPY); } + /** + * @return the working copy document Node for this document if found or null if not + */ + public Node getWorkingCopyDocument() + { + Node workingCopyNode = null; + + if (isLocked()) + { + NodeRef workingCopyRef = this.cociService.getWorkingCopy(getDocument().getNodeRef()); + if (workingCopyRef != null) + { + workingCopyNode = new Node(workingCopyRef); + } + } + + return workingCopyNode; + } + /** * Returns whether the current document is a working copy owned by the current User * @@ -1261,6 +1282,16 @@ public class DocumentDetailsBean this.ownableService = ownableService; } + /** + * Sets the checkincheckout service instance the bean should use + * + * @param cociService The CheckOutCheckInService + */ + public void setCheckOutCheckInService(CheckOutCheckInService cociService) + { + this.cociService = cociService; + } + /** * @param navigator The NavigationBean to set. */ diff --git a/source/java/org/alfresco/web/bean/repository/Node.java b/source/java/org/alfresco/web/bean/repository/Node.java index c85756e0e6..7bcc67271d 100644 --- a/source/java/org/alfresco/web/bean/repository/Node.java +++ b/source/java/org/alfresco/web/bean/repository/Node.java @@ -25,7 +25,9 @@ import java.util.Set; import javax.faces.context.FacesContext; +import org.alfresco.model.ContentModel; import org.alfresco.service.ServiceRegistry; +import org.alfresco.service.cmr.lock.LockStatus; import org.alfresco.service.cmr.repository.AssociationRef; import org.alfresco.service.cmr.repository.ChildAssociationRef; import org.alfresco.service.cmr.repository.NodeRef; @@ -54,6 +56,7 @@ public class Node implements Serializable private String id; private Set aspects = null; private Map permissions; + private Boolean locked = null; protected QNameNodeMap properties; protected boolean propsRetrieved = false; protected ServiceRegistry services = null; @@ -379,6 +382,28 @@ public class Node implements Serializable return this.path; } + /** + * @return If the node is currently locked + */ + public final boolean isLocked() + { + if (this.locked == null) + { + this.locked = Boolean.FALSE; + + if (hasAspect(ContentModel.ASPECT_LOCKABLE)) + { + LockStatus lockStatus = getServiceRegistry().getLockService().getLockStatus(getNodeRef()); + if (lockStatus == LockStatus.LOCKED || lockStatus == LockStatus.LOCK_OWNER) + { + locked = Boolean.TRUE; + } + } + } + + return this.locked.booleanValue(); + } + /** * Resets the state of the node to force re-retrieval of the data */ @@ -387,6 +412,7 @@ public class Node implements Serializable this.name = null; this.type = null; this.path = null; + this.locked = null; this.properties.clear(); this.propsRetrieved = false; this.aspects = null; diff --git a/source/web/WEB-INF/faces-config-beans.xml b/source/web/WEB-INF/faces-config-beans.xml index 9079a17621..dec20f7b5e 100644 --- a/source/web/WEB-INF/faces-config-beans.xml +++ b/source/web/WEB-INF/faces-config-beans.xml @@ -783,6 +783,10 @@ ownableService #{OwnableService} + + checkOutCheckInService + #{CheckoutCheckinService} + navigator #{NavigationBean} diff --git a/source/web/jsp/browse/browse.jsp b/source/web/jsp/browse/browse.jsp index 19b154ea30..4373e11e13 100644 --- a/source/web/jsp/browse/browse.jsp +++ b/source/web/jsp/browse/browse.jsp @@ -483,7 +483,7 @@ - + diff --git a/source/web/jsp/dialog/document-details.jsp b/source/web/jsp/dialog/document-details.jsp index 20b76623ad..fec178c4bc 100644 --- a/source/web/jsp/dialog/document-details.jsp +++ b/source/web/jsp/dialog/document-details.jsp @@ -72,7 +72,17 @@
''
-
:
+
+ : +
+ +
+ : + + + +
+
@@ -81,14 +91,14 @@ - - @@ -310,9 +320,6 @@ - -
- @@ -346,6 +353,8 @@ +
+