08-15-2008 08:42 AM
/**
* CopySpaceMetadata
*
* This script makes sure that a content "inherits" is containing space metadata.
* It will not overwrite already existing metadata about the content
*/
// Make sure that the content have the aspects the space has
for(var i in space.aspects){
if(!document.hasAspect(i)){
document.addAspect(i);
}
}
// Set the properties from the space to the content, unless they already are set
for(var i in space.properties){
if(document.property[i] == null){
document.property[i] = space.properties[i];
}
}
08-15-2008 10:15 AM
document.save();
08-15-2008 10:44 AM
08-21-2008 10:32 AM
for(var i in space.aspects){
logger.log("Found aspect " + i);
}
for(var i in space.aspects){
logger.log("Found aspect " + i);
if(!document.hasAspect(i)){
logger.log("Adding aspect: " + i + " to document");
document.addAspect(i);
}
}
for(var i in space.aspects){
logger.log("Found aspect " + i);
if(!document.hasAspect(i)){
logger.log("Adding aspect: " + i + " to document");
document.addAspect(space.aspects[i]);
}
}
08-21-2008 10:57 AM
for (prop in object)
{
if (object.hasOwnProperty(prop) {
// do something
}
}
If you want to iterate over the values in an array, use the more traditional iteration construct:
for (var i=0; i < space.aspects.length; i++) {
logger.log(space.aspects[i]);
}
08-21-2008 11:16 AM
/**
* CopySpaceMetadata
*
* This script makes sure that a content "inherits" is containing space metadata.
* It will not overwrite already existing metadata about the content
*/
// Make sure that the content have the aspects the space has
logger.log("Script CopySpaceMetadata started");
var myArr = space.aspects.toArray();
// Copy the aspects from the space to the content
for(i in myArr){
logger.log("Found aspect " + myArr[i]);
if(!document.hasAspect(myArr[i])){
logger.log("Adding aspect: " + myArr[i] + " to document");
document.addAspect(myArr[i]);
}
}
// Set the properties from the space to the content, unless they already are set
for(var i in space.properties){
logger.log("Found property: " + space.properties[i]);
if(document.properties[i] == null){
document.properties[i] = space.properties[i];
}
}
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.