private QName determineElementQName(Containerable containerable) { PrismContainerValue prismContainerValue = containerable.asPrismContainerValue(); PrismContainerDefinition<?> definition = prismContainerValue.getParent() != null ? prismContainerValue.getParent().getDefinition() : null; if (definition != null) { if (definition.getName() != null) { return definition.getName(); } } throw new IllegalStateException("Cannot determine element name of " + containerable + " (parent = " + prismContainerValue.getParent() + ", definition = " + definition + ")"); }
public static <T> void assertPropertyValue(PrismContainerValue<?> containerValue, ItemPath propPath, T... realPropValues) { PrismProperty<T> property = containerValue.findProperty(propPath); assertNotNull("Property " + propPath + " not found in " + containerValue.getParent(), property); assertPropertyValueDesc(property, containerValue.getParent().toString(), realPropValues); }
public static PrismObject setupContainerValue(PrismObject prismObject, PrismContainerValue containerValue) { PrismContainerable parent = containerValue.getParent(); if (parent != null && parent instanceof PrismObject) { return (PrismObject)parent; } try { prismObject.setValue(containerValue); return prismObject; } catch (SchemaException e) { // This should not happen. Code generator and compiler should take care of that. throw new IllegalStateException("Internal schema error: "+e.getMessage(),e); } }
public static <T> void assertPropertyValueMatch(PrismContainerValue<?> containerValue, ItemPath propQName, MatchingRule<T> matchingRule, T... realPropValues) throws SchemaException { PrismProperty<T> property = containerValue.findProperty(propQName); assertNotNull("Property " + propQName + " not found in " + containerValue.getParent(), property); assertSame("Wrong parent for property " + property, containerValue, property.getParent()); assertPropertyValueDesc(property, matchingRule, containerValue.getParent().toString(), realPropValues); }
@SuppressWarnings("unchecked") private static void computePathToRoot(List<String> path, PrismContainerValue<? extends AbstractPolicyConstraintType> pc) { path.add(pc.asContainerable().getName()); if (pc.getParent() instanceof PrismContainer) { PrismContainer<? extends AbstractPolicyConstraintType> container = (PrismContainer<? extends AbstractPolicyConstraintType>) pc.getParent(); PrismValue containerParentValue = container.getParent(); if (containerParentValue instanceof PrismContainerValue && ((PrismContainerValue) containerParentValue).asContainerable() instanceof AbstractPolicyConstraintType) { computePathToRoot(path, ((PrismContainerValue) container.getParent())); } } }
static <V extends PrismContainerValue> void createParentIfNeeded(V value, ItemDefinition definition) throws SchemaException { if (value.getParent() != null) { return; } if (!(definition instanceof PrismContainerDefinition)) { throw new SchemaException("Missing or invalid definition for a PrismContainer: " + definition); } PrismContainer<?> rv = (PrismContainer) definition.instantiate(); rv.add(value); }
public static <V extends PrismContainerValue> void createParentIfNeeded(V value, ItemDefinition definition) throws SchemaException { if (value.getParent() != null) { return; } if (!(definition instanceof PrismContainerDefinition)) { throw new SchemaException("Missing or invalid definition for a PrismContainer: " + definition); } PrismContainerImpl<?> rv = (PrismContainerImpl) definition.instantiate(); rv.add(value); }
public static <T> void assertPropertyValueMatch(PrismContainer<?> container, ItemPath propQName, MatchingRule<T> matchingRule, T... realPropValues) throws SchemaException { PrismContainerValue<?> containerValue = container.getValue(); assertSame("Wrong parent for value of container "+container, container, containerValue.getParent()); assertPropertyValueMatch(containerValue, propQName, matchingRule, realPropValues); }
public static <T> void assertPropertyValue(PrismContainer<?> container, ItemPath propPath, T... realPropValues) { PrismContainerValue<?> containerValue = container.getValue(); assertSame("Wrong parent for value of container "+container, container, containerValue.getParent()); assertPropertyValue(containerValue, propPath, realPropValues); }
public<X >X end() { return ((X)((PrismContainerValue)((PrismContainer) asPrismContainerValue().getParent()).getParent()).asContainerable()); }
public<X >X end() { return ((X)((PrismContainerValue)((PrismContainer) asPrismContainerValue().getParent()).getParent()).asContainerable()); }
public<X >X end() { return ((X)((PrismContainerValue)((PrismContainer) asPrismContainerValue().getParent()).getParent()).asContainerable()); }
public<X >X end() { return ((X)((PrismContainerValue)((PrismContainer) asPrismContainerValue().getParent()).getParent()).asContainerable()); }
public<X >X end() { return ((X)((PrismContainerValue)((PrismContainer) asPrismContainerValue().getParent()).getParent()).asContainerable()); }
public<X >X end() { return ((X)((PrismContainerValue)((PrismContainer) asPrismContainerValue().getParent()).getParent()).asContainerable()); }
public<X >X end() { return ((X)((PrismContainerValue)((PrismContainer) asPrismContainerValue().getParent()).getParent()).asContainerable()); }
private S_ValuesEntry getDeltaItemFragment(PrismContainerValue<AssignmentType> cval) throws SchemaException { PrismContainerDefinition<AssignmentType> definition = cval.getParent() != null ? cval.getParent().getDefinition() : null; if (definition == null) { // we use custom definition, if available; if not, we find the standard one definition = prismContext.getSchemaRegistry().findObjectDefinitionByCompileTimeClass(AssignmentHolderType.class) .findItemDefinition(AssignmentHolderType.F_ASSIGNMENT); } definition = definition.clone(); definition.toMutable().setMaxOccurs(1); return prismContext.deltaFor(AssignmentHolderType.class) .item(AssignmentHolderType.F_ASSIGNMENT, definition); }
private PrismObject<AccessCertificationCampaignType> getOwningCampaignChecked(AccessCertificationCaseType aCase) { PrismContainer caseContainer = (PrismContainer) aCase.asPrismContainerValue().getParent(); assertNotNull("campaign is not fetched (case parent is null)", caseContainer); PrismContainerValue campaignValue = (PrismContainerValue) caseContainer.getParent(); assertNotNull("campaign is not fetched (case container parent is null)", caseContainer); PrismObject<AccessCertificationCampaignType> campaign = (PrismObject) campaignValue.getParent(); assertNotNull("campaign is not fetched (campaign PCV parent is null)", campaign); return campaign; }
private void checkExtension(ExtensionType extension, String sourceDescription) throws SchemaException { PrismContainerValue<ExtensionType> extensionValueFromJaxb = extension.asPrismContainerValue(); assertNotNull("No extension container in "+sourceDescription+" (jaxb)", extensionValueFromJaxb); assertNotNull("No extension definition in "+sourceDescription+" (jaxb)", extensionValueFromJaxb.getParent().getDefinition()); assertTrue("Not runtime in definition in "+sourceDescription+" (jaxb)", extensionValueFromJaxb.getParent().getDefinition().isRuntimeSchema()); PrismProperty<Integer> intProperty = extensionValueFromJaxb.findOrCreateProperty(EXTENSION_INT_TYPE_ELEMENT); PrismAsserts.assertDefinition(intProperty.getDefinition(), EXTENSION_INT_TYPE_ELEMENT, DOMUtil.XSD_INT, 0, -1); intProperty.setRealValue(15); PrismProperty<String> stringProperty = extensionValueFromJaxb.findOrCreateItem(EXTENSION_STRING_TYPE_ELEMENT, PrismProperty.class); PrismAsserts.assertDefinition(stringProperty.getDefinition(), EXTENSION_STRING_TYPE_ELEMENT, DOMUtil.XSD_STRING, 0, -1); stringProperty.setRealValue("fifteen men on a dead man chest"); }