Examples of XBELDocument


Examples of org.openbel.bel.xbel.model.XBELDocument

        final File testFile = new File(testxml);
        if (!testFile.canRead())
            fail("can't read " + testxml);

        try {
            XBELDocument d = xvc.unmarshal(testFile);
            assertNotNull(d);
        } catch (JAXBException e) {
            String err = "JAXB exception unmarshalling " + testxml;
            err += ", exception message follows:\n\t";
            err += e.getMessage();
View Full Code Here

Examples of org.openbel.bel.xbel.model.XBELDocument

    /**
     * {@inheritDoc}
     */
    @Override
    public String toXML(final Document d) throws JAXBException, IOException {
        XBELDocument xdoc = new DocumentConverter().convert(d);
        return converter.marshal(xdoc);
    }
View Full Code Here

Examples of org.openbel.bel.xbel.model.XBELDocument

    /**
     * {@inheritDoc}
     */
    @Override
    public Document toCommon(final String s) throws JAXBException, IOException {
        XBELDocument xdoc = toJAXB(s);
        return convert(xdoc);
    }
View Full Code Here

Examples of org.openbel.bel.xbel.model.XBELDocument

    /**
     * {@inheritDoc}
     */
    @Override
    public Document toCommon(final File f) throws JAXBException, IOException {
        XBELDocument xdoc = toJAXB(f);
        return convert(xdoc);
    }
View Full Code Here

Examples of org.openbel.bel.xbel.model.XBELDocument

     */
    @Override
    public XBELDocument convert(Document source) {
        if (source == null) return null;

        XBELDocument xd = new XBELDocument();

        List<StatementGroup> stmtGroups = source.getStatementGroups();
        List<XBELStatementGroup> xstmtGroups = xd.getStatementGroup();
        StatementGroupConverter sgConverter = new StatementGroupConverter();
        for (final StatementGroup sg : stmtGroups) {
            // Defer to StatementGroupConverter
            xstmtGroups.add(sgConverter.convert(sg));
        }

        List<AnnotationDefinition> definitions = source.getDefinitions();
        if (hasItems(definitions)) {
            XBELAnnotationDefinitionGroup xadGroup =
                    new XBELAnnotationDefinitionGroup();
            List<XBELInternalAnnotationDefinition> internals =
                    xadGroup.getInternalAnnotationDefinition();
            List<XBELExternalAnnotationDefinition> externals =
                    xadGroup.getExternalAnnotationDefinition();

            InternalAnnotationDefinitionConverter iConverter =
                    new InternalAnnotationDefinitionConverter();
            ExternalAnnotationDefinitionConverter eConverter =
                    new ExternalAnnotationDefinitionConverter();

            for (final AnnotationDefinition ad : definitions) {

                XBELInternalAnnotationDefinition iad = iConverter.convert(ad);
                if (iad != null) {
                    internals.add(iad);
                    continue;
                }

                XBELExternalAnnotationDefinition ead = eConverter.convert(ad);
                if (ead != null) {
                    externals.add(ead);
                }
            }
            xd.setAnnotationDefinitionGroup(xadGroup);
        }

        Header header = source.getHeader();
        HeaderConverter hConverter = new HeaderConverter();
        // Defer to HeaderConverter
        xd.setHeader(hConverter.convert(header));

        NamespaceGroup nsGroup = source.getNamespaceGroup();
        if (nsGroup != null) {
            NamespaceGroupConverter ngConverter = new NamespaceGroupConverter();
            // Defer to NamespaceGroupConverter
            xd.setNamespaceGroup(ngConverter.convert(nsGroup));
        }

        return xd;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.