CCM NG: All entity class of ccm-core pass tests for equals, hashCode and toString mehthods

git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@3455 8810af33-2d31-482b-a856-94f89814c4df
pull/2/head
jensp 2015-06-03 20:19:37 +00:00
parent ce7f0a7e7b
commit a79c67974d
48 changed files with 788 additions and 235 deletions

View File

@ -158,7 +158,7 @@ public class Categorization implements Serializable {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) { if (!(obj instanceof Categorization)) {
return false; return false;
} }
final Categorization other = (Categorization) obj; final Categorization other = (Categorization) obj;

View File

@ -308,7 +308,7 @@ public class Category extends CcmObject implements Serializable {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) { if (!(obj instanceof Category)) {
return false; return false;
} }
final Category other = (Category) obj; final Category other = (Category) obj;
@ -360,11 +360,11 @@ public class Category extends CcmObject implements Serializable {
+ "categoryOrder = %d%s", + "categoryOrder = %d%s",
uniqueId, uniqueId,
name, name,
title.toString(), Objects.toString(title),
enabled, enabled,
visible, visible,
abstractCategory, abstractCategory,
parentCategory, Objects.toString(parentCategory),
categoryOrder, categoryOrder,
data)); data));
} }

View File

@ -100,10 +100,10 @@ public class Domain extends CcmObject implements Serializable {
*/ */
@Embedded @Embedded
@AssociationOverride( @AssociationOverride(
name = "values", name = "values",
joinTable = @JoinTable(name = "domain_titles", joinTable = @JoinTable(name = "domain_titles",
joinColumns = { joinColumns = {
@JoinColumn(name = "object_id")})) @JoinColumn(name = "object_id")}))
private LocalizedString title; private LocalizedString title;
/** /**
@ -111,10 +111,10 @@ public class Domain extends CcmObject implements Serializable {
*/ */
@Embedded @Embedded
@AssociationOverride( @AssociationOverride(
name = "values", name = "values",
joinTable = @JoinTable(name = "domain_descriptions", joinTable = @JoinTable(name = "domain_descriptions",
joinColumns = { joinColumns = {
@JoinColumn(name = "object_id")})) @JoinColumn(name = "object_id")}))
private LocalizedString description; private LocalizedString description;
/** /**
@ -192,11 +192,19 @@ public class Domain extends CcmObject implements Serializable {
} }
public Date getReleased() { public Date getReleased() {
return new Date(released.getTime()); if (released == null) {
return null;
} else {
return new Date(released.getTime());
}
} }
public void setReleased(final Date released) { public void setReleased(final Date released) {
this.released = new Date(released.getTime()); if (released == null) {
this.released = null;
} else {
this.released = new Date(released.getTime());
}
} }
public Category getRoot() { public Category getRoot() {
@ -213,6 +221,7 @@ public class Domain extends CcmObject implements Serializable {
* {@link DomainManager}. * {@link DomainManager}.
* *
* @return An <strong>unmodifiable</strong> list of the owners of this { * @return An <strong>unmodifiable</strong> list of the owners of this {
*
* @Domain} * @Domain}
* *
* @see #owners * @see #owners
@ -254,7 +263,7 @@ public class Domain extends CcmObject implements Serializable {
@Override @Override
public int hashCode() { public int hashCode() {
int hash = 3; int hash = super.hashCode();
hash = 41 * hash + Objects.hashCode(domainKey); hash = 41 * hash + Objects.hashCode(domainKey);
hash = 41 * hash + Objects.hashCode(uri); hash = 41 * hash + Objects.hashCode(uri);
hash = 41 * hash + Objects.hashCode(title); hash = 41 * hash + Objects.hashCode(title);
@ -271,10 +280,14 @@ public class Domain extends CcmObject implements Serializable {
"PMD.StdCyclomaticComplexity", "PMD.StdCyclomaticComplexity",
"PMD.ModifiedCyclomaticComplexity"}) "PMD.ModifiedCyclomaticComplexity"})
public boolean equals(final Object obj) { public boolean equals(final Object obj) {
if (!super.equals(obj)) {
return false;
}
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) { if (!(obj instanceof Domain)) {
return false; return false;
} }
final Domain other = (Domain) obj; final Domain other = (Domain) obj;
@ -311,19 +324,19 @@ public class Domain extends CcmObject implements Serializable {
@Override @Override
public String toString(final String data) { public String toString(final String data) {
return String.format( return String.format(
", domainKey = \"%s\", " ", domainKey = \"%s\", "
+ "uri = \"%s\", " + "uri = \"%s\", "
+ "title = \"%s\", " + "title = \"%s\", "
+ "version = \"%s\", " + "version = \"%s\", "
+ "released = %tF %<tT, " + "released = %tF %<tT, "
+ "root = \"%s\"%s", + "root = \"%s\"%s",
domainKey, domainKey,
uri.toString(), Objects.toString(uri),
title.toString(), Objects.toString(title),
version, version,
released, released,
root.toString(), Objects.toString(root),
data data
); );
} }

View File

@ -152,7 +152,7 @@ public class DomainOwnership implements Serializable {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) { if (!(obj instanceof DomainOwnership)) {
return false; return false;
} }
final DomainOwnership other = (DomainOwnership) obj; final DomainOwnership other = (DomainOwnership) obj;
@ -199,8 +199,8 @@ public class DomainOwnership implements Serializable {
+ "%s }", + "%s }",
super.toString(), super.toString(),
ownershipId, ownershipId,
owner.toString(), Objects.toString(owner),
domain.toString(), Objects.toString(domain),
context, context,
domainOrder, domainOrder,
ownerOrder, ownerOrder,

View File

@ -163,7 +163,7 @@ public class Resource extends CcmObject implements Serializable {
// } // }
@Override @Override
public int hashCode() { public int hashCode() {
int hash = 5; int hash = super.hashCode();
hash = 29 * hash + Objects.hashCode(title); hash = 29 * hash + Objects.hashCode(title);
hash = 29 * hash + Objects.hashCode(description); hash = 29 * hash + Objects.hashCode(description);
hash = 29 * hash + Objects.hashCode(created); hash = 29 * hash + Objects.hashCode(created);
@ -176,11 +176,15 @@ public class Resource extends CcmObject implements Serializable {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof Resource)) { if (!(obj instanceof Resource)) {
return false; return false;
} }
final Resource other = (Resource) obj; final Resource other = (Resource) obj;
if (!other.canEqual(this)) { if (!other.canEqual(this)) {
return false; return false;
} }

View File

@ -116,7 +116,11 @@ public class Component extends CcmObject implements Serializable {
} }
public List<Component> getChildComponents() { public List<Component> getChildComponents() {
return Collections.unmodifiableList(childComponents); if (childComponents == null) {
return null;
} else {
return Collections.unmodifiableList(childComponents);
}
} }
protected void setChildComponents(final List<Component> childComponents) { protected void setChildComponents(final List<Component> childComponents) {
@ -158,7 +162,12 @@ public class Component extends CcmObject implements Serializable {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) {
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof Component)) {
return false; return false;
} }
final Component other = (Component) obj; final Component other = (Component) obj;

View File

@ -70,7 +70,12 @@ public class DataDrivenSelect extends Widget implements Serializable {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) {
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof DataDrivenSelect)) {
return false; return false;
} }
final DataDrivenSelect other = (DataDrivenSelect) obj; final DataDrivenSelect other = (DataDrivenSelect) obj;

View File

@ -18,8 +18,6 @@
*/ */
package org.libreccm.formbuilder; package org.libreccm.formbuilder;
import org.hibernate.annotations.CollectionId;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
@ -89,7 +87,12 @@ public class FormSection extends Component implements Serializable {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) {
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof FormSection)) {
return false; return false;
} }
final FormSection other = (FormSection) obj; final FormSection other = (FormSection) obj;

View File

@ -85,11 +85,16 @@ public class Listener extends CcmObject implements Serializable {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) {
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof Listener)) {
return false; return false;
} }
final Listener other = (Listener) obj; final Listener other = (Listener) obj;
if (other.canEqual(this)) { if (!other.canEqual(this)) {
return false; return false;
} }
@ -99,14 +104,11 @@ public class Listener extends CcmObject implements Serializable {
if (!Objects.equals(attributeString, other.getAttributeString())) { if (!Objects.equals(attributeString, other.getAttributeString())) {
return false; return false;
} }
if (!Objects.equals(widget, other.getWidget())) { return Objects.equals(widget, other.getWidget());
return false;
}
return true;
} }
@Override @Override
public boolean canEqual(Object obj) { public boolean canEqual(final Object obj) {
return obj instanceof Listener; return obj instanceof Listener;
} }

View File

@ -96,7 +96,12 @@ public class MetaObject extends CcmObject implements Serializable {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) {
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof MetaObject)) {
return false; return false;
} }
final MetaObject other = (MetaObject) obj; final MetaObject other = (MetaObject) obj;

View File

@ -61,7 +61,7 @@ public class ObjectType extends CcmObject implements Serializable {
@Override @Override
public int hashCode() { public int hashCode() {
int hash = 7; int hash = super.hashCode();
hash = 61 * hash + Objects.hashCode(appName); hash = 61 * hash + Objects.hashCode(appName);
hash = 61 * hash + Objects.hashCode(className); hash = 61 * hash + Objects.hashCode(className);
return hash; return hash;
@ -72,7 +72,12 @@ public class ObjectType extends CcmObject implements Serializable {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) {
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof ObjectType)) {
return false; return false;
} }
final ObjectType other = (ObjectType) obj; final ObjectType other = (ObjectType) obj;

View File

@ -80,7 +80,12 @@ public class Option extends Component implements Serializable {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) {
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof Option)) {
return false; return false;
} }
final Option other = (Option) obj; final Option other = (Option) obj;

View File

@ -100,7 +100,12 @@ public class PersistentDataQuery extends CcmObject implements Serializable {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) {
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof PersistentDataQuery)) {
return false; return false;
} }
final PersistentDataQuery other = (PersistentDataQuery) obj; final PersistentDataQuery other = (PersistentDataQuery) obj;

View File

@ -126,7 +126,12 @@ public class ProcessListener extends CcmObject implements Serializable {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) {
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof ProcessListener)) {
return false; return false;
} }
final ProcessListener other = (ProcessListener) obj; final ProcessListener other = (ProcessListener) obj;

View File

@ -18,7 +18,6 @@
*/ */
package org.libreccm.formbuilder; package org.libreccm.formbuilder;
import java.io.Serializable; import java.io.Serializable;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@ -51,7 +50,7 @@ public class Widget extends Component implements Serializable {
@OneToOne @OneToOne
private WidgetLabel label; private WidgetLabel label;
@OneToMany(mappedBy = "widget") @OneToMany(mappedBy = "widget")
private List<Listener> listeners; private List<Listener> listeners;
@ -88,7 +87,11 @@ public class Widget extends Component implements Serializable {
} }
public List<Listener> getListeners() { public List<Listener> getListeners() {
return Collections.unmodifiableList(listeners); if (listeners == null) {
return null;
} else {
return Collections.unmodifiableList(listeners);
}
} }
protected void setListeners(final List<Listener> listeners) { protected void setListeners(final List<Listener> listeners) {
@ -98,12 +101,11 @@ public class Widget extends Component implements Serializable {
protected void addListener(final Listener listener) { protected void addListener(final Listener listener) {
listeners.add(listener); listeners.add(listener);
} }
protected void removeListener(final Listener listener) { protected void removeListener(final Listener listener) {
listeners.remove(listener); listeners.remove(listener);
} }
@Override @Override
public int hashCode() { public int hashCode() {
int hash = super.hashCode(); int hash = super.hashCode();
@ -120,7 +122,12 @@ public class Widget extends Component implements Serializable {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) {
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof Widget)) {
return false; return false;
} }
final Widget other = (Widget) obj; final Widget other = (Widget) obj;
@ -140,9 +147,14 @@ public class Widget extends Component implements Serializable {
if (!Objects.equals(label, other.getLabel())) { if (!Objects.equals(label, other.getLabel())) {
return false; return false;
} }
return Objects.equals(listeners, other.getListeners()); return Objects.equals(listeners, other.getListeners());
} }
@Override
public boolean canEqual(final Object obj) {
return obj instanceof Widget;
}
@Override @Override
public String toString(final String data) { public String toString(final String data) {

View File

@ -59,7 +59,12 @@ public class WidgetLabel extends Component implements Serializable {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) {
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof WidgetLabel)) {
return false; return false;
} }
final WidgetLabel other = (WidgetLabel) obj; final WidgetLabel other = (WidgetLabel) obj;

View File

@ -20,8 +20,8 @@ import org.libreccm.formbuilder.ProcessListener;
@Entity @Entity
@Table(name = "formbuilder_confirm_email_listener") @Table(name = "formbuilder_confirm_email_listener")
public class ConfirmEmailListener public class ConfirmEmailListener
extends ProcessListener extends ProcessListener
implements Serializable { implements Serializable {
private static final long serialVersionUID = -7009695795355273248L; private static final long serialVersionUID = -7009695795355273248L;
@ -73,7 +73,12 @@ public class ConfirmEmailListener
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) {
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof ConfirmEmailListener)) {
return false; return false;
} }
final ConfirmEmailListener other = (ConfirmEmailListener) obj; final ConfirmEmailListener other = (ConfirmEmailListener) obj;
@ -98,7 +103,7 @@ public class ConfirmEmailListener
@Override @Override
public String toString(final String data) { public String toString(final String data) {
return super.toString(String.format(", fromEmail = \"%s\"," return super.toString(String.format(", fromEmail = \"%s\","
+ "subject = \"%s\"%s", + "subject = \"%s\"%s",
fromEmail, fromEmail,
subject, subject,
data)); data));

View File

@ -19,11 +19,11 @@ import org.libreccm.formbuilder.ProcessListener;
@Entity @Entity
@Table(name = "formbuilder_confirm_redirect_listeners") @Table(name = "formbuilder_confirm_redirect_listeners")
public class ConfirmRedirectListener public class ConfirmRedirectListener
extends ProcessListener extends ProcessListener
implements Serializable { implements Serializable {
private static final long serialVersionUID = 7891034630202555922L; private static final long serialVersionUID = 7891034630202555922L;
@Column(name = "url") @Column(name = "url")
private String url; private String url;
@ -47,22 +47,27 @@ public class ConfirmRedirectListener
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) {
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof ConfirmRedirectListener)) {
return false; return false;
} }
final ConfirmRedirectListener other = (ConfirmRedirectListener) obj; final ConfirmRedirectListener other = (ConfirmRedirectListener) obj;
if (!other.canEqual(this)) { if (!other.canEqual(this)) {
return false; return false;
} }
return Objects.equals(this.url, other.url); return Objects.equals(this.url, other.url);
} }
@Override @Override
public boolean canEqual(final Object obj) { public boolean canEqual(final Object obj) {
return obj instanceof ConfirmRedirectListener; return obj instanceof ConfirmRedirectListener;
} }
@Override @Override
public String toString(final String data) { public String toString(final String data) {
return super.toString(String.format(", url = \"%s\"%s", return super.toString(String.format(", url = \"%s\"%s",

View File

@ -45,7 +45,12 @@ public class RemoteServerPostListener
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) {
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof RemoteServerPostListener)) {
return false; return false;
} }
final RemoteServerPostListener other = (RemoteServerPostListener) obj; final RemoteServerPostListener other = (RemoteServerPostListener) obj;
@ -53,7 +58,12 @@ public class RemoteServerPostListener
return false; return false;
} }
return Objects.equals(this.remoteUrl, other.remoteUrl); return Objects.equals(this.remoteUrl, other.getRemoteUrl());
}
@Override
public boolean canEqual(final Object obj) {
return obj instanceof RemoteServerPostListener;
} }
@Override @Override

View File

@ -62,7 +62,12 @@ public class SimpleEmailListener
if (!super.equals(obj)) { if (!super.equals(obj)) {
return false; return false;
} }
if (getClass() != obj.getClass()) {
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof SimpleEmailListener)) {
return false; return false;
} }
final SimpleEmailListener other = (SimpleEmailListener) obj; final SimpleEmailListener other = (SimpleEmailListener) obj;

View File

@ -20,8 +20,8 @@ import org.libreccm.formbuilder.ProcessListener;
@Entity @Entity
@Table(name = "formbuilder_template_email_listeners") @Table(name = "formbuilder_template_email_listeners")
public class TemplateEmailListener public class TemplateEmailListener
extends ProcessListener extends ProcessListener
implements Serializable { implements Serializable {
private static final long serialVersionUID = -4476860960485494976L; private static final long serialVersionUID = -4476860960485494976L;
@ -62,9 +62,9 @@ public class TemplateEmailListener
@Override @Override
public int hashCode() { public int hashCode() {
int hash = super.hashCode(); int hash = super.hashCode();
hash = 67 * hash + Objects.hashCode(this.recipient); hash = 67 * hash + Objects.hashCode(recipient);
hash = 67 * hash + Objects.hashCode(this.subject); hash = 67 * hash + Objects.hashCode(subject);
hash = 67 * hash + Objects.hashCode(this.body); hash = 67 * hash + Objects.hashCode(body);
return hash; return hash;
} }
@ -73,7 +73,12 @@ public class TemplateEmailListener
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) {
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof TemplateEmailListener)) {
return false; return false;
} }
final TemplateEmailListener other = (TemplateEmailListener) obj; final TemplateEmailListener other = (TemplateEmailListener) obj;
@ -81,13 +86,13 @@ public class TemplateEmailListener
return false; return false;
} }
if (!Objects.equals(this.recipient, other.recipient)) { if (!Objects.equals(recipient, other.getRecipient())) {
return false; return false;
} }
if (!Objects.equals(this.subject, other.subject)) { if (!Objects.equals(subject, other.getSubject())) {
return false; return false;
} }
return Objects.equals(this.body, other.body); return Objects.equals(body, other.getBody());
} }
@Override @Override
@ -98,7 +103,7 @@ public class TemplateEmailListener
@Override @Override
public String toString(final String data) { public String toString(final String data) {
return super.toString(String.format(", recipient = \"%s\", " return super.toString(String.format(", recipient = \"%s\", "
+ "subject = \"%s\"%s", + "subject = \"%s\"%s",
recipient, recipient,
subject, subject,
data)); data));

View File

@ -24,7 +24,7 @@ public class XmlEmailListener extends ProcessListener implements Serializable {
@Column(name = "recipient") @Column(name = "recipient")
private String recipient; private String recipient;
@Column(name = "subject") @Column(name = "subject")
private String subject; private String subject;
@ -57,7 +57,12 @@ public class XmlEmailListener extends ProcessListener implements Serializable {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) {
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof XmlEmailListener)) {
return false; return false;
} }
final XmlEmailListener other = (XmlEmailListener) obj; final XmlEmailListener other = (XmlEmailListener) obj;
@ -79,7 +84,7 @@ public class XmlEmailListener extends ProcessListener implements Serializable {
@Override @Override
public String toString(final String data) { public String toString(final String data) {
return super.toString(String.format(", recipient = \"%s\", " return super.toString(String.format(", recipient = \"%s\", "
+ "subject = \"%s\"%s", + "subject = \"%s\"%s",
recipient, recipient,
subject, subject,
data)); data));

View File

@ -23,6 +23,7 @@ import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.Locale; import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.Objects;
import java.util.Set; import java.util.Set;
import javax.persistence.Column; import javax.persistence.Column;
@ -158,6 +159,34 @@ public class LocalizedString implements Serializable {
return values.keySet(); return values.keySet();
} }
@Override
public int hashCode() {
int hash = 7;
hash = 41 * hash + Objects.hashCode(this.values);
return hash;
}
@Override
public boolean equals(final Object obj) {
if (obj == null) {
return false;
}
if (!(obj instanceof LocalizedString)) {
return false;
}
final LocalizedString other = (LocalizedString) obj;
if (!other.canEqual(this)) {
return false;
}
return Objects.equals(values, other.getValues());
}
public boolean canEqual(final Object obj) {
return obj instanceof LocalizedString;
}
@Override @Override
public String toString() { public String toString() {
return String.format( return String.format(
@ -165,7 +194,7 @@ public class LocalizedString implements Serializable {
+ "%s" + "%s"
+ " }", + " }",
super.toString(), super.toString(),
values.toString()); Objects.toString(values));
} }
} }

View File

@ -110,11 +110,19 @@ public class Attachment implements Serializable {
} }
public byte[] getData() { public byte[] getData() {
return Arrays.copyOf(data, data.length); if (data == null) {
return null;
} else {
return Arrays.copyOf(data, data.length);
}
} }
public void setData(byte[] data) { public void setData(byte[] data) {
this.data = Arrays.copyOf(data, data.length); if (data == null) {
this.data = null;
} else {
this.data = Arrays.copyOf(data, data.length);
}
} }
@Override @Override
@ -135,7 +143,7 @@ public class Attachment implements Serializable {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) { if (!(obj instanceof Attachment)) {
return false; return false;
} }
final Attachment other = (Attachment) obj; final Attachment other = (Attachment) obj;

View File

@ -111,11 +111,19 @@ public class Message extends CcmObject implements Serializable {
} }
public Date getSent() { public Date getSent() {
return new Date(sent.getTime()); if (sent == null) {
return null;
} else {
return new Date(sent.getTime());
}
} }
public void setSent(final Date sent) { public void setSent(final Date sent) {
this.sent = new Date(sent.getTime()); if (sent == null) {
this.sent = null;
} else {
this.sent = new Date(sent.getTime());
}
} }
public Message getInReplyTo() { public Message getInReplyTo() {
@ -127,7 +135,11 @@ public class Message extends CcmObject implements Serializable {
} }
public List<Message> getReplies() { public List<Message> getReplies() {
return Collections.unmodifiableList(replies); if (replies == null) {
return null;
} else {
return Collections.unmodifiableList(replies);
}
} }
protected void setReplies(final List<Message> replies) { protected void setReplies(final List<Message> replies) {
@ -143,7 +155,11 @@ public class Message extends CcmObject implements Serializable {
} }
public List<Attachment> getAttachments() { public List<Attachment> getAttachments() {
return Collections.unmodifiableList(attachments); if (attachments == null) {
return null;
} else {
return Collections.unmodifiableList(attachments);
}
} }
protected void setAttachments(final List<Attachment> attachments) { protected void setAttachments(final List<Attachment> attachments) {
@ -177,11 +193,16 @@ public class Message extends CcmObject implements Serializable {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) {
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof Message)) {
return false; return false;
} }
final Message other = (Message) obj; final Message other = (Message) obj;
if (!other.canEqual(obj)) { if (!other.canEqual(this)) {
return false; return false;
} }

View File

@ -62,7 +62,12 @@ public class MessageThread extends CcmObject implements Serializable {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) {
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof MessageThread)) {
return false; return false;
} }
final MessageThread other = (MessageThread) obj; final MessageThread other = (MessageThread) obj;
@ -70,7 +75,7 @@ public class MessageThread extends CcmObject implements Serializable {
return false; return false;
} }
return Objects.equals(this.root, other.getRoot()); return Objects.equals(root, other.getRoot());
} }
@Override @Override

View File

@ -28,20 +28,19 @@ import java.util.Objects;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.JoinColumn; import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne; import javax.persistence.OneToOne;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Temporal; import javax.persistence.Temporal;
import javax.persistence.TemporalType; import javax.persistence.TemporalType;
/** /**
* *
* Models the envelope information associated with a digest. * Models the envelope information associated with a digest.
* *
* When a digest is processed, all notifications associated with it are grouped * When a digest is processed, all notifications associated with it are grouped
* for delivery as a single unit to each receiver. The outbound email generated * for delivery as a single unit to each receiver. The outbound email generated
* for the receivers has a common subject, header, separator between the * for the receivers has a common subject, header, separator between the
* individual messages, and signature (from the documentation of the * individual messages, and signature (from the documentation of the
* {@code com.arsdigita.notification.Digest} class). * {@code com.arsdigita.notification.Digest} class).
* *
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a> * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
@ -124,11 +123,19 @@ public class Digest extends CcmObject implements Serializable {
} }
public Date getNextRun() { public Date getNextRun() {
return new Date(nextRun.getTime()); if (nextRun == null) {
return null;
} else {
return new Date(nextRun.getTime());
}
} }
public void setNextRun(final Date nextRun) { public void setNextRun(final Date nextRun) {
this.nextRun = new Date(nextRun.getTime()); if (nextRun == null) {
this.nextRun = null;
} else {
this.nextRun = new Date(nextRun.getTime());
}
} }
@Override @Override
@ -149,11 +156,12 @@ public class Digest extends CcmObject implements Serializable {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) {
if (!super.equals(obj)) {
return false; return false;
} }
if (!super.equals(obj)) { if (!(obj instanceof Digest)) {
return false; return false;
} }

View File

@ -36,38 +36,34 @@ import javax.persistence.TemporalType;
/** /**
* *
*The {@code Notification} class is used to create and send * The {@code Notification} class is used to create and send messages via email
* messages via email to ACS users and groups. It acts as a wrapper * to ACS users and groups. It acts as a wrapper for a {@link Message} which
* for a {@link Message} which contains the subject, sender, body and * contains the subject, sender, body and any attachments for the email. The
* any attachments for the email. The recipient can be a {@link * recipient can be a {@link
* com.arsdigita.kernel.User} or a {@link org.libreccm.core.Group}. * com.arsdigita.kernel.User} or a {@link org.libreccm.core.Group}. In the case
* In the case of Group, the message can be sent to the group's email * of Group, the message can be sent to the group's email address or expanded
* address or expanded into a separate message for each member of the * into a separate message for each member of the group.
* group.
* *
* <h4>Email Alerts</h4> * <h4>Email Alerts</h4>
* *
* When using notifications for email alerts, applications often * When using notifications for email alerts, applications often need to wrap a
* need to wrap a special header and signature around the contained * special header and signature around the contained Message object. This can be
* Message object. This can be useful for including introductory * useful for including introductory remarks and action links in the email body.
* remarks and action links in the email body. The * The {@code setHeader} and {@code setSignature} methods allow you to do this
* {@code setHeader} and {@code setSignature} methods allow * without the need to create a separate Message for the modified email.
* you to do this without the need to create a separate Message for *
* the modified email.
* *
* <h4>Digests</h4> * <h4>Digests</h4>
* *
* Finally, notifications can be sent in "instant processing mode" * Finally, notifications can be sent in "instant processing mode" or as part of
* or as part of a {@link Digest}. When sent as part of a digest all * a {@link Digest}. When sent as part of a digest all notifications to the same
* notifications to the same recipient are collected into a single * recipient are collected into a single email and sent at regular internal. For
* email and sent at regular internal. For example, an hourly digest * example, an hourly digest might send a user all of their workflow task
* might send a user all of their workflow task updates that have * updates that have changed in the past hour, rather a much larger number of
* changed in the past hour, rather a much larger number of individual * individual messages every time an tasks changed.
* messages every time an tasks changed. *
* * (Documentation taken from the {@code com.arsdigita.notification.Notification}
* (Documentation taken from the {@code com.arsdigita.notification.Notification}
* class) * class)
* *
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a> * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/ */
@Entity @Entity
@ -166,19 +162,35 @@ public class Notification extends CcmObject implements Serializable {
} }
public Date getRequestDate() { public Date getRequestDate() {
return new Date(requestDate.getTime()); if (requestDate == null) {
return null;
} else {
return new Date(requestDate.getTime());
}
} }
public void setRequestDate(final Date requestDate) { public void setRequestDate(final Date requestDate) {
this.requestDate = new Date(requestDate.getTime()); if (requestDate == null) {
this.requestDate = null;
} else {
this.requestDate = new Date(requestDate.getTime());
}
} }
public Date getFulfillDate() { public Date getFulfillDate() {
return new Date(fulfillDate.getTime()); if (fulfillDate == null) {
return null;
} else {
return new Date(fulfillDate.getTime());
}
} }
public void setFulfillDate(final Date fulfillDate) { public void setFulfillDate(final Date fulfillDate) {
this.fulfillDate = new Date(fulfillDate.getTime()); if (fulfillDate == null) {
this.fulfillDate = null;
} else {
this.fulfillDate = new Date(fulfillDate.getTime());
}
} }
public String getStatus() { public String getStatus() {
@ -236,7 +248,7 @@ public class Notification extends CcmObject implements Serializable {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) { if (!(obj instanceof Notification)) {
return false; return false;
} }

View File

@ -160,10 +160,14 @@ public class QueueItem implements Serializable {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) { if (!(obj instanceof QueueItem)) {
return false; return false;
} }
final QueueItem other = (QueueItem) obj; final QueueItem other = (QueueItem) obj;
if (!other.canEqual(this)) {
return false;
}
if (this.queueItemId != other.getQueueItemId()) { if (this.queueItemId != other.getQueueItemId()) {
return false; return false;
} }

View File

@ -62,7 +62,11 @@ public class Portal extends Resource implements Serializable {
} }
public List<Portlet> getPortlets() { public List<Portlet> getPortlets() {
return Collections.unmodifiableList(portlets); if (portlets == null) {
return null;
} else {
return Collections.unmodifiableList(portlets);
}
} }
protected void setPortlets(final List<Portlet> portlets) { protected void setPortlets(final List<Portlet> portlets) {
@ -90,11 +94,12 @@ public class Portal extends Resource implements Serializable {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) {
if (!super.equals(obj)) {
return false; return false;
} }
if (!super.equals(obj)) { if (!(obj instanceof Portal)) {
return false; return false;
} }
@ -108,7 +113,7 @@ public class Portal extends Resource implements Serializable {
} }
return Objects.equals(portlets, other.getPortlets()); return Objects.equals(portlets, other.getPortlets());
} }
@Override @Override
public boolean canEqual(final Object obj) { public boolean canEqual(final Object obj) {
return obj instanceof Portal; return obj instanceof Portal;

View File

@ -88,16 +88,17 @@ public class Portlet extends Resource implements Serializable {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) {
if (!super.equals(obj)) {
return false; return false;
} }
if (!super.equals(obj)) { if (!(obj instanceof Portlet)) {
return false; return false;
} }
final Portlet other = (Portlet) obj; final Portlet other = (Portlet) obj;
if (!other.canEqual(obj)) { if (!other.canEqual(this)) {
return false; return false;
} }

View File

@ -90,7 +90,11 @@ public class Initalizer implements Serializable {
} }
public List<Initalizer> getRequiredInitializers() { public List<Initalizer> getRequiredInitializers() {
return Collections.unmodifiableList(requiredInitializers); if (requiredInitializers == null) {
return null;
} else {
return Collections.unmodifiableList(requiredInitializers);
}
} }
protected void setRequiredInitializers( protected void setRequiredInitializers(
@ -122,7 +126,7 @@ public class Initalizer implements Serializable {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) { if (!(obj instanceof Initalizer)) {
return false; return false;
} }
final Initalizer other = (Initalizer) obj; final Initalizer other = (Initalizer) obj;

View File

@ -59,13 +59,13 @@ public class Document implements Serializable {
@Column(name = "document_timestamp") @Column(name = "document_timestamp")
@Temporal(TemporalType.TIMESTAMP) @Temporal(TemporalType.TIMESTAMP)
private Date documentTimeStamp; private Date timeStamp;
@Column(name = "dirty") @Column(name = "dirty")
private long dirty; private long dirty;
@Column(name = "document_language", length = 8) @Column(name = "document_language", length = 8)
private String documentLanguage; private String language;
@Column(name = "country", length = 8) @Column(name = "country", length = 8)
private String country; private String country;
@ -127,12 +127,20 @@ public class Document implements Serializable {
this.typeSpecificInfo = typeSpecificInfo; this.typeSpecificInfo = typeSpecificInfo;
} }
public Date getDocumentTimeStamp() { public Date getTimeStamp() {
return new Date(documentTimeStamp.getTime()); if (timeStamp == null) {
return null;
} else {
return new Date(timeStamp.getTime());
}
} }
public void setDocumentTimeStamp(final Date documentTimeStamp) { public void setTimeStamp(final Date timeStamp) {
this.documentTimeStamp = new Date(documentTimeStamp.getTime()); if (timeStamp == null) {
this.timeStamp = null;
} else {
this.timeStamp = new Date(timeStamp.getTime());
}
} }
public long getDirty() { public long getDirty() {
@ -143,12 +151,12 @@ public class Document implements Serializable {
this.dirty = dirty; this.dirty = dirty;
} }
public String getDocumentLanguage() { public String getLanguage() {
return documentLanguage; return language;
} }
public void setDocumentLanguage(final String documentLanguage) { public void setLanguage(final String language) {
this.documentLanguage = documentLanguage; this.language = language;
} }
public String getCountry() { public String getCountry() {
@ -184,11 +192,19 @@ public class Document implements Serializable {
} }
public Date getCreated() { public Date getCreated() {
return new Date(created.getTime()); if (created == null) {
return null;
} else {
return new Date(created.getTime());
}
} }
public void setCreated(final Date created) { public void setCreated(final Date created) {
this.created = new Date(created.getTime()); if (created == null) {
this.created = null;
} else {
this.created = new Date(created.getTime());
}
} }
public Party getCreatedBy() { public Party getCreatedBy() {
@ -200,11 +216,19 @@ public class Document implements Serializable {
} }
public Date getLastModified() { public Date getLastModified() {
return new Date(lastModified.getTime()); if (lastModified == null) {
return null;
} else {
return new Date(lastModified.getTime());
}
} }
public void setLastModified(final Date lastModified) { public void setLastModified(final Date lastModified) {
this.lastModified = new Date(lastModified.getTime()); if (lastModified == null) {
this.lastModified = null;
} else {
this.lastModified = new Date(lastModified.getTime());
}
} }
public Party getLastModifiedBy() { public Party getLastModifiedBy() {
@ -229,9 +253,9 @@ public class Document implements Serializable {
hash = 53 * hash + (int) (documentId ^ (documentId >>> 32)); hash = 53 * hash + (int) (documentId ^ (documentId >>> 32));
hash = 53 * hash + Objects.hashCode(type); hash = 53 * hash + Objects.hashCode(type);
hash = 53 * hash + Objects.hashCode(typeSpecificInfo); hash = 53 * hash + Objects.hashCode(typeSpecificInfo);
hash = 53 * hash + Objects.hashCode(documentTimeStamp); hash = 53 * hash + Objects.hashCode(timeStamp);
hash = 53 * hash + (int) (dirty ^ (dirty >>> 32)); hash = 53 * hash + (int) (dirty ^ (dirty >>> 32));
hash = 53 * hash + Objects.hashCode(documentLanguage); hash = 53 * hash + Objects.hashCode(language);
hash = 53 * hash + Objects.hashCode(country); hash = 53 * hash + Objects.hashCode(country);
hash = 53 * hash + Objects.hashCode(title); hash = 53 * hash + Objects.hashCode(title);
hash = 53 * hash + Objects.hashCode(summary); hash = 53 * hash + Objects.hashCode(summary);
@ -249,10 +273,14 @@ public class Document implements Serializable {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) { if (!(obj instanceof Document)) {
return false; return false;
} }
final Document other = (Document) obj; final Document other = (Document) obj;
if (!other.canEqual(this)) {
return false;
}
if (documentId != other.getDocumentId()) { if (documentId != other.getDocumentId()) {
return false; return false;
} }
@ -262,13 +290,13 @@ public class Document implements Serializable {
if (!Objects.equals(typeSpecificInfo, other.getTypeSpecificInfo())) { if (!Objects.equals(typeSpecificInfo, other.getTypeSpecificInfo())) {
return false; return false;
} }
if (!Objects.equals(documentTimeStamp, other.getDocumentTimeStamp())) { if (!Objects.equals(timeStamp, other.getTimeStamp())) {
return false; return false;
} }
if (dirty != other.getDirty()) { if (dirty != other.getDirty()) {
return false; return false;
} }
if (!Objects.equals(documentLanguage, other.getDocumentLanguage())) { if (!Objects.equals(language, other.getLanguage())) {
return false; return false;
} }
if (!Objects.equals(country, other.getCountry())) { if (!Objects.equals(country, other.getCountry())) {
@ -298,6 +326,10 @@ public class Document implements Serializable {
return Objects.equals(contentSection, other.getContentSection()); return Objects.equals(contentSection, other.getContentSection());
} }
public boolean canEqual(final Object obj) {
return obj instanceof Document;
}
@Override @Override
public String toString() { public String toString() {
return String.format("%s{ " return String.format("%s{ "
@ -317,9 +349,9 @@ public class Document implements Serializable {
super.toString(), super.toString(),
documentId, documentId,
type, type,
documentTimeStamp, timeStamp,
dirty, dirty,
documentLanguage, language,
country, country,
title, title,
created, created,

View File

@ -97,10 +97,14 @@ public class Index implements Serializable {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) { if (!(obj instanceof Index)) {
return false; return false;
} }
final Index other = (Index) obj; final Index other = (Index) obj;
if (!other.canEqual(this)) {
return false;
}
if (indexId != other.getIndexId()) { if (indexId != other.getIndexId()) {
return false; return false;
} }
@ -110,6 +114,10 @@ public class Index implements Serializable {
return luceneIndexId == other.getLuceneIndexId(); return luceneIndexId == other.getLuceneIndexId();
} }
public boolean canEqual(final Object obj) {
return obj instanceof Index;
}
@Override @Override
public String toString() { public String toString() {
return String.format("%s{ " return String.format("%s{ "

View File

@ -80,11 +80,12 @@ public class Application extends Resource implements Serializable {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) {
if (!super.equals(obj)) {
return false; return false;
} }
if (!super.equals(obj)) { if (!(obj instanceof Application)) {
return false; return false;
} }
@ -98,6 +99,11 @@ public class Application extends Resource implements Serializable {
} }
return Objects.equals(containerGroup, other.getContainerGroup()); return Objects.equals(containerGroup, other.getContainerGroup());
} }
@Override
public boolean canEqual(final Object obj) {
return obj instanceof Application;
}
@Override @Override
public String toString(final String data) { public String toString(final String data) {

View File

@ -90,10 +90,13 @@ public class Host implements Serializable {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) { if (!(obj instanceof Host)) {
return false; return false;
} }
final Host other = (Host) obj; final Host other = (Host) obj;
if (!other.canEqual(this)) {
return false;
}
if (this.hostId != other.getHostId()) { if (this.hostId != other.getHostId()) {
return false; return false;
} }
@ -103,6 +106,10 @@ public class Host implements Serializable {
return this.serverPort == other.getServerPort(); return this.serverPort == other.getServerPort();
} }
public boolean canEqual(final Object obj) {
return obj instanceof Host;
}
@Override @Override
public String toString() { public String toString() {
return String.format("%s{ " return String.format("%s{ "

View File

@ -163,7 +163,11 @@ public class Task implements Serializable {
} }
public List<Task> getDependentTasks() { public List<Task> getDependentTasks() {
return Collections.unmodifiableList(dependentTasks); if (dependentTasks == null) {
return null;
} else {
return Collections.unmodifiableList(dependentTasks);
}
} }
protected void setDependentTasks(final List<Task> dependentTasks) { protected void setDependentTasks(final List<Task> dependentTasks) {
@ -179,7 +183,11 @@ public class Task implements Serializable {
} }
public List<Task> getDependsOn() { public List<Task> getDependsOn() {
return Collections.unmodifiableList(dependsOn); if (dependsOn == null) {
return null;
} else {
return Collections.unmodifiableList(dependsOn);
}
} }
protected void setDependsOn(final List<Task> dependsOn) { protected void setDependsOn(final List<Task> dependsOn) {
@ -195,7 +203,11 @@ public class Task implements Serializable {
} }
public List<String> getComments() { public List<String> getComments() {
return Collections.unmodifiableList(comments); if (comments == null) {
return null;
} else {
return Collections.unmodifiableList(comments);
}
} }
protected void setComments(final List<String> comments) { protected void setComments(final List<String> comments) {
@ -230,14 +242,14 @@ public class Task implements Serializable {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) { if (!(obj instanceof Task)) {
return false; return false;
} }
final Task other = (Task) obj; final Task other = (Task) obj;
if (!other.canEqual(obj)) { if (!other.canEqual(this)) {
return false; return false;
} }
if (taskId != other.getTaskId()) { if (taskId != other.getTaskId()) {
return false; return false;
} }
@ -264,7 +276,7 @@ public class Task implements Serializable {
} }
return Objects.equals(comments, other.getComments()); return Objects.equals(comments, other.getComments());
} }
public boolean canEqual(final Object obj) { public boolean canEqual(final Object obj) {
return obj instanceof Task; return obj instanceof Task;
} }
@ -273,17 +285,17 @@ public class Task implements Serializable {
public final String toString() { public final String toString() {
return toString(""); return toString("");
} }
public String toString(final String data) { public String toString(final String data) {
return String.format("%s{ " return String.format("%s{ "
+ "taskId = %d, " + "taskId = %d, "
+ "label = %s, " + "label = %s, "
+ "active = %b, " + "active = %b, "
+ "taskState = \"%s\", " + "taskState = \"%s\", "
+ "workflow = %s, " + "workflow = %s, "
+ "dependentTasks = %s, " + "dependentTasks = %s, "
+ "dependsOn = %s%s" + "dependsOn = %s%s"
+ " }", + " }",
super.toString(), super.toString(),
taskId, taskId,
Objects.toString(label), Objects.toString(label),
@ -294,4 +306,5 @@ public class Task implements Serializable {
Objects.toString(dependsOn), Objects.toString(dependsOn),
data); data);
} }
} }

View File

@ -109,19 +109,35 @@ public class UserTask extends Task implements Serializable {
} }
public Date getStartDate() { public Date getStartDate() {
return new Date(startDate.getTime()); if (startDate == null) {
return null;
} else {
return new Date(startDate.getTime());
}
} }
public void setStartDate(final Date startDate) { public void setStartDate(final Date startDate) {
this.startDate = new Date(startDate.getTime()); if (startDate == null) {
this.startDate = null;
} else {
this.startDate = new Date(startDate.getTime());
}
} }
public Date getDueDate() { public Date getDueDate() {
return new Date(dueDate.getTime()); if (dueDate == null) {
return null;
} else {
return new Date(dueDate.getTime());
}
} }
public void setDueDate(final Date dueDate) { public void setDueDate(final Date dueDate) {
this.dueDate = new Date(dueDate.getTime()); if (dueDate == null) {
this.dueDate = null;
} else {
this.dueDate = new Date(dueDate.getTime());
}
} }
public long getDurationMinutes() { public long getDurationMinutes() {
@ -141,7 +157,11 @@ public class UserTask extends Task implements Serializable {
} }
public List<User> getAssignedUsers() { public List<User> getAssignedUsers() {
return Collections.unmodifiableList(assignedUsers); if (assignedUsers == null) {
return null;
} else {
return Collections.unmodifiableList(assignedUsers);
}
} }
protected void setAssignedUsers(final List<User> assignedUsers) { protected void setAssignedUsers(final List<User> assignedUsers) {
@ -157,7 +177,11 @@ public class UserTask extends Task implements Serializable {
} }
public List<UserGroup> getAssignedGroups() { public List<UserGroup> getAssignedGroups() {
return Collections.unmodifiableList(assignedGroups); if (assignedGroups == null) {
return null;
} else {
return Collections.unmodifiableList(assignedGroups);
}
} }
protected void setAssignedGroups(final List<UserGroup> assignedGroups) { protected void setAssignedGroups(final List<UserGroup> assignedGroups) {
@ -192,11 +216,16 @@ public class UserTask extends Task implements Serializable {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) {
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof UserTask)) {
return false; return false;
} }
final UserTask other = (UserTask) obj; final UserTask other = (UserTask) obj;
if (!other.canEqual(obj)) { if (!other.canEqual(this)) {
return false; return false;
} }
@ -224,6 +253,11 @@ public class UserTask extends Task implements Serializable {
return Objects.equals(assignedGroups, other.getAssignedGroups()); return Objects.equals(assignedGroups, other.getAssignedGroups());
} }
@Override
public boolean canEqual(final Object obj) {
return obj instanceof UserTask;
}
@Override @Override
public String toString(final String data) { public String toString(final String data) {
return super.toString(String.format(", locked = %b, " return super.toString(String.format(", locked = %b, "

View File

@ -104,9 +104,13 @@ public class Workflow implements Serializable {
public void setDescription(final LocalizedString description) { public void setDescription(final LocalizedString description) {
this.description = description; this.description = description;
} }
public List<Task> getTasks() { public List<Task> getTasks() {
return Collections.unmodifiableList(tasks); if (tasks == null) {
return null;
} else {
return Collections.unmodifiableList(tasks);
}
} }
protected void setTasks(final List<Task> tasks) { protected void setTasks(final List<Task> tasks) {
@ -135,11 +139,11 @@ public class Workflow implements Serializable {
if (obj == null) { if (obj == null) {
return false; return false;
} }
if (getClass() != obj.getClass()) { if (!(obj instanceof Workflow)) {
return false; return false;
} }
final Workflow other = (Workflow) obj; final Workflow other = (Workflow) obj;
if (!other.canEqual(obj)) { if (!other.canEqual(this)) {
return false; return false;
} }

View File

@ -18,9 +18,11 @@
*/ */
package org.libreccm.categorization; package org.libreccm.categorization;
import nl.jqno.equalsverifier.EqualsVerifier;
import nl.jqno.equalsverifier.Warning;
import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.Parameterized; import org.junit.runners.Parameterized;
import org.libreccm.testutils.EqualsVerifier;
import org.libreccm.tests.categories.UnitTest; import org.libreccm.tests.categories.UnitTest;
import java.util.Arrays; import java.util.Arrays;
@ -32,7 +34,9 @@ import java.util.Collection;
*/ */
@RunWith(Parameterized.class) @RunWith(Parameterized.class)
@org.junit.experimental.categories.Category(UnitTest.class) @org.junit.experimental.categories.Category(UnitTest.class)
public class EqualsAndHashCodeTest extends EqualsVerifier { public class EqualsAndHashCodeTest {
private final Class<?> entityClass;
@Parameterized.Parameters(name = "{0}") @Parameterized.Parameters(name = "{0}")
public static Collection<Class<?>> data() { public static Collection<Class<?>> data() {
@ -43,8 +47,32 @@ public class EqualsAndHashCodeTest extends EqualsVerifier {
DomainOwnership.class}); DomainOwnership.class});
} }
public EqualsAndHashCodeTest(final Class<?> entitiesClass) { public EqualsAndHashCodeTest(final Class<?> entityClass) {
super(entitiesClass); this.entityClass = entityClass;
}
@Test
public void verifyEqualsAndHashCode() {
final Category category1 = new Category();
category1.setName("Category One");
final Category category2 = new Category();
category2.setName("Category Two");
final Domain domain1 = new Domain();
domain1.setDomainKey("Domain-One");
final Domain domain2 = new Domain();
domain2.setDomainKey("Domain Two");
EqualsVerifier
.forClass(entityClass)
.suppress(Warning.STRICT_INHERITANCE)
.suppress(Warning.NONFINAL_FIELDS)
.withRedefinedSuperclass()
.withPrefabValues(Category.class, category1, category2)
.withPrefabValues(Domain.class, domain1, domain2)
.verify();
} }
} }

View File

@ -18,10 +18,12 @@
*/ */
package org.libreccm.formbuilder; package org.libreccm.formbuilder;
import nl.jqno.equalsverifier.EqualsVerifier;
import nl.jqno.equalsverifier.Warning;
import org.junit.Test;
import org.junit.experimental.categories.Category; import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.Parameterized; import org.junit.runners.Parameterized;
import org.libreccm.testutils.EqualsVerifier;
import org.libreccm.tests.categories.UnitTest; import org.libreccm.tests.categories.UnitTest;
import java.util.Arrays; import java.util.Arrays;
@ -33,11 +35,13 @@ import java.util.Collection;
*/ */
@RunWith(Parameterized.class) @RunWith(Parameterized.class)
@Category(UnitTest.class) @Category(UnitTest.class)
public class EqualsAndHashCodeTest extends EqualsVerifier { public class EqualsAndHashCodeTest {
private final Class<?> entityClass;
@Parameterized.Parameters(name = "{0}") @Parameterized.Parameters(name = "{0}")
public static Collection<Class<?>> data() { public static Collection<Class<?>> data() {
return Arrays.asList(new Class<?>[] { return Arrays.asList(new Class<?>[]{
Component.class, Component.class,
DataDrivenSelect.class, DataDrivenSelect.class,
FormSection.class, FormSection.class,
@ -51,8 +55,47 @@ public class EqualsAndHashCodeTest extends EqualsVerifier {
WidgetLabel.class WidgetLabel.class
}); });
} }
public EqualsAndHashCodeTest(final Class<?> entityClass) { public EqualsAndHashCodeTest(final Class<?> entityClass) {
super(entityClass); this.entityClass = entityClass;
} }
@Test
public void verifyEqualsAndHashCode() {
final Component component1 = new Component();
component1.setAdminName("Component One");
final Component component2 = new Component();
component2.setAdminName("Component Two");
final WidgetLabel widgetLabel1 = new WidgetLabel();
widgetLabel1.setAdminName("WidgetLabel One");
final WidgetLabel widgetLabel2 = new WidgetLabel();
widgetLabel2.setAdminName("WidgetLabel Two");
final Widget widget1 = new Widget();
widget1.setAdminName("Widget 1");
final Widget widget2 = new Widget();
widget2.setAdminName("Widget 2");
final FormSection formSection1 = new FormSection();
formSection1.setAdminName("FormSection One");
final FormSection formSection2 = new FormSection();
formSection2.setAdminName("FormSection Two");
EqualsVerifier
.forClass(entityClass)
.suppress(Warning.STRICT_INHERITANCE)
.suppress(Warning.NONFINAL_FIELDS)
.withRedefinedSuperclass()
.withPrefabValues(Component.class, component1, component2)
.withPrefabValues(WidgetLabel.class, widgetLabel1, widgetLabel2)
.withPrefabValues(Widget.class, widget1, widget2)
.withPrefabValues(FormSection.class, formSection1, formSection2)
.verify();
}
} }

View File

@ -18,10 +18,14 @@
*/ */
package org.libreccm.formbuilder.actions; package org.libreccm.formbuilder.actions;
import nl.jqno.equalsverifier.EqualsVerifier;
import nl.jqno.equalsverifier.Warning;
import org.junit.Test;
import org.junit.experimental.categories.Category; import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.Parameterized; import org.junit.runners.Parameterized;
import org.libreccm.testutils.EqualsVerifier; import org.libreccm.formbuilder.Component;
import org.libreccm.formbuilder.FormSection;
import org.libreccm.tests.categories.UnitTest; import org.libreccm.tests.categories.UnitTest;
import java.util.Arrays; import java.util.Arrays;
@ -33,7 +37,9 @@ import java.util.Collection;
*/ */
@RunWith(Parameterized.class) @RunWith(Parameterized.class)
@Category(UnitTest.class) @Category(UnitTest.class)
public class EqualsAndHashCodeTest extends EqualsVerifier { public class EqualsAndHashCodeTest {
private final Class<?> entityClass;
@Parameterized.Parameters(name = "{0}") @Parameterized.Parameters(name = "{0}")
public static Collection<Class<?>> data() { public static Collection<Class<?>> data() {
@ -48,7 +54,31 @@ public class EqualsAndHashCodeTest extends EqualsVerifier {
} }
public EqualsAndHashCodeTest(final Class<?> entityClass) { public EqualsAndHashCodeTest(final Class<?> entityClass) {
super(entityClass); this.entityClass = entityClass;
}
@Test
public void verifyEqualsAndHashCode() {
final Component component1 = new Component();
component1.setAdminName("Component One");
final Component component2 = new Component();
component2.setAdminName("Component Two");
final FormSection formSection1 = new FormSection();
formSection1.setAdminName("FormSection One");
final FormSection formSection2 = new FormSection();
formSection2.setAdminName("FormSection Two");
EqualsVerifier
.forClass(entityClass)
.suppress(Warning.STRICT_INHERITANCE)
.suppress(Warning.NONFINAL_FIELDS)
.withRedefinedSuperclass()
.withPrefabValues(Component.class, component1, component2)
.withPrefabValues(FormSection.class, formSection1, formSection2)
.verify();
} }
} }

View File

@ -18,9 +18,12 @@
*/ */
package org.libreccm.l10n; package org.libreccm.l10n;
import nl.jqno.equalsverifier.Warning;
import org.junit.Test;
import org.junit.experimental.categories.Category; import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.Parameterized; import org.junit.runners.Parameterized;
import org.libreccm.messaging.Message;
import org.libreccm.tests.categories.UnitTest; import org.libreccm.tests.categories.UnitTest;
import org.libreccm.testutils.EqualsVerifier; import org.libreccm.testutils.EqualsVerifier;
@ -33,7 +36,9 @@ import java.util.Collection;
*/ */
@RunWith(Parameterized.class) @RunWith(Parameterized.class)
@Category(UnitTest.class) @Category(UnitTest.class)
public class EqualsAndHashCodeTest extends EqualsVerifier { public class EqualsAndHashCodeTest {
private final Class<?> entityClass;
@Parameterized.Parameters(name = "{0}") @Parameterized.Parameters(name = "{0}")
public static Collection<Class<?>> data() { public static Collection<Class<?>> data() {
@ -43,7 +48,26 @@ public class EqualsAndHashCodeTest extends EqualsVerifier {
} }
public EqualsAndHashCodeTest(final Class<?> entityClass) { public EqualsAndHashCodeTest(final Class<?> entityClass) {
super(entityClass); this.entityClass = entityClass;
} }
@Test
public void verifyEqualsAndHashCode() {
final Message message1 = new Message();
message1.setSubject("Message One");
final Message message2 = new Message();
message2.setSubject("Message Two");
nl.jqno.equalsverifier.EqualsVerifier
.forClass(entityClass)
.suppress(Warning.STRICT_INHERITANCE)
.suppress(Warning.NONFINAL_FIELDS)
.withRedefinedSuperclass()
.withPrefabValues(Message.class, message1, message2)
.verify();
}
} }

View File

@ -18,11 +18,12 @@
*/ */
package org.libreccm.messaging; package org.libreccm.messaging;
import nl.jqno.equalsverifier.Warning;
import org.junit.Test;
import org.junit.experimental.categories.Category; import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.Parameterized; import org.junit.runners.Parameterized;
import org.libreccm.tests.categories.UnitTest; import org.libreccm.tests.categories.UnitTest;
import org.libreccm.testutils.EqualsVerifier;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
@ -33,7 +34,9 @@ import java.util.Collection;
*/ */
@RunWith(Parameterized.class) @RunWith(Parameterized.class)
@Category(UnitTest.class) @Category(UnitTest.class)
public class EqualsAndHashCodeTest extends EqualsVerifier { public class EqualsAndHashCodeTest {
private final Class<?> entityClass;
@Parameterized.Parameters(name = "{0}") @Parameterized.Parameters(name = "{0}")
public static Collection<Class<?>> data() { public static Collection<Class<?>> data() {
@ -45,7 +48,24 @@ public class EqualsAndHashCodeTest extends EqualsVerifier {
} }
public EqualsAndHashCodeTest(final Class<?> entityClass) { public EqualsAndHashCodeTest(final Class<?> entityClass) {
super(entityClass); this.entityClass = entityClass;
}
@Test
public void verifyEqualsAndHashCode() {
final Message message1 = new Message();
message1.setSubject("Message One");
final Message message2 = new Message();
message2.setSubject("Message Two");
nl.jqno.equalsverifier.EqualsVerifier
.forClass(entityClass)
.suppress(Warning.STRICT_INHERITANCE)
.suppress(Warning.NONFINAL_FIELDS)
.withRedefinedSuperclass()
.withPrefabValues(Message.class, message1, message2)
.verify();
} }
} }

View File

@ -18,11 +18,14 @@
*/ */
package org.libreccm.notification; package org.libreccm.notification;
import nl.jqno.equalsverifier.EqualsVerifier;
import nl.jqno.equalsverifier.Warning;
import org.junit.Test;
import org.junit.experimental.categories.Category; import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.Parameterized; import org.junit.runners.Parameterized;
import org.libreccm.messaging.Message;
import org.libreccm.tests.categories.UnitTest; import org.libreccm.tests.categories.UnitTest;
import org.libreccm.testutils.EqualsVerifier;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
@ -33,7 +36,9 @@ import java.util.Collection;
*/ */
@RunWith(Parameterized.class) @RunWith(Parameterized.class)
@Category(UnitTest.class) @Category(UnitTest.class)
public class EqualsAndHashCodeTest extends EqualsVerifier { public class EqualsAndHashCodeTest {
private final Class<?> entityClass;
@Parameterized.Parameters(name = "{0}") @Parameterized.Parameters(name = "{0}")
public static Collection<Class<?>> data() { public static Collection<Class<?>> data() {
@ -45,7 +50,24 @@ public class EqualsAndHashCodeTest extends EqualsVerifier {
} }
public EqualsAndHashCodeTest(final Class<?> entityClass) { public EqualsAndHashCodeTest(final Class<?> entityClass) {
super(entityClass); this.entityClass = entityClass;
}
@Test
public void verifyEqualsAndHashCode() {
final Message message1 = new Message();
message1.setSubject("Message One");
final Message message2 = new Message();
message2.setSubject("Message Two");
EqualsVerifier
.forClass(entityClass)
.suppress(Warning.STRICT_INHERITANCE)
.suppress(Warning.NONFINAL_FIELDS)
.withRedefinedSuperclass()
.withPrefabValues(Message.class, message1, message2)
.verify();
} }
} }

View File

@ -18,11 +18,14 @@
*/ */
package org.libreccm.portal; package org.libreccm.portal;
import nl.jqno.equalsverifier.EqualsVerifier;
import nl.jqno.equalsverifier.Warning;
import org.junit.Test;
import org.junit.experimental.categories.Category; import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.Parameterized; import org.junit.runners.Parameterized;
import org.libreccm.core.Resource;
import org.libreccm.tests.categories.UnitTest; import org.libreccm.tests.categories.UnitTest;
import org.libreccm.testutils.EqualsVerifier;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
@ -33,7 +36,9 @@ import java.util.Collection;
*/ */
@RunWith(Parameterized.class) @RunWith(Parameterized.class)
@Category(UnitTest.class) @Category(UnitTest.class)
public class EqualsAndHashCodeTest extends EqualsVerifier { public class EqualsAndHashCodeTest {
private final Class<?> entityClass;
@Parameterized.Parameters(name = "{0}") @Parameterized.Parameters(name = "{0}")
public static Collection<Class<?>> data() { public static Collection<Class<?>> data() {
@ -44,6 +49,31 @@ public class EqualsAndHashCodeTest extends EqualsVerifier {
} }
public EqualsAndHashCodeTest(final Class<?> entityTest) { public EqualsAndHashCodeTest(final Class<?> entityTest) {
super(entityTest); this.entityClass = entityTest;
} }
@Test
public void verifyEqualsAndHashCode() {
final Portal portal1 = new Portal();
portal1.setDisplayName("Portal One");
final Portal portal2 = new Portal();
portal2.setDisplayName("Portal Two");
final Resource resource1 = new Resource();
resource1.setDisplayName("Resource One");
final Resource resource2 = new Resource();
resource2.setDisplayName("Resource Two");
EqualsVerifier
.forClass(entityClass)
.suppress(Warning.STRICT_INHERITANCE)
.suppress(Warning.NONFINAL_FIELDS)
.withRedefinedSuperclass()
.withPrefabValues(Portal.class, portal1, portal2)
.withPrefabValues(Resource.class, resource1, resource2)
.verify();
}
} }

View File

@ -18,11 +18,13 @@
*/ */
package org.libreccm.runtime; package org.libreccm.runtime;
import nl.jqno.equalsverifier.EqualsVerifier;
import nl.jqno.equalsverifier.Warning;
import org.junit.Test;
import org.junit.experimental.categories.Category; import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.Parameterized; import org.junit.runners.Parameterized;
import org.libreccm.tests.categories.UnitTest; import org.libreccm.tests.categories.UnitTest;
import org.libreccm.testutils.EqualsVerifier;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
@ -33,7 +35,9 @@ import java.util.Collection;
*/ */
@RunWith(Parameterized.class) @RunWith(Parameterized.class)
@Category(UnitTest.class) @Category(UnitTest.class)
public class EqualsAndHashCodeTest extends EqualsVerifier { public class EqualsAndHashCodeTest {
private final Class<?> entityClass;
@Parameterized.Parameters(name = "{0}") @Parameterized.Parameters(name = "{0}")
public static Collection<Class<?>> data() { public static Collection<Class<?>> data() {
@ -43,8 +47,24 @@ public class EqualsAndHashCodeTest extends EqualsVerifier {
} }
public EqualsAndHashCodeTest(final Class<?> entityClass) { public EqualsAndHashCodeTest(final Class<?> entityClass) {
super(entityClass); this.entityClass = entityClass;
}
@Test
public void verifyEqualsAndHashCode() {
final Initalizer initalizer1 = new Initalizer();
initalizer1.setClassName("org.example.foo.Initalizer");
final Initalizer initalizer2 = new Initalizer();
initalizer2.setClassName("org.example.bar.Initalizer");
EqualsVerifier
.forClass(entityClass)
.suppress(Warning.STRICT_INHERITANCE)
.suppress(Warning.NONFINAL_FIELDS)
.withRedefinedSuperclass()
.withPrefabValues(Initalizer.class, initalizer1, initalizer2)
.verify();
} }
} }

View File

@ -18,11 +18,14 @@
*/ */
package org.libreccm.web; package org.libreccm.web;
import nl.jqno.equalsverifier.EqualsVerifier;
import nl.jqno.equalsverifier.Warning;
import org.junit.Test;
import org.junit.experimental.categories.Category; import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.Parameterized; import org.junit.runners.Parameterized;
import org.libreccm.core.Resource;
import org.libreccm.tests.categories.UnitTest; import org.libreccm.tests.categories.UnitTest;
import org.libreccm.testutils.EqualsVerifier;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
@ -33,7 +36,9 @@ import java.util.Collection;
*/ */
@RunWith(Parameterized.class) @RunWith(Parameterized.class)
@Category(UnitTest.class) @Category(UnitTest.class)
public class EqualsAndHashCodeTest extends EqualsVerifier { public class EqualsAndHashCodeTest {
private final Class<?> entityClass;
@Parameterized.Parameters(name = "{0}") @Parameterized.Parameters(name = "{0}")
public static Collection<Class<?>> data() { public static Collection<Class<?>> data() {
@ -44,7 +49,24 @@ public class EqualsAndHashCodeTest extends EqualsVerifier {
} }
public EqualsAndHashCodeTest(final Class<?> entityClass) { public EqualsAndHashCodeTest(final Class<?> entityClass) {
super(entityClass); this.entityClass = entityClass;
}
@Test
public void verifyEqualsAndHashCode() {
final Resource resource1 = new Resource();
resource1.setDisplayName("Resource One");
final Resource resource2 = new Resource();
resource2.setDisplayName("Resource Two");
EqualsVerifier
.forClass(entityClass)
.suppress(Warning.STRICT_INHERITANCE)
.suppress(Warning.NONFINAL_FIELDS)
.withRedefinedSuperclass()
.withPrefabValues(Resource.class, resource1, resource2)
.verify();
} }
} }