Skip to content

Commit

Permalink
Novas Atualizações (#400)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ronierys2 authored Feb 18, 2025
2 parents 74b9485 + 65e3ab1 commit bcca791
Show file tree
Hide file tree
Showing 11 changed files with 186 additions and 122 deletions.
6 changes: 2 additions & 4 deletions CORE/Source/Basic/uRESTDWBasicDB.pas
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@
Roniery - Devel.
}

{$IFNDEF RESTDWLAZARUS}
{$IFDEF FPC}
{$MODE OBJFPC}{$H+}
{$ENDIF}
{$IFDEF FPC}
{$MODE OBJFPC}{$H+}
{$ENDIF}

interface
Expand Down
24 changes: 13 additions & 11 deletions CORE/Source/Basic/uRESTDWParams.pas
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,8 @@
Roniery - Devel.
}

{$IFNDEF RESTDWLAZARUS}
{$IFDEF FPC}
{$MODE OBJFPC}{$H+}
{$ENDIF}
{$IFDEF FPC}
{$MODE OBJFPC}{$H+}
{$ENDIF}


Expand Down Expand Up @@ -261,20 +259,22 @@ interface
vTypeObject : TTypeObject;
vObjectDirection : TObjectDirection;
vObjectValue : TObjectValue;
FName,
vAlias,
vDefaultValue,
vParamName : String;
vEncoded : Boolean;
Property Name : String Read GetDisplayName Write SetDisplayName;
Public
Function GetDisplayName : String; {$IFNDEF FPC}Override;{$ENDIF}
Procedure SetDisplayName(Const Value : String); {$IFNDEF FPC}Override;{$ENDIF}
Constructor Create (aCollection : TCollection); {$IFNDEF FPC}Override;{$ENDIF}
Function GetDisplayName : String; Override;
Procedure SetDisplayName(Const Value : String); Override;
Constructor Create (aCollection : TCollection); Override;
Published
Property TypeObject : TTypeObject Read vTypeObject Write vTypeObject;
Property ObjectDirection : TObjectDirection Read vObjectDirection Write vObjectDirection;
Property ObjectValue : TObjectValue Read vObjectValue Write vObjectValue;
Property Alias : String Read vAlias Write vAlias;
Property ParamName : String Read GetDisplayName Write SetDisplayName;
Property ParamName : String Read FName Write FName;
Property Encoded : Boolean Read vEncoded Write vEncoded;
Property DefaultValue : String Read vDefaultValue Write vDefaultValue;
End;
Expand Down Expand Up @@ -681,15 +681,16 @@ implementation
vTypeObject := toParam;
vObjectDirection := odINOUT;
vObjectValue := ovString;
vParamName := 'dwparam' + IntToStr(aCollection.Count);
vParamName := 'dwparam' + IntToStr(aCollection.Count);
FName := vParamName;
vEncoded := True;
vDefaultValue := '';
vAlias := '';
End;

function TRESTDWParamMethod.GetDisplayName: String;
begin
Result := vParamName;
Result := FName;
end;

procedure TRESTDWParamMethod.SetDisplayName(const Value: String);
Expand All @@ -699,6 +700,7 @@ procedure TRESTDWParamMethod.SetDisplayName(const Value: String);
Else
Begin
vParamName := Trim(Value);
FName := vParamName;
Inherited SetDisplayName(Value);
End;
end;
Expand Down Expand Up @@ -1687,7 +1689,7 @@ procedure TRESTDWParamsMethods.PutRecName(Index: String; Item: TRESTDWParamMetho
Result := vNewFieldList
Else
Begin
{$IFDEF RESTDWLAZARUS}
{$IFDEF FPC}
Result := @aNewFieldList;
{$ELSE}
{$IFNDEF FPC}
Expand Down
69 changes: 40 additions & 29 deletions CORE/Source/Basic/uRESTDWServerContext.pas
Original file line number Diff line number Diff line change
Expand Up @@ -94,22 +94,22 @@ interface
vOwnerCollection : TCollection;
Procedure SetContextScript(Value : TStrings);
Public
Function GetDisplayName : String; {$IFNDEF FPC}Override;{$ENDIF}
Procedure SetDisplayName (Const Value : String); {$IFNDEF FPC}Override;{$ENDIF}
Function GetNamePath : String; {$IFNDEF FPC}Override;{$ENDIF}
Procedure Assign (Source : TPersistent); Override;
Constructor Create (aCollection : TCollection); Override;
Function GetDisplayName : String; Override;
Procedure SetDisplayName (Const Value : String); Override;
Function GetNamePath : String; Override;
Procedure Assign (Source : TPersistent); Override;
Constructor Create (aCollection : TCollection); Override;
Destructor Destroy; Override;
Function BuildClass : String;
Published
Property ContextTag : String Read vContextTag Write vContextTag;
Property TypeItem : String Read vType Write vType;
Property ClassItem : String Read vClass Write vClass;
Property TagID : String Read vTagID Write vTagID;
Property TagReplace : String Read vTagReplace Write vTagReplace;
Property css : String Read vCss Write vCss;
Property ContextScript : TStrings Read vContextScript Write SetContextScript;
Property ObjectName : String Read FName Write FName;
Property ContextTag : String Read vContextTag Write vContextTag;
Property TypeItem : String Read vType Write vType;
Property ClassItem : String Read vClass Write vClass;
Property TagID : String Read vTagID Write vTagID;
Property TagReplace : String Read vTagReplace Write vTagReplace;
Property css : String Read vCss Write vCss;
Property ContextScript : TStrings Read vContextScript Write SetContextScript;
Property ObjectName : String Read FName Write FName;
Property OnRequestExecute : TRESTDWMarkRequest Read vDWMarkRequest Write vDWMarkRequest;
Property OnBeforeRendererContextItem : TRESTDWGetContextItemTag Read vDWGetContextItemTag Write vDWGetContextItemTag;
End;
Expand Down Expand Up @@ -180,6 +180,9 @@ interface
Type
TRESTDWContext = Class;
PDWContext = ^TRESTDWContext;

{ TRESTDWContext }

TRESTDWContext = Class(TCollectionItem)
Protected
Private
Expand Down Expand Up @@ -208,6 +211,8 @@ interface
Function GetBeforeRenderer : TRESTDWBeforeRenderer;
Procedure SetBeforeRenderer (Value : TRESTDWBeforeRenderer);
Procedure SetBaseURL(Value : String);
Procedure SetContextName(Value : String);
Property Name : String Read GetDisplayName Write SetDisplayName;
Public
Function GetDisplayName : String; Override;
Procedure SetDisplayName(Const Value : String); Override;
Expand All @@ -219,9 +224,8 @@ interface
Published
Property Params : TRESTDWParamsMethods Read vDWParams Write vDWParams;
Property ContentType : String Read vContentType Write vContentType;
Property Name : String Read GetDisplayName Write SetDisplayName;
Property BaseURL : String Read vBaseURL Write SetBaseURL;
Property ContextName : String Read vContextName Write vContextName;
Property ContextName : String Read vContextName Write SetContextName;
Property DefaultHtml : TStrings Read vDefaultHtml Write SetDefaultPage;
Property Description : TStrings Read vDescription Write SetDescription;
Property Routes : TRESTDWRoutes Read vDWRoutes Write vDWRoutes;
Expand Down Expand Up @@ -301,7 +305,7 @@ implementation

{ TRESTDWContext }

Function TRESTDWContext.GetNamePath: String;
function TRESTDWContext.GetNamePath: String;
Begin
Result := vOwnerCollection.GetNamePath + FName;
End;
Expand All @@ -314,7 +318,7 @@ constructor TRESTDWContext.Create(aCollection: TCollection);
DWReplyRequestData := TRESTDWReplyRequestData.Create(Nil);
vOwnerCollection := aCollection;
FName := 'dwcontext' + IntToStr(aCollection.Count);
vContextName := '';
vContextName := FName;
vBaseURL := '/';
DWReplyRequestData.Name := FName;
vDWRoutes := TRESTDWRoutes.Create;
Expand All @@ -335,17 +339,17 @@ destructor TRESTDWContext.Destroy;
inherited;
end;

Function TRESTDWContext.GetBeforeRenderer: TRESTDWBeforeRenderer;
function TRESTDWContext.GetBeforeRenderer: TRESTDWBeforeRenderer;
Begin
Result := vDWBeforeRenderer;
End;

Function TRESTDWContext.GetDisplayName: String;
function TRESTDWContext.GetDisplayName: String;
Begin
Result := DWReplyRequestData.Name;
Result := FName;
End;

Procedure TRESTDWContext.CompareParams(Var Dest : TRESTDWParams);
procedure TRESTDWContext.CompareParams(var Dest: TRESTDWParams);
Var
I : Integer;
Begin
Expand All @@ -364,7 +368,7 @@ destructor TRESTDWContext.Destroy;
End;
End;

Procedure TRESTDWContext.Assign(Source: TPersistent);
procedure TRESTDWContext.Assign(Source: TPersistent);
begin
If Source is TRESTDWContext then
Begin
Expand All @@ -376,17 +380,17 @@ destructor TRESTDWContext.Destroy;
Inherited;
End;

Function TRESTDWContext.GetReplyRequestStream: TRESTDWReplyRequestStream;
function TRESTDWContext.GetReplyRequestStream: TRESTDWReplyRequestStream;
Begin
Result := DWReplyRequestData.OnReplyRequestStream;
End;

Function TRESTDWContext.GetReplyRequest: TRESTDWReplyRequest;
function TRESTDWContext.GetReplyRequest: TRESTDWReplyRequest;
Begin
Result := DWReplyRequestData.OnReplyRequest;
End;

Procedure TRESTDWContext.SetBaseURL(Value : String);
procedure TRESTDWContext.SetBaseURL(Value: String);
Var
vTempValue : String;
Begin
Expand All @@ -403,12 +407,18 @@ destructor TRESTDWContext.Destroy;
End;
End;

Procedure TRESTDWContext.SetBeforeRenderer(Value: TRESTDWBeforeRenderer);
Procedure TRESTDWContext.SetContextName(Value: String);
Begin
FName := Trim(Value);
vContextName := FName;
End;

procedure TRESTDWContext.SetBeforeRenderer(Value: TRESTDWBeforeRenderer);
Begin
vDWBeforeRenderer := Value;
End;

Procedure TRESTDWContext.SetDescription(Strings : TStrings);
procedure TRESTDWContext.SetDescription(Strings: TStrings);
begin
vDescription.Assign(Strings);
end;
Expand All @@ -418,7 +428,7 @@ procedure TRESTDWContext.SetDefaultPage(Strings: TStrings);
vDefaultHtml.Assign(Strings);
end;

Procedure TRESTDWContext.SetDisplayName(Const Value: String);
procedure TRESTDWContext.SetDisplayName(const Value: String);
Begin
If Trim(Value) = '' Then
Raise Exception.Create(cInvalidContextName)
Expand All @@ -432,7 +442,8 @@ procedure TRESTDWContext.SetDefaultPage(Strings: TStrings);
End;
End;

Procedure TRESTDWContext.SetReplyRequestStream(Value : TRESTDWReplyRequestStream);
procedure TRESTDWContext.SetReplyRequestStream(Value: TRESTDWReplyRequestStream
);
begin
DWReplyRequestData.OnReplyRequestStream := Value;
end;
Expand Down
12 changes: 6 additions & 6 deletions CORE/Source/Basic/uRESTDWServerEvents.pas
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ interface
Procedure SetBaseUrl (Value : String);
Procedure SetContentType(Value : String);
Procedure SetDataMode (Value : TDataMode);
Property Name : String Read GetDisplayName Write SetDisplayName;
Public
Function GetDisplayName : String; Override;
Procedure SetDisplayName(Const Value : String); Override;
Expand All @@ -104,8 +105,7 @@ interface
Property Routes : TRESTDWRoutes Read vDWRoutes Write vDWRoutes;
Property Params : TRESTDWParamsMethods Read vDWParams Write vDWParams;
Property DataMode : TDataMode Read vDataMode Write SetDataMode;
Property Name : String Read GetDisplayName Write SetDisplayName;
Property EventName : String Read vEventName Write vEventName;
Property EventName : String Read FName Write FName;
Property BaseURL : String Read vBaseURL Write SetBaseURL;
Property DefaultContentType : String Read vContentType Write SetContentType;
Property CallbackEvent : Boolean Read vCallbackEvent Write vCallbackEvent;
Expand Down Expand Up @@ -171,7 +171,7 @@ interface
Var DWParams : TRESTDWParams);
Published
Property IgnoreInvalidParams : Boolean Read vIgnoreInvalidParams Write vIgnoreInvalidParams;
Property Events : TRESTDWEventList Read vEventList Write vEventList;
Property Events : TRESTDWEventList Read vEventList Write vEventList;
Property AccessTag : String Read vAccessTag Write vAccessTag;
Property DefaultEvent : String Read vDefaultEvent Write vDefaultEvent;
Property OnCreate : TObjectEvent Read vOnCreate Write vOnCreate;
Expand Down Expand Up @@ -268,7 +268,7 @@ constructor TRESTDWEvent.Create(aCollection: TCollection);

Function TRESTDWEvent.GetDisplayName: String;
Begin
Result := DWReplyEventData.Name;
Result := FName;
End;

Procedure TRESTDWEvent.Assign(Source: TPersistent);
Expand Down Expand Up @@ -802,8 +802,8 @@ procedure TRESTDWClientEvents.GetOnlineEvents(Value: Boolean);
If Assigned(vRESTClientPooler.OnBeforeExecute) Then
vRESTClientPooler.OnBeforeExecute(Self);
DWParams := TRESTDWParams.Create;
DWParams.CriptOptions.Use := CriptOptions.Use;
DWParams.CriptOptions.Key := CriptOptions.Key;
// DWParams.CriptOptions.Use := CriptOptions.Use;
// DWParams.CriptOptions.Key := CriptOptions.Key;
JSONParam := TRESTDWJSONParam.Create(RESTClientPoolerExec.Encoding);
JSONParam.ParamName := 'dwservereventname';
JSONParam.ObjectDirection := odIn;
Expand Down
8 changes: 3 additions & 5 deletions CORE/Source/Consts/uRESTDWConsts.pas
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,8 @@
Roniery - Devel.
}

{$IFNDEF RESTDWLAZARUS}
{$IFDEF FPC}
{$MODE OBJFPC}{$H+}
{$ENDIF}
{$IFDEF FPC}
{$MODE OBJFPC}{$H+}
{$ENDIF}

Interface
Expand Down Expand Up @@ -62,7 +60,7 @@

// controle de versão
RESTDWVersionINFO = 'v2.1.0-';
RESTDWRelease = '3920';
RESTDWRelease = '3933';
RESTDWCodeProject = 'Galaga - Github';
RESTDWVersao = RESTDWVersionINFO + RESTDWRelease + '(' + RESTDWCodeProject + ')';
RESTDWDialogoTitulo = 'REST DataWare Components ' + RESTDWVersao;
Expand Down
6 changes: 3 additions & 3 deletions CORE/Source/Database_Drivers/uRESTDWDriverBase.pas
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ procedure TRESTDWDrvDataset.ImportParams(DWParams: TRESTDWParams);
vParam.Clear;
end
else If vParam.DataType in [ftDate, ftTime, ftDateTime, ftTimeStamp] then begin
if (Trim(DWParams[I].Value) <> '') and (not DWParams[I].IsNull) then begin
if (Trim(DWParams[I].AsString) <> '') and (not DWParams[I].IsNull) then begin
if vParam.DataType = ftDate then
vParam.Value := DWParams[I].AsDate
else If vParam.DataType = ftTime then
Expand Down Expand Up @@ -617,7 +617,7 @@ procedure TRESTDWDrvDataset.ImportParams(DWParams: TRESTDWParams);
if vParam.RESTDWDataTypeParam in [dwftMemo, dwftFmtMemo] then
vParam.Value := DecodeStrings(DWParams[I].AsString)
else
vParam.Value := utf8tostring(DWParams[I].AsString);
vParam.Value := DWParams[I].AsString;
{$ELSE}
if vParam.RESTDWDataTypeParam in [dwftMemo, dwftFmtMemo] then
vParam.Value := DecodeStrings(DWParams[I].AsString)
Expand All @@ -628,7 +628,7 @@ procedure TRESTDWDrvDataset.ImportParams(DWParams: TRESTDWParams);
if vParam.RESTDWDataTypeParam in [dwftMemo] then
vParam.Value := DecodeStrings(DWParams[I].AsString, csUndefined)
else
vParam.Value := utf8tostring(DWParams[I].AsString);
vParam.Value := DWParams[I].AsString;
{$ENDIF}
End
Else
Expand Down
Loading

0 comments on commit bcca791

Please sign in to comment.