Test for FreezeService

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@43581 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Tuna Aksoy
2012-11-13 16:42:44 +00:00
parent d8ab355a05
commit ceb945aa82
3 changed files with 172 additions and 47 deletions

View File

@@ -18,6 +18,7 @@
*/
package org.alfresco.module.org_alfresco_module_rm.freeze;
import java.util.Date;
import java.util.Set;
import org.alfresco.service.cmr.repository.NodeRef;
@@ -153,4 +154,20 @@ public interface FreezeService
* @return true if the given nodeRef has frozen children, false otherwise
*/
boolean hasFrozenChildren(NodeRef nodeRef);
/**
* Gets the date of the freeze for the given node, null if the node is not frozen
*
* @param nodeRef The nodeRef for which the date check will be performed
* @return Date The of the freeze or null
*/
Date getFreezeDate(NodeRef nodeRef);
/**
* Gets the initiator of the freeze for the given node, null if the node is not frozen
*
* @param nodeRef The nodeRef for which the initiator check will be performed
* @return String The initiator of the freeze or null
*/
String getFreezeInitiator(NodeRef nodeRef);
}

View File

@@ -489,6 +489,50 @@ public class FreezeServiceImpl implements FreezeService,
return getFrozen(nodeRef).size() > 0 ? true : false;
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService#getFreezeDate(org.alfresco.service.cmr.repository.NodeRef)
*/
@Override
public Date getFreezeDate(NodeRef nodeRef)
{
ParameterCheck.mandatory("nodeRef", nodeRef);
if (isFrozen(nodeRef))
{
Serializable property = nodeService.getProperty(nodeRef, PROP_FROZEN_AT);
if (property != null)
{
return (Date) property;
}
}
return null;
}
/**
* @see org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService#getFreezeInitiator(org.alfresco.service.cmr.repository.NodeRef)
*/
@Override
public String getFreezeInitiator(NodeRef nodeRef)
{
ParameterCheck.mandatory("nodeRef", nodeRef);
if (isFrozen(nodeRef))
{
Serializable property = nodeService.getProperty(nodeRef, PROP_FROZEN_BY);
if (property != null)
{
return (String) property;
}
}
return null;
}
/**
* Helper Methods
*/
/**
* Creates a hold using the given nodeRef and reason
*