use of pl.x3E.adInterface.DataRow in project adempiere by adempiere.
the class ADServiceImpl method addNewDataRow.
// getFieldValue
public WindowTabDataDocument addNewDataRow(int WindowNo, int TabNo) throws XFireFault {
authenticate(webServiceName, "addNewDataRow");
WindowTabDataDocument ret = WindowTabDataDocument.Factory.newInstance();
WindowTabData wd = ret.addNewWindowTabData();
DataSet ds = wd.addNewDataSet();
WWindowStatus ws = WWindowStatus.get(WindowStatusMap, WindowNo, true, TabNo, false, 0);
if (ws != null) {
if (ws.curTab.dataNew(false)) {
//ws.curTab.setSingleRow(true);
wd.setSuccess(true);
DataRow dr = ds.addNewDataRow();
fillDataRow(dr, ws, true, false);
updateRecIDMap(ws);
System.out.println("New Row no = " + ws.curTab.getCurrentRow());
} else {
ws.curTab.dataIgnore();
wd.setSuccess(false);
}
}
return ret;
}
use of pl.x3E.adInterface.DataRow in project adempiere by adempiere.
the class ADServiceImpl method saveDataRow.
public WindowTabDataDocument saveDataRow(int WindowNo, int TabNo, int RowNo, WindowTabDataDocument data) throws XFireFault {
authenticate(webServiceName, "saveDataRow");
WindowTabDataDocument ret = WindowTabDataDocument.Factory.newInstance();
WindowTabData wd = ret.addNewWindowTabData();
DataSet ds = wd.addNewDataSet();
DataRow ret_dr = ds.addNewDataRow();
WWindowStatus ws = WWindowStatus.get(WindowStatusMap, WindowNo, false, 0, true, RowNo);
if (ws != null) {
DataRow[] dr = data.getWindowTabData().getDataSet().getDataRowArray();
if (dr.length == 1) {
DataRow dr0 = dr[0];
boolean error = updateFields(ws, dr0);
DataField[] f = dr0.getFieldArray();
HashMap fmap = new HashMap();
for (int i = 0; i < f.length; i++) fmap.put(f[i].getColumn(), f[i].getVal());
// Check Mandatory
int size = ws.curTab.getFieldCount();
for (int i = 0; i < size; i++) {
GridField field = ws.curTab.getField(i);
if (// context check
field.isMandatory(true)) {
Object value = new Object();
//jesli tak nie zrobimy, mozemy stracic wartosc
if (field.getValue() == null && fmap.get(field.getColumnName()) != null)
//field.getValue();
value = fmap.get(field.getColumnName());
else
value = field.getValue();
if ((value == null || value.toString().length() == 0)) {
// set editable otherwise deadlock
field.setInserting(true);
field.setError(true);
field.setErrorValue(value == null ? null : value.toString());
if (!error)
error = true;
System.out.println("Mandatory Error: " + field.getColumnName());
//log.info("Mandatory Error: " + field.getColumnName());
} else
field.setError(false);
}
}
// save it - of errors ignore changes
wd.setSuccess(ws.curTab.dataSave(true));
//ws.curTab.dataIgnore();
;
//else
// fillDataRow( ret_dr, ws, true);
fillDataRow(ret_dr, ws, true, false);
if (ws.ads.m_is_error) {
wd.setError(ws.ads.m_error_message);
wd.setErrorInfo(ws.ads.m_error_info);
} else {
updateRecIDMap(ws);
}
wd.setStatus(ws.ads.m_status_data);
wd.setStatusError(ws.ads.m_is_status_error);
ws.m_needSave = false;
//log.fine("done");
}
}
return ret;
}
Aggregations