Search in sources :

Example 6 with DataField

use of pl.x3E.adInterface.DataField in project adempiere by adempiere.

the class InfoProduct method setupParamsFromDataRow.

void setupParamsFromDataRow() {
    for (int i = 0; i < params.sizeOfFieldArray(); i++) {
        DataField f = params.getFieldArray(i);
        System.out.println(f.getColumn() + " - '" + f.getVal() + "'");
        if ("value".equalsIgnoreCase(f.getColumn()))
            fieldValue = f.getVal();
        if ("name".equalsIgnoreCase(f.getColumn()))
            fieldName = f.getVal();
        if ("name".equalsIgnoreCase(f.getColumn()))
            fieldName = f.getVal();
        if ("upc".equalsIgnoreCase(f.getColumn()))
            fieldUPC = f.getVal();
        if ("upc".equalsIgnoreCase(f.getColumn()))
            fieldUPC = f.getVal();
        if ("sku".equalsIgnoreCase(f.getColumn()))
            fieldSKU = f.getVal();
        if ("M_PriceList_Version_ID".equalsIgnoreCase(f.getColumn()))
            M_PriceList_Version_ID = Integer.parseInt(f.getVal());
        if ("M_Warehouse_ID".equalsIgnoreCase(f.getColumn()))
            M_Warehouse_ID = Integer.parseInt(f.getVal());
    }
}
Also used : DataField(pl.x3E.adInterface.DataField)

Example 7 with DataField

use of pl.x3E.adInterface.DataField in project adempiere by adempiere.

the class InfoProduct method getColumns.

public DataRow getColumns() {
    DataRow col = DataRow.Factory.newInstance();
    DataField f = null;
    //0
    f = col.addNewField();
    f.setType("int");
    f.setLval("20, 0");
    f.setColumn("key");
    //1
    f = col.addNewField();
    f.setType("string");
    f.setLval("1, 15");
    f.setColumn("Discontinued");
    //2
    f = col.addNewField();
    f.setType("string");
    f.setLval("40, 110");
    f.setColumn("Value");
    //3
    f = col.addNewField();
    f.setType("string");
    f.setLval("60, 140");
    f.setColumn("Name");
    //4
    f = col.addNewField();
    f.setType("string");
    f.setLval("10, 50");
    f.setColumn("QtyAvailable");
    //5
    f = col.addNewField();
    f.setType("string");
    f.setLval("10, 50");
    f.setColumn("PriceList");
    //6
    f = col.addNewField();
    f.setType("string");
    f.setLval("10, 50");
    f.setColumn("PriceStd");
    //7
    f = col.addNewField();
    f.setType("string");
    f.setLval("10, 50");
    f.setColumn("QtyOnHand");
    //8
    f = col.addNewField();
    f.setType("string");
    f.setLval("10, 50");
    f.setColumn("QtyReserved");
    //9
    f = col.addNewField();
    f.setType("string");
    f.setLval("10, 50");
    f.setColumn("QtyOrdered");
    //10
    f = col.addNewField();
    f.setType("string");
    f.setLval("10, 50");
    f.setColumn("Margin");
    //10
    f = col.addNewField();
    f.setType("string");
    f.setLval("10, 50");
    f.setColumn("PriceLimit");
    //10
    f = col.addNewField();
    f.setType("string");
    f.setLval("1, 20");
    f.setColumn("IsInstanceAttribute");
    return col;
}
Also used : DataField(pl.x3E.adInterface.DataField) DataRow(pl.x3E.adInterface.DataRow)

Example 8 with DataField

use of pl.x3E.adInterface.DataField 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;
}
Also used : ADLoginRequest(pl.x3E.adInterface.ADLoginRequest) StandardResponse(pl.x3E.adInterface.StandardResponse) Properties(java.util.Properties) XFireFault(org.codehaus.xfire.fault.XFireFault) DataRow(pl.x3E.adInterface.DataRow) StandardResponseDocument(pl.x3E.adInterface.StandardResponseDocument) POInfo(org.compiere.model.POInfo) MTable(org.compiere.model.MTable) DataField(pl.x3E.adInterface.DataField) ModelCRUD(pl.x3E.adInterface.ModelCRUD) Trx(org.compiere.util.Trx) PO(org.compiere.model.PO)

Example 9 with DataField

use of pl.x3E.adInterface.DataField in project adempiere by adempiere.

the class InfoBPartner method setupParamsFromDataRow.

void setupParamsFromDataRow() {
    for (int i = 0; i < params.sizeOfFieldArray(); i++) {
        DataField f = params.getFieldArray(i);
        System.out.println(f.getColumn() + " - '" + f.getVal() + "'");
        if ("value".equalsIgnoreCase(f.getColumn()))
            fieldValue = f.getVal();
        if ("name".equalsIgnoreCase(f.getColumn()))
            fieldName = f.getVal();
        if ("contact".equalsIgnoreCase(f.getColumn()))
            fieldContact = f.getVal();
        if ("checkCustomer".equalsIgnoreCase(f.getColumn()))
            checkCustomer = "Y".equalsIgnoreCase(f.getVal());
        if ("checkAND".equalsIgnoreCase(f.getColumn()))
            checkAND = "Y".equalsIgnoreCase(f.getVal());
    }
}
Also used : DataField(pl.x3E.adInterface.DataField)

Example 10 with DataField

use of pl.x3E.adInterface.DataField in project adempiere by adempiere.

the class InfoBPartner method getColumns.

//  prepareTable
public DataRow getColumns() {
    DataRow col = DataRow.Factory.newInstance();
    DataField f = null;
    //0
    f = col.addNewField();
    f.setType("int");
    f.setColumn("key");
    f.setLval("20,0");
    //1
    f = col.addNewField();
    f.setType("string");
    f.setColumn("value");
    f.setLval("20,100");
    //2
    f = col.addNewField();
    f.setType("string");
    f.setColumn("name");
    f.setLval("20, 140");
    //3
    f = col.addNewField();
    f.setType("string");
    f.setColumn("contact");
    f.setLval("20, 70");
    //4
    f = col.addNewField();
    f.setType("string");
    f.setColumn("SO_CreditAvailable");
    f.setLval("20, 50");
    //5
    f = col.addNewField();
    f.setType("string");
    f.setColumn("SO_CreditUsed");
    f.setLval("20, 40");
    //6
    f = col.addNewField();
    f.setType("string");
    f.setColumn("Phone");
    f.setLval("20,50");
    //7
    f = col.addNewField();
    f.setType("string");
    f.setColumn("Postal");
    f.setLval("20, 40");
    //8
    f = col.addNewField();
    f.setType("string");
    f.setColumn("City");
    f.setLval("20, 50");
    //9
    f = col.addNewField();
    f.setType("string");
    f.setColumn("TotalOpenBalance");
    f.setLval("10,50");
    //10
    f = col.addNewField();
    f.setType("string");
    f.setColumn("ActualLifetimeValue");
    f.setLval("10,50");
    return col;
}
Also used : DataField(pl.x3E.adInterface.DataField) DataRow(pl.x3E.adInterface.DataRow)

Aggregations

DataField (pl.x3E.adInterface.DataField)18 DataRow (pl.x3E.adInterface.DataRow)10 DataSet (pl.x3E.adInterface.DataSet)6 WindowTabData (pl.x3E.adInterface.WindowTabData)6 WindowTabDataDocument (pl.x3E.adInterface.WindowTabDataDocument)6 SQLException (java.sql.SQLException)5 Properties (java.util.Properties)5 XFireFault (org.codehaus.xfire.fault.XFireFault)5 MTable (org.compiere.model.MTable)5 ADLoginRequest (pl.x3E.adInterface.ADLoginRequest)5 GridField (org.compiere.model.GridField)4 PO (org.compiere.model.PO)4 POInfo (org.compiere.model.POInfo)4 ModelCRUD (pl.x3E.adInterface.ModelCRUD)4 PreparedStatement (java.sql.PreparedStatement)3 ResultSet (java.sql.ResultSet)3 QName (javax.xml.namespace.QName)3 Lookup (org.compiere.model.Lookup)3 BigDecimal (java.math.BigDecimal)2 ArrayList (java.util.ArrayList)2