Search in sources :

Example 1 with X_AD_PrintFormatItem

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

the class PrintFormatItemElementHandler method create.

public void create(Properties ctx, TransformerHandler document) throws SAXException {
    int AD_PrintFormatItem_ID = Env.getContextAsInt(ctx, X_AD_PrintFormatItem.COLUMNNAME_AD_PrintFormatItem_ID);
    X_AD_PrintFormatItem m_PrintFormatItem = new X_AD_PrintFormatItem(ctx, AD_PrintFormatItem_ID, null);
    AttributesImpl atts = new AttributesImpl();
    createPrintFormatItemBinding(atts, m_PrintFormatItem);
    document.startElement("", "", "printformatitem", atts);
    document.endElement("", "", "printformatitem");
}
Also used : AttributesImpl(org.xml.sax.helpers.AttributesImpl) X_AD_PrintFormatItem(org.compiere.model.X_AD_PrintFormatItem)

Example 2 with X_AD_PrintFormatItem

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

the class PrintFormatItemElementHandler method startElement.

public void startElement(Properties ctx, Element element) throws SAXException {
    String elementValue = element.getElementValue();
    int AD_Backup_ID = -1;
    String Object_Status = null;
    Attributes atts = element.attributes;
    log.info(elementValue + " " + atts.getValue("Name"));
    if (element.parent != null && element.parent.getElementValue().equals("printformat") && element.parent.defer) {
        element.defer = true;
        return;
    }
    String name = atts.getValue("Name");
    int id = get_IDWithMaster(ctx, "AD_PrintFormatItem", name, "AD_PrintFormat", atts.getValue("ADPrintFormatNameID"));
    X_AD_PrintFormatItem m_PrintFormatItem = new X_AD_PrintFormatItem(ctx, id, getTrxName(ctx));
    if (id <= 0 && atts.getValue("AD_PrintFormatItem_ID") != null && Integer.parseInt(atts.getValue("AD_PrintFormatItem_ID")) <= PackOut.MAX_OFFICIAL_ID)
        m_PrintFormatItem.setAD_PrintFormatItem_ID(Integer.parseInt(atts.getValue("AD_PrintFormatItem_ID")));
    if (id > 0) {
        AD_Backup_ID = copyRecord(ctx, "AD_PrintFormatItem", m_PrintFormatItem);
        Object_Status = "Update";
    } else {
        Object_Status = "New";
        AD_Backup_ID = 0;
    }
    m_PrintFormatItem.setName(name);
    name = atts.getValue("ADPrintFormatNameID");
    if (element.parent != null && element.parent.getElementValue().equals("printformat") && element.parent.recordId != 0) {
        id = element.parent.recordId;
    } else {
        id = get_IDWithColumn(ctx, "AD_PrintFormat", "Name", name);
        if (element.parent != null && element.parent.getElementValue().equals("printformat") && id > 0) {
            element.parent.recordId = id;
        }
    }
    if (id <= 0) {
        element.defer = true;
        return;
    }
    m_PrintFormatItem.setAD_PrintFormat_ID(id);
    name = atts.getValue("ADTableNameID");
    int tableid = get_IDWithColumn(ctx, "AD_Table", "TableName", name);
    name = atts.getValue("ADColumnNameID");
    id = get_IDWithMasterAndColumn(ctx, "AD_Column", "ColumnName", name, "AD_Table", tableid);
    if (id > 0)
        m_PrintFormatItem.setAD_Column_ID(id);
    name = atts.getValue("ADPrintFormatChildNameID");
    if (name != null && name.trim().length() > 0) {
        id = get_IDWithColumn(ctx, "AD_PrintFormat", "Name", name);
        if (id <= 0) {
            element.defer = true;
            element.unresolved = "AD_PrintFormat: " + name;
            return;
        }
        m_PrintFormatItem.setAD_PrintFormatChild_ID(id);
    }
    name = atts.getValue("ADPrintGraphID");
    if (name != null && name.trim().length() > 0) {
        id = get_IDWithColumn(ctx, "AD_PrintGraph", "Name", name);
        /*
			if (id <= 0) {
				element.defer = true;
				return;
			}*/
        if (id > 0)
            m_PrintFormatItem.setAD_PrintGraph_ID(id);
    }
    name = atts.getValue("ADPrintColorID");
    if (name != null && name.trim().length() > 0) {
        id = get_IDWithColumn(ctx, "AD_PrintColor", "Name", name);
        /*
			if (id <= 0) {
				element.defer = true;
				return;
			}*/
        if (id > 0)
            m_PrintFormatItem.setAD_PrintColor_ID(id);
    }
    name = atts.getValue("ADPrintFontID");
    if (name != null && name.trim().length() > 0) {
        id = get_IDWithColumn(ctx, "AD_PrintFont", "Name", name);
        /*
			if (id <= 0) {
				element.defer = true;
				return;
			}*/
        if (id > 0)
            m_PrintFormatItem.setAD_PrintFont_ID(id);
    }
    m_PrintFormatItem.setPrintName(getStringValue(atts, "PrintName"));
    m_PrintFormatItem.setName(atts.getValue("Name"));
    m_PrintFormatItem.setPrintAreaType(getStringValue(atts, "PrintAreaType"));
    m_PrintFormatItem.setSeqNo(Integer.parseInt(atts.getValue("SeqNo")));
    m_PrintFormatItem.setPrintFormatType(getStringValue(atts, "PrintFormatType"));
    m_PrintFormatItem.setXSpace(Integer.parseInt(atts.getValue("XSpace")));
    m_PrintFormatItem.setYSpace(Integer.parseInt(atts.getValue("YSpace")));
    m_PrintFormatItem.setXPosition(Integer.parseInt(atts.getValue("Xposition")));
    m_PrintFormatItem.setYPosition(Integer.parseInt(atts.getValue("Yposition")));
    m_PrintFormatItem.setMaxWidth(Integer.parseInt(atts.getValue("MaxWidth")));
    m_PrintFormatItem.setMaxHeight(Integer.parseInt(atts.getValue("MaxHieght")));
    m_PrintFormatItem.setSortNo(Integer.parseInt(atts.getValue("SortNo")));
    m_PrintFormatItem.setFieldAlignmentType(getStringValue(atts, "FieldAlignmentType"));
    m_PrintFormatItem.setLineAlignmentType(getStringValue(atts, "LineAlignmentType"));
    m_PrintFormatItem.setImageURL(getStringValue(atts, "ImageURL"));
    m_PrintFormatItem.setArcDiameter(Integer.parseInt(atts.getValue("ArcDiameter")));
    m_PrintFormatItem.setLineWidth(Integer.parseInt(atts.getValue("LineWidth")));
    m_PrintFormatItem.setShapeType(getStringValue(atts, "ShapeType"));
    m_PrintFormatItem.setBelowColumn(Integer.parseInt(atts.getValue("BelowColumn")));
    m_PrintFormatItem.setPrintNameSuffix(getStringValue(atts, "PrintNameSuffix"));
    m_PrintFormatItem.setRunningTotalLines(Integer.parseInt(atts.getValue("RunningTotalLines")));
    m_PrintFormatItem.setIsActive(atts.getValue("isActive") != null ? Boolean.valueOf(atts.getValue("isActive")).booleanValue() : true);
    m_PrintFormatItem.setIsPrinted(Boolean.valueOf(atts.getValue("isPrinted")).booleanValue());
    m_PrintFormatItem.setIsRelativePosition(Boolean.valueOf(atts.getValue("isRelativePosition")).booleanValue());
    m_PrintFormatItem.setIsNextLine(Boolean.valueOf(atts.getValue("isNextLine")).booleanValue());
    m_PrintFormatItem.setIsHeightOneLine(Boolean.valueOf(atts.getValue("isHeightOneLine")).booleanValue());
    m_PrintFormatItem.setIsOrderBy(Boolean.valueOf(atts.getValue("isOrderBy")).booleanValue());
    m_PrintFormatItem.setIsGroupBy(Boolean.valueOf(atts.getValue("isGroupBy")).booleanValue());
    m_PrintFormatItem.setIsPageBreak(Boolean.valueOf(atts.getValue("isPageBreak")).booleanValue());
    m_PrintFormatItem.setIsSummarized(Boolean.valueOf(atts.getValue("isSummarized")).booleanValue());
    m_PrintFormatItem.setImageIsAttached(Boolean.valueOf(atts.getValue("isImageIsAttached")).booleanValue());
    m_PrintFormatItem.setIsAveraged(Boolean.valueOf(atts.getValue("isAveraged")).booleanValue());
    m_PrintFormatItem.setIsCounted(Boolean.valueOf(atts.getValue("isCounted")).booleanValue());
    m_PrintFormatItem.setIsSetNLPosition(Boolean.valueOf(atts.getValue("isSetNLPosition")).booleanValue());
    m_PrintFormatItem.setIsSuppressNull(Boolean.valueOf(atts.getValue("isSuppressNull")).booleanValue());
    m_PrintFormatItem.setIsFixedWidth(Boolean.valueOf(atts.getValue("isFixedWidth")).booleanValue());
    m_PrintFormatItem.setIsNextPage(Boolean.valueOf(atts.getValue("isNextPage")).booleanValue());
    m_PrintFormatItem.setIsMaxCalc(Boolean.valueOf(atts.getValue("isMaxCalc")).booleanValue());
    m_PrintFormatItem.setIsMinCalc(Boolean.valueOf(atts.getValue("isMinCalc")).booleanValue());
    m_PrintFormatItem.setIsRunningTotal(Boolean.valueOf(atts.getValue("isRunningTotal")).booleanValue());
    m_PrintFormatItem.setIsVarianceCalc(Boolean.valueOf(atts.getValue("isVarianceCalc")).booleanValue());
    m_PrintFormatItem.setIsDeviationCalc(Boolean.valueOf(atts.getValue("isDeviationCalc")).booleanValue());
    // BarCode Type
    String barCodeType = atts.getValue(X_AD_PrintFormatItem.COLUMNNAME_BarcodeType);
    m_PrintFormatItem.setBarcodeType(barCodeType);
    if (m_PrintFormatItem.save(getTrxName(ctx)) == true) {
        record_log(ctx, 1, m_PrintFormatItem.getName(), "PrintFormatItem", m_PrintFormatItem.get_ID(), AD_Backup_ID, Object_Status, "AD_PrintFormatItem", get_IDWithColumn(ctx, "AD_Table", "TableName", "AD_PrintFormatItem"));
    } else {
        record_log(ctx, 0, m_PrintFormatItem.getName(), "PrintFormatItem", m_PrintFormatItem.get_ID(), AD_Backup_ID, Object_Status, "AD_PrintFormatItem", get_IDWithColumn(ctx, "AD_Table", "TableName", "AD_PrintFormatItem"));
        throw new POSaveFailedException("PrintFormatItem");
    }
}
Also used : Attributes(org.xml.sax.Attributes) POSaveFailedException(org.adempiere.pipo.exception.POSaveFailedException) X_AD_PrintFormatItem(org.compiere.model.X_AD_PrintFormatItem)

Aggregations

X_AD_PrintFormatItem (org.compiere.model.X_AD_PrintFormatItem)2 POSaveFailedException (org.adempiere.pipo.exception.POSaveFailedException)1 Attributes (org.xml.sax.Attributes)1 AttributesImpl (org.xml.sax.helpers.AttributesImpl)1