CCM NG/ccm-cms: Added an order field for AttachmentList to order multiple AttachmentLists with the same name.

git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@4390 8810af33-2d31-482b-a856-94f89814c4df
pull/2/head
jensp 2016-10-18 17:36:58 +00:00
parent dded522313
commit 98b59e8f1f
6 changed files with 57 additions and 17 deletions

View File

@ -45,10 +45,10 @@ import javax.persistence.Table;
import static org.librecms.CmsConstants.*;
/**
* A list of assets attached a {@link ContentItem}. Each {@link ContentItem}
* may have multiple lists of attachments. Each list can be identified by name
* which can be used for example by the theme to determine the position where
* the list is printed.
* A list of assets attached a {@link ContentItem}. Each {@link ContentItem} may
* have multiple lists of attachments. Each list can be identified by name which
* can be used for example by the theme to determine the position where the list
* is printed.
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@ -86,6 +86,13 @@ public class AttachmentList implements Identifiable, Serializable {
@Column(name = "NAME")
private String name;
/**
* A order index for ordering multiple attachment lists with the same
* {@link #name}.
*/
@Column(name = "LIST_ORDER")
private long order;
/**
* The localised title of the list.
*/
@ -150,6 +157,14 @@ public class AttachmentList implements Identifiable, Serializable {
this.name = name;
}
public long getOrder() {
return order;
}
public void setOrder(final long order) {
this.order = order;
}
public LocalizedString getTitle() {
return title;
}
@ -192,6 +207,7 @@ public class AttachmentList implements Identifiable, Serializable {
hash = 29 * hash + (int) (listId ^ (listId >>> 32));
hash = 29 * hash + Objects.hashCode(uuid);
hash = 29 * hash + Objects.hashCode(name);
hash = 29 * hash + (int) (order ^ (order >>> 32));
hash = 29 * hash + Objects.hashCode(title);
hash = 29 * hash + Objects.hashCode(description);
hash = 29 * hash + Objects.hashCode(attachments);
@ -224,6 +240,9 @@ public class AttachmentList implements Identifiable, Serializable {
System.out.println("uuid is not equal");
return false;
}
if (order != other.getOrder()) {
return false;
}
if (!Objects.equals(name, other.getName())) {
System.out.println("name is not equal");
return false;
@ -257,6 +276,7 @@ public class AttachmentList implements Identifiable, Serializable {
+ "listId = %d, "
+ "uuid = %s, "
+ "name = \"%s\", "
+ "order = %d, "
+ "caption = { %s }, "
+ "description = { %s }, "
+ "attachments = { %s }%s"
@ -265,6 +285,7 @@ public class AttachmentList implements Identifiable, Serializable {
listId,
uuid,
name,
order,
Objects.toString(title),
Objects.toString(description),
Objects.toString(attachments),

View File

@ -123,6 +123,9 @@ alter table CCM_CMS.ATTACHMENT_LISTS
alter table CCM_CMS.ATTACHMENT_LISTS
add column ITEM_ID bigint;
alter table CCM_CMS.ATTACHMENT_LISTS
add column LIST_ORDER bigint;
alter table CCM_CMS.ATTACHMENT_LISTS_AUD
drop column ASSET_TYPE;
@ -132,6 +135,9 @@ alter table CCM_CMS.ATTACHMENT_LISTS_AUD
alter table CCM_CMS.ATTACHMENT_LISTS_AUD
add column ITEM_ID bigint;
alter table CCM_CMS.ATTACHMENT_LISTS_AUD
add column LIST_ORDER bigint;
alter table CCM_CMS.AUDIO_ASSETS
drop constraint FKa1m18ejmeknjiibvh2dac6tas;

View File

@ -123,6 +123,9 @@ alter table CCM_CMS.ATTACHMENT_LISTS
alter table CCM_CMS.ATTACHMENT_LISTS
add column ITEM_ID int8;
alter table CCM_CMS.ATTACHMENT_LISTS
add column LIST_ORDER int8;
alter table CCM_CMS.ATTACHMENT_LISTS_AUD
drop column ASSET_TYPE;
@ -132,6 +135,9 @@ alter table CCM_CMS.ATTACHMENT_LISTS_AUD
alter table CCM_CMS.ATTACHMENT_LISTS_AUD
add column ITEM_ID int8;
alter table CCM_CMS.ATTACHMENT_LISTS_AUD
add column LIST_ORDER int8;
alter table CCM_CMS.AUDIO_ASSETS
drop constraint FKa1m18ejmeknjiibvh2dac6tas;

View File

@ -106,6 +106,7 @@ create table CCM_CMS.ARTICLE_LEADS (
create table CCM_CMS.ATTACHMENT_LISTS (
LIST_ID bigint not null,
NAME varchar(255),
LIST_ORDER bigint,
UUID varchar(255),
ITEM_ID bigint,
CONTENT_ITEM_ID bigint,
@ -118,6 +119,7 @@ create table CCM_CMS.ARTICLE_LEADS (
REVTYPE tinyint,
REVEND integer,
NAME varchar(255),
LIST_ORDER bigint,
UUID varchar(255),
ITEM_ID bigint,
primary key (LIST_ID, REV)
@ -1381,10 +1383,10 @@ create table CCM_CMS.ARTICLE_LEADS (
CONFIGURATION_CLASS varchar(512) not null,
NAME varchar(512) not null,
SETTING_VALUE_BIG_DECIMAL decimal(19,2),
SETTING_VALUE_LONG bigint,
SETTING_VALUE_BOOLEAN boolean,
SETTING_VALUE_STRING varchar(1024),
SETTING_VALUE_DOUBLE double,
SETTING_VALUE_BOOLEAN boolean,
SETTING_VALUE_LONG bigint,
primary key (SETTING_ID)
);

View File

@ -6,6 +6,7 @@ DROP SEQUENCE IF EXISTS hibernate_sequence;
CREATE SCHEMA ccm_core;
CREATE SCHEMA ccm_cms;
create table CCM_CMS.ARTICLE_LEADS (
OBJECT_ID int8 not null,
LOCALIZED_VALUE text,
@ -106,6 +107,7 @@ create table CCM_CMS.ARTICLE_LEADS (
create table CCM_CMS.ATTACHMENT_LISTS (
LIST_ID int8 not null,
NAME varchar(255),
LIST_ORDER int8,
UUID varchar(255),
ITEM_ID int8,
CONTENT_ITEM_ID int8,
@ -118,6 +120,7 @@ create table CCM_CMS.ARTICLE_LEADS (
REVTYPE int2,
REVEND int4,
NAME varchar(255),
LIST_ORDER int8,
UUID varchar(255),
ITEM_ID int8,
primary key (LIST_ID, REV)
@ -1381,10 +1384,10 @@ create table CCM_CMS.ARTICLE_LEADS (
CONFIGURATION_CLASS varchar(512) not null,
NAME varchar(512) not null,
SETTING_VALUE_BIG_DECIMAL numeric(19, 2),
SETTING_VALUE_LONG int8,
SETTING_VALUE_BOOLEAN boolean,
SETTING_VALUE_STRING varchar(1024),
SETTING_VALUE_DOUBLE float8,
SETTING_VALUE_BOOLEAN boolean,
SETTING_VALUE_LONG int8,
primary key (SETTING_ID)
);

View File

@ -106,6 +106,7 @@ create table CCM_CMS.ARTICLE_LEADS (
create table CCM_CMS.ATTACHMENT_LISTS (
LIST_ID bigint not null,
NAME varchar(255),
LIST_ORDER bigint,
UUID varchar(255),
ITEM_ID bigint,
CONTENT_ITEM_ID bigint,
@ -118,6 +119,7 @@ create table CCM_CMS.ARTICLE_LEADS (
REVTYPE tinyint,
REVEND integer,
NAME varchar(255),
LIST_ORDER bigint,
UUID varchar(255),
ITEM_ID bigint,
primary key (LIST_ID, REV)
@ -1381,10 +1383,10 @@ create table CCM_CMS.ARTICLE_LEADS (
CONFIGURATION_CLASS varchar(512) not null,
NAME varchar(512) not null,
SETTING_VALUE_BIG_DECIMAL decimal(19,2),
SETTING_VALUE_LONG bigint,
SETTING_VALUE_BOOLEAN boolean,
SETTING_VALUE_STRING varchar(1024),
SETTING_VALUE_DOUBLE double,
SETTING_VALUE_BOOLEAN boolean,
SETTING_VALUE_LONG bigint,
primary key (SETTING_ID)
);