Clover coverage report - Maven Clover report
Coverage timestamp: Tue Sep 16 2008 01:16:37 EEST
file stats: LOC: 90   Methods: 2
NCLOC: 47   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
NodeTopEntity.java 0% 0% 0% 0%
coverage
 1    /*
 2    wsmo4j - a WSMO API and Reference Implementation
 3   
 4    Copyright (c) 2004-2005, OntoText Lab. / SIRMA
 5   
 6    This library is free software; you can redistribute it and/or modify it under
 7    the terms of the GNU Lesser General Public License as published by the Free
 8    Software Foundation; either version 2.1 of the License, or (at your option)
 9    any later version.
 10    This library is distributed in the hope that it will be useful, but WITHOUT
 11    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 12    FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 13    details.
 14    You should have received a copy of the GNU Lesser General Public License along
 15    with this library; if not, write to the Free Software Foundation, Inc.,
 16    59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 17    */
 18    package com.ontotext.wsmo4j.parser.xml;
 19   
 20    import org.w3c.dom.*;
 21    import org.wsmo.common.*;
 22    import org.wsmo.common.Entity;
 23    import org.wsmo.common.exception.*;
 24   
 25    import com.ontotext.wsmo4j.serializer.xml.*;
 26   
 27    /**
 28    * <p>Title: WSMO4J</p>
 29    * <p>Description: WSMO API and a Reference Implementation</p>
 30    * <p>Copyright: Copyright (c) 2004-2005</p>
 31    * <p>Company: OntoText Lab. / SIRMA </p>
 32    * @author not attributable
 33    * @version 1.0
 34    *
 35    */
 36    public class NodeTopEntity {
 37   
 38  0 static void processTopEntityNode(TopEntity te, Node xmlNode, WsmlXmlParser parser)
 39    throws InvalidModelException {
 40  0 if (te == null || xmlNode == null || parser == null
 41    || xmlNode.getNodeType() != Element.ELEMENT_NODE) {
 42  0 throw new IllegalArgumentException();
 43    }
 44   
 45  0 NodeList nodes = xmlNode.getChildNodes();
 46  0 for (int i = 0; i < nodes.getLength(); i++) {
 47  0 Node node = nodes.item(i);
 48  0 if (node.getNodeName() == "importsOntology") {
 49  0 te.addOntology(parser.getFactory().createOntology(
 50    parser.getFactory().createIRI(WsmlXmlHelper.getElementText(node))));
 51    }
 52  0 else if (node.getNodeName() == "usesMediator") {
 53  0 IRI iri = parser.getFactory().createIRI(WsmlXmlHelper.getElementText(node));
 54  0 te.addMediator(iri);
 55    }
 56    }
 57    }
 58   
 59  0 static void serializeTopEntity(Element parent, TopEntity te, WsmlXmlSerializer serializer) {
 60  0 if (!te.listOntologies().isEmpty()) {
 61  0 Object[] entities = te.listOntologies().toArray();
 62  0 for (int i = 0; i < entities.length; i++) {
 63  0 Element importOnto = serializer.createElement("importsOntology");
 64  0 parent.appendChild(importOnto);
 65  0 importOnto.appendChild(serializer.createTextNode(((Entity) entities[i])
 66    .getIdentifier().toString()));
 67    }
 68    }
 69   
 70  0 if (!te.listMediators().isEmpty()) {
 71  0 Object[] entities = te.listMediators().toArray();
 72  0 for (int i = 0; i < entities.length; i++) {
 73  0 Element useMediator = serializer.createElement("usesMediator");
 74  0 parent.appendChild(useMediator);
 75  0 useMediator.appendChild(serializer.createTextNode(((Identifier) entities[i])
 76    .toString()));
 77    }
 78    }
 79    }
 80    }
 81   
 82    /*
 83    * $Log$
 84    * Revision 1.2 2006/04/05 13:25:26 vassil_momtchev
 85    * usesMediator now refer mediators by IRI instead of handle to object
 86    *
 87    * Revision 1.1 2006/03/29 11:20:51 vassil_momtchev
 88    * mediator support added; some code refactored; minor bugs fixed
 89    *
 90    */