当前位置: 首页>>代码示例>>Java>>正文


Java GrProperty类代码示例

本文整理汇总了Java中iot.jcypher.graph.GrProperty的典型用法代码示例。如果您正苦于以下问题:Java GrProperty类的具体用法?Java GrProperty怎么用?Java GrProperty使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


GrProperty类属于iot.jcypher.graph包,在下文中一共展示了GrProperty类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addCreateNodeClause

import iot.jcypher.graph.GrProperty; //导入依赖的package包/类
private void addCreateNodeClause(GrNode node,
		List<IClause> clauses, Map<GrNode, JcNode> localNodeMap,
		List<GrNode2JcNode> nodesToCreate) {
	String nm = "ln_".concat(String.valueOf(clauses.size()));
	JcNode n = new JcNode(nm);
	nodesToCreate.add(new GrNode2JcNode(node, n));
	Node create = CREATE.node(n);
	for (GrLabel label : node.getLabels()) {
		create = create.label(label.getName());
	}
	for (GrProperty prop : node.getProperties()) {
		create = create.property(prop.getName()).value(prop.getValue());
	}
	if (writeVersion || lockingStrategy == Locking.OPTIMISTIC)
		create = create.property(ResultHandler.lockVersionProperty).value(0);
	clauses.add(create);
	localNodeMap.put(node, n);
}
 
开发者ID:Wolfgang-Schuetzelhofer,项目名称:jcypher,代码行数:19,代码来源:ResultHandler.java

示例2: addCreateRelationClause

import iot.jcypher.graph.GrProperty; //导入依赖的package包/类
private void addCreateRelationClause(GrRelation relation,
		List<IClause> createRelationClauses,
		Map<GrNode, JcNode> localNodeMap, Map<GrNode, JcNode> dbNodeMap,
		List<IClause> startNodeClauses, List<GrRelation2JcRelation> relationsToCreate) {
	String nm = "lr_".concat(String.valueOf(createRelationClauses.size()));
	JcRelation r = new JcRelation(nm);
	relationsToCreate.add(new GrRelation2JcRelation(relation, r));
	GrNode sNode = relation.getStartNode();
	GrNode eNode = relation.getEndNode();
	JcNode sn = getNode(sNode, localNodeMap, dbNodeMap, startNodeClauses);
	JcNode en = getNode(eNode, localNodeMap, dbNodeMap, startNodeClauses);
	Relation create = CREATE.node(sn).relation(r).out();
	if (relation.getType() != null)
		create = create.type(relation.getType());
	for (GrProperty prop : relation.getProperties()) {
		create = create.property(prop.getName()).value(prop.getValue());
	}
	if (writeVersion || lockingStrategy == Locking.OPTIMISTIC)
		create = create.property(ResultHandler.lockVersionProperty).value(0);
	createRelationClauses.add(create.node(en));
}
 
开发者ID:Wolfgang-Schuetzelhofer,项目名称:jcypher,代码行数:22,代码来源:ResultHandler.java

示例3: handleVersionProperty

import iot.jcypher.graph.GrProperty; //导入依赖的package包/类
private void handleVersionProperty(GrPropertyContainer element, int curVersion) {
	if (writeVersion || lockingStrategy == Locking.OPTIMISTIC) {
		if (elementVersions == null)
			elementVersions = new ElementVersions();
		int oldVersion = curVersion;
		GrProperty prop = element.getProperty(ResultHandler.lockVersionProperty);
		if (prop != null)
			prop.setValue(oldVersion + 1);
		else
			prop = element.addProperty(ResultHandler.lockVersionProperty, oldVersion + 1);

		if (element instanceof GrNode)
			elementVersions.nodeVersions.put(element, oldVersion);
		else if (element instanceof GrRelation)
			elementVersions.relationVersions.put(element, oldVersion);
	}
}
 
开发者ID:Wolfgang-Schuetzelhofer,项目名称:jcypher,代码行数:18,代码来源:ResultHandler.java

示例4: mapPropertyFromField

import iot.jcypher.graph.GrProperty; //导入依赖的package包/类
@Override
public void mapPropertyFromField(Object domainObject, GrNode rNode) {
	Object mapped = super.intMapPropertyFromField(domainObject, rNode);
	String propName = getPropertyOrRelationName().concat(TypePostfix);
	GrProperty prop = rNode.getProperty(propName);
	if (mapped != null) {
		String value = mapped.getClass().getName();
		if (prop != null) {
			Object propValue = prop.getValue(); // String need not be converted
			if (!value.equals(propValue)) {
				prop.setValue(value);
			}
		} else
			rNode.addProperty(propName, value);
	} else { // remove if needed
		if (prop != null)
			prop.setValue(null);
	}
}
 
开发者ID:Wolfgang-Schuetzelhofer,项目名称:jcypher,代码行数:20,代码来源:ValueAndTypeMapping.java

示例5: storeSimpleListComponentType

import iot.jcypher.graph.GrProperty; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
@Override
protected void storeSimpleListComponentType(Object value, GrNode rNode) {
	// only called when a collection or an array is mapped to a property
	Collection coll;
	if (value instanceof Collection<?>)
		coll = (Collection) this.getFieldType().cast(value);
	else
		coll = Arrays.asList((Object[])value);
	if (coll.size() > 0) {
		Object elem = coll.iterator().next();
		Class<?> type = elem.getClass();
		// test the first element,
		// assuming all elements are of the same type !!!
		String propName = getPropertyOrRelationName().concat(TypePostfix);
		GrProperty prop = rNode.getProperty(propName);
		String t_value = type.getName();
		if (prop != null) {
			Object propValue = prop.getValue(); // String need not be converted
			if (!t_value.equals(propValue)) {
				prop.setValue(t_value);
			}
		} else
			rNode.addProperty(propName, t_value);
	}
}
 
开发者ID:Wolfgang-Schuetzelhofer,项目名称:jcypher,代码行数:27,代码来源:ListFieldMapping.java

示例6: testBooking

import iot.jcypher.graph.GrProperty; //导入依赖的package包/类
@Test
public void testBooking() {
	JCypherClient jCypherClient = new JCypherClient(dbAccess);
	jCypherClient.insertBooking(new Booking(1l, "FRAUD", "CONTRACT", "[email protected]"));
	jCypherClient.insertBooking(new Booking(2l, "LEGIT", "INIT", "[email protected]"));
	
	jCypherClient = new JCypherClient(dbAccess);
	List<GrRelation> bookingsRelated = jCypherClient.getBookingsRelated(1L, 6);
	bookingsRelated = removeMultiples(bookingsRelated); // needed when duplicates are included
	assertEquals(1, bookingsRelated.size());
	
	GrRelation br = bookingsRelated.get(0);
	GrNode sn = br.getStartNode();
	GrProperty fr = sn.getProperty("fraud");
	GrProperty stat = sn.getProperty("status");
	Object frVal = fr.getValue();
	Object statVal = stat.getValue();
	
	assertEquals("FRAUD", frVal);
	assertEquals("CONTRACT", statVal);
	
	return;
}
 
开发者ID:Wolfgang-Schuetzelhofer,项目名称:jcypher,代码行数:24,代码来源:JCypherClientTest.java

示例7: checkDomainInfoNodeAgainst

import iot.jcypher.graph.GrProperty; //导入依赖的package包/类
private boolean checkDomainInfoNodeAgainst(String expected) {
	JcNode info = new JcNode("info");
	JcQuery query = new JcQuery();
	query.setClauses(new IClause[] {
			MATCH.node(info).label("DomainInfo"),
			WHERE.valueOf(info.property("name"))
				.EQUALS(domainName),
			RETURN.value(info)
	});
	JcQueryResult result = dbAccess.execute(query);
	List<JcError> errors = Util.collectErrors(result);
	if (!errors.isEmpty()) {
		throw new JcResultException(errors);
	}
	GrNode rInfo = result.resultOf(info).get(0);
	GrProperty prop = rInfo.getProperty("label2ClassMap");
	Object val = prop.getValue();
	String returned = val.toString();
	return expected.equals(returned);
}
 
开发者ID:Wolfgang-Schuetzelhofer,项目名称:jcypher,代码行数:21,代码来源:DomainMappingTest.java

示例8: save

import iot.jcypher.graph.GrProperty; //导入依赖的package包/类
@Test
public void save() throws Exception {
  new MockUnit(IDBAccess.class, Session.class)
      .expect(sid("sidfoo", ImmutableMap.of("foo", "bar"), 1L, 2L, 3L))
      .expect(newNode("n"))
      .expect(millis())
      .expect(SAVE("sidfoo", "session", 1L, 2L, 3L, TimeUnit.MINUTES.toMillis(30)))
      .expect(newQuery())
      .expect(execute())
      .expect(resultOf())
      .expect(unit -> {
        GrProperty foo = unit.mock(GrProperty.class);
        expect(foo.getName()).andReturn("foo");
        GrNode node = unit.get(GrNode.class);
        expect(node.getProperties()).andReturn(ImmutableList.of(foo));
      })
      .run(unit -> {
        new Neo4jSessionStore(unit.get(IDBAccess.class), "session", "30m")
            .save(unit.get(Session.class));
      });
}
 
开发者ID:jooby-project,项目名称:jooby,代码行数:22,代码来源:Neo4jSessionStoreTest.java

示例9: saveDeleteUnsetProps

import iot.jcypher.graph.GrProperty; //导入依赖的package包/类
@Test
public void saveDeleteUnsetProps() throws Exception {
  new MockUnit(IDBAccess.class, Session.class)
      .expect(sid("sidfoo", ImmutableMap.of("foo", "bar"), 1L, 2L, 3L))
      .expect(newNode("n"))
      .expect(millis())
      .expect(SAVE("sidfoo", "session", 1L, 2L, 3L, TimeUnit.MINUTES.toMillis(30)))
      .expect(newQuery())
      .expect(execute())
      .expect(resultOf())
      .expect(unit -> {
        GrProperty bar = unit.mock(GrProperty.class);
        expect(bar.getName()).andReturn("bar");
        GrNode node = unit.get(GrNode.class);
        expect(node.getProperties()).andReturn(ImmutableList.of(bar));
      })
      .expect(newQuery())
      .expect(REMOVE("sidfoo", "session", "bar"))
      .expect(execute())
      .run(unit -> {
        new Neo4jSessionStore(unit.get(IDBAccess.class), "session", "30m")
            .save(unit.get(Session.class));
      });
}
 
开发者ID:jooby-project,项目名称:jooby,代码行数:25,代码来源:Neo4jSessionStoreTest.java

示例10: print

import iot.jcypher.graph.GrProperty; //导入依赖的package包/类
private static void print(List<GrNode> nodes, boolean distinct) {
	List<Long> ids = new ArrayList<Long>();
	StringBuilder sb = new StringBuilder();
	boolean firstNode = true;
	for (GrNode node : nodes) {
		if (!ids.contains(node.getId()) || !distinct) {
			ids.add(node.getId());
			if (!firstNode)
				sb.append("\n");
			else
				firstNode = false;
			sb.append("---NODE---:\n");
			sb.append('[');
			sb.append(node.getId());
			sb.append(']');
			for (GrLabel label : node.getLabels()) {
				sb.append(", ");
				sb.append(label.getName());
			}
			sb.append("\n");
			boolean first = true;
			for (GrProperty prop : node.getProperties()) {
				if (!first)
					sb.append(", ");
				else
					first = false;
				sb.append(prop.getName());
				sb.append(" = ");
				sb.append(prop.getValue());
			}
		}
	}
	System.out.println(sb.toString());
}
 
开发者ID:Wolfgang-Schuetzelhofer,项目名称:jcypher_samples,代码行数:35,代码来源:MovieDatabase.java

示例11: getNodeProperties

import iot.jcypher.graph.GrProperty; //导入依赖的package包/类
private List<GrProperty> getNodeProperties(long nodeId, int rowIndex) {
	List<GrProperty> props = new ArrayList<GrProperty>();
	Iterator<PropEntry> esIt = this.contentHandler.getPropertiesIterator(nodeId, rowIndex, ElemType.NODE);
	while (esIt.hasNext()) {
		PropEntry entry = esIt.next();
		GrProperty prop = GrAccess.createProperty(entry.getPropName());
		prop.setValue(this.contentHandler.convertContentValue(entry.getPropValue()));
		GrAccess.setState(prop, SyncState.SYNC);
		props.add(prop);
	}
	return props;
}
 
开发者ID:Wolfgang-Schuetzelhofer,项目名称:jcypher,代码行数:13,代码来源:ResultHandler.java

示例12: getRelationProperties

import iot.jcypher.graph.GrProperty; //导入依赖的package包/类
private List<GrProperty> getRelationProperties(long relationId, int rowIndex) {
	List<GrProperty> props = new ArrayList<GrProperty>();
	Iterator<PropEntry> esIt = this.contentHandler.getPropertiesIterator(relationId, rowIndex, ElemType.RELATION);
	while (esIt.hasNext()) {
		PropEntry entry = esIt.next();
		GrProperty prop = GrAccess.createProperty(entry.getPropName());
		prop.setValue(this.contentHandler.convertContentValue(entry.getPropValue()));
		GrAccess.setState(prop, SyncState.SYNC);
		props.add(prop);
	}
	return props;
}
 
开发者ID:Wolfgang-Schuetzelhofer,项目名称:jcypher,代码行数:13,代码来源:ResultHandler.java

示例13: addPropertyChild

import iot.jcypher.graph.GrProperty; //导入依赖的package包/类
/**
 * @param fm
 * @param obj
 * @param node
 * @return true if the property exists in the node
 */
public boolean addPropertyChild(FieldMapping fm, Object obj, GrNode node) {
	if (!fm.isInnerClassRefField()) {
		if (this.realObject == null) {
			if (this.propertyChildren == null)
				this.propertyChildren = new ArrayList<DeferredPropertyMapping>();
			this.propertyChildren.add(new DeferredPropertyMapping(fm, obj, node));
			GrProperty prop = node.getProperty(fm.getPropertyOrRelationName());
			return prop != null;
		} else {
			return fm.mapPropertyToField(this.realObject, node);
		}
	}
	return false;
}
 
开发者ID:Wolfgang-Schuetzelhofer,项目名称:jcypher,代码行数:21,代码来源:InnerClassSurrogate.java

示例14: clearAdditionalProperties

import iot.jcypher.graph.GrProperty; //导入依赖的package包/类
@Override
protected void clearAdditionalProperties(GrNode rNode) {
	String propName = getPropertyOrRelationName().concat(TypePostfix);
	GrProperty prop = rNode.getProperty(propName);
	if (prop != null)
		prop.setValue(null);
}
 
开发者ID:Wolfgang-Schuetzelhofer,项目名称:jcypher,代码行数:8,代码来源:ListFieldMapping.java

示例15: mapPropertyToField

import iot.jcypher.graph.GrProperty; //导入依赖的package包/类
/**
 * @param domainObject
 * @param rNode
 * @return true if the property exists in the node
 */
public boolean mapPropertyToField(Object domainObject, GrNode rNode) {
	boolean hasProperty = false;
	if (domainObject instanceof InnerClassSurrogate) {
		hasProperty = ((InnerClassSurrogate)domainObject).addPropertyChild(this, domainObject, rNode);
	} else {
		try {
			prepare(domainObject);
			
			Object value = this.field.get(domainObject);
			GrProperty prop = rNode.getProperty(this.propertyName);
			if (prop != null) {
				hasProperty = true;
				Object propValue = prop.getValue();
				if (propValue != null) { // allow null values in properties
					Class<?> typ = getFieldTypeInt(rNode);
					propValue = MappingUtil.convertFromProperty(propValue, typ,
							getComponentType(rNode), getConcreteFieldType());
					if (!propValue.equals(value)) {
						this.field.set(domainObject, convertFieldValue(propValue, domainObject));
					}
				}
			}
		} catch (Throwable e) {
			throw new RuntimeException(e);
		}
	}
	return hasProperty;
}
 
开发者ID:Wolfgang-Schuetzelhofer,项目名称:jcypher,代码行数:34,代码来源:FieldMapping.java


注:本文中的iot.jcypher.graph.GrProperty类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。