/** * @param IOpenStackRelease $release * @param string $term * @param int $adoption * @param int $maturity * @param int $age * @param string $sort * @param string $sort_dir * @return array */ public function getComponents(IOpenStackRelease $release, $term = '', $adoption = 0, $maturity = 0, $age = 0, $sort = '', $sort_dir = '') { $res1 = array(); $res2 = array(); $core_components = $release->getOpenStackCoreComponents($term, $adoption, $maturity, $age); $optional_components = $release->getOpenStackOptionalComponents($term, $adoption, $maturity, $age, $sort, $sort_dir); foreach ($core_components as $c) { array_push($res1, $this->serializer->serialize($c)); } foreach ($optional_components as $c) { array_push($res2, $this->serializer->serialize($c)); } return array($res1, $res2); }
/** * Returns List of entities changed after certain time. * @param array entityList List of entity. * @param long changedSince DateTime of timespan after which entities were changed. * @return IntuitCDCResponse Returns an IntuitCDCResponse. */ public function CDC($entityList, $changedSince) { $this->serviceContext->IppConfiguration->Logger->CustomLogger->Log(TraceLevel::Info, "Called Method CDC."); // Validate parameter if (count($entityList) <= 0) { $exception = new IdsException('ParameterNotNullMessage'); $this->serviceContext->IppConfiguration->Logger->CustomLogger->Log(TraceLevel::Error, "ParameterNotNullMessage"); IdsExceptionManager::HandleException($exception); } $entityString = implode(",", $entityList); $query = NULL; $uri = NULL; $formattedChangedSince = date("Y-m-d\\TH:m:sP", $changedSince); $query = "entities=" . $entityString . "&changedSince=" . $formattedChangedSince; $uri = "company/{1}/cdc?{2}"; //$uri = str_replace("{0}", CoreConstants::VERSION, $uri); $uri = str_replace("{1}", $this->serviceContext->realmId, $uri); $uri = str_replace("{2}", $query, $uri); // Creates request parameters $requestParameters = new RequestParameters($uri, 'GET', CoreConstants::CONTENTTYPE_APPLICATIONXML, NULL); $restRequestHandler = new SyncRestHandler($this->serviceContext); try { // gets response list($responseCode, $responseBody, $responseError) = $restRequestHandler->GetResponse($requestParameters, NULL, NULL); } catch (Exception $e) { IdsExceptionManager::HandleException($e); } CoreHelper::CheckResponseErrorAndThrowException($this->serviceContext, $responseError); CoreHelper::CheckNullResponseAndThrowException($responseBody); $returnValue = new IntuitCDCResponse(); try { $xmlObj = simplexml_load_string($responseBody); foreach ($xmlObj->CDCResponse->QueryResponse as $oneObj) { $entities = $this->responseSerializer->Deserialize($oneObj->asXML(), FALSE); $entityName = NULL; foreach ($oneObj->children() as $oneObjChild) { $entityName = (string) $oneObjChild->getName(); break; } $returnValue->entities[$entityName] = $entities; } } catch (Exception $e) { IdsExceptionManager::HandleException($e); } $this->serviceContext->IppConfiguration->Logger->CustomLogger->Log(TraceLevel::Info, "Finished Executing Method CDC."); return $returnValue; }