Search in sources :

Example 1 with MFormAccess

use of org.compiere.model.MFormAccess in project idempiere by idempiere.

the class FormAccessElementHandler method startElement.

public void startElement(PIPOContext ctx, Element element) throws SAXException {
    List<String> excludes = defaultExcludeList(X_AD_Form_Access.Table_Name);
    MFormAccess po = findPO(ctx, element);
    if (po == null) {
        po = new MFormAccess(ctx.ctx, 0, getTrxName(ctx));
    }
    PoFiller filler = new PoFiller(ctx, po, element, this);
    List<String> notfounds = filler.autoFill(excludes);
    if (notfounds.size() > 0) {
        element.defer = true;
        element.unresolved = notfounds.toString();
        return;
    }
    po.saveEx();
}
Also used : PoFiller(org.adempiere.pipo2.PoFiller) MFormAccess(org.compiere.model.MFormAccess)

Example 2 with MFormAccess

use of org.compiere.model.MFormAccess in project idempiere by idempiere.

the class FormAccessElementHandler method packOut.

@Override
public void packOut(PackOut packout, TransformerHandler packoutHandler, TransformerHandler docHandler, int recordId, String uuid) throws Exception {
    MFormAccess po = new Query(packout.getCtx().ctx, MFormAccess.Table_Name, "AD_Form_Access_UU=?", getTrxName(packout.getCtx())).setParameters(uuid).first();
    if (po != null) {
        Env.setContext(packout.getCtx().ctx, X_AD_Form.COLUMNNAME_AD_Form_ID, po.getAD_Form_ID());
        Env.setContext(packout.getCtx().ctx, X_AD_Role.COLUMNNAME_AD_Role_ID, po.getAD_Role_ID());
        this.create(packout.getCtx(), packoutHandler);
        packout.getCtx().ctx.remove(X_AD_Form.COLUMNNAME_AD_Form_ID);
        packout.getCtx().ctx.remove(X_AD_Role.COLUMNNAME_AD_Role_ID);
    } else {
        throw new AdempiereException("AD_Form_Access_UU not found = " + uuid);
    }
}
Also used : MFormAccess(org.compiere.model.MFormAccess) Query(org.compiere.model.Query) AdempiereException(org.adempiere.exceptions.AdempiereException)

Example 3 with MFormAccess

use of org.compiere.model.MFormAccess in project idempiere by idempiere.

the class FormAccessElementHandler method create.

public void create(PIPOContext ctx, TransformerHandler document) throws SAXException {
    int AD_Form_ID = Env.getContextAsInt(ctx.ctx, X_AD_Form.COLUMNNAME_AD_Form_ID);
    int AD_Role_ID = Env.getContextAsInt(ctx.ctx, X_AD_Role.COLUMNNAME_AD_Role_ID);
    MFormAccess po = null;
    Query query = new Query(ctx.ctx, "AD_Form_Access", "AD_Form_ID = ? AND AD_Role_ID = ?", getTrxName(ctx));
    po = query.setParameters(new Object[] { AD_Form_ID, AD_Role_ID }).<MFormAccess>first();
    if (po != null) {
        if (!isPackOutElement(ctx, po))
            return;
        verifyPackOutRequirement(po);
        AttributesImpl atts = new AttributesImpl();
        addTypeName(atts, "table");
        document.startElement("", "", I_AD_Form_Access.Table_Name, atts);
        createFormAccessBinding(ctx, document, po);
        document.endElement("", "", I_AD_Form_Access.Table_Name);
    }
}
Also used : MFormAccess(org.compiere.model.MFormAccess) AttributesImpl(org.xml.sax.helpers.AttributesImpl) Query(org.compiere.model.Query)

Aggregations

MFormAccess (org.compiere.model.MFormAccess)3 Query (org.compiere.model.Query)2 AdempiereException (org.adempiere.exceptions.AdempiereException)1 PoFiller (org.adempiere.pipo2.PoFiller)1 AttributesImpl (org.xml.sax.helpers.AttributesImpl)1