(1);
+ dateObj.put("value", value);
+ dateObj.put("iso8601", ISO8601DateFormat.format((Date)value));
+ json.put(key, (Serializable)dateObj);
+ }
+ else
+ {
+ json.put(key, value);
+ }
+ }
+ }
+ catch (NamespaceException ne)
+ {
+ // ignore properties that do not have a registered namespace
+ if (logger.isDebugEnabled())
+ logger.debug("Ignoring property '" + nextLongQName + "' as its namespace is not registered");
+ }
+ }
+
+ return json;
+ }
+
+ /**
+ * @param node the node to construct the download URL for
+ * @return For a content document, this method returns the URL to the /api/node/content
+ * API for the default content property
+ *
+ * For a container node, this method returns an empty string
+ *
+ */
+ public String getDownloadAPIUrl(ScriptNode node)
+ {
+ if (node.getIsDocument())
+ {
+ return MessageFormat.format(CONTENT_DOWNLOAD_API_URL, new Object[]{
+ node.nodeRef.getStoreRef().getProtocol(),
+ node.nodeRef.getStoreRef().getIdentifier(),
+ node.nodeRef.getId(),
+ URLEncoder.encode(node.getName())});
+ }
+ else
+ {
+ return "";
+ }
+ }
+
+}
diff --git a/source/java/org/alfresco/repo/jscript/ScriptNode.java b/source/java/org/alfresco/repo/jscript/ScriptNode.java
index 75c301340c..676103d479 100644
--- a/source/java/org/alfresco/repo/jscript/ScriptNode.java
+++ b/source/java/org/alfresco/repo/jscript/ScriptNode.java
@@ -130,7 +130,7 @@ public class ScriptNode implements Serializable, Scopeable, NamespacePrefixResol
private final static String CONTENT_PROP_URL = "/d/d/{0}/{1}/{2}/{3}?property={4}";
private final static String CONTENT_DOWNLOAD_PROP_URL = "/d/a/{0}/{1}/{2}/{3}?property={4}";
private final static String FOLDER_BROWSE_URL = "/n/browse/{0}/{1}/{2}";
-
+
/** Root scope for this object */
protected Scriptable scope;
@@ -1263,7 +1263,7 @@ public class ScriptNode implements Serializable, Scopeable, NamespacePrefixResol
{
return getDownloadUrl();
}
-
+
/**
* @return The WebDav cm:name based path to the content for the default content property
* (@see ContentModel.PROP_CONTENT)
@@ -1411,7 +1411,7 @@ public class ScriptNode implements Serializable, Scopeable, NamespacePrefixResol
*
* @return Object[] of packed permission strings.
*/
- private Object[] retrieveAllSetPermissions(boolean direct, boolean full)
+ protected Object[] retrieveAllSetPermissions(boolean direct, boolean full)
{
Set acls = this.services.getPermissionService().getAllSetPermissions(getNodeRef());
List