Example usage for javax.xml.bind JAXBElement getDeclaredType

List of usage examples for javax.xml.bind JAXBElement getDeclaredType

Introduction

In this page you can find the example usage for javax.xml.bind JAXBElement getDeclaredType.

Prototype

public Class<T> getDeclaredType() 

Source Link

Document

Returns the Java binding of the xml element declaration's type attribute.

Usage

From source file:org.wallerlab.yoink.molecular.service.translator.MolecularSystemTranslator.java

private List<Atom> parseAtoms(org.xml_cml.schema.Molecule cmlMolecule) {
    List<Atom> atoms = new ArrayList<Atom>();
    for (Object elementAtomArray : cmlMolecule.getAnyCmlOrAnyOrAny()) {
        @SuppressWarnings("unchecked")
        JAXBElement<AtomArray> element = (JAXBElement<AtomArray>) elementAtomArray;
        if (element.getDeclaredType() == AtomArray.class) {
            @SuppressWarnings("unchecked")
            AtomArray cmlAtomArray = ((JAXBElement<AtomArray>) elementAtomArray).getValue();
            loopOverAtoms(atoms, cmlAtomArray);
        }/*  ww  w  .j  a  v a 2s. co  m*/
    }
    return atoms;
}

From source file:org.wallerlab.yoink.service.PropertyWrapper.java

private void loopOverAllMolecules(Job<JAXBElement> job, Object elementList) {
    List<Molecule> molecules = job.getMolecularSystem().getMolecules();
    MoleculeList cmlMoleculeList = ((JAXBElement<MoleculeList>) elementList).getValue();
    int moleculeCounter = 0;
    for (Object elementMolecule : cmlMoleculeList.getAnyCmlOrAnyOrAny()) {
        JAXBElement element = (JAXBElement) elementMolecule;
        // check molecule
        if (element.getDeclaredType() == org.xml_cml.schema.Molecule.class) {
            org.xml_cml.schema.Molecule cmlMolecule = ((JAXBElement<org.xml_cml.schema.Molecule>) element)
                    .getValue();/*from w w  w .  jav a2s .  c o m*/
            cmlMolecule.setId(molecules.get(moleculeCounter).getName().toString());
            moleculeCounter++;
        }
    }
}

From source file:org.wallerlab.yoink.molecular.service.translator.MolecularSystemTranslator.java

private void loopOverAtoms(List<Atom> atoms, AtomArray cmlAtomArray) {
    for (Object elementAtom : cmlAtomArray.getAnyCmlOrAnyOrAny()) {
        @SuppressWarnings("unchecked")
        JAXBElement<org.xml_cml.schema.Atom> element = (JAXBElement<org.xml_cml.schema.Atom>) elementAtom;
        if (element.getDeclaredType() == org.xml_cml.schema.Atom.class) {
            org.xml_cml.schema.Atom cmlAtom = (org.xml_cml.schema.Atom) element.getValue();
            parseAtom(atoms, cmlAtom);/*w w  w  .j  a va 2s .  c om*/
        }
    }
}

From source file:org.wallerlab.yoink.molecular.service.translator.MolecularSystemTranslator.java

private void loopOverElementsInCmlMoleculeList(MoleculeList cmlMoleculeList) {
    // loopOverCMlMoleculelist
    for (Object elementMolecule : cmlMoleculeList.getAnyCmlOrAnyOrAny()) {
        @SuppressWarnings("unchecked")
        JAXBElement<org.xml_cml.schema.Molecule> element = (JAXBElement<org.xml_cml.schema.Molecule>) elementMolecule;
        // check molecule
        if (element.getDeclaredType() == org.xml_cml.schema.Molecule.class) {
            org.xml_cml.schema.Molecule cmlMolecule = ((JAXBElement<org.xml_cml.schema.Molecule>) element)
                    .getValue();//w w  w .j ava 2 s  . c o m
            parseMolecule(cmlMolecule);
        }
    }
}

From source file:it.govpay.ejb.ndp.util.wsclient.NodoPerPa.java

private void dump(JAXBElement<?> jaxb) {
    StringBuffer content = new StringBuffer();
    content.append("Messaggio di " + jaxb.getDeclaredType());
    dump(content, jaxb);// w ww  .  j  a  va 2s  .c  om
}

From source file:it.govpay.ejb.ndp.util.wsclient.NodoPerPa.java

private void dump(IntestazioneCarrelloPPT intestazione, JAXBElement<?> jaxb) {
    StringBuffer content = new StringBuffer();
    content.append("Messaggio di " + jaxb.getDeclaredType());
    content.append("\n\tidentificativoIntermediarioPA" + intestazione.getIdentificativoIntermediarioPA());
    content.append("\n\tidentificativoStazioneIntermediarioPA"
            + intestazione.getIdentificativoStazioneIntermediarioPA());
    content.append("\n\tidentificativoUnivocoVersamento" + intestazione.getIdentificativoCarrello());
}

From source file:it.govpay.ejb.ndp.util.wsclient.NodoPerPa.java

private void dump(IntestazionePPT intestazione, JAXBElement<?> jaxb) {
    StringBuffer content = new StringBuffer();
    content.append("Messaggio di " + jaxb.getDeclaredType());
    content.append("\n\tidentificativoDominio: " + intestazione.getIdentificativoDominio());
    content.append("\n\tidentificativoUnivocoVersamento: " + intestazione.getIdentificativoUnivocoVersamento());
    content.append("\n\tcodiceContestoPagamento: " + intestazione.getCodiceContestoPagamento());
    content.append("\n\tidentificativoIntermediarioPA: " + intestazione.getIdentificativoIntermediarioPA());
    content.append("\n\tidentificativoStazioneIntermediarioPA: "
            + intestazione.getIdentificativoStazioneIntermediarioPA());
}

From source file:de.extra.client.plugins.responseprocessplugin.filesystem.FileSystemResultPackageDataResponseProcessPlugin.java

/**
 * /*from w ww  . ja  v  a2  s . c  o m*/
 * @param packagePlugIns
 * @return element Name aus der PackagePlugIns.DataSource mit dem Type File,
 *         wenn Element nicht vorhanden ist, wird null zurckgeliefert
 */
private String extractIncomingFileNameFromDataSource(final AnyPlugInContainerType packagePlugIns) {
    String fileName = null;
    if (packagePlugIns != null) {
        final List<Object> plugins = packagePlugIns.getAny();
        for (final Object plugin : plugins) {

            final JAXBElement<?> jaxbElement = (JAXBElement<?>) plugin;

            if (DataSource.class.isAssignableFrom(jaxbElement.getDeclaredType())) {
                final DataSource dataSource = DataSource.class.cast(jaxbElement.getValue());
                final DataContainerType dataContainer = dataSource.getDataContainer();
                // Strikte Validierung. Element DataSource ohne
                // DataContainer
                // ist in diesem Scenario nicht vereinbart
                Assert.notNull(dataContainer, "DataContainer from ElementDataSource is null");
                if (DataContainerCode.FILE.equals(dataContainer.getType())) {
                    if (fileName == null) {
                        fileName = dataContainer.getName();
                    } else {
                        throw new ExtraResponseProcessPluginRuntimeException(
                                ExceptionCode.EXTRA_ILLEGAL_ACCESS_EXCEPTION,
                                "Multiple DataContainer for DataSource found");
                    }
                }
            }
        }
    }
    return fileName;
}

From source file:com.catify.processengine.core.EntityInitialization.java

/**
 * Creates a sub process. //from w  w w .  j  a v  a 2s  .  com
 * <p>
 * Can be called recursively to create nested sub processes.
 *
 * @param clientId the client id
 * @param processJaxb the process jaxb
 * @param subProcessesJaxb the sub processes jaxb
 * @param parentNodeRunning the parent node
 * @param runningPath true, if working the running process path, false if working on the archive process path
 */
private void createSubProcessNodes(String clientId, TProcess processJaxb,
        ArrayList<TSubProcess> subProcessesJaxb, FlowNode parentNodeRunning, FlowNode parentNodeArchive) {

    List<TFlowNode> flowNodesJaxb = new ArrayList<TFlowNode>();
    List<TSequenceFlow> sequenceFlowsJaxb = new ArrayList<TSequenceFlow>();

    // only check the (currently) last iteration of the list sub processes
    if (subProcessesJaxb.size() > 0) {
        TSubProcess subProcessJaxb = subProcessesJaxb.get(subProcessesJaxb.size() - 1);

        for (JAXBElement<? extends TFlowElement> flowElementJaxb : subProcessJaxb.getFlowElement()) {

            if (flowElementJaxb.getDeclaredType().equals(TSequenceFlow.class)) {
                sequenceFlowsJaxb.add((TSequenceFlow) flowElementJaxb.getValue());
            } else if (flowElementJaxb.getValue() instanceof TFlowNode) {
                flowNodesJaxb.add((TFlowNode) flowElementJaxb.getValue());
            }
        }

        // create the flow nodes that belong to this sub process
        this.createFlowNodes(clientId, processJaxb, subProcessesJaxb, flowNodesJaxb, sequenceFlowsJaxb,
                parentNodeRunning, parentNodeArchive);
    }

}

From source file:com.catify.processengine.core.EntityInitialization.java

/**
 * Initialize neo4j data beans.//from  w w w .j  av a  2s .  c  om
 *
 * @param clientId the client id
 * @param processJaxb the process object generated by jaxb
 */
@Transactional
public synchronized void initializeProcess(String clientId, TProcess processJaxb) {

    List<TFlowNode> flowNodesJaxb = new ArrayList<TFlowNode>();
    List<TSequenceFlow> sequenceFlowsJaxb = new ArrayList<TSequenceFlow>();

    // iterate through process elements and separate flow nodes and
    // sequenceFlows (because they need to be activated after each other)
    for (JAXBElement<? extends TFlowElement> flowElementJaxb : processJaxb.getFlowElement()) {

        LOG.debug(String.format("Instantiating %s:%s as a neo4j data node",
                flowElementJaxb.getDeclaredType().getSimpleName(), flowElementJaxb.getValue().getId()));

        if (flowElementJaxb.getDeclaredType().equals(TSequenceFlow.class)) {
            sequenceFlowsJaxb.add((TSequenceFlow) flowElementJaxb.getValue());
        } else if (flowElementJaxb.getValue() instanceof TFlowNode) {
            flowNodesJaxb.add((TFlowNode) flowElementJaxb.getValue());
        }
    }

    // Save the process to the neo4j db or retrieve it if it already exists
    this.createEntities(clientId, processJaxb, flowNodesJaxb, sequenceFlowsJaxb);
}