]> git.mxchange.org Git - juser-activity-core.git/commitdiff
Continued a bit:
authorRoland Häder <roland@mxchange.org>
Fri, 26 Aug 2016 12:17:57 +0000 (14:17 +0200)
committerRoland Häder <roland@mxchange.org>
Fri, 26 Aug 2016 12:17:57 +0000 (14:17 +0200)
- added principal name field
- added constructor with new field

src/org/mxchange/jusercore/model/user/activity/LogableUserActivity.java
src/org/mxchange/jusercore/model/user/activity/UserActivityLog.java

index ffd04fe4d7cccd7826d7e192525aed85855b0e86..226faa754931a9eb21c51ef1b99f8fa01f14f204 100644 (file)
@@ -56,6 +56,20 @@ public interface LogableUserActivity extends Serializable {
         */
        void setActivityMessage (final String activityMessage);
 
+       /**
+        * Getter for principal name
+        * <p>
+        * @return Principal name
+        */
+       String getActivityPrincipalName ();
+
+       /**
+        * Setter for principal name
+        * <p>
+        * @param activityPrincipalName Principal name
+        */
+       void setActivityPrincipalName (final String activityPrincipalName);
+
        /**
         * Getter for activity timestamp
         * <p>
index a0a0e3f325afe8ba7f14d313918bf26f54fe8673..f96e689a06acf21061f9cf43f8e9f2ef7f361ab2 100644 (file)
@@ -103,6 +103,12 @@ public class UserActivityLog implements LogableUserActivity {
        @Lob
        private String activityMessage;
 
+       /**
+        * Principal name
+        */
+       @Column (name = "activity_principal_name", updatable = false)
+       private String activityPrincipalName;
+
        /**
         * Timestamp
         */
@@ -213,6 +219,23 @@ public class UserActivityLog implements LogableUserActivity {
                this.activityContactFamilyName = activityUser.getUserContact().getContactFamilyName();
        }
 
+       /**
+        * Constructor with message, type, user, timestamp and principal name
+        * <p>
+        * @param activityMessage Message
+        * @param activityType Type
+        * @param activityUser User instance
+        * @param activityTimestamp imestamp
+        * @param principalName Principal name
+        */
+       public UserActivityLog (final String activityMessage, final String activityType, final User activityUser, final Calendar activityTimestamp, final String principalName) {
+               // Call other constructor
+               this(activityMessage, activityType, activityUser, activityTimestamp);
+
+               // Set principal name
+               this.activityPrincipalName = principalName;
+       }
+
        @Override
        public boolean equals (final Object object) {
                if (this == object) {
@@ -227,6 +250,8 @@ public class UserActivityLog implements LogableUserActivity {
 
                if (!Objects.equals(this.getActivityMessage(), other.getActivityMessage())) {
                        return false;
+               } else if (!Objects.equals(this.getActivityPrincipalName(), other.getActivityPrincipalName())) {
+                       return false;
                } else if (!Objects.equals(this.getActivityType(), other.getActivityType())) {
                        return false;
                } else if (!Objects.equals(this.getActivityId(), other.getActivityId())) {
@@ -290,6 +315,16 @@ public class UserActivityLog implements LogableUserActivity {
                this.activityMessage = activityMessage;
        }
 
+       @Override
+       public String getActivityPrincipalName () {
+               return this.activityPrincipalName;
+       }
+
+       @Override
+       public void setActivityPrincipalName (final String activityPrincipalName) {
+               this.activityPrincipalName = activityPrincipalName;
+       }
+
        @Override
        @SuppressWarnings ("ReturnOfDateField")
        public Calendar getActivityTimestamp () {
@@ -338,6 +373,7 @@ public class UserActivityLog implements LogableUserActivity {
 
                hash = 83 * hash + Objects.hashCode(this.getActivityId());
                hash = 83 * hash + Objects.hashCode(this.getActivityMessage());
+               hash = 83 * hash + Objects.hashCode(this.getActivityPrincipalName());
                hash = 83 * hash + Objects.hashCode(this.getActivityTimestamp());
                hash = 83 * hash + Objects.hashCode(this.getActivityType());
                hash = 83 * hash + Objects.hashCode(this.getActivityUser());