Package com.socrata.datasync.deltaimporter2

Examples of com.socrata.datasync.deltaimporter2.Version


     * @param ver HL7 version
     * @return package path of the version
     * @throws HL7Exception if the HL7 version is unknown
   */
  public static String getVersionPackagePath(String ver) throws HL7Exception {
    Version v = Version.versionOf(ver);
      if (v == null) {
          throw new HL7Exception("The HL7 version " + ver + " is unknown", ErrorCode.UNSUPPORTED_VERSION_ID);
      }
      String pkg = v.modelPackageName();
      return pkg.replace('.', '/');
  }
View Full Code Here


        version = getVersion(message);
      } catch (Exception e) { /* use the default */
      }

      if (version == null) {
        Version availableVersion = Version.highestAvailableVersionOrDefault();
        version = availableVersion.getVersion();
      }

      Segment msh = Parser.makeControlMSH(version, getFactory());
      Terser.set(msh, 1, 0, 1, 1, String.valueOf(fieldSep));
      Terser.set(msh, 2, 0, 1, 1, encChars);
View Full Code Here

  private Message instantiateACK() throws HL7Exception {
    ModelClassFactory mcf = getParser() != null ?
        getParser().getFactory() :
        new DefaultModelClassFactory();
    Version version = Version.versionOf(getVersion());
    Message out = null;
    if (version != null && version.available()) {
      Class<? extends Message> clazz = mcf.getMessageClass("ACK", version.getVersion(), false);
      if (clazz != null) {
          out = ReflectionUtil.instantiateMessage(clazz, mcf);
      }
    }
    if (out == null) {
View Full Code Here

    Terser.set(mshOut, 7, 0, 1, 1, CommonTS.toHl7TSFormat(now));
    Terser.set(mshOut, 9, 0, 1, 1, "ACK");
    Terser.set(mshOut, 9, 0, 2, 1, Terser.get(mshIn, 9, 0, 2, 1));
    String v = mshOut.getMessage().getVersion();
    if (v != null) {
      Version version = Version.versionOf(v);
      if (version != null && !Version.V25.isGreaterThan(version)) {
        Terser.set(mshOut, 9, 0, 3, 1, "ACK");
      }
    }
    Terser.set(mshOut, 10, 0, 1, 1, mshIn.getMessage().getParser().getParserConfiguration().getIdGenerator().getID());
View Full Code Here

        Terser.set(msh, 12, 0, 1, 1, getVersion());
       
        // Add structure information if version is 2.4 or better
        if (!Version.V24.isGreaterThan(Version.versionOf(getVersion()))) {
          if (this instanceof SuperStructure) {
            Version version = Version.versionOf(getVersion());
            Map<String, String> eventMap = new DefaultModelClassFactory().getEventMapForVersion(version);
            if (StringUtil.isNotBlank(messageCode) && StringUtil.isNotBlank(messageTriggerEvent)) {
              String structure = eventMap.get(messageCode + "_" + messageTriggerEvent);
              Terser.set(msh, 9, 0, 3, 1, structure);
            }           
View Full Code Here

   @Test
    public void testDeserializationReturnIds() throws IOException {

        String typicalBlobJson = "{\"blobId\":\"xxxx-xxxx\"}";
        BlobId id1 = mapper.readValue(typicalBlobJson, BlobId.class);
        TestCase.assertEquals("xxxx-xxxx", id1.blobId);

        String typicalJobJson = "{\"jobId\":\"yyyyyy\"}";
        JobId id2 = mapper.readValue(typicalJobJson, JobId.class);
        TestCase.assertEquals("yyyyyy", id2.jobId);

        String emptyJson = "{}";
        BlobId id3 = mapper.readValue(emptyJson, BlobId.class);
        JobId id4 = mapper.readValue(emptyJson, JobId.class);
        TestCase.assertNull(id3.blobId);
        TestCase.assertNull(id4.jobId);

        String extraStuffJson = "{\"blobId\":\"some-4by4\", \"junk\":0}";
        BlobId id5 = mapper.readValue(extraStuffJson, BlobId.class);
        TestCase.assertEquals("some-4by4", id5.blobId);
    }
View Full Code Here

    @Test
    public void testSerializationFullCommitMessage() throws IOException {
        FileTypeControl ftc = new FileTypeControl().floatingTimestampFormat(new String[]{"ISO8601"});
        ControlFile cf = new ControlFile("Replace", null, ftc, null);
        CommitMessage commit = new CommitMessage()
                .filename("hoo-ya.csv")
                .relativeTo("datasync/id/some-4by4/completed/2014/6/2/hoo-ya.csv")
                .chunks(Arrays.asList("1234", "2345"))
                .control(cf)
                .expectedSize(11001001L);
View Full Code Here

        TestCase.assertEquals(expectedJson, mapper.writeValueAsString(commit));
    }

    @Test
    public void testSerializationIncompleteCommitMessage() throws IOException {
        CommitMessage commit = new CommitMessage()
                .filename("hoo-ya.csv")
                .chunks(Arrays.asList("1234", "2345"));
        String expectedJson = "{" +
                "\"chunks\":[\"1234\",\"2345\"]," +
                "\"filename\":\"hoo-ya.csv\"," +
View Full Code Here

    DatasyncDirectory dd;

    @Before
    public void setUp() throws Exception {
        http = new HttpUtility(getUserPrefs(), false);
        dd = new DatasyncDirectory(http, "test.socrata.com", "some-4by4");
    }
View Full Code Here

        String typicalBlobJson = "{\"blobId\":\"xxxx-xxxx\"}";
        BlobId id1 = mapper.readValue(typicalBlobJson, BlobId.class);
        TestCase.assertEquals("xxxx-xxxx", id1.blobId);

        String typicalJobJson = "{\"jobId\":\"yyyyyy\"}";
        JobId id2 = mapper.readValue(typicalJobJson, JobId.class);
        TestCase.assertEquals("yyyyyy", id2.jobId);

        String emptyJson = "{}";
        BlobId id3 = mapper.readValue(emptyJson, BlobId.class);
        JobId id4 = mapper.readValue(emptyJson, JobId.class);
        TestCase.assertNull(id3.blobId);
        TestCase.assertNull(id4.jobId);

        String extraStuffJson = "{\"blobId\":\"some-4by4\", \"junk\":0}";
        BlobId id5 = mapper.readValue(extraStuffJson, BlobId.class);
View Full Code Here

TOP

Related Classes of com.socrata.datasync.deltaimporter2.Version

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.