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/06/22 14:01:44 UTC
[6/9] airavata git commit: Fixing getIds CPI methods in experiment
registry
Fixing getIds CPI methods in experiment registry
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/bf7db065
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/bf7db065
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/bf7db065
Branch: refs/heads/master
Commit: bf7db06539c8ca0ba10fd540a881af4e35396cc5
Parents: fb30f5d
Author: Supun Nakandala <sc...@apache.org>
Authored: Mon Jun 22 13:26:24 2015 +0530
Committer: Supun Nakandala <sc...@apache.org>
Committed: Mon Jun 22 13:26:24 2015 +0530
----------------------------------------------------------------------
.../catalog/impl/ExperimentCatalogImpl.java | 4 +-
.../catalog/impl/ExperimentRegistry.java | 101 ++++++++++---------
2 files changed, 53 insertions(+), 52 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/bf7db065/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 97fa40e..19a7698 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
@@ -558,9 +558,9 @@ public class ExperimentCatalogImpl implements ExperimentCatalog {
case EXPERIMENT:
return experimentRegistry.getExperimentIDs(fieldName, value);
case PROCESS:
- return experimentRegistry.getTaskDetailIds(fieldName, value);
+ return experimentRegistry.getProcessIds(fieldName, value);
case TASK:
- return experimentRegistry.getJobDetailIds(fieldName, value);
+ return experimentRegistry.getTaskIds(fieldName, value);
default:
logger.error("Unsupported data type...", new UnsupportedOperationException());
throw new UnsupportedOperationException();
http://git-wip-us.apache.org/repos/asf/airavata/blob/bf7db065/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 aa0bb41..9fa8daf 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
@@ -1124,6 +1124,57 @@ public class ExperimentRegistry {
}
}
+ //CPI getIds method
+ public List<String> getExperimentIDs(String fieldName, Object value) throws RegistryException {
+ List<String> expIDs = new ArrayList<String>();
+ try {
+ if (fieldName.equals(Constants.FieldConstants.ExperimentConstants.GATEWAY_EXECUTION_ID)) {
+ if (gatewayResource == null) {
+ logger.error("You should use an existing gateway in order to retrieve experiments..");
+ return null;
+ } else {
+ List<ExperimentResource> resources = gatewayResource.getExperiments();
+ for (ExperimentResource resource : resources) {
+ String expID = resource.getExperimentId();
+ expIDs.add(expID);
+ }
+ }
+ } else if (fieldName.equals(Constants.FieldConstants.ExperimentConstants.USER_NAME)) {
+ List<ExperimentResource> resources = workerResource.getExperiments();
+ for (ExperimentResource resource : resources) {
+ expIDs.add(resource.getExperimentId());
+ }
+ } else if (fieldName.equals(Constants.FieldConstants.ExperimentConstants.PROJECT_ID)) {
+ List<ExperimentResource> resources = workerResource.getExperiments();
+ for (ExperimentResource resource : resources) {
+ expIDs.add(resource.getExperimentId());
+ }
+ }
+ } catch (Exception e) {
+ logger.error("Error while retrieving experiment ids..", e);
+ throw new RegistryException(e);
+ }
+ return expIDs;
+ }
+
+
+ public List<String> getProcessIds(String fieldName, Object value) throws RegistryException {
+ List<String> processIds = new ArrayList<String>();
+ List<ProcessModel> processes = getProcessList(fieldName, value);
+ for (ProcessModel td : processes) {
+ processIds.add(td.getProcessId());
+ }
+ return processIds;
+ }
+
+ public List<String> getTaskIds(String fieldName, Object value) throws RegistryException {
+ List<String> taskIds = new ArrayList<String>();
+ List<TaskModel> tasks = getTaskList(fieldName, value);
+ for (TaskModel task : tasks) {
+ taskIds.add(task.getTaskId());
+ }
+ return taskIds;
+ }
// ids - taskId + jobid
public void updateJobDetails(JobModel jobDetails, CompositeIdentifier ids) throws RegistryException {
@@ -1914,39 +1965,6 @@ public class ExperimentRegistry {
// }
// }
- public List<String> getExperimentIDs(String fieldName, Object value) throws RegistryException {
-// List<String> expIDs = new ArrayList<String>();
-// try {
-// if (fieldName.equals(Constants.FieldConstants.ExperimentConstants.GATEWAY)) {
-// if (gatewayResource == null) {
-// logger.error("You should use an existing gateway in order to retrieve experiments..");
-// return null;
-// } else {
-// List<ExperimentResource> resources = gatewayResource.getExperiments();
-// for (ExperimentResource resource : resources) {
-// String expID = resource.getExpID();
-// expIDs.add(expID);
-// }
-// }
-// } else if (fieldName.equals(Constants.FieldConstants.ExperimentConstants.USER_NAME)) {
-// List<ExperimentResource> resources = workerResource.getExperiments();
-// for (ExperimentResource resource : resources) {
-// expIDs.add(resource.getExpID());
-// }
-// } else if (fieldName.equals(Constants.FieldConstants.ExperimentConstants.PROJECT_ID)) {
-// List<ExperimentResource> resources = workerResource.getExperiments();
-// for (ExperimentResource resource : resources) {
-// expIDs.add(resource.getExpID());
-// }
-// }
-// } catch (Exception e) {
-// logger.error("Error while retrieving experiment ids..", e);
-// throw new RegistryException(e);
-// }
-// return expIDs;
- return null;
- }
-
// public List<String> getWorkflowNodeIds(String fieldName, Object value) throws RegistryException {
// List<String> wfIds = new ArrayList<String>();
// List<WorkflowNodeDetails> wfNodeDetails = getWFNodeDetails(fieldName, value);
@@ -1956,23 +1974,6 @@ public class ExperimentRegistry {
// return wfIds;
// }
- public List<String> getTaskDetailIds(String fieldName, Object value) throws RegistryException {
- List<String> taskDetailIds = new ArrayList<String>();
- List<TaskModel> taskDetails = getTaskDetails(fieldName, value);
- for (TaskModel td : taskDetails) {
- taskDetailIds.add(td.getTaskId());
- }
- return taskDetailIds;
- }
-
- public List<String> getJobDetailIds(String fieldName, Object value) throws RegistryException {
- List<String> jobIds = new ArrayList<String>();
- List<JobModel> jobDetails = getJobDetails(fieldName, value);
- for (JobModel jd : jobDetails) {
- jobIds.add(jd.getJobId());
- }
- return jobIds;
- }
//
// public List<String> getTransferDetailIds(String fieldName, Object value) throws RegistryException {
// List<String> transferIds = new ArrayList<String>();