mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-07 18:25:23 +00:00
38321: Removing unused installer resource file 38322: ALF-14652: Installation: Friendly message about busy Tomcat SSL port should be more exact - Translations from Gloria 38336: Merged DEV to V4.1-BUG-FIX 38212: ALF-13650: Double byte code white spaces in front and at the end of a file name should be removed as the same behaviour of Single byte code white space. Altered Alfresco.util.trim() in order to support double byte code white spaces. 38337: Fixed ALF-14117 "Unable to load 'old version' wiki page if the title is in Japanese" - Regression: The fixes for ALF-6737 & ALF-8427 provided 2 different solutions for the same problem resulting in a double encoding of the page title 38344: ALF-14674: Deployment installer still doesn't work - Use ${installdir.escape_backslashes} instead of ${installdir} 38345: ALF-14824 - About Share - animation on about dialog corrupts screen on iPad 38400: ALF-14438: Accepted patch from BRANCHES/DEV/BELARUS/... with some modifications and using activiti-naming-conventions 38415: ALF-14808 - patched YUI2.9.0 to handle 'touchend' event to correctly hide pop-up menus when a click/touch occurs outside the menu area. 38417: Fix for ALF-14812 and ALF-14813 - evaluator config for Edit Online and Edit Offline actions. 38421: Fix for ALF-14814 - correct height of previewer area when no preview is available. Also improved the handling of Previewer for iOS - skip the WebPreviewer plugin altogether - this removes the unhelpful message about Installing Adobe Flash etc. 38471: ALF-14674: Deployment installer still doesn't work - Correction to use of ${installdir.escape_backslashes} 38540: Corrected use of ?html and ?js_string operators for element ID 38548: ALF-14829 - Removed delay added iPad specific CSS to increase hit area of actions in main and more menus. 38549: ALF-11861: Maintain the same defuault root of WebDav for Alfresco 4.0 as was in pre-4.0 Removed overriding protocols.rootPath property from installer and enterprise overlay versions of alfresco-global.properties so that correct setting in repository.properties is used. 38575: ALF-14504: PostgreSQL: Schema differences upgrading from 3.4.8 to 4.0.2 Allow for primary key alf_node_assoc_pkey to have an optional '1' at the end of its name (PostgreSQL) - for upgrade path 3.4.8 to 4.0.2 38582: ALF-14504: PostgreSQL: Schema differences upgrading from 3.4.8 to 4.0.2 Ignore avm_child_entries PK name differences. 38585: ALF-14599 ftp.ipv6.enabled is configured in alfresco-global by default, but is not injected nor implemented for FTP 38586: Merged V3.4-BUG-FIX to V4.1-BUG-FIX 38354: ALF-14738: Add information to manifests in all war files 38393: ALF-10804: WCM - Using multiple instances of the same TinyMCE plugin in the same form causes configuration inheritance issues - TinyMCE initialization and configuration moved into _createTinyMCE:function() - TinyMCE initialization moved to onLoadContent event callback - TinyMCE settings application uses init() now 38406: ALF-14738: use correct property for build number 38438: ALF-14856: Documents uploaded via WebDAV mount from Windows 7, and copied by a jscript rule are zero-length - Simplified fix. Don't fire on-create-node-trigger if on-content-create-trigger would fire, so that policy.content.update.ignoreEmpty=true is respected - policy.content.update.ignoreEmpty=true now the default as it is required by OSX and Windows 7 38459: ALF-13567: "manager-osx" should be called "Application Manager" inside the installation folder - Fix from Bitrock 38460: ALF-11817: No versioning when modify/save file content via mapped Webdav network drive - parseRequestHeader() now trys harder to parse the "Microsoft-WebDAV-MiniRedir" client's buggy "Lock-Token" header. 38476: Merged DEV to V3.4-BUG-FIX 38475: ALF-14868:CLONE - 'Error 0x80070057: The parameter is incorrect' occurs often during upload of documents via WebDAV Port fix from ALF-14636: Make XML-streaming WebDAV Methods buffer their response in case of transaction retries 38502: ALF-14876: awe.log and share.log were left after uninstalling Alfresco - Fix by Bitrock 38561: Merged V3.4 to V3.4-BUG-FIX 38414: ALF-14402: Merged PATCHES/V3.4.6 to V3.4 38028: ALF-13827: Prevent excessive cache chatter by avoiding replicating the aspects, properties and parent associations caches 38416: (RECORD ONLY) ALF-14852: Merged V3.4-BUG-FIX to V3.4 37835: Fix for ALF-14429 - Recently Modified dashlet takes up to 30 seconds to load after upgrade to Alfresco 3.4.6.23 git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@38587 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
207 lines
7.4 KiB
Java
207 lines
7.4 KiB
Java
/*
|
|
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
|
*
|
|
* This file is part of Alfresco
|
|
*
|
|
* Alfresco is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU Lesser General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* Alfresco is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
package org.alfresco.repo.rule.ruletrigger;
|
|
|
|
import java.util.Set;
|
|
|
|
import org.alfresco.repo.node.NodeServicePolicies;
|
|
import org.alfresco.repo.policy.JavaBehaviour;
|
|
import org.alfresco.repo.policy.Behaviour.NotificationFrequency;
|
|
import org.alfresco.repo.rule.RuntimeRuleService;
|
|
import org.alfresco.repo.transaction.TransactionalResourceHelper;
|
|
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
|
import org.alfresco.service.cmr.dictionary.PropertyDefinition;
|
|
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
|
import org.alfresco.service.cmr.repository.NodeRef;
|
|
import org.alfresco.service.namespace.NamespaceService;
|
|
import org.alfresco.service.namespace.QName;
|
|
import org.apache.commons.logging.Log;
|
|
import org.apache.commons.logging.LogFactory;
|
|
|
|
/**
|
|
* We use this specialised trigger for create node beaucse of a problem with the CIFS integration.
|
|
* <p>
|
|
* The create node trigger will only be fired if the object is NOT a sub-type of content.
|
|
* <p>
|
|
* Policy names supported are:
|
|
* <ul>
|
|
* <li>{@linkplain NodeServicePolicies.OnCreateChildAssociationPolicy}</li>
|
|
* <li>{@linkplain NodeServicePolicies.BeforeDeleteChildAssociationPolicy}</li>
|
|
* <li>{@linkplain NodeServicePolicies.OnCreateNodePolicy}</li>
|
|
* </ul>
|
|
*
|
|
* @author Roy Wetherall
|
|
*/
|
|
public class CreateNodeRuleTrigger extends RuleTriggerAbstractBase
|
|
implements NodeServicePolicies.OnCreateNodePolicy
|
|
{
|
|
private static Log logger = LogFactory.getLog(CreateNodeRuleTrigger.class);
|
|
|
|
private static final String POLICY = "onCreateNode";
|
|
|
|
private static final QName ASPECT_NO_CONTENT = QName.createQName(NamespaceService.SYSTEM_MODEL_1_0_URI, "noContent");
|
|
|
|
/** Indicates whether this is a class behaviour or not */
|
|
private boolean isClassBehaviour = false;
|
|
|
|
/** Runtime rule service */
|
|
RuntimeRuleService runtimeRuleService;
|
|
|
|
/**
|
|
* Set whether this is a class behaviour or not
|
|
*/
|
|
public void setIsClassBehaviour(boolean isClassBehaviour)
|
|
{
|
|
this.isClassBehaviour = isClassBehaviour;
|
|
}
|
|
|
|
/**
|
|
* Set the rule service
|
|
*/
|
|
public void setRuntimeRuleService(RuntimeRuleService runtimeRuleService)
|
|
{
|
|
this.runtimeRuleService = runtimeRuleService;
|
|
}
|
|
|
|
/**
|
|
* {@inheritDoc}
|
|
*/
|
|
public void registerRuleTrigger()
|
|
{
|
|
if (isClassBehaviour == true)
|
|
{
|
|
this.policyComponent.bindClassBehaviour(
|
|
QName.createQName(NamespaceService.ALFRESCO_URI, POLICY),
|
|
this,
|
|
new JavaBehaviour(this, POLICY));
|
|
}
|
|
else
|
|
{
|
|
this.policyComponent.bindAssociationBehaviour(
|
|
QName.createQName(NamespaceService.ALFRESCO_URI, POLICY),
|
|
this,
|
|
new JavaBehaviour(this, POLICY));
|
|
}
|
|
|
|
// Register interest in the addition and removal of the sys:noContent aspect
|
|
this.policyComponent.bindClassBehaviour(
|
|
NodeServicePolicies.OnAddAspectPolicy.QNAME,
|
|
ASPECT_NO_CONTENT,
|
|
new JavaBehaviour(this, "onAddAspect", NotificationFrequency.EVERY_EVENT));
|
|
this.policyComponent.bindClassBehaviour(
|
|
NodeServicePolicies.OnRemoveAspectPolicy.QNAME,
|
|
ASPECT_NO_CONTENT,
|
|
new JavaBehaviour(this, "onRemoveAspect", NotificationFrequency.EVERY_EVENT));
|
|
}
|
|
|
|
/**
|
|
* {@inheritDoc}
|
|
*/
|
|
public void onCreateNode(ChildAssociationRef childAssocRef)
|
|
{
|
|
// Break out early if rules are not enabled
|
|
if (!areRulesEnabled())
|
|
{
|
|
return;
|
|
}
|
|
NodeRef nodeRef = childAssocRef.getChildRef();
|
|
|
|
// If the node has a single-valued content property, don't fire the trigger, as it will be handled by
|
|
// on-content-create-trigger, according to its settings for empty content
|
|
for (QName propertyQName : nodeService.getProperties(nodeRef).keySet())
|
|
{
|
|
PropertyDefinition propertyDef = dictionaryService.getProperty(propertyQName);
|
|
if (propertyDef != null && propertyDef.getDataType().getName().equals(DataTypeDefinition.CONTENT)
|
|
&& !propertyDef.isMultiValued())
|
|
{
|
|
return;
|
|
}
|
|
}
|
|
|
|
// Keep track of new nodes to prevent firing of updates in the same transaction
|
|
Set<NodeRef> newNodeRefSet = TransactionalResourceHelper.getSet(RULE_TRIGGER_NEW_NODES);
|
|
newNodeRefSet.add(nodeRef);
|
|
|
|
if (nodeRef != null &&
|
|
nodeService.exists(nodeRef) == true &&
|
|
nodeService.hasAspect(nodeRef, ASPECT_NO_CONTENT) == false)
|
|
{
|
|
NodeRef parentNodeRef = childAssocRef.getParentRef();
|
|
|
|
if (logger.isDebugEnabled() == true)
|
|
{
|
|
logger.debug(
|
|
"Create node rule trigger fired for parent node " +
|
|
this.nodeService.getType(parentNodeRef).toString() + " " + parentNodeRef +
|
|
" and child node " +
|
|
this.nodeService.getType(nodeRef).toString() + " " + nodeRef);
|
|
}
|
|
|
|
triggerRules(parentNodeRef, nodeRef);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* On add aspect behaviour
|
|
*/
|
|
public void onAddAspect(NodeRef nodeRef, QName aspectTypeQName)
|
|
{
|
|
if (!nodeService.exists(nodeRef))
|
|
{
|
|
return;
|
|
}
|
|
if (logger.isDebugEnabled() == true)
|
|
{
|
|
logger.debug(
|
|
"Removing the pending rules for the node " +
|
|
nodeRef.toString() +
|
|
" since the noContent aspect has been applied.");
|
|
}
|
|
|
|
// Removes any rules that have already been triggered for that node
|
|
runtimeRuleService.removeRulePendingExecution(nodeRef);
|
|
}
|
|
|
|
/**
|
|
* On remove aspect behaviour
|
|
*/
|
|
public void onRemoveAspect(NodeRef nodeRef, QName aspectTypeQName)
|
|
{
|
|
if (!nodeService.exists(nodeRef))
|
|
{
|
|
return;
|
|
}
|
|
// We can assume it is the primary parent since it is only in the CIFS use case this aspect
|
|
// is added. It's added during create, therefore we must be talking about the primary parent
|
|
NodeRef parentNodeRef = nodeService.getPrimaryParent(nodeRef).getParentRef();
|
|
|
|
if (logger.isDebugEnabled() == true)
|
|
{
|
|
logger.debug(
|
|
"Create node rule trigger fired for parent node " +
|
|
this.nodeService.getType(parentNodeRef).toString() + " " + parentNodeRef +
|
|
" and child node " +
|
|
this.nodeService.getType(nodeRef).toString() + " " + nodeRef +
|
|
" (this was triggered on removal of the noContent aspect)");
|
|
}
|
|
|
|
triggerRules(parentNodeRef, nodeRef);
|
|
}
|
|
}
|