Merged 5.0.N (5.0.4) to 5.1.N (5.1.1)

120555: Merged DEV to 5.0.N (5.0.4)
      120544 rneamtu: MNT-13723 : Error message not clear, when de-activating a model dynamically deployed and content still exists.
         - Added externalized error message, generic for both delete and deactivate
         - Do not merge this forward, it will be merged manually
   120572: MNT-13723 : Error message not clear, when de-activating a model dynamically deployed and content still exists.
      - Fixed failing tests
      - Do not merge this forward, it will be merged manually

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.1.N/root@121494 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Ramona Neamtu
2016-01-27 09:58:37 +00:00
parent c6465ea418
commit 8d05a12205
3 changed files with 11 additions and 10 deletions

View File

@@ -27,6 +27,7 @@ cmm.service.download.create_share_ext_err=We couldn''t create a Share extension
cmm.service.download.create_model_copy_err=We couldn''t make a copy of the custom model node. {0} cmm.service.download.create_model_copy_err=We couldn''t make a copy of the custom model node. {0}
cmm.service.download.create_err=We couldn't create download. cmm.service.download.create_err=We couldn't create download.
cmm.service.constraint.default_prop_value_err=Property default value isn't valid for the defined constraint. cmm.service.constraint.default_prop_value_err=Property default value isn't valid for the defined constraint.
cmm.service.model_in_use=Model ''{0}'' is in use and cannot be deleted or deactivated.
# ValueDataTypeValidator messages # ValueDataTypeValidator messages
cmm.value_datatype_validator.unknown_datatype=Property data type ''{0}'' is unknown. cmm.value_datatype_validator.unknown_datatype=Property data type ''{0}'' is unknown.

View File

@@ -84,6 +84,8 @@ public class DictionaryModelType implements ContentServicePolicies.OnContentUpda
/** The name of the lock used to ensure that DictionaryModelType updates do not run on more than one thread/node at the same time. */ /** The name of the lock used to ensure that DictionaryModelType updates do not run on more than one thread/node at the same time. */
private static final QName LOCK_QNAME = QName.createQName(NamespaceService.SYSTEM_MODEL_1_0_URI, "DictionaryModelType"); private static final QName LOCK_QNAME = QName.createQName(NamespaceService.SYSTEM_MODEL_1_0_URI, "DictionaryModelType");
private static final String MODEL_IN_USE = "cmm.service.model_in_use";
/** The dictionary DAO */ /** The dictionary DAO */
private DictionaryDAO dictionaryDAO; private DictionaryDAO dictionaryDAO;
@@ -342,9 +344,9 @@ public class DictionaryModelType implements ContentServicePolicies.OnContentUpda
if (modelName != null) if (modelName != null)
{ {
// Validate model delete against usages - content and/or workflows // Validate model delete against usages - content and/or workflows
if(!modelValidator.canDeleteModel(modelName)) if (!modelValidator.canDeleteModel(modelName))
{ {
throw new AlfrescoRuntimeException("Cannot delete model " + modelName + ", it is being used"); throw AlfrescoRuntimeException.create(MODEL_IN_USE, modelName);
} }
Set<NodeRef> pendingModelDeletes = (Set<NodeRef>)AlfrescoTransactionSupport.getResource(KEY_PENDING_DELETE_MODELS); Set<NodeRef> pendingModelDeletes = (Set<NodeRef>)AlfrescoTransactionSupport.getResource(KEY_PENDING_DELETE_MODELS);
@@ -650,10 +652,9 @@ public class DictionaryModelType implements ContentServicePolicies.OnContentUpda
if (modelName != null) if (modelName != null)
{ {
// Validate model delete against usages - content and/or workflows // Validate model delete against usages - content and/or workflows
if(!modelValidator.canDeleteModel(modelName)) if (!modelValidator.canDeleteModel(modelName))
{ {
throw new AlfrescoRuntimeException("Cannot delete model " throw AlfrescoRuntimeException.create(MODEL_IN_USE, modelName);
+ modelName + ", it is being used");
} }
// invalidate - to force lazy re-init // invalidate - to force lazy re-init

View File

@@ -333,8 +333,7 @@ public class RepoAdminServiceImplTest extends TestCase
// expected // expected
assertTrue( assertTrue(
"Incorrect exception message: " + are.getMessage(), "Incorrect exception message: " + are.getMessage(),
are.getMessage().contains("Cannot delete model") && are.getMessage().contains(" is in use and cannot be deleted or deactivated."));
are.getMessage().contains("it is being used"));
} }
nodeService.deleteNode(node1); nodeService.deleteNode(node1);
@@ -353,7 +352,7 @@ public class RepoAdminServiceImplTest extends TestCase
catch (AlfrescoRuntimeException are) catch (AlfrescoRuntimeException are)
{ {
// expected // expected
assertTrue(are.getMessage().contains("Cannot delete model")); assertTrue(are.getMessage().contains("is in use and cannot be deleted or deactivated."));
} }
nodeService.deleteNode(archiveNode1); nodeService.deleteNode(archiveNode1);
@@ -484,7 +483,7 @@ public class RepoAdminServiceImplTest extends TestCase
{ {
// expected // expected
assertTrue(are.getMessage().contains("Model undeployment failed")); assertTrue(are.getMessage().contains("Model undeployment failed"));
assertTrue(are.getCause().getMessage().contains("Cannot delete model")); assertTrue(are.getCause().getMessage().contains("is in use and cannot be deleted or deactivated."));
} }
nodeService.deleteNode(node1); nodeService.deleteNode(node1);
@@ -504,7 +503,7 @@ public class RepoAdminServiceImplTest extends TestCase
{ {
// expected // expected
assertTrue(are.getMessage().contains("Model undeployment failed")); assertTrue(are.getMessage().contains("Model undeployment failed"));
assertTrue(are.getCause().getMessage().contains("Cannot delete model")); assertTrue(are.getCause().getMessage().contains("is in use and cannot be deleted or deactivated."));
} }
nodeService.deleteNode(archiveNode1); nodeService.deleteNode(archiveNode1);