Skip to content
This repository has been archived by the owner on Aug 30, 2024. It is now read-only.

Commit

Permalink
Resource filtering by timestamp at query time - EUCA-4744
Browse files Browse the repository at this point in the history
Timestamp parsing is fixed (EUCA-4743) so database filters for date
properties can be enabled.

EUCA-4744
  • Loading branch information
sjones4 committed Jan 29, 2013
1 parent dd102a2 commit 8d4b0d3
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ public SnapshotFilterSupport() {
.withPersistenceFilter( "owner-id", "ownerAccountNumber" )
//.withPersistenceFilter( "progress" ) //TODO:STEVE: Not working, problem with % escaping?
.withPersistenceFilter( "snapshot-id", "displayName" )
//.withPersistenceFilter( "start-time", "creationTimestamp", PersistenceFilter.Type.Date ) //TODO:STEVE: Not working, fails to match due to dropped millis? (lost by timestamps parser)
.withPersistenceFilter( "start-time", "creationTimestamp", PersistenceFilter.Type.Date )
.withPersistenceFilter( "volume-id", "parentVolume" )
.withPersistenceFilter( "volume-size", "volumeSize", PersistenceFilter.Type.Integer )
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ public VolumeFilterSupport(){
.withStringProperty("volume-id", FilterStringFunctions.VOLUME_ID)
.withConstantProperty("volume-type", "standard")
.withPersistenceFilter( "availability-zone", "partition" )
//.withPersistenceFilter( "create-time", "creationTimestamp", PersistenceFilter.Type.Date ) //TODO:STEVE: Not working, fails to match due to dropped millis? (lost by timestamps parser)
.withPersistenceFilter( "create-time", "creationTimestamp", PersistenceFilter.Type.Date )
.withPersistenceFilter( "size", "size", PersistenceFilter.Type.Integer )
.withPersistenceFilter( "snapshot-id", "parentSnapshot" )
.withPersistenceFilter( "volume-id", "displayName" ) );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -970,7 +970,7 @@ public java.util.Date apply( final String textValue ) {
boolean matches( final Object targetValue, final Object resourceValue ) {
boolean match = false;
if ( resourceValue instanceof Date && targetValue instanceof Date ) {
match = (((Date) resourceValue).getTime()/1000L) == (((Date) targetValue).getTime()/1000L); //TODO:STEVE: match to second only?
match = ((Date) resourceValue).getTime() == ((Date) targetValue).getTime();
}
return match;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1000,7 +1000,7 @@ public VmInstanceFilterSupport() {
.withPersistenceFilter( "instance-type", "vmType.name", Sets.newHashSet("bootRecord.vmType") )
.withPersistenceFilter( "kernel-id", "image.kernelId", Sets.newHashSet("bootRecord.machineImage") )
.withPersistenceFilter( "launch-index", "launchRecord.launchIndex", Collections.<String>emptySet(), PersistenceFilter.Type.Integer )
//.withPersistenceFilter( "launch-time", "launchRecord.launchTime", Collections.<String>emptySet(), PersistenceFilter.Type.Date ) //TODO:STEVE: Not working, fails to match due to dropped millis? (lost by timestamps parser)
.withPersistenceFilter( "launch-time", "launchRecord.launchTime", Collections.<String>emptySet(), PersistenceFilter.Type.Date )
.withPersistenceFilter( "owner-id", "ownerAccountNumber" )
.withPersistenceFilter( "ramdisk-id", "image.ramdiskId", Sets.newHashSet("bootRecord.machineImage") )
.withPersistenceFilter( "reservation-id", "vmId.reservationId", Collections.<String>emptySet() )
Expand Down Expand Up @@ -1044,9 +1044,9 @@ public VmBundleTaskFilterSupport() {
.withPersistenceFilter( "progress", "runtimeState.bundleTask.progress", Collections.<String>emptySet(), ProgressToInteger.INSTANCE )
.withPersistenceFilter( "s3-bucket", "runtimeState.bundleTask.bucket", Collections.<String>emptySet() )
.withPersistenceFilter( "s3-prefix", "runtimeState.bundleTask.prefix", Collections.<String>emptySet() )
//.withPersistenceFilter( "start-time", "runtimeState.bundleTask.startTime", Collections.<String>emptySet(), PersistenceFilter.Type.Date ) //TODO:STEVE: Not working, fails to match due to dropped millis? (lost by timestamps parser)
.withPersistenceFilter( "start-time", "runtimeState.bundleTask.startTime", Collections.<String>emptySet(), PersistenceFilter.Type.Date )
.withPersistenceFilter( "state", "runtimeState.bundleTask.state", Collections.<String>emptySet(), Enums.valueOfFunction( VmBundleTask.BundleState.class ) )
//.withPersistenceFilter( "update-time", "runtimeState.bundleTask.updateTime", Collections.<String>emptySet(), PersistenceFilter.Type.Date ) //TODO:STEVE: Not working, fails to match due to dropped millis? (lost by timestamps parser)
.withPersistenceFilter( "update-time", "runtimeState.bundleTask.updateTime", Collections.<String>emptySet(), PersistenceFilter.Type.Date )
);
}
}
Expand Down

0 comments on commit 8d4b0d3

Please sign in to comment.