10-18-2011 07:05 AM
10-18-2011 08:17 AM
10-18-2011 08:29 AM
10-18-2011 08:42 AM
main();
function main()
{
if (url.templateArgs.store_type === null)
{
status.setCode(status.STATUS_BAD_REQUEST, "NodeRef missing");
return;
}
// nodeRef input
var storeType = url.templateArgs.store_type;
var storeId = url.templateArgs.store_id;
var id = url.templateArgs.id;
var nodeRef = storeType + "://" + storeId + "/" + id;
var node = search.findNode(nodeRef);
if (node === null)
{
status.setCode(status.STATUS_NOT_FOUND, "Not a valid nodeRef: '" + nodeRef + "'");
return null;
}
// Set passed-in properties
if (json.has("properties"))
{
var properties = jsonToObject("properties");
for (property in properties)
{
node.properties[property] = properties[property];
}
}
// Set passed-in mimetype
if (json.has("mimetype"))
{
node.mimetype = json.get("mimetype");
}
// Set passed-in tags
if (json.has("tags"))
{
// Get the tags JSONArray and copy it to a native JavaScript array
var jsonTags = json.get("tags"),
tags = [];
for (var t = 0; t < jsonTags.length(); t++)
{
tags.push(jsonTags.get(t));
}
if (tags.length > 0)
{
node.tags = tags;
}
else
{
node.clearTags();
}
}
node.save();
}
function jsonToObject(p_name)
{
var object = {};
var jsonObj = json.get(p_name);
var names = jsonObj.names();
var name;
for (var i = 0, j = names.length(); i < j; i++)
{
name = names.get(i);
object[name] = jsonObj.get(name);
}
return object;
}
function jsonToArray(p_name)
{
var array = [];
var jsonArray = json.get(p_name);
for (var i = 0, j = jsonArray.length(); i < j; i++)
{
array.push(jsonArray.get(i));
}
return array;
}
10-20-2011 09:24 AM
12-12-2011 07:34 AM
12-15-2011 04:30 AM
12-15-2011 08:01 AM
Abdera abdera = new Abdera();
AbderaClient client = new AbderaClient(abdera);
String uri = "http://localhost:8080/alfresco/service/api/metadata/node/workspace/SpaceStore/{id}?alf_ticket=ticket";
String jsonMessage ="{\"properties\":{\"cm:title\":\"Texas\",\"cm:description\":\"Descripción de Texas\"}}";
InputStream is = Utilidades.stringToInputStream(jsonMessage);
RequestOptions options = new RequestOptions();
options.setHeader("Content-Type", "application/json");
ClientResponse resp = client.post(uri, is, options);
04-24-2015 06:56 AM
04-24-2015 07:25 AM
HTTP/1.1 404 Not Found
body
{
"status" :
{
"code" : 404,
"name" : "Not Found",
"description" : "Requested resource is not available."
},
"message" : "Not a valid nodeRef: 'workspace:\/\/SpaceStore\/de17d530-1f13-4eb1-91b5-7049892a5055\/'",
"exception" : "",
"callstack" :
[
],
"server" : "Community v5.0.0 (c r91299-b145) schema 8,009",
"time" : "Apr 24, 2015 4:21:29 AM"
}
urlString = "http://'+ipaddress+':8080/alfresco/service/api/metadata/node/workspace/SpaceStore/'+nodeId+'/?alf_ti..."
+ authTicket;
System.out.println("The upload url:::" + urlString);
client = new HttpClient();
mPost = new PostMethod(urlString);
itemNameValue=new ArrayList();
itemNameValue.addAll(Arrays.asList(new String[] { "Item1","Item2"}));
String jsonMessage ="{\"properties\":{\"rs:vendor\":\"Texas\",\"rs:itemName\":\"Descripción de Texas\"}}";
InputStream stream = new ByteArrayInputStream(jsonMessage.getBytes(StandardCharsets.UTF_8));
mPost.addRequestHeader("Content-Type", "application/json");
mPost.setRequestBody(stream);
statusCode1 = client.executeMethod(mPost);
System.out.println("statusLine>>>" + statusCode1 + "……"
+ "\n status line \n" + mPost.getStatusLine() + "\nbody \n"
+ mPost.getResponseBodyAsString());
mPost.releaseConnection();
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.