Search in sources :

Example 1 with X_AD_Message

use of org.compiere.model.X_AD_Message in project adempiere by adempiere.

the class MessageElementHandler method getMessages.

private List<X_AD_Message> getMessages(Properties ctx) {
    int AD_Message_ID = Env.getContextAsInt(ctx, X_AD_Package_Exp_Detail.COLUMNNAME_AD_Message_ID);
    int AD_EntityType_ID = Env.getContextAsInt(ctx, X_AD_Package_Exp_Detail.COLUMNNAME_AD_EntityType_ID);
    String whereClause;
    Object[] params;
    if (AD_Message_ID > 0) {
        whereClause = X_AD_Message.COLUMNNAME_AD_Message_ID + "=?";
        params = new Object[] { AD_Message_ID };
    } else if (AD_EntityType_ID > 0) {
        whereClause = " EXISTS (SELECT 1 FROM AD_EntityType et" + " WHERE et.AD_EntityType_ID=? AND et.EntityType=AD_Message.EntityType)";
        params = new Object[] { AD_EntityType_ID };
    } else {
        throw new IllegalArgumentException("AD_Message_ID and AD_EntityType_ID not found");
    }
    List<X_AD_Message> list = new Query(ctx, X_AD_Message.Table_Name, whereClause, null).setParameters(params).setOrderBy(X_AD_Message.COLUMNNAME_AD_Message_ID).list();
    return list;
}
Also used : Query(org.compiere.model.Query) X_AD_Message(org.compiere.model.X_AD_Message)

Example 2 with X_AD_Message

use of org.compiere.model.X_AD_Message in project adempiere by adempiere.

the class MessageElementHandler method create.

public void create(Properties ctx, TransformerHandler document) throws SAXException {
    for (X_AD_Message message : getMessages(ctx)) {
        if (messages.contains(message.getAD_Message_ID()))
            continue;
        messages.add(message.getAD_Message_ID());
        //
        AttributesImpl atts = new AttributesImpl();
        createMessageBinding(atts, message);
        document.startElement("", "", "message", atts);
        document.endElement("", "", "message");
    }
}
Also used : AttributesImpl(org.xml.sax.helpers.AttributesImpl) X_AD_Message(org.compiere.model.X_AD_Message)

Aggregations

X_AD_Message (org.compiere.model.X_AD_Message)2 Query (org.compiere.model.Query)1 AttributesImpl (org.xml.sax.helpers.AttributesImpl)1