mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Code refactored (FreezeService & RecordService)
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@43618 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -106,14 +106,6 @@ public interface RecordsManagementService
|
||||
*/
|
||||
boolean isRecordFolder(NodeRef nodeRef);
|
||||
|
||||
/**
|
||||
* Indicates whether the given node is a record or not.
|
||||
*
|
||||
* @param nodeRef node reference
|
||||
* @return boolean true if record, false otherwise
|
||||
*/
|
||||
boolean isRecord(NodeRef nodeRef);
|
||||
|
||||
/**
|
||||
* Indicates whether the given node is a transfer (container) or not.
|
||||
*
|
||||
@@ -495,4 +487,15 @@ public interface RecordsManagementService
|
||||
*/
|
||||
@Deprecated
|
||||
boolean hasFrozenChildren(NodeRef nodeRef);
|
||||
|
||||
/**
|
||||
* Indicates whether the given node is a record or not.
|
||||
*
|
||||
* @param nodeRef node reference
|
||||
* @return boolean true if record, false otherwise
|
||||
*
|
||||
* @deprecated As of 2.1, replaced by {@link RecordService#isRecord(NodeRef)}
|
||||
*/
|
||||
@Deprecated
|
||||
boolean isRecord(NodeRef nodeRef);
|
||||
}
|
||||
|
@@ -595,14 +595,6 @@ public class RecordsManagementServiceImpl implements RecordsManagementService,
|
||||
{
|
||||
return instanceOf(nodeRef, TYPE_RECORD_FOLDER);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementService#isRecord(org.alfresco.service.cmr.repository.NodeRef)
|
||||
*/
|
||||
public boolean isRecord(NodeRef nodeRef)
|
||||
{
|
||||
return this.nodeService.hasAspect(nodeRef, ASPECT_RECORD);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementService#isTransfer(org.alfresco.service.cmr.repository.NodeRef)
|
||||
@@ -1260,4 +1252,14 @@ public class RecordsManagementServiceImpl implements RecordsManagementService,
|
||||
{
|
||||
return serviceRegistry.getFreezeService().hasFrozenChildren(nodeRef);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementService#isRecord(org.alfresco.service.cmr.repository.NodeRef)
|
||||
*/
|
||||
@Override
|
||||
@Deprecated
|
||||
public boolean isRecord(NodeRef nodeRef)
|
||||
{
|
||||
return serviceRegistry.getRecordService().isRecord(nodeRef);
|
||||
}
|
||||
}
|
||||
|
@@ -40,7 +40,9 @@ import org.alfresco.module.org_alfresco_module_rm.event.EventCompletionDetails;
|
||||
import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEvent;
|
||||
import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventType;
|
||||
import org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
|
||||
import org.alfresco.module.org_alfresco_module_rm.record.RecordService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.vital.VitalRecordService;
|
||||
import org.alfresco.repo.action.executer.ActionExecuterAbstractBase;
|
||||
import org.alfresco.service.cmr.action.Action;
|
||||
@@ -114,6 +116,12 @@ public abstract class RMActionExecuterAbstractBase extends ActionExecuterAbstra
|
||||
/** Ownable service **/
|
||||
protected OwnableService ownableService;
|
||||
|
||||
/** Freeze Service */
|
||||
protected FreezeService freezeService;
|
||||
|
||||
/** Record Service */
|
||||
protected RecordService recordService;
|
||||
|
||||
protected LinkedList<AbstractCapability> capabilities = new LinkedList<AbstractCapability>();;
|
||||
|
||||
/** Default constructor */
|
||||
@@ -226,7 +234,27 @@ public abstract class RMActionExecuterAbstractBase extends ActionExecuterAbstra
|
||||
{
|
||||
this.ownableService = ownableService;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set freeze service
|
||||
*
|
||||
* @param freezeService freeze service
|
||||
*/
|
||||
public void setFreezeService(FreezeService freezeService)
|
||||
{
|
||||
this.freezeService = freezeService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set record service
|
||||
*
|
||||
* @param recordService record service
|
||||
*/
|
||||
public void setRecordService(RecordService recordService)
|
||||
{
|
||||
this.recordService = recordService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register with a single capability
|
||||
* @param capability
|
||||
|
@@ -48,189 +48,185 @@ import org.springframework.extensions.surf.util.I18NUtil;
|
||||
*/
|
||||
public class DeclareRecordAction extends RMActionExecuterAbstractBase
|
||||
{
|
||||
/** I18N */
|
||||
private static final String MSG_UNDECLARED_ONLY_RECORDS = "rm.action.undeclared-only-records";
|
||||
private static final String MSG_NO_DECLARE_MAND_PROP = "rm.action.no-declare-mand-prop";
|
||||
|
||||
/** Logger */
|
||||
private static Log logger = LogFactory.getLog(DeclareRecordAction.class);
|
||||
/** I18N */
|
||||
private static final String MSG_UNDECLARED_ONLY_RECORDS = "rm.action.undeclared-only-records";
|
||||
private static final String MSG_NO_DECLARE_MAND_PROP = "rm.action.no-declare-mand-prop";
|
||||
|
||||
/**
|
||||
* @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action,
|
||||
* org.alfresco.service.cmr.repository.NodeRef)
|
||||
*/
|
||||
@Override
|
||||
protected void executeImpl(Action action, NodeRef actionedUponNodeRef)
|
||||
{
|
||||
if (recordsManagementService.isRecord(actionedUponNodeRef) == true)
|
||||
{
|
||||
if (recordsManagementService.isRecordDeclared(actionedUponNodeRef) == false)
|
||||
/** Logger */
|
||||
private static Log logger = LogFactory.getLog(DeclareRecordAction.class);
|
||||
|
||||
/**
|
||||
* @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef)
|
||||
*/
|
||||
@Override
|
||||
protected void executeImpl(Action action, NodeRef actionedUponNodeRef)
|
||||
{
|
||||
if (recordService.isRecord(actionedUponNodeRef) == true)
|
||||
{
|
||||
if (recordService.isDeclared(actionedUponNodeRef) == false)
|
||||
{
|
||||
List<String> missingProperties = new ArrayList<String>(5);
|
||||
// Aspect not already defined - check mandatory properties then add
|
||||
if (mandatoryPropertiesSet(actionedUponNodeRef, missingProperties) == true)
|
||||
{
|
||||
List<String> missingProperties = new ArrayList<String>(5);
|
||||
// Aspect not already defined - check mandatory properties then add
|
||||
if (mandatoryPropertiesSet(actionedUponNodeRef, missingProperties) == true)
|
||||
{
|
||||
// Add the declared aspect
|
||||
Map<QName, Serializable> declaredProps = new HashMap<QName, Serializable>(2);
|
||||
declaredProps.put(PROP_DECLARED_AT, new Date());
|
||||
declaredProps.put(PROP_DECLARED_BY, AuthenticationUtil.getRunAsUser());
|
||||
this.nodeService.addAspect(actionedUponNodeRef, ASPECT_DECLARED_RECORD, declaredProps);
|
||||
|
||||
// remove all owner related rights
|
||||
this.ownableService.setOwner(actionedUponNodeRef, OwnableService.NO_OWNER);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new AlfrescoRuntimeException(buildMissingPropertiesErrorString(missingProperties));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_UNDECLARED_ONLY_RECORDS, actionedUponNodeRef.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
private String buildMissingPropertiesErrorString(List<String> missingProperties)
|
||||
{
|
||||
StringBuilder builder = new StringBuilder(255);
|
||||
builder.append(I18NUtil.getMessage(MSG_NO_DECLARE_MAND_PROP));
|
||||
builder.append(" ");
|
||||
for (String missingProperty : missingProperties)
|
||||
{
|
||||
builder.append(missingProperty)
|
||||
.append(", ");
|
||||
}
|
||||
return builder.toString();
|
||||
}
|
||||
// Add the declared aspect
|
||||
Map<QName, Serializable> declaredProps = new HashMap<QName, Serializable>(2);
|
||||
declaredProps.put(PROP_DECLARED_AT, new Date());
|
||||
declaredProps.put(PROP_DECLARED_BY, AuthenticationUtil.getRunAsUser());
|
||||
this.nodeService.addAspect(actionedUponNodeRef, ASPECT_DECLARED_RECORD, declaredProps);
|
||||
|
||||
/**
|
||||
* Helper method to check whether all the mandatory properties of the node have been set
|
||||
*
|
||||
* @param nodeRef
|
||||
* node reference
|
||||
* @return boolean true if all mandatory properties are set, false otherwise
|
||||
*/
|
||||
private boolean mandatoryPropertiesSet(NodeRef nodeRef, List<String> missingProperties)
|
||||
{
|
||||
boolean result = true;
|
||||
|
||||
Map<QName, Serializable> nodeRefProps = this.nodeService.getProperties(nodeRef);
|
||||
|
||||
QName nodeRefType = this.nodeService.getType(nodeRef);
|
||||
|
||||
TypeDefinition typeDef = this.dictionaryService.getType(nodeRefType);
|
||||
for (PropertyDefinition propDef : typeDef.getProperties().values())
|
||||
{
|
||||
if (propDef.isMandatory() == true)
|
||||
{
|
||||
if (nodeRefProps.get(propDef.getName()) == null)
|
||||
{
|
||||
logMissingProperty(propDef, missingProperties);
|
||||
|
||||
result = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (result != false)
|
||||
{
|
||||
Set<QName> aspects = this.nodeService.getAspects(nodeRef);
|
||||
for (QName aspect : aspects)
|
||||
{
|
||||
AspectDefinition aspectDef = this.dictionaryService.getAspect(aspect);
|
||||
for (PropertyDefinition propDef : aspectDef.getProperties().values())
|
||||
{
|
||||
if (propDef.isMandatory() == true)
|
||||
{
|
||||
if (nodeRefProps.get(propDef.getName()) == null)
|
||||
{
|
||||
logMissingProperty(propDef, missingProperties);
|
||||
|
||||
result = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Log information about missing properties.
|
||||
*
|
||||
* @param propDef property definition
|
||||
* @param missingProperties missing properties
|
||||
*/
|
||||
private void logMissingProperty(PropertyDefinition propDef, List<String> missingProperties)
|
||||
{
|
||||
if (logger.isWarnEnabled())
|
||||
{
|
||||
StringBuilder msg = new StringBuilder();
|
||||
msg.append("Mandatory property missing: ").append(propDef.getName());
|
||||
logger.warn(msg.toString());
|
||||
}
|
||||
missingProperties.add(propDef.getName().toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase#getProtectedAspects()
|
||||
*/
|
||||
@Override
|
||||
public Set<QName> getProtectedAspects()
|
||||
{
|
||||
HashSet<QName> qnames = new HashSet<QName>();
|
||||
qnames.add(ASPECT_DECLARED_RECORD);
|
||||
return qnames;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase#isExecutableImpl(org.alfresco.service.cmr.repository.NodeRef, java.util.Map, boolean)
|
||||
*/
|
||||
@Override
|
||||
protected boolean isExecutableImpl(NodeRef filePlanComponent, Map<String, Serializable> parameters, boolean throwException)
|
||||
{
|
||||
if (recordsManagementService.isRecord(filePlanComponent) == true)
|
||||
{
|
||||
if (recordsManagementService.isRecordDeclared(filePlanComponent) == false)
|
||||
{
|
||||
// Aspect not already defined - check mandatory properties then add
|
||||
List<String> missingProperties = new ArrayList<String>(10);
|
||||
if (mandatoryPropertiesSet(filePlanComponent, missingProperties) == true)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (throwException)
|
||||
{
|
||||
throw new AlfrescoRuntimeException(buildMissingPropertiesErrorString(missingProperties));
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// remove all owner related rights
|
||||
this.ownableService.setOwner(actionedUponNodeRef, OwnableService.NO_OWNER);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
throw new AlfrescoRuntimeException(buildMissingPropertiesErrorString(missingProperties));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (throwException)
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_UNDECLARED_ONLY_RECORDS, actionedUponNodeRef.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
private String buildMissingPropertiesErrorString(List<String> missingProperties)
|
||||
{
|
||||
StringBuilder builder = new StringBuilder(255);
|
||||
builder.append(I18NUtil.getMessage(MSG_NO_DECLARE_MAND_PROP));
|
||||
builder.append(" ");
|
||||
for (String missingProperty : missingProperties)
|
||||
{
|
||||
builder.append(missingProperty).append(", ");
|
||||
}
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to check whether all the mandatory properties of the node have been set
|
||||
*
|
||||
* @param nodeRef node reference
|
||||
* @return boolean true if all mandatory properties are set, false otherwise
|
||||
*/
|
||||
private boolean mandatoryPropertiesSet(NodeRef nodeRef, List<String> missingProperties)
|
||||
{
|
||||
boolean result = true;
|
||||
|
||||
Map<QName, Serializable> nodeRefProps = this.nodeService.getProperties(nodeRef);
|
||||
|
||||
QName nodeRefType = this.nodeService.getType(nodeRef);
|
||||
|
||||
TypeDefinition typeDef = this.dictionaryService.getType(nodeRefType);
|
||||
for (PropertyDefinition propDef : typeDef.getProperties().values())
|
||||
{
|
||||
if (propDef.isMandatory() == true)
|
||||
{
|
||||
if (nodeRefProps.get(propDef.getName()) == null)
|
||||
{
|
||||
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_UNDECLARED_ONLY_RECORDS, filePlanComponent.toString()));
|
||||
logMissingProperty(propDef, missingProperties);
|
||||
|
||||
result = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (result != false)
|
||||
{
|
||||
Set<QName> aspects = this.nodeService.getAspects(nodeRef);
|
||||
for (QName aspect : aspects)
|
||||
{
|
||||
AspectDefinition aspectDef = this.dictionaryService.getAspect(aspect);
|
||||
for (PropertyDefinition propDef : aspectDef.getProperties().values())
|
||||
{
|
||||
if (propDef.isMandatory() == true)
|
||||
{
|
||||
if (nodeRefProps.get(propDef.getName()) == null)
|
||||
{
|
||||
logMissingProperty(propDef, missingProperties);
|
||||
|
||||
result = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Log information about missing properties.
|
||||
*
|
||||
* @param propDef property definition
|
||||
* @param missingProperties missing properties
|
||||
*/
|
||||
private void logMissingProperty(PropertyDefinition propDef, List<String> missingProperties)
|
||||
{
|
||||
if (logger.isWarnEnabled())
|
||||
{
|
||||
StringBuilder msg = new StringBuilder();
|
||||
msg.append("Mandatory property missing: ").append(propDef.getName());
|
||||
logger.warn(msg.toString());
|
||||
}
|
||||
missingProperties.add(propDef.getName().toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase#getProtectedAspects()
|
||||
*/
|
||||
@Override
|
||||
public Set<QName> getProtectedAspects()
|
||||
{
|
||||
HashSet<QName> qnames = new HashSet<QName>();
|
||||
qnames.add(ASPECT_DECLARED_RECORD);
|
||||
return qnames;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase#isExecutableImpl(org.alfresco.service.cmr.repository.NodeRef, java.util.Map, boolean)
|
||||
*/
|
||||
@Override
|
||||
protected boolean isExecutableImpl(NodeRef filePlanComponent, Map<String, Serializable> parameters, boolean throwException)
|
||||
{
|
||||
if (recordService.isRecord(filePlanComponent) == true)
|
||||
{
|
||||
if (recordService.isDeclared(filePlanComponent) == false)
|
||||
{
|
||||
// Aspect not already defined - check mandatory properties then add
|
||||
List<String> missingProperties = new ArrayList<String>(10);
|
||||
if (mandatoryPropertiesSet(filePlanComponent, missingProperties) == true)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
if (throwException)
|
||||
{
|
||||
throw new AlfrescoRuntimeException(buildMissingPropertiesErrorString(missingProperties));
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (throwException)
|
||||
{
|
||||
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_UNDECLARED_ONLY_RECORDS, filePlanComponent.toString()));
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -25,7 +25,6 @@ import java.util.Set;
|
||||
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase;
|
||||
import org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService;
|
||||
import org.alfresco.service.cmr.action.Action;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
@@ -45,19 +44,6 @@ public class EditHoldReasonAction extends RMActionExecuterAbstractBase
|
||||
/** Parameter names */
|
||||
public static final String PARAM_REASON = "reason";
|
||||
|
||||
/** Freeze Service */
|
||||
private FreezeService freezeService;
|
||||
|
||||
/**
|
||||
* Set freeze service
|
||||
*
|
||||
* @param freezeService freeze service
|
||||
*/
|
||||
public void setFreezeService(FreezeService freezeService)
|
||||
{
|
||||
this.freezeService = freezeService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef)
|
||||
*/
|
||||
@@ -110,14 +96,13 @@ public class EditHoldReasonAction extends RMActionExecuterAbstractBase
|
||||
@Override
|
||||
protected boolean isExecutableImpl(NodeRef filePlanComponent, Map<String, Serializable> parameters, boolean throwException)
|
||||
{
|
||||
QName nodeType = this.nodeService.getType(filePlanComponent);
|
||||
if (this.dictionaryService.isSubClass(nodeType, TYPE_HOLD) == true)
|
||||
if (freezeService.isHold(filePlanComponent) == true)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(throwException)
|
||||
if (throwException)
|
||||
{
|
||||
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_HOLD_EDIT_TYPE, TYPE_HOLD.toString(), filePlanComponent.toString()));
|
||||
}
|
||||
|
@@ -25,7 +25,6 @@ import java.util.Set;
|
||||
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase;
|
||||
import org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService;
|
||||
import org.alfresco.service.cmr.action.Action;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
@@ -44,19 +43,6 @@ public class FreezeAction extends RMActionExecuterAbstractBase
|
||||
/** Parameter names */
|
||||
public static final String PARAM_REASON = "reason";
|
||||
|
||||
/** Freeze Service */
|
||||
private FreezeService freezeService;
|
||||
|
||||
/**
|
||||
* Set freeze service
|
||||
*
|
||||
* @param freezeService freeze service
|
||||
*/
|
||||
public void setFreezeService(FreezeService freezeService)
|
||||
{
|
||||
this.freezeService = freezeService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef)
|
||||
*/
|
||||
@@ -95,7 +81,7 @@ public class FreezeAction extends RMActionExecuterAbstractBase
|
||||
@Override
|
||||
protected boolean isExecutableImpl(NodeRef filePlanComponent, Map<String, Serializable> parameters, boolean throwException)
|
||||
{
|
||||
if (this.recordsManagementService.isRecord(filePlanComponent) == true ||
|
||||
if (this.recordService.isRecord(filePlanComponent) == true ||
|
||||
this.recordsManagementService.isRecordFolder(filePlanComponent) == true)
|
||||
{
|
||||
// Get the property values
|
||||
|
@@ -25,7 +25,6 @@ import java.util.Set;
|
||||
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase;
|
||||
import org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService;
|
||||
import org.alfresco.service.cmr.action.Action;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
@@ -41,19 +40,6 @@ public class RelinquishHoldAction extends RMActionExecuterAbstractBase
|
||||
/** I18N */
|
||||
private static final String MSG_NOT_HOLD_TYPE = "rm.action.not-hold-type";
|
||||
|
||||
/** Freeze Service */
|
||||
private FreezeService freezeService;
|
||||
|
||||
/**
|
||||
* Set freeze service
|
||||
*
|
||||
* @param freezeService freeze service
|
||||
*/
|
||||
public void setFreezeService(FreezeService freezeService)
|
||||
{
|
||||
this.freezeService = freezeService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef)
|
||||
*/
|
||||
@@ -87,14 +73,13 @@ public class RelinquishHoldAction extends RMActionExecuterAbstractBase
|
||||
@Override
|
||||
protected boolean isExecutableImpl(NodeRef filePlanComponent, Map<String, Serializable> parameters, boolean throwException)
|
||||
{
|
||||
QName nodeType = this.nodeService.getType(filePlanComponent);
|
||||
if (this.dictionaryService.isSubClass(nodeType, TYPE_HOLD) == true)
|
||||
if (freezeService.isHold(filePlanComponent) == true)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(throwException)
|
||||
if (throwException)
|
||||
{
|
||||
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_NOT_HOLD_TYPE, TYPE_HOLD.toString(), filePlanComponent.toString()));
|
||||
}
|
||||
|
@@ -24,7 +24,6 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase;
|
||||
import org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService;
|
||||
import org.alfresco.service.cmr.action.Action;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
@@ -36,19 +35,6 @@ import org.alfresco.service.namespace.QName;
|
||||
*/
|
||||
public class UnfreezeAction extends RMActionExecuterAbstractBase
|
||||
{
|
||||
/** Freeze Service */
|
||||
private FreezeService freezeService;
|
||||
|
||||
/**
|
||||
* Set freeze service
|
||||
*
|
||||
* @param freezeService freeze service
|
||||
*/
|
||||
public void setFreezeService(FreezeService freezeService)
|
||||
{
|
||||
this.freezeService = freezeService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef)
|
||||
*/
|
||||
@@ -75,7 +61,7 @@ public class UnfreezeAction extends RMActionExecuterAbstractBase
|
||||
@Override
|
||||
protected boolean isExecutableImpl(NodeRef filePlanComponent, Map<String, Serializable> parameters, boolean throwException)
|
||||
{
|
||||
return this.nodeService.hasAspect(filePlanComponent, ASPECT_FROZEN);
|
||||
return freezeService.isFrozen(filePlanComponent);
|
||||
}
|
||||
|
||||
}
|
@@ -39,6 +39,14 @@ public interface RecordService
|
||||
*/
|
||||
Set<QName> getRecordMetaDataAspects();
|
||||
|
||||
/**
|
||||
* Checks whether if the given node reference is a record or not
|
||||
*
|
||||
* @param nodeRef node reference to be checked
|
||||
* @return boolean true if the node reference is a record, false otherwise
|
||||
*/
|
||||
boolean isRecord(NodeRef nodeRef);
|
||||
|
||||
/**
|
||||
* Indicates whether the record is declared
|
||||
*
|
||||
|
@@ -158,6 +158,17 @@ public class RecordServiceImpl implements RecordService, RecordsManagementModel
|
||||
return recordMetaDataAspects;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#isRecord(org.alfresco.service.cmr.repository.NodeRef)
|
||||
*/
|
||||
@Override
|
||||
public boolean isRecord(NodeRef nodeRef)
|
||||
{
|
||||
ParameterCheck.mandatory("nodeRef", nodeRef);
|
||||
|
||||
return nodeService.hasAspect(nodeRef, ASPECT_RECORD);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#isDeclared(org.alfresco.service.cmr.repository.NodeRef)
|
||||
*/
|
||||
@@ -166,7 +177,7 @@ public class RecordServiceImpl implements RecordService, RecordsManagementModel
|
||||
{
|
||||
ParameterCheck.mandatory("record", record);
|
||||
|
||||
return (nodeService.hasAspect(record, ASPECT_DECLARED_RECORD));
|
||||
return nodeService.hasAspect(record, ASPECT_DECLARED_RECORD);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user