You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sc...@apache.org on 2015/05/31 23:23:14 UTC
[03/13] airavata git commit: Improving the experiment search
operation performance.
Improving the experiment search operation performance.
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/cd5ad247
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/cd5ad247
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/cd5ad247
Branch: refs/heads/master
Commit: cd5ad247c60f9795d6ba32693ea6a35ef383f524
Parents: 9f9c2e0
Author: Supun Nakandala <sc...@apache.org>
Authored: Sun May 31 12:27:00 2015 +0530
Committer: Supun Nakandala <sc...@apache.org>
Committed: Sun May 31 12:27:00 2015 +0530
----------------------------------------------------------------------
.../persistance/registry/jpa/ResourceType.java | 1 +
.../registry/jpa/impl/ExperimentRegistry.java | 10 +-
.../registry/jpa/model/ExperimentSummary.java | 198 +++++++++++++++++++
.../resources/ExperimentSummaryResource.java | 143 ++++++++++++++
.../registry/jpa/resources/Utils.java | 59 ++++++
.../registry/jpa/resources/WorkerResource.java | 26 ++-
.../jpa/utils/ThriftDataModelConversion.java | 63 ++----
.../src/main/resources/META-INF/persistence.xml | 1 +
.../registry/jpa/RegistryUseCaseTest.java | 2 +-
9 files changed, 438 insertions(+), 65 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/cd5ad247/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceType.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceType.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceType.java
index 0a38664..55a4d0f 100644
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceType.java
+++ b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceType.java
@@ -28,6 +28,7 @@ public enum ResourceType {
CONFIGURATION,
GATEWAY_WORKER,
EXPERIMENT,
+ EXPERIMENT_SUMMARY,
NOTIFICATION_EMAIL,
EXPERIMENT_INPUT,
EXPERIMENT_OUTPUT,
http://git-wip-us.apache.org/repos/asf/airavata/blob/cd5ad247/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/ExperimentRegistry.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/ExperimentRegistry.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/ExperimentRegistry.java
index 6d3b34b..5b63641 100644
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/ExperimentRegistry.java
+++ b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/ExperimentRegistry.java
@@ -2893,16 +2893,16 @@ public class ExperimentRegistry {
toTime = Long.parseLong(filters.get(field));
}
}
- List<ExperimentResource> experimentResources;
+ List<ExperimentSummaryResource> experimentSummaryResources;
if (fromTime != 0 && toTime != 0) {
- experimentResources = workerResource.searchExperiments(new Timestamp(fromTime), new Timestamp(toTime), fil
+ experimentSummaryResources = workerResource.searchExperiments(new Timestamp(fromTime), new Timestamp(toTime), fil
,limit , offset, orderByIdentifier, resultOrderType);
} else {
- experimentResources = workerResource
+ experimentSummaryResources = workerResource
.searchExperiments(null, null, fil, limit, offset, orderByIdentifier, resultOrderType);
}
- if (experimentResources != null && !experimentResources.isEmpty()) {
- for (ExperimentResource ex : experimentResources) {
+ if (experimentSummaryResources != null && !experimentSummaryResources.isEmpty()) {
+ for (ExperimentSummaryResource ex : experimentSummaryResources) {
experimentSummaries.add(ThriftDataModelConversion.getExperimentSummary(ex));
}
}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cd5ad247/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/ExperimentSummary.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/ExperimentSummary.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/ExperimentSummary.java
new file mode 100644
index 0000000..52338c3
--- /dev/null
+++ b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/ExperimentSummary.java
@@ -0,0 +1,198 @@
+/*
+*
+* 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.persistance.registry.jpa.model;
+
+import org.apache.openjpa.persistence.DataCache;
+
+import javax.persistence.*;
+import java.io.Serializable;
+import java.sql.Timestamp;
+import java.util.Collection;
+
+@Entity
+@Table(name = "EXPERIMENT")
+@DataCache
+public class ExperimentSummary implements Serializable {
+ @Id
+ @Column(name = "EXPERIMENT_ID")
+ private String expId;
+ @Column(name = "GATEWAY_ID")
+ private String gatewayId;
+ @Column(name = "EXECUTION_USER")
+ private String executionUser;
+ @Column(name = "PROJECT_ID")
+ private String projectID;
+ @Column(name = "CREATION_TIME")
+ private Timestamp creationTime;
+ @Column(name = "EXPERIMENT_NAME")
+ private String expName;
+ @Column(name = "EXPERIMENT_DESCRIPTION")
+ private String expDesc;
+ @Column(name = "APPLICATION_ID")
+ private String applicationId;
+ @Column(name = "APPLICATION_VERSION")
+ private String appVersion;
+ @Column(name = "WORKFLOW_TEMPLATE_ID")
+ private String workflowTemplateId;
+ @Column(name = "WORKFLOW_TEMPLATE_VERSION")
+ private String workflowTemplateVersion;
+ @Column(name = "WORKFLOW_EXECUTION_ID")
+ private String workflowExecutionId;
+ @Column(name = "ALLOW_NOTIFICATION")
+ private boolean allowNotification;
+ @Column(name = "GATEWAY_EXECUTION_ID")
+ private String gatewayExecutionId;
+
+ @OneToMany(fetch = FetchType.EAGER, mappedBy = "experiment")
+ private Collection<ErrorDetail> errorDetails;
+
+ @OneToMany(fetch = FetchType.EAGER, mappedBy = "experiment")
+ private Collection<Status> statuses;
+
+ public String getExpId() {
+ return expId;
+ }
+
+ public void setExpId(String expId) {
+ this.expId = expId;
+ }
+
+ public String getGatewayId() {
+ return gatewayId;
+ }
+
+ public void setGatewayId(String gatewayId) {
+ this.gatewayId = gatewayId;
+ }
+
+ public String getExecutionUser() {
+ return executionUser;
+ }
+
+ public void setExecutionUser(String executionUser) {
+ this.executionUser = executionUser;
+ }
+
+ public String getProjectId() {
+ return projectID;
+ }
+
+ public void setProjectId(String projectId) {
+ this.projectID = projectId;
+ }
+
+ public Timestamp getCreationTime() {
+ return creationTime;
+ }
+
+ public void setCreationTime(Timestamp creationTime) {
+ this.creationTime = creationTime;
+ }
+
+ public String getExpName() {
+ return expName;
+ }
+
+ public void setExpName(String expName) {
+ this.expName = expName;
+ }
+
+ public String getExpDesc() {
+ return expDesc;
+ }
+
+ public void setExpDesc(String expDesc) {
+ this.expDesc = expDesc;
+ }
+
+ public String getApplicationId() {
+ return applicationId;
+ }
+
+ public void setApplicationId(String applicationId) {
+ this.applicationId = applicationId;
+ }
+
+ public String getAppVersion() {
+ return appVersion;
+ }
+
+ public void setAppVersion(String appVersion) {
+ this.appVersion = appVersion;
+ }
+
+ public String getWorkflowTemplateId() {
+ return workflowTemplateId;
+ }
+
+ public void setWorkflowTemplateId(String workflowTemplateId) {
+ this.workflowTemplateId = workflowTemplateId;
+ }
+
+ public String getWorkflowTemplateVersion() {
+ return workflowTemplateVersion;
+ }
+
+ public void setWorkflowTemplateVersion(String workflowTemplateVersion) {
+ this.workflowTemplateVersion = workflowTemplateVersion;
+ }
+
+ public String getWorkflowExecutionId() {
+ return workflowExecutionId;
+ }
+
+ public void setWorkflowExecutionId(String workflowExecutionId) {
+ this.workflowExecutionId = workflowExecutionId;
+ }
+
+ public boolean isAllowNotification() {
+ return allowNotification;
+ }
+
+ public void setAllowNotification(boolean allowNotification) {
+ this.allowNotification = allowNotification;
+ }
+
+ public String getGatewayExecutionId() {
+ return gatewayExecutionId;
+ }
+
+ public void setGatewayExecutionId(String gatewayExecutionId) {
+ this.gatewayExecutionId = gatewayExecutionId;
+ }
+
+ public Collection<ErrorDetail> getErrorDetailsByExperimentId() {
+ return errorDetails;
+ }
+
+ public void setErrorDetailsByExperimentId(Collection<ErrorDetail> errorDetailsByExperimentId) {
+ this.errorDetails = errorDetailsByExperimentId;
+ }
+
+ public Collection<Status> getStatusesByExperimentId() {
+ return statuses;
+ }
+
+ public void setStatusesByExperimentId(Collection<Status> statusesByExperimentId) {
+ this.statuses = statusesByExperimentId;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cd5ad247/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentSummaryResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentSummaryResource.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentSummaryResource.java
new file mode 100644
index 0000000..0e54f80
--- /dev/null
+++ b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentSummaryResource.java
@@ -0,0 +1,143 @@
+/*
+ *
+ * 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.persistance.registry.jpa.resources;
+
+import org.apache.airavata.persistance.registry.jpa.Resource;
+import org.apache.airavata.persistance.registry.jpa.ResourceType;
+import org.apache.airavata.registry.cpi.RegistryException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.el.MethodNotFoundException;
+import java.sql.Timestamp;
+import java.util.List;
+
+public class ExperimentSummaryResource extends AbstractResource {
+ private final static Logger logger = LoggerFactory.getLogger(ExperimentSummaryResource.class);
+
+ private String executionUser;
+ private String expID;
+ private String projectID;
+ private Timestamp creationTime;
+ private String expName;
+ private String description;
+ private String applicationId;
+
+ private List<ErrorDetailResource> errorDetails;
+ private StatusResource status;
+
+ @Override
+ public Resource create(ResourceType type) throws RegistryException {
+ throw new MethodNotFoundException();
+ }
+
+ @Override
+ public void remove(ResourceType type, Object name) throws RegistryException {
+ throw new MethodNotFoundException();
+ }
+
+ @Override
+ public Resource get(ResourceType type, Object name) throws RegistryException {
+ throw new MethodNotFoundException();
+ }
+
+ @Override
+ public List<Resource> get(ResourceType type) throws RegistryException {
+ throw new MethodNotFoundException();
+ }
+
+ @Override
+ public void save() throws RegistryException {
+ throw new MethodNotFoundException();
+ }
+
+ public String getExecutionUser() {
+ return executionUser;
+ }
+
+ public void setExecutionUser(String executionUser) {
+ this.executionUser = executionUser;
+ }
+
+ public String getExpID() {
+ return expID;
+ }
+
+ public void setExpID(String expID) {
+ this.expID = expID;
+ }
+
+ public String getProjectID() {
+ return projectID;
+ }
+
+ public void setProjectID(String projectID) {
+ this.projectID = projectID;
+ }
+
+ public Timestamp getCreationTime() {
+ return creationTime;
+ }
+
+ public void setCreationTime(Timestamp creationTime) {
+ this.creationTime = creationTime;
+ }
+
+ public String getExpName() {
+ return expName;
+ }
+
+ public void setExpName(String expName) {
+ this.expName = expName;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getApplicationId() {
+ return applicationId;
+ }
+
+ public void setApplicationId(String applicationId) {
+ this.applicationId = applicationId;
+ }
+
+ public List<ErrorDetailResource> getErrorDetails() {
+ return errorDetails;
+ }
+
+ public void setErrorDetails(List<ErrorDetailResource> errorDetails) {
+ this.errorDetails = errorDetails;
+ }
+
+ public StatusResource getStatus() {
+ return status;
+ }
+
+ public void setStatus(StatusResource status) {
+ this.status = status;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/cd5ad247/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/Utils.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/Utils.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/Utils.java
index 34bd1fd..ce4d1d0 100644
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/Utils.java
+++ b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/Utils.java
@@ -30,6 +30,9 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.net.URI;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
public class Utils {
@@ -214,6 +217,13 @@ public class Utils {
logger.error("Object should be a Experiment.", new IllegalArgumentException());
throw new IllegalArgumentException("Object should be a Experiment.");
}
+ case EXPERIMENT_SUMMARY:
+ if (o instanceof ExperimentSummary){
+ return createExperimentSummary((ExperimentSummary)o);
+ }else {
+ logger.error("Object should be a ExperimentSummary.", new IllegalArgumentException());
+ throw new IllegalArgumentException("Object should be a ExperimentSummary.");
+ }
case NOTIFICATION_EMAIL:
if (o instanceof Notification_Email){
return createNotificationEmail((Notification_Email)o);
@@ -472,6 +482,55 @@ public class Utils {
return experimentResource;
}
+ /**
+ *
+ * @param o ExperimentSummary model object
+ * @return ExperimentSummary Resource object
+ */
+ private static Resource createExperimentSummary(ExperimentSummary o) {
+ ExperimentSummaryResource experimentSummaryResource = new ExperimentSummaryResource();
+ if (o != null){
+ experimentSummaryResource.setExecutionUser(o.getExecutionUser());
+ experimentSummaryResource.setExpID(o.getExpId());
+ experimentSummaryResource.setExpName(o.getExpName());
+ experimentSummaryResource.setProjectID(o.getProjectId());
+ experimentSummaryResource.setCreationTime(o.getCreationTime());
+ experimentSummaryResource.setDescription(o.getExpDesc());
+ experimentSummaryResource.setApplicationId(o.getApplicationId());
+
+ List<ErrorDetailResource> errorDetailResourceList = new ArrayList();
+ for(ErrorDetail err: o.getErrorDetailsByExperimentId()){
+ ErrorDetailResource errorDetailResource = new ErrorDetailResource();
+ errorDetailResource.setErrorId(err.getErrorID());
+ errorDetailResource.setJobId(err.getJobId());
+ errorDetailResource.setCreationTime(o.getCreationTime());
+ if (err.getActualErrorMsg() != null){
+ errorDetailResource.setActualErrorMsg(new String(err.getActualErrorMsg()));
+ }
+ errorDetailResource.setUserFriendlyErrorMsg(err.getUserFriendlyErrorMsg());
+ errorDetailResource.setTransientPersistent(err.isTransientPersistent());
+ errorDetailResource.setErrorCategory(err.getErrorCategory());
+ errorDetailResource.setCorrectiveAction(err.getCorrectiveAction());
+ errorDetailResource.setActionableGroup(err.getActionableGroup());
+ errorDetailResourceList.add(errorDetailResource);
+ }
+ experimentSummaryResource.setErrorDetails(errorDetailResourceList);
+
+ Collection<Status> statusList = o.getStatusesByExperimentId();
+ if(statusList != null && statusList.size()>0){
+ StatusResource statusResource = new StatusResource();
+ statusResource.setStatusId(statusList.iterator().next().getStatusId());
+ statusResource.setJobId(statusList.iterator().next().getJobId());
+ statusResource.setState(statusList.iterator().next().getState());
+ statusResource.setStatusUpdateTime(statusList.iterator().next().getStatusUpdateTime());
+ statusResource.setStatusType(statusList.iterator().next().getStatusType());
+ experimentSummaryResource.setStatus(statusResource);
+ }
+ }
+
+ return experimentSummaryResource;
+ }
+
private static Resource createNotificationEmail (Notification_Email o){
NotificationEmailResource emailResource = new NotificationEmailResource();
if (o != null){
http://git-wip-us.apache.org/repos/asf/airavata/blob/cd5ad247/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkerResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkerResource.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkerResource.java
index 85d9343..96e83c9 100644
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkerResource.java
+++ b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/WorkerResource.java
@@ -601,9 +601,10 @@ public class WorkerResource extends AbstractResource {
}
/**
- * To search the experiments of user with the given filter criteria and retrieve the results with
+ * To search the experiments of user with the given time period and filter criteria and retrieve the results with
* pagination support. Results can be ordered based on an identifier (i.e column) either ASC or
- * DESC. But in the current implementation ordering is only supported based on creationTime
+ * DESC. But in the current implementation ordering is only supported based on creationTime. Also if
+ * time period values i.e fromTime and toTime are null they will be ignored.
*
* @param fromTime
* @param toTime
@@ -615,20 +616,17 @@ public class WorkerResource extends AbstractResource {
* @return
* @throws RegistryException
*/
- public List<ExperimentResource> searchExperiments(Timestamp fromTime, Timestamp toTime, Map<String, String> filters, int limit,
+ public List<ExperimentSummaryResource> searchExperiments(Timestamp fromTime, Timestamp toTime, Map<String, String> filters, int limit,
int offset, Object orderByIdentifier, ResultOrderType resultOrderType) throws RegistryException {
- List<ExperimentResource> result = new ArrayList<>();
+ List<ExperimentSummaryResource> result = new ArrayList();
EntityManager em = null;
try {
- String query;
+ String query = "SELECT e FROM ExperimentSummary e " +
+ "LEFT JOIN e.statuses s LEFT JOIN FETCH e.errorDetails LEFT JOIN FETCH e.statuses WHERE ";
if(filters.get(StatusConstants.STATE) != null) {
String experimentState = ExperimentState.valueOf(filters.get(StatusConstants.STATE)).toString();
- query = "SELECT e FROM Status s " +
- "JOIN s.experiment e " +
- "WHERE s.state='" + experimentState + "' " +
+ query += "s.state='" + experimentState + "' " +
"AND s.statusType='" + StatusType.EXPERIMENT + "' AND ";
- }else {
- query = "SELECT e from Experiment e WHERE ";
}
if(toTime != null && fromTime != null && toTime.after(fromTime)){
@@ -675,10 +673,10 @@ public class WorkerResource extends AbstractResource {
List resultList = q.getResultList();
for (Object o : resultList) {
- Experiment experiment = (Experiment) o;
- ExperimentResource experimentResource =
- (ExperimentResource) Utils.getResource(ResourceType.EXPERIMENT, experiment);
- result.add(experimentResource);
+ ExperimentSummary experimentSummary = (ExperimentSummary) o;
+ ExperimentSummaryResource experimentSummaryResource =
+ (ExperimentSummaryResource) Utils.getResource(ResourceType.EXPERIMENT_SUMMARY, experimentSummary);
+ result.add(experimentSummaryResource);
}
em.getTransaction().commit();
em.close();
http://git-wip-us.apache.org/repos/asf/airavata/blob/cd5ad247/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/utils/ThriftDataModelConversion.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/utils/ThriftDataModelConversion.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/utils/ThriftDataModelConversion.java
index 8f385e8..2282a7e 100644
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/utils/ThriftDataModelConversion.java
+++ b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/utils/ThriftDataModelConversion.java
@@ -21,40 +21,12 @@
package org.apache.airavata.persistance.registry.jpa.utils;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.airavata.common.utils.StringUtil;
-import org.apache.airavata.model.appcatalog.appinterface.*;
+import org.apache.airavata.model.appcatalog.appinterface.DataType;
+import org.apache.airavata.model.appcatalog.appinterface.InputDataObjectType;
+import org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType;
import org.apache.airavata.model.workspace.Gateway;
import org.apache.airavata.model.workspace.Project;
-import org.apache.airavata.model.workspace.experiment.ActionableGroup;
-import org.apache.airavata.model.workspace.experiment.AdvancedInputDataHandling;
-import org.apache.airavata.model.workspace.experiment.AdvancedOutputDataHandling;
-import org.apache.airavata.model.workspace.experiment.ApplicationStatus;
-import org.apache.airavata.model.workspace.experiment.ComputationalResourceScheduling;
-import org.apache.airavata.model.workspace.experiment.CorrectiveAction;
-import org.apache.airavata.model.workspace.experiment.DataTransferDetails;
-import org.apache.airavata.model.workspace.experiment.ErrorCategory;
-import org.apache.airavata.model.workspace.experiment.ErrorDetails;
-import org.apache.airavata.model.workspace.experiment.ExecutionUnit;
-import org.apache.airavata.model.workspace.experiment.Experiment;
-import org.apache.airavata.model.workspace.experiment.ExperimentState;
-import org.apache.airavata.model.workspace.experiment.ExperimentStatus;
-import org.apache.airavata.model.workspace.experiment.ExperimentSummary;
-import org.apache.airavata.model.workspace.experiment.JobDetails;
-import org.apache.airavata.model.workspace.experiment.JobState;
-import org.apache.airavata.model.workspace.experiment.JobStatus;
-import org.apache.airavata.model.workspace.experiment.QualityOfServiceParams;
-import org.apache.airavata.model.workspace.experiment.TaskDetails;
-import org.apache.airavata.model.workspace.experiment.TaskState;
-import org.apache.airavata.model.workspace.experiment.TaskStatus;
-import org.apache.airavata.model.workspace.experiment.TransferState;
-import org.apache.airavata.model.workspace.experiment.TransferStatus;
-import org.apache.airavata.model.workspace.experiment.UserConfigurationData;
-import org.apache.airavata.model.workspace.experiment.WorkflowNodeDetails;
-import org.apache.airavata.model.workspace.experiment.WorkflowNodeState;
-import org.apache.airavata.model.workspace.experiment.WorkflowNodeStatus;
+import org.apache.airavata.model.workspace.experiment.*;
import org.apache.airavata.persistance.registry.jpa.Resource;
import org.apache.airavata.persistance.registry.jpa.ResourceType;
import org.apache.airavata.persistance.registry.jpa.resources.*;
@@ -62,6 +34,9 @@ import org.apache.airavata.registry.cpi.RegistryException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.util.ArrayList;
+import java.util.List;
+
public class ThriftDataModelConversion {
private final static Logger logger = LoggerFactory.getLogger(ThriftDataModelConversion.class);
@@ -159,23 +134,21 @@ public class ThriftDataModelConversion {
return null;
}
- public static ExperimentSummary getExperimentSummary(ExperimentResource experimentResource) throws RegistryException {
- if (experimentResource != null){
+ public static ExperimentSummary getExperimentSummary(ExperimentSummaryResource experimentSummaryResource) throws RegistryException {
+ if (experimentSummaryResource != null){
ExperimentSummary experimentSummary = new ExperimentSummary();
- if (experimentResource.getProject()!= null){
- experimentSummary.setProjectID(experimentResource.getProject().getId());
- }
- experimentSummary.setExperimentID(experimentResource.getExpID());
- experimentSummary.setCreationTime(experimentResource.getCreationTime().getTime());
- experimentSummary.setUserName(experimentResource.getExecutionUser());
- experimentSummary.setName(experimentResource.getExpName());
- experimentSummary.setDescription(experimentResource.getDescription());
- experimentSummary.setApplicationId(experimentResource.getApplicationId());
- StatusResource experimentStatus = experimentResource.getExperimentStatus();
+ experimentSummary.setProjectID(experimentSummaryResource.getProjectID());
+ experimentSummary.setExperimentID(experimentSummaryResource.getExpID());
+ experimentSummary.setCreationTime(experimentSummaryResource.getCreationTime().getTime());
+ experimentSummary.setUserName(experimentSummaryResource.getExecutionUser());
+ experimentSummary.setName(experimentSummaryResource.getExpName());
+ experimentSummary.setDescription(experimentSummaryResource.getDescription());
+ experimentSummary.setApplicationId(experimentSummaryResource.getApplicationId());
+ StatusResource experimentStatus = experimentSummaryResource.getStatus();
if (experimentStatus != null){
experimentSummary.setExperimentStatus(getExperimentStatus(experimentStatus));
}
- List<ErrorDetailResource> errorDetails = experimentResource.getErrorDetails();
+ List<ErrorDetailResource> errorDetails = experimentSummaryResource.getErrorDetails();
if (errorDetails!= null && !errorDetails.isEmpty()){
experimentSummary.setErrors(getErrorDetailList(errorDetails));
}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cd5ad247/modules/registry/airavata-jpa-registry/src/main/resources/META-INF/persistence.xml
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/resources/META-INF/persistence.xml b/modules/registry/airavata-jpa-registry/src/main/resources/META-INF/persistence.xml
index 9055d3d..a8b6f70 100644
--- a/modules/registry/airavata-jpa-registry/src/main/resources/META-INF/persistence.xml
+++ b/modules/registry/airavata-jpa-registry/src/main/resources/META-INF/persistence.xml
@@ -30,6 +30,7 @@
<class>org.apache.airavata.persistance.registry.jpa.model.Project</class>
<class>org.apache.airavata.persistance.registry.jpa.model.ProjectUser</class>
<class>org.apache.airavata.persistance.registry.jpa.model.Experiment</class>
+ <class>org.apache.airavata.persistance.registry.jpa.model.ExperimentSummary</class>
<class>org.apache.airavata.persistance.registry.jpa.model.Notification_Email</class>
<class>org.apache.airavata.persistance.registry.jpa.model.Experiment_Input</class>
<class>org.apache.airavata.persistance.registry.jpa.model.Experiment_Output</class>
http://git-wip-us.apache.org/repos/asf/airavata/blob/cd5ad247/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/RegistryUseCaseTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/RegistryUseCaseTest.java b/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/RegistryUseCaseTest.java
index 5c473f5..55757fc 100644
--- a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/RegistryUseCaseTest.java
+++ b/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/RegistryUseCaseTest.java
@@ -274,7 +274,7 @@ public class RegistryUseCaseTest {
list = registry.search(RegistryModelType.EXPERIMENT, filters);
Assert.assertTrue(list.size()==3);
- //searching user experiemets with pagination
+ //searching user experiments with pagination
filters = new HashMap();
filters.put(Constants.FieldConstants.ExperimentConstants.USER_NAME, "TestUser" + TAG);
filters.put(Constants.FieldConstants.ExperimentConstants.GATEWAY, gatewayId);