*/
private final TitanType makeTitanType(TitanTypeClass typeClass, String name, TypeAttribute.Map definition) {
verifyOpen();
Preconditions.checkArgument(StringUtils.isNotBlank(name));
TitanTypeVertex type;
if (typeClass == TitanTypeClass.KEY) {
TypeAttribute.isValidKeyDefinition(definition);
type = new TitanKeyVertex(this, temporaryID.decrementAndGet(), ElementLifeCycle.New);
} else {
Preconditions.checkArgument(typeClass == TitanTypeClass.LABEL);
TypeAttribute.isValidLabelDefinition(definition);
type = new TitanLabelVertex(this, temporaryID.decrementAndGet(), ElementLifeCycle.New);
}
graph.assignID(type);
Preconditions.checkArgument(type.getID() > 0);
addProperty(type, SystemKey.TypeName, name);
addProperty(type, SystemKey.VertexState, SystemKey.VertexStates.DEFAULT.getValue());
addProperty(type, SystemKey.TypeClass, typeClass);
for (TypeAttribute attribute : definition.getAttributes()) {
addProperty(type, SystemKey.TypeDefinition, attribute);
}
vertexCache.add(type, type.getID());
typeCache.put(name, type.getID());
return type;
}