Source:
private void _saveStructure(ActionForm form, ActionRequest req, ActionResponse res) { try { StructureForm structureForm = (StructureForm) form; boolean newStructure = !UtilMethods.isSet(structureForm.getInode()); boolean publishChanged = false; boolean expireChanged = false; Structure structure = (Structure) req.getAttribute(WebKeys.Structure.STRUCTURE); User user = _getUser(req); HttpServletRequest httpReq = ((ActionRequestImpl) req).getHttpServletRequest(); if (UtilMethods.isSet(structure.getVelocityVarName())) { structureForm.setVelocityVarName(structure.getVelocityVarName()); } BeanUtils.copyProperties(structure, structureForm); if (newStructure) { String structureVelocityName = VelocityUtil.convertToVelocityVariable(structure.getName(), true); structureVelocityName = APILocator.getContentTypeAPI(APILocator.systemUser()).suggestVelocityVar(structureVelocityName); structure.setVelocityVarName(structureVelocityName); } Structure defaultStructure = new StructureTransformer(APILocator.getContentTypeAPI(user).findDefault()).asStructure(); if (!InodeUtils.isSet(defaultStructure.getInode())) { structure.setDefaultStructure(true); } if (newStructure) { structure.setFixed(false); structure.setOwner(user.getUserId()); } StructureFactory.saveStructure(structure); structureForm.setUrlMapPattern(structure.getUrlMapPattern()); List<WorkflowScheme> schemes = new ArrayList<>(); String[] schemeIds = req.getParameterValues("workflowScheme"); for(String schemeId : schemeIds) { if (UtilMethods.isSet(schemeId)) { WorkflowScheme scheme = APILocator.getWorkflowAPI().findScheme(schemeId); schemes.add(scheme); } } APILocator.getWorkflowAPI().saveSchemeForStruct(structure, schemes); CacheLocator.getContentTypeCache().remove(structure); CacheLocator.getContentTypeCache().add(structure); StructureServices.removeStructureFile(structure); String message = "message.structure.savestructure"; if (structure.getStructureType() == 3) { message = "message.form.saveform"; } SessionMessages.add(req, "message", message); } catch (Exception ex) { Logger.error(this.getClass(), ex.toString(),ex); String message = ex.getMessage(); SessionMessages.add(req, "error", message); } }

Target:
private void _saveStructure(ActionForm form, ActionRequest req, ActionResponse res) { try { StructureForm structureForm = (StructureForm) form; boolean newStructure = !UtilMethods.isSet(structureForm.getInode()); boolean publishChanged = false; boolean expireChanged = false; Structure structure = (Structure) req.getAttribute(WebKeys.Structure.STRUCTURE); User user = _getUser(req); HttpServletRequest httpReq = ((ActionRequestImpl) req).getHttpServletRequest(); if (UtilMethods.isSet(structure.getVelocityVarName())) { structureForm.setVelocityVarName(structure.getVelocityVarName()); } BeanUtils.copyProperties(structure, structureForm); if (newStructure) { String structureVelocityName = VelocityUtil.convertToVelocityVariable(structure.getName(), true); structureVelocityName = APILocator.getContentTypeAPI(APILocator.systemUser()).suggestVelocityVar(structureVelocityName); structure.setVelocityVarName(structureVelocityName); } Structure defaultStructure = new StructureTransformer(APILocator.getContentTypeAPI(user).findDefault()).asStructure(); if (!InodeUtils.isSet(defaultStructure.getInode())) { structure.setDefaultStructure(true); } if (newStructure) { structure.setFixed(false); structure.setOwner(user.getUserId()); } StructureFactory.saveStructure(structure); structureForm.setUrlMapPattern(structure.getUrlMapPattern()); final ImmutableList.Builder<WorkflowScheme> schemes = new ImmutableList.Builder<>(); String[] schemeIds = req.getParameterValues("workflowScheme"); for(String schemeId : schemeIds) { if (UtilMethods.isSet(schemeId)) { WorkflowScheme scheme = APILocator.getWorkflowAPI().findScheme(schemeId); schemes.add(scheme); } } APILocator.getWorkflowAPI().saveSchemesForStruct(structure, schemes.build()); CacheLocator.getContentTypeCache().remove(structure); CacheLocator.getContentTypeCache().add(structure); StructureServices.removeStructureFile(structure); String message = "message.structure.savestructure"; if (structure.getStructureType() == 3) { message = "message.form.saveform"; } SessionMessages.add(req, "message", message); } catch (Exception ex) { Logger.error(this.getClass(), ex.toString(),ex); String message = ex.getMessage(); SessionMessages.add(req, "error", message); } }