public static Collection<ResourceAttribute<?>> getPrimaryIdentifiers(PrismObject<? extends ShadowType> shadow) { ResourceAttributeContainer attributesContainer = getAttributesContainer(shadow); if (attributesContainer == null) { return null; } return attributesContainer.getPrimaryIdentifiers(); }
private void validateShadow(PrismObject<? extends ShadowType> shadow, String operation, boolean requireUid) { if (shadow == null) { throw new IllegalArgumentException("Cannot " + operation + " null " + shadow); } PrismContainer<?> attributesContainer = shadow.findContainer(ShadowType.F_ATTRIBUTES); if (attributesContainer == null) { throw new IllegalArgumentException("Cannot " + operation + " shadow without attributes container"); } ResourceAttributeContainer resourceAttributesContainer = ShadowUtil .getAttributesContainer(shadow); if (resourceAttributesContainer == null) { throw new IllegalArgumentException("Cannot " + operation + " shadow without attributes container of type ResourceAttributeContainer, got " + attributesContainer.getClass()); } if (requireUid) { Collection<ResourceAttribute<?>> identifiers = resourceAttributesContainer.getPrimaryIdentifiers(); if (identifiers == null || identifiers.isEmpty()) { throw new IllegalArgumentException("Cannot " + operation + " shadow without identifiers"); } } }
if (namingAttribute == null || namingAttribute.isEmpty()) { Collection<ResourceAttribute<?>> identifiers = attributesContainer.getPrimaryIdentifiers();
@Test public void test500FetchObject() throws Exception { final String TEST_NAME = "test500FetchObject"; TestUtil.displayTestTitle(this, TEST_NAME); // GIVEN ResourceAttributeContainer resourceObject = createResourceObject( "uid=Teell,ou=People,dc=example,dc=com", "Teell William", "Teell"); OperationResult addResult = new OperationResult(this.getClass().getName() + "." + TEST_NAME); PrismObject<ShadowType> shadow = wrapInShadow(ShadowType.class, resourceObject); // Add a testing object cc.addObject(shadow, null, null, addResult); ObjectClassComplexTypeDefinition accountDefinition = resourceObject.getDefinition().getComplexTypeDefinition(); Collection<ResourceAttribute<?>> identifiers = resourceObject.getPrimaryIdentifiers(); // Determine object class from the schema ResourceObjectIdentification identification = new ResourceObjectIdentification(accountDefinition, identifiers, null); OperationResult result = new OperationResult(this.getClass().getName() + "." + TEST_NAME); // WHEN PrismObject<ShadowType> ro = cc.fetchObject(identification, null, null, result); // THEN AssertJUnit.assertNotNull(ro); System.out.println("Fetched object " + ro); System.out.println("Result:"); System.out.println(result.debugDump()); }
Collection<ResourceAttribute<?>> identifiers = resourceObject.getPrimaryIdentifiers();
Collection<ResourceAttribute<?>> identifiers = attributesContainer.getPrimaryIdentifiers(); assertNotNull("No identifiers (null) in attributes container in "+accountJackOid, identifiers); assertFalse("No identifiers (empty) in attributes container in "+accountJackOid, identifiers.isEmpty());
Collection<ResourceAttribute<?>> primaryIdentifiers = attributesContainer.getPrimaryIdentifiers(); for (PrismProperty<?> p : primaryIdentifiers) { repoAttributesContainer.add(p.clone());