本文整理汇总了Java中org.bimserver.emf.IdEObject.getOid方法的典型用法代码示例。如果您正苦于以下问题:Java IdEObject.getOid方法的具体用法?Java IdEObject.getOid怎么用?Java IdEObject.getOid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bimserver.emf.IdEObject
的用法示例。
在下文中一共展示了IdEObject.getOid方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: objectToJson
import org.bimserver.emf.IdEObject; //导入方法依赖的package包/类
private ObjectNode objectToJson(IdEObject idEObject) {
ObjectNode objectNode = OBJECT_MAPPER.createObjectNode();
if (idEObject.getOid() != -1) {
objectNode.put("oid", idEObject.getOid());
}
if (idEObject instanceof IfcProduct) {
IfcProduct ifcProduct = (IfcProduct)idEObject;
if (ifcProduct.getName() != null) {
objectNode.put("name", ifcProduct.getName());
}
if (ifcProduct.getGlobalId() != null) {
objectNode.put("guid", ifcProduct.getGlobalId());
}
}
return objectNode;
}
示例2: getReference
import org.bimserver.emf.IdEObject; //导入方法依赖的package包/类
@Override
public Long getReference(Long tid, Long oid, String referenceName) throws ServerException, UserException {
DatabaseSession session = getBimServer().getDatabase().createSession();
try {
LongTransaction transaction = getBimServer().getLongTransactionManager().get(tid);
EClass eClass = session.getEClassForOid(oid);
IdEObject object = session.get(eClass, oid, new OldQuery(transaction.getPackageMetaData(), transaction.getPid(), transaction.getRid(), transaction.getRoid(), null, Deep.NO));
if (object == null) {
throw new UserException("No object of type " + eClass.getName() + " with oid " + oid + " found");
}
EStructuralFeature eStructuralFeature = object.eClass().getEStructuralFeature(referenceName);
if (eStructuralFeature == null) {
throw new UserException("No feature with name " + referenceName + " found on class " + object.eClass().getName());
}
IdEObject ref = (IdEObject) object.eGet(eStructuralFeature);
if (ref == null) {
return -1L;
}
return ref.getOid();
} catch (Exception e) {
return handleException(e);
} finally {
session.close();
}
}
示例3: processTodoList
import org.bimserver.emf.IdEObject; //导入方法依赖的package包/类
private void processTodoList(IfcModelInterface model, TodoList todoList, QueryInterface query) throws BimserverDatabaseException {
IdEObject idEObject = todoList.poll();
while (idEObject != null) {
IdEObject result = get(idEObject, idEObject.getOid(), model, query, todoList);
if (result == null) {
throw new BimserverDatabaseException("Object not found: " + query.getPid() + " " + query.getRid() + " " + idEObject.getOid() + " " + idEObject.eClass().getName());
}
if (!model.contains(result.getOid())) {
try {
model.addAllowMultiModel(result.getOid(), result);
} catch (IfcModelInterfaceException e) {
throw new BimserverDatabaseException(e);
}
}
idEObject = todoList.poll();
}
}
示例4: store
import org.bimserver.emf.IdEObject; //导入方法依赖的package包/类
public long store(IdEObject object, int pid, int rid) throws BimserverDatabaseException {
checkOpen();
if ((objectsToCommit == null || !objectsToCommit.containsObject(object)) && (objectsToDelete == null || !objectsToDelete.contains(object))) {
objectCache.put(object.getOid(), object);
boolean wrappedValue = object.eClass().getEAnnotation("wrapped") != null;
if (!wrappedValue) {
if (object.getOid() == -1) {
long newOid = newOid(object.eClass());
((IdEObjectImpl) object).setOid(newOid);
}
object.load();
((IdEObjectImpl) object).setPid(pid);
if (rid == Integer.MAX_VALUE) {
((IdEObjectImpl) object).setRid(object.getRid() + 1);
} else {
((IdEObjectImpl) object).setRid(rid);
}
addToObjectsToCommit(object);
}
}
return object.getOid();
}
示例5: checkDoubleOids
import org.bimserver.emf.IdEObject; //导入方法依赖的package包/类
public void checkDoubleOids() {
Set<Long> oids = new HashSet<Long>();
for (IdEObject idEObject : objects.values()) {
if (oids.contains(idEObject.getOid())) {
throw new RuntimeException("Double oid: " + idEObject.getOid());
}
oids.add(idEObject.getOid());
}
}
示例6: checkDoubleOidsPlusReferences
import org.bimserver.emf.IdEObject; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
private void checkDoubleOidsPlusReferences(BiMap<IdEObject, Long> done, IdEObject idEObject) {
if (idEObject == null) {
return;
}
if (idEObject.eClass().getEAnnotation("wrapped") != null) {
return;
}
if (done.containsKey(idEObject)) {
return;
}
if (done.containsValue(idEObject.getOid())) {
showBackReferences(idEObject);
IdEObject existing = done.inverse().get(idEObject.getOid());
showBackReferences(existing);
throw new RuntimeException("Double oid: " + idEObject.getOid() + " " + idEObject + ", " + existing);
}
done.put(idEObject, idEObject.getOid());
for (EReference eReference : idEObject.eClass().getEAllReferences()) {
if (eReference.isMany()) {
List list = (List) idEObject.eGet(eReference);
for (Object o : list) {
checkDoubleOidsPlusReferences(done, (IdEObject) o);
}
} else {
checkDoubleOidsPlusReferences(done, (IdEObject) idEObject.eGet(eReference));
}
}
}
示例7: addToObjectsToCommit
import org.bimserver.emf.IdEObject; //导入方法依赖的package包/类
public void addToObjectsToCommit(IdEObject idEObject) throws BimserverDatabaseException {
if (idEObject.getOid() == -1) {
throw new BimserverDatabaseException("Cannot store object with oid -1");
}
if (objectsToCommit == null) {
objectsToCommit = new ObjectsToCommit();
}
objectsToCommit.put(idEObject);
}
示例8: writeReference
import org.bimserver.emf.IdEObject; //导入方法依赖的package包/类
private void writeReference(IdEObject object, Object value, ByteBuffer buffer, EStructuralFeature feature) throws BimserverDatabaseException {
IdEObject idEObject = (IdEObject) value;
if (idEObject.getOid() < 0) {
throw new BimserverDatabaseException("Writing a reference with oid " + idEObject.getOid() + ", this is not supposed to happen, referenced: " + idEObject.getOid() + " " + value + " from " + object.getOid() + " " + object);
}
buffer.order(ByteOrder.LITTLE_ENDIAN);
buffer.putLong(idEObject.getOid());
buffer.order(ByteOrder.BIG_ENDIAN);
}
示例9: copy
import org.bimserver.emf.IdEObject; //导入方法依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
private IdEObject copy(IfcModel target, IdEObject idEObject, boolean limitToNonGuids) throws IfcModelInterfaceException {
if (target.contains(idEObject.getOid())) {
return target.get(idEObject.getOid());
}
IdEObject newObject = (IdEObject) idEObject.eClass().getEPackage().getEFactoryInstance().create(idEObject.eClass());
((IdEObjectImpl)newObject).setOid(idEObject.getOid());
if (newObject.getOid() != -1) {
target.add(newObject.getOid(), newObject);
}
for (EAttribute eAttribute : newObject.eClass().getEAllAttributes()) {
newObject.eSet(eAttribute, idEObject.eGet(eAttribute));
}
for (EReference eReference : newObject.eClass().getEAllReferences()) {
Object referencedObject = idEObject.eGet(eReference);
if (referencedObject instanceof IdEObject) {
IdEObject refEObject = (IdEObject)referencedObject;
if (!limitToNonGuids || !(referencedObject instanceof IfcRoot) && !(referencedObject instanceof IfcGloballyUniqueId)) {
newObject.eSet(eReference, copy(target, refEObject, limitToNonGuids));
}
} else if (referencedObject instanceof List) {
List list = (List)referencedObject;
List newList = (List)newObject.eGet(eReference);
for (Object o : list) {
if (!limitToNonGuids || !(o instanceof IfcRoot) && !(o instanceof IfcGloballyUniqueId)) {
IdEObject listObject = (IdEObject)o;
IdEObject smartCopy = copy(target, listObject, limitToNonGuids);
if (!newList.contains(smartCopy)) {
newList.add(smartCopy);
}
}
}
}
}
return newObject;
}
示例10: updateNode
import org.bimserver.emf.IdEObject; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public void updateNode(T expressId, EClass ec, IdEObject eObject) throws DeserializeException {
for (WaitingObject waitingObject : waitingObjects.get(expressId)) {
if (waitingObject.getEReference().isMany()) {
AbstractEList<EObject> list = (AbstractEList<EObject>) waitingObject.getObject().eGet(waitingObject.getEReference());
if (waitingObject instanceof SingleWaitingObject) {
list.addUnique(eObject);
} else {
ListWaitingObject listWaitingObject = (ListWaitingObject)waitingObject;
if (((EClass) waitingObject.getEReference().getEType()).isSuperTypeOf(eObject.eClass())) {
while (list.size() <= listWaitingObject.getIndex()) {
EObject create = ec.getEPackage().getEFactoryInstance().create(eObject.eClass());
((IdEObjectImpl)create).setOid(-2);
list.addUnique(create);
}
list.setUnique(listWaitingObject.getIndex(), eObject);
} else {
throw new DeserializeException(waitingObject.getLineNumber(), "Field " + waitingObject.getEReference().getName() + " of "
+ waitingObject.getEReference().getEContainingClass().getName() + " cannot contain a " + eObject.eClass().getName());
}
}
} else {
if (((EClass) waitingObject.getEReference().getEType()).isSuperTypeOf(eObject.eClass())) {
waitingObject.getObject().eSet(waitingObject.getEReference(), eObject);
} else {
throw new DeserializeException(waitingObject.getLineNumber(), "Field " + waitingObject.getEReference().getName() + " of "
+ waitingObject.getEReference().getEContainingClass().getName() + " cannot contain a " + eObject.eClass().getName() + "/" + eObject.getOid());
}
}
}
waitingObjects.remove(expressId);
}
示例11: ObjectNode
import org.bimserver.emf.IdEObject; //导入方法依赖的package包/类
public ObjectNode(IdEObject idEObject) {
super(idEObject.eClass().getName() + " (" + idEObject.getOid() + ")");
this.idEObject = idEObject;
}