FR-1976008 - 2Pack can replicate Data with FK integrity

Changes done by Low Heng Sin
This commit is contained in:
Redhuan D. Oon 2009-02-04 10:19:59 +00:00
parent 8ee2df3af6
commit d0649726f5
6 changed files with 1935 additions and 1718 deletions

View File

@ -106,22 +106,26 @@ public abstract class AbstractElementHandler implements ElementHandler {
.append( "AD_PACKAGE_IMP_DETAIL_ID, AD_PACKAGE_IMP_ID, TYPE, NAME," )
.append( " ACTION, SUCCESS, AD_ORIGINAL_ID, AD_BACKUP_ID, TABLENAME, AD_TABLE_ID)" )
.append( "VALUES(" )
.append( " "+ Env.getAD_Client_ID(ctx) )
.append( ", "+ Env.getAD_Org_ID(ctx) )
.append( ", "+ Env.getAD_User_ID(ctx) )
.append( ", "+ Env.getAD_User_ID(ctx) )
.append( ", " + id )
.append( ", " + getPackageImpId(ctx) )
.append( ", '" + objectType )
.append( "', '" + objectName )
.append( "', '" + objectStatus )
.append( "', 'Success'" )
.append( ", "+objectID )
.append( ", "+objectIDBackup )
.append( ", '"+tableName )
.append( "', "+AD_Table_ID )
.append( " ?")
.append( ", ?" )
.append( ", ?" )
.append( ", ?" )
.append( ", ?" )
.append( ", ?" )
.append( ", ?" )
.append( ", ?" )
.append( ", ?" )
.append( ", ?" )
.append( ", ?" )
.append( ", ?" )
.append( ", ?" )
.append( ", ?")
.append(")");
int no = DB.executeUpdate (sqlB.toString(), getTrxName(ctx));
Object[] param = new Object[] { Env.getAD_Client_ID(ctx), Env.getAD_Org_ID(ctx), Env.getAD_User_ID(ctx), Env.getAD_User_ID(ctx),
id, getPackageImpId(ctx) , objectType, objectName, objectStatus, "Success", objectID, objectIDBackup, tableName,
AD_Table_ID
};
int no = DB.executeUpdate (sqlB.toString(), param, true, getTrxName(ctx));
if (no == -1)
log.info("Insert to import detail failed");

View File

@ -816,7 +816,7 @@ public class PackInHandler extends DefaultHandler {
log.severe("Unresolved: " + d.element.getElementValue() + " - " + d.element.attributes.getValue(0) + ", " + d.element.unresolved);
}
}
throw new RuntimeException("Failed to resolve dependency for " + count + " elements.");
//throw new RuntimeException("Failed to resolve dependency for " + count + " elements."); //commented by Joyce (12 Nov 2008)
//System.err.println("Failed to resolve dependency for " + count + " elements.");
}
}

View File

@ -23,8 +23,7 @@ import java.sql.ResultSetMetaData;
import java.sql.Statement;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Properties;
import java.util.logging.Level;
@ -38,11 +37,18 @@ import org.adempiere.pipo.exception.POSaveFailedException;
import org.compiere.model.POInfo;
import org.compiere.model.X_AD_Package_Exp_Detail;
import org.compiere.util.DB;
import org.compiere.util.DisplayType;
import org.compiere.util.Env;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.AttributesImpl;
/**
*
* @author Robert Klein.
* @author Low Heng Sin
*
*/
public class DataElementHandler extends AbstractElementHandler {
private GenericPO genericPO = null;
@ -94,40 +100,40 @@ public class DataElementHandler extends AbstractElementHandler {
String elementValue = element.getElementValue();
Attributes atts = element.attributes;
log.info(elementValue+" "+atts.getValue("name"));
String d_rowname = atts.getValue("name");
// name can be null if there are keyXname attributes.
if (!d_rowname.equals("")){
int id = get_ID(ctx, d_tablename, d_rowname);
genericPO = new GenericPO(d_tablename, ctx, id, getTrxName(ctx));
if (id > 0){
AD_Backup_ID = copyRecord(ctx,d_tablename,genericPO);
objectStatus = "Update";
}
else{
objectStatus = "New";
AD_Backup_ID =0;
}
}
// keyXname and lookupkeyXname.
else {
// use keyXname and lookupkeyXname if available
if (atts.getValue("key1name") != null && atts.getValue("key1name").trim().length() > 0)
{
String sql = "select * from "+d_tablename;
String whereand = " where";
String CURRENT_KEY = "key1name";
if (atts.getValue(CURRENT_KEY) != null && !atts.getValue(CURRENT_KEY).equals("")) {
sql = sql+whereand+" "+atts.getValue(CURRENT_KEY)+"="+atts.getValue("lookup"+CURRENT_KEY);
List<String>params = new ArrayList<String>();
int keyIndex = 1;
while (true) {
String currentKey = "key" + keyIndex + "name";
if (atts.getValue(currentKey) != null && !atts.getValue(currentKey).equals("")) {
params.add(atts.getValue("lookup"+currentKey));
sql = sql+whereand+" "+atts.getValue(currentKey)+"=?";
whereand = " and";
keyIndex++;
} else {
break;
}
CURRENT_KEY = "key2name";
if (atts.getValue(CURRENT_KEY) != null && !atts.getValue(CURRENT_KEY).equals("")) {
sql = sql+whereand+" "+atts.getValue(CURRENT_KEY)+"="+atts.getValue("lookup"+CURRENT_KEY);
whereand = " and";
}
if (whereand.equals(" where"))
log.warning("no name or keyXname attribute defined.");
if (getClientId(ctx) > 0) {
sql = sql + whereand + " " + d_tablename + ".AD_Client_ID in (0, " + getClientId(ctx) + ")";
sql = sql + " Order by " + d_tablename + ".AD_Client_ID Desc";
} else {
sql = sql + whereand + " " + d_tablename + ".AD_Client_ID = 0";
}
// Load GenericPO from rs, in fact ID could not exist e.g. Attribute Value
try {
PreparedStatement pstmt = DB.prepareStatement(sql, getTrxName(ctx));
for (int i = 0; i < params.size(); i++) {
pstmt.setString(i+1, params.get(i));
}
ResultSet rs = pstmt.executeQuery();
if (rs.next()) {
@ -143,20 +149,23 @@ public class DataElementHandler extends AbstractElementHandler {
pstmt.close();
pstmt = null;
objectStatus = "New";
// set keyXname.
CURRENT_KEY = "key1name";
if (!atts.getValue(CURRENT_KEY).equals("")) {
genericPO.set_ValueOfColumn(atts.getValue(CURRENT_KEY), atts.getValue("lookup"+CURRENT_KEY));
}
CURRENT_KEY = "key2name";
if (!atts.getValue(CURRENT_KEY).equals("")) {
genericPO.set_ValueOfColumn(atts.getValue(CURRENT_KEY), atts.getValue("lookup"+CURRENT_KEY));
}
}
}
catch (Exception e) {
log.warning ("keyXname attribute. init from rs error."+e);
log.log(Level.SEVERE, e.getLocalizedMessage(), e);
}
} else {
//fallback to name attribute
String nameAttribute = atts.getValue("name");
int id = get_ID(ctx, d_tablename, nameAttribute);
genericPO = new GenericPO(d_tablename, ctx, id, getTrxName(ctx));
if (id > 0){
AD_Backup_ID = copyRecord(ctx,d_tablename,genericPO);
objectStatus = "Update";
}
else{
objectStatus = "New";
AD_Backup_ID =0;
}
}
@ -172,28 +181,6 @@ public class DataElementHandler extends AbstractElementHandler {
// globalqss: set AD_Client_ID to the client setted in adempieredata
if (getClientId(ctx) > 0 && genericPO.getAD_Client_ID() != getClientId(ctx))
genericPO.set_ValueOfColumn("AD_Client_ID", getClientId(ctx));
// if new. TODO: no defaults for keyXname.
if (!d_rowname.equals("") && ((Integer)(genericPO.get_Value(d_tablename+"_ID"))).intValue() == 0) {
log.info("new genericPO, table: "+d_tablename+" name:"+d_rowname);
genericPO.set_ValueOfColumn("Name", d_rowname);
// Set defaults.
//TODO: get defaults from configuration
HashMap defaults = new HashMap();
HashMap thisDefault = (HashMap)defaults.get(d_tablename);
if (thisDefault != null) {
Iterator iter = thisDefault.values().iterator();
ArrayList thisValue = null;
while (iter.hasNext()) {
thisValue = (ArrayList)iter.next();
if (((String)(thisValue.get(2))).equals("String"))
genericPO.set_ValueOfColumn((String)thisValue.get(0), (String)thisValue.get(1));
else if (((String)(thisValue.get(2))).equals("Integer"))
genericPO.set_ValueOfColumn((String)thisValue.get(0), Integer.valueOf((String)thisValue.get(1)));
else if (((String)(thisValue.get(2))).equals("Boolean"))
genericPO.set_ValueOfColumn((String)thisValue.get(0), new Boolean(((String)thisValue.get(1)).equals("true") ? true : false));
}
}
}
}
public void endElement(Properties ctx, Element element) throws SAXException {
@ -224,6 +211,10 @@ public class DataElementHandler extends AbstractElementHandler {
String columnName = atts.getValue("name");
int tableid = get_IDWithColumn(ctx, "AD_Table", "TableName", d_tablename);
int id =get_IDWithMasterAndColumn (ctx,"AD_Column", "ColumnName", columnName, "AD_Table", tableid);
if (id <= 0) {
log.log(Level.WARNING, "Column not found in AD_Column, TableName=" + d_tablename + " ColumnName=" + columnName);
return;
}
StringBuffer sql = new StringBuffer ("SELECT IsUpdateable FROM AD_column WHERE AD_Column_ID = ?");
String isUpdateable = DB.getSQLValueString(getTrxName(ctx), sql.toString(),id);
sql = new StringBuffer ("SELECT IsKey FROM AD_column WHERE AD_Column_ID = ?");
@ -231,36 +222,43 @@ public class DataElementHandler extends AbstractElementHandler {
if (("New".equals(objectStatus)) || (isKey.equals("N") &&
isUpdateable.equals("Y") &&
(!atts.getValue("name").equals("CreatedBy")||!atts.getValue("name").equals("UpdatedBy")))) {
if (atts.getValue("value") != null && !atts.getValue("value").equals("null")) {
String value = atts.getValue("value");
if (value != null && !value.equals("null") && value.trim().length() > 0) {
if (atts.getValue("class").equals("String") || atts.getValue("class").equals("Text")
|| atts.getValue("class").equals("List")|| atts.getValue("class").equals("Yes-No")
|| atts.getValue("class").equals("Button")
|| atts.getValue("class").equals("Memo")|| atts.getValue("class").equals("Text Long")) {
genericPO.set_ValueOfColumn(atts.getValue("name").toString(), atts.getValue("value").toString());
genericPO.set_ValueOfColumn(atts.getValue("name"), value);
}
else if (atts.getValue("class").equals("Number") || atts.getValue("class").equals("Amount")
|| atts.getValue("class").equals("Quantity")|| atts.getValue("class").equals("Costs+Prices")){
genericPO.set_ValueOfColumn(atts.getValue("name").toString(), new BigDecimal(atts.getValue("value")));
genericPO.set_ValueOfColumn(atts.getValue("name"), new BigDecimal(value));
}
else if (atts.getValue("class").equals("Integer") || atts.getValue("class").equals("ID")
|| atts.getValue("class").equals("Table Direct")|| atts.getValue("class").equals("Table")
|| atts.getValue("class").equals("Location (Address)")|| atts.getValue("class").equals("Account")
|| atts.getValue("class").equals("Color)")|| atts.getValue("class").equals("Search")
|| atts.getValue("class").equals("Locator (WH)")|| atts.getValue("class").equals("Product Attribute")) {
genericPO.set_ValueOfColumn(atts.getValue("name").toString(), Integer.valueOf(atts.getValue("value")));
genericPO.set_ValueOfColumn(atts.getValue("name"), Integer.valueOf(value));
}
else if (atts.getValue("class").equals("Boolean")) {
genericPO.set_ValueOfColumn(atts.getValue("name"), new Boolean(atts.getValue("value").equals("true") ? true : false));
genericPO.set_ValueOfColumn(atts.getValue("name"), new Boolean(value.equals("true") ? true : false));
}
else if (atts.getValue("class").equals("Date") || atts.getValue("class").equals("Date+Time")
|| atts.getValue("class").equals("Time")) {
genericPO.set_ValueOfColumn(atts.getValue("name").toString(), Timestamp.valueOf(atts.getValue("value")));
genericPO.set_ValueOfColumn(atts.getValue("name"), Timestamp.valueOf(value));
}//Binary, Radio, RowID, Image not supported
} else { // value is null
if (atts.getValue("lookupname") != null && !"".equals(atts.getValue("lookupname"))) {
// globalqss - bring support from XML2AD to lookupname
String m_tablename = atts.getValue("name").substring(0, atts.getValue("name").length()-3);
genericPO.set_ValueOfColumn(atts.getValue("name"), new Integer(getIDbyName(ctx, m_tablename, atts.getValue("lookupname"))));
} else if ( atts.getValue("sql") != null && atts.getValue("sql").trim().length() > 0) {
String idSql = atts.getValue("sql");
idSql = idSql.replace("@AD_Client_ID@", Integer.toString(getClientId(ctx)));
int result = DB.getSQLValue(getTrxName(ctx), idSql);
if (result >= 0)
genericPO.set_ValueOfColumn(atts.getValue("name"), result);
}
}
}
@ -275,6 +273,10 @@ public class DataElementHandler extends AbstractElementHandler {
}
/**
* @param ctx
* @param document
*/
public void create(Properties ctx, TransformerHandler document)
throws SAXException {
String sql = Env.getContext(ctx, X_AD_Package_Exp_Detail.COLUMNNAME_SQLStatement);
@ -295,8 +297,28 @@ public class DataElementHandler extends AbstractElementHandler {
document.startElement("","","dtable",atts);
while (rs.next()){
atts.clear();
int key1 = 0;
int keyIndex = 0;
String nameatts = "";
for (i=1 ;i <= columns;i++){
col_Name = meta.getColumnName(i).toUpperCase();
if (col_Name.equals("NAME") && rs.getObject("name") != null)
nameatts = ""+rs.getObject("name");
String sql2 = "SELECT ColumnName FROM AD_Column "
+ "WHERE isIdentifier = 'Y' AND "
+ "AD_Table_ID = ? AND "
+ "Upper(ColumnName)= '"+col_Name+"'";
String cName = DB.getSQLValueString(null,sql2,table_id);
if (cName != null){
if (cName.toUpperCase().equals(col_Name)){
keyIndex++;
atts.addAttribute("","","key" + keyIndex + "name","CDATA",cName);
atts.addAttribute("","","lookupkey" + keyIndex + "name","CDATA",""+rs.getObject(col_Name));
}
}
}
//fall back to Id
if (keyIndex == 0) {
for (i=1 ;i <= columns;i++){
col_Name = meta.getColumnName(i).toUpperCase();
if (col_Name.equals("NAME") && rs.getObject("name") != null)
@ -307,25 +329,21 @@ public class DataElementHandler extends AbstractElementHandler {
+ "Upper(ColumnName)= '"+col_Name+"'";
String cName = DB.getSQLValueString(null,sql2,table_id);
if (cName != null){
if (cName.toUpperCase().equals(col_Name) && key1 == 0 ){
atts.addAttribute("","","key1name","CDATA",cName);
atts.addAttribute("","","lookupkey1name","CDATA",""+rs.getObject(col_Name));
key1 = 1;
if (cName.toUpperCase().equals(col_Name)){
keyIndex++;
atts.addAttribute("","","key" + keyIndex + "name","CDATA",cName);
atts.addAttribute("","","lookupkey" + keyIndex + "name","CDATA",""+rs.getObject(col_Name));
}
else if (cName.toUpperCase().equals(col_Name) && key1 == 1 ){
atts.addAttribute("","","key2name","CDATA",cName);
atts.addAttribute("","","lookupkey2name","CDATA",""+rs.getObject(col_Name));
key1 = 2;
}
}
}
atts.addAttribute("","","name","CDATA",nameatts);
if ( key1 == 0 ){
if ( keyIndex == 0 ){
atts.addAttribute("","","key1name","CDATA","");
atts.addAttribute("","","lookupkey1name","CDATA","");
key1 = 1;
keyIndex++;
}
if ( key1 == 1 ){
if ( keyIndex == 1 ){
atts.addAttribute("","","key2name","CDATA","");
atts.addAttribute("","","lookupkey2name","CDATA","");
}
@ -333,11 +351,12 @@ public class DataElementHandler extends AbstractElementHandler {
for (i=1 ;i <= columns;i++){
atts.clear();
col_Name = meta.getColumnName(i).toUpperCase();
String sql2 = "Select A.ColumnName, B.Name "
String sql2 = "Select A.ColumnName, B.Name, A.AD_Reference_ID, A.AD_Reference_Value_ID "
+ "From AD_Column A, AD_Reference B "
+ "Where Upper(A.columnname) = ? and "
+ "A.AD_TABLE_ID = ? and "
+ "A.AD_Reference_ID = B.AD_Reference_ID";
+ "A.AD_Reference_ID = B.AD_Reference_ID "
+ "AND A.ColumnName != 'AD_Client_ID' ";
PreparedStatement pstmt = null;
try
{
@ -350,11 +369,50 @@ public class DataElementHandler extends AbstractElementHandler {
atts.clear();
atts.addAttribute("","","name","CDATA", rs1.getString("ColumnName"));
atts.addAttribute("","","class","CDATA", rs1.getString("Name"));
//rs1.getString("ColumnName") : NAME / VALUE
//rs1.getString("Name") : STRING
//rs1.getString("AD_Reference_ID") : number (table/table direct/ search)
//rs1.getString("AD_Reference_Value_ID") : number (null when type is table direct)
if (rs1.getInt("AD_Reference_ID") == DisplayType.Table || rs1.getInt("AD_Reference_ID") == DisplayType.Search
|| rs1.getInt("AD_Reference_ID") == DisplayType.TableDir ){
String tableName = "";
if (rs1.getInt("AD_Reference_ID") == DisplayType.TableDir){
//if rs1.getString("ColumnName") = C_EDIFORMAT_ID, tablename = C_EDIFORMAT
tableName = rs1.getString("ColumnName").substring(0,rs1.getString("ColumnName").length()-3);
}else{
//ad_ref_table.ad_reference_id = ad_reference_value_id
int referenceId = rs1.getInt("AD_Reference_Value_ID");
if (referenceId != 0)
tableName = getTableNameFromReferenceId(referenceId);
else
tableName = rs1.getString("ColumnName").substring(0,rs1.getString("ColumnName").length()-3);
}
if (rs.getObject(i) == null)
atts.addAttribute("","","value","CDATA", "");
else{
String insertSql = getSqlFromTableName(tableName,Integer.parseInt(rs.getObject(i).toString()),ctx);
String parentSql = getParentSql(tableName,ctx,Integer.parseInt(rs.getObject(i).toString()));
if (!parentSql.equals(""))
insertSql = insertSql + parentSql;
insertSql = insertSql + " Order By " + tableName + ".AD_Client_ID Desc ";
atts.addAttribute("","","value","CDATA", "");
atts.addAttribute("", "", "sql", "CDATA", insertSql);
}
} else {
if (rs1.getString("Name").equals("Date")||rs1.getString("Name").equals("Date+Time")||rs1.getString("Name").equals("Time"))
atts.addAttribute("","","value","CDATA", "" + rs.getTimestamp(i));
else
atts.addAttribute("","","value","CDATA", "" + rs.getObject(i));
}
if (!rs1.getString("ColumnName").equals("Created")&&!rs1.getString("ColumnName").equals("CreatedBy")&&
!rs1.getString("ColumnName").equals("Updated")&&!rs1.getString("ColumnName").equals("UpdatedBy")){
document.startElement("","","dcolumn",atts);
@ -385,4 +443,94 @@ public class DataElementHandler extends AbstractElementHandler {
}
private String getTableNameFromReferenceId(int referenceId){
String tableName = "";
String sql = " SELECT t.TableName FROM AD_Table T, AD_Ref_Table R "
+" WHERE T.AD_Table_ID=R.AD_Table_ID AND R.AD_Reference_ID=? ";
tableName= DB.getSQLValueString(null,sql,referenceId);
return tableName;
}
private String getSqlFromTableName(String tableName, int id, Properties ctx) throws Exception{
String result = null;
String sql = "SELECT count(a.ad_table_id) FROM ad_table a INNER JOIN ad_column b ON (a.ad_table_id = b.ad_table_id) "
+ "AND a.tablename = '" + tableName + "' AND UPPER(b.columnname) = 'VALUE'";
int count = DB.getSQLValue(null, sql);
String insertSqlValue = count <= 0
? ( "SELECT Name FROM "+tableName+" WHERE "+tableName+"_ID=?" )
: ( "SELECT Value FROM "+tableName+" WHERE "+tableName+"_ID=?" );
PreparedStatement pstmt = null;
ResultSet rs = null;
try{
pstmt = DB.prepareStatement(insertSqlValue, getTrxName(ctx));
pstmt.setInt(1, id);
rs = pstmt.executeQuery();
if (rs.next()){
if (count <= 0)
result = "SELECT " +tableName+"_ID FROM "+tableName+" WHERE Name='"+rs.getString(1)+"'";
else
result = "SELECT " +tableName+"_ID FROM "+tableName+" WHERE Value='"+rs.getString(1)+"'";
result = result + " AND " + tableName + ".AD_Client_ID IN ( @AD_Client_ID@ , 0 )";
}
} catch (Exception e) {
log.log(Level.SEVERE, e.getLocalizedMessage(), e);
} finally {
DB.close(rs, pstmt);
}
return result;
}
private String getParentSql(String tableName, Properties ctx, int recordId) throws Exception{
String parentSql = "";
PreparedStatement pstmt = null;
ResultSet rs = null;
try{
String sql = "SELECT A.ColumnName, A.AD_Reference_ID, A.AD_Reference_Value_ID "
+ "FROM AD_Column A, AD_Table T "
+ "Where A.AD_TABLE_ID = T.AD_Table_ID AND A.IsParent = 'Y' "
+ "AND UPPER(T.TableName)=? "
+ "AND A.ColumnName != 'AD_Client_ID' ";
pstmt = DB.prepareStatement(sql, getTrxName(ctx));
pstmt.setString(1,tableName.toUpperCase());
rs = pstmt.executeQuery();
while(rs.next()){
if (rs.getInt("AD_Reference_ID") == DisplayType.Table || rs.getInt("AD_Reference_ID") == DisplayType.Search || rs.getInt("AD_Reference_ID") == DisplayType.TableDir){
String parentTableName = "";
if (rs.getInt("AD_Reference_ID") == DisplayType.TableDir){
//if rs1.getString("ColumnName") = C_EDIFORMAT_ID, tablename = C_EDIFORMAT
parentTableName = rs.getString("ColumnName").substring(0,rs.getString("ColumnName").length()-3);
}else{
//ad_ref_table.ad_reference_id = ad_reference_value_id
int referenceId = rs.getInt("AD_Reference_Value_ID");
parentTableName = getTableNameFromReferenceId(referenceId);
}
String parentIdSql = "SELECT "+parentTableName+"_ID FROM "+tableName+" WHERE "+tableName+"_ID = "+recordId;
int parentRecordId = DB.getSQLValue(null, parentIdSql);
parentSql = " AND "+rs.getString("ColumnName")+ " IN (" +getParentSql(parentTableName, ctx, parentRecordId)+")";
parentSql = parentSql + " AND " + tableName + ".AD_Client_ID IN ( @AD_Client_ID@ , 0 )";
}
}
} catch (Exception e) {
log.log(Level.SEVERE, e.getLocalizedMessage(), e);
} finally{
DB.close(rs, pstmt);
}
return parentSql;
}
}

View File

@ -47,6 +47,7 @@ public class FieldElementHandler extends AbstractElementHandler {
if (element.parent != null && element.parent.getElementValue().equals("tab") &&
element.parent.defer) {
element.defer = true;
element.unresolved = element.parent.unresolved;
return;
}
String name = atts.getValue("Name");
@ -60,6 +61,7 @@ public class FieldElementHandler extends AbstractElementHandler {
packIn.addTable(tableName, tableid);
}
if (tableid <= 0) {
element.unresolved = "AD_Table=" + tableName;
element.defer = true;
return;
}
@ -67,6 +69,7 @@ public class FieldElementHandler extends AbstractElementHandler {
.getValue("ADWindowNameID"));
if (windowid <= 0) {
element.defer = true;
element.unresolved = "AD_Window=" + atts.getValue("ADWindowNameID");
return;
}
int columnid = packIn.getColumnId(tableName, colname);
@ -78,6 +81,7 @@ public class FieldElementHandler extends AbstractElementHandler {
}
if (columnid <= 0) {
element.defer = true;
element.unresolved = "AD_Column"+ colname;
return;
}
int tabid = 0;
@ -172,6 +176,7 @@ public class FieldElementHandler extends AbstractElementHandler {
}
} else {
element.defer = true;
element.unresolved = "AD_Tab=" + tabname;
return;
}
} else {

View File

@ -0,0 +1,30 @@
-- Aug 6, 2008 10:39:44 AM SGT
-- Packin to any client
UPDATE AD_Table SET AccessLevel='6',Updated=TO_DATE('2008-08-06 10:39:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Table_ID=50008
;
-- Aug 6, 2008 10:39:57 AM SGT
-- Packin to any client
UPDATE AD_Table SET AccessLevel='6',Updated=TO_DATE('2008-08-06 10:39:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Table_ID=50003
;
-- Aug 6, 2008 10:40:31 AM SGT
-- Packin to any client
DELETE FROM AD_Window_Access WHERE AD_Role_ID=102
;
-- Aug 6, 2008 10:40:32 AM SGT
-- Packin to any client
INSERT INTO AD_Window_Access (AD_Window_ID, AD_Role_ID, AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadWrite) SELECT DISTINCT w.AD_Window_ID, 102,11,0,'Y', SysDate,100, SysDate,100,'Y' FROM AD_Window w INNER JOIN AD_Tab t ON (w.AD_Window_ID=t.AD_Window_ID) INNER JOIN AD_Table tt ON (t.AD_Table_ID=tt.AD_Table_ID) WHERE t.SeqNo=(SELECT MIN(SeqNo) FROM AD_Tab xt WHERE xt.AD_Window_ID=w.AD_Window_ID)AND tt.AccessLevel IN ('7','6','3','2','1')
;
-- Aug 6, 2008 10:40:32 AM SGT
-- Packin to any client
DELETE FROM AD_Process_Access WHERE AD_Role_ID=102
;
-- Aug 6, 2008 10:40:32 AM SGT
-- Packin to any client
INSERT INTO AD_Process_Access (AD_Process_ID, AD_Role_ID, AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadWrite) SELECT DISTINCT p.AD_Process_ID, 102,11,0,'Y', SysDate,100, SysDate,100,'Y' FROM AD_Process p WHERE AccessLevel IN ('7','6','3','2','1')
;

View File

@ -0,0 +1,30 @@
-- Aug 6, 2008 10:39:44 AM SGT
-- Packin to any client
UPDATE AD_Table SET AccessLevel='6',Updated=TO_TIMESTAMP('2008-08-06 10:39:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Table_ID=50008
;
-- Aug 6, 2008 10:39:57 AM SGT
-- Packin to any client
UPDATE AD_Table SET AccessLevel='6',Updated=TO_TIMESTAMP('2008-08-06 10:39:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Table_ID=50003
;
-- Aug 6, 2008 10:40:32 AM SGT
-- Packin to any client
DELETE FROM AD_Window_Access WHERE AD_Role_ID=102
;
-- Aug 6, 2008 10:40:32 AM SGT
-- Packin to any client
INSERT INTO AD_Window_Access (AD_Window_ID, AD_Role_ID, AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadWrite) SELECT DISTINCT w.AD_Window_ID, 102,11,0,'Y', CURRENT_TIMESTAMP,100, CURRENT_TIMESTAMP,100,'Y' FROM AD_Window w INNER JOIN AD_Tab t ON (w.AD_Window_ID=t.AD_Window_ID) INNER JOIN AD_Table tt ON (t.AD_Table_ID=tt.AD_Table_ID) WHERE t.SeqNo=(SELECT MIN(SeqNo) FROM AD_Tab xt WHERE xt.AD_Window_ID=w.AD_Window_ID)AND tt.AccessLevel IN ('7','6','3','2','1')
;
-- Aug 6, 2008 10:40:32 AM SGT
-- Packin to any client
DELETE FROM AD_Process_Access WHERE AD_Role_ID=102
;
-- Aug 6, 2008 10:40:32 AM SGT
-- Packin to any client
INSERT INTO AD_Process_Access (AD_Process_ID, AD_Role_ID, AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadWrite) SELECT DISTINCT p.AD_Process_ID, 102,11,0,'Y', CURRENT_TIMESTAMP,100, CURRENT_TIMESTAMP,100,'Y' FROM AD_Process p WHERE AccessLevel IN ('7','6','3','2','1')
;