IDEMPIERE-293 Support for Kill Session

This commit is contained in:
Deepak Pansheriya 2012-11-30 17:15:19 +05:30
parent 8d1865571f
commit 962110fd2c
11 changed files with 487 additions and 30 deletions

View File

@ -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
;

View File

@ -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
;

View File

@ -91,6 +91,6 @@ public interface IEventTopics {
public static final String PREF_AFTER_LOAD = "adempiere/pref/afterLoad";
public static final String BROADCAST_MESSAGE = "adempiere/broadcastMsg";
public static final String BROADCAST_MESSAGE = "idempiere/broadcastMsg";
}

View File

@ -28,8 +28,8 @@ public class BroadCastMsg implements Serializable {
private static final long serialVersionUID = -7669279373526944539L;
private String src;
private int messageId;
private String targetNode;
private int intData;
private String target;
private int eventId;
private boolean fromCluster = false;
@ -50,12 +50,12 @@ public class BroadCastMsg implements Serializable {
this.eventId = eventId;
}
public String getTargetNode() {
return targetNode;
public String getTarget() {
return target;
}
public void setTargetNode(String targetNode) {
this.targetNode = targetNode;
public void setTarget(String targetNode) {
this.target = targetNode;
}
public String getSrc() {
@ -66,12 +66,12 @@ public class BroadCastMsg implements Serializable {
this.src = src;
}
public int getMessageId() {
return messageId;
public int getIntData() {
return intData;
}
public void setMessageId(int messageId) {
this.messageId = messageId;
public void setIntData(int messageId) {
this.intData = messageId;
}

View File

@ -27,6 +27,7 @@ public class BroadCastUtil {
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){

View File

@ -106,7 +106,7 @@ public class BroadcastMsgUtil
if (!MBroadcastMessage.BROADCASTTYPE_Login.equals(broadcastType)) {
BroadCastMsg msg = new BroadCastMsg();
msg.setMessageId(messageID);
msg.setIntData(messageID);
msg.setEventId(BroadCastUtil.EVENT_BROADCAST_MESSAGE);
pushToQueue(msg);
}
@ -136,10 +136,10 @@ public class BroadcastMsgUtil
*/
public static void testBroadcastMessage(int messageID, int AD_Session_ID) {
BroadCastMsg msg = new BroadCastMsg();
msg.setMessageId(messageID);
msg.setIntData(messageID);
msg.setFromCluster(true);
msg.setEventId(BroadCastUtil.EVENT_TEST_BROADCAST_MESSAGE);
msg.setTargetNode(Integer.toString(AD_Session_ID));
msg.setTarget(Integer.toString(AD_Session_ID));
pushToQueue(msg);
}

View File

@ -25,7 +25,6 @@ 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;
@ -35,6 +34,7 @@ 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;
@ -45,6 +45,7 @@ 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;
@ -105,6 +106,8 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria
private HeaderPanel pnlHead;
private Desktop m_desktop = null;
private TimeoutPanel panel = null;
public DefaultDesktop()
{
super();
@ -322,7 +325,8 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria
* @param eventManager
*/
public void bindEventManager() {
EventManager.getInstance().register(IEventTopics.BROADCAST_MESSAGE, this);
String topics [] = {IEventTopics.BROADCAST_MESSAGE,IEventTopics.KILL_SESSION};
EventManager.getInstance().register(topics, this);
}
/**
@ -336,19 +340,21 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria
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>(){
EventListener<Event> listner = new EventListener<Event>() {
@Override
public void onEvent(Event event) throws Exception {
BroadCastMsg msg = (BroadCastMsg) event.getData();
MBroadcastMessage mbMessage = MBroadcastMessage.get(
Env.getCtx(), msg.getMessageId());
if (msg.getEventId() == BroadCastUtil.EVENT_TEST_BROADCAST_MESSAGE) {
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.getTargetNode())) {
if (currSession.equals(msg.getTarget())) {
if (testMessageWindow == null)
testMessageWindow = new BroadcastMessageWindow(
pnlHead);
@ -356,15 +362,50 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria
testMessageWindow = null;
}
} else if (mbMessage.isValidUserforMessage()) {
if (messageWindow == null)
messageWindow = new BroadcastMessageWindow(pnlHead);
messageWindow.appendMessage(mbMessage, false);
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)));
Executions.schedule(m_desktop, listner, new Event("OnBroadcast",
null, event.getProperty(IEventManager.EVENT_DATA)));
}
}

View File

@ -60,7 +60,14 @@ public class ZKBroadCastManager implements ITopicSubscriber<BroadCastMsg>,EventH
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;
}
}

View File

@ -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&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;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");
}
}
}

View File

@ -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";
}
}

View File

@ -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";
}
}