Search in sources :

Example 6 with POSaveFailedException

use of org.adempiere.pipo.exception.POSaveFailedException in project adempiere by adempiere.

the class WorkflowNodeElementHandler method startElement.

public void startElement(Properties ctx, Element element) throws SAXException {
    Attributes atts = element.attributes;
    String elementValue = element.getElementValue();
    log.info(elementValue + " " + atts.getValue("Name"));
    String entitytype = atts.getValue("EntityType");
    log.info("entitytype " + atts.getValue("EntityType"));
    if (isProcessElement(ctx, entitytype)) {
        if (element.parent != null && element.parent.skip) {
            element.skip = true;
            return;
        }
        if (element.parent != null && element.parent.getElementValue().equals("workflow") && element.parent.defer) {
            element.unresolved = "Parent element mark as defer: " + atts.getValue("ADWorkflowNameID");
            element.defer = true;
            return;
        }
        int workflowId = 0;
        String workflowName = atts.getValue("ADWorkflowNameID");
        if (element.parent != null && element.parent.getElementValue().equals("workflow") && element.parent.recordId > 0)
            workflowId = element.parent.recordId;
        else {
            workflowId = get_IDWithColumn(ctx, "AD_Workflow", "name", workflowName);
            if (workflowId <= 0) {
                element.defer = true;
                element.unresolved = "AD_Workflow: " + workflowName;
                return;
            } else if (element.parent != null && element.parent.getElementValue().equals("workflow"))
                element.parent.recordId = workflowId;
        }
        String workflowNodeName = atts.getValue("Name").trim();
        StringBuffer sqlB = new StringBuffer("SELECT ad_wf_node_id FROM AD_WF_Node WHERE AD_Workflow_ID=? and Name =?");
        int id = DB.getSQLValue(getTrxName(ctx), sqlB.toString(), workflowId, workflowNodeName);
        X_AD_WF_Node m_WFNode = new X_AD_WF_Node(ctx, id, getTrxName(ctx));
        int AD_Backup_ID = -1;
        String Object_Status = null;
        if (id <= 0 && atts.getValue("AD_WF_Node_ID") != null && Integer.parseInt(atts.getValue("AD_WF_Node_ID")) <= PackOut.MAX_OFFICIAL_ID)
            m_WFNode.setAD_WF_Node_ID(Integer.parseInt(atts.getValue("AD_WF_Node_ID")));
        if (id > 0) {
            AD_Backup_ID = copyRecord(ctx, "AD_WF_Node", m_WFNode);
            Object_Status = "Update";
        } else {
            Object_Status = "New";
            AD_Backup_ID = 0;
        }
        m_WFNode.setValue(atts.getValue("Value"));
        m_WFNode.setName(workflowNodeName);
        m_WFNode.setAD_Workflow_ID(workflowId);
        String name = atts.getValue("ADProcessNameID");
        if (name != null && name.trim().length() > 0) {
            id = get_IDWithColumn(ctx, "AD_Process", "Name", name);
            if (id <= 0) {
                element.defer = true;
                element.unresolved = "AD_Process: " + name;
                return;
            }
            m_WFNode.setAD_Process_ID(id);
        }
        name = atts.getValue("ADFormNameID");
        if (name != null && name.trim().length() > 0) {
            id = get_IDWithColumn(ctx, "AD_Form", "Name", name);
            if (id <= 0) {
                element.defer = true;
                element.unresolved = "AD_Form: " + name;
                return;
            }
            m_WFNode.setAD_Form_ID(id);
        }
        name = atts.getValue("ADWorkflowResponsibleNameID");
        if (name != null && name.trim().length() > 0) {
            id = get_IDWithColumn(ctx, "AD_WF_Responsible", "Name", name);
            /*
				if (id <= 0) {
					element.defer = true;
					return;
				}*/
            if (id > 0)
                m_WFNode.setAD_WF_Responsible_ID(id);
        }
        name = atts.getValue("ADWindowNameID");
        if (name != null && name.trim().length() > 0) {
            id = get_IDWithColumn(ctx, "AD_Window", "Name", name);
            if (id <= 0) {
                element.defer = true;
                element.unresolved = "AD_Window: " + name;
                return;
            }
            m_WFNode.setAD_Window_ID(id);
        }
        name = atts.getValue("ADImageNameID");
        if (name != null && name.trim().length() > 0) {
            id = get_IDWithColumn(ctx, "AD_Image", "Name", name);
            /*
				if (id <= 0) {
					element.defer = true;
					return;
				}*/
            if (id > 0)
                m_WFNode.setAD_Image_ID(id);
        }
        name = atts.getValue("ADWorkflowBlockNameID");
        if (name != null && name.trim().length() > 0) {
            id = get_IDWithColumn(ctx, "AD_WF_Block", "Name", name);
            /*
				if (id <= 0) {
					element.defer = true;
					return;
				}*/
            if (id > 0)
                m_WFNode.setAD_WF_Block_ID(id);
        }
        String columnName = atts.getValue("ADColumnNameID");
        int tableId = DB.getSQLValue(getTrxName(ctx), "SELECT AD_Table_ID FROM AD_Workflow WHERE AD_Workflow_ID=?", workflowId);
        get_IDWithColumn(ctx, "AD_Workflow", "AD_Table_ID", workflowId);
        int columnId = get_IDWithMasterAndColumn(ctx, "AD_Column", "ColumnName", columnName, "AD_Table", tableId);
        if (columnId <= 0 && tableId > 0 && columnName != null && columnName.length() > 0) {
            element.unresolved = "AD_Column=" + columnName;
            element.defer = true;
            return;
        } else if (columnId > 0)
            m_WFNode.setAD_Column_ID(columnId);
        //[Bugs-1789058 ]
        /*
			name = atts.getValue("WorkflowNameID");
			if (name != null && name.trim().length() > 0) {
				id = get_IDWithColumn(ctx, "AD_Workflow", "Name", name);
				//TODO: export and import of ad_workflow
				
				if (id <= 0) {
					element.defer = true;
					element.unresolved = "Sub Workflow: " + name;
					return;
				}
				if (id > 0)
					m_WFNode.setWorkflow_ID(id);
			}*/
        /*
			 * FIXME: Do we need TaskName ? if
			 * (atts.getValue("ADTaskNameID")!=null){ String name =
			 * atts.getValue("ADTaskNameID"); sqlB = new StringBuffer ("SELECT
			 * AD_Task_ID FROM AD_Task WHERE Name= ?"); taskid =
			 * DB.getSQLValue(m_trxName,sqlB.toString(),name); }
			 */
        m_WFNode.setValue(atts.getValue("Value"));
        m_WFNode.setEntityType(atts.getValue("EntityType"));
        m_WFNode.setAction(getStringValue(atts, "Action"));
        m_WFNode.setDocAction(getStringValue(atts, "DocAction"));
        m_WFNode.setDescription(getStringValue(atts, "Description"));
        m_WFNode.setJoinElement(atts.getValue("JoinElement"));
        m_WFNode.setSplitElement(atts.getValue("SplitElement"));
        if (getStringValue(atts, "XPosition") != null)
            m_WFNode.setXPosition(Integer.valueOf(atts.getValue("XPosition")));
        if (getStringValue(atts, "YPosition") != null)
            m_WFNode.setYPosition(Integer.valueOf(atts.getValue("YPosition")));
        m_WFNode.setWaitingTime(Integer.valueOf(atts.getValue("WaitingTime")));
        if (getStringValue(atts, "WaitTime") != null)
            m_WFNode.setWaitTime(Integer.valueOf(atts.getValue("WaitTime")));
        m_WFNode.setWorkingTime(Integer.valueOf(atts.getValue("WorkingTime")));
        if (getStringValue(atts, "Cost") != null)
            m_WFNode.setCost(new BigDecimal(atts.getValue("Cost")));
        if (getStringValue(atts, "Duration") != null)
            m_WFNode.setDuration(Integer.valueOf(atts.getValue("Duration")));
        if (getStringValue(atts, "Priority") != null)
            m_WFNode.setPriority(Integer.valueOf(atts.getValue("Priority")));
        m_WFNode.setStartMode(getStringValue(atts, "StartMode"));
        m_WFNode.setSubflowExecution(getStringValue(atts, "SubflowExecution"));
        m_WFNode.setIsCentrallyMaintained(Boolean.valueOf(atts.getValue("IsCentrallyMaintained")).booleanValue());
        if (getStringValue(atts, "DynPriorityChange") != null)
            m_WFNode.setDynPriorityChange(new BigDecimal(atts.getValue("DynPriorityChange")));
        // m_WFNode.setAccessLevel (atts.getValue("AccessLevel"));
        m_WFNode.setDynPriorityUnit(getStringValue(atts, "DynPriorityUnit"));
        m_WFNode.setIsActive(atts.getValue("isActive") != null ? Boolean.valueOf(atts.getValue("isActive")).booleanValue() : true);
        m_WFNode.setValue(atts.getValue("Value"));
        log.info("about to execute m_WFNode.save");
        if (m_WFNode.save(getTrxName(ctx)) == true) {
            log.info("m_WFNode save success");
            record_log(ctx, 1, m_WFNode.getName(), "WFNode", m_WFNode.get_ID(), AD_Backup_ID, Object_Status, "AD_WF_Node", get_IDWithColumn(ctx, "AD_Table", "TableName", "AD_WF_Node"));
        } else {
            log.info("m_WFNode save failure");
            record_log(ctx, 0, m_WFNode.getName(), "WFNode", m_WFNode.get_ID(), AD_Backup_ID, Object_Status, "AD_WF_Node", get_IDWithColumn(ctx, "AD_Table", "TableName", "AD_WF_Node"));
            throw new POSaveFailedException("WorkflowNode");
        }
    } else {
        element.skip = true;
    }
}
Also used : Attributes(org.xml.sax.Attributes) POSaveFailedException(org.adempiere.pipo.exception.POSaveFailedException) X_AD_WF_Node(org.compiere.model.X_AD_WF_Node) BigDecimal(java.math.BigDecimal)

Example 7 with POSaveFailedException

use of org.adempiere.pipo.exception.POSaveFailedException in project adempiere by adempiere.

the class ViewElementHandler method startElement.

public void startElement(Properties ctx, Element element) throws SAXException {
    // Check namespace.
    String elementValue = element.getElementValue();
    Attributes atts = element.attributes;
    log.info(elementValue + " " + atts.getValue("Name"));
    String entitytype = atts.getValue("EntityType");
    if (isProcessElement(ctx, entitytype)) {
        String name = atts.getValue("Name");
        int id = get_ID(ctx, "AD_View", name);
        if (id > 0 && views.contains(id)) {
            return;
        }
        MView m_View = new MView(ctx, id, getTrxName(ctx));
        if (id <= 0 && atts.getValue("AD_View_ID") != null && Integer.parseInt(atts.getValue("AD_View_ID")) <= PackOut.MAX_OFFICIAL_ID)
            m_View.setAD_View_ID(Integer.parseInt(atts.getValue("AD_View_ID")));
        String Object_Status = null;
        int AD_Backup_ID = -1;
        if (id > 0) {
            AD_Backup_ID = copyRecord(ctx, "AD_View", m_View);
            Object_Status = "Update";
        } else {
            Object_Status = "New";
            AD_Backup_ID = 0;
        }
        m_View.setValue(atts.getValue("Value"));
        m_View.setName(atts.getValue("Name"));
        m_View.setDescription(getStringValue(atts, "Description"));
        m_View.setHelp(getStringValue(atts, "Help"));
        m_View.setIsActive(atts.getValue("isActive") != null ? Boolean.valueOf(atts.getValue("isActive")).booleanValue() : true);
        m_View.setEntityType(atts.getValue("EntityType"));
        if (m_View.save(getTrxName(ctx)) == true) {
            record_log(ctx, 1, m_View.getName(), "View", m_View.get_ID(), AD_Backup_ID, Object_Status, "AD_View", get_IDWithColumn(ctx, "AD_Table", "TableName", "AD_View"));
            element.recordId = m_View.getAD_View_ID();
            views.add(m_View.getAD_View_ID());
        } else {
            record_log(ctx, 0, m_View.getName(), "View", m_View.get_ID(), AD_Backup_ID, Object_Status, "AD_View", get_IDWithColumn(ctx, "AD_Table", "TableName", "AD_View"));
            throw new POSaveFailedException("View");
        }
    } else {
        element.skip = true;
    }
}
Also used : MView(org.adempiere.model.MView) Attributes(org.xml.sax.Attributes) POSaveFailedException(org.adempiere.pipo.exception.POSaveFailedException)

Example 8 with POSaveFailedException

use of org.adempiere.pipo.exception.POSaveFailedException in project adempiere by adempiere.

the class TaskElementHandler method startElement.

public void startElement(Properties ctx, Element element) throws SAXException {
    String elementValue = element.getElementValue();
    Attributes atts = element.attributes;
    log.info(elementValue + " " + atts.getValue("ADTaskNameID"));
    String entitytype = atts.getValue("EntityType");
    if (isProcessElement(ctx, entitytype)) {
        String name = atts.getValue("ADTaskNameID");
        int id = get_ID(ctx, "AD_Task", name);
        MTask m_Task = new MTask(ctx, id, getTrxName(ctx));
        int AD_Backup_ID = -1;
        String Object_Status = null;
        if (id <= 0 && atts.getValue("AD_Task_ID") != null && Integer.parseInt(atts.getValue("AD_Task_ID")) <= PackOut.MAX_OFFICIAL_ID)
            m_Task.setAD_Task_ID(Integer.parseInt(atts.getValue("AD_Task_ID")));
        if (id > 0) {
            AD_Backup_ID = copyRecord(ctx, "AD_Task", m_Task);
            Object_Status = "Update";
        } else {
            Object_Status = "New";
            AD_Backup_ID = 0;
        }
        m_Task.setAccessLevel(atts.getValue("AccessLevel"));
        m_Task.setDescription(getStringValue(atts, "Description"));
        m_Task.setEntityType(atts.getValue("EntityType"));
        m_Task.setHelp(getStringValue(atts, "Help"));
        m_Task.setIsActive(atts.getValue("isActive") != null ? Boolean.valueOf(atts.getValue("isActive")).booleanValue() : true);
        m_Task.setName(name);
        m_Task.setOS_Command(getStringValue(atts, "OS_Command"));
        if (m_Task.save(getTrxName(ctx)) == true) {
            record_log(ctx, 1, m_Task.getName(), "Task", m_Task.get_ID(), AD_Backup_ID, Object_Status, "AD_Task", get_IDWithColumn(ctx, "AD_Table", "TableName", "AD_Task"));
        } else {
            record_log(ctx, 0, m_Task.getName(), "Task", m_Task.get_ID(), AD_Backup_ID, Object_Status, "AD_Task", get_IDWithColumn(ctx, "AD_Table", "TableName", "AD_Task"));
            throw new POSaveFailedException("Task");
        }
    } else {
        element.skip = true;
    }
}
Also used : MTask(org.compiere.model.MTask) Attributes(org.xml.sax.Attributes) POSaveFailedException(org.adempiere.pipo.exception.POSaveFailedException)

Example 9 with POSaveFailedException

use of org.adempiere.pipo.exception.POSaveFailedException in project adempiere by adempiere.

the class EntityTypeElementHandler method startElement.

public void startElement(Properties ctx, Element element) throws SAXException {
    final String elementValue = element.getElementValue();
    final Attributes atts = element.attributes;
    final String entitytype = atts.getValue(I_AD_EntityType.COLUMNNAME_EntityType);
    log.info(elementValue + " " + entitytype);
    if (isProcessElement(ctx, entitytype)) {
        int id = get_IDWithColumn(ctx, I_AD_EntityType.Table_Name, I_AD_EntityType.COLUMNNAME_EntityType, entitytype);
        final MEntityType entity = new MEntityType(ctx, id, getTrxName(ctx));
        final int AD_Backup_ID;
        final String Object_Status;
        if (id <= 0 && getIntValue(atts, I_AD_EntityType.COLUMNNAME_AD_EntityType_ID, 0) <= PackOut.MAX_OFFICIAL_ID) {
            entity.setAD_EntityType_ID(getIntValue(atts, I_AD_EntityType.COLUMNNAME_AD_EntityType_ID, 0));
        }
        if (id > 0) {
            AD_Backup_ID = copyRecord(ctx, I_AD_EntityType.Table_Name, entity);
            Object_Status = "Update";
        } else {
            Object_Status = "New";
            AD_Backup_ID = 0;
        }
        entity.setName(getStringValue(atts, I_AD_EntityType.COLUMNNAME_Name));
        entity.setDescription(getStringValue(atts, I_AD_EntityType.COLUMNNAME_Description));
        entity.setHelp(getStringValue(atts, I_AD_EntityType.COLUMNNAME_Help));
        entity.setEntityType(getStringValue(atts, I_AD_EntityType.COLUMNNAME_EntityType));
        entity.setVersion(atts.getValue(I_AD_EntityType.COLUMNNAME_Version));
        entity.setIsActive(getBooleanValue(atts, I_AD_EntityType.COLUMNNAME_IsActive, true));
        entity.setModelPackage(getStringValue(atts, I_AD_EntityType.COLUMNNAME_ModelPackage));
        entity.setClasspath(getStringValue(atts, I_AD_EntityType.COLUMNNAME_Classpath));
        if (entity.save(getTrxName(ctx)) == true) {
            record_log(ctx, 1, entity.getEntityType(), TAG_Name, entity.get_ID(), AD_Backup_ID, Object_Status, I_AD_EntityType.Table_Name, I_AD_EntityType.Table_ID);
        } else {
            record_log(ctx, 0, entity.getEntityType(), TAG_Name, entity.get_ID(), AD_Backup_ID, Object_Status, I_AD_EntityType.Table_Name, I_AD_EntityType.Table_ID);
            throw new POSaveFailedException("Failed to save message.");
        }
    } else {
        element.skip = true;
    }
}
Also used : Attributes(org.xml.sax.Attributes) POSaveFailedException(org.adempiere.pipo.exception.POSaveFailedException) MEntityType(org.compiere.model.MEntityType)

Example 10 with POSaveFailedException

use of org.adempiere.pipo.exception.POSaveFailedException in project adempiere by adempiere.

the class FieldElementHandler method startElement.

public void startElement(Properties ctx, Element element) throws SAXException {
    final String include_tabname = element.attributes.getValue("ADIncludeTabNameID");
    // Set Included Tab ID if this task was previously postponed 
    if (element.defer && element.recordId > 0 && include_tabname != null) {
        MField field = new MField(ctx, element.recordId, getTrxName(ctx));
        setIncluded_Tab_ID(ctx, field, include_tabname);
        field.saveEx();
        return;
    }
    PackIn packIn = (PackIn) ctx.get("PackInProcess");
    String elementValue = element.getElementValue();
    Attributes atts = element.attributes;
    log.info(elementValue + " " + atts.getValue("Name"));
    String entitytype = atts.getValue("EntityType");
    if (isProcessElement(ctx, entitytype)) {
        if (element.parent != null && element.parent.getElementValue().equals("tab") && element.parent.defer) {
            element.defer = true;
            return;
        }
        String name = atts.getValue("Name");
        String tabname = atts.getValue("ADTabNameID");
        String colname = atts.getValue("ADColumnNameID");
        String tableName = atts.getValue("ADTableNameID");
        int tableid = packIn.getTableId(tableName);
        if (tableid <= 0) {
            tableid = get_IDWithColumn(ctx, "AD_Table", "TableName", tableName);
            if (tableid > 0)
                packIn.addTable(tableName, tableid);
        }
        if (tableid <= 0) {
            element.defer = true;
            return;
        }
        int windowid = get_ID(ctx, "AD_Window", atts.getValue("ADWindowNameID"));
        if (windowid <= 0) {
            element.defer = true;
            return;
        }
        int columnid = packIn.getColumnId(tableName, colname);
        if (columnid <= 0) {
            columnid = get_IDWithMasterAndColumn(ctx, "AD_Column", "ColumnName", colname, "AD_Table", tableid);
            if (columnid > 0)
                packIn.addColumn(tableName, colname, columnid);
        }
        if (columnid <= 0) {
            element.defer = true;
            return;
        }
        int tabid = 0;
        if (element.parent != null && element.parent.getElementValue().equals("tab") && element.parent.recordId > 0) {
            tabid = element.parent.recordId;
        } else {
            StringBuffer sqlB = new StringBuffer("select AD_Tab_ID from AD_Tab where AD_Window_ID = " + windowid).append(" and Name = '" + tabname + "'").append(" and AD_Table_ID = ?");
            tabid = DB.getSQLValue(getTrxName(ctx), sqlB.toString(), tableid);
            if (element.parent != null && element.parent.getElementValue().equals("tab") && tabid > 0) {
                element.parent.recordId = tabid;
            }
        }
        if (tabid > 0) {
            StringBuffer sqlB = new StringBuffer("select AD_Field_ID from AD_Field where AD_Column_ID = ").append(columnid).append(" and AD_Tab_ID = ?");
            int id = DB.getSQLValue(getTrxName(ctx), sqlB.toString(), tabid);
            final MField m_Field = new MField(ctx, id, getTrxName(ctx));
            if (id <= 0 && atts.getValue("AD_Field_ID") != null && Integer.parseInt(atts.getValue("AD_Field_ID")) <= PackOut.MAX_OFFICIAL_ID)
                m_Field.setAD_Field_ID(Integer.parseInt(atts.getValue("AD_Field_ID")));
            int AD_Backup_ID = -1;
            String Object_Status = null;
            if (id > 0) {
                AD_Backup_ID = copyRecord(ctx, "AD_Field", m_Field);
                Object_Status = "Update";
            } else {
                Object_Status = "New";
                AD_Backup_ID = 0;
            }
            m_Field.setName(atts.getValue("Name"));
            m_Field.setAD_Column_ID(columnid);
            name = atts.getValue("ADFieldGroupNameID");
            id = get_IDWithColumn(ctx, "AD_FieldGroup", "Name", name);
            m_Field.setAD_FieldGroup_ID(id);
            m_Field.setAD_Tab_ID(tabid);
            m_Field.setEntityType(atts.getValue("EntityType"));
            m_Field.setIsSameLine(Boolean.valueOf(atts.getValue("SameLine")).booleanValue());
            m_Field.setIsCentrallyMaintained(Boolean.valueOf(atts.getValue("isCentrallyMaintained")).booleanValue());
            m_Field.setIsDisplayed(Boolean.valueOf(atts.getValue("Displayed")).booleanValue());
            // m_Field.setIsEncrypted(Boolean.valueOf(atts.getValue("isEncrypted")).booleanValue());
            m_Field.setIsFieldOnly(Boolean.valueOf(atts.getValue("isFieldOnly")).booleanValue());
            m_Field.setIsHeading(Boolean.valueOf(atts.getValue("isHeading")).booleanValue());
            m_Field.setIsReadOnly(Boolean.valueOf(atts.getValue("isReadOnly")).booleanValue());
            m_Field.setSeqNo(Integer.parseInt(atts.getValue("SeqNo")));
            m_Field.setDisplayLength(Integer.parseInt(atts.getValue("DisplayLength")));
            m_Field.setDescription(getStringValue(atts, "Description"));
            m_Field.setHelp(getStringValue(atts, "Help"));
            m_Field.setIsActive(atts.getValue("isActive") != null ? Boolean.valueOf(atts.getValue("isActive")).booleanValue() : true);
            String sortNo = getStringValue(atts, "SortNo");
            if (sortNo != null)
                m_Field.setSortNo(new BigDecimal(sortNo));
            m_Field.setDisplayLogic(getStringValue(atts, "DisplayLogic"));
            String Name = atts.getValue("ADReferenceNameID");
            id = get_IDWithColumn(ctx, "AD_Reference", "Name", Name);
            m_Field.setAD_Reference_ID(id);
            Name = atts.getValue("ADValRuleNameID");
            id = get_IDWithColumn(ctx, "AD_Val_Rule", "Name", Name);
            m_Field.setAD_Val_Rule_ID(id);
            Name = atts.getValue("ADReferenceNameValueID");
            id = get_IDWithColumn(ctx, "AD_Reference", "Name", Name);
            m_Field.setAD_Reference_Value_ID(id);
            m_Field.setInfoFactoryClass(getStringValue(atts, "InfoFactoryClass"));
            if ("Y".equals(atts.getValue("isMandatory")))
                m_Field.setIsMandatory(atts.getValue("isMandatory"));
            else if ("N".equals(atts.getValue("isMandatory")))
                m_Field.setIsMandatory(atts.getValue("isMandatory"));
            m_Field.setDefaultValue(atts.getValue("DefaultValue"));
            if (atts.getValue("IsDisplayedGrid") != null)
                m_Field.setIsDisplayedGrid(Boolean.valueOf(atts.getValue("IsDisplayedGrid")).booleanValue());
            if (atts.getValue("PreferredWidth") != null)
                m_Field.setPreferredWidth(Integer.parseInt(atts.getValue("PreferredWidth")));
            setIncluded_Tab_ID(ctx, m_Field, include_tabname);
            if (m_Field.save(getTrxName(ctx)) == true) {
                record_log(ctx, 1, m_Field.getName(), "Field", m_Field.get_ID(), AD_Backup_ID, Object_Status, "AD_Field", get_IDWithColumn(ctx, "AD_Table", "TableName", "AD_Field"));
                element.recordId = m_Field.getAD_Field_ID();
            } else {
                record_log(ctx, 0, m_Field.getName(), "Field", m_Field.get_ID(), AD_Backup_ID, Object_Status, "AD_Field", get_IDWithColumn(ctx, "AD_Table", "TableName", "AD_Field"));
                throw new POSaveFailedException("Failed to save field definition.");
            }
            // If Included Tab not found, then postpone this task for later processing 
            if (m_Field.getAD_Field_ID() > 0 && include_tabname != null && m_Field.getIncluded_Tab_ID() <= 0) {
                element.defer = true;
            }
        } else {
            element.defer = true;
            return;
        }
    } else {
        element.skip = true;
    }
}
Also used : PackIn(org.adempiere.pipo.PackIn) Attributes(org.xml.sax.Attributes) POSaveFailedException(org.adempiere.pipo.exception.POSaveFailedException) MField(org.compiere.model.MField) BigDecimal(java.math.BigDecimal)

Aggregations

POSaveFailedException (org.adempiere.pipo.exception.POSaveFailedException)38 Attributes (org.xml.sax.Attributes)37 BigDecimal (java.math.BigDecimal)5 MTable (org.compiere.model.MTable)5 PackIn (org.adempiere.pipo.PackIn)4 X_AD_Element (org.compiere.model.X_AD_Element)4 PoFiller (org.adempiere.pipo.PoFiller)2 MWorkflow (org.compiere.wf.MWorkflow)2 AdempiereException (org.adempiere.exceptions.AdempiereException)1 MBrowse (org.adempiere.model.MBrowse)1 MBrowseField (org.adempiere.model.MBrowseField)1 MView (org.adempiere.model.MView)1 MViewColumn (org.adempiere.model.MViewColumn)1 MViewDefinition (org.adempiere.model.MViewDefinition)1 DatabaseAccessException (org.adempiere.pipo.exception.DatabaseAccessException)1 MColumn (org.compiere.model.MColumn)1 MEntityType (org.compiere.model.MEntityType)1 MField (org.compiere.model.MField)1 MForm (org.compiere.model.MForm)1 MMessage (org.compiere.model.MMessage)1