FR [ 1828521 ] Centralized ID management
changed Official dictionary default to Y - project default to N for projects don't update if the current sequence is greater (help to manage sequences for project independent from customer)
This commit is contained in:
parent
072a31b274
commit
5e735aeb8e
|
@ -156,8 +156,8 @@ public class MSequence extends X_AD_Sequence
|
||||||
// If maintaining official dictionary try to get the ID from http official server
|
// If maintaining official dictionary try to get the ID from http official server
|
||||||
if (adempiereSys) {
|
if (adempiereSys) {
|
||||||
|
|
||||||
String isUseCentralizedID = MSysConfig.getValue("DICTIONARY_ID_USE_CENTRALIZED_ID"); // "Y"
|
String isUseCentralizedID = MSysConfig.getValue("DICTIONARY_ID_USE_CENTRALIZED_ID", "Y"); // defaults to Y
|
||||||
if (isUseCentralizedID != null && isUseCentralizedID.equals("Y")) {
|
if (! isUseCentralizedID.equals("N")) {
|
||||||
// get ID from http site
|
// get ID from http site
|
||||||
retValue = getNextOfficialID_HTTP(TableName);
|
retValue = getNextOfficialID_HTTP(TableName);
|
||||||
if (retValue > 0) {
|
if (retValue > 0) {
|
||||||
|
@ -176,13 +176,13 @@ public class MSequence extends X_AD_Sequence
|
||||||
// If not official dictionary try to get the ID from http custom server - if configured
|
// If not official dictionary try to get the ID from http custom server - if configured
|
||||||
if (hasEntityType && ! adempiereSys) {
|
if (hasEntityType && ! adempiereSys) {
|
||||||
|
|
||||||
String isUseProjectCentralizedID = MSysConfig.getValue("PROJECT_ID_USE_CENTRALIZED_ID"); // "Y"
|
String isUseProjectCentralizedID = MSysConfig.getValue("PROJECT_ID_USE_CENTRALIZED_ID", "N"); // defaults to N
|
||||||
if (isUseProjectCentralizedID != null && isUseProjectCentralizedID.equals("Y")) {
|
if (isUseProjectCentralizedID.equals("Y")) {
|
||||||
// get ID from http site
|
// get ID from http site
|
||||||
retValue = getNextProjectID_HTTP(TableName);
|
retValue = getNextProjectID_HTTP(TableName);
|
||||||
if (retValue > 0) {
|
if (retValue > 0) {
|
||||||
PreparedStatement updateSQL;
|
PreparedStatement updateSQL;
|
||||||
updateSQL = conn.prepareStatement("UPDATE AD_Sequence SET CurrentNext = ? + 1 WHERE AD_Sequence_ID = ?");
|
updateSQL = conn.prepareStatement("UPDATE AD_Sequence SET CurrentNext = GREATEST(CurrentNext, ? + 1) WHERE AD_Sequence_ID = ?");
|
||||||
updateSQL.setInt(1, retValue);
|
updateSQL.setInt(1, retValue);
|
||||||
updateSQL.setInt(2, AD_Sequence_ID);
|
updateSQL.setInt(2, AD_Sequence_ID);
|
||||||
updateSQL.executeUpdate();
|
updateSQL.executeUpdate();
|
||||||
|
|
|
@ -58,9 +58,10 @@ public class MSysConfig extends X_AD_SysConfig
|
||||||
/**
|
/**
|
||||||
* Get system configuration property of type string
|
* Get system configuration property of type string
|
||||||
* @param Name
|
* @param Name
|
||||||
|
* @param defaultValue
|
||||||
* @return String
|
* @return String
|
||||||
*/
|
*/
|
||||||
public static String getValue(String Name)
|
public static String getValue(String Name, String defaultValue)
|
||||||
{
|
{
|
||||||
String str = null;
|
String str = null;
|
||||||
String sql = "SELECT Value FROM AD_SysConfig WHERE Name=? and IsActive='Y'";
|
String sql = "SELECT Value FROM AD_SysConfig WHERE Name=? and IsActive='Y'";
|
||||||
|
@ -79,10 +80,20 @@ public class MSysConfig extends X_AD_SysConfig
|
||||||
s_log.log(Level.SEVERE, "getValue", e);
|
s_log.log(Level.SEVERE, "getValue", e);
|
||||||
}
|
}
|
||||||
if (str == null)
|
if (str == null)
|
||||||
return null;
|
return defaultValue;
|
||||||
return (str.trim());
|
return (str.trim());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get system configuration property of type string
|
||||||
|
* @param Name
|
||||||
|
* @return String
|
||||||
|
*/
|
||||||
|
public static String getValue(String Name)
|
||||||
|
{
|
||||||
|
return (getValue(Name, null));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get system configuration property of type int
|
* Get system configuration property of type int
|
||||||
* @param Name
|
* @param Name
|
||||||
|
|
Loading…
Reference in New Issue