Merge 6c683b4f5c29
This commit is contained in:
commit
8c30c3d051
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,63 @@
|
|||
-- Nov 28, 2012 3:45:10 PM GMT+05:30
|
||||
-- IDEMPIERE-293 Adding ability to kill session from active session winodw
|
||||
INSERT INTO AD_Process (CopyFromProcess,Created,AD_Process_ID,IsDirectPrint,IsReport,AD_Process_UU,AccessLevel,IsBetaFunctionality,IsServerProcess,Statistic_Seconds,Statistic_Count,ShowHelp,EntityType,Classname,Name,Value,AD_Org_ID,AD_Client_ID,Updated,UpdatedBy,IsActive,CreatedBy) VALUES ('N',TO_DATE('2012-11-28 15:45:05','YYYY-MM-DD HH24:MI:SS'),200021,'N','N','1b4a0890-2e4b-4e20-be55-d0248ec4e4c6','4','N','N',0,0,'Y','U','org.adempiere.webui.process.KillCurrentSession','Kill Current Session','Kill Current Session',0,0,TO_DATE('2012-11-28 15:45:05','YYYY-MM-DD HH24:MI:SS'),100,'Y',100)
|
||||
;
|
||||
|
||||
-- Nov 28, 2012 3:45:11 PM GMT+05:30
|
||||
-- IDEMPIERE-293 Adding ability to kill session from active session winodw
|
||||
INSERT INTO AD_Process_Trl (AD_Language,AD_Process_ID, Help,Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Process_Trl_UU ) SELECT l.AD_Language,t.AD_Process_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_Process t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Process_ID=200021 AND NOT EXISTS (SELECT * FROM AD_Process_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_ID=t.AD_Process_ID)
|
||||
;
|
||||
|
||||
-- Nov 28, 2012 3:47:21 PM GMT+05:30
|
||||
-- IDEMPIERE-293 Adding ability to kill session from active session winodw
|
||||
INSERT INTO AD_Element (ColumnName,AD_Element_ID,EntityType,Name,PrintName,AD_Element_UU,AD_Client_ID,Created,Updated,AD_Org_ID,CreatedBy,UpdatedBy,IsActive) VALUES ('TimeOutInSeconds',200256,'U','TimeOutInSeconds','Timeout In Seconds','3a2c3c58-cf06-4624-bd31-332957521736',0,TO_DATE('2012-11-28 15:47:20','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2012-11-28 15:47:20','YYYY-MM-DD HH24:MI:SS'),0,100,100,'Y')
|
||||
;
|
||||
|
||||
-- Nov 28, 2012 3:47:21 PM GMT+05:30
|
||||
-- IDEMPIERE-293 Adding ability to kill session from active session winodw
|
||||
INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Help,PO_Description,PO_Help,Description,Name,PrintName,PO_Name,PO_PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Element_Trl_UU ) SELECT l.AD_Language,t.AD_Element_ID, t.Help,t.PO_Description,t.PO_Help,t.Description,t.Name,t.PrintName,t.PO_Name,t.PO_PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=200256 AND NOT EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID)
|
||||
;
|
||||
|
||||
-- Nov 28, 2012 3:48:48 PM GMT+05:30
|
||||
-- IDEMPIERE-293 Adding ability to kill session from active session winodw
|
||||
INSERT INTO AD_Process_Para (IsRange,AD_Element_ID,AD_Process_Para_ID,AD_Process_Para_UU,AD_Process_ID,AD_Reference_ID,IsMandatory,EntityType,Name,ColumnName,FieldLength,IsCentrallyMaintained,SeqNo,IsActive,UpdatedBy,Updated,CreatedBy,Created,AD_Org_ID,AD_Client_ID,IsEncrypted) VALUES ('N',200256,200044,'a5bc974e-d6b6-403e-8102-82e53950a14c',200021,11,'Y','U','TimeOutInSeconds','TimeOutInSeconds',4,'Y',10,'Y',100,TO_DATE('2012-11-28 15:48:47','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2012-11-28 15:48:47','YYYY-MM-DD HH24:MI:SS'),0,0,'N')
|
||||
;
|
||||
|
||||
-- Nov 28, 2012 3:48:48 PM GMT+05:30
|
||||
-- IDEMPIERE-293 Adding ability to kill session from active session winodw
|
||||
INSERT INTO AD_Process_Para_Trl (AD_Language,AD_Process_Para_ID, Help,Name,Description, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Process_Para_Trl_UU ) SELECT l.AD_Language,t.AD_Process_Para_ID, t.Help,t.Name,t.Description, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Process_Para t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Process_Para_ID=200044 AND NOT EXISTS (SELECT * FROM AD_Process_Para_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_Para_ID=t.AD_Process_Para_ID)
|
||||
;
|
||||
|
||||
-- Nov 28, 2012 3:50:54 PM GMT+05:30
|
||||
-- IDEMPIERE-293 Adding ability to kill session from active session winodw
|
||||
INSERT INTO AD_ToolBarButton (Action,AD_Tab_ID,AD_Process_ID,SeqNo,Name,ComponentName,IsCustomization,AD_Client_ID,AD_Org_ID,Created,CreatedBy,AD_ToolBarButton_ID,Updated,UpdatedBy,AD_ToolBarButton_UU,IsActive) VALUES ('W',200025,200021,10,'Kill Current Session','KillCurrentSession','N',0,0,TO_DATE('2012-11-28 15:50:53','YYYY-MM-DD HH24:MI:SS'),100,200073,TO_DATE('2012-11-28 15:50:53','YYYY-MM-DD HH24:MI:SS'),100,'f123c14c-0aa7-4ee9-87ed-3c4ef4ccc961','Y')
|
||||
;
|
||||
|
||||
-- Nov 28, 2012 3:53:26 PM GMT+05:30
|
||||
-- IDEMPIERE-293 Adding ability to kill session from active session winodw
|
||||
INSERT INTO AD_Process (CopyFromProcess,Created,AD_Process_ID,IsDirectPrint,IsReport,AD_Process_UU,AccessLevel,IsBetaFunctionality,IsServerProcess,Statistic_Seconds,Statistic_Count,ShowHelp,EntityType,Classname,Name,Value,AD_Org_ID,AD_Client_ID,Updated,UpdatedBy,IsActive,CreatedBy) VALUES ('N',TO_DATE('2012-11-28 15:53:25','YYYY-MM-DD HH24:MI:SS'),200022,'N','N','06a44cb0-5782-475b-aeab-63429829c708','4','N','N',0,0,'Y','U','org.adempiere.webui.process.KillAllSession','Kill All Session','Kill All Session',0,0,TO_DATE('2012-11-28 15:53:25','YYYY-MM-DD HH24:MI:SS'),100,'Y',100)
|
||||
;
|
||||
|
||||
-- Nov 28, 2012 3:53:26 PM GMT+05:30
|
||||
-- IDEMPIERE-293 Adding ability to kill session from active session winodw
|
||||
INSERT INTO AD_Process_Trl (AD_Language,AD_Process_ID, Help,Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Process_Trl_UU ) SELECT l.AD_Language,t.AD_Process_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_Process t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Process_ID=200022 AND NOT EXISTS (SELECT * FROM AD_Process_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_ID=t.AD_Process_ID)
|
||||
;
|
||||
|
||||
-- Nov 28, 2012 3:55:32 PM GMT+05:30
|
||||
-- IDEMPIERE-293 Adding ability to kill session from active session winodw
|
||||
INSERT INTO AD_Process_Para (IsRange,AD_Element_ID,AD_Process_Para_ID,AD_Process_Para_UU,AD_Process_ID,AD_Reference_ID,IsMandatory,EntityType,Name,ColumnName,FieldLength,IsCentrallyMaintained,SeqNo,IsActive,UpdatedBy,Updated,CreatedBy,Created,AD_Org_ID,AD_Client_ID,IsEncrypted) VALUES ('N',200256,200045,'c9f241c3-9085-4f3b-a071-e49bdc14541f',200022,11,'N','U','TimeOutInSeconds','TimeOutInSeconds',4,'Y',10,'Y',100,TO_DATE('2012-11-28 15:55:31','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2012-11-28 15:55:31','YYYY-MM-DD HH24:MI:SS'),0,0,'N')
|
||||
;
|
||||
|
||||
-- Nov 28, 2012 3:55:32 PM GMT+05:30
|
||||
-- IDEMPIERE-293 Adding ability to kill session from active session winodw
|
||||
INSERT INTO AD_Process_Para_Trl (AD_Language,AD_Process_Para_ID, Help,Name,Description, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Process_Para_Trl_UU ) SELECT l.AD_Language,t.AD_Process_Para_ID, t.Help,t.Name,t.Description, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Process_Para t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Process_Para_ID=200045 AND NOT EXISTS (SELECT * FROM AD_Process_Para_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_Para_ID=t.AD_Process_Para_ID)
|
||||
;
|
||||
|
||||
-- Nov 28, 2012 3:57:20 PM GMT+05:30
|
||||
-- IDEMPIERE-293 Adding ability to kill session from active session winodw
|
||||
INSERT INTO AD_ToolBarButton (Action,AD_Tab_ID,AD_Process_ID,SeqNo,Name,ComponentName,IsCustomization,AD_Client_ID,AD_Org_ID,Created,CreatedBy,AD_ToolBarButton_ID,Updated,UpdatedBy,AD_ToolBarButton_UU,IsActive) VALUES ('W',200025,200022,20,'Kill All Session','KillAllSession','N',0,0,TO_DATE('2012-11-28 15:57:19','YYYY-MM-DD HH24:MI:SS'),100,200074,TO_DATE('2012-11-28 15:57:19','YYYY-MM-DD HH24:MI:SS'),100,'b56e98d9-bbfd-478e-bc11-c3e9cdb9637e','Y')
|
||||
;
|
||||
|
||||
|
||||
SELECT register_migration_script('201211300507_IDEMPIERE-293.sql') FROM dual
|
||||
;
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,62 @@
|
|||
-- Nov 28, 2012 3:45:10 PM GMT+05:30
|
||||
-- IDEMPIERE-293 Adding ability to kill session from active session winodw
|
||||
INSERT INTO AD_Process (CopyFromProcess,Created,AD_Process_ID,IsDirectPrint,IsReport,AD_Process_UU,AccessLevel,IsBetaFunctionality,IsServerProcess,Statistic_Seconds,Statistic_Count,ShowHelp,EntityType,Classname,Name,Value,AD_Org_ID,AD_Client_ID,Updated,UpdatedBy,IsActive,CreatedBy) VALUES ('N',TO_TIMESTAMP('2012-11-28 15:45:05','YYYY-MM-DD HH24:MI:SS'),200021,'N','N','1b4a0890-2e4b-4e20-be55-d0248ec4e4c6','4','N','N',0,0,'Y','U','org.adempiere.webui.process.KillCurrentSession','Kill Current Session','Kill Current Session',0,0,TO_TIMESTAMP('2012-11-28 15:45:05','YYYY-MM-DD HH24:MI:SS'),100,'Y',100)
|
||||
;
|
||||
|
||||
-- Nov 28, 2012 3:45:11 PM GMT+05:30
|
||||
-- IDEMPIERE-293 Adding ability to kill session from active session winodw
|
||||
INSERT INTO AD_Process_Trl (AD_Language,AD_Process_ID, Help,Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Process_Trl_UU ) SELECT l.AD_Language,t.AD_Process_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_Process t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Process_ID=200021 AND NOT EXISTS (SELECT * FROM AD_Process_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_ID=t.AD_Process_ID)
|
||||
;
|
||||
|
||||
-- Nov 28, 2012 3:47:21 PM GMT+05:30
|
||||
-- IDEMPIERE-293 Adding ability to kill session from active session winodw
|
||||
INSERT INTO AD_Element (ColumnName,AD_Element_ID,EntityType,Name,PrintName,AD_Element_UU,AD_Client_ID,Created,Updated,AD_Org_ID,CreatedBy,UpdatedBy,IsActive) VALUES ('TimeOutInSeconds',200256,'U','TimeOutInSeconds','Timeout In Seconds','3a2c3c58-cf06-4624-bd31-332957521736',0,TO_TIMESTAMP('2012-11-28 15:47:20','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2012-11-28 15:47:20','YYYY-MM-DD HH24:MI:SS'),0,100,100,'Y')
|
||||
;
|
||||
|
||||
-- Nov 28, 2012 3:47:21 PM GMT+05:30
|
||||
-- IDEMPIERE-293 Adding ability to kill session from active session winodw
|
||||
INSERT INTO AD_Element_Trl (AD_Language,AD_Element_ID, Help,PO_Description,PO_Help,Description,Name,PrintName,PO_Name,PO_PrintName, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Element_Trl_UU ) SELECT l.AD_Language,t.AD_Element_ID, t.Help,t.PO_Description,t.PO_Help,t.Description,t.Name,t.PrintName,t.PO_Name,t.PO_PrintName, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Element t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Element_ID=200256 AND NOT EXISTS (SELECT * FROM AD_Element_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Element_ID=t.AD_Element_ID)
|
||||
;
|
||||
|
||||
-- Nov 28, 2012 3:48:48 PM GMT+05:30
|
||||
-- IDEMPIERE-293 Adding ability to kill session from active session winodw
|
||||
INSERT INTO AD_Process_Para (IsRange,AD_Element_ID,AD_Process_Para_ID,AD_Process_Para_UU,AD_Process_ID,AD_Reference_ID,IsMandatory,EntityType,Name,ColumnName,FieldLength,IsCentrallyMaintained,SeqNo,IsActive,UpdatedBy,Updated,CreatedBy,Created,AD_Org_ID,AD_Client_ID,IsEncrypted) VALUES ('N',200256,200044,'a5bc974e-d6b6-403e-8102-82e53950a14c',200021,11,'Y','U','TimeOutInSeconds','TimeOutInSeconds',4,'Y',10,'Y',100,TO_TIMESTAMP('2012-11-28 15:48:47','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2012-11-28 15:48:47','YYYY-MM-DD HH24:MI:SS'),0,0,'N')
|
||||
;
|
||||
|
||||
-- Nov 28, 2012 3:48:48 PM GMT+05:30
|
||||
-- IDEMPIERE-293 Adding ability to kill session from active session winodw
|
||||
INSERT INTO AD_Process_Para_Trl (AD_Language,AD_Process_Para_ID, Help,Name,Description, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Process_Para_Trl_UU ) SELECT l.AD_Language,t.AD_Process_Para_ID, t.Help,t.Name,t.Description, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Process_Para t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Process_Para_ID=200044 AND NOT EXISTS (SELECT * FROM AD_Process_Para_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_Para_ID=t.AD_Process_Para_ID)
|
||||
;
|
||||
|
||||
-- Nov 28, 2012 3:50:54 PM GMT+05:30
|
||||
-- IDEMPIERE-293 Adding ability to kill session from active session winodw
|
||||
INSERT INTO AD_ToolBarButton ("action",AD_Tab_ID,AD_Process_ID,SeqNo,Name,ComponentName,IsCustomization,AD_Client_ID,AD_Org_ID,Created,CreatedBy,AD_ToolBarButton_ID,Updated,UpdatedBy,AD_ToolBarButton_UU,IsActive) VALUES ('W',200025,200021,10,'Kill Current Session','KillCurrentSession','N',0,0,TO_TIMESTAMP('2012-11-28 15:50:53','YYYY-MM-DD HH24:MI:SS'),100,200073,TO_TIMESTAMP('2012-11-28 15:50:53','YYYY-MM-DD HH24:MI:SS'),100,'f123c14c-0aa7-4ee9-87ed-3c4ef4ccc961','Y')
|
||||
;
|
||||
|
||||
-- Nov 28, 2012 3:53:26 PM GMT+05:30
|
||||
-- IDEMPIERE-293 Adding ability to kill session from active session winodw
|
||||
INSERT INTO AD_Process (CopyFromProcess,Created,AD_Process_ID,IsDirectPrint,IsReport,AD_Process_UU,AccessLevel,IsBetaFunctionality,IsServerProcess,Statistic_Seconds,Statistic_Count,ShowHelp,EntityType,Classname,Name,Value,AD_Org_ID,AD_Client_ID,Updated,UpdatedBy,IsActive,CreatedBy) VALUES ('N',TO_TIMESTAMP('2012-11-28 15:53:25','YYYY-MM-DD HH24:MI:SS'),200022,'N','N','06a44cb0-5782-475b-aeab-63429829c708','4','N','N',0,0,'Y','U','org.adempiere.webui.process.KillAllSession','Kill All Session','Kill All Session',0,0,TO_TIMESTAMP('2012-11-28 15:53:25','YYYY-MM-DD HH24:MI:SS'),100,'Y',100)
|
||||
;
|
||||
|
||||
-- Nov 28, 2012 3:53:26 PM GMT+05:30
|
||||
-- IDEMPIERE-293 Adding ability to kill session from active session winodw
|
||||
INSERT INTO AD_Process_Trl (AD_Language,AD_Process_ID, Help,Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Process_Trl_UU ) SELECT l.AD_Language,t.AD_Process_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_Process t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Process_ID=200022 AND NOT EXISTS (SELECT * FROM AD_Process_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_ID=t.AD_Process_ID)
|
||||
;
|
||||
|
||||
-- Nov 28, 2012 3:55:32 PM GMT+05:30
|
||||
-- IDEMPIERE-293 Adding ability to kill session from active session winodw
|
||||
INSERT INTO AD_Process_Para (IsRange,AD_Element_ID,AD_Process_Para_ID,AD_Process_Para_UU,AD_Process_ID,AD_Reference_ID,IsMandatory,EntityType,Name,ColumnName,FieldLength,IsCentrallyMaintained,SeqNo,IsActive,UpdatedBy,Updated,CreatedBy,Created,AD_Org_ID,AD_Client_ID,IsEncrypted) VALUES ('N',200256,200045,'c9f241c3-9085-4f3b-a071-e49bdc14541f',200022,11,'N','U','TimeOutInSeconds','TimeOutInSeconds',4,'Y',10,'Y',100,TO_TIMESTAMP('2012-11-28 15:55:31','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2012-11-28 15:55:31','YYYY-MM-DD HH24:MI:SS'),0,0,'N')
|
||||
;
|
||||
|
||||
-- Nov 28, 2012 3:55:32 PM GMT+05:30
|
||||
-- IDEMPIERE-293 Adding ability to kill session from active session winodw
|
||||
INSERT INTO AD_Process_Para_Trl (AD_Language,AD_Process_Para_ID, Help,Name,Description, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Process_Para_Trl_UU ) SELECT l.AD_Language,t.AD_Process_Para_ID, t.Help,t.Name,t.Description, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Process_Para t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Process_Para_ID=200045 AND NOT EXISTS (SELECT * FROM AD_Process_Para_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_Para_ID=t.AD_Process_Para_ID)
|
||||
;
|
||||
|
||||
-- Nov 28, 2012 3:57:20 PM GMT+05:30
|
||||
-- IDEMPIERE-293 Adding ability to kill session from active session winodw
|
||||
INSERT INTO AD_ToolBarButton ("action",AD_Tab_ID,AD_Process_ID,SeqNo,Name,ComponentName,IsCustomization,AD_Client_ID,AD_Org_ID,Created,CreatedBy,AD_ToolBarButton_ID,Updated,UpdatedBy,AD_ToolBarButton_UU,IsActive) VALUES ('W',200025,200022,20,'Kill All Session','KillAllSession','N',0,0,TO_TIMESTAMP('2012-11-28 15:57:19','YYYY-MM-DD HH24:MI:SS'),100,200074,TO_TIMESTAMP('2012-11-28 15:57:19','YYYY-MM-DD HH24:MI:SS'),100,'b56e98d9-bbfd-478e-bc11-c3e9cdb9637e','Y')
|
||||
;
|
||||
|
||||
SELECT register_migration_script('201211300507_IDEMPIERE-293.sql') FROM dual
|
||||
;
|
|
@ -66,7 +66,7 @@ public class NoteDelete extends SvrProcess
|
|||
{
|
||||
log.info("doIt - AD_User_ID=" + p_AD_User_ID);
|
||||
|
||||
StringBuilder sql = new StringBuilder("DELETE FROM AD_Note WHERE AD_Client_ID=").append(getAD_Client_ID());
|
||||
StringBuilder sql = new StringBuilder("DELETE FROM AD_Note WHERE AD_BroadcastMessage_ID IS NULL AND AD_Client_ID=").append(getAD_Client_ID());
|
||||
if (p_AD_User_ID > 0)
|
||||
sql.append(" AND AD_User_ID=").append(p_AD_User_ID);
|
||||
if (p_KeepLogDays > 0)
|
||||
|
|
|
@ -184,6 +184,7 @@ Export-Package: bsh,
|
|||
org.compiere.util,
|
||||
org.compiere.wf,
|
||||
org.eevolution.model,
|
||||
org.idempiere.broadcast,
|
||||
org.idempiere.distributed,
|
||||
org.jfree,
|
||||
org.jfree.base,
|
||||
|
|
|
@ -90,5 +90,7 @@ public interface IEventTopics {
|
|||
public static final String IMPORT_AFTER_IMPORT = IMPORT_PREFIX+"afterImport";
|
||||
|
||||
public static final String PREF_AFTER_LOAD = "adempiere/pref/afterLoad";
|
||||
|
||||
public static final String BROADCAST_MESSAGE = "idempiere/broadcastMsg";
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,102 @@
|
|||
/******************************************************************************
|
||||
* Copyright (C) 2012 Trek Global *
|
||||
* Product: iDempiere ERP & CRM Smart Business Solution *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms version 2 of the GNU General Public License as published *
|
||||
* by the Free Software Foundation. This program is distributed in the hope *
|
||||
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU General Public License for more details. *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||
*****************************************************************************/
|
||||
package org.adempiere.model;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.compiere.model.X_AD_BroadcastMessage;
|
||||
import org.compiere.util.CCache;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.Env;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Vivek
|
||||
* @author Deepak Pansheriya
|
||||
*
|
||||
*/
|
||||
public class MBroadcastMessage extends X_AD_BroadcastMessage
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -6390563897422379468L;
|
||||
static private CCache<Integer,MBroadcastMessage> s_cache = new CCache<Integer,MBroadcastMessage>("AD_BroadcastMessage", 30, 60);
|
||||
|
||||
public MBroadcastMessage(Properties ctx, int AD_BroadcastMessage_ID,
|
||||
String trxName)
|
||||
{
|
||||
super(ctx, AD_BroadcastMessage_ID, trxName);
|
||||
}
|
||||
|
||||
public MBroadcastMessage(Properties ctx, ResultSet rs,
|
||||
String trxName)
|
||||
{
|
||||
super(ctx, rs, trxName);
|
||||
}
|
||||
|
||||
public static MBroadcastMessage get (Properties ctx, int AD_BroadcastMessage_ID)
|
||||
{
|
||||
Integer key = new Integer(AD_BroadcastMessage_ID);
|
||||
MBroadcastMessage retValue = (MBroadcastMessage)s_cache.get(key);
|
||||
if (retValue == null)
|
||||
{
|
||||
retValue = new MBroadcastMessage (ctx, AD_BroadcastMessage_ID, null);
|
||||
|
||||
s_cache.put(key, retValue);
|
||||
}
|
||||
return retValue;
|
||||
} // get
|
||||
|
||||
|
||||
/**
|
||||
* Is broadcast message applicable to current login user
|
||||
* @return
|
||||
*/
|
||||
public boolean isValidUserforMessage()
|
||||
{
|
||||
Properties ctx = Env.getCtx();
|
||||
|
||||
if(getBroadcastType()!=null && getBroadcastType().equals(BROADCASTTYPE_Immediate) && getTarget()!=null){
|
||||
if (getTarget().equals(TARGET_Role) ) {
|
||||
String sql = "SELECT COUNT(*) FROM AD_User_Roles WHERE AD_Role_ID = ? AND AD_User_ID=? AND IsActive='Y'";
|
||||
int roleSubs = DB.getSQLValue(null, sql, getAD_Role_ID(),Env.getAD_User_ID(ctx));
|
||||
if(roleSubs>0)
|
||||
return true;
|
||||
} else if (getTarget().equals(TARGET_User) && getAD_User_ID() == Env.getAD_User_ID(ctx)) {
|
||||
return true;
|
||||
} else if (getTarget().equals(TARGET_Client) && getAD_Client_ID() == Env.getAD_Client_ID(ctx)) {
|
||||
return true;
|
||||
}else if (getTarget().equals(TARGET_Everybody)){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
int AD_User_ID = Env.getAD_User_ID(ctx);
|
||||
String sql = "SELECT AD_User_ID from AD_Note WHERE AD_BroadcastMessage_ID = ? AND AD_User_ID = ? ";
|
||||
int result = DB.getSQLValue(null, sql,getAD_BroadcastMessage_ID(),AD_User_ID);
|
||||
if (result <= 0) {
|
||||
return false;
|
||||
}
|
||||
else{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,326 @@
|
|||
/******************************************************************************
|
||||
* Product: iDempiere ERP & CRM Smart Business Solution *
|
||||
* Copyright (C) 1999-2012 ComPiere, Inc. All Rights Reserved. *
|
||||
* This program is free software, you can redistribute it and/or modify it *
|
||||
* under the terms version 2 of the GNU General Public License as published *
|
||||
* by the Free Software Foundation. This program is distributed in the hope *
|
||||
* that it will be useful, but WITHOUT ANY WARRANTY, without even the implied *
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU General Public License for more details. *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program, if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||
* For the text or an alternative of this public license, you may reach us *
|
||||
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
|
||||
* or via info@compiere.org or http://www.compiere.org/license.html *
|
||||
*****************************************************************************/
|
||||
package org.compiere.model;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.Timestamp;
|
||||
import org.compiere.util.KeyNamePair;
|
||||
|
||||
/** Generated Interface for AD_BroadcastMessage
|
||||
* @author iDempiere (generated)
|
||||
* @version Release 1.0a
|
||||
*/
|
||||
public interface I_AD_BroadcastMessage
|
||||
{
|
||||
|
||||
/** TableName=AD_BroadcastMessage */
|
||||
public static final String Table_Name = "AD_BroadcastMessage";
|
||||
|
||||
/** AD_Table_ID=200038 */
|
||||
public static final int Table_ID = 200038;
|
||||
|
||||
KeyNamePair Model = new KeyNamePair(Table_ID, Table_Name);
|
||||
|
||||
/** AccessLevel = 6 - System - Client
|
||||
*/
|
||||
BigDecimal accessLevel = BigDecimal.valueOf(6);
|
||||
|
||||
/** Load Meta Data */
|
||||
|
||||
/** Column name AD_BroadcastMessage_ID */
|
||||
public static final String COLUMNNAME_AD_BroadcastMessage_ID = "AD_BroadcastMessage_ID";
|
||||
|
||||
/** Set Broadcast Message.
|
||||
* Broadcast Message
|
||||
*/
|
||||
public void setAD_BroadcastMessage_ID (int AD_BroadcastMessage_ID);
|
||||
|
||||
/** Get Broadcast Message.
|
||||
* Broadcast Message
|
||||
*/
|
||||
public int getAD_BroadcastMessage_ID();
|
||||
|
||||
/** Column name AD_BroadcastMessage_UU */
|
||||
public static final String COLUMNNAME_AD_BroadcastMessage_UU = "AD_BroadcastMessage_UU";
|
||||
|
||||
/** Set AD_BroadcastMessage_UU */
|
||||
public void setAD_BroadcastMessage_UU (String AD_BroadcastMessage_UU);
|
||||
|
||||
/** Get AD_BroadcastMessage_UU */
|
||||
public String getAD_BroadcastMessage_UU();
|
||||
|
||||
/** Column name AD_Client_ID */
|
||||
public static final String COLUMNNAME_AD_Client_ID = "AD_Client_ID";
|
||||
|
||||
/** Get Client.
|
||||
* Client/Tenant for this installation.
|
||||
*/
|
||||
public int getAD_Client_ID();
|
||||
|
||||
/** Column name AD_Org_ID */
|
||||
public static final String COLUMNNAME_AD_Org_ID = "AD_Org_ID";
|
||||
|
||||
/** Set Organization.
|
||||
* Organizational entity within client
|
||||
*/
|
||||
public void setAD_Org_ID (int AD_Org_ID);
|
||||
|
||||
/** Get Organization.
|
||||
* Organizational entity within client
|
||||
*/
|
||||
public int getAD_Org_ID();
|
||||
|
||||
/** Column name AD_Role_ID */
|
||||
public static final String COLUMNNAME_AD_Role_ID = "AD_Role_ID";
|
||||
|
||||
/** Set Role.
|
||||
* Responsibility Role
|
||||
*/
|
||||
public void setAD_Role_ID (int AD_Role_ID);
|
||||
|
||||
/** Get Role.
|
||||
* Responsibility Role
|
||||
*/
|
||||
public int getAD_Role_ID();
|
||||
|
||||
public org.compiere.model.I_AD_Role getAD_Role() throws RuntimeException;
|
||||
|
||||
/** Column name AD_User_ID */
|
||||
public static final String COLUMNNAME_AD_User_ID = "AD_User_ID";
|
||||
|
||||
/** Set User/Contact.
|
||||
* User within the system - Internal or Business Partner Contact
|
||||
*/
|
||||
public void setAD_User_ID (int AD_User_ID);
|
||||
|
||||
/** Get User/Contact.
|
||||
* User within the system - Internal or Business Partner Contact
|
||||
*/
|
||||
public int getAD_User_ID();
|
||||
|
||||
public org.compiere.model.I_AD_User getAD_User() throws RuntimeException;
|
||||
|
||||
/** Column name BroadcastFrequency */
|
||||
public static final String COLUMNNAME_BroadcastFrequency = "BroadcastFrequency";
|
||||
|
||||
/** Set Broadcast Frequency.
|
||||
* How Many Times Message Should be Broadcasted
|
||||
*/
|
||||
public void setBroadcastFrequency (String BroadcastFrequency);
|
||||
|
||||
/** Get Broadcast Frequency.
|
||||
* How Many Times Message Should be Broadcasted
|
||||
*/
|
||||
public String getBroadcastFrequency();
|
||||
|
||||
/** Column name BroadcastMessage */
|
||||
public static final String COLUMNNAME_BroadcastMessage = "BroadcastMessage";
|
||||
|
||||
/** Set Broadcast Message.
|
||||
* Broadcast Message
|
||||
*/
|
||||
public void setBroadcastMessage (String BroadcastMessage);
|
||||
|
||||
/** Get Broadcast Message.
|
||||
* Broadcast Message
|
||||
*/
|
||||
public String getBroadcastMessage();
|
||||
|
||||
/** Column name BroadcastType */
|
||||
public static final String COLUMNNAME_BroadcastType = "BroadcastType";
|
||||
|
||||
/** Set Broadcast Type.
|
||||
* Type of Broadcast
|
||||
*/
|
||||
public void setBroadcastType (String BroadcastType);
|
||||
|
||||
/** Get Broadcast Type.
|
||||
* Type of Broadcast
|
||||
*/
|
||||
public String getBroadcastType();
|
||||
|
||||
/** Column name Created */
|
||||
public static final String COLUMNNAME_Created = "Created";
|
||||
|
||||
/** Get Created.
|
||||
* Date this record was created
|
||||
*/
|
||||
public Timestamp getCreated();
|
||||
|
||||
/** Column name CreatedBy */
|
||||
public static final String COLUMNNAME_CreatedBy = "CreatedBy";
|
||||
|
||||
/** Get Created By.
|
||||
* User who created this records
|
||||
*/
|
||||
public int getCreatedBy();
|
||||
|
||||
/** Column name Expiration */
|
||||
public static final String COLUMNNAME_Expiration = "Expiration";
|
||||
|
||||
/** Set Expire On.
|
||||
* Expire On
|
||||
*/
|
||||
public void setExpiration (Timestamp Expiration);
|
||||
|
||||
/** Get Expire On.
|
||||
* Expire On
|
||||
*/
|
||||
public Timestamp getExpiration();
|
||||
|
||||
/** Column name Expired */
|
||||
public static final String COLUMNNAME_Expired = "Expired";
|
||||
|
||||
/** Set Expired */
|
||||
public void setExpired (boolean Expired);
|
||||
|
||||
/** Get Expired */
|
||||
public boolean isExpired();
|
||||
|
||||
/** Column name ExpireNow */
|
||||
public static final String COLUMNNAME_ExpireNow = "ExpireNow";
|
||||
|
||||
/** Set Expire Now.
|
||||
* Expire the broadcast message
|
||||
*/
|
||||
public void setExpireNow (String ExpireNow);
|
||||
|
||||
/** Get Expire Now.
|
||||
* Expire the broadcast message
|
||||
*/
|
||||
public String getExpireNow();
|
||||
|
||||
/** Column name IsActive */
|
||||
public static final String COLUMNNAME_IsActive = "IsActive";
|
||||
|
||||
/** Set Active.
|
||||
* The record is active in the system
|
||||
*/
|
||||
public void setIsActive (boolean IsActive);
|
||||
|
||||
/** Get Active.
|
||||
* The record is active in the system
|
||||
*/
|
||||
public boolean isActive();
|
||||
|
||||
/** Column name IsPublished */
|
||||
public static final String COLUMNNAME_IsPublished = "IsPublished";
|
||||
|
||||
/** Set Published.
|
||||
* The Topic is published and can be viewed
|
||||
*/
|
||||
public void setIsPublished (boolean IsPublished);
|
||||
|
||||
/** Get Published.
|
||||
* The Topic is published and can be viewed
|
||||
*/
|
||||
public boolean isPublished();
|
||||
|
||||
/** Column name LogAcknowledge */
|
||||
public static final String COLUMNNAME_LogAcknowledge = "LogAcknowledge";
|
||||
|
||||
/** Set Log Acknowledge.
|
||||
* Want to Log the Acknowledgement of Message?
|
||||
*/
|
||||
public void setLogAcknowledge (boolean LogAcknowledge);
|
||||
|
||||
/** Get Log Acknowledge.
|
||||
* Want to Log the Acknowledgement of Message?
|
||||
*/
|
||||
public boolean isLogAcknowledge();
|
||||
|
||||
/** Column name Notification_Client_ID */
|
||||
public static final String COLUMNNAME_Notification_Client_ID = "Notification_Client_ID";
|
||||
|
||||
/** Set Notification Client.
|
||||
* Notification Client
|
||||
*/
|
||||
public void setNotification_Client_ID (int Notification_Client_ID);
|
||||
|
||||
/** Get Notification Client.
|
||||
* Notification Client
|
||||
*/
|
||||
public int getNotification_Client_ID();
|
||||
|
||||
/** Column name Processed */
|
||||
public static final String COLUMNNAME_Processed = "Processed";
|
||||
|
||||
/** Set Processed.
|
||||
* The document has been processed
|
||||
*/
|
||||
public void setProcessed (boolean Processed);
|
||||
|
||||
/** Get Processed.
|
||||
* The document has been processed
|
||||
*/
|
||||
public boolean isProcessed();
|
||||
|
||||
/** Column name Publish */
|
||||
public static final String COLUMNNAME_Publish = "Publish";
|
||||
|
||||
/** Set Publish.
|
||||
* Publish Broadcast Message
|
||||
*/
|
||||
public void setPublish (String Publish);
|
||||
|
||||
/** Get Publish.
|
||||
* Publish Broadcast Message
|
||||
*/
|
||||
public String getPublish();
|
||||
|
||||
/** Column name Target */
|
||||
public static final String COLUMNNAME_Target = "Target";
|
||||
|
||||
/** Set Target.
|
||||
* Target client
|
||||
*/
|
||||
public void setTarget (String Target);
|
||||
|
||||
/** Get Target.
|
||||
* Target client
|
||||
*/
|
||||
public String getTarget();
|
||||
|
||||
/** Column name TestMessage */
|
||||
public static final String COLUMNNAME_TestMessage = "TestMessage";
|
||||
|
||||
/** Set Test Message.
|
||||
* Test broadcast message
|
||||
*/
|
||||
public void setTestMessage (String TestMessage);
|
||||
|
||||
/** Get Test Message.
|
||||
* Test broadcast message
|
||||
*/
|
||||
public String getTestMessage();
|
||||
|
||||
/** Column name Updated */
|
||||
public static final String COLUMNNAME_Updated = "Updated";
|
||||
|
||||
/** Get Updated.
|
||||
* Date this record was updated
|
||||
*/
|
||||
public Timestamp getUpdated();
|
||||
|
||||
/** Column name UpdatedBy */
|
||||
public static final String COLUMNNAME_UpdatedBy = "UpdatedBy";
|
||||
|
||||
/** Get Updated By.
|
||||
* User who updated this records
|
||||
*/
|
||||
public int getUpdatedBy();
|
||||
}
|
|
@ -41,6 +41,34 @@ public interface I_AD_Note
|
|||
|
||||
/** Load Meta Data */
|
||||
|
||||
/** Column name AcknowledgeDateTime */
|
||||
public static final String COLUMNNAME_AcknowledgeDateTime = "AcknowledgeDateTime";
|
||||
|
||||
/** Set Acknowledgement Time.
|
||||
* Acknowledgement Time of message
|
||||
*/
|
||||
public void setAcknowledgeDateTime (Timestamp AcknowledgeDateTime);
|
||||
|
||||
/** Get Acknowledgement Time.
|
||||
* Acknowledgement Time of message
|
||||
*/
|
||||
public Timestamp getAcknowledgeDateTime();
|
||||
|
||||
/** Column name AD_Broadcastmessage_ID */
|
||||
public static final String COLUMNNAME_AD_Broadcastmessage_ID = "AD_Broadcastmessage_ID";
|
||||
|
||||
/** Set Broadcast Message.
|
||||
* Broadcast Message
|
||||
*/
|
||||
public void setAD_Broadcastmessage_ID (int AD_Broadcastmessage_ID);
|
||||
|
||||
/** Get Broadcast Message.
|
||||
* Broadcast Message
|
||||
*/
|
||||
public int getAD_Broadcastmessage_ID();
|
||||
|
||||
public I_AD_BroadcastMessage getAD_Broadcastmessage() throws RuntimeException;
|
||||
|
||||
/** Column name AD_Client_ID */
|
||||
public static final String COLUMNNAME_AD_Client_ID = "AD_Client_ID";
|
||||
|
||||
|
|
|
@ -0,0 +1,448 @@
|
|||
/******************************************************************************
|
||||
* Product: iDempiere ERP & CRM Smart Business Solution *
|
||||
* Copyright (C) 1999-2012 ComPiere, Inc. All Rights Reserved. *
|
||||
* This program is free software, you can redistribute it and/or modify it *
|
||||
* under the terms version 2 of the GNU General Public License as published *
|
||||
* by the Free Software Foundation. This program is distributed in the hope *
|
||||
* that it will be useful, but WITHOUT ANY WARRANTY, without even the implied *
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU General Public License for more details. *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program, if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||
* For the text or an alternative of this public license, you may reach us *
|
||||
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
|
||||
* or via info@compiere.org or http://www.compiere.org/license.html *
|
||||
*****************************************************************************/
|
||||
/** Generated Model - DO NOT CHANGE */
|
||||
package org.compiere.model;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Properties;
|
||||
|
||||
/** Generated Model for AD_BroadcastMessage
|
||||
* @author iDempiere (generated)
|
||||
* @version Release 1.0a - $Id$ */
|
||||
public class X_AD_BroadcastMessage extends PO implements I_AD_BroadcastMessage, I_Persistent
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 20121202L;
|
||||
|
||||
/** Standard Constructor */
|
||||
public X_AD_BroadcastMessage (Properties ctx, int AD_BroadcastMessage_ID, String trxName)
|
||||
{
|
||||
super (ctx, AD_BroadcastMessage_ID, trxName);
|
||||
/** if (AD_BroadcastMessage_ID == 0)
|
||||
{
|
||||
setAD_BroadcastMessage_ID (0);
|
||||
setBroadcastFrequency (null);
|
||||
setBroadcastMessage (null);
|
||||
setBroadcastType (null);
|
||||
setTarget (null);
|
||||
} */
|
||||
}
|
||||
|
||||
/** Load Constructor */
|
||||
public X_AD_BroadcastMessage (Properties ctx, ResultSet rs, String trxName)
|
||||
{
|
||||
super (ctx, rs, trxName);
|
||||
}
|
||||
|
||||
/** AccessLevel
|
||||
* @return 6 - System - Client
|
||||
*/
|
||||
protected int get_AccessLevel()
|
||||
{
|
||||
return accessLevel.intValue();
|
||||
}
|
||||
|
||||
/** Load Meta Data */
|
||||
protected POInfo initPO (Properties ctx)
|
||||
{
|
||||
POInfo poi = POInfo.getPOInfo (ctx, Table_ID, get_TrxName());
|
||||
return poi;
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
StringBuffer sb = new StringBuffer ("X_AD_BroadcastMessage[")
|
||||
.append(get_ID()).append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/** Set Broadcast Message.
|
||||
@param AD_BroadcastMessage_ID
|
||||
Broadcast Message
|
||||
*/
|
||||
public void setAD_BroadcastMessage_ID (int AD_BroadcastMessage_ID)
|
||||
{
|
||||
if (AD_BroadcastMessage_ID < 1)
|
||||
set_ValueNoCheck (COLUMNNAME_AD_BroadcastMessage_ID, null);
|
||||
else
|
||||
set_ValueNoCheck (COLUMNNAME_AD_BroadcastMessage_ID, Integer.valueOf(AD_BroadcastMessage_ID));
|
||||
}
|
||||
|
||||
/** Get Broadcast Message.
|
||||
@return Broadcast Message
|
||||
*/
|
||||
public int getAD_BroadcastMessage_ID ()
|
||||
{
|
||||
Integer ii = (Integer)get_Value(COLUMNNAME_AD_BroadcastMessage_ID);
|
||||
if (ii == null)
|
||||
return 0;
|
||||
return ii.intValue();
|
||||
}
|
||||
|
||||
/** Set AD_BroadcastMessage_UU.
|
||||
@param AD_BroadcastMessage_UU AD_BroadcastMessage_UU */
|
||||
public void setAD_BroadcastMessage_UU (String AD_BroadcastMessage_UU)
|
||||
{
|
||||
set_Value (COLUMNNAME_AD_BroadcastMessage_UU, AD_BroadcastMessage_UU);
|
||||
}
|
||||
|
||||
/** Get AD_BroadcastMessage_UU.
|
||||
@return AD_BroadcastMessage_UU */
|
||||
public String getAD_BroadcastMessage_UU ()
|
||||
{
|
||||
return (String)get_Value(COLUMNNAME_AD_BroadcastMessage_UU);
|
||||
}
|
||||
|
||||
public org.compiere.model.I_AD_Role getAD_Role() throws RuntimeException
|
||||
{
|
||||
return (org.compiere.model.I_AD_Role)MTable.get(getCtx(), org.compiere.model.I_AD_Role.Table_Name)
|
||||
.getPO(getAD_Role_ID(), get_TrxName()); }
|
||||
|
||||
/** Set Role.
|
||||
@param AD_Role_ID
|
||||
Responsibility Role
|
||||
*/
|
||||
public void setAD_Role_ID (int AD_Role_ID)
|
||||
{
|
||||
if (AD_Role_ID < 0)
|
||||
set_Value (COLUMNNAME_AD_Role_ID, null);
|
||||
else
|
||||
set_Value (COLUMNNAME_AD_Role_ID, Integer.valueOf(AD_Role_ID));
|
||||
}
|
||||
|
||||
/** Get Role.
|
||||
@return Responsibility Role
|
||||
*/
|
||||
public int getAD_Role_ID ()
|
||||
{
|
||||
Integer ii = (Integer)get_Value(COLUMNNAME_AD_Role_ID);
|
||||
if (ii == null)
|
||||
return 0;
|
||||
return ii.intValue();
|
||||
}
|
||||
|
||||
public org.compiere.model.I_AD_User getAD_User() throws RuntimeException
|
||||
{
|
||||
return (org.compiere.model.I_AD_User)MTable.get(getCtx(), org.compiere.model.I_AD_User.Table_Name)
|
||||
.getPO(getAD_User_ID(), get_TrxName()); }
|
||||
|
||||
/** Set User/Contact.
|
||||
@param AD_User_ID
|
||||
User within the system - Internal or Business Partner Contact
|
||||
*/
|
||||
public void setAD_User_ID (int AD_User_ID)
|
||||
{
|
||||
if (AD_User_ID < 1)
|
||||
set_Value (COLUMNNAME_AD_User_ID, null);
|
||||
else
|
||||
set_Value (COLUMNNAME_AD_User_ID, Integer.valueOf(AD_User_ID));
|
||||
}
|
||||
|
||||
/** Get User/Contact.
|
||||
@return User within the system - Internal or Business Partner Contact
|
||||
*/
|
||||
public int getAD_User_ID ()
|
||||
{
|
||||
Integer ii = (Integer)get_Value(COLUMNNAME_AD_User_ID);
|
||||
if (ii == null)
|
||||
return 0;
|
||||
return ii.intValue();
|
||||
}
|
||||
|
||||
/** BroadcastFrequency AD_Reference_ID=200020 */
|
||||
public static final int BROADCASTFREQUENCY_AD_Reference_ID=200020;
|
||||
/** Just Once = J */
|
||||
public static final String BROADCASTFREQUENCY_JustOnce = "J";
|
||||
/** Until Expiration = U */
|
||||
public static final String BROADCASTFREQUENCY_UntilExpiration = "U";
|
||||
/** Set Broadcast Frequency.
|
||||
@param BroadcastFrequency
|
||||
How Many Times Message Should be Broadcasted
|
||||
*/
|
||||
public void setBroadcastFrequency (String BroadcastFrequency)
|
||||
{
|
||||
|
||||
set_Value (COLUMNNAME_BroadcastFrequency, BroadcastFrequency);
|
||||
}
|
||||
|
||||
/** Get Broadcast Frequency.
|
||||
@return How Many Times Message Should be Broadcasted
|
||||
*/
|
||||
public String getBroadcastFrequency ()
|
||||
{
|
||||
return (String)get_Value(COLUMNNAME_BroadcastFrequency);
|
||||
}
|
||||
|
||||
/** Set Broadcast Message.
|
||||
@param BroadcastMessage
|
||||
Broadcast Message
|
||||
*/
|
||||
public void setBroadcastMessage (String BroadcastMessage)
|
||||
{
|
||||
set_Value (COLUMNNAME_BroadcastMessage, BroadcastMessage);
|
||||
}
|
||||
|
||||
/** Get Broadcast Message.
|
||||
@return Broadcast Message
|
||||
*/
|
||||
public String getBroadcastMessage ()
|
||||
{
|
||||
return (String)get_Value(COLUMNNAME_BroadcastMessage);
|
||||
}
|
||||
|
||||
/** BroadcastType AD_Reference_ID=200021 */
|
||||
public static final int BROADCASTTYPE_AD_Reference_ID=200021;
|
||||
/** Immediate = I */
|
||||
public static final String BROADCASTTYPE_Immediate = "I";
|
||||
/** Immediate + Login = IL */
|
||||
public static final String BROADCASTTYPE_ImmediatePlusLogin = "IL";
|
||||
/** Login = L */
|
||||
public static final String BROADCASTTYPE_Login = "L";
|
||||
/** Set Broadcast Type.
|
||||
@param BroadcastType
|
||||
Type of Broadcast
|
||||
*/
|
||||
public void setBroadcastType (String BroadcastType)
|
||||
{
|
||||
|
||||
set_Value (COLUMNNAME_BroadcastType, BroadcastType);
|
||||
}
|
||||
|
||||
/** Get Broadcast Type.
|
||||
@return Type of Broadcast
|
||||
*/
|
||||
public String getBroadcastType ()
|
||||
{
|
||||
return (String)get_Value(COLUMNNAME_BroadcastType);
|
||||
}
|
||||
|
||||
/** Set Expire On.
|
||||
@param Expiration
|
||||
Expire On
|
||||
*/
|
||||
public void setExpiration (Timestamp Expiration)
|
||||
{
|
||||
set_Value (COLUMNNAME_Expiration, Expiration);
|
||||
}
|
||||
|
||||
/** Get Expire On.
|
||||
@return Expire On
|
||||
*/
|
||||
public Timestamp getExpiration ()
|
||||
{
|
||||
return (Timestamp)get_Value(COLUMNNAME_Expiration);
|
||||
}
|
||||
|
||||
/** Set Expired.
|
||||
@param Expired Expired */
|
||||
public void setExpired (boolean Expired)
|
||||
{
|
||||
set_Value (COLUMNNAME_Expired, Boolean.valueOf(Expired));
|
||||
}
|
||||
|
||||
/** Get Expired.
|
||||
@return Expired */
|
||||
public boolean isExpired ()
|
||||
{
|
||||
Object oo = get_Value(COLUMNNAME_Expired);
|
||||
if (oo != null)
|
||||
{
|
||||
if (oo instanceof Boolean)
|
||||
return ((Boolean)oo).booleanValue();
|
||||
return "Y".equals(oo);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Set Expire Now.
|
||||
@param ExpireNow
|
||||
Expire the broadcast message
|
||||
*/
|
||||
public void setExpireNow (String ExpireNow)
|
||||
{
|
||||
set_Value (COLUMNNAME_ExpireNow, ExpireNow);
|
||||
}
|
||||
|
||||
/** Get Expire Now.
|
||||
@return Expire the broadcast message
|
||||
*/
|
||||
public String getExpireNow ()
|
||||
{
|
||||
return (String)get_Value(COLUMNNAME_ExpireNow);
|
||||
}
|
||||
|
||||
/** Set Published.
|
||||
@param IsPublished
|
||||
The Topic is published and can be viewed
|
||||
*/
|
||||
public void setIsPublished (boolean IsPublished)
|
||||
{
|
||||
set_Value (COLUMNNAME_IsPublished, Boolean.valueOf(IsPublished));
|
||||
}
|
||||
|
||||
/** Get Published.
|
||||
@return The Topic is published and can be viewed
|
||||
*/
|
||||
public boolean isPublished ()
|
||||
{
|
||||
Object oo = get_Value(COLUMNNAME_IsPublished);
|
||||
if (oo != null)
|
||||
{
|
||||
if (oo instanceof Boolean)
|
||||
return ((Boolean)oo).booleanValue();
|
||||
return "Y".equals(oo);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Set Log Acknowledge.
|
||||
@param LogAcknowledge
|
||||
Want to Log the Acknowledgement of Message?
|
||||
*/
|
||||
public void setLogAcknowledge (boolean LogAcknowledge)
|
||||
{
|
||||
set_Value (COLUMNNAME_LogAcknowledge, Boolean.valueOf(LogAcknowledge));
|
||||
}
|
||||
|
||||
/** Get Log Acknowledge.
|
||||
@return Want to Log the Acknowledgement of Message?
|
||||
*/
|
||||
public boolean isLogAcknowledge ()
|
||||
{
|
||||
Object oo = get_Value(COLUMNNAME_LogAcknowledge);
|
||||
if (oo != null)
|
||||
{
|
||||
if (oo instanceof Boolean)
|
||||
return ((Boolean)oo).booleanValue();
|
||||
return "Y".equals(oo);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Set Notification Client.
|
||||
@param Notification_Client_ID
|
||||
Notification Client
|
||||
*/
|
||||
public void setNotification_Client_ID (int Notification_Client_ID)
|
||||
{
|
||||
if (Notification_Client_ID < 1)
|
||||
set_Value (COLUMNNAME_Notification_Client_ID, null);
|
||||
else
|
||||
set_Value (COLUMNNAME_Notification_Client_ID, Integer.valueOf(Notification_Client_ID));
|
||||
}
|
||||
|
||||
/** Get Notification Client.
|
||||
@return Notification Client
|
||||
*/
|
||||
public int getNotification_Client_ID ()
|
||||
{
|
||||
Integer ii = (Integer)get_Value(COLUMNNAME_Notification_Client_ID);
|
||||
if (ii == null)
|
||||
return 0;
|
||||
return ii.intValue();
|
||||
}
|
||||
|
||||
/** Set Processed.
|
||||
@param Processed
|
||||
The document has been processed
|
||||
*/
|
||||
public void setProcessed (boolean Processed)
|
||||
{
|
||||
set_Value (COLUMNNAME_Processed, Boolean.valueOf(Processed));
|
||||
}
|
||||
|
||||
/** Get Processed.
|
||||
@return The document has been processed
|
||||
*/
|
||||
public boolean isProcessed ()
|
||||
{
|
||||
Object oo = get_Value(COLUMNNAME_Processed);
|
||||
if (oo != null)
|
||||
{
|
||||
if (oo instanceof Boolean)
|
||||
return ((Boolean)oo).booleanValue();
|
||||
return "Y".equals(oo);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Set Publish.
|
||||
@param Publish
|
||||
Publish Broadcast Message
|
||||
*/
|
||||
public void setPublish (String Publish)
|
||||
{
|
||||
set_Value (COLUMNNAME_Publish, Publish);
|
||||
}
|
||||
|
||||
/** Get Publish.
|
||||
@return Publish Broadcast Message
|
||||
*/
|
||||
public String getPublish ()
|
||||
{
|
||||
return (String)get_Value(COLUMNNAME_Publish);
|
||||
}
|
||||
|
||||
/** Target AD_Reference_ID=200022 */
|
||||
public static final int TARGET_AD_Reference_ID=200022;
|
||||
/** Client = C */
|
||||
public static final String TARGET_Client = "C";
|
||||
/** Everybody = E */
|
||||
public static final String TARGET_Everybody = "E";
|
||||
/** Role = R */
|
||||
public static final String TARGET_Role = "R";
|
||||
/** User = U */
|
||||
public static final String TARGET_User = "U";
|
||||
/** Set Target.
|
||||
@param Target
|
||||
Target client
|
||||
*/
|
||||
public void setTarget (String Target)
|
||||
{
|
||||
|
||||
set_Value (COLUMNNAME_Target, Target);
|
||||
}
|
||||
|
||||
/** Get Target.
|
||||
@return Target client
|
||||
*/
|
||||
public String getTarget ()
|
||||
{
|
||||
return (String)get_Value(COLUMNNAME_Target);
|
||||
}
|
||||
|
||||
/** Set Test Message.
|
||||
@param TestMessage
|
||||
Test broadcast message
|
||||
*/
|
||||
public void setTestMessage (String TestMessage)
|
||||
{
|
||||
set_Value (COLUMNNAME_TestMessage, TestMessage);
|
||||
}
|
||||
|
||||
/** Get Test Message.
|
||||
@return Test broadcast message
|
||||
*/
|
||||
public String getTestMessage ()
|
||||
{
|
||||
return (String)get_Value(COLUMNNAME_TestMessage);
|
||||
}
|
||||
}
|
|
@ -18,6 +18,7 @@
|
|||
package org.compiere.model;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Properties;
|
||||
import org.compiere.util.KeyNamePair;
|
||||
|
||||
|
@ -30,7 +31,7 @@ public class X_AD_Note extends PO implements I_AD_Note, I_Persistent
|
|||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 20121031L;
|
||||
private static final long serialVersionUID = 20121024L;
|
||||
|
||||
/** Standard Constructor */
|
||||
public X_AD_Note (Properties ctx, int AD_Note_ID, String trxName)
|
||||
|
@ -71,6 +72,51 @@ public class X_AD_Note extends PO implements I_AD_Note, I_Persistent
|
|||
return sb.toString();
|
||||
}
|
||||
|
||||
/** Set Acknowledgement Time.
|
||||
@param AcknowledgeDateTime
|
||||
Acknowledgement Time of message
|
||||
*/
|
||||
public void setAcknowledgeDateTime (Timestamp AcknowledgeDateTime)
|
||||
{
|
||||
set_Value (COLUMNNAME_AcknowledgeDateTime, AcknowledgeDateTime);
|
||||
}
|
||||
|
||||
/** Get Acknowledgement Time.
|
||||
@return Acknowledgement Time of message
|
||||
*/
|
||||
public Timestamp getAcknowledgeDateTime ()
|
||||
{
|
||||
return (Timestamp)get_Value(COLUMNNAME_AcknowledgeDateTime);
|
||||
}
|
||||
|
||||
public org.compiere.model.I_AD_BroadcastMessage getAD_Broadcastmessage() throws RuntimeException
|
||||
{
|
||||
return (org.compiere.model.I_AD_BroadcastMessage)MTable.get(getCtx(), org.compiere.model.I_AD_BroadcastMessage.Table_Name)
|
||||
.getPO(getAD_Broadcastmessage_ID(), get_TrxName()); }
|
||||
|
||||
/** Set Broadcast Message.
|
||||
@param AD_Broadcastmessage_ID
|
||||
Broadcast Message
|
||||
*/
|
||||
public void setAD_Broadcastmessage_ID (int AD_Broadcastmessage_ID)
|
||||
{
|
||||
if (AD_Broadcastmessage_ID < 1)
|
||||
set_Value (COLUMNNAME_AD_Broadcastmessage_ID, null);
|
||||
else
|
||||
set_Value (COLUMNNAME_AD_Broadcastmessage_ID, Integer.valueOf(AD_Broadcastmessage_ID));
|
||||
}
|
||||
|
||||
/** Get Broadcast Message.
|
||||
@return Broadcast Message
|
||||
*/
|
||||
public int getAD_Broadcastmessage_ID ()
|
||||
{
|
||||
Integer ii = (Integer)get_Value(COLUMNNAME_AD_Broadcastmessage_ID);
|
||||
if (ii == null)
|
||||
return 0;
|
||||
return ii.intValue();
|
||||
}
|
||||
|
||||
public org.compiere.model.I_AD_Message getAD_Message() throws RuntimeException
|
||||
{
|
||||
return (org.compiere.model.I_AD_Message)MTable.get(getCtx(), org.compiere.model.I_AD_Message.Table_Name)
|
||||
|
|
|
@ -0,0 +1,78 @@
|
|||
/******************************************************************************
|
||||
* Copyright (C) 2012 Trek Global *
|
||||
* Product: iDempiere ERP & CRM Smart Business Solution *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms version 2 of the GNU General Public License as published *
|
||||
* by the Free Software Foundation. This program is distributed in the hope *
|
||||
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU General Public License for more details. *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||
*****************************************************************************/
|
||||
package org.idempiere.broadcast;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Deepak Pansheriya
|
||||
*
|
||||
*/
|
||||
public class BroadCastMsg implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -7669279373526944539L;
|
||||
|
||||
private String src;
|
||||
private int intData;
|
||||
private String target;
|
||||
private int eventId;
|
||||
|
||||
private boolean fromCluster = false;
|
||||
|
||||
public boolean isFromCluster() {
|
||||
return fromCluster;
|
||||
}
|
||||
|
||||
public void setFromCluster(boolean fromCluster) {
|
||||
this.fromCluster = fromCluster;
|
||||
}
|
||||
|
||||
public int getEventId() {
|
||||
return eventId;
|
||||
}
|
||||
|
||||
public void setEventId(int eventId) {
|
||||
this.eventId = eventId;
|
||||
}
|
||||
|
||||
public String getTarget() {
|
||||
return target;
|
||||
}
|
||||
|
||||
public void setTarget(String targetNode) {
|
||||
this.target = targetNode;
|
||||
}
|
||||
|
||||
public String getSrc() {
|
||||
return src;
|
||||
}
|
||||
|
||||
public void setSrc(String src) {
|
||||
this.src = src;
|
||||
}
|
||||
|
||||
public int getIntData() {
|
||||
return intData;
|
||||
}
|
||||
|
||||
public void setIntData(int messageId) {
|
||||
this.intData = messageId;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
/******************************************************************************
|
||||
* Copyright (C) 2012 Trek Global *
|
||||
* Product: iDempiere ERP & CRM Smart Business Solution *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms version 2 of the GNU General Public License as published *
|
||||
* by the Free Software Foundation. This program is distributed in the hope *
|
||||
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU General Public License for more details. *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||
*****************************************************************************/
|
||||
package org.idempiere.broadcast;
|
||||
|
||||
import org.adempiere.base.IServiceHolder;
|
||||
import org.adempiere.base.Service;
|
||||
import org.idempiere.distributed.IMessageService;
|
||||
import org.idempiere.distributed.ITopic;
|
||||
import org.idempiere.distributed.ITopicSubscriber;
|
||||
|
||||
/**
|
||||
* @author Deepak Pansheriya
|
||||
*/
|
||||
public class BroadCastUtil {
|
||||
public static final String TOPIC_BROADCAST_MESSAGE="BROADCAST_MESSAGE";
|
||||
public static final int EVENT_BROADCAST_MESSAGE =1;
|
||||
public static final int EVENT_TEST_BROADCAST_MESSAGE=2;
|
||||
public static final int EVENT_SESSION_TIMEOUT =3;
|
||||
public static final int EVENT_SESSION_ONNODE_TIMEOUT=4;
|
||||
|
||||
public static void subscribe(ITopicSubscriber<BroadCastMsg> subscriber){
|
||||
|
||||
IServiceHolder<IMessageService> holder = Service.locator().locate(IMessageService.class);
|
||||
IMessageService service = holder.getService();
|
||||
if (service != null) {
|
||||
ITopic<BroadCastMsg> topic= service.getTopic(TOPIC_BROADCAST_MESSAGE);
|
||||
topic.subscribe(subscriber);
|
||||
}
|
||||
}
|
||||
|
||||
public static void unSubscribe(ITopicSubscriber<BroadCastMsg> subscriber){
|
||||
|
||||
IServiceHolder<IMessageService> holder = Service.locator().locate(IMessageService.class);
|
||||
IMessageService service = holder.getService();
|
||||
if (service != null) {
|
||||
ITopic<BroadCastMsg> topic= service.getTopic(TOPIC_BROADCAST_MESSAGE);
|
||||
topic.unsubscribe(subscriber);
|
||||
}
|
||||
}
|
||||
|
||||
public static void publish(BroadCastMsg msg){
|
||||
|
||||
IServiceHolder<IMessageService> holder = Service.locator().locate(IMessageService.class);
|
||||
IMessageService service = holder.getService();
|
||||
if (service != null) {
|
||||
ITopic<BroadCastMsg> topic= service.getTopic(TOPIC_BROADCAST_MESSAGE);
|
||||
topic.publish(msg);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,164 @@
|
|||
/******************************************************************************
|
||||
* Copyright (C) 2012 Trek Global *
|
||||
* Product: iDempiere ERP & CRM Smart Business Solution *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms version 2 of the GNU General Public License as published *
|
||||
* by the Free Software Foundation. This program is distributed in the hope *
|
||||
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU General Public License for more details. *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||
*****************************************************************************/
|
||||
|
||||
package org.idempiere.broadcast;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.ArrayList;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.adempiere.base.event.EventManager;
|
||||
import org.adempiere.base.event.IEventTopics;
|
||||
import org.adempiere.exceptions.DBException;
|
||||
import org.adempiere.model.MBroadcastMessage;
|
||||
import org.compiere.model.MNote;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.Env;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Vivek
|
||||
* @author Deepak Pansheriya
|
||||
*
|
||||
*/
|
||||
public class BroadcastMsgUtil
|
||||
{
|
||||
|
||||
private static final CLogger logger = CLogger
|
||||
.getCLogger(BroadcastMsgUtil.class);
|
||||
// BROADCAST_MESSAGE_QUEUE
|
||||
|
||||
|
||||
/**
|
||||
* Publish Message
|
||||
* @param messageID
|
||||
* @param trxName
|
||||
*/
|
||||
public static void publishBroadcastMessage(final int messageID, String trxName) {
|
||||
MBroadcastMessage mbMessage = MBroadcastMessage.get(Env.getCtx(), messageID);
|
||||
String broadcastType = mbMessage.getBroadcastType();
|
||||
|
||||
if (MBroadcastMessage.BROADCASTTYPE_Login.equals(broadcastType)
|
||||
|| MBroadcastMessage.BROADCASTTYPE_ImmediatePlusLogin.equals(broadcastType)) {
|
||||
// get list of users based on rule
|
||||
if (mbMessage.getTarget() != null) {
|
||||
String sql = "SELECT DISTINCT(AD_User_ID) FROM AD_User_Roles WHERE IsActive='Y'";
|
||||
|
||||
// Role
|
||||
if (mbMessage.getTarget().equals(MBroadcastMessage.TARGET_Role)) {
|
||||
sql += " AND AD_Role_ID=" + mbMessage.getAD_Role_ID();
|
||||
} else if (mbMessage.getTarget().equals(MBroadcastMessage.TARGET_User)) {
|
||||
sql += " AND AD_User_ID=" + mbMessage.getAD_User_ID();
|
||||
} else if (mbMessage.getTarget().equals(MBroadcastMessage.TARGET_Client)) {
|
||||
sql += " AND ad_client_id = " + mbMessage.getNotification_Client_ID();
|
||||
}
|
||||
|
||||
int[] userIDs = DB.getIDsEx(null, sql);
|
||||
|
||||
for (int userID : userIDs) {
|
||||
MNote note = new MNote(Env.getCtx(), 0, trxName);
|
||||
note.setAD_Broadcastmessage_ID(messageID);
|
||||
note.setAD_User_ID(userID);
|
||||
note.setAD_Message_ID(0);
|
||||
note.saveEx();
|
||||
}
|
||||
mbMessage.setIsPublished(true);
|
||||
mbMessage.setProcessed(true);
|
||||
mbMessage.saveEx(trxName);
|
||||
} // create entry for users in AD_Note
|
||||
}else if(MBroadcastMessage.BROADCASTTYPE_Immediate.equals(broadcastType)){
|
||||
mbMessage.setProcessed(true);
|
||||
mbMessage.setIsPublished(true);
|
||||
mbMessage.saveEx(trxName);
|
||||
}
|
||||
|
||||
if (!MBroadcastMessage.BROADCASTTYPE_Login.equals(broadcastType)) {
|
||||
BroadCastMsg msg = new BroadCastMsg();
|
||||
msg.setIntData(messageID);
|
||||
msg.setEventId(BroadCastUtil.EVENT_BROADCAST_MESSAGE);
|
||||
pushToQueue(msg);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void pushToQueue(final BroadCastMsg msg){
|
||||
Runnable runnable = new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
org.osgi.service.event.Event event = EventManager.newEvent(IEventTopics.BROADCAST_MESSAGE, msg);
|
||||
EventManager.getInstance().postEvent(event);
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
Thread thread = new Thread(runnable);
|
||||
thread.setName("PublishMessage -" + Env.getContextAsInt(Env.getCtx(), "AD_Session_ID"));
|
||||
thread.start();
|
||||
}
|
||||
/**
|
||||
* Test message
|
||||
* @param messageID
|
||||
* @param AD_Session_ID
|
||||
*/
|
||||
public static void testBroadcastMessage(int messageID, int AD_Session_ID) {
|
||||
BroadCastMsg msg = new BroadCastMsg();
|
||||
msg.setIntData(messageID);
|
||||
msg.setFromCluster(true);
|
||||
msg.setEventId(BroadCastUtil.EVENT_TEST_BROADCAST_MESSAGE);
|
||||
msg.setTarget(Integer.toString(AD_Session_ID));
|
||||
|
||||
pushToQueue(msg);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Show all pending to acknowledge messages
|
||||
* @param AD_User_ID
|
||||
* @param messageWindow
|
||||
*/
|
||||
public static void showPendingMessage(int AD_User_ID, IBroadcastMsgPopup messageWindow) {
|
||||
String sql = "SELECT bm.AD_BroadcastMessage_ID "
|
||||
+ " FROM AD_Note n INNER JOIN AD_BroadcastMessage bm ON (bm.AD_BroadcastMessage_ID=n.AD_BroadcastMessage_ID) "
|
||||
+ " WHERE n.AD_User_ID=?"
|
||||
+ " AND (bm.BroadcastType='IL' OR bm.BroadcastType='L') "
|
||||
+ " AND bm.isPublished='Y' AND n.processed = 'N'"
|
||||
+ " AND ((bm.BroadcastFrequency='U' AND bm.Expired='N' AND bm.expiration > SYSDATE) OR bm.BroadcastFrequency='J')";
|
||||
|
||||
ArrayList<MBroadcastMessage> mbMessages = new ArrayList<MBroadcastMessage>();
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try {
|
||||
pstmt = DB.prepareStatement(sql, null);
|
||||
pstmt.setInt(1, AD_User_ID);
|
||||
rs = pstmt.executeQuery();
|
||||
while (rs.next()) {
|
||||
mbMessages.add(MBroadcastMessage.get(Env.getCtx(), rs.getInt(1)));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.log(Level.SEVERE, "Broadcast messages could not be retrieved",e);
|
||||
throw new DBException(e);
|
||||
}
|
||||
finally{
|
||||
DB.close(rs, pstmt);
|
||||
}
|
||||
if (mbMessages.size()>0) {
|
||||
messageWindow.prepareMessage(mbMessages);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
/******************************************************************************
|
||||
* Copyright (C) 2012 Trek Global *
|
||||
* Product: iDempiere ERP & CRM Smart Business Solution *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms version 2 of the GNU General Public License as published *
|
||||
* by the Free Software Foundation. This program is distributed in the hope *
|
||||
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU General Public License for more details. *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||
*****************************************************************************/
|
||||
|
||||
package org.idempiere.broadcast;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.adempiere.model.MBroadcastMessage;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Deepak Pansheriya
|
||||
*
|
||||
*/
|
||||
public interface IBroadcastMsgPopup {
|
||||
|
||||
public void prepareMessage(ArrayList<MBroadcastMessage> arrMessages);
|
||||
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
/******************************************************************************
|
||||
* Copyright (C) 2012 Trek Global *
|
||||
* Product: iDempiere ERP & CRM Smart Business Solution *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms version 2 of the GNU General Public License as published *
|
||||
* by the Free Software Foundation. This program is distributed in the hope *
|
||||
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU General Public License for more details. *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||
*****************************************************************************/
|
||||
|
||||
package org.idempiere.broadcast.process;
|
||||
|
||||
import org.adempiere.model.MBroadcastMessage;
|
||||
import org.compiere.process.SvrProcess;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.Env;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Vivek
|
||||
* @author Deepak Pansheriya
|
||||
*
|
||||
*/
|
||||
public class ExpireBrodcastMessage extends SvrProcess{
|
||||
|
||||
@Override
|
||||
protected void prepare() {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String doIt() throws Exception {
|
||||
MBroadcastMessage mbMessage = MBroadcastMessage.get(Env.getCtx(), getRecord_ID());
|
||||
if (MBroadcastMessage.BROADCASTFREQUENCY_UntilExpiration.equals(mbMessage.getBroadcastFrequency())
|
||||
&& !mbMessage.isExpired() && mbMessage.isPublished()){
|
||||
String sql = "UPDATE AD_Note SET Processed='Y' WHERE AD_BroadcastMessage_ID = ?";
|
||||
DB.executeUpdateEx(sql, new Object[] {getRecord_ID()}, null);
|
||||
mbMessage.setProcessed(true);
|
||||
mbMessage.setExpired(true);
|
||||
mbMessage.saveEx();
|
||||
}
|
||||
return "Expired";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
/******************************************************************************
|
||||
* Copyright (C) 2012 Trek Global *
|
||||
* Product: iDempiere ERP & CRM Smart Business Solution *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms version 2 of the GNU General Public License as published *
|
||||
* by the Free Software Foundation. This program is distributed in the hope *
|
||||
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU General Public License for more details. *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||
*****************************************************************************/
|
||||
package org.idempiere.broadcast.process;
|
||||
|
||||
import org.idempiere.broadcast.BroadcastMsgUtil;
|
||||
import org.compiere.process.SvrProcess;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Vivek
|
||||
* @author Deepak Pansheriya
|
||||
*
|
||||
*/
|
||||
public class PublishBrodcastMessage extends SvrProcess
|
||||
{
|
||||
|
||||
@Override
|
||||
protected void prepare()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String doIt() throws Exception{
|
||||
BroadcastMsgUtil.publishBroadcastMessage(getRecord_ID(), get_TrxName());
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
/******************************************************************************
|
||||
* Copyright (C) 2012 Trek Global *
|
||||
* Product: iDempiere ERP & CRM Smart Business Solution *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms version 2 of the GNU General Public License as published *
|
||||
* by the Free Software Foundation. This program is distributed in the hope *
|
||||
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU General Public License for more details. *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||
*****************************************************************************/
|
||||
package org.idempiere.broadcast.process;
|
||||
|
||||
import org.idempiere.broadcast.BroadcastMsgUtil;
|
||||
import org.compiere.process.SvrProcess;
|
||||
import org.compiere.util.Env;
|
||||
/**
|
||||
*
|
||||
* @author Vivek
|
||||
* @author Deepak Pansheriya
|
||||
*
|
||||
*/
|
||||
public class TestBrodcastMessage extends SvrProcess
|
||||
{
|
||||
|
||||
@Override
|
||||
protected void prepare()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String doIt() throws Exception
|
||||
{
|
||||
int AD_Session_ID = Env.getContextAsInt(getCtx(), "AD_Session_ID");
|
||||
BroadcastMsgUtil.testBroadcastMessage(getRecord_ID(), AD_Session_ID);
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
File diff suppressed because one or more lines are too long
|
@ -12,6 +12,7 @@ Import-Package: javax.servlet,
|
|||
org.apache.ecs.xhtml,
|
||||
org.compiere.css,
|
||||
org.osgi.framework;version="1.5.0",
|
||||
org.osgi.service.event;version="1.3.0",
|
||||
org.slf4j;version="1.6.1",
|
||||
org.slf4j.helpers;version="1.6.1",
|
||||
org.slf4j.spi;version="1.6.1"
|
||||
|
|
|
@ -40,6 +40,10 @@ import org.zkoss.zul.Vbox;
|
|||
*
|
||||
* Contributors:
|
||||
* CarlosRuiz - globalqss - Add unprocessed button to iDempiere
|
||||
*
|
||||
*
|
||||
* Contributors:
|
||||
* Deepak Pansheriya - showing only notes message
|
||||
*/
|
||||
public class DPActivities extends DashboardPanel implements EventListener<Event> {
|
||||
/**
|
||||
|
@ -123,7 +127,7 @@ public class DPActivities extends DashboardPanel implements EventListener<Event>
|
|||
{
|
||||
String sql = "SELECT COUNT(1) FROM AD_Note "
|
||||
+ "WHERE AD_Client_ID=? AND AD_User_ID IN (0,?)"
|
||||
+ " AND Processed='N'";
|
||||
+ " AND Processed='N' AND AD_BroadcastMessage_ID IS NULL";
|
||||
|
||||
int retValue = DB.getSQLValue(null, sql, Env.getAD_Client_ID(Env.getCtx()), Env.getAD_User_ID(Env.getCtx()));
|
||||
return retValue;
|
||||
|
|
|
@ -20,15 +20,21 @@ package org.adempiere.webui.desktop;
|
|||
import java.io.Serializable;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.adempiere.base.event.EventManager;
|
||||
import org.adempiere.base.event.IEventManager;
|
||||
import org.adempiere.base.event.IEventTopics;
|
||||
import org.adempiere.model.MBroadcastMessage;
|
||||
import org.adempiere.util.ServerContext;
|
||||
import org.adempiere.webui.LayoutUtils;
|
||||
import org.adempiere.webui.apps.AEnv;
|
||||
import org.adempiere.webui.apps.BusyDialog;
|
||||
import org.adempiere.webui.component.Tabpanel;
|
||||
import org.adempiere.webui.component.ToolBarButton;
|
||||
import org.adempiere.webui.dashboard.DPActivities;
|
||||
import org.adempiere.webui.event.MenuListener;
|
||||
import org.adempiere.webui.event.ZKBroadCastManager;
|
||||
import org.adempiere.webui.panel.BroadcastMessageWindow;
|
||||
import org.adempiere.webui.panel.HeaderPanel;
|
||||
import org.adempiere.webui.panel.TimeoutPanel;
|
||||
import org.adempiere.webui.session.SessionContextListener;
|
||||
import org.adempiere.webui.session.SessionManager;
|
||||
import org.adempiere.webui.util.IServerPushCallback;
|
||||
|
@ -39,14 +45,22 @@ import org.compiere.util.CLogger;
|
|||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Msg;
|
||||
import org.compiere.util.Util;
|
||||
import org.compiere.util.WebUtil;
|
||||
import org.idempiere.broadcast.BroadCastMsg;
|
||||
import org.idempiere.broadcast.BroadCastUtil;
|
||||
import org.idempiere.broadcast.BroadcastMsgUtil;
|
||||
import org.osgi.service.event.EventHandler;
|
||||
import org.zkoss.zk.au.out.AuScript;
|
||||
import org.zkoss.zk.ui.Component;
|
||||
import org.zkoss.zk.ui.Desktop;
|
||||
import org.zkoss.zk.ui.Executions;
|
||||
import org.zkoss.zk.ui.Page;
|
||||
import org.zkoss.zk.ui.event.Event;
|
||||
import org.zkoss.zk.ui.event.EventListener;
|
||||
import org.zkoss.zk.ui.event.Events;
|
||||
import org.zkoss.zk.ui.event.OpenEvent;
|
||||
import org.zkoss.zk.ui.util.Clients;
|
||||
import org.zkoss.zk.ui.util.DesktopCleanup;
|
||||
import org.zkoss.zul.Borderlayout;
|
||||
import org.zkoss.zul.Center;
|
||||
import org.zkoss.zul.North;
|
||||
|
@ -59,8 +73,9 @@ import org.zkoss.zul.West;
|
|||
* @author <a href="mailto:hengsin@gmail.com">Low Heng Sin</a>
|
||||
* @date Mar 2, 2007
|
||||
* @version $Revision: 0.10 $
|
||||
* @author Deepak Pansheriya/Vivek - Adding support for message broadcasting
|
||||
*/
|
||||
public class DefaultDesktop extends TabbedDesktop implements MenuListener, Serializable, EventListener<Event>, IServerPushCallback
|
||||
public class DefaultDesktop extends TabbedDesktop implements MenuListener, Serializable, EventListener<Event>, IServerPushCallback,EventHandler,DesktopCleanup
|
||||
{
|
||||
/**
|
||||
* generated serial version ID
|
||||
|
@ -86,16 +101,29 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria
|
|||
|
||||
private DashboardController dashboardController, sideController;
|
||||
|
||||
private BroadcastMessageWindow messageWindow;
|
||||
private BroadcastMessageWindow testMessageWindow;
|
||||
private HeaderPanel pnlHead;
|
||||
|
||||
private Desktop m_desktop = null;
|
||||
private TimeoutPanel panel = null;
|
||||
|
||||
public DefaultDesktop()
|
||||
{
|
||||
super();
|
||||
dashboardController = new DashboardController();
|
||||
sideController = new DashboardController();
|
||||
|
||||
m_desktop = AEnv.getDesktop();
|
||||
m_desktop.addListener(this);
|
||||
//subscribing to broadcast event
|
||||
bindEventManager();
|
||||
ZKBroadCastManager.getBroadCastMgr();
|
||||
}
|
||||
|
||||
protected Component doCreatePart(Component parent)
|
||||
{
|
||||
HeaderPanel pnlHead = new HeaderPanel();
|
||||
pnlHead = new HeaderPanel();
|
||||
|
||||
layout = new Borderlayout();
|
||||
if (parent != null)
|
||||
|
@ -150,6 +178,9 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria
|
|||
busyDialog.setShadow(false);
|
||||
homeTab.appendChild(busyDialog);
|
||||
|
||||
messageWindow = new BroadcastMessageWindow(pnlHead);
|
||||
BroadcastMsgUtil.showPendingMessage(Env.getAD_User_ID(Env.getCtx()), messageWindow);
|
||||
|
||||
if (!layout.getDesktop().isServerPushEnabled())
|
||||
{
|
||||
layout.getDesktop().enableServerPush(true);
|
||||
|
@ -251,6 +282,7 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria
|
|||
}
|
||||
|
||||
public void logout() {
|
||||
unbindEventManager();
|
||||
if (dashboardController != null) {
|
||||
dashboardController.onLogOut();
|
||||
}
|
||||
|
@ -287,4 +319,100 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria
|
|||
{
|
||||
autoHideMenu();
|
||||
}
|
||||
|
||||
//Implementation for Broadcast message
|
||||
/**
|
||||
* @param eventManager
|
||||
*/
|
||||
public void bindEventManager() {
|
||||
String topics [] = {IEventTopics.BROADCAST_MESSAGE};
|
||||
EventManager.getInstance().register(topics, this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param eventManager
|
||||
*/
|
||||
public void unbindEventManager() {
|
||||
EventManager.getInstance().unregister(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleEvent(final org.osgi.service.event.Event event) {
|
||||
String eventName = event.getTopic();
|
||||
if (eventName.equals(IEventTopics.BROADCAST_MESSAGE)) {
|
||||
EventListener<Event> listner = new EventListener<Event>() {
|
||||
|
||||
@Override
|
||||
public void onEvent(Event event) throws Exception {
|
||||
BroadCastMsg msg = (BroadCastMsg) event.getData();
|
||||
|
||||
|
||||
switch (msg.getEventId()) {
|
||||
case BroadCastUtil.EVENT_TEST_BROADCAST_MESSAGE:
|
||||
MBroadcastMessage mbMessage = MBroadcastMessage.get(
|
||||
Env.getCtx(), msg.getIntData());
|
||||
String currSession = Integer
|
||||
.toString(Env.getContextAsInt(Env.getCtx(),
|
||||
"AD_Session_ID"));
|
||||
if (currSession.equals(msg.getTarget())) {
|
||||
if (testMessageWindow == null)
|
||||
testMessageWindow = new BroadcastMessageWindow(
|
||||
pnlHead);
|
||||
testMessageWindow.appendMessage(mbMessage, true);
|
||||
testMessageWindow = null;
|
||||
|
||||
}
|
||||
break;
|
||||
case BroadCastUtil.EVENT_BROADCAST_MESSAGE:
|
||||
mbMessage = MBroadcastMessage.get(
|
||||
Env.getCtx(), msg.getIntData());
|
||||
if (mbMessage.isValidUserforMessage()) {
|
||||
|
||||
if (messageWindow == null)
|
||||
messageWindow = new BroadcastMessageWindow(
|
||||
pnlHead);
|
||||
messageWindow.appendMessage(mbMessage, false);
|
||||
}
|
||||
break;
|
||||
case BroadCastUtil.EVENT_SESSION_TIMEOUT:
|
||||
|
||||
currSession = Integer.toString(Env.getContextAsInt(
|
||||
Env.getCtx(), "AD_Session_ID"));
|
||||
System.out.println("Current Session" + currSession);
|
||||
if (currSession.equalsIgnoreCase(msg.getTarget())) {
|
||||
if (panel == null) {
|
||||
panel = new TimeoutPanel(pnlHead,
|
||||
msg.getIntData());
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case BroadCastUtil.EVENT_SESSION_ONNODE_TIMEOUT:
|
||||
|
||||
currSession = WebUtil.getServerName();
|
||||
|
||||
if (currSession.equalsIgnoreCase(msg.getTarget())) {
|
||||
if (panel == null) {
|
||||
panel = new TimeoutPanel(pnlHead,
|
||||
msg.getIntData());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
Executions.schedule(m_desktop, listner, new Event("OnBroadcast",
|
||||
null, event.getProperty(IEventManager.EVENT_DATA)));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanup(Desktop desktop) throws Exception {
|
||||
unbindEventManager();
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,92 @@
|
|||
/******************************************************************************
|
||||
* Copyright (C) 2012 Trek Global *
|
||||
* Product: iDempiere ERP & CRM Smart Business Solution *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms version 2 of the GNU General Public License as published *
|
||||
* by the Free Software Foundation. This program is distributed in the hope *
|
||||
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU General Public License for more details. *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||
*****************************************************************************/
|
||||
|
||||
package org.adempiere.webui.event;
|
||||
|
||||
import org.adempiere.base.event.EventManager;
|
||||
import org.adempiere.base.event.IEventTopics;
|
||||
import org.compiere.util.WebUtil;
|
||||
import org.idempiere.broadcast.BroadCastMsg;
|
||||
import org.idempiere.broadcast.BroadCastUtil;
|
||||
import org.idempiere.broadcast.BroadcastMsgUtil;
|
||||
import org.idempiere.distributed.ITopicSubscriber;
|
||||
import org.osgi.service.event.EventHandler;
|
||||
/**
|
||||
* Class Manages Broadcast Messages across webui cluster
|
||||
* @author Deepak Pansheriya
|
||||
*
|
||||
*/
|
||||
public class ZKBroadCastManager implements ITopicSubscriber<BroadCastMsg>,EventHandler{
|
||||
|
||||
private static ZKBroadCastManager broadCastMgr = null;
|
||||
|
||||
public static ZKBroadCastManager getBroadCastMgr() {
|
||||
|
||||
synchronized (ZKBroadCastManager.class) {
|
||||
if(broadCastMgr==null)
|
||||
broadCastMgr= new ZKBroadCastManager();
|
||||
|
||||
}
|
||||
return broadCastMgr;
|
||||
}
|
||||
|
||||
private ZKBroadCastManager(){
|
||||
EventManager.getInstance().register(IEventTopics.BROADCAST_MESSAGE, this);
|
||||
BroadCastUtil.subscribe(this);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* MessageService event
|
||||
*/
|
||||
@Override
|
||||
public void onMessage(BroadCastMsg message) {
|
||||
|
||||
if(!WebUtil.getServerName().equalsIgnoreCase(message.getSrc())){
|
||||
switch(message.getEventId()){
|
||||
case BroadCastUtil.EVENT_BROADCAST_MESSAGE:
|
||||
message.setFromCluster(true);
|
||||
BroadcastMsgUtil.pushToQueue(message);
|
||||
break;
|
||||
case BroadCastUtil.EVENT_SESSION_TIMEOUT:
|
||||
message.setFromCluster(true);
|
||||
BroadcastMsgUtil.pushToQueue(message);
|
||||
break;
|
||||
case BroadCastUtil.EVENT_SESSION_ONNODE_TIMEOUT:
|
||||
if(WebUtil.getServerName().equalsIgnoreCase(message.getTarget())){
|
||||
message.setFromCluster(true);
|
||||
BroadcastMsgUtil.pushToQueue(message);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* OSGI Event Handler
|
||||
*/
|
||||
@Override
|
||||
public void handleEvent(org.osgi.service.event.Event event) {
|
||||
BroadCastMsg msg = (BroadCastMsg) event
|
||||
.getProperty(EventManager.EVENT_DATA);
|
||||
// Avoid loop
|
||||
if (msg.isFromCluster())
|
||||
return;
|
||||
if (msg.getEventId() == BroadCastUtil.EVENT_BROADCAST_MESSAGE) {
|
||||
msg.setSrc(WebUtil.getServerName());
|
||||
msg.setEventId(BroadCastUtil.EVENT_BROADCAST_MESSAGE);
|
||||
BroadCastUtil.publish(msg);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,366 @@
|
|||
/******************************************************************************
|
||||
* Copyright (C) 2012 Trek Global *
|
||||
* Product: iDempiere ERP & CRM Smart Business Solution *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms version 2 of the GNU General Public License as published *
|
||||
* by the Free Software Foundation. This program is distributed in the hope *
|
||||
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU General Public License for more details. *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||
*****************************************************************************/
|
||||
package org.adempiere.webui.panel;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Hashtable;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.adempiere.exceptions.DBException;
|
||||
import org.adempiere.model.MBroadcastMessage;
|
||||
import org.adempiere.webui.component.Button;
|
||||
import org.adempiere.webui.component.Checkbox;
|
||||
import org.adempiere.webui.component.Label;
|
||||
import org.adempiere.webui.component.Window;
|
||||
import org.compiere.model.MNote;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.Env;
|
||||
import org.idempiere.broadcast.IBroadcastMsgPopup;
|
||||
import org.zkoss.zk.ui.Component;
|
||||
import org.zkoss.zk.ui.event.Event;
|
||||
import org.zkoss.zk.ui.event.EventListener;
|
||||
import org.zkoss.zk.ui.event.Events;
|
||||
import org.zkoss.zul.Borderlayout;
|
||||
import org.zkoss.zul.Cell;
|
||||
import org.zkoss.zul.Center;
|
||||
import org.zkoss.zul.Div;
|
||||
import org.zkoss.zul.Hbox;
|
||||
import org.zkoss.zul.Html;
|
||||
import org.zkoss.zul.North;
|
||||
import org.zkoss.zul.Separator;
|
||||
import org.zkoss.zul.South;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Vivek
|
||||
* @author Deepak Pansheriya
|
||||
*
|
||||
*/
|
||||
public class BroadcastMessageWindow extends Window implements IBroadcastMsgPopup,EventListener<Event>{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 5990080817061314383L;
|
||||
private static CLogger log = CLogger.getCLogger(BroadcastMessageWindow.class);
|
||||
public static final int PRESSED_PREV = 1;
|
||||
public static final int PRESSED_NEXT = 2;
|
||||
public static final int UPDATE_CurrMsg = 0;
|
||||
|
||||
private int currMsg=0;
|
||||
private Label textMsgNo = null;
|
||||
private Html textMsgContent = null;
|
||||
private North north =null;
|
||||
private Div swDiv =null;
|
||||
private Div sDiv = null;
|
||||
private Button btnPrev = null;
|
||||
private Button btnNext = null;
|
||||
private Checkbox acknowledged = null;
|
||||
private ArrayList<MBroadcastMessage> mbMessages = null;
|
||||
private Hashtable<Integer, Boolean> hashMessages = new Hashtable<Integer, Boolean>();
|
||||
private HeaderPanel pnlHead = null;
|
||||
private boolean isTest = false;
|
||||
private boolean initialised = false;
|
||||
/*public BroadcastMessageWindow(){
|
||||
//init();
|
||||
}*/
|
||||
|
||||
public BroadcastMessageWindow(HeaderPanel pnlHead) {
|
||||
this.pnlHead = pnlHead;
|
||||
textMsgNo = new Label();
|
||||
textMsgContent = new Html();
|
||||
textMsgContent.setStyle("color:black;");
|
||||
btnPrev = new Button("<");
|
||||
btnNext = new Button(">");
|
||||
}
|
||||
|
||||
private void init() {
|
||||
setTitle("Message");
|
||||
Borderlayout layout = new Borderlayout();
|
||||
this.appendChild(layout);
|
||||
addEventListener("onFocus", this);
|
||||
initialised = true;
|
||||
|
||||
setWidth("30%");
|
||||
setHeight("30%");
|
||||
setPosition("right,bottom");
|
||||
setBorder(true);
|
||||
setShadow(false);
|
||||
doOverlapped();
|
||||
setClosable(true);
|
||||
|
||||
north = new North();
|
||||
layout.appendChild(north);
|
||||
|
||||
Center center = new Center();
|
||||
layout.appendChild(center);
|
||||
Div htmlDiv = new Div();
|
||||
//textMsgContent = new Label();
|
||||
htmlDiv.appendChild(textMsgContent);
|
||||
textMsgContent.setContent(mbMessages.get(0).getBroadcastMessage());
|
||||
htmlDiv.setFocus(true);
|
||||
htmlDiv.setStyle("display: table-cell; vertical-align: middle; text-align: center;");
|
||||
Div divAlign = new Div();
|
||||
divAlign.setStyle("color:white; position: absolute; width: 370px; height: 120px; display: table;");
|
||||
htmlDiv.setParent(divAlign);
|
||||
center.appendChild(divAlign);
|
||||
center.setBorder("rounded");
|
||||
center.setStyle("-moz-border-radius: 3px; -webkit-border-radius: 3px; border: 1px solid #BBBBBB; border-radius: 3px; margin-bottom:10px;");
|
||||
|
||||
South south = new South();
|
||||
layout.appendChild(south);
|
||||
Hbox southHLayout = new Hbox();
|
||||
south.appendChild(southHLayout);
|
||||
southHLayout.setSpacing("30");
|
||||
southHLayout.setWidth("350px");
|
||||
|
||||
Cell leftCell = new Cell();
|
||||
southHLayout.appendChild(leftCell);
|
||||
leftCell.setHflex("1");
|
||||
//leftCell.setWidth("30%");
|
||||
leftCell.setAlign("left");
|
||||
swDiv = new Div();
|
||||
swDiv.setParent(leftCell);
|
||||
acknowledged = new Checkbox();
|
||||
|
||||
Cell rightCell = new Cell();
|
||||
southHLayout.appendChild(rightCell);
|
||||
rightCell.setAlign("right");
|
||||
rightCell.setHflex("2");
|
||||
sDiv = new Div();
|
||||
sDiv.setWidth("70px");
|
||||
rightCell.appendChild(sDiv);
|
||||
|
||||
|
||||
//createHashTable();
|
||||
currMsg = 0;
|
||||
//btnPrev = new Button("<");
|
||||
btnPrev.addEventListener("onClick", this);
|
||||
//textMsgNo = new Label();
|
||||
//textMsgNo.setValue((currMsg+1)+"/"+noOfMsgs);
|
||||
btnNext = new Button(">");
|
||||
btnNext.addEventListener("onClick", this);
|
||||
|
||||
swDiv.appendChild(btnPrev);
|
||||
swDiv.appendChild(new Separator("vertical"));
|
||||
swDiv.appendChild(textMsgNo);
|
||||
swDiv.appendChild(new Separator("vertical"));
|
||||
swDiv.appendChild(btnNext);
|
||||
textMsgNo.setStyle("font-weight:bold;");
|
||||
|
||||
renderMsg(UPDATE_CurrMsg);
|
||||
|
||||
if(mbMessages.size()<=0)
|
||||
swDiv.setVisible(false);
|
||||
|
||||
south.setHeight("22%");
|
||||
//south.setWidth("45%");
|
||||
acknowledged.setParent(rightCell);
|
||||
acknowledged.setVisible(false);
|
||||
//acknowledged.setHflex("6");
|
||||
acknowledged.setLabel("Acknowledge");
|
||||
acknowledged.addEventListener("onClick", this);
|
||||
|
||||
}
|
||||
|
||||
private void createHashTable() {
|
||||
hashMessages.clear();
|
||||
for(int i=0; i<mbMessages.size(); i++){
|
||||
if(!mbMessages.get(i).getBroadcastType().equals(MBroadcastMessage.BROADCASTTYPE_Immediate)){
|
||||
MNote note = getMNote(mbMessages.get(i));
|
||||
hashMessages.put(mbMessages.get(i).get_ID(), note.isProcessed());
|
||||
}else{
|
||||
hashMessages.put(mbMessages.get(i).get_ID(), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void prepareMessage(ArrayList<MBroadcastMessage> arrMessages){
|
||||
mbMessages = arrMessages;
|
||||
createHashTable();
|
||||
if(!initialised)
|
||||
init();
|
||||
pnlHead.appendChild(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Append message to existing message list
|
||||
* @param mbMessage
|
||||
* @param isTest
|
||||
*/
|
||||
public void appendMessage(MBroadcastMessage mbMessage, boolean isTest){
|
||||
this.isTest = isTest;
|
||||
currMsg = 0;
|
||||
if(mbMessages!=null && isTest){
|
||||
mbMessages.clear();
|
||||
}else if(mbMessages == null){
|
||||
mbMessages = new ArrayList<MBroadcastMessage>();
|
||||
}
|
||||
|
||||
mbMessages.add(0, mbMessage);
|
||||
if(!isTest)
|
||||
createHashTable();
|
||||
|
||||
if(!initialised)
|
||||
init();
|
||||
else if(!isTest){
|
||||
currMsg=0;
|
||||
renderMsg(UPDATE_CurrMsg);
|
||||
}
|
||||
|
||||
pnlHead.appendChild(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEvent(Event event) throws Exception {
|
||||
Component comp = event.getTarget();
|
||||
int noOfMsgs = mbMessages.size();
|
||||
|
||||
if(event.getName().equals(Events.ON_CLICK)){
|
||||
if(comp == btnPrev){
|
||||
if(currMsg > 0){
|
||||
currMsg--;
|
||||
renderMsg(PRESSED_PREV);
|
||||
}
|
||||
}else if (comp == btnNext){
|
||||
if(currMsg < noOfMsgs-1){
|
||||
currMsg++;
|
||||
renderMsg(PRESSED_NEXT);
|
||||
}
|
||||
}else if(comp == acknowledged){
|
||||
hashMessages.put(mbMessages.get(currMsg).get_ID(), acknowledged.isChecked());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update message on window
|
||||
* @param status
|
||||
*/
|
||||
public void renderMsg(int status) {
|
||||
int msgToUpdate = currMsg-1;
|
||||
if(status == PRESSED_NEXT){
|
||||
msgToUpdate = currMsg-1;
|
||||
}else if(status == PRESSED_PREV){
|
||||
msgToUpdate = currMsg+1;
|
||||
}else if(status == UPDATE_CurrMsg){
|
||||
msgToUpdate = currMsg;
|
||||
}
|
||||
|
||||
int noOfMsgs = mbMessages.size();
|
||||
MBroadcastMessage mbMessage = mbMessages.get(currMsg);
|
||||
String broadcastFrequency = mbMessage.getBroadcastFrequency();
|
||||
|
||||
if(mbMessages.size()>1)
|
||||
swDiv.setVisible(true);
|
||||
else
|
||||
swDiv.setVisible(false);
|
||||
|
||||
if (noOfMsgs > 1) {
|
||||
btnNext.setEnabled(true);
|
||||
btnPrev.setEnabled(true);
|
||||
MBroadcastMessage prevMsg = mbMessages.get(msgToUpdate);
|
||||
if((prevMsg.getBroadcastFrequency().equals("J")
|
||||
|| prevMsg.getBroadcastType().equals(MBroadcastMessage.BROADCASTTYPE_Immediate))){
|
||||
hashMessages.put(prevMsg.get_ID(), true);
|
||||
}
|
||||
|
||||
if (currMsg == 0) {
|
||||
btnPrev.setEnabled(false);
|
||||
} else if (currMsg == noOfMsgs - 1) {
|
||||
if ((broadcastFrequency.equals("J"))
|
||||
|| (mbMessage.getBroadcastType().equals(MBroadcastMessage.BROADCASTTYPE_Immediate))) {
|
||||
hashMessages.put(mbMessage.get_ID(), true);
|
||||
}
|
||||
btnNext.setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
textMsgNo.setValue((currMsg+1)+"/"+noOfMsgs);
|
||||
textMsgContent.setContent(mbMessage.getBroadcastMessage());
|
||||
|
||||
if(!isTest && mbMessage.isLogAcknowledge() && broadcastFrequency.equals(MBroadcastMessage.BROADCASTFREQUENCY_UntilExpiration)){
|
||||
boolean ack = hashMessages.get(mbMessage.get_ID());
|
||||
acknowledged.setChecked(ack);
|
||||
acknowledged.setVisible(true);
|
||||
}else if((broadcastFrequency.equals(MBroadcastMessage.BROADCASTFREQUENCY_JustOnce))
|
||||
|| (mbMessage.getBroadcastType().equals(MBroadcastMessage.BROADCASTTYPE_Immediate))){
|
||||
acknowledged.setVisible(false);
|
||||
hashMessages.put(mbMessages.get(currMsg).get_ID(), true);
|
||||
}else{
|
||||
acknowledged.setVisible(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get AD Note entries for current login user for provided message
|
||||
* @param mbMessage
|
||||
* @return
|
||||
*/
|
||||
public MNote getMNote(MBroadcastMessage mbMessage) {
|
||||
MNote note =null;
|
||||
if(!mbMessage.getBroadcastType().equals(MBroadcastMessage.BROADCASTTYPE_Immediate)){
|
||||
String sql = "SELECT * FROM AD_Note WHERE AD_BroadcastMessage_ID = ? AND AD_User_ID = ?";
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs=null;
|
||||
try {
|
||||
pstmt = DB.prepareStatement(sql, null);
|
||||
pstmt.setInt(1, mbMessage.get_ID());
|
||||
pstmt.setInt(2, Env.getAD_User_ID(Env.getCtx()));
|
||||
rs = pstmt.executeQuery();
|
||||
if(rs.next())
|
||||
note = new MNote(Env.getCtx(), rs, null);
|
||||
} catch (Exception e) {
|
||||
log.log(Level.SEVERE, "Note for the Mesaage Could not be retrieved ",e);
|
||||
throw new DBException(e);
|
||||
}finally{
|
||||
DB.close(rs, pstmt);
|
||||
}
|
||||
}
|
||||
return note;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClose() {
|
||||
super.onClose();
|
||||
if (!isTest) {
|
||||
if(mbMessages.size()==1){
|
||||
if ((mbMessages.get(0).getBroadcastFrequency().equals("J"))
|
||||
|| (mbMessages.get(0).getBroadcastType().equals(MBroadcastMessage.BROADCASTTYPE_Immediate))) {
|
||||
hashMessages.put(mbMessages.get(0).get_ID(), true);
|
||||
}
|
||||
}
|
||||
ArrayList<MBroadcastMessage> acknowedgedMsgs = new ArrayList<MBroadcastMessage>();
|
||||
for (MBroadcastMessage mbMessage : mbMessages) {
|
||||
if(!mbMessage.getBroadcastType().equals(MBroadcastMessage.BROADCASTTYPE_Immediate)){
|
||||
MNote note = getMNote(mbMessage);
|
||||
note.setProcessed(hashMessages.get(mbMessage.get_ID()));
|
||||
if(hashMessages.get(mbMessage.get_ID())){
|
||||
acknowedgedMsgs.add(mbMessage);
|
||||
}
|
||||
note.saveEx();
|
||||
}else{
|
||||
acknowedgedMsgs.add(mbMessage);
|
||||
}
|
||||
}
|
||||
for (MBroadcastMessage mBroadcastMessage : acknowedgedMsgs) {
|
||||
mbMessages.remove(mBroadcastMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,148 @@
|
|||
/******************************************************************************
|
||||
* Copyright (C) 2012 Trek Global *
|
||||
* Product: iDempiere ERP & CRM Smart Business Solution *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms version 2 of the GNU General Public License as published *
|
||||
* by the Free Software Foundation. This program is distributed in the hope *
|
||||
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU General Public License for more details. *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||
*****************************************************************************/
|
||||
|
||||
package org.adempiere.webui.panel;
|
||||
|
||||
import org.zkoss.zhtml.Script;
|
||||
import org.zkoss.zk.ui.Executions;
|
||||
import org.zkoss.zk.ui.Session;
|
||||
import org.zkoss.zk.ui.Sessions;
|
||||
import org.zkoss.zk.ui.event.Event;
|
||||
import org.zkoss.zk.ui.event.Events;
|
||||
import org.zkoss.zul.Borderlayout;
|
||||
import org.zkoss.zul.Center;
|
||||
import org.zkoss.zul.Div;
|
||||
import org.zkoss.zul.Html;
|
||||
import org.zkoss.zul.Label;
|
||||
import org.zkoss.zul.North;
|
||||
import org.zkoss.zul.South;
|
||||
import org.zkoss.zul.Timer;
|
||||
import org.zkoss.zul.Vlayout;
|
||||
import org.zkoss.zul.Window;
|
||||
/**
|
||||
*
|
||||
* @author Deepak Pansheriya
|
||||
*
|
||||
*/
|
||||
public class TimeoutPanel extends Window implements
|
||||
org.zkoss.zk.ui.event.EventListener<Event> {
|
||||
|
||||
|
||||
private static final long serialVersionUID = -2734157789771800337L;
|
||||
private Timer timer = null;
|
||||
private int count = 0;
|
||||
private Label lCaption = null;
|
||||
private Label ltime = null;
|
||||
private Timer timerJS = null;
|
||||
|
||||
public TimeoutPanel(HeaderPanel pnlHead, int timeInSecond) {
|
||||
count = timeInSecond;
|
||||
pnlHead.appendChild(this);
|
||||
|
||||
|
||||
Borderlayout layout = new Borderlayout();
|
||||
layout.setParent(this);
|
||||
|
||||
setWidth("23%");
|
||||
setHeight("25%");
|
||||
setPosition("left,bottom");
|
||||
setBorder(true);
|
||||
setShadow(false);
|
||||
doOverlapped();
|
||||
|
||||
North north = new North();
|
||||
north.setParent(layout);
|
||||
|
||||
Div divNorth = new Div();
|
||||
divNorth.setParent(north);
|
||||
divNorth.setStyle("text-align: center;");
|
||||
|
||||
lCaption = new Label("You will be logged out in ");
|
||||
lCaption.setParent(divNorth);
|
||||
lCaption.setStyle("text-align: center; font-size: 20px;");
|
||||
|
||||
Center center = new Center();
|
||||
center.setParent(layout);
|
||||
|
||||
Vlayout centerVlayout = new Vlayout();
|
||||
centerVlayout.setParent(center);
|
||||
centerVlayout.setStyle("height:100%; text-align: center;");
|
||||
|
||||
|
||||
South south = new South();
|
||||
south.setParent(layout);
|
||||
|
||||
|
||||
Div divSouth = new Div();
|
||||
divSouth.setParent(south);
|
||||
divSouth.setStyle("height:100%; text-align: center;");
|
||||
|
||||
|
||||
timer = new Timer();
|
||||
timer.setDelay((count * 1000));
|
||||
timer.addEventListener(Events.ON_TIMER, this);
|
||||
timer.setRepeats(true);
|
||||
timer.start();
|
||||
centerVlayout.appendChild(timer);
|
||||
|
||||
|
||||
Script jScript = new Script("var countJS = "+count+";");
|
||||
jScript.setDynamicProperty("defer","true");
|
||||
jScript.setParent(centerVlayout);
|
||||
|
||||
timerJS = new Timer();
|
||||
timerJS.setDelay((1000));
|
||||
timerJS.stop();
|
||||
timerJS.setRepeats(true);
|
||||
String script = " countJS--;if(countJS <= 0){this.stop();} minValue = Math.floor(countJS/60).toString().length > 1 ? Math.floor(countJS/60) : '0' + Math.floor(countJS/60); secValue = (countJS%60).toString().length>1?(countJS%60) : '0'+(countJS%60); this.nextSibling.setValue(minValue+' : '+secValue);";
|
||||
timerJS.setWidgetListener("onTimer", script);
|
||||
timerJS.start();
|
||||
timerJS.setParent(centerVlayout);
|
||||
|
||||
String minConverted = ((count / 60) + "").length() > 1 ? (count / 60) + ""
|
||||
: "0" + (count / 60);
|
||||
String secConverted = ((count % 60) + "").length() > 1 ? (count % 60) + ""
|
||||
: "0" + (count % 60);
|
||||
|
||||
ltime = new Label(minConverted +" : "+secConverted);
|
||||
ltime.setParent(centerVlayout);
|
||||
ltime.setStyle("text-align: center; font-size: 40px; color:red;");
|
||||
|
||||
|
||||
Html txtLbl = new Html("Minutes Second");
|
||||
txtLbl.setParent(centerVlayout);
|
||||
txtLbl.setStyle("font-size: 12px;");
|
||||
|
||||
|
||||
Vlayout vLayout = new Vlayout();
|
||||
vLayout.setParent(divSouth);
|
||||
|
||||
|
||||
Label saveLbl = new Label("Save your work!!");
|
||||
saveLbl.setParent(vLayout);
|
||||
saveLbl.setStyle("font-size: 20px;");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEvent(Event event) throws Exception {
|
||||
if (event.getName().equals("onTimer"))
|
||||
{
|
||||
timer.stop();
|
||||
Session session = Sessions.getCurrent();
|
||||
session.invalidate();
|
||||
Executions.sendRedirect("/index.zul");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,79 @@
|
|||
/******************************************************************************
|
||||
* Copyright (C) 2012 Trek Global *
|
||||
* Product: iDempiere ERP & CRM Smart Business Solution *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms version 2 of the GNU General Public License as published *
|
||||
* by the Free Software Foundation. This program is distributed in the hope *
|
||||
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU General Public License for more details. *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||
*****************************************************************************/
|
||||
|
||||
package org.adempiere.webui.process;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.compiere.process.ProcessInfoParameter;
|
||||
import org.compiere.process.SvrProcess;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.DB;
|
||||
import org.idempiere.broadcast.BroadCastMsg;
|
||||
import org.idempiere.broadcast.BroadCastUtil;
|
||||
import org.idempiere.broadcast.BroadcastMsgUtil;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Deepak Pansheriya
|
||||
*
|
||||
*/
|
||||
public class KillAllSession extends SvrProcess {
|
||||
private static final CLogger logger = CLogger
|
||||
.getCLogger(KillAllSession.class);
|
||||
private int scndTimeout = 0;
|
||||
|
||||
|
||||
@Override
|
||||
protected void prepare() {
|
||||
ProcessInfoParameter[] para = getParameter();
|
||||
for (int i = 0; i < para.length; i++) {
|
||||
String name = para[i].getParameterName();
|
||||
if (para[i].getParameter() == null)
|
||||
;
|
||||
else if (name.equals("TimeOutInSeconds"))
|
||||
scndTimeout = para[i].getParameterAsInt();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String doIt() throws Exception {
|
||||
|
||||
|
||||
String sql = "SELECT servername FROM ad_session WHERE ad_session_id=?";
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try {
|
||||
pstmt = DB.prepareStatement(sql, null);
|
||||
pstmt.setInt(1, getRecord_ID());
|
||||
rs = pstmt.executeQuery();
|
||||
if (rs.next()) {
|
||||
BroadCastMsg msg = new BroadCastMsg();
|
||||
msg.setEventId(BroadCastUtil.EVENT_SESSION_ONNODE_TIMEOUT);
|
||||
msg.setIntData(scndTimeout);
|
||||
msg.setTarget(rs.getString("servername"));
|
||||
BroadcastMsgUtil.pushToQueue(msg);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.log(Level.SEVERE, "servername could not be retrieved", e);
|
||||
throw new IllegalStateException(e.getMessage());
|
||||
} finally {
|
||||
DB.close(rs, pstmt);
|
||||
}
|
||||
|
||||
return "Session Time Out Initiated";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
/******************************************************************************
|
||||
* Copyright (C) 2012 Trek Global *
|
||||
* Product: iDempiere ERP & CRM Smart Business Solution *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms version 2 of the GNU General Public License as published *
|
||||
* by the Free Software Foundation. This program is distributed in the hope *
|
||||
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU General Public License for more details. *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||
*****************************************************************************/
|
||||
|
||||
package org.adempiere.webui.process;
|
||||
|
||||
import org.compiere.process.ProcessInfoParameter;
|
||||
import org.compiere.process.SvrProcess;
|
||||
import org.idempiere.broadcast.BroadCastMsg;
|
||||
import org.idempiere.broadcast.BroadCastUtil;
|
||||
import org.idempiere.broadcast.BroadcastMsgUtil;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Deepak Pansheriya
|
||||
*
|
||||
*/
|
||||
public class KillCurrentSession extends SvrProcess {
|
||||
|
||||
private int scndTimeout = 0;
|
||||
|
||||
@Override
|
||||
protected void prepare() {
|
||||
ProcessInfoParameter[] para = getParameter();
|
||||
for (int i = 0; i < para.length; i++) {
|
||||
String name = para[i].getParameterName();
|
||||
if (para[i].getParameter() == null)
|
||||
;
|
||||
else if (name.equals("TimeOutInSeconds"))
|
||||
scndTimeout = para[i].getParameterAsInt();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String doIt() throws Exception {
|
||||
|
||||
BroadCastMsg msg = new BroadCastMsg();
|
||||
msg.setEventId(BroadCastUtil.EVENT_SESSION_TIMEOUT);
|
||||
msg.setIntData(scndTimeout);
|
||||
msg.setTarget(Integer.toString(getRecord_ID()));
|
||||
BroadcastMsgUtil.pushToQueue(msg);
|
||||
|
||||
return "Session notified";
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue