use of org.alfresco.service.cmr.repository.Period in project records-management by Alfresco.
the class DispositionServiceImpl method calculateAsOfDate.
/**
* Compute the "disposition as of" date (if necessary) for a disposition action and a node.
*
* @param nodeRef The node which the schedule applies to.
* @param dispositionActionDefinition The definition of the disposition action.
* @return The new "disposition as of" date.
*/
@Override
public Date calculateAsOfDate(NodeRef nodeRef, DispositionActionDefinition dispositionActionDefinition) {
// Calculate the asOf date
Date asOfDate = null;
Period period = dispositionActionDefinition.getPeriod();
if (period != null) {
Date contextDate = null;
// Get the period properties value
QName periodProperty = dispositionActionDefinition.getPeriodProperty();
if (periodProperty != null) {
if (RecordsManagementModel.PROP_DISPOSITION_AS_OF.equals(periodProperty)) {
DispositionAction lastCompletedDispositionAction = getLastCompletedDispostionAction(nodeRef);
if (lastCompletedDispositionAction != null) {
contextDate = lastCompletedDispositionAction.getCompletedAt();
} else {
contextDate = (Date) this.nodeService.getProperty(nodeRef, periodProperty);
}
} else {
// doesn't matter if the period property isn't set ... the asOfDate will get updated later
// when the value of the period property is set
contextDate = (Date) this.nodeService.getProperty(nodeRef, periodProperty);
}
} else {
if (period.getPeriodType().equals(Immediately.PERIOD_TYPE)) {
contextDate = (Date) nodeService.getProperty(nodeRef, ContentModel.PROP_CREATED);
} else {
// for now use 'NOW' as the default context date
// TODO set the default period property ... cut off date or last disposition date depending on context
contextDate = new Date();
}
}
// Calculate the as of date
if (contextDate != null) {
asOfDate = period.getNextDate(contextDate);
}
}
return asOfDate;
}
use of org.alfresco.service.cmr.repository.Period in project records-management by Alfresco.
the class BroadcastVitalRecordDefinitionAction method propagateChangeToChildrenOf.
/**
* Propagates the changes to the children of the node specified.
*
* @param actionedUponNodeRef actioned upon node reference
*/
private void propagateChangeToChildrenOf(NodeRef actionedUponNodeRef) {
Map<QName, Serializable> parentProps = getNodeService().getProperties(actionedUponNodeRef);
// parent vital record indicator, default to null if not set
boolean parentVri = false;
Boolean parentVriValue = (Boolean) parentProps.get(PROP_VITAL_RECORD_INDICATOR);
if (parentVriValue != null) {
parentVri = parentVriValue.booleanValue();
}
Period parentReviewPeriod = (Period) parentProps.get(PROP_REVIEW_PERIOD);
List<ChildAssociationRef> assocs = this.getNodeService().getChildAssocs(actionedUponNodeRef, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL);
for (ChildAssociationRef nextAssoc : assocs) {
NodeRef nextChild = nextAssoc.getChildRef();
if (filePlanService.isFilePlanComponent(nextChild) && !getFreezeService().isFrozen(nextChild)) {
// If the child is a record, then the VitalRecord aspect needs to be applied or updated
if (getRecordService().isRecord(nextChild)) {
if (parentVri) {
VitalRecordDefinition vrDefn = getVitalRecordService().getVitalRecordDefinition(nextChild);
Map<QName, Serializable> aspectProps = new HashMap<QName, Serializable>();
aspectProps.put(PROP_REVIEW_AS_OF, vrDefn.getNextReviewDate());
getNodeService().addAspect(nextChild, RecordsManagementModel.ASPECT_VITAL_RECORD, aspectProps);
} else {
getNodeService().removeAspect(nextChild, RecordsManagementModel.ASPECT_VITAL_RECORD);
}
} else // copy the vitalRecordDefinition properties from the parent to the child
{
Map<QName, Serializable> childProps = getNodeService().getProperties(nextChild);
childProps.put(PROP_REVIEW_PERIOD, parentReviewPeriod);
childProps.put(PROP_VITAL_RECORD_INDICATOR, parentVri);
getNodeService().setProperties(nextChild, childProps);
}
// Recurse down the containment hierarchy to all containers
if (!getRecordService().isRecord(nextChild)) {
this.propagateChangeToChildrenOf(nextChild);
}
}
}
}
use of org.alfresco.service.cmr.repository.Period in project SearchServices by Alfresco.
the class LoadAFTSTestData method loadTestSet.
@BeforeClass
public static void loadTestSet() throws Exception {
initAlfrescoCore("schema.xml");
Thread.sleep(1000);
// Root
SolrCore core = h.getCore();
AlfrescoSolrDataModel dataModel = AlfrescoSolrDataModel.getInstance();
dataModel.getNamespaceDAO().removePrefix("");
dataModel.setCMDefaultUri();
rootNodeRef = new NodeRef(new StoreRef("workspace", "SpacesStore"), createGUID());
addStoreRoot(core, dataModel, rootNodeRef, 1, 1, 1, 1);
// 1
n01NodeRef = new NodeRef(new StoreRef("workspace", "SpacesStore"), createGUID());
n01QName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "one");
n01CAR = new ChildAssociationRef(ContentModel.ASSOC_CHILDREN, rootNodeRef, n01QName, n01NodeRef, true, 0);
addNode(core, dataModel, 1, 2, 1, testSuperType, null, getOrderProperties(), null, "andy", new ChildAssociationRef[] { n01CAR }, new NodeRef[] { rootNodeRef }, new String[] { "/" + n01QName.toString() }, n01NodeRef, true);
testNodeRef = n01NodeRef;
// 2
n02NodeRef = new NodeRef(new StoreRef("workspace", "SpacesStore"), createGUID());
n02QName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "two");
n02CAR = new ChildAssociationRef(ContentModel.ASSOC_CHILDREN, rootNodeRef, n02QName, n02NodeRef, true, 0);
addNode(core, dataModel, 1, 3, 1, testSuperType, null, getOrderProperties(), null, "bob", new ChildAssociationRef[] { n02CAR }, new NodeRef[] { rootNodeRef }, new String[] { "/" + n02QName.toString() }, n02NodeRef, true);
// 3
n03NodeRef = new NodeRef(new StoreRef("workspace", "SpacesStore"), createGUID());
n03QName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "three");
n03CAR = new ChildAssociationRef(ContentModel.ASSOC_CHILDREN, rootNodeRef, n03QName, n03NodeRef, true, 0);
addNode(core, dataModel, 1, 4, 1, testSuperType, null, getOrderProperties(), null, "cid", new ChildAssociationRef[] { n03CAR }, new NodeRef[] { rootNodeRef }, new String[] { "/" + n03QName.toString() }, n03NodeRef, true);
// 4
properties04 = new HashMap<QName, PropertyValue>();
content04 = new HashMap<QName, String>();
properties04.putAll(getOrderProperties());
properties04.put(QName.createQName(TEST_NAMESPACE, "text-indexed-stored-tokenised-atomic"), new StringPropertyValue("TEXT THAT IS INDEXED STORED AND TOKENISED ATOMICALLY KEYONE"));
properties04.put(QName.createQName(TEST_NAMESPACE, "text-indexed-unstored-tokenised-atomic"), new StringPropertyValue("TEXT THAT IS INDEXED STORED AND TOKENISED ATOMICALLY KEYUNSTORED"));
properties04.put(QName.createQName(TEST_NAMESPACE, "text-indexed-stored-tokenised-nonatomic"), new StringPropertyValue("TEXT THAT IS INDEXED STORED AND TOKENISED BUT NOT ATOMICALLY KEYTWO"));
properties04.put(QName.createQName(TEST_NAMESPACE, "int-ista"), new StringPropertyValue("1"));
properties04.put(QName.createQName(TEST_NAMESPACE, "long-ista"), new StringPropertyValue("2"));
properties04.put(QName.createQName(TEST_NAMESPACE, "float-ista"), new StringPropertyValue("3.4"));
properties04.put(QName.createQName(TEST_NAMESPACE, "double-ista"), new StringPropertyValue("5.6"));
Calendar c = new GregorianCalendar();
c.setTime(new Date(((new Date().getTime() - 10000))));
Date testDate = c.getTime();
ftsTestDate = testDate;
properties04.put(QName.createQName(TEST_NAMESPACE, "date-ista"), new StringPropertyValue(DefaultTypeConverter.INSTANCE.convert(String.class, testDate)));
properties04.put(QName.createQName(TEST_NAMESPACE, "datetime-ista"), new StringPropertyValue(DefaultTypeConverter.INSTANCE.convert(String.class, testDate)));
properties04.put(QName.createQName(TEST_NAMESPACE, "boolean-ista"), new StringPropertyValue(DefaultTypeConverter.INSTANCE.convert(String.class, Boolean.valueOf(true))));
properties04.put(QName.createQName(TEST_NAMESPACE, "qname-ista"), new StringPropertyValue(DefaultTypeConverter.INSTANCE.convert(String.class, QName.createQName("{wibble}wobble"))));
properties04.put(QName.createQName(TEST_NAMESPACE, "category-ista"), new StringPropertyValue(DefaultTypeConverter.INSTANCE.convert(String.class, new NodeRef(new StoreRef("proto", "id"), "CategoryId"))));
properties04.put(QName.createQName(TEST_NAMESPACE, "noderef-ista"), new StringPropertyValue(DefaultTypeConverter.INSTANCE.convert(String.class, n01NodeRef)));
properties04.put(QName.createQName(TEST_NAMESPACE, "path-ista"), new StringPropertyValue("/" + n03QName.toString()));
properties04.put(QName.createQName(TEST_NAMESPACE, "locale-ista"), new StringPropertyValue(DefaultTypeConverter.INSTANCE.convert(String.class, Locale.UK)));
properties04.put(QName.createQName(TEST_NAMESPACE, "period-ista"), new StringPropertyValue(DefaultTypeConverter.INSTANCE.convert(String.class, new Period("period|12"))));
properties04.put(QName.createQName(TEST_NAMESPACE, "null"), null);
MultiPropertyValue list_0 = new MultiPropertyValue();
list_0.addValue(new StringPropertyValue("one"));
list_0.addValue(new StringPropertyValue("two"));
properties04.put(QName.createQName(TEST_NAMESPACE, "list"), list_0);
MLTextPropertyValue mlText = new MLTextPropertyValue();
mlText.addValue(Locale.ENGLISH, "banana");
mlText.addValue(Locale.FRENCH, "banane");
mlText.addValue(Locale.CHINESE, "香蕉");
mlText.addValue(new Locale("nl"), "banaan");
mlText.addValue(Locale.GERMAN, "banane");
mlText.addValue(new Locale("el"), "μπανάνα");
mlText.addValue(Locale.ITALIAN, "banana");
mlText.addValue(new Locale("ja"), "バナナ");
mlText.addValue(new Locale("ko"), "바나나");
mlText.addValue(new Locale("pt"), "banana");
mlText.addValue(new Locale("ru"), "банан");
mlText.addValue(new Locale("es"), "plátano");
properties04.put(QName.createQName(TEST_NAMESPACE, "ml"), mlText);
MultiPropertyValue list_1 = new MultiPropertyValue();
list_1.addValue(new StringPropertyValue("100"));
list_1.addValue(new StringPropertyValue("anyValueAsString"));
properties04.put(QName.createQName(TEST_NAMESPACE, "any-many-ista"), list_1);
MultiPropertyValue list_2 = new MultiPropertyValue();
list_2.addValue(new ContentPropertyValue(Locale.ENGLISH, 12L, "UTF-16", "text/plain", null));
properties04.put(QName.createQName(TEST_NAMESPACE, "content-many-ista"), list_2);
content04.put(QName.createQName(TEST_NAMESPACE, "content-many-ista"), "multicontent");
MLTextPropertyValue mlText1 = new MLTextPropertyValue();
mlText1.addValue(Locale.ENGLISH, "cabbage");
mlText1.addValue(Locale.FRENCH, "chou");
MLTextPropertyValue mlText2 = new MLTextPropertyValue();
mlText2.addValue(Locale.ENGLISH, "lemur");
mlText2.addValue(new Locale("ru"), "лемур");
MultiPropertyValue list_3 = new MultiPropertyValue();
list_3.addValue(mlText1);
list_3.addValue(mlText2);
properties04.put(QName.createQName(TEST_NAMESPACE, "mltext-many-ista"), list_3);
MultiPropertyValue list_4 = new MultiPropertyValue();
list_4.addValue(null);
properties04.put(QName.createQName(TEST_NAMESPACE, "nullist"), list_4);
n04NodeRef = new NodeRef(new StoreRef("workspace", "SpacesStore"), createGUID());
n04QName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "four");
n04CAR = new ChildAssociationRef(ContentModel.ASSOC_CHILDREN, rootNodeRef, n04QName, n04NodeRef, true, 0);
properties04.put(QName.createQName(TEST_NAMESPACE, "aspectProperty"), new StringPropertyValue(""));
addNode(core, dataModel, 1, 5, 1, testType, new QName[] { testAspect }, properties04, content04, "dave", new ChildAssociationRef[] { n04CAR }, new NodeRef[] { rootNodeRef }, new String[] { "/" + n04QName.toString() }, n04NodeRef, true);
// 5
n05NodeRef = new NodeRef(new StoreRef("workspace", "SpacesStore"), createGUID());
n05QName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "five");
n05CAR = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, n01NodeRef, n05QName, n05NodeRef, true, 0);
addNode(core, dataModel, 1, 6, 1, testSuperType, null, getOrderProperties(), null, "eoin", new ChildAssociationRef[] { n05CAR }, new NodeRef[] { rootNodeRef, n01NodeRef }, new String[] { "/" + n01QName.toString() + "/" + n05QName.toString() }, n05NodeRef, true);
// 6
n06NodeRef = new NodeRef(new StoreRef("workspace", "SpacesStore"), createGUID());
n06QName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "six");
n06CAR = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, n01NodeRef, n06QName, n06NodeRef, true, 0);
addNode(core, dataModel, 1, 7, 1, testSuperType, null, getOrderProperties(), null, "fred", new ChildAssociationRef[] { n06CAR }, new NodeRef[] { rootNodeRef, n01NodeRef }, new String[] { "/" + n01QName.toString() + "/" + n06QName.toString() }, n06NodeRef, true);
// 7
n07NodeRef = new NodeRef(new StoreRef("workspace", "SpacesStore"), createGUID());
n07QName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "seven");
n07CAR = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, n02NodeRef, n07QName, n07NodeRef, true, 0);
addNode(core, dataModel, 1, 8, 1, testSuperType, null, getOrderProperties(), null, "gail", new ChildAssociationRef[] { n07CAR }, new NodeRef[] { rootNodeRef, n02NodeRef }, new String[] { "/" + n02QName.toString() + "/" + n07QName.toString() }, n07NodeRef, true);
// 8
n08NodeRef = new NodeRef(new StoreRef("workspace", "SpacesStore"), createGUID());
n08QName_0 = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "eight-0");
n08QName_1 = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "eight-1");
n08QName_2 = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "eight-2");
n08CAR_0 = new ChildAssociationRef(ContentModel.ASSOC_CHILDREN, rootNodeRef, n08QName_0, n08NodeRef, false, 2);
n08CAR_1 = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, n01NodeRef, n08QName_1, n08NodeRef, false, 1);
n08CAR_2 = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, n02NodeRef, n08QName_2, n08NodeRef, true, 0);
addNode(core, dataModel, 1, 9, 1, testSuperType, null, getOrderProperties(), null, "hal", new ChildAssociationRef[] { n08CAR_0, n08CAR_1, n08CAR_2 }, new NodeRef[] { rootNodeRef, rootNodeRef, n01NodeRef, rootNodeRef, n02NodeRef }, new String[] { "/" + n08QName_0, "/" + n01QName.toString() + "/" + n08QName_1.toString(), "/" + n02QName.toString() + "/" + n08QName_2.toString() }, n08NodeRef, true);
// 9
n09NodeRef = new NodeRef(new StoreRef("workspace", "SpacesStore"), createGUID());
n09QName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "nine");
n09CAR = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, n05NodeRef, n09QName, n09NodeRef, true, 0);
addNode(core, dataModel, 1, 10, 1, testSuperType, null, getOrderProperties(), null, "ian", new ChildAssociationRef[] { n09CAR }, new NodeRef[] { rootNodeRef, n01NodeRef, n05NodeRef }, new String[] { "/" + n01QName.toString() + "/" + n05QName.toString() + "/" + n09QName }, n09NodeRef, true);
// 10
n10NodeRef = new NodeRef(new StoreRef("workspace", "SpacesStore"), createGUID());
n10QName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "ten");
n10CAR = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, n05NodeRef, n10QName, n10NodeRef, true, 0);
addNode(core, dataModel, 1, 11, 1, testSuperType, null, getOrderProperties(), null, "jake", new ChildAssociationRef[] { n10CAR }, new NodeRef[] { rootNodeRef, n01NodeRef, n05NodeRef }, new String[] { "/" + n01QName.toString() + "/" + n05QName.toString() + "/" + n10QName }, n10NodeRef, true);
// 11
n11NodeRef = new NodeRef(new StoreRef("workspace", "SpacesStore"), createGUID());
n11QName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "eleven");
n11CAR = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, n05NodeRef, n11QName, n11NodeRef, true, 0);
addNode(core, dataModel, 1, 12, 1, testSuperType, null, getOrderProperties(), null, "kara", new ChildAssociationRef[] { n11CAR }, new NodeRef[] { rootNodeRef, n01NodeRef, n05NodeRef }, new String[] { "/" + n01QName.toString() + "/" + n05QName.toString() + "/" + n11QName }, n11NodeRef, true);
// 12
n12NodeRef = new NodeRef(new StoreRef("workspace", "SpacesStore"), createGUID());
n12QName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "twelve");
n12CAR = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, n05NodeRef, n12QName, n12NodeRef, true, 0);
addNode(core, dataModel, 1, 13, 1, testSuperType, null, getOrderProperties(), null, "loon", new ChildAssociationRef[] { n12CAR }, new NodeRef[] { rootNodeRef, n01NodeRef, n05NodeRef }, new String[] { "/" + n01QName.toString() + "/" + n05QName.toString() + "/" + n12QName }, n12NodeRef, true);
// 13
n13NodeRef = new NodeRef(new StoreRef("workspace", "SpacesStore"), createGUID());
n13QName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "thirteen");
n13QNameLink = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "link");
n13CAR = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, n12NodeRef, n13QName, n13NodeRef, true, 0);
n13CARLink = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, n02NodeRef, n13QName, n13NodeRef, false, 0);
addNode(core, dataModel, 1, 14, 1, testSuperType, null, getOrderProperties(), null, "mike", new ChildAssociationRef[] { n13CAR, n13CARLink }, new NodeRef[] { rootNodeRef, n01NodeRef, n05NodeRef, n12NodeRef, rootNodeRef, n02NodeRef }, new String[] { "/" + n01QName.toString() + "/" + n05QName.toString() + "/" + n12QName + "/" + n13QName, "/" + n02QName.toString() + "/" + n13QNameLink }, n13NodeRef, true);
// 14
properties14 = new HashMap<QName, PropertyValue>();
properties14.putAll(getOrderProperties());
content14 = new HashMap<QName, String>();
MLTextPropertyValue desc1 = new MLTextPropertyValue();
desc1.addValue(Locale.ENGLISH, "Alfresco tutorial");
desc1.addValue(Locale.US, "Alfresco tutorial");
Date explicitCreatedDate = new Date();
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
properties14.put(ContentModel.PROP_CONTENT, new ContentPropertyValue(Locale.UK, 298L, "UTF-8", "text/plain", null));
content14.put(ContentModel.PROP_CONTENT, "The quick brown fox jumped over the lazy dog and ate the Alfresco Tutorial, in pdf format, along with the following stop words; a an and are" + " as at be but by for if in into is it no not of on or such that the their then there these they this to was will with: " + " and random charcters \u00E0\u00EA\u00EE\u00F0\u00F1\u00F6\u00FB\u00FF");
properties14.put(ContentModel.PROP_DESCRIPTION, desc1);
properties14.put(ContentModel.PROP_CREATED, new StringPropertyValue(DefaultTypeConverter.INSTANCE.convert(String.class, explicitCreatedDate)));
properties14.put(ContentModel.PROP_MODIFIED, new StringPropertyValue(DefaultTypeConverter.INSTANCE.convert(String.class, explicitCreatedDate)));
MLTextPropertyValue title = new MLTextPropertyValue();
title.addValue(Locale.ENGLISH, "English123");
title.addValue(Locale.FRENCH, "French123");
properties14.put(ContentModel.PROP_TITLE, title);
n14NodeRef = new NodeRef(new StoreRef("workspace", "SpacesStore"), createGUID());
n14QName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "fourteen");
n14QNameCommon = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "common");
n14CAR = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, n13NodeRef, n14QName, n14NodeRef, true, 0);
n14CAR_1 = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, n01NodeRef, n14QNameCommon, n14NodeRef, false, 0);
n14CAR_2 = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, n02NodeRef, n14QNameCommon, n14NodeRef, false, 0);
n14CAR_5 = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, n05NodeRef, n14QNameCommon, n14NodeRef, false, 0);
n14CAR_6 = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, n06NodeRef, n14QNameCommon, n14NodeRef, false, 0);
n14CAR_12 = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, n12NodeRef, n14QNameCommon, n14NodeRef, false, 0);
n14CAR_13 = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, n13NodeRef, n14QNameCommon, n14NodeRef, false, 0);
addNode(core, dataModel, 1, 15, 1, ContentModel.TYPE_CONTENT, new QName[] { ContentModel.ASPECT_TITLED }, properties14, content14, "noodle", new ChildAssociationRef[] { n14CAR, n14CAR_1, n14CAR_2, n14CAR_5, n14CAR_6, n14CAR_12, n14CAR_13 }, new NodeRef[] { rootNodeRef, n01NodeRef, n05NodeRef, n12NodeRef, n13NodeRef }, new String[] { "/" + n01QName.toString() + "/" + n05QName.toString() + "/" + n12QName + "/" + n13QName + "/" + n14QName, "/" + n02QName.toString() + "/" + n13QNameLink + "/" + n14QName, "/" + n01QName + "/" + n14QNameCommon, "/" + n02QName + "/" + n14QNameCommon, "/" + n01QName + "/" + n05QName + "/" + n14QNameCommon, "/" + n01QName + "/" + n06QName + "/" + n14QNameCommon, "/" + n01QName + "/" + n05QName + "/" + n12QName + "/" + n14QNameCommon, "/" + n01QName + "/" + n05QName + "/" + n12QName + "/" + n13QName + "/" + n14QNameCommon }, n14NodeRef, true);
// 15
properties15 = new HashMap<QName, PropertyValue>();
properties15.putAll(getOrderProperties());
properties15.put(ContentModel.PROP_MODIFIED, new StringPropertyValue(DefaultTypeConverter.INSTANCE.convert(String.class, explicitCreatedDate)));
content15 = new HashMap<QName, String>();
content15.put(ContentModel.PROP_CONTENT, " ");
n15NodeRef = new NodeRef(new StoreRef("workspace", "SpacesStore"), createGUID());
n15QName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "fifteen");
n15CAR = new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, n13NodeRef, n15QName, n15NodeRef, true, 0);
addNode(core, dataModel, 1, 16, 1, ContentModel.TYPE_THUMBNAIL, null, properties15, content15, "ood", new ChildAssociationRef[] { n15CAR }, new NodeRef[] { rootNodeRef, n01NodeRef, n05NodeRef, n12NodeRef, n13NodeRef }, new String[] { "/" + n01QName.toString() + "/" + n05QName.toString() + "/" + n12QName + "/" + n13QName + "/" + n15QName, "/" + n02QName.toString() + "/" + n13QNameLink + "/" + n14QName }, n15NodeRef, true);
}
use of org.alfresco.service.cmr.repository.Period in project records-management by Alfresco.
the class RecordsManagementSearchBehaviour method updateDispositionActionProperties.
/**
* On update disposition action properties behaviour implementation
*
* @param record record node reference
* @param dispositionAction disposition action
*/
private void updateDispositionActionProperties(NodeRef record, NodeRef dispositionAction) {
Map<QName, Serializable> props = nodeService.getProperties(record);
DispositionAction da = new DispositionActionImpl(recordsManagementServiceRegistry, dispositionAction);
props.put(PROP_RS_DISPOSITION_ACTION_NAME, da.getName());
props.put(PROP_RS_DISPOSITION_ACTION_AS_OF, da.getAsOfDate());
props.put(PROP_RS_DISPOSITION_EVENTS_ELIGIBLE, nodeService.getProperty(dispositionAction, PROP_DISPOSITION_EVENTS_ELIGIBLE));
DispositionActionDefinition daDefinition = da.getDispositionActionDefinition();
if (daDefinition != null) {
Period period = daDefinition.getPeriod();
if (period != null) {
props.put(PROP_RS_DISPOSITION_PERIOD, period.getPeriodType());
props.put(PROP_RS_DISPOSITION_PERIOD_EXPRESSION, period.getExpression());
} else {
props.put(PROP_RS_DISPOSITION_PERIOD, null);
props.put(PROP_RS_DISPOSITION_PERIOD_EXPRESSION, null);
}
}
nodeService.setProperties(record, props);
if (logger.isDebugEnabled()) {
logger.debug("Set rma:recordSearchDispositionActionName for node " + record + " to: " + props.get(PROP_RS_DISPOSITION_ACTION_NAME));
logger.debug("Set rma:recordSearchDispositionActionAsOf for node " + record + " to: " + props.get(PROP_RS_DISPOSITION_ACTION_AS_OF));
logger.debug("Set rma:recordSearchDispositionEventsEligible for node " + record + " to: " + props.get(PROP_RS_DISPOSITION_EVENTS_ELIGIBLE));
logger.debug("Set rma:recordSearchDispositionPeriod for node " + record + " to: " + props.get(PROP_RS_DISPOSITION_PERIOD));
logger.debug("Set rma:recordSearchDispositionPeriodExpression for node " + record + " to: " + props.get(PROP_RS_DISPOSITION_PERIOD_EXPRESSION));
}
}
use of org.alfresco.service.cmr.repository.Period in project records-management by Alfresco.
the class ReviewedActionUnitTest method testReviewRecordWithRecurentReviewPeriod.
/**
* Given a record having a recurent vital record definition
* When I mark the record as reviewed
* Then the review as of date is updated according to the next review period computed by the vital record definition
*/
@Test
public void testReviewRecordWithRecurentReviewPeriod() {
/*
* Given
*/
NodeRef mockedRecord = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, GUID.generate());
when(mockedRecordService.isRecord(mockedRecord)).thenReturn(true);
VitalRecordDefinition mockedVRDef = mock(VitalRecordDefinition.class);
when(mockedVRDef.isEnabled()).thenReturn(true);
when(mockedVitalRecordService.getVitalRecordDefinition(mockedRecord)).thenReturn(mockedVRDef);
Date mockedNextReviewDate = mock(Date.class);
when(mockedVRDef.getNextReviewDate()).thenReturn(mockedNextReviewDate);
Period mockedReviewPeriod = mock(Period.class);
when(mockedReviewPeriod.getPeriodType()).thenReturn(Days.PERIOD_TYPE);
when(mockedVRDef.getReviewPeriod()).thenReturn(mockedReviewPeriod);
/*
* When
*/
reviewedAction.executeImpl(null, mockedRecord);
/*
* Then
*/
verify(mockedNodeService).setProperty(mockedRecord, PROP_REVIEW_AS_OF, mockedNextReviewDate);
}
Aggregations