Example usage for javax.xml.namespace QName getLocalPart

List of usage examples for javax.xml.namespace QName getLocalPart

Introduction

In this page you can find the example usage for javax.xml.namespace QName getLocalPart.

Prototype

public String getLocalPart() 

Source Link

Document

Get the local part of this QName.

Usage

From source file:com.evolveum.midpoint.prism.marshaller.BeanUnmarshaller.java

private <T, S> void unmarshallToAnyUsingGetter(T bean, Method getter, QName elementName, XNode xsubnode,
        ParsingContext pc) throws SchemaException {
    Class<T> beanClass = (Class<T>) bean.getClass();

    Class objectFactoryClass = inspector.getObjectFactoryClass(elementName.getNamespaceURI());
    Object objectFactory = instantiateObjectFactory(objectFactoryClass);
    Method elementFactoryMethod = inspector.findElementMethodInObjectFactory(objectFactoryClass,
            elementName.getLocalPart());
    Class<S> subBeanClass = (Class<S>) elementFactoryMethod.getParameterTypes()[0];

    if (xsubnode instanceof ListXNode) {
        for (XNode xsubSubNode : ((ListXNode) xsubnode)) {
            S subBean = unmarshal(xsubSubNode, subBeanClass, pc);
            unmarshallToAnyValue(bean, beanClass, subBean, objectFactoryClass, objectFactory,
                    elementFactoryMethod, getter, pc);
        }/*www  .j  av  a2 s.com*/
    } else {
        S subBean = unmarshal(xsubnode, subBeanClass, pc);
        unmarshallToAnyValue(bean, beanClass, subBean, objectFactoryClass, objectFactory, elementFactoryMethod,
                getter, pc);
    }
}

From source file:com.evolveum.midpoint.prism.schema.SchemaRegistryImpl.java

@Nullable
@Override//from   w  w w  .  j  a  v a2s . c o  m
public <TD extends TypeDefinition> TD findTypeDefinitionByType(@NotNull QName typeName,
        @NotNull Class<TD> definitionClass) {
    if (QNameUtil.noNamespace(typeName)) {
        return resolveGlobalTypeDefinitionWithoutNamespace(typeName.getLocalPart(), definitionClass);
    }
    PrismSchema schema = findSchemaByNamespace(typeName.getNamespaceURI());
    if (schema == null) {
        return null;
    }
    return schema.findTypeDefinitionByType(typeName, definitionClass);
}

From source file:com.evolveum.midpoint.prism.schema.SchemaRegistryImpl.java

@NotNull
@Override/*from www  .  jav a  2  s  . c o  m*/
public <TD extends TypeDefinition> Collection<? extends TD> findTypeDefinitionsByType(@NotNull QName typeName,
        @NotNull Class<TD> definitionClass) {
    if (QNameUtil.noNamespace(typeName)) {
        return resolveGlobalTypeDefinitionsWithoutNamespace(typeName.getLocalPart(), definitionClass);
    }
    PrismSchema schema = findSchemaByNamespace(typeName.getNamespaceURI());
    if (schema == null) {
        return Collections.emptyList();
    }
    return schema.findTypeDefinitionsByType(typeName, definitionClass);
}

From source file:com.evolveum.midpoint.prism.schema.SchemaRegistryImpl.java

@NotNull
@Override/*from   ww  w .  j a  v a2s  . c  om*/
public <ID extends ItemDefinition> List<ID> findItemDefinitionsByElementName(@NotNull QName elementName,
        @NotNull Class<ID> definitionClass) {
    if (QNameUtil.noNamespace(elementName)) {
        return resolveGlobalItemDefinitionsWithoutNamespace(elementName.getLocalPart(), definitionClass);
    } else {
        PrismSchema schema = findSchemaByNamespace(elementName.getNamespaceURI());
        if (schema == null) {
            return new ArrayList<>();
        }
        return schema.findItemDefinitionsByElementName(elementName, definitionClass);
    }
}

From source file:com.evolveum.midpoint.prism.schema.SchemaRegistryImpl.java

@Override
public QName resolveUnqualifiedTypeName(QName type) throws SchemaException {
    QName typeFound = null;/*from   w w  w.jav  a 2  s .  c  o  m*/
    for (SchemaDescription desc : schemaDescriptions) {
        QName typeInSchema = new QName(desc.getNamespace(), type.getLocalPart());
        if (desc.getSchema() != null && desc.getSchema().findComplexTypeDefinition(typeInSchema) != null) {
            if (typeFound != null) {
                throw new SchemaException("Ambiguous type name: " + type);
            } else {
                typeFound = typeInSchema;
            }
        }
    }
    if (typeFound == null) {
        throw new SchemaException("Unknown type: " + type);
    } else {
        return typeFound;
    }
}

From source file:com.evolveum.midpoint.prism.schema.SchemaRegistryImpl.java

@Nullable
@Override//from  w  w w.j  a v  a 2 s  .c  o  m
public <ID extends ItemDefinition> ID findItemDefinitionByType(@NotNull QName typeName,
        @NotNull Class<ID> definitionClass) {
    if (QNameUtil.noNamespace(typeName)) {
        TypeDefinition td = resolveGlobalTypeDefinitionWithoutNamespace(typeName.getLocalPart(),
                TypeDefinition.class);
        if (td == null) {
            return null;
        }
        typeName = td.getTypeName();
    }
    PrismSchema schema = findSchemaByNamespace(typeName.getNamespaceURI());
    if (schema == null) {
        return null;
    }
    return schema.findItemDefinitionByType(typeName, definitionClass);
}

From source file:com.evolveum.midpoint.prism.schema.SchemaRegistryImpl.java

@Override
public ItemDefinition findItemDefinitionByElementName(QName elementName,
        @Nullable List<String> ignoredNamespaces) {
    if (StringUtils.isEmpty(elementName.getNamespaceURI())) {
        return resolveGlobalItemDefinitionWithoutNamespace(elementName.getLocalPart(), ItemDefinition.class,
                true, ignoredNamespaces);
    }/*from   w w w .  j ava2 s.com*/
    PrismSchema schema = findSchemaByNamespace(elementName.getNamespaceURI());
    if (schema == null) {
        return null;
    }
    return schema.findItemDefinitionByElementName(elementName, ItemDefinition.class);
}

From source file:com.collabnet.ccf.teamforge.TFWriter.java

@Override
public Document[] deleteAttachment(Document gaDocument) {
    GenericArtifact ga = null;/* w w w  .ja  v  a2  s .  co  m*/
    try {
        ga = GenericArtifactHelper.createGenericArtifactJavaObject(gaDocument);
    } catch (GenericArtifactParsingException e) {
        String cause = "Problem occured while parsing the GenericArtifact into Document";
        log.error(cause, e);
        XPathUtils.addAttribute(gaDocument.getRootElement(), GenericArtifactHelper.ERROR_CODE,
                GenericArtifact.ERROR_GENERIC_ARTIFACT_PARSING);
        throw new CCFRuntimeException(cause, e);
    }
    this.initializeArtifact(ga);
    // String targetRepositoryId = ga.getTargetRepositoryId();
    String targetArtifactId = ga.getTargetArtifactId();
    String artifactId = ga.getDepParentTargetArtifactId();
    // String tracker = targetRepositoryId;
    Connection connection = null;
    GenericArtifact parentArtifact = null;
    try {
        connection = connect(ga);
        try {
            attachmentHandler.deleteAttachment(connection, targetArtifactId, artifactId, ga);
        } catch (AxisFault e) {
            javax.xml.namespace.QName faultCode = e.getFaultCode();
            if (faultCode.getLocalPart().equals("NoSuchObjectFault")) {
                log.warn("Attachment " + targetArtifactId + " does not exist any more!");
                return null;
            } else {
                throw e;
            }
        }
        log.info("Attachment " + targetArtifactId + " is deleted successfully.");
        ArtifactDO artifact = null;
        try {
            artifact = trackerHandler.getTrackerItem(connection, artifactId);
        } catch (AxisFault e) {
            javax.xml.namespace.QName faultCode = e.getFaultCode();
            if (faultCode.getLocalPart().equals("NoSuchObjectFault")) {
                log.warn("Artifact " + artifactId + " does not exist any more!");
                return null;
            } else {
                throw e;
            }
        }
        parentArtifact = new GenericArtifact();
        // make sure that we do not update the synchronization status record
        // for replayed attachments
        parentArtifact.setTransactionId(ga.getTransactionId());
        parentArtifact.setArtifactType(GenericArtifact.ArtifactTypeValue.PLAINARTIFACT);
        parentArtifact.setArtifactAction(GenericArtifact.ArtifactActionValue.UPDATE);
        parentArtifact.setArtifactMode(GenericArtifact.ArtifactModeValue.CHANGEDFIELDSONLY);
        parentArtifact.setConflictResolutionPriority(ga.getConflictResolutionPriority());
        parentArtifact.setSourceArtifactId(ga.getDepParentSourceArtifactId());
        parentArtifact.setSourceArtifactLastModifiedDate(ga.getSourceArtifactLastModifiedDate());
        parentArtifact.setSourceArtifactVersion(ga.getSourceArtifactVersion());
        parentArtifact.setSourceRepositoryId(ga.getSourceRepositoryId());
        parentArtifact.setSourceSystemId(ga.getSourceSystemId());
        parentArtifact.setSourceSystemKind(ga.getSourceSystemKind());
        parentArtifact.setSourceRepositoryKind(ga.getSourceRepositoryKind());
        parentArtifact.setSourceSystemTimezone(ga.getSourceSystemTimezone());

        parentArtifact.setTargetArtifactId(artifactId);
        parentArtifact.setTargetArtifactLastModifiedDate(DateUtil.format(artifact.getLastModifiedDate()));
        parentArtifact.setTargetArtifactVersion(Integer.toString(artifact.getVersion()));
        parentArtifact.setTargetRepositoryId(ga.getTargetRepositoryId());
        parentArtifact.setTargetRepositoryKind(ga.getTargetRepositoryKind());
        parentArtifact.setTargetSystemId(ga.getTargetSystemId());
        parentArtifact.setTargetSystemKind(ga.getTargetSystemKind());
        parentArtifact.setTargetSystemTimezone(ga.getTargetSystemTimezone());
    } catch (RemoteException e) {

        String message = "Exception while deleting attachment " + artifactId;
        log.error(message, e);
        throw new CCFRuntimeException(message, e);
    } finally {
        if (connection != null) {
            this.disconnect(connection);
        }
    }
    Document returnDocument = null;
    Document returnParentDocument = null;
    try {
        returnDocument = GenericArtifactHelper.createGenericArtifactXMLDocument(ga);
        returnParentDocument = GenericArtifactHelper.createGenericArtifactXMLDocument(parentArtifact);
    } catch (GenericArtifactParsingException e) {
        String message = "Exception while deleting attachment " + artifactId
                + ". Could not parse Generic artifact";
        log.error(message, e);
        throw new CCFRuntimeException(message, e);
    }
    return new Document[] { returnDocument, returnParentDocument };
}

From source file:com.collabnet.ccf.teamforge.TFWriter.java

@Override
public Document deleteArtifact(Document gaDocument) {
    GenericArtifact ga = null;/*  ww w.  ja  v a 2s  .c  om*/
    try {
        ga = GenericArtifactHelper.createGenericArtifactJavaObject(gaDocument);
    } catch (GenericArtifactParsingException e) {
        String cause = "Problem occured while parsing the GenericArtifact into Document";
        log.error(cause, e);
        XPathUtils.addAttribute(gaDocument.getRootElement(), GenericArtifactHelper.ERROR_CODE,
                GenericArtifact.ERROR_GENERIC_ARTIFACT_PARSING);
        throw new CCFRuntimeException(cause, e);
    }
    // now we have to figure out whether we have to delete a planning folder
    // or a tracker item
    String targetRepositoryId = ga.getTargetRepositoryId();
    String targetArtifactId = ga.getTargetArtifactId();
    Connection connection = null;
    GenericArtifact deletedArtifact = new GenericArtifact();
    // make sure that we do not update the synchronization status record for
    // replayed attachments
    deletedArtifact.setTransactionId(ga.getTransactionId());
    deletedArtifact.setArtifactType(GenericArtifact.ArtifactTypeValue.PLAINARTIFACT);
    deletedArtifact.setArtifactAction(GenericArtifact.ArtifactActionValue.DELETE);
    deletedArtifact.setArtifactMode(GenericArtifact.ArtifactModeValue.CHANGEDFIELDSONLY);
    deletedArtifact.setConflictResolutionPriority(ga.getConflictResolutionPriority());
    deletedArtifact.setSourceArtifactId(ga.getSourceArtifactId());
    deletedArtifact.setSourceArtifactLastModifiedDate(ga.getSourceArtifactLastModifiedDate());
    deletedArtifact.setSourceArtifactVersion(ga.getSourceArtifactVersion());
    deletedArtifact.setSourceRepositoryId(ga.getSourceRepositoryId());
    deletedArtifact.setSourceSystemId(ga.getSourceSystemId());
    deletedArtifact.setSourceSystemKind(ga.getSourceSystemKind());
    deletedArtifact.setSourceRepositoryKind(ga.getSourceRepositoryKind());
    deletedArtifact.setSourceSystemTimezone(ga.getSourceSystemTimezone());

    deletedArtifact.setTargetArtifactId(targetArtifactId);
    deletedArtifact.setTargetRepositoryId(ga.getTargetRepositoryId());
    deletedArtifact.setTargetRepositoryKind(ga.getTargetRepositoryKind());
    deletedArtifact.setTargetSystemId(ga.getTargetSystemId());
    deletedArtifact.setTargetSystemKind(ga.getTargetSystemKind());
    deletedArtifact.setTargetSystemTimezone(ga.getTargetSystemTimezone());

    try {
        connection = connect(ga);
        // now we have to figure out whether we have to delete a planning
        // folder or a tracker item
        if (TFConnectionFactory.isTrackerRepository(targetRepositoryId)) {
            ArtifactDO artifact = null;
            try {
                artifact = trackerHandler.getTrackerItem(connection, targetArtifactId);
            } catch (AxisFault e) {
                javax.xml.namespace.QName faultCode = e.getFaultCode();
                if (faultCode.getLocalPart().equals("NoSuchObjectFault")) {
                    log.warn("Artifact " + targetArtifactId + " does not exist any more!");
                } else {
                    throw e;
                }
            }
            if (artifact != null) {
                deletedArtifact
                        .setTargetArtifactLastModifiedDate(DateUtil.format(artifact.getLastModifiedDate()));
                deletedArtifact.setTargetArtifactVersion(Integer.toString(artifact.getVersion()));
                try {
                    trackerHandler.removeArtifact(connection, targetArtifactId);
                } catch (AxisFault e) {
                    javax.xml.namespace.QName faultCode = e.getFaultCode();
                    if (faultCode.getLocalPart().equals("NoSuchObjectFault")) {
                        log.warn("Artifact " + targetArtifactId + " does not exist any more!");
                    } else {
                        throw e;
                    }
                }
                log.info("Artifact " + targetArtifactId + " is deleted successfully.");
            }
        } else if (TFConnectionFactory.isPlanningFolderRepository(targetRepositoryId)) {
            PlanningFolderDO artifact = null;
            try {
                artifact = connection.getPlanningClient().getPlanningFolderData(targetArtifactId);
            } catch (AxisFault e) {
                javax.xml.namespace.QName faultCode = e.getFaultCode();
                if (faultCode.getLocalPart().equals("NoSuchObjectFault")) {
                    log.warn("Artifact " + targetArtifactId + " does not exist any more!");
                } else {
                    throw e;
                }
            }
            if (artifact != null) {
                deletedArtifact
                        .setTargetArtifactLastModifiedDate(DateUtil.format(artifact.getLastModifiedDate()));
                deletedArtifact.setTargetArtifactVersion(Integer.toString(artifact.getVersion()));
                try {
                    connection.getPlanningClient().deletePlanningFolder(targetArtifactId);
                } catch (AxisFault e) {
                    javax.xml.namespace.QName faultCode = e.getFaultCode();
                    if (faultCode.getLocalPart().equals("NoSuchObjectFault")) {
                        log.warn("Artifact " + targetArtifactId + " does not exist any more!");
                    } else {
                        throw e;
                    }
                }
                log.info("Artifact " + targetArtifactId + " is deleted successfully.");
            }
        } else {
            log.warn("deleteArtifact is not implemented for repository " + targetRepositoryId);
        }
    } catch (RemoteException e) {
        String message = "Exception while deleting artifact " + targetArtifactId;
        log.error(message, e);
        throw new CCFRuntimeException(message, e);
    } finally {
        if (connection != null) {
            this.disconnect(connection);
        }
    }
    Document returnDocument = null;
    try {
        returnDocument = GenericArtifactHelper.createGenericArtifactXMLDocument(deletedArtifact);
    } catch (GenericArtifactParsingException e) {
        String message = "Exception while deleting artifact " + targetArtifactId
                + ". Could not parse Generic artifact";
        log.error(message, e);
        throw new CCFRuntimeException(message, e);
    }
    return returnDocument;
}

From source file:com.evolveum.midpoint.prism.marshaller.BeanUnmarshaller.java

/**
 * Parses either a map entry, or a fictitious heterogeneous list property.
 *
 * It makes sure that a 'key' property is inserted into 'bean' object, being sourced from 'node' structure.
 * Node itself can be single-valued or multi-valued, corresponding to single or multi-valued 'key' property.
 * ---// www .j  a va  2 s .  c o  m
 * A notable (and quite ugly) exception is processing of fictitious heterogeneous lists.
 * In this case we have a ListXNode that should be interpreted as a MapXNode, inserting fictitious property
 * named after abstract multivalued property in the parent bean.
 *
 * For example, when we have (embedded in ExecuteScriptType):
 *   {
 *     pipeline: *[
 *       { element: search, ... },
 *       { element: sequence, ... }
 *     ]
 *   }
 *
 * ...it should be, in fact, read as if it would be:
 *
 *   {
 *     pipeline: {
 *        scriptingExpression: [
 *          { type: SearchExpressionType, ... },
 *          { type: ExpressionSequenceType, ... }
 *        ]
 *     }
 *   }
 *
 * (The only difference is in element names, which are missing in the latter snippet, but let's ignore that here.)
 *
 * Fictitious heterogeneous list entry here is "scriptingExpression", a property of pipeline (ExpressionPipelineType).
 *
  * We have to create the following data structure (corresponding to latter snippet):
 *
 * instance of ExecuteScriptType:
 *   scriptingExpression = instance of JAXBElement(pipeline, ExpressionPipelineType):         [1]
 *     scriptingExpression = List of                                             [2]
 *       - JAXBElement(search, SearchExpressionType)
 *       - JAXBElement(sequence, ExpressionSequenceType)
 *
 * We in fact invoke this method twice with the same node (a two-entry list, marked as '*' in the first snippet):
 * 1) bean=ExecuteScriptType, key=pipeline, node=HList(*), isHeteroListProperty=false
 * 2) bean=ExpressionPipelineType, key=scriptingExpression, node=HList(*), isHeteroListProperty=true      <<<
 *
 * During the first call we fill in scriptingExpression (single value) in ExecuteScriptType [1]; during the second one
 * we fill in scriptingExpression (multivalued) in ExpressionPipelineType [2].
 *
 * Now let's expand the sample.
 *
 * This XNode tree:
 *   {
 *     pipeline: *[
 *       { element: search, type: RoleType, searchFilter: {...}, action: log },
 *       { element: sequence, value: **[
 *           { element: action, type: delete },
 *           { element: action, type: assign, parameter: {...} },
 *           { element: search, type: UserType }
 *       ] }
 *     ]
 *   }
 *
 * Should be interpreted as:
 *   {
 *     pipeline: {
 *       scriptingExpression: [
 *          { type: SearchExpressionType, type: RoleType, searchFilter: {...}, action: log }
 *          { type: ExpressionSequenceType, scriptingExpression: [
 *                { type: ActionExpressionType, type: delete },
 *                { type: ActionExpressionType, type: assign, parameter: {...} },
 *                { type: SearchExpressionType, type: UserType }
 *            ] }
 *       ]
 *     }
 *   }
 *
 * Producing the following data:
 *
 * instance of ExecuteScriptType:
 *   scriptingExpression = instance of JAXBElement(pipeline, ExpressionPipelineType):         [1]
 *     scriptingExpression = List of                                             [2]
 *       - JAXBElement(search, instance of SearchExpressionType):
 *           type: RoleType,
 *           searchFilter: (...),
 *           action: log,
 *       - JAXBElement(sequence, instance of ExpressionSequenceType):
 *           scriptingExpression = List of
 *             - JAXBElement(action, instance of ActionExpressionType):
 *                 type: delete
 *             - JAXBElement(action, instance of ActionExpressionType):
 *                 type: assign
 *                 parameter: (...),
 *             - JAXBElement(search, instance of SearchExpressionType):
 *                 type: UserType
 *
 * Invocations of this method will be:
 *  1) bean=ExecuteScriptType, key=pipeline, node=HList(*), isHeteroListProperty=false
 *  2) bean=ExpressionPipelineType, key=scriptingExpression, node=HList(*), isHeteroListProperty=true            <<<
 *  3) bean=SearchExpressionType, key=type, node='type: c:RoleType', isHeteroListProperty=false
 *  4) bean=SearchExpressionType, key=searchFilter, node=XNode(map:1 entries), isHeteroListProperty=false
 *  5) bean=SearchExpressionType, key=action, node=XNode(map:1 entries), isHeteroListProperty=false
 *  6) bean=ActionExpressionType, key=type, node='type: log', isHeteroListProperty=false
 *  7) bean=ExpressionSequenceType, key=scriptingExpression, node=HList(**), isHeteroListProperty=true           <<<
 *  8) bean=ActionExpressionType, key=type, node='type: delete', isHeteroListProperty=false
 *  9) bean=ActionExpressionType, key=type, node='type: assign', isHeteroListProperty=false
 * 10) bean=ActionExpressionType, key=parameter, node=XNode(map:2 entries), isHeteroListProperty=false
 * 11) bean=ActionParameterValueType, key=name, node='name: role', isHeteroListProperty=false
 * 12) bean=ActionParameterValueType, key=value, node='value: rome555c-7797-11e2-94a6-001e8c717e5b', isHeteroListProperty=false
 * 13) bean=SearchExpressionType, key=type, node='type: UserType', isHeteroListProperty=false
 *
 * Here we have 2 calls with isHeteroListProperty=true; first for pipeline.scriptingExpression, second for
 * sequence.scriptingExpression.
 */
private <T> void unmarshalEntry(@NotNull T bean, @NotNull Class<T> beanClass, @NotNull QName key,
        @NotNull XNode node, @NotNull XNode containingNode, boolean isHeteroListProperty,
        @NotNull ParsingContext pc) throws SchemaException {

    //System.out.println("bean=" + bean.getClass().getSimpleName() + ", key=" + key.getLocalPart() + ", node=" + node + ", isHeteroListProperty=" + isHeteroListProperty);
    final String propName = key.getLocalPart();

    // this code is just to keep this method reasonably short
    PropertyAccessMechanism mechanism = new PropertyAccessMechanism();
    if (!mechanism.compute(bean, beanClass, propName, key, node, pc)) {
        return;
    }

    final String actualPropertyName = mechanism.actualPropertyName;
    final boolean storeAsRawType = mechanism.storeAsRawType;

    final Method getter = mechanism.getter;
    final Method setter = mechanism.setter;
    final boolean wrapInJaxbElement = mechanism.wrapInJaxbElement;

    if (Element.class.isAssignableFrom(mechanism.paramType)) {
        throw new IllegalArgumentException(
                "DOM not supported in field " + actualPropertyName + " in " + beanClass);
    }

    // The type T that is expected by the bean, i.e. either by
    //   - setMethod(T value), or
    //   - Collection<T> getMethod()
    // We use it to retrieve the correct value when parsing the node.
    // We might specialize it using the information derived from the node (to deal with inclusive polymorphism,
    // i.e. storing ExclusionPolicyConstraintType where AbstractPolicyConstraintType is expected).
    @NotNull
    Class<?> paramType;

    if (!storeAsRawType && !isHeteroListProperty) {
        Class<?> t = specializeParamType(node, mechanism.paramType, pc);
        if (t == null) { // indicates a problem
            return;
        } else {
            paramType = t;
        }
    } else {
        paramType = mechanism.paramType;
    }

    if (!(node instanceof ListXNode) && Object.class.equals(paramType) && !storeAsRawType) {
        throw new IllegalArgumentException("Object property (without @Raw) not supported in field "
                + actualPropertyName + " in " + beanClass);
    }

    //      String paramNamespace = inspector.determineNamespace(paramType);

    boolean problem = false;
    Object propValue = null;
    Collection<Object> propValues = null;
    // For heterogeneous lists we have to create multi-valued fictitious property first. So we have to treat node as a map
    // (instead of list) and process it as a single value. Only when
    if (node instanceof ListXNode && (!node.isHeterogeneousList() || isHeteroListProperty)) {
        ListXNode xlist = (ListXNode) node;
        if (setter != null) {
            try {
                Object value = unmarshalSinglePropValue(node, actualPropertyName, paramType, storeAsRawType,
                        beanClass, pc);
                if (wrapInJaxbElement) {
                    propValue = wrapInJaxbElement(value, mechanism.objectFactory,
                            mechanism.elementFactoryMethod, propName, beanClass, pc);
                } else {
                    propValue = value;
                }
            } catch (SchemaException e) {
                problem = processSchemaException(e, node, pc);
            }
        } else {
            // No setter, we have to use collection getter
            propValues = new ArrayList<>(xlist.size());
            for (XNode xsubsubnode : xlist) {
                try {
                    Object valueToAdd;
                    Object value = unmarshalSinglePropValue(xsubsubnode, actualPropertyName, paramType,
                            storeAsRawType, beanClass, pc);
                    if (value != null) {
                        if (isHeteroListProperty) {
                            QName elementName = xsubsubnode.getElementName();
                            if (elementName == null) {
                                // TODO better error handling
                                throw new SchemaException(
                                        "Heterogeneous list with a no-elementName node: " + xsubsubnode);
                            }
                            Class valueClass = value.getClass();
                            QName jaxbElementName;
                            if (QNameUtil.hasNamespace(elementName)) {
                                jaxbElementName = elementName;
                            } else {
                                // Approximate solution: find element in schema registry - check for type compatibility
                                // in order to exclude accidental name matches (like c:expression/s:expression).
                                Optional<ItemDefinition> itemDefOpt = getSchemaRegistry()
                                        .findItemDefinitionsByElementName(elementName).stream()
                                        .filter(def -> getSchemaRegistry()
                                                .findTypeDefinitionsByType(def.getTypeName()).stream()
                                                .anyMatch(typeDef -> typeDef.getCompileTimeClass() != null
                                                        && typeDef.getCompileTimeClass()
                                                                .isAssignableFrom(valueClass)))
                                        .findFirst();
                                if (itemDefOpt.isPresent()) {
                                    jaxbElementName = itemDefOpt.get().getName();
                                } else {
                                    LOGGER.warn("Heterogeneous list member with unknown element name '"
                                            + elementName + "': " + value);
                                    jaxbElementName = elementName; // unqualified
                                }
                            }
                            @SuppressWarnings("unchecked")
                            JAXBElement jaxbElement = new JAXBElement<>(jaxbElementName, valueClass, value);
                            valueToAdd = jaxbElement;
                        } else {
                            if (wrapInJaxbElement) {
                                valueToAdd = wrapInJaxbElement(value, mechanism.objectFactory,
                                        mechanism.elementFactoryMethod, propName, beanClass, pc);
                            } else {
                                valueToAdd = value;
                            }
                        }
                        propValues.add(valueToAdd);
                    }
                } catch (SchemaException e) {
                    problem = processSchemaException(e, xsubsubnode, pc);
                }
            }
        }
    } else {
        try {
            propValue = unmarshalSinglePropValue(node, actualPropertyName, paramType, storeAsRawType, beanClass,
                    pc);
            if (wrapInJaxbElement) {
                propValue = wrapInJaxbElement(propValue, mechanism.objectFactory,
                        mechanism.elementFactoryMethod, propName, beanClass, pc);
            }
        } catch (SchemaException e) {
            problem = processSchemaException(e, node, pc);
        }
    }

    if (setter != null) {
        try {
            setter.invoke(bean, propValue);
        } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
            throw new SystemException(
                    "Cannot invoke setter " + setter + " on bean of type " + beanClass + ": " + e.getMessage(),
                    e);
        }
    } else if (getter != null) {
        Object getterReturn;
        Collection<Object> col;
        try {
            getterReturn = getter.invoke(bean);
        } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
            throw new SystemException(
                    "Cannot invoke getter " + getter + " on bean of type " + beanClass + ": " + e.getMessage(),
                    e);
        }
        try {
            col = (Collection<Object>) getterReturn;
        } catch (ClassCastException e) {
            throw new SystemException("Getter " + getter + " on bean of type " + beanClass + " returned "
                    + getterReturn + " instead of collection");
        }
        if (propValue != null) {
            col.add(propValue);
        } else if (propValues != null) {
            for (Object propVal : propValues) {
                col.add(propVal);
            }
        } else if (!problem) {
            throw new IllegalStateException("Strange. Multival property " + propName + " in " + beanClass
                    + " produced null values list, parsed from " + containingNode);
        }
        if (!isHeteroListProperty) {
            checkJaxbElementConsistence(col, pc);
        }
    } else {
        throw new IllegalStateException("Uh? No setter nor getter.");
    }
}