Source:
public String createWorkspaceOld() { String navResult = null; if (!useTemplateFlag || selectedTemplateId.equals("none")) { navResult = documentActions.saveDocument(tmpWorkspace); } else { DocumentRef currentDocRef = navigationContext.getCurrentDocument().getRef(); String title = (String) tmpWorkspace.getProperty("dublincore", "title"); String name = Framework.getService(PathSegmentService.class).generatePathSegment(title); documentManager.copy(new IdRef(selectedTemplateId), currentDocRef, name); DocumentModel created = documentManager.getChild(currentDocRef, name); created.setProperty("dublincore", "title", title); String descr = (String) tmpWorkspace.getProperty("dublincore", "description"); if (!descr.equals("")) { created.setProperty("dublincore", "description", descr); } Blob blob = (Blob) tmpWorkspace.getProperty("file", "content"); if (blob != null) { created.setProperty("file", "content", blob); String fname = (String) tmpWorkspace.getProperty("file", "filename"); created.setProperty("file", "filename", fname); } created = documentManager.saveDocument(created); documentManager.save(); navResult = navigationContext.navigateToDocument(created, "after-create"); } if (!selectedSecurityModel.equals("inherit")) { List<String> principalsName; if (selectedOwnerModel.equals("me")) { principalsName = new ArrayList<String>(); principalsName.add(currentUser.getName()); } else { principalsName = principalListManager.getSelectedUsers(); } for (String principalName : principalsName) { securityActions.addPermission(principalName, SecurityConstants.EVERYTHING, true); } principalsName.addAll(userManager.getAdministratorsGroups()); securityActions.addPermission(SecurityConstants.EVERYONE, SecurityConstants.EVERYTHING, false); securityActions.updateSecurityOnDocument(); } String res = navigationContext.navigateToDocument(navigationContext.getCurrentDocument()); navigationContext.setChangeableDocument(navigationContext.getCurrentDocument()); return res; }

Target:
public String createWorkspaceOld() { String navResult = null; if (!useTemplateFlag || selectedTemplateId.equals("none")) { navResult = documentActions.saveDocument(tmpWorkspace); } else { DocumentRef currentDocRef = navigationContext.getCurrentDocument().getRef(); String title = (String) tmpWorkspace.getProperty("dublincore", "title"); String name = Framework.getService(PathSegmentService.class).generatePathSegment(title); documentManager.copy(new IdRef(selectedTemplateId), currentDocRef, name); DocumentModel created = documentManager.getChild(currentDocRef, name); created.setProperty("dublincore", "title", title); String descr = (String) tmpWorkspace.getProperty("dublincore", "description"); if (!descr.equals("")) { created.setProperty("dublincore", "description", descr); } Blob blob = (Blob) tmpWorkspace.getProperty("file", "content"); if (blob != null) { created.setProperty("file", "content", blob); } created = documentManager.saveDocument(created); documentManager.save(); navResult = navigationContext.navigateToDocument(created, "after-create"); } if (!selectedSecurityModel.equals("inherit")) { List<String> principalsName; if (selectedOwnerModel.equals("me")) { principalsName = new ArrayList<String>(); principalsName.add(currentUser.getName()); } else { principalsName = principalListManager.getSelectedUsers(); } for (String principalName : principalsName) { securityActions.addPermission(principalName, SecurityConstants.EVERYTHING, true); } principalsName.addAll(userManager.getAdministratorsGroups()); securityActions.addPermission(SecurityConstants.EVERYONE, SecurityConstants.EVERYTHING, false); securityActions.updateSecurityOnDocument(); } String res = navigationContext.navigateToDocument(navigationContext.getCurrentDocument()); navigationContext.setChangeableDocument(navigationContext.getCurrentDocument()); return res; }