http://git-wip-us.apache.org/repos/asf/airavata/blob/2c6620f0/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/workspace/experiment/ExperimentStatistics.java ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/workspace/experiment/ExperimentStatistics.java b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/workspace/experiment/ExperimentStatistics.java new file mode 100644 index 0000000..d191249 --- /dev/null +++ b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/workspace/experiment/ExperimentStatistics.java @@ -0,0 +1,1280 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * Autogenerated by Thrift Compiler (0.9.1) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.apache.airavata.model.workspace.experiment; + +import org.apache.thrift.EncodingUtils; +import org.apache.thrift.TException; +import org.apache.thrift.protocol.TProtocolException; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.scheme.IScheme; +import org.apache.thrift.scheme.SchemeFactory; +import org.apache.thrift.scheme.StandardScheme; +import org.apache.thrift.scheme.TupleScheme; + +import java.util.*; + +public class ExperimentStatistics implements org.apache.thrift.TBase<ExperimentStatistics, ExperimentStatistics._Fields>, java.io.Serializable, Cloneable, Comparable<ExperimentStatistics> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ExperimentStatistics"); + + private static final org.apache.thrift.protocol.TField ALL_EXPERIMENT_COUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("allExperimentCount", org.apache.thrift.protocol.TType.I32, (short)1); + private static final org.apache.thrift.protocol.TField COMPLETED_EXPERIMENT_COUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("completedExperimentCount", org.apache.thrift.protocol.TType.I32, (short)2); + private static final org.apache.thrift.protocol.TField CANCELLED_EXPERIMENT_COUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("cancelledExperimentCount", org.apache.thrift.protocol.TType.I32, (short)3); + private static final org.apache.thrift.protocol.TField FAILED_EXPERIMENT_COUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("failedExperimentCount", org.apache.thrift.protocol.TType.I32, (short)4); + private static final org.apache.thrift.protocol.TField ALL_EXPERIMENTS_FIELD_DESC = new org.apache.thrift.protocol.TField("allExperiments", org.apache.thrift.protocol.TType.LIST, (short)5); + private static final org.apache.thrift.protocol.TField COMPLETED_EXPERIMENTS_FIELD_DESC = new org.apache.thrift.protocol.TField("completedExperiments", org.apache.thrift.protocol.TType.LIST, (short)6); + private static final org.apache.thrift.protocol.TField FAILED_EXPERIMENTS_FIELD_DESC = new org.apache.thrift.protocol.TField("failedExperiments", org.apache.thrift.protocol.TType.LIST, (short)7); + private static final org.apache.thrift.protocol.TField CANCELLED_EXPERIMENTS_FIELD_DESC = new org.apache.thrift.protocol.TField("cancelledExperiments", org.apache.thrift.protocol.TType.LIST, (short)8); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new ExperimentStatisticsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new ExperimentStatisticsTupleSchemeFactory()); + } + + public int allExperimentCount; // required + public int completedExperimentCount; // required + public int cancelledExperimentCount; // optional + public int failedExperimentCount; // required + public List<ExperimentSummary> allExperiments; // required + public List<ExperimentSummary> completedExperiments; // optional + public List<ExperimentSummary> failedExperiments; // optional + public List<ExperimentSummary> cancelledExperiments; // optional + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + ALL_EXPERIMENT_COUNT((short)1, "allExperimentCount"), + COMPLETED_EXPERIMENT_COUNT((short)2, "completedExperimentCount"), + CANCELLED_EXPERIMENT_COUNT((short)3, "cancelledExperimentCount"), + FAILED_EXPERIMENT_COUNT((short)4, "failedExperimentCount"), + ALL_EXPERIMENTS((short)5, "allExperiments"), + COMPLETED_EXPERIMENTS((short)6, "completedExperiments"), + FAILED_EXPERIMENTS((short)7, "failedExperiments"), + CANCELLED_EXPERIMENTS((short)8, "cancelledExperiments"); + + private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + case 1: // ALL_EXPERIMENT_COUNT + return ALL_EXPERIMENT_COUNT; + case 2: // COMPLETED_EXPERIMENT_COUNT + return COMPLETED_EXPERIMENT_COUNT; + case 3: // CANCELLED_EXPERIMENT_COUNT + return CANCELLED_EXPERIMENT_COUNT; + case 4: // FAILED_EXPERIMENT_COUNT + return FAILED_EXPERIMENT_COUNT; + case 5: // ALL_EXPERIMENTS + return ALL_EXPERIMENTS; + case 6: // COMPLETED_EXPERIMENTS + return COMPLETED_EXPERIMENTS; + case 7: // FAILED_EXPERIMENTS + return FAILED_EXPERIMENTS; + case 8: // CANCELLED_EXPERIMENTS + return CANCELLED_EXPERIMENTS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __ALLEXPERIMENTCOUNT_ISSET_ID = 0; + private static final int __COMPLETEDEXPERIMENTCOUNT_ISSET_ID = 1; + private static final int __CANCELLEDEXPERIMENTCOUNT_ISSET_ID = 2; + private static final int __FAILEDEXPERIMENTCOUNT_ISSET_ID = 3; + private byte __isset_bitfield = 0; + private _Fields optionals[] = {_Fields.CANCELLED_EXPERIMENT_COUNT,_Fields.COMPLETED_EXPERIMENTS,_Fields.FAILED_EXPERIMENTS,_Fields.CANCELLED_EXPERIMENTS}; + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.ALL_EXPERIMENT_COUNT, new org.apache.thrift.meta_data.FieldMetaData("allExperimentCount", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); + tmpMap.put(_Fields.COMPLETED_EXPERIMENT_COUNT, new org.apache.thrift.meta_data.FieldMetaData("completedExperimentCount", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); + tmpMap.put(_Fields.CANCELLED_EXPERIMENT_COUNT, new org.apache.thrift.meta_data.FieldMetaData("cancelledExperimentCount", org.apache.thrift.TFieldRequirementType.OPTIONAL, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); + tmpMap.put(_Fields.FAILED_EXPERIMENT_COUNT, new org.apache.thrift.meta_data.FieldMetaData("failedExperimentCount", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); + tmpMap.put(_Fields.ALL_EXPERIMENTS, new org.apache.thrift.meta_data.FieldMetaData("allExperiments", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, ExperimentSummary.class)))); + tmpMap.put(_Fields.COMPLETED_EXPERIMENTS, new org.apache.thrift.meta_data.FieldMetaData("completedExperiments", org.apache.thrift.TFieldRequirementType.OPTIONAL, + new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, ExperimentSummary.class)))); + tmpMap.put(_Fields.FAILED_EXPERIMENTS, new org.apache.thrift.meta_data.FieldMetaData("failedExperiments", org.apache.thrift.TFieldRequirementType.OPTIONAL, + new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, ExperimentSummary.class)))); + tmpMap.put(_Fields.CANCELLED_EXPERIMENTS, new org.apache.thrift.meta_data.FieldMetaData("cancelledExperiments", org.apache.thrift.TFieldRequirementType.OPTIONAL, + new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, ExperimentSummary.class)))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ExperimentStatistics.class, metaDataMap); + } + + public ExperimentStatistics() { + } + + public ExperimentStatistics( + int allExperimentCount, + int completedExperimentCount, + int failedExperimentCount, + List<ExperimentSummary> allExperiments) + { + this(); + this.allExperimentCount = allExperimentCount; + setAllExperimentCountIsSet(true); + this.completedExperimentCount = completedExperimentCount; + setCompletedExperimentCountIsSet(true); + this.failedExperimentCount = failedExperimentCount; + setFailedExperimentCountIsSet(true); + this.allExperiments = allExperiments; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public ExperimentStatistics(ExperimentStatistics other) { + __isset_bitfield = other.__isset_bitfield; + this.allExperimentCount = other.allExperimentCount; + this.completedExperimentCount = other.completedExperimentCount; + this.cancelledExperimentCount = other.cancelledExperimentCount; + this.failedExperimentCount = other.failedExperimentCount; + if (other.isSetAllExperiments()) { + List<ExperimentSummary> __this__allExperiments = new ArrayList<ExperimentSummary>(other.allExperiments.size()); + for (ExperimentSummary other_element : other.allExperiments) { + __this__allExperiments.add(new ExperimentSummary(other_element)); + } + this.allExperiments = __this__allExperiments; + } + if (other.isSetCompletedExperiments()) { + List<ExperimentSummary> __this__completedExperiments = new ArrayList<ExperimentSummary>(other.completedExperiments.size()); + for (ExperimentSummary other_element : other.completedExperiments) { + __this__completedExperiments.add(new ExperimentSummary(other_element)); + } + this.completedExperiments = __this__completedExperiments; + } + if (other.isSetFailedExperiments()) { + List<ExperimentSummary> __this__failedExperiments = new ArrayList<ExperimentSummary>(other.failedExperiments.size()); + for (ExperimentSummary other_element : other.failedExperiments) { + __this__failedExperiments.add(new ExperimentSummary(other_element)); + } + this.failedExperiments = __this__failedExperiments; + } + if (other.isSetCancelledExperiments()) { + List<ExperimentSummary> __this__cancelledExperiments = new ArrayList<ExperimentSummary>(other.cancelledExperiments.size()); + for (ExperimentSummary other_element : other.cancelledExperiments) { + __this__cancelledExperiments.add(new ExperimentSummary(other_element)); + } + this.cancelledExperiments = __this__cancelledExperiments; + } + } + + public ExperimentStatistics deepCopy() { + return new ExperimentStatistics(this); + } + + @Override + public void clear() { + setAllExperimentCountIsSet(false); + this.allExperimentCount = 0; + setCompletedExperimentCountIsSet(false); + this.completedExperimentCount = 0; + setCancelledExperimentCountIsSet(false); + this.cancelledExperimentCount = 0; + setFailedExperimentCountIsSet(false); + this.failedExperimentCount = 0; + this.allExperiments = null; + this.completedExperiments = null; + this.failedExperiments = null; + this.cancelledExperiments = null; + } + + public int getAllExperimentCount() { + return this.allExperimentCount; + } + + public ExperimentStatistics setAllExperimentCount(int allExperimentCount) { + this.allExperimentCount = allExperimentCount; + setAllExperimentCountIsSet(true); + return this; + } + + public void unsetAllExperimentCount() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ALLEXPERIMENTCOUNT_ISSET_ID); + } + + /** Returns true if field allExperimentCount is set (has been assigned a value) and false otherwise */ + public boolean isSetAllExperimentCount() { + return EncodingUtils.testBit(__isset_bitfield, __ALLEXPERIMENTCOUNT_ISSET_ID); + } + + public void setAllExperimentCountIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ALLEXPERIMENTCOUNT_ISSET_ID, value); + } + + public int getCompletedExperimentCount() { + return this.completedExperimentCount; + } + + public ExperimentStatistics setCompletedExperimentCount(int completedExperimentCount) { + this.completedExperimentCount = completedExperimentCount; + setCompletedExperimentCountIsSet(true); + return this; + } + + public void unsetCompletedExperimentCount() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __COMPLETEDEXPERIMENTCOUNT_ISSET_ID); + } + + /** Returns true if field completedExperimentCount is set (has been assigned a value) and false otherwise */ + public boolean isSetCompletedExperimentCount() { + return EncodingUtils.testBit(__isset_bitfield, __COMPLETEDEXPERIMENTCOUNT_ISSET_ID); + } + + public void setCompletedExperimentCountIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __COMPLETEDEXPERIMENTCOUNT_ISSET_ID, value); + } + + public int getCancelledExperimentCount() { + return this.cancelledExperimentCount; + } + + public ExperimentStatistics setCancelledExperimentCount(int cancelledExperimentCount) { + this.cancelledExperimentCount = cancelledExperimentCount; + setCancelledExperimentCountIsSet(true); + return this; + } + + public void unsetCancelledExperimentCount() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __CANCELLEDEXPERIMENTCOUNT_ISSET_ID); + } + + /** Returns true if field cancelledExperimentCount is set (has been assigned a value) and false otherwise */ + public boolean isSetCancelledExperimentCount() { + return EncodingUtils.testBit(__isset_bitfield, __CANCELLEDEXPERIMENTCOUNT_ISSET_ID); + } + + public void setCancelledExperimentCountIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __CANCELLEDEXPERIMENTCOUNT_ISSET_ID, value); + } + + public int getFailedExperimentCount() { + return this.failedExperimentCount; + } + + public ExperimentStatistics setFailedExperimentCount(int failedExperimentCount) { + this.failedExperimentCount = failedExperimentCount; + setFailedExperimentCountIsSet(true); + return this; + } + + public void unsetFailedExperimentCount() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __FAILEDEXPERIMENTCOUNT_ISSET_ID); + } + + /** Returns true if field failedExperimentCount is set (has been assigned a value) and false otherwise */ + public boolean isSetFailedExperimentCount() { + return EncodingUtils.testBit(__isset_bitfield, __FAILEDEXPERIMENTCOUNT_ISSET_ID); + } + + public void setFailedExperimentCountIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __FAILEDEXPERIMENTCOUNT_ISSET_ID, value); + } + + public int getAllExperimentsSize() { + return (this.allExperiments == null) ? 0 : this.allExperiments.size(); + } + + public java.util.Iterator<ExperimentSummary> getAllExperimentsIterator() { + return (this.allExperiments == null) ? null : this.allExperiments.iterator(); + } + + public void addToAllExperiments(ExperimentSummary elem) { + if (this.allExperiments == null) { + this.allExperiments = new ArrayList<ExperimentSummary>(); + } + this.allExperiments.add(elem); + } + + public List<ExperimentSummary> getAllExperiments() { + return this.allExperiments; + } + + public ExperimentStatistics setAllExperiments(List<ExperimentSummary> allExperiments) { + this.allExperiments = allExperiments; + return this; + } + + public void unsetAllExperiments() { + this.allExperiments = null; + } + + /** Returns true if field allExperiments is set (has been assigned a value) and false otherwise */ + public boolean isSetAllExperiments() { + return this.allExperiments != null; + } + + public void setAllExperimentsIsSet(boolean value) { + if (!value) { + this.allExperiments = null; + } + } + + public int getCompletedExperimentsSize() { + return (this.completedExperiments == null) ? 0 : this.completedExperiments.size(); + } + + public java.util.Iterator<ExperimentSummary> getCompletedExperimentsIterator() { + return (this.completedExperiments == null) ? null : this.completedExperiments.iterator(); + } + + public void addToCompletedExperiments(ExperimentSummary elem) { + if (this.completedExperiments == null) { + this.completedExperiments = new ArrayList<ExperimentSummary>(); + } + this.completedExperiments.add(elem); + } + + public List<ExperimentSummary> getCompletedExperiments() { + return this.completedExperiments; + } + + public ExperimentStatistics setCompletedExperiments(List<ExperimentSummary> completedExperiments) { + this.completedExperiments = completedExperiments; + return this; + } + + public void unsetCompletedExperiments() { + this.completedExperiments = null; + } + + /** Returns true if field completedExperiments is set (has been assigned a value) and false otherwise */ + public boolean isSetCompletedExperiments() { + return this.completedExperiments != null; + } + + public void setCompletedExperimentsIsSet(boolean value) { + if (!value) { + this.completedExperiments = null; + } + } + + public int getFailedExperimentsSize() { + return (this.failedExperiments == null) ? 0 : this.failedExperiments.size(); + } + + public java.util.Iterator<ExperimentSummary> getFailedExperimentsIterator() { + return (this.failedExperiments == null) ? null : this.failedExperiments.iterator(); + } + + public void addToFailedExperiments(ExperimentSummary elem) { + if (this.failedExperiments == null) { + this.failedExperiments = new ArrayList<ExperimentSummary>(); + } + this.failedExperiments.add(elem); + } + + public List<ExperimentSummary> getFailedExperiments() { + return this.failedExperiments; + } + + public ExperimentStatistics setFailedExperiments(List<ExperimentSummary> failedExperiments) { + this.failedExperiments = failedExperiments; + return this; + } + + public void unsetFailedExperiments() { + this.failedExperiments = null; + } + + /** Returns true if field failedExperiments is set (has been assigned a value) and false otherwise */ + public boolean isSetFailedExperiments() { + return this.failedExperiments != null; + } + + public void setFailedExperimentsIsSet(boolean value) { + if (!value) { + this.failedExperiments = null; + } + } + + public int getCancelledExperimentsSize() { + return (this.cancelledExperiments == null) ? 0 : this.cancelledExperiments.size(); + } + + public java.util.Iterator<ExperimentSummary> getCancelledExperimentsIterator() { + return (this.cancelledExperiments == null) ? null : this.cancelledExperiments.iterator(); + } + + public void addToCancelledExperiments(ExperimentSummary elem) { + if (this.cancelledExperiments == null) { + this.cancelledExperiments = new ArrayList<ExperimentSummary>(); + } + this.cancelledExperiments.add(elem); + } + + public List<ExperimentSummary> getCancelledExperiments() { + return this.cancelledExperiments; + } + + public ExperimentStatistics setCancelledExperiments(List<ExperimentSummary> cancelledExperiments) { + this.cancelledExperiments = cancelledExperiments; + return this; + } + + public void unsetCancelledExperiments() { + this.cancelledExperiments = null; + } + + /** Returns true if field cancelledExperiments is set (has been assigned a value) and false otherwise */ + public boolean isSetCancelledExperiments() { + return this.cancelledExperiments != null; + } + + public void setCancelledExperimentsIsSet(boolean value) { + if (!value) { + this.cancelledExperiments = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case ALL_EXPERIMENT_COUNT: + if (value == null) { + unsetAllExperimentCount(); + } else { + setAllExperimentCount((Integer)value); + } + break; + + case COMPLETED_EXPERIMENT_COUNT: + if (value == null) { + unsetCompletedExperimentCount(); + } else { + setCompletedExperimentCount((Integer)value); + } + break; + + case CANCELLED_EXPERIMENT_COUNT: + if (value == null) { + unsetCancelledExperimentCount(); + } else { + setCancelledExperimentCount((Integer)value); + } + break; + + case FAILED_EXPERIMENT_COUNT: + if (value == null) { + unsetFailedExperimentCount(); + } else { + setFailedExperimentCount((Integer)value); + } + break; + + case ALL_EXPERIMENTS: + if (value == null) { + unsetAllExperiments(); + } else { + setAllExperiments((List<ExperimentSummary>)value); + } + break; + + case COMPLETED_EXPERIMENTS: + if (value == null) { + unsetCompletedExperiments(); + } else { + setCompletedExperiments((List<ExperimentSummary>)value); + } + break; + + case FAILED_EXPERIMENTS: + if (value == null) { + unsetFailedExperiments(); + } else { + setFailedExperiments((List<ExperimentSummary>)value); + } + break; + + case CANCELLED_EXPERIMENTS: + if (value == null) { + unsetCancelledExperiments(); + } else { + setCancelledExperiments((List<ExperimentSummary>)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case ALL_EXPERIMENT_COUNT: + return Integer.valueOf(getAllExperimentCount()); + + case COMPLETED_EXPERIMENT_COUNT: + return Integer.valueOf(getCompletedExperimentCount()); + + case CANCELLED_EXPERIMENT_COUNT: + return Integer.valueOf(getCancelledExperimentCount()); + + case FAILED_EXPERIMENT_COUNT: + return Integer.valueOf(getFailedExperimentCount()); + + case ALL_EXPERIMENTS: + return getAllExperiments(); + + case COMPLETED_EXPERIMENTS: + return getCompletedExperiments(); + + case FAILED_EXPERIMENTS: + return getFailedExperiments(); + + case CANCELLED_EXPERIMENTS: + return getCancelledExperiments(); + + } + throw new IllegalStateException(); + } + + /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case ALL_EXPERIMENT_COUNT: + return isSetAllExperimentCount(); + case COMPLETED_EXPERIMENT_COUNT: + return isSetCompletedExperimentCount(); + case CANCELLED_EXPERIMENT_COUNT: + return isSetCancelledExperimentCount(); + case FAILED_EXPERIMENT_COUNT: + return isSetFailedExperimentCount(); + case ALL_EXPERIMENTS: + return isSetAllExperiments(); + case COMPLETED_EXPERIMENTS: + return isSetCompletedExperiments(); + case FAILED_EXPERIMENTS: + return isSetFailedExperiments(); + case CANCELLED_EXPERIMENTS: + return isSetCancelledExperiments(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof ExperimentStatistics) + return this.equals((ExperimentStatistics)that); + return false; + } + + public boolean equals(ExperimentStatistics that) { + if (that == null) + return false; + + boolean this_present_allExperimentCount = true; + boolean that_present_allExperimentCount = true; + if (this_present_allExperimentCount || that_present_allExperimentCount) { + if (!(this_present_allExperimentCount && that_present_allExperimentCount)) + return false; + if (this.allExperimentCount != that.allExperimentCount) + return false; + } + + boolean this_present_completedExperimentCount = true; + boolean that_present_completedExperimentCount = true; + if (this_present_completedExperimentCount || that_present_completedExperimentCount) { + if (!(this_present_completedExperimentCount && that_present_completedExperimentCount)) + return false; + if (this.completedExperimentCount != that.completedExperimentCount) + return false; + } + + boolean this_present_cancelledExperimentCount = true && this.isSetCancelledExperimentCount(); + boolean that_present_cancelledExperimentCount = true && that.isSetCancelledExperimentCount(); + if (this_present_cancelledExperimentCount || that_present_cancelledExperimentCount) { + if (!(this_present_cancelledExperimentCount && that_present_cancelledExperimentCount)) + return false; + if (this.cancelledExperimentCount != that.cancelledExperimentCount) + return false; + } + + boolean this_present_failedExperimentCount = true; + boolean that_present_failedExperimentCount = true; + if (this_present_failedExperimentCount || that_present_failedExperimentCount) { + if (!(this_present_failedExperimentCount && that_present_failedExperimentCount)) + return false; + if (this.failedExperimentCount != that.failedExperimentCount) + return false; + } + + boolean this_present_allExperiments = true && this.isSetAllExperiments(); + boolean that_present_allExperiments = true && that.isSetAllExperiments(); + if (this_present_allExperiments || that_present_allExperiments) { + if (!(this_present_allExperiments && that_present_allExperiments)) + return false; + if (!this.allExperiments.equals(that.allExperiments)) + return false; + } + + boolean this_present_completedExperiments = true && this.isSetCompletedExperiments(); + boolean that_present_completedExperiments = true && that.isSetCompletedExperiments(); + if (this_present_completedExperiments || that_present_completedExperiments) { + if (!(this_present_completedExperiments && that_present_completedExperiments)) + return false; + if (!this.completedExperiments.equals(that.completedExperiments)) + return false; + } + + boolean this_present_failedExperiments = true && this.isSetFailedExperiments(); + boolean that_present_failedExperiments = true && that.isSetFailedExperiments(); + if (this_present_failedExperiments || that_present_failedExperiments) { + if (!(this_present_failedExperiments && that_present_failedExperiments)) + return false; + if (!this.failedExperiments.equals(that.failedExperiments)) + return false; + } + + boolean this_present_cancelledExperiments = true && this.isSetCancelledExperiments(); + boolean that_present_cancelledExperiments = true && that.isSetCancelledExperiments(); + if (this_present_cancelledExperiments || that_present_cancelledExperiments) { + if (!(this_present_cancelledExperiments && that_present_cancelledExperiments)) + return false; + if (!this.cancelledExperiments.equals(that.cancelledExperiments)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(ExperimentStatistics other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetAllExperimentCount()).compareTo(other.isSetAllExperimentCount()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAllExperimentCount()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.allExperimentCount, other.allExperimentCount); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetCompletedExperimentCount()).compareTo(other.isSetCompletedExperimentCount()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetCompletedExperimentCount()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.completedExperimentCount, other.completedExperimentCount); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetCancelledExperimentCount()).compareTo(other.isSetCancelledExperimentCount()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetCancelledExperimentCount()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.cancelledExperimentCount, other.cancelledExperimentCount); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetFailedExperimentCount()).compareTo(other.isSetFailedExperimentCount()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetFailedExperimentCount()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.failedExperimentCount, other.failedExperimentCount); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetAllExperiments()).compareTo(other.isSetAllExperiments()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAllExperiments()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.allExperiments, other.allExperiments); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetCompletedExperiments()).compareTo(other.isSetCompletedExperiments()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetCompletedExperiments()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.completedExperiments, other.completedExperiments); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetFailedExperiments()).compareTo(other.isSetFailedExperiments()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetFailedExperiments()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.failedExperiments, other.failedExperiments); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetCancelledExperiments()).compareTo(other.isSetCancelledExperiments()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetCancelledExperiments()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.cancelledExperiments, other.cancelledExperiments); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("ExperimentStatistics("); + boolean first = true; + + sb.append("allExperimentCount:"); + sb.append(this.allExperimentCount); + first = false; + if (!first) sb.append(", "); + sb.append("completedExperimentCount:"); + sb.append(this.completedExperimentCount); + first = false; + if (isSetCancelledExperimentCount()) { + if (!first) sb.append(", "); + sb.append("cancelledExperimentCount:"); + sb.append(this.cancelledExperimentCount); + first = false; + } + if (!first) sb.append(", "); + sb.append("failedExperimentCount:"); + sb.append(this.failedExperimentCount); + first = false; + if (!first) sb.append(", "); + sb.append("allExperiments:"); + if (this.allExperiments == null) { + sb.append("null"); + } else { + sb.append(this.allExperiments); + } + first = false; + if (isSetCompletedExperiments()) { + if (!first) sb.append(", "); + sb.append("completedExperiments:"); + if (this.completedExperiments == null) { + sb.append("null"); + } else { + sb.append(this.completedExperiments); + } + first = false; + } + if (isSetFailedExperiments()) { + if (!first) sb.append(", "); + sb.append("failedExperiments:"); + if (this.failedExperiments == null) { + sb.append("null"); + } else { + sb.append(this.failedExperiments); + } + first = false; + } + if (isSetCancelledExperiments()) { + if (!first) sb.append(", "); + sb.append("cancelledExperiments:"); + if (this.cancelledExperiments == null) { + sb.append("null"); + } else { + sb.append(this.cancelledExperiments); + } + first = false; + } + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + // alas, we cannot check 'allExperimentCount' because it's a primitive and you chose the non-beans generator. + // alas, we cannot check 'completedExperimentCount' because it's a primitive and you chose the non-beans generator. + // alas, we cannot check 'failedExperimentCount' because it's a primitive and you chose the non-beans generator. + if (allExperiments == null) { + throw new TProtocolException("Required field 'allExperiments' was not present! Struct: " + toString()); + } + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor. + __isset_bitfield = 0; + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (TException te) { + throw new java.io.IOException(te); + } + } + + private static class ExperimentStatisticsStandardSchemeFactory implements SchemeFactory { + public ExperimentStatisticsStandardScheme getScheme() { + return new ExperimentStatisticsStandardScheme(); + } + } + + private static class ExperimentStatisticsStandardScheme extends StandardScheme<ExperimentStatistics> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, ExperimentStatistics struct) throws TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) + { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // ALL_EXPERIMENT_COUNT + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.allExperimentCount = iprot.readI32(); + struct.setAllExperimentCountIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // COMPLETED_EXPERIMENT_COUNT + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.completedExperimentCount = iprot.readI32(); + struct.setCompletedExperimentCountIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 3: // CANCELLED_EXPERIMENT_COUNT + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.cancelledExperimentCount = iprot.readI32(); + struct.setCancelledExperimentCountIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 4: // FAILED_EXPERIMENT_COUNT + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.failedExperimentCount = iprot.readI32(); + struct.setFailedExperimentCountIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 5: // ALL_EXPERIMENTS + if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { + { + org.apache.thrift.protocol.TList _list152 = iprot.readListBegin(); + struct.allExperiments = new ArrayList<ExperimentSummary>(_list152.size); + for (int _i153 = 0; _i153 < _list152.size; ++_i153) + { + ExperimentSummary _elem154; + _elem154 = new ExperimentSummary(); + _elem154.read(iprot); + struct.allExperiments.add(_elem154); + } + iprot.readListEnd(); + } + struct.setAllExperimentsIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 6: // COMPLETED_EXPERIMENTS + if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { + { + org.apache.thrift.protocol.TList _list155 = iprot.readListBegin(); + struct.completedExperiments = new ArrayList<ExperimentSummary>(_list155.size); + for (int _i156 = 0; _i156 < _list155.size; ++_i156) + { + ExperimentSummary _elem157; + _elem157 = new ExperimentSummary(); + _elem157.read(iprot); + struct.completedExperiments.add(_elem157); + } + iprot.readListEnd(); + } + struct.setCompletedExperimentsIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 7: // FAILED_EXPERIMENTS + if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { + { + org.apache.thrift.protocol.TList _list158 = iprot.readListBegin(); + struct.failedExperiments = new ArrayList<ExperimentSummary>(_list158.size); + for (int _i159 = 0; _i159 < _list158.size; ++_i159) + { + ExperimentSummary _elem160; + _elem160 = new ExperimentSummary(); + _elem160.read(iprot); + struct.failedExperiments.add(_elem160); + } + iprot.readListEnd(); + } + struct.setFailedExperimentsIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 8: // CANCELLED_EXPERIMENTS + if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { + { + org.apache.thrift.protocol.TList _list161 = iprot.readListBegin(); + struct.cancelledExperiments = new ArrayList<ExperimentSummary>(_list161.size); + for (int _i162 = 0; _i162 < _list161.size; ++_i162) + { + ExperimentSummary _elem163; + _elem163 = new ExperimentSummary(); + _elem163.read(iprot); + struct.cancelledExperiments.add(_elem163); + } + iprot.readListEnd(); + } + struct.setCancelledExperimentsIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + if (!struct.isSetAllExperimentCount()) { + throw new TProtocolException("Required field 'allExperimentCount' was not found in serialized data! Struct: " + toString()); + } + if (!struct.isSetCompletedExperimentCount()) { + throw new TProtocolException("Required field 'completedExperimentCount' was not found in serialized data! Struct: " + toString()); + } + if (!struct.isSetFailedExperimentCount()) { + throw new TProtocolException("Required field 'failedExperimentCount' was not found in serialized data! Struct: " + toString()); + } + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, ExperimentStatistics struct) throws TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldBegin(ALL_EXPERIMENT_COUNT_FIELD_DESC); + oprot.writeI32(struct.allExperimentCount); + oprot.writeFieldEnd(); + oprot.writeFieldBegin(COMPLETED_EXPERIMENT_COUNT_FIELD_DESC); + oprot.writeI32(struct.completedExperimentCount); + oprot.writeFieldEnd(); + if (struct.isSetCancelledExperimentCount()) { + oprot.writeFieldBegin(CANCELLED_EXPERIMENT_COUNT_FIELD_DESC); + oprot.writeI32(struct.cancelledExperimentCount); + oprot.writeFieldEnd(); + } + oprot.writeFieldBegin(FAILED_EXPERIMENT_COUNT_FIELD_DESC); + oprot.writeI32(struct.failedExperimentCount); + oprot.writeFieldEnd(); + if (struct.allExperiments != null) { + oprot.writeFieldBegin(ALL_EXPERIMENTS_FIELD_DESC); + { + oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.allExperiments.size())); + for (ExperimentSummary _iter164 : struct.allExperiments) + { + _iter164.write(oprot); + } + oprot.writeListEnd(); + } + oprot.writeFieldEnd(); + } + if (struct.completedExperiments != null) { + if (struct.isSetCompletedExperiments()) { + oprot.writeFieldBegin(COMPLETED_EXPERIMENTS_FIELD_DESC); + { + oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.completedExperiments.size())); + for (ExperimentSummary _iter165 : struct.completedExperiments) + { + _iter165.write(oprot); + } + oprot.writeListEnd(); + } + oprot.writeFieldEnd(); + } + } + if (struct.failedExperiments != null) { + if (struct.isSetFailedExperiments()) { + oprot.writeFieldBegin(FAILED_EXPERIMENTS_FIELD_DESC); + { + oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.failedExperiments.size())); + for (ExperimentSummary _iter166 : struct.failedExperiments) + { + _iter166.write(oprot); + } + oprot.writeListEnd(); + } + oprot.writeFieldEnd(); + } + } + if (struct.cancelledExperiments != null) { + if (struct.isSetCancelledExperiments()) { + oprot.writeFieldBegin(CANCELLED_EXPERIMENTS_FIELD_DESC); + { + oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.cancelledExperiments.size())); + for (ExperimentSummary _iter167 : struct.cancelledExperiments) + { + _iter167.write(oprot); + } + oprot.writeListEnd(); + } + oprot.writeFieldEnd(); + } + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class ExperimentStatisticsTupleSchemeFactory implements SchemeFactory { + public ExperimentStatisticsTupleScheme getScheme() { + return new ExperimentStatisticsTupleScheme(); + } + } + + private static class ExperimentStatisticsTupleScheme extends TupleScheme<ExperimentStatistics> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, ExperimentStatistics struct) throws TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + oprot.writeI32(struct.allExperimentCount); + oprot.writeI32(struct.completedExperimentCount); + oprot.writeI32(struct.failedExperimentCount); + { + oprot.writeI32(struct.allExperiments.size()); + for (ExperimentSummary _iter168 : struct.allExperiments) + { + _iter168.write(oprot); + } + } + BitSet optionals = new BitSet(); + if (struct.isSetCancelledExperimentCount()) { + optionals.set(0); + } + if (struct.isSetCompletedExperiments()) { + optionals.set(1); + } + if (struct.isSetFailedExperiments()) { + optionals.set(2); + } + if (struct.isSetCancelledExperiments()) { + optionals.set(3); + } + oprot.writeBitSet(optionals, 4); + if (struct.isSetCancelledExperimentCount()) { + oprot.writeI32(struct.cancelledExperimentCount); + } + if (struct.isSetCompletedExperiments()) { + { + oprot.writeI32(struct.completedExperiments.size()); + for (ExperimentSummary _iter169 : struct.completedExperiments) + { + _iter169.write(oprot); + } + } + } + if (struct.isSetFailedExperiments()) { + { + oprot.writeI32(struct.failedExperiments.size()); + for (ExperimentSummary _iter170 : struct.failedExperiments) + { + _iter170.write(oprot); + } + } + } + if (struct.isSetCancelledExperiments()) { + { + oprot.writeI32(struct.cancelledExperiments.size()); + for (ExperimentSummary _iter171 : struct.cancelledExperiments) + { + _iter171.write(oprot); + } + } + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, ExperimentStatistics struct) throws TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + struct.allExperimentCount = iprot.readI32(); + struct.setAllExperimentCountIsSet(true); + struct.completedExperimentCount = iprot.readI32(); + struct.setCompletedExperimentCountIsSet(true); + struct.failedExperimentCount = iprot.readI32(); + struct.setFailedExperimentCountIsSet(true); + { + org.apache.thrift.protocol.TList _list172 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.allExperiments = new ArrayList<ExperimentSummary>(_list172.size); + for (int _i173 = 0; _i173 < _list172.size; ++_i173) + { + ExperimentSummary _elem174; + _elem174 = new ExperimentSummary(); + _elem174.read(iprot); + struct.allExperiments.add(_elem174); + } + } + struct.setAllExperimentsIsSet(true); + BitSet incoming = iprot.readBitSet(4); + if (incoming.get(0)) { + struct.cancelledExperimentCount = iprot.readI32(); + struct.setCancelledExperimentCountIsSet(true); + } + if (incoming.get(1)) { + { + org.apache.thrift.protocol.TList _list175 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.completedExperiments = new ArrayList<ExperimentSummary>(_list175.size); + for (int _i176 = 0; _i176 < _list175.size; ++_i176) + { + ExperimentSummary _elem177; + _elem177 = new ExperimentSummary(); + _elem177.read(iprot); + struct.completedExperiments.add(_elem177); + } + } + struct.setCompletedExperimentsIsSet(true); + } + if (incoming.get(2)) { + { + org.apache.thrift.protocol.TList _list178 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.failedExperiments = new ArrayList<ExperimentSummary>(_list178.size); + for (int _i179 = 0; _i179 < _list178.size; ++_i179) + { + ExperimentSummary _elem180; + _elem180 = new ExperimentSummary(); + _elem180.read(iprot); + struct.failedExperiments.add(_elem180); + } + } + struct.setFailedExperimentsIsSet(true); + } + if (incoming.get(3)) { + { + org.apache.thrift.protocol.TList _list181 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.cancelledExperiments = new ArrayList<ExperimentSummary>(_list181.size); + for (int _i182 = 0; _i182 < _list181.size; ++_i182) + { + ExperimentSummary _elem183; + _elem183 = new ExperimentSummary(); + _elem183.read(iprot); + struct.cancelledExperiments.add(_elem183); + } + } + struct.setCancelledExperimentsIsSet(true); + } + } + } + +} +
http://git-wip-us.apache.org/repos/asf/airavata/blob/2c6620f0/component-interface-descriptions/airavata-api/airavataAPI.thrift ---------------------------------------------------------------------- diff --git a/component-interface-descriptions/airavata-api/airavataAPI.thrift b/component-interface-descriptions/airavata-api/airavataAPI.thrift index 699e96b..1dafab2 100644 --- a/component-interface-descriptions/airavata-api/airavataAPI.thrift +++ b/component-interface-descriptions/airavata-api/airavataAPI.thrift @@ -525,6 +525,21 @@ service Airavata { 2: airavataErrors.AiravataClientException ace, 3: airavataErrors.AiravataSystemException ase) + /** + * Get Experiment Statisitics for the given gateway for a specific time period + * @param gatewayId + * Identifier of the requested gateway + * @param fromTime + * Starting date time + * @param toTime + * Ending data time + **/ + experimentModel.ExperimentStatistics getExperimentStatistics(1: required string gatewayId, + 2: required i64 fromTime, 3: required i64 toTime) + throws (1: airavataErrors.InvalidRequestException ire, + 2: airavataErrors.AiravataClientException ace, + 3: airavataErrors.AiravataSystemException ase) + /** * Get all Experiments within a Project * http://git-wip-us.apache.org/repos/asf/airavata/blob/2c6620f0/component-interface-descriptions/airavata-api/experimentModel.thrift ---------------------------------------------------------------------- diff --git a/component-interface-descriptions/airavata-api/experimentModel.thrift b/component-interface-descriptions/airavata-api/experimentModel.thrift index 7bc2dc7..f9d76ab 100644 --- a/component-interface-descriptions/airavata-api/experimentModel.thrift +++ b/component-interface-descriptions/airavata-api/experimentModel.thrift @@ -409,3 +409,14 @@ struct ExperimentSummary { 7: optional string applicationId, 8: optional ExperimentStatus experimentStatus, } + +struct ExperimentStatistics { + 1: required i32 allExperimentCount, + 2: required i32 completedExperimentCount, + 3: optional i32 cancelledExperimentCount, + 4: required i32 failedExperimentCount, + 5: required list<ExperimentSummary> allExperiments, + 6: optional list<ExperimentSummary> completedExperiments, + 7: optional list<ExperimentSummary> failedExperiments, + 8: optional list<ExperimentSummary> cancelledExperiments, +} http://git-wip-us.apache.org/repos/asf/airavata/blob/2c6620f0/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/ExperimentCatalogImpl.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/ExperimentCatalogImpl.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/ExperimentCatalogImpl.java index e71cff0..81f2c8b 100644 --- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/ExperimentCatalogImpl.java +++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/ExperimentCatalogImpl.java @@ -544,6 +544,9 @@ public class ExperimentCatalogImpl implements ExperimentCatalog { result.add(ex); } return result; + case EXPERIMENT_STATISTICS: + result.add(experimentRegistry.getExperimentStatistics(filters)); + return result; default: logger.error("Unsupported data type...", new UnsupportedOperationException()); throw new UnsupportedOperationException(); http://git-wip-us.apache.org/repos/asf/airavata/blob/2c6620f0/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/ExperimentRegistry.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/ExperimentRegistry.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/ExperimentRegistry.java index 6bae21f..1187e37 100644 --- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/ExperimentRegistry.java +++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/impl/ExperimentRegistry.java @@ -2940,6 +2940,57 @@ public class ExperimentRegistry { return null; } + /** + * Method to get experiment execution statistics for a specific time period + * @param filters + * @return + * @throws RegistryException + */ + public ExperimentStatistics getExperimentStatistics(Map<String,String> filters) throws RegistryException { + try { + ExperimentStatistics experimentStatistics = new ExperimentStatistics(); + ExperimentStatisticsResource experimentStatisticsResource = workerResource.getExperimentStatistics( + filters.get(Constants.FieldConstants.ExperimentConstants.GATEWAY), + new Timestamp(Long.parseLong(filters.get(Constants.FieldConstants.ExperimentConstants.FROM_DATE))), + new Timestamp(Long.parseLong(filters.get(Constants.FieldConstants.ExperimentConstants.TO_DATE))) + ); + + experimentStatistics.setAllExperimentCount(experimentStatisticsResource.getAllExperimentCount()); + experimentStatistics.setCompletedExperimentCount(experimentStatisticsResource.getCompletedExperimentCount()); + experimentStatistics.setFailedExperimentCount(experimentStatisticsResource.getFailedExperimentCount()); + experimentStatistics.setCancelledExperimentCount(experimentStatisticsResource.getCancelledExperimentCount()); + + ArrayList<ExperimentSummary> experimentSummaries = new ArrayList(); + for (ExperimentSummaryResource ex : experimentStatisticsResource.getAllExperiments()) { + experimentSummaries.add(ThriftDataModelConversion.getExperimentSummary(ex)); + } + experimentStatistics.setAllExperiments(experimentSummaries); + + experimentSummaries = new ArrayList(); + for (ExperimentSummaryResource ex : experimentStatisticsResource.getCompletedExperiments()) { + experimentSummaries.add(ThriftDataModelConversion.getExperimentSummary(ex)); + } + experimentStatistics.setCompletedExperiments(experimentSummaries); + + experimentSummaries = new ArrayList(); + for (ExperimentSummaryResource ex : experimentStatisticsResource.getFailedExperiments()) { + experimentSummaries.add(ThriftDataModelConversion.getExperimentSummary(ex)); + } + experimentStatistics.setFailedExperiments(experimentSummaries); + + experimentSummaries = new ArrayList(); + for (ExperimentSummaryResource ex : experimentStatisticsResource.getCancelledExperiments()) { + experimentSummaries.add(ThriftDataModelConversion.getExperimentSummary(ex)); + } + experimentStatistics.setCancelledExperiments(experimentSummaries); + + return experimentStatistics; + } catch (RegistryException e) { + logger.error("Error while retrieving experiment statistics from registry", e); + throw new RegistryException(e); + } + } + public boolean isValidStatusTransition(ExperimentState oldState, ExperimentState nextState) { if (nextState == null) { return false; http://git-wip-us.apache.org/repos/asf/airavata/blob/2c6620f0/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ExperimentStatisticsResource.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ExperimentStatisticsResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ExperimentStatisticsResource.java new file mode 100644 index 0000000..11cc510 --- /dev/null +++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/experiment/catalog/resources/ExperimentStatisticsResource.java @@ -0,0 +1,133 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * +*/ +package org.apache.airavata.registry.core.experiment.catalog.resources; + +import org.apache.airavata.registry.core.experiment.catalog.ExperimentCatResource; +import org.apache.airavata.registry.core.experiment.catalog.ResourceType; +import org.apache.airavata.registry.cpi.RegistryException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.el.MethodNotFoundException; +import java.util.List; + +public class ExperimentStatisticsResource extends AbstractExpCatResource { + private final static Logger logger = LoggerFactory.getLogger(ExperimentStatisticsResource.class); + + private int allExperimentCount; + private int completedExperimentCount; + private int cancelledExperimentCount; + private int failedExperimentCount; + + private List<ExperimentSummaryResource> allExperiments; + private List<ExperimentSummaryResource> completedExperiments; + private List<ExperimentSummaryResource> cancelledExperiments; + private List<ExperimentSummaryResource> failedExperiments; + + @Override + public ExperimentCatResource create(ResourceType type) throws RegistryException { + throw new MethodNotFoundException(); + } + + @Override + public void remove(ResourceType type, Object name) throws RegistryException { + throw new MethodNotFoundException(); + } + + @Override + public ExperimentCatResource get(ResourceType type, Object name) throws RegistryException { + throw new MethodNotFoundException(); + } + + @Override + public List<ExperimentCatResource> get(ResourceType type) throws RegistryException { + throw new MethodNotFoundException(); + } + + @Override + public void save() throws RegistryException { + throw new MethodNotFoundException(); + } + + public int getAllExperimentCount() { + return allExperimentCount; + } + + public void setAllExperimentCount(int allExperimentCount) { + this.allExperimentCount = allExperimentCount; + } + + public int getCompletedExperimentCount() { + return completedExperimentCount; + } + + public void setCompletedExperimentCount(int completedExperimentCount) { + this.completedExperimentCount = completedExperimentCount; + } + + public int getCancelledExperimentCount() { + return cancelledExperimentCount; + } + + public void setCancelledExperimentCount(int cancelledExperimentCount) { + this.cancelledExperimentCount = cancelledExperimentCount; + } + + public int getFailedExperimentCount() { + return failedExperimentCount; + } + + public void setFailedExperimentCount(int failedExperimentCount) { + this.failedExperimentCount = failedExperimentCount; + } + + public List<ExperimentSummaryResource> getAllExperiments() { + return allExperiments; + } + + public void setAllExperiments(List<ExperimentSummaryResource> allExperiments) { + this.allExperiments = allExperiments; + } + + public List<ExperimentSummaryResource> getCompletedExperiments() { + return completedExperiments; + } + + public void setCompletedExperiments(List<ExperimentSummaryResource> completedExperiments) { + this.completedExperiments = completedExperiments; + } + + public List<ExperimentSummaryResource> getCancelledExperiments() { + return cancelledExperiments; + } + + public void setCancelledExperiments(List<ExperimentSummaryResource> cancelledExperiments) { + this.cancelledExperiments = cancelledExperiments; + } + + public List<ExperimentSummaryResource> getFailedExperiments() { + return failedExperiments; + } + + public void setFailedExperiments(List<ExperimentSummaryResource> failedExperiments) { + this.failedExperiments = failedExperiments; + } +} \ No newline at end of file
