- adds @Transitional annotation to all marshaller implementations-
- updates export test data

git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@4513 8810af33-2d31-482b-a856-94f89814c4df
ccm-docs
tosmers 2017-01-05 16:45:54 +00:00
parent 96e90014ce
commit a6db3ffd2f
12 changed files with 37 additions and 11 deletions

View File

@ -21,6 +21,7 @@ package org.libreccm.categorization;
import org.libreccm.portation.AbstractMarshaller; import org.libreccm.portation.AbstractMarshaller;
import javax.inject.Inject; import javax.inject.Inject;
import javax.transaction.Transactional;
/** /**
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers</a> * @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers</a>
@ -37,6 +38,7 @@ public class CategoryMarshaller extends AbstractMarshaller<Category> {
} }
@Override @Override
@Transactional(Transactional.TxType.REQUIRED)
protected void insertIntoDb(Category portableObject) { protected void insertIntoDb(Category portableObject) {
categoryRepository.save(portableObject); categoryRepository.save(portableObject);
} }

View File

@ -21,6 +21,7 @@ package org.libreccm.security;
import org.libreccm.portation.AbstractMarshaller; import org.libreccm.portation.AbstractMarshaller;
import javax.inject.Inject; import javax.inject.Inject;
import javax.transaction.Transactional;
/** /**
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers</a> * @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers</a>
@ -37,6 +38,7 @@ public class GroupMarshaller extends AbstractMarshaller<Group> {
} }
@Override @Override
@Transactional(Transactional.TxType.REQUIRED)
protected void insertIntoDb(Group portableObject) { protected void insertIntoDb(Group portableObject) {
groupRepository.save(portableObject); groupRepository.save(portableObject);
} }

View File

@ -22,6 +22,7 @@ import org.libreccm.portation.AbstractMarshaller;
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> * @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers</a>
@ -38,6 +39,7 @@ public class GroupMembershipMarshaller extends AbstractMarshaller<GroupMembershi
} }
@Override @Override
@Transactional(Transactional.TxType.REQUIRED)
protected void insertIntoDb(GroupMembership portableObject) { protected void insertIntoDb(GroupMembership portableObject) {
if (portableObject.getMembershipId() == 0) { if (portableObject.getMembershipId() == 0) {
entityManager.persist(portableObject); entityManager.persist(portableObject);

View File

@ -22,6 +22,7 @@ import org.libreccm.portation.AbstractMarshaller;
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> * @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers</a>
@ -38,6 +39,7 @@ public class PermissionMarshaller extends AbstractMarshaller<Permission> {
} }
@Override @Override
@Transactional(Transactional.TxType.REQUIRED)
protected void insertIntoDb(Permission portableObject) { protected void insertIntoDb(Permission portableObject) {
if (portableObject.getPermissionId() == 0) { if (portableObject.getPermissionId() == 0) {
entityManager.persist(portableObject); entityManager.persist(portableObject);

View File

@ -21,6 +21,7 @@ package org.libreccm.security;
import org.libreccm.portation.AbstractMarshaller; import org.libreccm.portation.AbstractMarshaller;
import javax.inject.Inject; import javax.inject.Inject;
import javax.transaction.Transactional;
/** /**
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers</a> * @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers</a>
@ -37,6 +38,7 @@ public class RoleMarshaller extends AbstractMarshaller<Role> {
} }
@Override @Override
@Transactional(Transactional.TxType.REQUIRED)
protected void insertIntoDb(Role portableObject) { protected void insertIntoDb(Role portableObject) {
roleRepository.save(portableObject); roleRepository.save(portableObject);
} }

View File

@ -22,6 +22,7 @@ import org.libreccm.portation.AbstractMarshaller;
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> * @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers</a>
@ -38,6 +39,7 @@ public class RoleMembershipMarshaller extends AbstractMarshaller<RoleMembership>
} }
@Override @Override
@Transactional(Transactional.TxType.REQUIRED)
protected void insertIntoDb(RoleMembership portableObject) { protected void insertIntoDb(RoleMembership portableObject) {
if (portableObject.getMembershipId() == 0) { if (portableObject.getMembershipId() == 0) {
entityManager.persist(portableObject); entityManager.persist(portableObject);

View File

@ -21,6 +21,7 @@ package org.libreccm.security;
import org.libreccm.portation.AbstractMarshaller; import org.libreccm.portation.AbstractMarshaller;
import javax.inject.Inject; import javax.inject.Inject;
import javax.transaction.Transactional;
/** /**
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers</a> * @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers</a>
@ -37,6 +38,7 @@ public class UserMarshaller extends AbstractMarshaller<User> {
} }
@Override @Override
@Transactional(Transactional.TxType.REQUIRED)
protected void insertIntoDb(User portableObject) { protected void insertIntoDb(User portableObject) {
userRepository.save(portableObject); userRepository.save(portableObject);
} }

View File

@ -21,6 +21,7 @@ package org.libreccm.workflow;
import org.libreccm.portation.AbstractMarshaller; import org.libreccm.portation.AbstractMarshaller;
import javax.inject.Inject; import javax.inject.Inject;
import javax.transaction.Transactional;
/** /**
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers</a> * @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers</a>
@ -37,6 +38,7 @@ public class AssignableTaskMarshaller extends AbstractMarshaller<AssignableTask>
} }
@Override @Override
@Transactional(Transactional.TxType.REQUIRED)
protected void insertIntoDb(AssignableTask portableObject) { protected void insertIntoDb(AssignableTask portableObject) {
assignableTaskRepository.save(portableObject); assignableTaskRepository.save(portableObject);
} }

View File

@ -18,20 +18,13 @@
*/ */
package org.libreccm.workflow; package org.libreccm.workflow;
import static org.libreccm.core.CoreConstants.*;
import com.fasterxml.jackson.annotation.JsonBackReference; import com.fasterxml.jackson.annotation.JsonBackReference;
import com.fasterxml.jackson.annotation.JsonManagedReference; import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import org.libreccm.core.CcmObject; import org.libreccm.core.CcmObject;
import org.libreccm.core.Identifiable; import org.libreccm.core.Identifiable;
import org.libreccm.l10n.LocalizedString; import org.libreccm.l10n.LocalizedString;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import javax.persistence.AssociationOverride; import javax.persistence.AssociationOverride;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Embedded; import javax.persistence.Embedded;
@ -52,6 +45,13 @@ import javax.persistence.NamedQuery;
import javax.persistence.OneToMany; import javax.persistence.OneToMany;
import javax.persistence.Table; import javax.persistence.Table;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import static org.libreccm.core.CoreConstants.DB_SCHEMA;
/** /**
* A task is part of a workflow and represents a specific step in the creation * A task is part of a workflow and represents a specific step in the creation
@ -166,7 +166,9 @@ public class Task implements Identifiable, Serializable {
* Tasks which the depends of this task. * Tasks which the depends of this task.
*/ */
@ManyToMany(mappedBy = "dependsOn") @ManyToMany(mappedBy = "dependsOn")
@JsonManagedReference(value = "dependent-dependson") @JsonIdentityInfo(
generator = ObjectIdGenerators.PropertyGenerator.class,
property = "taskId")
private List<Task> dependentTasks; private List<Task> dependentTasks;
/** /**
@ -179,7 +181,9 @@ public class Task implements Identifiable, Serializable {
@JoinColumn(name = "DEPENDS_ON_TASK_ID")}, @JoinColumn(name = "DEPENDS_ON_TASK_ID")},
inverseJoinColumns = { inverseJoinColumns = {
@JoinColumn(name = "DEPENDENT_TASK_ID")}) @JoinColumn(name = "DEPENDENT_TASK_ID")})
@JsonBackReference(value = "dependent-dependson") @JsonIdentityInfo(
generator = ObjectIdGenerators.PropertyGenerator.class,
property = "taskId")
private List<Task> dependsOn; private List<Task> dependsOn;
/** /**

View File

@ -22,6 +22,7 @@ import org.libreccm.portation.AbstractMarshaller;
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> * @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers</a>
@ -38,6 +39,7 @@ public class TaskAssignmentMarshaller extends AbstractMarshaller<TaskAssignment>
} }
@Override @Override
@Transactional(Transactional.TxType.REQUIRED)
protected void insertIntoDb(TaskAssignment portableObject) { protected void insertIntoDb(TaskAssignment portableObject) {
if (portableObject.getTaskAssignmentId() == 0) { if (portableObject.getTaskAssignmentId() == 0) {
entityManager.persist(portableObject); entityManager.persist(portableObject);

View File

@ -21,6 +21,7 @@ package org.libreccm.workflow;
import org.libreccm.portation.AbstractMarshaller; import org.libreccm.portation.AbstractMarshaller;
import javax.inject.Inject; import javax.inject.Inject;
import javax.transaction.Transactional;
/** /**
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers</a> * @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers</a>
@ -37,6 +38,7 @@ public class WorkflowMarshaller extends AbstractMarshaller<Workflow> {
} }
@Override @Override
@Transactional(Transactional.TxType.REQUIRED)
protected void insertIntoDb(Workflow portableObject) { protected void insertIntoDb(Workflow portableObject) {
workflowRepository.save(portableObject); workflowRepository.save(portableObject);
} }

View File

@ -21,6 +21,7 @@ package org.libreccm.workflow;
import org.libreccm.portation.AbstractMarshaller; import org.libreccm.portation.AbstractMarshaller;
import javax.inject.Inject; import javax.inject.Inject;
import javax.transaction.Transactional;
/** /**
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers</a> * @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers</a>
@ -38,6 +39,7 @@ public class WorkflowTemplateMarshaller extends
} }
@Override @Override
@Transactional(Transactional.TxType.REQUIRED)
protected void insertIntoDb(WorkflowTemplate portableObject) { protected void insertIntoDb(WorkflowTemplate portableObject) {
workflowTemplateRepository.save(portableObject); workflowTemplateRepository.save(portableObject);
} }