MdWsSeiHipoteseLegalRN.php
3.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<?php
require_once dirname(__FILE__).'/../../../SEI.php';
class MdWsSeiHipoteseLegalRN extends InfraRN
{
protected function inicializarObjInfraIBanco()
{
return BancoSEI::getInstance();
}
/**
* O serviço realiza a pesquisa das hipóteses legais do SEI.
* @param MdWsSeiHipoteseLegalDTO $dto
* @return array
*/
protected function listarHipoteseLegalConectado(MdWsSeiHipoteseLegalDTO $dto)
{
try {
$id = $dto->getNumIdHipoteseLegal();
$nivelAcesso = $dto->getNumNivelAcesso();
$filter = $dto->getStrFilter();
$start = $dto->getNumStart();
$limit = $dto->getNumLimit();
$hipoteseLegalDTO = new HipoteseLegalDTO();
if ($id)
$hipoteseLegalDTO->setNumIdHipoteseLegal($id);
if ($nivelAcesso)
$hipoteseLegalDTO->setStrStaNivelAcesso($nivelAcesso);
if ($filter)
$hipoteseLegalDTO->setStrNome('%' . utf8_decode ($filter) . '%', InfraDTO::$OPER_LIKE);
IF ($limit)
$hipoteseLegalDTO->setNumMaxRegistrosRetorno($limit);
IF ($start)
$hipoteseLegalDTO->setNumPaginaAtual($start);
$hipoteseLegalDTO->retNumIdHipoteseLegal();
$hipoteseLegalDTO->retStrNome();
$hipoteseLegalRN = new HipoteseLegalRN();
$arrHipoteseLegalDTO = $hipoteseLegalRN->listar($hipoteseLegalDTO);
$arrayRetorno = array();
if($arrHipoteseLegalDTO){
foreach ($arrHipoteseLegalDTO as $obj) {
$arrayRetorno[] = array(
"id" => $obj->getNumIdHipoteseLegal(),
"nome" => $obj->getStrNome()
);
}
}
$total = count($arrayRetorno);
return MdWsSeiRest::formataRetornoSucessoREST(null, $arrayRetorno, $total);
} catch (Exception $e) {
return MdWsSeiRest::formataRetornoErroREST($e);
}
}
/**
* Realiza a inclusão de um contato no SEI.
* @param MdWsSeiContatoDTO $objGetMdWsSeiContatoDTO
* @return array
*/
protected function criarContatoConectado(MdWsSeiContatoDTO $objGetMdWsSeiContatoDTO)
{
try {
$nome = $objGetMdWsSeiContatoDTO->getStrNome();
$objContatoDTO = new ContatoDTO();
$objContatoDTO->setStrNome($nome);
$objContatoRN = new ContatoRN();
$objContatoDTO = $objContatoRN->cadastrarContextoTemporario($objContatoDTO);
return MdWsSeiRest::formataRetornoSucessoREST(null,array("id"=>$objContatoDTO->getNumIdContato()));
} catch (Exception $e) {
return MdWsSeiRest::formataRetornoErroREST($e);
}
}
}