/** * Load Persistence Object * * @author Yamel Senih, [email protected], ERPCyA http://www.erpcya.com 17/05/2014, 11:03:25 * @return * @return boolean */ private boolean loadPO() { Env.setTabRecord_ID(m_TabParam.getActivityNo(), m_TabParam.getTabNo(), m_Record_ID); Env.setTabKeyColumns(m_TabParam.getActivityNo(), m_TabParam.getTabNo(), m_KeyColums); // Get Model if (model == null) { int instance_ID = m_Record_ID[0]; if (m_Record_ID.length > 1) instance_ID = 0; // model = MSPSTable.getPO(m_ctx, instance_ID, m_TabInfo.getTableName(), conn); // if (model != null && m_Record_ID.length > 1) model.loadData(m_Record_ID, m_KeyColums); } // For null if (model == null) { return false; } // Set identifier Env.setContext( m_TabParam.getActivityNo(), m_TabParam.getTabNo(), m_TabInfo.getTableName() + "_ID", model.getID()); // return true; }
/** * Save only model * * @author Yamel Senih, [email protected], ERPCyA http://www.erpcya.com 29/08/2014, 16:51:48 * @return * @return boolean */ public boolean modelSave() { boolean ok = true; m_ErrorMsg = null; ok = model.save(); // Set Record Identifier m_Record_ID = model.getIDs(); m_KeyColums = model.getKeyColumns(); if (ok) { Env.setTabRecord_ID(m_TabParam.getActivityNo(), m_TabParam.getTabNo(), m_Record_ID); Env.setTabKeyColumns(m_TabParam.getActivityNo(), m_TabParam.getTabNo(), m_KeyColums); // Env.setContext( m_TabParam.getActivityNo(), m_TabParam.getTabNo(), m_TabInfo.getTableKeyName(), m_Record_ID[0]); } else { m_ErrorMsg = model.getError(); } // return ok; }
/** * Refresh * * @author Yamel Senih, [email protected], ERPCyA http://www.erpcya.com 18/10/2014, 13:36:09 * @param record_ID * @param keyColumn * @param parentChanged * @return * @return boolean */ public boolean refresh(int[] record_ID, String[] keyColumn, boolean parentChanged) { this.m_Record_ID = record_ID; // Set record Identifier in context Env.setTabRecord_ID(m_TabParam.getActivityNo(), m_TabParam.getTabNo(), m_Record_ID); Env.setTabKeyColumns(m_TabParam.getActivityNo(), m_TabParam.getTabNo(), m_KeyColums); // Parent changed if (parentChanged || record_ID[0] <= 0) model.clear(false); // model.loadData(record_ID, keyColumn); // Refresh loadData(); // Set Identifier Env.setContext( m_TabParam.getActivityNo(), m_TabParam.getTabNo(), m_TabInfo.getTableKeyName(), model.getID()); // Set Parent Record Identifier int[] parent = Env.getTabRecord_ID(m_TabParam.getActivityNo(), m_TabParam.getParentTabNo()); m_Parent_Record_ID = parent[0]; // Return return !isEmpty(); }