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


Java M2Constraint.setTitle方法代码示例

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


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

示例1: setConstraintOtherData

import org.alfresco.repo.dictionary.M2Constraint; //导入方法依赖的package包/类
private void setConstraintOtherData(CustomModelConstraint constraint, M2Constraint m2Constraint, String propDataType)
{
    if (m2Constraint.getType() == null)
    {
        throw new InvalidArgumentException("cmm.rest_api.constraint_type_null");
    }

    ConstraintValidator constraintValidator = ConstraintValidator.findByType(m2Constraint.getType());
    if (propDataType != null)
    {
        // Check if the constraint can be used with given data type
        constraintValidator.validateUsage(prefixedStringToQname(propDataType));
    }

    m2Constraint.setTitle(constraint.getTitle());
    m2Constraint.setDescription(constraint.getDescription());
    for (CustomModelNamedValue parameter : constraint.getParameters())
    {
        validateName(parameter.getName(), "cmm.rest_api.constraint_parameter_name_null");
        if (parameter.getListValue() != null)
        {
            if (propDataType != null && "allowedValues".equals(parameter.getName()))
            {
                validateListConstraint(parameter.getListValue(), propDataType);
            }
            m2Constraint.createParameter(parameter.getName(), parameter.getListValue());
        }
        else
        {
            constraintValidator.validate(parameter.getName(), parameter.getSimpleValue());
            m2Constraint.createParameter(parameter.getName(), parameter.getSimpleValue());
        }
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:35,代码来源:CustomModelsImpl.java

示例2: addCustomConstraintDefinition

import org.alfresco.repo.dictionary.M2Constraint; //导入方法依赖的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: changeCustomConstraintTitle

import org.alfresco.repo.dictionary.M2Constraint; //导入方法依赖的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.M2Constraint.setTitle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。