/** * Returns a (single) primary identifier. * * This method returns a property that acts as an (primary) identifier for * the resource object. Primary identifiers are used to access the resource * objects, retrieve them from resource, identify objects for modifications, * etc. * * Returns null if no identifier is defined. * * Resource objects may have multiple (composite) identifiers, but this * method assumes that there is only a single identifier. The method will * throw exception if that assumption is not satisfied. * * @return identifier property * @throws IllegalStateException * if resource object has multiple identifiers */ @Override public PrismProperty<?> getPrimaryIdentifier() { Collection<ResourceAttribute<?>> attrDefs = getPrimaryIdentifiers(); if (attrDefs.size() > 1){ throw new IllegalStateException("Resource object has more than one identifier."); } for (PrismProperty<?> p : attrDefs){ return p; } return null; }