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.nortal.jroad.typegen.xmlbeans.XteeSchemaCodePrinter.java

static String prettyQName(QName qname) {
    String result = qname.getLocalPart();
    if (qname.getNamespaceURI() != null)
        result += "(@" + qname.getNamespaceURI() + ")";
    return result;
}

From source file:com.evolveum.midpoint.web.component.wizard.resource.SchemaHandlingStep.java

private String formatItemInfo(ResourceItemDefinitionType item, ItemPathType ref, String displayName,
        List<MappingType> inbounds, MappingType outbound) {
    StringBuilder sb = new StringBuilder();
    if (ref != null && !ref.getItemPath().isEmpty()) {
        QName name = ItemPathUtil.getOnlySegmentQNameRobust(ref);
        if (name != null) {
            String prefix = SchemaConstants.NS_ICF_SCHEMA.equals(name.getNamespaceURI()) ? "icfs" : "ri";
            sb.append(prefix);/*from  ww  w.j  a v a 2  s  .  c o  m*/
            sb.append(": ");
            sb.append(name.getLocalPart());
        }
    } else {
        sb.append("-");
    }
    String duplicateInfo = getDuplicateInfo(item);
    if (duplicateInfo != null) {
        sb.append(" (").append(duplicateInfo).append(")");
    }
    if (displayName != null) {
        sb.append(" (").append(displayName).append(")");
    }
    if (!inbounds.isEmpty()) {
        sb.append(" | ");
        sb.append(getString("SchemaHandlingStep.in", ""));
        boolean first = true;
        for (MappingType inbound : inbounds) {
            if (inbound != null && inbound.getTarget() != null) {
                if (first)
                    first = false;
                else
                    sb.append(", ");
                sb.append(formatPath(inbound.getTarget().getPath()));
            }
        }
    }
    if (outbound != null) {
        sb.append(" | ").append(getString("SchemaHandlingStep.out")).append(": ");
        boolean first = true;
        for (VariableBindingDefinitionType source : outbound.getSource()) {
            if (source != null) {
                if (first)
                    first = false;
                else
                    sb.append(", ");
                sb.append(formatPath(source.getPath()));
            }
        }
    }
    return sb.toString();
}

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

public <C extends Containerable> PrismContainerDefinition<C> findContainerDefinitionByType(QName typeName) {
    if (StringUtils.isEmpty(typeName.getNamespaceURI())) {
        // Maybe not optimal but sufficient way: we resolve complex type definition, and from it we get qualified type name.
        // This is then used to find container definition in the traditional way.
        ComplexTypeDefinition complexTypeDefinition = resolveGlobalTypeDefinitionWithoutNamespace(
                typeName.getLocalPart());
        if (complexTypeDefinition == null) {
            return null;
        }/*from   w w  w . j a  v  a  2s. c  o  m*/
        typeName = complexTypeDefinition.getTypeName();
    }
    PrismSchema schema = findSchemaByNamespace(typeName.getNamespaceURI());
    if (schema == null) {
        return null;
    }
    return schema.findContainerDefinitionByType(typeName);
}

From source file:net.morphbank.mbsvc3.xml.XmlBaseObject.java

public Date getFirstTagDateValue(String tagName) {
    Iterator<Object> tags = getAny().iterator();
    while (tags.hasNext()) {
        JAXBElement obj = (JAXBElement) tags.next();
        QName qname = obj.getName();
        if (qname.getLocalPart().equals(tagName)) {
            Object value = obj.getValue();
            if (value instanceof Date) {
                return (Date) value;
            }//from www  . j  a  va2  s .  c o m
        }
    }
    return null;
}

From source file:net.morphbank.mbsvc3.xml.XmlBaseObject.java

public JAXBElement getFirstTag(String tagName) {
    Iterator<Object> tags = getAny().iterator();
    while (tags.hasNext()) {
        JAXBElement obj = (JAXBElement) tags.next();
        QName qname = obj.getName();
        String localPart = qname.getLocalPart();
        if (localPart.equals(tagName)) {
            return obj;
        }/*w  w  w.  j a  va 2 s. co  m*/
    }
    return null;
}

From source file:com.evolveum.midpoint.prism.parser.PrismBeanConverter.java

private <T, S> void unmarshallToAny(T bean, Method getter, QName elementName, XNode xsubnode)
        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 = unmarshall(xsubSubNode, subBeanClass);
            unmarshallToAnyValue(bean, beanClass, subBean, objectFactoryClass, objectFactory,
                    elementFactoryMethod, getter);
        }/*from w  w  w  .  j  a  v a 2 s .  co m*/
    } else {
        S subBean = unmarshall(xsubnode, subBeanClass);
        unmarshallToAnyValue(bean, beanClass, subBean, objectFactoryClass, objectFactory, elementFactoryMethod,
                getter);
    }

}

From source file:com.evolveum.midpoint.prism.parser.PrismBeanConverter.java

public <T> T unmarshall(MapXNode xnode, Class<T> beanClass) throws SchemaException {

    if (PolyStringType.class.equals(beanClass)) {
        PolyString polyString = unmarshalPolyString(xnode);
        return (T) polyString; // violates the method interface but ... TODO fix it
    } else if (ProtectedStringType.class.equals(beanClass)) {
        ProtectedStringType protectedType = new ProtectedStringType();
        XNodeProcessorUtil.parseProtectedType(protectedType, xnode, prismContext);
        return (T) protectedType;
    } else if (ProtectedByteArrayType.class.equals(beanClass)) {
        ProtectedByteArrayType protectedType = new ProtectedByteArrayType();
        XNodeProcessorUtil.parseProtectedType(protectedType, xnode, prismContext);
        return (T) protectedType;
    } else if (SchemaDefinitionType.class.equals(beanClass)) {
        SchemaDefinitionType schemaDefType = unmarshalSchemaDefinitionType(xnode);
        return (T) schemaDefType;
    } else if (prismContext.getSchemaRegistry().determineDefinitionFromClass(beanClass) != null) {
        return (T) prismContext.getXnodeProcessor().parseObject(xnode).asObjectable();
    } else if (XmlAsStringType.class.equals(beanClass)) {
        // reading a string represented a XML-style content
        // used e.g. when reading report templates (embedded XML)
        // A necessary condition: there may be only one map entry.
        if (xnode.size() > 1) {
            throw new SchemaException("Map with more than one item cannot be parsed as a string: " + xnode);
        } else if (xnode.isEmpty()) {
            return (T) new XmlAsStringType();
        } else {/*from   www . ja v  a  2  s  .com*/
            Map.Entry<QName, XNode> entry = xnode.entrySet().iterator().next();
            DomParser domParser = prismContext.getParserDom();
            String value = domParser.serializeToString(entry.getValue(), entry.getKey());
            return (T) new XmlAsStringType(value);
        }
    }
    T bean;
    Set<String> keysToParse; // only these keys will be parsed (null if all)
    if (SearchFilterType.class.isAssignableFrom(beanClass)) {
        keysToParse = Collections.singleton("condition"); // TODO fix this BRUTAL HACK - it is here because of c:ConditionalSearchFilterType
        bean = (T) unmarshalSearchFilterType(xnode, (Class<? extends SearchFilterType>) beanClass);
    } else {
        keysToParse = null;
        try {
            bean = beanClass.newInstance();
        } catch (InstantiationException e) {
            throw new SystemException("Cannot instantiate bean of type " + beanClass + ": " + e.getMessage(),
                    e);
        } catch (IllegalAccessException e) {
            throw new SystemException("Cannot instantiate bean of type " + beanClass + ": " + e.getMessage(),
                    e);
        }
    }

    if (ProtectedDataType.class.isAssignableFrom(beanClass)) {
        ProtectedDataType protectedDataType = null;
        if (bean instanceof ProtectedStringType) {
            protectedDataType = new ProtectedStringType();
        } else if (bean instanceof ProtectedByteArrayType) {
            protectedDataType = new ProtectedByteArrayType();
        } else {
            throw new SchemaException("Unexpected subtype of protected data type: " + bean.getClass());
        }
        XNodeProcessorUtil.parseProtectedType(protectedDataType, xnode, prismContext);
        return (T) protectedDataType;
    }

    for (Entry<QName, XNode> entry : xnode.entrySet()) {
        QName key = entry.getKey();
        if (keysToParse != null && !keysToParse.contains(key.getLocalPart())) {
            continue;
        }
        XNode xsubnode = entry.getValue();
        String propName = key.getLocalPart();
        Field field = inspector.findPropertyField(beanClass, propName);
        Method propertyGetter = null;
        if (field == null) {
            propertyGetter = inspector.findPropertyGetter(beanClass, propName);
        }

        Method elementMethod = null;
        Object objectFactory = null;
        if (field == null && propertyGetter == null) {
            // We have to try to find a more generic field, such as xsd:any or substitution element
            // check for global element definition first
            Class objectFactoryClass = inspector.getObjectFactoryClass(beanClass.getPackage());
            objectFactory = instantiateObjectFactory(objectFactoryClass);
            elementMethod = inspector.findElementMethodInObjectFactory(objectFactoryClass, propName);
            if (elementMethod == null) {
                // Check for "any" method
                elementMethod = inspector.findAnyMethod(beanClass);
                if (elementMethod == null) {
                    String m = "No field " + propName + " in class " + beanClass
                            + " (and no element method in object factory too)";
                    if (mode == XNodeProcessorEvaluationMode.COMPAT) {
                        LOGGER.warn("{}", m);
                        continue;
                    } else {
                        throw new SchemaException(m);
                    }
                }
                unmarshallToAny(bean, elementMethod, key, xsubnode);
                continue;

            }
            field = inspector.lookupSubstitution(beanClass, elementMethod);
            if (field == null) {
                // Check for "any" field
                field = inspector.findAnyField(beanClass);
                if (field == null) {
                    elementMethod = inspector.findAnyMethod(beanClass);
                    if (elementMethod == null) {
                        String m = "No field " + propName + " in class " + beanClass
                                + " (and no element method in object factory too)";
                        if (mode == XNodeProcessorEvaluationMode.COMPAT) {
                            LOGGER.warn("{}", m);
                            continue;
                        } else {
                            throw new SchemaException(m);
                        }
                    }
                    unmarshallToAny(bean, elementMethod, key, xsubnode);
                    continue;
                    //                  throw new SchemaException("No field "+propName+" in class "+beanClass+" (no suitable substitution and no 'any' field)");
                }
                unmarshallToAny(bean, field, key, xsubnode);
                continue;
            }
        }

        boolean storeAsRawType;
        if (elementMethod != null) {
            storeAsRawType = elementMethod.getAnnotation(Raw.class) != null;
        } else if (propertyGetter != null) {
            storeAsRawType = propertyGetter.getAnnotation(Raw.class) != null;
        } else {
            storeAsRawType = field.getAnnotation(Raw.class) != null;
        }

        String fieldName;
        if (field != null) {
            fieldName = field.getName();
        } else {
            fieldName = propName;
        }

        Method setter = inspector.findSetter(beanClass, fieldName);
        Method getter = null;
        boolean wrapInJaxbElement = false;
        Class<?> paramType = null;
        if (setter == null) {
            // No setter. But if the property is multi-value we need to look
            // for a getter that returns a collection (Collection<Whatever>)
            getter = inspector.findPropertyGetter(beanClass, fieldName);
            if (getter == null) {
                String m = "Cannot find setter or getter for field " + fieldName + " in " + beanClass;
                if (mode == XNodeProcessorEvaluationMode.COMPAT) {
                    LOGGER.warn("{}", m);
                    continue;
                } else {
                    throw new SchemaException(m);
                }
            }
            Class<?> getterReturnType = getter.getReturnType();
            if (!Collection.class.isAssignableFrom(getterReturnType)) {
                throw new SchemaException("Cannot find getter for field " + fieldName + " in " + beanClass
                        + " does not return collection, cannot use it to set value");
            }
            Type genericReturnType = getter.getGenericReturnType();
            Type typeArgument = getTypeArgument(genericReturnType,
                    "for field " + fieldName + " in " + beanClass + ", cannot determine collection type");
            //         System.out.println("type argument " + typeArgument);
            if (typeArgument instanceof Class) {
                paramType = (Class<?>) typeArgument;
            } else if (typeArgument instanceof ParameterizedType) {
                ParameterizedType paramTypeArgument = (ParameterizedType) typeArgument;
                Type rawTypeArgument = paramTypeArgument.getRawType();
                if (rawTypeArgument.equals(JAXBElement.class)) {
                    // This is the case of Collection<JAXBElement<....>>
                    wrapInJaxbElement = true;
                    Type innerTypeArgument = getTypeArgument(typeArgument, "for field " + fieldName + " in "
                            + beanClass + ", cannot determine collection type (inner type argument)");
                    if (innerTypeArgument instanceof Class) {
                        // This is the case of Collection<JAXBElement<Whatever>>
                        paramType = (Class<?>) innerTypeArgument;
                    } else if (innerTypeArgument instanceof WildcardType) {
                        // This is the case of Collection<JAXBElement<?>>
                        // we need to exctract the specific type from the factory method
                        if (elementMethod == null) {
                            // TODO: TEMPORARY CODE!!!!!!!!!! fix in 3.1 [med]
                            Class objectFactoryClass = inspector.getObjectFactoryClass(beanClass.getPackage());
                            objectFactory = instantiateObjectFactory(objectFactoryClass);
                            elementMethod = inspector.findElementMethodInObjectFactory(objectFactoryClass,
                                    propName);
                            if (elementMethod == null) {
                                throw new IllegalArgumentException(
                                        "Wildcard type in JAXBElement field specification and no factory method found for field "
                                                + fieldName + " in " + beanClass
                                                + ", cannot determine collection type (inner type argument)");
                            }
                        }
                        Type factoryMethodGenericReturnType = elementMethod.getGenericReturnType();
                        Type factoryMethodTypeArgument = getTypeArgument(factoryMethodGenericReturnType,
                                "in factory method " + elementMethod + " return type for field " + fieldName
                                        + " in " + beanClass + ", cannot determine collection type");
                        if (factoryMethodTypeArgument instanceof Class) {
                            // This is the case of JAXBElement<Whatever>
                            paramType = (Class<?>) factoryMethodTypeArgument;
                            if (Object.class.equals(paramType) && !storeAsRawType) {
                                throw new IllegalArgumentException("Factory method " + elementMethod
                                        + " type argument is Object (and not @Raw) for field " + fieldName
                                        + " in " + beanClass + ", property " + propName);
                            }
                        } else {
                            throw new IllegalArgumentException(
                                    "Cannot determine factory method return type, got "
                                            + factoryMethodTypeArgument + " - for field " + fieldName + " in "
                                            + beanClass
                                            + ", cannot determine collection type (inner type argument)");
                        }
                    } else {
                        throw new IllegalArgumentException("Ejha! " + innerTypeArgument + " "
                                + innerTypeArgument.getClass() + " from " + getterReturnType + " from "
                                + fieldName + " in " + propName + " " + beanClass);
                    }
                } else {
                    // The case of Collection<Whatever<Something>>
                    if (rawTypeArgument instanceof Class) {
                        paramType = (Class<?>) rawTypeArgument;
                    } else {
                        throw new IllegalArgumentException("EH? Eh!? " + typeArgument + " "
                                + typeArgument.getClass() + " from " + getterReturnType + " from " + fieldName
                                + " in " + propName + " " + beanClass);
                    }
                }
            } else {
                throw new IllegalArgumentException(
                        "EH? " + typeArgument + " " + typeArgument.getClass() + " from " + getterReturnType
                                + " from " + fieldName + " in " + propName + " " + beanClass);
            }
        } else {
            Class<?> setterType = setter.getParameterTypes()[0];
            if (JAXBElement.class.equals(setterType)) {
                //               TODO some handling for the returned generic parameter types
                Type[] genericTypes = setter.getGenericParameterTypes();
                if (genericTypes.length != 1) {
                    throw new IllegalArgumentException("Too lazy to handle this.");
                }
                Type genericType = genericTypes[0];
                if (genericType instanceof ParameterizedType) {
                    Type actualType = getTypeArgument(genericType, "add some description");
                    if (actualType instanceof WildcardType) {
                        if (elementMethod == null) {
                            Class objectFactoryClass = inspector.getObjectFactoryClass(beanClass.getPackage());
                            objectFactory = instantiateObjectFactory(objectFactoryClass);
                            elementMethod = inspector.findElementMethodInObjectFactory(objectFactoryClass,
                                    propName);
                        }
                        // This is the case of Collection<JAXBElement<?>>
                        // we need to exctract the specific type from the factory method
                        if (elementMethod == null) {
                            throw new IllegalArgumentException(
                                    "Wildcard type in JAXBElement field specification and no facotry method found for field "
                                            + fieldName + " in " + beanClass
                                            + ", cannot determine collection type (inner type argument)");
                        }
                        Type factoryMethodGenericReturnType = elementMethod.getGenericReturnType();
                        Type factoryMethodTypeArgument = getTypeArgument(factoryMethodGenericReturnType,
                                "in factory method " + elementMethod + " return type for field " + fieldName
                                        + " in " + beanClass + ", cannot determine collection type");
                        if (factoryMethodTypeArgument instanceof Class) {
                            // This is the case of JAXBElement<Whatever>
                            paramType = (Class<?>) factoryMethodTypeArgument;
                            if (Object.class.equals(paramType) && !storeAsRawType) {
                                throw new IllegalArgumentException("Factory method " + elementMethod
                                        + " type argument is Object (without @Raw) for field " + fieldName
                                        + " in " + beanClass + ", property " + propName);
                            }
                        } else {
                            throw new IllegalArgumentException(
                                    "Cannot determine factory method return type, got "
                                            + factoryMethodTypeArgument + " - for field " + fieldName + " in "
                                            + beanClass
                                            + ", cannot determine collection type (inner type argument)");
                        }
                    }
                }
                //               Class enclosing = paramType.getEnclosingClass();
                //               Class clazz = paramType.getClass();
                //               Class declaring = paramType.getDeclaringClass();
                wrapInJaxbElement = true;
            } else {
                paramType = setterType;
            }
        }

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

        //check for subclasses???
        if (!storeAsRawType && xsubnode.getTypeQName() != null) {
            Class explicitParamType = getSchemaRegistry().determineCompileTimeClass(xsubnode.getTypeQName());
            if (explicitParamType == null) {
                explicitParamType = XsdTypeMapper.toJavaTypeIfKnown(xsubnode.getTypeQName());
            }

            if (explicitParamType != null) {
                paramType = explicitParamType;
            }
        }

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

        String paramNamespace = inspector.determineNamespace(paramType);

        boolean problem = false;
        Object propValue = null;
        Collection<Object> propValues = null;
        if (xsubnode instanceof ListXNode) {
            ListXNode xlist = (ListXNode) xsubnode;
            if (setter != null) {
                try {
                    propValue = convertSinglePropValue(xsubnode, fieldName, paramType, storeAsRawType,
                            beanClass, paramNamespace);
                } catch (SchemaException e) {
                    problem = processSchemaException(e, xsubnode);
                }
            } else {
                // No setter, we have to use collection getter
                propValues = new ArrayList<>(xlist.size());
                for (XNode xsubsubnode : xlist) {
                    try {
                        propValues.add(convertSinglePropValue(xsubsubnode, fieldName, paramType, storeAsRawType,
                                beanClass, paramNamespace));
                    } catch (SchemaException e) {
                        problem = processSchemaException(e, xsubsubnode);
                    }
                }
            }
        } else {
            try {
                propValue = convertSinglePropValue(xsubnode, fieldName, paramType, storeAsRawType, beanClass,
                        paramNamespace);
            } catch (SchemaException e) {
                problem = processSchemaException(e, xsubnode);
            }
        }

        if (setter != null) {
            try {
                setter.invoke(bean, prepareValueToBeStored(propValue, wrapInJaxbElement, objectFactory,
                        elementMethod, propName, beanClass));
            } 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(prepareValueToBeStored(propValue, wrapInJaxbElement, objectFactory, elementMethod,
                        propName, beanClass));
            } else if (propValues != null) {
                for (Object propVal : propValues) {
                    col.add(prepareValueToBeStored(propVal, wrapInJaxbElement, objectFactory, elementMethod,
                            propName, beanClass));
                }
            } else if (!problem) {
                throw new IllegalStateException("Strange. Multival property " + propName + " in " + beanClass
                        + " produced null values list, parsed from " + xnode);
            }
            checkJaxbElementConsistence(col);
        } else {
            throw new IllegalStateException("Uh? No setter nor getter.");
        }
    }

    if (prismContext != null && bean instanceof Revivable) {
        ((Revivable) bean).revive(prismContext);
    }

    return bean;
}

From source file:com.evolveum.midpoint.prism.parser.XNodeProcessor.java

private void parsePrismReferenceValueFromXNode(PrismReference ref, XNode subnode,
        PrismReferenceDefinition referenceDefinition, QName itemName) throws SchemaException {
    /*//from   w  w  w . j  a  va2  s .  co  m
     *  We distinguish between "real" references and composite objects by
     *  (1) looking at type QName of XNode passed (whether it's ObjectType or ObjectReferenceType)
     *  (2) comparing itemName and name from reference definition - e.g. linkRef vs. link
     */
    boolean isComposite;
    if (subnode.getTypeQName() != null) {
        QName typeName = subnode.getTypeQName();
        if (prismContext != null) {
            ItemDefinition definition = prismContext.getSchemaRegistry().findItemDefinitionByType(typeName);
            isComposite = definition instanceof PrismObjectDefinition;
        } else {
            isComposite = PrismConstants.REFERENCE_TYPE_NAME.equals(typeName.getLocalPart());
        }
    } else {
        isComposite = !QNameUtil.match(itemName, referenceDefinition.getName());
    }

    if (isComposite) {
        // This is a composite object (complete object stored inside
        // reference)
        ref.add(parseReferenceAsCompositeObject(subnode, referenceDefinition));
    } else {
        // This is "real" reference (oid type and nothing more)
        ref.add(parseReferenceValue(subnode, referenceDefinition));
    }
}

From source file:iristk.flow.FlowCompiler.java

private Map<String, String> getParameters(Map<QName, String> attributes, List<Object> content, Object parent)
        throws FlowCompilerException {
    Map<String, String> result = new HashMap<String, String>();
    for (QName attr : attributes.keySet()) {
        if (attr.getNamespaceURI() != null && attr.getNamespaceURI().equals("http://www.w3.org/2000/xmlns/"))
            continue;
        String name = attr.getLocalPart();
        String value = formatAttrExpr(attributes.get(attr));
        result.put(name, value);/*  ww w .  ja va2  s. c  om*/
    }
    if (content.size() > 0) {
        ListMap<String, String> paramList = new ListMap<>();
        for (Object child : content) {
            if (child instanceof Element) {
                Element elem = (Element) child;
                if (elem.getNamespaceURI().equals("iristk.flow.param")) {
                    String key = elem.getLocalName();
                    List<Object> paramChildren = new ArrayList<Object>();
                    for (int j = 0; j < elem.getChildNodes().getLength(); j++) {
                        paramChildren.add(elem.getChildNodes().item(j));
                    }
                    String text = createExpression(paramChildren, elem);
                    paramList.add(key, text);
                }
            }
        }
        if (paramList.size() == 0) {
            paramList.add("text", createExpression(content, parent));
        }
        for (String key : paramList.keySet()) {
            if (paramList.get(key).size() > 1) {
                result.put(key, "java.util.Arrays.asList(" + listToString(paramList.get(key)) + ")");
            } else {
                result.put(key, paramList.get(key).get(0));
            }
        }
    }
    return result;
}

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

@Override
public <T> Class<T> determineCompileTimeClass(QName typeName) {
    if (QNameUtil.noNamespace(typeName)) {
        TypeDefinition td = resolveGlobalTypeDefinitionWithoutNamespace(typeName.getLocalPart(),
                TypeDefinition.class);
        if (td == null) {
            return null;
        }/*from   w  w w .  ja  va 2s  . co  m*/
        return (Class<T>) td.getCompileTimeClass();
    }
    SchemaDescription desc = findSchemaDescriptionByNamespace(typeName.getNamespaceURI());
    if (desc == null) {
        return null;
    }
    Package pkg = desc.getCompileTimeClassesPackage();
    if (pkg == null) {
        return null;
    }
    return JAXBUtil.findClassForType(typeName, pkg);
}