Merge from head.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3314 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Britt Park
2006-07-13 07:06:30 +00:00
parent b601821d98
commit fae76d7896
41 changed files with 1354 additions and 147 deletions

View File

@@ -0,0 +1,181 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Default Audit Configuration -->
<Audit xmlns="http://www.alfresco.org/model/audit/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" enabled="true" auditInternal="false" mode="all">
<!-- -->
<!-- Global options -->
<!-- -->
<!-- Do not record any additional information -->
<RecordOptions>
<recordPath>false</recordPath>
<recordFilters>false</recordFilters>
<recordSerializedReturnValue>false</recordSerializedReturnValue>
<recordSerializedExceptions>false</recordSerializedExceptions>
<recordSerializedMethodArguments>false</recordSerializedMethodArguments>
<recordSerializedKeyPropertiesBeforeInvocation>false</recordSerializedKeyPropertiesBeforeInvocation>
<recordSerializedKeyPropertiesAferInvocation>false</recordSerializedKeyPropertiesAferInvocation>
</RecordOptions>
<!-- -->
<!-- Specific service options -->
<!-- -->
<Service name="ServiceRegistry" mode="none" enabled="false"/>
<!-- The action service -->
<Service name="ActionService" mode="none">
<Method name="executeAction" mode="all" auditInternal="true"/>
<Method name="saveAction" mode="all"/>
<Method name="removeAction" mode="all"/>
<Method name="removeAllActions" mode="all"/>
</Service>
<!-- The COCI Service -->
<Service name="CheckOutCheckInService"/>
<!-- The DictionaryService -->
<!-- There are no audtiable methods in the data dictionary service -->
<Service name="DictionaryService" mode="none" enabled="false"/>
<!-- The Lock Service -->
<Service name="LockService"/>
<!-- The File/Folder Service -->
<Service name="FileFolderService" mode="none">
<Method name="rename" mode="all"/>
<Method name="move" mode="all"/>
<Method name="copy" mode="all"/>
<Method name="create" mode="all"/>
<Method name="delete" mode="all"/>
<Method name="makeFolders" mode="all"/>
<Method name="getWriter" mode="all"/>
</Service>
<Service name="ContentService" mode="none">
<Method name="getWriter" mode="all"/>
</Service>
<Service name="CopyService" mode="none">
<Method name="copy" mode="all"/>
</Service>
<!-- The MimetypeService -->
<!-- There are no audtiable methods in the mime type service -->
<Service name="MimetypeService" mode="none" enabled="false"/>
<Service name="NodeService" mode="none">
<Method name="createStore" mode="all"/>
<Method name="createNode" mode="all"/>
<Method name="moveNode" mode="all"/>
<Method name="setChildAssociationIndex" mode="all"/>
<Method name="setType" mode="all"/>
<Method name="addAspect" mode="all"/>
<Method name="removeAspect" mode="all"/>
<Method name="deleteNode" mode="all"/>
<Method name="addChild" mode="all"/>
<Method name="removeChild" mode="all"/>
<Method name="setProperties" mode="all"/>
<Method name="setProperty" mode="all"/>
<Method name="createAssociation" mode="all"/>
<Method name="removeAssociation" mode="all"/>
<Method name="restoreNode" mode="all"/>
</Service>
<Service name="ScriptService"/>
<Service name="TemplateService"/>
<Service name="RuleService" mode="none">
<Method name="disableRules" mode="all"/>
<Method name="enableRules" mode="all"/>
<Method name="disableRule" mode="all"/>
<Method name="enableRule" mode="all"/>
<Method name="createRule" mode="all"/>
<Method name="saveRule" mode="all"/>
<Method name="removeRule" mode="all"/>
<Method name="removeAllRules" mode="all"/>
</Service>
<Service name="CategoryService" mode="none">
<Method name="createClassifiction" mode="all"/>
<Method name="createRootCategory" mode="all"/>
<Method name="createCategory" mode="all"/>
<Method name="deleteClassification" mode="all"/>
<Method name="deleteCategory" mode="all"/>
</Service>
<Service name="SearchService" mode="none" enabled="false"/>
<Service name="AuthenticationService" mode="none">
<Method name="createAuthentication" mode="all"/>
<Method name="updateAuthentication" mode="all"/>
<Method name="setAuthentication" mode="all"/>
<Method name="deleteAuthentication" mode="all"/>
<Method name="setAuthenticationEnabled" mode="all"/>
<Method name="authenticate" mode="all"/>
<Method name="authenticateAsGuest" mode="all"/>
<Method name="authenticationExists" mode="all"/>
<Method name="invalidateUserSession" mode="all"/>
<Method name="invalidateTicket" mode="all"/>
<Method name="validate" mode="all"/>
<Method name="clearCurrentSecurityContext" mode="all"/>
</Service>
<Service name="AuthorityService" mode="none">
<Method name="createAuthority" mode="all"/>
<Method name="addAuthority" mode="all"/>
<Method name="removeAuthority" mode="all"/>
<Method name="deleteAuthority" mode="all"/>
</Service>
<Service name="OwnableService" mode="none">
<Method name="setOwner" mode="all"/>
<Method name="takeOwnership" mode="all"/>
</Service>
<Service name="PermissionService" mode="none">
<Method name="deletePermissions" mode="all"/>
<Method name="clearPermission" mode="all"/>
<Method name="deletePermission" mode="all"/>
<Method name="setPermission" mode="all"/>
<Method name="setInheritParentPermissions" mode="all"/>
</Service>
<Service name="PersonService" mode="none">
<Method name="setCreateMissingPeople" mode="all"/>
<Method name="setPersonProperties" mode="all"/>
<Method name="createPerson" mode="all"/>
<Method name="deletePerson" mode="all"/>
</Service>
<Service name="VersionService" mode="none">
<Method name="createVersion" mode="all"/>
<Method name="revert" mode="all"/>
<Method name="restore" mode="all"/>
<Method name="deleteVersionHistory" mode="all"/>
</Service>
<Service name="ExporterService"/>
<Service name="ImporterService"/>
<Service name="RepositoryExporterService"/>
<Service name="DescriptorService" mode="none" enabled="false"/>
<Service name="LicenseService" mode="none" enabled="false"/>
<Service name="NamespaceService"/>
<Service name="TransactionService" mode="none" enabled="false"/>
</Audit>

View File

@@ -0,0 +1,204 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="http://www.alfresco.org/model/audit/1.0" elementFormDefault="qualified" xml:lang="EN" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:a="http://www.alfresco.org/model/audit/1.0">
<xs:annotation>
<xs:documentation xml:lang="EN"> Schema to define audit configuration. </xs:documentation>
</xs:annotation>
<!-- Root element is the Audit element -->
<xs:element name="Audit" type="a:Audit"/>
<!-- -->
<!-- Type definitions -->
<!-- -->
<!-- Options for what to record -->
<!-- By default these are not recorded. Behaviour is "inherited" from containing elements for unspecified entries -->
<xs:complexType name="RecordOptions">
<xs:sequence>
<xs:element name="recordPath" type="xs:boolean" minOccurs="0" maxOccurs="1" />
<xs:element name="recordFilters" type="xs:boolean" minOccurs="0" maxOccurs="1" />
<xs:element name="recordSerializedReturnValue" type="xs:boolean" minOccurs="0" maxOccurs="1" />
<xs:element name="recordSerializedExceptions" type="xs:boolean" minOccurs="0" maxOccurs="1" />
<xs:element name="recordSerializedMethodArguments" type="xs:boolean" minOccurs="0" maxOccurs="1" />
<xs:element name="recordSerializedKeyPropertiesBeforeInvocation" type="xs:boolean" minOccurs="0" maxOccurs="1" />
<xs:element name="recordSerializedKeyPropertiesAferInvocation" type="xs:boolean" minOccurs="0" maxOccurs="1" />
</xs:sequence>
</xs:complexType>
<!-- Abstract Filter entry -->
<xs:complexType name="Filter" abstract="true"/>
<!-- Simple Filter entry -->
<!--
Supports:
Simple path
Type (and sub-types)
Aspect (and sub-aspects)
NodeRef
All (do not filter)
XPATH simple xpath expressions in the context of the key node
A simple value (intended for use with non node arguments)
-->
<xs:simpleType name="KeyFilterType">
<xs:restriction base="xs:string">
<xs:enumeration value="path"/>
<xs:enumeration value="type"/>
<xs:enumeration value="aspect"/>
<xs:enumeration value="id"/>
<xs:enumeration value="all"/>
<xs:enumeration value="xpath"/>
<xs:enumeration value="value"/>
<xs:enumeration value="protocol"/>
<xs:enumeration value="store"/>
</xs:restriction>
</xs:simpleType>
<!-- Audit Mode -->
<xs:simpleType name="AuditMode">
<xs:restriction base="xs:string">
<xs:enumeration value="all"/>
<xs:enumeration value="success"/>
<xs:enumeration value="fail"/>
<xs:enumeration value="none"/>
</xs:restriction>
</xs:simpleType>
<!-- Defintion for how to combine elements in a compound filter -->
<xs:simpleType name="FilterSetMode">
<xs:restriction base="xs:string">
<xs:enumeration value="and"/>
<xs:enumeration value="or"/>
</xs:restriction>
</xs:simpleType>
<!-- Define a set of filters -->
<xs:complexType name="FilterSet">
<xs:complexContent>
<xs:extension base="a:Filter">
<xs:sequence>
<xs:element name="Filter" type="a:Filter" minOccurs="1" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="mode" type="a:FilterSetMode" use="required"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<!-- A filter that applies to the key node -->
<xs:complexType name="KeyFilter">
<xs:complexContent>
<xs:extension base="a:Filter">
<xs:sequence>
<xs:element name="Expression" type="xs:string"/>
</xs:sequence>
<xs:attribute name="type" type="a:KeyFilterType" use="required"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<!-- A filter that applies to a named parameter -->
<xs:complexType name="ParameterFilter">
<xs:complexContent>
<xs:extension base="a:KeyFilter">
<xs:sequence>
<xs:element name="ParameterName" type="xs:string"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<!-- An abstract audit entry -->
<xs:complexType name="AuditEntry" abstract="true">
<xs:sequence>
<xs:element name="RecordOptions" type="a:RecordOptions" minOccurs="0" maxOccurs="1"/>
<xs:element name="Filter" type="a:Filter" minOccurs="0" maxOccurs="1" />
</xs:sequence>
<!-- The inner most specification over-rides -->
<xs:attribute name="mode" type="a:AuditMode" />
<!-- The outer most specification set this -->
<xs:attribute name="enabled" type="xs:boolean" />
<!-- The inner most specification over-rides -->
<xs:attribute name="auditInternal" type="xs:boolean" />
</xs:complexType>
<!-- Force default behaviour to be specified on the root Audit node -->
<xs:complexType name="MandatoryAuditEntry" abstract="true">
<xs:complexContent>
<xs:restriction base="a:AuditEntry">
<xs:sequence>
<xs:element name="RecordOptions" type="a:RecordOptions" minOccurs="0" maxOccurs="1"/>
<xs:element name="Filter" type="a:Filter" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
<xs:attribute name="mode" type="a:AuditMode" use="required"/>
<xs:attribute name="enabled" type="xs:boolean" use="required"/>
<xs:attribute name="auditInternal" type="xs:boolean" use="required"/>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
<!-- An abstract audit entry with a name -->
<xs:complexType name="NamedAuditEntry" abstract="true">
<xs:complexContent>
<xs:extension base="a:AuditEntry">
<xs:attribute name="name" type="xs:string" use="required"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<!-- Method level audit control -->
<xs:complexType name="Method">
<xs:complexContent>
<xs:extension base="a:NamedAuditEntry"/>
</xs:complexContent>
</xs:complexType>
<!-- Application level audit control -->
<xs:complexType name="Application">
<xs:complexContent>
<xs:extension base="a:NamedAuditEntry"/>
</xs:complexContent>
</xs:complexType>
<!-- Service level audit control -->
<xs:complexType name="Service">
<xs:complexContent>
<xs:extension base="a:NamedAuditEntry">
<xs:sequence>
<xs:element name="Method" type="a:Method" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<!-- Global audit level control -->
<xs:complexType name="Audit">
<xs:complexContent>
<xs:extension base="a:MandatoryAuditEntry">
<xs:sequence>
<xs:element name="Service" type="a:Service" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:schema>

View File

@@ -47,6 +47,7 @@ import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService; import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.repository.TemplateImageResolver; import org.alfresco.service.cmr.repository.TemplateImageResolver;
import org.alfresco.service.cmr.security.AccessStatus; import org.alfresco.service.cmr.security.AccessStatus;
import org.alfresco.service.cmr.security.PermissionService;
import org.alfresco.service.namespace.NamespaceService; import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName; import org.alfresco.service.namespace.QName;
import org.alfresco.service.namespace.RegexQNamePattern; import org.alfresco.service.namespace.RegexQNamePattern;
@@ -488,6 +489,66 @@ public final class Node implements Serializable
return allowed; return allowed;
} }
/**
* @return true if the node inherits permissions from the parent node, false otherwise
*/
public boolean inheritsPermissions()
{
return this.services.getPermissionService().getInheritParentPermissions(this.nodeRef);
}
/**
* Set whether this node should inherit permissions from the parent node.
*
* @param inherit True to inherit parent permissions, false otherwise.
*/
public void setInheritsPermissions(boolean inherit)
{
this.services.getPermissionService().setInheritParentPermissions(this.nodeRef, inherit);
}
/**
* Apply a permission for ALL users to the node.
*
* @param permission Permission to apply @see org.alfresco.service.cmr.security.PermissionService
*/
public void setPermission(String permission)
{
this.services.getPermissionService().setPermission(this.nodeRef, PermissionService.ALL_AUTHORITIES, permission, true);
}
/**
* Apply a permission for the specified authority (e.g. username or group) to the node.
*
* @param permission Permission to apply @see org.alfresco.service.cmr.security.PermissionService
* @param authority Authority (generally a username or group name) to apply the permission for
*/
public void setPermission(String permission, String authority)
{
this.services.getPermissionService().setPermission(this.nodeRef, authority, permission, true);
}
/**
* Remove a permission for ALL user from the node.
*
* @param permission Permission to remove @see org.alfresco.service.cmr.security.PermissionService
*/
public void removePermission(String permission)
{
this.services.getPermissionService().deletePermission(this.nodeRef, PermissionService.ALL_AUTHORITIES, permission);
}
/**
* Remove a permission for the specified authority (e.g. username or group) from the node.
*
* @param permission Permission to remove @see org.alfresco.service.cmr.security.PermissionService
* @param authority Authority (generally a username or group name) to apply the permission for
*/
public void removePermission(String permission, String authority)
{
this.services.getPermissionService().deletePermission(this.nodeRef, authority, permission);
}
/** /**
* @return Display path to this node * @return Display path to this node
*/ */

View File

@@ -35,6 +35,7 @@ import org.alfresco.service.cmr.repository.ScriptException;
import org.alfresco.service.cmr.repository.ScriptService; import org.alfresco.service.cmr.repository.ScriptService;
import org.alfresco.service.cmr.repository.TemplateImageResolver; import org.alfresco.service.cmr.repository.TemplateImageResolver;
import org.alfresco.service.namespace.QName; import org.alfresco.service.namespace.QName;
import org.apache.log4j.Logger;
import org.mozilla.javascript.Context; import org.mozilla.javascript.Context;
import org.mozilla.javascript.ImporterTopLevel; import org.mozilla.javascript.ImporterTopLevel;
import org.mozilla.javascript.Scriptable; import org.mozilla.javascript.Scriptable;
@@ -47,6 +48,8 @@ import org.mozilla.javascript.ScriptableObject;
*/ */
public class RhinoScriptService implements ScriptService public class RhinoScriptService implements ScriptService
{ {
private static final Logger logger = Logger.getLogger(RhinoScriptService.class);
/** The permission-safe node service */ /** The permission-safe node service */
private NodeService nodeService; private NodeService nodeService;
@@ -191,7 +194,13 @@ public class RhinoScriptService implements ScriptService
*/ */
private Object executeScriptImpl(Reader reader, Map<String, Object> model) private Object executeScriptImpl(Reader reader, Map<String, Object> model)
throws AlfrescoRuntimeException throws AlfrescoRuntimeException
{ {
long startTime = 0;
if (logger.isDebugEnabled())
{
startTime = System.currentTimeMillis();
}
// check that rhino script engine is available // check that rhino script engine is available
Context cx = Context.enter(); Context cx = Context.enter();
try try
@@ -226,6 +235,12 @@ public class RhinoScriptService implements ScriptService
finally finally
{ {
cx.exit(); cx.exit();
if (logger.isDebugEnabled())
{
long endTime = System.currentTimeMillis();
logger.debug("Time to execute script: " + (endTime - startTime) + "ms");
}
} }
} }

View File

@@ -67,7 +67,8 @@ public class RuleServiceImpl implements RuleService, RuntimeRuleService
private static final String KEY_RULES_EXECUTED = "RuleServiceImpl.ExecutedRules"; private static final String KEY_RULES_EXECUTED = "RuleServiceImpl.ExecutedRules";
/** qname of assoc to rules */ /** qname of assoc to rules */
private QName ASSOC_NAME_RULES = QName.createQName(RuleModel.RULE_MODEL_URI, "rules"); private String ASSOC_NAME_RULES_PREFIX = "rules";
private RegexQNamePattern ASSOC_NAME_RULES_REGEX = new RegexQNamePattern(RuleModel.RULE_MODEL_URI, "^" + ASSOC_NAME_RULES_PREFIX + ".*");
/** /**
* The logger * The logger
@@ -325,7 +326,7 @@ public class RuleServiceImpl implements RuleService, RuntimeRuleService
// Get the rules for this node // Get the rules for this node
List<ChildAssociationRef> ruleChildAssocRefs = List<ChildAssociationRef> ruleChildAssocRefs =
this.runtimeNodeService.getChildAssocs(ruleFolder, RegexQNamePattern.MATCH_ALL, ASSOC_NAME_RULES); this.runtimeNodeService.getChildAssocs(ruleFolder, RegexQNamePattern.MATCH_ALL, ASSOC_NAME_RULES_REGEX);
for (ChildAssociationRef ruleChildAssocRef : ruleChildAssocRefs) for (ChildAssociationRef ruleChildAssocRef : ruleChildAssocRefs)
{ {
// Create the rule and add to the list // Create the rule and add to the list
@@ -366,7 +367,7 @@ public class RuleServiceImpl implements RuleService, RuntimeRuleService
{ {
// Get the rules for this node // Get the rules for this node
List<ChildAssociationRef> ruleChildAssocRefs = List<ChildAssociationRef> ruleChildAssocRefs =
this.runtimeNodeService.getChildAssocs(ruleFolder, RegexQNamePattern.MATCH_ALL, ASSOC_NAME_RULES); this.runtimeNodeService.getChildAssocs(ruleFolder, RegexQNamePattern.MATCH_ALL, ASSOC_NAME_RULES_REGEX);
ruleCount = ruleChildAssocRefs.size(); ruleCount = ruleChildAssocRefs.size();
} }
@@ -531,7 +532,7 @@ public class RuleServiceImpl implements RuleService, RuntimeRuleService
private Rule createRule(NodeRef owningNodeRef, NodeRef ruleNodeRef) private Rule createRule(NodeRef owningNodeRef, NodeRef ruleNodeRef)
{ {
// Get the rule properties // Get the rule properties
Map<QName, Serializable> props = this.nodeService.getProperties(ruleNodeRef); Map<QName, Serializable> props = this.runtimeNodeService.getProperties(ruleNodeRef);
// Create the rule // Create the rule
String ruleTypeName = (String)props.get(RuleModel.PROP_RULE_TYPE); String ruleTypeName = (String)props.get(RuleModel.PROP_RULE_TYPE);
@@ -590,7 +591,7 @@ public class RuleServiceImpl implements RuleService, RuntimeRuleService
ruleNodeRef = this.nodeService.createNode( ruleNodeRef = this.nodeService.createNode(
getSavedRuleFolderRef(nodeRef), getSavedRuleFolderRef(nodeRef),
ContentModel.ASSOC_CONTAINS, ContentModel.ASSOC_CONTAINS,
ASSOC_NAME_RULES, QName.createQName(RuleModel.RULE_MODEL_URI, ASSOC_NAME_RULES_PREFIX + GUID.generate()),
RuleModel.TYPE_RULE, RuleModel.TYPE_RULE,
props).getChildRef(); props).getChildRef();
@@ -643,7 +644,7 @@ public class RuleServiceImpl implements RuleService, RuntimeRuleService
{ {
List<ChildAssociationRef> ruleChildAssocs = this.nodeService.getChildAssocs( List<ChildAssociationRef> ruleChildAssocs = this.nodeService.getChildAssocs(
folder, folder,
RegexQNamePattern.MATCH_ALL, ASSOC_NAME_RULES); RegexQNamePattern.MATCH_ALL, ASSOC_NAME_RULES_REGEX);
for (ChildAssociationRef ruleChildAssoc : ruleChildAssocs) for (ChildAssociationRef ruleChildAssoc : ruleChildAssocs)
{ {
this.nodeService.removeChild(folder, ruleChildAssoc.getChildRef()); this.nodeService.removeChild(folder, ruleChildAssoc.getChildRef());
@@ -666,30 +667,25 @@ public class RuleServiceImpl implements RuleService, RuntimeRuleService
this.disabledRules.contains(rule) == false) this.disabledRules.contains(rule) == false)
{ {
PendingRuleData pendingRuleData = new PendingRuleData(actionableNodeRef, actionedUponNodeRef, rule, executeAtEnd); PendingRuleData pendingRuleData = new PendingRuleData(actionableNodeRef, actionedUponNodeRef, rule, executeAtEnd);
Set<ExecutedRuleData> executedRules =
(Set<ExecutedRuleData>) AlfrescoTransactionSupport.getResource(KEY_RULES_EXECUTED); Set<PendingRuleData> pendingRules =
(Set<PendingRuleData>) AlfrescoTransactionSupport.getResource(KEY_RULES_PENDING);
if (executedRules == null || executedRules.contains(new ExecutedRuleData(actionableNodeRef, rule)) == false) if (pendingRules == null)
{ {
Set<PendingRuleData> pendingRules = // bind pending rules to the current transaction
(Set<PendingRuleData>) AlfrescoTransactionSupport.getResource(KEY_RULES_PENDING); pendingRules = new HashSet<PendingRuleData>();
if (pendingRules == null) AlfrescoTransactionSupport.bindResource(KEY_RULES_PENDING, pendingRules);
{ // bind the rule transaction listener
// bind pending rules to the current transaction AlfrescoTransactionSupport.bindListener(this.ruleTransactionListener);
pendingRules = new HashSet<PendingRuleData>();
AlfrescoTransactionSupport.bindResource(KEY_RULES_PENDING, pendingRules); if (logger.isDebugEnabled() == true)
// bind the rule transaction listener {
AlfrescoTransactionSupport.bindListener(this.ruleTransactionListener); logger.debug("Rule '" + rule.getTitle() + "' has been added pending execution to action upon node '" + actionedUponNodeRef.getId() + "'");
}
if (logger.isDebugEnabled() == true) }
{
logger.debug("Rule '" + rule.getTitle() + "' has been added pending execution to action upon node '" + actionedUponNodeRef.getId() + "'"); // Prevent hte same rule being executed more than one in the same transaction
} pendingRules.add(pendingRuleData);
}
// Prevent hte same rule being executed more than one in the same transaction
pendingRules.add(pendingRuleData);
}
} }
else else
{ {
@@ -699,12 +695,18 @@ public class RuleServiceImpl implements RuleService, RuntimeRuleService
} }
} }
} }
/** /**
* @see org.alfresco.repo.rule.RuleService#executePendingRules() * @see org.alfresco.repo.rule.RuleService#executePendingRules()
*/ */
public void executePendingRules() public void executePendingRules()
{ {
if (logger.isDebugEnabled() == true)
{
logger.debug("Creating the executed rules list");
}
AlfrescoTransactionSupport.bindResource(KEY_RULES_EXECUTED, new HashSet<ExecutedRuleData>()); AlfrescoTransactionSupport.bindResource(KEY_RULES_EXECUTED, new HashSet<ExecutedRuleData>());
try try
{ {
@@ -718,6 +720,10 @@ public class RuleServiceImpl implements RuleService, RuntimeRuleService
finally finally
{ {
AlfrescoTransactionSupport.unbindResource(KEY_RULES_EXECUTED); AlfrescoTransactionSupport.unbindResource(KEY_RULES_EXECUTED);
if (logger.isDebugEnabled() == true)
{
logger.debug("Unbinding resource");
}
} }
} }
@@ -762,22 +768,121 @@ public class RuleServiceImpl implements RuleService, RuntimeRuleService
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private void executePendingRule(PendingRuleData pendingRule) private void executePendingRule(PendingRuleData pendingRule)
{ {
NodeRef actionableNodeRef = pendingRule.getActionableNodeRef(); Set<ExecutedRuleData> executedRules =
(Set<ExecutedRuleData>) AlfrescoTransactionSupport.getResource(KEY_RULES_EXECUTED);
NodeRef actionedUponNodeRef = pendingRule.getActionedUponNodeRef(); NodeRef actionedUponNodeRef = pendingRule.getActionedUponNodeRef();
Rule rule = pendingRule.getRule(); Rule rule = pendingRule.getRule();
// Evaluate the condition if (executedRules == null || canExecuteRule(executedRules, actionedUponNodeRef, rule) == true)
if (this.actionService.evaluateAction(rule, actionedUponNodeRef) == true) {
{ // Evaluate the condition
// Add the rule to the executed rule list if (this.actionService.evaluateAction(rule, actionedUponNodeRef) == true)
// (do this before this is executed to prevent rules being added to the pending list) {
Set<ExecutedRuleData> executedRules = // Add the rule to the executed rule list
(Set<ExecutedRuleData>) AlfrescoTransactionSupport.getResource(KEY_RULES_EXECUTED); // (do this before this is executed to prevent rules being added to the pending list)
executedRules.add(new ExecutedRuleData(actionableNodeRef, rule)); executedRules.add(new ExecutedRuleData(actionedUponNodeRef, rule));
if (logger.isDebugEnabled() == true)
// Execute the rule {
this.actionService.executeAction(rule, actionedUponNodeRef); logger.debug(" ... Adding rule (" + rule.getTitle() + ") and nodeRef (" + actionedUponNodeRef.getId() + ") to executed list");
} }
// Execute the rule
this.actionService.executeAction(rule, actionedUponNodeRef);
}
}
}
/**
* Determines whether the rule can be executed
*
* @param executedRules
* @param actionedUponNodeRef
* @param rule
* @return
*/
private boolean canExecuteRule(Set<ExecutedRuleData> executedRules, NodeRef actionedUponNodeRef, Rule rule)
{
boolean result = true;
if (logger.isDebugEnabled() == true)
{
logger.debug(" >> Current executed items count = " + executedRules.size());
}
if (executedRules != null)
{
if (executedRules.contains(new ExecutedRuleData(actionedUponNodeRef, rule)) == true)
{
if (logger.isDebugEnabled() == true)
{
logger.debug(" >> Already executed this rule (" + rule.getTitle()+ ") on this nodeRef (" + actionedUponNodeRef.getId() + ")");
}
result = false;
}
else
{
result = checkForCopy(executedRules, actionedUponNodeRef, rule);
}
}
else
{
if (logger.isDebugEnabled() == true)
{
logger.debug(" >> Executed this rule (" + rule.getTitle()+ ") on (" + actionedUponNodeRef.getId() + ") executed rule is null");
}
}
return result;
}
/**
* Checks to see if a copy exists in the executed rules list
*
* @param executedRules
* @param actionedUponNodeRef
* @param rule
* @return
*/
private boolean checkForCopy(Set<ExecutedRuleData> executedRules, NodeRef actionedUponNodeRef, Rule rule)
{
boolean result = true;
if (this.nodeService.hasAspect(actionedUponNodeRef, ContentModel.ASPECT_COPIEDFROM) == true)
{
if (logger.isDebugEnabled() == true)
{
logger.debug(" >> Has the copied from aspect (" + actionedUponNodeRef.getId() + ")");
}
NodeRef copiedFrom = (NodeRef)this.nodeService.getProperty(actionedUponNodeRef, ContentModel.PROP_COPY_REFERENCE);
if (logger.isDebugEnabled() == true && copiedFrom != null) {logger.debug(" >> Got the copedFrom nodeRef (" + copiedFrom.getId() + ")");};
if (copiedFrom != null && executedRules.contains(new ExecutedRuleData(copiedFrom, rule)) == true)
{
if (logger.isDebugEnabled() == true)
{
logger.debug(" >> Already executed this rule (" + rule.getTitle()+ ") on this the copied from nodeRef (" + copiedFrom.getId() + ")");
}
return false;
}
else
{
if (logger.isDebugEnabled() == true)
{
logger.debug(" >> Executed this rule (" + rule.getTitle()+ ") on (" + actionedUponNodeRef.getId() + ") copiedFrom is not is list");
logger.debug(" > Checking copy");
}
result = checkForCopy(executedRules, copiedFrom, rule);
}
}
else
{
if (logger.isDebugEnabled() == true)
{
logger.debug(" >> Executed this rule (" + rule.getTitle()+ ") on (" + actionedUponNodeRef.getId() + ") no copied from aspect");
}
}
return result;
} }
/** /**

View File

@@ -22,16 +22,15 @@ import java.util.Set;
import org.alfresco.error.AlfrescoRuntimeException; import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
import org.apache.lucene.document.Document;
import org.apache.lucene.index.FilterIndexReader; import org.apache.lucene.index.FilterIndexReader;
import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.Term; import org.apache.lucene.index.Term;
import org.apache.lucene.index.TermDocs; import org.apache.lucene.index.TermDocs;
import org.apache.lucene.index.TermEnum; import org.apache.lucene.index.TermEnum;
import org.apache.lucene.index.TermPositions; import org.apache.lucene.index.TermPositions;
import org.apache.lucene.search.BooleanQuery;
import org.apache.lucene.search.Hits; import org.apache.lucene.search.Hits;
import org.apache.lucene.search.IndexSearcher; import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.MultiSearcher;
import org.apache.lucene.search.Searcher; import org.apache.lucene.search.Searcher;
import org.apache.lucene.search.TermQuery; import org.apache.lucene.search.TermQuery;
@@ -63,19 +62,23 @@ public class FilterIndexReaderByNodeRefs2 extends FilterIndexReader
Searcher searcher = new IndexSearcher(reader); Searcher searcher = new IndexSearcher(reader);
for (NodeRef nodeRef : deletions) for (NodeRef nodeRef : deletions)
{ {
BooleanQuery query = new BooleanQuery(); TermQuery query = new TermQuery(new Term("ID", nodeRef.toString()));
query.add(new TermQuery(new Term("ID", nodeRef.toString())), true, false);
query.add(new TermQuery(new Term("ISNODE", "T")), false, false);
Hits hits = searcher.search(query); Hits hits = searcher.search(query);
if (hits.length() > 0) if (hits.length() > 0)
{ {
for (int i = 0; i < hits.length(); i++) for (int i = 0; i < hits.length(); i++)
{ {
deletedDocuments.set(hits.id(i), true); Document doc = hits.doc(i);
if (doc.getField("ISCONTAINER") == null)
{
deletedDocuments.set(hits.id(i), true);
// There should only be one thing to delete
//break;
}
} }
} }
} }
} }
} }
catch (IOException e) catch (IOException e)

View File

@@ -47,7 +47,6 @@ import java.util.zip.CRC32;
import org.alfresco.error.AlfrescoRuntimeException; import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.repo.search.IndexerException; import org.alfresco.repo.search.IndexerException;
import org.alfresco.repo.search.impl.lucene.FilterIndexReaderByNodeRefs;
import org.alfresco.repo.search.impl.lucene.FilterIndexReaderByNodeRefs2; import org.alfresco.repo.search.impl.lucene.FilterIndexReaderByNodeRefs2;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.StoreRef; import org.alfresco.service.cmr.repository.StoreRef;
@@ -61,12 +60,14 @@ import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexWriter; import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.MultiReader; import org.apache.lucene.index.MultiReader;
import org.apache.lucene.index.Term; import org.apache.lucene.index.Term;
import org.apache.lucene.search.BooleanQuery;
import org.apache.lucene.search.Hits; import org.apache.lucene.search.Hits;
import org.apache.lucene.search.IndexSearcher; import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.Searcher; import org.apache.lucene.search.Searcher;
import org.apache.lucene.search.TermQuery; import org.apache.lucene.search.TermQuery;
import org.apache.lucene.store.Directory; import org.apache.lucene.store.Directory;
import org.apache.lucene.store.FSDirectory;
import org.apache.lucene.store.InputStream;
import org.apache.lucene.store.OutputStream;
import org.apache.lucene.store.RAMDirectory; import org.apache.lucene.store.RAMDirectory;
/** /**
@@ -205,6 +206,11 @@ public class IndexInfo
private static HashMap<File, IndexInfo> indexInfos = new HashMap<File, IndexInfo>(); private static HashMap<File, IndexInfo> indexInfos = new HashMap<File, IndexInfo>();
static
{
System.setProperty("disableLuceneLocks", "true");
}
public static synchronized IndexInfo getIndexInfo(File file) public static synchronized IndexInfo getIndexInfo(File file)
{ {
IndexInfo indexInfo = indexInfos.get(file); IndexInfo indexInfo = indexInfos.get(file);
@@ -249,7 +255,6 @@ public class IndexInfo
// a spanking new index // a spanking new index
version = 0; version = 0;
} }
// Open the files and channels // Open the files and channels
@@ -364,7 +369,7 @@ public class IndexInfo
} }
for (String id : deletable) for (String id : deletable)
{ {
IndexEntry entry = indexEntries.remove(id); indexEntries.remove(id);
deleteQueue.add(id); deleteQueue.add(id);
} }
synchronized (cleaner) synchronized (cleaner)
@@ -2008,7 +2013,6 @@ public class IndexInfo
} }
} }
// Check it is not deleting // Check it is not deleting
boolean foundDelta;
for (IndexEntry entry : indexEntries.values()) for (IndexEntry entry : indexEntries.values())
{ {
if (entry.getType() == IndexType.DELTA) if (entry.getType() == IndexType.DELTA)
@@ -2095,16 +2099,20 @@ public class IndexInfo
{ {
Searcher searcher = new IndexSearcher(reader); Searcher searcher = new IndexSearcher(reader);
BooleanQuery query = new BooleanQuery(); TermQuery query = new TermQuery(new Term("ID", nodeRef.toString()));
query.add(new TermQuery(new Term("ID", nodeRef.toString())), true, false);
query.add(new TermQuery(new Term("ISNODE", "T")), false, false);
Hits hits = searcher.search(query); Hits hits = searcher.search(query);
if (hits.length() > 0) if (hits.length() > 0)
{ {
for (int i = 0; i < hits.length(); i++) for (int i = 0; i < hits.length(); i++)
{ {
reader.delete(hits.id(i)); Document doc = hits.doc(i);
invalidIndexes.add(key); if (doc.getField("ISCONTAINER") == null)
{
reader.delete(hits.id(i));
invalidIndexes.add(key);
// There should only be one thing to delete
// break;
}
} }
} }
searcher.close(); searcher.close();
@@ -2332,7 +2340,10 @@ public class IndexInfo
{ {
int count = 0; int count = 0;
IndexReader[] readers = new IndexReader[toMerge.size() - 1]; IndexReader[] readers = new IndexReader[toMerge.size() - 1];
RAMDirectory ramDirectory = null;
IndexWriter writer = null; IndexWriter writer = null;
long docCount = 0;
File outputLocation = null;
for (IndexEntry entry : toMerge.values()) for (IndexEntry entry : toMerge.values())
{ {
File location = new File(indexDirectory, entry.getName()); File location = new File(indexDirectory, entry.getName());
@@ -2348,10 +2359,20 @@ public class IndexInfo
reader = IndexReader.open(emptyIndex); reader = IndexReader.open(emptyIndex);
} }
readers[count++] = reader; readers[count++] = reader;
docCount += entry.getDocumentCount();
} }
else if (entry.getStatus() == TransactionStatus.MERGE_TARGET) else if (entry.getStatus() == TransactionStatus.MERGE_TARGET)
{ {
writer = new IndexWriter(location, new StandardAnalyzer(), true); outputLocation = location;
if (docCount < 10000)
{
ramDirectory = new RAMDirectory();
writer = new IndexWriter(ramDirectory, new StandardAnalyzer(), true);
}
else
{
writer = new IndexWriter(location, new StandardAnalyzer(), true);
}
writer.setUseCompoundFile(true); writer.setUseCompoundFile(true);
writer.minMergeDocs = 1000; writer.minMergeDocs = 1000;
writer.mergeFactor = 5; writer.mergeFactor = 5;
@@ -2360,6 +2381,30 @@ public class IndexInfo
} }
writer.addIndexes(readers); writer.addIndexes(readers);
writer.close(); writer.close();
if (ramDirectory != null)
{
String[] files = ramDirectory.list();
Directory directory = FSDirectory.getDirectory(outputLocation, true);
for (int i = 0; i < files.length; i++)
{
// make place on ram disk
OutputStream os = directory.createFile(files[i]);
// read current file
InputStream is = ramDirectory.openFile(files[i]);
// and copy to ram disk
int len = (int) is.length();
byte[] buf = new byte[len];
is.readBytes(buf, 0, len);
os.writeBytes(buf, len);
// graceful cleanup
is.close();
os.close();
}
ramDirectory.close();
directory.close();
}
for (IndexReader reader : readers) for (IndexReader reader : readers)
{ {
reader.close(); reader.close();

View File

@@ -23,7 +23,6 @@ import org.alfresco.service.cmr.repository.ContentService;
import org.alfresco.service.cmr.repository.NodeService; import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.repository.TemplateException; import org.alfresco.service.cmr.repository.TemplateException;
import org.alfresco.service.cmr.repository.TemplateProcessor; import org.alfresco.service.cmr.repository.TemplateProcessor;
import org.alfresco.util.ISO9075;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import freemarker.cache.MruCacheStorage; import freemarker.cache.MruCacheStorage;
@@ -43,7 +42,10 @@ public class FreeMarkerProcessor implements TemplateProcessor
private final static String MSG_ERROR_TEMPLATE_FAIL = "error_template_fail"; private final static String MSG_ERROR_TEMPLATE_FAIL = "error_template_fail";
private final static String MSG_ERROR_TEMPLATE_IO = "error_template_io"; private final static String MSG_ERROR_TEMPLATE_IO = "error_template_io";
private static Logger logger = Logger.getLogger(FreeMarkerProcessor.class); private static final Logger logger = Logger.getLogger(FreeMarkerProcessor.class);
/** Pseudo path to String based template */
private static final String PATH = "string://fixed";
/** FreeMarker processor configuration */ /** FreeMarker processor configuration */
private Configuration config = null; private Configuration config = null;
@@ -75,7 +77,9 @@ public class FreeMarkerProcessor implements TemplateProcessor
} }
/** /**
* @return The FreeMarker config instance for this processor * Get the FreeMarker configuration for this instance
*
* @return FreeMarker configuration
*/ */
private Configuration getConfig() private Configuration getConfig()
{ {
@@ -100,26 +104,30 @@ public class FreeMarkerProcessor implements TemplateProcessor
return this.config; return this.config;
} }
/**
* FreeMarker configuration for loading the specified template directly from a String
*
* @param path Pseudo Path to the template
* @param template Template content
*
* @return FreeMarker configuration
*/
private Configuration getStringConfig(String path, String template) private Configuration getStringConfig(String path, String template)
{ {
Configuration config = new Configuration();
Configuration config = new Configuration(); // use our custom loader to load a template directly from a String
StringTemplateLoader stringTemplateLoader = new StringTemplateLoader();
// setup template cache stringTemplateLoader.putTemplate(path, template);
config.setCacheStorage(new MruCacheStorage(20, 0)); config.setTemplateLoader(stringTemplateLoader);
// use our custom loader to find templates on the ClassPath // use our custom object wrapper that can deal with QNameMap objects directly
StringTemplateLoader stringTemplateLoader = new StringTemplateLoader(); config.setObjectWrapper(new QNameAwareObjectWrapper());
stringTemplateLoader.putTemplate(path, template);
config.setTemplateLoader(stringTemplateLoader); // rethrow any exception so we can deal with them
config.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER);
// use our custom object wrapper that can deal with QNameMap objects directly
config.setObjectWrapper(new QNameAwareObjectWrapper()); return config;
// rethrow any exception so we can deal with them
config.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER);
return config;
} }
/** /**
@@ -142,8 +150,12 @@ public class FreeMarkerProcessor implements TemplateProcessor
try try
{ {
long startTime = 0;
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
logger.debug("Executing template: " + template + " on model: " + model); {
logger.debug("Executing template: " + template);// + " on model: " + model);
startTime = System.currentTimeMillis();
}
Template t = getConfig().getTemplate(template); Template t = getConfig().getTemplate(template);
if (t != null) if (t != null)
@@ -162,6 +174,12 @@ public class FreeMarkerProcessor implements TemplateProcessor
{ {
throw new TemplateException(MSG_ERROR_NO_TEMPLATE, new Object[] {template}); throw new TemplateException(MSG_ERROR_NO_TEMPLATE, new Object[] {template});
} }
if (logger.isDebugEnabled())
{
long endTime = System.currentTimeMillis();
logger.debug("Time to execute template: " + (endTime - startTime) + "ms");
}
} }
catch (IOException ioerr) catch (IOException ioerr)
{ {
@@ -169,8 +187,9 @@ public class FreeMarkerProcessor implements TemplateProcessor
} }
} }
private static final String PATH = "string://fixed"; /**
* @see org.alfresco.service.cmr.repository.TemplateProcessor#processString(java.lang.String, java.lang.Object, java.io.Writer)
*/
public void processString(String template, Object model, Writer out) public void processString(String template, Object model, Writer out)
{ {
if (template == null || template.length() == 0) if (template == null || template.length() == 0)
@@ -188,8 +207,12 @@ public class FreeMarkerProcessor implements TemplateProcessor
try try
{ {
long startTime = 0;
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
logger.debug("Executing template: " + template + " on model: " + model); {
logger.debug("Executing template: " + template);// + " on model: " + model);
startTime = System.currentTimeMillis();
}
Template t = getStringConfig(PATH, template).getTemplate(PATH); Template t = getStringConfig(PATH, template).getTemplate(PATH);
if (t != null) if (t != null)
@@ -198,6 +221,12 @@ public class FreeMarkerProcessor implements TemplateProcessor
{ {
// perform the template processing against supplied data model // perform the template processing against supplied data model
t.process(model, out); t.process(model, out);
if (logger.isDebugEnabled())
{
long endTime = System.currentTimeMillis();
logger.debug("Time to execute template: " + (endTime - startTime) + "ms");
}
} }
catch (Throwable err) catch (Throwable err)
{ {

View File

@@ -127,6 +127,9 @@ public class TemplateServiceImpl implements TemplateService, ApplicationContextA
return out.toString(); return out.toString();
} }
/**
* @see org.alfresco.service.cmr.repository.TemplateService#processTemplateString(java.lang.String, java.lang.String, java.lang.Object, java.io.Writer)
*/
public void processTemplateString(String engine, String template, Object model, Writer out) public void processTemplateString(String engine, String template, Object model, Writer out)
throws TemplateException throws TemplateException
{ {
@@ -146,6 +149,9 @@ public class TemplateServiceImpl implements TemplateService, ApplicationContextA
} }
} }
/**
* @see org.alfresco.service.cmr.repository.TemplateService#processTemplateString(java.lang.String, java.lang.String, java.lang.Object)
*/
public String processTemplateString(String engine, String template, Object model) public String processTemplateString(String engine, String template, Object model)
throws TemplateException throws TemplateException
{ {
@@ -154,7 +160,6 @@ public class TemplateServiceImpl implements TemplateService, ApplicationContextA
return out.toString(); return out.toString();
} }
/** /**
* Return the TemplateProcessor implementation for the named template engine * Return the TemplateProcessor implementation for the named template engine
* *
@@ -169,7 +174,7 @@ public class TemplateServiceImpl implements TemplateService, ApplicationContextA
Map<String, TemplateProcessor> procMap = processors.get(); Map<String, TemplateProcessor> procMap = processors.get();
if (procMap == null) if (procMap == null)
{ {
procMap = new HashMap<String, TemplateProcessor>(7, 1.0f); procMap = new HashMap<String, TemplateProcessor>(2, 1.0f);
processors.set(procMap); processors.set(procMap);
} }

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;
import java.lang.reflect.Method;
import junit.framework.TestCase;
public class AnnotationTest extends TestCase
{
public AnnotationTest()
{
super();
}
public AnnotationTest(String arg0)
{
super(arg0);
}
public void testAnnotations() throws Exception, NoSuchMethodException
{
Class clazz = AnnotationTestInterface.class;
Method method = clazz.getMethod("noArgs", new Class[]{});
assertTrue(method.isAnnotationPresent(Auditable.class));
Auditable auditable = method.getAnnotation(Auditable.class);
assertEquals(auditable.key(), Auditable.Key.NO_KEY);
assertEquals(auditable.parameters().length, 0);
method = clazz.getMethod("getString", new Class[]{String.class, String.class});
assertTrue(method.isAnnotationPresent(Auditable.class));
auditable = method.getAnnotation(Auditable.class);
assertEquals(auditable.key(), Auditable.Key.ARG_0);
assertEquals(auditable.parameters().length, 2);
assertEquals(auditable.parameters()[0], "one");
assertEquals(auditable.parameters()[1], "two");
method = clazz.getMethod("getAnotherString", new Class[]{String.class});
assertTrue(method.isAnnotationPresent(Auditable.class));
auditable = method.getAnnotation(Auditable.class);
assertEquals(auditable.key(), Auditable.Key.ARG_0);
assertEquals(auditable.parameters().length, 1);
assertEquals(auditable.parameters()[0], "one");
}
}

View File

@@ -0,0 +1,34 @@
/*
* 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;
/**
* An interface to test the use of the auditable annotation.
*
* @author Andy Hind
*/
public interface AnnotationTestInterface
{
@Auditable()
public void noArgs();
@Auditable(key = Auditable.Key.ARG_0, parameters = {"one", "two"})
public String getString(String one, String two);
@Auditable(key = Auditable.Key.ARG_0, parameters = {"one"})
public String getAnotherString(String one);
}

View File

@@ -0,0 +1,83 @@
/*
* 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;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Annotation to defined key and parameter names for the auditing API.
*
* If this annotation is present on a public service interface it will be considered for auditing. If it is not present the method will never be audited.
*
* Note that the service name and method name can be found from the bean definition and the method invocation.
*
* @author Andy Hind
*/
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface Auditable
{
enum Key
{
NO_KEY, RETURN, ARG_0, ARG_1, ARG_2, ARG_3, ARG_4, ARG_5, ARG_6, ARG_7, ARG_8, ARG_9
}
/**
* The position of the key argument in the method list.
*
* @return -1 indicates there is no key
*/
Auditable.Key key() default Key.NO_KEY;
/**
* The names of the parameters
*
* @return a String[] of parameter names, the default is an empty array.
*/
String[] parameters() default {};
/**
* If a method as marked as warn, it is potentially an audit hole.
* Typically a method returns an object which allows unaudited access.
*
* This is intended to mark things that appear to expose unsafe API calls.
*
* @return
*/
boolean warn() default false;
/**
* All method parameters are recorded by default.
* This can be used to stop a parameter being written to the audit log.
* It will be entered as "******".
*
* @return
*/
boolean[] recordable() default {};
/**
* Return object are recorded by default.
* Setting this means they can never be recorded in the audit.
*
* @return
*/
boolean recordReturnedObject() default true;
}

View File

@@ -0,0 +1,35 @@
/*
* 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;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Specifically indicate that a method is not to be audited.
* This is a marker annotation.
*
* @author Andy Hind
*/
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface NotAuditable
{
}

View File

@@ -87,6 +87,7 @@ public interface ServiceRegistry
* *
* @return list of provided Services * @return list of provided Services
*/ */
@NotAuditable
Collection<QName> getServices(); Collection<QName> getServices();
/** /**
@@ -95,6 +96,7 @@ public interface ServiceRegistry
* @param service name of service to test provision of * @param service name of service to test provision of
* @return true => provided, false => not provided * @return true => provided, false => not provided
*/ */
@NotAuditable
boolean isServiceProvided(QName service); boolean isServiceProvided(QName service);
/** /**
@@ -103,6 +105,7 @@ public interface ServiceRegistry
* @param service name of service to retrieve meta data for * @param service name of service to retrieve meta data for
* @return the service meta data * @return the service meta data
*/ */
@NotAuditable
ServiceDescriptor getServiceDescriptor(QName service); ServiceDescriptor getServiceDescriptor(QName service);
/** /**
@@ -110,121 +113,145 @@ public interface ServiceRegistry
* *
* @param service name of service to retrieve * @param service name of service to retrieve
* @return the service interface (must cast to interface as described in service meta-data) * @return the service interface (must cast to interface as described in service meta-data)
*/ */
@NotAuditable
Object getService(QName service); Object getService(QName service);
/** /**
* @return the descriptor service * @return the descriptor service
*/ */
@NotAuditable
DescriptorService getDescriptorService(); DescriptorService getDescriptorService();
/** /**
* @return the transaction service * @return the transaction service
*/ */
@NotAuditable
TransactionService getTransactionService(); TransactionService getTransactionService();
/** /**
* @return the namespace service (or null, if one is not provided) * @return the namespace service (or null, if one is not provided)
*/ */
@NotAuditable
NamespaceService getNamespaceService(); NamespaceService getNamespaceService();
/** /**
* @return the authentication service (or null, if one is not provided) * @return the authentication service (or null, if one is not provided)
*/ */
@NotAuditable
AuthenticationService getAuthenticationService(); AuthenticationService getAuthenticationService();
/** /**
* @return the node service (or null, if one is not provided) * @return the node service (or null, if one is not provided)
*/ */
@NotAuditable
NodeService getNodeService(); NodeService getNodeService();
/** /**
* @return the content service (or null, if one is not provided) * @return the content service (or null, if one is not provided)
*/ */
@NotAuditable
ContentService getContentService(); ContentService getContentService();
/** /**
* @return the mimetype service (or null, if one is not provided) * @return the mimetype service (or null, if one is not provided)
*/ */
@NotAuditable
MimetypeService getMimetypeService(); MimetypeService getMimetypeService();
/** /**
* @return the search service (or null, if one is not provided) * @return the search service (or null, if one is not provided)
*/ */
@NotAuditable
SearchService getSearchService(); SearchService getSearchService();
/** /**
* @return the version service (or null, if one is not provided) * @return the version service (or null, if one is not provided)
*/ */
@NotAuditable
VersionService getVersionService(); VersionService getVersionService();
/** /**
* @return the lock service (or null, if one is not provided) * @return the lock service (or null, if one is not provided)
*/ */
@NotAuditable
LockService getLockService(); LockService getLockService();
/** /**
* @return the dictionary service (or null, if one is not provided) * @return the dictionary service (or null, if one is not provided)
*/ */
@NotAuditable
DictionaryService getDictionaryService(); DictionaryService getDictionaryService();
/** /**
* @return the copy service (or null, if one is not provided) * @return the copy service (or null, if one is not provided)
*/ */
@NotAuditable
CopyService getCopyService(); CopyService getCopyService();
/** /**
* @return the checkout / checkin service (or null, if one is not provided) * @return the checkout / checkin service (or null, if one is not provided)
*/ */
@NotAuditable
CheckOutCheckInService getCheckOutCheckInService(); CheckOutCheckInService getCheckOutCheckInService();
/** /**
* @return the category service (or null, if one is not provided) * @return the category service (or null, if one is not provided)
*/ */
@NotAuditable
CategoryService getCategoryService(); CategoryService getCategoryService();
/** /**
* @return the importer service or null if not present * @return the importer service or null if not present
*/ */
@NotAuditable
ImporterService getImporterService(); ImporterService getImporterService();
/** /**
* @return the exporter service or null if not present * @return the exporter service or null if not present
*/ */
@NotAuditable
ExporterService getExporterService(); ExporterService getExporterService();
/** /**
* @return the rule service (or null, if one is not provided) * @return the rule service (or null, if one is not provided)
*/ */
@NotAuditable
RuleService getRuleService(); RuleService getRuleService();
/** /**
* @return the action service (or null if one is not provided) * @return the action service (or null if one is not provided)
*/ */
@NotAuditable
ActionService getActionService(); ActionService getActionService();
/** /**
* @return the permission service (or null if one is not provided) * @return the permission service (or null if one is not provided)
*/ */
@NotAuditable
PermissionService getPermissionService(); PermissionService getPermissionService();
/** /**
* @return the authority service (or null if one is not provided) * @return the authority service (or null if one is not provided)
*/ */
@NotAuditable
AuthorityService getAuthorityService(); AuthorityService getAuthorityService();
/** /**
* @return the template service (or null if one is not provided) * @return the template service (or null if one is not provided)
*/ */
@NotAuditable
TemplateService getTemplateService(); TemplateService getTemplateService();
/** /**
* @return the file-folder manipulation service (or null if one is not provided) * @return the file-folder manipulation service (or null if one is not provided)
*/ */
@NotAuditable
FileFolderService getFileFolderService(); FileFolderService getFileFolderService();
/** /**
* @return the script execution service (or null if one is not provided) * @return the script execution service (or null if one is not provided)
*/ */
@NotAuditable
ScriptService getScriptService(); ScriptService getScriptService();
} }

View File

@@ -20,6 +20,7 @@ import java.io.Serializable;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.alfresco.service.Auditable;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
/** /**
@@ -35,6 +36,7 @@ public interface ActionService
* @param name the name of the action definition * @param name the name of the action definition
* @return the action definition * @return the action definition
*/ */
@Auditable(parameters = {"name"})
ActionDefinition getActionDefinition(String name); ActionDefinition getActionDefinition(String name);
/** /**
@@ -42,6 +44,7 @@ public interface ActionService
* *
* @return the list action definitions * @return the list action definitions
*/ */
@Auditable()
List<ActionDefinition> getActionDefinitions(); List<ActionDefinition> getActionDefinitions();
/** /**
@@ -51,6 +54,7 @@ public interface ActionService
* @param nodeRef the node reference * @param nodeRef the node reference
* @return a list of applicable action definitions * @return a list of applicable action definitions
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef"})
List<ActionDefinition> getActionDefinitions(NodeRef nodeRef); List<ActionDefinition> getActionDefinitions(NodeRef nodeRef);
/** /**
@@ -59,6 +63,7 @@ public interface ActionService
* @param name the name of the action condition definition * @param name the name of the action condition definition
* @return the action condition definition * @return the action condition definition
*/ */
@Auditable(parameters = {"name"})
ActionConditionDefinition getActionConditionDefinition(String name); ActionConditionDefinition getActionConditionDefinition(String name);
/** /**
@@ -66,6 +71,7 @@ public interface ActionService
* *
* @return the list of aciton condition definitions * @return the list of aciton condition definitions
*/ */
@Auditable(parameters = {})
List<ActionConditionDefinition> getActionConditionDefinitions(); List<ActionConditionDefinition> getActionConditionDefinitions();
/** /**
@@ -74,15 +80,17 @@ public interface ActionService
* @param name the action definition name * @param name the action definition name
* @return the action * @return the action
*/ */
@Auditable(parameters = {"name"})
Action createAction(String name); Action createAction(String name);
/** /**
* Create a new action specifying the initial set of parameter values * Create a new action specifying the initial set of parameter values
* *
* @param name the action defintion name * @param name the action definition name
* @param params the parameter values * @param params the parameter values
* @return the action * @return the action
*/ */
@Auditable(parameters = {"name", "params"})
Action createAction(String name, Map<String, Serializable> params); Action createAction(String name, Map<String, Serializable> params);
/** /**
@@ -90,6 +98,7 @@ public interface ActionService
* *
* @return the composite action * @return the composite action
*/ */
@Auditable()
CompositeAction createCompositeAction(); CompositeAction createCompositeAction();
/** /**
@@ -98,15 +107,17 @@ public interface ActionService
* @param name the action condition definition name * @param name the action condition definition name
* @return the action condition * @return the action condition
*/ */
@Auditable(parameters = {"name"})
ActionCondition createActionCondition(String name); ActionCondition createActionCondition(String name);
/** /**
* Create an action condition specifying the initial set of parameter values * Create an action condition specifying the initial set of parameter values
* *
* @param name the aciton condition definition name * @param name the action condition definition name
* @param params the parameter valeus * @param params the parameter values
* @return the action condition * @return the action condition
*/ */
@Auditable(parameters = {"name", "params"})
ActionCondition createActionCondition(String name, Map<String, Serializable> params); ActionCondition createActionCondition(String name, Map<String, Serializable> params);
/** /**
@@ -117,10 +128,11 @@ public interface ActionService
* @param action the action * @param action the action
* @param actionedUponNodeRef the actioned upon node reference * @param actionedUponNodeRef the actioned upon node reference
*/ */
@Auditable(key = Auditable.Key.ARG_1, parameters = {"action", "actionedUponNodeRef" })
void executeAction(Action action, NodeRef actionedUponNodeRef); void executeAction(Action action, NodeRef actionedUponNodeRef);
/** /**
* The action is sexecuted based on the asynchronous attribute of the action. * The action is executed based on the asynchronous attribute of the action.
* *
* @see ActionService#executeAction(Action, NodeRef, boolean, boolean) * @see ActionService#executeAction(Action, NodeRef, boolean, boolean)
* *
@@ -128,6 +140,7 @@ public interface ActionService
* @param actionedUponNodeRef the actioned upon node reference * @param actionedUponNodeRef the actioned upon node reference
* @param checkConditions indicates whether the conditions should be checked * @param checkConditions indicates whether the conditions should be checked
*/ */
@Auditable(key = Auditable.Key.ARG_1, parameters = {"action", "actionedUponNodeRef", "checkConditions" })
void executeAction(Action action, NodeRef actionedUponNodeRef, boolean checkConditions); void executeAction(Action action, NodeRef actionedUponNodeRef, boolean checkConditions);
/** /**
@@ -149,6 +162,7 @@ public interface ActionService
* @param executeAsynchronously indicates whether the action should be executed asychronously or not, this value overrides * @param executeAsynchronously indicates whether the action should be executed asychronously or not, this value overrides
* the value set on the action its self * the value set on the action its self
*/ */
@Auditable(key = Auditable.Key.ARG_1, parameters = {"action", "actionedUponNodeRef", "checkConditions", "executeAsynchronously" })
void executeAction(Action action, NodeRef actionedUponNodeRef, boolean checkConditions, boolean executeAsynchronously); void executeAction(Action action, NodeRef actionedUponNodeRef, boolean checkConditions, boolean executeAsynchronously);
/** /**
@@ -163,6 +177,7 @@ public interface ActionService
* @param actionedUponNodeRef the actioned upon node reference * @param actionedUponNodeRef the actioned upon node reference
* @return true if the condition succeeds, false otherwise * @return true if the condition succeeds, false otherwise
*/ */
@Auditable(key = Auditable.Key.ARG_1, parameters = {"action", "actionedUponNodeRef" })
boolean evaluateAction(Action action, NodeRef actionedUponNodeRef); boolean evaluateAction(Action action, NodeRef actionedUponNodeRef);
/** /**
@@ -172,6 +187,7 @@ public interface ActionService
* @param actionedUponNodeRef the actioned upon node reference * @param actionedUponNodeRef the actioned upon node reference
* @return true if the condition succeeds, false otherwise * @return true if the condition succeeds, false otherwise
*/ */
@Auditable(key = Auditable.Key.ARG_1, parameters = {"condition", "actionedUponNodeRef" })
boolean evaluateActionCondition(ActionCondition condition, NodeRef actionedUponNodeRef); boolean evaluateActionCondition(ActionCondition condition, NodeRef actionedUponNodeRef);
/** /**
@@ -184,14 +200,16 @@ public interface ActionService
* @param nodeRef the node reference * @param nodeRef the node reference
* @param action the action * @param action the action
*/ */
@Auditable(key = Auditable.Key.ARG_1, parameters = {"nodeRef", "action" })
void saveAction(NodeRef nodeRef, Action action); void saveAction(NodeRef nodeRef, Action action);
/** /**
* Gets all the actions currently saved on the given node reference. * Gets all the actions currently saved on the given node reference.
* *
* @param nodeRef the ndoe reference * @param nodeRef the node reference
* @return the list of actions * @return the list of actions
*/ */
@Auditable(key = Auditable.Key.ARG_1, parameters = {"nodeRef"})
List<Action> getActions(NodeRef nodeRef); List<Action> getActions(NodeRef nodeRef);
/** /**
@@ -203,14 +221,16 @@ public interface ActionService
* @param actionId the action id * @param actionId the action id
* @return the action * @return the action
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef", "actionId"})
Action getAction(NodeRef nodeRef, String actionId); Action getAction(NodeRef nodeRef, String actionId);
/** /**
* Removes an action associatied with a node reference. * Removes an action associated with a node reference.
* *
* @param nodeRef the node reference * @param nodeRef the node reference
* @param action the action * @param action the action
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef", "action" })
void removeAction(NodeRef nodeRef, Action action); void removeAction(NodeRef nodeRef, Action action);
/** /**
@@ -218,6 +238,7 @@ public interface ActionService
* *
* @param nodeRef the node reference * @param nodeRef the node reference
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef"})
void removeAllActions(NodeRef nodeRef); void removeAllActions(NodeRef nodeRef);
} }

View File

@@ -19,6 +19,7 @@ package org.alfresco.service.cmr.coci;
import java.io.Serializable; import java.io.Serializable;
import java.util.Map; import java.util.Map;
import org.alfresco.service.Auditable;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.namespace.QName; import org.alfresco.service.namespace.QName;
@@ -33,10 +34,10 @@ public interface CheckOutCheckInService
/** /**
* Checks out the given node placing a working copy in the destination specified. * Checks out the given node placing a working copy in the destination specified.
* <p> * <p>
* When a node is checked out a read-only lock is placed on the origional node and * When a node is checked out a read-only lock is placed on the original node and
* a working copy is placed in the destination specified. * a working copy is placed in the destination specified.
* <p> * <p>
* The copy aspect is applied to the working copy so that the origional node can be * The copy aspect is applied to the working copy so that the original node can be
* identified. * identified.
* <p> * <p>
* The working copy aspect is applied to the working copy so that it can be identified * The working copy aspect is applied to the working copy so that it can be identified
@@ -53,6 +54,7 @@ public interface CheckOutCheckInService
* the working copy * the working copy
* @return node reference to the created working copy * @return node reference to the created working copy
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef", "destinationParentNodeRef", "destinationAssocTypeQName", "destinationAssocQName"})
public NodeRef checkout( public NodeRef checkout(
NodeRef nodeRef, NodeRef nodeRef,
NodeRef destinationParentNodeRef, NodeRef destinationParentNodeRef,
@@ -68,38 +70,40 @@ public interface CheckOutCheckInService
* @param nodeRef a reference to the node to checkout * @param nodeRef a reference to the node to checkout
* @return a node reference to the created working copy * @return a node reference to the created working copy
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef"})
public NodeRef checkout(NodeRef nodeRef); public NodeRef checkout(NodeRef nodeRef);
/** /**
* Checks in the working node specified. * Checks in the working node specified.
* <p> * <p>
* When a working copy is checked in the current state of the working copy is copyied to the * When a working copy is checked in the current state of the working copy is copied to the
* origional node. This will include any content updated in the working node. * original node. This will include any content updated in the working node.
* <p> * <p>
* If version properties are provided the origional node will be versioned and updated accordingly. * If version properties are provided the original node will be versioned and updated accordingly.
* <p> * <p>
* If a content Url is provided it will be used to update the content of the working node before the * If a content Url is provided it will be used to update the content of the working node before the
* checkin opertaion takes place. * checkin operation takes place.
* <p> * <p>
* Once the operation has completed the read lock applied to the origional node during checkout will * Once the operation has completed the read lock applied to the original node during checkout will
* be removed and the working copy of the node deleted from the repository, unless the operation is * be removed and the working copy of the node deleted from the repository, unless the operation is
* instructed to keep the origional node checked out. In which case the lock and the working copy will * instructed to keep the original node checked out. In which case the lock and the working copy will
* remain. * remain.
* <p> * <p>
* The node reference to the origional node is returned. * The node reference to the original node is returned.
* *
* @param workingCopyNodeRef the working copy node reference * @param workingCopyNodeRef the working copy node reference
* @param versionProperties the version properties. If null is passed then the origional node * @param versionProperties the version properties. If null is passed then the original node
* is NOT versioned during the checkin operation. * is NOT versioned during the checkin operation.
* @param contentUrl a content url that should be set on the working copy before * @param contentUrl a content url that should be set on the working copy before
* the checkin opertation takes place. If null then the current working * the checkin operation takes place. If null then the current working
* copy content is copied back to the origional node. * copy content is copied back to the original node.
* @param keepCheckedOut indicates whether the node should remain checked out after the checkin * @param keepCheckedOut indicates whether the node should remain checked out after the checkin
* has taken place. When the node remains checked out the working node * has taken place. When the node remains checked out the working node
* reference remains the same. * reference remains the same.
* @return the node reference to the origional node, updated with the checked in * @return the node reference to the original node, updated with the checked in
* state * state
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"workingCopyNodeRef", "versionProperties", "contentUrl", "keepCheckedOut"})
public NodeRef checkin( public NodeRef checkin(
NodeRef workingCopyNodeRef, NodeRef workingCopyNodeRef,
Map<String,Serializable> versionProperties, Map<String,Serializable> versionProperties,
@@ -112,14 +116,15 @@ public interface CheckOutCheckInService
* @see VersionOperationsService#checkin(NodeRef, HashMap<String,Serializable>, String, boolean) * @see VersionOperationsService#checkin(NodeRef, HashMap<String,Serializable>, String, boolean)
* *
* @param workingCopyNodeRef the working copy node reference * @param workingCopyNodeRef the working copy node reference
* @param versionProperties the version properties. If null is passed then the origional node * @param versionProperties the version properties. If null is passed then the original node
* is NOT versioned during the checkin operation. * is NOT versioned during the checkin operation.
* @param contentUrl a content url that should be set on the working copy before * @param contentUrl a content url that should be set on the working copy before
* the checkin opertation takes place. If null then the current working * the checkin operation takes place. If null then the current working
* copy content is copied back to the origional node. * copy content is copied back to the original node.
* @return the node reference to the origional node, updated with the checked in * @return the node reference to the original node, updated with the checked in
* state * state
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"workingCopyNodeRef", "versionProperties", "contentUrl"})
public NodeRef checkin( public NodeRef checkin(
NodeRef workingCopyNodeRef, NodeRef workingCopyNodeRef,
Map<String, Serializable> versionProperties, Map<String, Serializable> versionProperties,
@@ -132,11 +137,12 @@ public interface CheckOutCheckInService
* @see VersionOperationsService#checkin(NodeRef, HashMap<String,Serializable>, String) * @see VersionOperationsService#checkin(NodeRef, HashMap<String,Serializable>, String)
* *
* @param workingCopyNodeRef the working copy node reference * @param workingCopyNodeRef the working copy node reference
* @param versionProperties the version properties. If null is passed then the origional node * @param versionProperties the version properties. If null is passed then the original node
* is NOT versioned during the checkin operation. * is NOT versioned during the checkin operation.
* @return the node reference to the origional node, updated with the checked in * @return the node reference to the original node, updated with the checked in
* state * state
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"workingCopyNodeRef", "versionProperties"})
public NodeRef checkin( public NodeRef checkin(
NodeRef workingCopyNodeRef, NodeRef workingCopyNodeRef,
Map<String, Serializable> versionProperties); Map<String, Serializable> versionProperties);
@@ -144,16 +150,17 @@ public interface CheckOutCheckInService
/** /**
* Cancels the checkout for a given working copy. * Cancels the checkout for a given working copy.
* <p> * <p>
* The read-only lock on the origional node is removed and the working copy is removed. * The read-only lock on the original node is removed and the working copy is removed.
* <p> * <p>
* Note that all modification made to the working copy will be lost and the origional node * Note that all modification made to the working copy will be lost and the original node
* will remiain unchanged. * will remain unchanged.
* <p> * <p>
* A reference to the origional node reference is returned. * A reference to the original node reference is returned.
* *
* @param workingCopyNodeRef the working copy node reference * @param workingCopyNodeRef the working copy node reference
* @return the origional node reference * @return the original node reference
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"workingCopyNodeRef"})
public NodeRef cancelCheckout(NodeRef workingCopyNodeRef); public NodeRef cancelCheckout(NodeRef workingCopyNodeRef);
/** /**
@@ -164,5 +171,6 @@ public interface CheckOutCheckInService
* @param nodeRef a node reference * @param nodeRef a node reference
* @return the working copy node reference or null if none. * @return the working copy node reference or null if none.
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef"})
public NodeRef getWorkingCopy(NodeRef nodeRef); public NodeRef getWorkingCopy(NodeRef nodeRef);
} }

View File

@@ -18,6 +18,7 @@ package org.alfresco.service.cmr.dictionary;
import java.util.Collection; import java.util.Collection;
import org.alfresco.service.NotAuditable;
import org.alfresco.service.namespace.QName; import org.alfresco.service.namespace.QName;
@@ -40,52 +41,61 @@ public interface DictionaryService
/** /**
* @return the names of all models that have been registered with the Repository * @return the names of all models that have been registered with the Repository
*/ */
@NotAuditable
public Collection<QName> getAllModels(); public Collection<QName> getAllModels();
/** /**
* @param model the model name to retrieve * @param model the model name to retrieve
* @return the specified model (or null, if it doesn't exist) * @return the specified model (or null, if it doesn't exist)
*/ */
@NotAuditable
public ModelDefinition getModel(QName model); public ModelDefinition getModel(QName model);
/** /**
* @return the names of all data types that have been registered with the Repository * @return the names of all data types that have been registered with the Repository
*/ */
@NotAuditable
Collection<QName> getAllDataTypes(); Collection<QName> getAllDataTypes();
/** /**
* @param model the model to retrieve data types for * @param model the model to retrieve data types for
* @return the names of all data types defined within the specified model * @return the names of all data types defined within the specified model
*/ */
@NotAuditable
Collection<QName> getDataTypes(QName model); Collection<QName> getDataTypes(QName model);
/** /**
* @param name the name of the data type to retrieve * @param name the name of the data type to retrieve
* @return the data type definition (or null, if it doesn't exist) * @return the data type definition (or null, if it doesn't exist)
*/ */
@NotAuditable
DataTypeDefinition getDataType(QName name); DataTypeDefinition getDataType(QName name);
/** /**
* @param javaClass java class to find datatype for * @param javaClass java class to find datatype for
* @return the data type definition (or null, if a mapping does not exist) * @return the data type definition (or null, if a mapping does not exist)
*/ */
@NotAuditable
DataTypeDefinition getDataType(Class javaClass); DataTypeDefinition getDataType(Class javaClass);
/** /**
* @return the names of all types that have been registered with the Repository * @return the names of all types that have been registered with the Repository
*/ */
@NotAuditable
Collection<QName> getAllTypes(); Collection<QName> getAllTypes();
/** /**
* @param model the model to retrieve types for * @param model the model to retrieve types for
* @return the names of all types defined within the specified model * @return the names of all types defined within the specified model
*/ */
@NotAuditable
Collection<QName> getTypes(QName model); Collection<QName> getTypes(QName model);
/** /**
* @param name the name of the type to retrieve * @param name the name of the type to retrieve
* @return the type definition (or null, if it doesn't exist) * @return the type definition (or null, if it doesn't exist)
*/ */
@NotAuditable
TypeDefinition getType(QName name); TypeDefinition getType(QName name);
/** /**
@@ -96,29 +106,34 @@ public interface DictionaryService
* @param aspects the aspects to combine with the type * @param aspects the aspects to combine with the type
* @return the anonymous type definition * @return the anonymous type definition
*/ */
@NotAuditable
TypeDefinition getAnonymousType(QName type, Collection<QName> aspects); TypeDefinition getAnonymousType(QName type, Collection<QName> aspects);
/** /**
* @return the names of all aspects that have been registered with the Repository * @return the names of all aspects that have been registered with the Repository
*/ */
@NotAuditable
Collection<QName> getAllAspects(); Collection<QName> getAllAspects();
/** /**
* @param model the model to retrieve aspects for * @param model the model to retrieve aspects for
* @return the names of all aspects defined within the specified model * @return the names of all aspects defined within the specified model
*/ */
@NotAuditable
Collection<QName> getAspects(QName model); Collection<QName> getAspects(QName model);
/** /**
* @param name the name of the aspect to retrieve * @param name the name of the aspect to retrieve
* @return the aspect definition (or null, if it doesn't exist) * @return the aspect definition (or null, if it doesn't exist)
*/ */
@NotAuditable
AspectDefinition getAspect(QName name); AspectDefinition getAspect(QName name);
/** /**
* @param name the name of the class (type or aspect) to retrieve * @param name the name of the class (type or aspect) to retrieve
* @return the class definition (or null, if it doesn't exist) * @return the class definition (or null, if it doesn't exist)
*/ */
@NotAuditable
ClassDefinition getClass(QName name); ClassDefinition getClass(QName name);
/** /**
@@ -128,6 +143,7 @@ public interface DictionaryService
* @param ofClassName the class to test against * @param ofClassName the class to test against
* @return true => the class is a sub-class (or itself) * @return true => the class is a sub-class (or itself)
*/ */
@NotAuditable
boolean isSubClass(QName className, QName ofClassName); boolean isSubClass(QName className, QName ofClassName);
/** /**
@@ -140,6 +156,7 @@ public interface DictionaryService
* @param propertyName the property name * @param propertyName the property name
* @return the property definition (or null, if it doesn't exist) * @return the property definition (or null, if it doesn't exist)
*/ */
@NotAuditable
PropertyDefinition getProperty(QName className, QName propertyName); PropertyDefinition getProperty(QName className, QName propertyName);
/** /**
@@ -148,6 +165,7 @@ public interface DictionaryService
* @param propertyName the property name * @param propertyName the property name
* @return the property definition (or null, if it doesn't exist) * @return the property definition (or null, if it doesn't exist)
*/ */
@NotAuditable
PropertyDefinition getProperty(QName propertyName); PropertyDefinition getProperty(QName propertyName);
/** /**
@@ -156,6 +174,7 @@ public interface DictionaryService
* @param associationName the property name * @param associationName the property name
* @return the association definition (or null, if it doesn't exist) * @return the association definition (or null, if it doesn't exist)
*/ */
@NotAuditable
AssociationDefinition getAssociation(QName associationName); AssociationDefinition getAssociation(QName associationName);
// TODO: Behaviour definitions // TODO: Behaviour definitions

View File

@@ -19,6 +19,7 @@ package org.alfresco.service.cmr.lock;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import org.alfresco.service.Auditable;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.StoreRef; import org.alfresco.service.cmr.repository.StoreRef;
@@ -46,6 +47,7 @@ public interface LockService
* @throws UnableToAquireLockException * @throws UnableToAquireLockException
* thrown if the lock could not be obtained * thrown if the lock could not be obtained
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef", "lockType"})
public void lock(NodeRef nodeRef, LockType lockType) public void lock(NodeRef nodeRef, LockType lockType)
throws UnableToAquireLockException; throws UnableToAquireLockException;
@@ -71,6 +73,7 @@ public interface LockService
* @throws UnableToAquireLockException * @throws UnableToAquireLockException
* thrown if the lock could not be obtained * thrown if the lock could not be obtained
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef", "lockType", "timeToExpire"})
public void lock(NodeRef nodeRef, LockType lockType, int timeToExpire) public void lock(NodeRef nodeRef, LockType lockType, int timeToExpire)
throws UnableToAquireLockException; throws UnableToAquireLockException;
@@ -102,6 +105,7 @@ public interface LockService
* @throws UnableToAquireLockException * @throws UnableToAquireLockException
* thrown if the lock could not be obtained * thrown if the lock could not be obtained
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef", "lockType", "timeToExpire", "lockChildren"})
public void lock(NodeRef nodeRef, LockType lockType, int timeToExpire, boolean lockChildren) public void lock(NodeRef nodeRef, LockType lockType, int timeToExpire, boolean lockChildren)
throws UnableToAquireLockException; throws UnableToAquireLockException;
@@ -129,6 +133,7 @@ public interface LockService
* @throws UnableToAquireLockException * @throws UnableToAquireLockException
* thrown if the lock could not be obtained * thrown if the lock could not be obtained
*/ */
@Auditable(parameters = {"nodeRefs", "lockType", "timeToExpire"})
public void lock(Collection<NodeRef> nodeRefs, LockType lockType, int timeToExpire) public void lock(Collection<NodeRef> nodeRefs, LockType lockType, int timeToExpire)
throws UnableToAquireLockException; throws UnableToAquireLockException;
@@ -143,6 +148,7 @@ public interface LockService
* @throws UnableToReleaseLockException * @throws UnableToReleaseLockException
* thrown if the lock could not be released * thrown if the lock could not be released
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef"})
public void unlock(NodeRef nodeRef) public void unlock(NodeRef nodeRef)
throws UnableToReleaseLockException; throws UnableToReleaseLockException;
@@ -166,6 +172,7 @@ public interface LockService
* @throws UnableToReleaseLockException * @throws UnableToReleaseLockException
* thrown if the lock could not be released * thrown if the lock could not be released
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef", "lockChildren"})
public void unlock(NodeRef nodeRef, boolean lockChildren) public void unlock(NodeRef nodeRef, boolean lockChildren)
throws UnableToReleaseLockException; throws UnableToReleaseLockException;
@@ -187,6 +194,7 @@ public interface LockService
* @throws UnableToReleaseLockException * @throws UnableToReleaseLockException
* thrown if the lock could not be released * thrown if the lock could not be released
*/ */
@Auditable(parameters = {"nodeRefs"})
public void unlock(Collection<NodeRef> nodeRefs) public void unlock(Collection<NodeRef> nodeRefs)
throws UnableToReleaseLockException; throws UnableToReleaseLockException;
@@ -198,6 +206,7 @@ public interface LockService
* @param nodeRef the node reference * @param nodeRef the node reference
* @return the lock status * @return the lock status
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef"})
public LockStatus getLockStatus(NodeRef nodeRef); public LockStatus getLockStatus(NodeRef nodeRef);
/** /**
@@ -211,6 +220,7 @@ public interface LockService
* @return the lock type, null is returned if the object in question has no * @return the lock type, null is returned if the object in question has no
* lock * lock
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef"})
public LockType getLockType(NodeRef nodeRef); public LockType getLockType(NodeRef nodeRef);
/** /**
@@ -222,6 +232,7 @@ public interface LockService
* *
* @param nodeRef the node reference * @param nodeRef the node reference
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef"})
public void checkForLock(NodeRef nodeRef); public void checkForLock(NodeRef nodeRef);
/** /**
@@ -230,6 +241,7 @@ public interface LockService
* @param storeRef the store reference * @param storeRef the store reference
* @return a list of nodes that the current user has locked. * @return a list of nodes that the current user has locked.
*/ */
@Auditable(key = Auditable.Key.ARG_0,parameters = {"storeRef"})
public List<NodeRef> getLocks(StoreRef storeRef); public List<NodeRef> getLocks(StoreRef storeRef);
/** /**
@@ -240,5 +252,6 @@ public interface LockService
* *
* @return a list of nodes that the current user has locked filtered by the lock type provided * @return a list of nodes that the current user has locked filtered by the lock type provided
*/ */
@Auditable(key = Auditable.Key.ARG_0,parameters = {"storeRef", "lockType"})
public List<NodeRef> getLocks(StoreRef storeRef, LockType lockType); public List<NodeRef> getLocks(StoreRef storeRef, LockType lockType);
} }

View File

@@ -18,6 +18,7 @@ package org.alfresco.service.cmr.model;
import java.util.List; import java.util.List;
import org.alfresco.service.Auditable;
import org.alfresco.service.cmr.repository.ContentReader; import org.alfresco.service.cmr.repository.ContentReader;
import org.alfresco.service.cmr.repository.ContentWriter; import org.alfresco.service.cmr.repository.ContentWriter;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
@@ -39,6 +40,7 @@ public interface FileFolderService
* @param contextNodeRef the node to start searching in * @param contextNodeRef the node to start searching in
* @return Returns a list of matching files and folders * @return Returns a list of matching files and folders
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"contextNodeRef"})
public List<FileInfo> list(NodeRef contextNodeRef); public List<FileInfo> list(NodeRef contextNodeRef);
/** /**
@@ -47,6 +49,7 @@ public interface FileFolderService
* @param folderNodeRef the folder to start searching in * @param folderNodeRef the folder to start searching in
* @return Returns a list of matching files * @return Returns a list of matching files
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"folderNodeRef"})
public List<FileInfo> listFiles(NodeRef folderNodeRef); public List<FileInfo> listFiles(NodeRef folderNodeRef);
/** /**
@@ -55,6 +58,7 @@ public interface FileFolderService
* @param contextNodeRef the node to start searching in * @param contextNodeRef the node to start searching in
* @return Returns a list of matching folders * @return Returns a list of matching folders
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"contextNodeRef"})
public List<FileInfo> listFolders(NodeRef contextNodeRef); public List<FileInfo> listFolders(NodeRef contextNodeRef);
/** /**
@@ -71,6 +75,7 @@ public interface FileFolderService
* *
* @see #search(NodeRef, String, boolean, boolean, boolean) * @see #search(NodeRef, String, boolean, boolean, boolean)
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"contextNodeRef", "namePattern", "includeSubFolders"})
public List<FileInfo> search( public List<FileInfo> search(
NodeRef contextNodeRef, NodeRef contextNodeRef,
String namePattern, String namePattern,
@@ -90,6 +95,7 @@ public interface FileFolderService
* @param includeSubFolders true to search the entire hierarchy below the search context * @param includeSubFolders true to search the entire hierarchy below the search context
* @return Returns a list of file or folder matches * @return Returns a list of file or folder matches
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"contextNodeRef", "namePattern", "fileSearch", "folderSearch", "includeSubFolders"})
public List<FileInfo> search( public List<FileInfo> search(
NodeRef contextNodeRef, NodeRef contextNodeRef,
String namePattern, String namePattern,
@@ -106,6 +112,7 @@ public interface FileFolderService
* @throws FileExistsException if a file or folder with the new name already exists * @throws FileExistsException if a file or folder with the new name already exists
* @throws FileNotFoundException the file or folder reference doesn't exist * @throws FileNotFoundException the file or folder reference doesn't exist
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"fileFolderRef", "newName"})
public FileInfo rename(NodeRef fileFolderRef, String newName) throws FileExistsException, FileNotFoundException; public FileInfo rename(NodeRef fileFolderRef, String newName) throws FileExistsException, FileNotFoundException;
/** /**
@@ -120,6 +127,7 @@ public interface FileFolderService
* @throws FileExistsException * @throws FileExistsException
* @throws FileNotFoundException * @throws FileNotFoundException
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"sourceNodeRef", "targetParentRef", "newName"})
public FileInfo move(NodeRef sourceNodeRef, NodeRef targetParentRef, String newName) public FileInfo move(NodeRef sourceNodeRef, NodeRef targetParentRef, String newName)
throws FileExistsException, FileNotFoundException; throws FileExistsException, FileNotFoundException;
@@ -136,6 +144,7 @@ public interface FileFolderService
* @throws FileExistsException * @throws FileExistsException
* @throws FileNotFoundException * @throws FileNotFoundException
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"sourceNodeRef", "targetParentRef", "newName"})
public FileInfo copy(NodeRef sourceNodeRef, NodeRef targetParentRef, String newName) public FileInfo copy(NodeRef sourceNodeRef, NodeRef targetParentRef, String newName)
throws FileExistsException, FileNotFoundException; throws FileExistsException, FileNotFoundException;
@@ -149,6 +158,7 @@ public interface FileFolderService
* @return Returns the new node's file information * @return Returns the new node's file information
* @throws FileExistsException * @throws FileExistsException
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"parentNodeRef", "name", "typeQName"})
public FileInfo create(NodeRef parentNodeRef, String name, QName typeQName) throws FileExistsException; public FileInfo create(NodeRef parentNodeRef, String name, QName typeQName) throws FileExistsException;
/** /**
@@ -156,6 +166,7 @@ public interface FileFolderService
* *
* @param nodeRef the node to delete * @param nodeRef the node to delete
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef"})
public void delete(NodeRef nodeRef); public void delete(NodeRef nodeRef);
/** /**
@@ -170,15 +181,16 @@ public interface FileFolderService
* {@link org.alfresco.model.ContentModel#TYPE_FOLDER they folder type}. * {@link org.alfresco.model.ContentModel#TYPE_FOLDER they folder type}.
* @return Returns the info of the last folder in the path. * @return Returns the info of the last folder in the path.
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"parentNodeRef", "pathElements", "folderTypeQName"})
public FileInfo makeFolders(NodeRef parentNodeRef, List<String> pathElements, QName folderTypeQName); public FileInfo makeFolders(NodeRef parentNodeRef, List<String> pathElements, QName folderTypeQName);
/** /**
* Get the file or folder names from the root down to and including the node provided. * Get the file or folder names from the root down to and including the node provided.
* <ul> * <ul>
* <li>The root node can be of any type and is not included in the path list.</li> * <li>The root node can be of any type and is not included in the path list.</li>
* <li>Only the primary path is considered. If the target node is not a descendent of the * <li>Only the primary path is considered. If the target node is not a descendant of the
* root along purely primary associations, then an exception is generated.</li> * root along purely primary associations, then an exception is generated.</li>
* <li>If an invalid type is encoutered along the path, then an exception is generated.</li> * <li>If an invalid type is encountered along the path, then an exception is generated.</li>
* </ul> * </ul>
* *
* @param rootNodeRef the start of the returned path, or null if the <b>store</b> root * @param rootNodeRef the start of the returned path, or null if the <b>store</b> root
@@ -188,6 +200,7 @@ public interface FileFolderService
* including the destination file or folder * including the destination file or folder
* @throws FileNotFoundException if the node could not be found * @throws FileNotFoundException if the node could not be found
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"rootNodeRef", "nodeRef"})
public List<FileInfo> getNamePath(NodeRef rootNodeRef, NodeRef nodeRef) throws FileNotFoundException; public List<FileInfo> getNamePath(NodeRef rootNodeRef, NodeRef nodeRef) throws FileNotFoundException;
/** /**
@@ -198,6 +211,7 @@ public interface FileFolderService
* @return Returns the info of the file or folder * @return Returns the info of the file or folder
* @throws FileNotFoundException if no file or folder exists along the path * @throws FileNotFoundException if no file or folder exists along the path
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"rootNodeRef", "pathElements"})
public FileInfo resolveNamePath(NodeRef rootNodeRef, List<String> pathElements) throws FileNotFoundException; public FileInfo resolveNamePath(NodeRef rootNodeRef, List<String> pathElements) throws FileNotFoundException;
/** /**
@@ -206,9 +220,26 @@ public interface FileFolderService
* @param nodeRef the node to get info for * @param nodeRef the node to get info for
* @return Returns the file info or null if the node does not represent a file or folder * @return Returns the file info or null if the node does not represent a file or folder
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef"})
public FileInfo getFileInfo(NodeRef nodeRef); public FileInfo getFileInfo(NodeRef nodeRef);
/**
* Get the reader to the file represented by the node according to the File/Folder model.
* (This is not the same as the method on the ContentService)
*
* @param nodeRef
* @return
*/
@Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef"})
public ContentReader getReader(NodeRef nodeRef); public ContentReader getReader(NodeRef nodeRef);
/**
* Get the writer to the file represented by the node according to the File/Folder model.
* (This is not the same as the method on the ContentService)
*
* @param nodeRef
* @return
*/
@Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef"})
public ContentWriter getWriter(NodeRef nodeRef); public ContentWriter getWriter(NodeRef nodeRef);
} }

View File

@@ -17,6 +17,7 @@
package org.alfresco.service.cmr.repository; package org.alfresco.service.cmr.repository;
import org.alfresco.repo.content.transform.ContentTransformer; import org.alfresco.repo.content.transform.ContentTransformer;
import org.alfresco.service.Auditable;
import org.alfresco.service.cmr.dictionary.InvalidTypeException; import org.alfresco.service.cmr.dictionary.InvalidTypeException;
import org.alfresco.service.namespace.QName; import org.alfresco.service.namespace.QName;
@@ -59,6 +60,7 @@ public interface ContentService
* *
* @see org.alfresco.repo.content.filestore.FileContentReader#getSafeContentReader(ContentReader, String, Object[]) * @see org.alfresco.repo.content.filestore.FileContentReader#getSafeContentReader(ContentReader, String, Object[])
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef", "propertyQName"})
public ContentReader getReader(NodeRef nodeRef, QName propertyQName) public ContentReader getReader(NodeRef nodeRef, QName propertyQName)
throws InvalidNodeRefException, InvalidTypeException; throws InvalidNodeRefException, InvalidTypeException;
@@ -80,6 +82,7 @@ public interface ContentService
* @throws InvalidNodeRefException if the node doesn't exist * @throws InvalidNodeRefException if the node doesn't exist
* @throws InvalidTypeException if the node property is not of type <b>content</b> * @throws InvalidTypeException if the node property is not of type <b>content</b>
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef", "propertyQName", "update"})
public ContentWriter getWriter(NodeRef nodeRef, QName propertyQName, boolean update) public ContentWriter getWriter(NodeRef nodeRef, QName propertyQName, boolean update)
throws InvalidNodeRefException, InvalidTypeException; throws InvalidNodeRefException, InvalidTypeException;
@@ -89,6 +92,7 @@ public interface ContentService
* *
* @return Returns a writer onto a temporary location * @return Returns a writer onto a temporary location
*/ */
@Auditable
public ContentWriter getTempWriter(); public ContentWriter getTempWriter();
/** /**
@@ -105,6 +109,7 @@ public interface ContentService
* given source and target mimetypes of the reader and writer * given source and target mimetypes of the reader and writer
* @throws ContentIOException if the transformation fails * @throws ContentIOException if the transformation fails
*/ */
@Auditable(parameters = {"reader", "writer"})
public void transform(ContentReader reader, ContentWriter writer) public void transform(ContentReader reader, ContentWriter writer)
throws NoTransformerException, ContentIOException; throws NoTransformerException, ContentIOException;
@@ -118,6 +123,7 @@ public interface ContentService
* *
* @see ContentAccessor#getMimetype() * @see ContentAccessor#getMimetype()
*/ */
@Auditable(parameters = {"sourceMimetype", "targetMimetype"})
public ContentTransformer getTransformer(String sourceMimetype, String targetMimetype); public ContentTransformer getTransformer(String sourceMimetype, String targetMimetype);
/** /**
@@ -133,5 +139,6 @@ public interface ContentService
* *
* @return true if a transformer exists, false otherwise * @return true if a transformer exists, false otherwise
*/ */
@Auditable(parameters = {"reader", "writer"})
public boolean isTransformable(ContentReader reader, ContentWriter writer); public boolean isTransformable(ContentReader reader, ContentWriter writer);
} }

View File

@@ -18,6 +18,7 @@ package org.alfresco.service.cmr.repository;
import java.util.List; import java.util.List;
import org.alfresco.service.Auditable;
import org.alfresco.service.namespace.QName; import org.alfresco.service.namespace.QName;
/** /**
@@ -38,7 +39,7 @@ public interface CopyService
* <p> * <p>
* If the new node resides in the same workspace then * If the new node resides in the same workspace then
* the new node will have the Copy aspect applied to it which will * the new node will have the Copy aspect applied to it which will
* reference the origional node. * reference the original node.
* <p> * <p>
* The aspects applied to source node will also be applied to destination node * The aspects applied to source node will also be applied to destination node
* and all the property value will be duplicated accordingly. This is with the * and all the property value will be duplicated accordingly. This is with the
@@ -48,7 +49,7 @@ public interface CopyService
* <p> * <p>
* Child associations are copied onto the destination node. If the child of * Child associations are copied onto the destination node. If the child of
* copied association is not present in the destination workspace the child * copied association is not present in the destination workspace the child
* association is not copied. This is unless is has been specfied that the * association is not copied. This is unless is has been specified that the
* children of the source node should also be copied. * children of the source node should also be copied.
* <p> * <p>
* Target associations are copied to the destination node. If the target of the * Target associations are copied to the destination node. If the target of the
@@ -65,6 +66,7 @@ public interface CopyService
* *
* @return the new node reference * @return the new node reference
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"sourceNodeRef", "destinationParent", "destinationAssocTypeQName", "destinationQName", "copyChildren"})
public NodeRef copy( public NodeRef copy(
NodeRef sourceNodeRef, NodeRef sourceNodeRef,
NodeRef destinationParent, NodeRef destinationParent,
@@ -84,6 +86,7 @@ public interface CopyService
* parent to the new node * parent to the new node
* @return the new node reference * @return the new node reference
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"sourceNodeRef", "destinationParent", "destinationAssocTypeQName", "destinationQName"})
public NodeRef copy( public NodeRef copy(
NodeRef sourceNodeRef, NodeRef sourceNodeRef,
NodeRef destinationParent, NodeRef destinationParent,
@@ -98,7 +101,7 @@ public interface CopyService
* that of the source node. * that of the source node.
* <p> * <p>
* If data (for example an association) does not exist on the source * If data (for example an association) does not exist on the source
* node, but does exist on the detination node this data is NOT deleted * node, but does exist on the destination node this data is NOT deleted
* from the destination node. * from the destination node.
* <p> * <p>
* Child associations and target associations are updated on the destination * Child associations and target associations are updated on the destination
@@ -109,7 +112,7 @@ public interface CopyService
* updated to the destination node. * updated to the destination node.
* <p> * <p>
* All aspects found on the source node are applied to the destination node where * All aspects found on the source node are applied to the destination node where
* missing. The properties of the apects are updated accordingly except in the case * missing. The properties of the aspects are updated accordingly except in the case
* where the aspect has been marked as having 'Non-Transferable State'. In this case * where the aspect has been marked as having 'Non-Transferable State'. In this case
* aspect properties will take on the values already assigned to them in the * aspect properties will take on the values already assigned to them in the
* destination node. * destination node.
@@ -117,13 +120,15 @@ public interface CopyService
* @param sourceNodeRef the source node reference * @param sourceNodeRef the source node reference
* @param destinationNodeRef the destination node reference * @param destinationNodeRef the destination node reference
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"sourceNodeRef", "destinationNodeRef"})
public void copy(NodeRef sourceNodeRef, NodeRef destinationNodeRef); public void copy(NodeRef sourceNodeRef, NodeRef destinationNodeRef);
/** /**
* Gets all the copies of a given node that have been made using this service. * Gets all the copies of a given node that have been made using this service.
* *
* @param nodeRef the origional node reference * @param nodeRef the original node reference
* @return a list of copies, empty is none * @return a list of copies, empty is none
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef"})
public List<NodeRef> getCopies(NodeRef nodeRef); public List<NodeRef> getCopies(NodeRef nodeRef);
} }

View File

@@ -20,6 +20,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import org.alfresco.error.AlfrescoRuntimeException; import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.service.NotAuditable;
/** /**
@@ -37,6 +38,7 @@ public interface MimetypeService
* @return Returns the default extension for the mimetype * @return Returns the default extension for the mimetype
* @throws AlfrescoRuntimeException if the mimetype doesn't exist * @throws AlfrescoRuntimeException if the mimetype doesn't exist
*/ */
@NotAuditable
public String getExtension(String mimetype); public String getExtension(String mimetype);
/** /**
@@ -44,6 +46,7 @@ public interface MimetypeService
* *
* @return the map of displays indexed by extension * @return the map of displays indexed by extension
*/ */
@NotAuditable
public Map<String, String> getDisplaysByExtension(); public Map<String, String> getDisplaysByExtension();
/** /**
@@ -51,6 +54,7 @@ public interface MimetypeService
* *
* @return the map of displays indexed by mimetype * @return the map of displays indexed by mimetype
*/ */
@NotAuditable
public Map<String, String> getDisplaysByMimetype(); public Map<String, String> getDisplaysByMimetype();
/** /**
@@ -58,6 +62,7 @@ public interface MimetypeService
* *
* @return the map of extension indexed by mimetype * @return the map of extension indexed by mimetype
*/ */
@NotAuditable
public Map<String, String> getExtensionsByMimetype(); public Map<String, String> getExtensionsByMimetype();
/** /**
@@ -65,6 +70,7 @@ public interface MimetypeService
* *
* @return the map of mimetypes indexed by extension * @return the map of mimetypes indexed by extension
*/ */
@NotAuditable
public Map<String, String> getMimetypesByExtension(); public Map<String, String> getMimetypesByExtension();
/** /**
@@ -72,6 +78,7 @@ public interface MimetypeService
* *
* @return all mimetypes * @return all mimetypes
*/ */
@NotAuditable
public List<String> getMimetypes(); public List<String> getMimetypes();
/** /**
@@ -82,5 +89,6 @@ public interface MimetypeService
* @return Returns the best guess mimetype or the mimetype for * @return Returns the best guess mimetype or the mimetype for
* straight binary files if no extension could be found. * straight binary files if no extension could be found.
*/ */
@NotAuditable
public String guessMimetype(String filename); public String guessMimetype(String filename);
} }

View File

@@ -21,6 +21,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import org.alfresco.service.Auditable;
import org.alfresco.service.cmr.dictionary.InvalidAspectException; import org.alfresco.service.cmr.dictionary.InvalidAspectException;
import org.alfresco.service.cmr.dictionary.InvalidTypeException; import org.alfresco.service.cmr.dictionary.InvalidTypeException;
import org.alfresco.service.namespace.QName; import org.alfresco.service.namespace.QName;
@@ -38,6 +39,7 @@ public interface NodeService
* *
* @return Returns a list of store references * @return Returns a list of store references
*/ */
@Auditable
public List<StoreRef> getStores(); public List<StoreRef> getStores();
/** /**
@@ -50,18 +52,21 @@ public interface NodeService
* @return Returns a reference to the store * @return Returns a reference to the store
* @throws StoreExistsException * @throws StoreExistsException
*/ */
@Auditable(parameters = {"protocol", "identifier"})
public StoreRef createStore(String protocol, String identifier) throws StoreExistsException; public StoreRef createStore(String protocol, String identifier) throws StoreExistsException;
/** /**
* @param storeRef a reference to the store to look for * @param storeRef a reference to the store to look for
* @return Returns true if the store exists, otherwise false * @return Returns true if the store exists, otherwise false
*/ */
@Auditable(parameters = {"storeRef"})
public boolean exists(StoreRef storeRef); public boolean exists(StoreRef storeRef);
/** /**
* @param nodeRef a reference to the node to look for * @param nodeRef a reference to the node to look for
* @return Returns true if the node exists, otherwise false * @return Returns true if the node exists, otherwise false
*/ */
@Auditable(key = Auditable.Key.ARG_0 ,parameters = {"nodeRef"})
public boolean exists(NodeRef nodeRef); public boolean exists(NodeRef nodeRef);
/** /**
@@ -72,6 +77,7 @@ public interface NodeService
* @param nodeRef a reference to a current or previously existing node * @param nodeRef a reference to a current or previously existing node
* @return Returns the status of the node, or null if the node never existed * @return Returns the status of the node, or null if the node never existed
*/ */
@Auditable(key = Auditable.Key.ARG_0 ,parameters = {"nodeRef"})
public NodeRef.Status getNodeStatus(NodeRef nodeRef); public NodeRef.Status getNodeStatus(NodeRef nodeRef);
/** /**
@@ -79,11 +85,13 @@ public interface NodeService
* @return Returns a reference to the root node of the store * @return Returns a reference to the root node of the store
* @throws InvalidStoreRefException if the store could not be found * @throws InvalidStoreRefException if the store could not be found
*/ */
@Auditable(key = Auditable.Key.ARG_0 ,parameters = {"storeRef"})
public NodeRef getRootNode(StoreRef storeRef) throws InvalidStoreRefException; public NodeRef getRootNode(StoreRef storeRef) throws InvalidStoreRefException;
/** /**
* @see #createNode(NodeRef, QName, QName, QName, Map) * @see #createNode(NodeRef, QName, QName, QName, Map)
*/ */
@Auditable(key = Auditable.Key.ARG_0 ,parameters = {"parentRef", "assocTypeQName", "assocQName", "nodeTypeQName"})
public ChildAssociationRef createNode( public ChildAssociationRef createNode(
NodeRef parentRef, NodeRef parentRef,
QName assocTypeQName, QName assocTypeQName,
@@ -106,6 +114,7 @@ public interface NodeService
* *
* @see org.alfresco.service.cmr.dictionary.DictionaryService * @see org.alfresco.service.cmr.dictionary.DictionaryService
*/ */
@Auditable(key = Auditable.Key.ARG_0 ,parameters = {"parentRef", "assocTypeQName", "assocQName", "nodeTypeQName", "properties"})
public ChildAssociationRef createNode( public ChildAssociationRef createNode(
NodeRef parentRef, NodeRef parentRef,
QName assocTypeQName, QName assocTypeQName,
@@ -135,6 +144,7 @@ public interface NodeService
* *
* @see #getPrimaryParent(NodeRef) * @see #getPrimaryParent(NodeRef)
*/ */
@Auditable(key = Auditable.Key.ARG_0 ,parameters = {"nodeToMoveRef", "newParentRef", "assocTypeQName", "assocQName"})
public ChildAssociationRef moveNode( public ChildAssociationRef moveNode(
NodeRef nodeToMoveRef, NodeRef nodeToMoveRef,
NodeRef newParentRef, NodeRef newParentRef,
@@ -148,12 +158,13 @@ public interface NodeService
* associations. * associations.
* *
* @param childAssocRef the child association that must be moved in the order * @param childAssocRef the child association that must be moved in the order
* @param index an arbibrary index that will affect the return order * @param index an arbitrary index that will affect the return order
* *
* @see #getChildAssocs(NodeRef) * @see #getChildAssocs(NodeRef)
* @see #getChildAssocs(NodeRef, QNamePattern, QNamePattern) * @see #getChildAssocs(NodeRef, QNamePattern, QNamePattern)
* @see ChildAssociationRef#getNthSibling() * @see ChildAssociationRef#getNthSibling()
*/ */
@Auditable(key = Auditable.Key.ARG_0 ,parameters = {"childAssocRef", "index"})
public void setChildAssociationIndex( public void setChildAssociationIndex(
ChildAssociationRef childAssocRef, ChildAssociationRef childAssocRef,
int index) int index)
@@ -166,6 +177,7 @@ public interface NodeService
* *
* @see org.alfresco.service.cmr.dictionary.DictionaryService * @see org.alfresco.service.cmr.dictionary.DictionaryService
*/ */
@Auditable(key = Auditable.Key.ARG_0 ,parameters = {"nodeRef"})
public QName getType(NodeRef nodeRef) throws InvalidNodeRefException; public QName getType(NodeRef nodeRef) throws InvalidNodeRefException;
/** /**
@@ -180,6 +192,7 @@ public interface NodeService
* *
* @since 1.1 * @since 1.1
*/ */
@Auditable(key = Auditable.Key.ARG_0 ,parameters = {"nodeRef", "typeQName"})
public void setType(NodeRef nodeRef, QName typeQName) throws InvalidNodeRefException; public void setType(NodeRef nodeRef, QName typeQName) throws InvalidNodeRefException;
/** /**
@@ -196,6 +209,7 @@ public interface NodeService
* @see org.alfresco.service.cmr.dictionary.DictionaryService#getAspect(QName) * @see org.alfresco.service.cmr.dictionary.DictionaryService#getAspect(QName)
* @see org.alfresco.service.cmr.dictionary.ClassDefinition#getProperties() * @see org.alfresco.service.cmr.dictionary.ClassDefinition#getProperties()
*/ */
@Auditable(key = Auditable.Key.ARG_0 ,parameters = {"nodeRef", "aspectTypeQName", "aspectProperties"})
public void addAspect( public void addAspect(
NodeRef nodeRef, NodeRef nodeRef,
QName aspectTypeQName, QName aspectTypeQName,
@@ -211,6 +225,7 @@ public interface NodeService
* @throws InvalidAspectException if the the aspect is unknown or if the * @throws InvalidAspectException if the the aspect is unknown or if the
* aspect is mandatory for the <b>class</b> of the <b>node</b> * aspect is mandatory for the <b>class</b> of the <b>node</b>
*/ */
@Auditable(key = Auditable.Key.ARG_0 ,parameters = {"nodeRef", "aspectTypeQName"})
public void removeAspect(NodeRef nodeRef, QName aspectTypeQName) public void removeAspect(NodeRef nodeRef, QName aspectTypeQName)
throws InvalidNodeRefException, InvalidAspectException; throws InvalidNodeRefException, InvalidAspectException;
@@ -219,13 +234,14 @@ public interface NodeService
* removed if they are <b>NOT</b> mandatory. * removed if they are <b>NOT</b> mandatory.
* *
* @param nodeRef * @param nodeRef
* @param aspectRef * @param aspectTypeQName
* @return Returns true if the aspect has been applied to the given node, * @return Returns true if the aspect has been applied to the given node,
* otherwise false * otherwise false
* @throws InvalidNodeRefException if the node could not be found * @throws InvalidNodeRefException if the node could not be found
* @throws InvalidAspectException if the aspect reference is invalid * @throws InvalidAspectException if the aspect reference is invalid
*/ */
public boolean hasAspect(NodeRef nodeRef, QName aspectRef) @Auditable(key = Auditable.Key.ARG_0 ,parameters = {"nodeRef", "aspectTypeQName"})
public boolean hasAspect(NodeRef nodeRef, QName aspectTypeQName)
throws InvalidNodeRefException, InvalidAspectException; throws InvalidNodeRefException, InvalidAspectException;
/** /**
@@ -234,6 +250,7 @@ public interface NodeService
* aspects * aspects
* @throws InvalidNodeRefException if the node could not be found * @throws InvalidNodeRefException if the node could not be found
*/ */
@Auditable(key = Auditable.Key.ARG_0 ,parameters = {"nodeRef"})
public Set<QName> getAspects(NodeRef nodeRef) throws InvalidNodeRefException; public Set<QName> getAspects(NodeRef nodeRef) throws InvalidNodeRefException;
/** /**
@@ -246,6 +263,7 @@ public interface NodeService
* @param nodeRef reference to a node within a store * @param nodeRef reference to a node within a store
* @throws InvalidNodeRefException if the reference given is invalid * @throws InvalidNodeRefException if the reference given is invalid
*/ */
@Auditable(key = Auditable.Key.ARG_0 ,parameters = {"nodeRef"})
public void deleteNode(NodeRef nodeRef) throws InvalidNodeRefException; public void deleteNode(NodeRef nodeRef) throws InvalidNodeRefException;
/** /**
@@ -261,6 +279,7 @@ public interface NodeService
* @throws InvalidNodeRefException if the parent or child nodes could not be found * @throws InvalidNodeRefException if the parent or child nodes could not be found
* @throws CyclicChildRelationshipException if the child partakes in a cyclic relationship after the add * @throws CyclicChildRelationshipException if the child partakes in a cyclic relationship after the add
*/ */
@Auditable(key = Auditable.Key.ARG_0 ,parameters = {"parentRef", "childRef", "assocTypeQName", "qname"})
public ChildAssociationRef addChild( public ChildAssociationRef addChild(
NodeRef parentRef, NodeRef parentRef,
NodeRef childRef, NodeRef childRef,
@@ -278,6 +297,7 @@ public interface NodeService
* @return Returns a collection of deleted entities - both associations and node references. * @return Returns a collection of deleted entities - both associations and node references.
* @throws InvalidNodeRefException if the parent or child nodes could not be found * @throws InvalidNodeRefException if the parent or child nodes could not be found
*/ */
@Auditable(key = Auditable.Key.ARG_0 ,parameters = {"parentRef", "childRef"})
public void removeChild(NodeRef parentRef, NodeRef childRef) throws InvalidNodeRefException; public void removeChild(NodeRef parentRef, NodeRef childRef) throws InvalidNodeRefException;
/** /**
@@ -285,6 +305,7 @@ public interface NodeService
* @return Returns all properties keyed by their qualified name * @return Returns all properties keyed by their qualified name
* @throws InvalidNodeRefException if the node could not be found * @throws InvalidNodeRefException if the node could not be found
*/ */
@Auditable(key = Auditable.Key.ARG_0 ,parameters = {"nodeRef"})
public Map<QName, Serializable> getProperties(NodeRef nodeRef) throws InvalidNodeRefException; public Map<QName, Serializable> getProperties(NodeRef nodeRef) throws InvalidNodeRefException;
/** /**
@@ -293,6 +314,7 @@ public interface NodeService
* @return Returns the value of the property, or null if not yet set * @return Returns the value of the property, or null if not yet set
* @throws InvalidNodeRefException if the node could not be found * @throws InvalidNodeRefException if the node could not be found
*/ */
@Auditable(key = Auditable.Key.ARG_0 ,parameters = {"nodeRef", "qname"})
public Serializable getProperty(NodeRef nodeRef, QName qname) throws InvalidNodeRefException; public Serializable getProperty(NodeRef nodeRef, QName qname) throws InvalidNodeRefException;
/** /**
@@ -306,6 +328,7 @@ public interface NodeService
* @param properties all the properties of the node keyed by their qualified names * @param properties all the properties of the node keyed by their qualified names
* @throws InvalidNodeRefException if the node could not be found * @throws InvalidNodeRefException if the node could not be found
*/ */
@Auditable(key = Auditable.Key.ARG_0 ,parameters = {"nodeRef", "properties"})
public void setProperties(NodeRef nodeRef, Map<QName, Serializable> properties) throws InvalidNodeRefException; public void setProperties(NodeRef nodeRef, Map<QName, Serializable> properties) throws InvalidNodeRefException;
/** /**
@@ -320,6 +343,7 @@ public interface NodeService
* @param propertyValue the value of the property - never null * @param propertyValue the value of the property - never null
* @throws InvalidNodeRefException if the node could not be found * @throws InvalidNodeRefException if the node could not be found
*/ */
@Auditable(key = Auditable.Key.ARG_0 ,parameters = {"nodeRef", "qname", "value"})
public void setProperty(NodeRef nodeRef, QName qname, Serializable value) throws InvalidNodeRefException; public void setProperty(NodeRef nodeRef, QName qname, Serializable value) throws InvalidNodeRefException;
/** /**
@@ -330,6 +354,7 @@ public interface NodeService
* *
* @see #getParentAssocs(NodeRef, QNamePattern, QNamePattern) * @see #getParentAssocs(NodeRef, QNamePattern, QNamePattern)
*/ */
@Auditable(key = Auditable.Key.ARG_0 ,parameters = {"nodeRef"})
public List<ChildAssociationRef> getParentAssocs(NodeRef nodeRef) throws InvalidNodeRefException; public List<ChildAssociationRef> getParentAssocs(NodeRef nodeRef) throws InvalidNodeRefException;
/** /**
@@ -350,6 +375,7 @@ public interface NodeService
* @see QName * @see QName
* @see org.alfresco.service.namespace.RegexQNamePattern#MATCH_ALL * @see org.alfresco.service.namespace.RegexQNamePattern#MATCH_ALL
*/ */
@Auditable(key = Auditable.Key.ARG_0 ,parameters = {"nodeRef", "typeQNamePattern", "qnamePattern"})
public List<ChildAssociationRef> getParentAssocs(NodeRef nodeRef, QNamePattern typeQNamePattern, QNamePattern qnamePattern) public List<ChildAssociationRef> getParentAssocs(NodeRef nodeRef, QNamePattern typeQNamePattern, QNamePattern qnamePattern)
throws InvalidNodeRefException; throws InvalidNodeRefException;
@@ -367,6 +393,7 @@ public interface NodeService
* @see #setChildAssociationIndex(ChildAssociationRef, int) * @see #setChildAssociationIndex(ChildAssociationRef, int)
* @see ChildAssociationRef#getNthSibling() * @see ChildAssociationRef#getNthSibling()
*/ */
@Auditable(key = Auditable.Key.ARG_0 ,parameters = {"nodeRef"})
public List<ChildAssociationRef> getChildAssocs(NodeRef nodeRef) throws InvalidNodeRefException; public List<ChildAssociationRef> getChildAssocs(NodeRef nodeRef) throws InvalidNodeRefException;
/** /**
@@ -383,6 +410,7 @@ public interface NodeService
* @see QName * @see QName
* @see org.alfresco.service.namespace.RegexQNamePattern#MATCH_ALL * @see org.alfresco.service.namespace.RegexQNamePattern#MATCH_ALL
*/ */
@Auditable(key = Auditable.Key.ARG_0 ,parameters = {"nodeRef", "typeQNamePattern", "qnamePattern"})
public List<ChildAssociationRef> getChildAssocs( public List<ChildAssociationRef> getChildAssocs(
NodeRef nodeRef, NodeRef nodeRef,
QNamePattern typeQNamePattern, QNamePattern typeQNamePattern,
@@ -398,6 +426,7 @@ public interface NodeService
* @return Returns the primary parent-child association of the node * @return Returns the primary parent-child association of the node
* @throws InvalidNodeRefException if the node could not be found * @throws InvalidNodeRefException if the node could not be found
*/ */
@Auditable(key = Auditable.Key.ARG_0 ,parameters = {"nodeRef"})
public ChildAssociationRef getPrimaryParent(NodeRef nodeRef) throws InvalidNodeRefException; public ChildAssociationRef getPrimaryParent(NodeRef nodeRef) throws InvalidNodeRefException;
/** /**
@@ -409,6 +438,7 @@ public interface NodeService
* @throws InvalidNodeRefException if either of the nodes could not be found * @throws InvalidNodeRefException if either of the nodes could not be found
* @throws AssociationExistsException * @throws AssociationExistsException
*/ */
@Auditable(key = Auditable.Key.ARG_0 ,parameters = {"sourceRef", "targetRef", "assocTypeQName"})
public AssociationRef createAssociation(NodeRef sourceRef, NodeRef targetRef, QName assocTypeQName) public AssociationRef createAssociation(NodeRef sourceRef, NodeRef targetRef, QName assocTypeQName)
throws InvalidNodeRefException, AssociationExistsException; throws InvalidNodeRefException, AssociationExistsException;
@@ -419,6 +449,7 @@ public interface NodeService
* @param assocTypeQName the qualified name of the association type * @param assocTypeQName the qualified name of the association type
* @throws InvalidNodeRefException if either of the nodes could not be found * @throws InvalidNodeRefException if either of the nodes could not be found
*/ */
@Auditable(key = Auditable.Key.ARG_0 ,parameters = {"sourceRef", "targetRef", "assocTypeQName"})
public void removeAssociation(NodeRef sourceRef, NodeRef targetRef, QName assocTypeQName) public void removeAssociation(NodeRef sourceRef, NodeRef targetRef, QName assocTypeQName)
throws InvalidNodeRefException; throws InvalidNodeRefException;
@@ -435,6 +466,7 @@ public interface NodeService
* @see QName * @see QName
* @see org.alfresco.service.namespace.RegexQNamePattern#MATCH_ALL * @see org.alfresco.service.namespace.RegexQNamePattern#MATCH_ALL
*/ */
@Auditable(key = Auditable.Key.ARG_0 ,parameters = {"sourceRef", "qnamePattern"})
public List<AssociationRef> getTargetAssocs(NodeRef sourceRef, QNamePattern qnamePattern) public List<AssociationRef> getTargetAssocs(NodeRef sourceRef, QNamePattern qnamePattern)
throws InvalidNodeRefException; throws InvalidNodeRefException;
@@ -451,6 +483,7 @@ public interface NodeService
* @see QName * @see QName
* @see org.alfresco.service.namespace.RegexQNamePattern#MATCH_ALL * @see org.alfresco.service.namespace.RegexQNamePattern#MATCH_ALL
*/ */
@Auditable(key = Auditable.Key.ARG_0 ,parameters = {"targetRef", "qnamePattern"})
public List<AssociationRef> getSourceAssocs(NodeRef targetRef, QNamePattern qnamePattern) public List<AssociationRef> getSourceAssocs(NodeRef targetRef, QNamePattern qnamePattern)
throws InvalidNodeRefException; throws InvalidNodeRefException;
@@ -465,6 +498,7 @@ public interface NodeService
* *
* @see #getPaths(NodeRef, boolean) * @see #getPaths(NodeRef, boolean)
*/ */
@Auditable(key = Auditable.Key.ARG_0 ,parameters = {"nodeRef"})
public Path getPath(NodeRef nodeRef) throws InvalidNodeRefException; public Path getPath(NodeRef nodeRef) throws InvalidNodeRefException;
/** /**
@@ -478,6 +512,7 @@ public interface NodeService
* @return Returns a List of all possible paths to the given node * @return Returns a List of all possible paths to the given node
* @throws InvalidNodeRefException if the node could not be found * @throws InvalidNodeRefException if the node could not be found
*/ */
@Auditable(key = Auditable.Key.ARG_0 ,parameters = {"nodeRef", "primaryOnly"})
public List<Path> getPaths(NodeRef nodeRef, boolean primaryOnly) throws InvalidNodeRefException; public List<Path> getPaths(NodeRef nodeRef, boolean primaryOnly) throws InvalidNodeRefException;
/** /**
@@ -486,6 +521,7 @@ public interface NodeService
* @param storeRef the store that items were deleted from * @param storeRef the store that items were deleted from
* @return Returns the archive node parent * @return Returns the archive node parent
*/ */
@Auditable(key = Auditable.Key.ARG_0 ,parameters = {"storeRef"})
public NodeRef getStoreArchiveNode(StoreRef storeRef); public NodeRef getStoreArchiveNode(StoreRef storeRef);
/** /**
@@ -502,6 +538,7 @@ public interface NodeService
* or <tt>null</tt> to use the original * or <tt>null</tt> to use the original
* @return Returns the reference to the newly created node * @return Returns the reference to the newly created node
*/ */
@Auditable(key = Auditable.Key.ARG_0 ,parameters = {"archivedNodeRef", "destinationParentNodeRef", "assocTypeQName", "assocQName"})
public NodeRef restoreNode( public NodeRef restoreNode(
NodeRef archivedNodeRef, NodeRef archivedNodeRef,
NodeRef destinationParentNodeRef, NodeRef destinationParentNodeRef,

View File

@@ -16,9 +16,9 @@
*/ */
package org.alfresco.service.cmr.repository; package org.alfresco.service.cmr.repository;
import java.io.Writer;
import java.util.Map; import java.util.Map;
import org.alfresco.service.Auditable;
import org.alfresco.service.namespace.QName; import org.alfresco.service.namespace.QName;
/** /**
@@ -32,7 +32,7 @@ import org.alfresco.service.namespace.QName;
* Java objects are passed into the scripting engine and methods can be accessed directly from the script. * Java objects are passed into the scripting engine and methods can be accessed directly from the script.
* <p> * <p>
* A script is executed within a single transaction, any modifications to nodes or properties that fail * A script is executed within a single transaction, any modifications to nodes or properties that fail
* and cause a rollback which will rollback all repoistory modifications made by the script. * and cause a rollback which will rollback all repository modifications made by the script.
* *
* @author Kevin Roast * @author Kevin Roast
*/ */
@@ -48,6 +48,7 @@ public interface ScriptService
* *
* @throws ScriptException * @throws ScriptException
*/ */
@Auditable(parameters = {"scriptClasspath", "model"})
public Object executeScript(String scriptClasspath, Map<String, Object> model) public Object executeScript(String scriptClasspath, Map<String, Object> model)
throws ScriptException; throws ScriptException;
@@ -63,6 +64,7 @@ public interface ScriptService
* *
* @throws ScriptException * @throws ScriptException
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"scriptRef", "contentProp", "model"})
public Object executeScript(NodeRef scriptRef, QName contentProp, Map<String, Object> model) public Object executeScript(NodeRef scriptRef, QName contentProp, Map<String, Object> model)
throws ScriptException; throws ScriptException;
@@ -76,6 +78,7 @@ public interface ScriptService
* *
* @throws ScriptException * @throws ScriptException
*/ */
@Auditable(parameters = {"script", "model"})
public Object executeScriptString(String script, Map<String, Object> model) public Object executeScriptString(String script, Map<String, Object> model)
throws ScriptException; throws ScriptException;
} }

View File

@@ -18,6 +18,8 @@ package org.alfresco.service.cmr.repository;
import java.io.Writer; import java.io.Writer;
import org.alfresco.service.Auditable;
/** /**
* Template Service. * Template Service.
* <p> * <p>
@@ -43,6 +45,7 @@ public interface TemplateService
* *
* @return output of the template process as a String * @return output of the template process as a String
*/ */
@Auditable(parameters = {"engine", "template", "model"})
public String processTemplate(String engine, String template, Object model) public String processTemplate(String engine, String template, Object model)
throws TemplateException; throws TemplateException;
@@ -54,6 +57,7 @@ public interface TemplateService
* @param model Object model to process template against * @param model Object model to process template against
* @param out Writer object to send output too * @param out Writer object to send output too
*/ */
@Auditable(parameters = {"engine", "template", "model", "out"})
public void processTemplate(String engine, String template, Object model, Writer out) public void processTemplate(String engine, String template, Object model, Writer out)
throws TemplateException; throws TemplateException;
@@ -68,6 +72,7 @@ public interface TemplateService
* *
* @throws TemplateException * @throws TemplateException
*/ */
@Auditable(parameters = {"engine", "template", "model"})
public String processTemplateString(String engine, String template, Object model) public String processTemplateString(String engine, String template, Object model)
throws TemplateException; throws TemplateException;
@@ -82,6 +87,7 @@ public interface TemplateService
* *
* @throws TemplateException * @throws TemplateException
*/ */
@Auditable(parameters = {"engine", "template", "model", "out"})
public void processTemplateString(String engine, String template, Object model, Writer out) public void processTemplateString(String engine, String template, Object model, Writer out)
throws TemplateException; throws TemplateException;
@@ -93,5 +99,6 @@ public interface TemplateService
* *
* @return TemplateProcessor * @return TemplateProcessor
*/ */
@Auditable(warn = true, parameters = {"engine"})
public TemplateProcessor getTemplateProcessor(String engine); public TemplateProcessor getTemplateProcessor(String engine);
} }

View File

@@ -18,6 +18,7 @@ package org.alfresco.service.cmr.rule;
import java.util.List; import java.util.List;
import org.alfresco.service.Auditable;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
/** /**
@@ -32,6 +33,7 @@ public interface RuleService
* *
* @return a list of rule types * @return a list of rule types
*/ */
@Auditable
public List<RuleType> getRuleTypes(); public List<RuleType> getRuleTypes();
/** /**
@@ -40,6 +42,7 @@ public interface RuleService
* @param name the name of the rule type * @param name the name of the rule type
* @return the rule type, null if not found * @return the rule type, null if not found
*/ */
@Auditable(parameters = {"name"})
public RuleType getRuleType(String name); public RuleType getRuleType(String name);
/** /**
@@ -49,6 +52,7 @@ public interface RuleService
* @param nodeRef the node reference * @param nodeRef the node reference
* @return true if the rules are enabled, false otherwise * @return true if the rules are enabled, false otherwise
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef"})
public boolean rulesEnabled(NodeRef nodeRef); public boolean rulesEnabled(NodeRef nodeRef);
/** /**
@@ -57,6 +61,7 @@ public interface RuleService
* *
* @param nodeRef the node reference * @param nodeRef the node reference
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef"})
public void disableRules(NodeRef nodeRef); public void disableRules(NodeRef nodeRef);
/** /**
@@ -65,6 +70,7 @@ public interface RuleService
* *
* @param nodeRef the node reference * @param nodeRef the node reference
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef"})
public void enableRules(NodeRef nodeRef); public void enableRules(NodeRef nodeRef);
/** /**
@@ -72,6 +78,7 @@ public interface RuleService
* *
* @param rule the rule to disable * @param rule the rule to disable
*/ */
@Auditable(parameters = {"rule"})
public void disableRule(Rule rule); public void disableRule(Rule rule);
/** /**
@@ -79,6 +86,7 @@ public interface RuleService
* *
* @param rule the rule to enable * @param rule the rule to enable
*/ */
@Auditable(parameters = {"rule"})
public void enableRule(Rule rule); public void enableRule(Rule rule);
/** /**
@@ -87,6 +95,7 @@ public interface RuleService
* @param nodeRef the node reference * @param nodeRef the node reference
* @return true if the node has rules associated, false otherwise * @return true if the node has rules associated, false otherwise
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef"})
public boolean hasRules(NodeRef nodeRef); public boolean hasRules(NodeRef nodeRef);
/** /**
@@ -99,6 +108,7 @@ public interface RuleService
* @param nodeRef the node reference * @param nodeRef the node reference
* @return a list of the rules associated with the node * @return a list of the rules associated with the node
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef"})
public List<Rule> getRules(NodeRef nodeRef); public List<Rule> getRules(NodeRef nodeRef);
/** /**
@@ -114,6 +124,7 @@ public interface RuleService
* the result list or not * the result list or not
* @return a list of the rules associated with the node * @return a list of the rules associated with the node
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef", "includeInhertied"})
public List<Rule> getRules(NodeRef nodeRef, boolean includeInhertied); public List<Rule> getRules(NodeRef nodeRef, boolean includeInhertied);
/** /**
@@ -126,6 +137,7 @@ public interface RuleService
* are returned * are returned
* @return a list of the rules associated with the node * @return a list of the rules associated with the node
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef", "includeInhertiedRuleType", "ruleTypeName"})
public List<Rule> getRules(NodeRef nodeRef, boolean includeInhertiedRuleType, String ruleTypeName); public List<Rule> getRules(NodeRef nodeRef, boolean includeInhertiedRuleType, String ruleTypeName);
/** /**
@@ -134,6 +146,7 @@ public interface RuleService
* @param nodeRef the node reference * @param nodeRef the node reference
* @return a list of the rules associated with the node * @return a list of the rules associated with the node
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef"})
public int countRules(NodeRef nodeRef); public int countRules(NodeRef nodeRef);
/** /**
@@ -143,6 +156,7 @@ public interface RuleService
* @param ruleId the rule id * @param ruleId the rule id
* @return the rule corresponding ot the id * @return the rule corresponding ot the id
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef", "ruleId"})
public Rule getRule(NodeRef nodeRef, String ruleId); public Rule getRule(NodeRef nodeRef, String ruleId);
/** /**
@@ -154,6 +168,7 @@ public interface RuleService
* @param ruleTypeName the name of the rule type * @param ruleTypeName the name of the rule type
* @return the created rule * @return the created rule
*/ */
@Auditable(parameters = {"ruleTypeName"})
public Rule createRule(String ruleTypeName); public Rule createRule(String ruleTypeName);
/** /**
@@ -165,6 +180,7 @@ public interface RuleService
* @param nodeRef * @param nodeRef
* @param rule * @param rule
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef", "rule"})
public void saveRule(NodeRef nodeRef, Rule rule); public void saveRule(NodeRef nodeRef, Rule rule);
/** /**
@@ -172,6 +188,7 @@ public interface RuleService
* *
* @param nodeRef the actionable node reference * @param nodeRef the actionable node reference
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef", "rule"})
public void removeRule(NodeRef nodeRef, Rule rule); public void removeRule(NodeRef nodeRef, Rule rule);
/** /**
@@ -179,5 +196,6 @@ public interface RuleService
* *
* @param nodeRef the actionable node reference * @param nodeRef the actionable node reference
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef"})
public void removeAllRules(NodeRef nodeRef); public void removeAllRules(NodeRef nodeRef);
} }

View File

@@ -18,6 +18,7 @@ package org.alfresco.service.cmr.search;
import java.util.Collection; import java.util.Collection;
import org.alfresco.service.Auditable;
import org.alfresco.service.cmr.repository.ChildAssociationRef; import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.StoreRef; import org.alfresco.service.cmr.repository.StoreRef;
@@ -63,6 +64,7 @@ public interface CategoryService
* @param depth - the enumeration depth for what level to recover * @param depth - the enumeration depth for what level to recover
* @return a collection of all the nodes found identified by their ChildAssocRef's * @return a collection of all the nodes found identified by their ChildAssocRef's
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"categoryRef", "mode", "depth"})
public Collection<ChildAssociationRef> getChildren(NodeRef categoryRef, Mode mode, Depth depth ); public Collection<ChildAssociationRef> getChildren(NodeRef categoryRef, Mode mode, Depth depth );
/** /**
@@ -73,6 +75,7 @@ public interface CategoryService
* @param depth - the enumeration depth for what level to recover * @param depth - the enumeration depth for what level to recover
* @return a collection of all the nodes found identified by their ChildAssocRef's * @return a collection of all the nodes found identified by their ChildAssocRef's
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"storeRef", "aspectQName", "depth"})
public Collection<ChildAssociationRef> getCategories(StoreRef storeRef, QName aspectQName, Depth depth ); public Collection<ChildAssociationRef> getCategories(StoreRef storeRef, QName aspectQName, Depth depth );
/** /**
@@ -80,6 +83,7 @@ public interface CategoryService
* *
* @return * @return
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"storeRef"})
public Collection<ChildAssociationRef> getClassifications(StoreRef storeRef); public Collection<ChildAssociationRef> getClassifications(StoreRef storeRef);
/** /**
@@ -89,6 +93,7 @@ public interface CategoryService
* @param aspectName * @param aspectName
* @return * @return
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"storeRef", "aspectName"})
public Collection<ChildAssociationRef> getRootCategories(StoreRef storeRef, QName aspectName); public Collection<ChildAssociationRef> getRootCategories(StoreRef storeRef, QName aspectName);
/** /**
@@ -96,6 +101,7 @@ public interface CategoryService
* *
* @return * @return
*/ */
@Auditable
public Collection<QName> getClassificationAspects(); public Collection<QName> getClassificationAspects();
/** /**
@@ -107,6 +113,7 @@ public interface CategoryService
* @param aspectName * @param aspectName
* @param attributeName * @param attributeName
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"storeRef", "aspectName", "attributeName"})
public NodeRef createClassifiction(StoreRef storeRef, QName aspectName, String attributeName); public NodeRef createClassifiction(StoreRef storeRef, QName aspectName, String attributeName);
/** /**
@@ -117,6 +124,7 @@ public interface CategoryService
* @param name * @param name
* @return * @return
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"storeRef", "aspectName", "name"})
public NodeRef createRootCategory(StoreRef storeRef, QName aspectName, String name); public NodeRef createRootCategory(StoreRef storeRef, QName aspectName, String name);
/** /**
@@ -126,6 +134,7 @@ public interface CategoryService
* @param name * @param name
* @return * @return
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"parent", "name"})
public NodeRef createCategory(NodeRef parent, String name); public NodeRef createCategory(NodeRef parent, String name);
/** /**
@@ -134,6 +143,7 @@ public interface CategoryService
* @param storeRef * @param storeRef
* @param aspectName * @param aspectName
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"storeRef", "aspectName"})
public void deleteClassification(StoreRef storeRef, QName aspectName); public void deleteClassification(StoreRef storeRef, QName aspectName);
/** /**
@@ -141,5 +151,6 @@ public interface CategoryService
* *
* @param nodeRef * @param nodeRef
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef"})
public void deleteCategory(NodeRef nodeRef); public void deleteCategory(NodeRef nodeRef);
} }

View File

@@ -19,6 +19,7 @@ package org.alfresco.service.cmr.search;
import java.io.Serializable; import java.io.Serializable;
import java.util.List; import java.util.List;
import org.alfresco.service.Auditable;
import org.alfresco.service.cmr.repository.InvalidNodeRefException; import org.alfresco.service.cmr.repository.InvalidNodeRefException;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.Path; import org.alfresco.service.cmr.repository.Path;
@@ -62,6 +63,7 @@ public interface SearchService
* the value. * the value.
* @return Returns the query results * @return Returns the query results
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"store", "language", "query", "attributePaths", "queryParameterDefinitions"})
public ResultSet query(StoreRef store, String language, String query, Path[] attributePaths, public ResultSet query(StoreRef store, String language, String query, Path[] attributePaths,
QueryParameterDefinition[] queryParameterDefinitions); QueryParameterDefinition[] queryParameterDefinitions);
@@ -77,6 +79,7 @@ public interface SearchService
* the query string - which may include parameters * the query string - which may include parameters
* @return Returns the query results * @return Returns the query results
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"store", "language", "query"})
public ResultSet query(StoreRef store, String language, String query); public ResultSet query(StoreRef store, String language, String query);
/** /**
@@ -93,6 +96,7 @@ public interface SearchService
* the value. * the value.
* @return Returns the query results * @return Returns the query results
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"store", "language", "query", "queryParameterDefinitions"})
public ResultSet query(StoreRef store, String language, String query, public ResultSet query(StoreRef store, String language, String query,
QueryParameterDefinition[] queryParameterDefintions); QueryParameterDefinition[] queryParameterDefintions);
@@ -110,6 +114,7 @@ public interface SearchService
* selected nodes in xpath style syntax * selected nodes in xpath style syntax
* @return Returns the query results * @return Returns the query results
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"store", "language", "query", "attributePaths"})
public ResultSet query(StoreRef store, String language, String query, Path[] attributePaths); public ResultSet query(StoreRef store, String language, String query, Path[] attributePaths);
/** /**
@@ -123,12 +128,14 @@ public interface SearchService
* parameterisation for the canned query * parameterisation for the canned query
* @return Returns the query results * @return Returns the query results
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"store", "queryId", "queryParameters"})
public ResultSet query(StoreRef store, QName queryId, QueryParameter[] queryParameters); public ResultSet query(StoreRef store, QName queryId, QueryParameter[] queryParameters);
/** /**
* Search using the given SearchParameters * Search using the given SearchParameters
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"searchParameters"})
public ResultSet query(SearchParameters searchParameters); public ResultSet query(SearchParameters searchParameters);
/** /**
@@ -147,6 +154,7 @@ public interface SearchService
* it follows all * it follows all
* @return a list of all the child assoc relationships to the selected nodes * @return a list of all the child assoc relationships to the selected nodes
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"contextNodeRef", "xpath", "parameters", "namespacePrefixResolver", "followAllParentLinks"})
public List<NodeRef> selectNodes(NodeRef contextNodeRef, String xpath, QueryParameterDefinition[] parameters, public List<NodeRef> selectNodes(NodeRef contextNodeRef, String xpath, QueryParameterDefinition[] parameters,
NamespacePrefixResolver namespacePrefixResolver, boolean followAllParentLinks) NamespacePrefixResolver namespacePrefixResolver, boolean followAllParentLinks)
throws InvalidNodeRefException, XPathException; throws InvalidNodeRefException, XPathException;
@@ -169,6 +177,7 @@ public interface SearchService
* the xpath variant * the xpath variant
* @return a list of all the child assoc relationships to the selected nodes * @return a list of all the child assoc relationships to the selected nodes
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"contextNodeRef", "xpath", "parameters", "namespacePrefixResolver", "followAllParentLinks", "language"})
public List<NodeRef> selectNodes(NodeRef contextNodeRef, String xpath, QueryParameterDefinition[] parameters, public List<NodeRef> selectNodes(NodeRef contextNodeRef, String xpath, QueryParameterDefinition[] parameters,
NamespacePrefixResolver namespacePrefixResolver, boolean followAllParentLinks, String language) NamespacePrefixResolver namespacePrefixResolver, boolean followAllParentLinks, String language)
throws InvalidNodeRefException, XPathException; throws InvalidNodeRefException, XPathException;
@@ -189,6 +198,7 @@ public interface SearchService
* it follows all * it follows all
* @return a list of property values * @return a list of property values
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"contextNodeRef", "xpath", "parameters", "namespacePrefixResolver", "followAllParentLinks"})
public List<Serializable> selectProperties(NodeRef contextNodeRef, String xpath, public List<Serializable> selectProperties(NodeRef contextNodeRef, String xpath,
QueryParameterDefinition[] parameters, NamespacePrefixResolver namespacePrefixResolver, QueryParameterDefinition[] parameters, NamespacePrefixResolver namespacePrefixResolver,
boolean followAllParentLinks) throws InvalidNodeRefException, XPathException; boolean followAllParentLinks) throws InvalidNodeRefException, XPathException;
@@ -211,6 +221,7 @@ public interface SearchService
* the xpath variant * the xpath variant
* @return a list of property values * @return a list of property values
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"contextNodeRef", "xpath", "parameters", "namespacePrefixResolver", "followAllParentLinks", "language"})
public List<Serializable> selectProperties(NodeRef contextNodeRef, String xpath, public List<Serializable> selectProperties(NodeRef contextNodeRef, String xpath,
QueryParameterDefinition[] parameters, NamespacePrefixResolver namespacePrefixResolver, QueryParameterDefinition[] parameters, NamespacePrefixResolver namespacePrefixResolver,
boolean followAllParentLinks, String language) throws InvalidNodeRefException, XPathException; boolean followAllParentLinks, String language) throws InvalidNodeRefException, XPathException;
@@ -227,6 +238,7 @@ public interface SearchService
* a Google-like pattern to search for in the property value * a Google-like pattern to search for in the property value
* @return Returns true if the pattern could be found - uses the default OR operator * @return Returns true if the pattern could be found - uses the default OR operator
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef", "propertyQName", "googleLikePattern"})
public boolean contains(NodeRef nodeRef, QName propertyQName, String googleLikePattern) public boolean contains(NodeRef nodeRef, QName propertyQName, String googleLikePattern)
throws InvalidNodeRefException; throws InvalidNodeRefException;
@@ -242,6 +254,7 @@ public interface SearchService
* a Google-like pattern to search for in the property value * a Google-like pattern to search for in the property value
* @return Returns true if the pattern could be found * @return Returns true if the pattern could be found
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef", "propertyQName", "googleLikePattern", "defaultOperator"})
public boolean contains(NodeRef nodeRef, QName propertyQName, String googleLikePattern, SearchParameters.Operator defaultOperator) public boolean contains(NodeRef nodeRef, QName propertyQName, String googleLikePattern, SearchParameters.Operator defaultOperator)
throws InvalidNodeRefException; throws InvalidNodeRefException;
@@ -259,6 +272,7 @@ public interface SearchService
* include full text search matches in the like test * include full text search matches in the like test
* @return Returns true if the pattern could be found * @return Returns true if the pattern could be found
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef", "propertyQName", "sqlLikePattern", "includeFTS"})
public boolean like(NodeRef nodeRef, QName propertyQName, String sqlLikePattern, boolean includeFTS) public boolean like(NodeRef nodeRef, QName propertyQName, String sqlLikePattern, boolean includeFTS)
throws InvalidNodeRefException; throws InvalidNodeRefException;
} }

View File

@@ -19,6 +19,7 @@ package org.alfresco.service.cmr.security;
import java.util.Set; import java.util.Set;
import org.alfresco.repo.security.authentication.AuthenticationException; import org.alfresco.repo.security.authentication.AuthenticationException;
import org.alfresco.service.Auditable;
/** /**
* The authentication service defines the API for managing authentication information * The authentication service defines the API for managing authentication information
@@ -36,6 +37,7 @@ public interface AuthenticationService
* @param password * @param password
* @throws AuthenticationException * @throws AuthenticationException
*/ */
@Auditable(parameters = {"userName", "password"}, recordable = {true, false})
public void createAuthentication(String userName, char[] password) throws AuthenticationException; public void createAuthentication(String userName, char[] password) throws AuthenticationException;
/** /**
@@ -46,6 +48,7 @@ public interface AuthenticationService
* @param newPassword * @param newPassword
* @throws AuthenticationException * @throws AuthenticationException
*/ */
@Auditable(parameters = {"userName", "oldPassword", "newPassword"}, recordable = {true, false, false})
public void updateAuthentication(String userName, char[] oldPassword, char[] newPassword) throws AuthenticationException; public void updateAuthentication(String userName, char[] oldPassword, char[] newPassword) throws AuthenticationException;
/** /**
@@ -55,6 +58,7 @@ public interface AuthenticationService
* @param newPassword * @param newPassword
* @throws AuthenticationException * @throws AuthenticationException
*/ */
@Auditable(parameters = {"userName", "newPassword"}, recordable = {true, false})
public void setAuthentication(String userName, char[] newPassword) throws AuthenticationException; public void setAuthentication(String userName, char[] newPassword) throws AuthenticationException;
@@ -64,6 +68,7 @@ public interface AuthenticationService
* @param userName * @param userName
* @throws AuthenticationException * @throws AuthenticationException
*/ */
@Auditable(parameters = {"userName"})
public void deleteAuthentication(String userName) throws AuthenticationException; public void deleteAuthentication(String userName) throws AuthenticationException;
/** /**
@@ -72,6 +77,7 @@ public interface AuthenticationService
* @param userName * @param userName
* @param enabled * @param enabled
*/ */
@Auditable(parameters = {"userName", "enabled"})
public void setAuthenticationEnabled(String userName, boolean enabled) throws AuthenticationException; public void setAuthenticationEnabled(String userName, boolean enabled) throws AuthenticationException;
/** /**
@@ -80,6 +86,7 @@ public interface AuthenticationService
* @param userName * @param userName
* @return * @return
*/ */
@Auditable(parameters = {"userName"})
public boolean getAuthenticationEnabled(String userName) throws AuthenticationException; public boolean getAuthenticationEnabled(String userName) throws AuthenticationException;
/** /**
@@ -90,6 +97,7 @@ public interface AuthenticationService
* @param password the passowrd * @param password the passowrd
* @throws AuthenticationException * @throws AuthenticationException
*/ */
@Auditable(parameters = {"userName", "password"}, recordable = {true, false})
public void authenticate(String userName, char[] password) throws AuthenticationException; public void authenticate(String userName, char[] password) throws AuthenticationException;
/** /**
@@ -97,6 +105,7 @@ public interface AuthenticationService
* *
* @throws AuthenticationException * @throws AuthenticationException
*/ */
@Auditable
public void authenticateAsGuest() throws AuthenticationException; public void authenticateAsGuest() throws AuthenticationException;
/** /**
@@ -105,6 +114,7 @@ public interface AuthenticationService
* @param userName the username * @param userName the username
* @return Returns <tt>true</tt> if the authentication exists * @return Returns <tt>true</tt> if the authentication exists
*/ */
@Auditable(parameters = {"userName"})
public boolean authenticationExists(String userName); public boolean authenticationExists(String userName);
/** /**
@@ -113,6 +123,7 @@ public interface AuthenticationService
* @return * @return
* @throws AuthenticationException * @throws AuthenticationException
*/ */
@Auditable
public String getCurrentUserName() throws AuthenticationException; public String getCurrentUserName() throws AuthenticationException;
/** /**
@@ -121,6 +132,7 @@ public interface AuthenticationService
* @param userName * @param userName
* @throws AuthenticationException * @throws AuthenticationException
*/ */
@Auditable(parameters = {"userName"})
public void invalidateUserSession(String userName) throws AuthenticationException; public void invalidateUserSession(String userName) throws AuthenticationException;
/** /**
@@ -129,6 +141,7 @@ public interface AuthenticationService
* @param ticket * @param ticket
* @throws AuthenticationException * @throws AuthenticationException
*/ */
@Auditable(parameters = {"ticket"}, recordable = {false})
public void invalidateTicket(String ticket) throws AuthenticationException; public void invalidateTicket(String ticket) throws AuthenticationException;
/** /**
@@ -137,18 +150,21 @@ public interface AuthenticationService
* @param ticket * @param ticket
* @throws AuthenticationException * @throws AuthenticationException
*/ */
@Auditable(parameters = {"ticket"}, recordable = {false})
public void validate(String ticket) throws AuthenticationException; public void validate(String ticket) throws AuthenticationException;
/** /**
* Get the current ticket as a string * Get the current ticket as a string
* @return * @return
*/ */
@Auditable
public String getCurrentTicket(); public String getCurrentTicket();
/** /**
* Remove the current security information * Remove the current security information
* *
*/ */
@Auditable
public void clearCurrentSecurityContext(); public void clearCurrentSecurityContext();
/** /**
@@ -156,7 +172,7 @@ public interface AuthenticationService
* *
* @return * @return
*/ */
@Auditable
public boolean isCurrentUserTheSystemUser(); public boolean isCurrentUserTheSystemUser();
/** /**
@@ -164,7 +180,7 @@ public interface AuthenticationService
* *
* @return The domain name * @return The domain name
*/ */
@Auditable
public Set<String> getDomains(); public Set<String> getDomains();
/** /**
@@ -172,6 +188,7 @@ public interface AuthenticationService
* *
* @return * @return
*/ */
@Auditable
public Set<String> getDomainsThatAllowUserCreation(); public Set<String> getDomainsThatAllowUserCreation();
/** /**
@@ -179,6 +196,7 @@ public interface AuthenticationService
* *
* @return * @return
*/ */
@Auditable
public Set<String> getDomainsThatAllowUserDeletion(); public Set<String> getDomainsThatAllowUserDeletion();
/** /**
@@ -186,6 +204,7 @@ public interface AuthenticationService
* *
* @return * @return
*/ */
@Auditable
public Set<String> getDomiansThatAllowUserPasswordChanges(); public Set<String> getDomiansThatAllowUserPasswordChanges();
} }

View File

@@ -18,6 +18,8 @@ package org.alfresco.service.cmr.security;
import java.util.Set; import java.util.Set;
import org.alfresco.service.Auditable;
/** /**
* The service that encapsulates authorities granted to users. * The service that encapsulates authorities granted to users.
* *
@@ -43,6 +45,7 @@ public interface AuthorityService
* *
* @return true if the currently authenticated user has the admin authority * @return true if the currently authenticated user has the admin authority
*/ */
@Auditable
public boolean hasAdminAuthority(); public boolean hasAdminAuthority();
/** /**
@@ -50,6 +53,7 @@ public interface AuthorityService
* *
* @return * @return
*/ */
@Auditable
public Set<String> getAuthorities(); public Set<String> getAuthorities();
/** /**
@@ -59,6 +63,7 @@ public interface AuthorityService
* the type of authorities. * the type of authorities.
* @return * @return
*/ */
@Auditable(parameters = {"type"})
public Set<String> getAllAuthorities(AuthorityType type); public Set<String> getAllAuthorities(AuthorityType type);
/** /**
@@ -69,7 +74,7 @@ public interface AuthorityService
* the type of the authority * the type of the authority
* @return * @return
*/ */
@Auditable(parameters = {"type"})
public Set<String> getAllRootAuthorities(AuthorityType type); public Set<String> getAllRootAuthorities(AuthorityType type);
/** /**
@@ -87,6 +92,7 @@ public interface AuthorityService
* @return the name of the authority (this will be the prefix, if any * @return the name of the authority (this will be the prefix, if any
* associated with the type appended with the short name) * associated with the type appended with the short name)
*/ */
@Auditable(parameters = {"type", "parentName", "shortName"})
public String createAuthority(AuthorityType type, String parentName, String shortName); public String createAuthority(AuthorityType type, String parentName, String shortName);
/** /**
@@ -98,6 +104,7 @@ public interface AuthorityService
* @param childName - * @param childName -
* the string identifier for the child. * the string identifier for the child.
*/ */
@Auditable(parameters = {"parentName", "childName"})
public void addAuthority(String parentName, String childName); public void addAuthority(String parentName, String childName);
/** /**
@@ -111,6 +118,7 @@ public interface AuthorityService
* @param childName - * @param childName -
* the string identifier for the child. * the string identifier for the child.
*/ */
@Auditable(parameters = {"parentName", "childName"})
public void removeAuthority(String parentName, String childName); public void removeAuthority(String parentName, String childName);
/** /**
@@ -118,6 +126,7 @@ public interface AuthorityService
* *
* @param name * @param name
*/ */
@Auditable(parameters = {"name"})
public void deleteAuthority(String name); public void deleteAuthority(String name);
/** /**
@@ -135,6 +144,7 @@ public interface AuthorityService
* find authorities at any depth * find authorities at any depth
* @return * @return
*/ */
@Auditable(parameters = {"type", "name", "immediate"})
public Set<String> getContainedAuthorities(AuthorityType type, String name, boolean immediate); public Set<String> getContainedAuthorities(AuthorityType type, String name, boolean immediate);
/** /**
@@ -152,6 +162,7 @@ public interface AuthorityService
* limit to immediate parents or any ancestor. * limit to immediate parents or any ancestor.
* @return * @return
*/ */
@Auditable(parameters = {"type", "name", "immediate"})
public Set<String> getContainingAuthorities(AuthorityType type, String name, boolean immediate); public Set<String> getContainingAuthorities(AuthorityType type, String name, boolean immediate);
/** /**
@@ -160,6 +171,7 @@ public interface AuthorityService
* @param name * @param name
* @return * @return
*/ */
@Auditable(parameters = {"name"})
public String getShortName(String name); public String getShortName(String name);
/** /**
@@ -170,6 +182,7 @@ public interface AuthorityService
* @param shortName * @param shortName
* @return * @return
*/ */
@Auditable(parameters = {"type", "shortName"})
public String getName(AuthorityType type, String shortName); public String getName(AuthorityType type, String shortName);
/** /**
@@ -178,6 +191,7 @@ public interface AuthorityService
* @param name (the long name). * @param name (the long name).
* @return * @return
*/ */
@Auditable(parameters = {"name"})
public boolean authorityExists(String name); public boolean authorityExists(String name);
} }

View File

@@ -16,6 +16,7 @@
*/ */
package org.alfresco.service.cmr.security; package org.alfresco.service.cmr.security;
import org.alfresco.service.Auditable;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
/** /**
@@ -31,6 +32,7 @@ public interface OwnableService
* @param nodeRef * @param nodeRef
* @return the username or null if the object has no owner * @return the username or null if the object has no owner
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef"})
public String getOwner(NodeRef nodeRef); public String getOwner(NodeRef nodeRef);
/** /**
@@ -39,6 +41,7 @@ public interface OwnableService
* @param nodeRef * @param nodeRef
* @param userName * @param userName
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef", "userName"})
public void setOwner(NodeRef nodeRef, String userName); public void setOwner(NodeRef nodeRef, String userName);
/** /**
@@ -46,6 +49,7 @@ public interface OwnableService
* *
* @param nodeRef * @param nodeRef
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef"})
public void takeOwnership(NodeRef nodeRef); public void takeOwnership(NodeRef nodeRef);
/** /**
@@ -54,5 +58,6 @@ public interface OwnableService
* @param nodeRef * @param nodeRef
* @return * @return
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef"})
public boolean hasOwner(NodeRef nodeRef); public boolean hasOwner(NodeRef nodeRef);
} }

View File

@@ -18,6 +18,7 @@ package org.alfresco.service.cmr.security;
import java.util.Set; import java.util.Set;
import org.alfresco.service.Auditable;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.namespace.QName; import org.alfresco.service.namespace.QName;
@@ -119,6 +120,7 @@ public interface PermissionService
* *
* @return the owner authority * @return the owner authority
*/ */
@Auditable
public String getOwnerAuthority(); public String getOwnerAuthority();
/** /**
@@ -126,6 +128,7 @@ public interface PermissionService
* *
* @return the All authorities * @return the All authorities
*/ */
@Auditable
public String getAllAuthorities(); public String getAllAuthorities();
/** /**
@@ -133,6 +136,7 @@ public interface PermissionService
* *
* @return the All permission * @return the All permission
*/ */
@Auditable
public String getAllPermission(); public String getAllPermission();
/** /**
@@ -143,6 +147,7 @@ public interface PermissionService
* the reference to the node * the reference to the node
* @return the set of allowed permissions * @return the set of allowed permissions
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef"})
public Set<AccessPermission> getPermissions(NodeRef nodeRef); public Set<AccessPermission> getPermissions(NodeRef nodeRef);
/** /**
@@ -153,6 +158,7 @@ public interface PermissionService
* the reference to the node * the reference to the node
* @return the set of allowed permissions * @return the set of allowed permissions
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef"})
public Set<AccessPermission> getAllSetPermissions(NodeRef nodeRef); public Set<AccessPermission> getAllSetPermissions(NodeRef nodeRef);
/** /**
@@ -161,6 +167,7 @@ public interface PermissionService
* @param nodeRef * @param nodeRef
* @return * @return
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef"})
public Set<String> getSettablePermissions(NodeRef nodeRef); public Set<String> getSettablePermissions(NodeRef nodeRef);
/** /**
@@ -169,6 +176,7 @@ public interface PermissionService
* @param nodeRef * @param nodeRef
* @return * @return
*/ */
@Auditable(parameters = {"type"})
public Set<String> getSettablePermissions(QName type); public Set<String> getSettablePermissions(QName type);
/** /**
@@ -176,16 +184,18 @@ public interface PermissionService
* given node. (The default behaviour is to inherit permissions) * given node. (The default behaviour is to inherit permissions)
* *
* @param nodeRef * @param nodeRef
* @param perm * @param permission
* @return * @return
*/ */
public AccessStatus hasPermission(NodeRef nodeRef, String perm); @Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef", "permission"})
public AccessStatus hasPermission(NodeRef nodeRef, String permission);
/** /**
* Delete all the permission assigned to the node * Delete all the permission assigned to the node
* *
* @param nodeRef * @param nodeRef
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef"})
public void deletePermissions(NodeRef nodeRef); public void deletePermissions(NodeRef nodeRef);
/** /**
@@ -194,6 +204,7 @@ public interface PermissionService
* @param nodeRef * @param nodeRef
* @param authority * @param authority
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef", "authority"})
public void clearPermission(NodeRef nodeRef, String authority); public void clearPermission(NodeRef nodeRef, String authority);
/** /**
@@ -203,6 +214,7 @@ public interface PermissionService
* @param authority the authority recipient * @param authority the authority recipient
* @param permission the entry permission * @param permission the entry permission
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef", "authority", "permission"})
public void deletePermission(NodeRef nodeRef, String authority, String permission); public void deletePermission(NodeRef nodeRef, String authority, String permission);
/** /**
@@ -210,10 +222,11 @@ public interface PermissionService
* *
* @param nodeRef * @param nodeRef
* @param authority * @param authority
* @param perm * @param permission
* @param allow * @param allow
*/ */
public void setPermission(NodeRef nodeRef, String authority, String perm, boolean allow); @Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef", "authority", "permission", "allow"})
public void setPermission(NodeRef nodeRef, String authority, String permission, boolean allow);
/** /**
* Set the global inheritance behaviour for permissions on a node. * Set the global inheritance behaviour for permissions on a node.
@@ -221,6 +234,7 @@ public interface PermissionService
* @param nodeRef * @param nodeRef
* @param inheritParentPermissions * @param inheritParentPermissions
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef", "inheritParentPermissions"})
public void setInheritParentPermissions(NodeRef nodeRef, boolean inheritParentPermissions); public void setInheritParentPermissions(NodeRef nodeRef, boolean inheritParentPermissions);
/** /**
@@ -229,5 +243,6 @@ public interface PermissionService
* @param nodeRef * @param nodeRef
* @return inheritParentPermissions * @return inheritParentPermissions
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef"})
public boolean getInheritParentPermissions(NodeRef nodeRef); public boolean getInheritParentPermissions(NodeRef nodeRef);
} }

View File

@@ -20,6 +20,7 @@ import java.io.Serializable;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import org.alfresco.service.Auditable;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.namespace.QName; import org.alfresco.service.namespace.QName;
@@ -49,6 +50,7 @@ public interface PersonService
* @see #setCreateMissingPeople(boolean) * @see #setCreateMissingPeople(boolean)
* @see #createMissingPeople() * @see #createMissingPeople()
*/ */
@Auditable(parameters = {"userName"})
public NodeRef getPerson(String userName); public NodeRef getPerson(String userName);
/** /**
@@ -57,6 +59,7 @@ public interface PersonService
* @param userName the user name * @param userName the user name
* @return Returns true if the user exists, otherwise false * @return Returns true if the user exists, otherwise false
*/ */
@Auditable(parameters = {"userName"})
public boolean personExists(String userName); public boolean personExists(String userName);
/** /**
@@ -65,6 +68,7 @@ public interface PersonService
* *
* @return true if people are created on demand and false otherwise. * @return true if people are created on demand and false otherwise.
*/ */
@Auditable
public boolean createMissingPeople(); public boolean createMissingPeople();
/** /**
@@ -74,6 +78,7 @@ public interface PersonService
* *
* @see #getPerson(String) * @see #getPerson(String)
*/ */
@Auditable(parameters = {"createMissing"})
public void setCreateMissingPeople(boolean createMissing); public void setCreateMissingPeople(boolean createMissing);
/** /**
@@ -84,6 +89,7 @@ public interface PersonService
* *
* @return A set of QNames that identify properties that can be changed * @return A set of QNames that identify properties that can be changed
*/ */
@Auditable
public Set<QName> getMutableProperties(); public Set<QName> getMutableProperties();
/** /**
@@ -93,6 +99,7 @@ public interface PersonService
* @param userName - the user for which the properties should be set. * @param userName - the user for which the properties should be set.
* @param properties - the map of properties to set (as the NodeService) * @param properties - the map of properties to set (as the NodeService)
*/ */
@Auditable(parameters = {"userName", "properties"})
public void setPersonProperties(String userName, Map<QName, Serializable> properties); public void setPersonProperties(String userName, Map<QName, Serializable> properties);
/** /**
@@ -100,6 +107,7 @@ public interface PersonService
* *
* @return true if this service allows mutation to people. * @return true if this service allows mutation to people.
*/ */
@Auditable
public boolean isMutable(); public boolean isMutable();
/** /**
@@ -110,6 +118,7 @@ public interface PersonService
* @param properties * @param properties
* @return * @return
*/ */
@Auditable(parameters = {"properties"})
public NodeRef createPerson(Map<QName, Serializable> properties); public NodeRef createPerson(Map<QName, Serializable> properties);
/** /**
@@ -117,6 +126,7 @@ public interface PersonService
* *
* @param userName * @param userName
*/ */
@Auditable(parameters = {"userName"})
public void deletePerson(String userName); public void deletePerson(String userName);
/** /**
@@ -124,6 +134,7 @@ public interface PersonService
* *
* @return a set of people in no specific order. * @return a set of people in no specific order.
*/ */
@Auditable
public Set<NodeRef> getAllPeople(); public Set<NodeRef> getAllPeople();
/** /**
@@ -131,6 +142,7 @@ public interface PersonService
* *
* @return * @return
*/ */
@Auditable
public NodeRef getPeopleContainer(); public NodeRef getPeopleContainer();
/** /**
@@ -138,5 +150,6 @@ public interface PersonService
* *
* @return * @return
*/ */
@Auditable
public boolean getUserNamesAreCaseSensitive(); public boolean getUserNamesAreCaseSensitive();
} }

View File

@@ -20,6 +20,7 @@ import java.io.Serializable;
import java.util.Collection; import java.util.Collection;
import java.util.Map; import java.util.Map;
import org.alfresco.service.Auditable;
import org.alfresco.service.cmr.repository.AspectMissingException; import org.alfresco.service.cmr.repository.AspectMissingException;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.StoreRef; import org.alfresco.service.cmr.repository.StoreRef;
@@ -42,6 +43,7 @@ public interface VersionService
* *
* @return reference to the version store * @return reference to the version store
*/ */
@Auditable
public StoreRef getVersionStoreReference(); public StoreRef getVersionStoreReference();
/** /**
@@ -53,7 +55,7 @@ public interface VersionService
* If the node referenced does not or can not have the version aspect * If the node referenced does not or can not have the version aspect
* applied to it then an exception will be raised. * applied to it then an exception will be raised.
* <p> * <p>
* The version properties are sotred as version meta-data against the newly * The version properties are stored as version meta-data against the newly
* created version. * created version.
* *
* @param nodeRef a node reference * @param nodeRef a node reference
@@ -66,6 +68,7 @@ public interface VersionService
* @throws AspectMissingException * @throws AspectMissingException
* thrown if the version aspect is missing * thrown if the version aspect is missing
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef", "versionProperties"})
public Version createVersion( public Version createVersion(
NodeRef nodeRef, NodeRef nodeRef,
Map<String, Serializable> versionProperties) Map<String, Serializable> versionProperties)
@@ -80,7 +83,7 @@ public interface VersionService
* If the node referenced does not or can not have the version aspect * If the node referenced does not or can not have the version aspect
* applied to it then an exception will be raised. * applied to it then an exception will be raised.
* <p> * <p>
* The version properties are sotred as version meta-data against the newly * The version properties are stored as version meta-data against the newly
* created version. * created version.
* *
* @param nodeRef a node reference * @param nodeRef a node reference
@@ -95,6 +98,7 @@ public interface VersionService
* @throws AspectMissingException * @throws AspectMissingException
* thrown if the version aspect is missing * thrown if the version aspect is missing
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef", "versionProperties", "versionChildren"})
public Collection<Version> createVersion( public Collection<Version> createVersion(
NodeRef nodeRef, NodeRef nodeRef,
Map<String, Serializable> versionProperties, Map<String, Serializable> versionProperties,
@@ -113,6 +117,7 @@ public interface VersionService
* @throws AspectMissingException * @throws AspectMissingException
* thrown if the version aspect is missing * thrown if the version aspect is missing
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef", "versionProperties"})
public Collection<Version> createVersion( public Collection<Version> createVersion(
Collection<NodeRef> nodeRefs, Collection<NodeRef> nodeRefs,
Map<String, Serializable> versionProperties) Map<String, Serializable> versionProperties)
@@ -131,6 +136,7 @@ public interface VersionService
* @throws AspectMissingException * @throws AspectMissingException
* thrown if the version aspect is missing * thrown if the version aspect is missing
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef"})
public VersionHistory getVersionHistory(NodeRef nodeRef) public VersionHistory getVersionHistory(NodeRef nodeRef)
throws AspectMissingException; throws AspectMissingException;
@@ -142,6 +148,7 @@ public interface VersionService
* @param nodeRef the node reference * @param nodeRef the node reference
* @return the version object for the current version * @return the version object for the current version
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef"})
public Version getCurrentVersion(NodeRef nodeRef); public Version getCurrentVersion(NodeRef nodeRef);
/** /**
@@ -153,6 +160,7 @@ public interface VersionService
* *
* @param nodeRef the node reference * @param nodeRef the node reference
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef"})
public void revert(NodeRef nodeRef); public void revert(NodeRef nodeRef);
/** /**
@@ -163,6 +171,7 @@ public interface VersionService
* @param nodeRef the node reference * @param nodeRef the node reference
* @param deep true if a deep revert is to be performed, flase otherwise * @param deep true if a deep revert is to be performed, flase otherwise
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef", "deep"})
public void revert(NodeRef nodeRef, boolean deep); public void revert(NodeRef nodeRef, boolean deep);
/** /**
@@ -173,6 +182,7 @@ public interface VersionService
* @param nodeRef the node reference * @param nodeRef the node reference
* @param version the version to revert to * @param version the version to revert to
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef", "version"})
public void revert(NodeRef nodeRef, Version version); public void revert(NodeRef nodeRef, Version version);
/** /**
@@ -194,6 +204,7 @@ public interface VersionService
* @param version the version to revert to * @param version the version to revert to
* @param deep true is a deep revert is to be performed, false otherwise. * @param deep true is a deep revert is to be performed, false otherwise.
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef", "version", "deep"})
public void revert(NodeRef nodeRef, Version version, boolean deep); public void revert(NodeRef nodeRef, Version version, boolean deep);
/** /**
@@ -207,6 +218,7 @@ public interface VersionService
* @param assocQName the assoc qname * @param assocQName the assoc qname
* @return the newly restored node reference * @return the newly restored node reference
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef", "parentNodeRef", "assocTypeQName", "assocQName"})
public NodeRef restore( public NodeRef restore(
NodeRef nodeRef, NodeRef nodeRef,
NodeRef parentNodeRef, NodeRef parentNodeRef,
@@ -214,12 +226,12 @@ public interface VersionService
QName assocQName); QName assocQName);
/** /**
* Restores a node not currenlty present in the store, but that has a version * Restores a node not currently present in the store, but that has a version
* history. * history.
* <p> * <p>
* The restored node will be at the head (most resent version). * The restored node will be at the head (most resent version).
* <p> * <p>
* Resoration will fail if there is no version history for the specified node id in * Restoration will fail if there is no version history for the specified node id in
* the specified store. * the specified store.
* <p> * <p>
* If the node already exists in the store then an exception will be raised. * If the node already exists in the store then an exception will be raised.
@@ -230,13 +242,14 @@ public interface VersionService
* *
* @param nodeRef the node reference to a node that no longer exists in * @param nodeRef the node reference to a node that no longer exists in
* the store * the store
* @param parentNodeRef the new parent of the resotred node * @param parentNodeRef the new parent of the restored node
* @param assocTypeQName the assoc type qname * @param assocTypeQName the assoc type qname
* @param assocQName the assoc qname * @param assocQName the assoc qname
* @param deep true is a deep revert shoudl be performed once the node has been * @param deep true is a deep revert should be performed once the node has been
* restored, false otherwise * restored, false otherwise
* @return the newly restored node reference * @return the newly restored node reference
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef", "parentNodeRef", "assocTypeQName", "assocQName", "deep"})
public NodeRef restore( public NodeRef restore(
NodeRef nodeRef, NodeRef nodeRef,
NodeRef parentNodeRef, NodeRef parentNodeRef,
@@ -247,7 +260,7 @@ public interface VersionService
/** /**
* Delete the version history associated with a node reference. * Delete the version history associated with a node reference.
* <p> * <p>
* This operation is perminant, all versions in the version history are * This operation is permanent, all versions in the version history are
* deleted and cannot be retrieved. * deleted and cannot be retrieved.
* <p> * <p>
* The current version label for the node reference is reset and any subsequent versions * The current version label for the node reference is reset and any subsequent versions
@@ -256,6 +269,7 @@ public interface VersionService
* @param nodeRef the node reference * @param nodeRef the node reference
* @throws AspectMissingException thrown if the version aspect is missing * @throws AspectMissingException thrown if the version aspect is missing
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef"})
public void deleteVersionHistory(NodeRef nodeRef) public void deleteVersionHistory(NodeRef nodeRef)
throws AspectMissingException; throws AspectMissingException;
} }

View File

@@ -18,6 +18,8 @@ package org.alfresco.service.cmr.view;
import java.io.OutputStream; import java.io.OutputStream;
import org.alfresco.service.Auditable;
/** /**
* Exporter Service * Exporter Service
@@ -36,6 +38,7 @@ public interface ExporterService
* @param parameters export parameters * @param parameters export parameters
* @param progress exporter callback for tracking progress of export * @param progress exporter callback for tracking progress of export
*/ */
@Auditable(parameters = {"viewWriter", "parameters", "progress"})
public void exportView(OutputStream viewWriter, ExporterCrawlerParameters parameters, Exporter progress) public void exportView(OutputStream viewWriter, ExporterCrawlerParameters parameters, Exporter progress)
throws ExporterException; throws ExporterException;
@@ -48,6 +51,7 @@ public interface ExporterService
* @param parameters export parameters * @param parameters export parameters
* @param progress exporter callback for tracking progress of export * @param progress exporter callback for tracking progress of export
*/ */
@Auditable(parameters = {"exportHandler", "parameters", "progress"})
public void exportView(ExportPackageHandler exportHandler, ExporterCrawlerParameters parameters, Exporter progress) public void exportView(ExportPackageHandler exportHandler, ExporterCrawlerParameters parameters, Exporter progress)
throws ExporterException; throws ExporterException;
@@ -59,6 +63,7 @@ public interface ExporterService
* @param parameters export parameters * @param parameters export parameters
* @param progress exporter callback for tracking progress of export * @param progress exporter callback for tracking progress of export
*/ */
@Auditable(parameters = {"exporter", "parameters", "progress"})
public void exportView(Exporter exporter, ExporterCrawlerParameters parameters, Exporter progress); public void exportView(Exporter exporter, ExporterCrawlerParameters parameters, Exporter progress);
} }

View File

@@ -18,6 +18,8 @@ package org.alfresco.service.cmr.view;
import java.io.Reader; import java.io.Reader;
import org.alfresco.service.Auditable;
/** /**
* Importer Service. Entry point for importing xml data sources into the Repository. * Importer Service. Entry point for importing xml data sources into the Repository.
@@ -36,6 +38,7 @@ public interface ImporterService
* @param binding property values used for binding property place holders in import stream * @param binding property values used for binding property place holders in import stream
* @param progress progress monitor (optional) * @param progress progress monitor (optional)
*/ */
@Auditable(parameters = {"viewReader", "location", "binding", "progress"})
public void importView(Reader viewReader, Location location, ImporterBinding binding, ImporterProgress progress) public void importView(Reader viewReader, Location location, ImporterBinding binding, ImporterProgress progress)
throws ImporterException; throws ImporterException;
@@ -50,6 +53,7 @@ public interface ImporterService
* @param binding property values used for binding property place holders in import stream * @param binding property values used for binding property place holders in import stream
* @param progress progress monitor (optional) * @param progress progress monitor (optional)
*/ */
@Auditable(parameters = {"importHandler", "location", "binding", "progress"})
public void importView(ImportPackageHandler importHandler, Location location, ImporterBinding binding, ImporterProgress progress) public void importView(ImportPackageHandler importHandler, Location location, ImporterBinding binding, ImporterProgress progress)
throws ImporterException; throws ImporterException;

View File

@@ -18,6 +18,7 @@ package org.alfresco.service.cmr.view;
import java.io.File; import java.io.File;
import org.alfresco.service.Auditable;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.StoreRef; import org.alfresco.service.cmr.repository.StoreRef;
@@ -38,6 +39,7 @@ public interface RepositoryExporterService
* @param packageName package name prefix for export .acp files * @param packageName package name prefix for export .acp files
* @return list of temporary export files * @return list of temporary export files
*/ */
@Auditable(parameters = {"packageName"})
public FileExportHandle[] export(String packageName); public FileExportHandle[] export(String packageName);
/** /**
@@ -49,6 +51,7 @@ public interface RepositoryExporterService
* @param packageName package name prefix for export .acp files * @param packageName package name prefix for export .acp files
* @return list of repository held export files * @return list of repository held export files
*/ */
@Auditable(key = Auditable.Key.ARG_0, parameters = {"repositoryDestination", "packageName"})
public RepositoryExportHandle[] export(NodeRef repositoryDestination, String packageName); public RepositoryExportHandle[] export(NodeRef repositoryDestination, String packageName);
/** /**
@@ -58,6 +61,7 @@ public interface RepositoryExporterService
* @param packageName package name prefix for export .acp files * @param packageName package name prefix for export .acp files
* @return list of export files * @return list of export files
*/ */
@Auditable(parameters = {"directoryDestination", "packageName"})
public FileExportHandle[] export(File directoryDestination, String packageName); public FileExportHandle[] export(File directoryDestination, String packageName);

View File

@@ -16,6 +16,7 @@
*/ */
package org.alfresco.service.descriptor; package org.alfresco.service.descriptor;
import org.alfresco.service.NotAuditable;
import org.alfresco.service.license.LicenseDescriptor; import org.alfresco.service.license.LicenseDescriptor;
@@ -32,6 +33,7 @@ public interface DescriptorService
* *
* @return server descriptor * @return server descriptor
*/ */
@NotAuditable
public Descriptor getServerDescriptor(); public Descriptor getServerDescriptor();
/** /**
@@ -41,6 +43,7 @@ public interface DescriptorService
* *
* @return repository descriptor * @return repository descriptor
*/ */
@NotAuditable
public Descriptor getInstalledRepositoryDescriptor(); public Descriptor getInstalledRepositoryDescriptor();
/** /**
@@ -48,6 +51,7 @@ public interface DescriptorService
* *
* @return the license descriptor * @return the license descriptor
*/ */
@NotAuditable
public LicenseDescriptor getLicenseDescriptor(); public LicenseDescriptor getLicenseDescriptor();
} }

View File

@@ -16,6 +16,8 @@
*/ */
package org.alfresco.service.license; package org.alfresco.service.license;
import org.alfresco.service.NotAuditable;
/** /**
* Contract for managing licenses * Contract for managing licenses
@@ -30,6 +32,7 @@ public interface LicenseService
* *
* @throws LicenseException * @throws LicenseException
*/ */
@NotAuditable
public void verifyLicense() throws LicenseException; public void verifyLicense() throws LicenseException;
/** /**
@@ -38,6 +41,7 @@ public interface LicenseService
* @return license descriptor (or null, if one is not installed) * @return license descriptor (or null, if one is not installed)
* @throws LicenseException * @throws LicenseException
*/ */
@NotAuditable
public LicenseDescriptor getLicense() throws LicenseException; public LicenseDescriptor getLicense() throws LicenseException;
} }

View File

@@ -16,6 +16,8 @@
*/ */
package org.alfresco.service.namespace; package org.alfresco.service.namespace;
import org.alfresco.service.Auditable;
/** /**
@@ -83,6 +85,7 @@ public interface NamespaceService extends NamespacePrefixResolver
* @param prefix * @param prefix
* @param uri * @param uri
*/ */
@Auditable(parameters = {"prefix", "uri"})
public void registerNamespace(String prefix, String uri); public void registerNamespace(String prefix, String uri);
@@ -91,6 +94,7 @@ public interface NamespaceService extends NamespacePrefixResolver
* *
* @param prefix * @param prefix
*/ */
@Auditable(parameters = {"prefix"})
public void unregisterNamespace(String prefix); public void unregisterNamespace(String prefix);
} }

View File

@@ -18,6 +18,8 @@ package org.alfresco.service.transaction;
import javax.transaction.UserTransaction; import javax.transaction.UserTransaction;
import org.alfresco.service.NotAuditable;
/** /**
* Contract for retrieving access to a user transaction. * Contract for retrieving access to a user transaction.
* <p> * <p>
@@ -34,6 +36,7 @@ public interface TransactionService
* *
* @return Returns true if all transactions are read-only. * @return Returns true if all transactions are read-only.
*/ */
@NotAuditable
public boolean isReadOnly(); public boolean isReadOnly();
/** /**
@@ -42,6 +45,7 @@ public interface TransactionService
* *
* @return the user transaction * @return the user transaction
*/ */
@NotAuditable
UserTransaction getUserTransaction(); UserTransaction getUserTransaction();
/** /**
@@ -53,6 +57,7 @@ public interface TransactionService
* system is in read-only mode. * system is in read-only mode.
* @return the user transaction * @return the user transaction
*/ */
@NotAuditable
UserTransaction getUserTransaction(boolean readOnly); UserTransaction getUserTransaction(boolean readOnly);
/** /**
@@ -64,6 +69,7 @@ public interface TransactionService
* *
* @return Returns a non-propagating user transaction * @return Returns a non-propagating user transaction
*/ */
@NotAuditable
UserTransaction getNonPropagatingUserTransaction(); UserTransaction getNonPropagatingUserTransaction();
/** /**
@@ -78,5 +84,6 @@ public interface TransactionService
* system is in read-only mode. * system is in read-only mode.
* @return Returns a non-gating user transaction * @return Returns a non-gating user transaction
*/ */
@NotAuditable
UserTransaction getNonPropagatingUserTransaction(boolean readOnly); UserTransaction getNonPropagatingUserTransaction(boolean readOnly);
} }