Merged V3.2E to HEAD

17533: Fix for unreported issue for events with multiple days (secondary elements) aren't filtered correctly when view is filtered by tags
   17535: ETHREEOH-3411 - Alert appears when loading My Dashboard when Documents I'm editing dashlet is aded and site name was edited with XSS text
   17536: Fixes for various forms issues (ETHREEOH-3398, ETHREEOH-3273, ETHREEOH-3339 & ALFCOM-3587) and reverted accidentally checked in log4j.properties file
            - Folders can now have tags applied in edit form
            - Working copy nodes have their cm:name property set to protected
            - Removed mandatory marker from checkbox control (if you have a boolean there is always a value so no need to mark as mandatory)
            - Potential security issue
   17537: ETHREEOH-1908 - .docx word documents are not displayed in 'Word Documents' category in 'Document List' component. Also fixed some i18n strings.
   17538: Fix for ETHREEOH-3085 and ETHREEOH-3341.
          - NTLM/Kerberos, Tomcat/JBoss5 and JSF client now play nicely on session timeout and display the correct configured page on first login.
          - Tested Share NTLM works correctly with above changes.
   17539: Fix for ETHREEOH-3368: UI does not show multi-valued MLText propertis as localisable
   17543: Merged DEV_TEMPORARY to V3.2
      17529: Fix for ETHREEOH-3186 & ETHREEOH-3187
   17544: Fix for ETHREEOH-1509 - Manage action is not applied for task resources part from My Tasks tab in Office Addins if user already opens another task.
   17547: Fix for ETHREEOH-1709 - AccessDeniedException - Download Servlet not re-directing user to login page.
          - WebDav path now resolved to a noderef as system user - then the permission test for READ_CONTENT is performed directly on the resulting noderef.
   17548: Fix for ETHREEOH-3137 - Tags created for All day event are not displayed in Tags pane.
   17551: Final part of fix for ETHREEOH-2161 includes solution for ETHREEOH-3270.
          - An admin user can now optionally disable the execute of Rules and the Archive of nodes during a folder delete operation.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@18128 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2010-01-19 12:01:16 +00:00
parent 189422edce
commit 2cd5047075
18 changed files with 384 additions and 144 deletions

View File

@@ -65,9 +65,12 @@ public class DeleteSpaceDialog extends BaseDialogBean
private static final String DELETE_CONTENTS = "contents";
private String deleteMode = DELETE_ALL;
private boolean executeRules = true;
private boolean archiveNodes = true;
protected boolean hasMultipleParents = false;
// ------------------------------------------------------------------------------
// Dialog implementation
@@ -99,81 +102,103 @@ public class DeleteSpaceDialog extends BaseDialogBean
if (logger.isDebugEnabled())
logger.debug("Trying to delete space: " + node.getId() + " using delete mode: " + this.deleteMode);
if (DELETE_ALL.equals(this.deleteMode))
try
{
NodeRef nodeRef = node.getNodeRef();
if (this.getNodeService().exists(nodeRef))
if (!this.executeRules)
{
// The node still exists
this.getNodeService().deleteNode(node.getNodeRef());
Repository.getServiceRegistry(context).getRuleService().disableRules();
}
}
else
{
List<ChildAssociationRef> childRefs = this.getNodeService().getChildAssocs(node.getNodeRef(),
ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL);
List<NodeRef> deleteRefs = new ArrayList<NodeRef>(childRefs.size());
for (ChildAssociationRef ref : childRefs)
if (DELETE_ALL.equals(this.deleteMode))
{
NodeRef nodeRef = ref.getChildRef();
NodeRef nodeRef = node.getNodeRef();
// Check the node still exists
if (this.getNodeService().exists(nodeRef))
{
if (DELETE_CONTENTS.equals(this.deleteMode))
if (!this.archiveNodes)
{
deleteRefs.add(nodeRef);
this.getNodeService().addAspect(node.getNodeRef(), ContentModel.ASPECT_TEMPORARY, null);
}
else
this.getNodeService().deleteNode(node.getNodeRef());
}
}
else
{
List<ChildAssociationRef> childRefs = this.getNodeService().getChildAssocs(node.getNodeRef(),
ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL);
List<NodeRef> deleteRefs = new ArrayList<NodeRef>(childRefs.size());
for (ChildAssociationRef ref : childRefs)
{
NodeRef nodeRef = ref.getChildRef();
if (this.getNodeService().exists(nodeRef))
{
// find it's type so we can see if it's a node we are interested in
QName type = this.getNodeService().getType(nodeRef);
// make sure the type is defined in the data dictionary
TypeDefinition typeDef = this.getDictionaryService().getType(type);
if (typeDef != null)
if (DELETE_CONTENTS.equals(this.deleteMode))
{
if (DELETE_FOLDERS.equals(this.deleteMode))
deleteRefs.add(nodeRef);
}
else
{
// find it's type so we can see if it's a node we are interested in
QName type = this.getNodeService().getType(nodeRef);
// make sure the type is defined in the data dictionary
TypeDefinition typeDef = this.getDictionaryService().getType(type);
if (typeDef != null)
{
// look for folder type
if (this.getDictionaryService().isSubClass(type, ContentModel.TYPE_FOLDER) == true &&
this.getDictionaryService().isSubClass(type, ContentModel.TYPE_SYSTEM_FOLDER) == false)
if (DELETE_FOLDERS.equals(this.deleteMode))
{
deleteRefs.add(nodeRef);
// look for folder type
if (this.getDictionaryService().isSubClass(type, ContentModel.TYPE_FOLDER) == true &&
this.getDictionaryService().isSubClass(type, ContentModel.TYPE_SYSTEM_FOLDER) == false)
{
deleteRefs.add(nodeRef);
}
}
}
else if (DELETE_FILES.equals(this.deleteMode))
{
// look for content file type
if (this.getDictionaryService().isSubClass(type, ContentModel.TYPE_CONTENT))
else if (DELETE_FILES.equals(this.deleteMode))
{
deleteRefs.add(nodeRef);
// look for content file type
if (this.getDictionaryService().isSubClass(type, ContentModel.TYPE_CONTENT))
{
deleteRefs.add(nodeRef);
}
}
}
}
}
}
// delete the list of refs
TransactionService txService = Repository.getServiceRegistry(context).getTransactionService();
for (NodeRef nodeRef : deleteRefs)
{
UserTransaction tx = null;
try
{
tx = txService.getNonPropagatingUserTransaction();
tx.begin();
if (!this.archiveNodes)
{
this.getNodeService().addAspect(nodeRef, ContentModel.ASPECT_TEMPORARY, null);
}
this.getNodeService().deleteNode(nodeRef);
tx.commit();
}
catch (Throwable err)
{
try { if (tx != null) {tx.rollback();} } catch (Exception ex) {}
}
}
}
// delete the list of refs
TransactionService txService = Repository.getServiceRegistry(context).getTransactionService();
for (NodeRef nodeRef : deleteRefs)
}
finally
{
if (!this.executeRules)
{
UserTransaction tx = null;
try
{
tx = txService.getNonPropagatingUserTransaction();
tx.begin();
this.getNodeService().deleteNode(nodeRef);
tx.commit();
}
catch (Throwable err)
{
try { if (tx != null) {tx.rollback();} } catch (Exception ex) {}
}
Repository.getServiceRegistry(context).getRuleService().enableRules();
}
}
}
@@ -273,4 +298,36 @@ public class DeleteSpaceDialog extends BaseDialogBean
{
return this.hasMultipleParents;
}
/**
* @return true to execute rules during delete
*/
public boolean getExecuteRules()
{
return this.executeRules;
}
/**
* @param executeRules execute rules during delete
*/
public void setExecuteRules(boolean executeRules)
{
this.executeRules = executeRules;
}
/**
* @return true to archive nodes during delete
*/
public boolean getArchiveNodes()
{
return this.archiveNodes;
}
/**
* @param archiveNodes archive nodes during delete
*/
public void setArchiveNodes(boolean archiveNodes)
{
this.archiveNodes = archiveNodes;
}
}