當前位置: 首頁>>代碼示例>>Java>>正文


Java CustomModelException.CustomModelConstraintException方法代碼示例

本文整理匯總了Java中org.alfresco.service.cmr.dictionary.CustomModelException.CustomModelConstraintException方法的典型用法代碼示例。如果您正苦於以下問題:Java CustomModelException.CustomModelConstraintException方法的具體用法?Java CustomModelException.CustomModelConstraintException怎麽用?Java CustomModelException.CustomModelConstraintException使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.alfresco.service.cmr.dictionary.CustomModelException的用法示例。


在下文中一共展示了CustomModelException.CustomModelConstraintException方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: validatePropsDefaultValues

import org.alfresco.service.cmr.dictionary.CustomModelException; //導入方法依賴的package包/類
/**
 * Validates the properties' non-null default values against the defined property constraints.
 *
 * @param compiledModel the compiled model
 * @throws CustomModelException.CustomModelConstraintException if there is constraint evaluation
 *                                                             exception
 */
private void validatePropsDefaultValues(CompiledModel compiledModel)
{
    for (PropertyDefinition propertyDef : compiledModel.getProperties())
    {
        if (propertyDef.getDefaultValue() != null && propertyDef.getConstraints().size() > 0)
        {
            for (ConstraintDefinition constraintDef : propertyDef.getConstraints())
            {
                Constraint constraint = constraintDef.getConstraint();
                try
                {
                    constraint.evaluate(propertyDef.getDefaultValue());
                }
                catch (AlfrescoRuntimeException ex)
                {
                    String message = getRootCauseMsg(ex, false, "cmm.service.constraint.default_prop_value_err");
                    throw new CustomModelException.CustomModelConstraintException(message);
                }
            }
        }
    }
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:30,代碼來源:CustomModelServiceImpl.java

示例2: validateTypeAspectDependency

import org.alfresco.service.cmr.dictionary.CustomModelException; //導入方法依賴的package包/類
private void validateTypeAspectDependency(Collection<? extends ClassDefinition> parentDefs, Collection<? extends ClassDefinition> childDefs)
{
    for (ClassDefinition parentClassDef : parentDefs)
    {
        for (ClassDefinition childClassDef : childDefs)
        {
            if (parentClassDef.getName().equals(childClassDef.getParentName()))
            {
                Object[] msgParams = new Object[] { parentClassDef.getName().toPrefixString(),
                            childClassDef.getName().toPrefixString(),
                            childClassDef.getModel().getName().getLocalName() };

                if (parentClassDef instanceof TypeDefinition)
                {
                    throw new CustomModelException.CustomModelConstraintException(MSG_FAILED_DEACTIVATION_TYPE_DEPENDENCY, msgParams);
                }
                else
                {
                    throw new CustomModelException.CustomModelConstraintException(MSG_FAILED_DEACTIVATION_ASPECT_DEPENDENCY, msgParams);
                }
            }
        }
    }
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:25,代碼來源:CustomModelServiceImpl.java

示例3: compileModel

import org.alfresco.service.cmr.dictionary.CustomModelException; //導入方法依賴的package包/類
@Override
public CompiledModel compileModel(M2Model m2Model)
{
    try
    {
        // Validate model dependencies, constraints and etc. before creating a node
        return m2Model.compile(dictionaryDAO, namespaceDAO, true);
    }
    catch (Exception ex)
    {
        AlfrescoRuntimeException alf = null;
        if (ex instanceof AlfrescoRuntimeException)
        {
            alf = (AlfrescoRuntimeException) ex;
        }
        else
        {
            alf = AlfrescoRuntimeException.create(ex, ex.getMessage());
        }

        Throwable cause = alf.getRootCause();
        String message = null;

        if (cause instanceof DuplicateDefinitionException)
        {
            message = getRootCauseMsg(cause, false, MSG_INVALID_MODEL);
            throw new CustomModelException.CustomModelConstraintException(message);
        }
        else
        {
            message = getRootCauseMsg(cause, true, null);
            throw new CustomModelException.InvalidCustomModelException(MSG_INVALID_MODEL, new Object[] { message }, ex);
        }
    }
}
 
開發者ID:Alfresco,項目名稱:community-edition-old,代碼行數:36,代碼來源:CustomModelServiceImpl.java


注:本文中的org.alfresco.service.cmr.dictionary.CustomModelException.CustomModelConstraintException方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。