List of usage examples for org.joda.time DateTime getMinuteOfHour
public int getMinuteOfHour()
From source file:com.cronutils.model.time.ExecutionTime.java
License:Apache License
/** * If date is not match, will return previous closest match. * If date is match, will return this date. * @param date - reference DateTime instance - never null; * @return DateTime instance, never null. Value obeys logic specified above. * @throws NoSuchValueException//from w w w .j a v a 2 s . co m */ DateTime previousClosestMatch(DateTime date) throws NoSuchValueException { List<Integer> year = yearsValueGenerator.generateCandidates(date.getYear(), date.getYear()); TimeNode days = generateDays(cronDefinition, date); int highestMonth = months.getValues().get(months.getValues().size() - 1); int highestDay = days.getValues().get(days.getValues().size() - 1); int highestHour = hours.getValues().get(hours.getValues().size() - 1); int highestMinute = minutes.getValues().get(minutes.getValues().size() - 1); int highestSecond = seconds.getValues().get(seconds.getValues().size() - 1); NearestValue nearestValue; DateTime newDate; if (year.isEmpty()) { int previousYear = yearsValueGenerator.generatePreviousValue(date.getYear()); if (highestDay > 28) { int highestDayOfMonth = new DateTime(previousYear, highestMonth, 1, 0, 0).dayOfMonth() .getMaximumValue(); if (highestDay > highestDayOfMonth) { nearestValue = days.getPreviousValue(highestDay, 1); if (nearestValue.getShifts() > 0) { newDate = new DateTime(previousYear, highestMonth, 1, 23, 59, 59) .minusMonths(nearestValue.getShifts()).dayOfMonth().withMaximumValue(); return previousClosestMatch(newDate); } else { highestDay = nearestValue.getValue(); } } } return initDateTime(previousYear, highestMonth, highestDay, highestHour, highestMinute, highestSecond, date.getZone()); } if (!months.getValues().contains(date.getMonthOfYear())) { nearestValue = months.getPreviousValue(date.getMonthOfYear(), 0); int previousMonths = nearestValue.getValue(); if (nearestValue.getShifts() > 0) { newDate = new DateTime(date.getYear(), 12, 31, 23, 59, 59).minusYears(nearestValue.getShifts()); return previousClosestMatch(newDate); } return initDateTime(date.getYear(), previousMonths, highestDay, highestHour, highestMinute, highestSecond, date.getZone()); } if (!days.getValues().contains(date.getDayOfMonth())) { nearestValue = days.getPreviousValue(date.getDayOfMonth(), 0); if (nearestValue.getShifts() > 0) { newDate = new DateTime(date.getYear(), date.getMonthOfYear(), 1, 23, 59, 59) .minusMonths(nearestValue.getShifts()).dayOfMonth().withMaximumValue(); return previousClosestMatch(newDate); } return initDateTime(date.getYear(), date.getMonthOfYear(), nearestValue.getValue(), highestHour, highestMinute, highestSecond, date.getZone()); } if (!hours.getValues().contains(date.getHourOfDay())) { nearestValue = hours.getPreviousValue(date.getHourOfDay(), 0); if (nearestValue.getShifts() > 0) { newDate = new DateTime(date.getYear(), date.getMonthOfYear(), date.getDayOfMonth(), 23, 59, 59) .minusDays(nearestValue.getShifts()); return previousClosestMatch(newDate); } return initDateTime(date.getYear(), date.getMonthOfYear(), date.getDayOfMonth(), nearestValue.getValue(), highestMinute, highestSecond, date.getZone()); } if (!minutes.getValues().contains(date.getMinuteOfHour())) { nearestValue = minutes.getPreviousValue(date.getMinuteOfHour(), 0); if (nearestValue.getShifts() > 0) { newDate = new DateTime(date.getYear(), date.getMonthOfYear(), date.getDayOfMonth(), date.getHourOfDay(), 59, 59).minusHours(nearestValue.getShifts()); return previousClosestMatch(newDate); } return initDateTime(date.getYear(), date.getMonthOfYear(), date.getDayOfMonth(), date.getHourOfDay(), nearestValue.getValue(), highestSecond, date.getZone()); } if (!seconds.getValues().contains(date.getSecondOfMinute())) { nearestValue = seconds.getPreviousValue(date.getSecondOfMinute(), 0); int previousSeconds = nearestValue.getValue(); if (nearestValue.getShifts() > 0) { newDate = new DateTime(date.getYear(), date.getMonthOfYear(), date.getDayOfMonth(), date.getHourOfDay(), date.getMinuteOfHour(), 59).minusMinutes(nearestValue.getShifts()); return previousClosestMatch(newDate); } return initDateTime(date.getYear(), date.getMonthOfYear(), date.getDayOfMonth(), date.getHourOfDay(), date.getMinuteOfHour(), previousSeconds, date.getZone()); } return date; }
From source file:com.ecofactor.qa.automation.util.DateUtil.java
License:Open Source License
/** * Convert time to utc calendar.//from ww w. ja va2s .com * @param date the date * @return the calendar */ public static Calendar convertTimeToUTCCalendar(DateTime date) { Calendar utcCalendar = getUTCCalendar(); StringBuilder startDate = new StringBuilder(); startDate.append(utcCalendar.get(Calendar.YEAR)).append("-").append(utcCalendar.get(Calendar.MONTH) + 1) .append("-").append(utcCalendar.get(Calendar.DATE)).toString(); int hours = date.getHourOfDay(); int mins = date.getMinuteOfHour(); int secs = date.getSecondOfMinute(); startDate.append(" " + hours + ":" + mins + ":" + secs); Calendar changedCalendar = parseToUTCCalendar(startDate.toString(), DATE_FMT); System.out.println(changedCalendar); return changedCalendar; }
From source file:com.ephesoft.dcma.nsi.NsiExporter.java
License:Open Source License
private void transformXmlAndExportFiles(String batchInstanceID, String exportFolder, String xmlTagStyle, boolean isZipSwitchOn, String baseDocsFolder, InputStream xslStream) throws TransformerFactoryConfigurationError, DCMAApplicationException { String batchXmlName = batchInstanceID + ICommonConstants.UNDERSCORE_BATCH_XML; String sourceXMLPath = baseDocsFolder + File.separator + batchInstanceID + ICommonConstants.UNDERSCORE_BATCH_XML; String targetXmlPath = exportFolder + File.separator + batchInstanceID + xmlTagStyle; LOGGER.debug("Transforming XML " + sourceXMLPath + " to " + targetXmlPath); try {/*from w ww . j a va 2 s . c o m*/ TransformerFactory tFactory = TransformerFactory.newInstance(); Transformer transformer = null; try { // NOTE, this needs to be fixed to use the InputStream xslStream object, not a hardcoded path to the file. transformer = tFactory.newTransformer(new StreamSource(xslStream)); } finally { if (xslStream != null) { try { xslStream.close(); } catch (IOException e) { LOGGER.info("Error closing input stream for :" + xslResource.toString()); } } } if (transformer != null) { DateTimeZone zone = DateTimeZone.forID(NSIExportConstant.TIME_ZONE_ID); DateTime dateTime = new DateTime(zone); String date = Integer.toString(dateTime.getYear()) + NSIExportConstant.HYPEN + Integer.toString(dateTime.getMonthOfYear()) + NSIExportConstant.HYPEN + Integer.toString(dateTime.getDayOfMonth()); String time = Integer.toString(dateTime.getHourOfDay()) + NSIExportConstant.COLON + Integer.toString(dateTime.getMinuteOfHour()) + NSIExportConstant.COLON + Integer.toString(dateTime.getSecondOfMinute()); transformer.setParameter(NSIExportConstant.DATE, date); transformer.setParameter(NSIExportConstant.HOURS, time); transformer.setParameter(NSIExportConstant.BASE_DOC_FOLDER_PATH, baseDocsFolder + File.separator); transformer.setParameter(NSIExportConstant.EXPORT_FOLDER_PATH, exportFolder + File.separator); File file = new File(exportFolder); boolean isFileCreated = false; if (!file.exists()) { isFileCreated = file.mkdir(); } else { isFileCreated = true; } if (isFileCreated) { String imageFolderPath = exportFolder + File.separator + NSIExportConstant.IMAGE_FOLDER_NAME; File imageFolder = new File(imageFolderPath); boolean isImageFolderCreated = false; if (!imageFolder.exists()) { isImageFolderCreated = imageFolder.mkdir(); } else { isImageFolderCreated = true; } if (isImageFolderCreated) { LOGGER.info(exportFolder + " folder created"); Batch batch = batchSchemaService.getBatch(batchInstanceID); List<Document> documentList = batch.getDocuments().getDocument(); transformXML(isZipSwitchOn, batchXmlName, sourceXMLPath, targetXmlPath, transformer); File baseDocFolder = new File(baseDocsFolder); for (Document document : documentList) { if (document != null && document.getMultiPageTiffFile() != null && !document.getMultiPageTiffFile().isEmpty()) { String multipageTiffName = document.getMultiPageTiffFile(); String filePath = baseDocFolder.getAbsolutePath() + File.separator + multipageTiffName; String exportFileName = multipageTiffName.replace( NSIExportConstant.TIF_WITH_DOT_EXTENSION, NSIExportConstant.DAT_WITH_DOT_EXTENSION); String exportFilePath = imageFolderPath + File.separator + exportFileName; File oldFile = new File(filePath); File newFile = new File(exportFilePath); try { FileUtils.copyFile(oldFile, newFile); } catch (Exception e) { LOGGER.error("Error creating in file: " + newFile + "is" + e.getMessage(), e); } } } } } else { LOGGER.error("Access is denied for creating: " + file.getName()); } } else { LOGGER.error("Transformer is null due to Invalid xsl file."); } } catch (FileNotFoundException e1) { LOGGER.error("Could not find NSITransform.xsl file : " + e1.getMessage(), e1); throw new DCMAApplicationException("Could not find nsiTransform.xsl file : " + e1.getMessage(), e1); } catch (TransformerException e1) { LOGGER.error( "Problem occurred in transforming " + sourceXMLPath + " to " + targetXmlPath + e1.getMessage(), e1); throw new DCMAApplicationException("Could not find nsiTransform.xsl file : ", e1); } catch (IOException ioe) { LOGGER.error( "Problem occurred in transforming " + sourceXMLPath + " to " + targetXmlPath + ioe.getMessage(), ioe); throw new DCMAApplicationException("Could not transform ibmCMTransform.xsl file : " + ioe.getMessage(), ioe); } }
From source file:com.esofthead.mycollab.vaadin.AppContext.java
License:Open Source License
/** * @param date is the UTC date value/*from ww w . ja va 2 s . c o m*/ * @return */ public static String formatDateTime(Date date) { // return date == null ? "" : DateTimeUtils.formatDate(date, AppContext.getDateTimeFormat(), AppContext.getUserTimeZone()); if (date == null) { return ""; } else { DateTime jodaDate = new DateTime(date) .toDateTime(DateTimeZone.forTimeZone(AppContext.getUserTimeZone())); if (jodaDate.getHourOfDay() > 0 || jodaDate.getMinuteOfHour() > 0) { DateTimeFormatter formatter = DateTimeFormat.forPattern(AppContext.getDateTimeFormat()); return formatter.print(jodaDate); } else { DateTimeFormatter formatter = DateTimeFormat.forPattern(AppContext.getDateFormat()); return formatter.print(jodaDate); } } }
From source file:com.esofthead.mycollab.vaadin.web.ui.field.DateTimeOptionField.java
License:Open Source License
@Override public void setPropertyDataSource(Property newDataSource) { Date value = (Date) newDataSource.getValue(); if (value != null) { DateTime jodaTime = new DateTime(value); jodaTime = jodaTime.toDateTime(DateTimeZone.forTimeZone(AppContext.getUserTimeZone())); int hrs = jodaTime.getHourOfDay(); int min = jodaTime.getMinuteOfHour(); String timeFormat = "AM"; if (hrs > 12) { hrs -= 12;//w w w. j av a 2s. com timeFormat = "PM"; } if ((hrs > 0 || min > 0) && hideTimeOption) { toggleHideTimeOption(false); } popupDateField.setPropertyDataSource(new ObjectProperty(jodaTime.toDate())); if (!hideTimeOption) { hourPickerComboBox.setPropertyDataSource(new ObjectProperty((hrs < 10) ? "0" + hrs : "" + hrs)); minutePickerComboBox.setPropertyDataSource(new ObjectProperty((min < 10) ? "0" + min : "" + min)); timeFormatComboBox.setPropertyDataSource(new ObjectProperty(timeFormat)); } } super.setPropertyDataSource(newDataSource); }
From source file:com.esri.geoevent.solutions.processor.geometry.QueryReportProcessor.java
License:Apache License
@Override public GeoEvent process(GeoEvent ge) throws Exception { //CreateQueryMap(); CreateQueries();/* w w w.ja va2 s. co m*/ double radius = (Double) properties.get("radius").getValue(); String units = properties.get("units").getValue().toString(); int inwkid = (Integer) properties.get("wkidin").getValue(); int outwkid = (Integer) properties.get("wkidout").getValue(); int bufferwkid = (Integer) properties.get("wkidbuffer").getValue(); srIn = SpatialReference.create(inwkid); srBuffer = SpatialReference.create(bufferwkid); srOut = SpatialReference.create(outwkid); com.esri.ges.spatial.Geometry geo = ge.getGeometry(); com.esri.ges.spatial.Geometry inGeo = null; if (properties.get("geosrc").getValueAsString().equals("Buffer")) { inGeometry = constructGeometry(geo); Unit u = queryUnit(units); inGeo = constructBuffer(geo, radius, u); } else if (properties.get("geosrc").getValueAsString().equals("Event Definition")) { String eventfld = properties.get("geoeventdef").getValue().toString(); String[] arr = eventfld.split(":"); String geostr = (String) ge.getField(arr[1]); com.esri.ges.spatial.Geometry g = constructGeometryFromString(geostr); com.esri.core.geometry.Geometry polyGeo = constructGeometry(g); Envelope env = new Envelope(); polyGeo.queryEnvelope(env); inGeometry = env.getCenter(); com.esri.core.geometry.Geometry projGeo = GeometryEngine.project(polyGeo, srBuffer, srOut); String json = GeometryEngine.geometryToJson(srOut, projGeo); inGeo = spatial.fromJson(json); } else { com.esri.core.geometry.Geometry polyGeo = constructGeometry(geo); Envelope env = new Envelope(); polyGeo.queryEnvelope(env); inGeometry = env.getCenter(); com.esri.core.geometry.Geometry projGeo = GeometryEngine.project(polyGeo, srBuffer, srOut); String json = GeometryEngine.geometryToJson(srOut, projGeo); inGeo = spatial.fromJson(json); } String jsonGeo = inGeo.toJson(); String geotype = GeometryUtility.parseGeometryType(inGeo.getType()); ExecuteRestQueries(jsonGeo, geotype); String timestamp = ""; if ((Boolean) properties.get("usetimestamp").getValue()) { String eventfld = properties.get("timestamp").getValueAsString(); String[] arr = eventfld.split(":"); timestamp = ge.getField(arr[1]).toString(); } DateTime dt = DateTime.now(); String ts = ((Integer) dt.getYear()).toString() + ((Integer) dt.getMonthOfYear()).toString() + ((Integer) dt.getDayOfMonth()).toString() + ((Integer) dt.getHourOfDay()).toString() + ((Integer) dt.getMinuteOfHour()).toString() + ((Integer) dt.getSecondOfMinute()).toString(); String file = properties.get("filename").getValueAsString() + ts + ".html"; ParseResponses(timestamp, file); String host = properties.get("host").getValueAsString(); if (host.contains("http://")) { host.replace("http://", ""); } String url = "http://" + host + ":6180/geoevent/assets/reports/" + file; GeoEventDefinition geoDef = ge.getGeoEventDefinition(); String outDefName = geoDef.getName() + "_out"; GeoEventDefinition edOut; if ((edOut = manager.searchGeoEventDefinition(outDefName, getId())) == null) { List<FieldDefinition> fds = Arrays .asList(((FieldDefinition) new DefaultFieldDefinition("url", FieldType.String))); edOut = geoDef.augment(fds); edOut.setOwner(getId()); edOut.setName(outDefName); manager.addGeoEventDefinition(edOut); } GeoEventCreator geoEventCreator = messaging.createGeoEventCreator(); GeoEvent geOut = geoEventCreator.create(edOut.getGuid(), new Object[] { ge.getAllFields(), url }); geOut.setProperty(GeoEventPropertyName.TYPE, "message"); geOut.setProperty(GeoEventPropertyName.OWNER_ID, getId()); geOut.setProperty(GeoEventPropertyName.OWNER_ID, definition.getUri()); for (Map.Entry<GeoEventPropertyName, Object> property : ge.getProperties()) if (!geOut.hasProperty(property.getKey())) geOut.setProperty(property.getKey(), property.getValue()); queries.clear(); responseMap.clear(); return geOut; }
From source file:com.esri.geoevent.solutions.processor.queryreport.QueryReportProcessor.java
License:Apache License
@Override public void afterPropertiesSet() { radius = (Double) properties.get("radius").getValue(); units = properties.get("units").getValue().toString(); //inwkid = (Integer) properties.get("wkidin").getValue(); outwkid = (Integer) properties.get("wkidout").getValue(); bufferwkid = (Integer) properties.get("wkidbuffer").getValue(); geoSrc = properties.get("geosrc").getValueAsString(); useCentroid = (Boolean) properties.get("usecentroid").getValue(); eventfld = properties.get("geoeventdef").getValue().toString(); useTimeStamp = (Boolean) properties.get("usetimestamp").getValue(); DateTime dt = DateTime.now(); ts = ((Integer) dt.getYear()).toString() + ((Integer) dt.getMonthOfYear()).toString() + ((Integer) dt.getDayOfMonth()).toString() + ((Integer) dt.getHourOfDay()).toString() + ((Integer) dt.getMinuteOfHour()).toString() + ((Integer) dt.getSecondOfMinute()).toString(); time = ((Integer) dt.getYear()).toString() + "/" + ((Integer) dt.getMonthOfYear()).toString() + "/" + ((Integer) dt.getDayOfMonth()).toString() + " " + ((Integer) dt.getHourOfDay()).toString() + ":" + ((Integer) dt.getMinuteOfHour()).toString() + ":" + ((Integer) dt.getSecondOfMinute()).toString(); file = properties.get("filename").getValueAsString() + ts + ".html"; host = properties.get("host").getValueAsString(); outDefName = properties.get("gedname").getValueAsString(); connName = properties.get("connection").getValueAsString(); folder = properties.get("folder").getValueAsString(); service = properties.get("service").getValueAsString(); lyrName = properties.get("layer").getValueAsString(); try {// www . j a v a2 s. c o m conn = connectionManager.getArcGISServerConnection(connName); } catch (Exception e) { LOG.error(e.getMessage()); ValidationException ve = new ValidationException("Unable to make connection to ArcGIS Server"); LOG.error(ve.getMessage()); try { throw ve; } catch (ValidationException e1) { e1.printStackTrace(); } } layer = conn.getLayer(folder, service, lyrName, ArcGISServerType.FeatureServer); layerId = ((Integer) layer.getId()).toString(); field = properties.get("field").getValueAsString(); sortField = properties.get("sortfield").getValueAsString(); if (!properties.get("endpoint").getValueAsString().isEmpty()) { endpoint = properties.get("endpoint").getValueAsString(); } try { token = conn.getDecryptedToken(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } //fields = conn.getFields(folder, service, layer.getId(), ArcGISServerType.FeatureServer); calcDist = (Boolean) properties.get("calcDistance").getValue(); wc = properties.get("wc").getValueAsString(); lyrHeaderCfg = properties.get("lyrheader").getValueAsString(); sortByDist = false; if (calcDist) { sortByDist = (Boolean) properties.get("sortdist").getValue(); distToken = "${distance.value}"; distUnits = properties.get("dist_units").getValueAsString(); } //token = properties.get("field-token").getValueAsString(); itemConfig = properties.get("item-config").getValueAsString(); title = properties.get("title").getValueAsString(); Object objHeader = properties.get("header"); header = null; if (objHeader != null) { header = properties.get("header").getValueAsString(); } }
From source file:com.esri.ges.solutions.processor.geometry.QueryProcessor.java
License:Apache License
@Override public GeoEvent process(GeoEvent ge) throws Exception { CreateQueryMap();//from w ww . ja v a 2 s . c o m double radius = (Double) properties.get("radius").getValue(); String units = properties.get("units").getValue().toString(); int inwkid = (Integer) properties.get("wkidin").getValue(); int outwkid = (Integer) properties.get("wkidout").getValue(); int bufferwkid = (Integer) properties.get("wkidbuffer").getValue(); srIn = SpatialReference.create(inwkid); srBuffer = SpatialReference.create(bufferwkid); srOut = SpatialReference.create(outwkid); com.esri.ges.spatial.Point eventGeo = (com.esri.ges.spatial.Point) ge.getGeometry(); double x = eventGeo.getX(); double y = eventGeo.getY(); com.esri.ges.spatial.Geometry buffer = constructBuffer(x, y, radius, units); String jsonGeo = buffer.toJson(); String geotype = GeometryUtility.parseGeometryType(buffer.getType()); ExecuteRestQueries(jsonGeo, geotype); String timestamp = ""; if ((Boolean) properties.get("usetimestamp").getValue()) { String eventfld = properties.get("timestamp").getValueAsString(); String[] arr = eventfld.split(":"); timestamp = ge.getField(arr[1]).toString(); } DateTime dt = DateTime.now(); String ts = ((Integer) dt.getYear()).toString() + ((Integer) dt.getMonthOfYear()).toString() + ((Integer) dt.getDayOfMonth()).toString() + ((Integer) dt.getHourOfDay()).toString() + ((Integer) dt.getMinuteOfHour()).toString() + ((Integer) dt.getSecondOfMinute()).toString(); String file = properties.get("filename").getValueAsString() + ts + ".html"; ParseResponses(timestamp, file); String host = properties.get("host").getValueAsString(); String url = "http://" + host + ":6180/geoevent/assets/reports/" + file; GeoEventDefinition geoDef = ge.getGeoEventDefinition(); List<FieldDefinition> fds = Arrays .asList(((FieldDefinition) new DefaultFieldDefinition("url", FieldType.String))); GeoEventDefinition edOut = geoDef.augment(fds); edOut.setOwner(getId()); manager.addTemporaryGeoEventDefinition(edOut, true); GeoEventCreator geoEventCreator = messaging.createGeoEventCreator(); GeoEvent geOut = geoEventCreator.create(edOut.getGuid(), new Object[] { ge.getAllFields(), url }); geOut.setProperty(GeoEventPropertyName.TYPE, "message"); geOut.setProperty(GeoEventPropertyName.OWNER_ID, getId()); geOut.setProperty(GeoEventPropertyName.OWNER_ID, definition.getUri()); for (Map.Entry<GeoEventPropertyName, Object> property : ge.getProperties()) if (!geOut.hasProperty(property.getKey())) geOut.setProperty(property.getKey(), property.getValue()); queries.clear(); responseMap.clear(); return geOut; }
From source file:com.esri.ges.solutions.processor.geometry.QueryReportProcessor.java
License:Apache License
@Override public GeoEvent process(GeoEvent ge) throws Exception { CreateQueryMap();// w w w . ja va 2 s .c o m double radius = (Double) properties.get("radius").getValue(); String units = properties.get("units").getValue().toString(); int inwkid = (Integer) properties.get("wkidin").getValue(); int outwkid = (Integer) properties.get("wkidout").getValue(); int bufferwkid = (Integer) properties.get("wkidbuffer").getValue(); srIn = SpatialReference.create(inwkid); srBuffer = SpatialReference.create(bufferwkid); srOut = SpatialReference.create(outwkid); Geometry geo = ge.getGeometry(); Geometry inGeo = null; if (properties.get("geosrc").getValueAsString().equals("Buffer")) { inGeo = constructBuffer(geo, radius, units); } else if (properties.get("geosrc").getValueAsString().equals("Event Definition")) { String eventfld = properties.get("geoeventdef").getValue().toString(); String[] arr = eventfld.split(":"); String geostr = (String) ge.getField(arr[1]); inGeo = constructGeometryFromString(geostr); } else { inGeo = geo; } String jsonGeo = inGeo.toJson(); String geotype = GeometryUtility.parseGeometryType(inGeo.getType()); ExecuteRestQueries(jsonGeo, geotype); String timestamp = ""; if ((Boolean) properties.get("usetimestamp").getValue()) { String eventfld = properties.get("timestamp").getValueAsString(); String[] arr = eventfld.split(":"); timestamp = ge.getField(arr[1]).toString(); } DateTime dt = DateTime.now(); String ts = ((Integer) dt.getYear()).toString() + ((Integer) dt.getMonthOfYear()).toString() + ((Integer) dt.getDayOfMonth()).toString() + ((Integer) dt.getHourOfDay()).toString() + ((Integer) dt.getMinuteOfHour()).toString() + ((Integer) dt.getSecondOfMinute()).toString(); String file = properties.get("filename").getValueAsString() + ts + ".html"; ParseResponses(timestamp, file); String host = properties.get("host").getValueAsString(); String url = "http://" + host + ":6180/geoevent/assets/reports/" + file; GeoEventDefinition geoDef = ge.getGeoEventDefinition(); List<FieldDefinition> fds = Arrays .asList(((FieldDefinition) new DefaultFieldDefinition("url", FieldType.String))); GeoEventDefinition edOut = geoDef.augment(fds); edOut.setOwner(getId()); manager.addTemporaryGeoEventDefinition(edOut, true); GeoEventCreator geoEventCreator = messaging.createGeoEventCreator(); GeoEvent geOut = geoEventCreator.create(edOut.getGuid(), new Object[] { ge.getAllFields(), url }); geOut.setProperty(GeoEventPropertyName.TYPE, "message"); geOut.setProperty(GeoEventPropertyName.OWNER_ID, getId()); geOut.setProperty(GeoEventPropertyName.OWNER_ID, definition.getUri()); for (Map.Entry<GeoEventPropertyName, Object> property : ge.getProperties()) if (!geOut.hasProperty(property.getKey())) geOut.setProperty(property.getKey(), property.getValue()); queries.clear(); responseMap.clear(); return geOut; }
From source file:com.example.android.sunshine.wear.Utility.java
License:Apache License
static public String getTimeForDisplay(DateTime dateTime) { return dateTime.getHourOfDay() + ":" + dateTime.getMinuteOfHour(); }