Projects >> structr >>2bf89715ce3edef085fb40e5d422d900133b2758

Chunk
Conflicting content
		// ----- BEGIN automatic property resolution -----

		// check for static relationships and return related nodes
<<<<<<< HEAD
		String singularType = (key.endsWith("ies")
				       ? key.substring(0,
			key.length() - 3).concat("y")
				       : (key.endsWith("s")
					  ? key.substring(0,
			key.length() - 1)
					  : key));

		if (EntityContext.getRelations(type).containsKey(singularType)) {
=======
		String singularType = getSingularTypeName(key);
		if(key.endsWith("Id")) {

			// remove "Id" from the end of the value and set "id requested"-flag
			singularType = singularType.substring(0, singularType.length() - 2);
			idRequested = true;
		}

		if(singularType != null && EntityContext.getRelations(type).containsKey(singularType)) {
>>>>>>> 05d63fbbafdc5b7f12e0f0df4850d3766b405136

			// static relationship detected, return related nodes
			// (we omit null check here because containsKey ensures that rel is not null)
Solution content
		// ----- BEGIN automatic property resolution -----

		// check for static relationships and return related nodes
		String singularType = getSingularTypeName(key);
		if(key.endsWith("Id")) {

			// remove "Id" from the end of the value and set "id requested"-flag
			singularType = singularType.substring(0, singularType.length() - 2);
			idRequested = true;
		}

		if(singularType != null && EntityContext.getRelations(type).containsKey(singularType)) {

			// static relationship detected, return related nodes
			// (we omit null check here because containsKey ensures that rel is not null)
File
AbstractNode.java
Developer's decision
Version 2
Kind of conflict
If statement
Method invocation
Variable
Chunk
Conflicting content
			// static relationship detected, return related nodes
			// (we omit null check here because containsKey ensures that rel is not null)
			DirectedRelationship rel = EntityContext.getRelations(type).get(singularType);
<<<<<<< HEAD

			if (rel != null) {

				return getTraversalResults(rel.getRelType(),
							   rel.getDirection(),
							   StringUtils.capitalize(singularType));
=======
			if(idRequested) {
				AbstractNode node = rel.getRelatedNode(securityContext, this, singularType);
				if(node != null) {
					return node.getId();
				} else {
					// TODO: handle "not found"..
				}
			} else {
				return rel.getRelatedNodes(securityContext, this, singularType);
>>>>>>> 05d63fbbafdc5b7f12e0f0df4850d3766b405136
			}
		}
		// ----- END automatic property resolution -----
Solution content
			// static relationship detected, return related nodes
			// (we omit null check here because containsKey ensures that rel is not null)
			DirectedRelationship rel = EntityContext.getRelations(type).get(singularType);
			if(idRequested) {
				AbstractNode node = rel.getRelatedNode(securityContext, this, singularType);
				if(node != null) {
					return node.getId();
				} else {
					// TODO: handle "not found"..
				}
			} else {
				return rel.getRelatedNodes(securityContext, this, singularType);
			}
		}
		// ----- END automatic property resolution -----
File
AbstractNode.java
Developer's decision
Version 2
Kind of conflict
If statement
Method invocation
Return statement
Variable
Chunk
Conflicting content

		return (size);
	}

<<<<<<< HEAD
	public Set getTraversalResults(final RelationshipType relType, final Direction direction,
		final String type) {

		// use traverser
		Iterable nodes = Traversal.description().breadthFirst().relationships(relType,
			direction).evaluator(new Evaluator() {

			@Override
			public Evaluation evaluate(Path path) {

				int len = path.length();

				if (len <= 1) {

					if (len == 0) {

						// do not include start node (which is the
						// index node in this case), but continue
						// traversal
						return Evaluation.EXCLUDE_AND_CONTINUE;
					} else {

						Node currentNode = path.endNode();

						if (currentNode.hasProperty(AbstractNode.Key.type.name())) {

							String nodeType = (String) currentNode.getProperty(
									      AbstractNode.Key.type.name());

							if (type.equals(nodeType)) {
								return Evaluation.INCLUDE_AND_CONTINUE;
							}
						}
					}
				}

				return Evaluation.EXCLUDE_AND_PRUNE;
			}
		}).traverse(this.getNode()).nodes();
		// collect results and convert nodes into structr nodes
		StructrNodeFactory nodeFactory = new StructrNodeFactory(securityContext);
		Set nodeList     = new LinkedHashSet();

		for (Node n : nodes) {
			nodeList.add(nodeFactory.createNode(securityContext, n, type));
		}

		return nodeList;
	}

=======
>>>>>>> 05d63fbbafdc5b7f12e0f0df4850d3766b405136
	/**
	 * Return unordered list of all direct child nodes (no recursion)
	 * with given relationship type
Solution content
		return (size);
	}

	/**
	 * Return unordered list of all direct child nodes (no recursion)
	 * with given relationship type
File
AbstractNode.java
Developer's decision
Version 2
Kind of conflict
Method declaration
Chunk
Conflicting content
			return;
		}

<<<<<<< HEAD
		// TODO: add setProperty function for entities here!
		Class type                  = this.getClass();
=======
		String singularType = getSingularTypeName(key);
		if(key.endsWith("Id")) {
			singularType = singularType.substring(0, singularType.length() - 2);
		}

		// check for static relationships and connect node
		if(EntityContext.getRelations(type).containsKey(singularType)) {

			// static relationship detected, create relationship
			DirectedRelationship rel = EntityContext.getRelations(type).get(singularType);
			if(rel != null) {

				// FIXME: return here, or do something else?
				rel.createRelationship(securityContext, this, value);
				return;
			}
		}

>>>>>>> 05d63fbbafdc5b7f12e0f0df4850d3766b405136
		PropertyConverter converter = EntityContext.getPropertyConverter(securityContext,
			type,
			key);
Solution content
			return;
		}

		String singularType = getSingularTypeName(key);
		if(key.endsWith("Id")) {
			singularType = singularType.substring(0, singularType.length() - 2);
		}

		// check for static relationships and connect node
		if(EntityContext.getRelations(type).containsKey(singularType)) {

			// static relationship detected, create relationship
			DirectedRelationship rel = EntityContext.getRelations(type).get(singularType);
			if(rel != null) {

				// FIXME: return here, or do something else?
				rel.createRelationship(securityContext, this, value);
				return;
			}
		}

		PropertyConverter converter = EntityContext.getPropertyConverter(securityContext,
			type,
			key);
File
AbstractNode.java
Developer's decision
Version 2
Kind of conflict
Comment
If statement
Method invocation
Variable