CCM NG: Several small things:
- ResourceType and ApplicationType entities
- Some refinements of columns names
- Collections are not longer used in hashCode/equals because we can't be sure that the implementation of a collection
provided for instance by Hibernate implements equals/hashCode.
git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@3515 8810af33-2d31-482b-a856-94f89814c4df
pull/2/head
parent
bae3e911a7
commit
cb54c2c9d9
|
|
@ -123,7 +123,6 @@ public class Group extends Subject implements Serializable {
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int hash = super.hashCode();
|
int hash = super.hashCode();
|
||||||
hash = 83 * hash + Objects.hashCode(this.name);
|
hash = 83 * hash + Objects.hashCode(this.name);
|
||||||
hash = 83 * hash + Objects.hashCode(this.roles);
|
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -144,10 +143,7 @@ public class Group extends Subject implements Serializable {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Objects.equals(this.name, other.getName())) {
|
return Objects.equals(this.name, other.getName());
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return Objects.equals(this.roles, other.getRoles());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,9 @@ public class Resource extends CcmObject implements Serializable {
|
||||||
@JoinColumn(name = "object_id")}))
|
@JoinColumn(name = "object_id")}))
|
||||||
private LocalizedString description;
|
private LocalizedString description;
|
||||||
|
|
||||||
|
@ManyToOne
|
||||||
|
private ResourceType resourceType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date on which the resource was created.
|
* Date on which the resource was created.
|
||||||
*/
|
*/
|
||||||
|
|
@ -118,6 +121,14 @@ public class Resource extends CcmObject implements Serializable {
|
||||||
this.description = description;
|
this.description = description;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ResourceType getResourceType() {
|
||||||
|
return resourceType;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setResourceType(final ResourceType resourceType) {
|
||||||
|
this.resourceType = resourceType;
|
||||||
|
}
|
||||||
|
|
||||||
public Date getCreated() {
|
public Date getCreated() {
|
||||||
if (created == null) {
|
if (created == null) {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,210 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2015 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.libreccm.core;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Objects;
|
||||||
|
import javax.persistence.AssociationOverride;
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Embedded;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.Inheritance;
|
||||||
|
import javax.persistence.InheritanceType;
|
||||||
|
import javax.persistence.JoinColumn;
|
||||||
|
import javax.persistence.JoinTable;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
import org.libreccm.l10n.LocalizedString;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*/
|
||||||
|
@Entity
|
||||||
|
@Table(name = "resource_types")
|
||||||
|
@Inheritance(strategy = InheritanceType.JOINED)
|
||||||
|
public class ResourceType implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 4563584142251370627L;
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@Column(name = "resource_type_id")
|
||||||
|
private long resourceTypeId;
|
||||||
|
|
||||||
|
@Column(name = "title", length = 254, nullable = false)
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
@Embedded
|
||||||
|
@AssociationOverride(
|
||||||
|
name = "values",
|
||||||
|
joinTable = @JoinTable(name = "resource_type_descriptions",
|
||||||
|
joinColumns = {
|
||||||
|
@JoinColumn(name = "resource_type_id")}))
|
||||||
|
private LocalizedString description;
|
||||||
|
|
||||||
|
@Column(name = "workspace_app")
|
||||||
|
private boolean workspaceApplication;
|
||||||
|
|
||||||
|
@Column(name = "full_page_view")
|
||||||
|
private boolean viewableAsFullPage;
|
||||||
|
|
||||||
|
@Column(name = "embedded_view")
|
||||||
|
private boolean viewableAsEmbedded;
|
||||||
|
|
||||||
|
@Column(name = "singleton")
|
||||||
|
private boolean singleton;
|
||||||
|
|
||||||
|
public ResourceType() {
|
||||||
|
description = new LocalizedString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getResourceTypeId() {
|
||||||
|
return resourceTypeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setResourceTypeId(final long resourceTypeId) {
|
||||||
|
this.resourceTypeId = resourceTypeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitle(final String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LocalizedString getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(final LocalizedString description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isWorkspaceApplication() {
|
||||||
|
return workspaceApplication;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWorkspaceApplication(final boolean workspaceApplication) {
|
||||||
|
this.workspaceApplication = workspaceApplication;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isViewableAsFullPage() {
|
||||||
|
return viewableAsFullPage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setViewableAsFullPage(final boolean viewableAsFullPage) {
|
||||||
|
this.viewableAsFullPage = viewableAsFullPage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isViewableAsEmbedded() {
|
||||||
|
return viewableAsEmbedded;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setViewableAsEmbedded(final boolean viewableAsEmbedded) {
|
||||||
|
this.viewableAsEmbedded = viewableAsEmbedded;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSingleton() {
|
||||||
|
return singleton;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSingleton(final boolean singleton) {
|
||||||
|
this.singleton = singleton;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int hash = 5;
|
||||||
|
hash = 17 * hash + (int) (this.resourceTypeId ^ (this.resourceTypeId
|
||||||
|
>>> 32));
|
||||||
|
hash = 17 * hash + Objects.hashCode(this.title);
|
||||||
|
hash = 17 * hash + Objects.hashCode(this.description);
|
||||||
|
hash = 17 * hash + (this.workspaceApplication ? 1 : 0);
|
||||||
|
hash = 17 * hash + (this.viewableAsFullPage ? 1 : 0);
|
||||||
|
hash = 17 * hash + (this.viewableAsEmbedded ? 1 : 0);
|
||||||
|
hash = 17 * hash + (this.singleton ? 1 : 0);
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(final Object obj) {
|
||||||
|
if (obj == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!(obj instanceof ResourceType)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
final ResourceType other = (ResourceType) obj;
|
||||||
|
if (!other.canEqual(this)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.resourceTypeId != other.resourceTypeId) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!Objects.equals(this.title, other.title)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!Objects.equals(this.description, other.description)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (this.workspaceApplication != other.workspaceApplication) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (this.viewableAsFullPage != other.viewableAsFullPage) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (this.viewableAsEmbedded != other.viewableAsEmbedded) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return this.singleton == other.singleton;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean canEqual(final Object obj) {
|
||||||
|
return obj instanceof ResourceType;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final String toString() {
|
||||||
|
return toString("");
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toString(final String data) {
|
||||||
|
return String.format("%s{ "
|
||||||
|
+ "resourceTypeId = %d, "
|
||||||
|
+ "title = \"%s\", "
|
||||||
|
+ "description = { %s }, "
|
||||||
|
+ "workspaceApplication = %b, "
|
||||||
|
+ "viewableAsFullPage = %b, "
|
||||||
|
+ "viewableAsEmbedded = %b, "
|
||||||
|
+ "singleton = %b%s"
|
||||||
|
+ " }",
|
||||||
|
super.toString(),
|
||||||
|
resourceTypeId,
|
||||||
|
title,
|
||||||
|
Objects.toString(description),
|
||||||
|
workspaceApplication,
|
||||||
|
viewableAsFullPage,
|
||||||
|
viewableAsEmbedded,
|
||||||
|
singleton,
|
||||||
|
data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -149,11 +149,11 @@ public class Subject implements Serializable {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final Subject other = (Subject) obj;
|
final Subject other = (Subject) obj;
|
||||||
if (subjectId != other.getSubjectId()) {
|
if (!other.canEqual(this)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!other.canEqual(this)) {
|
if (subjectId != other.getSubjectId()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -155,7 +155,6 @@ public class Component extends CcmObject implements Serializable {
|
||||||
hash = 53 * hash + Objects.hashCode(attributeString);
|
hash = 53 * hash + Objects.hashCode(attributeString);
|
||||||
hash = 53 * hash + (active ? 1 : 0);
|
hash = 53 * hash + (active ? 1 : 0);
|
||||||
hash = 53 * hash + Objects.hashCode(parentComponent);
|
hash = 53 * hash + Objects.hashCode(parentComponent);
|
||||||
hash = 53 * hash + Objects.hashCode(childComponents);
|
|
||||||
hash = 53 * hash + (int) (componentOrder ^ (componentOrder >>> 32));
|
hash = 53 * hash + (int) (componentOrder ^ (componentOrder >>> 32));
|
||||||
hash = 53 * hash + (selected ? 1 : 0);
|
hash = 53 * hash + (selected ? 1 : 0);
|
||||||
return hash;
|
return hash;
|
||||||
|
|
@ -199,9 +198,6 @@ public class Component extends CcmObject implements Serializable {
|
||||||
if (!Objects.equals(parentComponent, other.getParentComponent())) {
|
if (!Objects.equals(parentComponent, other.getParentComponent())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!Objects.equals(childComponents, other.getChildComponents())) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (componentOrder != other.getComponentOrder()) {
|
if (componentOrder != other.getComponentOrder()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -187,8 +187,6 @@ public class Message extends CcmObject implements Serializable {
|
||||||
hash = 89 * hash + Objects.hashCode(bodyMimeType);
|
hash = 89 * hash + Objects.hashCode(bodyMimeType);
|
||||||
hash = 89 * hash + Objects.hashCode(sent);
|
hash = 89 * hash + Objects.hashCode(sent);
|
||||||
hash = 89 * hash + Objects.hashCode(inReplyTo);
|
hash = 89 * hash + Objects.hashCode(inReplyTo);
|
||||||
hash = 89 * hash + Objects.hashCode(replies);
|
|
||||||
hash = 89 * hash + Objects.hashCode(attachments);
|
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -230,13 +228,7 @@ public class Message extends CcmObject implements Serializable {
|
||||||
if (!Objects.equals(sent, other.getSent())) {
|
if (!Objects.equals(sent, other.getSent())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!Objects.equals(inReplyTo, other.getInReplyTo())) {
|
return Objects.equals(inReplyTo, other.getInReplyTo());
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!Objects.equals(replies, other.getReplies())) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return Objects.equals(attachments, other.getAttachments());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,6 @@ public class Portal extends Resource implements Serializable {
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int hash = super.hashCode();
|
int hash = super.hashCode();
|
||||||
hash = 79 * hash + (template ? 1 : 0);
|
hash = 79 * hash + (template ? 1 : 0);
|
||||||
hash = 79 * hash + Objects.hashCode(portlets);
|
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -108,10 +107,7 @@ public class Portal extends Resource implements Serializable {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (template != other.isTemplate()) {
|
return (template == other.isTemplate());
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return Objects.equals(portlets, other.getPortlets());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -117,7 +117,6 @@ public class Initalizer implements Serializable {
|
||||||
= 37 * hash + (int) (initializerId ^ (initializerId >>> 32));
|
= 37 * hash + (int) (initializerId ^ (initializerId >>> 32));
|
||||||
hash = 37 * hash + Objects.hashCode(className);
|
hash = 37 * hash + Objects.hashCode(className);
|
||||||
hash = 37 * hash + Objects.hashCode(requiredBy);
|
hash = 37 * hash + Objects.hashCode(requiredBy);
|
||||||
hash = 37 * hash + Objects.hashCode(requires);
|
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -140,11 +139,7 @@ public class Initalizer implements Serializable {
|
||||||
if (!Objects.equals(className, other.getClassName())) {
|
if (!Objects.equals(className, other.getClassName())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!Objects.equals(requiredBy, other.getRequiredBy())) {
|
return Objects.equals(requiredBy, other.getRequiredBy());
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return Objects.equals(requires,
|
|
||||||
other.getRequires());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canEqual(final Object obj) {
|
public boolean canEqual(final Object obj) {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,170 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2015 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.libreccm.web;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.ForeignKey;
|
||||||
|
import javax.persistence.JoinColumn;
|
||||||
|
import javax.persistence.JoinColumns;
|
||||||
|
import javax.persistence.ManyToOne;
|
||||||
|
import javax.persistence.OneToMany;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
import org.libreccm.core.Group;
|
||||||
|
import org.libreccm.core.Privilege;
|
||||||
|
import org.libreccm.core.ResourceType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*/
|
||||||
|
@Entity
|
||||||
|
@Table(name = "application_types")
|
||||||
|
public class ApplicationType extends ResourceType implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -1175728067001112457L;
|
||||||
|
|
||||||
|
@OneToMany
|
||||||
|
@JoinColumn(name = "relevant_privilege_id")
|
||||||
|
private List<Privilege> relevantPrivileges;
|
||||||
|
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "container_group_id")
|
||||||
|
private Group containerGroup;
|
||||||
|
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "provider_app_type_id")
|
||||||
|
private ApplicationType providerApplicationType;
|
||||||
|
|
||||||
|
@OneToMany(mappedBy = "providerApplicationType")
|
||||||
|
private List<ApplicationType> dependentApplicationTypes;
|
||||||
|
|
||||||
|
public ApplicationType() {
|
||||||
|
super();
|
||||||
|
|
||||||
|
relevantPrivileges = new ArrayList<>();
|
||||||
|
dependentApplicationTypes = new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Privilege> getRelevantPrivileges() {
|
||||||
|
return Collections.unmodifiableList(relevantPrivileges);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setRelevantPrivileges(
|
||||||
|
final List<Privilege> relevantPrivileges) {
|
||||||
|
this.relevantPrivileges = relevantPrivileges;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void addRelevantPrivilege(final Privilege privilege) {
|
||||||
|
relevantPrivileges.add(privilege);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void removeRelevantPrivlege(final Privilege privilege) {
|
||||||
|
relevantPrivileges.remove(privilege);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Group getContainerGroup() {
|
||||||
|
return containerGroup;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setContainerGroup(final Group containerGroup) {
|
||||||
|
this.containerGroup = containerGroup;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApplicationType getProviderApplicationType() {
|
||||||
|
return providerApplicationType;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setProviderApplicationType(
|
||||||
|
final ApplicationType providerApplicationType) {
|
||||||
|
this.providerApplicationType = providerApplicationType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ApplicationType> getDependentApplicationTypes() {
|
||||||
|
return Collections.unmodifiableList(dependentApplicationTypes);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setDependentApplicationTypes(
|
||||||
|
final List<ApplicationType> dependentApplicationTypes) {
|
||||||
|
this.dependentApplicationTypes = dependentApplicationTypes;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void addDependantApplicationType(
|
||||||
|
final ApplicationType applicationType) {
|
||||||
|
dependentApplicationTypes.add(applicationType);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void removeDependentApplicationType(
|
||||||
|
final ApplicationType applicationType) {
|
||||||
|
dependentApplicationTypes.remove(applicationType);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int hash = super.hashCode();
|
||||||
|
hash = 97 * hash + Objects.hashCode(this.containerGroup);
|
||||||
|
hash = 97 * hash + Objects.hashCode(this.providerApplicationType);
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(final Object obj) {
|
||||||
|
if (obj == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!super.equals(obj)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(obj instanceof ApplicationType)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
final ApplicationType other = (ApplicationType) obj;
|
||||||
|
if (!other.canEqual(this)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Objects.equals(this.containerGroup, other.containerGroup)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return Objects.equals(this.providerApplicationType,
|
||||||
|
other.providerApplicationType);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canEqual(final Object obj) {
|
||||||
|
return obj instanceof ApplicationType;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString(final String data) {
|
||||||
|
return super.toString(String.format(
|
||||||
|
", containerGroup = { %s },"
|
||||||
|
+ "providerApplicationType = { %s }%s",
|
||||||
|
Objects.toString(containerGroup),
|
||||||
|
Objects.toString(
|
||||||
|
providerApplicationType),
|
||||||
|
data));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -238,9 +238,6 @@ public class Task implements Serializable {
|
||||||
hash = 79 * hash + (active ? 1 : 0);
|
hash = 79 * hash + (active ? 1 : 0);
|
||||||
hash = 79 * hash + Objects.hashCode(taskState);
|
hash = 79 * hash + Objects.hashCode(taskState);
|
||||||
hash = 79 * hash + Objects.hashCode(workflow);
|
hash = 79 * hash + Objects.hashCode(workflow);
|
||||||
hash = 79 * hash + Objects.hashCode(dependentTasks);
|
|
||||||
hash = 79 * hash + Objects.hashCode(dependsOn);
|
|
||||||
hash = 79 * hash + Objects.hashCode(comments);
|
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -277,16 +274,7 @@ public class Task implements Serializable {
|
||||||
if (!Objects.equals(taskState, other.getTaskState())) {
|
if (!Objects.equals(taskState, other.getTaskState())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!Objects.equals(workflow, other.getWorkflow())) {
|
return Objects.equals(workflow, other.getWorkflow());
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!Objects.equals(dependentTasks, other.getDependentTasks())) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!Objects.equals(dependsOn, other.getDependsOn())) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return Objects.equals(comments, other.getComments());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canEqual(final Object obj) {
|
public boolean canEqual(final Object obj) {
|
||||||
|
|
|
||||||
|
|
@ -212,8 +212,6 @@ public class UserTask extends Task implements Serializable {
|
||||||
hash
|
hash
|
||||||
= 37 * hash + (int) (durationMinutes ^ (durationMinutes >>> 32));
|
= 37 * hash + (int) (durationMinutes ^ (durationMinutes >>> 32));
|
||||||
hash = 37 * hash + Objects.hashCode(notificationSender);
|
hash = 37 * hash + Objects.hashCode(notificationSender);
|
||||||
hash = 37 * hash + Objects.hashCode(assignedUsers);
|
|
||||||
hash = 37 * hash + Objects.hashCode(assignedGroups);
|
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -255,13 +253,7 @@ public class UserTask extends Task implements Serializable {
|
||||||
if (durationMinutes != other.getDurationMinutes()) {
|
if (durationMinutes != other.getDurationMinutes()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!Objects.equals(notificationSender, other.getNotificationSender())) {
|
return Objects.equals(notificationSender, other.getNotificationSender());
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!Objects.equals(assignedUsers, other.getAssignedUsers())) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return Objects.equals(assignedGroups, other.getAssignedGroups());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -130,7 +130,6 @@ public class Workflow implements Serializable {
|
||||||
int hash = 5;
|
int hash = 5;
|
||||||
hash = 79 * hash + (int) (this.workflowId ^ (this.workflowId >>> 32));
|
hash = 79 * hash + (int) (this.workflowId ^ (this.workflowId >>> 32));
|
||||||
hash = 79 * hash + Objects.hashCode(this.name);
|
hash = 79 * hash + Objects.hashCode(this.name);
|
||||||
hash = 79 * hash + Objects.hashCode(this.tasks);
|
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -150,10 +149,8 @@ public class Workflow implements Serializable {
|
||||||
if (this.workflowId != other.getWorkflowId()) {
|
if (this.workflowId != other.getWorkflowId()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!Objects.equals(this.name, other.getName())) {
|
return Objects.equals(this.name, other.getName());
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return Objects.equals(this.tasks, other.getTasks());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canEqual(final Object obj) {
|
public boolean canEqual(final Object obj) {
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ import org.libreccm.tests.categories.UnitTest;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import org.libreccm.web.ApplicationType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
@ -45,6 +46,7 @@ public class EqualsAndHashCodeTest extends EqualsVerifier {
|
||||||
Permission.class,
|
Permission.class,
|
||||||
PersonName.class,
|
PersonName.class,
|
||||||
Privilege.class,
|
Privilege.class,
|
||||||
|
ResourceType.class,
|
||||||
Role.class,
|
Role.class,
|
||||||
User.class,
|
User.class,
|
||||||
Group.class});
|
Group.class});
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ import org.libreccm.tests.categories.UnitTest;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import org.libreccm.web.ApplicationType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
@ -38,6 +39,7 @@ public class ToStringTest extends ToStringVerifier {
|
||||||
@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<?>[]{
|
||||||
|
ApplicationType.class,
|
||||||
CcmObject.class,
|
CcmObject.class,
|
||||||
EmailAddress.class,
|
EmailAddress.class,
|
||||||
GroupMembership.class,
|
GroupMembership.class,
|
||||||
|
|
@ -46,6 +48,7 @@ public class ToStringTest extends ToStringVerifier {
|
||||||
PersonName.class,
|
PersonName.class,
|
||||||
Privilege.class,
|
Privilege.class,
|
||||||
Resource.class,
|
Resource.class,
|
||||||
|
ResourceType.class,
|
||||||
Role.class,
|
Role.class,
|
||||||
User.class,
|
User.class,
|
||||||
Group.class});
|
Group.class});
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,71 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2015 LibreCCM Foundation.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||||
|
* MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.libreccm.web;
|
||||||
|
|
||||||
|
import nl.jqno.equalsverifier.EqualsVerifier;
|
||||||
|
import nl.jqno.equalsverifier.Warning;
|
||||||
|
import org.junit.After;
|
||||||
|
import org.junit.AfterClass;
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.BeforeClass;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
*/
|
||||||
|
public class ApplicationTypeTest {
|
||||||
|
|
||||||
|
public ApplicationTypeTest() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@BeforeClass
|
||||||
|
public static void setUpClass() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@AfterClass
|
||||||
|
public static void tearDownClass() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void setUp() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@After
|
||||||
|
public void tearDown() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void verifyEqualsAndHashCod() {
|
||||||
|
final ApplicationType appType1 = new ApplicationType();
|
||||||
|
appType1.setTitle("app-type-1");
|
||||||
|
|
||||||
|
final ApplicationType appType2 = new ApplicationType();
|
||||||
|
appType2.setTitle("app-type-2");
|
||||||
|
|
||||||
|
EqualsVerifier
|
||||||
|
.forClass(ApplicationType.class)
|
||||||
|
.suppress(Warning.STRICT_INHERITANCE)
|
||||||
|
.suppress(Warning.NONFINAL_FIELDS)
|
||||||
|
.withPrefabValues(ApplicationType.class, appType1, appType2)
|
||||||
|
.withRedefinedSuperclass()
|
||||||
|
.verify();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -27,24 +27,24 @@ import org.libreccm.web.Application;
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "shortcut_app")
|
@Table(name = "shortcuts_app")
|
||||||
public class Shortcuts extends Application {
|
public class Shortcuts extends Application {
|
||||||
private static final long serialVersionUID = -6793265996161649637L;
|
private static final long serialVersionUID = -6793265996161649637L;
|
||||||
|
|
||||||
private String shortcutAppName;
|
// private String shortcutAppName;
|
||||||
|
|
||||||
public Shortcuts() {
|
public Shortcuts() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getShortcutAppName() {
|
// public String getShortcutAppName() {
|
||||||
return shortcutAppName;
|
// return shortcutAppName;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public void setShortcutAppName(final String shortcutAppName) {
|
// public void setShortcutAppName(final String shortcutAppName) {
|
||||||
this.shortcutAppName = shortcutAppName;
|
// this.shortcutAppName = shortcutAppName;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue