Iterator it = rolesPages.keySet().iterator();
while (it.hasNext()) {
String roleName = (String) it.next();
Long sectionId = (Long) rolesPages.get(roleName);
WorkspaceHome newPage = new WorkspaceHome();
newPage.setWorkspace(workspace);
newPage.setRoleId(roleName);
newPage.setSectionId(sectionId);
workspace.getWorkspaceHomes().add(newPage);
}
// Save the changes made to the workspace.
UIServices.lookup().getWorkspacesManager().store(workspace);