add searchpattern

This commit is contained in:
stubbfel
2013-09-04 12:15:47 +02:00
parent 2805de2198
commit 2d10c027a2
3 changed files with 59 additions and 8 deletions

View File

@@ -26,6 +26,12 @@ class PisApi extends Api {
*/
public static $routeParameterINames = "/iname/:iname+";
/**
* public string for the patter string parameter
* @var string
*/
public static $routParameterIPatter = "ipatter/:ipatter";
/**
* Keyword for pidList arguments
* @var string
@@ -38,6 +44,12 @@ class PisApi extends Api {
*/
public static $keyINameList = "iNameList";
/**
* Keyword for iNameList arguments
* @var string
*/
public static $keyIPatter = "searchPatter";
/**
* max number of pid for each query
* @var int
@@ -66,22 +78,27 @@ class PisApi extends Api {
* @return query result as xml
*/
public function sendPisQuery($queryArgs) {
$pidList = \utiliy\ArrayManager::removeEmptyItmes($queryArgs[self::$keyPidList]);
$pidList = \utiliy\ArrayManager::removeEmptyItmes($queryArgs[self::$keyPidList]);
if (array_key_exists(self::$keyINameList, $queryArgs)) {
$iNameList = \utiliy\ArrayManager::removeEmptyItmes($queryArgs[self::$keyINameList]);
} else {
$iNameList = array();
}
if (array_key_exists(self::$keyIPatter, $queryArgs)) {
$iPatter = trim($queryArgs[self::$keyIPatter]);
} else {
$iPatter = "*";
}
if (count($pidList) < self::$maxPid) {
$result = $this->sqlManager->sendPisQuery($pidList, $iNameList);
$result = $this->sqlManager->sendPisQuery($pidList, $iNameList,$iPatter);
return $this->serialManager->arrayToPis($result);
}
return NULL;
}
}
?>