use of pl.x3E.adInterface.DataSet 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.DataSet in project adempiere by adempiere.
the class ADServiceImpl method getLookupSearchData.
public WindowTabDataDocument getLookupSearchData(GetLookupSearchDataReqDocument req) throws XFireFault {
//int WindowNo, int TabNo, int RowNo, DataRow dr
authenticate(webServiceName, "getLookupSearchData");
GetLookupSearchDataReq reqt = req.getGetLookupSearchDataReq();
DataField[] df = reqt.getParams().getFieldArray();
for (int i = 0; i < df.length; i++) {
if (df[i].getVal() != null && df[i].getVal().length() > 0)
log.info("LookUp COlumn: " + df[i].getColumn() + " " + df[i].getVal());
}
WindowTabDataDocument ret = WindowTabDataDocument.Factory.newInstance();
WindowTabData wd = ret.addNewWindowTabData();
DataSet ds = wd.addNewDataSet();
int WindowNo = reqt.getWindowNo();
int TabNo = reqt.getTabNo();
int RowNo = reqt.getTabNo();
WWindowStatus ws = null;
if (WindowNo > 0)
//<-- Note changes to the active record (bledne action), probably are not properly communicated parameters
ws = WWindowStatus.get(WindowStatusMap, WindowNo, true, TabNo, true, RowNo);
if (ws != null) {
ADLookup lk = new ADLookup(df[0].getVal());
lk.getLookupSearchValues(reqt.getParams(), ds, ws.ctx, WindowNo);
} else {
ADLookup lk = new ADLookup(df[0].getVal());
lk.getLookupSearchValues(reqt.getParams(), ds, this.m_cs.getM_ctx(), 0);
}
return ret;
}
use of pl.x3E.adInterface.DataSet 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