Search in sources :

Example 1 with LookupValue

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

the class Process method renderOption.

//	startFinReport
private static void renderOption(LookupValues lvs, java.util.Hashtable assoc, String idx) {
    Object ob = assoc.get(idx);
    if (ob == null)
        return;
    LookupValue lv = lvs.addNewLv();
    // o.setValue(idx);
    lv.setKey(idx);
    lv.setVal(ob.toString());
}
Also used : LookupValue(pl.x3E.adInterface.LookupValue)

Example 2 with LookupValue

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

the class ADServiceImpl method getCountry.

private LookupValues getCountry(MLocation location) {
    MCountry[] countries = MCountry.getCountries(location.getCtx());
    int comp = location.getC_Country_ID();
    if (comp == 0)
        comp = Env.getContextAsInt(m_cs.getM_ctx(), "C_Country_ID");
    LookupValues lvs = LookupValues.Factory.newInstance();
    for (int i = 0; i < countries.length; i++) {
        LookupValue lv = lvs.addNewLv();
        lv.setKey(String.valueOf(countries[i].getC_Country_ID()));
        lv.setVal(countries[i].getName());
    }
    return lvs;
}
Also used : MCountry(org.compiere.model.MCountry) LookupValues(pl.x3E.adInterface.LookupValues) LookupValue(pl.x3E.adInterface.LookupValue)

Example 3 with LookupValue

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

the class ADServiceImpl method login.

public ADLoginResponseDocument login(ADLoginRequestDocument req) throws XFireFault {
    authenticate(webServiceName, "login");
    // TODO: Implement security layer
    log.log(Level.SEVERE, "Warning: Security layer not implemented yet - opening web service " + webServiceName + " implies a security risk for server");
    ADLoginResponseDocument res = ADLoginResponseDocument.Factory.newInstance();
    ADLoginResponse lr = res.addNewADLoginResponse();
    ADLoginRequest r = req.getADLoginRequest();
    if (// initial phase - return possible translations
    r.getStage() == 0) {
        LookupValues langs = lr.addNewLangs();
        for (int i = 0; i < Language.getLanguageCount(); i++) {
            Language language = Language.getLanguage(i);
            LookupValue lv = langs.addNewLv();
            lv.setKey(language.getAD_Language());
            lv.setVal(language.getName());
        }
    } else if (// Verify user and pass
    r.getStage() == 1) {
        KeyNamePair[] roles = null;
        KeyNamePair[] clients = null;
        KeyNamePair[] orgs = null;
        KeyNamePair[] warehouses = null;
        Login login = new Login(m_cs.getM_ctx());
        roles = login.getRoles(r.getUser(), r.getPass());
        if (roles == null) {
            lr.setStatus(-1);
            return res;
        } else {
            if (r.getRoleID() == -1 && roles != null && roles.length > 0)
                r.setRoleID(Integer.parseInt(roles[0].getID()));
            if (r.getRoleID() > -1)
                clients = login.getClients(new KeyNamePair(r.getRoleID(), ""));
            if (r.getClientID() == -1 && clients != null && clients.length > 0)
                r.setClientID(Integer.parseInt(clients[0].getID()));
            if (r.getClientID() > -1)
                orgs = login.getOrgs(new KeyNamePair(r.getClientID(), ""));
            if (r.getOrgID() == -1 && orgs != null && orgs.length > 0)
                r.setOrgID(Integer.parseInt(orgs[0].getID()));
            if (r.getOrgID() > -1)
                warehouses = login.getWarehouses(new KeyNamePair(r.getOrgID(), ""));
            ADLookup.fillLookupValues(lr.addNewRoles(), roles);
            ADLookup.fillLookupValues(lr.addNewClients(), clients);
            ADLookup.fillLookupValues(lr.addNewOrgs(), orgs);
            ADLookup.fillLookupValues(lr.addNewWarehouses(), warehouses);
        }
    } else if (// Verify user and pass
    r.getStage() == 2) {
        Login login = new Login(m_cs.getM_ctx());
        KeyNamePair[] roles = login.getRoles(r.getUser(), r.getPass());
        if (roles != null) {
            KeyNamePair org = new KeyNamePair(r.getRoleID(), Integer.toString(r.getRoleID()));
            String error = login.validateLogin(org);
            if (error != null && error.length() > 0) {
                lr.setStatus(-1);
                return res;
            }
            int AD_User_ID = Env.getAD_User_ID(m_cs.getM_ctx());
            if (!m_cs.login(AD_User_ID, r.getRoleID(), r.getClientID(), r.getOrgID(), r.getWarehouseID(), r.getLang())) {
                lr.setStatus(-1);
                return res;
            }
        } else {
            lr.setStatus(-1);
            return res;
        }
    }
    return res;
}
Also used : ADLoginRequest(pl.x3E.adInterface.ADLoginRequest) ADLoginResponseDocument(pl.x3E.adInterface.ADLoginResponseDocument) Language(org.compiere.util.Language) LookupValues(pl.x3E.adInterface.LookupValues) Login(org.compiere.util.Login) KeyNamePair(org.compiere.util.KeyNamePair) ADLoginResponse(pl.x3E.adInterface.ADLoginResponse) LookupValue(pl.x3E.adInterface.LookupValue)

Example 4 with LookupValue

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

the class ADServiceImpl method fillField.

private void fillField(Field f, GridFieldVO fo) {
    ////(griddieldvo) adempiere specific
    f.setADColumnID(fo.AD_Column_ID);
    f.setADProcessID(fo.AD_Process_ID);
    f.setADReferenceValueID(fo.AD_Reference_Value_ID);
    f.setADWindowID(fo.AD_Window_ID);
    f.setCallout(fo.Callout);
    f.setColumnName(fo.ColumnName);
    f.setDefaultValue(fo.DefaultValue);
    f.setDefaultValue2(fo.DefaultValue2);
    f.setDescription(fo.Description);
    f.setDisplayLength(fo.DisplayLength);
    f.setDisplayLogic(fo.DisplayLogic);
    f.setDisplayType(fo.displayType);
    f.setFieldGroup(fo.FieldGroup);
    f.setFieldLength(fo.FieldLength);
    f.setHeader(fo.Header);
    f.setHelp(fo.Help);
    f.setIsAlwaysUpdateable(fo.IsAlwaysUpdateable);
    f.setIsDisplayed(fo.IsDisplayed);
    f.setIsEncryptedColumn(fo.IsEncryptedColumn);
    f.setIsEncryptedField(fo.IsEncryptedField);
    f.setIsFieldOnly(fo.IsFieldOnly);
    f.setIsHeading(fo.IsHeading);
    f.setIsKey(fo.IsKey);
    f.setIsMandatory(fo.IsMandatory);
    f.setIsParent(fo.IsParent);
    f.setIsProcess(fo.isProcess);
    f.setIsRange(fo.IsRange);
    f.setIsReadOnly(fo.IsReadOnly);
    f.setIsSameLine(fo.IsSameLine);
    f.setIsSelectionColumn(fo.IsSelectionColumn);
    f.setIsUpdateable(fo.IsUpdateable);
    if (DisplayType.isLookup(fo.displayType)) {
        GridField ff = new GridField(fo);
        ArrayList<String> deps = ff.getDependentOn();
        Lookup lookup = ff.getLookup();
        LookupInfo li = f.addNewLookupInfo();
        if (fo.lookupInfo != null) {
            li.setZoomWindow(fo.lookupInfo.ZoomWindow);
            li.setZoomWindow(fo.lookupInfo.ZoomWindow);
        }
        //if (deps.size()==0)
        if (lookup != null && (fo.ValidationCode == null || (fo.ValidationCode != null && fo.ValidationCode.length() == 0))) {
            LookupValues lvs = f.addNewLookup();
            //System.out.println( "lookup "+fo.ColumnName+" "+lookup.getSize() );
            //if(lookup.size() == 0) - nie robic tego
            //	System.out.println("lookup refresh ["+fo.ColumnName+"]= "+lookup.refresh());
            /*if(lookup.getSize() > 0)*/
            // the last was false, 2007-05-11
            ArrayList ar = lookup.getData(ff.isMandatory(false), true, !ff.isReadOnly(), true);
            if (ar != null && ar.size() > 0) {
                Object[] list = ar.toArray();
                for (int i = 0; i < list.length; i++) {
                    boolean isNumber = list[0] instanceof KeyNamePair;
                    LookupValue lv = lvs.addNewLv();
                    if (isNumber) {
                        KeyNamePair p = (KeyNamePair) list[i];
                        lv.setKey(Integer.toString(p.getKey()));
                        lv.setVal(p.getName());
                    //System.out.println( "LV " + p.getKey() + " - "+ p.getName() );						
                    } else {
                        ValueNamePair p = (ValueNamePair) list[i];
                        lv.setKey(p.getValue());
                        lv.setVal(p.getName());
                    //System.out.println( "LV " + p.getValue() + " - "+ p.getName());
                    }
                }
            }
        }
    }
}
Also used : LookupInfo(pl.x3E.adInterface.LookupInfo) ArrayList(java.util.ArrayList) GridField(org.compiere.model.GridField) Lookup(org.compiere.model.Lookup) MLookup(org.compiere.model.MLookup) LookupValues(pl.x3E.adInterface.LookupValues) KeyNamePair(org.compiere.util.KeyNamePair) ValueNamePair(org.compiere.util.ValueNamePair) LookupValue(pl.x3E.adInterface.LookupValue)

Example 5 with LookupValue

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

the class ADServiceImpl method getRegion.

private LookupValues getRegion(MLocation location) {
    MRegion[] regions = MRegion.getRegions(location.getCtx(), location.getC_Country_ID());
    int comp = location.getC_Region_ID();
    if (comp == 0)
        comp = Env.getContextAsInt(m_cs.getM_ctx(), "C_Region_ID");
    LookupValues lvs = LookupValues.Factory.newInstance();
    for (int i = 0; i < regions.length; i++) {
        LookupValue lv = lvs.addNewLv();
        lv.setKey(String.valueOf(regions[i].getC_Region_ID()));
        lv.setVal(regions[i].getName());
    }
    return lvs;
}
Also used : LookupValues(pl.x3E.adInterface.LookupValues) MRegion(org.compiere.model.MRegion) LookupValue(pl.x3E.adInterface.LookupValue)

Aggregations

LookupValue (pl.x3E.adInterface.LookupValue)6 LookupValues (pl.x3E.adInterface.LookupValues)4 KeyNamePair (org.compiere.util.KeyNamePair)3 ValueNamePair (org.compiere.util.ValueNamePair)2 ArrayList (java.util.ArrayList)1 GridField (org.compiere.model.GridField)1 Lookup (org.compiere.model.Lookup)1 MCountry (org.compiere.model.MCountry)1 MLookup (org.compiere.model.MLookup)1 MRegion (org.compiere.model.MRegion)1 Language (org.compiere.util.Language)1 Login (org.compiere.util.Login)1 ADLoginRequest (pl.x3E.adInterface.ADLoginRequest)1 ADLoginResponse (pl.x3E.adInterface.ADLoginResponse)1 ADLoginResponseDocument (pl.x3E.adInterface.ADLoginResponseDocument)1 LookupInfo (pl.x3E.adInterface.LookupInfo)1