Refine search
private static boolean checkParseCompressedIso8601Date() throws ParseException { Date date = new Date(); SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd'T'HHmmss'Z'"); sdf.setTimeZone(new SimpleTimeZone(0, "GMT")); String formatted = sdf.format(date); Date expected = sdf.parse(formatted); Date actual = new Date(DateUtils.compressedIso8601DateFormat.parseMillis(formatted)); return expected.equals(actual); }
private static List<String> dateStrBetweenDates(Long startdatems, Long enddatems) { List<String> dates = new ArrayList<String>(); Calendar calendar = new GregorianCalendar(); Date startdate = new Date(startdatems); Date enddate = new Date(enddatems); calendar.setTime(startdate); while (calendar.getTime().before(enddate) || calendar.getTime().equals(enddate)) { Date result = calendar.getTime(); dates.add(dateStr(result)); calendar.add(Calendar.DATE, 1); } return dates; }
@Override public List<Date> collectLogic() throws Exception { List<Date> dates = new ArrayList<>(); Calendar calendar = Calendar.getInstance(); StringBuilder builder = new StringBuilder(); for (Date i = from; i.before(to) || i.equals(to); ) { dates.add(i); calendar.setTime(i); builder.delete(0, builder.length()); calendar.add(Calendar.DATE, 1); i = calendar.getTime(); } return dates; }
if (other.getDeploymentGroups() == null ^ this.getDeploymentGroups() == null) return false; if (other.getDeploymentGroups() != null && other.getDeploymentGroups().equals(this.getDeploymentGroups()) == false) return false; if (other.getFirstUsedTime() == null ^ this.getFirstUsedTime() == null) return false; if (other.getFirstUsedTime() != null && other.getFirstUsedTime().equals(this.getFirstUsedTime()) == false) return false; if (other.getLastUsedTime() == null ^ this.getLastUsedTime() == null) return false; if (other.getLastUsedTime() != null && other.getLastUsedTime().equals(this.getLastUsedTime()) == false) return false; if (other.getRegisterTime() == null ^ this.getRegisterTime() == null) return false; if (other.getRegisterTime() != null && other.getRegisterTime().equals(this.getRegisterTime()) == false) return false; return true;
if (other.getDeviceAttributes() == null ^ this.getDeviceAttributes() == null) return false; if (other.getDeviceAttributes() != null && other.getDeviceAttributes().equals(this.getDeviceAttributes()) == false) return false; if (other.getDeviceCreateDate() == null ^ this.getDeviceCreateDate() == null) return false; if (other.getDeviceCreateDate() != null && other.getDeviceCreateDate().equals(this.getDeviceCreateDate()) == false) return false; if (other.getDeviceLastModifiedDate() == null ^ this.getDeviceLastModifiedDate() == null) return false; if (other.getDeviceLastModifiedDate() != null && other.getDeviceLastModifiedDate().equals(this.getDeviceLastModifiedDate()) == false) return false; if (other.getDeviceLastAuthenticatedDate() == null ^ this.getDeviceLastAuthenticatedDate() == null) return false; if (other.getDeviceLastAuthenticatedDate() != null && other.getDeviceLastAuthenticatedDate().equals(this.getDeviceLastAuthenticatedDate()) == false) return false; return true;
private static boolean checkParseRfc822Date() throws ParseException { Date date = new Date(); SimpleDateFormat sdf = new SimpleDateFormat( "EEE, dd MMM yyyy HH:mm:ss z", Locale.US); sdf.setTimeZone(new SimpleTimeZone(0, "GMT")); String formatted = sdf.format(date); Date expected = sdf.parse(formatted); Date actual2 = new Date(DateUtils.rfc822DateFormat.parseMillis(formatted)); return expected.equals(actual2); }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof ListClustersRequest == false) return false; ListClustersRequest other = (ListClustersRequest) obj; if (other.getCreatedAfter() == null ^ this.getCreatedAfter() == null) return false; if (other.getCreatedAfter() != null && other.getCreatedAfter().equals(this.getCreatedAfter()) == false) return false; if (other.getCreatedBefore() == null ^ this.getCreatedBefore() == null) return false; if (other.getCreatedBefore() != null && other.getCreatedBefore().equals(this.getCreatedBefore()) == false) return false; if (other.getClusterStates() == null ^ this.getClusterStates() == null) return false; if (other.getClusterStates() != null && other.getClusterStates().equals(this.getClusterStates()) == false) return false; if (other.getMarker() == null ^ this.getMarker() == null) return false; if (other.getMarker() != null && other.getMarker().equals(this.getMarker()) == false) return false; return true; }
private static boolean checkFormatRfc822Date() throws ParseException { Date date = new Date(); SimpleDateFormat sdf = new SimpleDateFormat( "EEE, dd MMM yyyy HH:mm:ss z", Locale.US); sdf.setTimeZone(new SimpleTimeZone(0, "GMT")); String expected = sdf.format(date); String actual = DateUtils.rfc822DateFormat.print(date.getTime()); if (expected.equals(actual)) { Date expectedDate = sdf.parse(expected); Date actualDate2 = new Date(DateUtils.rfc822DateFormat.parseMillis(actual)); return expectedDate.equals(actualDate2); } return false; }
@Override public Iterator<AbstractBackupPath> list(String bucket, Date start, Date till) { String[] paths = bucket.split(String.valueOf(RemoteBackupPath.PATH_SEP)); if (paths.length > 1) { baseDir = paths[1]; region = paths[2]; clusterName = paths[3]; } List<AbstractBackupPath> tmpList = new ArrayList<>(); for (AbstractBackupPath path : flist) { if ((path.time.after(start) && path.time.before(till)) || path.time.equals(start) && path.baseDir.equals(baseDir) && path.clusterName.equals(clusterName) && path.region.equals(region)) { tmpList.add(path); } } return tmpList.iterator(); }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof SecretVersionsListEntry == false) return false; SecretVersionsListEntry other = (SecretVersionsListEntry) obj; if (other.getVersionId() == null ^ this.getVersionId() == null) return false; if (other.getVersionId() != null && other.getVersionId().equals(this.getVersionId()) == false) return false; if (other.getVersionStages() == null ^ this.getVersionStages() == null) return false; if (other.getVersionStages() != null && other.getVersionStages().equals(this.getVersionStages()) == false) return false; if (other.getLastAccessedDate() == null ^ this.getLastAccessedDate() == null) return false; if (other.getLastAccessedDate() != null && other.getLastAccessedDate().equals(this.getLastAccessedDate()) == false) return false; if (other.getCreatedDate() == null ^ this.getCreatedDate() == null) return false; if (other.getCreatedDate() != null && other.getCreatedDate().equals(this.getCreatedDate()) == false) return false; return true; }
private static boolean checkParseIso8601Date() throws ParseException { Date date = new Date(); SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); sdf.setTimeZone(new SimpleTimeZone(0, "GMT")); String formatted = sdf.format(date); String alternative = DateUtils.iso8601DateFormat.print(date.getTime()); if (formatted.equals(alternative)) { Date expectedDate = sdf.parse(formatted); Date actualDate = DateUtils.doParseISO8601Date(formatted); return expectedDate.equals(actualDate); } return false; }
@Override public Iterator<AbstractBackupPath> list(String path, Date start, Date till) { String prefix = pathProvider.get().remotePrefix(start, till, path); Iterator<String> fileIterator = listFileSystem(prefix, null, null); @SuppressWarnings("unchecked") TransformIterator<String, AbstractBackupPath> transformIterator = new TransformIterator( fileIterator, remotePath -> { AbstractBackupPath abstractBackupPath = pathProvider.get(); abstractBackupPath.parseRemote(remotePath.toString()); return abstractBackupPath; }); return new FilterIterator<>( transformIterator, abstractBackupPath -> (abstractBackupPath.getTime().after(start) && abstractBackupPath.getTime().before(till)) || abstractBackupPath.getTime().equals(start)); }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof DescribeIdentityResult == false) return false; DescribeIdentityResult other = (DescribeIdentityResult) obj; if (other.getIdentityId() == null ^ this.getIdentityId() == null) return false; if (other.getIdentityId() != null && other.getIdentityId().equals(this.getIdentityId()) == false) return false; if (other.getLogins() == null ^ this.getLogins() == null) return false; if (other.getLogins() != null && other.getLogins().equals(this.getLogins()) == false) return false; if (other.getCreationDate() == null ^ this.getCreationDate() == null) return false; if (other.getCreationDate() != null && other.getCreationDate().equals(this.getCreationDate()) == false) return false; if (other.getLastModifiedDate() == null ^ this.getLastModifiedDate() == null) return false; if (other.getLastModifiedDate() != null && other.getLastModifiedDate().equals(this.getLastModifiedDate()) == false) return false; return true; }
private static boolean checkFormatIso8601Date() throws ParseException { Date date = new Date(); SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); sdf.setTimeZone(new SimpleTimeZone(0, "GMT")); String expected = sdf.format(date); String actual = DateUtils.iso8601DateFormat.print(date.getTime()); if (expected.equals(actual)) { Date expectedDate = sdf.parse(expected); Date actualDate = DateUtils.doParseISO8601Date(actual); return expectedDate.equals(actualDate); } return false; }
private boolean isOverlapping(TimelineEvent event1, TimelineEvent event2) { if (event1.getEndDate() == null && event2.getEndDate() == null) { return event1.getStartDate().equals(event2.getStartDate()); } else if (event1.getEndDate() == null && event2.getEndDate() != null) { return (event1.getStartDate().equals(event2.getStartDate()) || event1.getStartDate().equals(event2.getEndDate()) || (event1.getStartDate().after(event2.getStartDate()) && event1.getStartDate().before(event2.getEndDate()))); } else if (event1.getEndDate() != null && event2.getEndDate() == null) { return (event2.getStartDate().equals(event1.getStartDate()) || event2.getStartDate().equals(event1.getEndDate()) || (event2.getStartDate().after(event1.getStartDate()) && event2.getStartDate().before(event1.getEndDate()))); } else { // check with ODER if // 1. start date of the event 1 is within the event 2 // 2. end date of the event 1 is within the event 2 // 3. event 2 is completely strong within the event 1 return (event1.getStartDate().equals(event2.getStartDate()) || event1.getStartDate().equals(event2.getEndDate()) || (event1.getStartDate().after(event2.getStartDate()) && event1.getStartDate().before(event2.getEndDate()))) || (event1.getEndDate().equals(event2.getStartDate()) || event1.getEndDate().equals(event2.getEndDate()) || (event1.getEndDate().after(event2.getStartDate()) && event1.getEndDate().before(event2.getEndDate()))) || (event1.getStartDate().before(event2.getStartDate()) && event1.getEndDate().after(event2.getEndDate())); } } }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof StartExportTaskRequest == false) return false; StartExportTaskRequest other = (StartExportTaskRequest) obj; if (other.getExportDataFormat() == null ^ this.getExportDataFormat() == null) return false; if (other.getExportDataFormat() != null && other.getExportDataFormat().equals(this.getExportDataFormat()) == false) return false; if (other.getFilters() == null ^ this.getFilters() == null) return false; if (other.getFilters() != null && other.getFilters().equals(this.getFilters()) == false) return false; if (other.getStartTime() == null ^ this.getStartTime() == null) return false; if (other.getStartTime() != null && other.getStartTime().equals(this.getStartTime()) == false) return false; if (other.getEndTime() == null ^ this.getEndTime() == null) return false; if (other.getEndTime() != null && other.getEndTime().equals(this.getEndTime()) == false) return false; return true; }
private static boolean checkParseIso8601DateUsingAlternativeFormat() throws ParseException { Date date = new Date(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); sdf.setTimeZone(new SimpleTimeZone(0, "GMT")); String formatted = sdf.format(date); String alternative = DateUtils.alternateIso8601DateFormat.print(date .getTime()); if (formatted.equals(alternative)) { Date expectedDate = sdf.parse(formatted); Date actualDate = DateUtils.parseISO8601Date(formatted); return expectedDate.equals(actualDate); } return false; }
@Override public int compare(TimelineEvent a, TimelineEvent b) { if (a.getStartDate().equals(b.getStartDate())) { if (a.getEndDate() == null && b.getEndDate() == null) { return 0; } else if (a.getEndDate() == null) { return -1; } else if (b.getEndDate() == null) { return 1; } else { return (a.getEndDate().before(b.getEndDate()) ? -1 : 1); } } else { return (a.getStartDate().before(b.getStartDate()) ? -1 : 1); } } }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof DescribeJobFlowsRequest == false) return false; DescribeJobFlowsRequest other = (DescribeJobFlowsRequest) obj; if (other.getCreatedAfter() == null ^ this.getCreatedAfter() == null) return false; if (other.getCreatedAfter() != null && other.getCreatedAfter().equals(this.getCreatedAfter()) == false) return false; if (other.getCreatedBefore() == null ^ this.getCreatedBefore() == null) return false; if (other.getCreatedBefore() != null && other.getCreatedBefore().equals(this.getCreatedBefore()) == false) return false; if (other.getJobFlowIds() == null ^ this.getJobFlowIds() == null) return false; if (other.getJobFlowIds() != null && other.getJobFlowIds().equals(this.getJobFlowIds()) == false) return false; if (other.getJobFlowStates() == null ^ this.getJobFlowStates() == null) return false; if (other.getJobFlowStates() != null && other.getJobFlowStates().equals(this.getJobFlowStates()) == false) return false; return true; }