@Override public String getNamespace() { return getName().getNamespaceURI(); }
protected String getSchemaNamespace() { return getName().getNamespaceURI(); }
@NotNull @Override public List<?> getSegments() { return Collections.singletonList(new QName(getNamespaceURI(), getLocalPart(), getPrefix())); // todo eliminate QName construction while avoiding endless recursion }
private ItemDefinition<?> createPropertyDefinition(MutablePrismContainerDefinition<?> configurationContainerDef, PropertyDescriptor prop) { String propName = prop.getName(); Class<?> propertyType = prop.getPropertyType(); Class<?> baseType = propertyType; int minOccurs = 1; int maxOccurs = 1; if (propertyType.isArray()) { maxOccurs = -1; baseType = propertyType.getComponentType(); } // TODO: minOccurs: define which properties are optional/mandatory // TODO: display names, ordering, help texts QName propType = XsdTypeMapper.toXsdType(baseType); return configurationContainerDef.createPropertyDefinition(new QName(configurationContainerDef.getName().getNamespaceURI(), propName), propType, minOccurs, maxOccurs); }
private ItemName getExtensionContainerElementName() { return new ItemName(getElementName().getNamespaceURI(), PrismConstants.EXTENSION_LOCAL_NAME); }
private ItemName getExtensionQName() { String namespace = getName().getNamespaceURI(); return new ItemName(namespace, PrismConstants.EXTENSION_LOCAL_NAME); }
private ItemName getNamePropertyElementName() { return new ItemName(getElementName().getNamespaceURI(), PrismConstants.NAME_LOCAL_NAME); }
@Override public ResourceAttributeDefinition findAttributeDefinition(String elementLocalname) { ItemName elementQName = new ItemName(getName().getNamespaceURI(),elementLocalname); return findAttributeDefinition(elementQName); }
} else if (itemNameFromSource != null) { if (QNameUtil.noNamespace(itemNameFromSource) && definition != null) { info.itemName = new QName(definition.getName().getNamespaceURI(), itemNameFromSource.getLocalPart()); } else { info.itemName = itemNameFromSource;
String attrNamespace = definition.getName().getNamespaceURI(); if (attrNamespace != null && attrNamespace.equals(getNamespace())) { setAttribute(property, "name", definition.getName().getLocalPart());
@Test public void testGetExtensionPropertyValueParts() throws Exception { final String TEST_NAME = "testGetExtensionPropertyValueParts"; TestUtil.displayTestTitle(TEST_NAME); // GIVEN BasicExpressionFunctions f = createBasicFunctions(); PrismObject<UserType> userJack = PrismTestUtil.parseObject(USER_JACK_FILE); // WHEN String shipExtension = f.getExtensionPropertyValue(userJack.asObjectable(), SchemaTestConstants.EXTENSION_SHIP_ELEMENT.getNamespaceURI(), SchemaTestConstants.EXTENSION_SHIP_ELEMENT.getLocalPart()); // THEN assertEquals("Wrong value for extension "+SchemaTestConstants.EXTENSION_SHIP_ELEMENT, "Black Pearl", shipExtension); }
String attrNamespace = definition.getName().getNamespaceURI(); if (attrNamespace != null && attrNamespace.equals(getNamespace())) { setAttribute(property, "name", definition.getName().getLocalPart());
private void assertDomSchema(Element xsdElement) { assertPrefix("xsd", xsdElement); Element displayNameAnnotationElement = DOMUtil.findElementRecursive(xsdElement, PrismConstants.A_DISPLAY_NAME); assertPrefix(PrismConstants.PREFIX_NS_ANNOTATION, displayNameAnnotationElement); Element kindAnnotationElement = DOMUtil.findElementRecursive(xsdElement, MidPointConstants.RA_KIND); assertPrefix("ra", kindAnnotationElement); assertEquals(ShadowKindType.ACCOUNT.value(), kindAnnotationElement.getTextContent()); Element identifierAnnotationElement = DOMUtil.findElementRecursive(xsdElement, MidPointConstants.RA_IDENTIFIER); assertPrefix("ra", identifierAnnotationElement); QName identifier = DOMUtil.getQNameValue(identifierAnnotationElement); assertEquals("Wrong <a:identifier> value namespace", SchemaTestConstants.ICFS_UID.getNamespaceURI(), identifier.getNamespaceURI()); assertEquals("Wrong <a:identifier> value localname", SchemaTestConstants.ICFS_UID.getLocalPart(), identifier.getLocalPart()); assertEquals("Wrong <a:identifier> value prefix", "icfs", identifier.getPrefix()); Element dnaAnnotationElement = DOMUtil.findElementRecursive(xsdElement, MidPointConstants.RA_DISPLAY_NAME_ATTRIBUTE); assertPrefix("ra", dnaAnnotationElement); QName dna = DOMUtil.getQNameValue(dnaAnnotationElement); assertEquals("Wrong <a:identifier> value prefix", "tns", dna.getPrefix()); assertEquals("Wrong 'tns' prefix declaration", SCHEMA_NAMESPACE, xsdElement.lookupNamespaceURI("tns")); }