@Test public void testParseDate() throws DatatypeConfigurationException { Date date = Fedora3StreamsDiscStructure.disectCreateDate("2012-11-29T13:06:53.331Z"); Calendar cal = Calendar.getInstance(); cal.setTime(date); Assert.assertTrue(cal.get(Calendar.YEAR) == 2012); Assert.assertTrue(cal.get(Calendar.MONTH) == 10); Assert.assertTrue(cal.get(Calendar.DAY_OF_MONTH) == 29); Assert.assertTrue(cal.get(Calendar.HOUR_OF_DAY) == 13); Assert.assertTrue(cal.get(Calendar.MINUTE) == 6); }
public static Date disectCreateDate(String data) throws DatatypeConfigurationException { XMLGregorianCalendar gregorianCalendar = DatatypeFactory.newInstance().newXMLGregorianCalendar(data); int year = gregorianCalendar.getYear(); int day = gregorianCalendar.getDay(); int month = gregorianCalendar.getMonth(); int minute = gregorianCalendar.getMinute(); int hour = gregorianCalendar.getHour(); Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.YEAR, year); calendar.set(Calendar.DAY_OF_MONTH, day); calendar.set(Calendar.MINUTE, minute); calendar.set(Calendar.HOUR_OF_DAY, hour); calendar.set(Calendar.MONTH, month-1); return calendar.getTime(); }
Fedora3StreamsDiscStructure implements DiscStrucutreForStore { public static Date disectCreateDate(String data) throws DatatypeConfigurationException { XMLGregorianCalendar gregorianCalendar = DatatypeFactory.newInstance().newXMLGregorianCalendar(data); int year = gregorianCalendar.getYear(); int day = gregorianCalendar.getDay(); int month = gregorianCalendar.getMonth(); int minute = gregorianCalendar.getMinute(); int hour = gregorianCalendar.getHour(); Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.YEAR, year); calendar.set(Calendar.DAY_OF_MONTH, day); calendar.set(Calendar.MINUTE, minute); calendar.set(Calendar.HOUR_OF_DAY, hour); calendar.set(Calendar.MONTH, month-1); return calendar.getTime(); } }
Fedora3StreamsDiscStructure implements DiscStrucutreForStore { public static Date disectCreateDate(String data) throws DatatypeConfigurationException { XMLGregorianCalendar gregorianCalendar = DatatypeFactory.newInstance().newXMLGregorianCalendar(data); int year = gregorianCalendar.getYear(); int day = gregorianCalendar.getDay(); int month = gregorianCalendar.getMonth(); int minute = gregorianCalendar.getMinute(); int hour = gregorianCalendar.getHour(); Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.YEAR, year); calendar.set(Calendar.DAY_OF_MONTH, day); calendar.set(Calendar.MINUTE, minute); calendar.set(Calendar.HOUR_OF_DAY, hour); calendar.set(Calendar.MONTH, month-1); return calendar.getTime(); } @Inject  Fedora3StreamsDiscStructure(@Named("securedFedoraAccess") FedoraAccess fedoraAccess); }
Fedora3StreamsDiscStructure implements DiscStrucutreForStore { public static Date disectCreateDate(String data) throws DatatypeConfigurationException { XMLGregorianCalendar gregorianCalendar = DatatypeFactory.newInstance().newXMLGregorianCalendar(data); int year = gregorianCalendar.getYear(); int day = gregorianCalendar.getDay(); int month = gregorianCalendar.getMonth(); int minute = gregorianCalendar.getMinute(); int hour = gregorianCalendar.getHour(); Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.YEAR, year); calendar.set(Calendar.DAY_OF_MONTH, day); calendar.set(Calendar.MINUTE, minute); calendar.set(Calendar.HOUR_OF_DAY, hour); calendar.set(Calendar.MONTH, month-1); return calendar.getTime(); } @Inject  Fedora3StreamsDiscStructure(@Named("securedFedoraAccess") FedoraAccess fedoraAccess); @Override Path getUUIDFile(String uuid,  String rootPath); static Date disectCreateDate(String data); }
Fedora3StreamsDiscStructure implements DiscStrucutreForStore { public static Date disectCreateDate(String data) throws DatatypeConfigurationException { XMLGregorianCalendar gregorianCalendar = DatatypeFactory.newInstance().newXMLGregorianCalendar(data); int year = gregorianCalendar.getYear(); int day = gregorianCalendar.getDay(); int month = gregorianCalendar.getMonth(); int minute = gregorianCalendar.getMinute(); int hour = gregorianCalendar.getHour(); Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.YEAR, year); calendar.set(Calendar.DAY_OF_MONTH, day); calendar.set(Calendar.MINUTE, minute); calendar.set(Calendar.HOUR_OF_DAY, hour); calendar.set(Calendar.MONTH, month-1); return calendar.getTime(); } @Inject  Fedora3StreamsDiscStructure(@Named("securedFedoraAccess") FedoraAccess fedoraAccess); @Override Path getUUIDFile(String uuid,  String rootPath); static Date disectCreateDate(String data);  }