Added module status to module.properties file saved in WAR for later use. Added contribution to return node path in Reference object. Fixed issues with web service caused by outdated Jars and incorrect AuthenticationService

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@4980 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Roy Wetherall
2007-01-31 11:56:02 +00:00
parent 251029fc75
commit fccfa9fc65
14 changed files with 107 additions and 90 deletions

View File

@@ -341,11 +341,11 @@ public class CMLUtil
}
if (sourceNodeRef != null)
{
result.setSource(Utils.convertToReference(sourceNodeRef));
result.setSource(Utils.convertToReference(this.nodeService, sourceNodeRef));
}
if (destinationNodeRef != null)
{
result.setDestination(Utils.convertToReference(destinationNodeRef));
result.setDestination(Utils.convertToReference(this.nodeService, destinationNodeRef));
}
// Sort out the count ???
return result;

View File

@@ -359,7 +359,7 @@ public class CMLUtilTest extends BaseSpringTest
this.nodeService.addChild(this.folderNodeRef, this.nodeRef, ContentModel.ASSOC_CONTAINS, ContentModel.ASSOC_CONTAINS);
CMLRemoveChild removeChild = new CMLRemoveChild();
removeChild.setFrom(Utils.convertToReference(this.folderNodeRef));
removeChild.setFrom(Utils.convertToReference(this.nodeService, this.folderNodeRef));
removeChild.setWhere(createPredicate(this.nodeRef));
CML cml = new CML();
@@ -448,7 +448,7 @@ public class CMLUtilTest extends BaseSpringTest
{
Predicate predicate = new Predicate();
predicate.setStore(Utils.convertToStore(nodeRef.getStoreRef()));
predicate.setNodes(new Reference[]{Utils.convertToReference(nodeRef)});
predicate.setNodes(new Reference[]{Utils.convertToReference(this.nodeService, nodeRef)});
return predicate;
}

View File

@@ -309,12 +309,26 @@ public class Utils
* The node to create a Reference for
* @return The Reference
*/
public static Reference convertToReference(NodeRef node)
public static Reference convertToReference(NodeService nodeService, NodeRef node)
{
Reference ref = new Reference();
Store store = new Store(node.getStoreRef().getProtocol(), node.getStoreRef().getIdentifier());
ref.setStore(store);
ref.setUuid(node.getId());
// Need to check if node still exists (e.g., after a delete operation) so getPath()
// doesn't fail
if(nodeService.exists(node) == true)
{
if (logger.isDebugEnabled())
{
logger.debug("setting path for reference to: " + nodeService.getPath(node).toString());
}
// so clients can get the path too
ref.setPath(nodeService.getPath(node).toString());
}
return ref;
}
@@ -324,12 +338,10 @@ public class Utils
* @param store
* The Store to search within
* @param uuid
* The id of the node, or the id of the starting node if a path
* is also present
* The id of the required node.c
* @param path
* The path to the required node, if a uuid is given the search
* starts from that node otherwise the search will start from the
* root node
* The path to the required node. If a uuid is given the uuid is used
+ * to find the node. Otherwise, the path is used.
* @param nodeService
* NodeService to use
* @param searchService
@@ -350,54 +362,45 @@ public class Utils
NodeRef nodeRef = null;
// find out where we are starting from, either the root or the node
// represented by the uuid
NodeRef rootNodeRef = null;
// If uuid is null, then use the path to find the node
if (uuid == null || uuid.length() == 0)
{
rootNodeRef = nodeService.getRootNode(convertToStoreRef(store));
}
else
{
rootNodeRef = new NodeRef(convertToStoreRef(store), uuid);
}
// see if we have a path to further define the node being requested
if (path != null && path.length() != 0)
{
if (logger.isDebugEnabled() == true)
if (path != null && path.length() != 0)
{
logger.debug("Resolving path: " + path);
if (logger.isDebugEnabled() == true)
{
logger.debug("Resolving path: " + path);
}
NodeRef rootNodeRef = nodeService.getRootNode(convertToStoreRef(store));
List<NodeRef> nodes = searchService.selectNodes(rootNodeRef, path,
null, namespaceService, false);
// make sure we only have one result
if (nodes.size() != 1)
{
StringBuilder builder = new StringBuilder(
"Failed to resolve to a single NodeRef with parameters (store=");
builder.append(store.getScheme()).append(":")
.append(store.getAddress());
builder.append(" uuid=").append(uuid);
builder.append(" path=").append(path).append("), found ");
builder.append(nodes.size()).append(" nodes.");
throw new IllegalStateException(builder.toString());
}
nodeRef = nodes.get(0);
}
else
{
throw new IllegalArgumentException("A uuid or a path must be supplied to resolve to a NodeRef");
}
List<NodeRef> nodes = searchService.selectNodes(rootNodeRef, path,
null, namespaceService, false);
// make sure we only have one result
if (nodes.size() != 1)
{
StringBuilder builder = new StringBuilder(
"Failed to resolve to a single NodeRef with parameters (store=");
builder.append(store.getScheme()).append(":")
.append(store.getAddress());
builder.append(" uuid=").append(uuid);
builder.append(" path=").append(path).append("), found ");
builder.append(nodes.size()).append(" nodes.");
throw new IllegalStateException(builder.toString());
}
nodeRef = nodes.get(0);
}
else
{
if (logger.isDebugEnabled() == true)
{
logger.debug("There was no path to resolve so using root or specified node");
}
// if there is no path just use whatever the rootNodeRef currently
// is
nodeRef = rootNodeRef;
}
else // use the uuid
{
nodeRef = new NodeRef(convertToStoreRef(store), uuid);
}
return nodeRef;
@@ -556,12 +559,13 @@ public class Utils
* @return the web service version object
*/
public static Version convertToVersion(
NodeService nodeService,
org.alfresco.service.cmr.version.Version version)
{
Version webServiceVersion = new Version();
// Set the basic properties
webServiceVersion.setId(Utils.convertToReference(version
webServiceVersion.setId(Utils.convertToReference(nodeService, version
.getFrozenStateNodeRef()));
webServiceVersion.setCreator(version.getCreator());
webServiceVersion.setLabel(version.getVersionLabel());

View File

@@ -128,7 +128,7 @@ public class AccessControlWebService extends AbstractWebService implements Acces
{
// Create the acl
ACL acl = new ACL();
acl.setReference(Utils.convertToReference(node));
acl.setReference(Utils.convertToReference(this.nodeService, node));
// Set the inhertied value
boolean inheritPermission = this.permissionService.getInheritParentPermissions(node);
@@ -332,7 +332,7 @@ public class AccessControlWebService extends AbstractWebService implements Acces
// Create the permissions result object
GetPermissionsResult result = new GetPermissionsResult();
result.setReference(Utils.convertToReference(node));
result.setReference(Utils.convertToReference(this.nodeService, node));
result.setPermissions((String[])permissions.toArray(new String[permissions.size()]));
// Add result to array
@@ -451,7 +451,7 @@ public class AccessControlWebService extends AbstractWebService implements Acces
}
// Add to the results list
results.add(new HasPermissionsResult(Utils.convertToReference(node), permission, accessState));
results.add(new HasPermissionsResult(Utils.convertToReference(this.nodeService, node), permission, accessState));
}
}
@@ -556,7 +556,7 @@ public class AccessControlWebService extends AbstractWebService implements Acces
String owner = this.ownableService.getOwner(node);
// Marshal into result
result[count] = new OwnerResult(Utils.convertToReference(node), owner);
result[count] = new OwnerResult(Utils.convertToReference(this.nodeService, node), owner);
count ++;
}
@@ -609,7 +609,7 @@ public class AccessControlWebService extends AbstractWebService implements Acces
this.ownableService.setOwner(node, owner);
// Marshal into result
result[count] = new OwnerResult(Utils.convertToReference(node), owner);
result[count] = new OwnerResult(Utils.convertToReference(this.nodeService, node), owner);
count ++;
}

View File

@@ -483,7 +483,7 @@ public class ActionWebService extends AbstractWebService implements ActionServic
// Create the web service action object
org.alfresco.repo.webservice.action.Action webServiceAction = new org.alfresco.repo.webservice.action.Action(
Utils.convertToReference(action.getNodeRef()),
Utils.convertToReference(this.nodeService, action.getNodeRef()),
action.getId(),
action.getActionDefinitionName(),
action.getTitle(),
@@ -860,7 +860,7 @@ public class ActionWebService extends AbstractWebService implements ActionServic
{
// Create the execution result object and set the action reference
ActionExecutionResult executionResult = new ActionExecutionResult();
executionResult.setReference(Utils.convertToReference(nodeRef));
executionResult.setReference(Utils.convertToReference(this.nodeService, nodeRef));
// Tyr and execute the actions
List<org.alfresco.repo.webservice.action.Action> executedActions = new ArrayList<org.alfresco.repo.webservice.action.Action>(10);
@@ -946,12 +946,12 @@ public class ActionWebService extends AbstractWebService implements ActionServic
NodeRef owningNodeRef = this.ruleService.getOwningNodeRef(rule);
if (owningNodeRef != null)
{
owningReference = Utils.convertToReference(owningNodeRef);
owningReference = Utils.convertToReference(this.nodeService, owningNodeRef);
}
// Create the web service rule object
org.alfresco.repo.webservice.action.Rule webServiceRule = new org.alfresco.repo.webservice.action.Rule(
Utils.convertToReference(rule.getNodeRef()),
Utils.convertToReference(this.nodeService, rule.getNodeRef()),
owningReference,
rule.getRuleTypes().toArray(new String[rule.getRuleTypes().size()]),
rule.getTitle(),

View File

@@ -183,8 +183,8 @@ public class AuthoringWebService extends AbstractWebService implements
}
// store the results
originals[x] = Utils.convertToReference(original);
workingCopies[x] = Utils.convertToReference(workingCopy);
originals[x] = Utils.convertToReference(AuthoringWebService.this.nodeService, original);
workingCopies[x] = Utils.convertToReference(AuthoringWebService.this.nodeService, workingCopy);
}
// setup the result object
@@ -248,12 +248,12 @@ public class AuthoringWebService extends AbstractWebService implements
NodeRef checkedInNode = AuthoringWebService.this.cociService.checkin(node, mapComments, null, keepCheckedOut);
// Add the results to the array
checkedIn[iIndex] = Utils.convertToReference(checkedInNode);
checkedIn[iIndex] = Utils.convertToReference(AuthoringWebService.this.nodeService, checkedInNode);
// Only return the working copies if the node is keep checked out otherwise the working copies have been deleted
if (keepCheckedOut == true)
{
listWorkingCopies.add(Utils.convertToReference(node));
listWorkingCopies.add(Utils.convertToReference(AuthoringWebService.this.nodeService, node));
}
iIndex++;
}
@@ -333,7 +333,7 @@ public class AuthoringWebService extends AbstractWebService implements
contentUrl,
keepCheckedOut);
// Return the orig node ref
return Utils.convertToReference(origNodeRef);
return Utils.convertToReference(AuthoringWebService.this.nodeService, origNodeRef);
}
});
}
@@ -380,8 +380,8 @@ public class AuthoringWebService extends AbstractWebService implements
NodeRef origNode = AuthoringWebService.this.cociService.cancelCheckout(node);
// Set the value in the arrays
origNodes[iIndex] = Utils.convertToReference(origNode);
workingCopies[iIndex] = Utils.convertToReference(node);
origNodes[iIndex] = Utils.convertToReference(AuthoringWebService.this.nodeService, origNode);
workingCopies[iIndex] = Utils.convertToReference(AuthoringWebService.this.nodeService, node);
iIndex ++;
}
@@ -433,7 +433,7 @@ public class AuthoringWebService extends AbstractWebService implements
{
LockType convertedLockType = convertToLockType(lockType);
AuthoringWebService.this.lockService.lock(node, convertedLockType, 0, lockChildren);
result[iIndex] = Utils.convertToReference(node);
result[iIndex] = Utils.convertToReference(AuthoringWebService.this.nodeService, node);
iIndex++;
}
@@ -501,7 +501,7 @@ public class AuthoringWebService extends AbstractWebService implements
{
AuthoringWebService.this.lockService.unlock(node, unlockChildren);
result[iIndex] = Utils.convertToReference(node);
result[iIndex] = Utils.convertToReference(AuthoringWebService.this.nodeService, node);
iIndex++;
}
@@ -555,7 +555,7 @@ public class AuthoringWebService extends AbstractWebService implements
LockStatus lockStatus = new LockStatus();
lockStatus.setLockOwner(lockOwner);
lockStatus.setLockType(lockTypeEnum);
lockStatus.setNode(Utils.convertToReference(node));
lockStatus.setNode(Utils.convertToReference(AuthoringWebService.this.nodeService, node));
result[iIndex] = lockStatus;
iIndex++;
@@ -634,8 +634,8 @@ public class AuthoringWebService extends AbstractWebService implements
Collection<Version> versions = AuthoringWebService.this.versionService.createVersion(node, mapComments, versionChildren);
for (Version version : versions)
{
versionedReferences.add(Utils.convertToReference(version.getVersionedNodeRef()));
webServiceVersions.add(Utils.convertToVersion(version));
versionedReferences.add(Utils.convertToReference(AuthoringWebService.this.nodeService, version.getVersionedNodeRef()));
webServiceVersions.add(Utils.convertToVersion(AuthoringWebService.this.nodeService, version));
}
}
@@ -689,7 +689,7 @@ public class AuthoringWebService extends AbstractWebService implements
int iIndex = 0;
for (Version version : versions)
{
webServiceVersions[iIndex] = Utils.convertToVersion(version);
webServiceVersions[iIndex] = Utils.convertToVersion(AuthoringWebService.this.nodeService, version);
iIndex ++;
}
webServiceVersionHistory.setVersions(webServiceVersions);

View File

@@ -16,7 +16,6 @@
*/
package org.alfresco.repo.webservice.classification;
import java.io.Serializable;
import java.rmi.RemoteException;
import java.util.ArrayList;
import java.util.Collection;
@@ -177,7 +176,7 @@ public class ClassificationWebService extends AbstractWebService implements
}
Category category = new Category();
category.setId(Utils.convertToReference(nodeRef));
category.setId(Utils.convertToReference(this.nodeService, nodeRef));
category.setTitle(title);
// TODO need to set the description
return category;
@@ -275,7 +274,7 @@ public class ClassificationWebService extends AbstractWebService implements
int iIndex = 0;
for (NodeRef categoryNodeRef : categoryNodeRefs)
{
categoryReferences[iIndex] = Utils.convertToReference(categoryNodeRef);
categoryReferences[iIndex] = Utils.convertToReference(ClassificationWebService.this.nodeService, categoryNodeRef);
iIndex ++;
}
@@ -292,7 +291,7 @@ public class ClassificationWebService extends AbstractWebService implements
// Create the category result object
CategoriesResult categoryResult = new CategoriesResult();
categoryResult.setNode(Utils.convertToReference(nodeRef));
categoryResult.setNode(Utils.convertToReference(ClassificationWebService.this.nodeService, nodeRef));
categoryResult.setCategories(appliedCategories.toArray(new AppliedCategory[appliedCategories.size()]));
result.add(categoryResult);
@@ -401,7 +400,7 @@ public class ClassificationWebService extends AbstractWebService implements
// Create the category result object
CategoriesResult categoryResult = new CategoriesResult();
categoryResult.setNode(Utils.convertToReference(nodeRef));
categoryResult.setNode(Utils.convertToReference(ClassificationWebService.this.nodeService, nodeRef));
categoryResult.setCategories(appliedCategories.toArray(new AppliedCategory[appliedCategories.size()]));
result.add(categoryResult);

View File

@@ -147,7 +147,7 @@ public class ContentWebService extends AbstractWebService implements
// Create the content object
ContentFormat format = new ContentFormat(contentReader.getMimetype(), contentReader.getEncoding());
content = new Content(Utils.convertToReference(nodeRef), property, contentReader.getSize(), format, downloadUrl);
content = new Content(Utils.convertToReference(this.nodeService, nodeRef), property, contentReader.getSize(), format, downloadUrl);
// Debug
if (logger.isDebugEnabled())
@@ -163,7 +163,7 @@ public class ContentWebService extends AbstractWebService implements
else
{
// Create an empty content object
content = new Content(Utils.convertToReference(nodeRef), property, 0, null, null);
content = new Content(Utils.convertToReference(this.nodeService, nodeRef), property, 0, null, null);
// Debug
if (logger.isDebugEnabled())

View File

@@ -111,7 +111,7 @@ public class AssociatedQuerySession extends AbstractQuerySession
// get the data for the row and build up the columns structure
Map<QName, Serializable> props = nodeService
.getProperties(childNodeRef);
NamedValue[] columns = new NamedValue[props.size()+1];
NamedValue[] columns = new NamedValue[props.size()+2];
int col = 0;
for (QName propName : props.keySet())
{
@@ -121,7 +121,11 @@ public class AssociatedQuerySession extends AbstractQuerySession
// Now add the system columns containing the association details
columns[col] = new NamedValue(SYS_COL_ASSOC_TYPE, Boolean.FALSE, assoc.getTypeQName().toString(), null);
// Add one more column for the node's path
col++;
columns[col] = Utils.createNamedValue(dictionaryService, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "path"), nodeService.getPath(childNodeRef).toString());
ResultSetRow row = new ResultSetRow();
row.setRowIndex(x);
row.setNode(rowNode);

View File

@@ -97,7 +97,7 @@ public class ChildrenQuerySession extends AbstractQuerySession
// create columns for all the properties of the node
// get the data for the row and build up the columns structure
Map<QName, Serializable> props = nodeService.getProperties(childNodeRef);
NamedValue[] columns = new NamedValue[props.size()+4];
NamedValue[] columns = new NamedValue[props.size()+5];
int col = 0;
for (QName propName : props.keySet())
{
@@ -114,6 +114,10 @@ public class ChildrenQuerySession extends AbstractQuerySession
col++;
columns[col] = new NamedValue(SYS_COL_NTH_SIBLING, Boolean.FALSE, Integer.toString(assoc.getNthSibling()), null);
// Add one more column for the node's path
col++;
columns[col] = Utils.createNamedValue(dictionaryService, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "path"), nodeService.getPath(childNodeRef).toString());
ResultSetRow row = new ResultSetRow();
row.setRowIndex(x);
row.setNode(rowNode);

View File

@@ -97,7 +97,7 @@ public class ParentsQuerySession extends AbstractQuerySession
// create columns for all the properties of the node
// get the data for the row and build up the columns structure
Map<QName, Serializable> props = nodeService.getProperties(parentNodeRef);
NamedValue[] columns = new NamedValue[props.size()+4];
NamedValue[] columns = new NamedValue[props.size()+5];
int col = 0;
for (QName propName : props.keySet())
{
@@ -113,6 +113,9 @@ public class ParentsQuerySession extends AbstractQuerySession
columns[col] = new NamedValue(SYS_COL_IS_PRIMARY, Boolean.FALSE, Boolean.toString(assoc.isPrimary()), null);
col++;
columns[col] = new NamedValue(SYS_COL_NTH_SIBLING, Boolean.FALSE, Integer.toString(assoc.getNthSibling()), null);
// Add one more column for the node's path
col++;
columns[col] = Utils.createNamedValue(dictionaryService, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "path"), nodeService.getPath(parentNodeRef).toString());
ResultSetRow row = new ResultSetRow();
row.setRowIndex(x);

View File

@@ -614,7 +614,7 @@ public class RepositoryWebService extends AbstractWebService implements
for (NodeRef nodeRef : nodeRefs)
{
// Get the nodes reference
Reference reference = Utils.convertToReference(nodeRef);
Reference reference = Utils.convertToReference(this.nodeService, nodeRef);
// Get the nodes type
String type = this.nodeService.getType(nodeRef).toString();

View File

@@ -49,6 +49,7 @@ public class ResultSetQuerySession extends AbstractQuerySession
private Store store;
private Query query;
@SuppressWarnings("unused")
private boolean includeMetaData;
/**
@@ -111,7 +112,7 @@ public class ResultSetQuerySession extends AbstractQuerySession
// get the data for the row and build up the columns structure
Map<Path, Serializable> values = origRow.getValues();
NamedValue[] columns = new NamedValue[values.size()];
NamedValue[] columns = new NamedValue[values.size() + 1];
int col = 0;
for (Path path : values.keySet())
{
@@ -125,7 +126,9 @@ public class ResultSetQuerySession extends AbstractQuerySession
columns[col] = Utils.createNamedValue(dictionaryService, QName.createQName(attributeName), values.get(path)); //new NamedValue(attributeName, value);
col++;
}
// add one extra column for the node's path
columns[col] = Utils.createNamedValue(dictionaryService, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "path"), nodeService.getPath(nodeRef).toString());
org.alfresco.repo.webservice.types.ResultSetRow row = new org.alfresco.repo.webservice.types.ResultSetRow();
row.setColumns(columns);

View File

@@ -6,7 +6,7 @@
<!-- Axis handler to validate the ticket sent with the web service request -->
<bean id="ticketCallbackHandler" class="org.alfresco.repo.webservice.axis.TicketCallbackHandler">
<property name="authenticationService">
<ref bean="authenticationService"/>
<ref bean="AuthenticationService"/>
</property>
</bean>