use of eu.esdihumboldt.hale.common.instance.model.impl.PseudoInstanceReference in project hale by halestudio.
the class ResolvableInstanceReference method getId.
/**
* Looks for an ID in the original reference and, if that fails, for an
* {@link InstanceReferenceDecorator}.
*
* @see eu.esdihumboldt.hale.common.instance.model.Identifiable#getId()
*/
@Override
public Object getId() {
InstanceReference origRef = getOriginalReference();
if (origRef instanceof Identifiable) {
return Identifiable.getId(origRef);
} else if (origRef instanceof PseudoInstanceReference && ((PseudoInstanceReference) origRef).getInstance() instanceof Identifiable) {
PseudoInstanceReference pir = (PseudoInstanceReference) origRef;
Identifiable ii = (Identifiable) pir.getInstance();
return ii.getId();
}
IdentifiableInstanceReference iir = InstanceReferenceDecorator.findDecoration(origRef, IdentifiableInstanceReference.class);
if (iir != null) {
return iir.getId();
}
return null;
}
Aggregations