Package org.apache.ctakes.jdl.data.xml

Examples of org.apache.ctakes.jdl.data.xml.Validation


  /**
   * Execute the loader of the data into the database.
   */
  public void execute() {
    Validation validation = new Validation(SchemaUtil.urlToSchema(XSD),
        srcConn);
    if (validation.succeed()) {
      validation.setDocument(srcLoad);
      if (validation.succeed()) {
        JdlConnection jdlConnection = null;
        try {
          JdbcType jdbc = ObjectFactoryUtil
              .getJdbcTypeBySrcXml(srcConn);
          LoadType load = ObjectFactoryUtil
              .getLoadTypeBySrcXml(srcLoad);
          jdlConnection = new JdlConnection(jdbc);
          CsvLoadType csv = load.getCsv();
          if (csv != null) {
            try {
              CsvLoader csvLoader = new CsvLoader(csv, new File(
                  srcData));
              csvLoader.dataInsert(jdlConnection);
            } catch (FileNotFoundException e) {
              throw new RuntimeException(e);
            }
          }
          XmlLoadType xml = load.getXml();
          if (xml != null) {
            XmlLoader xPathParsing = new XmlLoader(xml,
                DomUtil.srcToDocument(srcData));
            xPathParsing.dataInsert(jdlConnection);
          }
        } catch (JAXBException e) {
          e.printStackTrace();
        } finally {
          try {
            if (jdlConnection != null)
              jdlConnection.closeConnection();
          } catch (SQLException e) {
            log.error("closing connection", e);
          }
        }
      } else {
        System.err.println(validation.getError());
      }
    } else {
      System.err.println(validation.getError());
    }
  }
View Full Code Here


  public static String L2X = Resources.LOAD2X;

  @BeforeClass
  public static void initClass() {
    Schema schema = SchemaUtil.urlToSchema(XSD);
    validation = new Validation(schema);
  }
View Full Code Here

TOP

Related Classes of org.apache.ctakes.jdl.data.xml.Validation

Copyright © 2018 www.massapicom. 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.