- Removed GenericArticle entity, not useful anymore
- DDL Scripts


git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@4186 8810af33-2d31-482b-a856-94f89814c4df
pull/2/head
jensp 2016-07-04 14:57:24 +00:00
parent 749fb1e2ae
commit 9166673585
13 changed files with 2379 additions and 2480 deletions

View File

@ -28,6 +28,7 @@ import java.util.List;
import java.util.Objects; import java.util.Objects;
import javax.persistence.AssociationOverride; import javax.persistence.AssociationOverride;
import javax.persistence.CollectionTable;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.ElementCollection; import javax.persistence.ElementCollection;
import javax.persistence.Embedded; import javax.persistence.Embedded;
@ -79,6 +80,12 @@ public class LegalMetadata extends Asset implements Serializable {
private String creator; private String creator;
@ElementCollection @ElementCollection
@CollectionTable(name = "LEGAL_METADATA_CONTRIBUTORS",
schema = DB_SCHEMA,
joinColumns = {
@JoinColumn(name = "LEGAL_METADATA_ID")
})
@Column(name ="CONTRIBUTORS")
private List<String> contributors; private List<String> contributors;
public LegalMetadata() { public LegalMetadata() {

View File

@ -20,9 +20,6 @@ package org.librecms.contentsection;
import org.hibernate.envers.Audited; import org.hibernate.envers.Audited;
import org.hibernate.envers.RelationTargetAuditMode; import org.hibernate.envers.RelationTargetAuditMode;
import static org.librecms.CmsConstants.*;
import org.libreccm.core.CcmObject; import org.libreccm.core.CcmObject;
import org.libreccm.l10n.LocalizedString; import org.libreccm.l10n.LocalizedString;
import org.librecms.attachments.AttachmentList; import org.librecms.attachments.AttachmentList;
@ -47,6 +44,8 @@ import javax.persistence.Table;
import javax.persistence.Temporal; import javax.persistence.Temporal;
import javax.persistence.TemporalType; import javax.persistence.TemporalType;
import static org.librecms.CmsConstants.*;
/** /**
* Base type for all content item types. Specifies some common properties. * Base type for all content item types. Specifies some common properties.
* *

View File

@ -19,9 +19,6 @@
package org.librecms.contentsection; package org.librecms.contentsection;
import org.libreccm.categorization.Category; import org.libreccm.categorization.Category;
import static org.librecms.CmsConstants.*;
import org.libreccm.security.Role; import org.libreccm.security.Role;
import org.libreccm.web.CcmApplication; import org.libreccm.web.CcmApplication;
@ -35,6 +32,8 @@ import javax.persistence.JoinColumn;
import javax.persistence.OneToOne; import javax.persistence.OneToOne;
import javax.persistence.Table; import javax.persistence.Table;
import static org.librecms.CmsConstants.*;
/** /**
* *
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a> * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>

View File

@ -51,7 +51,7 @@ public class ContentType extends CcmObject implements Serializable {
@Embedded @Embedded
@AssociationOverride( @AssociationOverride(
name = "VALUES", name = "values",
joinTable = @JoinTable(name = "CONTENT_TYPE_LABELS", joinTable = @JoinTable(name = "CONTENT_TYPE_LABELS",
schema = DB_SCHEMA, schema = DB_SCHEMA,
joinColumns = { joinColumns = {
@ -61,7 +61,7 @@ public class ContentType extends CcmObject implements Serializable {
@Embedded @Embedded
@AssociationOverride( @AssociationOverride(
name = "VALUES", name = "values",
joinTable = @JoinTable(name = "CONTENT_TYPE_DESCRIPTIONS", joinTable = @JoinTable(name = "CONTENT_TYPE_DESCRIPTIONS",
schema = DB_SCHEMA, schema = DB_SCHEMA,
joinColumns = { joinColumns = {

View File

@ -20,16 +20,20 @@ package org.librecms.contenttypes;
import java.io.Serializable; import java.io.Serializable;
import java.util.Objects; import java.util.Objects;
import javax.persistence.AssociationOverride; import javax.persistence.AssociationOverride;
import javax.persistence.Embedded; import javax.persistence.Embedded;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.JoinColumn; import javax.persistence.JoinColumn;
import javax.persistence.JoinTable; import javax.persistence.JoinTable;
import javax.persistence.Table; import javax.persistence.Table;
import org.hibernate.envers.Audited; import org.hibernate.envers.Audited;
import org.libreccm.l10n.LocalizedString; import org.libreccm.l10n.LocalizedString;
import static org.libreccm.core.CoreConstants.*; import static org.librecms.CmsConstants.*;
import org.librecms.contentsection.ContentItem;
/** /**
* @author <a href="mailto:konerman@tzi.de">Alexander Konermann</a> * @author <a href="mailto:konerman@tzi.de">Alexander Konermann</a>
@ -38,32 +42,32 @@ import static org.libreccm.core.CoreConstants.*;
@Entity @Entity
@Audited @Audited
@Table(name = "ARTICLES", schema = DB_SCHEMA) @Table(name = "ARTICLES", schema = DB_SCHEMA)
public class Article extends GenericArticle implements Serializable { public class Article extends ContentItem implements Serializable {
private static final long serialVersionUID = 3832010184748095822L; private static final long serialVersionUID = 3832010184748095822L;
@Embedded @Embedded
@AssociationOverride( @AssociationOverride(
name = "values", name = "values",
joinTable = @JoinTable(name = "ARTICLE_LEADS", joinTable = @JoinTable(name = "ARTICLE_TEXTS",
schema = DB_SCHEMA, schema = DB_SCHEMA,
joinColumns = { joinColumns = {
@JoinColumn(name = "OBJECT_ID")} @JoinColumn(name = "OBJECT_ID")}
)) ))
private LocalizedString lead; private LocalizedString text;
public LocalizedString getLead() { public LocalizedString getText() {
return lead; return text;
} }
public void setLead(final LocalizedString lead) { public void setText(final LocalizedString text) {
this.lead = lead; this.text = text;
} }
@Override @Override
public int hashCode() { public int hashCode() {
int hash = super.hashCode(); int hash = super.hashCode();
hash = 29 * hash + Objects.hashCode(lead); hash = 29 * hash + Objects.hashCode(text);
return hash; return hash;
} }
@ -87,7 +91,7 @@ public class Article extends GenericArticle implements Serializable {
return false; return false;
} }
return Objects.equals(lead, other.getLead()); return Objects.equals(text, other.getText());
} }
@Override @Override
@ -97,8 +101,8 @@ public class Article extends GenericArticle implements Serializable {
@Override @Override
public String toString(final String data) { public String toString(final String data) {
return super.toString(String.format(", lead = %s%s", return super.toString(String.format(", text = %s%s",
Objects.toString(lead), Objects.toString(text),
data)); data));
} }

View File

@ -21,6 +21,7 @@ package org.librecms.contenttypes;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import java.util.Objects; import java.util.Objects;
import javax.persistence.AssociationOverride; import javax.persistence.AssociationOverride;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Embedded; import javax.persistence.Embedded;
@ -30,12 +31,15 @@ import javax.persistence.JoinTable;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Temporal; import javax.persistence.Temporal;
import javax.persistence.TemporalType; import javax.persistence.TemporalType;
import org.hibernate.envers.Audited; import org.hibernate.envers.Audited;
import org.hibernate.validator.constraints.NotEmpty; import org.hibernate.validator.constraints.NotEmpty;
import org.libreccm.l10n.LocalizedString; import org.libreccm.l10n.LocalizedString;
import static org.libreccm.core.CoreConstants.*; import org.librecms.contentsection.ContentItem;
import static org.librecms.CmsConstants.*;
/** /**
* @author <a href="mailto:konerman@tzi.de">Alexander Konermann</a> * @author <a href="mailto:konerman@tzi.de">Alexander Konermann</a>
@ -44,7 +48,7 @@ import static org.libreccm.core.CoreConstants.*;
@Entity @Entity
@Audited @Audited
@Table(name = "EVENTS", schema = DB_SCHEMA) @Table(name = "EVENTS", schema = DB_SCHEMA)
public class Event extends GenericArticle implements Serializable { public class Event extends ContentItem implements Serializable {
private static final long serialVersionUID = -9104886733503414635L; private static final long serialVersionUID = -9104886733503414635L;
@ -54,12 +58,12 @@ public class Event extends GenericArticle implements Serializable {
@Embedded @Embedded
@AssociationOverride( @AssociationOverride(
name = "values", name = "values",
joinTable = @JoinTable(name = "EVENT_LEADS", joinTable = @JoinTable(name = "EVENT_TEXTS",
schema = DB_SCHEMA, schema = DB_SCHEMA,
joinColumns = { joinColumns = {
@JoinColumn(name = "OBJECT_ID")} @JoinColumn(name = "OBJECT_ID")}
)) ))
private LocalizedString lead; private LocalizedString text;
@Column(name = "START_DATE", nullable = false) @Column(name = "START_DATE", nullable = false)
@Temporal(TemporalType.DATE) @Temporal(TemporalType.DATE)
@ -75,7 +79,7 @@ public class Event extends GenericArticle implements Serializable {
*/ */
@Embedded @Embedded
@AssociationOverride( @AssociationOverride(
name = "VALUES", name = "values",
joinTable = @JoinTable(name = "EVENT_DATES", joinTable = @JoinTable(name = "EVENT_DATES",
schema = DB_SCHEMA, schema = DB_SCHEMA,
joinColumns = { joinColumns = {
@ -88,7 +92,7 @@ public class Event extends GenericArticle implements Serializable {
*/ */
@Embedded @Embedded
@AssociationOverride( @AssociationOverride(
name = "VALUES", name = "values",
joinTable = @JoinTable(name = "EVENT_LOCATIONS", joinTable = @JoinTable(name = "EVENT_LOCATIONS",
schema = DB_SCHEMA, schema = DB_SCHEMA,
joinColumns = { joinColumns = {
@ -101,7 +105,7 @@ public class Event extends GenericArticle implements Serializable {
*/ */
@Embedded @Embedded
@AssociationOverride( @AssociationOverride(
name = "VALUES", name = "values",
joinTable = @JoinTable(name = "EVENT_MAIN_CONTRIBUTORS", joinTable = @JoinTable(name = "EVENT_MAIN_CONTRIBUTORS",
schema = DB_SCHEMA, schema = DB_SCHEMA,
joinColumns = { joinColumns = {
@ -111,7 +115,7 @@ public class Event extends GenericArticle implements Serializable {
@Embedded @Embedded
@AssociationOverride( @AssociationOverride(
name = "VALUES", name = "values",
joinTable = @JoinTable(name = "EVENT_TYPES", joinTable = @JoinTable(name = "EVENT_TYPES",
schema = DB_SCHEMA, schema = DB_SCHEMA,
joinColumns = { joinColumns = {
@ -128,7 +132,7 @@ public class Event extends GenericArticle implements Serializable {
*/ */
@Embedded @Embedded
@AssociationOverride( @AssociationOverride(
name = "VALUES", name = "values",
joinTable = @JoinTable(name = "EVENT_COSTS", joinTable = @JoinTable(name = "EVENT_COSTS",
schema = DB_SCHEMA, schema = DB_SCHEMA,
joinColumns = { joinColumns = {
@ -136,28 +140,28 @@ public class Event extends GenericArticle implements Serializable {
)) ))
private LocalizedString cost; private LocalizedString cost;
public LocalizedString getLead() { public LocalizedString getText() {
return lead; return text;
} }
public void setLead(final LocalizedString lead) { public void setText(final LocalizedString text) {
this.lead = lead; this.text = text;
} }
public Date getStartDate() { public Date getStartDate() {
return startDate; return new Date(startDate.getTime());
} }
public void setStartDate(final Date startDate) { public void setStartDate(final Date startDate) {
this.startDate = startDate; this.startDate = new Date(startDate.getTime());
} }
public Date getEndDate() { public Date getEndDate() {
return endDate; return new Date(endDate.getTime());
} }
public void setEndDate(final Date endDate) { public void setEndDate(final Date endDate) {
this.endDate = endDate; this.endDate = new Date(endDate.getTime());
} }
public LocalizedString getEventDate() { public LocalizedString getEventDate() {
@ -211,7 +215,7 @@ public class Event extends GenericArticle implements Serializable {
@Override @Override
public int hashCode() { public int hashCode() {
int hash = super.hashCode(); int hash = super.hashCode();
hash = 97 * hash + Objects.hashCode(lead); hash = 97 * hash + Objects.hashCode(text);
hash = 97 * hash + Objects.hashCode(startDate); hash = 97 * hash + Objects.hashCode(startDate);
hash = 97 * hash + Objects.hashCode(endDate); hash = 97 * hash + Objects.hashCode(endDate);
hash = 97 * hash + Objects.hashCode(eventDate); hash = 97 * hash + Objects.hashCode(eventDate);
@ -245,7 +249,7 @@ public class Event extends GenericArticle implements Serializable {
if (!Objects.equals(mapLink, other.getMapLink())) { if (!Objects.equals(mapLink, other.getMapLink())) {
return false; return false;
} }
if (!Objects.equals(lead, other.getLead())) { if (!Objects.equals(text, other.getText())) {
return false; return false;
} }
if (!Objects.equals(startDate, other.getStartDate())) { if (!Objects.equals(startDate, other.getStartDate())) {
@ -276,7 +280,7 @@ public class Event extends GenericArticle implements Serializable {
@Override @Override
public String toString(final String data) { public String toString(final String data) {
return super.toString(String.format(", lead = %s, " return super.toString(String.format(", text = %s, "
+ "startDate = %tF %<tT, " + "startDate = %tF %<tT, "
+ "endDate = %tF %<tT, " + "endDate = %tF %<tT, "
+ "eventDate = %s, " + "eventDate = %s, "
@ -285,7 +289,7 @@ public class Event extends GenericArticle implements Serializable {
+ "eventType = %s, " + "eventType = %s, "
+ "mapLink = \"%s\", " + "mapLink = \"%s\", "
+ "cost = %s%s", + "cost = %s%s",
Objects.toString(lead), Objects.toString(text),
startDate, startDate,
endDate, endDate,
Objects.toString(eventDate), Objects.toString(eventDate),
@ -296,4 +300,5 @@ public class Event extends GenericArticle implements Serializable {
Objects.toString(cost), Objects.toString(cost),
data)); data));
} }
} }

View File

@ -1,102 +0,0 @@
/*
* 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.librecms.contenttypes;
import java.io.Serializable;
import java.util.Objects;
import javax.persistence.AssociationOverride;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.Table;
import org.hibernate.envers.Audited;
import org.librecms.contentsection.ContentItem;
import org.libreccm.l10n.LocalizedString;
import static org.libreccm.core.CoreConstants.*;
/**
* Base class for article like content items. These items usually contain a
* short introduction text (the description) and a longer text containing
* the more detailed content.
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@Entity
@Audited
@Table(name = "GENERIC_ARTICLES", schema = DB_SCHEMA)
public class GenericArticle extends ContentItem implements Serializable {
private static final long serialVersionUID = -6737443527969703121L;
@Embedded
@AssociationOverride(
name = "values",
joinTable = @JoinTable(name = "ARTICLE_TEXTS",
schema = DB_SCHEMA,
joinColumns = {
@JoinColumn(name = "OBJECT_ID")}
))
private LocalizedString text;
public LocalizedString getText() {
return text;
}
public void setText(final LocalizedString text) {
this.text = text;
}
@Override
public int hashCode() {
int hash = super.hashCode();
hash = 17 * hash + Objects.hashCode(text);
return hash;
}
@Override
public boolean equals(final Object obj) {
if (obj == null) {
return false;
}
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof GenericArticle)) {
return false;
}
final GenericArticle other = (GenericArticle) obj;
if(!other.canEqual(this)) {
return false;
}
return Objects.equals(text, other.getText());
}
@Override
public boolean canEqual(final Object obj) {
return obj instanceof GenericArticle;
}
}

View File

@ -18,8 +18,6 @@
*/ */
package org.librecms.contenttypes; package org.librecms.contenttypes;
import static org.libreccm.core.CoreConstants.*;
import org.hibernate.envers.Audited; import org.hibernate.envers.Audited;
import org.libreccm.l10n.LocalizedString; import org.libreccm.l10n.LocalizedString;
import org.librecms.contentsection.ContentItem; import org.librecms.contentsection.ContentItem;
@ -38,6 +36,8 @@ import javax.persistence.JoinTable;
import javax.persistence.OneToMany; import javax.persistence.OneToMany;
import javax.persistence.Table; import javax.persistence.Table;
import static org.librecms.CmsConstants.*;
/** /**
* *
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a> * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>

View File

@ -18,8 +18,6 @@
*/ */
package org.librecms.contenttypes; package org.librecms.contenttypes;
import static org.libreccm.core.CoreConstants.*;
import org.hibernate.envers.Audited; import org.hibernate.envers.Audited;
import org.libreccm.l10n.LocalizedString; import org.libreccm.l10n.LocalizedString;
@ -37,6 +35,8 @@ import javax.persistence.JoinColumn;
import javax.persistence.JoinTable; import javax.persistence.JoinTable;
import javax.persistence.Table; import javax.persistence.Table;
import static org.librecms.CmsConstants.*;
/** /**
* A section of a MultiPartArticle * A section of a MultiPartArticle
* *
@ -44,7 +44,7 @@ import javax.persistence.Table;
*/ */
@Entity @Entity
@Audited @Audited
@Table(name = "MULTIPART_ARTICLE_SECTIONS") @Table(name = "MULTIPART_ARTICLE_SECTIONS", schema = DB_SCHEMA)
public class MultiPartArticleSection implements Serializable { public class MultiPartArticleSection implements Serializable {
private static final long serialVersionUID = 1109186628988745920L; private static final long serialVersionUID = 1109186628988745920L;

View File

@ -18,9 +18,15 @@
*/ */
package org.librecms.contenttypes; package org.librecms.contenttypes;
import org.hibernate.envers.Audited;
import org.hibernate.validator.constraints.NotEmpty;
import org.libreccm.l10n.LocalizedString;
import org.librecms.contentsection.ContentItem;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import java.util.Objects; import java.util.Objects;
import javax.persistence.AssociationOverride; import javax.persistence.AssociationOverride;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Embedded; import javax.persistence.Embedded;
@ -30,11 +36,8 @@ import javax.persistence.JoinTable;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Temporal; import javax.persistence.Temporal;
import javax.persistence.TemporalType; import javax.persistence.TemporalType;
import org.hibernate.envers.Audited;
import org.hibernate.validator.constraints.NotEmpty;
import org.libreccm.l10n.LocalizedString;
import static org.libreccm.core.CoreConstants.*; import static org.librecms.CmsConstants.*;
/** /**
* @author <a href="mailto:konerman@tzi.de">Alexander Konermann</a> * @author <a href="mailto:konerman@tzi.de">Alexander Konermann</a>
@ -43,7 +46,7 @@ import static org.libreccm.core.CoreConstants.*;
@Entity @Entity
@Audited @Audited
@Table(name = "NEWS", schema = DB_SCHEMA) @Table(name = "NEWS", schema = DB_SCHEMA)
public class News extends GenericArticle implements Serializable { public class News extends ContentItem implements Serializable {
private static final long serialVersionUID = -4939565845920227974L; private static final long serialVersionUID = -4939565845920227974L;
@ -53,12 +56,12 @@ public class News extends GenericArticle implements Serializable {
@Embedded @Embedded
@AssociationOverride( @AssociationOverride(
name = "values", name = "values",
joinTable = @JoinTable(name = "NEWS_LEADS", joinTable = @JoinTable(name = "NEWS_TEXTS",
schema = DB_SCHEMA, schema = DB_SCHEMA,
joinColumns = { joinColumns = {
@JoinColumn(name = "OBJECT_ID")} @JoinColumn(name = "OBJECT_ID")}
)) ))
private LocalizedString lead; private LocalizedString text;
/** /**
* Release date of the news * Release date of the news
@ -76,12 +79,12 @@ public class News extends GenericArticle implements Serializable {
@NotEmpty @NotEmpty
private boolean homepage; private boolean homepage;
public LocalizedString getLead() { public LocalizedString getText() {
return lead; return text;
} }
public void setLead(final LocalizedString lead) { public void setText(final LocalizedString text) {
this.lead = lead; this.text = text;
} }
public Date getReleaseDate() { public Date getReleaseDate() {
@ -103,7 +106,7 @@ public class News extends GenericArticle implements Serializable {
@Override @Override
public int hashCode() { public int hashCode() {
int hash = super.hashCode(); int hash = super.hashCode();
hash = 11 * hash + Objects.hashCode(this.lead); hash = 11 * hash + Objects.hashCode(this.text);
hash = 11 * hash + Objects.hashCode(this.releaseDate); hash = 11 * hash + Objects.hashCode(this.releaseDate);
hash = 11 * hash + (this.homepage ? 1 : 0); hash = 11 * hash + (this.homepage ? 1 : 0);
return hash; return hash;
@ -130,7 +133,7 @@ public class News extends GenericArticle implements Serializable {
if (homepage != other.isHomepage()) { if (homepage != other.isHomepage()) {
return false; return false;
} }
if (!Objects.equals(lead, other.getLead())) { if (!Objects.equals(text, other.getText())) {
return false; return false;
} }
return Objects.equals(releaseDate, other.getReleaseDate()); return Objects.equals(releaseDate, other.getReleaseDate());
@ -143,10 +146,10 @@ public class News extends GenericArticle implements Serializable {
@Override @Override
public String toString(final String data) { public String toString(final String data) {
return super.toString(String.format(", lead = \"%s\", " return super.toString(String.format(", text = %s, "
+ "releaseDate = %tF %<tT, " + "releaseDate = %tF %<tT, "
+ "homepage = %b%d", + "homepage = %b%d",
Objects.toString(lead), Objects.toString(text),
releaseDate, releaseDate,
homepage, homepage,
data)); data));

View File

@ -34,12 +34,14 @@ import javax.persistence.Table;
import javax.persistence.Temporal; import javax.persistence.Temporal;
import javax.persistence.TemporalType; import javax.persistence.TemporalType;
import static org.librecms.CmsConstants.*;
/** /**
* *
* @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 = "LIFECYLE_PHASES") @Table(name = "LIFECYLE_PHASES", schema = DB_SCHEMA)
public class Phase implements Serializable { public class Phase implements Serializable {
private static final long serialVersionUID = -1683874069942019941L; private static final long serialVersionUID = -1683874069942019941L;