protected <T> void assertAttribute(PrismObject<ResourceType> resource, ShadowType shadow, String attrName, T... expectedValues) { QName attrQname = new QName(ResourceTypeUtil.getResourceNamespace(resource), attrName); assertAttribute(resource, shadow, attrQname, expectedValues); }
public static void assertProvisioningAccountShadow(PrismObject<ShadowType> account, ResourceType resourceType, Class<?> expetcedAttributeDefinitionClass) { assertProvisioningShadow(account,resourceType,expetcedAttributeDefinitionClass, new QName(ResourceTypeUtil.getResourceNamespace(resourceType), SchemaTestConstants.ICF_ACCOUNT_OBJECT_CLASS_LOCAL_NAME)); }
private void registerName(ResourceValidationContext ctx, Set<QName> existingNames, Set<QName> duplicates, ItemPathType ref) { QName name = itemRefToName(ref); if (name != null) { if (name.getNamespaceURI() == null) { name = new QName(ResourceTypeUtil.getResourceNamespace(ctx.resourceObject), name.getLocalPart()); // TODO is this correct? } if (!existingNames.add(name)) { duplicates.add(name); } } }
protected <T> void assertAttribute(PrismObject<ResourceType> resource, ShadowType shadow, String attrName, T... expectedValues) { QName attrQname = new QName(ResourceTypeUtil.getResourceNamespace(resource), attrName); assertAttribute(resource, shadow, attrQname, expectedValues); }
public static <T> void assertAttribute(PrismObject<? extends ShadowType> shadow, ResourceType resource, String name, T... expectedValues) { assertAttribute("Wrong attribute " + name + " in "+shadow, shadow, new QName(ResourceTypeUtil.getResourceNamespace(resource), name), expectedValues); }
public static <T> void assertAttribute(ShadowType shadow, ResourceType resource, String name, T... expectedValues) { assertAttribute("Wrong attribute " + name + " in "+shadow, shadow, new QName(ResourceTypeUtil.getResourceNamespace(resource), name), expectedValues); }
@NotNull public static String getResourceNamespace(PrismObject<ResourceType> resource) { return getResourceNamespace(resource.asObjectable()); }
protected void assertNoAttribute(PrismObject<ResourceType> resource, ShadowType shadow, String attrName) { QName attrQname = new QName(ResourceTypeUtil.getResourceNamespace(resource), attrName); assertNoAttribute(resource, shadow, attrQname); }
public static QName getDefaultAccountObjectClass(ResourceType resourceType) { String namespace = ResourceTypeUtil.getResourceNamespace(resourceType); return new QName(namespace, SchemaConstants.ACCOUNT_OBJECT_CLASS_LOCAL_NAME); }
public <T> Integer countAccounts(ResourceType resourceType, String attributeName, T attributeValue) throws SchemaException, ObjectNotFoundException, CommunicationException, ConfigurationException, SecurityViolationException, ExpressionEvaluationException { OperationResult result = getCurrentResult(MidpointFunctions.class.getName() + ".countAccounts"); QName attributeQName = new QName(ResourceTypeUtil.getResourceNamespace(resourceType), attributeName); return countAccounts(resourceType, attributeQName, attributeValue, getCurrentTask(), result); }
public static void checkAccountShadow(ShadowType shadowType, ResourceType resourceType, RepositoryService repositoryService, ObjectChecker<ShadowType> checker, MatchingRule<String> uidMatchingRule, PrismContext prismContext, OperationResult parentResult) throws SchemaException { checkShadow(shadowType, resourceType, repositoryService, checker, uidMatchingRule, prismContext, parentResult); assertEquals(new QName(ResourceTypeUtil.getResourceNamespace(resourceType), SchemaTestConstants.ICF_ACCOUNT_OBJECT_CLASS_LOCAL_NAME), shadowType.getObjectClass()); }
public static void checkEntitlementShadow(ShadowType shadowType, ResourceType resourceType, RepositoryService repositoryService, ObjectChecker<ShadowType> checker, String objectClassLocalName, MatchingRule<String> uidMatchingRule, PrismContext prismContext, OperationResult parentResult) throws SchemaException { checkShadow(shadowType, resourceType, repositoryService, checker, uidMatchingRule, prismContext, parentResult); assertEquals(new QName(ResourceTypeUtil.getResourceNamespace(resourceType), objectClassLocalName), shadowType.getObjectClass()); }
public <T> boolean isUniqueAccountValue(ResourceType resourceType, ShadowType shadowType, String attributeName, T attributeValue) throws SchemaException, ObjectNotFoundException, CommunicationException, ConfigurationException, SecurityViolationException, ExpressionEvaluationException { Validate.notEmpty(attributeName, "Empty attribute name"); OperationResult result = getCurrentResult(MidpointFunctions.class.getName() + ".isUniqueAccountValue"); QName attributeQName = new QName(ResourceTypeUtil.getResourceNamespace(resourceType), attributeName); return isUniqueAccountValue(resourceType, shadowType, attributeQName, attributeValue, getCurrentTask(), result); }
private void checkResource(ResourceType resource, OperationResult objectResult) { OperationResult subresult = objectResult.createSubresult(OPERATION_RESOURCE_NAMESPACE_CHECK); checkUri(resource, ResourceTypeUtil.getResourceNamespace(resource), "namespace", subresult); subresult.recordSuccessIfUnknown(); }
private PrismProperty createProperty(String propertyName, String propertyValue) { ObjectClassComplexTypeDefinition accountDefinition = resourceSchema.findObjectClassDefinition( new QName(ResourceTypeUtil.getResourceNamespace(resourceType), OpenDJController.OBJECT_CLASS_INETORGPERSON_NAME)); ResourceAttributeDefinition propertyDef = accountDefinition.findAttributeDefinition(new QName( ResourceTypeUtil.getResourceNamespace(resourceType), propertyName)); ResourceAttribute property = propertyDef.instantiate(); property.setRealValue(propertyValue); return property; }
protected <T> void addAttributeToShadow(PrismObject<ShadowType> shadow, PrismObject<ResourceType> resource, String attrName, T attrValue) throws SchemaException { ResourceAttributeContainer attrs = ShadowUtil.getAttributesContainer(shadow); ResourceAttributeDefinition attrSnDef = attrs.getDefinition().findAttributeDefinition( new ItemName(ResourceTypeUtil.getResourceNamespace(resource), attrName)); ResourceAttribute<T> attr = attrSnDef.instantiate(); attr.setRealValue(attrValue); attrs.add(attr); }
private String getEntryUuid(Collection<ResourceAttribute<?>> identifiers) { for (ResourceAttribute<?> identifier : identifiers) { if (identifier.getElementName().equals(new QName(ResourceTypeUtil.getResourceNamespace(resourceType), OpenDJController.RESOURCE_OPENDJ_PRIMARY_IDENTIFIER_LOCAL_NAME))) { return identifier.getValue(String.class).getValue(); } } return null; }
private PropertyModificationOperation createReplaceAttributeChange(String propertyName, String propertyValue) { PrismProperty property = createProperty(propertyName, propertyValue); ItemPath propertyPath = ItemPath.create(ShadowType.F_ATTRIBUTES, new QName(ResourceTypeUtil.getResourceNamespace(resourceType), propertyName)); PropertyDelta delta = prismContext.deltaFactory().property().create(propertyPath, property.getDefinition()); delta.setRealValuesToReplace(propertyValue); PropertyModificationOperation attributeModification = new PropertyModificationOperation(delta); return attributeModification; }
private PropertyModificationOperation createDeleteAttributeChange(String propertyName, String propertyValue) { PrismProperty property = createProperty(propertyName, propertyValue); ItemPath propertyPath = ItemPath.create(ShadowType.F_ATTRIBUTES, new QName(ResourceTypeUtil.getResourceNamespace(resourceType), propertyName)); PropertyDelta delta = prismContext.deltaFactory().property().create(propertyPath, property.getDefinition()); delta.addRealValuesToDelete(propertyValue); PropertyModificationOperation attributeModification = new PropertyModificationOperation(delta); return attributeModification; }
private PropertyModificationOperation createAddAttributeChange(String propertyName, String propertyValue) { PrismProperty property = createProperty(propertyName, propertyValue); ItemPath propertyPath = ItemPath.create(ShadowType.F_ATTRIBUTES, new QName(ResourceTypeUtil.getResourceNamespace(resourceType), propertyName)); PropertyDelta delta = prismContext.deltaFactory().property().create(propertyPath, property.getDefinition()); delta.addRealValuesToAdd(propertyValue); PropertyModificationOperation attributeModification = new PropertyModificationOperation(delta); return attributeModification; }