CCM NG: Revised Im/Export system for entities in org.libreccm.categorization

git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@5707 8810af33-2d31-482b-a856-94f89814c4df
ccm-docs
jensp 2018-10-03 09:19:52 +00:00
parent 0d1a53b2d9
commit 869c46c856
26 changed files with 263 additions and 266 deletions

View File

@ -29,6 +29,9 @@ import java.util.Objects;
import static org.libreccm.core.CoreConstants.DB_SCHEMA; import static org.libreccm.core.CoreConstants.DB_SCHEMA;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import org.libreccm.imexport.Exportable;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
@ -52,6 +55,10 @@ import javax.persistence.Table;
@Entity @Entity
@Table(name = "CATEGORIZATIONS", schema = DB_SCHEMA) @Table(name = "CATEGORIZATIONS", schema = DB_SCHEMA)
@NamedQueries({ @NamedQueries({
@NamedQuery(
name = "Categorization.findByUuid",
query = "SELECT c FROM Categorization c WHERE c.uuid = :uuid"
),
@NamedQuery( @NamedQuery(
name = "Categorization.find", name = "Categorization.find",
query = "SELECT c FROM Categorization c " query = "SELECT c FROM Categorization c "
@ -94,9 +101,9 @@ import javax.persistence.Table;
+ "WHERE c.category = :category " + "WHERE c.category = :category "
+ "AND c.indexObject = TRUE") + "AND c.indexObject = TRUE")
}) })
@JsonIdentityInfo(generator = CategorizationIdGenerator.class, @JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class,
property = "customCatId") property = "uuid")
public class Categorization implements Serializable, Relation, Portable { public class Categorization implements Serializable, Relation, Exportable {
private static final long serialVersionUID = 201504301320L; private static final long serialVersionUID = 201504301320L;
@ -108,6 +115,9 @@ public class Categorization implements Serializable, Relation, Portable {
@GeneratedValue(strategy = GenerationType.AUTO) @GeneratedValue(strategy = GenerationType.AUTO)
private long categorizationId; private long categorizationId;
@Column(name = "UUID", unique = true, nullable = false)
private String uuid;
/** /**
* The category to which this {@code Categorization} object belongs. * The category to which this {@code Categorization} object belongs.
*/ */
@ -126,7 +136,7 @@ public class Categorization implements Serializable, Relation, Portable {
/** /**
* If the categorised object is the indexObject object of the category this * If the categorised object is the indexObject object of the category this
property is set to {@code true}. * property is set to {@code true}.
*/ */
@Column(name = "CATEGORY_INDEX") @Column(name = "CATEGORY_INDEX")
private boolean indexObject; private boolean indexObject;
@ -166,6 +176,15 @@ public class Categorization implements Serializable, Relation, Portable {
this.categorizationId = categorizationId; this.categorizationId = categorizationId;
} }
@Override
public String getUuid() {
return uuid;
}
protected void setUuid(final String uuid) {
this.uuid = uuid;
}
public Category getCategory() { public Category getCategory() {
return category; return category;
} }
@ -195,7 +214,6 @@ public class Categorization implements Serializable, Relation, Portable {
// public boolean getIndex() { // public boolean getIndex() {
// return indexObject; // return indexObject;
// } // }
public boolean isIndexObject() { public boolean isIndexObject() {
return indexObject; return indexObject;
} }

View File

@ -1,70 +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.libreccm.categorization;
import com.fasterxml.jackson.annotation.ObjectIdGenerator;
/**
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers</a>
* @version created on 3/23/17
*/
public class CategorizationIdGenerator extends ObjectIdGenerator<String> {
private static final long serialVersionUID = 3013739402534056286L;
@Override
public Class<?> getScope() {
return Categorization.class;
}
@Override
public boolean canUseFor(ObjectIdGenerator<?> gen) {
return gen instanceof CategorizationIdGenerator;
}
@Override
public ObjectIdGenerator<String> forScope(Class<?> scope) {
return this;
}
@Override
public ObjectIdGenerator<String> newForSerialization(Object context) {
return this;
}
@Override
public IdKey key(Object key) {
if (key == null)
return null;
return new IdKey(Categorization.class, Categorization.class, key);
}
@Override
public String generateId(Object forPojo) {
if (!(forPojo instanceof Categorization)) {
throw new IllegalArgumentException(
"Only Categorization instances are supported.");
}
final Categorization categorization = (Categorization) forPojo;
return String.format("{%s}{%s}",
categorization.getCategory().getUuid(),
categorization.getCategorizedObject().getUuid());
}
}

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2015 LibreCCM Foundation. * Copyright (C) 2018 LibreCCM Foundation.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,37 +18,37 @@
*/ */
package org.libreccm.categorization; package org.libreccm.categorization;
import org.libreccm.portation.AbstractMarshaller; import org.libreccm.imexport.AbstractEntityImExporter;
import org.libreccm.portation.Marshals; import org.libreccm.imexport.DependsOn;
import org.libreccm.imexport.Processes;
import javax.enterprise.context.RequestScoped;
import javax.inject.Inject; import javax.inject.Inject;
import javax.persistence.EntityManager; import javax.persistence.EntityManager;
import javax.transaction.Transactional;
/** /**
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a> *
* @version created the 8/23/17 * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/ */
@RequestScoped @Processes(Categorization.class)
@Marshals(DomainOwnership.class) @DependsOn({Category.class})
public class DomainOwnershipMarshaller extends AbstractMarshaller<DomainOwnership> { public class CategorizationImExporter
extends AbstractEntityImExporter<Categorization> {
private static final long serialVersionUID = 6743023023790517330L;
@Inject @Inject
private EntityManager entityManager; private EntityManager entityManager;
@Override @Override
protected Class<DomainOwnership> getObjectClass() { protected Class<Categorization> getEntityClass() {
return DomainOwnership.class;
return Categorization.class;
} }
@Override @Override
protected void insertIntoDb(DomainOwnership portableObject) { @Transactional(Transactional.TxType.REQUIRED)
if (portableObject.getOwnershipId() == 0) { protected void saveImportedEntity(final Categorization entity) {
entityManager.persist(portableObject);
} else { entityManager.persist(entity);
entityManager.merge(portableObject);
}
} }
} }

View File

@ -41,6 +41,8 @@ import java.util.Objects;
import static org.libreccm.categorization.CategorizationConstants.CAT_XML_NS; import static org.libreccm.categorization.CategorizationConstants.CAT_XML_NS;
import static org.libreccm.core.CoreConstants.DB_SCHEMA; import static org.libreccm.core.CoreConstants.DB_SCHEMA;
import org.libreccm.imexport.Exportable;
import javax.persistence.AssociationOverride; import javax.persistence.AssociationOverride;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Embedded; import javax.persistence.Embedded;
@ -148,7 +150,7 @@ import javax.persistence.Table;
@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, @JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class,
resolver = CategoryIdResolver.class, resolver = CategoryIdResolver.class,
property = "uuid") property = "uuid")
public class Category extends CcmObject implements Serializable, Portable { public class Category extends CcmObject implements Serializable, Exportable {
private static final long serialVersionUID = -7250208963391878547L; private static final long serialVersionUID = -7250208963391878547L;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2015 LibreCCM Foundation. * Copyright (C) 2018 LibreCCM Foundation.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,35 +18,37 @@
*/ */
package org.libreccm.categorization; package org.libreccm.categorization;
import org.libreccm.portation.AbstractMarshaller; import org.libreccm.imexport.AbstractEntityImExporter;
import org.libreccm.portation.Marshals; import org.libreccm.imexport.DependsOn;
import org.libreccm.imexport.Processes;
import javax.enterprise.context.RequestScoped; import javax.enterprise.context.RequestScoped;
import javax.inject.Inject; import javax.inject.Inject;
import javax.transaction.Transactional; import javax.transaction.Transactional;
import java.io.Serializable;
/** /**
* @author <a href="mailto:tosmers@uni-bremen.de">Tobias Osmers</a> *
* @version created on 11/7/16 * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/ */
@RequestScoped @RequestScoped
@Marshals(Category.class) @Processes(Category.class)
public class CategoryMarshaller extends AbstractMarshaller<Category> { @DependsOn({Domain.class})
public class CategoryImExporter extends AbstractEntityImExporter<Category> {
private static final long serialVersionUID = -9089135773302229477L;
@Inject @Inject
private CategoryRepository categoryRepository; private CategoryRepository categoryRepository;
@Override @Override
protected Class<Category> getObjectClass() { protected Class<Category> getEntityClass() {
return Category.class; return Category.class;
} }
@Override @Override
@Transactional(Transactional.TxType.REQUIRED) @Transactional(Transactional.TxType.REQUIRED)
protected void insertIntoDb(Category portableObject) { protected void saveImportedEntity(final Category entity) {
categoryRepository.save(portableObject);
categoryRepository.save(entity);
} }
} }

View File

@ -44,6 +44,7 @@ import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.Optional; import java.util.Optional;
import java.util.StringJoiner; import java.util.StringJoiner;
import java.util.UUID;
/** /**
* The {@code CategoryManager} provides several helper methods for managing * The {@code CategoryManager} provides several helper methods for managing
@ -138,6 +139,7 @@ public class CategoryManager implements Serializable {
category.getObjectId()))); category.getObjectId())));
final Categorization categorization = new Categorization(); final Categorization categorization = new Categorization();
categorization.setUuid(UUID.randomUUID().toString());
categorization.setCategorizedObject(object); categorization.setCategorizedObject(object);
categorization.setCategory(assignedCategory); categorization.setCategory(assignedCategory);

View File

@ -41,6 +41,8 @@ import java.io.Serializable;
import static org.libreccm.categorization.CategorizationConstants.CAT_XML_NS; import static org.libreccm.categorization.CategorizationConstants.CAT_XML_NS;
import static org.libreccm.core.CoreConstants.DB_SCHEMA; import static org.libreccm.core.CoreConstants.DB_SCHEMA;
import org.libreccm.imexport.Exportable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Date; import java.util.Date;
@ -123,7 +125,7 @@ import javax.persistence.TemporalType;
@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, @JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class,
resolver = DomainIdResolver.class, resolver = DomainIdResolver.class,
property = "uuid") property = "uuid")
public class Domain extends CcmObject implements Serializable, Portable { public class Domain extends CcmObject implements Serializable, Exportable {
private static final long serialVersionUID = 4012590760598188732L; private static final long serialVersionUID = 4012590760598188732L;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2015 LibreCCM Foundation. * Copyright (C) 2018 LibreCCM Foundation.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,33 +18,35 @@
*/ */
package org.libreccm.categorization; package org.libreccm.categorization;
import org.libreccm.portation.AbstractMarshaller; import org.libreccm.imexport.AbstractEntityImExporter;
import org.libreccm.portation.Marshals; import org.libreccm.imexport.Processes;
import javax.enterprise.context.RequestScoped; import javax.enterprise.context.RequestScoped;
import javax.inject.Inject; import javax.inject.Inject;
import java.io.Serializable;
/** /**
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a> *
* @version created the 8/22/17 * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/ */
@RequestScoped @RequestScoped
@Marshals(Domain.class) @Processes(Domain.class)
public class DomainMarshaller extends AbstractMarshaller<Domain> { public class DomainImExporter extends AbstractEntityImExporter<Domain> {
private static final long serialVersionUID = -2435714410695539890L;
@Inject @Inject
private DomainRepository domainRepository; private DomainRepository domainRepository;
@Override @Override
protected Class<Domain> getObjectClass() { protected Class<Domain> getEntityClass() {
return Domain.class; return Domain.class;
} }
@Override @Override
protected void insertIntoDb(Domain portableObject) { protected void saveImportedEntity(final Domain entity) {
domainRepository.save(portableObject);
domainRepository.save(entity);
} }
} }

View File

@ -28,9 +28,11 @@ import javax.inject.Inject;
import javax.persistence.EntityManager; import javax.persistence.EntityManager;
import javax.persistence.TypedQuery; import javax.persistence.TypedQuery;
import javax.transaction.Transactional; import javax.transaction.Transactional;
import java.io.Serializable; import java.io.Serializable;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
import java.util.UUID;
/** /**
* Provides several methods when managing the relations between {@link Domain}s * Provides several methods when managing the relations between {@link Domain}s
@ -103,6 +105,7 @@ public class DomainManager implements Serializable {
public void addDomainOwner(final CcmApplication application, public void addDomainOwner(final CcmApplication application,
final Domain domain) { final Domain domain) {
final DomainOwnership ownership = new DomainOwnership(); final DomainOwnership ownership = new DomainOwnership();
ownership.setUuid(UUID.randomUUID().toString());
ownership.setDomain(domain); ownership.setDomain(domain);
ownership.setOwner(application); ownership.setOwner(application);
ownership.setOwnerOrder(domain.getOwners().size() + 1); ownership.setOwnerOrder(domain.getOwners().size() + 1);

View File

@ -21,15 +21,28 @@ package org.libreccm.categorization;
import com.fasterxml.jackson.annotation.JsonIdentityInfo; import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.JsonIdentityReference; import com.fasterxml.jackson.annotation.JsonIdentityReference;
import org.libreccm.core.CcmObject; import org.libreccm.core.CcmObject;
import org.libreccm.portation.Portable;
import org.libreccm.web.CcmApplication; import org.libreccm.web.CcmApplication;
import javax.persistence.*;
import java.io.Serializable; import java.io.Serializable;
import java.util.Objects; import java.util.Objects;
import static org.libreccm.core.CoreConstants.DB_SCHEMA; import static org.libreccm.core.CoreConstants.DB_SCHEMA;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import org.libreccm.core.CoreConstants;
import org.libreccm.imexport.Exportable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlElement;
/** /**
* Association class for the association between a {@link Domain} and a * Association class for the association between a {@link Domain} and a
* {@link CcmObject}. Instances of this class should not be created manually. * {@link CcmObject}. Instances of this class should not be created manually.
@ -41,14 +54,19 @@ import static org.libreccm.core.CoreConstants.DB_SCHEMA;
@Entity @Entity
@Table(name = "DOMAIN_OWNERSHIPS", schema = DB_SCHEMA) @Table(name = "DOMAIN_OWNERSHIPS", schema = DB_SCHEMA)
@NamedQueries({ @NamedQueries({
@NamedQuery(
name = "DomainOwnership.findByUuid",
query = "SELECT o FROM DomainOwnership o WHERE o.uuid = :uuid"
)
,
@NamedQuery( @NamedQuery(
name = "DomainOwnership.findByOwnerAndDomain", name = "DomainOwnership.findByOwnerAndDomain",
query = "SELECT o FROM DomainOwnership o " query = "SELECT o FROM DomainOwnership o "
+ "WHERE o.owner = :owner AND o.domain = :domain") + "WHERE o.owner = :owner AND o.domain = :domain")
}) })
@JsonIdentityInfo(generator = DomainOwnershipIdGenerator.class, @JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class,
property = "customOwnId") property = "uuid")
public class DomainOwnership implements Serializable, Portable { public class DomainOwnership implements Serializable, Exportable {
private static final long serialVersionUID = 201504301305L; private static final long serialVersionUID = 201504301305L;
@ -60,6 +78,10 @@ public class DomainOwnership implements Serializable, Portable {
@GeneratedValue(strategy = GenerationType.AUTO) @GeneratedValue(strategy = GenerationType.AUTO)
private long ownershipId; private long ownershipId;
@Column(name = "UUID", unique = true, nullable = false)
@XmlElement(name = "uuid", namespace = CoreConstants.CORE_XML_NS)
private String uuid;
/** /**
* The {@link Domain} owned by the {@link CcmObject}. * The {@link Domain} owned by the {@link CcmObject}.
*/ */
@ -102,6 +124,15 @@ public class DomainOwnership implements Serializable, Portable {
this.ownershipId = ownershipId; this.ownershipId = ownershipId;
} }
@Override
public String getUuid() {
return uuid;
}
protected void setUuid(final String uuid) {
this.uuid = uuid;
}
public CcmApplication getOwner() { public CcmApplication getOwner() {
return owner; return owner;
} }

View File

@ -1,71 +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.libreccm.categorization;
import com.fasterxml.jackson.annotation.ObjectIdGenerator;
/**
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers<\a>
* @version created the 8/10/17
*/
public class DomainOwnershipIdGenerator extends ObjectIdGenerator<String> {
private static final long serialVersionUID = -5651368736214980681L;
@Override
public Class<?> getScope() {
return DomainOwnership.class;
}
@Override
public boolean canUseFor(ObjectIdGenerator<?> objectIdGenerator) {
return objectIdGenerator instanceof DomainOwnershipIdGenerator;
}
@Override
public ObjectIdGenerator<String> forScope(Class<?> aClass) {
return this;
}
@Override
public ObjectIdGenerator<String> newForSerialization(Object o) {
return this;
}
@Override
public IdKey key(Object key) {
if (key == null)
return null;
return new IdKey(DomainOwnership.class, DomainOwnership.class, key);
}
@Override
public String generateId(Object forPojo) {
if (!(forPojo instanceof DomainOwnership)) {
throw new IllegalArgumentException(
"Only DomainOwnerships instances are supported.");
}
final DomainOwnership domainOwnership = (DomainOwnership) forPojo;
return String.format("{%s}{%s}",
domainOwnership.getDomain().getDomainKey(),
domainOwnership.getOwner().getPrimaryUrl());
}
}

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2015 LibreCCM Foundation. * Copyright (C) 2018 LibreCCM Foundation.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,40 +18,40 @@
*/ */
package org.libreccm.categorization; package org.libreccm.categorization;
import org.libreccm.portation.AbstractMarshaller; import org.libreccm.imexport.AbstractEntityImExporter;
import org.libreccm.portation.Marshals; import org.libreccm.imexport.DependsOn;
import org.libreccm.imexport.Processes;
import org.libreccm.web.CcmApplication;
import javax.enterprise.context.RequestScoped; import javax.enterprise.context.RequestScoped;
import javax.inject.Inject; import javax.inject.Inject;
import javax.persistence.EntityManager; import javax.persistence.EntityManager;
import javax.transaction.Transactional; import javax.transaction.Transactional;
import java.io.Serializable;
/** /**
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers</a> *
* @version created on 11/7/16 * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/ */
@RequestScoped @RequestScoped
@Marshals(Categorization.class) @Processes(DomainOwnership.class)
public class CategorizationMarshaller extends AbstractMarshaller<Categorization> { @DependsOn({CcmApplication.class, Domain.class})
public class DomainOwnershipImExporter
private static final long serialVersionUID = -4388218720510005447L; extends AbstractEntityImExporter<DomainOwnership>{
@Inject @Inject
private EntityManager entityManager; private EntityManager entityManager;
@Override @Override
protected Class<Categorization> getObjectClass() { protected Class<DomainOwnership> getEntityClass() {
return Categorization.class;
return DomainOwnership.class;
} }
@Override @Override
@Transactional(Transactional.TxType.REQUIRED) @Transactional(Transactional.TxType.REQUIRED)
protected void insertIntoDb(Categorization portableObject) { protected void saveImportedEntity(final DomainOwnership entity) {
if (portableObject.getCategorizationId() == 0) {
entityManager.persist(portableObject); entityManager.persist(entity);
} else {
entityManager.merge(portableObject);
}
} }
} }

View File

@ -29,6 +29,8 @@ import java.io.Serializable;
import static org.libreccm.core.CoreConstants.DB_SCHEMA; import static org.libreccm.core.CoreConstants.DB_SCHEMA;
import org.libreccm.imexport.Exportable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Date; import java.util.Date;
@ -73,7 +75,7 @@ import javax.persistence.TemporalType;
@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, @JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class,
resolver = ResourceIdResolver.class, resolver = ResourceIdResolver.class,
property = "uuid") property = "uuid")
public class Resource extends CcmObject implements Serializable { public class Resource extends CcmObject implements Serializable, Exportable {
private static final long serialVersionUID = 7345482620613842781L; private static final long serialVersionUID = 7345482620613842781L;

View File

@ -41,6 +41,8 @@ import java.util.Objects;
import static org.libreccm.core.CoreConstants.DB_SCHEMA; import static org.libreccm.core.CoreConstants.DB_SCHEMA;
import static org.libreccm.web.WebConstants.WEB_XML_NS; import static org.libreccm.web.WebConstants.WEB_XML_NS;
import org.libreccm.imexport.Exportable;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.NamedAttributeNode; import javax.persistence.NamedAttributeNode;
@ -79,7 +81,7 @@ import javax.persistence.Table;
@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, @JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class,
resolver = ApplicationIdResolver.class, resolver = ApplicationIdResolver.class,
property = "uuid") property = "uuid")
public class CcmApplication extends Resource implements Serializable, Portable { public class CcmApplication extends Resource implements Serializable, Portable, Exportable {
private static final long serialVersionUID = 9205226362368890784L; private static final long serialVersionUID = 9205226362368890784L;

View File

@ -0,0 +1,8 @@
alter table CCM_CORE.DOMAIN_OWNERSHIPS
add column UUID varchar(255) not null;
alter table CCM_CORE.DOMAIN_OWNERSHIPS
add constraint UK_j86gai9740v9hshascbsboudb unique (UUID);

View File

@ -0,0 +1,9 @@
alter table CCM_CORE.CATEGORIZATIONS
add column UUID varchar(255) not null;
alter table CCM_CORE.CATEGORIZATIONS
add constraint UK_da7jus3wn1tr8poyaw9btxbrc unique (UUID);

View File

@ -0,0 +1,8 @@
alter table CCM_CORE.DOMAIN_OWNERSHIPS
add column UUID varchar(255) not null;
alter table CCM_CORE.DOMAIN_OWNERSHIPS
add constraint UK_j86gai9740v9hshascbsboudb unique (UUID);

View File

@ -0,0 +1,9 @@
alter table CCM_CORE.CATEGORIZATIONS
add column UUID varchar(255) not null;
alter table CCM_CORE.CATEGORIZATIONS
add constraint UK_da7jus3wn1tr8poyaw9btxbrc unique (UUID);

View File

@ -55,18 +55,21 @@ ccm_core.category_domains:
ccm_core.categorizations: ccm_core.categorizations:
- categorization_id: -10000 - categorization_id: -10000
uuid: 5ace8dbb-2e8a-4bf6-932a-22591be326bf
category_id: -2100 category_id: -2100
object_id: -3100 object_id: -3100
object_order: 1 object_order: 1
category_order: 1 category_order: 1
category_index: false category_index: false
- categorization_id: -10100 - categorization_id: -10100
uuid: 50780558-5851-4eb2-8398-460173507a1b
category_id: -2200 category_id: -2200
object_id: -3300 object_id: -3300
category_order: 1 category_order: 1
object_order: 1 object_order: 1
category_index: true category_index: true
- categorization_id: -10200 - categorization_id: -10200
uuid: 05014503-0763-41e3-883c-461721beee6f
object_id: -3200 object_id: -3200
category_id: -2100 category_id: -2100
category_order: 1 category_order: 1

View File

@ -66,12 +66,14 @@ ccm_core.category_domains:
ccm_core.categorizations: ccm_core.categorizations:
- categorization_id: -10000 - categorization_id: -10000
uuid: 5ace8dbb-2e8a-4bf6-932a-22591be326bf
category_id: -2100 category_id: -2100
object_id: -3100 object_id: -3100
object_order: 1 object_order: 1
category_order: 1 category_order: 1
category_index: false category_index: false
- categorization_id: -10100 - categorization_id: -10100
uuid: 50780558-5851-4eb2-8398-460173507a1b
category_id: -2200 category_id: -2200
object_id: -3300 object_id: -3300
category_order: 1 category_order: 1

View File

@ -99,12 +99,14 @@ ccm_core.category_domains:
ccm_core.categorizations: ccm_core.categorizations:
- categorization_id: -10000 - categorization_id: -10000
uuid: 5ace8dbb-2e8a-4bf6-932a-22591be326bf
category_id: -2100 category_id: -2100
object_id: -3100 object_id: -3100
object_order: 1 object_order: 1
category_order: 1 category_order: 1
category_index: false category_index: false
- categorization_id: -10100 - categorization_id: -10100
uuid: 50780558-5851-4eb2-8398-460173507a1b
category_id: -2200 category_id: -2200
object_id: -3300 object_id: -3300
category_order: 1 category_order: 1

View File

@ -54,9 +54,10 @@ ccm_core.category_domains:
version: 1.0 version: 1.0
ccm_core.categorizations: ccm_core.categorizations:
- categorization_id: -10100 - categorization_id: -10000
category_id: -2200 uuid: 5ace8dbb-2e8a-4bf6-932a-22591be326bf
object_id: -3300 category_id: -2100
category_order: 1 object_id: -3100
object_order: 1 object_order: 1
category_index: true category_order: 1
category_index: false

View File

@ -54,12 +54,14 @@ ccm_core.category_domains:
ccm_core.categorizations: ccm_core.categorizations:
- categorization_id: -10000 - categorization_id: -10000
uuid: 5ace8dbb-2e8a-4bf6-932a-22591be326bf
category_id: -2100 category_id: -2100
object_id: -3100 object_id: -3100
object_order: 1 object_order: 1
category_order: 1 category_order: 1
category_index: false category_index: false
- categorization_id: -10100 - categorization_id: -10100
uuid: 50780558-5851-4eb2-8398-460173507a1b
category_id: -2200 category_id: -2200
object_id: -3300 object_id: -3300
category_order: 1 category_order: 1

View File

@ -55,12 +55,14 @@ ccm_core.category_domains:
ccm_core.categorizations: ccm_core.categorizations:
- categorization_id: -10000 - categorization_id: -10000
uuid: 5ace8dbb-2e8a-4bf6-932a-22591be326bf
category_id: -2100 category_id: -2100
object_id: -3100 object_id: -3100
object_order: 1 object_order: 1
category_order: 1 category_order: 1
category_index: false category_index: false
- categorization_id: -10100 - categorization_id: -10100
uuid: 50780558-5851-4eb2-8398-460173507a1b
category_id: -2200 category_id: -2200
object_id: -3300 object_id: -3300
category_order: 1 category_order: 1
@ -110,70 +112,84 @@ ccm_core.users:
ccm_core.ccm_roles: ccm_core.ccm_roles:
- role_id: -4000 - role_id: -4000
uuid: cb07e4f7-9a77-41e8-af1a-eed318aed596
name: domain_test_category_manager name: domain_test_category_manager
- role_id: -4100 - role_id: -4100
uuid: e9d4bb0a-7218-4ecb-a759-d1623b2d5c00
name: category_foo_manager name: category_foo_manager
ccm_core.role_memberships: ccm_core.role_memberships:
- membership_id: -5000 - membership_id: -5000
uuid: a62fab65-94e0-463b-8d51-6f7585e2417c
role_id: -4000 role_id: -4000
member_id: -3100 member_id: -3100
- membership_id: 5100 - membership_id: 5100
uuid: 8fb7b7cc-fe04-4986-93de-73132b94e2fa
role_id: -4100 role_id: -4100
member_id: -3200 member_id: -3200
ccm_core.permissions: ccm_core.permissions:
- permission_id: -6000 - permission_id: -6000
uuid: 1f9cd01d-b04f-4cb8-83b7-502a53b442c9
granted_privilege: manage_category granted_privilege: manage_category
grantee_id: -4000 grantee_id: -4000
object_id: -2000 object_id: -2000
inherited: false inherited: false
- permission_id: -6010 - permission_id: -6010
uuid: 964ab653-eadf-4c69-b4cb-d90e9834bb81
granted_privilege: manage_category granted_privilege: manage_category
grantee_id: -4000 grantee_id: -4000
object_id: -2100 object_id: -2100
inherited: true inherited: true
inherited_from_id: -2000 inherited_from_id: -2000
- permission_id: -6020 - permission_id: -6020
uuid: c44261af-6522-418d-b7c5-ae3b3dcb02a3
granted_privilege: manage_category granted_privilege: manage_category
grantee_id: -4000 grantee_id: -4000
object_id: -2200 object_id: -2200
inherited: true inherited: true
inherited_from_id: -2000 inherited_from_id: -2000
- permission_id: -6100 - permission_id: -6100
uuid: 8aa98e4d-6fa9-411b-bcb0-3e51bba63a5b
granted_privilege: manage_category_objects granted_privilege: manage_category_objects
grantee_id: -4000 grantee_id: -4000
object_id: -2000 object_id: -2000
inherited: false inherited: false
- permission_id: -6110 - permission_id: -6110
uuid: 89fe50b0-6f59-4dfd-8520-f9059ad9d629
granted_privilege: manage_category_objects granted_privilege: manage_category_objects
grantee_id: -4000 grantee_id: -4000
object_id: -2100 object_id: -2100
inherited: true inherited: true
inherited_from_id: -2000 inherited_from_id: -2000
- permission_id: -6120 - permission_id: -6120
uuid: 052ea99f-a0de-4d8b-aebd-69ad9680f921
granted_privilege: manage_category_objects granted_privilege: manage_category_objects
grantee_id: -4000 grantee_id: -4000
object_id: -2200 object_id: -2200
inherited: true inherited: true
inherited_from_id: -2000 inherited_from_id: -2000
- permission_id: -6200 - permission_id: -6200
uuid: daf465e7-bfb3-4847-a5f8-2c985f20cbb8
granted_privilege: manage_category granted_privilege: manage_category
grantee_id: -4100 grantee_id: -4100
object_id: -2100 object_id: -2100
inherited: false inherited: false
- permission_id: -6210 - permission_id: -6210
uuid: 23424b24-fa6f-4e2c-86f6-6c10c4342dd7
granted_privilege: manage_category granted_privilege: manage_category
grantee_id: -4100 grantee_id: -4100
object_id: -2200 object_id: -2200
inherited: true inherited: true
inherited_from_id: -2100 inherited_from_id: -2100
- permission_id: -6300 - permission_id: -6300
uuid: 1b58b9ab-7c8a-402f-9fe5-d5f4af8dfa00
granted_privilege: manage_category_objects granted_privilege: manage_category_objects
grantee_id: -4100 grantee_id: -4100
object_id: -2100 object_id: -2100
inherited: false inherited: false
- permission_id: -6310 - permission_id: -6310
uuid: 9aafe40c-ce25-4344-bc3f-144a0457191a
granted_privilege: manage_category_objects granted_privilege: manage_category_objects
grantee_id: -4100 grantee_id: -4100
object_id: -2200 object_id: -2200

View File

@ -95,24 +95,30 @@ ccm_core.users:
ccm_core.ccm_roles: ccm_core.ccm_roles:
- role_id: -500 - role_id: -500
uuid: 420f5f60-18a6-4dbe-9160-c730bbe18f45
name: category_manager name: category_manager
- role_id: -510 - role_id: -510
uuid: 0aeea94d-3d8e-4a50-807b-e3c857038e22
name: category_manager_domain_test name: category_manager_domain_test
ccm_core.role_memberships: ccm_core.role_memberships:
- membership_id: -600 - membership_id: -600
uuid: 59bfad40-2bd1-4ddd-91cf-60c51724e29c
role_id: -500 role_id: -500
member_id: -200 member_id: -200
- membership_id: -610 - membership_id: -610
uuid: 192024a9-0489-44a0-940f-725b5579a52d
role_id: -510 role_id: -510
member_id: -300 member_id: -300
ccm_core.permissions: ccm_core.permissions:
- permission_id: -700 - permission_id: -700
uuid: 70e8b64c-505d-48bd-b196-36c10ed2321a
granted_privilege: manage_category granted_privilege: manage_category
grantee_id: -500 grantee_id: -500
inherited: false inherited: false
- permission_id: -710 - permission_id: -710
uuid: 1a798119-a4a4-477b-8092-4423d7185e1b
granted_privilege: manage_category granted_privilege: manage_category
grantee_id: -510 grantee_id: -510
object_id: -1000 object_id: -1000

View File

@ -85,24 +85,30 @@ ccm_core.users:
ccm_core.ccm_roles: ccm_core.ccm_roles:
- role_id: -500 - role_id: -500
uuid: 420f5f60-18a6-4dbe-9160-c730bbe18f45
name: category_manager name: category_manager
- role_id: -510 - role_id: -510
uuid: 0aeea94d-3d8e-4a50-807b-e3c857038e22
name: category_manager_domain_test name: category_manager_domain_test
ccm_core.role_memberships: ccm_core.role_memberships:
- membership_id: -600 - membership_id: -600
uuid: 59bfad40-2bd1-4ddd-91cf-60c51724e29c
role_id: -500 role_id: -500
member_id: -200 member_id: -200
- membership_id: -610 - membership_id: -610
uuid: 192024a9-0489-44a0-940f-725b5579a52d
role_id: -510 role_id: -510
member_id: -300 member_id: -300
ccm_core.permissions: ccm_core.permissions:
- permission_id: -700 - permission_id: -700
uuid: 70e8b64c-505d-48bd-b196-36c10ed2321a
granted_privilege: manage_category granted_privilege: manage_category
grantee_id: -500 grantee_id: -500
inherited: false inherited: false
- permission_id: -710 - permission_id: -710
uuid: 1a798119-a4a4-477b-8092-4423d7185e1b
granted_privilege: manage_category granted_privilege: manage_category
grantee_id: -510 grantee_id: -510
object_id: -1000 object_id: -1000