当前位置: 首页>>代码示例>>Java>>正文


Java M2Model.createImport方法代码示例

本文整理汇总了Java中org.alfresco.repo.dictionary.M2Model.createImport方法的典型用法代码示例。如果您正苦于以下问题:Java M2Model.createImport方法的具体用法?Java M2Model.createImport怎么用?Java M2Model.createImport使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.alfresco.repo.dictionary.M2Model的用法示例。


在下文中一共展示了M2Model.createImport方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createTestCategories

import org.alfresco.repo.dictionary.M2Model; //导入方法依赖的package包/类
/**
 * Create the categories used in the tests
 */
private void createTestCategories()
{
    // Create the test model
    M2Model model = M2Model.createModel("test:rulecategory");
    model.createNamespace(TEST_NAMESPACE, "test");
    model.createImport(NamespaceService.DICTIONARY_MODEL_1_0_URI, "d");
    model.createImport(NamespaceService.CONTENT_MODEL_1_0_URI, NamespaceService.CONTENT_MODEL_PREFIX);
    
    // Create the region category
    regionCategorisationQName = QName.createQName(TEST_NAMESPACE, "region");
    M2Aspect generalCategorisation = model.createAspect("test:" + regionCategorisationQName.getLocalName());
    generalCategorisation.setParentName("cm:" + ContentModel.ASPECT_CLASSIFIABLE.getLocalName());
    M2Property genCatProp = generalCategorisation.createProperty("test:region");
    genCatProp.setIndexed(true);
    genCatProp.setIndexedAtomically(true);
    genCatProp.setMandatory(true);
    genCatProp.setMultiValued(true);
    genCatProp.setStoredInIndex(true);
    genCatProp.setIndexTokenisationMode(IndexTokenisationMode.TRUE);
    genCatProp.setType("d:" + DataTypeDefinition.CATEGORY.getLocalName());        

    // Save the mode
    dictionaryDAO.putModel(model);
    
    // Create the category value container and root
    catContainer = nodeService.createNode(rootNodeRef, ContentModel.ASSOC_CHILDREN, QName.createQName(TEST_NAMESPACE, "categoryContainer"), ContentModel.TYPE_CONTAINER).getChildRef();
    catRoot = nodeService.createNode(catContainer, ContentModel.ASSOC_CHILDREN, QName.createQName(TEST_NAMESPACE, "categoryRoot"), ContentModel.TYPE_CATEGORYROOT).getChildRef();

    // Create the category values
    catRBase = nodeService.createNode(catRoot, ContentModel.ASSOC_CATEGORIES, QName.createQName(TEST_NAMESPACE, "region"), ContentModel.TYPE_CATEGORY).getChildRef();
    catROne = nodeService.createNode(catRBase, ContentModel.ASSOC_SUBCATEGORIES, QName.createQName(TEST_NAMESPACE, "Europe"), ContentModel.TYPE_CATEGORY).getChildRef();
    catRTwo = nodeService.createNode(catRBase, ContentModel.ASSOC_SUBCATEGORIES, QName.createQName(TEST_NAMESPACE, "RestOfWorld"), ContentModel.TYPE_CATEGORY).getChildRef();
    catRThree = nodeService.createNode(catRTwo, ContentModel.ASSOC_SUBCATEGORIES, QName.createQName(TEST_NAMESPACE, "US"), ContentModel.TYPE_CATEGORY).getChildRef();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:38,代码来源:RuleServiceCoverageTest.java

示例2: createTestModel

import org.alfresco.repo.dictionary.M2Model; //导入方法依赖的package包/类
private void createTestModel()
{
    M2Model model = M2Model.createModel("test:comparepropertyvalueevaluatortest");
    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:" + PROP_TEXT.getLocalName());
    prop1.setMandatory(false);
    prop1.setType("d:" + DataTypeDefinition.TEXT.getLocalName());
    prop1.setMultiValued(false);
    
    M2Property prop2 = testType.createProperty("test:" + PROP_INT.getLocalName());
    prop2.setMandatory(false);
    prop2.setType("d:" + DataTypeDefinition.INT.getLocalName());
    prop2.setMultiValued(false);
    
    M2Property prop3 = testType.createProperty("test:" + PROP_DATETIME.getLocalName());
    prop3.setMandatory(false);
    prop3.setType("d:" + DataTypeDefinition.DATETIME.getLocalName());
    prop3.setMultiValued(false);
    
    M2Property prop4 = testType.createProperty("test:" + PROP_NODEREF.getLocalName());
    prop4.setMandatory(false);
    prop4.setType("d:" + DataTypeDefinition.NODE_REF.getLocalName());
    prop4.setMultiValued(false);

    M2Property prop5 = testType.createProperty("test:" + PROP_MULTI_VALUE.getLocalName());
    prop5.setMandatory(false);
    prop5.setType("d:" + DataTypeDefinition.TEXT.getLocalName());
    prop5.setMultiValued(true);

    dictionaryDAO.putModel(model);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:39,代码来源:ComparePropertyValueEvaluatorTest.java

示例3: createTestModel

import org.alfresco.repo.dictionary.M2Model; //导入方法依赖的package包/类
/**
 * 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);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:64,代码来源:CopyServiceImplTest.java

示例4: testUploadModel_UnsupportedModelElements

import org.alfresco.repo.dictionary.M2Model; //导入方法依赖的package包/类
public void testUploadModel_UnsupportedModelElements() throws Exception
{
    // Note: here we only test a couple of not-supported model elements to check for the correct status code.
    // This test should be removed when we implement the required support

    long timestamp = System.currentTimeMillis();
    final String modelName = getClass().getSimpleName() + timestamp;
    final String prefix = "prefix"+timestamp;
    final String uri = "uriNamespace"+timestamp;
    final String aspectName = prefix + QName.NAMESPACE_PREFIX + "testAspec";
    final String typeName = prefix + QName.NAMESPACE_PREFIX + "testType";
    final String associationName = prefix + QName.NAMESPACE_PREFIX + "testAssociation";

    M2Model model = M2Model.createModel(prefix + QName.NAMESPACE_PREFIX + modelName);
    model.createNamespace(uri, prefix);
    model.setAuthor("John Doe");
    model.createAspect(aspectName);
    model.createImport(NamespaceService.CONTENT_MODEL_1_0_URI, NamespaceService.CONTENT_MODEL_PREFIX);

    M2Type type = model.createType(typeName);
    // Add 'association' not supported yet.
    M2Association association = type.createAssociation(associationName);
    association.setSourceMandatory(false);
    association.setSourceMany(false);
    association.setTargetMandatory(false);
    association.setTargetClassName("cm:content");

    ByteArrayOutputStream xml = new ByteArrayOutputStream();
    model.toXML(xml);
    ZipEntryContext context = new ZipEntryContext(modelName + ".xml", xml.toByteArray());
    File zipFile = createZip(context);

    PostRequest postRequest = buildMultipartPostRequest(zipFile);
    sendRequest(postRequest, 409); // <associations> element is not supported yet

    type.removeAssociation(associationName);
    // Add 'mandatory-aspect' not supported yet.
    type.addMandatoryAspect(aspectName);
    xml = new ByteArrayOutputStream();
    model.toXML(xml);
    context = new ZipEntryContext(modelName + ".xml", xml.toByteArray());
    zipFile = createZip(context);

    postRequest = buildMultipartPostRequest(zipFile);
    sendRequest(postRequest, 409); // <mandatory-aspects> element is not supported yet
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:47,代码来源:CustomModelImportTest.java

示例5: createTestTypes

import org.alfresco.repo.dictionary.M2Model; //导入方法依赖的package包/类
private void createTestTypes()
{
    M2Model model = M2Model.createModel("adm-cat-test:lucenecategory");
    model.createNamespace(TEST_NAMESPACE, "adm-cat-test");
    model.createImport(NamespaceService.DICTIONARY_MODEL_1_0_URI, NamespaceService.DICTIONARY_MODEL_PREFIX);
    model.createImport(NamespaceService.CONTENT_MODEL_1_0_URI, NamespaceService.CONTENT_MODEL_PREFIX);
    
    regionCategorisationQName = QName.createQName(TEST_NAMESPACE, "region");
    M2Aspect generalCategorisation = model.createAspect("adm-cat-test:" + regionCategorisationQName.getLocalName());
    generalCategorisation.setParentName("cm:" + ContentModel.ASPECT_CLASSIFIABLE.getLocalName());
    M2Property genCatProp = generalCategorisation.createProperty("adm-cat-test:region");
    genCatProp.setIndexed(true);
    genCatProp.setIndexedAtomically(true);
    genCatProp.setMandatory(true);
    genCatProp.setMultiValued(true);
    genCatProp.setStoredInIndex(true);
    genCatProp.setIndexTokenisationMode(IndexTokenisationMode.FALSE);
    genCatProp.setType("d:" + DataTypeDefinition.CATEGORY.getLocalName());
    
    assetClassCategorisationQName = QName.createQName(TEST_NAMESPACE, "assetClass");
    M2Aspect assetClassCategorisation = model.createAspect("adm-cat-test:" + assetClassCategorisationQName.getLocalName());
    assetClassCategorisation.setParentName("cm:" + ContentModel.ASPECT_CLASSIFIABLE.getLocalName());
    M2Property acProp = assetClassCategorisation.createProperty("adm-cat-test:assetClass");
    acProp.setIndexed(true);
    acProp.setIndexedAtomically(true);
    acProp.setMandatory(true);
    acProp.setMultiValued(true);
    acProp.setStoredInIndex(true);
    acProp.setIndexTokenisationMode(IndexTokenisationMode.FALSE);
    acProp.setType("d:" + DataTypeDefinition.CATEGORY.getLocalName());
    
    investmentRegionCategorisationQName = QName.createQName(TEST_NAMESPACE, "investmentRegion");
    M2Aspect investmentRegionCategorisation = model.createAspect("adm-cat-test:" + investmentRegionCategorisationQName.getLocalName());
    investmentRegionCategorisation.setParentName("cm:" + ContentModel.ASPECT_CLASSIFIABLE.getLocalName());
    M2Property irProp = investmentRegionCategorisation.createProperty("adm-cat-test:investmentRegion");
    irProp.setIndexed(true);
    irProp.setIndexedAtomically(true);
    irProp.setMandatory(true);
    irProp.setMultiValued(true);
    irProp.setStoredInIndex(true);
    irProp.setIndexTokenisationMode(IndexTokenisationMode.FALSE);
    irProp.setType("d:" + DataTypeDefinition.CATEGORY.getLocalName());
    
    marketingRegionCategorisationQName = QName.createQName(TEST_NAMESPACE, "marketingRegion");
    M2Aspect marketingRegionCategorisation = model.createAspect("adm-cat-test:" + marketingRegionCategorisationQName.getLocalName());
    marketingRegionCategorisation.setParentName("cm:" + ContentModel.ASPECT_CLASSIFIABLE.getLocalName());
    M2Property mrProp =  marketingRegionCategorisation.createProperty("adm-cat-test:marketingRegion");
    mrProp.setIndexed(true);
    mrProp.setIndexedAtomically(true);
    mrProp.setMandatory(true);
    mrProp.setMultiValued(true);
    mrProp.setStoredInIndex(true);
    mrProp.setIndexTokenisationMode(IndexTokenisationMode.FALSE);
    mrProp.setType("d:" + DataTypeDefinition.CATEGORY.getLocalName());

    dictionaryDAO.putModel(model);
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:58,代码来源:ADMLuceneCategoryTest.java


注:本文中的org.alfresco.repo.dictionary.M2Model.createImport方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。