mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
. Added link to the associated Working Copy for a locked document to the Document Details page
. Improved performance of "locked" status check for a cached client Node object . Adding missing method to the list of authenticated methods for the CheckoutCheckinService to public-services-security-context.xml git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2509 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -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();
|
||||
}
|
||||
};
|
||||
|
||||
|
@@ -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<String, Boolean> panels = new HashMap<String, Boolean>(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.
|
||||
*/
|
||||
|
@@ -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<QName> aspects = null;
|
||||
private Map<String, Boolean> permissions;
|
||||
private Boolean locked = null;
|
||||
protected QNameNodeMap<String, Object> 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;
|
||||
|
Reference in New Issue
Block a user