Search in sources :

Example 11 with WindowTabDataDocument

use of pl.x3E.adInterface.WindowTabDataDocument 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;
}
Also used : WindowTabDataDocument(pl.x3E.adInterface.WindowTabDataDocument) DataSet(pl.x3E.adInterface.DataSet) WindowTabData(pl.x3E.adInterface.WindowTabData) DataRow(pl.x3E.adInterface.DataRow)

Example 12 with WindowTabDataDocument

use of pl.x3E.adInterface.WindowTabDataDocument 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;
}
Also used : WindowTabDataDocument(pl.x3E.adInterface.WindowTabDataDocument) DataField(pl.x3E.adInterface.DataField) DataSet(pl.x3E.adInterface.DataSet) WindowTabData(pl.x3E.adInterface.WindowTabData) GetLookupSearchDataReq(pl.x3E.adInterface.GetLookupSearchDataReq)

Example 13 with WindowTabDataDocument

use of pl.x3E.adInterface.WindowTabDataDocument 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;
}
Also used : DataSet(pl.x3E.adInterface.DataSet) HashMap(java.util.HashMap) WindowTabData(pl.x3E.adInterface.WindowTabData) GridField(org.compiere.model.GridField) DataRow(pl.x3E.adInterface.DataRow) WindowTabDataDocument(pl.x3E.adInterface.WindowTabDataDocument) DataField(pl.x3E.adInterface.DataField)

Aggregations

DataSet (pl.x3E.adInterface.DataSet)13 WindowTabData (pl.x3E.adInterface.WindowTabData)13 WindowTabDataDocument (pl.x3E.adInterface.WindowTabDataDocument)13 DataRow (pl.x3E.adInterface.DataRow)12 DataField (pl.x3E.adInterface.DataField)6 Properties (java.util.Properties)3 QName (javax.xml.namespace.QName)3 XFireFault (org.codehaus.xfire.fault.XFireFault)3 GridField (org.compiere.model.GridField)3 MTable (org.compiere.model.MTable)3 ADLoginRequest (pl.x3E.adInterface.ADLoginRequest)3 SQLException (java.sql.SQLException)2 ArrayList (java.util.ArrayList)2 MLookup (org.compiere.model.MLookup)2 MRole (org.compiere.model.MRole)2 PO (org.compiere.model.PO)2 POInfo (org.compiere.model.POInfo)2 ModelCRUD (pl.x3E.adInterface.ModelCRUD)2 ModelGetList (pl.x3E.adInterface.ModelGetList)2 BigDecimal (java.math.BigDecimal)1