use of com.qwest.mbeng.DomDocument in project mdw-designer by CenturyLinkCloud.
the class DesignerDataAccess method updateVariableInstanceThruServer.
public void updateVariableInstanceThruServer(VariableInstanceInfo var, String value, boolean isDocument) throws RemoteException, DataAccessException {
if (this.dbSchemaVersion < 5000 && isDocument) {
// temporary work-around by updating database directly
// need to enhance 4.5 code to handle document variables
DocumentReference docref = new DocumentReference(var.getStringValue());
rtinfo.updateDocumentContent(docref.getDocumentId(), value);
} else {
DomDocument domdoc = new DomDocument();
FormatDom fmter = new FormatDom();
domdoc.getRootNode().setName("_mdw_update_variable");
MbengNode node = domdoc.newNode("var_value", value, "", ' ');
domdoc.getRootNode().appendChild(node);
if (var.getInstanceId() == null) {
node = domdoc.newNode("var_name", var.getName(), "", ' ');
domdoc.getRootNode().appendChild(node);
node = domdoc.newNode("proc_inst_id", var.getStringValue(), "", ' ');
domdoc.getRootNode().appendChild(node);
String res = this.engineCall(fmter.format(domdoc));
if (res.startsWith("OK:")) {
String[] vs = res.split(":");
var.setInstanceId(new Long(vs[1]));
if (vs.length == 3) {
DocumentReference docref = new DocumentReference(new Long(vs[2]), null);
var.setStringValue(docref.toString());
}
} else
throw new DataAccessException(res);
} else {
node = domdoc.newNode("var_inst_id", var.getInstanceId().toString(), "", ' ');
domdoc.getRootNode().appendChild(node);
String res = this.engineCall(fmter.format(domdoc));
if (!"OK".equals(res))
throw new DataAccessException(res);
}
}
auditLog(Action.Create, Entity.VariableInstance, var.getInstanceId(), var.getName());
}
use of com.qwest.mbeng.DomDocument in project mdw-designer by CenturyLinkCloud.
the class Graph method addNode.
private Node addNode(GraphCommon owner, ActivityImplementorVO nmi, int x, int y, boolean recordchange) {
String name = "New " + nmi.getLabel();
if (nmi.isManualTask()) {
if (owner instanceof SubGraph)
name = processVO.getProcessName() + " Fallout";
else
name = "New Task for " + processVO.getProcessName();
}
Long pActId = genNodeId();
String pDesc = null;
String pActImplClass = nmi.getImplementorClassName();
ArrayList<AttributeVO> pAttribs = new ArrayList<AttributeVO>();
if (nmi.isManualTask()) {
pAttribs.add(new AttributeVO(TaskActivity.ATTRIBUTE_TASK_NAME, name));
pAttribs.add(new AttributeVO(TaskActivity.ATTRIBUTE_TASK_CATEGORY, "COM"));
pAttribs.add(new AttributeVO(TaskActivity.ATTRIBUTE_TASK_VARIABLES, TaskVO.getVariablesAsString(processVO.getVariables(), null)));
}
ActivityVO nodet = new ActivityVO(pActId, name, pDesc, pActImplClass, pAttribs);
owner.getProcessVO().getActivities().add(nodet);
Node node = new Node(nodet, owner, metainfo);
String iconname = node.getIconName();
javax.swing.Icon icon = getIconFactory().getIcon(iconname);
if (nodestyle.equals(Node.NODE_STYLE_ICON)) {
node.w = icon.getIconWidth();
node.h = icon.getIconHeight();
} else {
if (icon instanceof ImageIcon) {
node.w = 100;
node.h = 60;
} else {
node.w = 60;
node.h = 40;
}
}
node.x = x;
node.y = y;
owner.nodes.add(node);
String xmldesc = nmi.getAttributeDescription();
if (xmldesc != null && xmldesc.length() > 0) {
FormatDom fmter = new FormatDom();
DomDocument doc = new DomDocument();
try {
fmter.load(doc, xmldesc);
MbengNode widget;
String default_value, attr_name;
for (widget = doc.getRootNode().getFirstChild(); widget != null; widget = widget.getNextSibling()) {
default_value = widget.getAttribute("DEFAULT");
if (default_value == null)
continue;
if (widget.getAttribute("UNITS_ATTR") != null)
continue;
attr_name = widget.getAttribute("NAME");
if (attr_name == null)
continue;
if (default_value.equals("$DefaultNotices")) {
node.setAttribute(attr_name, TaskVO.getDefaultNotices());
} else
node.setAttribute(attr_name, default_value);
}
} catch (MbengException e) {
}
}
if (recordchange)
node.getChanges().setChangeType(Changes.NEW);
setDirtyLevel(DIRTY);
return node;
}
use of com.qwest.mbeng.DomDocument in project mdw-designer by CenturyLinkCloud.
the class FormPanel method loadForm.
private DomDocument loadForm(String formname) throws Exception {
if (dao.isVcsPersist())
formname = formname + ".xml";
RuleSetVO ruleset = dao.getRuleSet(formname, RuleSetVO.FORM, 0);
String content;
if (ruleset == null) {
if (dao.isVcsPersist()) {
content = dao.getServerResourceRest(formname);
} else {
StringBuffer request = new StringBuffer();
request.append("<_mdw_get_resource>");
request.append("<name>").append(formname).append("</name>");
request.append("<language>").append(RuleSetVO.FORM).append("</language>");
request.append("</_mdw_get_resource>");
content = dao.engineCall(request.toString());
if (content.startsWith("ERROR:"))
throw new Exception("Failed to load form " + formname + " - " + content);
}
} else
content = ruleset.getRuleSet();
FormatDom fmter = new FormatDom();
DomDocument formdoc = new DomDocument();
fmter.load(formdoc, content);
return formdoc;
}
Aggregations