IDEMPIERE-720 UUID Generator doesn't work #resolve
This commit is contained in:
parent
5781427ac6
commit
17560dba8e
|
@ -23,6 +23,7 @@ import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import org.adempiere.exceptions.DBException;
|
import org.adempiere.exceptions.DBException;
|
||||||
import org.compiere.model.MColumn;
|
import org.compiere.model.MColumn;
|
||||||
|
@ -48,6 +49,9 @@ public class UUIDGenerator extends SvrProcess {
|
||||||
|
|
||||||
private String tableName;
|
private String tableName;
|
||||||
|
|
||||||
|
/** Logger */
|
||||||
|
private static CLogger log = CLogger.getCLogger(UUIDGenerator.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.compiere.process.SvrProcess#prepare()
|
* @see org.compiere.process.SvrProcess#prepare()
|
||||||
*/
|
*/
|
||||||
|
@ -94,7 +98,7 @@ public class UUIDGenerator extends SvrProcess {
|
||||||
String columnName = PO.getUUIDColumnName(cTableName);
|
String columnName = PO.getUUIDColumnName(cTableName);
|
||||||
int AD_Column_ID = DB.getSQLValue(null, "SELECT AD_Column_ID FROM AD_Column Where AD_Table_ID = ? AND ColumnName = ?", AD_Table_ID, columnName);
|
int AD_Column_ID = DB.getSQLValue(null, "SELECT AD_Column_ID FROM AD_Column Where AD_Table_ID = ? AND ColumnName = ?", AD_Table_ID, columnName);
|
||||||
if (AD_Column_ID <= 0) {
|
if (AD_Column_ID <= 0) {
|
||||||
System.out.println("Adding UUID to " + cTableName);
|
if (log.isLoggable(Level.INFO)) log.info("Adding UUID to " + cTableName);
|
||||||
count++;
|
count++;
|
||||||
//create column
|
//create column
|
||||||
MColumn mColumn = new MColumn(getCtx(), 0, null);
|
MColumn mColumn = new MColumn(getCtx(), 0, null);
|
||||||
|
@ -142,6 +146,10 @@ public class UUIDGenerator extends SvrProcess {
|
||||||
} else {
|
} else {
|
||||||
compositeKeys = Arrays.asList(table.getKeyColumns());
|
compositeKeys = Arrays.asList(table.getKeyColumns());
|
||||||
}
|
}
|
||||||
|
if ((compositeKeys == null || compositeKeys.size() == 0) && keyColumn == null) {
|
||||||
|
log.warning("Cannot update orphan table " + table.getTableName() + " (not ID neither parents)");
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (compositeKeys == null) {
|
if (compositeKeys == null) {
|
||||||
sql.append(keyColumn);
|
sql.append(keyColumn);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue