- Runtime (txn breaking) exceptions that occurs during JavaScript execution now correctly bubble up and halt script execution
. Rhino JavaScript engine JAR updated to 1.6R4 (from 1.6R2)
 - Bug fix release - executed all existing test scripts to ensure compatability
. Minor label change requested by PHH

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5055 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast 2007-02-06 16:46:57 +00:00
parent c5a5ba2a5a
commit 5e74474f98

View File

@ -566,16 +566,9 @@ public class Node implements Serializable, Scopeable
public String getDisplayPath() public String getDisplayPath()
{ {
if (displayPath == null) if (displayPath == null)
{
try
{ {
displayPath = this.nodeService.getPath(this.nodeRef).toDisplayPath(this.nodeService); displayPath = this.nodeService.getPath(this.nodeRef).toDisplayPath(this.nodeService);
} }
catch (AccessDeniedException err)
{
displayPath = "";
}
}
return displayPath; return displayPath;
} }
@ -976,18 +969,11 @@ public class Node implements Serializable, Scopeable
this.services.getDictionaryService().isSubClass(qnameType, getType()) == true) this.services.getDictionaryService().isSubClass(qnameType, getType()) == true)
{ {
// Specialise the type of the node // Specialise the type of the node
try
{
this.nodeService.setType(this.nodeRef, qnameType); this.nodeService.setType(this.nodeRef, qnameType);
this.type = qnameType; this.type = qnameType;
return true; return true;
} }
catch (InvalidNodeRefException err)
{
// fall through to return fase
}
}
return false; return false;
} }
@ -1004,24 +990,12 @@ public class Node implements Serializable, Scopeable
{ {
Node node = null; Node node = null;
try
{
if (name != null && name.length() != 0) if (name != null && name.length() != 0)
{ {
FileInfo fileInfo = this.services.getFileFolderService().create(this.nodeRef, name, FileInfo fileInfo = this.services.getFileFolderService().create(this.nodeRef, name,
ContentModel.TYPE_CONTENT); ContentModel.TYPE_CONTENT);
node = newInstance(fileInfo.getNodeRef(), this.services, this.scope); node = newInstance(fileInfo.getNodeRef(), this.services, this.scope);
} }
}
catch (FileExistsException fileErr)
{
// default of null will be returned
// TODO: how to report this kind of exception to the script writer?
}
catch (AccessDeniedException accessErr)
{
// default of null will be returned
}
return node; return node;
} }
@ -1037,24 +1011,12 @@ public class Node implements Serializable, Scopeable
{ {
Node node = null; Node node = null;
try
{
if (name != null && name.length() != 0) if (name != null && name.length() != 0)
{ {
FileInfo fileInfo = this.services.getFileFolderService().create(this.nodeRef, name, FileInfo fileInfo = this.services.getFileFolderService().create(this.nodeRef, name,
ContentModel.TYPE_FOLDER); ContentModel.TYPE_FOLDER);
node = newInstance(fileInfo.getNodeRef(), this.services, this.scope); node = newInstance(fileInfo.getNodeRef(), this.services, this.scope);
} }
}
catch (FileExistsException fileErr)
{
// default of null will be returned
// TODO: how to report this kind of exception to the script writer?
}
catch (AccessDeniedException accessErr)
{
// default of null will be returned
}
return node; return node;
} }
@ -1071,8 +1033,6 @@ public class Node implements Serializable, Scopeable
{ {
Node node = null; Node node = null;
try
{
if (name != null && name.length() != 0 && type != null && type.length() != 0) if (name != null && name.length() != 0 && type != null && type.length() != 0)
{ {
Map<QName, Serializable> props = new HashMap<QName, Serializable>(1); Map<QName, Serializable> props = new HashMap<QName, Serializable>(1);
@ -1082,11 +1042,6 @@ public class Node implements Serializable, Scopeable
createQName(type), props); createQName(type), props);
node = newInstance(childAssocRef.getChildRef(), this.services, this.scope); node = newInstance(childAssocRef.getChildRef(), this.services, this.scope);
} }
}
catch (AccessDeniedException accessErr)
{
// default of null will be returned
}
return node; return node;
} }
@ -1098,22 +1053,13 @@ public class Node implements Serializable, Scopeable
{ {
boolean success = false; boolean success = false;
try if (nodeService.exists(this.nodeRef))
{ {
this.nodeService.deleteNode(this.nodeRef); this.nodeService.deleteNode(this.nodeRef);
reset();
success = true; success = true;
} }
catch (AccessDeniedException accessErr)
{ reset();
// default of false will be returned
}
catch (InvalidNodeRefException refErr)
{
// default of false will be returned
}
return success; return success;
} }
@ -1144,8 +1090,6 @@ public class Node implements Serializable, Scopeable
Node copy = null; Node copy = null;
try
{
if (destination.getNodeRef().getStoreRef().getProtocol().equals(StoreRef.PROTOCOL_WORKSPACE)) if (destination.getNodeRef().getStoreRef().getProtocol().equals(StoreRef.PROTOCOL_WORKSPACE))
{ {
NodeRef copyRef = this.services.getCopyService().copyAndRename(this.nodeRef, destination.getNodeRef(), NodeRef copyRef = this.services.getCopyService().copyAndRename(this.nodeRef, destination.getNodeRef(),
@ -1157,15 +1101,6 @@ public class Node implements Serializable, Scopeable
// NOTE: the deepCopy flag is not respected for this copy mechanism // NOTE: the deepCopy flag is not respected for this copy mechanism
copy = getCrossRepositoryCopyHelper().copy(this, destination, getName()); copy = getCrossRepositoryCopyHelper().copy(this, destination, getName());
} }
}
catch (AccessDeniedException accessErr)
{
// default of null will be returned
}
catch (InvalidNodeRefException nodeErr)
{
// default of null will be returned
}
return copy; return copy;
} }
@ -1181,28 +1116,13 @@ public class Node implements Serializable, Scopeable
{ {
ParameterCheck.mandatory("Destination Node", destination); ParameterCheck.mandatory("Destination Node", destination);
boolean success = false;
try
{
this.primaryParentAssoc = this.nodeService.moveNode(this.nodeRef, destination.getNodeRef(), this.primaryParentAssoc = this.nodeService.moveNode(this.nodeRef, destination.getNodeRef(),
ContentModel.ASSOC_CONTAINS, getPrimaryParentAssoc().getQName()); ContentModel.ASSOC_CONTAINS, getPrimaryParentAssoc().getQName());
// reset cached values // reset cached values
reset(); reset();
success = true; return true;
}
catch (AccessDeniedException accessErr)
{
// default of false will be returned
}
catch (InvalidNodeRefException refErr)
{
// default of false will be returned
}
return success;
} }
/** /**
@ -1230,10 +1150,6 @@ public class Node implements Serializable, Scopeable
{ {
ParameterCheck.mandatoryString("Aspect Type", type); ParameterCheck.mandatoryString("Aspect Type", type);
boolean success = false;
try
{
Map<QName, Serializable> aspectProps = null; Map<QName, Serializable> aspectProps = null;
if (props instanceof ScriptableObject) if (props instanceof ScriptableObject)
{ {
@ -1264,14 +1180,7 @@ public class Node implements Serializable, Scopeable
// reset the relevant cached node members // reset the relevant cached node members
reset(); reset();
success = true; return true;
}
catch (InvalidAspectException aspectErr)
{
// default of failed will be returned
}
return success;
} }
/** /**
@ -1440,17 +1349,10 @@ public class Node implements Serializable, Scopeable
{ {
Node transformedNode = null; Node transformedNode = null;
if (contentService.isTransformable(reader, writer)) if (contentService.isTransformable(reader, writer))
{
try
{ {
contentService.transform(reader, writer); contentService.transform(reader, writer);
transformedNode = newInstance(nodeRef, services, scope); transformedNode = newInstance(nodeRef, services, scope);
} }
catch (NoTransformerException err)
{
// failed to find a useful transformer - do not return a node instance
}
}
return transformedNode; return transformedNode;
} }
}; };
@ -1569,20 +1471,12 @@ public class Node implements Serializable, Scopeable
{ {
public Node transform(ContentService contentService, NodeRef nodeRef, ContentReader reader, public Node transform(ContentService contentService, NodeRef nodeRef, ContentReader reader,
ContentWriter writer) ContentWriter writer)
{
Node transformedNode = null;
try
{ {
Map<String, Object> opts = new HashMap<String, Object>(1); Map<String, Object> opts = new HashMap<String, Object>(1);
opts.put(ImageMagickContentTransformer.KEY_OPTIONS, options != null ? options : ""); opts.put(ImageMagickContentTransformer.KEY_OPTIONS, options != null ? options : "");
contentService.getImageTransformer().transform(reader, writer, opts); contentService.getImageTransformer().transform(reader, writer, opts);
transformedNode = newInstance(nodeRef, services, scope);
} return newInstance(nodeRef, services, scope);
catch (NoTransformerException err)
{
// failed to find a useful transformer - do not return a node instance
}
return transformedNode;
} }
}; };
@ -1710,8 +1604,8 @@ public class Node implements Serializable, Scopeable
// TODO: DC: Allow debug output of property values - for now it's disabled as this could potentially // TODO: DC: Allow debug output of property values - for now it's disabled as this could potentially
// follow a large network of nodes. Unfortunately, JBPM issues unprotected debug statements // follow a large network of nodes. Unfortunately, JBPM issues unprotected debug statements
// where node.toString is used - will request this is fixed in next release of JBPM. // where node.toString is used - will request this is fixed in next release of JBPM.
return "Node Type: " + getType() + "\nNode Properties: " + this.getProperties().size() + "\nNode Aspects: " return "Node Type: " + getType() + "\nNode Properties: " + this.getProperties().size() +
+ this.getAspects().toString(); "\nNode Aspects: " + this.getAspects().toString();
} }
else else
{ {