[Fusionforge-commits] r12230 - in branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application: controllers models views/scripts/fusionforgecm

Olivier Berger olberger at libremir.placard.fr.eu.org
Thu Feb 10 16:12:04 CET 2011


Author: olberger
Date: 2011-02-10 16:12:04 +0100 (Thu, 10 Feb 2011)
New Revision: 12230

Modified:
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/controllers/FusionForgeOSLCConnector.php
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/models/fusionforge.inc.php
   branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/_resource_xml.php
Log:
Import fix done in trunk.

Modified: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/controllers/FusionForgeOSLCConnector.php
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/controllers/FusionForgeOSLCConnector.php	2011-02-10 15:11:58 UTC (rev 12229)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/controllers/FusionForgeOSLCConnector.php	2011-02-10 15:12:04 UTC (rev 12230)
@@ -62,7 +62,7 @@
 		'dc:title',
 		'dc:description',
 		'dc:creator',
-		'helios_bt:status',
+		'oslc_cm:status',
 		'helios_bt:priority',
 		'helios_bt:assigned_to',
 		'dc:modified',
@@ -151,14 +151,10 @@
 
 		if(array_key_exists('where', $filter))	{
 			foreach($filter['where']['terms'] as $term)	{
-			  // equality
-				if($term[0] == '=')	{	
+				if($term[0]=='=')	{	
 					$term[2] = str_replace("\"", "", $term[2]);
 					switch($term[1])	{
-					case 'dc:title':
-					  $query['summary'] = $term[2];
-					  break;
-						case 'helios_bt:status':
+						case 'oslc_cm:status':
 							if (array_key_exists($term[2],self::$status_arr))	{
 								$query['status'] = self::$status_arr[$term[2]];
 							}else	{
@@ -289,7 +285,7 @@
 		$af->order_col = $query['order_col'];
 		
 		// Can add here values for 'details' and 'summary'. Values comes from oslc_searchTerms
-		$af->summary = $query['summary'];
+		//$af->summary = $query['search'];
 		//$af->details =	$query['search'];
 		
 		// query the DB for requested artifacts 
@@ -371,7 +367,7 @@
 			throw new Exception('Error : Could not instanciate project Tracker');
 		} else {
 			// Construct array for oslc.where with all possible values for each attribute
-			// Currently only helios_bt:status and helios_bt:assigned_to are supported for
+			// Currently only oslc_cm:status and helios_bt:assigned_to are supported for
 			// oslc.where query.
 			$engine = RBACEngine::getInstance() ;
 			$techs = $engine->getUsersByAllowedAction ('tracker', $tracker, 'tech') ;
@@ -550,7 +546,7 @@
 			}
 		}
 		
-		// helios_bt:status ===> status 
+		// oslc_cm:status ===> status 
 		if(in_array('status',$props))
 		{
 			if(isset($cm_request['status']))
@@ -559,7 +555,7 @@
 			}
 			else
 			{
-				throw new BadRequestException("helios_bt:status mentioned in the request query not found in request body!");
+				throw new BadRequestException("oslc_cm:status mentioned in the request query not found in request body!");
 			}
 		}
 		

Modified: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/models/fusionforge.inc.php
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/models/fusionforge.inc.php	2011-02-10 15:11:58 UTC (rev 12229)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/models/fusionforge.inc.php	2011-02-10 15:12:04 UTC (rev 12230)
@@ -127,6 +127,26 @@
 							$resource[$field] = $value;
 						}
 					}
+					foreach ($changerequest->children('http://open-services.net/ns/core#') as $child) {
+						$field = $child->getName();
+						if(!$field){
+							print('No ontology attribute !!!');
+						}
+						if (in_array($field,$fusionforgebt_attr)) {
+							$value = (string)$child;
+							$resource[$field] = $value;
+						}
+					}
+					foreach ($changerequest->children('http://open-services.net/ns/cm#') as $child) {
+						$field = $child->getName();
+						if(!$field){
+							print('No ontology attribute !!!');
+						}
+						if (in_array($field,$fusionforgebt_attr)) {
+							$value = (string)$child;
+							$resource[$field] = $value;
+						}
+					}
 				}
 			}
 		}
@@ -154,6 +174,7 @@
 		foreach ($resource as $field => $value) {
 			$field = str_replace('dc:', '', $field);
 			$field = str_replace('helios_bt:', '', $field);
+			$field = str_replace('oslc_cm:', '', $field);
 			
 			$changerequest->container[$field] = $value;
 		}
@@ -178,9 +199,9 @@
 		}
 	}
 
-	/* duplicated from code in the SOAP API
+	/* 
 	 * 
-	 * TODO Add code that maps fusionforge tracker fields to ontologies (dc, helios_bt, etc) 
+	 * Maps fusionforge tracker fields to ontologies (dc, oslc_cm, oslc, helios_bt, etc) 
 	 * 
 	 */
 	protected static function convert_artifacts_array($at_arr, $fields_string) {
@@ -248,8 +269,8 @@
 								case 'dc:creator': 
 									$return[$identifier]['creator'] = $at_arr[$i]->data_array['submitted_realname'];
 									break;
-								case 'helios_bt:status': 
-									$return[$identifier]['helios_bt:status'] = $at_arr[$i]->data_array['status_name'];
+								case 'oslc_cm:status': 
+									$return[$identifier]['oslc_cm:status'] = $at_arr[$i]->data_array['status_name'];
 									break;
 								case 'helios_bt:priority': 
 									$return[$identifier]['helios_bt:priority'] = $at_arr[$i]->data_array['priority'];
@@ -273,7 +294,7 @@
 							'identifier'=>$identifier,
 							'title'=>$at_arr[$i]->data_array['summary'],
 							'description'=>$at_arr[$i]->data_array['details'],
-							'helios_bt:status'=>$at_arr[$i]->data_array['status_name'],
+							'oslc_cm:status'=>$at_arr[$i]->data_array['status_name'],
 							'helios_bt:priority'=>$at_arr[$i]->data_array['priority'],
 							'creator' => $at_arr[$i]->data_array['submitted_realname'],
 							'helios_bt:assigned_to' => $at_arr[$i]->data_array['assigned_realname'],

Modified: branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/_resource_xml.php
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/_resource_xml.php	2011-02-10 15:11:58 UTC (rev 12229)
+++ branches/Branch_5_1/src/plugins/oslc/include/oslc-zend/application/views/scripts/fusionforgecm/_resource_xml.php	2011-02-10 15:12:04 UTC (rev 12230)
@@ -36,6 +36,9 @@
 			case 'dc' :
 				$prefix = 'http://purl.org/dc/terms/';
 				break;
+			case 'oslc_cm':
+				$prefix = 'http://open-services.net/ns/cm#';
+				break;
 			case 'helios_bt' :
 				$prefix = 'http://heliosplatform.sourceforge.net/ontologies/2010/05/helios_bt.owl';
 				break;
@@ -56,13 +59,10 @@
 
 function createRessourceCollectionView($view){
 	$feedcharset = 'UTF-8';
-	$feedauthor = 'OSLC-CM-V1 Demo server ( '.TRACKER_TYPE.' version)';
-	if(isset($view->tracker)){
-		$feedtitle = TRACKER_TYPE.' OSLC-CM Change requests';
-	}else{
-		$feedtitle = 'All '.TRACKER_TYPE.' OSLC-CM Change requests';
-	}
+	$feedauthor = 'FusionForge OSLC-CM plugin';
 
+	$feedtitle = TRACKER_TYPE.' OSLC-CM ChangeRequests found in Tracker'. $view->tracker;
+
 	$doc = new DOMDocument('1.0',$feedcharset);
 	$doc->formatOutput = true;
 




More information about the Fusionforge-commits mailing list