Examples of DatatypeFactory


Examples of javax.xml.datatype.DatatypeFactory

        }
    }

    private void performTestNewXMLGregorianCalendar(StandardTypesServiceClient serviceClient)
        throws DatatypeConfigurationException {
        DatatypeFactory df = DatatypeFactory.newInstance();
        XMLGregorianCalendar[] xgcals = new XMLGregorianCalendar[3];
        xgcals[0] = df.newXMLGregorianCalendar(new GregorianCalendar(1974, GregorianCalendar.APRIL, 19));
        xgcals[1] = df.newXMLGregorianCalendar(new GregorianCalendar(1978, GregorianCalendar.OCTOBER, 13));
        xgcals[2] = df.newXMLGregorianCalendar(new GregorianCalendar(2006, GregorianCalendar.JUNE, 16));

        for (int i = 0; i < xgcals.length; ++i) {
            XMLGregorianCalendar actual = serviceClient.getNewXMLGregorianCalendarForward(xgcals[i]);
            xgcals[i].setDay(xgcals[i].getDay() + 5);
            Assert.assertEquals(xgcals[i], actual);
View Full Code Here

Examples of javax.xml.datatype.DatatypeFactory

        }
    }

    private void performTestNewXMLGregorianCalendarArray(StandardTypesServiceClient serviceClient)
        throws DatatypeConfigurationException {
        DatatypeFactory df = DatatypeFactory.newInstance();
        XMLGregorianCalendar[] xgcals = new XMLGregorianCalendar[3];
        xgcals[0] = df.newXMLGregorianCalendar(new GregorianCalendar(1974, GregorianCalendar.APRIL, 19));
        xgcals[1] = df.newXMLGregorianCalendar(new GregorianCalendar(1978, GregorianCalendar.OCTOBER, 13));
        xgcals[2] = df.newXMLGregorianCalendar(new GregorianCalendar(2006, GregorianCalendar.JUNE, 16));

        XMLGregorianCalendar[] actual = serviceClient.getNewXMLGregorianCalendarArrayForward(xgcals);
        Assert.assertEquals(xgcals.length, actual.length);
        for (int i = 0; i < xgcals.length; ++i) {
            xgcals[i].setDay(xgcals[i].getDay() + 5);
View Full Code Here

Examples of javax.xml.datatype.DatatypeFactory

            Assert.assertEquals(xgcals[i], actual[i]);
        }
    }

    private void performTestNewDuration(StandardTypesServiceClient serviceClient) throws DatatypeConfigurationException {
        DatatypeFactory df = DatatypeFactory.newInstance();
        Duration[] da = new Duration[3];
        da[0] = df.newDuration(1000000000000L);
        da[1] = df.newDurationDayTime(1000000000000L);
        da[2] = df.newDurationYearMonth(true, 1, 3);

        for (int i = 0; i < da.length; ++i) {
            Assert.assertEquals(da[i].negate(), serviceClient.getNewDurationForward(da[i]));
        }
    }
View Full Code Here

Examples of javax.xml.datatype.DatatypeFactory

        }
    }

    private void performTestNewDurationArray(StandardTypesServiceClient serviceClient)
        throws DatatypeConfigurationException {
        DatatypeFactory df = DatatypeFactory.newInstance();
        Duration[] da = new Duration[3];
        da[0] = df.newDuration(1000000000000L);
        da[1] = df.newDurationDayTime(1000000000000L);
        da[2] = df.newDurationYearMonth(true, 1, 3);

        Duration[] actual = serviceClient.getNewDurationArrayForward(da);
        Assert.assertEquals(da.length, actual.length);
        for (int i = 0; i < da.length; ++i) {
            Assert.assertEquals(da[i].negate(), actual[i]);
View Full Code Here

Examples of javax.xml.datatype.DatatypeFactory

      if (userExpiration.getTimeInMillis() < expirationDate.getTimeInMillis())
        expirationDate.setTimeInMillis(userExpiration.getTimeInMillis());
    }

    try {
      DatatypeFactory df = DatatypeFactory.newInstance();
      apiSubscription.setExpiresAfter(df.newXMLGregorianCalendar(expirationDate));
    }
    catch(DatatypeConfigurationException ce) {
      throw new FatalErrorException(new ErrorMessage("errors.Unspecified"));
    }
   
View Full Code Here

Examples of javax.xml.datatype.DatatypeFactory

    public static List<XMLGregorianCalendar> convertCalendar(List<GregorianCalendar> calendar) {
        if (calendar == null) {
            return null;
        }

        DatatypeFactory df;
        try {
            df = DatatypeFactory.newInstance();
        } catch (DatatypeConfigurationException e) {
            throw new CmisRuntimeException("Convert exception: " + e.getMessage(), e);
        }

        List<XMLGregorianCalendar> result = new ArrayList<XMLGregorianCalendar>();
        for (GregorianCalendar cal : calendar) {
            result.add(df.newXMLGregorianCalendar(cal));
        }

        return result;
    }
View Full Code Here

Examples of javax.xml.datatype.DatatypeFactory

    public static XMLGregorianCalendar convertCalendar(GregorianCalendar calendar) {
        if (calendar == null) {
            return null;
        }

        DatatypeFactory df;
        try {
            df = DatatypeFactory.newInstance();
        } catch (DatatypeConfigurationException e) {
            throw new CmisRuntimeException("Convert exception: " + e.getMessage(), e);
        }

        return df.newXMLGregorianCalendar(calendar);
    }
View Full Code Here

Examples of javax.xml.datatype.DatatypeFactory

   private static XMLGregorianCalendar getXMLGregorianCalendar(GregorianCalendar gregorianCalendar)
   {
      try
      {
         DatatypeFactory dtf = DatatypeFactory.newInstance();
         return dtf.newXMLGregorianCalendar(gregorianCalendar);
      }
      catch (DatatypeConfigurationException e)
      {
         throw new RuntimeException(e);
      }
View Full Code Here

Examples of javax.xml.datatype.DatatypeFactory

    }

    private static XMLGregorianCalendar getCalendar() {
        GregorianCalendar calendar = new GregorianCalendar();
        calendar.setTimeInMillis(1234567);
        DatatypeFactory datatypeFactory;
        try {
            datatypeFactory = DatatypeFactory.newInstance();
        } catch (DatatypeConfigurationException e) {
            throw new RuntimeException(e);
        }
        XMLGregorianCalendar xmlGregCal = datatypeFactory.newXMLGregorianCalendar(calendar);
        return xmlGregCal;
    }
View Full Code Here

Examples of javax.xml.datatype.DatatypeFactory

      }
      // update editing-duration info.
      long editingDuration = calendar.getTimeInMillis() - documentOpeningTime;
      editingDuration = (editingDuration < 1) ? 1 : editingDuration;
      try {
        DatatypeFactory aFactory = DatatypeFactory.newInstance();
        metaData.setEditingDuration(new Duration(aFactory.newDurationDayTime(editingDuration)));
      } catch (DatatypeConfigurationException e) {
        Logger.getLogger(Document.class.getName()).log(Level.SEVERE,
            "editing duration update fail as DatatypeFactory can not be instanced", e);
      }
    }
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.