Examples of SectionCopyOption


Examples of org.jboss.dashboard.workspace.copyoptions.SectionCopyOption

                                // Security check.
                                WorkspacePermission sectionPerm = WorkspacePermission.newInstance(workspace, WorkspacePermission.ACTION_CREATE_PAGE);
                                getUserStatus().checkPermission(sectionPerm);

                                // Duplicate
                                SectionCopyOption sco = getCopyOptions(request);
                                Section sectionCopy = getCopyManager().copy(section, workspace, sco);
                                Map<String, String> title = section.getTitle();
                                for (String lang : title.keySet()) {
                                    String desc = title.get(lang);
                                    String prefix = "Copia de ";
View Full Code Here

Examples of org.jboss.dashboard.workspace.copyoptions.SectionCopyOption

            case SectionCopyOption.COPY_ALL:
                return new BasicSectionCopyOption(true);
            case SectionCopyOption.COPY_NONE:
                return new BasicSectionCopyOption(false);
            default:
                SectionCopyOption sco = CopyOption.DEFAULT_SECTION_COPY_OPTION_SAME_WORKSPACE;
                for (Enumeration en = request.getRequestObject().getParameterNames(); en.hasMoreElements();) {
                    String paramName = (String) en.nextElement();
                    if (!paramName.startsWith("duplicatePanelInstance_"))
                        continue;
                    String sDuplicate = request.getParameter(paramName);
                    boolean duplicate = false;
                    if (sDuplicate != null)
                        duplicate = Boolean.valueOf(sDuplicate).booleanValue();
                    String panelInstanceId = paramName.substring("duplicatePanelInstance_".length());
                    log.debug("PanelInstance with id=" + panelInstanceId + " will " + (duplicate ? "" : "not ") + "be duplicated.");
                    sco.addPanelInstanceToDuplicate(panelInstanceId, duplicate);
                }
                return sco;
        }
    }
View Full Code Here

Examples of org.jboss.dashboard.workspace.copyoptions.SectionCopyOption


        final Section[] results = new Section[]{null};
        HibernateTxFragment txFragment = new HibernateTxFragment() {
            protected void txFragment(Session session) throws Exception {
                SectionCopyOption copyOption = sco;
                log.debug("Copying section " + section.getId() + " to Workspace " + workspace.getId());
                if (copyOption == null) {
                    if (workspace.getId().equals(section.getWorkspace().getId()))
                        copyOption = CopyOption.DEFAULT_SECTION_COPY_OPTION_SAME_WORKSPACE;
                    else
                        copyOption = CopyOption.DEFAULT_SECTION_COPY_OPTION_OTHER_WORKSPACE;
                }
                Section sectionCopy = (Section) section.clone();
                sectionCopy.setPosition(-1); //Let the workspace decide the position later
                sectionCopy.setWorkspace(workspace);
                boolean copyingToSameWorkspace = workspace.getId().equals(section.getWorkspace().getId());
                if (copyingToSameWorkspace) {//Section in same workspace-> can't reuse the id
                    sectionCopy.setId(null);
                } else {//Section in different workspace-> can reuse the url
                    sectionCopy.setFriendlyUrl(section.getFriendlyUrl());
                }
                if (log.isDebugEnabled())
                    log.debug("Storing basic section copy to workspace " + workspace.getId());
                UIServices.lookup().getSectionsManager().store(sectionCopy);

                // Add to destination workspace
                if (log.isDebugEnabled())
                    log.debug("Adding cloned section (" + sectionCopy.getId() + ") to workspace " + workspace.getId());
                workspace.addSection(sectionCopy);
                UIServices.lookup().getWorkspacesManager().store(workspace);

                //Resources
                copyResources(section, sectionCopy);

                // Panels inside section
                LayoutRegion[] regions = section.getLayout().getRegions();
                log.debug("Regions in section are " + Arrays.asList(regions));
                Hashtable panelInstanceMappings = new Hashtable();
                for (int i = 0; i < regions.length; i++) {
                    LayoutRegion region = regions[i];
                    Panel[] panels = section.getPanels(region);
                    if (log.isDebugEnabled())
                        log.debug("Copying " + panels.length + " panels in region " + region);
                    for (int j = 0; panels != null && j < panels.length; j++) {
                        Panel panelClone = null;
                        PanelInstance instanceClone = panels[j].getInstance();
                        String panelInstanceId = panels[j].getInstanceId().toString();
                        if (copyOption.isDuplicatePanelInstance(panelInstanceId)) { //Duplicate Panel instance for this panel.
                            if (panelInstanceMappings.containsKey(panelInstanceId)) {
                                instanceClone = (PanelInstance) panelInstanceMappings.get(panelInstanceId);
                            } else {
                                instanceClone = copy(panels[j].getInstance(), workspace);
                                panelInstanceMappings.put(panelInstanceId, instanceClone);
View Full Code Here

Examples of org.jboss.dashboard.workspace.copyoptions.SectionCopyOption


        final Section[] results = new Section[]{null};
        HibernateTxFragment txFragment = new HibernateTxFragment() {
            protected void txFragment(Session session) throws Exception {
                SectionCopyOption copyOption = sco;
                log.debug("Copying section " + section.getId() + " to Workspace " + workspace.getId());
                if (copyOption == null) {
                    if (workspace.getId().equals(section.getWorkspace().getId()))
                        copyOption = CopyOption.DEFAULT_SECTION_COPY_OPTION_SAME_WORKSPACE;
                    else
                        copyOption = CopyOption.DEFAULT_SECTION_COPY_OPTION_OTHER_WORKSPACE;
                }
                Section sectionCopy = (Section) section.clone();
                sectionCopy.setPosition(-1); //Let the workspace decide the position later
                sectionCopy.setWorkspace(workspace);
                boolean copyingToSameWorkspace = workspace.getId().equals(section.getWorkspace().getId());
                if (copyingToSameWorkspace) {//Section in same workspace-> can't reuse the id
                    sectionCopy.setId(null);
                } else {//Section in different workspace-> can reuse the url
                    sectionCopy.setFriendlyUrl(section.getFriendlyUrl());
                }
                if (log.isDebugEnabled())
                    log.debug("Storing basic section copy to workspace " + workspace.getId());
                UIServices.lookup().getSectionsManager().store(sectionCopy);

                // Add to destination workspace
                if (log.isDebugEnabled())
                    log.debug("Adding cloned section (" + sectionCopy.getId() + ") to workspace " + workspace.getId());
                workspace.addSection(sectionCopy);
                UIServices.lookup().getWorkspacesManager().store(workspace);

                //Resources
                copyResources(section, sectionCopy);

                // Panels inside section
                LayoutRegion[] regions = section.getLayout().getRegions();
                log.debug("Regions in section are " + Arrays.asList(regions));
                Hashtable panelInstanceMappings = new Hashtable();
                for (int i = 0; i < regions.length; i++) {
                    LayoutRegion region = regions[i];
                    Panel[] panels = section.getPanels(region);
                    if (log.isDebugEnabled())
                        log.debug("Copying " + panels.length + " panels in region " + region);
                    for (int j = 0; panels != null && j < panels.length; j++) {
                        Panel panelClone = null;
                        PanelInstance instanceClone = panels[j].getInstance();
                        String panelInstanceId = panels[j].getInstanceId().toString();
                        if (copyOption.isDuplicatePanelInstance(panelInstanceId)) { //Duplicate Panel instance for this panel.
                            if (panelInstanceMappings.containsKey(panelInstanceId)) {
                                instanceClone = (PanelInstance) panelInstanceMappings.get(panelInstanceId);
                            } else {
                                instanceClone = copy(panels[j].getInstance(), workspace);
                                panelInstanceMappings.put(panelInstanceId, instanceClone);
View Full Code Here

Examples of org.jboss.dashboard.workspace.copyoptions.SectionCopyOption

                                // Security check.
                                WorkspacePermission sectionPerm = WorkspacePermission.newInstance(workspace, WorkspacePermission.ACTION_CREATE_PAGE);
                                getUserStatus().checkPermission(sectionPerm);

                                // Duplicate
                                SectionCopyOption sco = getCopyOptions(request);
                                Section sectionCopy = getCopyManager().copy(section, workspace, sco);
                                Map<String, String> title = section.getTitle();
                                for (String lang : title.keySet()) {
                                    String desc = title.get(lang);
                                    String prefix = "Copia de ";
View Full Code Here

Examples of org.jboss.dashboard.workspace.copyoptions.SectionCopyOption

            case SectionCopyOption.COPY_ALL:
                return new BasicSectionCopyOption(true);
            case SectionCopyOption.COPY_NONE:
                return new BasicSectionCopyOption(false);
            default:
                SectionCopyOption sco = CopyOption.DEFAULT_SECTION_COPY_OPTION_SAME_WORKSPACE;
                for (Enumeration en = request.getRequestObject().getParameterNames(); en.hasMoreElements();) {
                    String paramName = (String) en.nextElement();
                    if (!paramName.startsWith("duplicatePanelInstance_"))
                        continue;
                    String sDuplicate = request.getParameter(paramName);
                    boolean duplicate = false;
                    if (sDuplicate != null)
                        duplicate = Boolean.valueOf(sDuplicate).booleanValue();
                    String panelInstanceId = paramName.substring("duplicatePanelInstance_".length());
                    log.debug("PanelInstance with id=" + panelInstanceId + " will " + (duplicate ? "" : "not ") + "be duplicated.");
                    sco.addPanelInstanceToDuplicate(panelInstanceId, duplicate);
                }
                return sco;
        }
    }
View Full Code Here

Examples of org.jboss.dashboard.workspace.copyoptions.SectionCopyOption


        final Section[] results = new Section[]{null};
        HibernateTxFragment txFragment = new HibernateTxFragment() {
            protected void txFragment(Session session) throws Exception {
                SectionCopyOption copyOption = sco;
                log.debug("Copying section " + section.getId() + " to Workspace " + workspace.getId());
                if (copyOption == null) {
                    if (workspace.getId().equals(section.getWorkspace().getId()))
                        copyOption = CopyOption.DEFAULT_SECTION_COPY_OPTION_SAME_WORKSPACE;
                    else
                        copyOption = CopyOption.DEFAULT_SECTION_COPY_OPTION_OTHER_WORKSPACE;
                }
                Section sectionCopy = (Section) section.clone();
                sectionCopy.setPosition(-1); //Let the workspace decide the position later
                sectionCopy.setWorkspace(workspace);
                boolean copyingToSameWorkspace = workspace.getId().equals(section.getWorkspace().getId());
                if (copyingToSameWorkspace) {//Section in same workspace-> can't reuse the id
                    sectionCopy.setId(null);
                } else {//Section in different workspace-> can reuse the url
                    sectionCopy.setFriendlyUrl(section.getFriendlyUrl());
                }
                if (log.isDebugEnabled())
                    log.debug("Storing basic section copy to workspace " + workspace.getId());
                UIServices.lookup().getSectionsManager().store(sectionCopy);

                // Add to destination workspace
                if (log.isDebugEnabled())
                    log.debug("Adding cloned section (" + sectionCopy.getId() + ") to workspace " + workspace.getId());
                workspace.addSection(sectionCopy);
                UIServices.lookup().getWorkspacesManager().store(workspace);

                //Resources
                copyResources(section, sectionCopy);

                // Panels inside section
                LayoutRegion[] regions = section.getLayout().getRegions();
                log.debug("Regions in section are " + Arrays.asList(regions));
                Hashtable panelInstanceMappings = new Hashtable();
                for (int i = 0; i < regions.length; i++) {
                    LayoutRegion region = regions[i];
                    Panel[] panels = section.getPanels(region);
                    if (log.isDebugEnabled())
                        log.debug("Copying " + panels.length + " panels in region " + region);
                    for (int j = 0; panels != null && j < panels.length; j++) {
                        Panel panelClone = null;
                        PanelInstance instanceClone = panels[j].getInstance();
                        String panelInstanceId = panels[j].getInstanceId().toString();
                        if (copyOption.isDuplicatePanelInstance(panelInstanceId)) { //Duplicate Panel instance for this panel.
                            if (panelInstanceMappings.containsKey(panelInstanceId)) {
                                instanceClone = (PanelInstance) panelInstanceMappings.get(panelInstanceId);
                            } else {
                                instanceClone = copy(panels[j].getInstance(), workspace);
                                panelInstanceMappings.put(panelInstanceId, instanceClone);
View Full Code Here

Examples of org.jboss.dashboard.workspace.copyoptions.SectionCopyOption

                                // Security check.
                                WorkspacePermission sectionPerm = WorkspacePermission.newInstance(workspace, WorkspacePermission.ACTION_CREATE_PAGE);
                                getUserStatus().checkPermission(sectionPerm);

                                // Duplicate
                                SectionCopyOption sco = getCopyOptions(request);
                                Section sectionCopy = getCopyManager().copy(section, workspace, sco);
                                Map title = section.getTitle();
                                for (Iterator it = title.keySet().iterator(); it.hasNext();) {
                                    String lang = (String) it.next();
                                    String desc = (String) title.get(lang);
View Full Code Here

Examples of org.jboss.dashboard.workspace.copyoptions.SectionCopyOption

            case SectionCopyOption.COPY_ALL:
                return new BasicSectionCopyOption(true);
            case SectionCopyOption.COPY_NONE:
                return new BasicSectionCopyOption(false);
            default:
                SectionCopyOption sco = CopyOption.DEFAULT_SECTION_COPY_OPTION_SAME_WORKSPACE;
                for (Enumeration en = request.getRequestObject().getParameterNames(); en.hasMoreElements();) {
                    String paramName = (String) en.nextElement();
                    if (!paramName.startsWith("duplicatePanelInstance_"))
                        continue;
                    String sDuplicate = request.getParameter(paramName);
                    boolean duplicate = false;
                    if (sDuplicate != null)
                        duplicate = Boolean.valueOf(sDuplicate).booleanValue();
                    String panelInstanceId = paramName.substring("duplicatePanelInstance_".length());
                    log.debug("PanelInstance with id=" + panelInstanceId + " will " + (duplicate ? "" : "not ") + "be duplicated.");
                    sco.addPanelInstanceToDuplicate(panelInstanceId, duplicate);
                }
                return sco;
        }
    }
View Full Code Here

Examples of org.jboss.dashboard.workspace.copyoptions.SectionCopyOption

                                // Security check.
                                WorkspacePermission sectionPerm = WorkspacePermission.newInstance(workspace, WorkspacePermission.ACTION_CREATE_PAGE);
                                getUserStatus().checkPermission(sectionPerm);

                                // Duplicate
                                SectionCopyOption sco = getCopyOptions(request);
                                Section sectionCopy = getCopyManager().copy(section, workspace, sco);
                                Map title = section.getTitle();
                                for (Iterator it = title.keySet().iterator(); it.hasNext();) {
                                    String lang = (String) it.next();
                                    String desc = (String) title.get(lang);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.