@Override public SandBox execute() { List<SandBox> defaultSandBoxes = sandBoxService.retrieveSandBoxesByType(SandBoxType.DEFAULT); if (defaultSandBoxes.size() > 1) { throw new IllegalStateException("Only one sandbox should be configured as default"); } SandBox defaultSandBox; if (defaultSandBoxes.size() == 1) { defaultSandBox = defaultSandBoxes.get(0); } else { defaultSandBox = sandBoxService.createDefaultSandBox(); } SandBox sandBox = sandBoxService.retrieveUserSandBoxForParent(-1L, defaultSandBox.getId()); if (sandBox == null) { sandBox = sandBoxService.createUserSandBox(-1L, defaultSandBox); } return sandBox; } }, siteService.retrievePersistentSiteById(siteId));
protected boolean isSandboxIdValid(String sandboxId) { boolean isValid = false; if (StringUtils.isNotEmpty(sandboxId)) { Long id = Long.valueOf(sandboxId); SandBox sandbox = sandBoxService.retrieveSandBoxById(id); if (sandbox != null) { isValid = true; } } return isValid; }
@Override public PropertyValidationResult validate(Entity entity, Serializable instance, Map<String, FieldMetadata> entityFieldMetadata, Map<String, String> validationConfiguration, BasicFieldMetadata propertyMetadata, String propertyName, String value) { if (value == null) { return new PropertyValidationResult(succeedForNullValues); } Property theProp = entity.getPMap().get(propertyName); if (theProp != null && theProp.getIsDirty()) { if (!sandboxService.checkForExistingApprovalSandboxWithName(value)) { return new PropertyValidationResult(false, ERROR_DUPLICATE_SANDBOX_NAME); } } return new PropertyValidationResult(true); }
if (StringUtils.isNotBlank(request.getParameter(SANDBOX_REQ_PARAM))) { Long sandBoxId = Long.parseLong(request.getParameter(SANDBOX_REQ_PARAM)); sandBox = sandBoxService.retrieveUserSandBoxForParent(adminUser.getId(), sandBoxId); if (sandBox == null) { SandBox approvalOrUserSandBox = sandBoxService.retrieveSandBoxManagementById(sandBoxId); if (approvalOrUserSandBox != null) { if (approvalOrUserSandBox.getSandBoxType().equals(SandBoxType.USER)) { sandBox = approvalOrUserSandBox; } else { sandBox = sandBoxService.createUserSandBox(adminUser.getId(), approvalOrUserSandBox); sandBox = sandBoxService.retrieveSandBoxManagementById(previouslySetSandBoxId); List<SandBox> defaultSandBoxes = sandBoxService.retrieveSandBoxesByType(SandBoxType.DEFAULT); if (defaultSandBoxes.size() > 1) { throw new IllegalStateException("Only one sandbox should be configured as default"); defaultSandBox = defaultSandBoxes.get(0); } else { defaultSandBox = sandBoxService.createDefaultSandBox(); sandBox = sandBoxService.retrieveUserSandBoxForParent(adminUser.getId(), defaultSandBox.getId()); if (sandBox == null) { sandBox = sandBoxService.createUserSandBox(adminUser.getId(), defaultSandBox);
protected SandBox getSandBox() { return sandBoxService.retrieveSandBoxById(SandBoxContext.getSandBoxContext().getSandBoxId()); }
currentSandbox = sandBoxService.retrieveSandBoxById(sandboxId); request.setAttribute(SANDBOX_VAR, currentSandbox); if (currentSandbox != null && !SandBoxType.PRODUCTION.equals(currentSandbox.getSandBoxType())) {
protected SandBox getSandBox() { return sandBoxService.retrieveSandBoxById(SandBoxContext.getSandBoxContext().getSandBoxId()); }
currentSandbox = sandBoxService.retrieveSandBoxById(sandboxId); request.setAttribute(SANDBOX_VAR, currentSandbox); if (currentSandbox != null && !SandBoxType.PRODUCTION.equals(currentSandbox.getSandBoxType())) {