use of org.broadleafcommerce.common.sandbox.domain.SandBoxManagementImpl in project BroadleafCommerce by BroadleafCommerce.
the class SandBoxDaoImpl method createSandBox.
@Override
public SandBox createSandBox(String sandBoxName, SandBoxType sandBoxType) {
TransactionStatus status = TransactionUtils.createTransaction("createSandBox", TransactionDefinition.PROPAGATION_REQUIRES_NEW, transactionManager);
try {
SandBox approvalSandbox = retrieveNamedSandBox(sandBoxType, sandBoxName);
if (approvalSandbox == null) {
approvalSandbox = new SandBoxImpl();
approvalSandbox.setName(sandBoxName);
approvalSandbox.setSandBoxType(sandBoxType);
approvalSandbox = persist(approvalSandbox);
SandBoxManagement mgmt = new SandBoxManagementImpl();
mgmt.setSandBox(approvalSandbox);
sandBoxEntityManager.persist(mgmt);
sandBoxEntityManager.flush();
}
TransactionUtils.finalizeTransaction(status, transactionManager, false);
return approvalSandbox;
} catch (Exception ex) {
TransactionUtils.finalizeTransaction(status, transactionManager, true);
throw new RuntimeException(ex);
}
}
Aggregations