use of org.alfresco.repo.dictionary.M2ChildAssociation in project alfresco-repository by Alfresco.
the class CopyServiceImplTest method createTestModel.
/**
* Creates the test model used by the tests
*/
private void createTestModel() {
M2Model model = M2Model.createModel("test:nodeoperations");
model.createNamespace(TEST_TYPE_NAMESPACE, "test");
model.createImport(NamespaceService.DICTIONARY_MODEL_1_0_URI, NamespaceService.DICTIONARY_MODEL_PREFIX);
model.createImport(NamespaceService.SYSTEM_MODEL_1_0_URI, NamespaceService.SYSTEM_MODEL_PREFIX);
model.createImport(NamespaceService.CONTENT_MODEL_1_0_URI, NamespaceService.CONTENT_MODEL_PREFIX);
M2Type testType = model.createType("test:" + TEST_TYPE_QNAME.getLocalName());
testType.setParentName("cm:" + ContentModel.TYPE_CONTENT.getLocalName());
M2Property prop1 = testType.createProperty("test:" + PROP1_QNAME_MANDATORY.getLocalName());
prop1.setMandatory(true);
prop1.setType("d:" + DataTypeDefinition.TEXT.getLocalName());
prop1.setMultiValued(false);
M2Property prop2 = testType.createProperty("test:" + PROP2_QNAME_OPTIONAL.getLocalName());
prop2.setMandatory(false);
prop2.setType("d:" + DataTypeDefinition.TEXT.getLocalName());
prop2.setMandatory(false);
M2Property propNodeRef = testType.createProperty("test:" + PROP_QNAME_MY_NODE_REF.getLocalName());
propNodeRef.setMandatory(false);
propNodeRef.setType("d:" + DataTypeDefinition.NODE_REF.getLocalName());
propNodeRef.setMandatory(false);
M2Property propAnyNodeRef = testType.createProperty("test:" + PROP_QNAME_MY_ANY.getLocalName());
propAnyNodeRef.setMandatory(false);
propAnyNodeRef.setType("d:" + DataTypeDefinition.ANY.getLocalName());
propAnyNodeRef.setMandatory(false);
M2ChildAssociation childAssoc = testType.createChildAssociation("test:" + TEST_CHILD_ASSOC_TYPE_QNAME.getLocalName());
childAssoc.setTargetClassName("sys:base");
childAssoc.setTargetMandatory(false);
M2Association assoc = testType.createAssociation("test:" + TEST_ASSOC_TYPE_QNAME.getLocalName());
assoc.setTargetClassName("sys:base");
assoc.setTargetMandatory(false);
M2Aspect testAspect = model.createAspect("test:" + TEST_ASPECT_QNAME.getLocalName());
M2Property prop3 = testAspect.createProperty("test:" + PROP3_QNAME_MANDATORY.getLocalName());
prop3.setMandatory(true);
prop3.setType("d:" + DataTypeDefinition.TEXT.getLocalName());
prop3.setMultiValued(false);
M2Property prop4 = testAspect.createProperty("test:" + PROP4_QNAME_OPTIONAL.getLocalName());
prop4.setMandatory(false);
prop4.setType("d:" + DataTypeDefinition.TEXT.getLocalName());
prop4.setMultiValued(false);
M2Aspect testMandatoryAspect = model.createAspect("test:" + TEST_MANDATORY_ASPECT_QNAME.getLocalName());
M2Property prop5 = testMandatoryAspect.createProperty("test:" + PROP5_QNAME_MANDATORY.getLocalName());
prop5.setType("d:" + DataTypeDefinition.TEXT.getLocalName());
prop5.setMandatory(true);
testType.addMandatoryAspect("test:" + TEST_MANDATORY_ASPECT_QNAME.getLocalName());
dictionaryDAO.putModel(model);
}
Aggregations