Commit 14585827 authored by Gabriel Macena's avatar Gabriel Macena

Commit inicial.

parents
*.exe
*.dproj
*.~*
\ No newline at end of file
{
"generator-curio": {
"srv": {
"path": "srv/src",
"dprname": "HelloWorld"
},
"cli": {
"path": "cli/win/",
"dpkname": "HelloWorld"
}
}
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<Config>
<Application DefaultSecurityDriver="NativeSecurityDriver">
<Service Name="svHelloWorld" DisplayName="Idexa - HelloWorld" Description="exemplo" Port="7878"/>
<Database ActiveConnectionString="ConnectionString1">
<ConnectionString1>Provider=SQLOLEDB.1;Password=conexo;Persist Security Info=True;User ID=sa;Initial Catalog=BD_HELLO_WORLD_GABRIEL;Data Source=srvd1;Application Name=Produto;cxsqldialect=SQLServer</ConnectionString1>
</Database>
<UseXMLEncode version="1"/>
</Application>
</Config>
This diff is collapsed.
package HelloWorld;
{$R *.res}
{$ALIGN 8}
{$ASSERTIONS ON}
{$BOOLEVAL OFF}
{$DEBUGINFO OFF}
{$EXTENDEDSYNTAX ON}
{$IMPORTEDDATA ON}
{$IOCHECKS ON}
{$LOCALSYMBOLS OFF}
{$LONGSTRINGS ON}
{$OPENSTRINGS ON}
{$OPTIMIZATION ON}
{$OVERFLOWCHECKS OFF}
{$RANGECHECKS OFF}
{$REFERENCEINFO OFF}
{$SAFEDIVIDE OFF}
{$STACKFRAMES OFF}
{$TYPEDADDRESS OFF}
{$VARSTRINGCHECKS ON}
{$WRITEABLECONST OFF}
{$MINENUMSIZE 1}
{$IMAGEBASE $400000}
{$DESCRIPTION 'Conexo HelloWorld'}
{$RUNONLY}
{$IMPLICITBUILD ON}
{$DEFINE RELEASE}
{$DEFINE DEBUG}
requires
rtl,
CXClient,
vcl,
JvCore,
dbrtl,
vcljpg,
vclx,
JclVcl,
Jcl,
vclimg,
JvStdCtrls,
JvSystem,
JvMM,
JvControls,
elpackD11,
tee,
teeUI,
teedb,
vcldb,
JvDB,
JvDlgs,
JvCustom,
JvGlobus,
bdertl,
xmlrtl,
vclie,
VclSmp,
JvWizards;
contains
ituHelloWorldMain in 'itu\ituHelloWorldMain.pas';
end.
unit ituHelloWorldMain;
interface
uses
ituInterfaceFactory, ituMain, ituMainPortal;
type
itHelloWorldMain = class(itMainPortal)
protected
function InitialLevel: integer; override;
public
procedure Initialize; override;
end;
var
fUsuario, fSenha, fCodigoSusep : string;
implementation
procedure itHelloWorldMain.Initialize;
begin
MainPortal := TMainPortal.Create(nil);
inherited;
end;
function itHelloWorldMain.InitialLevel: integer;
begin
result := 0;
end;
initialization
gInterfaceFactory.RegisterClass(ITCTLMAIN, itHelloWorldMain);
finalization
gInterfaceFactory.UnregisterClass(ITCTLMAIN);
end.
<?xml version="1.0" encoding="ISO-8859-1" ?>
<DATA>
<oql name="ObterUsuarios" oqltype="0">
<description></description>
<query><![CDATA[
SELECT ngUsuario
FROM ngUsuario
WHERE (ngUsuario.Nome LIKE '%'+?nome:acString+'%' OR ?nome:acString IS NULL)
AND (ngUsuario.CPF = ?cpf:acString OR ?cpf:acString IS NULL)]]></query>
</oql>
</DATA>
This diff is collapsed.
-- CLASS ngSituacao
CREATE TABLE SITUACAO (
ID_SITUACAO INT PRIMARY KEY,
CODIGO VARCHAR(5) NOT NULL,
DESCRICAO VARCHAR(250) NOT NULL
);
INSERT INTO SITUACAO
VALUES (1, '1', 'Disponvel');
INSERT INTO SITUACAO
VALUES (2, '2', 'Emprestado');
INSERT INTO SITUACAO
VALUES (3, '3', 'Reservado');
INSERT INTO SITUACAO
VALUES (4, '4', 'Perdido');
-- CLASS ngUsuario
CREATE TABLE USUARIO (
ID_USUARIO INT PRIMARY KEY,
NOME VARCHAR(200) NOT NULL,
CPF VARCHAR(11) NOT NULL,
DATA_NASCIMENTO DATETIME NOT NULL
);
-- CLASS ngLivro
CREATE TABLE LIVRO (
ID_LIVRO INT PRIMARY KEY,
ISBN VARCHAR(15) NOT NULL,
TITULO VARCHAR(200) NOT NULL,
EDICAO VARCHAR(15) NOT NULL
);
-- CLASS ngExemplar
CREATE TABLE EXEMPLAR (
ID_EXEMPLAR INT PRIMARY KEY,
CODIGO VARCHAR(20) NOT NULL,
ID_SITUACAO INT NOT NULL,
ID_LIVRO INT NOT NULL
);
-- CLASS ngExemplar
-- RELATION ngSituacao(0..*) <----> (1..1)ngExemplar
ALTER TABLE EXEMPLAR ADD CONSTRAINT F2998ID_SITUACAO FOREIGN KEY (ID_SITUACAO) REFERENCES SITUACAO(ID_SITUACAO);
CREATE INDEX I2998ID_SITUACAO ON EXEMPLAR (ID_SITUACAO);
-- RELATION ngLivro(0..*) <----> (1..1)ngExemplar
ALTER TABLE EXEMPLAR ADD CONSTRAINT F2998ID_LIVRO FOREIGN KEY (ID_LIVRO) REFERENCES LIVRO(ID_LIVRO);
CREATE INDEX I2998ID_LIVRO ON EXEMPLAR (ID_LIVRO);
-- CLASS ngEmprestimo
CREATE TABLE EMPRESTIMO (
ID_EMPRESTIMO INT PRIMARY KEY,
DATA_INICIO DATETIME NOT NULL,
DATA_DEVOLUCAO_PREVISTA DATETIME NOT NULL,
ID_USUARIO INT NOT NULL,
ID_EXEMPLAR INT NOT NULL
);
-- CLASS ngEmprestimo
-- RELATION ngUsuario(0..*) <----> (1..1)ngEmprestimo
ALTER TABLE EMPRESTIMO ADD CONSTRAINT F3002ID_USUARIO FOREIGN KEY (ID_USUARIO) REFERENCES USUARIO(ID_USUARIO);
CREATE INDEX I3002ID_USUARIO ON EMPRESTIMO (ID_USUARIO);
-- RELATION ngExemplar(0..*) <----> (1..1)ngEmprestimo
ALTER TABLE EMPRESTIMO ADD CONSTRAINT F3002ID_EXEMPLAR FOREIGN KEY (ID_EXEMPLAR) REFERENCES EXEMPLAR(ID_EXEMPLAR);
CREATE INDEX I3002ID_EXEMPLAR ON EMPRESTIMO (ID_EXEMPLAR);
\ No newline at end of file
INSERT INTO USUARIO VALUES (1,'Thiago Anders', '14390657720','19940619')
INSERT INTO USUARIO VALUES (2,'Gabriel Macena', '15455148796','19940111')
INSERT INTO USUARIO VALUES (3,'Isaac Pereira', '11473334756','19870316')
INSERT INTO LIVRO VALUES (1,'8573517328','Absolute Sandman - Volume 2','Primeira')
INSERT INTO LIVRO VALUES (2,'B0765KZSM4','O CAPATAZ: OPERAO CAA COWBOY','Primeira')
INSERT INTO EXEMPLAR VALUES (1,'34523452345',1,1)
INSERT INTO EXEMPLAR VALUES (2,'34523452346',1,1)
INSERT INTO EXEMPLAR VALUES (3,'34523452347',1,2)
INSERT INTO EXEMPLAR VALUES (4,'34523452348',1,2)
\ No newline at end of file
This diff is collapsed.
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID('SISBTNUMER') AND type in ('U'))
DROP TABLE SISBTNUMER
CREATE TABLE SISBTNUMER(
SISBDSNUME varchar(50) PRIMARY KEY,
SISBNONUME int NOT NULL,
)
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID('VERSAO_BANCO') AND type in ('U'))
DROP TABLE VERSAO_BANCO
CREATE TABLE VERSAO_BANCO (
ID_VERSAO_BANCO int NOT NULL PRIMARY KEY,
VERSAO INT NOT NULL,
BRANCH varchar(50) NOT NULL,
NOME_ARQUIVO varchar(50) NOT NULL,
DATA_ATUALIZACAO datetime NOT NULL,
)
INSERT IESATSISTE (IESAIDSIST, IESANMSIST, IESADSSIST, IESAVERSAO, IESACDSIST, IESACDSITU)
VALUES (1, 'SISEG', 'Sistema de Seguranca', '1.0', 19, 'A')
INSERT IESDTCATEG (IESDIDCATE, IESDNMCATE, IESDCDCATE, IESDCDSITU)
VALUES (1, 'Processos', 1, 'A')
INSERT IESOTINTER (IESOIDINTE, IESONMINTE, IESOCDINTE, IESODSINTE, IESOCDSITU)
VALUES (1, 'itImportaConfiguracaoSistema', 183, 'itImportaConfiguracaoSistema', 'A')
INSERT IESCTENTID (IESCIDENTI, IESCNMENTI, IESCCDENTI, IESCTIENTI, IESCCDSITU)
VALUES (1, 'Configuracoes', 168, 'Configuracoes', 'A')
INSERT IESFTCUICO (IESFIDCUIC, IESFDSCUIC, IESFCDCUIC, IESFCDSITU)
VALUES (1, 'Processo', 1, 'A')
INSERT IESBTCASOU (IESBIDCASO, IESBDSCASO, IESBNMCASO, IESBCDCASO, IESBTPCASO, IESBIDCUIC, IESBIDENTI, IESBIDCATE, IESBCDSITU)
VALUES (1, 'Importa configuracao sistema', 'Importa configuracao sistema', 1327, NULL, 1, 1, 1, 'A')
INSERT IESETSISCU (IESEIDSIST, IESEIDCASO, IESEIDSISC, IESECDSITU)
VALUES (1, 1, 1, 'A')
INSERT IESJTOPERA (IESJIDOPER, IESJDSOPER, IESJCDOPER, IESJCDSITU)
VALUES (1, 'Executar', 5, 'A')
INSERT IESPTSISIN (IESPIDSISI, IESPIDCASO, IESPIDSIST, IESPIDINTE, IESPCDSITU)
VALUES (1, 1, 1, 1, 'A')
INSERT IESGTCUOPE (IESGIDCUOP, IESGIDCASO, IESGIDOPER, IESGCDSITU)
VALUES (1, 1, 1, 'A')
INSERT SEGDTNAUSU (SEGDIDNAUS, SEGDCDNAUS, SEGDDSNAUS)
VALUES (1, 0, 'ADMINISTRADOR')
INSERT SEGDTNAUSU (SEGDIDNAUS, SEGDCDNAUS, SEGDDSNAUS)
VALUES (2, 3, 'OUTROS')
INSERT SEGETSINAU (SEGEIDSIST, SEGEIDNAUS)
VALUES (1, 1)
INSERT SEGATUSUAR (SEGAIDUSUA, SEGACDUSUA, SEGASENHAU, SEGADTULSE, SEGADTCADU, SEGAINCANC, SEGACDHERA, SEGACDREFE, SEGAIDNAUS, SEGAFORMSE, SEGASALTSE, SEGAMOBILE, SEGAEEMAIL, SEGALEMAIL, SEGASENHAQ, SEGASENHAA, SEGABLOQUE, SEGAULTLGN, SEGAULTBLQ, SEGAFSACOU, SEGAFSAWST, SEGAFSAACO, SEGAFSAAWS, SEGACOMMEN, SEGAULTACT, SEGAPRSETC)
VALUES (1, 'Administrador', '', NULL, CAST(0x00009BBE00000000 AS DateTime), 'N', -6, NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)
\ No newline at end of file
program HelloWorld;
{$R 'VersionInfo.res' 'VersionInfo.rc'}
{$R 'mmenu.res' 'mmenu.rc'}
uses
Classes,
SvcMgr,
acuNativeSecurityDriver,
acuConexoSecurityDriver,
acuSQLDialectDB2,
acuSQLDialectOracle,
acuSQLDialectSQLServer,
acuObject,
ucuManager,
acuCollection,
ucuUseCase,
nguEvent,
nguOperation,
nguPermission,
utuMessage,
utuRequest,
utuRequestQueue,
utuParamFields,
mxuConnectionServer,
utuLinksManager,
utuLink,
utuLinkSharedMemory,
utuLinkSock,
blcksock,
synsock,
mxuUseCaseCommCenter,
mxuCommCenter,
utuProtectedList,
sucuBuscaObjetosBasica,
utuFactory,
ucuUseCaseFactory,
acOQL,
acuRepositorySQL,
ucuMain,
ucuSecurityManager,
acuUseCaseServer,
acuContainers,
acuPersistenceLog,
acuApplicationLog,
acuPersistenceEventsToApplicationLogSubscriber,
utuStateMachine,
acuSystem,
acuQuerySQLADO,
NGUAuditEvent,
NGUAuditEventData,
nguSystemConfigUpdateLog,
nguUser,
nguCategory,
nguEntity,
nguGUITicket,
nguIcon,
nguLevel,
nguSystem,
nguMessage,
nguSystemGUITickets,
nguSystemUseCaseTicket,
nguUseCaseTicket,
nguUseCaseTicketOperation,
nguBusinessEvent,
NGuBusinessEventDistributed,
nguBusinessEventSubscriber,
NGuBusinessEventSubscriberError,
nguBusinessEventType,
NGuBusinessSubscriberNotifierEventualTimeWindow,
NGuBusinessSubscriberNotifierTimeGrid,
NGuBusinessSubscriberNotifierTimeWindow,
ucuCadastroBasicoV4,
SysUtils,
acuFramework,
ucuExplorerV4,
ucuControlPanelConsole,
ucuProfiler,
sucuBuscaObjetosServidores,
ucuControlPanel,
sucuBuscaObjetosUsuarioV4,
sucuBuscaLogAtualizacaoSistema,
sucuBuscaNaturezas,
ucuCadastroNatureza,
ucuControleAcesso,
ucuPropriedadesDoServico,
ucuDetalhesAtualizacaoSistema,
ucuImportaConfiguracaoSistema,
ucuCadastroUsuarioSistema,
utuSysUtils,
acuRegisterModelMappings in 'lib\acuRegisterModelMappings.pas',
nguVersaoBanco in 'ngu\nguVersaoBanco.pas',
ucuHelloWorldMain in 'ucu\ucuHelloWorldMain.pas',
svuHelloWorld in 'svuHelloWorld.pas' {svHelloWorld: TService},
ucuHelloWorld in 'ucu\ucuHelloWorld.pas',
nguEmprestimo in 'ngu\nguEmprestimo.pas',
nguExemplar in 'ngu\nguExemplar.pas',
nguLivro in 'ngu\nguLivro.pas',
nguSituacao in 'ngu\nguSituacao.pas',
nguUsuario in 'ngu\nguUsuario.pas',
ucuEfetuarEmprestimo in 'ucu\ucuEfetuarEmprestimo.pas',
utuEmprestimoOQL in 'utu\utuEmprestimoOQL.pas';
var
lErros : TStringList;
begin
gDefaultConnetionString := gSystem.ParamByName['Application.Database.' + gSystem.ParamByName['Application.Database.@ActiveConnectionString']];
Application.Initialize;
RegisterModelMappings(PersistenceManager.DefaultMetaModel);
PersistenceManager.Initialize;
lErros := TStringList.Create;
try
if not PersistenceManager.DefaultMetaModel.ImplementationOK(lErros) then
begin
lErros.SaveToFile(IncludeTrailingPathDelimiter(ExtractFileDir(ParamStr(0))) + 'ModelErrors.log');
raise Exception.Create('Error initalizing service, check ModelErrors.log for details.');
end;
finally
lErros.Free;
end;
Application.CreateForm(TsvHelloWorld, svHelloWorld);
Application.Run;
end.
// Version Information Resource File
1 VERSIONINFO
FILEVERSION 1, 0, 8, 12
PRODUCTVERSION 1, 0, 8, 12
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
//FILEFLAGS VS_FF_DEBUG | VS_FF_PRERELEASE
FILEOS VOS__WINDOWS32
FILETYPE VFT_APP
{
BLOCK "StringFileInfo"
{
BLOCK "041604E4"
{
VALUE "CompanyName", "CONEXO Projetos e Sistemas Ltda\000"
VALUE "FileVersion", "1.0.8.12\000"
VALUE "ProductName", "GED - Gest�o Eletr�nica de Documentos\000"
VALUE "ProductVersion", "1.0.8.12\000"
VALUE "LegalCopyright", "Copyright (C) CONEXO Projetos e Sistemas Ltda. Todos os direitos reservados\000"
}
}
BLOCK "VarFileInfo"
{
VALUE "Translation", 1046, 1252
}
}
This source diff could not be displayed because it is too large. You can view the blob instead.
<?xml version="1.0" encoding="iso-8859-1"?>
<SYSMSG>
<System Name="HelloWorld">
<Menu>
</Menu>
</System>
</SYSMSG>
\ No newline at end of file
mmenu RCDATA mainmenu.xml
\ No newline at end of file
unit nguEmprestimo;
interface
uses
acuframework;
type
ngEmprestimo = class(acPersistentObject)
private
FDataInicio: acDateTime;
FDataDevolucaoPrevista: acDateTime;
fExemplar: acRelationPartnerShip;
fUsuario: acRelationPartnerShip;
published
property DataInicio: acDateTime read FDataInicio write FDataInicio;
property DataDevolucaoPrevista: acDateTime read FDataDevolucaoPrevista write FDataDevolucaoPrevista;
property Exemplar: acRelationPartnerShip read fExemplar write fExemplar;
property Usuario: acRelationPartnerShip read fUsuario write fUsuario;
end;
implementation
initialization
PersistenceManager.RegisterClass(ngEmprestimo);
end.
unit nguExemplar;
interface
uses
acuframework;
type
ngExemplar = class(acPersistentObject)
private
FCodigo: acString;
fLivro: acRelationPartnerShip;
fSituacao: acRelationPartnerShip;
fEmprestimos: acRelationPartnerList;
published
property Codigo: acString read FCodigo write FCodigo;
property Livro: acRelationPartnerShip read fLivro write fLivro;
property Situacao: acRelationPartnerShip read fSituacao write fSituacao;
property Emprestimos: acRelationPartnerList read fEmprestimos write fEmprestimos;
end;
implementation
initialization
PersistenceManager.RegisterClass(ngExemplar);
end.
unit nguLivro;
interface
uses
acuframework;
type
ngLivro = class(acPersistentObject)
private
FISBN: acString;
FTitulo: acString;
FEdicao: acString;
fExemplares: acRelationPartnerList;
published
property ISBN: acString read FISBN write FISBN;
property Titulo: acString read FTitulo write FTitulo;
property Edicao: acString read FEdicao write FEdicao;
property Exemplares: acRelationPartnerList read fExemplares write fExemplares;
end;
implementation
initialization
PersistenceManager.RegisterClass(ngLivro);
end.
unit nguSituacao;
interface
uses
acuframework;
type
ngSituacao = class(acPersistentObject)
private
FCodigo: acString;
FDescricao: acString;
published
property Codigo: acString read FCodigo write FCodigo;
property Descricao: acString read FDescricao write FDescricao;
end;
implementation
initialization
PersistenceManager.RegisterClass(ngSituacao);
end.
unit nguUsuario;
interface
uses
acuframework, utuMessage;
type
ngUsuario = class(acPersistentObject)
private
FNome: acString;
FCPF: acString;
FDataNascimento: acDateTime;
fEmprestimos: acRelationPartnerList;
public
procedure toXML(piField: utField);
published
property Nome: acString read FNome write FNome;
property CPF: acString read FCPF write FCPF;
property DataNascimento: acDateTime read FDataNascimento write FDataNascimento;
property Emprestimos: acRelationPartnerList read fEmprestimos write fEmprestimos;
end;
implementation
{ ngUsuario }
procedure ngUsuario.toXML(piField: utField);
begin
piField.AddAttribute('OID').AsString := Self.IDO.AsString;
piField.AddAttribute('Nome').AsString := Self.Nome.AsString;
piField.AddAttribute('CPF').AsString := Self.CPF.AsString;
end;
initialization
PersistenceManager.RegisterClass(ngUsuario);
end.
unit nguVersaoBanco;
interface
uses
acuframework;
type
ngVersaoBanco = class(acPersistentObject)
private
FVersao: acInt;
FBranch: acString;
FNomeArquivo: acString;
FDataAtualizacao: acDateTime;
published
property Versao: acInt read FVersao write FVersao;
property Branch: acString read FBranch write FBranch;
property NomeArquivo: acString read FNomeArquivo write FNomeArquivo;
property DataAtualizacao: acDateTime read FDataAtualizacao write FDataAtualizacao;
end;
implementation
initialization
PersistenceManager.RegisterClass(ngVersaoBanco);
end.
object svHelloWorld: TsvHelloWorld
OldCreateOrder = False
OnCreate = ServiceCreate
DisplayName = 'svHelloWorld'
BeforeInstall = ServiceBeforeInstall
AfterInstall = ServiceAfterInstall
AfterUninstall = ServiceAfterUninstall
OnStart = ServiceStart
OnStop = ServiceStop
Height = 150
Width = 215
end
unit svuHelloWorld;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, SvcMgr,
mxuConnectionServer;
type
TsvHelloWorld = class(TService)
procedure ServiceStart(Sender: TService; var Started: Boolean);
procedure ServiceBeforeInstall(Sender: TService);
procedure ServiceCreate(Sender: TObject);
procedure ServiceAfterInstall(Sender: TService);
procedure ServiceAfterUninstall(Sender: TService);
procedure ServiceStop(Sender: TService; var Stopped: Boolean);
private
fConnectionServer: mxConnectionServer;
fDescription: string;
fPortNumber : Word;
procedure LerConfiguracao;
public
function GetServiceController: TServiceController; override;
end;
var
svHelloWorld: TsvHelloWorld;
implementation
{$R *.DFM}
uses
Registry,
acuSystem;
procedure ServiceController(CtrlCode: DWord); stdcall;
begin
svHelloWorld.Controller(CtrlCode);
end;
function TsvHelloWorld.GetServiceController: TServiceController;
begin
Result := ServiceController;
end;
procedure TsvHelloWorld.LerConfiguracao;
begin
if gSystem.HasParam('Application.Service') then
begin
Self.Name:=gSystem.ParamByName['Application.Service.@Name'];
Self.DisplayName:=gSystem.ParamByName['Application.Service.@DisplayName'];
Self.fPortNumber:=StrToInt(gSystem.ParamByName['Application.Service.@Port']);
Self.fDescription:=gSystem.ParamByName['Application.Service.@Description']
end;
end;
procedure TsvHelloWorld.ServiceAfterInstall(Sender: TService);
var
Reg: TRegistry;
begin
Reg := TRegistry.Create(KEY_READ or KEY_WRITE);
try
Reg.RootKey := HKEY_LOCAL_MACHINE;
//entrada do registro com a descri��o do servi�o
if Reg.OpenKey('\SYSTEM\CurrentControlSet\Services\' + Self.Name, false) then
begin
Reg.WriteString('Description', fDescription);
Reg.CloseKey;
end;
//Entrada do registro com a vincula��o dos eventos do event viewer
{ if Reg.OpenKey('\SYSTEM\CurrentControlSet\Services\Eventlog\Application\' + Self.Name, True) then
begin
Reg.WriteString('EventMessageFile', ParamStr(0));
Reg.WriteInteger('TypesSupported', 7);
Reg.CloseKey;
end; }
finally
Reg.Free;
end;
end;
procedure TsvHelloWorld.ServiceAfterUninstall(Sender: TService);
{var
Reg : TRegistry;
Chave : string;}
begin
//Remover entrada no registro da vincula��o com o event viewer
{ Chave := '\SYSTEM\CurrentControlSet\Services\Eventlog\Application\' + Self.Name;
Reg := TRegistry.Create(KEY_READ or KEY_WRITE);
try
Reg.RootKey := HKEY_LOCAL_MACHINE;
if Reg.KeyExists(Chave) then
Reg.DeleteKey(Chave);
finally
Reg.Free;
end;}
end;
procedure TsvHelloWorld.ServiceBeforeInstall(Sender: TService);
begin
LerConfiguracao;
end;
procedure TsvHelloWorld.ServiceCreate(Sender: TObject);
begin
LerConfiguracao;
end;
procedure TsvHelloWorld.ServiceStart(Sender: TService; var Started: Boolean);
begin
fConnectionServer := mxConnectionServer.Create;
if fPortNumber > 0 then fConnectionServer.Start(fPortNumber) else fConnectionServer.Start;
end;
procedure TsvHelloWorld.ServiceStop(Sender: TService; var Stopped: Boolean);
begin
fConnectionServer.Free;
end;
initialization
finalization
end.
unit ucuEfetuarEmprestimo;
interface
uses
utuStateMachine, utuRequest, ucuUseCase;
type
ucEfetuarEmprestimo = class(ucUseCase)
public
procedure Initialize; Override;
procedure Finalize; Override;
published
procedure Effect_PesquisarUsuario(piRequest: utRequest; piTransition: utTransition);
procedure Effect_EscolherUsuario(piRequest: utRequest; piTransition: utTransition);
procedure Effect_RealizarEmprestimo(piRequest: utRequest; piTransition: utTransition);
procedure Effect_PesquisarExemplar(piRequest: utRequest; piTransition: utTransition);
procedure Effect_RemoverExemplar(piRequest: utRequest; piTransition: utTransition);
procedure Effect_Confirmar(piRequest: utRequest; piTransition: utTransition);
procedure Effect_CancelarConfirmacao(piRequest: utRequest; piTransition: utTransition);
procedure Effect_CancelarEscolhaExemplar(piRequest: utRequest; piTransition: utTransition);
procedure Effect_SelecionarExemplar(piRequest: utRequest; piTransition: utTransition);
end;
implementation
uses
ucuManager,
utuMessage {define utField},
acuFramework,
utuEmprestimoOQL,
acuObject {define acEnumerator},
nguUsuario;
procedure ucEfetuarEmprestimo.Initialize;
begin
inherited;
end;
procedure ucEfetuarEmprestimo.Finalize;
begin
inherited;
end;
procedure ucEfetuarEmprestimo.Effect_PesquisarUsuario(piRequest: utRequest; piTransition: utTransition);
var
lFieldUsuario,
lFieldUsuarios: utField;
lOQL: IObterUsuarios;
lListUsuarios: acPersistentObjectList;
lEnumUsuario: acEnumerator;
lUsuario: ngUsuario;
begin
lFieldUsuario := piRequest.Message.RootField.FieldByName('Usuario');
lOQL := utEmprestimoOQL.ObterUsuarios(Self.Session);
lFieldUsuarios := piRequest.Response.RootField.AddField('Usuarios');
lListUsuarios := acPersistentObjectList.Create(ngUsuario);
try
if lFieldUsuario.HasAttribute('Nome')
then lOQL.Param_nome.Value := lFieldUsuario.AttributeByName('Nome').AsString
else lOQL.Param_nome.SetNull;
if lFieldUsuario.HasAttribute('CPF')
then lOQL.Param_cpf.Value := lFieldUsuario.AttributeByName('CPF').AsString
else lOQL.Param_cpf.SetNull;
lOQL.LoadList(lListUsuarios);
lEnumUsuario := acEnumerator.Create(lListUsuarios);
try
while not lEnumUsuario.EOL do
begin
lUsuario := lEnumUsuario.Current as ngUsuario;
lUsuario.toXML(lFieldUsuarios.AddField('Usuario'));
lEnumUsuario.MoveNext;
end;
finally
lEnumUsuario.Free;
end;
finally
lListUsuarios.Free;
end;
piRequest.Processed := True;
end;
procedure ucEfetuarEmprestimo.Effect_EscolherUsuario(piRequest: utRequest; piTransition: utTransition);
begin
piRequest.Processed := True;
end;
procedure ucEfetuarEmprestimo.Effect_RealizarEmprestimo(piRequest: utRequest; piTransition: utTransition);
begin
piRequest.Processed := True;
end;
procedure ucEfetuarEmprestimo.Effect_PesquisarExemplar(piRequest: utRequest; piTransition: utTransition);
begin
piRequest.Processed := True;
end;
procedure ucEfetuarEmprestimo.Effect_RemoverExemplar(piRequest: utRequest; piTransition: utTransition);
begin
piRequest.Processed := True;
end;
procedure ucEfetuarEmprestimo.Effect_Confirmar(piRequest: utRequest; piTransition: utTransition);
begin
piRequest.Processed := True;
end;
procedure ucEfetuarEmprestimo.Effect_CancelarConfirmacao(piRequest: utRequest; piTransition: utTransition);
begin
piRequest.Processed := True;
end;
procedure ucEfetuarEmprestimo.Effect_CancelarEscolhaExemplar(piRequest: utRequest; piTransition: utTransition);
begin
piRequest.Processed := True;
end;
procedure ucEfetuarEmprestimo.Effect_SelecionarExemplar(piRequest: utRequest; piTransition: utTransition);
begin
piRequest.Processed := True;
end;
initialization
gucManager.RegisterClass(3220,ucEfetuarEmprestimo);
end.
unit ucuHelloWorld;
interface
uses
utuStateMachine, utuRequest, ucuUseCase, utuMessage;
type
ucHelloWorld = class(ucUseCase)
private
fNome: String;
public
procedure Initialize; Override;
procedure Finalize; Override;
published
procedure Effect_Cumprimentar(piRequest: utRequest; piTransition: utTransition);
procedure Effect_Despedir(piRequest: utRequest; piTransition: utTransition);
end;
implementation
uses
ucuManager;
procedure ucHelloWorld.Initialize;
begin
inherited;
end;
procedure ucHelloWorld.Finalize;
begin
inherited;
end;
procedure ucHelloWorld.Effect_Cumprimentar(piRequest: utRequest; piTransition: utTransition);
var
lFieldCumprimento: utField;
begin
fNome := piRequest.Message.RootField.FieldByName('Nome').AsString;
lFieldCumprimento := piRequest.Response.RootField.AddField('Cumprimento');
lFieldCumprimento.AsString := 'Ol, ' + fNome;
piRequest.Processed := True;
end;
procedure ucHelloWorld.Effect_Despedir(piRequest: utRequest; piTransition: utTransition);
var
lFieldDespedida: utField;
begin
lFieldDespedida := piRequest.Response.RootField.AddField('Despedida');
lFieldDespedida.AsString := 'Adeus, ' + fNome;
piRequest.Processed := True;
end;
initialization
gucManager.RegisterClass(3216,ucHelloWorld);
end.
unit ucuHelloWorldMain;
interface
uses
ucuMain;
type
ucHelloWorldMain = class(ucMain)
protected
function GetGUIXML(piLevel: Integer): string; override;
private
end;
implementation
uses
acuSystem, SysUtils, SvcMgr, ucuManager, Classes, Windows;
function ucHelloWorldMain.GetGUIXML(piLevel: Integer): string;
var
lStream: TResourceStream;
lResult: TStringStream;
begin
lStream := TResourceStream.Create(HInstance, 'mmenu', RT_RCDATA);
try
lResult := TStringStream.Create('');
try
lResult.CopyFrom(lStream, lStream.Size);
Result := lResult.DataString;
finally
lResult.Free;
end;
finally
lStream.Free;
end;
end;
initialization
gucManager.RegisterClass(UCAPLMAIN, ucHelloWorldMain);
end.
unit utuEmprestimoOQL;
interface
uses acuOQL, acuFramework;
type
IObterUsuarios = interface(IOQLQuery)
function Param_nome: acOQLParamString;
function Param_cpf: acOQLParamString;
end;
utEmprestimoOQL = class
class function ObterUsuarios(piSessao: acPersistenceSession): IObterUsuarios;
end;
implementation
type
TObterUsuarios = class(acOQLQuery, IObterUsuarios)
function Param_nome: acOQLParamString;
function Param_cpf: acOQLParamString;
end;
{ TObterUsuarios }
function TObterUsuarios.Param_nome: acOQLParamString;
begin
result := acOQLParamString(Self.ParamByName('nome'));
end;
function TObterUsuarios.Param_cpf: acOQLParamString;
begin
result := acOQLParamString(Self.ParamByName('cpf'));
end;
{ utOQLs }
class function utEmprestimoOQL.ObterUsuarios(piSessao: acPersistenceSession): IObterUsuarios;
begin
result := TObterUsuarios.Create(pisessao,
'SELECT ngUsuario' + #13#10 +
'FROM ngUsuario' + #13#10 +
'WHERE (ngUsuario.Nome LIKE ''%''+?nome:acString+''%'' OR ?nome:acString IS NULL)' + #13#10 +
' AND (ngUsuario.CPF = ?cpf:acString OR ?cpf:acString IS NULL)');
end;
end.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment