本文整理匯總了Java中org.alfresco.service.cmr.dictionary.CustomModelException.ModelDoesNotExistException方法的典型用法代碼示例。如果您正苦於以下問題:Java CustomModelException.ModelDoesNotExistException方法的具體用法?Java CustomModelException.ModelDoesNotExistException怎麽用?Java CustomModelException.ModelDoesNotExistException使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.alfresco.service.cmr.dictionary.CustomModelException
的用法示例。
在下文中一共展示了CustomModelException.ModelDoesNotExistException方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: deleteCustomModel
import org.alfresco.service.cmr.dictionary.CustomModelException; //導入方法依賴的package包/類
@Override
public void deleteCustomModel(String modelName)
{
NodeRef nodeRef = getModelNodeRef(modelName);
if (nodeRef == null)
{
throw new CustomModelException.ModelDoesNotExistException(MSG_MODEL_NOT_EXISTS, new Object[] { modelName });
}
final boolean isActive = Boolean.TRUE.equals(nodeService.getProperty(nodeRef, ContentModel.PROP_MODEL_ACTIVE));
if (isActive)
{
throw new CustomModelException.ActiveModelConstraintException(MSG_UNABLE_DELETE_ACTIVE_MODEL);
}
try
{
repoAdminService.undeployModel(modelName);
}
catch (Exception ex)
{
throw new CustomModelException(MSG_UNABLE_MODEL_DELETE, new Object[] { modelName }, ex);
}
}
示例2: deactivateCustomModel
import org.alfresco.service.cmr.dictionary.CustomModelException; //導入方法依賴的package包/類
@Override
public void deactivateCustomModel(final String modelName)
{
CustomModelDefinition customModelDefinition = getCustomModel(modelName);
if (customModelDefinition == null)
{
throw new CustomModelException.ModelDoesNotExistException(MSG_MODEL_NOT_EXISTS, new Object[] { modelName });
}
Collection<TypeDefinition> modelTypes = customModelDefinition.getTypeDefinitions();
Collection<AspectDefinition> modelAspects = customModelDefinition.getAspectDefinitions();
for (CompiledModel cm : getAllCustomM2Models(false))
{
// Ignore type/aspect dependency check within the model itself
if (!customModelDefinition.getName().equals(cm.getModelDefinition().getName()))
{
// Check if the type of the model being deactivated is the parent of another model's type
validateTypeAspectDependency(modelTypes, cm.getTypes());
// Check if the aspect of the model being deactivated is the parent of another model's aspect
validateTypeAspectDependency(modelAspects, cm.getAspects());
}
}
// requiresNewTx = true, in order to catch any exception thrown within
// "DictionaryModelType$DictionaryModelTypeTransactionListener" model validation.
doInTransaction(MSG_UNABLE_MODEL_DEACTIVATE, true, new RetryingTransactionCallback<Void>()
{
public Void execute() throws Exception
{
repoAdminService.deactivateModel(modelName);
return null;
}
});
}
示例3: updateCustomModel
import org.alfresco.service.cmr.dictionary.CustomModelException; //導入方法依賴的package包/類
@Override
public CustomModelDefinition updateCustomModel(String modelFileName, M2Model m2Model, boolean activate)
{
ParameterCheck.mandatory("m2Model", m2Model);
final NodeRef existingModelNodeRef = getModelNodeRef(modelFileName);
if (existingModelNodeRef == null)
{
throw new CustomModelException.ModelDoesNotExistException(MSG_MODEL_NOT_EXISTS, new Object[] { modelFileName });
}
// Existing model property and namespace uri-prefix pair
final boolean isActive = Boolean.TRUE.equals(nodeService.getProperty(existingModelNodeRef, ContentModel.PROP_MODEL_ACTIVE));
final M2Model existingModel = getM2Model(existingModelNodeRef);
final Pair<String, String> existingNamespacePair = getModelNamespaceUriPrefix(existingModel);
// New model namespace uri-prefix pair
final Pair<String, String> newNamespacePair = getModelNamespaceUriPrefix(m2Model);
if (isActive && !(existingNamespacePair.equals(newNamespacePair)))
{
throw new CustomModelException.ActiveModelConstraintException(MSG_NAMESPACE_ACTIVE_MODEL);
}
// if the prefix has changed, then check the new prefix is not in use.
if (!existingNamespacePair.getSecond().equals(newNamespacePair.getSecond()))
{
validateModelNamespacePrefix(newNamespacePair.getSecond());
}
// if the URI has changed, then check the new URI is not in use.
if (!existingNamespacePair.getFirst().equals(newNamespacePair.getFirst()))
{
validateModelNamespaceUri(newNamespacePair.getFirst());
}
/*
* We set the requiresNewTx = true, in order to catch any exception
* thrown within the low level content model management.
* For example, deleting a property of an active model, where the
* property has been applied to a node will cause the
* ModelValidatorImpl to throw an exception.
* Without starting a new TX, we can't catch that exception.
*/
CompiledModel compiledModel = createUpdateModel(modelFileName, m2Model, activate, MSG_UPDATE_MODEL_ERR, true);
CustomModelDefinition modelDef = new CustomModelDefinitionImpl(compiledModel, activate, dictionaryService);
if (logger.isDebugEnabled())
{
logger.debug(modelFileName + " model has been updated.");
}
return modelDef;
}