本文整理汇总了Java中org.alfresco.repo.dictionary.M2Model类的典型用法代码示例。如果您正苦于以下问题:Java M2Model类的具体用法?Java M2Model怎么用?Java M2Model使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
M2Model类属于org.alfresco.repo.dictionary包,在下文中一共展示了M2Model类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: setUp
import org.alfresco.repo.dictionary.M2Model; //导入依赖的package包/类
protected void setUp() throws Exception
{
super.setUp();
ctx = ApplicationContextHelper.getApplicationContext();
transactionService = (TransactionService)ctx.getBean("transactionComponent");
contentService = (ContentService)ctx.getBean("contentService");
nodeService = (NodeService)ctx.getBean("nodeService");
scriptService = (ScriptService)ctx.getBean("scriptService");
serviceRegistry = (ServiceRegistry)ctx.getBean("ServiceRegistry");
this.authenticationComponent = (AuthenticationComponent)ctx.getBean("authenticationComponent");
this.authenticationComponent.setSystemUserAsCurrentUser();
DictionaryDAO dictionaryDao = (DictionaryDAO)ctx.getBean("dictionaryDAO");
// load the system model
ClassLoader cl = BaseNodeServiceTest.class.getClassLoader();
InputStream modelStream = cl.getResourceAsStream("alfresco/model/contentModel.xml");
assertNotNull(modelStream);
M2Model model = M2Model.createModel(modelStream);
dictionaryDao.putModel(model);
// load the test model
modelStream = cl.getResourceAsStream("org/alfresco/repo/node/BaseNodeServiceTest_model.xml");
assertNotNull(modelStream);
model = M2Model.createModel(modelStream);
dictionaryDao.putModel(model);
DictionaryComponent dictionary = new DictionaryComponent();
dictionary.setDictionaryDAO(dictionaryDao);
BaseNodeServiceTest.loadModel(ctx);
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:33,代码来源:RhinoScriptTest.java
示例2: loadModel
import org.alfresco.repo.dictionary.M2Model; //导入依赖的package包/类
/**
* Loads the test model required for building the node graphs
*/
public static DictionaryService loadModel(ApplicationContext applicationContext)
{
DictionaryDAO dictionaryDao = (DictionaryDAO) applicationContext.getBean("dictionaryDAO");
// load the system model
ClassLoader cl = BaseNodeServiceTest.class.getClassLoader();
InputStream modelStream = cl.getResourceAsStream("alfresco/model/contentModel.xml");
assertNotNull(modelStream);
M2Model model = M2Model.createModel(modelStream);
dictionaryDao.putModel(model);
// load the test model
modelStream = cl.getResourceAsStream("org/alfresco/repo/node/BaseNodeServiceTest_model.xml");
assertNotNull(modelStream);
model = M2Model.createModel(modelStream);
dictionaryDao.putModel(model);
DictionaryComponent dictionary = new DictionaryComponent();
dictionary.setDictionaryDAO(dictionaryDao);
// done
return dictionary;
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:24,代码来源:BaseNodeServiceTest.java
示例3: onSetUpInTransaction
import org.alfresco.repo.dictionary.M2Model; //导入依赖的package包/类
@Override
protected void onSetUpInTransaction() throws Exception
{
super.onSetUpInTransaction();
mlAwareNodeService = (NodeService) applicationContext.getBean("mlAwareNodeService");
nodeService = (NodeService) applicationContext.getBean("nodeService");
dictionaryDAO = (DictionaryDAO) applicationContext.getBean("dictionaryDAO");
authenticationComponent = (AuthenticationComponent) applicationContext.getBean("authenticationComponent");
authenticationComponent.setSystemUserAsCurrentUser();
ClassLoader cl = BaseNodeServiceTest.class.getClassLoader();
InputStream modelStream = cl.getResourceAsStream("org/alfresco/repo/node/NodeRefTestModel.xml");
assertNotNull(modelStream);
M2Model model = M2Model.createModel(modelStream);
dictionaryDAO.putModel(model);
StoreRef storeRef = nodeService.createStore(StoreRef.PROTOCOL_WORKSPACE, "Test_" + System.currentTimeMillis());
rootNodeRef = nodeService.getRootNode(storeRef);
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:23,代码来源:NodeRefPropertyMethodInterceptorTest.java
示例4: loadModel
import org.alfresco.repo.dictionary.M2Model; //导入依赖的package包/类
/**
* Loads the test model required for building the node graphs
*/
public static DictionaryService loadModel(ApplicationContext applicationContext)
{
DictionaryDAO dictionaryDao = (DictionaryDAO) applicationContext.getBean("dictionaryDAO");
// load the system model
ClassLoader cl = PerformanceNodeServiceTest.class.getClassLoader();
InputStream modelStream = cl.getResourceAsStream("alfresco/model/contentModel.xml");
assertNotNull(modelStream);
M2Model model = M2Model.createModel(modelStream);
dictionaryDao.putModel(model);
// load the test model
modelStream = cl.getResourceAsStream("org/alfresco/repo/node/BaseNodeServiceTest_model.xml");
assertNotNull(modelStream);
model = M2Model.createModel(modelStream);
dictionaryDao.putModel(model);
DictionaryComponent dictionary = new DictionaryComponent();
dictionary.setDictionaryDAO(dictionaryDao);
return dictionary;
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:26,代码来源:PerformanceNodeServiceTest.java
示例5: loadModel
import org.alfresco.repo.dictionary.M2Model; //导入依赖的package包/类
private void loadModel(Map<String, M2Model> modelMap, HashSet<String> loadedModels, M2Model model)
{
String modelName = model.getName();
if (loadedModels.contains(modelName) == false)
{
for (M2Namespace importNamespace : model.getImports())
{
M2Model importedModel = modelMap.get(importNamespace.getUri());
if (importedModel != null)
{
// Ensure that the imported model is loaded first
loadModel(modelMap, loadedModels, importedModel);
}
}
dictionaryDAO.putModelIgnoringConstraints(model);
loadedModels.add(modelName);
}
}
开发者ID:Alfresco,项目名称:alfresco-solrclient,代码行数:21,代码来源:SOLRAPIClientTest.java
示例6: updateModel
import org.alfresco.repo.dictionary.M2Model; //导入依赖的package包/类
private CustomModelDefinition updateModel(ModelDetails modelDetails, String errorMsg)
{
M2Model m2Model = convertToM2Model(modelDetails);
try
{
CustomModelDefinition modelDef = customModelService.updateCustomModel(modelDetails.getModel().getName(), m2Model, modelDetails.isActive());
return modelDef;
}
catch (CustomModelConstraintException mce)
{
throw new ConstraintViolatedException(mce.getMessage());
}
catch (InvalidCustomModelException iex)
{
throw new InvalidArgumentException(iex.getMessage());
}
catch (Exception ex)
{
if (ex.getMessage() != null)
{
errorMsg = ex.getMessage();
}
throw new ApiException(errorMsg, ex);
}
}
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:26,代码来源:CustomModelsImpl.java
示例7: overrideVersionableAspectProperties
import org.alfresco.repo.dictionary.M2Model; //导入依赖的package包/类
protected void overrideVersionableAspectProperties(ApplicationContext ctx)
{
final DictionaryDAO dictionaryDAO = (DictionaryDAO) ctx.getBean("dictionaryDAO");
dictionaryDAO.removeModel(QName.createQName("cm:contentmodel"));
M2Model contentModel = M2Model.createModel(getClass().getClassLoader().getResourceAsStream("alfresco/model/contentModel.xml"));
M2Aspect versionableAspect = contentModel.getAspect("cm:versionable");
M2Property prop = versionableAspect.getProperty("cm:initialVersion");
prop.setDefaultValue(Boolean.FALSE.toString());
prop = versionableAspect.getProperty("cm:autoVersion");
prop.setDefaultValue(Boolean.FALSE.toString());
prop = versionableAspect.getProperty("cm:autoVersionOnUpdateProps");
prop.setDefaultValue(Boolean.FALSE.toString());
dictionaryDAO.putModel(contentModel);
}
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:17,代码来源:AbstractEnterpriseOpenCMISTCKTest.java
示例8: putModel
import org.alfresco.repo.dictionary.M2Model; //导入依赖的package包/类
/**
* @param model M2Model
* @return boolean
*/
public boolean putModel(M2Model model)
{
Set<String> errors = validateModel(model);
if(errors.size() == 0)
{
modelErrors.remove(model.getName());
dictionaryDAO.putModelIgnoringConstraints(model);
return true;
}
else
{
if(!modelErrors.containsKey(model.getName()))
{
modelErrors.put(model.getName(), errors);
log.warn(errors.iterator().next());
}
return false;
}
}
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:25,代码来源:AlfrescoSolrDataModel.java
示例9: loadModel
import org.alfresco.repo.dictionary.M2Model; //导入依赖的package包/类
private void loadModel(Map<String, M2Model> modelMap, HashSet<String> loadedModels, M2Model model)
{
String modelName = model.getName();
if (loadedModels.contains(modelName) == false)
{
for (M2Namespace importNamespace : model.getImports())
{
M2Model importedModel = modelMap.get(importNamespace.getUri());
if (importedModel != null)
{
// Ensure that the imported model is loaded first
loadModel(modelMap, loadedModels, importedModel);
}
}
if (this.infoSrv.putModel(model))
{
loadedModels.add(modelName);
}
log.info("Loading model " + model.getName());
}
}
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:24,代码来源:ModelTracker.java
示例10: putModel
import org.alfresco.repo.dictionary.M2Model; //导入依赖的package包/类
/**
* @param model
*/
public boolean putModel(M2Model model)
{
Set<String> errors = validateModel(model);
if(errors.size() == 0)
{
modelErrors.remove(model.getName());
dictionaryDAO.putModelIgnoringConstraints(model);
return true;
}
else
{
if(!modelErrors.containsKey(model.getName()))
{
modelErrors.put(model.getName(), errors);
log.warn(errors.iterator().next());
}
return false;
}
}
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:24,代码来源:AlfrescoSolrDataModel.java
示例11: loadModel
import org.alfresco.repo.dictionary.M2Model; //导入依赖的package包/类
/**
* Loads a model (and its dependents) if it does not exist in the list of loaded models.
*
* @param modelMap
* a map of the models to be loaded
* @param loadedModels
* the list of models already loaded
* @param model
* the model to try and load
*/
private void loadModel(Map<String, M2Model> modelMap, HashSet<String> loadedModels, M2Model model)
{
String modelName = model.getName();
if (loadedModels.contains(modelName) == false)
{
for (M2Namespace importNamespace : model.getImports())
{
M2Model importedModel = modelMap.get(importNamespace.getUri());
if (importedModel != null)
{
// Ensure that the imported model is loaded first
loadModel(modelMap, loadedModels, importedModel);
}
}
AlfrescoSolrDataModel.getInstance(id).putModel(model);
loadedModels.add(modelName);
}
}
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:31,代码来源:AlfrescoDataType.java
示例12: loadModel
import org.alfresco.repo.dictionary.M2Model; //导入依赖的package包/类
private void loadModel(Map<String, M2Model> modelMap, HashSet<String> loadedModels, M2Model model)
{
String modelName = model.getName();
if (loadedModels.contains(modelName) == false)
{
for (M2Namespace importNamespace : model.getImports())
{
M2Model importedModel = modelMap.get(importNamespace.getUri());
if (importedModel != null)
{
// Ensure that the imported model is loaded first
loadModel(modelMap, loadedModels, importedModel);
}
}
if(this.infoSrv.putModel(model))
{
loadedModels.add(modelName);
}
log.info("Loading model " + model.getName());
}
}
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:24,代码来源:CoreTracker.java
示例13: writeCustomContentModel
import org.alfresco.repo.dictionary.M2Model; //导入依赖的package包/类
private void writeCustomContentModel(M2Model deserializedModel)
{
ContentWriter writer = contentService.getWriter(RM_CUSTOM_MODEL_NODE_REF,
ContentModel.TYPE_CONTENT, true);
writer.setMimetype(MimetypeMap.MIMETYPE_XML);
writer.setEncoding("UTF-8");
ByteArrayOutputStream baos = new ByteArrayOutputStream();
deserializedModel.toXML(baos);
String updatedModelXml;
try
{
updatedModelXml = baos.toString("UTF-8");
writer.putContent(updatedModelXml);
// putContent closes all resources.
// so we don't have to.
} catch (UnsupportedEncodingException uex)
{
throw new AlfrescoRuntimeException("Exception when writing custom model xml.", uex);
}
}
开发者ID:Alfresco,项目名称:records-management-old,代码行数:23,代码来源:ApplyFixMob1573Get.java
示例14: writeCustomContentModel
import org.alfresco.repo.dictionary.M2Model; //导入依赖的package包/类
private void writeCustomContentModel(M2Model deserializedModel)
{
ContentWriter writer = this.contentService.getWriter(RM_CUSTOM_MODEL_NODE_REF,
ContentModel.TYPE_CONTENT, true);
writer.setMimetype(MimetypeMap.MIMETYPE_XML);
writer.setEncoding("UTF-8");
ByteArrayOutputStream baos = new ByteArrayOutputStream();
deserializedModel.toXML(baos);
String updatedModelXml;
try
{
updatedModelXml = baos.toString("UTF-8");
writer.putContent(updatedModelXml);
// putContent closes all resources.
// so we don't have to.
} catch (UnsupportedEncodingException uex)
{
throw new AlfrescoRuntimeException("Exception when writing custom model xml.", uex);
}
}
开发者ID:Alfresco,项目名称:records-management-old,代码行数:23,代码来源:ApplyDodCertModelFixesGet.java
示例15: findProperty
import org.alfresco.repo.dictionary.M2Model; //导入依赖的package包/类
/**
*
* @param propQName
* @param deserializedModel
* @return
*/
private M2Property findProperty(QName propQName, M2Model deserializedModel)
{
List<M2Aspect> aspects = deserializedModel.getAspects();
// Search through the aspects looking for the custom property
for (M2Aspect aspect : aspects)
{
for (M2Property prop : aspect.getProperties())
{
if (propQName.toPrefixString(getNamespaceService()).equals(prop.getName()))
{
return prop;
}
}
}
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_CUSTOM_PROP_EXIST, propQName));
}
开发者ID:Alfresco,项目名称:records-management-old,代码行数:23,代码来源:RecordsManagementAdminServiceImpl.java
示例16: removeCustomConstraintDefinition
import org.alfresco.repo.dictionary.M2Model; //导入依赖的package包/类
/**
* @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#removeCustomConstraintDefinition(org.alfresco.service.namespace.QName)
*/
public void removeCustomConstraintDefinition(QName constraintName)
{
mandatory("constraintName", constraintName);
NodeRef modelRef = getCustomModelRef(constraintName.getNamespaceURI());
M2Model deserializedModel = readCustomContentModel(modelRef);
String constraintNameAsPrefixString = constraintName.toPrefixString(getNamespaceService());
M2Constraint customConstraint = deserializedModel.getConstraint(constraintNameAsPrefixString);
if (customConstraint == null)
{
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_CANNOT_FIND_CONSTRAINT, constraintNameAsPrefixString));
}
deserializedModel.removeConstraint(constraintNameAsPrefixString);
writeCustomContentModel(modelRef, deserializedModel);
if (logger.isInfoEnabled())
{
logger.info("deleteCustomConstraintDefinition: "+constraintNameAsPrefixString);
}
}
开发者ID:Alfresco,项目名称:records-management-old,代码行数:29,代码来源:RecordsManagementAdminServiceImpl.java
示例17: writeCustomContentModel
import org.alfresco.repo.dictionary.M2Model; //导入依赖的package包/类
/**
* Updates the content of the custom model
*
* @param modelRef The node reference of the model
* @param deserializedModel The deserialized model
*/
protected void writeCustomContentModel(NodeRef modelRef, M2Model deserializedModel)
{
ContentWriter writer = getContentService().getWriter(modelRef, ContentModel.TYPE_CONTENT, true);
writer.setMimetype(MimetypeMap.MIMETYPE_XML);
writer.setEncoding("UTF-8");
ByteArrayOutputStream baos = new ByteArrayOutputStream();
deserializedModel.toXML(baos);
String updatedModelXml;
try
{
updatedModelXml = baos.toString("UTF-8");
writer.putContent(updatedModelXml);
// putContent closes all resources.
// so we don't have to.
}
catch (UnsupportedEncodingException uex)
{
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_ERROR_WRITE_CUSTOM_MODEL, modelRef.toString()), uex);
}
}
开发者ID:Alfresco,项目名称:records-management-old,代码行数:29,代码来源:RecordsManagementAdminBase.java
示例18: loadTestModel
import org.alfresco.repo.dictionary.M2Model; //导入依赖的package包/类
protected void loadTestModel()
{
ClassLoader cl = BaseNodeServiceTest.class.getClassLoader();
InputStream modelStream = cl.getResourceAsStream("org/alfresco/repo/search/impl/MetadataQueryTest_model.xml");
assertNotNull(modelStream);
model = M2Model.createModel(modelStream);
dictionaryDAO.registerListener(this);
dictionaryDAO.reset();
assertNotNull(dictionaryDAO.getClass(TEST_SUPER_CONTENT_TYPE));
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:11,代码来源:DBQueryTest.java
示例19: 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
示例20: setUp
import org.alfresco.repo.dictionary.M2Model; //导入依赖的package包/类
protected void setUp() throws Exception
{
ctx = ApplicationContextHelper.getApplicationContext();
DictionaryDAO dictionaryDao = (DictionaryDAO) ctx.getBean("dictionaryDAO");
// load the system model
ClassLoader cl = BaseNodeServiceTest.class.getClassLoader();
InputStream modelStream = cl.getResourceAsStream("alfresco/model/systemModel.xml");
assertNotNull(modelStream);
M2Model model = M2Model.createModel(modelStream);
dictionaryDao.putModel(model);
// load the test model
modelStream = cl.getResourceAsStream("org/alfresco/repo/node/BaseNodeServiceTest_model.xml");
assertNotNull(modelStream);
model = M2Model.createModel(modelStream);
dictionaryDao.putModel(model);
nodeService = (NodeService) ctx.getBean("dbNodeService");
transactionService = (TransactionService) ctx.getBean("transactionComponent");
this.authenticationComponent = (AuthenticationComponent) ctx.getBean("authenticationComponent");
this.authenticationComponent.setSystemUserAsCurrentUser();
// create a first store directly
UserTransaction tx = transactionService.getUserTransaction();
tx.begin();
StoreRef storeRef = nodeService.createStore(StoreRef.PROTOCOL_WORKSPACE, "Test_" + System.currentTimeMillis());
rootNodeRef = nodeService.getRootNode(storeRef);
tx.commit();
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:30,代码来源:ConcurrentNodeServiceSearchTest.java
注:本文中的org.alfresco.repo.dictionary.M2Model类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论