Suite user administration.
[gpl/argeo-suite.git] / org.argeo.suite.ui / src / org / argeo / suite / ui / SuiteEvent.java
index 7d9bca73cc0e3ff086e43b3647b62d4e93ed83d6..a77dc7a87629c0b9294e1dee4ae00c3ea2c48f71 100644 (file)
@@ -1,17 +1,37 @@
 package org.argeo.suite.ui;
 
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.jcr.Node;
+
+import org.argeo.cms.ui.util.CmsEvent;
+import org.argeo.jcr.Jcr;
+import org.osgi.service.useradmin.User;
+
 /** Events specific to Argeo Suite. */
-public enum SuiteEvent {
-       switchLayer;
+public enum SuiteEvent implements CmsEvent {
+       openNewPart, refreshPart, switchLayer;
 
-       public final static String LAYER_PARAM = "layer";
+       public final static String LAYER = "layer";
+       public final static String NODE_ID = "nodeId";
+       public final static String USERNAME = "username";
+       public final static String WORKSPACE = "workspace";
 
-       String topic() {
-               return getTopicBase() + "/" + name();
+       public String getTopicBase() {
+               return "argeo/suite/ui";
        }
 
-       String getTopicBase() {
-               return "argeo/suite/ui";
+       public static Map<String, Object> eventProperties(Node node) {
+               Map<String, Object> properties = new HashMap<>();
+               properties.put(NODE_ID, Jcr.getIdentifier(node));
+               properties.put(WORKSPACE, Jcr.getWorkspaceName(node));
+               return properties;
        }
 
+       public static Map<String, Object> eventProperties(User user) {
+               Map<String, Object> properties = new HashMap<>();
+               properties.put(USERNAME, user.getName());
+               return properties;
+       }
 }