Moving to root below branch label

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2005 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2005-12-08 07:13:07 +00:00
commit e1e6508fec
1095 changed files with 230566 additions and 0 deletions

View File

@@ -0,0 +1,203 @@
/*
* Copyright (C) 2005 Alfresco, Inc.
*
* Licensed under the Mozilla Public License version 1.1
* with a permitted attribution clause. You may obtain a
* copy of the License at
*
* http://www.alfresco.org/legal/license.txt
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the
* License.
*/
package org.alfresco.service.cmr.action;
import java.util.Date;
import java.util.List;
import org.alfresco.service.cmr.repository.NodeRef;
/**
* The rule action interface
*
* @author Roy Wetherall
*/
public interface Action extends ParameterizedItem
{
/**
* Get the name of the action definition that relates to this action
*
* @return the action defintion name
*/
String getActionDefinitionName();
/**
* Get the title of the action
*
* @return the title of the action
*/
String getTitle();
/**
* Set the title of the action
*
* @param title the title of the action
*/
void setTitle(String title);
/**
* Get the description of the action
*
* @return the description of the action
*/
String getDescription();
/**
* Set the description of the action
*
* @param description the description of the action
*/
void setDescription(String description);
/**
* Get the node reference of the node that 'owns' this action.
* <p>
* The node that 'owns' the action is th one that stores it via its
* actionable aspect association.
*
* @return node reference
*/
NodeRef getOwningNodeRef();
/**
* Gets a value indicating whether the action should be executed asychronously or not.
* <p>
* The default is to execute the action synchronously.
*
* @return true if the action is executed asychronously, false otherwise.
*/
boolean getExecuteAsychronously();
/**
* Set the value that indicates whether the action should be executed asychronously or not.
*
* @param executeAsynchronously true if the action is to be executed asychronously, false otherwise.
*/
void setExecuteAsynchronously(boolean executeAsynchronously);
/**
* Get the compensating action.
* <p>
* This action is executed if the failure behaviour is to compensate and the action being executed
* fails.
*
* @return the compensating action
*/
Action getCompensatingAction();
/**
* Set the compensating action.
*
* @param action the compensating action
*/
void setCompensatingAction(Action action);
/**
* Get the date the action was created
*
* @return action creation date
*/
Date getCreatedDate();
/**
* Get the name of the user that created the action
*
* @return user name
*/
String getCreator();
/**
* Get the date that the action was last modified
*
* @return aciton modification date
*/
Date getModifiedDate();
/**
* Get the name of the user that last modified the action
*
* @return user name
*/
String getModifier();
/**
* Indicates whether the action has any conditions specified
*
* @return true if the action has any conditions specified, flase otherwise
*/
boolean hasActionConditions();
/**
* Gets the index of an action condition
*
* @param actionCondition the action condition
* @return the index
*/
int indexOfActionCondition(ActionCondition actionCondition);
/**
* Gets a list of the action conditions for this action
*
* @return list of action conditions
*/
List<ActionCondition> getActionConditions();
/**
* Get the action condition at a given index
*
* @param index the index
* @return the action condition
*/
ActionCondition getActionCondition(int index);
/**
* Add an action condition to the action
*
* @param actionCondition an action condition
*/
void addActionCondition(ActionCondition actionCondition);
/**
* Add an action condition at the given index
*
* @param index the index
* @param actionCondition the action condition
*/
void addActionCondition(int index, ActionCondition actionCondition);
/**
* Replaces the current action condition at the given index with the
* action condition provided.
*
* @param index the index
* @param actionCondition the action condition
*/
void setActionCondition(int index, ActionCondition actionCondition);
/**
* Removes an action condition
*
* @param actionCondition an action condition
*/
void removeActionCondition(ActionCondition actionCondition);
/**
* Removes all action conditions
*/
void removeAllActionConditions();
}

View File

@@ -0,0 +1,58 @@
/*
* Copyright (C) 2005 Alfresco, Inc.
*
* Licensed under the Mozilla Public License version 1.1
* with a permitted attribution clause. You may obtain a
* copy of the License at
*
* http://www.alfresco.org/legal/license.txt
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the
* License.
*/
package org.alfresco.service.cmr.action;
/**
* Rule condition interface
*
* @author Roy Wetherall
*/
public interface ActionCondition extends ParameterizedItem
{
/**
* Get the action condition definition name
*
* @param the action condition definition name
*/
public String getActionConditionDefinitionName();
/**
* Set whether the condition result should be inverted.
* <p>
* This is achieved by applying the NOT logical operator to the
* result.
* <p>
* The default value is false.
*
* @param invertCondition true indicates that the result of the condition
* is inverted, false otherwise.
*/
public void setInvertCondition(boolean invertCondition);
/**
* Indicates whether the condition result should be inverted.
* <p>
* This is achieved by applying the NOT logical operator to the result.
* <p>
* The default value is false.
*
* @return true indicates that the result of the condition is inverted, false
* otherwise
*/
public boolean getInvertCondition();
}

View File

@@ -0,0 +1,29 @@
/*
* Copyright (C) 2005 Alfresco, Inc.
*
* Licensed under the Mozilla Public License version 1.1
* with a permitted attribution clause. You may obtain a
* copy of the License at
*
* http://www.alfresco.org/legal/license.txt
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the
* License.
*/
package org.alfresco.service.cmr.action;
/**
* Rule condition interface
*
* @author Roy Wetherall
*/
public interface ActionConditionDefinition extends ParameterizedItemDefinition
{
}

View File

@@ -0,0 +1,29 @@
/*
* Copyright (C) 2005 Alfresco, Inc.
*
* Licensed under the Mozilla Public License version 1.1
* with a permitted attribution clause. You may obtain a
* copy of the License at
*
* http://www.alfresco.org/legal/license.txt
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the
* License.
*/
package org.alfresco.service.cmr.action;
/**
* Rule action interface.
*
* @author Roy Wetherall
*/
public interface ActionDefinition extends ParameterizedItemDefinition
{
}

View File

@@ -0,0 +1,33 @@
/*
* Copyright (C) 2005 Alfresco, Inc.
*
* Licensed under the Mozilla Public License version 1.1
* with a permitted attribution clause. You may obtain a
* copy of the License at
*
* http://www.alfresco.org/legal/license.txt
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the
* License.
*/
package org.alfresco.service.cmr.action;
import java.io.Serializable;
/**
* Action execution status enumeration
*
* @author Roy Wetherall
*/
public enum ActionExecutionStatus implements Serializable
{
PENDING, // The action is queued pending execution
RUNNING, // The action is currently executing
SUCCEEDED, // The action has completed successfully
FAILED, // The action has failed
COMPENSATED // The action has failed and a compensating action has been been queued for execution
}

View File

@@ -0,0 +1,214 @@
/*
* Copyright (C) 2005 Alfresco, Inc.
*
* Licensed under the Mozilla Public License version 1.1
* with a permitted attribution clause. You may obtain a
* copy of the License at
*
* http://www.alfresco.org/legal/license.txt
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the
* License.
*/
package org.alfresco.service.cmr.action;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
import org.alfresco.service.cmr.repository.NodeRef;
/**
* Action service interface
*
* @author Roy Wetherall
*/
public interface ActionService
{
/**
* Get a named action definition
*
* @param name the name of the action definition
* @return the action definition
*/
ActionDefinition getActionDefinition(String name);
/**
* Get all the action definitions
*
* @return the list action definitions
*/
List<ActionDefinition> getActionDefinitions();
/**
* Get a named action condition definition
*
* @param name the name of the action condition definition
* @return the action condition definition
*/
ActionConditionDefinition getActionConditionDefinition(String name);
/**
* Get all the action condition definitions
*
* @return the list of aciton condition definitions
*/
List<ActionConditionDefinition> getActionConditionDefinitions();
/**
* Create a new action
*
* @param name the action definition name
* @return the action
*/
Action createAction(String name);
/**
* Create a new action specifying the initial set of parameter values
*
* @param name the action defintion name
* @param params the parameter values
* @return the action
*/
Action createAction(String name, Map<String, Serializable> params);
/**
* Create a composite action
*
* @return the composite action
*/
CompositeAction createCompositeAction();
/**
* Create an action condition
*
* @param name the action condition definition name
* @return the action condition
*/
ActionCondition createActionCondition(String name);
/**
* Create an action condition specifying the initial set of parameter values
*
* @param name the aciton condition definition name
* @param params the parameter valeus
* @return the action condition
*/
ActionCondition createActionCondition(String name, Map<String, Serializable> params);
/**
* The actions conditions are always checked.
*
* @see ActionService#executeAction(Action, NodeRef, boolean)
*
* @param action the action
* @param actionedUponNodeRef the actioned upon node reference
*/
void executeAction(Action action, NodeRef actionedUponNodeRef);
/**
* The action is sexecuted based on the asynchronous attribute of the action.
*
* @see ActionService#executeAction(Action, NodeRef, boolean, boolean)
*
* @param action the action
* @param actionedUponNodeRef the actioned upon node reference
* @param checkConditions indicates whether the conditions should be checked
*/
void executeAction(Action action, NodeRef actionedUponNodeRef, boolean checkConditions);
/**
* Executes the specified action upon the node reference provided.
* <p>
* If specified that the conditions should be checked then any conditions
* set on the action are evaluated.
* <p>
* If the conditions fail then the action is not executed.
* <p>
* If an action has no conditions then the action will always be executed.
* <p>
* If the conditions are not checked then the action will always be executed.
*
* @param action the action
* @param actionedUponNodeRef the actioned upon node reference
* @param checkConditions indicates whether the conditions should be checked before
* executing the action
* @param executeAsynchronously indicates whether the action should be executed asychronously or not, this value overrides
* the value set on the action its self
*/
void executeAction(Action action, NodeRef actionedUponNodeRef, boolean checkConditions, boolean executeAsynchronously);
/**
* Evaluted the conditions set on an action.
* <p>
* Returns true if the action has no conditions.
* <p>
* If the action has more than one condition their results are combined using the 'AND'
* logical operator.
*
* @param action the action
* @param actionedUponNodeRef the actioned upon node reference
* @return true if the condition succeeds, false otherwise
*/
boolean evaluateAction(Action action, NodeRef actionedUponNodeRef);
/**
* Evaluate an action condition.
*
* @param condition the action condition
* @param actionedUponNodeRef the actioned upon node reference
* @return true if the condition succeeds, false otherwise
*/
boolean evaluateActionCondition(ActionCondition condition, NodeRef actionedUponNodeRef);
/**
* Save an action against a node reference.
* <p>
* The node will be made configurable if it is not already.
* <p>
* If the action already exists then its details will be updated.
*
* @param nodeRef the node reference
* @param action the action
*/
void saveAction(NodeRef nodeRef, Action action);
/**
* Gets all the actions currently saved on the given node reference.
*
* @param nodeRef the ndoe reference
* @return the list of actions
*/
List<Action> getActions(NodeRef nodeRef);
/**
* Gets an action stored against a given node reference.
* <p>
* Returns null if the action can not be found.
*
* @param nodeRef the node reference
* @param actionId the action id
* @return the action
*/
Action getAction(NodeRef nodeRef, String actionId);
/**
* Removes an action associatied with a node reference.
*
* @param nodeRef the node reference
* @param action the action
*/
void removeAction(NodeRef nodeRef, Action action);
/**
* Removes all actions associated with a node reference
*
* @param nodeRef the node reference
*/
void removeAllActions(NodeRef nodeRef);
}

View File

@@ -0,0 +1,52 @@
/*
* Copyright (C) 2005 Alfresco, Inc.
*
* Licensed under the Mozilla Public License version 1.1
* with a permitted attribution clause. You may obtain a
* copy of the License at
*
* http://www.alfresco.org/legal/license.txt
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the
* License.
*/
package org.alfresco.service.cmr.action;
import org.alfresco.error.AlfrescoRuntimeException;
/**
* Rule Service Exception Class
*
* @author Roy Wetherall
*/
public class ActionServiceException extends AlfrescoRuntimeException
{
/**
* Serial version UID
*/
private static final long serialVersionUID = 3257571685241467958L;
public ActionServiceException(String msgId)
{
super(msgId);
}
public ActionServiceException(String msgId, Object[] msgParams)
{
super(msgId, msgParams);
}
public ActionServiceException(String msgId, Object[] msgParams, Throwable cause)
{
super(msgId, msgParams, cause);
}
public ActionServiceException(String msgId, Throwable cause)
{
super(msgId, cause);
}
}

View File

@@ -0,0 +1,92 @@
/*
* Copyright (C) 2005 Alfresco, Inc.
*
* Licensed under the Mozilla Public License version 1.1
* with a permitted attribution clause. You may obtain a
* copy of the License at
*
* http://www.alfresco.org/legal/license.txt
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the
* License.
*/
package org.alfresco.service.cmr.action;
import java.util.List;
/**
* Composite action
*
* @author Roy Wetherall
*/
public interface CompositeAction extends Action
{
/**
* Indicates whether there are any actions
*
* @return true if there are actions, false otherwise
*/
boolean hasActions();
/**
* Add an action to the end of the list
*
* @param action the action
*/
void addAction(Action action);
/**
* Add an action to the list at the index specified
*
* @param index the index
* @param action the action
*/
void addAction(int index, Action action);
/**
* Replace the action at the specfied index with the passed action.
*
* @param index the index
* @param action the action
*/
void setAction(int index, Action action);
/**
* Gets the index of an action
*
* @param action the action
* @return the index
*/
int indexOfAction(Action action);
/**
* Get list containing the actions in their current order
*
* @return the list of actions
*/
List<Action> getActions();
/**
* Get an action at a given index
*
* @param index the index
* @return the action
*/
Action getAction(int index);
/**
* Remove an action from the list
*
* @param action the action
*/
void removeAction(Action action);
/**
* Remove all actions from the list
*/
void removeAllActions();
}

View File

@@ -0,0 +1,60 @@
/*
* Copyright (C) 2005 Alfresco, Inc.
*
* Licensed under the Mozilla Public License version 1.1
* with a permitted attribution clause. You may obtain a
* copy of the License at
*
* http://www.alfresco.org/legal/license.txt
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the
* License.
*/
package org.alfresco.service.cmr.action;
import org.alfresco.service.namespace.QName;
/**
* Parameter definition interface.
*
* @author Roy Wetherall
*/
public interface ParameterDefinition
{
/**
* Get the name of the parameter.
* <p>
* This is unique and is used to identify the parameter.
*
* @return the parameter name
*/
public String getName();
/**
* Get the type of parameter
*
* @return the parameter type qname
*/
public QName getType();
/**
* Indicates whether the parameter is mandatory or not.
* <p>
* If a parameter is mandatory it means that the value can not be null.
*
* @return true if the parameter is mandatory, false otherwise
*/
public boolean isMandatory();
/**
* Get the display label of the parameter.
*
* @return the parameter display label
*/
public String getDisplayLabel();
}

View File

@@ -0,0 +1,66 @@
/*
* Copyright (C) 2005 Alfresco, Inc.
*
* Licensed under the Mozilla Public License version 1.1
* with a permitted attribution clause. You may obtain a
* copy of the License at
*
* http://www.alfresco.org/legal/license.txt
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the
* License.
*/
package org.alfresco.service.cmr.action;
import java.io.Serializable;
import java.util.Map;
/**
* Rule item interface
*
* @author Roy Wetherall
*/
public interface ParameterizedItem
{
/**
* Unique identifier for the parameterized item
*
* @return the id string
*/
public String getId();
/**
* Get the parameter values
*
* @return get the parameter values
*/
public Map<String, Serializable> getParameterValues();
/**
* Get value of a named parameter.
*
* @param name the parameter name
* @return the value of the parameter
*/
public Serializable getParameterValue(String name);
/**
* Sets the parameter values
*
* @param parameterValues the parameter values
*/
public void setParameterValues(
Map<String, Serializable> parameterValues);
/**
* Sets the value of a parameter.
*
* @param name the parameter name
* @param value the parameter value
*/
public void setParameterValue(String name, Serializable value);
}

View File

@@ -0,0 +1,67 @@
/*
* Copyright (C) 2005 Alfresco, Inc.
*
* Licensed under the Mozilla Public License version 1.1
* with a permitted attribution clause. You may obtain a
* copy of the License at
*
* http://www.alfresco.org/legal/license.txt
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the
* License.
*/
package org.alfresco.service.cmr.action;
import java.util.List;
public interface ParameterizedItemDefinition
{
/**
* Get the name of the rule item.
* <p>
* The name is unique and is used to identify the rule item.
*
* @return the name of the rule action
*/
public String getName();
/**
* The title of the parameterized item definition
*
* @return the title
*/
public String getTitle();
/**
* The description of the parameterized item definition
*
* @return the description
*/
public String getDescription();
/**
* Indicates whether the parameterized item allows adhoc properties to be set
*
* @return true if ashoc properties are allowed, false otherwise
*/
public boolean getAdhocPropertiesAllowed();
/**
* A list containing the parmameter defintions for this rule item.
*
* @return a list of parameter definitions
*/
public List<ParameterDefinition> getParameterDefinitions();
/**
* Get the parameter definition by name
*
* @param name the name of the parameter
* @return the parameter definition, null if none found
*/
public ParameterDefinition getParameterDefintion(String name);
}