List of usage examples for org.joda.time LocalDate LocalDate
public LocalDate(Object instant)
From source file:com.google.api.ads.adwords.awreporting.model.util.DateUtil.java
License:Open Source License
/** * Formats the date to the ISO format without the time zone and day information: yyyyMM * * @param date the date as a {@code java.util.Date} * @return the {@code String} that represents the date in ISO format *//*w w w.j a va 2 s.c om*/ public static String formatYearMonthNoDash(Date date) { return formatYearMonthNoDash(new LocalDate(date)); }
From source file:com.google.gdt.googleapi.core.ApiDirectoryListingJsonCodec.java
License:Open Source License
protected void populateApiInfoFromJson(URL baseURL, JsonObject object, MutableApiInfo info) { if (object.has("name")) { info.setName(object.get("name").getAsString()); }//from w w w.j a v a2 s . c om if (object.has("version")) { info.setVersion(object.get("version").getAsString()); } if (object.has("title")) { info.setDisplayName(object.get("title").getAsString()); } if (object.has("publisher")) { info.setPublisher(object.get("publisher").getAsString()); } if (object.has("description")) { info.setDescription(object.get("description").getAsString()); } if (object.has("icons")) { JsonObject iconLinks = object.getAsJsonObject("icons"); Set<Entry<String, JsonElement>> iconLinksEntrySet = iconLinks.entrySet(); for (Entry<String, JsonElement> entry : iconLinksEntrySet) { try { info.putIconLink(entry.getKey(), new URL(baseURL, entry.getValue().getAsString())); } catch (MalformedURLException e) { // TODO Add logging warn } } } if (object.has("labels")) { JsonArray labelsJsonArray = object.getAsJsonArray("labels"); for (JsonElement labelElement : labelsJsonArray) { info.addLabel(labelElement.getAsString()); } } if (object.has("releaseDate")) { try { LocalDate date = new LocalDate(object.get("releaseDate").getAsString()); info.setReleaseDate(date); } catch (IllegalArgumentException e) { throw new JsonParseException(e); } } if (object.has("releaseNotesLink")) { try { info.setReleaseNotesLink(new URL(baseURL, object.get("releaseNotesLink").getAsString())); } catch (MalformedURLException e) { // TODO Add logging warn } } if (object.has("ranking")) { info.setRanking(object.get("ranking").getAsInt()); } if (object.has("discoveryLink")) { try { info.setDiscoveryLink(new URL(baseURL, object.get("discoveryLink").getAsString())); } catch (MalformedURLException e) { // TODO Add logging warn } } if (object.has("documentationLink")) { try { info.setDocumentationLink(new URL(baseURL, object.get("documentationLink").getAsString())); } catch (MalformedURLException e) { // TODO Add logging warn } } if (object.has("downloadLink")) { try { info.setDownloadLink(new URL(baseURL, object.get("downloadLink").getAsString())); } catch (MalformedURLException e) { // TODO Add logging warn } } if (object.has("tosLink")) { try { info.setTosLink(new URL(baseURL, object.get("tosLink").getAsString())); } catch (MalformedURLException e) { // TODO Add logging warn } } }
From source file:com.google.walkaround.wave.server.googleimport.ImportOverviewHandler.java
License:Open Source License
private List<ImportWaveletDisplayRecord> getWaves(CheckedTransaction tx, Multimap<Pair<SourceInstance, WaveletName>, ImportSharingMode> importsInProgress) throws RetryableFailure, PermanentFailure { ImmutableList.Builder<ImportWaveletDisplayRecord> out = ImmutableList.builder(); List<RemoteConvWavelet> wavelets = perUserTable.get().getAllWavelets(tx, userId); for (RemoteConvWavelet wavelet : wavelets) { WaveletName waveletName = WaveletName.of(WaveId.deserialise(wavelet.getDigest().getWaveId()), wavelet.getWaveletId()); out.add(new ImportWaveletDisplayRecord(wavelet.getSourceInstance(), waveletName, wavelet.getSourceInstance().getWaveLink(waveletName.waveId), // Let's assume that participant 0 is the creator even if that's not always true. // Participant lists can be empty. wavelet.getDigest().getParticipantSize() == 0 ? "<unknown>" : wavelet.getDigest().getParticipant(0), wavelet.getDigest().getTitle(), "" + new LocalDate(new Instant(wavelet.getDigest().getLastModifiedMillis())), importsInProgress.containsEntry(Pair.of(wavelet.getSourceInstance(), waveletName), ImportSharingMode.PRIVATE) || importsInProgress.containsEntry(Pair.of(wavelet.getSourceInstance(), waveletName), ImportSharingMode.PRIVATE_UNLESS_PARTICIPANT), wavelet.getPrivateLocalId() == null ? null : wavelet.getPrivateLocalId().getId(), wavelet.getPrivateLocalId() == null ? null : makeLocalWaveLink(wavelet.getPrivateLocalId()), importsInProgress.containsEntry(Pair.of(wavelet.getSourceInstance(), waveletName), ImportSharingMode.SHARED) || importsInProgress.containsEntry(Pair.of(wavelet.getSourceInstance(), waveletName), ImportSharingMode.PRIVATE_UNLESS_PARTICIPANT), wavelet.getSharedLocalId() == null ? null : wavelet.getSharedLocalId().getId(), wavelet.getSharedLocalId() == null ? null : makeLocalWaveLink(wavelet.getSharedLocalId()))); }/*w w w . j av a2 s . c om*/ return out.build(); }
From source file:com.gs.fw.common.mithra.test.cacheloader.PYETopLevelLoaderFactory.java
License:Apache License
protected Timestamp shiftBusinessDate(Timestamp businessDate) { LocalDate localDate = new LocalDate(businessDate); int year = localDate.getYear(); LocalDateTime pye = new LocalDateTime(year - 1, 12, 31, 23, 59, 0, 0); int dayOfWeek = pye.dayOfWeek().get(); if (dayOfWeek > 5) { pye = pye.minusDays(dayOfWeek - 5); }/*from w w w . j ava2 s . co m*/ return new Timestamp(pye.toDateTime().getMillis()); }
From source file:com.gst.accounting.closure.service.GLClosureWritePlatformServiceJpaRepositoryImpl.java
License:Apache License
/** * @param command//w ww . j ava 2 s . c om * @param dve */ private void handleGLClosureIntegrityIssues(final JsonCommand command, final DataIntegrityViolationException dve) { final Throwable realCause = dve.getMostSpecificCause(); if (realCause.getMessage().contains("office_id_closing_date")) { throw new GLClosureDuplicateException( command.longValueOfParameterNamed(GLClosureJsonInputParams.OFFICE_ID.getValue()), new LocalDate( command.DateValueOfParameterNamed(GLClosureJsonInputParams.CLOSING_DATE.getValue()))); } logger.error(dve.getMessage(), dve); throw new PlatformDataIntegrityException("error.msg.glClosure.unknown.data.integrity.issue", "Unknown data integrity issue with resource GL Closure: " + realCause.getMessage()); }
From source file:com.gst.infrastructure.campaigns.sms.domain.SmsCampaign.java
License:Apache License
public LocalDate getSubmittedOnDate() { return (LocalDate) ObjectUtils.defaultIfNull(new LocalDate(this.submittedOnDate), null); }
From source file:com.gst.infrastructure.campaigns.sms.domain.SmsCampaign.java
License:Apache License
public LocalDate getClosureDate() { return (LocalDate) ObjectUtils.defaultIfNull(new LocalDate(this.closureDate), null); }
From source file:com.gst.infrastructure.campaigns.sms.domain.SmsCampaign.java
License:Apache License
public LocalDate getRecurrenceStartDate() { return (LocalDate) ObjectUtils.defaultIfNull(new LocalDate(this.recurrenceStartDate), null); }
From source file:com.gst.infrastructure.campaigns.sms.domain.SmsCampaign.java
License:Apache License
public LocalDate getLastTriggerDate() { return (LocalDate) ObjectUtils.defaultIfNull(new LocalDate(this.lastTriggerDate), null); }
From source file:com.gst.infrastructure.core.domain.JdbcSupport.java
License:Apache License
public static LocalDate getLocalDate(final ResultSet rs, final String columnName) throws SQLException { LocalDate localDate = null;//from ww w .j ava 2 s . c om final Date dateValue = rs.getDate(columnName); if (dateValue != null) { localDate = new LocalDate(dateValue); } return localDate; }