當前位置: 首頁>>代碼示例>>Java>>正文


Java Vertex.setProperty方法代碼示例

本文整理匯總了Java中com.tinkerpop.blueprints.Vertex.setProperty方法的典型用法代碼示例。如果您正苦於以下問題:Java Vertex.setProperty方法的具體用法?Java Vertex.setProperty怎麽用?Java Vertex.setProperty使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.tinkerpop.blueprints.Vertex的用法示例。


在下文中一共展示了Vertex.setProperty方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: updateUser

import com.tinkerpop.blueprints.Vertex; //導入方法依賴的package包/類
public boolean updateUser( User user ) {
	Graph graph = (Graph) connection.get();
	logger.debug("updateUser: " + user.getId() );
	
	try{
		Vertex v = graph.getVertex( user.getId() );
		
		if( v== null ) throw new UserNotFoundException( user.getEmail() );
		
		if( user.getEmail() != null )
			v.setProperty( GremlinDAOSpec.USER_PROPERTY_EMAIL, user.getEmail() );
		if( user.getFirstname() != null )
			v.setProperty( GremlinDAOSpec.USER_PROPERTY_FIRST_NAME, user.getFirstname() );
		if( user.getLastname() != null )
			v.setProperty( GremlinDAOSpec.USER_PROPERTY_LAST_NAME, user.getLastname() );
		
		return true;
	}
	finally {
		graph.shutdown();
	}
}
 
開發者ID:maltesander,項目名稱:rest-jersey2-json-jwt-authentication,代碼行數:23,代碼來源:GremlinUserDAO.java

示例2: addFriend

import com.tinkerpop.blueprints.Vertex; //導入方法依賴的package包/類
public OrientEdge addFriend(String outName, String inName) {
    OrientGraph database = new OrientGraph(databasePool);
    try {
        Vertex outVertex = database.addVertex(null);
        Vertex inVertex = database.addVertex(null);
        outVertex.setProperty("name", outName);
        inVertex.setProperty("name", inName);
        OrientEdge edge = database.addEdge(null, outVertex, inVertex, "knows");
        database.commit();
        return edge;
    } catch (Exception e) {
        database.rollback();
    } finally {
        database.shutdown();
    }

    return null;
}
 
開發者ID:wildfly-swarm,項目名稱:wildfly-swarm,代碼行數:19,代碼來源:TestPeopleDao.java

示例3: apply

import com.tinkerpop.blueprints.Vertex; //導入方法依賴的package包/類
@Override
public void apply() {
	// Move the data directory away
	try {
		log.info("Moving current data directory away to {" + dataSourceFolder().getAbsolutePath() + "}");
		FileUtils.moveDirectory(dataTargetFolder(), dataSourceFolder());
	} catch (Exception e) {
		throw new RuntimeException("Could not move data folder to backup location {" + dataTargetFolder().getAbsolutePath()
				+ "}. Maybe the permissions not allowing this?");
	}

	// Create binary root
	Vertex meshRoot = getMeshRootVertex();
	Vertex binaryRoot = getGraph().addVertex("class:BinaryRootImpl");
	binaryRoot.setProperty("ferma_type", "BinaryRootImpl");
	binaryRoot.setProperty("uuid", randomUUID());
	meshRoot.addEdge("HAS_BINARY_ROOT", binaryRoot).setProperty("uuid", randomUUID());

	// Iterate over all binary fields and convert them to edges to binaries
	Iterable<Vertex> it = getGraph().getVertices("@class", "BinaryGraphFieldImpl");
	for (Vertex binaryField : it) {
		migrateField(binaryField, binaryRoot);
	}
}
 
開發者ID:gentics,項目名稱:mesh,代碼行數:25,代碼來源:BinaryStorageMigration.java

示例4: updateProperty

import com.tinkerpop.blueprints.Vertex; //導入方法依賴的package包/類
private void updateProperty(String propertyName, Vertex node) {
	Object obj = node.getProperty(propertyName);
	if (obj == null) {
		return;
	}
	if (!(obj instanceof String)) {
		if (log.isDebugEnabled()) {
			log.debug("Property '{}' for node '{}' in database is no string so we don't convert it. {}: '{}'", propertyName, node.getProperty(UUID), obj.getClass(), obj);
		}
		return;
	}
	String strVal = (String) obj;
	Number numVal;
	try {
		numVal = format.parse(strVal);
	} catch (ParseException e) {
		log.warn("Could not parse the number '{}', for field '{}' in node {}", strVal, propertyName, node.getId());
		numVal = 0;
	}
	node.removeProperty(propertyName);
	node.setProperty(propertyName, numVal);
}
 
開發者ID:gentics,項目名稱:mesh,代碼行數:23,代碼來源:ChangeNumberStringsToNumber.java

示例5: apply

import com.tinkerpop.blueprints.Vertex; //導入方法依賴的package包/類
@Override
public void apply() {
	Vertex meshRoot = getMeshRootVertex();
	Vertex microschemaRoot = meshRoot.getVertices(OUT, "HAS_MICROSCHEMA_ROOT").iterator().next();
	Iterator<Vertex> microschemaIt = microschemaRoot.getVertices(OUT, "HAS_SCHEMA_CONTAINER_ITEM").iterator();
	while (microschemaIt.hasNext()) {
		Vertex microschemaVertex = microschemaIt.next();
		Iterator<Vertex> versionIt = microschemaVertex.getVertices(OUT, "HAS_PARENT_CONTAINER").iterator();
		while (versionIt.hasNext()) {
			Vertex microschemaVersion = versionIt.next();

			String json = microschemaVersion.getProperty("json");
			JsonObject schema = new JsonObject(json);
			schema.remove("editor");
			schema.remove("edited");
			schema.remove("creator");
			schema.remove("created");
			schema.remove("rolePerms");
			schema.remove("permissions");
			microschemaVersion.setProperty("json", schema.toString());
		}
	}

}
 
開發者ID:gentics,項目名稱:mesh,代碼行數:25,代碼來源:SanitizeMicroschemaJson.java

示例6: migrateTags

import com.tinkerpop.blueprints.Vertex; //導入方法依賴的package包/類
/**
 * Tags no longer have a TagGraphFieldContainerImpl. The value is now stored directly in the tag vertex.
 * 
 * @param meshRoot
 */
private void migrateTags(Vertex meshRoot) {
	Vertex tagRoot = meshRoot.getVertices(Direction.OUT, "HAS_TAG_ROOT").iterator().next();
	for (Vertex tag : tagRoot.getVertices(Direction.OUT, "HAS_TAG")) {
		Iterator<Vertex> tagFieldIterator = tag.getVertices(Direction.OUT, "HAS_FIELD_CONTAINER").iterator();
		Vertex tagFieldContainer = tagFieldIterator.next();
		if (tagFieldIterator.hasNext()) {
			fail("The tag with uuid {" + tag.getProperty("uuid") + "} got more then one field container.");
		}
		// Load the tag value from the field container and store it directly into the tag. Remove the now no longer needed field container from the graph.
		String tagValue = tagFieldContainer.getProperty("name");
		tag.setProperty("tagValue", tagValue);
		tagFieldContainer.remove();

		// Check editor /creator
		getOrFixUserReference(tag, "HAS_EDITOR");
		getOrFixUserReference(tag, "HAS_CREATOR");
	}
}
 
開發者ID:gentics,項目名稱:mesh,代碼行數:24,代碼來源:ChangeAddVersioning.java

示例7: apply

import com.tinkerpop.blueprints.Vertex; //導入方法依賴的package包/類
@Override
public void apply() {
	Vertex meshRoot = getMeshRootVertex();
	Vertex schemaRoot = meshRoot.getVertices(OUT, "HAS_ROOT_SCHEMA").iterator().next();
	Iterator<Vertex> schemaIt = schemaRoot.getVertices(OUT, "HAS_SCHEMA_CONTAINER_ITEM").iterator();
	while (schemaIt.hasNext()) {
		Vertex schemaVertex = schemaIt.next();
		Iterator<Vertex> versionIt = schemaVertex.getVertices(OUT, "HAS_PARENT_CONTAINER").iterator();
		while (versionIt.hasNext()) {
			Vertex schemaVersion = versionIt.next();

			String json = schemaVersion.getProperty("json");
			JsonObject schema = new JsonObject(json);
			schema.remove("editor");
			schema.remove("edited");
			schema.remove("creator");
			schema.remove("created");
			schema.remove("rolePerms");
			schema.remove("permissions");
			schemaVersion.setProperty("json", schema.toString());
		}
	}

}
 
開發者ID:gentics,項目名稱:mesh,代碼行數:25,代碼來源:ChangeSanitizeSchemaJson.java

示例8: createUser

import com.tinkerpop.blueprints.Vertex; //導入方法依賴的package包/類
public boolean createUser( UserSecurity user ) {
	Graph graph = (Graph) connection.get();
	logger.debug("createUser: " + user.getEmail() );
	
	try {
		// check if user already registered
		try {
			if( getUserIdByEmail( user.getEmail() ) != null ) {
				throw new UserExistingException( user.getEmail() );
			}
		}
		// continue if no user found
		catch( UserNotFoundException e) {}
		// create user vertex
		Vertex v = graph.addVertex(null);
		
		// type user
		v.setProperty( GremlinDAOSpec.UNIVERSAL_PROPERTY_TYPE, GremlinDAOSpec.USER_CLASS );
		v.setProperty( GremlinDAOSpec.USER_PROPERTY_FIRST_NAME, user.getFirstname() );
		v.setProperty( GremlinDAOSpec.USER_PROPERTY_LAST_NAME, user.getLastname() );
		v.setProperty( GremlinDAOSpec.USER_PROPERTY_EMAIL, user.getEmail() );
		v.setProperty( GremlinDAOSpec.USER_PROPERTY_PASSWORD, user.getPassword() );
		v.setProperty( GremlinDAOSpec.USER_PROPERTY_ROLE, user.getRole() );
		
		return true;			
	}
	finally {
		graph.shutdown();
	}
}
 
開發者ID:maltesander,項目名稱:rest-jersey2-json-jwt-authentication,代碼行數:31,代碼來源:GremlinUserDAO.java

示例9: setUserAuthentication

import com.tinkerpop.blueprints.Vertex; //導入方法依賴的package包/類
@Override
public boolean setUserAuthentication( UserSecurity user ) throws UserNotFoundException {
	Graph graph = (Graph) connection.get();
	logger.debug("setUserAuthentication: " + user.getId() );
	
	try {
		Vertex v = graph.getVertex( user.getId() );
		
		if( v == null ) throw new UserNotFoundException( user.getId() );

		if( user.getPassword() != null ) {
			v.setProperty( GremlinDAOSpec.USER_PROPERTY_PASSWORD,  user.getPassword() );
		}
		
		if( user.getToken() != null ) {
			v.setProperty(GremlinDAOSpec.USER_PROPERTY_TOKEN, user.getToken() );
		}
		
		if( user.getRole() != null ) {
			v.setProperty(GremlinDAOSpec.USER_PROPERTY_ROLE, user.getRole() );
		}
		
		return true;
	}
	finally {
		graph.shutdown();
	}
}
 
開發者ID:maltesander,項目名稱:rest-jersey2-json-jwt-authentication,代碼行數:29,代碼來源:GremlinUserDAO.java

示例10: updateUuids

import com.tinkerpop.blueprints.Vertex; //導入方法依賴的package包/類
/**
 * We currently can't specify the uuid during element creation. Thus we need to update it afterwards.
 */
private void updateUuids() {
	try (Tx tx = db.tx()) {
		for (Vertex v : tx.getGraph().getVertices()) {
			String uuid = v.getProperty("uuid");
			String mapping = uuidMapping.get(uuid);
			if (mapping != null) {
				v.setProperty("uuid", mapping);
				uuidMapping.remove(mapping);
			}
		}
		tx.success();
	}
}
 
開發者ID:gentics,項目名稱:mesh,代碼行數:17,代碼來源:DemoDataProvider.java

示例11: migrateNode

import com.tinkerpop.blueprints.Vertex; //導入方法依賴的package包/類
private void migrateNode(Vertex node) {

		// Extract and remove the published flag from the node
		String publishFlag = node.getProperty("published");
		node.removeProperty("published");

		// Set the published flag to all node graph field containers
		Iterable<Vertex> containers = node.getVertices(Direction.OUT, "HAS_FIELD_CONTAINER");
		for (Vertex container : containers) {
			if (publishFlag != null) {
				container.setProperty("published", publishFlag);
			}
		}
		log.info("Migrated node {" + node.getProperty("uuid") + "}");
	}
 
開發者ID:gentics,項目名稱:mesh,代碼行數:16,代碼來源:ChangeAddPublishFlag.java

示例12: fixName

import com.tinkerpop.blueprints.Vertex; //導入方法依賴的package包/類
private void fixName(Vertex schemaVertex) {
	String name = schemaVertex.getProperty("name");
	if (!isEmpty(name)) {
		name = name.replaceAll("-", "_");
		schemaVertex.setProperty("name", name);
	}
}
 
開發者ID:gentics,項目名稱:mesh,代碼行數:8,代碼來源:SanitizeSchemaNames.java

示例13: migrateBaseNode

import com.tinkerpop.blueprints.Vertex; //導入方法依賴的package包/類
/**
 * Migrate the basenode and create a new NodeGraphFieldContainer for it.
 * 
 * @param baseNode
 * @param admin
 */
private void migrateBaseNode(Vertex baseNode, Vertex admin) {

	log.info("Migrating basenode {" + baseNode.getProperty("uuid") + "}");
	Vertex schemaContainer = baseNode.getVertices(Direction.OUT, "HAS_SCHEMA_CONTAINER").iterator().next();
	Vertex schemaVersion = schemaContainer.getVertices(Direction.OUT, "HAS_LATEST_VERSION").iterator().next();

	Vertex english = findEnglish();
	Iterator<Edge> it = baseNode.getEdges(Direction.OUT, "HAS_FIELD_CONTAINER").iterator();

	// The base node has no field containers. Lets create the default one
	if (!it.hasNext()) {
		Vertex container = getGraph().addVertex("class:NodeGraphFieldContainerImpl");
		container.setProperty("ferma_type", "NodeGraphFieldContainerImpl");
		container.setProperty("uuid", randomUUID());

		// Fields
		container.setProperty("name-field", "name");
		container.setProperty("name-string", "");

		// field container edge which will later be migrated
		Edge edge = baseNode.addEdge("HAS_FIELD_CONTAINER", container);
		edge.setProperty("ferma_type", "GraphFieldContainerEdgeImpl");
		edge.setProperty("languageTag", "en");
		container.addEdge("HAS_SCHEMA_CONTAINER_VERSION", schemaVersion);
		container.addEdge("HAS_LANGUAGE", english);
	}

}
 
開發者ID:gentics,項目名稱:mesh,代碼行數:35,代碼來源:ChangeAddVersioning.java

示例14: migrateFermaTypes

import com.tinkerpop.blueprints.Vertex; //導入方法依賴的package包/類
private void migrateFermaTypes() {

		int i = 0;
		log.info("Migrating vertices");
		for (Vertex vertex : getGraph().getVertices()) {
			String type = vertex.getProperty("ferma_type");
			if (type != null && type.endsWith("TagGraphFieldContainerImpl")) {
				vertex.setProperty("ferma_type", "com.gentics.mesh.core.data.container.impl.TagGraphFieldContainerImpl");
				i++;
			}

			if (type != null && type.endsWith("SchemaContainerImpl")) {
				vertex.setProperty("ferma_type", "com.gentics.mesh.core.data.schema.impl.SchemaContainerImpl");
				i++;
			}

			if (type != null && type.endsWith("NodeGraphFieldContainerImpl")) {
				vertex.setProperty("ferma_type", "com.gentics.mesh.core.data.container.impl.NodeGraphFieldContainerImpl");
				i++;
			}

		}
		log.info("Completed migration of " + i + " vertices.");

		log.info("Migrating edges");
		i = 0;
		for (Edge edge : getGraph().getEdges()) {
			if ("com.gentics.mesh.core.data.node.field.impl.nesting.NodeGraphFieldImpl".equals(edge.getProperty("ferma_type"))) {
				edge.setProperty("ferma_type", "com.gentics.mesh.core.data.node.field.impl.NodeGraphFieldImpl");
				i++;
			}
		}
		log.info("Completed migration of " + i + " edges.");

	}
 
開發者ID:gentics,項目名稱:mesh,代碼行數:36,代碼來源:ChangeTVCMigration.java

示例15: apply

import com.tinkerpop.blueprints.Vertex; //導入方法依賴的package包/類
@Override
public void apply() {
	Vertex meshRootVertex = getMeshRootVertex();
	Vertex mopedVertex = getGraph().addVertex("TheMoped2");
	mopedVertex.setProperty("name", "moped2");
	meshRootVertex.addEdge("HAS_MOPED2", mopedVertex);
	log.info("Added moped2");
}
 
開發者ID:gentics,項目名稱:mesh,代碼行數:9,代碼來源:ChangeDummy2.java


注:本文中的com.tinkerpop.blueprints.Vertex.setProperty方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。