applicationConnector = new ApplicationConnector(); $this->questionConnector = new QuestionConnector(); $this->userConnector = new UserConnector(); $this->surveyConnector = new SurveyConnector(); $this->respondentConnector = new RespondentConnector(); $this->answerConnector = new AnswerConnector(); $this->answerSetConnector = new AnswerSetConnector(); $this->sessionConnector = new SessionConnector(); } /** * Get the data corresponding to the given type and arguments * @param type $type * @param type $arguments * @return type */ public function get($type, $arguments) { switch(strtolower($type)) { case "application": return $this->applicationConnector->get($arguments); break; case "question": return $this->questionConnector->get($arguments); break; case "user": return $this->userConnector->get($arguments); break; case "survey": return $this->surveyConnector->get($arguments); break; case "respondent": return $this->respondentConnector->get($arguments); break; case "answer": return $this->answerConnector->get($arguments); break; case "answerset": return $this->answerSetConnector->get($arguments); case "session": return $this->sessionConnector->get($arguments); } } /** * Saves the given object based on its class. * @param type $rToolObject */ public function set($rToolObject) { switch(get_class($rToolObject)) { case "Application": $this->applicationConnector->set($rToolObject); break; case "Question": $this->questionConnector->set($rToolObject); break; case "User": $this->userConnector->set($rToolObject); break; case "Survey": $this->surveyConnector->set($rToolObject); break; case "Respondent": $this->respondentConnector->set($rToolObject); break; case "Answer": $this->answerConnector->set($rToolObject); break; case "AnswerSet": $this->answerSetConnector->set($rToolObject); break; case "Session": $this->sessionConnector->set($rToolObject); break; } } /** * Saves all the objects in the given array, assuming they are * valid ResearchToolObjects. * @param type $rToolObjects */ public function batchSet($rToolObjects) { foreach ($rToolObjects as $rToolObject) { $this->set($rToolObject); } } } ?>