airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From scnakand...@apache.org
Subject [22/50] [abbrv] airavata-php-gateway git commit: updating thrift libraries, updating project, experiment search methods
Date Thu, 07 Jul 2016 19:27:26 GMT
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/83b53328/app/libraries/Airavata/Model/Experiment/Types.php
----------------------------------------------------------------------
diff --git a/app/libraries/Airavata/Model/Experiment/Types.php b/app/libraries/Airavata/Model/Experiment/Types.php
index 20587b6..5018139 100644
--- a/app/libraries/Airavata/Model/Experiment/Types.php
+++ b/app/libraries/Airavata/Model/Experiment/Types.php
@@ -45,6 +45,15 @@ final class ExperimentSearchFields {
   );
 }
 
+final class ProjectSearchFields {
+  const PROJECT_NAME = 0;
+  const PROJECT_DESCRIPTION = 1;
+  static public $__names = array(
+    0 => 'PROJECT_NAME',
+    1 => 'PROJECT_DESCRIPTION',
+  );
+}
+
 /**
  * A structure holding the experiment configuration.
  * 

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/83b53328/app/libraries/ExperimentUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/ExperimentUtilities.php b/app/libraries/ExperimentUtilities.php
index 038e176..612d0ea 100644
--- a/app/libraries/ExperimentUtilities.php
+++ b/app/libraries/ExperimentUtilities.php
@@ -1030,63 +1030,6 @@ class ExperimentUtilities
     }
 
     /**
-     * Get results of the user's search of experiments
-     * @return array|null
-     */
-    public static function get_expsearch_results($inputs)
-    {
-        $experiments = array();
-
-        try {
-            switch ($inputs["search-key"]) {
-                case 'experiment-name':
-                    $experiments = Airavata::searchExperimentsByName(Session::get('authz-token'),
Session::get('gateway_id'), Session::get('username'), $inputs["search-value"]);
-                    break;
-                case 'experiment-description':
-                    $experiments = Airavata::searchExperimentsByDesc(Session::get('authz-token'),
Session::get('gateway_id'), Session::get('username'), $inputs["search-value"]);
-                    break;
-                case 'application':
-                    $experiments = Airavata::searchExperimentsByApplication(Session::get('authz-token'),
Session::get('gateway_id'), Session::get('username'), $inputs["search-value"]);
-                    break;
-                case 'creation-time':
-                    $experiments = Airavata::searchExperimentsByCreationTime(Session::get('authz-token'),
Session::get('gateway_id'), Session::get('username'), strtotime($inputs["from-date"]) * 1000,
strtotime($inputs["to-date"]) * 1000);
-                    break;
-                case '':
-            }
-        } catch (InvalidRequestException $ire) {
-            CommonUtilities::print_error_message('InvalidRequestException!<br><br>'
. $ire->getMessage());
-        } catch (AiravataClientException $ace) {
-            CommonUtilities::print_error_message('AiravataClientException!<br><br>'
. $ace->getMessage());
-        } catch (AiravataSystemException $ase) {
-            if ($ase->airavataErrorType == 2) // 2 = INTERNAL_ERROR
-            {
-                CommonUtilities::print_info_message('<p>You have not created any experiments
yet, so no results will be returned!</p>
-                                <p>Click <a href="create_experiment.php">here</a>
to create an experiment, or
-                                <a href="create_project.php">here</a> to create
a new project.</p>');
-            } else {
-                CommonUtilities::print_error_message('There was a problem with Airavata.
Please try again later or report a bug using the link in the Help menu.');
-                //print_error_message('AiravataSystemException!<br><br>' . $ase->airavataErrorType
. ': ' . $ase->getMessage());
-            }
-        } catch (TTransportException $tte) {
-            CommonUtilities::print_error_message('TTransportException!<br><br>'
. $tte->getMessage());
-        }
-
-        //get values of all experiments
-        $expContainer = array();
-        $expNum = 0;
-        foreach ($experiments as $experiment) {
-            $expValue = ExperimentUtilities::get_experiment_values($experiment, true);
-            $expContainer[$expNum]['experiment'] = $experiment;
-            if ($expValue["experimentStatusString"] == "FAILED")
-                $expValue["editable"] = false;
-            $expContainer[$expNum]['expValue'] = $expValue;
-            $expNum++;
-        }
-
-        return $expContainer;
-    }
-
-    /**
      * Get results of the user's all experiments with pagination.
      * Results are ordered creation time DESC
      * @return array|null

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/83b53328/app/libraries/ProjectUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/ProjectUtilities.php b/app/libraries/ProjectUtilities.php
index 2e2dd70..95fe488 100644
--- a/app/libraries/ProjectUtilities.php
+++ b/app/libraries/ProjectUtilities.php
@@ -236,12 +236,14 @@ class ProjectUtilities
         try {
             switch ($searchKey) {
                 case 'project-name':
-                    $projects = Airavata::searchProjectsByProjectName(Session::get('authz-token'),
Session::get("gateway_id"),
-                        Session::get("username"), $searchValue, $limit, $offset);
+                    $filters[\Airavata\Model\Experiment\ProjectSearchFields::PROJECT_NAME]
= $searchValue;
+                    $projects = Airavata::searchProjects(Session::get('authz-token'), Session::get("gateway_id"),
+                        Session::get("username"), $filters, $limit, $offset);
                     break;
                 case 'project-description':
-                    $projects = Airavata::searchProjectsByProjectDesc(Session::get('authz-token'),
Session::get("gateway_id"),
-                        Session::get("username"), $searchValue, $limit, $offset);
+                    $filters[\Airavata\Model\Experiment\ProjectSearchFields::PROJECT_DESCRIPTION]
= $searchValue;
+                    $projects = Airavata::searchProjects(Session::get('authz-token'), Session::get("gateway_id"),
+                        Session::get("username"), $filters, $limit, $offset);
                     break;
             }
         } catch (InvalidRequestException $ire) {
@@ -263,40 +265,4 @@ class ProjectUtilities
 
         return $projects;
     }
-
-
-    public static function get_projsearch_results($searchKey, $searchValue)
-    {
-
-        $projects = array();
-
-        try {
-            switch ($searchKey) {
-                case 'project-name':
-                    $projects = Airavata::searchProjectsByProjectName(Session::get('authz-token'),
Session::get("gateway_id"), Session::get("username"), $searchValue);
-                    break;
-                case 'project-description':
-                    $projects = Airavata::searchProjectsByProjectDesc(Session::get('authz-token'),
Session::get("gateway_id"), Session::get("username"), $searchValue);
-                    break;
-            }
-        } catch (InvalidRequestException $ire) {
-            CommonUtilities::print_error_message('InvalidRequestException!<br><br>'
. $ire->getMessage());
-        } catch (AiravataClientException $ace) {
-            CommonUtilities::print_error_message('AiravataClientException!<br><br>'
. $ace->getMessage());
-        } catch (AiravataSystemException $ase) {
-            if ($ase->airavataErrorType == 2) // 2 = INTERNAL_ERROR
-            {
-                CommonUtilities::print_info_message('<p>You have not created any projects
yet, so no results will be returned!</p>
-                                <p>Click <a href="create_project.php">here</a>
to create a new project.</p>');
-            } else {
-                CommonUtilities::print_error_message('There was a problem with Airavata.
Please try again later, or report a bug using the link in the Help menu.');
-                //print_error_message('AiravataSystemException!<br><br>' . $ase->airavataErrorType
. ': ' . $ase->getMessage());
-            }
-        } catch (TTransportException $tte) {
-            CommonUtilities::print_error_message('TTransportException!<br><br>'
. $tte->getMessage());
-        }
-
-        return $projects;
-    }
-
 }
\ No newline at end of file


Mime
View raw message