use of com.qwest.mbeng.MbengException in project mdw-designer by CenturyLinkCloud.
the class SwingFormGenerator method getValue.
private String getValue(MbengNode node) {
String value = null;
String dataassoc = node.getAttribute(FormConstants.FORMATTR_DATA);
MbengNode vnode = dataassoc == null ? null : dataxml.getNode(dataassoc);
if (vnode != null)
value = vnode.getValue();
else
value = null;
if (value == null || value.length() == 0) {
String av = node.getAttribute(FormConstants.FORMATTR_AUTOVALUE);
if (av != null && av.length() > 0) {
// String rulename = node.getAttribute(FormConstants.FORMATTR_ID) + "_DEFAULT";
// try {
// value = this.evaluateExpression(rulename, av, dataxml);
// } catch (MbengException e) {
// // return null if data element is not there
// // rule syntax error should be detected at design time?
// value = null;
// }
// this makes it the same as JSF version
value = av;
try {
dataxml.setValue(dataassoc, value, FormDataDocument.KIND_FIELD);
} catch (MbengException e) {
}
}
}
return value;
}
use of com.qwest.mbeng.MbengException in project mdw-designer by CenturyLinkCloud.
the class DesignerDataAccess method getTaskInstances.
private List<TaskInstanceVO> getTaskInstances(ProcessVO process, ProcessInstanceVO processInstance, Long activityId, List<TaskInstanceVO> allTaskInstances) throws DataAccessException {
List<TaskInstanceVO> taskInstances = new ArrayList<>();
for (TaskInstanceVO taskInstance : allTaskInstances) {
String secondaryOwner = taskInstance.getSecondaryOwnerType();
if (OwnerType.DOCUMENT.equals(secondaryOwner) || "EXTERNAL_EVENT_INSTANCE".equals(secondaryOwner)) {
String formDataString = null;
if (OwnerType.DOCUMENT.equals(secondaryOwner))
formDataString = rtinfo.getDocument(taskInstance.getSecondaryOwnerId()).getContent();
else if ("EXTERNAL_EVENT_INSTANCE".equals(secondaryOwner))
formDataString = rtinfo.getExternalEventDetails(taskInstance.getSecondaryOwnerId());
FormDataDocument formDataDoc = new FormDataDocument();
try {
formDataDoc.load(formDataString);
for (ActivityInstanceVO activityInstance : processInstance.getActivityInstances(activityId)) {
if (activityInstance.getId().equals(formDataDoc.getActivityInstanceId()))
taskInstances.add(taskInstance);
}
} catch (MbengException ex) {
throw new DataAccessException(-1, ex.getMessage(), ex);
}
} else {
// task instance secondary owner is work transition instance
Long workTransInstId = taskInstance.getSecondaryOwnerId();
for (WorkTransitionInstanceVO transitionInstance : processInstance.getTransitions()) {
if (transitionInstance.getTransitionInstanceID().equals(workTransInstId)) {
Long transitionId = transitionInstance.getTransitionID();
WorkTransitionVO workTrans = process.getWorkTransition(transitionId);
if (workTrans == null && process.getSubProcesses() != null) {
for (ProcessVO subproc : process.getSubProcesses()) {
workTrans = subproc.getWorkTransition(transitionId);
if (workTrans != null)
break;
}
}
if (workTrans != null && workTrans.getToWorkId().equals(activityId))
taskInstances.add(taskInstance);
}
}
}
}
return taskInstances;
}
use of com.qwest.mbeng.MbengException in project mdw-designer by CenturyLinkCloud.
the class JTablePlus method performSorting.
private void performSorting(ActionEvent e) {
int columnIndex = e.getID();
boolean descending = columnIndex < 0;
if (columnIndex < 0)
columnIndex = -columnIndex - 1;
else
columnIndex = columnIndex - 1;
if (!model.isColumnSortable(columnIndex)) {
e.setSource(null);
return;
}
String sorton = getColumnName(columnIndex);
if (sorton == null)
return;
if (descending)
sorton = "-" + sorton;
MbengNode metanode = datadoc.getNode(datapath + "_META");
try {
if (metanode != null)
datadoc.setValue(metanode, "sort_on", sorton);
} catch (MbengException e1) {
}
String action = paginator + "?action=paging&table=" + datapath + "&meta=" + datapath + "_META&topage=S&sorton=" + sorton;
call_engine(action);
}
use of com.qwest.mbeng.MbengException in project mdw-designer by CenturyLinkCloud.
the class JTablePlus method setData.
public void setData(FormDataDocument dataxml, String datapath) {
this.datadoc = dataxml;
this.datapath = datapath;
MbengNode datanode = dataxml.getNode(datapath);
MbengNode metanode = dataxml.getNode(datapath + "_META");
model.setData(datanode);
if (metanode != null) {
String sorton = datadoc.getValue(metanode, "sort_on");
if (sorton != null) {
boolean descending = sorton.startsWith("-");
if (descending)
sorton = sorton.substring(1);
setSortingStatus(sorton, descending);
}
String selected_str = datadoc.getValue(metanode, "selected");
if (!StringHelper.isEmpty(selected_str)) {
String[] rows_str = selected_str.split(",");
int firstRow = Integer.parseInt(rows_str[0]);
try {
if (model.getRowCount() > firstRow) {
table.setRowSelectionInterval(firstRow, firstRow);
datadoc.setValue(metanode, "selected", rows_str[0]);
} else
datadoc.setValue(metanode, "selected", null);
} catch (MbengException e) {
}
}
if (rowrange != null) {
int nrows = model.getRowCount();
if (nrows == 0) {
rowrange.setText("No rows");
button_first.setEnabled(false);
button_prev.setEnabled(false);
button_next.setEnabled(false);
button_last.setEnabled(false);
button_goto.setEnabled(false);
} else {
String v = datadoc.getValue(metanode, "start_row");
int start_row = v == null ? 1 : Integer.parseInt(v);
v = datadoc.getValue(metanode, "total_rows");
int total_rows = v == null ? nrows : Integer.parseInt(v);
rowrange.setText("" + start_row + " - " + (start_row + nrows - 1) + " of " + total_rows);
button_first.setEnabled(start_row > 1);
button_prev.setEnabled(start_row > 1);
button_next.setEnabled(start_row + nrows - 1 < total_rows);
button_last.setEnabled(start_row + nrows - 1 < total_rows);
button_goto.setEnabled(nrows < total_rows);
}
}
}
// for some reason w/o the following, layout was not done and screen shows blank until resized
super.doLayout();
for (int k = this.getComponentCount(); k > 0; k--) {
Component comp = this.getComponent(k - 1);
if (comp instanceof Container)
((Container) comp).doLayout();
}
}
Aggregations