public ObjectType subtype(String value) { getSubtype().add(value); return this; }
public static <O extends ObjectType> void setSubtype(PrismObject<O> object, List<String> subtypes) { List<String> objSubtypes = object.asObjectable().getSubtype(); if (!objSubtypes.isEmpty()) { objSubtypes.clear(); } if (subtypes != null) { objSubtypes.addAll(subtypes); } } }
public List<String> createSubtypeList() { PrismForJAXBUtil.createProperty(asPrismContainerValue(), F_SUBTYPE); return getSubtype(); }
public PrismObjectAsserter<O,RA> assertSubtype(String... expected) { PrismAsserts.assertEqualsCollectionUnordered("Wrong subtype in "+desc(), getObject().asObjectable().getSubtype(), expected); return this; }
@Deprecated protected static <T extends ObjectType> void copyToJAXB(RObject<T> repo, ObjectType jaxb, PrismContext prismContext, Collection<SelectorOptions<GetOperationOptions>> options) { Validate.notNull(repo, "Repo object must not be null."); Validate.notNull(jaxb, "JAXB object must not be null."); jaxb.setName(RPolyString.copyToJAXB(repo.getName())); jaxb.setOid(repo.getOid()); jaxb.setVersion(Integer.toString(repo.getVersion())); jaxb.setLifecycleState(repo.getLifecycleState()); if (repo.getSubtype() != null) { jaxb.getSubtype().addAll(repo.getSubtype()); } if (SelectorOptions.hasToLoadPath(ObjectType.F_PARENT_ORG_REF, options)) { List orgRefs = RUtil.safeSetReferencesToList(repo.getParentOrgRef(), prismContext); if (!orgRefs.isEmpty()) { jaxb.getParentOrgRef().addAll(orgRefs); } } }
@NotNull // to eliminate the need for extensive NPE avoidance public static <O extends ObjectType> List<String> determineSubTypes(PrismObject<O> object) { if (object == null) { return emptyList(); } List<String> subtypes = object.asObjectable().getSubtype(); if (!subtypes.isEmpty()) { return subtypes; } if (object.canRepresent(UserType.class)) { return (((UserType)object.asObjectable()).getEmployeeType()); } if (object.canRepresent(OrgType.class)) { return (((OrgType)object.asObjectable()).getOrgType()); } if (object.canRepresent(RoleType.class)) { // TODO why not return simply .getRoleType() [pmed] List<String> roleTypes = new ArrayList<>(1); roleTypes.add((((RoleType)object.asObjectable()).getRoleType())); return roleTypes; } if (object.canRepresent(ServiceType.class)) { return (((ServiceType)object.asObjectable()).getServiceType()); } return emptyList(); }
repo.setLifecycleState(jaxb.getLifecycleState()); repo.setSubtype(RUtil.listToSet(jaxb.getSubtype()));