Search in sources :

Example 1 with X_AD_Package_Imp_Detail

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

the class AbstractElementHandler method record_log.

/**
     *	Write results to log and records in history table
     *
     *      @param success
     * 		@param tableName
     * 		@param objectType
     * 		@param objectID
     * 		@param objectStatus
     * 		@throws SAXException
     *       	
     */
public int record_log(Properties ctx, int success, String objectName, String objectType, int objectID, int objectIDBackup, String objectStatus, String tableName, int AD_Table_ID) throws SAXException {
    StringBuffer recordLayout = new StringBuffer();
    int id = 0;
    TransformerHandler hd_document = getLogDocument(ctx);
    AttributesImpl attsOut = new AttributesImpl();
    String result = success == 1 ? "Success" : "Failure";
    //hd_documemt.startElement("","","Successful",attsOut);
    recordLayout.append("Type:").append(objectType).append("  -   Name:").append(objectName).append("  -  ID:").append(objectID).append("  -  Action:").append(objectStatus).append("  -  " + result);
    hd_document.startElement("", "", result, attsOut);
    hd_document.characters(recordLayout.toString().toCharArray(), 0, recordLayout.length());
    hd_document.endElement("", "", result);
    X_AD_Package_Imp_Detail detail = new X_AD_Package_Imp_Detail(ctx, 0, getTrxName(ctx));
    detail.setAD_Package_Imp_ID(getPackageImpId(ctx));
    detail.setAD_Org_ID(Env.getAD_Org_ID(ctx));
    detail.setType(objectType);
    detail.setName(objectName);
    detail.setAction(objectStatus);
    detail.setSuccess(result);
    detail.setAD_Original_ID(objectID);
    detail.setAD_Backup_ID(objectIDBackup);
    detail.setTableName(tableName);
    detail.setAD_Table_ID(AD_Table_ID);
    if (!detail.save(getTrxName(ctx)))
        log.info("Insert to import detail failed");
    id = detail.get_ID();
    return id;
}
Also used : TransformerHandler(javax.xml.transform.sax.TransformerHandler) AttributesImpl(org.xml.sax.helpers.AttributesImpl) X_AD_Package_Imp_Detail(org.compiere.model.X_AD_Package_Imp_Detail)

Aggregations

TransformerHandler (javax.xml.transform.sax.TransformerHandler)1 X_AD_Package_Imp_Detail (org.compiere.model.X_AD_Package_Imp_Detail)1 AttributesImpl (org.xml.sax.helpers.AttributesImpl)1