You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ma...@apache.org on 2021/06/11 22:01:12 UTC
[airavata] 02/02: AIRAVATA-3322 Add pagination to
getExperimentStatistics
This is an automated email from the ASF dual-hosted git repository.
machristie pushed a commit to branch airavata-3322
in repository https://gitbox.apache.org/repos/asf/airavata.git
commit a0aeba89b0c51ffbe1899766e0a1abc07617676c
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Fri Jun 11 18:00:45 2021 -0400
AIRAVATA-3322 Add pagination to getExperimentStatistics
---
.../api/server/handler/AiravataServerHandler.java | 4 +-
.../java/org/apache/airavata/api/Airavata.java | 236 ++++++++++++++++++--
.../expcatalog/ExperimentSummaryRepository.java | 20 +-
.../ExperimentSummaryRepositoryTest.java | 28 ++-
.../api/service/handler/RegistryServerHandler.java | 7 +-
.../airavata/registry/api/RegistryService.java | 241 +++++++++++++++++++--
.../airavata-apis/airavata_api.thrift | 10 +-
.../component-cpis/registry-api.thrift | 11 +-
8 files changed, 508 insertions(+), 49 deletions(-)
diff --git a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
index a5e1894..6b86d01 100644
--- a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
+++ b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
@@ -1249,7 +1249,7 @@ public class AiravataServerHandler implements Airavata.Iface {
@Override
@SecurityCheck
public ExperimentStatistics getExperimentStatistics(AuthzToken authzToken, String gatewayId, long fromTime, long toTime,
- String userName, String applicationName, String resourceHostName)
+ String userName, String applicationName, String resourceHostName, int limit, int offset)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException, TException {
RegistryService.Client regClient = registryClientPool.getResource();
// SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
@@ -1278,7 +1278,7 @@ public class AiravataServerHandler implements Airavata.Iface {
// userId + "@" + gatewayId, sharingFilters, 0, Integer.MAX_VALUE).forEach(e -> accessibleExpIds.add(e.getEntityId()));
List<String> accessibleExpIds = null;
- ExperimentStatistics result = regClient.getExperimentStatistics(gatewayId, fromTime, toTime, userName, applicationName, resourceHostName, accessibleExpIds);
+ ExperimentStatistics result = regClient.getExperimentStatistics(gatewayId, fromTime, toTime, userName, applicationName, resourceHostName, accessibleExpIds, limit, offset);
registryClientPool.returnResource(regClient);
// sharingClientPool.returnResource(sharingClient);
return result;
diff --git a/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/api/Airavata.java b/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/api/Airavata.java
index bd46d89..caff1bb 100644
--- a/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/api/Airavata.java
+++ b/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/api/Airavata.java
@@ -408,6 +408,12 @@ public class Airavata {
* @param resourceHostName
* Hostname id substring with which to further filter statistics.
*
+ * @param limit
+ * Amount of results to be fetched.
+ *
+ * @param offset
+ * The starting point of the results to be fetched.
+ *
*
*
* @param authzToken
@@ -417,8 +423,10 @@ public class Airavata {
* @param userName
* @param applicationName
* @param resourceHostName
+ * @param limit
+ * @param offset
*/
- public org.apache.airavata.model.experiment.ExperimentStatistics getExperimentStatistics(org.apache.airavata.model.security.AuthzToken authzToken, java.lang.String gatewayId, long fromTime, long toTime, java.lang.String userName, java.lang.String applicationName, java.lang.String resourceHostName) throws org.apache.airavata.model.error.InvalidRequestException, org.apache.airavata.model.error.AiravataClientException, org.apache.airavata.model.error.AiravataSystemException, org.apache. [...]
+ public org.apache.airavata.model.experiment.ExperimentStatistics getExperimentStatistics(org.apache.airavata.model.security.AuthzToken authzToken, java.lang.String gatewayId, long fromTime, long toTime, java.lang.String userName, java.lang.String applicationName, java.lang.String resourceHostName, int limit, int offset) throws org.apache.airavata.model.error.InvalidRequestException, org.apache.airavata.model.error.AiravataClientException, org.apache.airavata.model.error.AiravataSyste [...]
/**
*
@@ -3056,7 +3064,7 @@ public class Airavata {
public void searchExperiments(org.apache.airavata.model.security.AuthzToken authzToken, java.lang.String gatewayId, java.lang.String userName, java.util.Map<org.apache.airavata.model.experiment.ExperimentSearchFields,java.lang.String> filters, int limit, int offset, org.apache.thrift.async.AsyncMethodCallback<java.util.List<org.apache.airavata.model.experiment.ExperimentSummaryModel>> resultHandler) throws org.apache.thrift.TException;
- public void getExperimentStatistics(org.apache.airavata.model.security.AuthzToken authzToken, java.lang.String gatewayId, long fromTime, long toTime, java.lang.String userName, java.lang.String applicationName, java.lang.String resourceHostName, org.apache.thrift.async.AsyncMethodCallback<org.apache.airavata.model.experiment.ExperimentStatistics> resultHandler) throws org.apache.thrift.TException;
+ public void getExperimentStatistics(org.apache.airavata.model.security.AuthzToken authzToken, java.lang.String gatewayId, long fromTime, long toTime, java.lang.String userName, java.lang.String applicationName, java.lang.String resourceHostName, int limit, int offset, org.apache.thrift.async.AsyncMethodCallback<org.apache.airavata.model.experiment.ExperimentStatistics> resultHandler) throws org.apache.thrift.TException;
public void getExperimentsInProject(org.apache.airavata.model.security.AuthzToken authzToken, java.lang.String projectId, int limit, int offset, org.apache.thrift.async.AsyncMethodCallback<java.util.List<org.apache.airavata.model.experiment.ExperimentModel>> resultHandler) throws org.apache.thrift.TException;
@@ -4359,13 +4367,13 @@ public class Airavata {
throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "searchExperiments failed: unknown result");
}
- public org.apache.airavata.model.experiment.ExperimentStatistics getExperimentStatistics(org.apache.airavata.model.security.AuthzToken authzToken, java.lang.String gatewayId, long fromTime, long toTime, java.lang.String userName, java.lang.String applicationName, java.lang.String resourceHostName) throws org.apache.airavata.model.error.InvalidRequestException, org.apache.airavata.model.error.AiravataClientException, org.apache.airavata.model.error.AiravataSystemException, org.apache. [...]
+ public org.apache.airavata.model.experiment.ExperimentStatistics getExperimentStatistics(org.apache.airavata.model.security.AuthzToken authzToken, java.lang.String gatewayId, long fromTime, long toTime, java.lang.String userName, java.lang.String applicationName, java.lang.String resourceHostName, int limit, int offset) throws org.apache.airavata.model.error.InvalidRequestException, org.apache.airavata.model.error.AiravataClientException, org.apache.airavata.model.error.AiravataSyste [...]
{
- send_getExperimentStatistics(authzToken, gatewayId, fromTime, toTime, userName, applicationName, resourceHostName);
+ send_getExperimentStatistics(authzToken, gatewayId, fromTime, toTime, userName, applicationName, resourceHostName, limit, offset);
return recv_getExperimentStatistics();
}
- public void send_getExperimentStatistics(org.apache.airavata.model.security.AuthzToken authzToken, java.lang.String gatewayId, long fromTime, long toTime, java.lang.String userName, java.lang.String applicationName, java.lang.String resourceHostName) throws org.apache.thrift.TException
+ public void send_getExperimentStatistics(org.apache.airavata.model.security.AuthzToken authzToken, java.lang.String gatewayId, long fromTime, long toTime, java.lang.String userName, java.lang.String applicationName, java.lang.String resourceHostName, int limit, int offset) throws org.apache.thrift.TException
{
getExperimentStatistics_args args = new getExperimentStatistics_args();
args.setAuthzToken(authzToken);
@@ -4375,6 +4383,8 @@ public class Airavata {
args.setUserName(userName);
args.setApplicationName(applicationName);
args.setResourceHostName(resourceHostName);
+ args.setLimit(limit);
+ args.setOffset(offset);
sendBase("getExperimentStatistics", args);
}
@@ -11418,9 +11428,9 @@ public class Airavata {
}
}
- public void getExperimentStatistics(org.apache.airavata.model.security.AuthzToken authzToken, java.lang.String gatewayId, long fromTime, long toTime, java.lang.String userName, java.lang.String applicationName, java.lang.String resourceHostName, org.apache.thrift.async.AsyncMethodCallback<org.apache.airavata.model.experiment.ExperimentStatistics> resultHandler) throws org.apache.thrift.TException {
+ public void getExperimentStatistics(org.apache.airavata.model.security.AuthzToken authzToken, java.lang.String gatewayId, long fromTime, long toTime, java.lang.String userName, java.lang.String applicationName, java.lang.String resourceHostName, int limit, int offset, org.apache.thrift.async.AsyncMethodCallback<org.apache.airavata.model.experiment.ExperimentStatistics> resultHandler) throws org.apache.thrift.TException {
checkReady();
- getExperimentStatistics_call method_call = new getExperimentStatistics_call(authzToken, gatewayId, fromTime, toTime, userName, applicationName, resourceHostName, resultHandler, this, ___protocolFactory, ___transport);
+ getExperimentStatistics_call method_call = new getExperimentStatistics_call(authzToken, gatewayId, fromTime, toTime, userName, applicationName, resourceHostName, limit, offset, resultHandler, this, ___protocolFactory, ___transport);
this.___currentMethod = method_call;
___manager.call(method_call);
}
@@ -11433,7 +11443,9 @@ public class Airavata {
private java.lang.String userName;
private java.lang.String applicationName;
private java.lang.String resourceHostName;
- public getExperimentStatistics_call(org.apache.airavata.model.security.AuthzToken authzToken, java.lang.String gatewayId, long fromTime, long toTime, java.lang.String userName, java.lang.String applicationName, java.lang.String resourceHostName, org.apache.thrift.async.AsyncMethodCallback<org.apache.airavata.model.experiment.ExperimentStatistics> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrif [...]
+ private int limit;
+ private int offset;
+ public getExperimentStatistics_call(org.apache.airavata.model.security.AuthzToken authzToken, java.lang.String gatewayId, long fromTime, long toTime, java.lang.String userName, java.lang.String applicationName, java.lang.String resourceHostName, int limit, int offset, org.apache.thrift.async.AsyncMethodCallback<org.apache.airavata.model.experiment.ExperimentStatistics> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFa [...]
super(client, protocolFactory, transport, resultHandler, false);
this.authzToken = authzToken;
this.gatewayId = gatewayId;
@@ -11442,6 +11454,8 @@ public class Airavata {
this.userName = userName;
this.applicationName = applicationName;
this.resourceHostName = resourceHostName;
+ this.limit = limit;
+ this.offset = offset;
}
public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
@@ -11454,6 +11468,8 @@ public class Airavata {
args.setUserName(userName);
args.setApplicationName(applicationName);
args.setResourceHostName(resourceHostName);
+ args.setLimit(limit);
+ args.setOffset(offset);
args.write(prot);
prot.writeMessageEnd();
}
@@ -18571,7 +18587,7 @@ public class Airavata {
public getExperimentStatistics_result getResult(I iface, getExperimentStatistics_args args) throws org.apache.thrift.TException {
getExperimentStatistics_result result = new getExperimentStatistics_result();
try {
- result.success = iface.getExperimentStatistics(args.authzToken, args.gatewayId, args.fromTime, args.toTime, args.userName, args.applicationName, args.resourceHostName);
+ result.success = iface.getExperimentStatistics(args.authzToken, args.gatewayId, args.fromTime, args.toTime, args.userName, args.applicationName, args.resourceHostName, args.limit, args.offset);
} catch (org.apache.airavata.model.error.InvalidRequestException ire) {
result.ire = ire;
} catch (org.apache.airavata.model.error.AiravataClientException ace) {
@@ -25876,7 +25892,7 @@ public class Airavata {
}
public void start(I iface, getExperimentStatistics_args args, org.apache.thrift.async.AsyncMethodCallback<org.apache.airavata.model.experiment.ExperimentStatistics> resultHandler) throws org.apache.thrift.TException {
- iface.getExperimentStatistics(args.authzToken, args.gatewayId, args.fromTime, args.toTime, args.userName, args.applicationName, args.resourceHostName,resultHandler);
+ iface.getExperimentStatistics(args.authzToken, args.gatewayId, args.fromTime, args.toTime, args.userName, args.applicationName, args.resourceHostName, args.limit, args.offset,resultHandler);
}
}
@@ -73247,6 +73263,8 @@ public class Airavata {
private static final org.apache.thrift.protocol.TField USER_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("userName", org.apache.thrift.protocol.TType.STRING, (short)5);
private static final org.apache.thrift.protocol.TField APPLICATION_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("applicationName", org.apache.thrift.protocol.TType.STRING, (short)6);
private static final org.apache.thrift.protocol.TField RESOURCE_HOST_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("resourceHostName", org.apache.thrift.protocol.TType.STRING, (short)7);
+ private static final org.apache.thrift.protocol.TField LIMIT_FIELD_DESC = new org.apache.thrift.protocol.TField("limit", org.apache.thrift.protocol.TType.I32, (short)8);
+ private static final org.apache.thrift.protocol.TField OFFSET_FIELD_DESC = new org.apache.thrift.protocol.TField("offset", org.apache.thrift.protocol.TType.I32, (short)9);
private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new getExperimentStatistics_argsStandardSchemeFactory();
private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new getExperimentStatistics_argsTupleSchemeFactory();
@@ -73258,6 +73276,8 @@ public class Airavata {
public java.lang.String userName; // required
public java.lang.String applicationName; // required
public java.lang.String resourceHostName; // required
+ public int limit; // required
+ public int offset; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
@@ -73267,7 +73287,9 @@ public class Airavata {
TO_TIME((short)4, "toTime"),
USER_NAME((short)5, "userName"),
APPLICATION_NAME((short)6, "applicationName"),
- RESOURCE_HOST_NAME((short)7, "resourceHostName");
+ RESOURCE_HOST_NAME((short)7, "resourceHostName"),
+ LIMIT((short)8, "limit"),
+ OFFSET((short)9, "offset");
private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>();
@@ -73296,6 +73318,10 @@ public class Airavata {
return APPLICATION_NAME;
case 7: // RESOURCE_HOST_NAME
return RESOURCE_HOST_NAME;
+ case 8: // LIMIT
+ return LIMIT;
+ case 9: // OFFSET
+ return OFFSET;
default:
return null;
}
@@ -73338,6 +73364,8 @@ public class Airavata {
// isset id assignments
private static final int __FROMTIME_ISSET_ID = 0;
private static final int __TOTIME_ISSET_ID = 1;
+ private static final int __LIMIT_ISSET_ID = 2;
+ private static final int __OFFSET_ISSET_ID = 3;
private byte __isset_bitfield = 0;
public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
@@ -73356,6 +73384,10 @@ public class Airavata {
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.RESOURCE_HOST_NAME, new org.apache.thrift.meta_data.FieldMetaData("resourceHostName", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+ tmpMap.put(_Fields.LIMIT, new org.apache.thrift.meta_data.FieldMetaData("limit", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
+ tmpMap.put(_Fields.OFFSET, new org.apache.thrift.meta_data.FieldMetaData("offset", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getExperimentStatistics_args.class, metaDataMap);
}
@@ -73370,7 +73402,9 @@ public class Airavata {
long toTime,
java.lang.String userName,
java.lang.String applicationName,
- java.lang.String resourceHostName)
+ java.lang.String resourceHostName,
+ int limit,
+ int offset)
{
this();
this.authzToken = authzToken;
@@ -73382,6 +73416,10 @@ public class Airavata {
this.userName = userName;
this.applicationName = applicationName;
this.resourceHostName = resourceHostName;
+ this.limit = limit;
+ setLimitIsSet(true);
+ this.offset = offset;
+ setOffsetIsSet(true);
}
/**
@@ -73406,6 +73444,8 @@ public class Airavata {
if (other.isSetResourceHostName()) {
this.resourceHostName = other.resourceHostName;
}
+ this.limit = other.limit;
+ this.offset = other.offset;
}
public getExperimentStatistics_args deepCopy() {
@@ -73423,6 +73463,10 @@ public class Airavata {
this.userName = null;
this.applicationName = null;
this.resourceHostName = null;
+ setLimitIsSet(false);
+ this.limit = 0;
+ setOffsetIsSet(false);
+ this.offset = 0;
}
public org.apache.airavata.model.security.AuthzToken getAuthzToken() {
@@ -73591,6 +73635,52 @@ public class Airavata {
}
}
+ public int getLimit() {
+ return this.limit;
+ }
+
+ public getExperimentStatistics_args setLimit(int limit) {
+ this.limit = limit;
+ setLimitIsSet(true);
+ return this;
+ }
+
+ public void unsetLimit() {
+ __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __LIMIT_ISSET_ID);
+ }
+
+ /** Returns true if field limit is set (has been assigned a value) and false otherwise */
+ public boolean isSetLimit() {
+ return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __LIMIT_ISSET_ID);
+ }
+
+ public void setLimitIsSet(boolean value) {
+ __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __LIMIT_ISSET_ID, value);
+ }
+
+ public int getOffset() {
+ return this.offset;
+ }
+
+ public getExperimentStatistics_args setOffset(int offset) {
+ this.offset = offset;
+ setOffsetIsSet(true);
+ return this;
+ }
+
+ public void unsetOffset() {
+ __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __OFFSET_ISSET_ID);
+ }
+
+ /** Returns true if field offset is set (has been assigned a value) and false otherwise */
+ public boolean isSetOffset() {
+ return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __OFFSET_ISSET_ID);
+ }
+
+ public void setOffsetIsSet(boolean value) {
+ __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __OFFSET_ISSET_ID, value);
+ }
+
public void setFieldValue(_Fields field, java.lang.Object value) {
switch (field) {
case AUTHZ_TOKEN:
@@ -73649,6 +73739,22 @@ public class Airavata {
}
break;
+ case LIMIT:
+ if (value == null) {
+ unsetLimit();
+ } else {
+ setLimit((java.lang.Integer)value);
+ }
+ break;
+
+ case OFFSET:
+ if (value == null) {
+ unsetOffset();
+ } else {
+ setOffset((java.lang.Integer)value);
+ }
+ break;
+
}
}
@@ -73675,6 +73781,12 @@ public class Airavata {
case RESOURCE_HOST_NAME:
return getResourceHostName();
+ case LIMIT:
+ return getLimit();
+
+ case OFFSET:
+ return getOffset();
+
}
throw new java.lang.IllegalStateException();
}
@@ -73700,6 +73812,10 @@ public class Airavata {
return isSetApplicationName();
case RESOURCE_HOST_NAME:
return isSetResourceHostName();
+ case LIMIT:
+ return isSetLimit();
+ case OFFSET:
+ return isSetOffset();
}
throw new java.lang.IllegalStateException();
}
@@ -73782,6 +73898,24 @@ public class Airavata {
return false;
}
+ boolean this_present_limit = true;
+ boolean that_present_limit = true;
+ if (this_present_limit || that_present_limit) {
+ if (!(this_present_limit && that_present_limit))
+ return false;
+ if (this.limit != that.limit)
+ return false;
+ }
+
+ boolean this_present_offset = true;
+ boolean that_present_offset = true;
+ if (this_present_offset || that_present_offset) {
+ if (!(this_present_offset && that_present_offset))
+ return false;
+ if (this.offset != that.offset)
+ return false;
+ }
+
return true;
}
@@ -73813,6 +73947,10 @@ public class Airavata {
if (isSetResourceHostName())
hashCode = hashCode * 8191 + resourceHostName.hashCode();
+ hashCode = hashCode * 8191 + limit;
+
+ hashCode = hashCode * 8191 + offset;
+
return hashCode;
}
@@ -73894,6 +74032,26 @@ public class Airavata {
return lastComparison;
}
}
+ lastComparison = java.lang.Boolean.valueOf(isSetLimit()).compareTo(other.isSetLimit());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetLimit()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.limit, other.limit);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = java.lang.Boolean.valueOf(isSetOffset()).compareTo(other.isSetOffset());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetOffset()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.offset, other.offset);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
return 0;
}
@@ -73961,6 +74119,14 @@ public class Airavata {
sb.append(this.resourceHostName);
}
first = false;
+ if (!first) sb.append(", ");
+ sb.append("limit:");
+ sb.append(this.limit);
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("offset:");
+ sb.append(this.offset);
+ first = false;
sb.append(")");
return sb.toString();
}
@@ -74074,6 +74240,22 @@ public class Airavata {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
+ case 8: // LIMIT
+ if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+ struct.limit = iprot.readI32();
+ struct.setLimitIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 9: // OFFSET
+ if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+ struct.offset = iprot.readI32();
+ struct.setOffsetIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
@@ -74126,6 +74308,12 @@ public class Airavata {
oprot.writeString(struct.resourceHostName);
oprot.writeFieldEnd();
}
+ oprot.writeFieldBegin(LIMIT_FIELD_DESC);
+ oprot.writeI32(struct.limit);
+ oprot.writeFieldEnd();
+ oprot.writeFieldBegin(OFFSET_FIELD_DESC);
+ oprot.writeI32(struct.offset);
+ oprot.writeFieldEnd();
oprot.writeFieldStop();
oprot.writeStructEnd();
}
@@ -74157,7 +74345,13 @@ public class Airavata {
if (struct.isSetResourceHostName()) {
optionals.set(2);
}
- oprot.writeBitSet(optionals, 3);
+ if (struct.isSetLimit()) {
+ optionals.set(3);
+ }
+ if (struct.isSetOffset()) {
+ optionals.set(4);
+ }
+ oprot.writeBitSet(optionals, 5);
if (struct.isSetUserName()) {
oprot.writeString(struct.userName);
}
@@ -74167,6 +74361,12 @@ public class Airavata {
if (struct.isSetResourceHostName()) {
oprot.writeString(struct.resourceHostName);
}
+ if (struct.isSetLimit()) {
+ oprot.writeI32(struct.limit);
+ }
+ if (struct.isSetOffset()) {
+ oprot.writeI32(struct.offset);
+ }
}
@Override
@@ -74181,7 +74381,7 @@ public class Airavata {
struct.setFromTimeIsSet(true);
struct.toTime = iprot.readI64();
struct.setToTimeIsSet(true);
- java.util.BitSet incoming = iprot.readBitSet(3);
+ java.util.BitSet incoming = iprot.readBitSet(5);
if (incoming.get(0)) {
struct.userName = iprot.readString();
struct.setUserNameIsSet(true);
@@ -74194,6 +74394,14 @@ public class Airavata {
struct.resourceHostName = iprot.readString();
struct.setResourceHostNameIsSet(true);
}
+ if (incoming.get(3)) {
+ struct.limit = iprot.readI32();
+ struct.setLimitIsSet(true);
+ }
+ if (incoming.get(4)) {
+ struct.offset = iprot.readI32();
+ struct.setOffsetIsSet(true);
+ }
}
}
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ExperimentSummaryRepository.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ExperimentSummaryRepository.java
index aa22c15..f6ab852 100644
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ExperimentSummaryRepository.java
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ExperimentSummaryRepository.java
@@ -155,7 +155,7 @@ public class ExperimentSummaryRepository extends ExpCatAbstractRepository<Experi
return experimentSummaryModelList;
}
- public ExperimentStatistics getAccessibleExperimentStatistics(List<String> accessibleExperimentIds, Map<String,String> filters) throws RegistryException {
+ public ExperimentStatistics getAccessibleExperimentStatistics(List<String> accessibleExperimentIds, Map<String,String> filters, int limit, int offset) throws RegistryException {
try {
@@ -209,7 +209,7 @@ public class ExperimentSummaryRepository extends ExpCatAbstractRepository<Experi
int allExperimentsCount = getExperimentStatisticsCountForState(null, gatewayId, fromDate, toDate,
userName, applicationName, resourceHostName, accessibleExperimentIds);
List<ExperimentSummaryModel> allExperiments = getExperimentStatisticsForState(null, gatewayId,
- fromDate, toDate, userName, applicationName, resourceHostName, accessibleExperimentIds);
+ fromDate, toDate, userName, applicationName, resourceHostName, accessibleExperimentIds, limit, offset);
experimentStatistics.setAllExperimentCount(allExperimentsCount);
experimentStatistics.setAllExperiments(allExperiments);
@@ -218,7 +218,7 @@ public class ExperimentSummaryRepository extends ExpCatAbstractRepository<Experi
createdStates, gatewayId, fromDate, toDate,
userName, applicationName, resourceHostName, accessibleExperimentIds);
List<ExperimentSummaryModel> createdExperiments = getExperimentStatisticsForState(createdStates, gatewayId,
- fromDate, toDate, userName, applicationName, resourceHostName, accessibleExperimentIds);
+ fromDate, toDate, userName, applicationName, resourceHostName, accessibleExperimentIds, limit, offset);
experimentStatistics.setCreatedExperimentCount(createdExperimentsCount);
experimentStatistics.setCreatedExperiments(createdExperiments);
@@ -227,7 +227,7 @@ public class ExperimentSummaryRepository extends ExpCatAbstractRepository<Experi
runningStates, gatewayId,
fromDate, toDate, userName, applicationName, resourceHostName, accessibleExperimentIds);
List<ExperimentSummaryModel> runningExperiments = getExperimentStatisticsForState(runningStates, gatewayId,
- fromDate, toDate, userName, applicationName, resourceHostName, accessibleExperimentIds);
+ fromDate, toDate, userName, applicationName, resourceHostName, accessibleExperimentIds, limit, offset);
experimentStatistics.setRunningExperimentCount(runningExperimentsCount);
experimentStatistics.setRunningExperiments(runningExperiments);
@@ -237,7 +237,7 @@ public class ExperimentSummaryRepository extends ExpCatAbstractRepository<Experi
fromDate, toDate, userName, applicationName, resourceHostName, accessibleExperimentIds);
List<ExperimentSummaryModel> completedExperiments = getExperimentStatisticsForState(
completedStates, gatewayId, fromDate, toDate, userName, applicationName, resourceHostName,
- accessibleExperimentIds);
+ accessibleExperimentIds, limit, offset);
experimentStatistics.setCompletedExperimentCount(completedExperimentsCount);
experimentStatistics.setCompletedExperiments(completedExperiments);
@@ -246,7 +246,7 @@ public class ExperimentSummaryRepository extends ExpCatAbstractRepository<Experi
failedStates, gatewayId,
fromDate, toDate, userName, applicationName, resourceHostName, accessibleExperimentIds);
List<ExperimentSummaryModel> failedExperiments = getExperimentStatisticsForState(failedStates,
- gatewayId, fromDate, toDate, userName, applicationName, resourceHostName, accessibleExperimentIds);
+ gatewayId, fromDate, toDate, userName, applicationName, resourceHostName, accessibleExperimentIds, limit, offset);
experimentStatistics.setFailedExperimentCount(failedExperimentsCount);
experimentStatistics.setFailedExperiments(failedExperiments);
@@ -256,7 +256,7 @@ public class ExperimentSummaryRepository extends ExpCatAbstractRepository<Experi
fromDate, toDate, userName, applicationName, resourceHostName, accessibleExperimentIds);
List<ExperimentSummaryModel> cancelledExperiments = getExperimentStatisticsForState(
cancelledStates, gatewayId, fromDate, toDate, userName, applicationName, resourceHostName,
- accessibleExperimentIds);
+ accessibleExperimentIds, limit, offset);
experimentStatistics.setCancelledExperimentCount(cancelledExperimentsCount);
experimentStatistics.setCancelledExperiments(cancelledExperiments);
@@ -294,7 +294,7 @@ public class ExperimentSummaryRepository extends ExpCatAbstractRepository<Experi
}
protected List<ExperimentSummaryModel> getExperimentStatisticsForState(List<ExperimentState> experimentStates, String gatewayId, Timestamp fromDate, Timestamp toDate,
- String userName, String applicationName, String resourceHostName, List<String> experimentIds) throws RegistryException, IllegalArgumentException {
+ String userName, String applicationName, String resourceHostName, List<String> experimentIds, int limit, int offset) throws RegistryException, IllegalArgumentException {
String query = "SELECT ES FROM " + ExperimentSummaryEntity.class.getSimpleName() + " ES WHERE ";
Map<String, Object> queryParameters = new HashMap<>();
@@ -306,8 +306,8 @@ public class ExperimentSummaryRepository extends ExpCatAbstractRepository<Experi
return new ArrayList<ExperimentSummaryModel>();
}
- query += "ORDER BY ES.creationTime DESC";
- List<ExperimentSummaryModel> experimentSummaryModelList = select(query, Integer.MAX_VALUE, 0, queryParameters);
+ query += "ORDER BY ES.creationTime DESC, ES.experimentId"; // experimentId is the ordering tiebreaker
+ List<ExperimentSummaryModel> experimentSummaryModelList = select(query, limit, offset, queryParameters);
return experimentSummaryModelList;
}
diff --git a/modules/registry/registry-core/src/test/java/org/apache/airavata/registry/core/repositories/expcatalog/ExperimentSummaryRepositoryTest.java b/modules/registry/registry-core/src/test/java/org/apache/airavata/registry/core/repositories/expcatalog/ExperimentSummaryRepositoryTest.java
index 1b0c415..248b12e 100644
--- a/modules/registry/registry-core/src/test/java/org/apache/airavata/registry/core/repositories/expcatalog/ExperimentSummaryRepositoryTest.java
+++ b/modules/registry/registry-core/src/test/java/org/apache/airavata/registry/core/repositories/expcatalog/ExperimentSummaryRepositoryTest.java
@@ -174,12 +174,12 @@ public class ExperimentSummaryRepositoryTest extends TestBase{
filters.put(DBConstants.ExperimentSummary.FROM_DATE, fromDate);
filters.put(DBConstants.ExperimentSummary.TO_DATE, toDate);
- ExperimentStatistics experimentStatistics = experimentSummaryRepository.getAccessibleExperimentStatistics(allExperimentIds, filters);
+ ExperimentStatistics experimentStatistics = experimentSummaryRepository.getAccessibleExperimentStatistics(allExperimentIds, filters, 10, 0);
assertTrue(experimentStatistics.getAllExperimentCount() == 0);
filters.remove(DBConstants.Experiment.RESOURCE_HOST_ID);
- experimentStatistics = experimentSummaryRepository.getAccessibleExperimentStatistics(allExperimentIds, filters);
+ experimentStatistics = experimentSummaryRepository.getAccessibleExperimentStatistics(allExperimentIds, filters, 10, 0);
assertTrue(experimentStatistics.getAllExperimentCount() == 1);
assertEquals(experimentStatistics.getAllExperiments().get(0).getExperimentId(), experimentIdTwo);
@@ -194,7 +194,7 @@ public class ExperimentSummaryRepositoryTest extends TestBase{
String statusIdTwo = experimentStatusRepository.addExperimentStatus(experimentStatusTwo, experimentIdTwo);
assertTrue(statusIdTwo != null);
- experimentStatistics = experimentSummaryRepository.getAccessibleExperimentStatistics(allExperimentIds, filters);
+ experimentStatistics = experimentSummaryRepository.getAccessibleExperimentStatistics(allExperimentIds, filters, 10, 0);
assertTrue(experimentStatistics.getAllExperimentCount() == 1);
assertTrue(experimentStatistics.getRunningExperimentCount() == 1);
assertEquals(experimentIdTwo, experimentStatistics.getAllExperiments().get(0).getExperimentId());
@@ -202,7 +202,7 @@ public class ExperimentSummaryRepositoryTest extends TestBase{
filters.remove(DBConstants.ExperimentSummary.FROM_DATE);
filters.remove(DBConstants.ExperimentSummary.TO_DATE);
- experimentStatistics = experimentSummaryRepository.getAccessibleExperimentStatistics(allExperimentIds, filters);
+ experimentStatistics = experimentSummaryRepository.getAccessibleExperimentStatistics(allExperimentIds, filters, 10, 0);
assertTrue(experimentStatistics.getAllExperimentCount() == 2);
assertTrue(experimentStatistics.getCreatedExperimentCount() == 1);
assertTrue(experimentStatistics.getRunningExperimentCount() == 1);
@@ -226,11 +226,29 @@ public class ExperimentSummaryRepositoryTest extends TestBase{
assertEquals(experimentIdTwo, experimentSummaryModelList.get(0).getExperimentId());
// Experiment 2 is EXECUTING and should be the only one returned
- experimentStatistics = experimentSummaryRepository.getAccessibleExperimentStatistics(Collections.singletonList(experimentIdTwo), filters);
+ experimentStatistics = experimentSummaryRepository.getAccessibleExperimentStatistics(Collections.singletonList(experimentIdTwo), filters, 10, 0);
assertTrue(experimentStatistics.getAllExperimentCount() == 1);
assertTrue(experimentStatistics.getCreatedExperimentCount() == 0);
assertTrue(experimentStatistics.getRunningExperimentCount() == 1);
+ // Check pagination
+ filters = new HashMap<>();
+ filters.put(DBConstants.Experiment.GATEWAY_ID, gatewayId);
+ // First page
+ experimentStatistics = experimentSummaryRepository.getAccessibleExperimentStatistics(allExperimentIds, filters, 1, 0);
+ // Should still return total count even when only returning the first page of experiment summaries
+ assertEquals(2, experimentStatistics.getAllExperimentCount());
+ // experiment 2 is more recent
+ assertEquals(1, experimentStatistics.getAllExperimentsSize());
+ assertEquals(experimentIdTwo, experimentStatistics.getAllExperiments().get(0).getExperimentId());
+ // Second page
+ experimentStatistics = experimentSummaryRepository.getAccessibleExperimentStatistics(allExperimentIds, filters, 1, 1);
+ // Should still return total count even when only returning the first page of experiment summaries
+ assertEquals(2, experimentStatistics.getAllExperimentCount());
+ // experiment 1 is less recent
+ assertEquals(1, experimentStatistics.getAllExperimentsSize());
+ assertEquals(experimentIdOne, experimentStatistics.getAllExperiments().get(0).getExperimentId());
+
experimentRepository.removeExperiment(experimentIdOne);
experimentRepository.removeExperiment(experimentIdTwo);
diff --git a/modules/registry/registry-server/registry-api-service/src/main/java/org/apache/airavata/registry/api/service/handler/RegistryServerHandler.java b/modules/registry/registry-server/registry-api-service/src/main/java/org/apache/airavata/registry/api/service/handler/RegistryServerHandler.java
index 3ff767d..8df2cc1 100644
--- a/modules/registry/registry-server/registry-api-service/src/main/java/org/apache/airavata/registry/api/service/handler/RegistryServerHandler.java
+++ b/modules/registry/registry-server/registry-api-service/src/main/java/org/apache/airavata/registry/api/service/handler/RegistryServerHandler.java
@@ -436,7 +436,7 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @param toTime Ending data time.
*/
@Override
- public ExperimentStatistics getExperimentStatistics(String gatewayId, long fromTime, long toTime, String userName, String applicationName, String resourceHostName, List<String> accessibleExpIds) throws RegistryServiceException, TException {
+ public ExperimentStatistics getExperimentStatistics(String gatewayId, long fromTime, long toTime, String userName, String applicationName, String resourceHostName, List<String> accessibleExpIds, int limit, int offset) throws RegistryServiceException, TException {
if (!isGatewayExistInternal(gatewayId)){
logger.error("Gateway does not exist.Please provide a valid gateway id...");
throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
@@ -461,7 +461,10 @@ public class RegistryServerHandler implements RegistryService.Iface {
filters.put(Constants.FieldConstants.ExperimentConstants.RESOURCE_HOST_ID, resourceHostName);
}
- ExperimentStatistics result = experimentSummaryRepository.getAccessibleExperimentStatistics(accessibleExpIds, filters);
+ // Cap the max returned experiment summaries at 1000
+ limit = Math.max(limit, 1000);
+
+ ExperimentStatistics result = experimentSummaryRepository.getAccessibleExperimentStatistics(accessibleExpIds, filters, limit, offset);
logger.debug("Airavata retrieved experiments for gateway id : " + gatewayId + " between : " + AiravataUtils.getTime(fromTime) + " and " + AiravataUtils.getTime(toTime));
return result;
}catch (Exception e) {
diff --git a/modules/registry/registry-server/registry-api-stubs/src/main/java/org/apache/airavata/registry/api/RegistryService.java b/modules/registry/registry-server/registry-api-stubs/src/main/java/org/apache/airavata/registry/api/RegistryService.java
index 67b0c32..2b89543 100644
--- a/modules/registry/registry-server/registry-api-stubs/src/main/java/org/apache/airavata/registry/api/RegistryService.java
+++ b/modules/registry/registry-server/registry-api-stubs/src/main/java/org/apache/airavata/registry/api/RegistryService.java
@@ -351,6 +351,13 @@ public class RegistryService {
* @param accessibleExpIds
* Experiment IDs which are accessible to the current user.
*
+ * @param limit
+ * Amount of results to be fetched.
+ *
+ * @param offset
+ * The starting point of the results to be fetched.
+ *
+ *
*
* @param gatewayId
* @param fromTime
@@ -359,8 +366,10 @@ public class RegistryService {
* @param applicationName
* @param resourceHostName
* @param accessibleExpIds
+ * @param limit
+ * @param offset
*/
- public org.apache.airavata.model.experiment.ExperimentStatistics getExperimentStatistics(java.lang.String gatewayId, long fromTime, long toTime, java.lang.String userName, java.lang.String applicationName, java.lang.String resourceHostName, java.util.List<java.lang.String> accessibleExpIds) throws org.apache.airavata.registry.api.exception.RegistryServiceException, org.apache.thrift.TException;
+ public org.apache.airavata.model.experiment.ExperimentStatistics getExperimentStatistics(java.lang.String gatewayId, long fromTime, long toTime, java.lang.String userName, java.lang.String applicationName, java.lang.String resourceHostName, java.util.List<java.lang.String> accessibleExpIds, int limit, int offset) throws org.apache.airavata.registry.api.exception.RegistryServiceException, org.apache.thrift.TException;
/**
*
@@ -2662,7 +2671,7 @@ public class RegistryService {
public void searchExperiments(java.lang.String gatewayId, java.lang.String userName, java.util.List<java.lang.String> accessibleExpIds, java.util.Map<org.apache.airavata.model.experiment.ExperimentSearchFields,java.lang.String> filters, int limit, int offset, org.apache.thrift.async.AsyncMethodCallback<java.util.List<org.apache.airavata.model.experiment.ExperimentSummaryModel>> resultHandler) throws org.apache.thrift.TException;
- public void getExperimentStatistics(java.lang.String gatewayId, long fromTime, long toTime, java.lang.String userName, java.lang.String applicationName, java.lang.String resourceHostName, java.util.List<java.lang.String> accessibleExpIds, org.apache.thrift.async.AsyncMethodCallback<org.apache.airavata.model.experiment.ExperimentStatistics> resultHandler) throws org.apache.thrift.TException;
+ public void getExperimentStatistics(java.lang.String gatewayId, long fromTime, long toTime, java.lang.String userName, java.lang.String applicationName, java.lang.String resourceHostName, java.util.List<java.lang.String> accessibleExpIds, int limit, int offset, org.apache.thrift.async.AsyncMethodCallback<org.apache.airavata.model.experiment.ExperimentStatistics> resultHandler) throws org.apache.thrift.TException;
public void getExperimentsInProject(java.lang.String gatewayId, java.lang.String projectId, int limit, int offset, org.apache.thrift.async.AsyncMethodCallback<java.util.List<org.apache.airavata.model.experiment.ExperimentModel>> resultHandler) throws org.apache.thrift.TException;
@@ -3591,13 +3600,13 @@ public class RegistryService {
throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "searchExperiments failed: unknown result");
}
- public org.apache.airavata.model.experiment.ExperimentStatistics getExperimentStatistics(java.lang.String gatewayId, long fromTime, long toTime, java.lang.String userName, java.lang.String applicationName, java.lang.String resourceHostName, java.util.List<java.lang.String> accessibleExpIds) throws org.apache.airavata.registry.api.exception.RegistryServiceException, org.apache.thrift.TException
+ public org.apache.airavata.model.experiment.ExperimentStatistics getExperimentStatistics(java.lang.String gatewayId, long fromTime, long toTime, java.lang.String userName, java.lang.String applicationName, java.lang.String resourceHostName, java.util.List<java.lang.String> accessibleExpIds, int limit, int offset) throws org.apache.airavata.registry.api.exception.RegistryServiceException, org.apache.thrift.TException
{
- send_getExperimentStatistics(gatewayId, fromTime, toTime, userName, applicationName, resourceHostName, accessibleExpIds);
+ send_getExperimentStatistics(gatewayId, fromTime, toTime, userName, applicationName, resourceHostName, accessibleExpIds, limit, offset);
return recv_getExperimentStatistics();
}
- public void send_getExperimentStatistics(java.lang.String gatewayId, long fromTime, long toTime, java.lang.String userName, java.lang.String applicationName, java.lang.String resourceHostName, java.util.List<java.lang.String> accessibleExpIds) throws org.apache.thrift.TException
+ public void send_getExperimentStatistics(java.lang.String gatewayId, long fromTime, long toTime, java.lang.String userName, java.lang.String applicationName, java.lang.String resourceHostName, java.util.List<java.lang.String> accessibleExpIds, int limit, int offset) throws org.apache.thrift.TException
{
getExperimentStatistics_args args = new getExperimentStatistics_args();
args.setGatewayId(gatewayId);
@@ -3607,6 +3616,8 @@ public class RegistryService {
args.setApplicationName(applicationName);
args.setResourceHostName(resourceHostName);
args.setAccessibleExpIds(accessibleExpIds);
+ args.setLimit(limit);
+ args.setOffset(offset);
sendBase("getExperimentStatistics", args);
}
@@ -9090,9 +9101,9 @@ public class RegistryService {
}
}
- public void getExperimentStatistics(java.lang.String gatewayId, long fromTime, long toTime, java.lang.String userName, java.lang.String applicationName, java.lang.String resourceHostName, java.util.List<java.lang.String> accessibleExpIds, org.apache.thrift.async.AsyncMethodCallback<org.apache.airavata.model.experiment.ExperimentStatistics> resultHandler) throws org.apache.thrift.TException {
+ public void getExperimentStatistics(java.lang.String gatewayId, long fromTime, long toTime, java.lang.String userName, java.lang.String applicationName, java.lang.String resourceHostName, java.util.List<java.lang.String> accessibleExpIds, int limit, int offset, org.apache.thrift.async.AsyncMethodCallback<org.apache.airavata.model.experiment.ExperimentStatistics> resultHandler) throws org.apache.thrift.TException {
checkReady();
- getExperimentStatistics_call method_call = new getExperimentStatistics_call(gatewayId, fromTime, toTime, userName, applicationName, resourceHostName, accessibleExpIds, resultHandler, this, ___protocolFactory, ___transport);
+ getExperimentStatistics_call method_call = new getExperimentStatistics_call(gatewayId, fromTime, toTime, userName, applicationName, resourceHostName, accessibleExpIds, limit, offset, resultHandler, this, ___protocolFactory, ___transport);
this.___currentMethod = method_call;
___manager.call(method_call);
}
@@ -9105,7 +9116,9 @@ public class RegistryService {
private java.lang.String applicationName;
private java.lang.String resourceHostName;
private java.util.List<java.lang.String> accessibleExpIds;
- public getExperimentStatistics_call(java.lang.String gatewayId, long fromTime, long toTime, java.lang.String userName, java.lang.String applicationName, java.lang.String resourceHostName, java.util.List<java.lang.String> accessibleExpIds, org.apache.thrift.async.AsyncMethodCallback<org.apache.airavata.model.experiment.ExperimentStatistics> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.trans [...]
+ private int limit;
+ private int offset;
+ public getExperimentStatistics_call(java.lang.String gatewayId, long fromTime, long toTime, java.lang.String userName, java.lang.String applicationName, java.lang.String resourceHostName, java.util.List<java.lang.String> accessibleExpIds, int limit, int offset, org.apache.thrift.async.AsyncMethodCallback<org.apache.airavata.model.experiment.ExperimentStatistics> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, [...]
super(client, protocolFactory, transport, resultHandler, false);
this.gatewayId = gatewayId;
this.fromTime = fromTime;
@@ -9114,6 +9127,8 @@ public class RegistryService {
this.applicationName = applicationName;
this.resourceHostName = resourceHostName;
this.accessibleExpIds = accessibleExpIds;
+ this.limit = limit;
+ this.offset = offset;
}
public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
@@ -9126,6 +9141,8 @@ public class RegistryService {
args.setApplicationName(applicationName);
args.setResourceHostName(resourceHostName);
args.setAccessibleExpIds(accessibleExpIds);
+ args.setLimit(limit);
+ args.setOffset(offset);
args.write(prot);
prot.writeMessageEnd();
}
@@ -15988,7 +16005,7 @@ public class RegistryService {
public getExperimentStatistics_result getResult(I iface, getExperimentStatistics_args args) throws org.apache.thrift.TException {
getExperimentStatistics_result result = new getExperimentStatistics_result();
try {
- result.success = iface.getExperimentStatistics(args.gatewayId, args.fromTime, args.toTime, args.userName, args.applicationName, args.resourceHostName, args.accessibleExpIds);
+ result.success = iface.getExperimentStatistics(args.gatewayId, args.fromTime, args.toTime, args.userName, args.applicationName, args.resourceHostName, args.accessibleExpIds, args.limit, args.offset);
} catch (org.apache.airavata.registry.api.exception.RegistryServiceException rse) {
result.rse = rse;
}
@@ -21965,7 +21982,7 @@ public class RegistryService {
}
public void start(I iface, getExperimentStatistics_args args, org.apache.thrift.async.AsyncMethodCallback<org.apache.airavata.model.experiment.ExperimentStatistics> resultHandler) throws org.apache.thrift.TException {
- iface.getExperimentStatistics(args.gatewayId, args.fromTime, args.toTime, args.userName, args.applicationName, args.resourceHostName, args.accessibleExpIds,resultHandler);
+ iface.getExperimentStatistics(args.gatewayId, args.fromTime, args.toTime, args.userName, args.applicationName, args.resourceHostName, args.accessibleExpIds, args.limit, args.offset,resultHandler);
}
}
@@ -52824,6 +52841,8 @@ public class RegistryService {
private static final org.apache.thrift.protocol.TField APPLICATION_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("applicationName", org.apache.thrift.protocol.TType.STRING, (short)5);
private static final org.apache.thrift.protocol.TField RESOURCE_HOST_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("resourceHostName", org.apache.thrift.protocol.TType.STRING, (short)6);
private static final org.apache.thrift.protocol.TField ACCESSIBLE_EXP_IDS_FIELD_DESC = new org.apache.thrift.protocol.TField("accessibleExpIds", org.apache.thrift.protocol.TType.LIST, (short)7);
+ private static final org.apache.thrift.protocol.TField LIMIT_FIELD_DESC = new org.apache.thrift.protocol.TField("limit", org.apache.thrift.protocol.TType.I32, (short)8);
+ private static final org.apache.thrift.protocol.TField OFFSET_FIELD_DESC = new org.apache.thrift.protocol.TField("offset", org.apache.thrift.protocol.TType.I32, (short)9);
private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new getExperimentStatistics_argsStandardSchemeFactory();
private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new getExperimentStatistics_argsTupleSchemeFactory();
@@ -52835,6 +52854,8 @@ public class RegistryService {
public java.lang.String applicationName; // required
public java.lang.String resourceHostName; // required
public java.util.List<java.lang.String> accessibleExpIds; // required
+ public int limit; // required
+ public int offset; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
@@ -52844,7 +52865,9 @@ public class RegistryService {
USER_NAME((short)4, "userName"),
APPLICATION_NAME((short)5, "applicationName"),
RESOURCE_HOST_NAME((short)6, "resourceHostName"),
- ACCESSIBLE_EXP_IDS((short)7, "accessibleExpIds");
+ ACCESSIBLE_EXP_IDS((short)7, "accessibleExpIds"),
+ LIMIT((short)8, "limit"),
+ OFFSET((short)9, "offset");
private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>();
@@ -52873,6 +52896,10 @@ public class RegistryService {
return RESOURCE_HOST_NAME;
case 7: // ACCESSIBLE_EXP_IDS
return ACCESSIBLE_EXP_IDS;
+ case 8: // LIMIT
+ return LIMIT;
+ case 9: // OFFSET
+ return OFFSET;
default:
return null;
}
@@ -52915,6 +52942,8 @@ public class RegistryService {
// isset id assignments
private static final int __FROMTIME_ISSET_ID = 0;
private static final int __TOTIME_ISSET_ID = 1;
+ private static final int __LIMIT_ISSET_ID = 2;
+ private static final int __OFFSET_ISSET_ID = 3;
private byte __isset_bitfield = 0;
public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
@@ -52934,11 +52963,19 @@ public class RegistryService {
tmpMap.put(_Fields.ACCESSIBLE_EXP_IDS, new org.apache.thrift.meta_data.FieldMetaData("accessibleExpIds", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
+ tmpMap.put(_Fields.LIMIT, new org.apache.thrift.meta_data.FieldMetaData("limit", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
+ tmpMap.put(_Fields.OFFSET, new org.apache.thrift.meta_data.FieldMetaData("offset", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getExperimentStatistics_args.class, metaDataMap);
}
public getExperimentStatistics_args() {
+ this.limit = 50;
+
+ this.offset = 0;
+
}
public getExperimentStatistics_args(
@@ -52948,7 +52985,9 @@ public class RegistryService {
java.lang.String userName,
java.lang.String applicationName,
java.lang.String resourceHostName,
- java.util.List<java.lang.String> accessibleExpIds)
+ java.util.List<java.lang.String> accessibleExpIds,
+ int limit,
+ int offset)
{
this();
this.gatewayId = gatewayId;
@@ -52960,6 +52999,10 @@ public class RegistryService {
this.applicationName = applicationName;
this.resourceHostName = resourceHostName;
this.accessibleExpIds = accessibleExpIds;
+ this.limit = limit;
+ setLimitIsSet(true);
+ this.offset = offset;
+ setOffsetIsSet(true);
}
/**
@@ -52985,6 +53028,8 @@ public class RegistryService {
java.util.List<java.lang.String> __this__accessibleExpIds = new java.util.ArrayList<java.lang.String>(other.accessibleExpIds);
this.accessibleExpIds = __this__accessibleExpIds;
}
+ this.limit = other.limit;
+ this.offset = other.offset;
}
public getExperimentStatistics_args deepCopy() {
@@ -53002,6 +53047,10 @@ public class RegistryService {
this.applicationName = null;
this.resourceHostName = null;
this.accessibleExpIds = null;
+ this.limit = 50;
+
+ this.offset = 0;
+
}
public java.lang.String getGatewayId() {
@@ -53185,6 +53234,52 @@ public class RegistryService {
}
}
+ public int getLimit() {
+ return this.limit;
+ }
+
+ public getExperimentStatistics_args setLimit(int limit) {
+ this.limit = limit;
+ setLimitIsSet(true);
+ return this;
+ }
+
+ public void unsetLimit() {
+ __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __LIMIT_ISSET_ID);
+ }
+
+ /** Returns true if field limit is set (has been assigned a value) and false otherwise */
+ public boolean isSetLimit() {
+ return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __LIMIT_ISSET_ID);
+ }
+
+ public void setLimitIsSet(boolean value) {
+ __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __LIMIT_ISSET_ID, value);
+ }
+
+ public int getOffset() {
+ return this.offset;
+ }
+
+ public getExperimentStatistics_args setOffset(int offset) {
+ this.offset = offset;
+ setOffsetIsSet(true);
+ return this;
+ }
+
+ public void unsetOffset() {
+ __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __OFFSET_ISSET_ID);
+ }
+
+ /** Returns true if field offset is set (has been assigned a value) and false otherwise */
+ public boolean isSetOffset() {
+ return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __OFFSET_ISSET_ID);
+ }
+
+ public void setOffsetIsSet(boolean value) {
+ __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __OFFSET_ISSET_ID, value);
+ }
+
public void setFieldValue(_Fields field, java.lang.Object value) {
switch (field) {
case GATEWAY_ID:
@@ -53243,6 +53338,22 @@ public class RegistryService {
}
break;
+ case LIMIT:
+ if (value == null) {
+ unsetLimit();
+ } else {
+ setLimit((java.lang.Integer)value);
+ }
+ break;
+
+ case OFFSET:
+ if (value == null) {
+ unsetOffset();
+ } else {
+ setOffset((java.lang.Integer)value);
+ }
+ break;
+
}
}
@@ -53269,6 +53380,12 @@ public class RegistryService {
case ACCESSIBLE_EXP_IDS:
return getAccessibleExpIds();
+ case LIMIT:
+ return getLimit();
+
+ case OFFSET:
+ return getOffset();
+
}
throw new java.lang.IllegalStateException();
}
@@ -53294,6 +53411,10 @@ public class RegistryService {
return isSetResourceHostName();
case ACCESSIBLE_EXP_IDS:
return isSetAccessibleExpIds();
+ case LIMIT:
+ return isSetLimit();
+ case OFFSET:
+ return isSetOffset();
}
throw new java.lang.IllegalStateException();
}
@@ -53376,6 +53497,24 @@ public class RegistryService {
return false;
}
+ boolean this_present_limit = true;
+ boolean that_present_limit = true;
+ if (this_present_limit || that_present_limit) {
+ if (!(this_present_limit && that_present_limit))
+ return false;
+ if (this.limit != that.limit)
+ return false;
+ }
+
+ boolean this_present_offset = true;
+ boolean that_present_offset = true;
+ if (this_present_offset || that_present_offset) {
+ if (!(this_present_offset && that_present_offset))
+ return false;
+ if (this.offset != that.offset)
+ return false;
+ }
+
return true;
}
@@ -53407,6 +53546,10 @@ public class RegistryService {
if (isSetAccessibleExpIds())
hashCode = hashCode * 8191 + accessibleExpIds.hashCode();
+ hashCode = hashCode * 8191 + limit;
+
+ hashCode = hashCode * 8191 + offset;
+
return hashCode;
}
@@ -53488,6 +53631,26 @@ public class RegistryService {
return lastComparison;
}
}
+ lastComparison = java.lang.Boolean.valueOf(isSetLimit()).compareTo(other.isSetLimit());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetLimit()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.limit, other.limit);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
+ lastComparison = java.lang.Boolean.valueOf(isSetOffset()).compareTo(other.isSetOffset());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetOffset()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.offset, other.offset);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
return 0;
}
@@ -53555,6 +53718,14 @@ public class RegistryService {
sb.append(this.accessibleExpIds);
}
first = false;
+ if (!first) sb.append(", ");
+ sb.append("limit:");
+ sb.append(this.limit);
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("offset:");
+ sb.append(this.offset);
+ first = false;
sb.append(")");
return sb.toString();
}
@@ -53671,6 +53842,22 @@ public class RegistryService {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
+ case 8: // LIMIT
+ if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+ struct.limit = iprot.readI32();
+ struct.setLimitIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
+ case 9: // OFFSET
+ if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+ struct.offset = iprot.readI32();
+ struct.setOffsetIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
@@ -53730,6 +53917,12 @@ public class RegistryService {
}
oprot.writeFieldEnd();
}
+ oprot.writeFieldBegin(LIMIT_FIELD_DESC);
+ oprot.writeI32(struct.limit);
+ oprot.writeFieldEnd();
+ oprot.writeFieldBegin(OFFSET_FIELD_DESC);
+ oprot.writeI32(struct.offset);
+ oprot.writeFieldEnd();
oprot.writeFieldStop();
oprot.writeStructEnd();
}
@@ -53763,7 +53956,13 @@ public class RegistryService {
if (struct.isSetAccessibleExpIds()) {
optionals.set(3);
}
- oprot.writeBitSet(optionals, 4);
+ if (struct.isSetLimit()) {
+ optionals.set(4);
+ }
+ if (struct.isSetOffset()) {
+ optionals.set(5);
+ }
+ oprot.writeBitSet(optionals, 6);
if (struct.isSetUserName()) {
oprot.writeString(struct.userName);
}
@@ -53782,6 +53981,12 @@ public class RegistryService {
}
}
}
+ if (struct.isSetLimit()) {
+ oprot.writeI32(struct.limit);
+ }
+ if (struct.isSetOffset()) {
+ oprot.writeI32(struct.offset);
+ }
}
@Override
@@ -53793,7 +53998,7 @@ public class RegistryService {
struct.setFromTimeIsSet(true);
struct.toTime = iprot.readI64();
struct.setToTimeIsSet(true);
- java.util.BitSet incoming = iprot.readBitSet(4);
+ java.util.BitSet incoming = iprot.readBitSet(6);
if (incoming.get(0)) {
struct.userName = iprot.readString();
struct.setUserNameIsSet(true);
@@ -53819,6 +54024,14 @@ public class RegistryService {
}
struct.setAccessibleExpIdsIsSet(true);
}
+ if (incoming.get(4)) {
+ struct.limit = iprot.readI32();
+ struct.setLimitIsSet(true);
+ }
+ if (incoming.get(5)) {
+ struct.offset = iprot.readI32();
+ struct.setOffsetIsSet(true);
+ }
}
}
diff --git a/thrift-interface-descriptions/airavata-apis/airavata_api.thrift b/thrift-interface-descriptions/airavata-apis/airavata_api.thrift
index 57f7919..9c4fdc0 100644
--- a/thrift-interface-descriptions/airavata-apis/airavata_api.thrift
+++ b/thrift-interface-descriptions/airavata-apis/airavata_api.thrift
@@ -515,6 +515,12 @@ service Airavata extends base_api.BaseAPI {
* @param resourceHostName
* Hostname id substring with which to further filter statistics.
*
+ * @param limit
+ * Amount of results to be fetched.
+ *
+ * @param offset
+ * The starting point of the results to be fetched.
+ *
**/
experiment_model.ExperimentStatistics getExperimentStatistics(1: required security_model.AuthzToken authzToken,
2: required string gatewayId,
@@ -522,7 +528,9 @@ service Airavata extends base_api.BaseAPI {
4: required i64 toTime,
5: string userName,
6: string applicationName,
- 7: string resourceHostName)
+ 7: string resourceHostName,
+ 8: i32 limit,
+ 9: i32 offset)
throws (1: airavata_errors.InvalidRequestException ire,
2: airavata_errors.AiravataClientException ace,
3: airavata_errors.AiravataSystemException ase,
diff --git a/thrift-interface-descriptions/component-cpis/registry-api.thrift b/thrift-interface-descriptions/component-cpis/registry-api.thrift
index 1694a1d..5cbea03 100644
--- a/thrift-interface-descriptions/component-cpis/registry-api.thrift
+++ b/thrift-interface-descriptions/component-cpis/registry-api.thrift
@@ -365,6 +365,13 @@ service RegistryService extends base_api.BaseAPI {
*
* @param accessibleExpIds
* Experiment IDs which are accessible to the current user.
+ *
+ * @param limit
+ * Amount of results to be fetched.
+ *
+ * @param offset
+ * The starting point of the results to be fetched.
+ *
**/
experiment_model.ExperimentStatistics getExperimentStatistics(1: required string gatewayId,
2: required i64 fromTime,
@@ -372,7 +379,9 @@ service RegistryService extends base_api.BaseAPI {
4: string userName,
5: string applicationName,
6: string resourceHostName,
- 7: list<string> accessibleExpIds)
+ 7: list<string> accessibleExpIds,
+ 8: i32 limit = 50,
+ 9: i32 offset = 0)
throws (1: registry_api_errors.RegistryServiceException rse)