From dbf854396a5148c2314f5e5504e73484079c62e9 Mon Sep 17 00:00:00 2001 From: Deepak Pansheriya Date: Tue, 16 Oct 2012 13:08:12 +0530 Subject: [PATCH] IDEMPIERE-389: Appending Host name and IP to server name and adding field for server name on session audit --- .../oracle/934_IDEMPIERE-389.sql | 6 +- .../936_IDEMPIERE-389_ServerName_Field.sql | 133 ++++++++++++++++++ .../postgresql/934_IDEMPIERE-389.sql | 6 +- .../936_IDEMPIERE-389_ServerName_Field.sql | 133 ++++++++++++++++++ .../src/org/compiere/model/MSession.java | 6 +- .../src/org/compiere/util/WebUtil.java | 29 ++++ 6 files changed, 305 insertions(+), 8 deletions(-) create mode 100644 migration/360lts-release/oracle/936_IDEMPIERE-389_ServerName_Field.sql create mode 100644 migration/360lts-release/postgresql/936_IDEMPIERE-389_ServerName_Field.sql diff --git a/migration/360lts-release/oracle/934_IDEMPIERE-389.sql b/migration/360lts-release/oracle/934_IDEMPIERE-389.sql index 4bbf7d9174..1d73de3e20 100644 --- a/migration/360lts-release/oracle/934_IDEMPIERE-389.sql +++ b/migration/360lts-release/oracle/934_IDEMPIERE-389.sql @@ -1,6 +1,6 @@ -- Oct 15, 2012 6:21:27 PM IST -- IDEMPIERE-389 Adding server name on AD_Session -INSERT INTO AD_Element (ColumnName,AD_Element_ID,Help,EntityType,Name,PrintName,AD_Element_UU,AD_Client_ID,Created,Updated,AD_Org_ID,CreatedBy,UpdatedBy,IsActive) VALUES ('ServerName',200182,'Load balancing instance name','U','Server Name','Server Name','7bd7b80a-d97d-4643-8d69-e2856a2a144a',0,TO_DATE('2012-10-15 18:21:26','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2012-10-15 18:21:26','YYYY-MM-DD HH24:MI:SS'),0,100,100,'Y') +INSERT INTO AD_Element (ColumnName,AD_Element_ID,Help,EntityType,Name,PrintName,AD_Element_UU,AD_Client_ID,Created,Updated,AD_Org_ID,CreatedBy,UpdatedBy,IsActive) VALUES ('ServerName',200182,'Node instance name','D','Server Name','Server Name','7bd7b80a-d97d-4643-8d69-e2856a2a144a',0,TO_DATE('2012-10-15 18:21:26','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2012-10-15 18:21:26','YYYY-MM-DD HH24:MI:SS'),0,100,100,'Y') ; -- Oct 15, 2012 6:21:27 PM IST @@ -10,7 +10,7 @@ INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Help,PO_Description,PO_He -- Oct 15, 2012 6:22:04 PM IST -- IDEMPIERE-389 Adding server name on AD_Session -INSERT INTO AD_Column (Version,AD_Table_ID,AD_Column_ID,EntityType,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Help,Name,IsAllowCopy,CreatedBy,Updated,AD_Org_ID,IsActive,Created,UpdatedBy,AD_Client_ID,SeqNoSelection) VALUES (0,566,200613,'U','N','N','N',0,'N',40,'Y',14,'N','N',200182,'N','Y','14d3c02e-9f80-40cb-8507-e040fbaf3ef6','N','Y','N','ServerName','Load balancing instance name','Server Name','Y',100,TO_DATE('2012-10-15 18:22:03','YYYY-MM-DD HH24:MI:SS'),0,'Y',TO_DATE('2012-10-15 18:22:03','YYYY-MM-DD HH24:MI:SS'),100,0,0) +INSERT INTO AD_Column (Version,AD_Table_ID,AD_Column_ID,EntityType,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Help,Name,IsAllowCopy,CreatedBy,Updated,AD_Org_ID,IsActive,Created,UpdatedBy,AD_Client_ID,SeqNoSelection) VALUES (0,566,200613,'D','N','N','N',0,'N',80,'Y',14,'N','N',200182,'N','Y','14d3c02e-9f80-40cb-8507-e040fbaf3ef6','N','Y','N','ServerName','Node instance name','Server Name','Y',100,TO_DATE('2012-10-15 18:22:03','YYYY-MM-DD HH24:MI:SS'),0,'Y',TO_DATE('2012-10-15 18:22:03','YYYY-MM-DD HH24:MI:SS'),100,0,0) ; -- Oct 15, 2012 6:22:04 PM IST @@ -20,7 +20,7 @@ INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Clien -- Oct 15, 2012 6:22:45 PM IST -- IDEMPIERE-389 Adding server name on AD_Session -ALTER TABLE AD_Session ADD ServerName NVARCHAR2(40) DEFAULT NULL +ALTER TABLE AD_Session ADD ServerName NVARCHAR2(80) DEFAULT NULL ; SELECT register_migration_script('934_IDEMPIERE-389.sql') FROM dual diff --git a/migration/360lts-release/oracle/936_IDEMPIERE-389_ServerName_Field.sql b/migration/360lts-release/oracle/936_IDEMPIERE-389_ServerName_Field.sql new file mode 100644 index 0000000000..a763f847d9 --- /dev/null +++ b/migration/360lts-release/oracle/936_IDEMPIERE-389_ServerName_Field.sql @@ -0,0 +1,133 @@ +-- Oct 16, 2012 11:39:49 AM IST +-- IDEMPIERE-389 Adding server name on AD_Session +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,AD_Column_ID,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,EntityType,Name,IsFieldOnly,IsDisplayed,AD_Field_UU,UpdatedBy,AD_Org_ID,Created,AD_Client_ID,CreatedBy,Updated,IsActive) VALUES ('N',475,36,'N','N',60501,'Y',200638,'N','D','AD_Session_UU','N','Y','bf38a28b-bfab-4c21-8626-18322acd7807',100,0,TO_DATE('2012-10-16 11:39:47','YYYY-MM-DD HH24:MI:SS'),0,100,TO_DATE('2012-10-16 11:39:47','YYYY-MM-DD HH24:MI:SS'),'Y') +; + +-- Oct 16, 2012 11:39:49 AM IST +-- IDEMPIERE-389 Adding server name on AD_Session +INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Help,Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Field_Trl_UU ) SELECT l.AD_Language,t.AD_Field_ID, t.Help,t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=200638 AND NOT EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID) +; + +-- Oct 16, 2012 11:39:50 AM IST +-- IDEMPIERE-389 Adding server name on AD_Session +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,AD_Column_ID,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Help,EntityType,Name,IsFieldOnly,IsDisplayed,AD_Field_UU,UpdatedBy,AD_Org_ID,Created,AD_Client_ID,CreatedBy,Updated,IsActive) VALUES ('N',475,40,'N','N',200613,'Y',200639,'N','Node instance name','D','Server Name','N','Y','7b8abf7a-5cb6-4d8e-9ed4-a0191ea16c7f',100,0,TO_DATE('2012-10-16 11:39:49','YYYY-MM-DD HH24:MI:SS'),0,100,TO_DATE('2012-10-16 11:39:49','YYYY-MM-DD HH24:MI:SS'),'Y') +; + +-- Oct 16, 2012 11:39:50 AM IST +-- IDEMPIERE-389 Adding server name on AD_Session +INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Help,Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Field_Trl_UU ) SELECT l.AD_Language,t.AD_Field_ID, t.Help,t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=200639 AND NOT EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID) +; + +-- Oct 16, 2012 11:42:31 AM IST +-- IDEMPIERE-389 Adding server name on AD_Session +UPDATE AD_Field SET SeqNoGrid=80,IsDisplayedGrid='Y' WHERE AD_Field_ID=200639 +; + +-- Oct 16, 2012 11:42:31 AM IST +-- IDEMPIERE-389 Adding server name on AD_Session +UPDATE AD_Field SET SeqNoGrid=90,IsDisplayedGrid='Y' WHERE AD_Field_ID=6620 +; + +-- Oct 16, 2012 11:42:31 AM IST +-- IDEMPIERE-389 Adding server name on AD_Session +UPDATE AD_Field SET SeqNoGrid=100,IsDisplayedGrid='Y' WHERE AD_Field_ID=54394 +; + +-- Oct 16, 2012 11:42:31 AM IST +-- IDEMPIERE-389 Adding server name on AD_Session +UPDATE AD_Field SET SeqNoGrid=110,IsDisplayedGrid='Y' WHERE AD_Field_ID=54395 +; + +-- Oct 16, 2012 11:42:31 AM IST +-- IDEMPIERE-389 Adding server name on AD_Session +UPDATE AD_Field SET SeqNoGrid=120,IsDisplayedGrid='Y' WHERE AD_Field_ID=54393 +; + +-- Oct 16, 2012 11:42:31 AM IST +-- IDEMPIERE-389 Adding server name on AD_Session +UPDATE AD_Field SET SeqNoGrid=130,IsDisplayedGrid='Y' WHERE AD_Field_ID=6622 +; + +-- Oct 16, 2012 11:42:31 AM IST +-- IDEMPIERE-389 Adding server name on AD_Session +UPDATE AD_Field SET SeqNoGrid=140,IsDisplayedGrid='Y' WHERE AD_Field_ID=200638 +; + +-- Oct 16, 2012 12:01:13 PM IST +-- IDEMPIERE-389 Adding server name on AD_Session +UPDATE AD_Field SET SeqNo=80,IsDisplayed='Y' WHERE AD_Field_ID=200639 +; + +-- Oct 16, 2012 12:01:13 PM IST +-- IDEMPIERE-389 Adding server name on AD_Session +UPDATE AD_Field SET SeqNo=90,IsDisplayed='Y' WHERE AD_Field_ID=6620 +; + +-- Oct 16, 2012 12:01:13 PM IST +-- IDEMPIERE-389 Adding server name on AD_Session +UPDATE AD_Field SET SeqNo=100,IsDisplayed='Y' WHERE AD_Field_ID=54394 +; + +-- Oct 16, 2012 12:01:13 PM IST +-- IDEMPIERE-389 Adding server name on AD_Session +UPDATE AD_Field SET SeqNo=110,IsDisplayed='Y' WHERE AD_Field_ID=54395 +; + +-- Oct 16, 2012 12:01:13 PM IST +-- IDEMPIERE-389 Adding server name on AD_Session +UPDATE AD_Field SET SeqNo=120,IsDisplayed='Y' WHERE AD_Field_ID=54393 +; + +-- Oct 16, 2012 12:01:13 PM IST +-- IDEMPIERE-389 Adding server name on AD_Session +UPDATE AD_Field SET SeqNo=130,IsDisplayed='Y' WHERE AD_Field_ID=6622 +; + +-- Oct 16, 2012 12:01:13 PM IST +-- IDEMPIERE-389 Adding server name on AD_Session +UPDATE AD_Field SET SeqNo=140,IsDisplayed='Y' WHERE AD_Field_ID=200638 +; + +-- Oct 16, 2012 12:03:37 PM IST +-- IDEMPIERE-389 Adding server name on AD_Session +UPDATE AD_Field SET IsSameLine='Y',Updated=TO_DATE('2012-10-16 12:03:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200639 +; + +-- Oct 16, 2012 12:04:28 PM IST +-- IDEMPIERE-389 Adding server name on AD_Session +UPDATE AD_Field SET XPosition=3,Updated=TO_DATE('2012-10-16 12:04:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200639 +; + +-- Oct 16, 2012 12:05:12 PM IST +-- IDEMPIERE-389 Adding server name on AD_Session +UPDATE AD_Field SET XPosition=1,Updated=TO_DATE('2012-10-16 12:05:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200639 +; + +-- Oct 16, 2012 12:05:44 PM IST +-- IDEMPIERE-389 Adding server name on AD_Session +UPDATE AD_Field SET IsSameLine='N',Updated=TO_DATE('2012-10-16 12:05:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200639 +; + +-- Oct 16, 2012 12:06:43 PM IST +-- IDEMPIERE-389 Adding server name on AD_Session +UPDATE AD_Field SET IsSameLine='Y', XPosition=4,Updated=TO_DATE('2012-10-16 12:06:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=6620 +; + +-- Oct 16, 2012 12:11:26 PM IST +-- IDEMPIERE-389 Adding server name on AD_Session +UPDATE AD_Field SET SeqNo=110, XPosition=1,Updated=TO_DATE('2012-10-16 12:11:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=54394 +; + +-- Oct 16, 2012 12:11:43 PM IST +-- IDEMPIERE-389 Adding server name on AD_Session +UPDATE AD_Field SET SeqNo=100,Updated=TO_DATE('2012-10-16 12:11:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=54395 +; + +-- Oct 16, 2012 12:12:44 PM IST +-- IDEMPIERE-389 Adding server name on AD_Session +UPDATE AD_Field SET XPosition=4,Updated=TO_DATE('2012-10-16 12:12:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=54394 +; + + +SELECT register_migration_script('936_IDEMPIERE-389_ServerName_Field.sql') FROM dual +; diff --git a/migration/360lts-release/postgresql/934_IDEMPIERE-389.sql b/migration/360lts-release/postgresql/934_IDEMPIERE-389.sql index c2940b2e68..7f701aa734 100644 --- a/migration/360lts-release/postgresql/934_IDEMPIERE-389.sql +++ b/migration/360lts-release/postgresql/934_IDEMPIERE-389.sql @@ -1,6 +1,6 @@ -- Oct 15, 2012 6:21:27 PM IST -- IDEMPIERE-389 Adding server name on AD_Session -INSERT INTO AD_Element (ColumnName,AD_Element_ID,Help,EntityType,Name,PrintName,AD_Element_UU,AD_Client_ID,Created,Updated,AD_Org_ID,CreatedBy,UpdatedBy,IsActive) VALUES ('ServerName',200182,'Load balancing instance name','U','Server Name','Server Name','7bd7b80a-d97d-4643-8d69-e2856a2a144a',0,TO_TIMESTAMP('2012-10-15 18:21:26','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2012-10-15 18:21:26','YYYY-MM-DD HH24:MI:SS'),0,100,100,'Y') +INSERT INTO AD_Element (ColumnName,AD_Element_ID,Help,EntityType,Name,PrintName,AD_Element_UU,AD_Client_ID,Created,Updated,AD_Org_ID,CreatedBy,UpdatedBy,IsActive) VALUES ('ServerName',200182,'Node instance name','D','Server Name','Server Name','7bd7b80a-d97d-4643-8d69-e2856a2a144a',0,TO_TIMESTAMP('2012-10-15 18:21:26','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2012-10-15 18:21:26','YYYY-MM-DD HH24:MI:SS'),0,100,100,'Y') ; -- Oct 15, 2012 6:21:27 PM IST @@ -10,7 +10,7 @@ INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Help,PO_Description,PO_He -- Oct 15, 2012 6:22:04 PM IST -- IDEMPIERE-389 Adding server name on AD_Session -INSERT INTO AD_Column (Version,AD_Table_ID,AD_Column_ID,EntityType,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Help,Name,IsAllowCopy,CreatedBy,Updated,AD_Org_ID,IsActive,Created,UpdatedBy,AD_Client_ID,SeqNoSelection) VALUES (0,566,200613,'U','N','N','N',0,'N',40,'Y',14,'N','N',200182,'N','Y','14d3c02e-9f80-40cb-8507-e040fbaf3ef6','N','Y','N','ServerName','Load balancing instance name','Server Name','Y',100,TO_TIMESTAMP('2012-10-15 18:22:03','YYYY-MM-DD HH24:MI:SS'),0,'Y',TO_TIMESTAMP('2012-10-15 18:22:03','YYYY-MM-DD HH24:MI:SS'),100,0,0) +INSERT INTO AD_Column (Version,AD_Table_ID,AD_Column_ID,EntityType,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsParent,FieldLength,IsSelectionColumn,AD_Reference_ID,IsSyncDatabase,IsKey,AD_Element_ID,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsEncrypted,IsUpdateable,IsAlwaysUpdateable,ColumnName,Help,Name,IsAllowCopy,CreatedBy,Updated,AD_Org_ID,IsActive,Created,UpdatedBy,AD_Client_ID,SeqNoSelection) VALUES (0,566,200613,'D','N','N','N',0,'N',80,'Y',14,'N','N',200182,'N','Y','14d3c02e-9f80-40cb-8507-e040fbaf3ef6','N','Y','N','ServerName','Node instance name','Server Name','Y',100,TO_TIMESTAMP('2012-10-15 18:22:03','YYYY-MM-DD HH24:MI:SS'),0,'Y',TO_TIMESTAMP('2012-10-15 18:22:03','YYYY-MM-DD HH24:MI:SS'),100,0,0) ; -- Oct 15, 2012 6:22:04 PM IST @@ -20,7 +20,7 @@ INSERT INTO AD_Column_Trl (AD_Language,AD_Column_ID, Name, IsTranslated,AD_Clien -- Oct 15, 2012 6:22:45 PM IST -- IDEMPIERE-389 Adding server name on AD_Session -ALTER TABLE AD_Session ADD COLUMN ServerName VARCHAR(40) DEFAULT NULL +ALTER TABLE AD_Session ADD COLUMN ServerName VARCHAR(80) DEFAULT NULL ; SELECT register_migration_script('934_IDEMPIERE-389.sql') FROM dual diff --git a/migration/360lts-release/postgresql/936_IDEMPIERE-389_ServerName_Field.sql b/migration/360lts-release/postgresql/936_IDEMPIERE-389_ServerName_Field.sql new file mode 100644 index 0000000000..2378c1f480 --- /dev/null +++ b/migration/360lts-release/postgresql/936_IDEMPIERE-389_ServerName_Field.sql @@ -0,0 +1,133 @@ +-- Oct 16, 2012 11:39:49 AM IST +-- IDEMPIERE-389 Adding server name on AD_Session +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,AD_Column_ID,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,EntityType,Name,IsFieldOnly,IsDisplayed,AD_Field_UU,UpdatedBy,AD_Org_ID,Created,AD_Client_ID,CreatedBy,Updated,IsActive) VALUES ('N',475,36,'N','N',60501,'Y',200638,'N','D','AD_Session_UU','N','Y','bf38a28b-bfab-4c21-8626-18322acd7807',100,0,TO_TIMESTAMP('2012-10-16 11:39:47','YYYY-MM-DD HH24:MI:SS'),0,100,TO_TIMESTAMP('2012-10-16 11:39:47','YYYY-MM-DD HH24:MI:SS'),'Y') +; + +-- Oct 16, 2012 11:39:49 AM IST +-- IDEMPIERE-389 Adding server name on AD_Session +INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Help,Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Field_Trl_UU ) SELECT l.AD_Language,t.AD_Field_ID, t.Help,t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=200638 AND NOT EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID) +; + +-- Oct 16, 2012 11:39:50 AM IST +-- IDEMPIERE-389 Adding server name on AD_Session +INSERT INTO AD_Field (IsEncrypted,AD_Tab_ID,DisplayLength,IsSameLine,IsHeading,AD_Column_ID,IsCentrallyMaintained,AD_Field_ID,IsReadOnly,Help,EntityType,Name,IsFieldOnly,IsDisplayed,AD_Field_UU,UpdatedBy,AD_Org_ID,Created,AD_Client_ID,CreatedBy,Updated,IsActive) VALUES ('N',475,40,'N','N',200613,'Y',200639,'N','Node instance name','D','Server Name','N','Y','7b8abf7a-5cb6-4d8e-9ed4-a0191ea16c7f',100,0,TO_TIMESTAMP('2012-10-16 11:39:49','YYYY-MM-DD HH24:MI:SS'),0,100,TO_TIMESTAMP('2012-10-16 11:39:49','YYYY-MM-DD HH24:MI:SS'),'Y') +; + +-- Oct 16, 2012 11:39:50 AM IST +-- IDEMPIERE-389 Adding server name on AD_Session +INSERT INTO AD_Field_Trl (AD_Language,AD_Field_ID, Help,Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Field_Trl_UU ) SELECT l.AD_Language,t.AD_Field_ID, t.Help,t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Field t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Field_ID=200639 AND NOT EXISTS (SELECT * FROM AD_Field_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Field_ID=t.AD_Field_ID) +; + +-- Oct 16, 2012 11:42:31 AM IST +-- IDEMPIERE-389 Adding server name on AD_Session +UPDATE AD_Field SET SeqNoGrid=80,IsDisplayedGrid='Y' WHERE AD_Field_ID=200639 +; + +-- Oct 16, 2012 11:42:31 AM IST +-- IDEMPIERE-389 Adding server name on AD_Session +UPDATE AD_Field SET SeqNoGrid=90,IsDisplayedGrid='Y' WHERE AD_Field_ID=6620 +; + +-- Oct 16, 2012 11:42:31 AM IST +-- IDEMPIERE-389 Adding server name on AD_Session +UPDATE AD_Field SET SeqNoGrid=100,IsDisplayedGrid='Y' WHERE AD_Field_ID=54394 +; + +-- Oct 16, 2012 11:42:31 AM IST +-- IDEMPIERE-389 Adding server name on AD_Session +UPDATE AD_Field SET SeqNoGrid=110,IsDisplayedGrid='Y' WHERE AD_Field_ID=54395 +; + +-- Oct 16, 2012 11:42:31 AM IST +-- IDEMPIERE-389 Adding server name on AD_Session +UPDATE AD_Field SET SeqNoGrid=120,IsDisplayedGrid='Y' WHERE AD_Field_ID=54393 +; + +-- Oct 16, 2012 11:42:31 AM IST +-- IDEMPIERE-389 Adding server name on AD_Session +UPDATE AD_Field SET SeqNoGrid=130,IsDisplayedGrid='Y' WHERE AD_Field_ID=6622 +; + +-- Oct 16, 2012 11:42:31 AM IST +-- IDEMPIERE-389 Adding server name on AD_Session +UPDATE AD_Field SET SeqNoGrid=140,IsDisplayedGrid='Y' WHERE AD_Field_ID=200638 +; + +-- Oct 16, 2012 12:01:13 PM IST +-- IDEMPIERE-389 Adding server name on AD_Session +UPDATE AD_Field SET SeqNo=80,IsDisplayed='Y' WHERE AD_Field_ID=200639 +; + +-- Oct 16, 2012 12:01:13 PM IST +-- IDEMPIERE-389 Adding server name on AD_Session +UPDATE AD_Field SET SeqNo=90,IsDisplayed='Y' WHERE AD_Field_ID=6620 +; + +-- Oct 16, 2012 12:01:13 PM IST +-- IDEMPIERE-389 Adding server name on AD_Session +UPDATE AD_Field SET SeqNo=100,IsDisplayed='Y' WHERE AD_Field_ID=54394 +; + +-- Oct 16, 2012 12:01:13 PM IST +-- IDEMPIERE-389 Adding server name on AD_Session +UPDATE AD_Field SET SeqNo=110,IsDisplayed='Y' WHERE AD_Field_ID=54395 +; + +-- Oct 16, 2012 12:01:13 PM IST +-- IDEMPIERE-389 Adding server name on AD_Session +UPDATE AD_Field SET SeqNo=120,IsDisplayed='Y' WHERE AD_Field_ID=54393 +; + +-- Oct 16, 2012 12:01:13 PM IST +-- IDEMPIERE-389 Adding server name on AD_Session +UPDATE AD_Field SET SeqNo=130,IsDisplayed='Y' WHERE AD_Field_ID=6622 +; + +-- Oct 16, 2012 12:01:13 PM IST +-- IDEMPIERE-389 Adding server name on AD_Session +UPDATE AD_Field SET SeqNo=140,IsDisplayed='Y' WHERE AD_Field_ID=200638 +; + +-- Oct 16, 2012 12:03:37 PM IST +-- IDEMPIERE-389 Adding server name on AD_Session +UPDATE AD_Field SET IsSameLine='Y',Updated=TO_TIMESTAMP('2012-10-16 12:03:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200639 +; + +-- Oct 16, 2012 12:04:28 PM IST +-- IDEMPIERE-389 Adding server name on AD_Session +UPDATE AD_Field SET XPosition=3,Updated=TO_TIMESTAMP('2012-10-16 12:04:28','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200639 +; + +-- Oct 16, 2012 12:05:12 PM IST +-- IDEMPIERE-389 Adding server name on AD_Session +UPDATE AD_Field SET XPosition=1,Updated=TO_TIMESTAMP('2012-10-16 12:05:12','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200639 +; + +-- Oct 16, 2012 12:05:44 PM IST +-- IDEMPIERE-389 Adding server name on AD_Session +UPDATE AD_Field SET IsSameLine='N',Updated=TO_TIMESTAMP('2012-10-16 12:05:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200639 +; + +-- Oct 16, 2012 12:06:43 PM IST +-- IDEMPIERE-389 Adding server name on AD_Session +UPDATE AD_Field SET IsSameLine='Y', XPosition=4,Updated=TO_TIMESTAMP('2012-10-16 12:06:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=6620 +; + +-- Oct 16, 2012 12:11:26 PM IST +-- IDEMPIERE-389 Adding server name on AD_Session +UPDATE AD_Field SET SeqNo=110, XPosition=1,Updated=TO_TIMESTAMP('2012-10-16 12:11:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=54394 +; + +-- Oct 16, 2012 12:11:43 PM IST +-- IDEMPIERE-389 Adding server name on AD_Session +UPDATE AD_Field SET SeqNo=100,Updated=TO_TIMESTAMP('2012-10-16 12:11:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=54395 +; + +-- Oct 16, 2012 12:12:44 PM IST +-- IDEMPIERE-389 Adding server name on AD_Session +UPDATE AD_Field SET XPosition=4,Updated=TO_TIMESTAMP('2012-10-16 12:12:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=54394 +; + + +SELECT register_migration_script('936_IDEMPIERE-389_ServerName_Field.sql') FROM dual +; \ No newline at end of file diff --git a/org.adempiere.base/src/org/compiere/model/MSession.java b/org.adempiere.base/src/org/compiere/model/MSession.java index 99baa121b7..d185c187e7 100644 --- a/org.adempiere.base/src/org/compiere/model/MSession.java +++ b/org.adempiere.base/src/org/compiere/model/MSession.java @@ -27,6 +27,7 @@ import org.compiere.util.CCache; import org.compiere.util.Env; import org.compiere.util.Ini; import org.compiere.util.TimeUtil; +import org.compiere.util.WebUtil; /** * Session Model. @@ -148,7 +149,8 @@ public class MSession extends X_AD_Session public MSession (Properties ctx, String Remote_Addr, String Remote_Host, String WebSession, String trxName) { this (ctx, 0, trxName); - setServerName(Ini.getProperties().getProperty("ServerName")); + + setServerName(WebUtil.getServerName()); if (Remote_Addr != null) setRemote_Addr(Remote_Addr); if (Remote_Host != null) @@ -173,7 +175,7 @@ public class MSession extends X_AD_Session try { InetAddress lh = InetAddress.getLocalHost(); - setServerName(Ini.getProperties().getProperty("ServerName")); + setServerName(WebUtil.getServerName()); setRemote_Addr(lh.getHostAddress()); setRemote_Host(lh.getHostName()); setDescription(Adempiere.MAIN_VERSION + "_" diff --git a/org.adempiere.base/src/org/compiere/util/WebUtil.java b/org.adempiere.base/src/org/compiere/util/WebUtil.java index b4600ef1a8..5000605bbd 100644 --- a/org.adempiere.base/src/org/compiere/util/WebUtil.java +++ b/org.adempiere.base/src/org/compiere/util/WebUtil.java @@ -24,8 +24,10 @@ import java.io.IOException; import java.io.PrintWriter; import java.io.UnsupportedEncodingException; import java.math.BigDecimal; +import java.net.InetAddress; import java.net.URLDecoder; import java.net.URLEncoder; +import java.net.UnknownHostException; import java.sql.Timestamp; import java.text.DateFormat; import java.text.DecimalFormat; @@ -1250,4 +1252,31 @@ public final class WebUtil } return wu.save(); } // updateFields + + /** + * + * @return Servername including host name: IP : instance name + */ + public static String getServerName(){ + StringBuilder strBuilder = new StringBuilder(); + String serverName = Ini.getProperties().getProperty("ServerName"); + + + try { + strBuilder.append(InetAddress.getLocalHost().getHostName()); + } catch (UnknownHostException e) { + log.log(Level.WARNING, "Local host or IP not found", e); + } + strBuilder.append(":"); + try { + strBuilder.append(InetAddress.getLocalHost().getHostAddress()); + } catch (UnknownHostException e) { + log.log(Level.WARNING, "Local host or IP not found", e); + } + strBuilder.append(":"); + if(serverName!=null) + strBuilder.append(serverName); + + return strBuilder.toString(); + } } // WUtil