use of eu.esdihumboldt.hale.common.instance.model.impl.InstanceDecorator in project hale by halestudio.
the class OrientInstanceReference method createReference.
/**
* Create a reference for an instance
*
* @param instance the instance, which must be an {@link OInstance}
* @return the instance reference
* @throws IllegalArgumentException if the instance is no {@link OInstance}
*/
public static InstanceReference createReference(Instance instance) {
if (instance.getDataSet() == null) {
throw new IllegalArgumentException("Instance data set may not be null for retrieving reference");
}
while (instance instanceof InstanceDecorator) {
instance = ((InstanceDecorator) instance).getOriginalInstance();
}
OInstance inst = (OInstance) instance;
ORID id = inst.getDocument().getIdentity();
return new OrientInstanceReference(id, instance.getDataSet(), inst.getDefinition());
}
Aggregations