12.07.2015 Views

Protótipo de um weaver para programação orientada a aspectos em ...

Protótipo de um weaver para programação orientada a aspectos em ...

Protótipo de um weaver para programação orientada a aspectos em ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

7 8 : ; < = > < @ A B C < ; > D > C G I K L B M D O < Q R @ S T < >7/ 2 3DMTaskMan.qryAutentica + (- 1. / 0 *0 + 5 *7 8 : ; < = > < @ A B C < ; > D > C G I K L B M D O < Q V < X7Quadro 4: Método SQLDelete antes do processo <strong>de</strong> weaving& ( ) * + , & *TClientes.SQLDelete(vId: Integer);%* . / 0 -/ 2 3DMTaskMan.SqlQuery + (- 1. / 0 *Close;Sql.Clear;Sql.Add(’Delete from CLIENTE Where CL_CODIGO = :CL_CODIGO’);ParamByName(’CL_CODIGO’).AsInteger := vID;ExecSql;* 0 + 5* 0 + 5Quadro 5: Método SQLDelete após o processo <strong>de</strong> weaving& ( ) * + , & *TClientes.SQLDelete(vId: Integer);%* . / 0 -Close;Sql.Clear;Sql.Add(’Select count(*) from DIREITO_USUARIO’);Sql.Add(’Where IDUSUARIO = :IDUSUARIO and OPERACAO = :OPERACAO’);Sql.Add(’ and TABELA = :TABELA’);ParamByName(’IDUSUARIO’).AsInteger := giCodUsuario;ParamByName(’OPERACAO’).AsInteger := 3; //1=Insert, 2=Update,3=DeleteParamByName(’TABELA’).AsInteger := Self.NomeTabela;ExecSQL;UFields[0].AsInteger = 0 2 3 * 0/Raise Exception.Create('Você não t<strong>em</strong> permissão <strong>para</strong> essaativida<strong>de</strong>. ' + Chr(13) +'Entre <strong>em</strong> contato com o seu superior.');/ 2 3DMTaskMan.SqlQuery + (- 1. / 0 *Close;Sql.Clear;Sql.Add('Delete from CLIENTE Where CL_CODIGO = :CL_CODIGO');ParamByName('CL_CODIGO').AsInteger := vID;ExecSql;* 0 + 5* 0 + 5Conforme <strong>de</strong>finido no advice AutenticaDelete do tipo before, o códigonele contido foi inserido no método interceptado, antes das instruções que já estavam aliimpl<strong>em</strong>entadas.4. ConclusõesConsi<strong>de</strong>rando a proposta e as vantagens da programação <strong>orientada</strong> a <strong>aspectos</strong>, ossoftwares <strong>de</strong>senvolvidos com essas técnicas ten<strong>de</strong>m a ser<strong>em</strong> mais flexíveis, melhorandoa manutenibilida<strong>de</strong> e reusabilida<strong>de</strong>, pois a impl<strong>em</strong>entação dos interesses transversaisfica encapsulada <strong>em</strong> módulos fisicamente se<strong>para</strong>dos do restante do código. Dessa forma,cada componente terá apenas código específico da impl<strong>em</strong>entação <strong>de</strong> seu negócio,permitindo <strong>um</strong>a melhor evolução do software.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!