public function toDTO()
 {
     $monitorDTO = new MonitorDTO();
     $monitorDTO->setId($this->getId());
     $monitorDTO->setMonitorTipo($this->unscapeString($this->getMonitorTipo()));
     $monitorDTO->setMonitorHorario($this->unscapeString($this->getMonitorHorario()));
     $monitorDTO->setMonitorEstudiante($this->unscapeString($this->getMonitorEstudiante()));
     return $monitorDTO;
 }
 /**
  * Listar algunos Monitor dado el $monitorEstudianteId
  * 
  * @param $monitorEstudianteId
  * @param $performSize
  * @param $firstResultNumber
  * @param $numResults
  */
 public function listMonitorsByMonitorEstudianteId($monitorEstudianteId, $performSize = false, $firstResultNumber = null, $numResults = null, $orderBy = null, $orderPriority = SQL_ASCENDING_ORDER)
 {
     $objBean = new EstudianteBean($this->persistenceManager);
     $obj = new Estudiante();
     $obj->setId($monitorEstudianteId);
     # Validamos los campos
     if ($firstResultNumber !== null && !EntityValidator::validatePositiveNumber($firstResultNumber)) {
         throw new Exception(SALAS_COMP_ALERT_E_VALIDATION_FAIL, $this->ID + 95);
     }
     if (!EntityValidator::validateGlobalOrderPriority($orderPriority)) {
         throw new Exception(SALAS_COMP_ALERT_E_VALIDATION_FAIL, $this->ID + 97);
     }
     if (!EntityValidator::validateId($monitorEstudianteId)) {
         throw new Exception(SALAS_COMP_ALERT_E_VALIDATION_FAIL, $this->ID + 99);
     }
     # Verificamos que la entidad exista
     if (!$objBean->getEstudiante($obj)) {
         throw new Exception(SALAS_COMP_ALERT_E_ENTITY_NOT_FOUND_FAIL, $this->ID + 101);
     }
     # Listamos las entidades
     if ($performSize) {
         $this->lastRequestSize = $this->monitorBean->countGetMonitorsByMonitorEstudiante($obj);
     }
     return MonitorDTO::loadFromEntities($this->monitorBean->listMonitorsByMonitorEstudiante($obj, $firstResultNumber, $numResults, $orderBy, $orderPriority));
 }
 public function updateMonitor($monitorDTO)
 {
     try {
         $ctrl = new MonitorController($this->persistenceManager);
         $monitor = new MonitorDTO();
         $monitor->setId($monitorDTO->getId());
         $ctrl->getMonitor($monitor);
         $monitor->setMonitorTipo($monitorDTO->getMonitorTipo());
         $monitor->setMonitorHorario($monitorDTO->getMonitorHorario());
         $ctrl->updateMonitor($monitor);
         $cm = new CommunicationMensaje(true, SALAS_COMP_ALERT_A_OPERATION_SUCCESS, $this->ID + 107, $monitor);
         return $cm;
     } catch (Exception $e) {
         return new CommunicationMensaje(false, $e->getMessage(), $this->ID + 108 . "->" . $e->getCode());
     }
 }
 public static function loadFromXML($xmlDaos)
 {
     $daos = array();
     $doc = new DOMDocument('1.0', 'utf-8');
     $doc->loadXML($xmlDaos);
     $nodes = $doc->getElementsByTagName("Monitor");
     foreach ($nodes as $node) {
         $dao = new MonitorDTO();
         $data = $node->getElementsByTagName("Monitor_Id");
         if ($data->length > 0) {
             $data = $data->item(0)->nodeValue;
         } else {
             $data = null;
         }
         $dao->setId($data);
         $data = $node->getElementsByTagName("monitorTipo");
         if ($data->length > 0 && !MonitorDTO::isEmpty($data->item(0)->nodeValue)) {
             $data = $data->item(0)->nodeValue;
         } else {
             $data = null;
         }
         $dao->setMonitorTipo($data);
         $data = $node->getElementsByTagName("monitorHorario");
         if ($data->length > 0 && !MonitorDTO::isEmpty($data->item(0)->nodeValue)) {
             $data = $data->item(0)->nodeValue;
         } else {
             $data = null;
         }
         $dao->setMonitorHorario($data);
         $data = $node->getElementsByTagName("monitorEstudiante");
         if ($data->length > 0 && !empty($data->item(0)->nodeValue)) {
             $data = $data->item(0)->nodeValue;
         } else {
             $data = null;
         }
         $dao->setMonitorEstudiante($data);
         $daos[] = $dao;
     }
     return $daos;
 }