use of pl.x3E.adInterface.StandardResponse in project adempiere by adempiere.
the class ADServiceImpl method setDocAction.
public StandardResponseDocument setDocAction(int WindowNo, int TabNo, int RowNo, String ColName, String docAction) throws XFireFault {
authenticate(webServiceName, "setDocAction");
StandardResponseDocument ret = StandardResponseDocument.Factory.newInstance();
StandardResponse sr = ret.addNewStandardResponse();
WWindowStatus ws = WWindowStatus.get(WindowStatusMap, WindowNo, true, TabNo, true, RowNo);
if (ws != null) {
ws.curTab.setValue("DocAction", docAction);
boolean result = false;
if (//slain - do not dispose of error, if not write musiales
ws.curTab.needSave(true, false)) {
if (!(result = ws.curTab.dataSave(true)))
ws.curTab.dataIgnore();
}
sr.setIsError(!result);
} else
sr.setIsError(true);
return ret;
}
use of pl.x3E.adInterface.StandardResponse in project adempiere by adempiere.
the class ModelADServiceImpl method updateData.
public StandardResponseDocument updateData(ModelCRUDRequestDocument req) throws XFireFault {
StandardResponseDocument ret = StandardResponseDocument.Factory.newInstance();
StandardResponse resp = ret.addNewStandardResponse();
ModelCRUD modelCRUD = req.getModelCRUDRequest().getModelCRUD();
String serviceType = modelCRUD.getServiceType();
ADLoginRequest reqlogin = req.getModelCRUDRequest().getADLoginRequest();
String err = modelLogin(reqlogin, webServiceName, "updateData", serviceType);
if (err != null && err.length() > 0) {
resp.setError(err);
resp.setIsError(true);
return ret;
}
// Validate parameters vs service type
validateCRUD(modelCRUD);
String tableName = modelCRUD.getTableName();
int recordID = modelCRUD.getRecordID();
resp.setRecordID(recordID);
Properties ctx = m_cs.getM_ctx();
// start a trx
String trxName = Trx.createTrxName("ws_modelUpdateData");
Trx trx = Trx.get(trxName, false);
// get the PO for the tablename and record ID
MTable table = MTable.get(ctx, tableName);
if (table == null)
return rollbackAndSetError(trx, resp, ret, true, "No table " + tableName);
PO po = table.getPO(recordID, trxName);
if (po == null)
return rollbackAndSetError(trx, resp, ret, true, "No Record " + recordID + " in " + tableName);
POInfo poinfo = POInfo.getPOInfo(ctx, table.getAD_Table_ID());
DataRow dr = modelCRUD.getDataRow();
for (DataField field : dr.getFieldList()) {
// TODO: Implement lookup
if (m_webservicetype.isInputColumnNameAllowed(field.getColumn())) {
int idxcol = po.get_ColumnIndex(field.getColumn());
if (idxcol < 0) {
// The column doesn't exist - it must exist as it's defined in security
return rollbackAndSetError(trx, resp, ret, true, "Web service type " + m_webservicetype.getValue() + ": input column " + field.getColumn() + " does not exist");
} else {
try {
setValueAccordingToClass(po, poinfo, field, idxcol);
} catch (XFireFault e) {
log.log(Level.WARNING, "Error setting value", e);
return rollbackAndSetError(trx, resp, ret, true, "Web service type " + m_webservicetype.getValue() + ": input column " + field.getColumn() + " value could not be set: " + e.getLocalizedMessage());
}
}
} else {
return rollbackAndSetError(trx, resp, ret, true, "Web service type " + m_webservicetype.getValue() + ": input column " + field.getColumn() + " not allowed");
}
}
if (!po.save())
return rollbackAndSetError(trx, resp, ret, true, "Cannot save record in " + tableName + ": " + CLogger.retrieveErrorString("no log message"));
// close the trx
if (!trx.commit())
return rollbackAndSetError(trx, resp, ret, true, "Cannot commit transaction after delete record " + recordID + " in " + tableName);
trx.close();
return ret;
}
use of pl.x3E.adInterface.StandardResponse in project adempiere by adempiere.
the class ModelADServiceImpl method deleteData.
// getList
public StandardResponseDocument deleteData(ModelCRUDRequestDocument req) throws XFireFault {
StandardResponseDocument ret = StandardResponseDocument.Factory.newInstance();
StandardResponse resp = ret.addNewStandardResponse();
ModelCRUD modelCRUD = req.getModelCRUDRequest().getModelCRUD();
String serviceType = modelCRUD.getServiceType();
ADLoginRequest reqlogin = req.getModelCRUDRequest().getADLoginRequest();
String err = modelLogin(reqlogin, webServiceName, "deleteData", serviceType);
if (err != null && err.length() > 0) {
resp.setError(err);
resp.setIsError(true);
return ret;
}
// Validate parameters vs service type
validateCRUD(modelCRUD);
String tableName = modelCRUD.getTableName();
int recordID = modelCRUD.getRecordID();
resp.setRecordID(recordID);
Properties ctx = m_cs.getM_ctx();
// start a trx
String trxName = Trx.createTrxName("ws_modelDeleteData");
Trx trx = Trx.get(trxName, false);
// get the PO for the tablename and record ID
MTable table = MTable.get(ctx, tableName);
if (table == null)
return rollbackAndSetError(trx, resp, ret, true, "No table " + tableName);
PO po = table.getPO(recordID, trxName);
if (po == null)
return rollbackAndSetError(trx, resp, ret, true, "No Record " + recordID + " in " + tableName);
if (!po.delete(false))
return rollbackAndSetError(trx, resp, ret, true, "Cannot delete record " + recordID + " in " + tableName + ": " + CLogger.retrieveErrorString("no log message"));
// close the trx
if (!trx.commit())
return rollbackAndSetError(trx, resp, ret, true, "Cannot commit transaction after delete record " + recordID + " in " + tableName);
trx.close();
return ret;
}
use of pl.x3E.adInterface.StandardResponse in project adempiere by adempiere.
the class ModelADServiceImpl method createData.
public StandardResponseDocument createData(ModelCRUDRequestDocument req) throws XFireFault {
StandardResponseDocument ret = StandardResponseDocument.Factory.newInstance();
StandardResponse resp = ret.addNewStandardResponse();
ModelCRUD modelCRUD = req.getModelCRUDRequest().getModelCRUD();
String serviceType = modelCRUD.getServiceType();
ADLoginRequest reqlogin = req.getModelCRUDRequest().getADLoginRequest();
String err = modelLogin(reqlogin, webServiceName, "createData", serviceType);
if (err != null && err.length() > 0) {
resp.setError(err);
resp.setIsError(true);
return ret;
}
// Validate parameters vs service type
validateCRUD(modelCRUD);
String tableName = modelCRUD.getTableName();
Properties ctx = m_cs.getM_ctx();
// start a trx
String trxName = Trx.createTrxName("ws_modelCreateData");
Trx trx = Trx.get(trxName, false);
// get the PO for the tablename and record ID
MTable table = MTable.get(ctx, tableName);
if (table == null)
return rollbackAndSetError(trx, resp, ret, true, "No table " + tableName);
PO po = table.getPO(0, trxName);
if (po == null)
return rollbackAndSetError(trx, resp, ret, true, "Cannot create PO for " + tableName);
POInfo poinfo = POInfo.getPOInfo(ctx, table.getAD_Table_ID());
DataRow dr = modelCRUD.getDataRow();
for (DataField field : dr.getFieldList()) {
// TODO: Implement lookup
if (m_webservicetype.isInputColumnNameAllowed(field.getColumn())) {
int idxcol = po.get_ColumnIndex(field.getColumn());
if (idxcol < 0) {
// The column doesn't exist - it must exist as it's defined in security
return rollbackAndSetError(trx, resp, ret, true, "Web service type " + m_webservicetype.getValue() + ": input column " + field.getColumn() + " does not exist");
} else {
try {
setValueAccordingToClass(po, poinfo, field, idxcol);
} catch (XFireFault e) {
log.log(Level.WARNING, "Error setting value", e);
return rollbackAndSetError(trx, resp, ret, true, "Web service type " + m_webservicetype.getValue() + ": input column " + field.getColumn() + " value could not be set: " + e.getLocalizedMessage());
}
}
} else {
return rollbackAndSetError(trx, resp, ret, true, "Web service type " + m_webservicetype.getValue() + ": input column " + field.getColumn() + " not allowed");
}
}
if (!po.save())
return rollbackAndSetError(trx, resp, ret, true, "Cannot save record in " + tableName + ": " + CLogger.retrieveErrorString("no log message"));
int recordID = po.get_ID();
resp.setRecordID(recordID);
// close the trx
if (!trx.commit())
return rollbackAndSetError(trx, resp, ret, true, "Cannot commit transaction after create record " + recordID + " in " + tableName);
trx.close();
return ret;
}
use of pl.x3E.adInterface.StandardResponse in project adempiere by adempiere.
the class ModelADServiceImpl method setDocAction.
/*
* Model oriented web service to change DocAction for documents, i.e. Complete a Material Receipt
* WARNING!!! This web service complete documents not via workflow, so it jump over any approval step considered in document workflow
* To complete documents using workflow it's better to use the runProcess web service
*/
public StandardResponseDocument setDocAction(ModelSetDocActionRequestDocument req) throws XFireFault {
StandardResponseDocument ret = StandardResponseDocument.Factory.newInstance();
StandardResponse resp = ret.addNewStandardResponse();
ModelSetDocAction modelSetDocAction = req.getModelSetDocActionRequest().getModelSetDocAction();
String serviceType = modelSetDocAction.getServiceType();
ADLoginRequest reqlogin = req.getModelSetDocActionRequest().getADLoginRequest();
String err = modelLogin(reqlogin, webServiceName, "setDocAction", serviceType);
if (err != null && err.length() > 0) {
resp.setError(err);
resp.setIsError(true);
return ret;
}
Properties ctx = m_cs.getM_ctx();
// Validate parameters
modelSetDocAction.setTableName(validateParameter("tableName", modelSetDocAction.getTableName()));
modelSetDocAction.setRecordID(validateParameter("recordID", modelSetDocAction.getRecordID()));
modelSetDocAction.setDocAction(validateParameter("docAction", modelSetDocAction.getDocAction()));
String tableName = modelSetDocAction.getTableName();
int recordID = modelSetDocAction.getRecordID();
String docAction = modelSetDocAction.getDocAction();
resp.setRecordID(recordID);
// start a trx
String trxName = Trx.createTrxName("ws_modelSetDocAction");
Trx trx = Trx.get(trxName, false);
// get the PO for the tablename and record ID
MTable table = MTable.get(ctx, tableName);
if (table == null)
return rollbackAndSetError(trx, resp, ret, true, "No table " + tableName);
PO po = table.getPO(recordID, trxName);
if (po == null)
return rollbackAndSetError(trx, resp, ret, true, "No Record " + recordID + " in " + tableName);
// set explicitly the column DocAction to avoid automatic process of default option
po.set_ValueOfColumn("DocAction", docAction);
if (!po.save())
return rollbackAndSetError(trx, resp, ret, true, "Cannot save before set docAction: " + CLogger.retrieveErrorString("no log message"));
// call process it
try {
if (!((org.compiere.process.DocAction) po).processIt(docAction))
return rollbackAndSetError(trx, resp, ret, true, "Couldn't set docAction: " + ((org.compiere.process.DocAction) po).getProcessMsg());
} catch (Exception e) {
return rollbackAndSetError(trx, resp, ret, true, e.toString());
}
// close the trx
if (!po.save())
return rollbackAndSetError(trx, resp, ret, true, "Cannot save after set docAction: " + CLogger.retrieveErrorString("no log message"));
if (!trx.commit())
return rollbackAndSetError(trx, resp, ret, true, "Cannot commit after docAction");
trx.close();
// resp.setError("");
resp.setIsError(false);
return ret;
}
Aggregations