Package org.exoplatform.portal.mop.navigation

Examples of org.exoplatform.portal.mop.navigation.NodeState$Builder


    public PageNode getChild(String name) {
        return getNode(name);
    }

    public NodeState getState() {
        return new NodeState(labels.getSimple(), icon, startPublicationDate == null ? -1 : startPublicationDate.getTime(),
                endPublicationDate == null ? -1 : endPublicationDate.getTime(), visibility,
                pageReference != null ? PageKey.parse(pageReference) : null);
    }
View Full Code Here


    public PageNode getChild(String name) {
        return getNode(name);
    }

    public NodeState getState() {
        return new NodeState(labels.getSimple(), icon, startPublicationDate == null ? -1 : startPublicationDate.getTime(),
                endPublicationDate == null ? -1 : endPublicationDate.getTime(), visibility,
                pageReference != null ? PageKey.parse(pageReference) : null);
    }
View Full Code Here

            index = parent.get((previous).getName()).getIndex() + 1;
        } else {
            index = 0;
        }
        NodeContext<?> child = parent.add(index, name);
        NodeState state = target.getState();
        child.setState(state);

        //
        if (description != null) {
            labelMap.put(child, description);
View Full Code Here

      else
      {
         index = 0;
      }
      NodeContext<?> child = parent.add(index, name);
      NodeState state = target.getState();
      child.setState(state);

      //
      if (description != null)
      {
View Full Code Here

      return getNode(name);
   }

   public NodeState getState()
   {
      return new NodeState(
         labels.getSimple(),
         icon,
         startPublicationDate == null ? -1 : startPublicationDate.getTime(),
         endPublicationDate == null ? -1 : endPublicationDate.getTime(),
         visibility,
View Full Code Here

            throw new IllegalArgumentException("Value class is not the same as key type");
        }

        T oldValue = get(key);

        NodeState oldState = context.getState();
        AttributesState oldAttributes = oldState.getAttributesState();
        String stringValue = value != null ? toString(key.getType(), value) : null;
        AttributesState newAttributes = new AttributesState.Builder(oldAttributes).attribute(key.getName(), stringValue).build();
        NodeState newState = new NodeState.Builder(oldState).attributes(newAttributes).build();
        context.setState(newState);

        return oldValue;
    }
View Full Code Here

    /**
     * @see java.util.Map#put(java.lang.Object, java.lang.Object)
     */
    @Override
    public String put(String key, String value) {
        NodeState oldState = context.getState();
        AttributesState oldAttributes = oldState.getAttributesState();
        AttributesState newAttributes = new AttributesState.Builder(oldAttributes).attribute(key, value).build();
        NodeState newState = new NodeState.Builder(oldState).attributes(newAttributes).build();
        context.setState(newState);
        return oldAttributes != null ? oldAttributes.get(key) : null;
    }
View Full Code Here

    /**
     * @see java.util.Map#putAll(java.util.Map)
     */
    @Override
    public void putAll(Map<? extends String, ? extends String> m) {
        NodeState oldState = context.getState();
        AttributesState oldAttributes = oldState.getAttributesState();
        AttributesState newAttributes = new AttributesState.Builder(oldAttributes).attributes(m).build();
        NodeState newState = new NodeState.Builder(oldState).attributes(newAttributes).build();
        context.setState(newState);
    }
View Full Code Here

    /**
     * @see java.util.Map#clear()
     */
    @Override
    public void clear() {
        NodeState oldState = context.getState();
        NodeState newState = new NodeState.Builder(oldState).attributes(AttributesState.EMPTY).build();
        context.setState(newState);
    }
View Full Code Here

    private static PageNode createPageNode(DescriptionService service, NodeContext<NodeContext<?>> node) {
        PageNode pageNode = new PageNode();
        pageNode.setName(node.getName());

        NodeState nodeState = node.getState();
        if (nodeState.getLabel() == null) {
            Map<Locale, Described.State> descriptions = service.getDescriptions(node.getId());
            if (descriptions != null && !descriptions.isEmpty()) {
                I18NString labels = new I18NString();
                for (Map.Entry<Locale, Described.State> entry : descriptions.entrySet()) {
                    labels.add(new LocalizedString(entry.getValue().getName(), entry.getKey()));
                }

                pageNode.setLabels(labels);
            }
        } else {
            pageNode.setLabel(nodeState.getLabel());
        }

        pageNode.setIcon(nodeState.getIcon());
        long startPublicationTime = nodeState.getStartPublicationTime();
        if (startPublicationTime != -1) {
            pageNode.setStartPublicationDate(new Date(startPublicationTime));
        }

        long endPublicationTime = nodeState.getEndPublicationTime();
        if (endPublicationTime != -1) {
            pageNode.setEndPublicationDate(new Date(endPublicationTime));
        }

        pageNode.setVisibility(nodeState.getVisibility());
        pageNode.setPageReference(nodeState.getPageRef() != null ? nodeState.getPageRef().format() : null);

        pageNode.setProperties(new Properties(nodeState.getAttributesState()));

        if (node.getNodes() != null) {
            ArrayList<PageNode> children = new ArrayList<PageNode>(node.getNodeCount());
            for (NodeContext<?> child : node.getNodes()) {
                @SuppressWarnings("unchecked")
View Full Code Here

TOP

Related Classes of org.exoplatform.portal.mop.navigation.NodeState$Builder

Copyright © 2018 www.massapicom. 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.