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


Java M2Model.getConstraint方法代码示例

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


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

示例1: 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

示例2: addCustomConstraintDefinition

import org.alfresco.repo.dictionary.M2Model; //导入方法依赖的package包/类
/**
 * @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#addCustomConstraintDefinition(org.alfresco.service.namespace.QName, java.lang.String, boolean, java.util.List, org.alfresco.module.org_alfresco_module_rm.caveat.RMListOfValuesConstraint.MatchLogic)
 */
public void addCustomConstraintDefinition(QName constraintName, String title, boolean caseSensitive, List<String> allowedValues, MatchLogic matchLogic)
{
    mandatory("constraintName", constraintName);
    mandatoryString("title", title);
    mandatory("allowedValues", allowedValues);
    mandatory("matchLogic", matchLogic);

    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_CONSTRAINT_EXISTS, constraintNameAsPrefixString));
    }

    M2Constraint newCon = deserializedModel.createConstraint(constraintNameAsPrefixString, CUSTOM_CONSTRAINT_TYPE);

    newCon.setTitle(title);
    newCon.createParameter(PARAM_ALLOWED_VALUES, allowedValues);
    newCon.createParameter(PARAM_CASE_SENSITIVE, caseSensitive ? "true" : "false");
    newCon.createParameter(PARAM_MATCH_LOGIC, matchLogic.toString());

    writeCustomContentModel(modelRef, deserializedModel);

    if (logger.isInfoEnabled())
    {
        logger.info("addCustomConstraintDefinition: "+constraintNameAsPrefixString+" (valueCnt: "+allowedValues.size()+")");
    }
}
 
开发者ID:Alfresco,项目名称:records-management-old,代码行数:36,代码来源:RecordsManagementAdminServiceImpl.java

示例3: changeCustomConstraintValues

import org.alfresco.repo.dictionary.M2Model; //导入方法依赖的package包/类
/**
 * @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#changeCustomConstraintValues(org.alfresco.service.namespace.QName, java.util.List)
 */
public void changeCustomConstraintValues(QName constraintName, List<String> newAllowedValues)
{
    mandatory("constraintName", constraintName);
    mandatory("newAllowedValues", newAllowedValues);

    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));
    }

    String type = customConstraint.getType();
    if (type == null ||
        (!type.equals(CUSTOM_CONSTRAINT_TYPE) &&
         !type.equals(CAPATIBILITY_CUSTOM_CONTRAINT_TYPE)))
    {
        throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_UNEXPECTED_TYPE_CONSTRAINT, type, constraintNameAsPrefixString, CUSTOM_CONSTRAINT_TYPE));
    }

    customConstraint.removeParameter(PARAM_ALLOWED_VALUES);
    customConstraint.createParameter(PARAM_ALLOWED_VALUES, newAllowedValues);

    writeCustomContentModel(modelRef, deserializedModel);

    if (logger.isInfoEnabled())
    {
        logger.info("changeCustomConstraintValues: "+constraintNameAsPrefixString+" (valueCnt: "+newAllowedValues.size()+")");
    }
}
 
开发者ID:Alfresco,项目名称:records-management-old,代码行数:38,代码来源:RecordsManagementAdminServiceImpl.java

示例4: changeCustomConstraintTitle

import org.alfresco.repo.dictionary.M2Model; //导入方法依赖的package包/类
/**
 * @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#changeCustomConstraintTitle(org.alfresco.service.namespace.QName, java.lang.String)
 */
public void changeCustomConstraintTitle(QName constraintName, String title)
{
    mandatory("constraintName", constraintName);
    mandatoryString("title", title);

    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));
    }

    String type = customConstraint.getType();
    if ((type == null) || (! type.equals(CUSTOM_CONSTRAINT_TYPE)))
    {

        throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_UNEXPECTED_TYPE_CONSTRAINT, type, constraintNameAsPrefixString, CUSTOM_CONSTRAINT_TYPE));
    }

    customConstraint.setTitle(title);

    writeCustomContentModel(modelRef, deserializedModel);

    if (logger.isInfoEnabled())
    {
        logger.info("changeCustomConstraintTitle: "+constraintNameAsPrefixString+" (title: "+title+")");
    }
}
 
开发者ID:Alfresco,项目名称:records-management-old,代码行数:36,代码来源:RecordsManagementAdminServiceImpl.java


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