本文整理匯總了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);
}
}
}
}
}
示例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);
}
}
}
}
}
示例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);
}
}
}