From: Roland Häder Date: Fri, 26 Aug 2016 12:17:57 +0000 (+0200) Subject: Continued a bit: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=d69da07061b10a01109a1d80a1b430c0a6d1be9b;p=juser-activity-core.git Continued a bit: - added principal name field - added constructor with new field --- diff --git a/src/org/mxchange/jusercore/model/user/activity/LogableUserActivity.java b/src/org/mxchange/jusercore/model/user/activity/LogableUserActivity.java index ffd04fe..226faa7 100644 --- a/src/org/mxchange/jusercore/model/user/activity/LogableUserActivity.java +++ b/src/org/mxchange/jusercore/model/user/activity/LogableUserActivity.java @@ -56,6 +56,20 @@ public interface LogableUserActivity extends Serializable { */ void setActivityMessage (final String activityMessage); + /** + * Getter for principal name + *

+ * @return Principal name + */ + String getActivityPrincipalName (); + + /** + * Setter for principal name + *

+ * @param activityPrincipalName Principal name + */ + void setActivityPrincipalName (final String activityPrincipalName); + /** * Getter for activity timestamp *

diff --git a/src/org/mxchange/jusercore/model/user/activity/UserActivityLog.java b/src/org/mxchange/jusercore/model/user/activity/UserActivityLog.java index a0a0e3f..f96e689 100644 --- a/src/org/mxchange/jusercore/model/user/activity/UserActivityLog.java +++ b/src/org/mxchange/jusercore/model/user/activity/UserActivityLog.java @@ -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 + *

+ * @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());