001/* 002 * (C) Copyright 2014 Nuxeo SA (http://nuxeo.com/) and contributors. 003 * 004 * All rights reserved. This program and the accompanying materials 005 * are made available under the terms of the GNU Lesser General Public License 006 * (LGPL) version 2.1 which accompanies this distribution, and is available at 007 * http://www.gnu.org/licenses/lgpl-2.1.html 008 * 009 * This library is distributed in the hope that it will be useful, 010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 012 * Lesser General Public License for more details. 013 * 014 * Contributors: 015 * <a href="mailto:grenard@nuxeo.com">Guillaume Renard</a> 016 * 017 */ 018 019package org.nuxeo.ecm.platform.routing.core.impl.jsongraph; 020 021import java.util.Locale; 022 023import org.nuxeo.ecm.platform.routing.core.impl.GraphNode; 024 025/** 026 * @since 7.2 027 */ 028public class NodeView { 029 030 public int x; 031 032 public int y; 033 034 public boolean isStartNode; 035 036 public boolean isEndNode; 037 038 public String id; 039 040 public String title; 041 042 public String state; 043 044 public boolean isMerge; 045 046 public boolean isMultiTask; 047 048 public boolean hasSubWorkflow; 049 050 public NodeView(GraphNode node, Locale locale) { 051 this.x = Integer.parseInt((String) node.getDocument().getPropertyValue(GraphNode.PROP_NODE_X_COORDINATE)); 052 this.y = Integer.parseInt((String) node.getDocument().getPropertyValue(GraphNode.PROP_NODE_Y_COORDINATE)); 053 this.isStartNode = node.isStart(); 054 this.isEndNode = node.isStop(); 055 this.id = node.getId(); 056 String titleProp = (String) node.getDocument().getPropertyValue(GraphNode.PROP_TITLE); 057 this.title = JsonGraphRoute.getI18nLabel(titleProp, locale); 058 this.state = node.getDocument().getCurrentLifeCycleState(); 059 this.isMerge = node.isMerge(); 060 this.isMultiTask = node.hasMultipleTasks(); 061 this.hasSubWorkflow = node.hasSubRoute(); 062 } 063 064 public String getId() { 065 return id; 066 } 067 068 public String getState() { 069 return state; 070 } 071 072 public String getTitle() { 073 return title; 074 } 075 076 public int getX() { 077 return x; 078 } 079 080 public int getY() { 081 return y; 082 } 083 084 public boolean isEndNode() { 085 return isEndNode; 086 } 087 088 public boolean isStartNode() { 089 return isStartNode; 090 } 091}