From cb54c2c9d934af194fa5713a11fef5fbbf56ff34 Mon Sep 17 00:00:00 2001 From: jensp Date: Thu, 2 Jul 2015 11:43:06 +0000 Subject: [PATCH] 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 --- .../main/java/org/libreccm/core/Group.java | 6 +- .../main/java/org/libreccm/core/Resource.java | 11 + .../java/org/libreccm/core/ResourceType.java | 210 ++++++++++++++++++ .../main/java/org/libreccm/core/Subject.java | 6 +- .../org/libreccm/formbuilder/Component.java | 4 - .../java/org/libreccm/messaging/Message.java | 10 +- .../main/java/org/libreccm/portal/Portal.java | 6 +- .../java/org/libreccm/runtime/Initalizer.java | 7 +- .../org/libreccm/web/ApplicationType.java | 170 ++++++++++++++ .../main/java/org/libreccm/workflow/Task.java | 14 +- .../java/org/libreccm/workflow/UserTask.java | 10 +- .../java/org/libreccm/workflow/Workflow.java | 7 +- .../libreccm/core/EqualsAndHashCodeTest.java | 2 + .../java/org/libreccm/core/ToStringTest.java | 3 + .../org/libreccm/web/ApplicationTypeTest.java | 71 ++++++ .../org/libreccm/shortcuts/Shortcuts.java | 20 +- 16 files changed, 488 insertions(+), 69 deletions(-) create mode 100644 ccm-core/src/main/java/org/libreccm/core/ResourceType.java create mode 100644 ccm-core/src/main/java/org/libreccm/web/ApplicationType.java create mode 100644 ccm-core/src/test/java/org/libreccm/web/ApplicationTypeTest.java diff --git a/ccm-core/src/main/java/org/libreccm/core/Group.java b/ccm-core/src/main/java/org/libreccm/core/Group.java index 571a9ab1e..04fbb9cee 100644 --- a/ccm-core/src/main/java/org/libreccm/core/Group.java +++ b/ccm-core/src/main/java/org/libreccm/core/Group.java @@ -123,7 +123,6 @@ public class Group extends Subject implements Serializable { public int hashCode() { int hash = super.hashCode(); hash = 83 * hash + Objects.hashCode(this.name); - hash = 83 * hash + Objects.hashCode(this.roles); return hash; } @@ -144,10 +143,7 @@ public class Group extends Subject implements Serializable { return false; } - if (!Objects.equals(this.name, other.getName())) { - return false; - } - return Objects.equals(this.roles, other.getRoles()); + return Objects.equals(this.name, other.getName()); } @Override diff --git a/ccm-core/src/main/java/org/libreccm/core/Resource.java b/ccm-core/src/main/java/org/libreccm/core/Resource.java index 78e044e49..83a6bb205 100644 --- a/ccm-core/src/main/java/org/libreccm/core/Resource.java +++ b/ccm-core/src/main/java/org/libreccm/core/Resource.java @@ -80,6 +80,9 @@ public class Resource extends CcmObject implements Serializable { @JoinColumn(name = "object_id")})) private LocalizedString description; + @ManyToOne + private ResourceType resourceType; + /** * Date on which the resource was created. */ @@ -118,6 +121,14 @@ public class Resource extends CcmObject implements Serializable { this.description = description; } + public ResourceType getResourceType() { + return resourceType; + } + + protected void setResourceType(final ResourceType resourceType) { + this.resourceType = resourceType; + } + public Date getCreated() { if (created == null) { return null; diff --git a/ccm-core/src/main/java/org/libreccm/core/ResourceType.java b/ccm-core/src/main/java/org/libreccm/core/ResourceType.java new file mode 100644 index 000000000..7bad64868 --- /dev/null +++ b/ccm-core/src/main/java/org/libreccm/core/ResourceType.java @@ -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 Jens Pelzetter + */ +@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); + } +} diff --git a/ccm-core/src/main/java/org/libreccm/core/Subject.java b/ccm-core/src/main/java/org/libreccm/core/Subject.java index d484d3a55..37dc9fa5b 100644 --- a/ccm-core/src/main/java/org/libreccm/core/Subject.java +++ b/ccm-core/src/main/java/org/libreccm/core/Subject.java @@ -149,11 +149,11 @@ public class Subject implements Serializable { return false; } final Subject other = (Subject) obj; - if (subjectId != other.getSubjectId()) { + if (!other.canEqual(this)) { return false; } - - if (!other.canEqual(this)) { + + if (subjectId != other.getSubjectId()) { return false; } diff --git a/ccm-core/src/main/java/org/libreccm/formbuilder/Component.java b/ccm-core/src/main/java/org/libreccm/formbuilder/Component.java index 6b60fda65..ece521991 100644 --- a/ccm-core/src/main/java/org/libreccm/formbuilder/Component.java +++ b/ccm-core/src/main/java/org/libreccm/formbuilder/Component.java @@ -155,7 +155,6 @@ public class Component extends CcmObject implements Serializable { hash = 53 * hash + Objects.hashCode(attributeString); hash = 53 * hash + (active ? 1 : 0); hash = 53 * hash + Objects.hashCode(parentComponent); - hash = 53 * hash + Objects.hashCode(childComponents); hash = 53 * hash + (int) (componentOrder ^ (componentOrder >>> 32)); hash = 53 * hash + (selected ? 1 : 0); return hash; @@ -199,9 +198,6 @@ public class Component extends CcmObject implements Serializable { if (!Objects.equals(parentComponent, other.getParentComponent())) { return false; } - if (!Objects.equals(childComponents, other.getChildComponents())) { - return false; - } if (componentOrder != other.getComponentOrder()) { return false; } diff --git a/ccm-core/src/main/java/org/libreccm/messaging/Message.java b/ccm-core/src/main/java/org/libreccm/messaging/Message.java index a137052cc..cc5c7700b 100644 --- a/ccm-core/src/main/java/org/libreccm/messaging/Message.java +++ b/ccm-core/src/main/java/org/libreccm/messaging/Message.java @@ -187,8 +187,6 @@ public class Message extends CcmObject implements Serializable { hash = 89 * hash + Objects.hashCode(bodyMimeType); hash = 89 * hash + Objects.hashCode(sent); hash = 89 * hash + Objects.hashCode(inReplyTo); - hash = 89 * hash + Objects.hashCode(replies); - hash = 89 * hash + Objects.hashCode(attachments); return hash; } @@ -230,13 +228,7 @@ public class Message extends CcmObject implements Serializable { if (!Objects.equals(sent, other.getSent())) { return false; } - if (!Objects.equals(inReplyTo, other.getInReplyTo())) { - return false; - } - if (!Objects.equals(replies, other.getReplies())) { - return false; - } - return Objects.equals(attachments, other.getAttachments()); + return Objects.equals(inReplyTo, other.getInReplyTo()); } @Override diff --git a/ccm-core/src/main/java/org/libreccm/portal/Portal.java b/ccm-core/src/main/java/org/libreccm/portal/Portal.java index b97bf5679..3d9ddecb8 100644 --- a/ccm-core/src/main/java/org/libreccm/portal/Portal.java +++ b/ccm-core/src/main/java/org/libreccm/portal/Portal.java @@ -85,7 +85,6 @@ public class Portal extends Resource implements Serializable { public int hashCode() { int hash = super.hashCode(); hash = 79 * hash + (template ? 1 : 0); - hash = 79 * hash + Objects.hashCode(portlets); return hash; } @@ -108,10 +107,7 @@ public class Portal extends Resource implements Serializable { return false; } - if (template != other.isTemplate()) { - return false; - } - return Objects.equals(portlets, other.getPortlets()); + return (template == other.isTemplate()); } @Override diff --git a/ccm-core/src/main/java/org/libreccm/runtime/Initalizer.java b/ccm-core/src/main/java/org/libreccm/runtime/Initalizer.java index 4cfcff0ad..d6ca77d2d 100644 --- a/ccm-core/src/main/java/org/libreccm/runtime/Initalizer.java +++ b/ccm-core/src/main/java/org/libreccm/runtime/Initalizer.java @@ -117,7 +117,6 @@ 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(requires); return hash; } @@ -140,11 +139,7 @@ public class Initalizer implements Serializable { if (!Objects.equals(className, other.getClassName())) { return false; } - if (!Objects.equals(requiredBy, other.getRequiredBy())) { - return false; - } - return Objects.equals(requires, - other.getRequires()); + return Objects.equals(requiredBy, other.getRequiredBy()); } public boolean canEqual(final Object obj) { diff --git a/ccm-core/src/main/java/org/libreccm/web/ApplicationType.java b/ccm-core/src/main/java/org/libreccm/web/ApplicationType.java new file mode 100644 index 000000000..0dc6c7535 --- /dev/null +++ b/ccm-core/src/main/java/org/libreccm/web/ApplicationType.java @@ -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 Jens Pelzetter + */ +@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 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 dependentApplicationTypes; + + public ApplicationType() { + super(); + + relevantPrivileges = new ArrayList<>(); + dependentApplicationTypes = new ArrayList<>(); + } + + public List getRelevantPrivileges() { + return Collections.unmodifiableList(relevantPrivileges); + } + + protected void setRelevantPrivileges( + final List 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 getDependentApplicationTypes() { + return Collections.unmodifiableList(dependentApplicationTypes); + } + + protected void setDependentApplicationTypes( + final List 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)); + } +} diff --git a/ccm-core/src/main/java/org/libreccm/workflow/Task.java b/ccm-core/src/main/java/org/libreccm/workflow/Task.java index 29c1dd705..2bfd45ea3 100644 --- a/ccm-core/src/main/java/org/libreccm/workflow/Task.java +++ b/ccm-core/src/main/java/org/libreccm/workflow/Task.java @@ -238,9 +238,6 @@ public class Task implements Serializable { hash = 79 * hash + (active ? 1 : 0); hash = 79 * hash + Objects.hashCode(taskState); 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; } @@ -277,16 +274,7 @@ public class Task implements Serializable { if (!Objects.equals(taskState, other.getTaskState())) { return false; } - if (!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()); + return Objects.equals(workflow, other.getWorkflow()); } public boolean canEqual(final Object obj) { diff --git a/ccm-core/src/main/java/org/libreccm/workflow/UserTask.java b/ccm-core/src/main/java/org/libreccm/workflow/UserTask.java index 7f32797b0..972adbec4 100644 --- a/ccm-core/src/main/java/org/libreccm/workflow/UserTask.java +++ b/ccm-core/src/main/java/org/libreccm/workflow/UserTask.java @@ -212,8 +212,6 @@ public class UserTask extends Task implements Serializable { hash = 37 * hash + (int) (durationMinutes ^ (durationMinutes >>> 32)); hash = 37 * hash + Objects.hashCode(notificationSender); - hash = 37 * hash + Objects.hashCode(assignedUsers); - hash = 37 * hash + Objects.hashCode(assignedGroups); return hash; } @@ -255,13 +253,7 @@ public class UserTask extends Task implements Serializable { if (durationMinutes != other.getDurationMinutes()) { return false; } - if (!Objects.equals(notificationSender, other.getNotificationSender())) { - return false; - } - if (!Objects.equals(assignedUsers, other.getAssignedUsers())) { - return false; - } - return Objects.equals(assignedGroups, other.getAssignedGroups()); + return Objects.equals(notificationSender, other.getNotificationSender()); } @Override diff --git a/ccm-core/src/main/java/org/libreccm/workflow/Workflow.java b/ccm-core/src/main/java/org/libreccm/workflow/Workflow.java index eb5b5fb67..d2d7948a9 100644 --- a/ccm-core/src/main/java/org/libreccm/workflow/Workflow.java +++ b/ccm-core/src/main/java/org/libreccm/workflow/Workflow.java @@ -130,7 +130,6 @@ public class Workflow implements Serializable { int hash = 5; hash = 79 * hash + (int) (this.workflowId ^ (this.workflowId >>> 32)); hash = 79 * hash + Objects.hashCode(this.name); - hash = 79 * hash + Objects.hashCode(this.tasks); return hash; } @@ -150,10 +149,8 @@ public class Workflow implements Serializable { if (this.workflowId != other.getWorkflowId()) { return false; } - if (!Objects.equals(this.name, other.getName())) { - return false; - } - return Objects.equals(this.tasks, other.getTasks()); + return Objects.equals(this.name, other.getName()); + } public boolean canEqual(final Object obj) { diff --git a/ccm-core/src/test/java/org/libreccm/core/EqualsAndHashCodeTest.java b/ccm-core/src/test/java/org/libreccm/core/EqualsAndHashCodeTest.java index e163353fd..a5421115a 100644 --- a/ccm-core/src/test/java/org/libreccm/core/EqualsAndHashCodeTest.java +++ b/ccm-core/src/test/java/org/libreccm/core/EqualsAndHashCodeTest.java @@ -26,6 +26,7 @@ import org.libreccm.tests.categories.UnitTest; import java.util.Arrays; import java.util.Collection; +import org.libreccm.web.ApplicationType; /** * @@ -45,6 +46,7 @@ public class EqualsAndHashCodeTest extends EqualsVerifier { Permission.class, PersonName.class, Privilege.class, + ResourceType.class, Role.class, User.class, Group.class}); diff --git a/ccm-core/src/test/java/org/libreccm/core/ToStringTest.java b/ccm-core/src/test/java/org/libreccm/core/ToStringTest.java index 2af5e44b2..5f502a490 100644 --- a/ccm-core/src/test/java/org/libreccm/core/ToStringTest.java +++ b/ccm-core/src/test/java/org/libreccm/core/ToStringTest.java @@ -26,6 +26,7 @@ import org.libreccm.tests.categories.UnitTest; import java.util.Arrays; import java.util.Collection; +import org.libreccm.web.ApplicationType; /** * @@ -38,6 +39,7 @@ public class ToStringTest extends ToStringVerifier { @Parameterized.Parameters(name = "{0}") public static Collection> data() { return Arrays.asList(new Class[]{ + ApplicationType.class, CcmObject.class, EmailAddress.class, GroupMembership.class, @@ -46,6 +48,7 @@ public class ToStringTest extends ToStringVerifier { PersonName.class, Privilege.class, Resource.class, + ResourceType.class, Role.class, User.class, Group.class}); diff --git a/ccm-core/src/test/java/org/libreccm/web/ApplicationTypeTest.java b/ccm-core/src/test/java/org/libreccm/web/ApplicationTypeTest.java new file mode 100644 index 000000000..78ccb3d53 --- /dev/null +++ b/ccm-core/src/test/java/org/libreccm/web/ApplicationTypeTest.java @@ -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 Jens Pelzetter + */ +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(); + + } +} diff --git a/ccm-shortcuts/src/main/java/org/libreccm/shortcuts/Shortcuts.java b/ccm-shortcuts/src/main/java/org/libreccm/shortcuts/Shortcuts.java index 9a64bbcac..677c12cbd 100644 --- a/ccm-shortcuts/src/main/java/org/libreccm/shortcuts/Shortcuts.java +++ b/ccm-shortcuts/src/main/java/org/libreccm/shortcuts/Shortcuts.java @@ -27,24 +27,24 @@ import org.libreccm.web.Application; * @author Jens Pelzetter */ @Entity -@Table(name = "shortcut_app") +@Table(name = "shortcuts_app") public class Shortcuts extends Application { private static final long serialVersionUID = -6793265996161649637L; - private String shortcutAppName; +// private String shortcutAppName; public Shortcuts() { super(); } - public String getShortcutAppName() { - return shortcutAppName; - } - - public void setShortcutAppName(final String shortcutAppName) { - this.shortcutAppName = shortcutAppName; - } - +// public String getShortcutAppName() { +// return shortcutAppName; +// } +// +// public void setShortcutAppName(final String shortcutAppName) { +// this.shortcutAppName = shortcutAppName; +// } +// }