org.umlg.associationclass.meta.PersonMeta Maven / Gradle / Ivy
package org.umlg.associationclass.meta;
import java.util.Iterator;
import org.apache.tinkerpop.gremlin.structure.Direction;
import org.apache.tinkerpop.gremlin.structure.Edge;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.umlg.runtime.adaptor.UMLG;
import org.umlg.runtime.adaptor.UmlgLabelConverterFactory;
import org.umlg.runtime.domain.BaseMetaNode;
import org.umlg.runtime.domain.UmlgMetaNode;
public class PersonMeta extends BaseMetaNode implements UmlgMetaNode {
/**
* constructor for PersonMeta
*
* @param vertex
*/
public PersonMeta(Vertex vertex) {
this.vertex= vertex;
}
/**
* default constructor for PersonMeta
*/
public PersonMeta() {
this.vertex = UMLG.get().addVertex(this.getClass().getName());
this.vertex.property("className", getClass().getName());
defaultCreate();
UMLG.get().getRoot().addEdge(getEdgeToRootLabel(), this.vertex);
}
@Override
public void defaultCreate() {
getUid();
}
public String getEdgeToRootLabel() {
return UmlgLabelConverterFactory.getUmlgLabelConverter().convert("rootPersonMeta");
}
synchronized static public PersonMeta getInstance() {
PersonMeta result;
Iterator iter = UMLG.get().getRoot().edges(Direction.OUT, UmlgLabelConverterFactory.getUmlgLabelConverter().convert("rootPersonMeta"));
if ( iter.hasNext() ) {
result = new PersonMeta(iter.next().inVertex());
} else {
iter = UMLG.get().getRoot().edges(Direction.OUT, UmlgLabelConverterFactory.getUmlgLabelConverter().convert("rootPersonMeta"));
if ( !iter.hasNext() ) {
result = new PersonMeta();
} else {
result = new PersonMeta(iter.next().inVertex());
}
}
return result;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy