/** * Listar algunos Responsable dado el $responsablePersonaId * * @param $responsablePersonaId * @param $performSize * @param $firstResultNumber * @param $numResults */ public function listResponsablesByResponsablePersonaId($responsablePersonaId, $performSize = false, $firstResultNumber = null, $numResults = null, $orderBy = null, $orderPriority = SQL_ASCENDING_ORDER) { $objBean = new PersonaBean($this->persistenceManager); $obj = new Persona(); $obj->setId($responsablePersonaId); # 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($responsablePersonaId)) { throw new Exception(SALAS_COMP_ALERT_E_VALIDATION_FAIL, $this->ID + 99); } # Verificamos que la entidad exista if (!$objBean->getPersona($obj)) { throw new Exception(SALAS_COMP_ALERT_E_ENTITY_NOT_FOUND_FAIL, $this->ID + 101); } # Listamos las entidades if ($performSize) { $this->lastRequestSize = $this->responsableBean->countGetResponsablesByResponsablePersona($obj); } return ResponsableDTO::loadFromEntities($this->responsableBean->listResponsablesByResponsablePersona($obj, $firstResultNumber, $numResults, $orderBy, $orderPriority)); }
public function updateResponsable($responsableDTO) { try { $ctrl = new ResponsableController($this->persistenceManager); $responsable = new ResponsableDTO(); $responsable->setId($responsableDTO->getId()); $ctrl->getResponsable($responsable); $responsable->setResponsableFacultad($responsableDTO->getResponsableFacultad()); $responsable->setResponsableAsignatura($responsableDTO->getResponsableAsignatura()); $ctrl->updateResponsable($responsable); $cm = new CommunicationMensaje(true, SALAS_COMP_ALERT_A_OPERATION_SUCCESS, $this->ID + 47, $responsable); return $cm; } catch (Exception $e) { return new CommunicationMensaje(false, $e->getMessage(), $this->ID + 48 . "->" . $e->getCode()); } }
public static function loadFromXML($xmlDaos) { $daos = array(); $doc = new DOMDocument('1.0', 'utf-8'); $doc->loadXML($xmlDaos); $nodes = $doc->getElementsByTagName("Responsable"); foreach ($nodes as $node) { $dao = new ResponsableDTO(); $data = $node->getElementsByTagName("Responsable_Id"); if ($data->length > 0) { $data = $data->item(0)->nodeValue; } else { $data = null; } $dao->setId($data); $data = $node->getElementsByTagName("responsableFacultad"); if ($data->length > 0 && !ResponsableDTO::isEmpty($data->item(0)->nodeValue)) { $data = $data->item(0)->nodeValue; } else { $data = null; } $dao->setResponsableFacultad($data); $data = $node->getElementsByTagName("responsableAsignatura"); if ($data->length > 0 && !ResponsableDTO::isEmpty($data->item(0)->nodeValue)) { $data = $data->item(0)->nodeValue; } else { $data = null; } $dao->setResponsableAsignatura($data); $data = $node->getElementsByTagName("responsablePersona"); if ($data->length > 0 && !empty($data->item(0)->nodeValue)) { $data = $data->item(0)->nodeValue; } else { $data = null; } $dao->setResponsablePersona($data); $daos[] = $dao; } return $daos; }
public function toDTO() { $responsableDTO = new ResponsableDTO(); $responsableDTO->setId($this->getId()); $responsableDTO->setResponsableFacultad($this->unscapeString($this->getResponsableFacultad())); $responsableDTO->setResponsableAsignatura($this->unscapeString($this->getResponsableAsignatura())); $responsableDTO->setResponsablePersona($this->unscapeString($this->getResponsablePersona())); return $responsableDTO; }