1   /**
2    * Licensed to Neo Technology under one or more contributor
3    * license agreements. See the NOTICE file distributed with
4    * this work for additional information regarding copyright
5    * ownership. Neo Technology licenses this file to you under
6    * the Apache License, Version 2.0 (the "License"); you may
7    * not use this file except in compliance with the License.
8    * You may obtain a copy of the License at
9    *
10   * http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied. See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.neo4j.examples.server;
20  
21  public class Relationship {
22  
23      public static final String OUT = "out";
24      public static final String IN = "in";
25      public static final String BOTH = "both";
26      private String type;
27      private String direction;
28  
29      public String toJsonCollection() {
30          StringBuilder sb = new StringBuilder();
31          sb.append("{ ");
32          sb.append(" \"type\" : \"" + type + "\"");
33          if(direction != null) {
34              sb.append(", \"direction\" : \"" + direction + "\"");
35          }
36          sb.append(" }");
37          return sb.toString();
38      }
39  
40      public Relationship(String type, String direction) {
41          setType(type);
42          setDirection(direction);
43      }
44  
45      
46      public Relationship(String type) {
47          this(type, null);
48      }
49  
50      public void setType(String type) {
51          this.type = type;
52      }
53      
54      public void setDirection(String direction) {
55          this.direction = direction;
56      }
57  }