Bläddra i källkod

API: updated analysis api to new match new rules

Lacey Sanderson 11 år sedan
förälder
incheckning
43bd01ec26

+ 115 - 0
tripal_analysis/api/tripal_analysis.DEPRECATED.inc

@@ -0,0 +1,115 @@
+<?php
+/**
+ * @file
+ * Wrapper functions to provide backwards compatibility for the tripal analysis api
+ */
+
+/**
+ * @deprecated Restructured API to make naming more readable and consistent.
+ * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
+ * This function has been replaced by chado_get_property().
+ *
+ * @see chado_get_property().
+ */
+function tripal_analysis_get_property($analysis_id, $property, $cv_name = 'tripal') {
+
+  tripal_report_error(
+    'tripal_api',
+    TRIPAL_NOTICE,
+    "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
+    array(
+      '%old_function'=>'tripal_analysis_get_property',
+      '%new_function' => 'chado_get_property'
+    )
+  );
+
+  return chado_get_property('analysis', $analysis_id, $property, $cv_name);
+}
+
+/**
+ * @deprecated Restructured API to make naming more readable and consistent.
+ * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
+ * This function has been replaced by chado_insert_property().
+ *
+ * @see chado_insert_property().
+ */
+function tripal_analysis_insert_property($analysis_id, $property, $value, $update_if_present = 0, $cv_name = 'tripal') {
+
+  tripal_report_error(
+    'tripal_api',
+    TRIPAL_NOTICE,
+    "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
+    array(
+      '%old_function'=>'tripal_analysis_insert_property',
+      '%new_function' => 'chado_insert_property'
+    )
+  );
+
+  return chado_insert_property('analysis', $analysis_id, $property, $cv_name, $value, $update_if_present);
+}
+
+/**
+ * @deprecated Restructured API to make naming more readable and consistent.
+ * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
+ * This function has been replaced by chado_update_property().
+ *
+ * @see chado_update_property().
+ */
+function tripal_analysis_update_property($analysis_id, $property, $value, $insert_if_missing = 0, $cv_name = 'tripal') {
+
+  tripal_report_error(
+    'tripal_api',
+    TRIPAL_NOTICE,
+    "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
+    array(
+      '%old_function'=>'tripal_analysis_update_property',
+      '%new_function' => 'chado_update_property'
+    )
+  );
+
+  return chado_update_property('analysis', $analysis_id, $property, $cv_name, $value, $insert_if_missing);
+}
+
+/**
+ * @deprecated Restructured API to make naming more readable and consistent.
+ * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
+ * This function has been replaced by the more generic chado_delete_property().
+ *
+ * @see chado_delete_property().
+ */
+function tripal_analysis_delete_property($analysis_id, $property, $cv_name = 'tripal') {
+
+  tripal_report_error(
+    'tripal_api',
+    TRIPAL_NOTICE,
+    "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
+    array(
+      '%old_function'=>'tripal_analysis_delete_property',
+      '%new_function' => 'chado_delete_property'
+    )
+  );
+
+  return chado_delete_property('analysis', $analysis_id, $property, $cv_name);
+}
+
+/**
+ * @deprecated Restructured API to make naming more readable and consistent.
+ * Function was deprecated in Tripal 2.0 and will be removed 2 releases from now.
+ * This function has been replaced by chado_get_analysis().
+ *
+ * @see chado_get_analysis().
+ */
+function tripal_analysis_get_node($analysis_id) {
+
+  tripal_report_error(
+    'tripal_api',
+    TRIPAL_NOTICE,
+    "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
+    array(
+      '%old_function'=>'tripal_analysis_get_node',
+      '%new_function' => 'chado_get_analysis'
+    )
+  );
+
+  return chado_get_analysis(array('analysis_id' => $analysis_id));
+}

+ 0 - 110
tripal_analysis/api/tripal_analysis.api.inc

@@ -44,113 +44,3 @@ function tripal_analysis_unregister_child($modulename) {
       db_query($sql, array(':modname' => $modulename));
   }
 }
-
-/**
- * Retrieve properties of a given type for a given analysis
- *
- * @param $analysis_id
- *    The analysis_id of the properties you would like to retrieve
- * @param $property
- *    The cvterm name of the properties to retrieve
- * @param $cvname
- *   The name of the vocabulary to which the term belongs. Defaults to 'tripal'.
- *
- * @return
- *    An analysis chado variable with the specified properties expanded
- *
- * @ingroup tripal_analysis_api
- */
-function tripal_analysis_get_property($analysis_id, $property, $cvname = 'tripal') {
-  return chado_get_property('analysis', $analysis_id, $property, $cvname);
-}
-
-/**
- * Insert a given property
- *
- * @param $analysis_id
- *   The analysis_id of the property to insert
- * @param $property
- *   The cvterm name of the property to insert
- * @param $value
- *   The value of the property to insert
- * @param $update_if_present
- *   A boolean indicated whether to update the record if it's already present
- * @param $cvname
- *   The name of the vocabulary to which the term belongs. Defaults to 'tripal'.
- *
- * @return
- *   True of success, False otherwise
- *
- * @ingroup tripal_analysis_api
- */
-function tripal_analysis_insert_property($analysis_id, $property, $value, $update_if_present = 0, $cvname = 'tripal') {
-    return chado_insert_property('analysis', $analysis_id, $property, $cvname, $value, $update_if_present);
-}
-
-/**
- * Update a given property
- *
- * @param $analysis_id
- *   The analysis_id of the property to update
- * @param $property
- *   The cvterm name of the property to update
- * @param $value
- *   The value of the property to update
- * @param $insert_if_missing
- *   A boolean indicated whether to insert the record if it's absent
- * @param $cvname
- *   The name of the vocabulary to which the term belongs. Defaults to 'tripal'.
- *
- * Note: The property will be identified using the unique combination of the $analysis_id and $property
- * and then it will be updated with the supplied value
- *
- * @return
- *   True of success, False otherwise
- *
- * @ingroup tripal_analysis_api
- */
-function tripal_analysis_update_property($analysis_id, $property, $value, $insert_if_missing = 0, $cvname = 'tripal') {
-  return chado_update_property('analysis', $analysis_id, $property, $cvname, $value, $insert_if_missing);
-}
-
-/**
- * Delete a given property
- *
- * @param $analysis_id
- *   The analysis_id of the property to delete
- * @param $property
- *   The cvterm name of the property to delete
- * @param $cvname
- *   The name of the vocabulary to which the term belongs. Defaults to 'tripal'.
- *
- * Note: The property will be identified using the unique combination of the $analysis_id and $property
- * and then it will be deleted
- *
- * @return
- *   True of success, False otherwise
- *
- * @ingroup tripal_analysis_api
- */
-function tripal_analysis_delete_property($analysis_id, $property, $cvname = 'tripal') {
-  return chado_delete_property('analysis', $analysis_id, $property, $cvname);
-}
-
-/**
- * Retreives the node of a sync'ed analysis
- *
- * @param $analysis_id
- *   The analysis_id of the property to delete
- *
- * @return
- *   node of analysis on success, null otherwise
- *
- * @ingroup tripal_analysis_api
- */
-function tripal_analysis_get_node($analysis_id) {
-  $sql = "SELECT *
-           FROM {chado_analysis} CA
-              INNER JOIN {node} N on CA.nid = N.nid
-           WHERE analysis_id = :analysis_id";
-  $node = db_query($sql, array(':analysis_id' => $analysis_id))->fetchObject();
-  return $node;
-}

+ 1 - 0
tripal_analysis/tripal_analysis.module

@@ -9,6 +9,7 @@
 
 require_once 'api/tripal_analysis.api.inc';
 require_once 'api/tripal_analysis.schema.api.inc';
+require_once 'api/tripal_analysis.DEPRECATED.inc';
 
 require_once 'includes/tripal_analysis_privacy.inc';
 require_once 'includes/tripal_analysis.admin.inc';