diff --git a/config/alfresco/auditConfig.xml b/config/alfresco/auditConfig.xml new file mode 100644 index 0000000000..b3408ecb3d --- /dev/null +++ b/config/alfresco/auditConfig.xml @@ -0,0 +1,181 @@ + + + + + + + + + + + + + + + false + false + false + false + false + false + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/config/alfresco/auditSchema.xsd b/config/alfresco/auditSchema.xsd new file mode 100644 index 0000000000..e76db97b11 --- /dev/null +++ b/config/alfresco/auditSchema.xsd @@ -0,0 +1,204 @@ + + + + + Schema to define audit configuration. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/source/java/org/alfresco/repo/jscript/Node.java b/source/java/org/alfresco/repo/jscript/Node.java index 2b36dedd14..8fe97a8c2b 100644 --- a/source/java/org/alfresco/repo/jscript/Node.java +++ b/source/java/org/alfresco/repo/jscript/Node.java @@ -47,6 +47,7 @@ import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeService; import org.alfresco.service.cmr.repository.TemplateImageResolver; 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.QName; import org.alfresco.service.namespace.RegexQNamePattern; @@ -488,6 +489,66 @@ public final class Node implements Serializable 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 */ diff --git a/source/java/org/alfresco/repo/jscript/RhinoScriptService.java b/source/java/org/alfresco/repo/jscript/RhinoScriptService.java index 96f880aafa..3dbe2ba130 100644 --- a/source/java/org/alfresco/repo/jscript/RhinoScriptService.java +++ b/source/java/org/alfresco/repo/jscript/RhinoScriptService.java @@ -35,6 +35,7 @@ import org.alfresco.service.cmr.repository.ScriptException; import org.alfresco.service.cmr.repository.ScriptService; import org.alfresco.service.cmr.repository.TemplateImageResolver; import org.alfresco.service.namespace.QName; +import org.apache.log4j.Logger; import org.mozilla.javascript.Context; import org.mozilla.javascript.ImporterTopLevel; import org.mozilla.javascript.Scriptable; @@ -47,6 +48,8 @@ import org.mozilla.javascript.ScriptableObject; */ public class RhinoScriptService implements ScriptService { + private static final Logger logger = Logger.getLogger(RhinoScriptService.class); + /** The permission-safe node service */ private NodeService nodeService; @@ -191,7 +194,13 @@ public class RhinoScriptService implements ScriptService */ private Object executeScriptImpl(Reader reader, Map model) throws AlfrescoRuntimeException - { + { + long startTime = 0; + if (logger.isDebugEnabled()) + { + startTime = System.currentTimeMillis(); + } + // check that rhino script engine is available Context cx = Context.enter(); try @@ -226,6 +235,12 @@ public class RhinoScriptService implements ScriptService finally { cx.exit(); + + if (logger.isDebugEnabled()) + { + long endTime = System.currentTimeMillis(); + logger.debug("Time to execute script: " + (endTime - startTime) + "ms"); + } } } diff --git a/source/java/org/alfresco/repo/rule/RuleServiceImpl.java b/source/java/org/alfresco/repo/rule/RuleServiceImpl.java index 0ea76b39ec..4cda7352ec 100644 --- a/source/java/org/alfresco/repo/rule/RuleServiceImpl.java +++ b/source/java/org/alfresco/repo/rule/RuleServiceImpl.java @@ -67,7 +67,8 @@ public class RuleServiceImpl implements RuleService, RuntimeRuleService private static final String KEY_RULES_EXECUTED = "RuleServiceImpl.ExecutedRules"; /** 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 @@ -325,7 +326,7 @@ public class RuleServiceImpl implements RuleService, RuntimeRuleService // Get the rules for this node List 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) { // Create the rule and add to the list @@ -366,7 +367,7 @@ public class RuleServiceImpl implements RuleService, RuntimeRuleService { // Get the rules for this node List 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(); } @@ -531,7 +532,7 @@ public class RuleServiceImpl implements RuleService, RuntimeRuleService private Rule createRule(NodeRef owningNodeRef, NodeRef ruleNodeRef) { // Get the rule properties - Map props = this.nodeService.getProperties(ruleNodeRef); + Map props = this.runtimeNodeService.getProperties(ruleNodeRef); // Create the rule String ruleTypeName = (String)props.get(RuleModel.PROP_RULE_TYPE); @@ -590,7 +591,7 @@ public class RuleServiceImpl implements RuleService, RuntimeRuleService ruleNodeRef = this.nodeService.createNode( getSavedRuleFolderRef(nodeRef), ContentModel.ASSOC_CONTAINS, - ASSOC_NAME_RULES, + QName.createQName(RuleModel.RULE_MODEL_URI, ASSOC_NAME_RULES_PREFIX + GUID.generate()), RuleModel.TYPE_RULE, props).getChildRef(); @@ -643,7 +644,7 @@ public class RuleServiceImpl implements RuleService, RuntimeRuleService { List ruleChildAssocs = this.nodeService.getChildAssocs( folder, - RegexQNamePattern.MATCH_ALL, ASSOC_NAME_RULES); + RegexQNamePattern.MATCH_ALL, ASSOC_NAME_RULES_REGEX); for (ChildAssociationRef ruleChildAssoc : ruleChildAssocs) { this.nodeService.removeChild(folder, ruleChildAssoc.getChildRef()); @@ -666,30 +667,25 @@ public class RuleServiceImpl implements RuleService, RuntimeRuleService this.disabledRules.contains(rule) == false) { PendingRuleData pendingRuleData = new PendingRuleData(actionableNodeRef, actionedUponNodeRef, rule, executeAtEnd); - Set executedRules = - (Set) AlfrescoTransactionSupport.getResource(KEY_RULES_EXECUTED); - - if (executedRules == null || executedRules.contains(new ExecutedRuleData(actionableNodeRef, rule)) == false) - { - Set pendingRules = - (Set) AlfrescoTransactionSupport.getResource(KEY_RULES_PENDING); - if (pendingRules == null) - { - // bind pending rules to the current transaction - pendingRules = new HashSet(); - AlfrescoTransactionSupport.bindResource(KEY_RULES_PENDING, pendingRules); - // bind the rule transaction listener - AlfrescoTransactionSupport.bindListener(this.ruleTransactionListener); - - 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); - } + + Set pendingRules = + (Set) AlfrescoTransactionSupport.getResource(KEY_RULES_PENDING); + if (pendingRules == null) + { + // bind pending rules to the current transaction + pendingRules = new HashSet(); + AlfrescoTransactionSupport.bindResource(KEY_RULES_PENDING, pendingRules); + // bind the rule transaction listener + AlfrescoTransactionSupport.bindListener(this.ruleTransactionListener); + + 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); } else { @@ -699,12 +695,18 @@ public class RuleServiceImpl implements RuleService, RuntimeRuleService } } } - + + + /** * @see org.alfresco.repo.rule.RuleService#executePendingRules() */ public void executePendingRules() { + if (logger.isDebugEnabled() == true) + { + logger.debug("Creating the executed rules list"); + } AlfrescoTransactionSupport.bindResource(KEY_RULES_EXECUTED, new HashSet()); try { @@ -718,6 +720,10 @@ public class RuleServiceImpl implements RuleService, RuntimeRuleService finally { 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") private void executePendingRule(PendingRuleData pendingRule) { - NodeRef actionableNodeRef = pendingRule.getActionableNodeRef(); + Set executedRules = + (Set) AlfrescoTransactionSupport.getResource(KEY_RULES_EXECUTED); + NodeRef actionedUponNodeRef = pendingRule.getActionedUponNodeRef(); Rule rule = pendingRule.getRule(); - - // Evaluate the condition - if (this.actionService.evaluateAction(rule, actionedUponNodeRef) == true) - { - // Add the rule to the executed rule list - // (do this before this is executed to prevent rules being added to the pending list) - Set executedRules = - (Set) AlfrescoTransactionSupport.getResource(KEY_RULES_EXECUTED); - executedRules.add(new ExecutedRuleData(actionableNodeRef, rule)); - - // Execute the rule - this.actionService.executeAction(rule, actionedUponNodeRef); - } + + if (executedRules == null || canExecuteRule(executedRules, actionedUponNodeRef, rule) == true) + { + // Evaluate the condition + if (this.actionService.evaluateAction(rule, actionedUponNodeRef) == true) + { + // Add the rule to the executed rule list + // (do this before this is executed to prevent rules being added to the pending list) + executedRules.add(new ExecutedRuleData(actionedUponNodeRef, rule)); + if (logger.isDebugEnabled() == true) + { + 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 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 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; } /** diff --git a/source/java/org/alfresco/repo/search/impl/lucene/FilterIndexReaderByNodeRefs2.java b/source/java/org/alfresco/repo/search/impl/lucene/FilterIndexReaderByNodeRefs2.java index d19e58a239..a04dec7aed 100644 --- a/source/java/org/alfresco/repo/search/impl/lucene/FilterIndexReaderByNodeRefs2.java +++ b/source/java/org/alfresco/repo/search/impl/lucene/FilterIndexReaderByNodeRefs2.java @@ -22,16 +22,15 @@ import java.util.Set; import org.alfresco.error.AlfrescoRuntimeException; import org.alfresco.service.cmr.repository.NodeRef; +import org.apache.lucene.document.Document; import org.apache.lucene.index.FilterIndexReader; import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.Term; import org.apache.lucene.index.TermDocs; import org.apache.lucene.index.TermEnum; import org.apache.lucene.index.TermPositions; -import org.apache.lucene.search.BooleanQuery; import org.apache.lucene.search.Hits; import org.apache.lucene.search.IndexSearcher; -import org.apache.lucene.search.MultiSearcher; import org.apache.lucene.search.Searcher; import org.apache.lucene.search.TermQuery; @@ -63,19 +62,23 @@ public class FilterIndexReaderByNodeRefs2 extends FilterIndexReader Searcher searcher = new IndexSearcher(reader); for (NodeRef nodeRef : deletions) { - BooleanQuery query = new BooleanQuery(); - query.add(new TermQuery(new Term("ID", nodeRef.toString())), true, false); - query.add(new TermQuery(new Term("ISNODE", "T")), false, false); + TermQuery query = new TermQuery(new Term("ID", nodeRef.toString())); Hits hits = searcher.search(query); if (hits.length() > 0) { 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) diff --git a/source/java/org/alfresco/repo/search/impl/lucene/index/IndexInfo.java b/source/java/org/alfresco/repo/search/impl/lucene/index/IndexInfo.java index 148621084d..07ef674ddd 100644 --- a/source/java/org/alfresco/repo/search/impl/lucene/index/IndexInfo.java +++ b/source/java/org/alfresco/repo/search/impl/lucene/index/IndexInfo.java @@ -47,7 +47,6 @@ import java.util.zip.CRC32; import org.alfresco.error.AlfrescoRuntimeException; 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.service.cmr.repository.NodeRef; 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.MultiReader; import org.apache.lucene.index.Term; -import org.apache.lucene.search.BooleanQuery; import org.apache.lucene.search.Hits; import org.apache.lucene.search.IndexSearcher; import org.apache.lucene.search.Searcher; import org.apache.lucene.search.TermQuery; 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; /** @@ -205,6 +206,11 @@ public class IndexInfo private static HashMap indexInfos = new HashMap(); + static + { + System.setProperty("disableLuceneLocks", "true"); + } + public static synchronized IndexInfo getIndexInfo(File file) { IndexInfo indexInfo = indexInfos.get(file); @@ -249,7 +255,6 @@ public class IndexInfo // a spanking new index version = 0; - } // Open the files and channels @@ -364,7 +369,7 @@ public class IndexInfo } for (String id : deletable) { - IndexEntry entry = indexEntries.remove(id); + indexEntries.remove(id); deleteQueue.add(id); } synchronized (cleaner) @@ -2008,7 +2013,6 @@ public class IndexInfo } } // Check it is not deleting - boolean foundDelta; for (IndexEntry entry : indexEntries.values()) { if (entry.getType() == IndexType.DELTA) @@ -2095,16 +2099,20 @@ public class IndexInfo { Searcher searcher = new IndexSearcher(reader); - BooleanQuery query = new BooleanQuery(); - query.add(new TermQuery(new Term("ID", nodeRef.toString())), true, false); - query.add(new TermQuery(new Term("ISNODE", "T")), false, false); + TermQuery query = new TermQuery(new Term("ID", nodeRef.toString())); Hits hits = searcher.search(query); if (hits.length() > 0) { for (int i = 0; i < hits.length(); i++) { - reader.delete(hits.id(i)); - invalidIndexes.add(key); + Document doc = hits.doc(i); + if (doc.getField("ISCONTAINER") == null) + { + reader.delete(hits.id(i)); + invalidIndexes.add(key); + // There should only be one thing to delete + // break; + } } } searcher.close(); @@ -2332,7 +2340,10 @@ public class IndexInfo { int count = 0; IndexReader[] readers = new IndexReader[toMerge.size() - 1]; + RAMDirectory ramDirectory = null; IndexWriter writer = null; + long docCount = 0; + File outputLocation = null; for (IndexEntry entry : toMerge.values()) { File location = new File(indexDirectory, entry.getName()); @@ -2348,10 +2359,20 @@ public class IndexInfo reader = IndexReader.open(emptyIndex); } readers[count++] = reader; + docCount += entry.getDocumentCount(); } 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.minMergeDocs = 1000; writer.mergeFactor = 5; @@ -2360,6 +2381,30 @@ public class IndexInfo } writer.addIndexes(readers); 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) { reader.close(); diff --git a/source/java/org/alfresco/repo/template/FreeMarkerProcessor.java b/source/java/org/alfresco/repo/template/FreeMarkerProcessor.java index b3ea0f06c6..d311575cc9 100644 --- a/source/java/org/alfresco/repo/template/FreeMarkerProcessor.java +++ b/source/java/org/alfresco/repo/template/FreeMarkerProcessor.java @@ -23,7 +23,6 @@ import org.alfresco.service.cmr.repository.ContentService; import org.alfresco.service.cmr.repository.NodeService; import org.alfresco.service.cmr.repository.TemplateException; import org.alfresco.service.cmr.repository.TemplateProcessor; -import org.alfresco.util.ISO9075; import org.apache.log4j.Logger; 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_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 */ 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() { @@ -100,26 +104,30 @@ public class FreeMarkerProcessor implements TemplateProcessor 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) { + Configuration config = new Configuration(); - Configuration config = new Configuration(); - - // setup template cache - config.setCacheStorage(new MruCacheStorage(20, 0)); - - // use our custom loader to find templates on the ClassPath - StringTemplateLoader stringTemplateLoader = new StringTemplateLoader(); - stringTemplateLoader.putTemplate(path, template); - config.setTemplateLoader(stringTemplateLoader); - - // use our custom object wrapper that can deal with QNameMap objects directly - config.setObjectWrapper(new QNameAwareObjectWrapper()); - - // rethrow any exception so we can deal with them - config.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER); - - return config; + // use our custom loader to load a template directly from a String + StringTemplateLoader stringTemplateLoader = new StringTemplateLoader(); + stringTemplateLoader.putTemplate(path, template); + config.setTemplateLoader(stringTemplateLoader); + + // use our custom object wrapper that can deal with QNameMap objects directly + config.setObjectWrapper(new QNameAwareObjectWrapper()); + + // 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 { + long startTime = 0; 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); if (t != null) @@ -162,6 +174,12 @@ public class FreeMarkerProcessor implements TemplateProcessor { 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) { @@ -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) { if (template == null || template.length() == 0) @@ -188,8 +207,12 @@ public class FreeMarkerProcessor implements TemplateProcessor try { + long startTime = 0; 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); if (t != null) @@ -198,6 +221,12 @@ public class FreeMarkerProcessor implements TemplateProcessor { // perform the template processing against supplied data model t.process(model, out); + + if (logger.isDebugEnabled()) + { + long endTime = System.currentTimeMillis(); + logger.debug("Time to execute template: " + (endTime - startTime) + "ms"); + } } catch (Throwable err) { diff --git a/source/java/org/alfresco/repo/template/TemplateServiceImpl.java b/source/java/org/alfresco/repo/template/TemplateServiceImpl.java index 7ef9eefe5b..17294f2679 100644 --- a/source/java/org/alfresco/repo/template/TemplateServiceImpl.java +++ b/source/java/org/alfresco/repo/template/TemplateServiceImpl.java @@ -127,6 +127,9 @@ public class TemplateServiceImpl implements TemplateService, ApplicationContextA 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) 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) throws TemplateException { @@ -154,7 +160,6 @@ public class TemplateServiceImpl implements TemplateService, ApplicationContextA return out.toString(); } - /** * Return the TemplateProcessor implementation for the named template engine * @@ -169,7 +174,7 @@ public class TemplateServiceImpl implements TemplateService, ApplicationContextA Map procMap = processors.get(); if (procMap == null) { - procMap = new HashMap(7, 1.0f); + procMap = new HashMap(2, 1.0f); processors.set(procMap); } diff --git a/source/java/org/alfresco/service/AnnotationTest.java b/source/java/org/alfresco/service/AnnotationTest.java new file mode 100644 index 0000000000..7eb03e78a4 --- /dev/null +++ b/source/java/org/alfresco/service/AnnotationTest.java @@ -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"); + + } + +} diff --git a/source/java/org/alfresco/service/AnnotationTestInterface.java b/source/java/org/alfresco/service/AnnotationTestInterface.java new file mode 100644 index 0000000000..495e8c12bb --- /dev/null +++ b/source/java/org/alfresco/service/AnnotationTestInterface.java @@ -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); +} diff --git a/source/java/org/alfresco/service/Auditable.java b/source/java/org/alfresco/service/Auditable.java new file mode 100644 index 0000000000..bb7eb3f890 --- /dev/null +++ b/source/java/org/alfresco/service/Auditable.java @@ -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; +} diff --git a/source/java/org/alfresco/service/NotAuditable.java b/source/java/org/alfresco/service/NotAuditable.java new file mode 100644 index 0000000000..54369f2829 --- /dev/null +++ b/source/java/org/alfresco/service/NotAuditable.java @@ -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 +{ + +} diff --git a/source/java/org/alfresco/service/ServiceRegistry.java b/source/java/org/alfresco/service/ServiceRegistry.java index 1e8683848f..3d26bcbf29 100644 --- a/source/java/org/alfresco/service/ServiceRegistry.java +++ b/source/java/org/alfresco/service/ServiceRegistry.java @@ -87,6 +87,7 @@ public interface ServiceRegistry * * @return list of provided Services */ + @NotAuditable Collection getServices(); /** @@ -95,6 +96,7 @@ public interface ServiceRegistry * @param service name of service to test provision of * @return true => provided, false => not provided */ + @NotAuditable boolean isServiceProvided(QName service); /** @@ -103,6 +105,7 @@ public interface ServiceRegistry * @param service name of service to retrieve meta data for * @return the service meta data */ + @NotAuditable ServiceDescriptor getServiceDescriptor(QName service); /** @@ -110,121 +113,145 @@ public interface ServiceRegistry * * @param service name of service to retrieve * @return the service interface (must cast to interface as described in service meta-data) - */ + */ + @NotAuditable Object getService(QName service); /** * @return the descriptor service */ + @NotAuditable DescriptorService getDescriptorService(); /** * @return the transaction service */ + @NotAuditable TransactionService getTransactionService(); /** * @return the namespace service (or null, if one is not provided) */ + @NotAuditable NamespaceService getNamespaceService(); /** * @return the authentication service (or null, if one is not provided) */ + @NotAuditable AuthenticationService getAuthenticationService(); /** * @return the node service (or null, if one is not provided) */ + @NotAuditable NodeService getNodeService(); /** * @return the content service (or null, if one is not provided) */ + @NotAuditable ContentService getContentService(); /** * @return the mimetype service (or null, if one is not provided) */ + @NotAuditable MimetypeService getMimetypeService(); /** * @return the search service (or null, if one is not provided) */ + @NotAuditable SearchService getSearchService(); /** * @return the version service (or null, if one is not provided) */ + @NotAuditable VersionService getVersionService(); /** * @return the lock service (or null, if one is not provided) */ + @NotAuditable LockService getLockService(); /** * @return the dictionary service (or null, if one is not provided) */ + @NotAuditable DictionaryService getDictionaryService(); /** * @return the copy service (or null, if one is not provided) */ + @NotAuditable CopyService getCopyService(); /** * @return the checkout / checkin service (or null, if one is not provided) */ + @NotAuditable CheckOutCheckInService getCheckOutCheckInService(); /** * @return the category service (or null, if one is not provided) */ + @NotAuditable CategoryService getCategoryService(); /** * @return the importer service or null if not present */ + @NotAuditable ImporterService getImporterService(); /** * @return the exporter service or null if not present */ + @NotAuditable ExporterService getExporterService(); /** * @return the rule service (or null, if one is not provided) */ + @NotAuditable RuleService getRuleService(); /** * @return the action service (or null if one is not provided) */ + @NotAuditable ActionService getActionService(); /** * @return the permission service (or null if one is not provided) */ + @NotAuditable PermissionService getPermissionService(); /** * @return the authority service (or null if one is not provided) */ + @NotAuditable AuthorityService getAuthorityService(); /** * @return the template service (or null if one is not provided) */ + @NotAuditable TemplateService getTemplateService(); /** * @return the file-folder manipulation service (or null if one is not provided) */ + @NotAuditable FileFolderService getFileFolderService(); /** * @return the script execution service (or null if one is not provided) */ + @NotAuditable ScriptService getScriptService(); } diff --git a/source/java/org/alfresco/service/cmr/action/ActionService.java b/source/java/org/alfresco/service/cmr/action/ActionService.java index 10ef0b641b..cbfe96ccfd 100644 --- a/source/java/org/alfresco/service/cmr/action/ActionService.java +++ b/source/java/org/alfresco/service/cmr/action/ActionService.java @@ -20,6 +20,7 @@ import java.io.Serializable; import java.util.List; import java.util.Map; +import org.alfresco.service.Auditable; import org.alfresco.service.cmr.repository.NodeRef; /** @@ -35,6 +36,7 @@ public interface ActionService * @param name the name of the action definition * @return the action definition */ + @Auditable(parameters = {"name"}) ActionDefinition getActionDefinition(String name); /** @@ -42,6 +44,7 @@ public interface ActionService * * @return the list action definitions */ + @Auditable() List getActionDefinitions(); /** @@ -51,6 +54,7 @@ public interface ActionService * @param nodeRef the node reference * @return a list of applicable action definitions */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef"}) List getActionDefinitions(NodeRef nodeRef); /** @@ -59,6 +63,7 @@ public interface ActionService * @param name the name of the action condition definition * @return the action condition definition */ + @Auditable(parameters = {"name"}) ActionConditionDefinition getActionConditionDefinition(String name); /** @@ -66,6 +71,7 @@ public interface ActionService * * @return the list of aciton condition definitions */ + @Auditable(parameters = {}) List getActionConditionDefinitions(); /** @@ -74,15 +80,17 @@ public interface ActionService * @param name the action definition name * @return the action */ + @Auditable(parameters = {"name"}) Action createAction(String name); /** * 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 * @return the action */ + @Auditable(parameters = {"name", "params"}) Action createAction(String name, Map params); /** @@ -90,6 +98,7 @@ public interface ActionService * * @return the composite action */ + @Auditable() CompositeAction createCompositeAction(); /** @@ -98,15 +107,17 @@ public interface ActionService * @param name the action condition definition name * @return the action condition */ + @Auditable(parameters = {"name"}) ActionCondition createActionCondition(String name); /** * Create an action condition specifying the initial set of parameter values * - * @param name the aciton condition definition name - * @param params the parameter valeus + * @param name the action condition definition name + * @param params the parameter values * @return the action condition */ + @Auditable(parameters = {"name", "params"}) ActionCondition createActionCondition(String name, Map params); /** @@ -117,10 +128,11 @@ public interface ActionService * @param action the action * @param actionedUponNodeRef the actioned upon node reference */ + @Auditable(key = Auditable.Key.ARG_1, parameters = {"action", "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) * @@ -128,6 +140,7 @@ public interface ActionService * @param actionedUponNodeRef the actioned upon node reference * @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); /** @@ -149,6 +162,7 @@ public interface ActionService * @param executeAsynchronously indicates whether the action should be executed asychronously or not, this value overrides * 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); /** @@ -163,6 +177,7 @@ public interface ActionService * @param actionedUponNodeRef the actioned upon node reference * @return true if the condition succeeds, false otherwise */ + @Auditable(key = Auditable.Key.ARG_1, parameters = {"action", "actionedUponNodeRef" }) boolean evaluateAction(Action action, NodeRef actionedUponNodeRef); /** @@ -172,6 +187,7 @@ public interface ActionService * @param actionedUponNodeRef the actioned upon node reference * @return true if the condition succeeds, false otherwise */ + @Auditable(key = Auditable.Key.ARG_1, parameters = {"condition", "actionedUponNodeRef" }) boolean evaluateActionCondition(ActionCondition condition, NodeRef actionedUponNodeRef); /** @@ -184,14 +200,16 @@ public interface ActionService * @param nodeRef the node reference * @param action the action */ + @Auditable(key = Auditable.Key.ARG_1, parameters = {"nodeRef", "action" }) void saveAction(NodeRef nodeRef, Action action); /** * 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 */ + @Auditable(key = Auditable.Key.ARG_1, parameters = {"nodeRef"}) List getActions(NodeRef nodeRef); /** @@ -203,14 +221,16 @@ public interface ActionService * @param actionId the action id * @return the action */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef", "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 action the action */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef", "action" }) void removeAction(NodeRef nodeRef, Action action); /** @@ -218,6 +238,7 @@ public interface ActionService * * @param nodeRef the node reference */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef"}) void removeAllActions(NodeRef nodeRef); } diff --git a/source/java/org/alfresco/service/cmr/coci/CheckOutCheckInService.java b/source/java/org/alfresco/service/cmr/coci/CheckOutCheckInService.java index 5539eac729..64b58437fd 100644 --- a/source/java/org/alfresco/service/cmr/coci/CheckOutCheckInService.java +++ b/source/java/org/alfresco/service/cmr/coci/CheckOutCheckInService.java @@ -19,6 +19,7 @@ package org.alfresco.service.cmr.coci; import java.io.Serializable; import java.util.Map; +import org.alfresco.service.Auditable; import org.alfresco.service.cmr.repository.NodeRef; 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. *

- * 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. *

- * 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. *

* 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 * @return node reference to the created working copy */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef", "destinationParentNodeRef", "destinationAssocTypeQName", "destinationAssocQName"}) public NodeRef checkout( NodeRef nodeRef, NodeRef destinationParentNodeRef, @@ -68,38 +70,40 @@ public interface CheckOutCheckInService * @param nodeRef a reference to the node to checkout * @return a node reference to the created working copy */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef"}) public NodeRef checkout(NodeRef nodeRef); /** * Checks in the working node specified. *

- * When a working copy is checked in the current state of the working copy is copyied to the - * origional node. This will include any content updated in the working node. + * When a working copy is checked in the current state of the working copy is copied to the + * original node. This will include any content updated in the working node. *

- * 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. *

* 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. *

- * 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 - * 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. *

- * 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 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. * @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 - * copy content is copied back to the origional node. + * the checkin operation takes place. If null then the current working + * copy content is copied back to the original node. * @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 * 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 */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"workingCopyNodeRef", "versionProperties", "contentUrl", "keepCheckedOut"}) public NodeRef checkin( NodeRef workingCopyNodeRef, Map versionProperties, @@ -112,14 +116,15 @@ public interface CheckOutCheckInService * @see VersionOperationsService#checkin(NodeRef, HashMap, String, boolean) * * @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. * @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 - * copy content is copied back to the origional node. - * @return the node reference to the origional node, updated with the checked in + * the checkin operation takes place. If null then the current working + * copy content is copied back to the original node. + * @return the node reference to the original node, updated with the checked in * state */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"workingCopyNodeRef", "versionProperties", "contentUrl"}) public NodeRef checkin( NodeRef workingCopyNodeRef, Map versionProperties, @@ -132,11 +137,12 @@ public interface CheckOutCheckInService * @see VersionOperationsService#checkin(NodeRef, HashMap, String) * * @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. - * @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 */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"workingCopyNodeRef", "versionProperties"}) public NodeRef checkin( NodeRef workingCopyNodeRef, Map versionProperties); @@ -144,16 +150,17 @@ public interface CheckOutCheckInService /** * Cancels the checkout for a given working copy. *

- * 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. *

- * Note that all modification made to the working copy will be lost and the origional node - * will remiain unchanged. + * Note that all modification made to the working copy will be lost and the original node + * will remain unchanged. *

- * 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 - * @return the origional node reference + * @return the original node reference */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"workingCopyNodeRef"}) public NodeRef cancelCheckout(NodeRef workingCopyNodeRef); /** @@ -164,5 +171,6 @@ public interface CheckOutCheckInService * @param nodeRef a node reference * @return the working copy node reference or null if none. */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef"}) public NodeRef getWorkingCopy(NodeRef nodeRef); } diff --git a/source/java/org/alfresco/service/cmr/dictionary/DictionaryService.java b/source/java/org/alfresco/service/cmr/dictionary/DictionaryService.java index 5ad1b5fdda..b939d3c72f 100644 --- a/source/java/org/alfresco/service/cmr/dictionary/DictionaryService.java +++ b/source/java/org/alfresco/service/cmr/dictionary/DictionaryService.java @@ -18,6 +18,7 @@ package org.alfresco.service.cmr.dictionary; import java.util.Collection; +import org.alfresco.service.NotAuditable; 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 */ + @NotAuditable public Collection getAllModels(); /** * @param model the model name to retrieve * @return the specified model (or null, if it doesn't exist) */ + @NotAuditable public ModelDefinition getModel(QName model); /** * @return the names of all data types that have been registered with the Repository */ + @NotAuditable Collection getAllDataTypes(); /** * @param model the model to retrieve data types for * @return the names of all data types defined within the specified model */ + @NotAuditable Collection getDataTypes(QName model); /** * @param name the name of the data type to retrieve * @return the data type definition (or null, if it doesn't exist) */ + @NotAuditable DataTypeDefinition getDataType(QName name); /** * @param javaClass java class to find datatype for * @return the data type definition (or null, if a mapping does not exist) */ + @NotAuditable DataTypeDefinition getDataType(Class javaClass); /** * @return the names of all types that have been registered with the Repository */ + @NotAuditable Collection getAllTypes(); /** * @param model the model to retrieve types for * @return the names of all types defined within the specified model */ + @NotAuditable Collection getTypes(QName model); /** * @param name the name of the type to retrieve * @return the type definition (or null, if it doesn't exist) */ + @NotAuditable TypeDefinition getType(QName name); /** @@ -96,29 +106,34 @@ public interface DictionaryService * @param aspects the aspects to combine with the type * @return the anonymous type definition */ + @NotAuditable TypeDefinition getAnonymousType(QName type, Collection aspects); /** * @return the names of all aspects that have been registered with the Repository */ + @NotAuditable Collection getAllAspects(); /** * @param model the model to retrieve aspects for * @return the names of all aspects defined within the specified model */ + @NotAuditable Collection getAspects(QName model); /** * @param name the name of the aspect to retrieve * @return the aspect definition (or null, if it doesn't exist) */ + @NotAuditable AspectDefinition getAspect(QName name); /** * @param name the name of the class (type or aspect) to retrieve * @return the class definition (or null, if it doesn't exist) */ + @NotAuditable ClassDefinition getClass(QName name); /** @@ -128,6 +143,7 @@ public interface DictionaryService * @param ofClassName the class to test against * @return true => the class is a sub-class (or itself) */ + @NotAuditable boolean isSubClass(QName className, QName ofClassName); /** @@ -140,6 +156,7 @@ public interface DictionaryService * @param propertyName the property name * @return the property definition (or null, if it doesn't exist) */ + @NotAuditable PropertyDefinition getProperty(QName className, QName propertyName); /** @@ -148,6 +165,7 @@ public interface DictionaryService * @param propertyName the property name * @return the property definition (or null, if it doesn't exist) */ + @NotAuditable PropertyDefinition getProperty(QName propertyName); /** @@ -156,6 +174,7 @@ public interface DictionaryService * @param associationName the property name * @return the association definition (or null, if it doesn't exist) */ + @NotAuditable AssociationDefinition getAssociation(QName associationName); // TODO: Behaviour definitions diff --git a/source/java/org/alfresco/service/cmr/lock/LockService.java b/source/java/org/alfresco/service/cmr/lock/LockService.java index 59c4aa47f7..7687e2b072 100644 --- a/source/java/org/alfresco/service/cmr/lock/LockService.java +++ b/source/java/org/alfresco/service/cmr/lock/LockService.java @@ -19,6 +19,7 @@ package org.alfresco.service.cmr.lock; import java.util.Collection; import java.util.List; +import org.alfresco.service.Auditable; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.StoreRef; @@ -46,6 +47,7 @@ public interface LockService * @throws UnableToAquireLockException * thrown if the lock could not be obtained */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef", "lockType"}) public void lock(NodeRef nodeRef, LockType lockType) throws UnableToAquireLockException; @@ -71,6 +73,7 @@ public interface LockService * @throws UnableToAquireLockException * 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) throws UnableToAquireLockException; @@ -102,6 +105,7 @@ public interface LockService * @throws UnableToAquireLockException * 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) throws UnableToAquireLockException; @@ -129,6 +133,7 @@ public interface LockService * @throws UnableToAquireLockException * thrown if the lock could not be obtained */ + @Auditable(parameters = {"nodeRefs", "lockType", "timeToExpire"}) public void lock(Collection nodeRefs, LockType lockType, int timeToExpire) throws UnableToAquireLockException; @@ -143,6 +148,7 @@ public interface LockService * @throws UnableToReleaseLockException * thrown if the lock could not be released */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef"}) public void unlock(NodeRef nodeRef) throws UnableToReleaseLockException; @@ -166,6 +172,7 @@ public interface LockService * @throws UnableToReleaseLockException * thrown if the lock could not be released */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef", "lockChildren"}) public void unlock(NodeRef nodeRef, boolean lockChildren) throws UnableToReleaseLockException; @@ -187,6 +194,7 @@ public interface LockService * @throws UnableToReleaseLockException * thrown if the lock could not be released */ + @Auditable(parameters = {"nodeRefs"}) public void unlock(Collection nodeRefs) throws UnableToReleaseLockException; @@ -198,6 +206,7 @@ public interface LockService * @param nodeRef the node reference * @return the lock status */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"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 * lock */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef"}) public LockType getLockType(NodeRef nodeRef); /** @@ -222,6 +232,7 @@ public interface LockService * * @param nodeRef the node reference */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef"}) public void checkForLock(NodeRef nodeRef); /** @@ -230,6 +241,7 @@ public interface LockService * @param storeRef the store reference * @return a list of nodes that the current user has locked. */ + @Auditable(key = Auditable.Key.ARG_0,parameters = {"storeRef"}) public List 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 */ + @Auditable(key = Auditable.Key.ARG_0,parameters = {"storeRef", "lockType"}) public List getLocks(StoreRef storeRef, LockType lockType); } diff --git a/source/java/org/alfresco/service/cmr/model/FileFolderService.java b/source/java/org/alfresco/service/cmr/model/FileFolderService.java index 9b828dcc4a..259e756622 100644 --- a/source/java/org/alfresco/service/cmr/model/FileFolderService.java +++ b/source/java/org/alfresco/service/cmr/model/FileFolderService.java @@ -18,6 +18,7 @@ package org.alfresco.service.cmr.model; import java.util.List; +import org.alfresco.service.Auditable; import org.alfresco.service.cmr.repository.ContentReader; import org.alfresco.service.cmr.repository.ContentWriter; import org.alfresco.service.cmr.repository.NodeRef; @@ -39,6 +40,7 @@ public interface FileFolderService * @param contextNodeRef the node to start searching in * @return Returns a list of matching files and folders */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"contextNodeRef"}) public List list(NodeRef contextNodeRef); /** @@ -47,6 +49,7 @@ public interface FileFolderService * @param folderNodeRef the folder to start searching in * @return Returns a list of matching files */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"folderNodeRef"}) public List listFiles(NodeRef folderNodeRef); /** @@ -55,6 +58,7 @@ public interface FileFolderService * @param contextNodeRef the node to start searching in * @return Returns a list of matching folders */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"contextNodeRef"}) public List listFolders(NodeRef contextNodeRef); /** @@ -71,6 +75,7 @@ public interface FileFolderService * * @see #search(NodeRef, String, boolean, boolean, boolean) */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"contextNodeRef", "namePattern", "includeSubFolders"}) public List search( NodeRef contextNodeRef, String namePattern, @@ -90,6 +95,7 @@ public interface FileFolderService * @param includeSubFolders true to search the entire hierarchy below the search context * @return Returns a list of file or folder matches */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"contextNodeRef", "namePattern", "fileSearch", "folderSearch", "includeSubFolders"}) public List search( NodeRef contextNodeRef, String namePattern, @@ -106,6 +112,7 @@ public interface FileFolderService * @throws FileExistsException if a file or folder with the new name already exists * @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; /** @@ -120,6 +127,7 @@ public interface FileFolderService * @throws FileExistsException * @throws FileNotFoundException */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"sourceNodeRef", "targetParentRef", "newName"}) public FileInfo move(NodeRef sourceNodeRef, NodeRef targetParentRef, String newName) throws FileExistsException, FileNotFoundException; @@ -136,6 +144,7 @@ public interface FileFolderService * @throws FileExistsException * @throws FileNotFoundException */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"sourceNodeRef", "targetParentRef", "newName"}) public FileInfo copy(NodeRef sourceNodeRef, NodeRef targetParentRef, String newName) throws FileExistsException, FileNotFoundException; @@ -149,6 +158,7 @@ public interface FileFolderService * @return Returns the new node's file information * @throws FileExistsException */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"parentNodeRef", "name", "typeQName"}) public FileInfo create(NodeRef parentNodeRef, String name, QName typeQName) throws FileExistsException; /** @@ -156,6 +166,7 @@ public interface FileFolderService * * @param nodeRef the node to delete */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef"}) public void delete(NodeRef nodeRef); /** @@ -170,15 +181,16 @@ public interface FileFolderService * {@link org.alfresco.model.ContentModel#TYPE_FOLDER they folder type}. * @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 pathElements, QName folderTypeQName); /** * Get the file or folder names from the root down to and including the node provided. *

    *
  • The root node can be of any type and is not included in the path list.
  • - *
  • Only the primary path is considered. If the target node is not a descendent of the + *
  • 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.
  • - *
  • If an invalid type is encoutered along the path, then an exception is generated.
  • + *
  • If an invalid type is encountered along the path, then an exception is generated.
  • *
* * @param rootNodeRef the start of the returned path, or null if the store root @@ -188,6 +200,7 @@ public interface FileFolderService * including the destination file or folder * @throws FileNotFoundException if the node could not be found */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"rootNodeRef", "nodeRef"}) public List getNamePath(NodeRef rootNodeRef, NodeRef nodeRef) throws FileNotFoundException; /** @@ -198,6 +211,7 @@ public interface FileFolderService * @return Returns the info of the file or folder * @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 pathElements) throws FileNotFoundException; /** @@ -206,9 +220,26 @@ public interface FileFolderService * @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 */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"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); + /** + * 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); } diff --git a/source/java/org/alfresco/service/cmr/repository/ContentService.java b/source/java/org/alfresco/service/cmr/repository/ContentService.java index f6fe72bf91..cbca110d5e 100644 --- a/source/java/org/alfresco/service/cmr/repository/ContentService.java +++ b/source/java/org/alfresco/service/cmr/repository/ContentService.java @@ -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 content */ + @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); } diff --git a/source/java/org/alfresco/service/cmr/repository/CopyService.java b/source/java/org/alfresco/service/cmr/repository/CopyService.java index cbc50da65e..62e365d10f 100644 --- a/source/java/org/alfresco/service/cmr/repository/CopyService.java +++ b/source/java/org/alfresco/service/cmr/repository/CopyService.java @@ -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 *

* 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. *

* 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 *

* 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. *

* 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. *

* 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. *

* Child associations and target associations are updated on the destination @@ -109,7 +112,7 @@ public interface CopyService * updated to the destination node. *

* 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 getCopies(NodeRef nodeRef); } diff --git a/source/java/org/alfresco/service/cmr/repository/MimetypeService.java b/source/java/org/alfresco/service/cmr/repository/MimetypeService.java index bb9e90b506..6475373993 100644 --- a/source/java/org/alfresco/service/cmr/repository/MimetypeService.java +++ b/source/java/org/alfresco/service/cmr/repository/MimetypeService.java @@ -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 getDisplaysByExtension(); /** @@ -51,6 +54,7 @@ public interface MimetypeService * * @return the map of displays indexed by mimetype */ + @NotAuditable public Map getDisplaysByMimetype(); /** @@ -58,6 +62,7 @@ public interface MimetypeService * * @return the map of extension indexed by mimetype */ + @NotAuditable public Map getExtensionsByMimetype(); /** @@ -65,6 +70,7 @@ public interface MimetypeService * * @return the map of mimetypes indexed by extension */ + @NotAuditable public Map getMimetypesByExtension(); /** @@ -72,6 +78,7 @@ public interface MimetypeService * * @return all mimetypes */ + @NotAuditable public List 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); } diff --git a/source/java/org/alfresco/service/cmr/repository/NodeService.java b/source/java/org/alfresco/service/cmr/repository/NodeService.java index db10928a2b..88e178ed64 100644 --- a/source/java/org/alfresco/service/cmr/repository/NodeService.java +++ b/source/java/org/alfresco/service/cmr/repository/NodeService.java @@ -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 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 class of the node */ + @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 NOT 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 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 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 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 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 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 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 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 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 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 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 null 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, diff --git a/source/java/org/alfresco/service/cmr/repository/ScriptService.java b/source/java/org/alfresco/service/cmr/repository/ScriptService.java index 87598ca931..3c6b9dcc88 100644 --- a/source/java/org/alfresco/service/cmr/repository/ScriptService.java +++ b/source/java/org/alfresco/service/cmr/repository/ScriptService.java @@ -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. *

* 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 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 model) throws ScriptException; @@ -76,6 +78,7 @@ public interface ScriptService * * @throws ScriptException */ + @Auditable(parameters = {"script", "model"}) public Object executeScriptString(String script, Map model) throws ScriptException; } diff --git a/source/java/org/alfresco/service/cmr/repository/TemplateService.java b/source/java/org/alfresco/service/cmr/repository/TemplateService.java index ff278cd529..5ba59bba24 100644 --- a/source/java/org/alfresco/service/cmr/repository/TemplateService.java +++ b/source/java/org/alfresco/service/cmr/repository/TemplateService.java @@ -18,6 +18,8 @@ package org.alfresco.service.cmr.repository; import java.io.Writer; +import org.alfresco.service.Auditable; + /** * Template Service. *

@@ -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); } diff --git a/source/java/org/alfresco/service/cmr/rule/RuleService.java b/source/java/org/alfresco/service/cmr/rule/RuleService.java index 06fe3a9adc..6117440b98 100644 --- a/source/java/org/alfresco/service/cmr/rule/RuleService.java +++ b/source/java/org/alfresco/service/cmr/rule/RuleService.java @@ -18,6 +18,7 @@ package org.alfresco.service.cmr.rule; import java.util.List; +import org.alfresco.service.Auditable; import org.alfresco.service.cmr.repository.NodeRef; /** @@ -32,6 +33,7 @@ public interface RuleService * * @return a list of rule types */ + @Auditable public List getRuleTypes(); /** @@ -40,6 +42,7 @@ public interface RuleService * @param name the name of the rule type * @return the rule type, null if not found */ + @Auditable(parameters = {"name"}) public RuleType getRuleType(String name); /** @@ -49,6 +52,7 @@ public interface RuleService * @param nodeRef the node reference * @return true if the rules are enabled, false otherwise */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef"}) public boolean rulesEnabled(NodeRef nodeRef); /** @@ -57,6 +61,7 @@ public interface RuleService * * @param nodeRef the node reference */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef"}) public void disableRules(NodeRef nodeRef); /** @@ -65,6 +70,7 @@ public interface RuleService * * @param nodeRef the node reference */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef"}) public void enableRules(NodeRef nodeRef); /** @@ -72,6 +78,7 @@ public interface RuleService * * @param rule the rule to disable */ + @Auditable(parameters = {"rule"}) public void disableRule(Rule rule); /** @@ -79,6 +86,7 @@ public interface RuleService * * @param rule the rule to enable */ + @Auditable(parameters = {"rule"}) public void enableRule(Rule rule); /** @@ -87,6 +95,7 @@ public interface RuleService * @param nodeRef the node reference * @return true if the node has rules associated, false otherwise */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef"}) public boolean hasRules(NodeRef nodeRef); /** @@ -99,6 +108,7 @@ public interface RuleService * @param nodeRef the node reference * @return a list of the rules associated with the node */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef"}) public List getRules(NodeRef nodeRef); /** @@ -114,6 +124,7 @@ public interface RuleService * the result list or not * @return a list of the rules associated with the node */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef", "includeInhertied"}) public List getRules(NodeRef nodeRef, boolean includeInhertied); /** @@ -126,6 +137,7 @@ public interface RuleService * are returned * @return a list of the rules associated with the node */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef", "includeInhertiedRuleType", "ruleTypeName"}) public List getRules(NodeRef nodeRef, boolean includeInhertiedRuleType, String ruleTypeName); /** @@ -134,6 +146,7 @@ public interface RuleService * @param nodeRef the node reference * @return a list of the rules associated with the node */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef"}) public int countRules(NodeRef nodeRef); /** @@ -143,6 +156,7 @@ public interface RuleService * @param ruleId the rule id * @return the rule corresponding ot the id */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef", "ruleId"}) public Rule getRule(NodeRef nodeRef, String ruleId); /** @@ -154,6 +168,7 @@ public interface RuleService * @param ruleTypeName the name of the rule type * @return the created rule */ + @Auditable(parameters = {"ruleTypeName"}) public Rule createRule(String ruleTypeName); /** @@ -165,6 +180,7 @@ public interface RuleService * @param nodeRef * @param rule */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef", "rule"}) public void saveRule(NodeRef nodeRef, Rule rule); /** @@ -172,6 +188,7 @@ public interface RuleService * * @param nodeRef the actionable node reference */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef", "rule"}) public void removeRule(NodeRef nodeRef, Rule rule); /** @@ -179,5 +196,6 @@ public interface RuleService * * @param nodeRef the actionable node reference */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef"}) public void removeAllRules(NodeRef nodeRef); } diff --git a/source/java/org/alfresco/service/cmr/search/CategoryService.java b/source/java/org/alfresco/service/cmr/search/CategoryService.java index d77978b4da..7651b93f19 100644 --- a/source/java/org/alfresco/service/cmr/search/CategoryService.java +++ b/source/java/org/alfresco/service/cmr/search/CategoryService.java @@ -18,6 +18,7 @@ package org.alfresco.service.cmr.search; import java.util.Collection; +import org.alfresco.service.Auditable; import org.alfresco.service.cmr.repository.ChildAssociationRef; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.StoreRef; @@ -63,6 +64,7 @@ public interface CategoryService * @param depth - the enumeration depth for what level to recover * @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 getChildren(NodeRef categoryRef, Mode mode, Depth depth ); /** @@ -73,6 +75,7 @@ public interface CategoryService * @param depth - the enumeration depth for what level to recover * @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 getCategories(StoreRef storeRef, QName aspectQName, Depth depth ); /** @@ -80,6 +83,7 @@ public interface CategoryService * * @return */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"storeRef"}) public Collection getClassifications(StoreRef storeRef); /** @@ -89,6 +93,7 @@ public interface CategoryService * @param aspectName * @return */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"storeRef", "aspectName"}) public Collection getRootCategories(StoreRef storeRef, QName aspectName); /** @@ -96,6 +101,7 @@ public interface CategoryService * * @return */ + @Auditable public Collection getClassificationAspects(); /** @@ -107,6 +113,7 @@ public interface CategoryService * @param aspectName * @param attributeName */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"storeRef", "aspectName", "attributeName"}) public NodeRef createClassifiction(StoreRef storeRef, QName aspectName, String attributeName); /** @@ -117,6 +124,7 @@ public interface CategoryService * @param name * @return */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"storeRef", "aspectName", "name"}) public NodeRef createRootCategory(StoreRef storeRef, QName aspectName, String name); /** @@ -126,6 +134,7 @@ public interface CategoryService * @param name * @return */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"parent", "name"}) public NodeRef createCategory(NodeRef parent, String name); /** @@ -134,6 +143,7 @@ public interface CategoryService * @param storeRef * @param aspectName */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"storeRef", "aspectName"}) public void deleteClassification(StoreRef storeRef, QName aspectName); /** @@ -141,5 +151,6 @@ public interface CategoryService * * @param nodeRef */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef"}) public void deleteCategory(NodeRef nodeRef); } diff --git a/source/java/org/alfresco/service/cmr/search/SearchService.java b/source/java/org/alfresco/service/cmr/search/SearchService.java index 231265fee2..9f5a90998e 100644 --- a/source/java/org/alfresco/service/cmr/search/SearchService.java +++ b/source/java/org/alfresco/service/cmr/search/SearchService.java @@ -19,6 +19,7 @@ package org.alfresco.service.cmr.search; import java.io.Serializable; import java.util.List; +import org.alfresco.service.Auditable; import org.alfresco.service.cmr.repository.InvalidNodeRefException; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.Path; @@ -62,6 +63,7 @@ public interface SearchService * the value. * @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, QueryParameterDefinition[] queryParameterDefinitions); @@ -77,6 +79,7 @@ public interface SearchService * the query string - which may include parameters * @return Returns the query results */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"store", "language", "query"}) public ResultSet query(StoreRef store, String language, String query); /** @@ -93,6 +96,7 @@ public interface SearchService * the value. * @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, QueryParameterDefinition[] queryParameterDefintions); @@ -110,6 +114,7 @@ public interface SearchService * selected nodes in xpath style syntax * @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); /** @@ -123,12 +128,14 @@ public interface SearchService * parameterisation for the canned query * @return Returns the query results */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"store", "queryId", "queryParameters"}) public ResultSet query(StoreRef store, QName queryId, QueryParameter[] queryParameters); /** * Search using the given SearchParameters */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"searchParameters"}) public ResultSet query(SearchParameters searchParameters); /** @@ -147,6 +154,7 @@ public interface SearchService * it follows all * @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 selectNodes(NodeRef contextNodeRef, String xpath, QueryParameterDefinition[] parameters, NamespacePrefixResolver namespacePrefixResolver, boolean followAllParentLinks) throws InvalidNodeRefException, XPathException; @@ -169,6 +177,7 @@ public interface SearchService * the xpath variant * @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 selectNodes(NodeRef contextNodeRef, String xpath, QueryParameterDefinition[] parameters, NamespacePrefixResolver namespacePrefixResolver, boolean followAllParentLinks, String language) throws InvalidNodeRefException, XPathException; @@ -189,6 +198,7 @@ public interface SearchService * it follows all * @return a list of property values */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"contextNodeRef", "xpath", "parameters", "namespacePrefixResolver", "followAllParentLinks"}) public List selectProperties(NodeRef contextNodeRef, String xpath, QueryParameterDefinition[] parameters, NamespacePrefixResolver namespacePrefixResolver, boolean followAllParentLinks) throws InvalidNodeRefException, XPathException; @@ -211,6 +221,7 @@ public interface SearchService * the xpath variant * @return a list of property values */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"contextNodeRef", "xpath", "parameters", "namespacePrefixResolver", "followAllParentLinks", "language"}) public List selectProperties(NodeRef contextNodeRef, String xpath, QueryParameterDefinition[] parameters, NamespacePrefixResolver namespacePrefixResolver, 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 * @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) throws InvalidNodeRefException; @@ -242,6 +254,7 @@ public interface SearchService * a Google-like pattern to search for in the property value * @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) throws InvalidNodeRefException; @@ -259,6 +272,7 @@ public interface SearchService * include full text search matches in the like test * @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) throws InvalidNodeRefException; } diff --git a/source/java/org/alfresco/service/cmr/security/AuthenticationService.java b/source/java/org/alfresco/service/cmr/security/AuthenticationService.java index 2cd7811e4c..65420fe4bb 100644 --- a/source/java/org/alfresco/service/cmr/security/AuthenticationService.java +++ b/source/java/org/alfresco/service/cmr/security/AuthenticationService.java @@ -19,6 +19,7 @@ package org.alfresco.service.cmr.security; import java.util.Set; import org.alfresco.repo.security.authentication.AuthenticationException; +import org.alfresco.service.Auditable; /** * The authentication service defines the API for managing authentication information @@ -36,6 +37,7 @@ public interface AuthenticationService * @param password * @throws AuthenticationException */ + @Auditable(parameters = {"userName", "password"}, recordable = {true, false}) public void createAuthentication(String userName, char[] password) throws AuthenticationException; /** @@ -46,6 +48,7 @@ public interface AuthenticationService * @param newPassword * @throws AuthenticationException */ + @Auditable(parameters = {"userName", "oldPassword", "newPassword"}, recordable = {true, false, false}) public void updateAuthentication(String userName, char[] oldPassword, char[] newPassword) throws AuthenticationException; /** @@ -55,6 +58,7 @@ public interface AuthenticationService * @param newPassword * @throws AuthenticationException */ + @Auditable(parameters = {"userName", "newPassword"}, recordable = {true, false}) public void setAuthentication(String userName, char[] newPassword) throws AuthenticationException; @@ -64,6 +68,7 @@ public interface AuthenticationService * @param userName * @throws AuthenticationException */ + @Auditable(parameters = {"userName"}) public void deleteAuthentication(String userName) throws AuthenticationException; /** @@ -72,6 +77,7 @@ public interface AuthenticationService * @param userName * @param enabled */ + @Auditable(parameters = {"userName", "enabled"}) public void setAuthenticationEnabled(String userName, boolean enabled) throws AuthenticationException; /** @@ -80,6 +86,7 @@ public interface AuthenticationService * @param userName * @return */ + @Auditable(parameters = {"userName"}) public boolean getAuthenticationEnabled(String userName) throws AuthenticationException; /** @@ -90,6 +97,7 @@ public interface AuthenticationService * @param password the passowrd * @throws AuthenticationException */ + @Auditable(parameters = {"userName", "password"}, recordable = {true, false}) public void authenticate(String userName, char[] password) throws AuthenticationException; /** @@ -97,6 +105,7 @@ public interface AuthenticationService * * @throws AuthenticationException */ + @Auditable public void authenticateAsGuest() throws AuthenticationException; /** @@ -105,6 +114,7 @@ public interface AuthenticationService * @param userName the username * @return Returns true if the authentication exists */ + @Auditable(parameters = {"userName"}) public boolean authenticationExists(String userName); /** @@ -113,6 +123,7 @@ public interface AuthenticationService * @return * @throws AuthenticationException */ + @Auditable public String getCurrentUserName() throws AuthenticationException; /** @@ -121,6 +132,7 @@ public interface AuthenticationService * @param userName * @throws AuthenticationException */ + @Auditable(parameters = {"userName"}) public void invalidateUserSession(String userName) throws AuthenticationException; /** @@ -129,6 +141,7 @@ public interface AuthenticationService * @param ticket * @throws AuthenticationException */ + @Auditable(parameters = {"ticket"}, recordable = {false}) public void invalidateTicket(String ticket) throws AuthenticationException; /** @@ -137,18 +150,21 @@ public interface AuthenticationService * @param ticket * @throws AuthenticationException */ + @Auditable(parameters = {"ticket"}, recordable = {false}) public void validate(String ticket) throws AuthenticationException; /** * Get the current ticket as a string * @return */ + @Auditable public String getCurrentTicket(); /** * Remove the current security information * */ + @Auditable public void clearCurrentSecurityContext(); /** @@ -156,7 +172,7 @@ public interface AuthenticationService * * @return */ - + @Auditable public boolean isCurrentUserTheSystemUser(); /** @@ -164,7 +180,7 @@ public interface AuthenticationService * * @return The domain name */ - + @Auditable public Set getDomains(); /** @@ -172,6 +188,7 @@ public interface AuthenticationService * * @return */ + @Auditable public Set getDomainsThatAllowUserCreation(); /** @@ -179,6 +196,7 @@ public interface AuthenticationService * * @return */ + @Auditable public Set getDomainsThatAllowUserDeletion(); /** @@ -186,6 +204,7 @@ public interface AuthenticationService * * @return */ + @Auditable public Set getDomiansThatAllowUserPasswordChanges(); } diff --git a/source/java/org/alfresco/service/cmr/security/AuthorityService.java b/source/java/org/alfresco/service/cmr/security/AuthorityService.java index 14b6d28572..0febd7b08d 100644 --- a/source/java/org/alfresco/service/cmr/security/AuthorityService.java +++ b/source/java/org/alfresco/service/cmr/security/AuthorityService.java @@ -18,6 +18,8 @@ package org.alfresco.service.cmr.security; import java.util.Set; +import org.alfresco.service.Auditable; + /** * 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 */ + @Auditable public boolean hasAdminAuthority(); /** @@ -50,6 +53,7 @@ public interface AuthorityService * * @return */ + @Auditable public Set getAuthorities(); /** @@ -59,6 +63,7 @@ public interface AuthorityService * the type of authorities. * @return */ + @Auditable(parameters = {"type"}) public Set getAllAuthorities(AuthorityType type); /** @@ -69,7 +74,7 @@ public interface AuthorityService * the type of the authority * @return */ - + @Auditable(parameters = {"type"}) public Set getAllRootAuthorities(AuthorityType type); /** @@ -87,6 +92,7 @@ public interface AuthorityService * @return the name of the authority (this will be the prefix, if any * associated with the type appended with the short name) */ + @Auditable(parameters = {"type", "parentName", "shortName"}) public String createAuthority(AuthorityType type, String parentName, String shortName); /** @@ -98,6 +104,7 @@ public interface AuthorityService * @param childName - * the string identifier for the child. */ + @Auditable(parameters = {"parentName", "childName"}) public void addAuthority(String parentName, String childName); /** @@ -111,6 +118,7 @@ public interface AuthorityService * @param childName - * the string identifier for the child. */ + @Auditable(parameters = {"parentName", "childName"}) public void removeAuthority(String parentName, String childName); /** @@ -118,6 +126,7 @@ public interface AuthorityService * * @param name */ + @Auditable(parameters = {"name"}) public void deleteAuthority(String name); /** @@ -135,6 +144,7 @@ public interface AuthorityService * find authorities at any depth * @return */ + @Auditable(parameters = {"type", "name", "immediate"}) public Set getContainedAuthorities(AuthorityType type, String name, boolean immediate); /** @@ -152,6 +162,7 @@ public interface AuthorityService * limit to immediate parents or any ancestor. * @return */ + @Auditable(parameters = {"type", "name", "immediate"}) public Set getContainingAuthorities(AuthorityType type, String name, boolean immediate); /** @@ -160,6 +171,7 @@ public interface AuthorityService * @param name * @return */ + @Auditable(parameters = {"name"}) public String getShortName(String name); /** @@ -170,6 +182,7 @@ public interface AuthorityService * @param shortName * @return */ + @Auditable(parameters = {"type", "shortName"}) public String getName(AuthorityType type, String shortName); /** @@ -178,6 +191,7 @@ public interface AuthorityService * @param name (the long name). * @return */ + @Auditable(parameters = {"name"}) public boolean authorityExists(String name); } diff --git a/source/java/org/alfresco/service/cmr/security/OwnableService.java b/source/java/org/alfresco/service/cmr/security/OwnableService.java index d0f7af05aa..1c77740e86 100644 --- a/source/java/org/alfresco/service/cmr/security/OwnableService.java +++ b/source/java/org/alfresco/service/cmr/security/OwnableService.java @@ -16,6 +16,7 @@ */ package org.alfresco.service.cmr.security; +import org.alfresco.service.Auditable; import org.alfresco.service.cmr.repository.NodeRef; /** @@ -31,6 +32,7 @@ public interface OwnableService * @param nodeRef * @return the username or null if the object has no owner */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef"}) public String getOwner(NodeRef nodeRef); /** @@ -39,6 +41,7 @@ public interface OwnableService * @param nodeRef * @param userName */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef", "userName"}) public void setOwner(NodeRef nodeRef, String userName); /** @@ -46,6 +49,7 @@ public interface OwnableService * * @param nodeRef */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef"}) public void takeOwnership(NodeRef nodeRef); /** @@ -54,5 +58,6 @@ public interface OwnableService * @param nodeRef * @return */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef"}) public boolean hasOwner(NodeRef nodeRef); } diff --git a/source/java/org/alfresco/service/cmr/security/PermissionService.java b/source/java/org/alfresco/service/cmr/security/PermissionService.java index f0a02441e0..ea772ca324 100644 --- a/source/java/org/alfresco/service/cmr/security/PermissionService.java +++ b/source/java/org/alfresco/service/cmr/security/PermissionService.java @@ -18,6 +18,7 @@ package org.alfresco.service.cmr.security; import java.util.Set; +import org.alfresco.service.Auditable; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.namespace.QName; @@ -119,6 +120,7 @@ public interface PermissionService * * @return the owner authority */ + @Auditable public String getOwnerAuthority(); /** @@ -126,6 +128,7 @@ public interface PermissionService * * @return the All authorities */ + @Auditable public String getAllAuthorities(); /** @@ -133,6 +136,7 @@ public interface PermissionService * * @return the All permission */ + @Auditable public String getAllPermission(); /** @@ -143,6 +147,7 @@ public interface PermissionService * the reference to the node * @return the set of allowed permissions */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef"}) public Set getPermissions(NodeRef nodeRef); /** @@ -153,6 +158,7 @@ public interface PermissionService * the reference to the node * @return the set of allowed permissions */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef"}) public Set getAllSetPermissions(NodeRef nodeRef); /** @@ -161,6 +167,7 @@ public interface PermissionService * @param nodeRef * @return */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef"}) public Set getSettablePermissions(NodeRef nodeRef); /** @@ -169,6 +176,7 @@ public interface PermissionService * @param nodeRef * @return */ + @Auditable(parameters = {"type"}) public Set getSettablePermissions(QName type); /** @@ -176,16 +184,18 @@ public interface PermissionService * given node. (The default behaviour is to inherit permissions) * * @param nodeRef - * @param perm + * @param permission * @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 * * @param nodeRef */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef"}) public void deletePermissions(NodeRef nodeRef); /** @@ -194,6 +204,7 @@ public interface PermissionService * @param nodeRef * @param authority */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef", "authority"}) public void clearPermission(NodeRef nodeRef, String authority); /** @@ -203,6 +214,7 @@ public interface PermissionService * @param authority the authority recipient * @param permission the entry permission */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef", "authority", "permission"}) public void deletePermission(NodeRef nodeRef, String authority, String permission); /** @@ -210,10 +222,11 @@ public interface PermissionService * * @param nodeRef * @param authority - * @param perm + * @param permission * @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. @@ -221,6 +234,7 @@ public interface PermissionService * @param nodeRef * @param inheritParentPermissions */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef", "inheritParentPermissions"}) public void setInheritParentPermissions(NodeRef nodeRef, boolean inheritParentPermissions); /** @@ -229,5 +243,6 @@ public interface PermissionService * @param nodeRef * @return inheritParentPermissions */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef"}) public boolean getInheritParentPermissions(NodeRef nodeRef); } diff --git a/source/java/org/alfresco/service/cmr/security/PersonService.java b/source/java/org/alfresco/service/cmr/security/PersonService.java index b41d39623d..0274a5414a 100644 --- a/source/java/org/alfresco/service/cmr/security/PersonService.java +++ b/source/java/org/alfresco/service/cmr/security/PersonService.java @@ -20,6 +20,7 @@ import java.io.Serializable; import java.util.Map; import java.util.Set; +import org.alfresco.service.Auditable; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.namespace.QName; @@ -49,6 +50,7 @@ public interface PersonService * @see #setCreateMissingPeople(boolean) * @see #createMissingPeople() */ + @Auditable(parameters = {"userName"}) public NodeRef getPerson(String userName); /** @@ -57,6 +59,7 @@ public interface PersonService * @param userName the user name * @return Returns true if the user exists, otherwise false */ + @Auditable(parameters = {"userName"}) public boolean personExists(String userName); /** @@ -65,6 +68,7 @@ public interface PersonService * * @return true if people are created on demand and false otherwise. */ + @Auditable public boolean createMissingPeople(); /** @@ -74,6 +78,7 @@ public interface PersonService * * @see #getPerson(String) */ + @Auditable(parameters = {"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 */ + @Auditable public Set getMutableProperties(); /** @@ -93,6 +99,7 @@ public interface PersonService * @param userName - the user for which the properties should be set. * @param properties - the map of properties to set (as the NodeService) */ + @Auditable(parameters = {"userName", "properties"}) public void setPersonProperties(String userName, Map properties); /** @@ -100,6 +107,7 @@ public interface PersonService * * @return true if this service allows mutation to people. */ + @Auditable public boolean isMutable(); /** @@ -110,6 +118,7 @@ public interface PersonService * @param properties * @return */ + @Auditable(parameters = {"properties"}) public NodeRef createPerson(Map properties); /** @@ -117,6 +126,7 @@ public interface PersonService * * @param userName */ + @Auditable(parameters = {"userName"}) public void deletePerson(String userName); /** @@ -124,6 +134,7 @@ public interface PersonService * * @return a set of people in no specific order. */ + @Auditable public Set getAllPeople(); /** @@ -131,6 +142,7 @@ public interface PersonService * * @return */ + @Auditable public NodeRef getPeopleContainer(); /** @@ -138,5 +150,6 @@ public interface PersonService * * @return */ + @Auditable public boolean getUserNamesAreCaseSensitive(); } diff --git a/source/java/org/alfresco/service/cmr/version/VersionService.java b/source/java/org/alfresco/service/cmr/version/VersionService.java index c0b6481e40..07baf95e42 100644 --- a/source/java/org/alfresco/service/cmr/version/VersionService.java +++ b/source/java/org/alfresco/service/cmr/version/VersionService.java @@ -20,6 +20,7 @@ import java.io.Serializable; import java.util.Collection; import java.util.Map; +import org.alfresco.service.Auditable; import org.alfresco.service.cmr.repository.AspectMissingException; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.StoreRef; @@ -42,6 +43,7 @@ public interface VersionService * * @return reference to the version store */ + @Auditable public StoreRef getVersionStoreReference(); /** @@ -53,7 +55,7 @@ public interface VersionService * If the node referenced does not or can not have the version aspect * applied to it then an exception will be raised. *

- * 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. * * @param nodeRef a node reference @@ -66,6 +68,7 @@ public interface VersionService * @throws AspectMissingException * thrown if the version aspect is missing */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef", "versionProperties"}) public Version createVersion( NodeRef nodeRef, Map versionProperties) @@ -80,7 +83,7 @@ public interface VersionService * If the node referenced does not or can not have the version aspect * applied to it then an exception will be raised. *

- * 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. * * @param nodeRef a node reference @@ -95,6 +98,7 @@ public interface VersionService * @throws AspectMissingException * thrown if the version aspect is missing */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef", "versionProperties", "versionChildren"}) public Collection createVersion( NodeRef nodeRef, Map versionProperties, @@ -113,6 +117,7 @@ public interface VersionService * @throws AspectMissingException * thrown if the version aspect is missing */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef", "versionProperties"}) public Collection createVersion( Collection nodeRefs, Map versionProperties) @@ -131,6 +136,7 @@ public interface VersionService * @throws AspectMissingException * thrown if the version aspect is missing */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef"}) public VersionHistory getVersionHistory(NodeRef nodeRef) throws AspectMissingException; @@ -142,6 +148,7 @@ public interface VersionService * @param nodeRef the node reference * @return the version object for the current version */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef"}) public Version getCurrentVersion(NodeRef nodeRef); /** @@ -153,6 +160,7 @@ public interface VersionService * * @param nodeRef the node reference */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef"}) public void revert(NodeRef nodeRef); /** @@ -163,6 +171,7 @@ public interface VersionService * @param nodeRef the node reference * @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); /** @@ -173,6 +182,7 @@ public interface VersionService * @param nodeRef the node reference * @param version the version to revert to */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef", "version"}) public void revert(NodeRef nodeRef, Version version); /** @@ -194,6 +204,7 @@ public interface VersionService * @param version the version to revert to * @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); /** @@ -207,6 +218,7 @@ public interface VersionService * @param assocQName the assoc qname * @return the newly restored node reference */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef", "parentNodeRef", "assocTypeQName", "assocQName"}) public NodeRef restore( NodeRef nodeRef, NodeRef parentNodeRef, @@ -214,12 +226,12 @@ public interface VersionService 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. *

* The restored node will be at the head (most resent version). *

- * 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. *

* 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 * 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 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 * @return the newly restored node reference */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef", "parentNodeRef", "assocTypeQName", "assocQName", "deep"}) public NodeRef restore( NodeRef nodeRef, NodeRef parentNodeRef, @@ -247,7 +260,7 @@ public interface VersionService /** * Delete the version history associated with a node reference. *

- * 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. *

* 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 * @throws AspectMissingException thrown if the version aspect is missing */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"nodeRef"}) public void deleteVersionHistory(NodeRef nodeRef) throws AspectMissingException; } diff --git a/source/java/org/alfresco/service/cmr/view/ExporterService.java b/source/java/org/alfresco/service/cmr/view/ExporterService.java index 0bb2b64d7c..9c91198d75 100644 --- a/source/java/org/alfresco/service/cmr/view/ExporterService.java +++ b/source/java/org/alfresco/service/cmr/view/ExporterService.java @@ -18,6 +18,8 @@ package org.alfresco.service.cmr.view; import java.io.OutputStream; +import org.alfresco.service.Auditable; + /** * Exporter Service @@ -36,6 +38,7 @@ public interface ExporterService * @param parameters export parameters * @param progress exporter callback for tracking progress of export */ + @Auditable(parameters = {"viewWriter", "parameters", "progress"}) public void exportView(OutputStream viewWriter, ExporterCrawlerParameters parameters, Exporter progress) throws ExporterException; @@ -48,6 +51,7 @@ public interface ExporterService * @param parameters export parameters * @param progress exporter callback for tracking progress of export */ + @Auditable(parameters = {"exportHandler", "parameters", "progress"}) public void exportView(ExportPackageHandler exportHandler, ExporterCrawlerParameters parameters, Exporter progress) throws ExporterException; @@ -59,6 +63,7 @@ public interface ExporterService * @param parameters export parameters * @param progress exporter callback for tracking progress of export */ + @Auditable(parameters = {"exporter", "parameters", "progress"}) public void exportView(Exporter exporter, ExporterCrawlerParameters parameters, Exporter progress); } diff --git a/source/java/org/alfresco/service/cmr/view/ImporterService.java b/source/java/org/alfresco/service/cmr/view/ImporterService.java index 5d68941897..5c9e22c6db 100644 --- a/source/java/org/alfresco/service/cmr/view/ImporterService.java +++ b/source/java/org/alfresco/service/cmr/view/ImporterService.java @@ -18,6 +18,8 @@ package org.alfresco.service.cmr.view; import java.io.Reader; +import org.alfresco.service.Auditable; + /** * 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 progress progress monitor (optional) */ + @Auditable(parameters = {"viewReader", "location", "binding", "progress"}) public void importView(Reader viewReader, Location location, ImporterBinding binding, ImporterProgress progress) throws ImporterException; @@ -50,6 +53,7 @@ public interface ImporterService * @param binding property values used for binding property place holders in import stream * @param progress progress monitor (optional) */ + @Auditable(parameters = {"importHandler", "location", "binding", "progress"}) public void importView(ImportPackageHandler importHandler, Location location, ImporterBinding binding, ImporterProgress progress) throws ImporterException; diff --git a/source/java/org/alfresco/service/cmr/view/RepositoryExporterService.java b/source/java/org/alfresco/service/cmr/view/RepositoryExporterService.java index 99bb20042c..ab027f3013 100644 --- a/source/java/org/alfresco/service/cmr/view/RepositoryExporterService.java +++ b/source/java/org/alfresco/service/cmr/view/RepositoryExporterService.java @@ -18,6 +18,7 @@ package org.alfresco.service.cmr.view; import java.io.File; +import org.alfresco.service.Auditable; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.StoreRef; @@ -38,6 +39,7 @@ public interface RepositoryExporterService * @param packageName package name prefix for export .acp files * @return list of temporary export files */ + @Auditable(parameters = {"packageName"}) public FileExportHandle[] export(String packageName); /** @@ -49,6 +51,7 @@ public interface RepositoryExporterService * @param packageName package name prefix for export .acp files * @return list of repository held export files */ + @Auditable(key = Auditable.Key.ARG_0, parameters = {"repositoryDestination", "packageName"}) public RepositoryExportHandle[] export(NodeRef repositoryDestination, String packageName); /** @@ -58,6 +61,7 @@ public interface RepositoryExporterService * @param packageName package name prefix for export .acp files * @return list of export files */ + @Auditable(parameters = {"directoryDestination", "packageName"}) public FileExportHandle[] export(File directoryDestination, String packageName); diff --git a/source/java/org/alfresco/service/descriptor/DescriptorService.java b/source/java/org/alfresco/service/descriptor/DescriptorService.java index f1695228ed..75c3af7be7 100644 --- a/source/java/org/alfresco/service/descriptor/DescriptorService.java +++ b/source/java/org/alfresco/service/descriptor/DescriptorService.java @@ -16,6 +16,7 @@ */ package org.alfresco.service.descriptor; +import org.alfresco.service.NotAuditable; import org.alfresco.service.license.LicenseDescriptor; @@ -32,6 +33,7 @@ public interface DescriptorService * * @return server descriptor */ + @NotAuditable public Descriptor getServerDescriptor(); /** @@ -41,6 +43,7 @@ public interface DescriptorService * * @return repository descriptor */ + @NotAuditable public Descriptor getInstalledRepositoryDescriptor(); /** @@ -48,6 +51,7 @@ public interface DescriptorService * * @return the license descriptor */ + @NotAuditable public LicenseDescriptor getLicenseDescriptor(); } diff --git a/source/java/org/alfresco/service/license/LicenseService.java b/source/java/org/alfresco/service/license/LicenseService.java index e0ae017b24..f325ac73c5 100644 --- a/source/java/org/alfresco/service/license/LicenseService.java +++ b/source/java/org/alfresco/service/license/LicenseService.java @@ -16,6 +16,8 @@ */ package org.alfresco.service.license; +import org.alfresco.service.NotAuditable; + /** * Contract for managing licenses @@ -30,6 +32,7 @@ public interface LicenseService * * @throws LicenseException */ + @NotAuditable public void verifyLicense() throws LicenseException; /** @@ -38,6 +41,7 @@ public interface LicenseService * @return license descriptor (or null, if one is not installed) * @throws LicenseException */ + @NotAuditable public LicenseDescriptor getLicense() throws LicenseException; } diff --git a/source/java/org/alfresco/service/namespace/NamespaceService.java b/source/java/org/alfresco/service/namespace/NamespaceService.java index 6ee1fda59a..9ef59abf26 100644 --- a/source/java/org/alfresco/service/namespace/NamespaceService.java +++ b/source/java/org/alfresco/service/namespace/NamespaceService.java @@ -16,6 +16,8 @@ */ package org.alfresco.service.namespace; +import org.alfresco.service.Auditable; + /** @@ -83,6 +85,7 @@ public interface NamespaceService extends NamespacePrefixResolver * @param prefix * @param uri */ + @Auditable(parameters = {"prefix", "uri"}) public void registerNamespace(String prefix, String uri); @@ -91,6 +94,7 @@ public interface NamespaceService extends NamespacePrefixResolver * * @param prefix */ + @Auditable(parameters = {"prefix"}) public void unregisterNamespace(String prefix); } diff --git a/source/java/org/alfresco/service/transaction/TransactionService.java b/source/java/org/alfresco/service/transaction/TransactionService.java index 1ed004d6d5..b1ee1d7c6f 100644 --- a/source/java/org/alfresco/service/transaction/TransactionService.java +++ b/source/java/org/alfresco/service/transaction/TransactionService.java @@ -18,6 +18,8 @@ package org.alfresco.service.transaction; import javax.transaction.UserTransaction; +import org.alfresco.service.NotAuditable; + /** * Contract for retrieving access to a user transaction. *

@@ -34,6 +36,7 @@ public interface TransactionService * * @return Returns true if all transactions are read-only. */ + @NotAuditable public boolean isReadOnly(); /** @@ -42,6 +45,7 @@ public interface TransactionService * * @return the user transaction */ + @NotAuditable UserTransaction getUserTransaction(); /** @@ -53,6 +57,7 @@ public interface TransactionService * system is in read-only mode. * @return the user transaction */ + @NotAuditable UserTransaction getUserTransaction(boolean readOnly); /** @@ -64,6 +69,7 @@ public interface TransactionService * * @return Returns a non-propagating user transaction */ + @NotAuditable UserTransaction getNonPropagatingUserTransaction(); /** @@ -78,5 +84,6 @@ public interface TransactionService * system is in read-only mode. * @return Returns a non-gating user transaction */ + @NotAuditable UserTransaction getNonPropagatingUserTransaction(boolean readOnly); }