CCM NG: More entities for assets
git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@4185 8810af33-2d31-482b-a856-94f89814c4dfpull/2/head
parent
d01264b169
commit
749fb1e2ae
|
|
@ -32,6 +32,8 @@ import javax.persistence.Entity;
|
|||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Inheritance;
|
||||
import javax.persistence.InheritanceType;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.JoinTable;
|
||||
import javax.persistence.Table;
|
||||
|
|
@ -44,6 +46,7 @@ import static org.librecms.CmsConstants.*;
|
|||
*/
|
||||
@Entity
|
||||
@Table(schema = DB_SCHEMA, name = "ASSETS")
|
||||
@Inheritance(strategy = InheritanceType.JOINED)
|
||||
@Audited
|
||||
public class Asset implements Identifiable, Serializable {
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,98 @@
|
|||
/*
|
||||
* Copyright (C) 2016 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.assets;
|
||||
|
||||
import org.hibernate.envers.Audited;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.OneToOne;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import static org.librecms.CmsConstants.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "AUDIO_ASSETS", schema = DB_SCHEMA)
|
||||
@Audited
|
||||
public class AudioAsset extends BinaryAsset implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -2290028707028530325L;
|
||||
|
||||
@OneToOne
|
||||
@JoinColumn(name = "LEGAL_METADATA_ID")
|
||||
private LegalMetadata legalMetadata;
|
||||
|
||||
public LegalMetadata getLegalMetadata() {
|
||||
return legalMetadata;
|
||||
}
|
||||
|
||||
public void setLegalMetadata(final LegalMetadata legalMetadata) {
|
||||
this.legalMetadata = legalMetadata;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = super.hashCode();
|
||||
hash = 79 * hash + Objects.hashCode(legalMetadata);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (!super.equals(obj)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(obj instanceof AudioAsset)) {
|
||||
return false;
|
||||
}
|
||||
final AudioAsset other = (AudioAsset) obj;
|
||||
if (!other.canEqual(obj)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return Objects.equals(legalMetadata, other.getLegalMetadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canEqual(final Object obj) {
|
||||
return obj instanceof AudioAsset;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(final String data) {
|
||||
return super.toString(String.format(", legalMetadata = %s%s",
|
||||
Objects.toString(legalMetadata),
|
||||
data));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,97 @@
|
|||
/*
|
||||
* Copyright (C) 2016 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.assets;
|
||||
|
||||
import org.hibernate.envers.Audited;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.OneToOne;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import static org.librecms.CmsConstants.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "EXTERNAL_AUDIO_ASSETS", schema = DB_SCHEMA)
|
||||
@Audited
|
||||
public class ExternalAudioAsset extends Bookmark implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1190735204910197490L;
|
||||
|
||||
@OneToOne
|
||||
@JoinColumn(name = "LEGAL_METADATA_ID")
|
||||
private LegalMetadata legalMetadata;
|
||||
|
||||
public LegalMetadata getLegalMetadata() {
|
||||
return legalMetadata;
|
||||
}
|
||||
|
||||
public void setLegalMetadata(final LegalMetadata legalMetadata) {
|
||||
this.legalMetadata = legalMetadata;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = super.hashCode();
|
||||
hash = 23 * hash + Objects.hashCode(legalMetadata);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (!super.equals(obj)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(obj instanceof ExternalVideoAsset)) {
|
||||
return false;
|
||||
}
|
||||
final ExternalVideoAsset other = (ExternalVideoAsset) obj;
|
||||
if (!other.canEqual(this)) {
|
||||
return false;
|
||||
}
|
||||
return Objects.equals(legalMetadata, other.getLegalMetadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canEqual(final Object obj) {
|
||||
return obj instanceof ExternalVideoAsset;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(final String data) {
|
||||
return super.toString(String.format(", legalMetadata = %s%s",
|
||||
Objects.toString(legalMetadata),
|
||||
data));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,97 @@
|
|||
/*
|
||||
* Copyright (C) 2016 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.assets;
|
||||
|
||||
import org.hibernate.envers.Audited;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.OneToOne;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import static org.librecms.CmsConstants.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "EXTERNAL_VIDEO_ASSET", schema = DB_SCHEMA)
|
||||
@Audited
|
||||
public class ExternalVideoAsset extends Bookmark implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -2927375812188779049L;
|
||||
|
||||
@OneToOne
|
||||
@JoinColumn(name = "LEGAL_METADATA_ID")
|
||||
private LegalMetadata legalMetadata;
|
||||
|
||||
public LegalMetadata getLegalMetadata() {
|
||||
return legalMetadata;
|
||||
}
|
||||
|
||||
public void setLegalMetadata(final LegalMetadata legalMetadata) {
|
||||
this.legalMetadata = legalMetadata;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = super.hashCode();
|
||||
hash = 23 * hash + Objects.hashCode(legalMetadata);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (!super.equals(obj)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(obj instanceof ExternalVideoAsset)) {
|
||||
return false;
|
||||
}
|
||||
final ExternalVideoAsset other = (ExternalVideoAsset) obj;
|
||||
if (!other.canEqual(this)) {
|
||||
return false;
|
||||
}
|
||||
return Objects.equals(legalMetadata, other.getLegalMetadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canEqual(final Object obj) {
|
||||
return obj instanceof ExternalVideoAsset;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(final String data) {
|
||||
return super.toString(String.format(", legalMetadata = %s%s",
|
||||
Objects.toString(legalMetadata),
|
||||
data));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -20,15 +20,15 @@ package org.librecms.assets;
|
|||
|
||||
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.JoinColumn;
|
||||
import javax.persistence.JoinTable;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.hibernate.envers.Audited;
|
||||
import org.libreccm.l10n.LocalizedString;
|
||||
|
||||
import javax.persistence.OneToOne;
|
||||
|
||||
import static org.librecms.CmsConstants.*;
|
||||
|
||||
|
|
@ -49,21 +49,12 @@ public class Image extends BinaryAsset implements Serializable {
|
|||
@Column(name = "HEIGHT")
|
||||
private long height;
|
||||
|
||||
@Embedded
|
||||
@AssociationOverride(
|
||||
name = "values",
|
||||
joinTable = @JoinTable(name = "IMAGE_COPYRIGHT_NOTICES",
|
||||
schema = DB_SCHEMA,
|
||||
joinColumns = {
|
||||
@JoinColumn(name = "ASSET_ID")
|
||||
}
|
||||
)
|
||||
)
|
||||
private LocalizedString copyrightNotice;
|
||||
@OneToOne
|
||||
@JoinColumn(name = "LEGAL_METADATA_ID")
|
||||
private LegalMetadata legalMetadata;
|
||||
|
||||
public Image() {
|
||||
super();
|
||||
copyrightNotice = new LocalizedString();
|
||||
}
|
||||
|
||||
public long getWidth() {
|
||||
|
|
@ -82,12 +73,12 @@ public class Image extends BinaryAsset implements Serializable {
|
|||
this.height = height;
|
||||
}
|
||||
|
||||
public LocalizedString getCopyrightNotice() {
|
||||
return copyrightNotice;
|
||||
public LegalMetadata getLegalMetadata() {
|
||||
return legalMetadata;
|
||||
}
|
||||
|
||||
public void setCopyrightNotice(final LocalizedString copyrightNotice) {
|
||||
this.copyrightNotice = copyrightNotice;
|
||||
public void setLegalMetadata(final LegalMetadata legalMetadata) {
|
||||
this.legalMetadata = legalMetadata;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -95,7 +86,7 @@ public class Image extends BinaryAsset implements Serializable {
|
|||
int hash = super.hashCode();
|
||||
hash = 89 * hash + (int) (width ^ (width >>> 32));
|
||||
hash = 89 * hash + (int) (height ^ (height >>> 32));
|
||||
hash = 89 * hash + Objects.hashCode(copyrightNotice);
|
||||
hash = 89 * hash + Objects.hashCode(legalMetadata);
|
||||
return hash;
|
||||
}
|
||||
|
||||
|
|
@ -125,7 +116,7 @@ public class Image extends BinaryAsset implements Serializable {
|
|||
if (height != other.getHeight()) {
|
||||
return false;
|
||||
}
|
||||
return Objects.equals(copyrightNotice, other.getCopyrightNotice());
|
||||
return Objects.equals(legalMetadata, other.getLegalMetadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -137,10 +128,10 @@ public class Image extends BinaryAsset implements Serializable {
|
|||
public String toString(final String data) {
|
||||
return super.toString(String.format(", width = %d, "
|
||||
+ "height = %d, "
|
||||
+ "copyrightNotice = %s%s",
|
||||
+ "legalMetadata = %s%s",
|
||||
width,
|
||||
height,
|
||||
Objects.toString(copyrightNotice),
|
||||
Objects.toString(legalMetadata),
|
||||
data));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,202 @@
|
|||
/*
|
||||
* Copyright (C) 2016 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.assets;
|
||||
|
||||
import org.hibernate.envers.Audited;
|
||||
import org.libreccm.l10n.LocalizedString;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import javax.persistence.AssociationOverride;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.ElementCollection;
|
||||
import javax.persistence.Embedded;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.JoinTable;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import static org.librecms.CmsConstants.*;
|
||||
|
||||
/**
|
||||
* Container for storing legal metadata about a resource (a content item or an
|
||||
* other asset).
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "LEGAL_METADATA", schema = DB_SCHEMA)
|
||||
@Audited
|
||||
public class LegalMetadata extends Asset implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -5766376031105842907L;
|
||||
|
||||
/**
|
||||
* The person or organisation which holds the rights for the resource.
|
||||
*/
|
||||
@Column(name = "RIGHTS_HOLDER", length = 512)
|
||||
private String rightsHolder;
|
||||
|
||||
/**
|
||||
* Rights granted for the resource to us.
|
||||
*/
|
||||
@Embedded
|
||||
@AssociationOverride(
|
||||
name = "values",
|
||||
joinTable = @JoinTable(name = "LEGAL_METADATA_RIGHTS",
|
||||
schema = DB_SCHEMA,
|
||||
joinColumns = {
|
||||
@JoinColumn(name = "ASSET_ID")
|
||||
}
|
||||
)
|
||||
)
|
||||
private LocalizedString rights;
|
||||
|
||||
@Column(name = "PUBLISHER")
|
||||
private String publisher;
|
||||
|
||||
@Column(name = "CREATOR")
|
||||
private String creator;
|
||||
|
||||
@ElementCollection
|
||||
private List<String> contributors;
|
||||
|
||||
public LegalMetadata() {
|
||||
super();
|
||||
contributors = new ArrayList<>();
|
||||
}
|
||||
|
||||
public String getRightsHolder() {
|
||||
return rightsHolder;
|
||||
}
|
||||
|
||||
public void setRightsHolder(final String rightsHolder) {
|
||||
this.rightsHolder = rightsHolder;
|
||||
}
|
||||
|
||||
public LocalizedString getRights() {
|
||||
return rights;
|
||||
}
|
||||
|
||||
public void setRights(final LocalizedString rights) {
|
||||
this.rights = rights;
|
||||
}
|
||||
|
||||
public String getPublisher() {
|
||||
return publisher;
|
||||
}
|
||||
|
||||
public void setPublisher(final String publisher) {
|
||||
this.publisher = publisher;
|
||||
}
|
||||
|
||||
public String getCreator() {
|
||||
return creator;
|
||||
}
|
||||
|
||||
public void setCreator(final String creator) {
|
||||
this.creator = creator;
|
||||
}
|
||||
|
||||
public List<String> getContributors() {
|
||||
return Collections.unmodifiableList(contributors);
|
||||
}
|
||||
|
||||
public void setContributors(final List<String> contributors) {
|
||||
this.contributors = new ArrayList<>(contributors);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = super.hashCode();
|
||||
hash = 17 * hash + Objects.hashCode(rightsHolder);
|
||||
hash = 17 * hash + Objects.hashCode(rights);
|
||||
hash = 17 * hash + Objects.hashCode(publisher);
|
||||
hash = 17 * hash + Objects.hashCode(creator);
|
||||
hash = 17 * hash + Objects.hashCode(contributors);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (!super.equals(obj)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (obj instanceof LegalMetadata) {
|
||||
return false;
|
||||
}
|
||||
final LegalMetadata other = (LegalMetadata) obj;
|
||||
if (!other.canEqual(this)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!Objects.equals(rightsHolder, other.getRightsHolder())) {
|
||||
return false;
|
||||
}
|
||||
if (!Objects.equals(publisher, other.getPublisher())) {
|
||||
return false;
|
||||
}
|
||||
if (!Objects.equals(creator, other.getCreator())) {
|
||||
return false;
|
||||
}
|
||||
if (!Objects.equals(rights, other.getRights())) {
|
||||
return false;
|
||||
}
|
||||
return Objects.equals(contributors, other.getContributors());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canEqual(final Object obj) {
|
||||
return obj instanceof LegalMetadata;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(final String data) {
|
||||
final String contributorsStr;
|
||||
if (contributors == null) {
|
||||
contributorsStr = "";
|
||||
} else {
|
||||
contributorsStr = String.join(", ", contributors);
|
||||
}
|
||||
|
||||
return super.toString(String.format(", rightsHolder = \"%s\", "
|
||||
+ "rights = %s, "
|
||||
+ "publisher = \"%s\", "
|
||||
+ "creator = \"%s\", "
|
||||
+ "contributors = { }%s",
|
||||
rightsHolder,
|
||||
Objects.toString(rights),
|
||||
publisher,
|
||||
creator,
|
||||
contributorsStr,
|
||||
data));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,113 @@
|
|||
/*
|
||||
* Copyright (C) 2016 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.assets;
|
||||
|
||||
import org.hibernate.envers.Audited;
|
||||
import org.libreccm.l10n.LocalizedString;
|
||||
|
||||
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 static org.librecms.CmsConstants.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "NOTES", schema = DB_SCHEMA)
|
||||
@Audited
|
||||
public class Note extends Asset implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -4566222634780521726L;
|
||||
|
||||
@Embedded
|
||||
@AssociationOverride(
|
||||
name = "values",
|
||||
joinTable = @JoinTable(name = "NOTE_TEXTS",
|
||||
schema = DB_SCHEMA,
|
||||
joinColumns = {
|
||||
@JoinColumn(name = "ASSET_ID")
|
||||
}
|
||||
)
|
||||
)
|
||||
private LocalizedString text;
|
||||
|
||||
public Note() {
|
||||
super();
|
||||
text = new LocalizedString();
|
||||
}
|
||||
|
||||
public LocalizedString getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
public void setText(final LocalizedString text) {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = super.hashCode();
|
||||
hash = 11 * hash + Objects.hashCode(text);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (!super.equals(obj)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(obj instanceof Note)) {
|
||||
return false;
|
||||
}
|
||||
final Note other = (Note) obj;
|
||||
if (!other.canEqual(this)) {
|
||||
return false;
|
||||
}
|
||||
return Objects.equals(text, other.getText());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canEqual(final Object obj) {
|
||||
return obj instanceof Note;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(final String data) {
|
||||
return super.toString(String.format(", text = %s%s",
|
||||
Objects.toString(text),
|
||||
data));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,115 @@
|
|||
/*
|
||||
* Copyright (C) 2016 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.assets;
|
||||
|
||||
import org.hibernate.envers.Audited;
|
||||
import org.librecms.contentsection.ContentItem;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.OneToOne;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import static org.librecms.CmsConstants.*;
|
||||
|
||||
/**
|
||||
* An link to information related to a content item, either to an (external) URL
|
||||
* provided by an existing or new bookmark or to another content item. Can be
|
||||
* used as an attachment only.
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "RELATED_LINKS", schema = DB_SCHEMA)
|
||||
@Audited
|
||||
public class RelatedLink extends Asset implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 6933875117588667160L;
|
||||
|
||||
@OneToOne
|
||||
@JoinColumn(name = "TARGET_ITEM")
|
||||
private ContentItem targetItem;
|
||||
|
||||
@OneToOne
|
||||
@JoinColumn(name = "BOOKMARK_ID")
|
||||
private Bookmark bookmark;
|
||||
|
||||
public ContentItem getTargetItem() {
|
||||
return targetItem;
|
||||
}
|
||||
|
||||
public void setTargetItem(final ContentItem targetItem) {
|
||||
this.targetItem = targetItem;
|
||||
}
|
||||
|
||||
public Bookmark getBookmark() {
|
||||
return bookmark;
|
||||
}
|
||||
|
||||
public void setBookmark(final Bookmark bookmark) {
|
||||
this.bookmark = bookmark;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = super.hashCode();
|
||||
hash = 67 * hash + Objects.hashCode(targetItem);
|
||||
hash = 67 * hash + Objects.hashCode(bookmark);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final RelatedLink other = (RelatedLink) obj;
|
||||
if (!Objects.equals(targetItem, other.targetItem)) {
|
||||
return false;
|
||||
}
|
||||
if (!Objects.equals(bookmark, other.bookmark)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canEqual(final Object obj) {
|
||||
return obj instanceof RelatedLink;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(final String data) {
|
||||
return super.toString(String.format(", targetItem = %s,"
|
||||
+ "bookmark = %s%s",
|
||||
Objects.toString(targetItem),
|
||||
Objects.toString(bookmark),
|
||||
data));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -18,20 +18,116 @@
|
|||
*/
|
||||
package org.librecms.assets;
|
||||
|
||||
import org.hibernate.envers.Audited;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.OneToOne;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import static org.librecms.CmsConstants.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "VIDEO_ASSET", schema = DB_SCHEMA)
|
||||
@Audited
|
||||
public class VideoAsset extends BinaryAsset implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -4377789857099678289L;
|
||||
|
||||
@Column(name = "WIDTH")
|
||||
private long width;
|
||||
|
||||
@Column(name = "HEIGHT")
|
||||
private long height;
|
||||
|
||||
@OneToOne
|
||||
@JoinColumn(name = "LEGAL_METADATA_ID")
|
||||
private LegalMetadata legalMetadata;
|
||||
|
||||
public long getWidth() {
|
||||
return width;
|
||||
}
|
||||
|
||||
public void setWidth(final long width) {
|
||||
this.width = width;
|
||||
}
|
||||
|
||||
public long getHeight() {
|
||||
return height;
|
||||
}
|
||||
|
||||
public void setHeight(final long height) {
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
public LegalMetadata getLegalMetadata() {
|
||||
return legalMetadata;
|
||||
}
|
||||
|
||||
public void setLegalMetadata(final LegalMetadata legalMetadata) {
|
||||
this.legalMetadata = legalMetadata;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = super.hashCode();
|
||||
hash = 97 * hash + (int) (width ^ (width >>> 32));
|
||||
hash = 97 * hash + (int) (height ^ (height >>> 32));
|
||||
hash = 97 * hash + Objects.hashCode(legalMetadata);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (!super.equals(obj)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (obj instanceof VideoAsset) {
|
||||
return false;
|
||||
}
|
||||
final VideoAsset other = (VideoAsset) obj;
|
||||
if (!other.canEqual(obj)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (width != other.getWidth()) {
|
||||
return false;
|
||||
}
|
||||
if (height != other.getHeight()) {
|
||||
return false;
|
||||
}
|
||||
return Objects.equals(legalMetadata, other.getLegalMetadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canEqual(final Object obj) {
|
||||
return obj instanceof VideoAsset;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(final String data) {
|
||||
return super.toString(String.format(", width = %d, "
|
||||
+ "height = %d, "
|
||||
+ "legalMetadata = %s%s",
|
||||
width,
|
||||
height,
|
||||
Objects.toString(legalMetadata),
|
||||
data));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,8 +75,7 @@ public class Lifecycle implements Serializable {
|
|||
@JoinColumn(name = "DEFINITION_ID")
|
||||
private LifecycleDefinition definition;
|
||||
|
||||
@OneToMany(mappedBy = "LIFECYCLE")
|
||||
@JoinColumn(name = "LIFECYCLE_ID")
|
||||
@OneToMany(mappedBy = "lifecycle")
|
||||
private List<Phase> phases;
|
||||
|
||||
public Lifecycle() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue