Пример #1
0
 public function toDTO()
 {
     $softwareDTO = new SoftwareDTO();
     $softwareDTO->setId($this->getId());
     $softwareDTO->setSoftwareNumeroSerie($this->unscapeString($this->getSoftwareNumeroSerie()));
     $softwareDTO->setSoftwareNombre($this->unscapeString($this->getSoftwareNombre()));
     $softwareDTO->setSoftwareVersion($this->unscapeString($this->getSoftwareVersion()));
     $softwareDTO->setSoftwareFechaCaducidad($this->unscapeString($this->getSoftwareFechaCaducidad()));
     $softwareDTO->setSoftwareFechaAquisicion($this->unscapeString($this->getSoftwareFechaAquisicion()));
     $softwareDTO->setSoftwareEquiposPermitidos($this->unscapeString($this->getSoftwareEquiposPermitidos()));
     $softwareDTO->setSoftwareComentarios($this->unscapeString($this->getSoftwareComentarios()));
     return $softwareDTO;
 }
 public function updateSoftware($softwareDTO)
 {
     try {
         $ctrl = new SoftwareController($this->persistenceManager);
         $software = new SoftwareDTO();
         $software->setId($softwareDTO->getId());
         $ctrl->getSoftware($software);
         $software->setSoftwareNombre($softwareDTO->getSoftwareNombre());
         $software->setSoftwareVersion($softwareDTO->getSoftwareVersion());
         $software->setSoftwareFechaCaducidad($softwareDTO->getSoftwareFechaCaducidad());
         $software->setSoftwareFechaAquisicion($softwareDTO->getSoftwareFechaAquisicion());
         $software->setSoftwareEquiposPermitidos($softwareDTO->getSoftwareEquiposPermitidos());
         $software->setSoftwareComentarios($softwareDTO->getSoftwareComentarios());
         $ctrl->updateSoftware($software);
         $cm = new CommunicationMensaje(true, SALAS_COMP_ALERT_A_OPERATION_SUCCESS, $this->ID + 37, $software);
         return $cm;
     } catch (Exception $e) {
         return new CommunicationMensaje(false, $e->getMessage(), $this->ID + 38 . "->" . $e->getCode());
     }
 }
Пример #3
0
 public static function loadFromXML($xmlDaos)
 {
     $daos = array();
     $doc = new DOMDocument('1.0', 'utf-8');
     $doc->loadXML($xmlDaos);
     $nodes = $doc->getElementsByTagName("Software");
     foreach ($nodes as $node) {
         $dao = new SoftwareDTO();
         $data = $node->getElementsByTagName("Software_Id");
         if ($data->length > 0) {
             $data = $data->item(0)->nodeValue;
         } else {
             $data = null;
         }
         $dao->setId($data);
         $data = $node->getElementsByTagName("softwareNumeroSerie");
         if ($data->length > 0 && !SoftwareDTO::isEmpty($data->item(0)->nodeValue)) {
             $data = $data->item(0)->nodeValue;
         } else {
             $data = null;
         }
         $dao->setSoftwareNumeroSerie($data);
         $data = $node->getElementsByTagName("softwareNombre");
         if ($data->length > 0 && !SoftwareDTO::isEmpty($data->item(0)->nodeValue)) {
             $data = $data->item(0)->nodeValue;
         } else {
             $data = null;
         }
         $dao->setSoftwareNombre($data);
         $data = $node->getElementsByTagName("softwareVersion");
         if ($data->length > 0 && !SoftwareDTO::isEmpty($data->item(0)->nodeValue)) {
             $data = $data->item(0)->nodeValue;
         } else {
             $data = null;
         }
         $dao->setSoftwareVersion($data);
         $data = $node->getElementsByTagName("softwareFechaCaducidad");
         if ($data->length > 0 && !SoftwareDTO::isEmpty($data->item(0)->nodeValue)) {
             $data = $data->item(0)->nodeValue;
         } else {
             $data = null;
         }
         $dao->setSoftwareFechaCaducidad($data);
         $data = $node->getElementsByTagName("softwareFechaAquisicion");
         if ($data->length > 0 && !SoftwareDTO::isEmpty($data->item(0)->nodeValue)) {
             $data = $data->item(0)->nodeValue;
         } else {
             $data = null;
         }
         $dao->setSoftwareFechaAquisicion($data);
         $data = $node->getElementsByTagName("softwareEquiposPermitidos");
         if ($data->length > 0 && !SoftwareDTO::isEmpty($data->item(0)->nodeValue)) {
             $data = $data->item(0)->nodeValue;
         } else {
             $data = null;
         }
         $dao->setSoftwareEquiposPermitidos($data);
         $data = $node->getElementsByTagName("softwareComentarios");
         if ($data->length > 0 && !SoftwareDTO::isEmpty($data->item(0)->nodeValue)) {
             $data = $data->item(0)->nodeValue;
         } else {
             $data = null;
         }
         $dao->setSoftwareComentarios($data);
         $daos[] = $dao;
     }
     return $daos;
 }
 /**
  * Listar algunos Software que contenga $softwareComentarios
  * 
  * @param $softwareComentarios
  * @param $performSize
  * @param $firstResultNumber
  * @param $numResults
  */
 public function listSoftwaresBySoftwareComentariosContains($softwareComentarios, $performSize = false, $firstResultNumber = null, $numResults = null, $orderBy = null, $orderPriority = SQL_ASCENDING_ORDER)
 {
     # Validamos los campos
     if ($firstResultNumber !== null && !EntityValidator::validatePositiveNumber($firstResultNumber)) {
         throw new Exception(SALAS_COMP_ALERT_E_VALIDATION_FAIL, $this->ID + 243);
     }
     if (!EntityValidator::validateGlobalOrderPriority($orderPriority)) {
         throw new Exception(SALAS_COMP_ALERT_E_VALIDATION_FAIL, $this->ID + 245);
     }
     if (!EntityValidator::validateString($softwareComentarios)) {
         throw new Exception(SALAS_COMP_ALERT_E_VALIDATION_FAIL, $this->ID + 247);
     }
     # Listamos las entidades
     if ($performSize) {
         $this->lastRequestSize = $this->softwareBean->countGetSoftwaresBySoftwareComentariosContains($softwareComentarios);
     }
     return SoftwareDTO::loadFromEntities($this->softwareBean->listSoftwaresBySoftwareComentariosContains($softwareComentarios, $firstResultNumber, $numResults, $orderBy, $orderPriority));
 }