Examples of GWTJahiaPublicationInfo


Examples of org.jahia.ajax.gwt.client.data.publication.GWTJahiaPublicationInfo

    public Map<String,GWTJahiaPublicationInfo> getAggregatedPublicationInfosByLanguage(String uuid, Set<String> languages, JCRSessionWrapper currentUserSession) throws GWTJahiaServiceException {
        try {
            HashMap<String, GWTJahiaPublicationInfo> infos = new HashMap<String, GWTJahiaPublicationInfo>();
            PublicationInfo pubInfo = publicationService.getPublicationInfo(uuid, languages, true, true, false, currentUserSession.getWorkspace().getName(), Constants.LIVE_WORKSPACE).get(0);
            for (String language : languages) {
                GWTJahiaPublicationInfo gwtInfo = new GWTJahiaPublicationInfo(pubInfo.getRoot().getUuid(), pubInfo.getRoot().getStatus(), pubInfo.getRoot().isCanPublish(language));
                if (pubInfo.getRoot().isLocked()  ) {
//                gwtInfo.setLocked(true);
                }
                for (PublicationInfoNode sub : pubInfo.getRoot().getChildren()) {
                    if (sub.getPath().contains("/j:translation_"+language)) {
                        if (sub.getStatus() > gwtInfo.getStatus()) {
                            gwtInfo.setStatus(sub.getStatus());
                        }
                        if (gwtInfo.getStatus() == GWTJahiaPublicationInfo.UNPUBLISHED && sub.getStatus() != GWTJahiaPublicationInfo.UNPUBLISHED) {
                            gwtInfo.setStatus(sub.getStatus());
                        }
                        if (sub.isLocked()) {
                            gwtInfo.setLocked(true);
                        }
                    }
                }


                if (gwtInfo.getStatus() < GWTJahiaPublicationInfo.NOT_PUBLISHED) {
                    Set<Integer> status = new HashSet<Integer>(pubInfo.getTreeStatus(language));
                    for (PublicationInfo refInfo : pubInfo.getAllReferences()) {
                        status.addAll(refInfo.getTreeStatus(language));
                    }
                    if (!status.isEmpty() && Collections.max(status) > GWTJahiaPublicationInfo.PUBLISHED) {
                        gwtInfo.setStatus(GWTJahiaPublicationInfo.MODIFIED);
                    }
                }
               
                infos.put(language, gwtInfo);
            }
View Full Code Here

Examples of org.jahia.ajax.gwt.client.data.publication.GWTJahiaPublicationInfo

    }

    private GWTJahiaPublicationInfo convert(OrderedMap all, PublicationInfoNode root, List<String> mainPaths,
                                            WorkflowRule lastRule, PublicationInfoNode node, List<PublicationInfo> references,
                                            JCRSessionWrapper currentUserSession, String language) {
        GWTJahiaPublicationInfo gwtInfo = new GWTJahiaPublicationInfo(node.getUuid(), node.getStatus(), node.isCanPublish(language));
        try {
            JCRNodeWrapper jcrNode;
            if (node.getStatus() == PublicationInfo.DELETED) {
                JCRSessionWrapper liveSession = JCRTemplate.getInstance().getSessionFactory().getCurrentUserSession("live", currentUserSession.getLocale(), currentUserSession.getFallbackLocale());
                jcrNode = liveSession.getNodeByUUID(node.getUuid());
            } else {
                jcrNode = currentUserSession.getNodeByUUID(node.getUuid());
                if (lastRule == null || jcrNode.hasNode(WorkflowService.WORKFLOWRULES_NODE_NAME)) {
                    WorkflowRule rule = workflowService.getWorkflowRuleForAction(jcrNode, null, "publish", null);
                    if (rule != null) {
                        if (!rule.equals(lastRule)) {
                            if (workflowService.getWorkflowRuleForAction(jcrNode, currentUserSession.getUser() , "publish", null) != null) {
                                lastRule = rule;
                            } else {
                                lastRule = null;
                            }
                        }
                    }
                }
            }
            if (jcrNode.hasProperty("jcr:title")) {
                gwtInfo.setTitle(jcrNode.getProperty("jcr:title").getString());
            } else {
                gwtInfo.setTitle(jcrNode.getName());
            }
            gwtInfo.setNodetype(jcrNode.getPrimaryNodeType().getLabel(currentUserSession.getLocale()));
        } catch (RepositoryException e1) {
            gwtInfo.setTitle(node.getPath());
        }

        String mainPath = root.getPath();
        gwtInfo.setMainPath(mainPath);
        gwtInfo.setMainUUID(root.getUuid());
        gwtInfo.setLanguage(language);
        if (!mainPaths.contains(mainPath)) {
            mainPaths.add(mainPath);
        }
        gwtInfo.setMainPathIndex(mainPaths.indexOf(mainPath));
        Map<String, GWTJahiaPublicationInfo> gwtInfos = new HashMap<String, GWTJahiaPublicationInfo>();
        gwtInfos.put(node.getPath(), gwtInfo);
        List<String> refUuids = new ArrayList<String>();
        if (node.isLocked()  ) {
//            gwtInfo.setLocked(true);
        }

        all.put(node.getUuid(), gwtInfo);


        if (lastRule != null) {
            gwtInfo.setWorkflowGroup(language + lastRule.getDefinitionPath());
            gwtInfo.setWorkflowDefinition(lastRule.getProviderKey()+":"+lastRule.getWorkflowDefinitionKey());
        } else {
            gwtInfo.setWorkflowGroup("no-workflow");
        }

        for (PublicationInfoNode sub : node.getChildren()) {
            if (sub.getPath().contains("/j:translation_"+language)) {
                String key = StringUtils.substringBeforeLast(sub.getPath(), "/j:translation");
                GWTJahiaPublicationInfo lastPub = gwtInfos.get(key);
                if (lastPub != null) {
                    if (sub.getStatus() > lastPub.getStatus()) {
                        lastPub.setStatus(sub.getStatus());
                    }
                    if (lastPub.getStatus() == GWTJahiaPublicationInfo.UNPUBLISHED && sub.getStatus() != GWTJahiaPublicationInfo.UNPUBLISHED) {
                        lastPub.setStatus(sub.getStatus());
                    }
                    if (sub.isLocked()) {
                        gwtInfo.setLocked(true);
                    }
                    lastPub.setI18NUuid(sub.getUuid());
                }
//                references.addAll(sub.getReferences());
                for (PublicationInfo pi : sub.getReferences()) {
                    if (!refUuids.contains(pi.getRoot().getUuid()) && !all.containsKey(pi.getRoot().getUuid())) {
                        refUuids.add(pi.getRoot().getUuid() );
View Full Code Here

Examples of org.jahia.ajax.gwt.client.data.publication.GWTJahiaPublicationInfo

                                  ListStore<ModelData> store) {

            GWTJahiaNode node = (GWTJahiaNode) model;
            Map<String,GWTJahiaPublicationInfo> infos = node.getAggregatedPublicationInfos();
            if (infos != null) {
                GWTJahiaPublicationInfo info = infos.get(getDataIndex());

                TableData td = new TableData();
                td.setHorizontalAlign(Style.HorizontalAlignment.CENTER);
                td.setVerticalAlign(Style.VerticalAlignment.MIDDLE);

                HorizontalPanel p = new HorizontalPanel();
                final LayoutContainer ctn = new LayoutContainer();
                ctn.addStyleName("x-grid3-check-col");
                ctn.addStyleName("x-grid3-check-col" + getCheckState(node, info));
                ctn.addStyleName("x-grid3-cc-"+ getId() + "-" + config.name);
                ctn.setWidth(16);
                ctn.setHeight(16);
                p.add(ctn,td);
                Object res = GWTJahiaPublicationInfo.renderPublicationStatusImage(info);
                if (res instanceof Widget) {
                    p.add((Widget) res, td);
                }
                if (info.isLocked()) {
                    p.add(StandardIconsProvider.STANDARD_ICONS.lock().createImage());
                    ctn.addStyleName("x-grid3-check-col-disabled");
                }
                return p;
            } else {
View Full Code Here

Examples of org.jahia.ajax.gwt.client.data.publication.GWTJahiaPublicationInfo

                        setEnabled(false);
                        updateTitle(Messages.get("label.workflow.started", "Workflow started") + " : " +wf.getDefinition().getDisplayName());
                    }
                } else {
                    wf = null;
                    GWTJahiaPublicationInfo info = gwtJahiaNode.getAggregatedPublicationInfo();

                    setEnabled(GWTJahiaPublicationInfo.canPublish(gwtJahiaNode, info,
                            JahiaGWTParameters.getLanguage()));
                    if(gwtJahiaNode.isFile() || gwtJahiaNode.isNodeType("nt:folder")) {
                        updateTitle(getGwtToolbarItem().getTitle() + " " + gwtJahiaNode.getDisplayName());
View Full Code Here

Examples of org.jahia.ajax.gwt.client.data.publication.GWTJahiaPublicationInfo

    }

    public void handleNewLinkerSelection() {
        GWTJahiaNode gwtJahiaNode = linker.getSelectionContext().getSingleSelection();
        if (gwtJahiaNode != null && gwtJahiaNode.getAggregatedPublicationInfos() != null) {
            GWTJahiaPublicationInfo info = gwtJahiaNode.getAggregatedPublicationInfo();
            setEnabled(!info.isLocked() && info.isCanPublish() &&
                       (info.getStatus() == GWTJahiaPublicationInfo.PUBLISHED ||
                        info.getStatus() == GWTJahiaPublicationInfo.MODIFIED));
            updateTitle(getGwtToolbarItem().getTitle() + " " + gwtJahiaNode.getDisplayName() + " - " +
                        JahiaGWTParameters.getLanguageDisplayName());
        } else {
            setEnabled(false);
        }
View Full Code Here

Examples of org.jahia.ajax.gwt.client.data.publication.GWTJahiaPublicationInfo

    public void handleNewLinkerSelection() {
        GWTJahiaNode gwtJahiaNode = linker.getSelectionContext().getSingleSelection();

        if (gwtJahiaNode != null) {
            GWTJahiaPublicationInfo info = gwtJahiaNode.getAggregatedPublicationInfo();
//            setEnabled(info.getStatus() == GWTJahiaPublicationInfo.LIVE_MODIFIED || info.getSubnodesStatus().contains(GWTJahiaPublicationInfo.LIVE_MODIFIED));
            setEnabled(true);
            updateTitle(getGwtToolbarItem().getTitle() + " " + gwtJahiaNode.getName());
        }
    }
View Full Code Here

Examples of org.jahia.ajax.gwt.client.data.publication.GWTJahiaPublicationInfo

                            if (activeLayers.containsKey("acl") && m.getNode().isHasAcl()) {
                                images.add(ToolbarIconProvider.getInstance().getIcon(
                                        "viewACLStatus"));
                            }
                            if (activeLayers.containsKey("publication")) {
                                GWTJahiaPublicationInfo info = m.getNode()
                                        .getAggregatedPublicationInfo();
                                if (lastUnpublished == null
                                        || !m.getNode().getPath().startsWith(lastUnpublished)) {
                                    if (info.isLocked()) {
                                        images.add(ToolbarIconProvider.getInstance().getIcon(
                                                "publication/locked"));
                                    }

                                    if (info.getStatus() == GWTJahiaPublicationInfo.NOT_PUBLISHED
                                            || info.getStatus() == GWTJahiaPublicationInfo.UNPUBLISHED) {
                                        lastUnpublished = m.getNode().getPath();
                                        if (info.getStatus() == GWTJahiaPublicationInfo.UNPUBLISHED) {
                                            images.add(ToolbarIconProvider.getInstance().getIcon(
                                                    "publication/unpublished"));
                                        } else {
                                            images.add(ToolbarIconProvider.getInstance().getIcon(
                                                    "publication/notpublished"));
                                        }
                                    } else if (info.getStatus() == GWTJahiaPublicationInfo.MODIFIED) {
                                        images.add(ToolbarIconProvider.getInstance().getIcon(
                                                "publication/modified"));
                                    } else if (info.getStatus() == GWTJahiaPublicationInfo.MANDATORY_LANGUAGE_UNPUBLISHABLE) {
                                        images.add(ToolbarIconProvider.getInstance().getIcon(
                                                "publication/mandatorylanguageunpublishable"));
                                    } else if (info.getStatus() == GWTJahiaPublicationInfo.MANDATORY_LANGUAGE_VALID) {
                                        images.add(ToolbarIconProvider.getInstance().getIcon(
                                                "publication/mandatorylanguagevalid"));
                                    }
                                }
                            }
View Full Code Here

Examples of org.jahia.ajax.gwt.client.data.publication.GWTJahiaPublicationInfo

        String lastUnpublished = null;
        boolean allPublished = true;
        for (Module module : moduleList) {
            if (module.getNode() != null) {
                GWTJahiaPublicationInfo info = module.getNode().getAggregatedPublicationInfo();
                if (info.getStatus() != GWTJahiaPublicationInfo.PUBLISHED) {
                    allPublished = false;
                    if (lastUnpublished != null && module.getNode().getPath().startsWith(lastUnpublished)) {
                        continue;
                    }

                    final String label = GWTJahiaPublicationInfo.statusToLabel.get(info.getStatus());
                    String status = Messages.get("label.publication." + label, label);

                    if (info.isLocked()) {
                        infoLayers.addInfoLayer(module, Messages.get("label.publication.locked", "locked"), "orange", "orange", removeListener, true,
                                "0.7");
                    } else if (info.getStatus() == GWTJahiaPublicationInfo.NOT_PUBLISHED || info.getStatus() == GWTJahiaPublicationInfo.UNPUBLISHED) {
                        lastUnpublished = module.getNode().getPath();
                        if (info.getStatus() == GWTJahiaPublicationInfo.UNPUBLISHED) {
                            infoLayers.addInfoLayer(module, status, "black", "black", removeListener, false,
                                    "0.7");
                        } else {
                            infoLayers.addInfoLayer(module, status, "black", "black", removeListener, false,
                                    "0.7");
                        }
                    } else if (info.getStatus() == GWTJahiaPublicationInfo.MODIFIED) {
                        infoLayers.addInfoLayer(module, status, "red", "red", removeListener, true,
                                "0.7");
                    } else if (info.getStatus() == GWTJahiaPublicationInfo.LIVE_MODIFIED) {
                        infoLayers.addInfoLayer(module, status, "blue", "blue", removeListener, true,
                                "0.7");
                    } else if (info.getStatus() == GWTJahiaPublicationInfo.CONFLICT) {
                        infoLayers.addInfoLayer(module, status, "red", "red", removeListener, true,
                                "0.7");
                    } else if (info.getStatus() == GWTJahiaPublicationInfo.MANDATORY_LANGUAGE_UNPUBLISHABLE) {
                        infoLayers.addInfoLayer(module, status, "red", "red", removeListener, true,
                                "0.7");
                    } else if (info.getStatus() == GWTJahiaPublicationInfo.MANDATORY_LANGUAGE_VALID) {
                        infoLayers.addInfoLayer(module, status, "red", "red", removeListener, true,
                                "0.7");
                    }
                }
            }
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.