Package java.text

Examples of java.text.DateFormat


   public void validate(UIFormInput uiInput) throws Exception
   {
      if (uiInput.getValue() == null || ((String)uiInput.getValue()).trim().length() == 0)
         return;
      String s = (String)uiInput.getValue();
      DateFormat stFormat = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
      UIFormDateTimeInput uiDateInput = (UIFormDateTimeInput)uiInput;
      SimpleDateFormat sdf = new SimpleDateFormat(uiDateInput.getDatePattern_().trim());

      UIForm uiForm = ((UIComponent)uiInput).getAncestorOfType(UIForm.class);
      String label;
      try
      {
        label = uiForm.getId() + ".label." + uiInput.getName();
      }
      catch (Exception e)
      {
         label = uiInput.getName();
      }
      Object[] args = {label, s};

      try
      {
         // Specify whether or not date/time parsing is to be lenient.
         sdf.setLenient(false);
         Date stDate = sdf.parse(s);
         s = stFormat.format(stDate);
      }
      catch (Exception e)
      {
         throw new MessageException(new ApplicationMessage("DateTimeValidator.msg.Invalid-input", args));
      }
View Full Code Here


    else
    {
      message = record.getMessage();
    }
   
    DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM);
    logWriter.println(dateFormat.format(new java.util.Date()));
   
    if (record.getSourceClassName() != null)
    {
      logWriter.println(record.getSourceClassName());
    }
View Full Code Here

  protected Store reGetStoreImpl() {
    return store;
  }

  public void testPreviousDates() throws Exception {
    DateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmssSSS");
    ToyClock clock = new ToyClock();
    Store store = getStoreImpl(clock);
    String baseURLString = "http://localhost/";
    CannedDataReader.readCannedData(store, new File("testdata"),
        baseURLString);
    GraphOverTime got = store.getGraphOverTime(Collections
        .singleton((Source) new SourceImpl(baseURLString + "danbri")));
    // one milli after last modification
    Iterator<Date> previousChanges = got.previousChanges(dateFormat
        .parse("20060920123618662"));
    // should get last modification
    assertEquals(dateFormat.parse("20060920123618661"), previousChanges
        .next());
    // eralier one
    assertEquals(dateFormat.parse("19980920123600000"), previousChanges
        .next());
  }
View Full Code Here

        .next());
  }

  // 20061006 changed as interface spec changed
  public void testPreviousDates2() throws Exception {
    DateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmssSSS");
    ToyClock clock = new ToyClock();
    Store store = getStoreImpl(clock);
    String baseURLString = "http://localhost/";
    CannedDataReader.readCannedData(store, new File("testdata"),
        baseURLString);
    GraphOverTime got = store.getGraphOverTime(Collections
        .singleton((Source) new SourceImpl(baseURLString + "danbri")));
    Iterator<Date> previousChanges = got.previousChanges(dateFormat
        .parse("20060920123618661"));
    assertEquals(dateFormat.parse("20060920123618661"), previousChanges
        .next());
    assertEquals(dateFormat.parse("19980920123600000"), previousChanges
        .next());
  }
View Full Code Here

    assertEquals(dateFormat.parse("19980920123600000"), previousChanges
        .next());
  }

  public void testFollowingDates() throws Exception {
    DateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmssSSS");
    //ToyClock clock = new ToyClock();
    Store store = getStoreImpl(null);
    String baseURLString = "http://localhost/";
    CannedDataReader.readCannedData(store, new File("testdata"),
        baseURLString);
    GraphOverTime got = store.getGraphOverTime(Collections
        .singleton((Source) new SourceImpl(baseURLString + "danbri")));
    // one milli after last modification
    Iterator<Date> followingChanges = got.followingChanges(dateFormat
        .parse("19980920123559999"));
    // should get last modification
    assertEquals(dateFormat.parse("19980920123600000"), followingChanges
        .next());
    // eralier one
    Date nextDate = followingChanges.next();
    assertEquals(dateFormat.parse("20060920123618661"), nextDate);
  }
View Full Code Here

    Date nextDate = followingChanges.next();
    assertEquals(dateFormat.parse("20060920123618661"), nextDate);
  }

  public void testFollowingDates2() throws Exception {
    DateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmssSSS");
    //ToyClock clock = new ToyClock();
    Store store = getStoreImpl(new ToyClock());
    String baseURLString = "http://localhost/";
    CannedDataReader.readCannedData(store, new File("testdata"),
        baseURLString);
    GraphOverTime got = store.getGraphOverTime(Collections
        .singleton((Source) new SourceImpl(baseURLString + "danbri")));
    // one milli after last modification
    Iterator<Date> followingChanges = got.followingChanges(dateFormat
        .parse("19980920123600000"));
    Date nextDate = followingChanges.next();
    assertEquals(dateFormat.parse("20060920123618661"), nextDate);
  }
View Full Code Here

    Date nextDate = followingChanges.next();
    assertEquals(dateFormat.parse("20060920123618661"), nextDate);
  }
 
  public void notyettestGOTFilter() throws Exception {
    DateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmssSSS");
    //ToyClock clock = new ToyClock();
    Store store = getStoreImpl(new ToyClock());
    String baseURLString = "http://localhost/";
    CannedDataReader.readCannedData(store, new File("testdata"),
        baseURLString);
    GraphOverTime got = store.getGraphOverTime(Collections
        .singleton((Source) new SourceImpl(baseURLString + "danbri")));
    //filter by a resource present only in the older version
    got = got.filter(Collections.singleton((GroundedNode)new NamedNodeImpl("mailto:danbri@porklips.org")));
    // one milli after last modification
    Iterator<Date> followingChanges = got.followingChanges(dateFormat
        .parse("19980920123600000"));
    assertFalse(followingChanges.hasNext());
    Iterator<Date> previousChanges = got.previousChanges(dateFormat
        .parse("19980920123600000"));
    assertTrue(previousChanges.hasNext());
  }
View Full Code Here

  /*
   * a second addition of the identical graph, must not cause a new
   * modification date
   */
  public void testAddingTheSame() throws Exception {
    DateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
    ToyClock clock = new ToyClock();
    Store store = getStoreImpl(clock);
    Model model = modelWithStatements("_a dc:subject 'hello'; _a http://xmlns.com/foaf/0.1/mbox 'm'; _a http://xmlns.com/foaf/0.1/mbox 'n'");
    Date date1 = dateFormat.parse("20050607");
    Date date2 = dateFormat.parse("20060912");
    FCAGraph graph = new FCAGraphImpl(model);
    Source source = new SourceImpl("http://example.org/graph-source");
    clock.setTime(date1);
    store.updateGraph(source, graph);
    clock.setTime(date2);
    store.updateGraph(source, graph);;
    GraphOverTime got = store.getGraphOverTime(Collections
        .singleton(source));
    Iterator<Date> followingChanges = got.followingChanges(dateFormat
        .parse("20060101"));
    assertFalse(followingChanges.hasNext());
  }
View Full Code Here

        .parse("20060101"));
    assertFalse(followingChanges.hasNext());
  }
 
  public void testFGNodeMerging() throws Exception {
    DateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
    ToyClock clock = new ToyClock();
    Store store = getStoreImpl(clock);
    Model model1 = modelWithStatements("_a dc:subject 'hello'; _a http://xmlns.com/foaf/0.1/mbox_sha1sum '49f9f8e38c3144e19e09c3e5fa10170242d1360f'");
    Model model2 = modelWithStatements("_a dc:subject 'hullo'; _a http://xmlns.com/foaf/0.1/mbox_sha1sum '49f9f8e38c3144e19e09c3e5fa10170242d1360f'");

    Date date1 = dateFormat.parse("20050607");
    Date date2 = dateFormat.parse("20060912");
    FCAGraph graph1 = new FCAGraphImpl(model1);
    FCAGraph graph2 = new FCAGraphImpl(model2);
    Source source = new SourceImpl("http://example.org/graph-source");
    clock.setTime(date1);
    store.updateGraph(source, graph1);
    store = reGetStoreImpl();
    source = new SourceImpl("http://example.org/graph-source");
    clock.setTime(date2);
    store.assertGraph(source, graph2);
    FCAGraph graphR  = store.getGraphOverTime(Collections.singleton(source)).getGraph(dateFormat.parse("20060913"));
    JenaUtil.getModelFromGraph(graphR).write(System.out);
  }
View Full Code Here

    JenaUtil.getModelFromGraph(graphR).write(System.out);
  }
 
  //FIX BaseStoreImp revokegraph
  public void notYetTestPartialFGNodeRevoke() throws Exception {
    DateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
    ToyClock clock = new ToyClock();
    Store store = getStoreImpl(clock);
    Model model1 = modelWithStatements("_a dc:subject 'hello'; _a http://xmlns.com/foaf/0.1/mbox \"foo\"; _a http://xmlns.com/foaf/0.1/mbox_sha1sum '49f9f8e38c3144e19e09c3e5fa10170242d1360f'");
    Model model2 = modelWithStatements("_a dc:subject 'hello'; _a http://xmlns.com/foaf/0.1/mbox_sha1sum '49f9f8e38c3144e19e09c3e5fa10170242d1360f'");

    Date date1 = dateFormat.parse("20050607");
    Date date2 = dateFormat.parse("20060912");
    FCAGraph graph1 = new FCAGraphImpl(model1);
    FCAGraph graph2 = new FCAGraphImpl(model2);
    Source source = new SourceImpl("http://example.org/graph-source");
    clock.setTime(date1);
    store.updateGraph(source, graph1);
    store = reGetStoreImpl();
    clock.setTime(date2);
    store.revokeGraph(source, graph2);
    FCAGraph graphR  = store.getGraphOverTime(Collections.singleton(source)).getGraph(dateFormat.parse("20060913"));
    JenaUtil.getModelFromGraph(graphR).write(System.out);
  }
View Full Code Here

TOP

Related Classes of java.text.DateFormat

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.