use of org.eclipse.sapphire.modeling.xml.XmlResource in project liferay-ide by liferay.
the class WorkflowMetadataBindingImpl method readUnderlyingObject.
@Override
protected Object readUnderlyingObject() {
WorkflowNodeMetadataObject metadataObject = null;
Element element = property().element();
Resource resource = element.resource();
XmlResource xmlResource = resource.adapt(XmlResource.class);
XmlElement xmlElement = xmlResource.getXmlElement();
XmlElement metadataElement = xmlElement.getChildElement("metadata", false);
if (metadataElement != null) {
String metadata = metadataElement.getChildNodeText("");
if (!CoreUtil.empty(metadata)) {
metadataObject = new WorkflowNodeMetadataObject(metadata.trim());
}
}
if (metadataObject == null) {
metadataObject = new WorkflowNodeMetadataObject();
}
if (!metadataObject.equals(_underlyingObject)) {
_underlyingObject = metadataObject;
}
return _underlyingObject;
}
use of org.eclipse.sapphire.modeling.xml.XmlResource in project liferay-ide by liferay.
the class WorkflowMetadataBindingImpl method createResource.
@Override
protected Resource createResource(Object obj) {
Element element = property().element();
Resource resource = element.resource();
XmlResource xmlResource = resource.adapt(XmlResource.class);
return new WorkflowNodeMetadataResource((WorkflowNodeMetadataObject) obj, xmlResource);
}
use of org.eclipse.sapphire.modeling.xml.XmlResource in project liferay-ide by liferay.
the class WorkflowNodeMetadataResource method saveMetadata.
public void saveMetadata() {
XmlResource xmlResource = parent().adapt(XmlResource.class);
XmlElement xmlElement = xmlResource.getXmlElement();
XmlElement metadataElement = xmlElement.getChildElement("metadata", true);
Element domElement = metadataElement.getDomNode();
try {
Document document = domElement.getOwnerDocument();
CDATASection cdata = document.createCDATASection(this._metadata.toJSONString());
CoreUtil.removeChildren(domElement);
domElement.insertBefore(cdata, null);
} catch (JSONException jsone) {
KaleoCore.logError(jsone);
}
}
Aggregations