First cut of audit annotations on public services, updated audit schema and first cut of default audit settings

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@3312 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Andrew Hind
2006-07-12 16:59:19 +00:00
parent 9025ad537a
commit 868966c11a
33 changed files with 655 additions and 62 deletions

View File

@@ -17,6 +17,7 @@
package org.alfresco.service.cmr.repository;
import org.alfresco.repo.content.transform.ContentTransformer;
import org.alfresco.service.Auditable;
import org.alfresco.service.cmr.dictionary.InvalidTypeException;
import org.alfresco.service.namespace.QName;
@@ -59,6 +60,7 @@ public interface ContentService
*
* @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)
throws InvalidNodeRefException, InvalidTypeException;
@@ -80,6 +82,7 @@ public interface ContentService
* @throws InvalidNodeRefException if the node doesn't exist
* @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)
throws InvalidNodeRefException, InvalidTypeException;
@@ -89,6 +92,7 @@ public interface ContentService
*
* @return Returns a writer onto a temporary location
*/
@Auditable
public ContentWriter getTempWriter();
/**
@@ -105,6 +109,7 @@ public interface ContentService
* given source and target mimetypes of the reader and writer
* @throws ContentIOException if the transformation fails
*/
@Auditable(parameters = {"reader", "writer"})
public void transform(ContentReader reader, ContentWriter writer)
throws NoTransformerException, ContentIOException;
@@ -118,6 +123,7 @@ public interface ContentService
*
* @see ContentAccessor#getMimetype()
*/
@Auditable(parameters = {"sourceMimetype", "targetMimetype"})
public ContentTransformer getTransformer(String sourceMimetype, String targetMimetype);
/**
@@ -133,5 +139,6 @@ public interface ContentService
*
* @return true if a transformer exists, false otherwise
*/
@Auditable(parameters = {"reader", "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 org.alfresco.service.Auditable;
import org.alfresco.service.namespace.QName;
/**
@@ -38,7 +39,7 @@ public interface CopyService
* <p>
* If the new node resides in the same workspace then
* the new node will have the Copy aspect applied to it which will
* reference the origional node.
* reference the original node.
* <p>
* 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
@@ -48,7 +49,7 @@ public interface CopyService
* <p>
* Child associations are copied onto the destination node. If the child of
* 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.
* <p>
* 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
*/
@Auditable(key = Auditable.Key.ARG_0, parameters = {"sourceNodeRef", "destinationParent", "destinationAssocTypeQName", "destinationQName", "copyChildren"})
public NodeRef copy(
NodeRef sourceNodeRef,
NodeRef destinationParent,
@@ -84,6 +86,7 @@ public interface CopyService
* parent to the new node
* @return the new node reference
*/
@Auditable(key = Auditable.Key.ARG_0, parameters = {"sourceNodeRef", "destinationParent", "destinationAssocTypeQName", "destinationQName"})
public NodeRef copy(
NodeRef sourceNodeRef,
NodeRef destinationParent,
@@ -98,7 +101,7 @@ public interface CopyService
* that of the source node.
* <p>
* 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.
* <p>
* Child associations and target associations are updated on the destination
@@ -109,7 +112,7 @@ public interface CopyService
* updated to the destination node.
* <p>
* 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
* aspect properties will take on the values already assigned to them in the
* destination node.
@@ -117,13 +120,15 @@ public interface CopyService
* @param sourceNodeRef the source node reference
* @param destinationNodeRef the destination node reference
*/
@Auditable(key = Auditable.Key.ARG_0, parameters = {"sourceNodeRef", "destinationNodeRef"})
public void copy(NodeRef sourceNodeRef, NodeRef destinationNodeRef);
/**
* 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
*/
@Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef"})
public List<NodeRef> getCopies(NodeRef nodeRef);
}

View File

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

View File

@@ -21,6 +21,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import org.alfresco.service.Auditable;
import org.alfresco.service.cmr.dictionary.InvalidAspectException;
import org.alfresco.service.cmr.dictionary.InvalidTypeException;
import org.alfresco.service.namespace.QName;
@@ -38,6 +39,7 @@ public interface NodeService
*
* @return Returns a list of store references
*/
@Auditable
public List<StoreRef> getStores();
/**
@@ -50,18 +52,21 @@ public interface NodeService
* @return Returns a reference to the store
* @throws StoreExistsException
*/
@Auditable(parameters = {"protocol", "identifier"})
public StoreRef createStore(String protocol, String identifier) throws StoreExistsException;
/**
* @param storeRef a reference to the store to look for
* @return Returns true if the store exists, otherwise false
*/
@Auditable(parameters = {"storeRef"})
public boolean exists(StoreRef storeRef);
/**
* @param nodeRef a reference to the node to look for
* @return Returns true if the node exists, otherwise false
*/
@Auditable(key = Auditable.Key.ARG_0 ,parameters = {"nodeRef"})
public boolean exists(NodeRef nodeRef);
/**
@@ -72,6 +77,7 @@ public interface NodeService
* @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
*/
@Auditable(key = Auditable.Key.ARG_0 ,parameters = {"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
* @throws InvalidStoreRefException if the store could not be found
*/
@Auditable(key = Auditable.Key.ARG_0 ,parameters = {"storeRef"})
public NodeRef getRootNode(StoreRef storeRef) throws InvalidStoreRefException;
/**
* @see #createNode(NodeRef, QName, QName, QName, Map)
*/
@Auditable(key = Auditable.Key.ARG_0 ,parameters = {"parentRef", "assocTypeQName", "assocQName", "nodeTypeQName"})
public ChildAssociationRef createNode(
NodeRef parentRef,
QName assocTypeQName,
@@ -106,6 +114,7 @@ public interface NodeService
*
* @see org.alfresco.service.cmr.dictionary.DictionaryService
*/
@Auditable(key = Auditable.Key.ARG_0 ,parameters = {"parentRef", "assocTypeQName", "assocQName", "nodeTypeQName", "properties"})
public ChildAssociationRef createNode(
NodeRef parentRef,
QName assocTypeQName,
@@ -135,6 +144,7 @@ public interface NodeService
*
* @see #getPrimaryParent(NodeRef)
*/
@Auditable(key = Auditable.Key.ARG_0 ,parameters = {"nodeToMoveRef", "newParentRef", "assocTypeQName", "assocQName"})
public ChildAssociationRef moveNode(
NodeRef nodeToMoveRef,
NodeRef newParentRef,
@@ -148,12 +158,13 @@ public interface NodeService
* associations.
*
* @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, QNamePattern, QNamePattern)
* @see ChildAssociationRef#getNthSibling()
*/
@Auditable(key = Auditable.Key.ARG_0 ,parameters = {"childAssocRef", "index"})
public void setChildAssociationIndex(
ChildAssociationRef childAssocRef,
int index)
@@ -166,6 +177,7 @@ public interface NodeService
*
* @see org.alfresco.service.cmr.dictionary.DictionaryService
*/
@Auditable(key = Auditable.Key.ARG_0 ,parameters = {"nodeRef"})
public QName getType(NodeRef nodeRef) throws InvalidNodeRefException;
/**
@@ -180,6 +192,7 @@ public interface NodeService
*
* @since 1.1
*/
@Auditable(key = Auditable.Key.ARG_0 ,parameters = {"nodeRef", "typeQName"})
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.ClassDefinition#getProperties()
*/
@Auditable(key = Auditable.Key.ARG_0 ,parameters = {"nodeRef", "aspectTypeQName", "aspectProperties"})
public void addAspect(
NodeRef nodeRef,
QName aspectTypeQName,
@@ -211,6 +225,7 @@ public interface NodeService
* @throws InvalidAspectException if the the aspect is unknown or if the
* 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)
throws InvalidNodeRefException, InvalidAspectException;
@@ -219,13 +234,14 @@ public interface NodeService
* removed if they are <b>NOT</b> mandatory.
*
* @param nodeRef
* @param aspectRef
* @param aspectTypeQName
* @return Returns true if the aspect has been applied to the given node,
* otherwise false
* @throws InvalidNodeRefException if the node could not be found
* @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;
/**
@@ -234,6 +250,7 @@ public interface NodeService
* aspects
* @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;
/**
@@ -246,6 +263,7 @@ public interface NodeService
* @param nodeRef reference to a node within a store
* @throws InvalidNodeRefException if the reference given is invalid
*/
@Auditable(key = Auditable.Key.ARG_0 ,parameters = {"nodeRef"})
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 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(
NodeRef parentRef,
NodeRef childRef,
@@ -278,6 +297,7 @@ public interface NodeService
* @return Returns a collection of deleted entities - both associations and node references.
* @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;
/**
@@ -285,6 +305,7 @@ public interface NodeService
* @return Returns all properties keyed by their qualified name
* @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;
/**
@@ -293,6 +314,7 @@ public interface NodeService
* @return Returns the value of the property, or null if not yet set
* @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;
/**
@@ -306,6 +328,7 @@ public interface NodeService
* @param properties all the properties of the node keyed by their qualified names
* @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;
/**
@@ -320,6 +343,7 @@ public interface NodeService
* @param propertyValue the value of the property - never null
* @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;
/**
@@ -330,6 +354,7 @@ public interface NodeService
*
* @see #getParentAssocs(NodeRef, QNamePattern, QNamePattern)
*/
@Auditable(key = Auditable.Key.ARG_0 ,parameters = {"nodeRef"})
public List<ChildAssociationRef> getParentAssocs(NodeRef nodeRef) throws InvalidNodeRefException;
/**
@@ -350,6 +375,7 @@ public interface NodeService
* @see QName
* @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)
throws InvalidNodeRefException;
@@ -367,6 +393,7 @@ public interface NodeService
* @see #setChildAssociationIndex(ChildAssociationRef, int)
* @see ChildAssociationRef#getNthSibling()
*/
@Auditable(key = Auditable.Key.ARG_0 ,parameters = {"nodeRef"})
public List<ChildAssociationRef> getChildAssocs(NodeRef nodeRef) throws InvalidNodeRefException;
/**
@@ -383,6 +410,7 @@ public interface NodeService
* @see QName
* @see org.alfresco.service.namespace.RegexQNamePattern#MATCH_ALL
*/
@Auditable(key = Auditable.Key.ARG_0 ,parameters = {"nodeRef", "typeQNamePattern", "qnamePattern"})
public List<ChildAssociationRef> getChildAssocs(
NodeRef nodeRef,
QNamePattern typeQNamePattern,
@@ -398,6 +426,7 @@ public interface NodeService
* @return Returns the primary parent-child association of the node
* @throws InvalidNodeRefException if the node could not be found
*/
@Auditable(key = Auditable.Key.ARG_0 ,parameters = {"nodeRef"})
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 AssociationExistsException
*/
@Auditable(key = Auditable.Key.ARG_0 ,parameters = {"sourceRef", "targetRef", "assocTypeQName"})
public AssociationRef createAssociation(NodeRef sourceRef, NodeRef targetRef, QName assocTypeQName)
throws InvalidNodeRefException, AssociationExistsException;
@@ -419,6 +449,7 @@ public interface NodeService
* @param assocTypeQName the qualified name of the association type
* @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)
throws InvalidNodeRefException;
@@ -435,6 +466,7 @@ public interface NodeService
* @see QName
* @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)
throws InvalidNodeRefException;
@@ -451,6 +483,7 @@ public interface NodeService
* @see QName
* @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)
throws InvalidNodeRefException;
@@ -465,6 +498,7 @@ public interface NodeService
*
* @see #getPaths(NodeRef, boolean)
*/
@Auditable(key = Auditable.Key.ARG_0 ,parameters = {"nodeRef"})
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
* @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;
/**
@@ -486,6 +521,7 @@ public interface NodeService
* @param storeRef the store that items were deleted from
* @return Returns the archive node parent
*/
@Auditable(key = Auditable.Key.ARG_0 ,parameters = {"storeRef"})
public NodeRef getStoreArchiveNode(StoreRef storeRef);
/**
@@ -502,6 +538,7 @@ public interface NodeService
* or <tt>null</tt> to use the original
* @return Returns the reference to the newly created node
*/
@Auditable(key = Auditable.Key.ARG_0 ,parameters = {"archivedNodeRef", "destinationParentNodeRef", "assocTypeQName", "assocQName"})
public NodeRef restoreNode(
NodeRef archivedNodeRef,
NodeRef destinationParentNodeRef,

View File

@@ -16,9 +16,9 @@
*/
package org.alfresco.service.cmr.repository;
import java.io.Writer;
import java.util.Map;
import org.alfresco.service.Auditable;
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.
* <p>
* 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
*/
@@ -48,6 +48,7 @@ public interface ScriptService
*
* @throws ScriptException
*/
@Auditable(parameters = {"scriptClasspath", "model"})
public Object executeScript(String scriptClasspath, Map<String, Object> model)
throws ScriptException;
@@ -63,6 +64,7 @@ public interface ScriptService
*
* @throws ScriptException
*/
@Auditable(key = Auditable.Key.ARG_0, parameters = {"scriptRef", "contentProp", "model"})
public Object executeScript(NodeRef scriptRef, QName contentProp, Map<String, Object> model)
throws ScriptException;
@@ -76,6 +78,7 @@ public interface ScriptService
*
* @throws ScriptException
*/
@Auditable(parameters = {"script", "model"})
public Object executeScriptString(String script, Map<String, Object> model)
throws ScriptException;
}

View File

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