Introduce UUID identified and openForEdit/freeze cycle
[lgpl/argeo-commons.git] / org.argeo.cms / src / org / argeo / cms / internal / auth / CmsSessionImpl.java
index 4f5a85ddfc998a0bbd24b33d4b4fc567bf21e565..3a23870bd0703a37608311c694d70a80ee82f672 100644 (file)
@@ -21,11 +21,12 @@ import org.argeo.api.cms.CmsAuth;
 import org.argeo.api.cms.CmsConstants;
 import org.argeo.api.cms.CmsLog;
 import org.argeo.api.cms.CmsSession;
+import org.argeo.api.uuid.UuidIdentified;
 import org.argeo.cms.internal.runtime.CmsContextImpl;
 import org.osgi.service.useradmin.Authorization;
 
 /** Default CMS session implementation. */
-public class CmsSessionImpl implements CmsSession, Serializable {
+public class CmsSessionImpl implements CmsSession, Serializable, UuidIdentified {
        private static final long serialVersionUID = 1867719354246307225L;
        private final static CmsLog log = CmsLog.getLog(CmsSessionImpl.class);
 
@@ -128,7 +129,7 @@ public class CmsSessionImpl implements CmsSession, Serializable {
        }
 
        @Override
-       public UUID getUuid() {
+       public UUID uuid() {
                return uuid;
        }
 
@@ -175,6 +176,21 @@ public class CmsSessionImpl implements CmsSession, Serializable {
                views.put(uid, view);
        }
 
+       /*
+        * OBJECT METHODS
+        */
+
+       @Override
+       public boolean equals(Object o) {
+               return UuidIdentified.equals(this, o);
+       }
+
+       @Override
+       public int hashCode() {
+               return UuidIdentified.hashCode(this);
+       }
+
+       @Override
        public String toString() {
                return "CMS Session " + userDn + " localId=" + localSessionId + ", uuid=" + uuid;
        }