CCM NG: Fixed several warnings from PMD (most of them false warnings)

git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@3460 8810af33-2d31-482b-a856-94f89814c4df
pull/2/head
jensp 2015-06-05 06:35:58 +00:00
parent a79c67974d
commit 1745c25dcc
27 changed files with 278 additions and 100 deletions

View File

@ -154,6 +154,8 @@ public class Categorization implements Serializable {
}
@Override
//No chance to make this method less complex, therefore suppress warning
@SuppressWarnings("PMD.NPathComplexity")
public boolean equals(final Object obj) {
if (obj == null) {
return false;

View File

@ -35,7 +35,6 @@ import java.util.Objects;
import javax.persistence.AssociationOverride;
import javax.persistence.Column;
import javax.persistence.Convert;
import javax.persistence.Converter;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
@ -46,6 +45,7 @@ import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.Pattern;
import org.omg.CORBA.DomainManager;
/**
* A domain is collection of categories designed a specific purpose. This entity

View File

@ -0,0 +1,44 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.libreccm.core;
import java.util.List;
import javax.inject.Inject;
import javax.persistence.EntityManager;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
public abstract class AbstractEntityRepository<K, E> {
@Inject
private transient EntityManager entityManager;
protected EntityManager getEntityManager() {
return entityManager;
}
public abstract Class<E> getEntityClass();
public abstract boolean isNew(final E entity) {
}
public void save(final E entity) {
if (isNew(entity)) {
entityManager.persist(entity);
} else {
entityManager.merge(entity);
}
}
public List<E> findById(final K entityId) {
return entityManager.find(getEntityClass(), entityId);
}
public abstract List<E> findAll();
}

View File

@ -37,6 +37,8 @@ import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
/**
* Root class of all entities in LibreCCM which need categorisation and
@ -58,6 +60,11 @@ import javax.persistence.Table;
@Entity
@Table(name = "ccm_objects")
@Inheritance(strategy = InheritanceType.JOINED)
@XmlRootElement(name = "ccm-object", namespace = "http://core.libreccm.org")
//False warning (?). Because this class has been migrated from the old PDL style
//persistence system we can't yet refactor it to make PMD happy. Also I think
//this is a false warning.
@SuppressWarnings("PMD.TooManyMethods")
public class CcmObject implements Serializable {
private static final long serialVersionUID = 201504261329L;
@ -70,6 +77,7 @@ public class CcmObject implements Serializable {
@Id
@Column(name = "object_id")
@GeneratedValue(strategy = GenerationType.AUTO)
@XmlElement(name = "object-id")
private long objectId;
/**

View File

@ -30,6 +30,14 @@ import javax.persistence.Embeddable;
/**
* An embeddable entity for storing email addresses.
*
* In contrast to its predecessor {@code com.arsdigita.kernel.EmailAddress}
* this class does not provide verification methods. Verification is done using
* the <em>Bean Validiation API</em> (Hibernate Validator is used as
* implementation).
*
* Because this class is an embeddable JPA entity it can be used in other
* entities to store eMail addresses.
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@Embeddable
@ -40,7 +48,7 @@ public class EmailAddress implements Serializable {
@Column(name = "email_address", length = 512, nullable = false)
@NotBlank
@Email
private String eMailAddress;
private String address;
@Column(name = "bouncing")
private boolean bouncing;
@ -48,12 +56,12 @@ public class EmailAddress implements Serializable {
@Column(name = "verified")
private boolean verified;
public String getEmailAddress() {
return eMailAddress;
public String getAddress() {
return address;
}
public void setEmailAddress(final String eMailAddress) {
this.eMailAddress = eMailAddress;
public void setAddress(final String eMailAddress) {
this.address = eMailAddress;
}
public boolean isBouncing() {
@ -75,7 +83,7 @@ public class EmailAddress implements Serializable {
@Override
public int hashCode() {
int hash = 5;
hash = 79 * hash + Objects.hashCode(eMailAddress);
hash = 79 * hash + Objects.hashCode(address);
hash = 79 * hash + (bouncing ? 1 : 0);
hash = 79 * hash + (verified ? 1 : 0);
return hash;
@ -94,7 +102,7 @@ public class EmailAddress implements Serializable {
return false;
}
if (!Objects.equals(eMailAddress, other.getEmailAddress())) {
if (!Objects.equals(address, other.getAddress())) {
return false;
}
if (bouncing != other.isBouncing()) {
@ -114,7 +122,7 @@ public class EmailAddress implements Serializable {
+ "bouncing = %b, "
+ "verified = %b }",
super.toString(),
eMailAddress,
address,
bouncing,
verified);
}

View File

@ -29,6 +29,7 @@ import javax.persistence.ManyToOne;
import javax.persistence.Table;
/**
* An association class for the association between a group and it members.
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/

View File

@ -52,6 +52,8 @@ public class Party extends CcmObject implements Serializable {
private List<EmailAddress> emailAddresses;
@OneToMany(mappedBy = "grantee")
//Can't shorten this variable name without reducing descriptiveness
@SuppressWarnings("PMD.LongVariable")
private List<Permission> grantedPermissions;
public Party() {
@ -84,6 +86,8 @@ public class Party extends CcmObject implements Serializable {
return Collections.unmodifiableList(grantedPermissions);
}
//Can't shorten this variable name without reducing descriptiveness
@SuppressWarnings("PMD.LongVariable")
protected void setGrantedPermissions(
final List<Permission> grantedPermissions) {
this.grantedPermissions = grantedPermissions;

View File

@ -40,6 +40,10 @@ import javax.persistence.TemporalType;
*/
@Entity
@Table(name = "permissions")
//Can't reduce complexity yet
@SuppressWarnings({"PMD.CyclomaticComplexity",
"PMD.StdCyclomaticComplexity",
"PMD.ModifiedCyclomaticComplexity"})
public class Permission implements Serializable {
private static final long serialVersionUID = -2368935232499907547L;
@ -136,7 +140,7 @@ public class Permission implements Serializable {
public int hashCode() {
int hash = 3;
hash
= 31 * hash + (int) (permissionId ^ (permissionId >>> 32));
= 31 * hash + (int) (permissionId ^ (permissionId >>> 32));
hash = 31 * hash + Objects.hashCode(grantee);
hash = 31 * hash + Objects.hashCode(grantedPrivilege);
hash = 31 * hash + Objects.hashCode(object);
@ -147,6 +151,11 @@ public class Permission implements Serializable {
}
@Override
//Can't reduce complexity yet
@SuppressWarnings({"PMD.CyclomaticComplexity",
"PMD.StdCyclomaticComplexity",
"PMD.ModifiedCyclomaticComplexity",
"PMD.NPathComplexity"})
public boolean equals(final Object obj) {
if (obj == null) {
return false;
@ -188,14 +197,14 @@ public class Permission implements Serializable {
@Override
public String toString() {
return String.format("%s{ "
+ "permissionId = %d, "
+ "grantee = %s, "
+ "grantedPrivilege = %s, "
+ "object = %s, "
+ "creationUser = %s,"
+ "creationDate = %tF %<tT, "
+ "creationIp = %s"
+ " }",
+ "permissionId = %d, "
+ "grantee = %s, "
+ "grantedPrivilege = %s, "
+ "object = %s, "
+ "creationUser = %s,"
+ "creationDate = %tF %<tT, "
+ "creationIp = %s"
+ " }",
super.toString(),
permissionId,
Objects.toString(grantee),

View File

@ -73,7 +73,7 @@ public class PersonName implements Serializable {
return middleName;
}
public void setMiddleName(String middleName) {
public void setMiddleName(final String middleName) {
this.middleName = middleName;
}

View File

@ -44,6 +44,8 @@ public class Privilege implements Serializable {
private long privilegeId;
@Column(name = "privilege", length = 255, nullable = false)
//Field is named like this in the old PDL class, don't want to change it now
@SuppressWarnings("PMD.AvoidFieldNameMatchingTypeName")
private String privilege;
public long getPrivilegeId() {

View File

@ -36,6 +36,7 @@ import org.hibernate.validator.constraints.NotBlank;
*/
@Entity
@Table(name = "roles")
@SuppressWarnings("PMD.ShortClassName") //Role is perfectly fine name.
public class Role implements Serializable {
private static final long serialVersionUID = 3314358449751376350L;

View File

@ -44,6 +44,12 @@ import javax.persistence.OneToMany;
*/
@Entity
@Table(name = "users")
//Supressing a few warnings from PMD because they misleading here.
//User is perfectly fine class name, and the complexity is not to high...
@SuppressWarnings({"PMD.ShortClassName",
"PMD.CyclomaticComplexity",
"PMD.StdCyclomaticComplexity",
"PMD.ModifiedCyclomaticComplexity"})
public class User extends Party implements Serializable {
private static final long serialVersionUID = 892038270064849732L;
@ -184,6 +190,11 @@ public class User extends Party implements Serializable {
}
@Override
//Can't reduce complexity yet
@SuppressWarnings({"PMD.CyclomaticComplexity",
"PMD.StdCyclomaticComplexity",
"PMD.ModifiedCyclomaticComplexity",
"PMD.NPathComplexity"})
public boolean equals(final Object obj) {
if (!super.equals(obj)) {
return false;

View File

@ -42,6 +42,10 @@ import javax.persistence.Table;
*/
@Entity
@Table(name = "formbuilder_components")
//Can't reduce complexity yet
@SuppressWarnings({"PMD.CyclomaticComplexity",
"PMD.StdCyclomaticComplexity",
"PMD.ModifiedCyclomaticComplexity"})
public class Component extends CcmObject implements Serializable {
private static final long serialVersionUID = 1787173100367982069L;
@ -158,6 +162,11 @@ public class Component extends CcmObject implements Serializable {
}
@Override
//Can't reduce complexity yet
@SuppressWarnings({"PMD.CyclomaticComplexity",
"PMD.StdCyclomaticComplexity",
"PMD.ModifiedCyclomaticComplexity",
"PMD.NPathComplexity"})
public boolean equals(final Object obj) {
if (obj == null) {
return false;

View File

@ -81,7 +81,7 @@ public class Listener extends CcmObject implements Serializable {
}
@Override
public boolean equals(Object obj) {
public boolean equals(final Object obj) {
if (obj == null) {
return false;
}

View File

@ -81,7 +81,7 @@ public class ObjectType extends CcmObject implements Serializable {
return false;
}
final ObjectType other = (ObjectType) obj;
if (!canEqual(this)) {
if (!other.canEqual(this)) {
return false;
}

View File

@ -122,6 +122,8 @@ public class ProcessListener extends CcmObject implements Serializable {
}
@Override
//We can't reduce the complexity now
@SuppressWarnings("PMD.NPathComplexity")
public boolean equals(final Object obj) {
if (obj == null) {
return false;

View File

@ -118,6 +118,8 @@ public class Widget extends Component implements Serializable {
}
@Override
//Can't reduce complexity yet
@SuppressWarnings("PMD.NPathComplexity")
public boolean equals(final Object obj) {
if (obj == null) {
return false;

View File

@ -117,7 +117,7 @@ public class Attachment implements Serializable {
}
}
public void setData(byte[] data) {
public void setData(final byte[] data) {
if (data == null) {
this.data = null;
} else {
@ -129,7 +129,7 @@ public class Attachment implements Serializable {
public int hashCode() {
int hash = 5;
hash
= 67 * hash + (int) (attachmentId ^ (attachmentId >>> 32));
= 67 * hash + (int) (attachmentId ^ (attachmentId >>> 32));
hash = 67 * hash + Objects.hashCode(message);
hash = 67 * hash + Objects.hashCode(mimeType);
hash = 67 * hash + Objects.hashCode(title);
@ -139,6 +139,8 @@ public class Attachment implements Serializable {
}
@Override
//Can't reduce complexity yet
@SuppressWarnings("PMD.NPathComplexity")
public boolean equals(final Object obj) {
if (obj == null) {
return false;
@ -178,11 +180,11 @@ public class Attachment implements Serializable {
@Override
public String toString() {
return String.format("%s{ "
+ "attachmentId = %d, "
+ "message = %s, "
+ "mimeType = \"%s\", "
+ "title = \"%s\""
+ " }",
+ "attachmentId = %d, "
+ "message = %s, "
+ "mimeType = \"%s\", "
+ "title = \"%s\""
+ " }",
super.toString(),
attachmentId,
Objects.toString(message),

View File

@ -46,6 +46,10 @@ import javax.persistence.TemporalType;
*/
@Entity
@Table(name = "messages")
//Can't reduce complexity yet
@SuppressWarnings({"PMD.CyclomaticComplexity",
"PMD.StdCyclomaticComplexity",
"PMD.ModifiedCyclomaticComplexity"})
public class Message extends CcmObject implements Serializable {
private static final long serialVersionUID = -9143137794418932025L;
@ -189,6 +193,11 @@ public class Message extends CcmObject implements Serializable {
}
@Override
//Can't reduce complexity yet
@SuppressWarnings({"PMD.CyclomaticComplexity",
"PMD.StdCyclomaticComplexity",
"PMD.ModifiedCyclomaticComplexity",
"PMD.NPathComplexity"})
public boolean equals(final Object obj) {
if (obj == null) {
return false;
@ -238,10 +247,10 @@ public class Message extends CcmObject implements Serializable {
@Override
public String toString(final String data) {
return super.toString(String.format(", sender = %s, "
+ "subject = \"%s\", "
+ "bodyMimeType = \"%s\", "
+ "sent = %tF %<tT, "
+ "inReplyTo = %s%s",
+ "subject = \"%s\", "
+ "bodyMimeType = \"%s\", "
+ "sent = %tF %<tT, "
+ "inReplyTo = %s%s",
Objects.toString(sender),
subject,
Objects.toString(bodyMimeType),

View File

@ -47,6 +47,10 @@ import javax.persistence.TemporalType;
*/
@Entity
@Table(name = "digests")
//Can't reduce complexity yet
@SuppressWarnings({"PMD.CyclomaticComplexity",
"PMD.StdCyclomaticComplexity",
"PMD.ModifiedCyclomaticComplexity"})
public class Digest extends CcmObject implements Serializable {
private static final long serialVersionUID = -3526066971290670390L;
@ -152,6 +156,11 @@ public class Digest extends CcmObject implements Serializable {
}
@Override
//Can't reduce complexity yet
@SuppressWarnings({"PMD.CyclomaticComplexity",
"PMD.StdCyclomaticComplexity",
"PMD.ModifiedCyclomaticComplexity",
"PMD.NPathComplexity"})
public boolean equals(final Object obj) {
if (obj == null) {
return false;
@ -199,9 +208,9 @@ public class Digest extends CcmObject implements Serializable {
@Override
public String toString(final String data) {
return super.toString(String.format(", fromParty = %s, "
+ "subject = \"%s\", "
+ "frequency = %d,"
+ "nextRun = %tF %<tT%s",
+ "subject = \"%s\", "
+ "frequency = %d,"
+ "nextRun = %tF %<tT%s",
Objects.toString(fromParty),
subject,
frequency,

View File

@ -68,6 +68,12 @@ import javax.persistence.TemporalType;
*/
@Entity
@Table(name = "notifications")
//Can't reduce complexity yet. Not sure what to do about the God class warning.
//Maybe we have to put some of the properties into an extra class.
@SuppressWarnings({"PMD.CyclomaticComplexity",
"PMD.StdCyclomaticComplexity",
"PMD.ModifiedCyclomaticComplexity",
"PMD.GodClass"})
public class Notification extends CcmObject implements Serializable {
private static final long serialVersionUID = -6052859580690813506L;
@ -244,6 +250,11 @@ public class Notification extends CcmObject implements Serializable {
}
@Override
//Can't reduce complexity yet
@SuppressWarnings({"PMD.CyclomaticComplexity",
"PMD.StdCyclomaticComplexity",
"PMD.ModifiedCyclomaticComplexity",
"PMD.NPathComplexity"})
public boolean equals(final Object obj) {
if (obj == null) {
return false;
@ -308,14 +319,14 @@ public class Notification extends CcmObject implements Serializable {
@Override
public String toString(final String data) {
return super.toString(String.format(", receiver = %s, "
+ "digest = %s, "
+ "message = %s, "
+ "expandGroup = %b, "
+ "requestDate = %tF %<tT, "
+ "fulfillDate = %tF %<tT, "
+ "status = \"%s\", "
+ "expunge = %b, "
+ "expungeMessage = %b%s",
+ "digest = %s, "
+ "message = %s, "
+ "expandGroup = %b, "
+ "requestDate = %tF %<tT, "
+ "fulfillDate = %tF %<tT, "
+ "status = \"%s\", "
+ "expunge = %b, "
+ "expungeMessage = %b%s",
Objects.toString(receiver),
Objects.toString(digest),
Objects.toString(message),

View File

@ -34,8 +34,8 @@ import javax.persistence.OneToOne;
import javax.persistence.Table;
/**
* Represents a notification that has been transferred to the outbound
* message queue. During processing, this class is used to retrieve information
* Represents a notification that has been transferred to the outbound message
* queue. During processing, this class is used to retrieve information
* necessary to convert the notification into an outbound email message.
*
* (Documentation taken from the [@code com.arsdigita.notifiction.QueueItem}
@ -45,6 +45,10 @@ import javax.persistence.Table;
*/
@Entity
@Table(name = "queue_items")
//Can't reduce complexity yet
@SuppressWarnings({"PMD.CyclomaticComplexity",
"PMD.StdCyclomaticComplexity",
"PMD.ModifiedCyclomaticComplexity"})
public class QueueItem implements Serializable {
private static final long serialVersionUID = 396330385592074013L;
@ -156,6 +160,11 @@ public class QueueItem implements Serializable {
}
@Override
//Can't reduce complexity yet
@SuppressWarnings({"PMD.CyclomaticComplexity",
"PMD.StdCyclomaticComplexity",
"PMD.ModifiedCyclomaticComplexity",
"PMD.NPathComplexity"})
public boolean equals(final Object obj) {
if (obj == null) {
return false;
@ -199,13 +208,13 @@ public class QueueItem implements Serializable {
@Override
public String toString() {
return String.format("%s{ "
+ "queueItemId = %d, "
+ "receiver = %s, "
+ "retryCount = %d, "
+ "successful = %b, "
+ "receiverAddress = \"%s\", "
+ "message = %s"
+ " }",
+ "queueItemId = %d, "
+ "receiver = %s, "
+ "retryCount = %d, "
+ "successful = %b, "
+ "receiverAddress = \"%s\", "
+ "message = %s"
+ " }",
super.toString(),
queueItemId,
Objects.toString(receiver),

View File

@ -57,12 +57,12 @@ public class Initalizer implements Serializable {
private Initalizer requiredBy;
@OneToMany(mappedBy = "requiredBy")
private List<Initalizer> requiredInitializers;
private List<Initalizer> requires;
public Initalizer() {
super();
requiredInitializers = new ArrayList<>();
requires = new ArrayList<>();
}
public long getInitializerId() {
@ -89,25 +89,25 @@ public class Initalizer implements Serializable {
this.requiredBy = requiredBy;
}
public List<Initalizer> getRequiredInitializers() {
if (requiredInitializers == null) {
public List<Initalizer> getRequires() {
if (requires == null) {
return null;
} else {
return Collections.unmodifiableList(requiredInitializers);
return Collections.unmodifiableList(requires);
}
}
protected void setRequiredInitializers(
final List<Initalizer> requiredInitializers) {
this.requiredInitializers = requiredInitializers;
protected void setRequires(
final List<Initalizer> requires) {
this.requires = requires;
}
protected void addRequiredInitalizer(final Initalizer initalizer) {
requiredInitializers.add(initalizer);
requires.add(initalizer);
}
protected void removeRequiredInitalizer(final Initalizer initalizer) {
requiredInitializers.remove(initalizer);
requires.remove(initalizer);
}
@Override
@ -117,7 +117,7 @@ public class Initalizer implements Serializable {
= 37 * hash + (int) (initializerId ^ (initializerId >>> 32));
hash = 37 * hash + Objects.hashCode(className);
hash = 37 * hash + Objects.hashCode(requiredBy);
hash = 37 * hash + Objects.hashCode(requiredInitializers);
hash = 37 * hash + Objects.hashCode(requires);
return hash;
}
@ -143,8 +143,8 @@ public class Initalizer implements Serializable {
if (!Objects.equals(requiredBy, other.getRequiredBy())) {
return false;
}
return Objects.equals(requiredInitializers,
other.getRequiredInitializers());
return Objects.equals(requires,
other.getRequires());
}
public boolean canEqual(final Object obj) {

View File

@ -42,6 +42,12 @@ import javax.persistence.TemporalType;
*/
@Entity
@Table(name = "lucene_documents")
//Can't reduce complexity yet. Not sure what to do about the God class warning.
//Maybe we have to put some of the properties into an extra class.
@SuppressWarnings({"PMD.CyclomaticComplexity",
"PMD.StdCyclomaticComplexity",
"PMD.ModifiedCyclomaticComplexity",
"PMD.GodClass"})
public class Document implements Serializable {
private static final long serialVersionUID = 3363154040440909619L;
@ -269,6 +275,11 @@ public class Document implements Serializable {
}
@Override
//Can't reduce complexity yet
@SuppressWarnings({"PMD.CyclomaticComplexity",
"PMD.StdCyclomaticComplexity",
"PMD.ModifiedCyclomaticComplexity",
"PMD.NPathComplexity"})
public boolean equals(final Object obj) {
if (obj == null) {
return false;

View File

@ -37,6 +37,7 @@ import javax.persistence.UniqueConstraint;
@Table(name = "hosts",
uniqueConstraints = {
@UniqueConstraint(columnNames = {"server_name", "server_port"})})
@SuppressWarnings("PMD.ShortClassName") //Host is perfectly fine as class name...
public class Host implements Serializable {
private static final long serialVersionUID = 8727376444061847375L;
@ -113,10 +114,10 @@ public class Host implements Serializable {
@Override
public String toString() {
return String.format("%s{ "
+ "hostId = %d, "
+ "serverName = \"%s\", "
+ "serverPort =\"%s\""
+ " }",
+ "hostId = %d, "
+ "serverName = \"%s\", "
+ "serverPort =\"%s\""
+ " }",
super.toString(),
hostId,
serverName,

View File

@ -50,6 +50,13 @@ import javax.persistence.Table;
@Entity
@Table(name = "workflow_tasks")
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
//Can't reduce complexity yet, Task is a fine name
@SuppressWarnings({"PMD.CyclomaticComplexity",
"PMD.StdCyclomaticComplexity",
"PMD.ModifiedCyclomaticComplexity",
"PMD.ShortClassName",
"PMD.TooManyMethods",
"PMD.AvoidDuplicateLiterals"})
public class Task implements Serializable {
private static final long serialVersionUID = 8161343036908150426L;
@ -61,18 +68,18 @@ public class Task implements Serializable {
@Embedded
@AssociationOverride(
name = "values",
joinTable = @JoinTable(name = "workflow_task_labels",
joinColumns = {
@JoinColumn(name = "task_id")}))
name = "values",
joinTable = @JoinTable(name = "workflow_task_labels",
joinColumns = {
@JoinColumn(name = "task_id")}))
private LocalizedString label;
@Embedded
@AssociationOverride(
name = "values",
joinTable = @JoinTable(name = "workflow_tasks_descriptions",
joinColumns = {
@JoinColumn(name = "task_id")}))
name = "values",
joinTable = @JoinTable(name = "workflow_tasks_descriptions",
joinColumns = {
@JoinColumn(name = "task_id")}))
private LocalizedString description;
@Column(name = "active")
@ -238,6 +245,11 @@ public class Task implements Serializable {
}
@Override
//Can't reduce complexity yet
@SuppressWarnings({"PMD.CyclomaticComplexity",
"PMD.StdCyclomaticComplexity",
"PMD.ModifiedCyclomaticComplexity",
"PMD.NPathComplexity"})
public boolean equals(final Object obj) {
if (obj == null) {
return false;
@ -288,14 +300,14 @@ public class Task implements Serializable {
public String toString(final String data) {
return String.format("%s{ "
+ "taskId = %d, "
+ "label = %s, "
+ "active = %b, "
+ "taskState = \"%s\", "
+ "workflow = %s, "
+ "dependentTasks = %s, "
+ "dependsOn = %s%s"
+ " }",
+ "taskId = %d, "
+ "label = %s, "
+ "active = %b, "
+ "taskState = \"%s\", "
+ "workflow = %s, "
+ "dependentTasks = %s, "
+ "dependsOn = %s%s"
+ " }",
super.toString(),
taskId,
Objects.toString(label),

View File

@ -44,6 +44,10 @@ import javax.persistence.TemporalType;
*/
@Entity
@Table(name = "workflow_user_tasks")
//Can't reduce complexity yet
@SuppressWarnings({"PMD.CyclomaticComplexity",
"PMD.StdCyclomaticComplexity",
"PMD.ModifiedCyclomaticComplexity"})
public class UserTask extends Task implements Serializable {
private static final long serialVersionUID = 4188064584389893019L;
@ -68,6 +72,7 @@ public class UserTask extends Task implements Serializable {
@OneToOne
@JoinColumn(name = "notification_sender")
@SuppressWarnings("PMD.LongVariable") //Shorter name would not be descriptive
private User notificationSender;
@OneToMany
@ -152,6 +157,7 @@ public class UserTask extends Task implements Serializable {
return notificationSender;
}
@SuppressWarnings("PMD.LongVariable")
public void setNotificationSender(final User notificationSender) {
this.notificationSender = notificationSender;
}
@ -204,7 +210,7 @@ public class UserTask extends Task implements Serializable {
hash = 37 * hash + Objects.hashCode(startDate);
hash = 37 * hash + Objects.hashCode(dueDate);
hash
= 37 * hash + (int) (durationMinutes ^ (durationMinutes >>> 32));
= 37 * hash + (int) (durationMinutes ^ (durationMinutes >>> 32));
hash = 37 * hash + Objects.hashCode(notificationSender);
hash = 37 * hash + Objects.hashCode(assignedUsers);
hash = 37 * hash + Objects.hashCode(assignedGroups);
@ -212,6 +218,11 @@ public class UserTask extends Task implements Serializable {
}
@Override
//Can't reduce complexity yet
@SuppressWarnings({"PMD.CyclomaticComplexity",
"PMD.StdCyclomaticComplexity",
"PMD.ModifiedCyclomaticComplexity",
"PMD.NPathComplexity"})
public boolean equals(final Object obj) {
if (obj == null) {
return false;
@ -261,11 +272,11 @@ public class UserTask extends Task implements Serializable {
@Override
public String toString(final String data) {
return super.toString(String.format(", locked = %b, "
+ "lockingUser = %s, "
+ "startDate = %tF %<tT,"
+ "dueDate = %tF %<tT, "
+ "durationMinutes = %d, "
+ "notificationSender = %s%s",
+ "lockingUser = %s, "
+ "startDate = %tF %<tT,"
+ "dueDate = %tF %<tT, "
+ "durationMinutes = %d, "
+ "notificationSender = %s%s",
locked,
Objects.toString(lockingUser),
startDate,