List of usage examples for java.util Calendar setTimeZone
public void setTimeZone(TimeZone value)
From source file:org.floggy.synchronization.jme.core.impl.JSONSerializationManagerTest.java
/** * DOCUMENT ME!/* ww w .j a v a 2s . c o m*/ * * @throws Exception DOCUMENT ME! */ public void testSendCalendarNotNull() throws Exception { JSONStringer stringer = new JSONStringer(); String name = "bornDate"; Calendar value = Calendar.getInstance(); value.setTimeZone(TimeZone.getTimeZone("America/Sao_Paulo")); value.setTimeInMillis(1234567890); stringer.object(); JSONSerializationManager.sendCalendar(name, value, stringer); stringer.endObject(); String expected = "{\"bornDate\":{\"timeZone\":{\"ID\":\"America/Sao_Paulo\"},\"time\":1234567890}}"; assertEquals(expected, stringer.toString()); }
From source file:ume.pareva.it.ITDr.java
private void processITDR(MobileClub club, String msisdn, String messageId, String logUnique, String statusText, String reasonCode, String statusCode, String reasonText) { Transaction dbtransaction = null;/* w w w.j a v a 2 s . c om*/ Session dbsession = null; Calendar nowTime = GregorianCalendar.getInstance(); nowTime.setTimeZone(TimeZone.getTimeZone("Europe/Rome")); Date currentDate = nowTime.getTime(); String billCreated = "1970-01-01 00:00:00"; clubUser = null; MobileClubBillingPlan billingPlan = null; if (msisdn.equals("")) { clubUser = umeMobileClubUserDao.getClubUserByMsisdn(msisdn, club.getUnique()); } //IF CLUBUSER IS ON PAREVA DOING BILLING LOGIC, ELSE REDIRECT TO MIXEM PLATFORM. if (clubUser != null) { dbtransaction = dbsession.beginTransaction(); Query query = null; try { String checktidQuery = "select * from itNotificationLog where aUnique='" + messageId + "'"; query = dbsession.createSQLQuery(checktidQuery).addScalar("aUnique", StandardBasicTypes.STRING); java.util.List result = query.list(); if (result != null && result.size() > 0) { } else { String addNotificationLogQuery = " INSERT INTO itNotificationLog" + " (aUnique)" + " VALUES('" + messageId + "')"; try { query = dbsession.createSQLQuery(addNotificationLogQuery); query.executeUpdate(); } catch (Exception e) { System.out.println("iminotification_debug " + " Exception " + e); e.printStackTrace(); } try { MobileClubBillingTry item = new MobileClubBillingTry(); item.setUnique(Misc.generateUniqueId()); item.setLogUnique(logUnique); item.setAggregator("ipx"); item.setStatus(statusText); item.setTransactionId(clubUser.getParam2()); item.setResponseRef(messageId); item.setResponseCode(reasonCode); item.setResponseDesc(reasonText); item.setCreated(currentDate); item.setRegionCode("IT"); item.setNetworkCode(clubUser.getNetworkCode()); item.setParsedMsisdn(clubUser.getParsedMobile()); item.setTariffClass(250); item.setBillingType("club"); item.setClubUnique(clubUser.getClubUnique()); item.setCampaign(clubUser.getCampaign()); item.setTicketCreated(SdcMiscDate.parseSqlDateString(billCreated)); processBillingPlan(statusCode, reasonCode, reasonText, messageId, clubUser, item); } catch (Exception eeee) { System.out.println("IPX oooo notify charged: " + eeee); } } } catch (Exception ee) { System.out.println("IPX itNotificationLog checking exception charged: " + ee); } } }
From source file:no.met.jtimeseries.chart.ChartPlotter.java
private boolean isDayMarker(Date d, TimeZone timeZone) { Calendar cal = Calendar.getInstance(); cal.setTime(d);//from w w w .j a v a2 s . co m cal.setTimeZone(timeZone); return (cal.get(Calendar.HOUR_OF_DAY) == 0 && cal.get(Calendar.MINUTE) == 0); }
From source file:org.floggy.synchronization.jme.core.impl.JSONSerializationManagerTest.java
/** * DOCUMENT ME!// w w w . j a v a 2 s . c o m * * @throws Exception DOCUMENT ME! */ public void testSendHashtableNotNull() throws Exception { JSONStringer stringer = new JSONStringer(); String name = "firstName"; Hashtable value = new Hashtable(); Calendar c1 = Calendar.getInstance(); c1.setTimeZone(TimeZone.getTimeZone("America/Sao_Paulo")); c1.setTime(new Date(1234567890)); Calendar c2 = Calendar.getInstance(); c2.setTimeZone(TimeZone.getTimeZone("America/Sao_Paulo")); c2.setTime(new Date(1234567890)); value.put(Boolean.TRUE, Boolean.TRUE); value.put(new Byte((byte) 90), new Byte((byte) 90)); value.put(new Character('2'), new Character('2')); value.put(new Double(23d), new Double(23d)); value.put(new Float(45f), new Float(45f)); value.put(new Integer(87), new Integer(87)); value.put(new Long(89), new Long(89)); value.put(new Short((short) 78), new Short((short) 78)); value.put("key", "value"); value.put(new Date(1234567890), new Date(9876543221L)); value.put(c1, c2); value.put(TimeZone.getTimeZone("America/Sao_Paulo"), TimeZone.getTimeZone("America/Sao_Paulo")); stringer.object(); JSONSerializationManager.sendHashtable(name, value, stringer); stringer.endObject(); String expected = "{\"firstName\":[{\"key\":{\"className\":\"java.lang.Byte\",\"value\":90},\"value\":{\"className\":\"java.lang.Byte\",\"value\":90}},{\"key\":{\"className\":\"java.lang.Long\",\"value\":89},\"value\":{\"className\":\"java.lang.Long\",\"value\":89}},{\"key\":{\"className\":\"java.lang.Float\",\"value\":45},\"value\":{\"className\":\"java.lang.Float\",\"value\":45}},{\"key\":{\"className\":\"java.util.Date\",\"value\":{\"time\":1234567890}},\"value\":{\"className\":\"java.util.Date\",\"value\":{\"time\":9876543221}}},{\"key\":{\"className\":\"java.lang.Integer\",\"value\":87},\"value\":{\"className\":\"java.lang.Integer\",\"value\":87}},{\"key\":{\"className\":\"java.lang.Double\",\"value\":23},\"value\":{\"className\":\"java.lang.Double\",\"value\":23}},{\"key\":{\"className\":\"java.lang.Boolean\",\"value\":true},\"value\":{\"className\":\"java.lang.Boolean\",\"value\":true}},{\"key\":{\"className\":\"java.util.TimeZone\",\"value\":{\"ID\":\"America/Sao_Paulo\"}},\"value\":{\"className\":\"java.util.TimeZone\",\"value\":{\"ID\":\"America/Sao_Paulo\"}}},{\"key\":{\"className\":\"java.lang.Short\",\"value\":78},\"value\":{\"className\":\"java.lang.Short\",\"value\":78}},{\"key\":{\"className\":\"java.util.Calendar\",\"value\":{\"timeZone\":{\"ID\":\"America/Sao_Paulo\"},\"time\":1234567890}},\"value\":{\"className\":\"java.util.Calendar\",\"value\":{\"timeZone\":{\"ID\":\"America/Sao_Paulo\"},\"time\":1234567890}}},{\"key\":{\"className\":\"java.lang.Character\",\"value\":\"2\"},\"value\":{\"className\":\"java.lang.Character\",\"value\":\"2\"}},{\"key\":{\"className\":\"java.lang.String\",\"value\":\"key\"},\"value\":{\"className\":\"java.lang.String\",\"value\":\"value\"}}]}"; assertEquals(expected, stringer.toString()); }
From source file:org.openhab.binding.keba.handler.KeContactP20Handler.java
protected void onRead(ByteBuffer byteBuffer, DatagramChannel datagramChannel) { String response = new String(byteBuffer.array(), 0, byteBuffer.limit()); response = StringUtils.chomp(response); if (response.contains("TCH-OK")) { // ignore confirmation messages which are not JSON return;//from www. j a v a2 s . c o m } try { JsonObject readObject = parser.parse(response).getAsJsonObject(); for (Entry<String, JsonElement> entry : readObject.entrySet()) { switch (entry.getKey()) { case "Product": { Map<String, String> properties = editProperties(); properties.put(CHANNEL_MODEL, entry.getValue().getAsString()); updateProperties(properties); break; } case "Serial": { Map<String, String> properties = editProperties(); properties.put(CHANNEL_SERIAL, entry.getValue().getAsString()); updateProperties(properties); break; } case "Firmware": { Map<String, String> properties = editProperties(); properties.put(CHANNEL_FIRMWARE, entry.getValue().getAsString()); updateProperties(properties); break; } case "Plug": { int state = entry.getValue().getAsInt(); switch (state) { case 0: { updateState(new ChannelUID(getThing().getUID(), CHANNEL_WALLBOX), OnOffType.OFF); updateState(new ChannelUID(getThing().getUID(), CHANNEL_VEHICLE), OnOffType.OFF); updateState(new ChannelUID(getThing().getUID(), CHANNEL_PLUG_LOCKED), OnOffType.OFF); break; } case 1: { updateState(new ChannelUID(getThing().getUID(), CHANNEL_WALLBOX), OnOffType.ON); updateState(new ChannelUID(getThing().getUID(), CHANNEL_VEHICLE), OnOffType.OFF); updateState(new ChannelUID(getThing().getUID(), CHANNEL_PLUG_LOCKED), OnOffType.OFF); break; } case 3: { updateState(new ChannelUID(getThing().getUID(), CHANNEL_WALLBOX), OnOffType.ON); updateState(new ChannelUID(getThing().getUID(), CHANNEL_VEHICLE), OnOffType.OFF); updateState(new ChannelUID(getThing().getUID(), CHANNEL_PLUG_LOCKED), OnOffType.ON); break; } case 5: { updateState(new ChannelUID(getThing().getUID(), CHANNEL_WALLBOX), OnOffType.ON); updateState(new ChannelUID(getThing().getUID(), CHANNEL_VEHICLE), OnOffType.ON); updateState(new ChannelUID(getThing().getUID(), CHANNEL_PLUG_LOCKED), OnOffType.OFF); break; } case 7: { updateState(new ChannelUID(getThing().getUID(), CHANNEL_WALLBOX), OnOffType.ON); updateState(new ChannelUID(getThing().getUID(), CHANNEL_VEHICLE), OnOffType.ON); updateState(new ChannelUID(getThing().getUID(), CHANNEL_PLUG_LOCKED), OnOffType.ON); break; } } break; } case "State": { State newState = new DecimalType(entry.getValue().getAsInt()); updateState(new ChannelUID(getThing().getUID(), CHANNEL_STATE), newState); break; } case "Enable sys": { int state = entry.getValue().getAsInt(); switch (state) { case 1: { updateState(new ChannelUID(getThing().getUID(), CHANNEL_ENABLED), OnOffType.ON); break; } default: { updateState(new ChannelUID(getThing().getUID(), CHANNEL_ENABLED), OnOffType.OFF); break; } } break; } case "Curr HW": { int state = entry.getValue().getAsInt(); maxSystemCurrent = state; State newState = new DecimalType(state); updateState(new ChannelUID(getThing().getUID(), CHANNEL_MAX_SYSTEM_CURRENT), newState); if (maxSystemCurrent < maxPresetCurrent) { sendCommand("curr " + String.valueOf(maxSystemCurrent)); updateState(new ChannelUID(getThing().getUID(), CHANNEL_MAX_PRESET_CURRENT), new DecimalType(maxSystemCurrent)); updateState(new ChannelUID(getThing().getUID(), CHANNEL_MAX_PRESET_CURRENT_RANGE), new PercentType((maxSystemCurrent - 6000) * 100 / (maxSystemCurrent - 6000))); } break; } case "Curr user": { int state = entry.getValue().getAsInt(); maxPresetCurrent = state; updateState(new ChannelUID(getThing().getUID(), CHANNEL_MAX_PRESET_CURRENT), new DecimalType(state)); updateState(new ChannelUID(getThing().getUID(), CHANNEL_MAX_PRESET_CURRENT_RANGE), new PercentType((state - 6000) * 100 / (maxSystemCurrent - 6000))); break; } case "Curr FS": { int state = entry.getValue().getAsInt(); State newState = new DecimalType(state); updateState(new ChannelUID(getThing().getUID(), CHANNEL_FAILSAFE_CURRENT), newState); break; } case "Output": { int state = entry.getValue().getAsInt(); switch (state) { case 1: { updateState(new ChannelUID(getThing().getUID(), CHANNEL_OUTPUT), OnOffType.ON); break; } default: { updateState(new ChannelUID(getThing().getUID(), CHANNEL_OUTPUT), OnOffType.OFF); break; } } break; } case "Input": { int state = entry.getValue().getAsInt(); switch (state) { case 1: { updateState(new ChannelUID(getThing().getUID(), CHANNEL_INPUT), OnOffType.ON); break; } default: { updateState(new ChannelUID(getThing().getUID(), CHANNEL_INPUT), OnOffType.OFF); break; } } break; } case "Sec": { long state = entry.getValue().getAsLong(); Calendar uptime = Calendar.getInstance(); uptime.setTimeZone(TimeZone.getTimeZone("GMT")); uptime.setTimeInMillis(state * 1000); SimpleDateFormat pFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); pFormatter.setTimeZone(TimeZone.getTimeZone("GMT")); updateState(new ChannelUID(getThing().getUID(), CHANNEL_UPTIME), new DateTimeType(pFormatter.format(uptime.getTime()))); break; } case "U1": { int state = entry.getValue().getAsInt(); State newState = new DecimalType(state); updateState(new ChannelUID(getThing().getUID(), CHANNEL_U1), newState); break; } case "U2": { int state = entry.getValue().getAsInt(); State newState = new DecimalType(state); updateState(new ChannelUID(getThing().getUID(), CHANNEL_U2), newState); break; } case "U3": { int state = entry.getValue().getAsInt(); State newState = new DecimalType(state); updateState(new ChannelUID(getThing().getUID(), CHANNEL_U3), newState); break; } case "I1": { int state = entry.getValue().getAsInt(); State newState = new DecimalType(state / 1000); updateState(new ChannelUID(getThing().getUID(), CHANNEL_I1), newState); break; } case "I2": { int state = entry.getValue().getAsInt(); State newState = new DecimalType(state / 1000); updateState(new ChannelUID(getThing().getUID(), CHANNEL_I2), newState); break; } case "I3": { int state = entry.getValue().getAsInt(); State newState = new DecimalType(state / 1000); updateState(new ChannelUID(getThing().getUID(), CHANNEL_I3), newState); break; } case "P": { long state = entry.getValue().getAsLong(); State newState = new DecimalType(state / 1000); updateState(new ChannelUID(getThing().getUID(), CHANNEL_POWER), newState); break; } case "PF": { int state = entry.getValue().getAsInt(); State newState = new PercentType(state / 10); updateState(new ChannelUID(getThing().getUID(), CHANNEL_POWER_FACTOR), newState); break; } case "E pres": { long state = entry.getValue().getAsLong(); State newState = new DecimalType(state / 10); updateState(new ChannelUID(getThing().getUID(), CHANNEL_SESSION_CONSUMPTION), newState); break; } case "E total": { long state = entry.getValue().getAsLong(); State newState = new DecimalType(state / 10); updateState(new ChannelUID(getThing().getUID(), CHANNEL_TOTAL_CONSUMPTION), newState); break; } } } } catch (JsonParseException e) { logger.debug("Invalid JSON data will be ignored: '{}'", response); } }
From source file:org.adblockplus.android.AdblockPlus.java
/** * Sets Alarm to call updater after specified number of minutes or after one * day if/*w w w . j av a 2s .c o m*/ * minutes are set to 0. * * @param minutes * number of minutes to wait */ public void scheduleUpdater(int minutes) { Calendar updateTime = Calendar.getInstance(); if (minutes == 0) { // Start update checks at 10:00 GMT... updateTime.setTimeZone(TimeZone.getTimeZone("GMT")); updateTime.set(Calendar.HOUR_OF_DAY, 10); updateTime.set(Calendar.MINUTE, 0); // ...next day updateTime.add(Calendar.HOUR_OF_DAY, 24); // Spread out the mass downloading? for 6 hours updateTime.add(Calendar.MINUTE, (int) (Math.random() * 60 * 6)); } else { updateTime.add(Calendar.MINUTE, minutes); } Intent updater = new Intent(this, AlarmReceiver.class); PendingIntent recurringUpdate = PendingIntent.getBroadcast(this, 0, updater, PendingIntent.FLAG_CANCEL_CURRENT); // Set non-waking alarm AlarmManager alarms = (AlarmManager) getSystemService(Context.ALARM_SERVICE); alarms.set(AlarmManager.RTC, updateTime.getTimeInMillis(), recurringUpdate); }
From source file:mk.finki.ranggo.aggregator.ContentsAggregatorImpl.java
public void aggregateGoogleNewsRSSFeed(Date date) throws ContentsAggregatorException { //only the category 'top stories' is extracted (due to the daily limit of 1000 transactions of a free alchemyapi license) //url: http://news.google.com/news?&hl=en&output=rss&scoring=n&as_drrb=b&as_minm=%minm&as_mind=%mind&as_maxm=%maxm&as_maxd=%maxd //%minm, %mind, %maxm, %maxd - minimum/maximum month/day Calendar calendar = Calendar.getInstance(); calendar.setTimeZone(TimeZone.getTimeZone("UTC")); calendar.setTime(date);//from w w w.j av a 2 s . c o m String month = String.valueOf(calendar.get(Calendar.MONTH) + 1); String day = String.valueOf(calendar.get(Calendar.DAY_OF_MONTH)); //pagination parameter? 'start' does not work. max size per page is 30 //currently fetching 10 articles to reduce the method runtime final String url = "http://news.google.com/news?&hl=en&output=rss&scoring=n&as_drrb=b&as_minm=" + month + "&as_mind=" + day + "&as_maxm=" + month + "&as_maxd=" + day + "&num=10"; //parse the rss try { DocumentBuilderFactory documenetBuilderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder documentBuilder = documenetBuilderFactory.newDocumentBuilder(); Document document = documentBuilder.parse(url); document.getDocumentElement().normalize(); NodeList items = document.getElementsByTagName("item"); //extract data for each article for (int i = 0; i < items.getLength(); i++) { Element itemElement = (Element) items.item(i); String itemTitle = itemElement.getElementsByTagName("title").item(0).getTextContent() .replaceAll("'", "'").replaceAll(""", "'").replaceAll("<", "<") .replaceAll(">", ">").replaceAll("&", "&"); String itemLink = itemElement.getElementsByTagName("link").item(0).getTextContent(); String itemPubDate = itemElement.getElementsByTagName("pubDate").item(0).getTextContent(); itemLink = URLDecoder.decode(itemLink.substring(itemLink.indexOf("url=") + 4), "UTF-8"); //the feed nests the url and redirects to it, extract only the nested url try { this.processGoogleNewsArticle(itemLink, itemTitle, itemPubDate); } catch (ParserConfigurationException exception) { } //these exceptions should be logged - only a single article fails catch (SAXException exception) { } catch (XPathExpressionException exception) { } catch (IOException exception) { } } } catch (ParserConfigurationException exception) { throw new ContentsAggregatorException("parser configuration error", AggregatorMethod.GOOGLE_NEWS_RSS_FEED); } catch (SAXException exception) { throw new ContentsAggregatorException("xml parse exception", AggregatorMethod.GOOGLE_NEWS_RSS_FEED); } catch (IOException exception) { throw new ContentsAggregatorException("can not fetch resource", AggregatorMethod.GOOGLE_NEWS_RSS_FEED); } }
From source file:ume.pareva.it.ITDr.java
private void processBillingPlan(final String statusCode, final String reasonCode, final String reasonText, final String referenceId, final SdcMobileClubUser clubUser, final MobileClubBillingTry btry) { ExecutorService executorService = Executors.newSingleThreadExecutor(); executorService.execute(new Runnable() { public void run() { try { Calendar nowTime = GregorianCalendar.getInstance(); nowTime.setTimeZone(TimeZone.getTimeZone("Europe/Rome")); ZACPA zalog = null;/*from w ww .j a v a 2s .co m*/ IpxBillingDirect billingDirect = null; MobileClubBillingPlan billingPlan = billingplandao.getActiveBillingPlanByMsisdnAndClubUnique( clubUser.getParsedMobile(), clubUser.getClubUnique()); //TODO TODO TODOCHECK referenceId here here. if (statusCode.equals("0")) { if (billingPlan != null) { if (billingPlan.getServiceDateBillsRemaining() > 0) { billingPlan.setLastSuccess(billingPlan.getLastPush()); billingPlan.setLastPaid(billingPlan.getLastPush()); billingPlan.setPartialsPaid(billingPlan.getPartialsPaid() + 1); if (billingPlan.getServiceDateBillsRemaining() > 0) { billingPlan.setServiceDateBillsRemaining( billingPlan.getServiceDateBillsRemaining() - 1); } billingPlan.setNextPush(MiscDate.getNextHourZeroIT()); if (!billingPlan.getNetworkCode().equals("tim")) { billingPlan.setNextPush(new Date()); } billingplandao.update(billingPlan); // billingplandao.update(billingPlan); umeMobileClubUserDao.updateBillingRenew(clubUser.getUnique()); if (isInFirstBillPeriod(billingPlan.getSubscribed(), billingPlan.getPartialsPaid())) { btry.setResponseCode("003"); } try { IpxBillingSubmit sms = new IpxBillingSubmit(); sms.setSmsAccount("ipx_billing"); sms.setServiceDesc(1); sms.setResponse("0"); System.out.println("IPX NotifyBilling billingsuccessdao ******"); MobileClubBillingSuccesses success = new MobileClubBillingSuccesses(billingPlan, btry, sms.getSmsAccount(), sms.getServiceDesc(), sms.getResponse(), "S"); System.out.println( "IPX NotifyBilling billingsuccessdao ******_:" + success.toString()); mobilebillingdao.insertBillingSuccess(success); } catch (Exception e) { System.out.println("IPX NotifyBilling billingsuccessdao exception: " + e + "--" + new Date()); e.printStackTrace(); } MobileClubCampaign cmpg = campaigndao.getCampaignMap().get(clubUser.getCampaign()); if (clubUser.getCampaign() != null) { cmpg = UmeTempCmsCache.campaignMap.get(clubUser.getCampaign()); if (cmpg != null) { cmpg.setBillingCount(cmpg.getBillingCount() + 1); campaigndao.saveItem(cmpg); } if (cmpg != null && cmpg.getSrc().endsWith("RS")) { MobileClub club = mobileclubdao.getMobileClubMap() .get(clubUser.getClubUnique()); revrevshareloggingdao.addRevShareLogging(cmpg, "", clubUser.getParsedMobile(), MiscCr.encrypt(clubUser.getParsedMobile()), club, clubUser.getNetworkCode(), "IT", "1"); } if (cmpg != null && cmpg.getSrc().toLowerCase().endsWith("cpa") && cmpg.getCpaType().equalsIgnoreCase(("billing"))) { SimpleDateFormat currentsdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Calendar currentTime = Calendar.getInstance(); currentTime.add(Calendar.MINUTE, 10); String nextpush = currentsdf.format(currentTime.getTime()); String cpaloggingquery = "insert into cpaLogging (aParsedMobile,aCampaign,aClubUnique,aCreated,aNextPush,status,aNetworkCode,aSrc) values" + "('" + clubUser.getParsedMobile() + "','" + clubUser.getCampaign() + "','" + clubUser.getClubUnique() + "','" + currentsdf.format(new Date()) + "','" + nextpush + "','" + "0" + "','" + clubUser.getNetworkCode() + "','" + cmpg.getSrc() + "')"; int insertedRows = zalog.executeUpdateCPA(cpaloggingquery); } } } } } else { //System.out.println("IPX statusCode different 0"); if (billingPlan != null) { Date nextPush = null; if (nowTime.get(Calendar.HOUR_OF_DAY) >= 0 && nowTime.get(Calendar.HOUR_OF_DAY) < 12) { nowTime.set(Calendar.HOUR_OF_DAY, 12); nowTime.set(Calendar.MINUTE, 00); nowTime.set(Calendar.SECOND, 00); nextPush = nowTime.getTime(); } else if (nowTime.get(Calendar.HOUR_OF_DAY) >= 12 && nowTime.get(Calendar.HOUR_OF_DAY) < 23) { //if (nowTime.get(Calendar.HOUR_OF_DAY) >= 12 && nowTime.get(Calendar.HOUR_OF_DAY) < 23) nowTime.add(Calendar.DATE, 1); nowTime.set(Calendar.HOUR_OF_DAY, 00); nowTime.set(Calendar.MINUTE, 00); nowTime.set(Calendar.SECOND, 00); nextPush = nowTime.getTime(); } else { nowTime.set(Calendar.HOUR_OF_DAY, 12); nowTime.set(Calendar.MINUTE, 00); nowTime.set(Calendar.SECOND, 00); nextPush = nowTime.getTime(); } // Italy billing. if (statusCode.equals("1") && reasonCode.equals("1001") && clubUser.getNetworkCode().equals("vodafone")) { nowTime.add(Calendar.DATE, 1); nextPush = nowTime.getTime(); if (reasonText.equals("KO Billing - Retry not allowed")) { } } billingPlan.setNextPush(nextPush); billingplandao.update(billingPlan); } } billingDirect.addTryItem(btry); } catch (Exception e) { e.printStackTrace(); } } }); executorService.shutdown(); }
From source file:org.metaeffekt.dcc.commons.pki.CertificateManager.java
private void roundFloor(Calendar calendar) { calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MILLISECOND, 0); calendar.setTimeZone(timeZone); }
From source file:org.floggy.synchronization.jme.core.impl.JSONSerializationManagerTest.java
/** * DOCUMENT ME!/*from ww w . j ava 2 s.c om*/ * * @throws Exception DOCUMENT ME! */ public void testReceiveCalendarNotNull() throws Exception { JSONObject jsonObject = new JSONObject(); String name = "calendar"; Calendar value = Calendar.getInstance(); JSONObject calendar = new JSONObject(); JSONObject timeZone = new JSONObject(); value.setTimeZone(TimeZone.getTimeZone("America/Sao_Paulo")); value.setTimeInMillis(1234567890); timeZone.put("ID", "America/Sao_Paulo"); calendar.put("timeZone", timeZone); calendar.put("time", 1234567890); jsonObject.put(name, calendar); Calendar actual = JSONSerializationManager.receiveCalendar(name, jsonObject); assertEquals(value, actual); }