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


Java M2Model类代码示例

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


M2Model类属于org.alfresco.repo.dictionary包,在下文中一共展示了M2Model类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


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