mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Fixes for AWC-1160 and AWC-1161
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5389 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -31,8 +31,6 @@ import javax.faces.context.ResponseWriter;
|
||||
import javax.faces.el.ValueBinding;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.service.cmr.lock.LockService;
|
||||
import org.alfresco.service.cmr.lock.LockStatus;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.web.app.Application;
|
||||
@@ -117,9 +115,12 @@ public class UILockIcon extends SelfRenderingComponent
|
||||
ref = (NodeRef)val;
|
||||
if (nodeService.exists(ref) && nodeService.hasAspect(ref, ContentModel.ASPECT_LOCKABLE) == true)
|
||||
{
|
||||
LockStatus lockStatus = getLockService(context).getLockStatus(ref);
|
||||
locked = (lockStatus == LockStatus.LOCKED || lockStatus == LockStatus.LOCK_OWNER);
|
||||
lockedOwner = (lockStatus == LockStatus.LOCK_OWNER);
|
||||
String lockerUser = (String)nodeService.getProperty(ref, ContentModel.PROP_LOCK_OWNER);
|
||||
if (lockerUser != null)
|
||||
{
|
||||
locked = true;
|
||||
lockedOwner = (lockerUser.equals(Application.getCurrentUser(context).getUserName()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -195,24 +196,6 @@ public class UILockIcon extends SelfRenderingComponent
|
||||
return service;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use Spring JSF integration to return the Lock Service bean instance
|
||||
*
|
||||
* @param context FacesContext
|
||||
*
|
||||
* @return Lock Service bean instance or throws exception if not found
|
||||
*/
|
||||
private static LockService getLockService(FacesContext context)
|
||||
{
|
||||
LockService service = Repository.getServiceRegistry(context).getLockService();
|
||||
if (service == null)
|
||||
{
|
||||
throw new IllegalStateException("Unable to obtain LockService bean reference.");
|
||||
}
|
||||
|
||||
return service;
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Strongly typed component property accessors
|
||||
|
Reference in New Issue
Block a user