diff --git a/ccm-core/src/main/java/org/libreccm/categorization/Categorization.java b/ccm-core/src/main/java/org/libreccm/categorization/Categorization.java
index 0df61fba0..6adf4befe 100644
--- a/ccm-core/src/main/java/org/libreccm/categorization/Categorization.java
+++ b/ccm-core/src/main/java/org/libreccm/categorization/Categorization.java
@@ -29,6 +29,9 @@ import java.util.Objects;
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.Entity;
import javax.persistence.GeneratedValue;
@@ -53,50 +56,54 @@ import javax.persistence.Table;
@Table(name = "CATEGORIZATIONS", schema = DB_SCHEMA)
@NamedQueries({
@NamedQuery(
- name = "Categorization.find",
- query = "SELECT c FROM Categorization c "
- + "WHERE c.category = :category "
- + "AND c.categorizedObject = :object")
+ name = "Categorization.findByUuid",
+ query = "SELECT c FROM Categorization c WHERE c.uuid = :uuid"
+ ),
+ @NamedQuery(
+ name = "Categorization.find",
+ query = "SELECT c FROM Categorization c "
+ + "WHERE c.category = :category "
+ + "AND c.categorizedObject = :object")
,
@NamedQuery(
- name = "Categorization.isAssignedTo",
- query = "SELECT (CASE WHEN COUNT(c) > 0 THEN true ELSE false END) "
- + "FROM Categorization c "
- + "WHERE c.category = :category "
- + "AND c.categorizedObject = :object")
+ name = "Categorization.isAssignedTo",
+ query = "SELECT (CASE WHEN COUNT(c) > 0 THEN true ELSE false END) "
+ + "FROM Categorization c "
+ + "WHERE c.category = :category "
+ + "AND c.categorizedObject = :object")
,
@NamedQuery(
- name = "Categorization.isAssignedToWithType",
- query = "SELECT (CASE WHEN COUNT(c) > 0 THEN true ELSE false END) "
- + "FROM Categorization c "
- + "WHERE c.category = :category "
- + "AND c.categorizedObject = :object "
- + "AND c.type = :type")
+ name = "Categorization.isAssignedToWithType",
+ query = "SELECT (CASE WHEN COUNT(c) > 0 THEN true ELSE false END) "
+ + "FROM Categorization c "
+ + "WHERE c.category = :category "
+ + "AND c.categorizedObject = :object "
+ + "AND c.type = :type")
,
@NamedQuery(
- name = "Categorization.findIndexObject",
- query = "SELECT c.categorizedObject FROM Categorization c "
- + "WHERE c.category = :category "
- + "AND c.indexObject = TRUE")
+ name = "Categorization.findIndexObject",
+ query = "SELECT c.categorizedObject FROM Categorization c "
+ + "WHERE c.category = :category "
+ + "AND c.indexObject = TRUE")
,
@NamedQuery(
- name = "Categorization.findIndexObjectCategorization",
- query = "SELECT c FROM Categorization c "
- + "WHERE c.category = :category "
- + "AND c.indexObject = TRUE"
+ name = "Categorization.findIndexObjectCategorization",
+ query = "SELECT c FROM Categorization c "
+ + "WHERE c.category = :category "
+ + "AND c.indexObject = TRUE"
)
,
@NamedQuery(
- name = "Categorization.hasIndexObject",
- query = "SELECT (CASE WHEN COUNT(c.categorizedObject) > 0 THEN true "
+ name = "Categorization.hasIndexObject",
+ query = "SELECT (CASE WHEN COUNT(c.categorizedObject) > 0 THEN true "
+ "ELSE false END) "
- + "FROM Categorization c "
- + "WHERE c.category = :category "
- + "AND c.indexObject = TRUE")
+ + "FROM Categorization c "
+ + "WHERE c.category = :category "
+ + "AND c.indexObject = TRUE")
})
-@JsonIdentityInfo(generator = CategorizationIdGenerator.class,
- property = "customCatId")
-public class Categorization implements Serializable, Relation, Portable {
+@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class,
+ property = "uuid")
+public class Categorization implements Serializable, Relation, Exportable {
private static final long serialVersionUID = 201504301320L;
@@ -108,6 +115,9 @@ public class Categorization implements Serializable, Relation, Portable {
@GeneratedValue(strategy = GenerationType.AUTO)
private long categorizationId;
+ @Column(name = "UUID", unique = true, nullable = false)
+ private String uuid;
+
/**
* 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
- property is set to {@code true}.
+ * property is set to {@code true}.
*/
@Column(name = "CATEGORY_INDEX")
private boolean indexObject;
@@ -166,6 +176,15 @@ public class Categorization implements Serializable, Relation, Portable {
this.categorizationId = categorizationId;
}
+ @Override
+ public String getUuid() {
+ return uuid;
+ }
+
+ protected void setUuid(final String uuid) {
+ this.uuid = uuid;
+ }
+
public Category getCategory() {
return category;
}
@@ -195,7 +214,6 @@ public class Categorization implements Serializable, Relation, Portable {
// public boolean getIndex() {
// return indexObject;
// }
-
public boolean isIndexObject() {
return indexObject;
}
@@ -232,7 +250,7 @@ public class Categorization implements Serializable, Relation, Portable {
public int hashCode() {
int hash = 7;
hash
- = 89 * hash + (int) (categorizationId ^ (categorizationId >>> 32));
+ = 89 * hash + (int) (categorizationId ^ (categorizationId >>> 32));
hash = 89 * hash + Objects.hashCode(category);
hash = 89 * hash + Objects.hashCode(categorizedObject);
hash = 89 * hash + (indexObject ? 1 : 0);
@@ -293,14 +311,14 @@ public class Categorization implements Serializable, Relation, Portable {
public String toString(final String data) {
return String.format("%s{ "
- + "categorizationId = %d, "
- + "category = %s, "
- + "categorizedObject = %s, "
- + "index = %b,"
- + "categoryOrder = %d, "
- + "objectOrder = %d"
- + "type = %s"
- + "%s }",
+ + "categorizationId = %d, "
+ + "category = %s, "
+ + "categorizedObject = %s, "
+ + "index = %b,"
+ + "categoryOrder = %d, "
+ + "objectOrder = %d"
+ + "type = %s"
+ + "%s }",
super.toString(),
categorizationId,
Objects.toString(category),
diff --git a/ccm-core/src/main/java/org/libreccm/categorization/CategorizationIdGenerator.java b/ccm-core/src/main/java/org/libreccm/categorization/CategorizationIdGenerator.java
deleted file mode 100644
index ea70aae75..000000000
--- a/ccm-core/src/main/java/org/libreccm/categorization/CategorizationIdGenerator.java
+++ /dev/null
@@ -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 Jens Pelzetter
*/
-@RequestScoped
-@Marshals(DomainOwnership.class)
-public class DomainOwnershipMarshaller extends AbstractMarshaller {
-
- private static final long serialVersionUID = 6743023023790517330L;
+@Processes(Categorization.class)
+@DependsOn({Category.class})
+public class CategorizationImExporter
+ extends AbstractEntityImExporter {
@Inject
- private EntityManager entityManager;
-
+ private EntityManager entityManager;
+
@Override
- protected Class getObjectClass() {
- return DomainOwnership.class;
+ protected Class getEntityClass() {
+
+ return Categorization.class;
}
@Override
- protected void insertIntoDb(DomainOwnership portableObject) {
- if (portableObject.getOwnershipId() == 0) {
- entityManager.persist(portableObject);
- } else {
- entityManager.merge(portableObject);
- }
+ @Transactional(Transactional.TxType.REQUIRED)
+ protected void saveImportedEntity(final Categorization entity) {
+
+ entityManager.persist(entity);
}
+
}
diff --git a/ccm-core/src/main/java/org/libreccm/categorization/Category.java b/ccm-core/src/main/java/org/libreccm/categorization/Category.java
index ec082a297..7b333006d 100644
--- a/ccm-core/src/main/java/org/libreccm/categorization/Category.java
+++ b/ccm-core/src/main/java/org/libreccm/categorization/Category.java
@@ -41,6 +41,8 @@ import java.util.Objects;
import static org.libreccm.categorization.CategorizationConstants.CAT_XML_NS;
import static org.libreccm.core.CoreConstants.DB_SCHEMA;
+import org.libreccm.imexport.Exportable;
+
import javax.persistence.AssociationOverride;
import javax.persistence.Column;
import javax.persistence.Embedded;
@@ -148,7 +150,7 @@ import javax.persistence.Table;
@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class,
resolver = CategoryIdResolver.class,
property = "uuid")
-public class Category extends CcmObject implements Serializable, Portable {
+public class Category extends CcmObject implements Serializable, Exportable {
private static final long serialVersionUID = -7250208963391878547L;
diff --git a/ccm-core/src/main/java/org/libreccm/categorization/CategoryMarshaller.java b/ccm-core/src/main/java/org/libreccm/categorization/CategoryImExporter.java
similarity index 65%
rename from ccm-core/src/main/java/org/libreccm/categorization/CategoryMarshaller.java
rename to ccm-core/src/main/java/org/libreccm/categorization/CategoryImExporter.java
index 64b45f485..48ada50b2 100644
--- a/ccm-core/src/main/java/org/libreccm/categorization/CategoryMarshaller.java
+++ b/ccm-core/src/main/java/org/libreccm/categorization/CategoryImExporter.java
@@ -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
* modify it under the terms of the GNU Lesser General Public
@@ -18,35 +18,37 @@
*/
package org.libreccm.categorization;
-import org.libreccm.portation.AbstractMarshaller;
-import org.libreccm.portation.Marshals;
+import org.libreccm.imexport.AbstractEntityImExporter;
+import org.libreccm.imexport.DependsOn;
+import org.libreccm.imexport.Processes;
import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.transaction.Transactional;
-import java.io.Serializable;
/**
- * @author Tobias Osmers
- * @version created on 11/7/16
+ *
+ * @author Jens Pelzetter
*/
@RequestScoped
-@Marshals(Category.class)
-public class CategoryMarshaller extends AbstractMarshaller {
-
- private static final long serialVersionUID = -9089135773302229477L;
+@Processes(Category.class)
+@DependsOn({Domain.class})
+public class CategoryImExporter extends AbstractEntityImExporter {
@Inject
private CategoryRepository categoryRepository;
@Override
- protected Class getObjectClass() {
+ protected Class getEntityClass() {
+
return Category.class;
}
@Override
@Transactional(Transactional.TxType.REQUIRED)
- protected void insertIntoDb(Category portableObject) {
- categoryRepository.save(portableObject);
+ protected void saveImportedEntity(final Category entity) {
+
+ categoryRepository.save(entity);
}
+
}
diff --git a/ccm-core/src/main/java/org/libreccm/categorization/CategoryManager.java b/ccm-core/src/main/java/org/libreccm/categorization/CategoryManager.java
index 4eec9d355..64ab260ec 100644
--- a/ccm-core/src/main/java/org/libreccm/categorization/CategoryManager.java
+++ b/ccm-core/src/main/java/org/libreccm/categorization/CategoryManager.java
@@ -44,6 +44,7 @@ import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.StringJoiner;
+import java.util.UUID;
/**
* The {@code CategoryManager} provides several helper methods for managing
@@ -138,6 +139,7 @@ public class CategoryManager implements Serializable {
category.getObjectId())));
final Categorization categorization = new Categorization();
+ categorization.setUuid(UUID.randomUUID().toString());
categorization.setCategorizedObject(object);
categorization.setCategory(assignedCategory);
diff --git a/ccm-core/src/main/java/org/libreccm/categorization/Domain.java b/ccm-core/src/main/java/org/libreccm/categorization/Domain.java
index ad9704356..e4ffac0ff 100644
--- a/ccm-core/src/main/java/org/libreccm/categorization/Domain.java
+++ b/ccm-core/src/main/java/org/libreccm/categorization/Domain.java
@@ -41,6 +41,8 @@ import java.io.Serializable;
import static org.libreccm.categorization.CategorizationConstants.CAT_XML_NS;
import static org.libreccm.core.CoreConstants.DB_SCHEMA;
+import org.libreccm.imexport.Exportable;
+
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
@@ -123,7 +125,7 @@ import javax.persistence.TemporalType;
@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class,
resolver = DomainIdResolver.class,
property = "uuid")
-public class Domain extends CcmObject implements Serializable, Portable {
+public class Domain extends CcmObject implements Serializable, Exportable {
private static final long serialVersionUID = 4012590760598188732L;
diff --git a/ccm-core/src/main/java/org/libreccm/categorization/DomainMarshaller.java b/ccm-core/src/main/java/org/libreccm/categorization/DomainImExporter.java
similarity index 64%
rename from ccm-core/src/main/java/org/libreccm/categorization/DomainMarshaller.java
rename to ccm-core/src/main/java/org/libreccm/categorization/DomainImExporter.java
index 3c6a5c209..697d259cb 100644
--- a/ccm-core/src/main/java/org/libreccm/categorization/DomainMarshaller.java
+++ b/ccm-core/src/main/java/org/libreccm/categorization/DomainImExporter.java
@@ -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
* modify it under the terms of the GNU Lesser General Public
@@ -18,33 +18,35 @@
*/
package org.libreccm.categorization;
-import org.libreccm.portation.AbstractMarshaller;
-import org.libreccm.portation.Marshals;
+import org.libreccm.imexport.AbstractEntityImExporter;
+import org.libreccm.imexport.Processes;
import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
-import java.io.Serializable;
/**
- * @author Jens Pelzetter
*/
@RequestScoped
-@Marshals(Domain.class)
-public class DomainMarshaller extends AbstractMarshaller {
-
- private static final long serialVersionUID = -2435714410695539890L;
+@Processes(Domain.class)
+public class DomainImExporter extends AbstractEntityImExporter {
@Inject
private DomainRepository domainRepository;
-
+
@Override
- protected Class getObjectClass() {
+ protected Class getEntityClass() {
+
return Domain.class;
}
@Override
- protected void insertIntoDb(Domain portableObject) {
- domainRepository.save(portableObject);
+ protected void saveImportedEntity(final Domain entity) {
+
+ domainRepository.save(entity);
}
+
+
+
}
diff --git a/ccm-core/src/main/java/org/libreccm/categorization/DomainManager.java b/ccm-core/src/main/java/org/libreccm/categorization/DomainManager.java
index 51aeb88d8..f34e48779 100644
--- a/ccm-core/src/main/java/org/libreccm/categorization/DomainManager.java
+++ b/ccm-core/src/main/java/org/libreccm/categorization/DomainManager.java
@@ -28,9 +28,11 @@ import javax.inject.Inject;
import javax.persistence.EntityManager;
import javax.persistence.TypedQuery;
import javax.transaction.Transactional;
+
import java.io.Serializable;
import java.util.List;
import java.util.Optional;
+import java.util.UUID;
/**
* 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,
final Domain domain) {
final DomainOwnership ownership = new DomainOwnership();
+ ownership.setUuid(UUID.randomUUID().toString());
ownership.setDomain(domain);
ownership.setOwner(application);
ownership.setOwnerOrder(domain.getOwners().size() + 1);
diff --git a/ccm-core/src/main/java/org/libreccm/categorization/DomainOwnership.java b/ccm-core/src/main/java/org/libreccm/categorization/DomainOwnership.java
index c8e58cddb..887fffbed 100644
--- a/ccm-core/src/main/java/org/libreccm/categorization/DomainOwnership.java
+++ b/ccm-core/src/main/java/org/libreccm/categorization/DomainOwnership.java
@@ -21,15 +21,28 @@ package org.libreccm.categorization;
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.JsonIdentityReference;
import org.libreccm.core.CcmObject;
-import org.libreccm.portation.Portable;
import org.libreccm.web.CcmApplication;
-import javax.persistence.*;
import java.io.Serializable;
import java.util.Objects;
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
* {@link CcmObject}. Instances of this class should not be created manually.
@@ -41,14 +54,19 @@ import static org.libreccm.core.CoreConstants.DB_SCHEMA;
@Entity
@Table(name = "DOMAIN_OWNERSHIPS", schema = DB_SCHEMA)
@NamedQueries({
+ @NamedQuery(
+ name = "DomainOwnership.findByUuid",
+ query = "SELECT o FROM DomainOwnership o WHERE o.uuid = :uuid"
+ )
+ ,
@NamedQuery(
name = "DomainOwnership.findByOwnerAndDomain",
query = "SELECT o FROM DomainOwnership o "
+ "WHERE o.owner = :owner AND o.domain = :domain")
})
-@JsonIdentityInfo(generator = DomainOwnershipIdGenerator.class,
- property = "customOwnId")
-public class DomainOwnership implements Serializable, Portable {
+@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class,
+ property = "uuid")
+public class DomainOwnership implements Serializable, Exportable {
private static final long serialVersionUID = 201504301305L;
@@ -59,6 +77,10 @@ public class DomainOwnership implements Serializable, Portable {
@Column(name = "OWNERSHIP_ID")
@GeneratedValue(strategy = GenerationType.AUTO)
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}.
@@ -102,6 +124,15 @@ public class DomainOwnership implements Serializable, Portable {
this.ownershipId = ownershipId;
}
+ @Override
+ public String getUuid() {
+ return uuid;
+ }
+
+ protected void setUuid(final String uuid) {
+ this.uuid = uuid;
+ }
+
public CcmApplication getOwner() {
return owner;
}
diff --git a/ccm-core/src/main/java/org/libreccm/categorization/DomainOwnershipIdGenerator.java b/ccm-core/src/main/java/org/libreccm/categorization/DomainOwnershipIdGenerator.java
deleted file mode 100644
index 75d5b455f..000000000
--- a/ccm-core/src/main/java/org/libreccm/categorization/DomainOwnershipIdGenerator.java
+++ /dev/null
@@ -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 Jens Pelzetter
*/
@RequestScoped
-@Marshals(Categorization.class)
-public class CategorizationMarshaller extends AbstractMarshaller {
-
- private static final long serialVersionUID = -4388218720510005447L;
+@Processes(DomainOwnership.class)
+@DependsOn({CcmApplication.class, Domain.class})
+public class DomainOwnershipImExporter
+ extends AbstractEntityImExporter{
@Inject
private EntityManager entityManager;
-
+
@Override
- protected Class getObjectClass() {
- return Categorization.class;
+ protected Class getEntityClass() {
+
+ return DomainOwnership.class;
}
@Override
@Transactional(Transactional.TxType.REQUIRED)
- protected void insertIntoDb(Categorization portableObject) {
- if (portableObject.getCategorizationId() == 0) {
- entityManager.persist(portableObject);
- } else {
- entityManager.merge(portableObject);
- }
+ protected void saveImportedEntity(final DomainOwnership entity) {
+
+ entityManager.persist(entity);
}
+
}
diff --git a/ccm-core/src/main/java/org/libreccm/core/Resource.java b/ccm-core/src/main/java/org/libreccm/core/Resource.java
index ec2577767..b3ae044e5 100644
--- a/ccm-core/src/main/java/org/libreccm/core/Resource.java
+++ b/ccm-core/src/main/java/org/libreccm/core/Resource.java
@@ -29,6 +29,8 @@ import java.io.Serializable;
import static org.libreccm.core.CoreConstants.DB_SCHEMA;
+import org.libreccm.imexport.Exportable;
+
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
@@ -73,7 +75,7 @@ import javax.persistence.TemporalType;
@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class,
resolver = ResourceIdResolver.class,
property = "uuid")
-public class Resource extends CcmObject implements Serializable {
+public class Resource extends CcmObject implements Serializable, Exportable {
private static final long serialVersionUID = 7345482620613842781L;
diff --git a/ccm-core/src/main/java/org/libreccm/web/CcmApplication.java b/ccm-core/src/main/java/org/libreccm/web/CcmApplication.java
index 632c25702..9eee2bc76 100644
--- a/ccm-core/src/main/java/org/libreccm/web/CcmApplication.java
+++ b/ccm-core/src/main/java/org/libreccm/web/CcmApplication.java
@@ -41,6 +41,8 @@ import java.util.Objects;
import static org.libreccm.core.CoreConstants.DB_SCHEMA;
import static org.libreccm.web.WebConstants.WEB_XML_NS;
+import org.libreccm.imexport.Exportable;
+
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.NamedAttributeNode;
@@ -79,7 +81,7 @@ import javax.persistence.Table;
@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class,
resolver = ApplicationIdResolver.class,
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;
diff --git a/ccm-core/src/main/resources/db/migrations/org/libreccm/ccm_core/h2/V7_0_0_32__add_domain_ownership_uuid.sql b/ccm-core/src/main/resources/db/migrations/org/libreccm/ccm_core/h2/V7_0_0_32__add_domain_ownership_uuid.sql
new file mode 100644
index 000000000..de9912c39
--- /dev/null
+++ b/ccm-core/src/main/resources/db/migrations/org/libreccm/ccm_core/h2/V7_0_0_32__add_domain_ownership_uuid.sql
@@ -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);
+
+
+
diff --git a/ccm-core/src/main/resources/db/migrations/org/libreccm/ccm_core/h2/V7_0_0_33__add_categorization_uuid.sql b/ccm-core/src/main/resources/db/migrations/org/libreccm/ccm_core/h2/V7_0_0_33__add_categorization_uuid.sql
new file mode 100644
index 000000000..7b976447e
--- /dev/null
+++ b/ccm-core/src/main/resources/db/migrations/org/libreccm/ccm_core/h2/V7_0_0_33__add_categorization_uuid.sql
@@ -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);
+
+
+
+
diff --git a/ccm-core/src/main/resources/db/migrations/org/libreccm/ccm_core/pgsql/V7_0_0_32__add_domain_ownership_uuid.sql b/ccm-core/src/main/resources/db/migrations/org/libreccm/ccm_core/pgsql/V7_0_0_32__add_domain_ownership_uuid.sql
new file mode 100644
index 000000000..de9912c39
--- /dev/null
+++ b/ccm-core/src/main/resources/db/migrations/org/libreccm/ccm_core/pgsql/V7_0_0_32__add_domain_ownership_uuid.sql
@@ -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);
+
+
+
diff --git a/ccm-core/src/main/resources/db/migrations/org/libreccm/ccm_core/pgsql/V7_0_0_33__add_categorization_uuid.sql b/ccm-core/src/main/resources/db/migrations/org/libreccm/ccm_core/pgsql/V7_0_0_33__add_categorization_uuid.sql
new file mode 100644
index 000000000..7b976447e
--- /dev/null
+++ b/ccm-core/src/main/resources/db/migrations/org/libreccm/ccm_core/pgsql/V7_0_0_33__add_categorization_uuid.sql
@@ -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);
+
+
+
+
diff --git a/ccm-core/src/test/resources/datasets/org/libreccm/categorization/CategoryManagerTest/after-add-obj-to-category.yml b/ccm-core/src/test/resources/datasets/org/libreccm/categorization/CategoryManagerTest/after-add-obj-to-category.yml
index 6b9c50eb1..c6ccd8821 100644
--- a/ccm-core/src/test/resources/datasets/org/libreccm/categorization/CategoryManagerTest/after-add-obj-to-category.yml
+++ b/ccm-core/src/test/resources/datasets/org/libreccm/categorization/CategoryManagerTest/after-add-obj-to-category.yml
@@ -55,18 +55,21 @@ ccm_core.category_domains:
ccm_core.categorizations:
- categorization_id: -10000
+ uuid: 5ace8dbb-2e8a-4bf6-932a-22591be326bf
category_id: -2100
object_id: -3100
object_order: 1
category_order: 1
category_index: false
- categorization_id: -10100
+ uuid: 50780558-5851-4eb2-8398-460173507a1b
category_id: -2200
object_id: -3300
category_order: 1
object_order: 1
category_index: true
- categorization_id: -10200
+ uuid: 05014503-0763-41e3-883c-461721beee6f
object_id: -3200
category_id: -2100
category_order: 1
diff --git a/ccm-core/src/test/resources/datasets/org/libreccm/categorization/CategoryManagerTest/after-add-subcategory.yml b/ccm-core/src/test/resources/datasets/org/libreccm/categorization/CategoryManagerTest/after-add-subcategory.yml
index 24e788e0e..f42fb5e63 100644
--- a/ccm-core/src/test/resources/datasets/org/libreccm/categorization/CategoryManagerTest/after-add-subcategory.yml
+++ b/ccm-core/src/test/resources/datasets/org/libreccm/categorization/CategoryManagerTest/after-add-subcategory.yml
@@ -66,14 +66,16 @@ ccm_core.category_domains:
ccm_core.categorizations:
- categorization_id: -10000
+ uuid: 5ace8dbb-2e8a-4bf6-932a-22591be326bf
category_id: -2100
object_id: -3100
object_order: 1
category_order: 1
category_index: false
- categorization_id: -10100
+ uuid: 50780558-5851-4eb2-8398-460173507a1b
category_id: -2200
object_id: -3300
category_order: 1
object_order: 1
- category_index: true
\ No newline at end of file
+ category_index: true
diff --git a/ccm-core/src/test/resources/datasets/org/libreccm/categorization/CategoryManagerTest/after-create-multiple-categories.yml b/ccm-core/src/test/resources/datasets/org/libreccm/categorization/CategoryManagerTest/after-create-multiple-categories.yml
index f3d3eaa0e..7167e4c11 100644
--- a/ccm-core/src/test/resources/datasets/org/libreccm/categorization/CategoryManagerTest/after-create-multiple-categories.yml
+++ b/ccm-core/src/test/resources/datasets/org/libreccm/categorization/CategoryManagerTest/after-create-multiple-categories.yml
@@ -99,14 +99,16 @@ ccm_core.category_domains:
ccm_core.categorizations:
- categorization_id: -10000
+ uuid: 5ace8dbb-2e8a-4bf6-932a-22591be326bf
category_id: -2100
object_id: -3100
object_order: 1
category_order: 1
category_index: false
- categorization_id: -10100
+ uuid: 50780558-5851-4eb2-8398-460173507a1b
category_id: -2200
object_id: -3300
category_order: 1
object_order: 1
- category_index: true
\ No newline at end of file
+ category_index: true
diff --git a/ccm-core/src/test/resources/datasets/org/libreccm/categorization/CategoryManagerTest/after-remove-obj-from-category.yml b/ccm-core/src/test/resources/datasets/org/libreccm/categorization/CategoryManagerTest/after-remove-obj-from-category.yml
index b9212389f..b76f40837 100644
--- a/ccm-core/src/test/resources/datasets/org/libreccm/categorization/CategoryManagerTest/after-remove-obj-from-category.yml
+++ b/ccm-core/src/test/resources/datasets/org/libreccm/categorization/CategoryManagerTest/after-remove-obj-from-category.yml
@@ -54,9 +54,10 @@ ccm_core.category_domains:
version: 1.0
ccm_core.categorizations:
- - categorization_id: -10100
- category_id: -2200
- object_id: -3300
- category_order: 1
+ - categorization_id: -10000
+ uuid: 5ace8dbb-2e8a-4bf6-932a-22591be326bf
+ category_id: -2100
+ object_id: -3100
object_order: 1
- category_index: true
+ category_order: 1
+ category_index: false
diff --git a/ccm-core/src/test/resources/datasets/org/libreccm/categorization/CategoryManagerTest/after-remove-subcategory.yml b/ccm-core/src/test/resources/datasets/org/libreccm/categorization/CategoryManagerTest/after-remove-subcategory.yml
index 84b60c823..3f5383da2 100644
--- a/ccm-core/src/test/resources/datasets/org/libreccm/categorization/CategoryManagerTest/after-remove-subcategory.yml
+++ b/ccm-core/src/test/resources/datasets/org/libreccm/categorization/CategoryManagerTest/after-remove-subcategory.yml
@@ -54,12 +54,14 @@ ccm_core.category_domains:
ccm_core.categorizations:
- categorization_id: -10000
+ uuid: 5ace8dbb-2e8a-4bf6-932a-22591be326bf
category_id: -2100
object_id: -3100
object_order: 1
category_order: 1
category_index: false
- categorization_id: -10100
+ uuid: 50780558-5851-4eb2-8398-460173507a1b
category_id: -2200
object_id: -3300
category_order: 1
diff --git a/ccm-core/src/test/resources/datasets/org/libreccm/categorization/CategoryManagerTest/data.yml b/ccm-core/src/test/resources/datasets/org/libreccm/categorization/CategoryManagerTest/data.yml
index 41b070f3d..f14ad81db 100644
--- a/ccm-core/src/test/resources/datasets/org/libreccm/categorization/CategoryManagerTest/data.yml
+++ b/ccm-core/src/test/resources/datasets/org/libreccm/categorization/CategoryManagerTest/data.yml
@@ -55,12 +55,14 @@ ccm_core.category_domains:
ccm_core.categorizations:
- categorization_id: -10000
+ uuid: 5ace8dbb-2e8a-4bf6-932a-22591be326bf
category_id: -2100
object_id: -3100
object_order: 1
category_order: 1
category_index: false
- categorization_id: -10100
+ uuid: 50780558-5851-4eb2-8398-460173507a1b
category_id: -2200
object_id: -3300
category_order: 1
@@ -110,70 +112,84 @@ ccm_core.users:
ccm_core.ccm_roles:
- role_id: -4000
+ uuid: cb07e4f7-9a77-41e8-af1a-eed318aed596
name: domain_test_category_manager
- role_id: -4100
+ uuid: e9d4bb0a-7218-4ecb-a759-d1623b2d5c00
name: category_foo_manager
ccm_core.role_memberships:
- membership_id: -5000
+ uuid: a62fab65-94e0-463b-8d51-6f7585e2417c
role_id: -4000
member_id: -3100
- membership_id: 5100
+ uuid: 8fb7b7cc-fe04-4986-93de-73132b94e2fa
role_id: -4100
member_id: -3200
ccm_core.permissions:
- permission_id: -6000
+ uuid: 1f9cd01d-b04f-4cb8-83b7-502a53b442c9
granted_privilege: manage_category
grantee_id: -4000
object_id: -2000
inherited: false
- permission_id: -6010
+ uuid: 964ab653-eadf-4c69-b4cb-d90e9834bb81
granted_privilege: manage_category
grantee_id: -4000
object_id: -2100
inherited: true
inherited_from_id: -2000
- permission_id: -6020
+ uuid: c44261af-6522-418d-b7c5-ae3b3dcb02a3
granted_privilege: manage_category
grantee_id: -4000
object_id: -2200
inherited: true
inherited_from_id: -2000
- permission_id: -6100
+ uuid: 8aa98e4d-6fa9-411b-bcb0-3e51bba63a5b
granted_privilege: manage_category_objects
grantee_id: -4000
object_id: -2000
inherited: false
- permission_id: -6110
+ uuid: 89fe50b0-6f59-4dfd-8520-f9059ad9d629
granted_privilege: manage_category_objects
grantee_id: -4000
object_id: -2100
inherited: true
inherited_from_id: -2000
- permission_id: -6120
+ uuid: 052ea99f-a0de-4d8b-aebd-69ad9680f921
granted_privilege: manage_category_objects
grantee_id: -4000
object_id: -2200
inherited: true
inherited_from_id: -2000
- permission_id: -6200
+ uuid: daf465e7-bfb3-4847-a5f8-2c985f20cbb8
granted_privilege: manage_category
grantee_id: -4100
object_id: -2100
inherited: false
- permission_id: -6210
+ uuid: 23424b24-fa6f-4e2c-86f6-6c10c4342dd7
granted_privilege: manage_category
grantee_id: -4100
object_id: -2200
inherited: true
inherited_from_id: -2100
- permission_id: -6300
+ uuid: 1b58b9ab-7c8a-402f-9fe5-d5f4af8dfa00
granted_privilege: manage_category_objects
grantee_id: -4100
object_id: -2100
inherited: false
- permission_id: -6310
+ uuid: 9aafe40c-ce25-4344-bc3f-144a0457191a
granted_privilege: manage_category_objects
grantee_id: -4100
object_id: -2200
diff --git a/ccm-core/src/test/resources/datasets/org/libreccm/categorization/CategoryRepositoryTest/after-save-new-category.yml b/ccm-core/src/test/resources/datasets/org/libreccm/categorization/CategoryRepositoryTest/after-save-new-category.yml
index b3e97817a..ea34b3286 100644
--- a/ccm-core/src/test/resources/datasets/org/libreccm/categorization/CategoryRepositoryTest/after-save-new-category.yml
+++ b/ccm-core/src/test/resources/datasets/org/libreccm/categorization/CategoryRepositoryTest/after-save-new-category.yml
@@ -95,24 +95,30 @@ ccm_core.users:
ccm_core.ccm_roles:
- role_id: -500
+ uuid: 420f5f60-18a6-4dbe-9160-c730bbe18f45
name: category_manager
- role_id: -510
+ uuid: 0aeea94d-3d8e-4a50-807b-e3c857038e22
name: category_manager_domain_test
ccm_core.role_memberships:
- membership_id: -600
+ uuid: 59bfad40-2bd1-4ddd-91cf-60c51724e29c
role_id: -500
member_id: -200
- membership_id: -610
+ uuid: 192024a9-0489-44a0-940f-725b5579a52d
role_id: -510
member_id: -300
ccm_core.permissions:
- permission_id: -700
+ uuid: 70e8b64c-505d-48bd-b196-36c10ed2321a
granted_privilege: manage_category
grantee_id: -500
inherited: false
- permission_id: -710
+ uuid: 1a798119-a4a4-477b-8092-4423d7185e1b
granted_privilege: manage_category
grantee_id: -510
object_id: -1000
diff --git a/ccm-core/src/test/resources/datasets/org/libreccm/categorization/CategoryRepositoryTest/data.yml b/ccm-core/src/test/resources/datasets/org/libreccm/categorization/CategoryRepositoryTest/data.yml
index d7309150d..88ad4122c 100644
--- a/ccm-core/src/test/resources/datasets/org/libreccm/categorization/CategoryRepositoryTest/data.yml
+++ b/ccm-core/src/test/resources/datasets/org/libreccm/categorization/CategoryRepositoryTest/data.yml
@@ -85,24 +85,30 @@ ccm_core.users:
ccm_core.ccm_roles:
- role_id: -500
+ uuid: 420f5f60-18a6-4dbe-9160-c730bbe18f45
name: category_manager
- role_id: -510
+ uuid: 0aeea94d-3d8e-4a50-807b-e3c857038e22
name: category_manager_domain_test
ccm_core.role_memberships:
- membership_id: -600
+ uuid: 59bfad40-2bd1-4ddd-91cf-60c51724e29c
role_id: -500
member_id: -200
- membership_id: -610
+ uuid: 192024a9-0489-44a0-940f-725b5579a52d
role_id: -510
member_id: -300
ccm_core.permissions:
- permission_id: -700
+ uuid: 70e8b64c-505d-48bd-b196-36c10ed2321a
granted_privilege: manage_category
grantee_id: -500
inherited: false
- permission_id: -710
+ uuid: 1a798119-a4a4-477b-8092-4423d7185e1b
granted_privilege: manage_category
grantee_id: -510
object_id: -1000