* Fixed ContentSectionSetup (now sets UUIDs for Workflow and LifecycleDefinition)
* Added UUID to Lifecycle and LifecycleDefinition
* All setUuid method are now public
Former-commit-id: 6a60575b75
pull/2/head
parent
ff9031861f
commit
1b33bc7a1c
|
|
@ -268,9 +268,11 @@ public class ContentSectionSetup extends AbstractCcmApplicationSetup {
|
||||||
section.addRole(contentReader);
|
section.addRole(contentReader);
|
||||||
|
|
||||||
final LifecycleDefinition lifecycleDefinition = new LifecycleDefinition();
|
final LifecycleDefinition lifecycleDefinition = new LifecycleDefinition();
|
||||||
|
lifecycleDefinition.setUuid(UUID.randomUUID().toString());
|
||||||
lifecycleDefinition.getLabel().addValue(Locale.ENGLISH, "Standard");
|
lifecycleDefinition.getLabel().addValue(Locale.ENGLISH, "Standard");
|
||||||
|
|
||||||
final Workflow workflow = new Workflow();
|
final Workflow workflow = new Workflow();
|
||||||
|
workflow.setUuid(UUID.randomUUID().toString());
|
||||||
workflow.setAbstractWorkflow(true);
|
workflow.setAbstractWorkflow(true);
|
||||||
workflow.getName().addValue(Locale.ENGLISH, "Standard");
|
workflow.getName().addValue(Locale.ENGLISH, "Standard");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,9 @@
|
||||||
*/
|
*/
|
||||||
package org.librecms.lifecycle;
|
package org.librecms.lifecycle;
|
||||||
|
|
||||||
|
import org.hibernate.search.annotations.Field;
|
||||||
|
import org.libreccm.core.Identifiable;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
|
@ -36,6 +39,8 @@ import javax.persistence.OneToOne;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
import javax.persistence.Temporal;
|
import javax.persistence.Temporal;
|
||||||
import javax.persistence.TemporalType;
|
import javax.persistence.TemporalType;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
|
||||||
import static org.librecms.CmsConstants.*;
|
import static org.librecms.CmsConstants.*;
|
||||||
|
|
||||||
|
|
@ -45,43 +50,52 @@ import static org.librecms.CmsConstants.*;
|
||||||
*/
|
*/
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "LIFECYCLES", schema = DB_SCHEMA)
|
@Table(name = "LIFECYCLES", schema = DB_SCHEMA)
|
||||||
public class Lifecycle implements Serializable {
|
public class Lifecycle implements Identifiable, Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 184357562249530038L;
|
private static final long serialVersionUID = 184357562249530038L;
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||||
@Column(name = "LIFECYCLE_ID")
|
@Column(name = "LIFECYCLE_ID")
|
||||||
private long lifecycleId;
|
private long lifecycleId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Column(name = "UUID", unique = true)
|
||||||
|
@NotNull
|
||||||
|
@Field
|
||||||
|
@XmlElement(name = "uuid")
|
||||||
|
private String uuid;
|
||||||
|
|
||||||
@Column(name = "START_DATE_TIME")
|
@Column(name = "START_DATE_TIME")
|
||||||
@Temporal(TemporalType.DATE)
|
@Temporal(TemporalType.DATE)
|
||||||
private Date startDateTime;
|
private Date startDateTime;
|
||||||
|
|
||||||
@Column(name = "END_DATE_TIME")
|
@Column(name = "END_DATE_TIME")
|
||||||
@Temporal(TemporalType.DATE)
|
@Temporal(TemporalType.DATE)
|
||||||
private Date endDateTime;
|
private Date endDateTime;
|
||||||
|
|
||||||
@Column(name = "LISTENER", length = 1024)
|
@Column(name = "LISTENER", length = 1024)
|
||||||
private String listener;
|
private String listener;
|
||||||
|
|
||||||
@Column(name = "STARTED")
|
@Column(name = "STARTED")
|
||||||
private boolean started;
|
private boolean started;
|
||||||
|
|
||||||
@Column(name = "FINISHED")
|
@Column(name = "FINISHED")
|
||||||
private boolean finished;
|
private boolean finished;
|
||||||
|
|
||||||
@OneToOne
|
@OneToOne
|
||||||
@JoinColumn(name = "DEFINITION_ID")
|
@JoinColumn(name = "DEFINITION_ID")
|
||||||
private LifecycleDefinition definition;
|
private LifecycleDefinition definition;
|
||||||
|
|
||||||
@OneToMany(mappedBy = "lifecycle")
|
@OneToMany(mappedBy = "lifecycle")
|
||||||
private List<Phase> phases;
|
private List<Phase> phases;
|
||||||
|
|
||||||
public Lifecycle() {
|
public Lifecycle() {
|
||||||
phases = new ArrayList<>();
|
phases = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getLifecycleId() {
|
public long getLifecycleId() {
|
||||||
return lifecycleId;
|
return lifecycleId;
|
||||||
}
|
}
|
||||||
|
|
@ -90,6 +104,15 @@ public class Lifecycle implements Serializable {
|
||||||
this.lifecycleId = lifecycleId;
|
this.lifecycleId = lifecycleId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getUuid() {
|
||||||
|
return uuid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUuid(final String uuid) {
|
||||||
|
this.uuid = uuid;
|
||||||
|
}
|
||||||
|
|
||||||
public Date getStartDateTime() {
|
public Date getStartDateTime() {
|
||||||
return new Date(startDateTime.getTime());
|
return new Date(startDateTime.getTime());
|
||||||
}
|
}
|
||||||
|
|
@ -145,11 +168,11 @@ public class Lifecycle implements Serializable {
|
||||||
protected void setPhases(final List<Phase> phases) {
|
protected void setPhases(final List<Phase> phases) {
|
||||||
this.phases = new ArrayList<>(phases);
|
this.phases = new ArrayList<>(phases);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addPhase(final Phase phase) {
|
public void addPhase(final Phase phase) {
|
||||||
phases.add(phase);
|
phases.add(phase);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removePhase(final Phase phase) {
|
public void removePhase(final Phase phase) {
|
||||||
phases.remove(phase);
|
phases.remove(phase);
|
||||||
}
|
}
|
||||||
|
|
@ -202,26 +225,26 @@ public class Lifecycle implements Serializable {
|
||||||
}
|
}
|
||||||
return Objects.equals(definition, other.getDefinition());
|
return Objects.equals(definition, other.getDefinition());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canEqual(final Object obj) {
|
public boolean canEqual(final Object obj) {
|
||||||
return obj instanceof Lifecycle;
|
return obj instanceof Lifecycle;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final String toString() {
|
public final String toString() {
|
||||||
return toString("");
|
return toString("");
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString(final String data) {
|
public String toString(final String data) {
|
||||||
return String.format("%s{ "
|
return String.format("%s{ "
|
||||||
+ "lifecycleId = %d, "
|
+ "lifecycleId = %d, "
|
||||||
+ "startDateTime = %tF %<tT, "
|
+ "startDateTime = %tF %<tT, "
|
||||||
+ "endDateTime = %tF %<tT, "
|
+ "endDateTime = %tF %<tT, "
|
||||||
+ "listener = \"%s\", "
|
+ "listener = \"%s\", "
|
||||||
+ "started = %b, "
|
+ "started = %b, "
|
||||||
+ "finished = %b, "
|
+ "finished = %b, "
|
||||||
+ "definition = %s%s"
|
+ "definition = %s%s"
|
||||||
+ " }",
|
+ " }",
|
||||||
super.toString(),
|
super.toString(),
|
||||||
lifecycleId,
|
lifecycleId,
|
||||||
startDateTime,
|
startDateTime,
|
||||||
|
|
@ -232,4 +255,5 @@ public class Lifecycle implements Serializable {
|
||||||
Objects.toString(definition),
|
Objects.toString(definition),
|
||||||
data);
|
data);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,8 @@
|
||||||
*/
|
*/
|
||||||
package org.librecms.lifecycle;
|
package org.librecms.lifecycle;
|
||||||
|
|
||||||
|
import org.hibernate.search.annotations.Field;
|
||||||
|
import org.libreccm.core.Identifiable;
|
||||||
import org.libreccm.l10n.LocalizedString;
|
import org.libreccm.l10n.LocalizedString;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
@ -37,6 +39,8 @@ import javax.persistence.JoinColumn;
|
||||||
import javax.persistence.JoinTable;
|
import javax.persistence.JoinTable;
|
||||||
import javax.persistence.OneToMany;
|
import javax.persistence.OneToMany;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
|
||||||
import static org.librecms.CmsConstants.*;
|
import static org.librecms.CmsConstants.*;
|
||||||
|
|
||||||
|
|
@ -46,7 +50,7 @@ import static org.librecms.CmsConstants.*;
|
||||||
*/
|
*/
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "LIFECYLE_DEFINITIONS", schema = DB_SCHEMA)
|
@Table(name = "LIFECYLE_DEFINITIONS", schema = DB_SCHEMA)
|
||||||
public class LifecycleDefinition implements Serializable {
|
public class LifecycleDefinition implements Identifiable, Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1291162870555527717L;
|
private static final long serialVersionUID = 1291162870555527717L;
|
||||||
|
|
||||||
|
|
@ -55,6 +59,12 @@ public class LifecycleDefinition implements Serializable {
|
||||||
@Column(name = "LIFECYCLE_DEFINITION_ID")
|
@Column(name = "LIFECYCLE_DEFINITION_ID")
|
||||||
private long definitionId;
|
private long definitionId;
|
||||||
|
|
||||||
|
@Column(name = "UUID", unique = true)
|
||||||
|
@NotNull
|
||||||
|
@Field
|
||||||
|
@XmlElement(name = "uuid")
|
||||||
|
private String uuid;
|
||||||
|
|
||||||
@Embedded
|
@Embedded
|
||||||
@AssociationOverride(
|
@AssociationOverride(
|
||||||
name = "values",
|
name = "values",
|
||||||
|
|
@ -96,6 +106,15 @@ public class LifecycleDefinition implements Serializable {
|
||||||
this.definitionId = definitionId;
|
this.definitionId = definitionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getUuid() {
|
||||||
|
return uuid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUuid(final String uuid) {
|
||||||
|
this.uuid = uuid;
|
||||||
|
}
|
||||||
|
|
||||||
public LocalizedString getLabel() {
|
public LocalizedString getLabel() {
|
||||||
return label;
|
return label;
|
||||||
}
|
}
|
||||||
|
|
@ -191,7 +210,7 @@ public class LifecycleDefinition implements Serializable {
|
||||||
public final String toString() {
|
public final String toString() {
|
||||||
return toString("");
|
return toString("");
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString(final String data) {
|
public String toString(final String data) {
|
||||||
return String.format("%s{ "
|
return String.format("%s{ "
|
||||||
+ "definitionId = %d, "
|
+ "definitionId = %d, "
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,8 @@ package org.librecms.lifecycle;
|
||||||
|
|
||||||
import org.libreccm.core.AbstractEntityRepository;
|
import org.libreccm.core.AbstractEntityRepository;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
import javax.enterprise.context.RequestScoped;
|
import javax.enterprise.context.RequestScoped;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -52,4 +54,12 @@ public class LifecycleDefinitionRepository
|
||||||
return lifecycleDefinition.getDefinitionId() == 0;
|
return lifecycleDefinition.getDefinitionId() == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void initNewEntity(final LifecycleDefinition entity) {
|
||||||
|
super.initNewEntity(entity);
|
||||||
|
entity.setUuid(UUID.randomUUID().toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,8 @@ package org.librecms.lifecycle;
|
||||||
|
|
||||||
import org.libreccm.core.AbstractEntityRepository;
|
import org.libreccm.core.AbstractEntityRepository;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
import javax.enterprise.context.RequestScoped;
|
import javax.enterprise.context.RequestScoped;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -30,6 +32,8 @@ import javax.enterprise.context.RequestScoped;
|
||||||
public class LifecycleRepository
|
public class LifecycleRepository
|
||||||
extends AbstractEntityRepository<Long, Lifecycle> {
|
extends AbstractEntityRepository<Long, Lifecycle> {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<Lifecycle> getEntityClass() {
|
public Class<Lifecycle> getEntityClass() {
|
||||||
return Lifecycle.class;
|
return Lifecycle.class;
|
||||||
|
|
@ -50,4 +54,10 @@ public class LifecycleRepository
|
||||||
return lifecycle.getLifecycleId() == 0;
|
return lifecycle.getLifecycleId() == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void initNewEntity(final Lifecycle entity) {
|
||||||
|
super.initNewEntity(entity);
|
||||||
|
entity.setUuid(UUID.randomUUID().toString());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -180,7 +180,7 @@ public class Categorization implements Serializable, Relation, Exportable {
|
||||||
return uuid;
|
return uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setUuid(final String uuid) {
|
public void setUuid(final String uuid) {
|
||||||
this.uuid = uuid;
|
this.uuid = uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -129,7 +129,7 @@ public class DomainOwnership implements Serializable, Exportable {
|
||||||
return uuid;
|
return uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setUuid(final String uuid) {
|
public void setUuid(final String uuid) {
|
||||||
this.uuid = uuid;
|
this.uuid = uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -125,7 +125,7 @@ public class ResourceType implements Serializable, Exportable {
|
||||||
return uuid;
|
return uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setUuid(final String uuid) {
|
public void setUuid(final String uuid) {
|
||||||
this.uuid = uuid;
|
this.uuid = uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -132,7 +132,7 @@ public class ComponentModel implements Serializable {
|
||||||
return uuid;
|
return uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setUuid(final String uuid) {
|
public void setUuid(final String uuid) {
|
||||||
this.uuid = uuid;
|
this.uuid = uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -140,7 +140,7 @@ public class ContainerModel implements Serializable {
|
||||||
return uuid;
|
return uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setUuid(final String uuid) {
|
public void setUuid(final String uuid) {
|
||||||
this.uuid = uuid;
|
this.uuid = uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -289,7 +289,7 @@ public class PageModel implements Serializable {
|
||||||
return uuid;
|
return uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setUuid(final String uuid) {
|
public void setUuid(final String uuid) {
|
||||||
|
|
||||||
this.uuid = uuid;
|
this.uuid = uuid;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,7 @@ public class GroupMembership implements Serializable, Exportable {
|
||||||
return uuid;
|
return uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setUuid(final String uuid) {
|
public void setUuid(final String uuid) {
|
||||||
this.uuid = uuid;
|
this.uuid = uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -141,7 +141,7 @@ public class Party implements Serializable {
|
||||||
return uuid;
|
return uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setUuid(final String uuid) {
|
public void setUuid(final String uuid) {
|
||||||
this.uuid = uuid;
|
this.uuid = uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -220,7 +220,7 @@ public class Permission implements Serializable, Exportable {
|
||||||
return uuid;
|
return uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setUuid(final String uuid) {
|
public void setUuid(final String uuid) {
|
||||||
this.uuid = uuid;
|
this.uuid = uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -233,7 +233,7 @@ public class Role implements Serializable, Exportable {
|
||||||
return uuid;
|
return uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setUuid(final String uuid) {
|
public void setUuid(final String uuid) {
|
||||||
this.uuid = uuid;
|
this.uuid = uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,7 @@ public class RoleMembership implements Serializable, Exportable {
|
||||||
return uuid;
|
return uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setUuid(final String uuid) {
|
public void setUuid(final String uuid) {
|
||||||
this.uuid = uuid;
|
this.uuid = uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,7 @@ public class Theme implements Serializable {
|
||||||
return uuid;
|
return uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setUuid(final String uuid) {
|
public void setUuid(final String uuid) {
|
||||||
this.uuid = uuid;
|
this.uuid = uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -125,7 +125,7 @@ public class ThemeFile implements Serializable {
|
||||||
return uuid;
|
return uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setUuid(final String uuid) {
|
public void setUuid(final String uuid) {
|
||||||
this.uuid = uuid;
|
this.uuid = uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -240,7 +240,7 @@ public class Task implements Identifiable, Serializable {
|
||||||
return uuid;
|
return uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setUuid(final String uuid) {
|
public void setUuid(final String uuid) {
|
||||||
this.uuid = uuid;
|
this.uuid = uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,7 @@ public class TaskAssignment implements Serializable, Exportable {
|
||||||
return uuid;
|
return uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setUuid(final String uuid) {
|
public void setUuid(final String uuid) {
|
||||||
this.uuid = uuid;
|
this.uuid = uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,7 @@ public class TaskComment implements Identifiable, Serializable, Exportable {
|
||||||
return uuid;
|
return uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setUuid(final String uuid) {
|
public void setUuid(final String uuid) {
|
||||||
this.uuid = uuid;
|
this.uuid = uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ public class TaskDependency implements Serializable, Exportable {
|
||||||
return uuid;
|
return uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setUuid(final String uuid) {
|
public void setUuid(final String uuid) {
|
||||||
this.uuid = uuid;
|
this.uuid = uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -196,7 +196,7 @@ public class Workflow implements Identifiable, Serializable, Exportable {
|
||||||
return uuid;
|
return uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setUuid(final String uuid) {
|
public void setUuid(final String uuid) {
|
||||||
this.uuid = uuid;
|
this.uuid = uuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue