Fork me on GitHub Fork me on GitHub


var dataStore = new MetadataStore("admin", "admin");
var resource = dataStore.newResource();
resource.content = "Hello Jaggery";
resource.addProperty("url", "");
resource.addProperty("company", "WSO2 Inc.");
dataStore.put("wso2products.xml", resource);
//now we read the resource again
var res = dataStore.get("wso2products.xml");

print("Company : "+res.getProperty("company"));
print("<br>URL : " +res.getProperty("url"));
print("<br>Content : "+res.content);


Store any type of data or metadata as resources including contracts, models, workflows, documents and more


Member Type Description
Returns the author username on a resource
lastUpdatedUserStringget author username who did the last update on a resource
lastUpdatedTimescriptableget lastUpdatedTime
createdTimescriptableget createdTime
idStringget id of the resource.
pathStringget path of the resource
parentPathStringget parentPath
permanentPathStringget permanentPath
stateNumberget state
mediaTypeStringget/set mediaType
contentString | Object | XMLget/set content
descriptionStringget/set description


Operation Returns Description
addProperty("name", "value")None
var dataStore = new MetadataStore("admin", "admin");
var resource = dataStore.newResource();
resource.addProperty("company", "WSO2");

adding property for resource

getProperty(String propertyName);String
var value = resource.getProperty("company");
This method returns value of a property

Above code returns last added value for a property if there is a list of values.
getPropertyValues(String propertyName);String []
var value = resource.getPropertyValues("company");
This method returns list of values of a property
var properties = resource.getProperties();
This method returns the list of properties with 'name' and 'value'. value is list of a vlaue for particular property

editPropertyValue(String propertyName,String propertyValue,String propertyNewValue );None
 editPropertyValue("company","WSO2","WSO2 Inc"); 
This method will edit property value in to new value.
removePropertyValue(String propertyName,String propertyValue);None
 removePropertyValue("company","WSO2 Inc"); 
This method will remove property value in property.
removeProperty(String propertyName);None
This method will remove property from the resource.
setProperty(String propertyName, String propertyValue/Values);None
This method will set property values.