diff --git a/Source/Core/ormbr.bind.pas b/Source/Core/ormbr.bind.pas index 2c4ee9d7..b2cd356b 100644 --- a/Source/Core/ormbr.bind.pas +++ b/Source/Core/ormbr.bind.pas @@ -242,7 +242,7 @@ procedure TBind.SetPropertyToField(const AObject: TObject; end; except on E: Exception do - raise Exception.Create('Column : ' + LColumn.ColumnName + raise Exception.Create(SColumn + LColumn.ColumnName + sLineBreak + E.Message); end; @@ -494,7 +494,7 @@ procedure TBind.SetDataDictionary(const ADataSet: TDataSet; raise Exception.Create('ormbr.bind->SetDataDictionary()' + sLineBreak + sLineBreak - + 'Column: ' + LFieldName); + + SColumn + LFieldName); end; end; end; @@ -707,7 +707,7 @@ procedure TBind.SetFieldToProperty(const ADataSet: IDBResultSet; _SetFieldToProperty(ADataSet.GetField(LColumn.ColumnName), LColumn, AObject); except on E: Exception do - raise Exception.Create('Problem when binding column "' + + raise Exception.Create(SProblemBindingColumn + LColumn.ColumnName + '" - ' + E.Message); end; end; @@ -788,7 +788,7 @@ procedure TBind.SetFieldToProperty(const ADataSet: TDataSet; _SetFieldToProperty(ADataSet.FieldByName(LColumn.ColumnName), LColumn, AObject); except on E: Exception do - raise Exception.CreateFmt('Problem when binding [%s->%s] (message: %s)', + raise Exception.CreateFmt(SProblemBinding, [ADataSet.Name, LColumn.ColumnName, E.Message]); end; end; @@ -858,7 +858,7 @@ procedure TBind._SetFieldToPropertyRecord(const LProperty: TRttiProperty; end; end else - raise Exception.CreateFmt('Column [%s] must have blob value', [AColumn.ColumnName]); + raise Exception.CreateFmt(SColumnMustHaveBlobValue, [AColumn.ColumnName]); end else LProperty.SetValueNullable(AObject, LProperty.PropertyType.Handle, AField.Value, False); diff --git a/Source/Core/ormbr.command.executor.pas b/Source/Core/ormbr.command.executor.pas index ca58e1be..2570b0be 100644 --- a/Source/Core/ormbr.command.executor.pas +++ b/Source/Core/ormbr.command.executor.pas @@ -109,7 +109,8 @@ implementation ormbr.bind, ormbr.session.abstract, ormbr.objects.helper, - ormbr.rtti.helper; + ormbr.rtti.helper, + ormbr.core.consts; { TObjectManager } @@ -121,7 +122,7 @@ constructor TSQLCommandExecutor.Create(const AOwner: TObject; FPageSize := APageSize; if not (AOwner is TSessionAbstract) then raise Exception - .Create('O Object Manager não deve ser instânciada diretamente, use as classes TSessionObject ou TSessionDataSet'); + .Create(SObjectManagerNotDirectCreate); FConnection := AConnection; FObjectInternal := M.Create; diff --git a/Source/Core/ormbr.core.consts.pas b/Source/Core/ormbr.core.consts.pas index ee2a1e8f..6f969213 100644 --- a/Source/Core/ormbr.core.consts.pas +++ b/Source/Core/ormbr.core.consts.pas @@ -28,6 +28,8 @@ interface +{$INCLUDE ..\ormbr.inc} + uses TypInfo; @@ -48,7 +50,51 @@ interface tkPointer, tkProcedure]; +resourcestring +{$IFDEF CBLIB_BR} + SColumn = 'Column : '; + SProblemBindingColumn = 'Problem when binding column "'; + SProblemBinding = 'Problem when binding [%s->%s] (message: %s)'; + SColumnMustHaveBlobValue = 'Column [%s] must have blob value'; + SObjectManagerNotDirectCreate = 'O Object Manager não deve ser instânciada diretamente, use as classes TSessionObject ou TSessionDataSet'; + SDriver = 'O Driver '; + SDNotRegister = ' não está registrado, adicione a unit "ormbr.dml.generator.???.pas" onde ??? nome do driver, na cláusula USES do seu projeto!'; + SPropertyError = 'Erro no SetValue() da propriedade '; + SCannotFindMetod = 'Cannot find method "%s" in the object'; + SCannotFindConstructor = 'Cannot find a property constructor for '; + SInvalidImage = 'Invalid image'; + SCannotAssign = 'Cannot assigned non-null pointer to nullable type.'; +{$ENDIF} + +{$IFDEF CBLIB_EN} + SColumn = 'Column : '; + SProblemBindingColumn = 'Problem when binding column "'; + SProblemBinding = 'Problem when binding [%s->%s] (message: %s)'; + SColumnMustHaveBlobValue = 'Column [%s] must have blob value'; + SObjectManagerNotDirectCreate = 'The Object Manager must not be instantiated directly, use the classes TSessionObject or TSessionDataSet'; + SDriver = 'The Driver '; + SDNotRegister = ' is not registered, add the unit "ormbr.dml.generator.???.pas" where ??? driver name, in the USES clause of your project!'; + SPropertyError = 'Error in SetValue() of property '; + SCannotFindMetod = 'Cannot find method "%s" in the object'; + SCannotFindConstructor = 'Cannot find a property constructor for '; + SInvalidImage = 'Invalid image'; + SCannotAssign = 'Cannot assigned non-null pointer to nullable type.'; +{$ENDIF} +{$IFDEF CBLIB_RU} + SColumn = 'Ñòîëáåö : '; + SProblemBindingColumn = 'Ïðîáëåìà ïðè ïðèâÿçêå ñòîëáöà "'; + SProblemBinding = 'Ïðîáëåìà ïðè ïðèâÿçêå [%s->%s] (Ñîîáùåíèå: %s)'; + SColumnMustHaveBlobValue = 'Ñòîëáåö [%s] äîëæåí èìåòü çíà÷åíèå blob'; + SObjectManagerNotDirectCreate = 'Äèñïåò÷åð îáúåêòîâ íå äîëæåí ñîçäàâàòüñÿ íàïðÿìóþ, èñïîëüçóéòå êëàññû TSessionObject èëè TSessionDataSet'; + SDriver = 'Äðàéâåð '; + SDNotRegister = ' íå çàðåãèñòðèðîâàí, äîáàâüòå ìîäóëü "ormbr.dml.generator.???.pas" ãäå ??? èìÿ äðàéâåðà â ðàçäåëå USES âàøåãî ïðîåêòà!'; + SPropertyError = 'Îøèáêà â ñâîéñòâå SetValue() '; + SCannotFindMetod = 'Cannot find method "%s" in the object'; + SCannotFindConstructor = 'Íåâîçìîæíî íàéòè êîíñòðóêòîð ñâîéñòâ äëÿ '; + SInvalidImage = 'Íåäîïóñòèìîå èçîáðàæåíèå'; + SCannotAssign = 'Íåâîçìîæíî ïðèñâîèòü íåíóëåâîé óêàçàòåëü nullable òèïó.'; +{$ENDIF} implementation end. diff --git a/Source/Core/ormbr.driver.register.pas b/Source/Core/ormbr.driver.register.pas index 800e6224..5c5261cc 100644 --- a/Source/Core/ormbr.driver.register.pas +++ b/Source/Core/ormbr.driver.register.pas @@ -32,6 +32,7 @@ interface SysUtils, Generics.Collections, ormbr.dml.interfaces, + ormbr.core.consts, dbebr.factory.interfaces; type @@ -65,7 +66,7 @@ class function TDriverRegister.GetDriver(const ADriverName: TDriverName): IDMLGe begin if not FDriver.ContainsKey(ADriverName) then raise Exception - .Create('O driver ' + TStrDriverName[ADriverName] + ' não está registrado, adicione a unit "ormbr.dml.generator.???.pas" onde ??? nome do driver, na cláusula USES do seu projeto!'); + .Create(SDriver + TStrDriverName[ADriverName] + SDNotRegister); Result := FDriver[ADriverName]; end; diff --git a/Source/Core/ormbr.json.pas b/Source/Core/ormbr.json.pas index 912aabf4..21cd44b4 100644 --- a/Source/Core/ormbr.json.pas +++ b/Source/Core/ormbr.json.pas @@ -94,7 +94,8 @@ TORMBrJson = class implementation uses - ormbr.rtti.helper; + ormbr.rtti.helper, + ormbr.core.consts; { TJson } @@ -172,7 +173,7 @@ class procedure TORMBrJson.DoGetValue({const Sender: TJSONBrObject;} end; except on E: Exception do - raise Exception.Create('Erro no SetValue() da propriedade [' + AProperty.Name + ']' + sLineBreak + E.Message); + raise Exception.Create(SPropertyError + '[' + AProperty.Name + ']' + sLineBreak + E.Message); end; end; @@ -228,7 +229,7 @@ class procedure TORMBrJson.DoSetValue(const AInstance: TObject; end; except on E: Exception do - raise Exception.Create('Erro no SetValue() da propriedade [' + AProperty.Name + ']' + sLineBreak + E.Message); + raise Exception.Create(SPropertyError + '[' + AProperty.Name + ']' + sLineBreak + E.Message); end; end; end; diff --git a/Source/Core/ormbr.objects.helper.pas b/Source/Core/ormbr.objects.helper.pas index f0bfd5a3..640489f3 100644 --- a/Source/Core/ormbr.objects.helper.pas +++ b/Source/Core/ormbr.objects.helper.pas @@ -65,7 +65,8 @@ TObjectHelper = class helper for TObject end; implementation - +uses + ormbr.core.consts; { TObjectHelper } function TObjectHelper.GetNotServerUse: NotServerUse; @@ -185,7 +186,7 @@ function TObjectHelper.MethodCall(const AMethodName: String; if Assigned(LMethod) then Result := LMethod.Invoke(Self, AParameters) else - raise Exception.CreateFmt('Cannot find method "%s" in the object', [AMethodName]); + raise Exception.CreateFmt(SCannotFindMetod, [AMethodName]); finally LContext.Free; end; diff --git a/Source/Core/ormbr.objects.utils.pas b/Source/Core/ormbr.objects.utils.pas index dc805bac..ff2d2553 100644 --- a/Source/Core/ormbr.objects.utils.pas +++ b/Source/Core/ormbr.objects.utils.pas @@ -81,7 +81,8 @@ implementation uses dbcbr.mapping.explorer, dbcbr.rtti.helper, - ormbr.objects.helper; + ormbr.objects.helper, + ormbr.core.consts; function RttiSingleton: IRttiSingleton; begin @@ -286,7 +287,7 @@ function TRttiSingleton.CreateObject(ARttiType: TRttiType): TObject; if Assigned(metaClass) then Result := Method.Invoke(metaClass, []).AsObject else - raise Exception.Create('Cannot find a propert constructor for ' + ARttiType.ToString); + raise Exception.Create(SCannotFindConstructor + ARttiType.ToString); end; function TRttiSingleton.GetRttiType(AClass: TClass): TRttiType; diff --git a/Source/Core/ormbr.types.blob.pas b/Source/Core/ormbr.types.blob.pas index bf8f8050..abe2a20f 100644 --- a/Source/Core/ormbr.types.blob.pas +++ b/Source/Core/ormbr.types.blob.pas @@ -95,6 +95,8 @@ TBlob = record implementation +uses + ormbr.core.consts; const MinGraphicSize = 44; @@ -109,7 +111,7 @@ procedure TBlob.SetBlobField(const Value: TBlobField; const ACompression: Boolea BuildBlobFieldToStream(ACompression); end else - raise Exception.Create(Format('Column [%s] must have blob value', [Value.FieldName])); + raise Exception.Create(Format(SColumnMustHaveBlobValue, [Value.FieldName])); end; procedure TBlob.SetBytes(const Value: TBytes); @@ -198,7 +200,7 @@ procedure TBlob.ToPicture(APicture: TPicture; const ACompression: Boolean); try DecompressStream(LSourceStream, LTargetStream); if not FindGraphicClass(LTargetStream.Memory^, LTargetStream.Size, LGraphicClass) then - raise EInvalidGraphic.Create('Invalid image'); + raise EInvalidGraphic.Create(SInvalidImage); LGraphic := LGraphicClass.Create; LTargetStream.Position := 0; LGraphic.LoadFromStream(LTargetStream); @@ -209,7 +211,7 @@ procedure TBlob.ToPicture(APicture: TPicture; const ACompression: Boolean); else begin if not FindGraphicClass(LSourceStream.Memory^, LSourceStream.Size, LGraphicClass) then - raise EInvalidGraphic.Create('Invalid image'); + raise EInvalidGraphic.Create(SInvalidImage); LGraphic := LGraphicClass.Create; LSourceStream.Position := 0; LGraphic.LoadFromStream(LSourceStream); diff --git a/Source/Core/ormbr.types.nullable.pas b/Source/Core/ormbr.types.nullable.pas index ff938763..7dace96d 100644 --- a/Source/Core/ormbr.types.nullable.pas +++ b/Source/Core/ormbr.types.nullable.pas @@ -76,6 +76,9 @@ Nullable = record implementation +uses + ormbr.core.consts; + const CHasValueFlag = '@'; @@ -190,7 +193,7 @@ function Nullable.Equals(const other: Nullable): Boolean; if not Assigned(Value) then Result.Clear else - raise Exception.Create('Cannot assigned non-null pointer to nullable type.'); + raise Exception.Create(SCannotAssign); end; class operator Nullable.Equal(const a, b: Nullable): Boolean; diff --git a/Source/Dataset/ormbr.container.clientdataset.pas b/Source/Dataset/ormbr.container.clientdataset.pas index 12be85c8..80d924bd 100644 --- a/Source/Dataset/ormbr.container.clientdataset.pas +++ b/Source/Dataset/ormbr.container.clientdataset.pas @@ -52,6 +52,8 @@ TContainerClientDataSet = class(TContainerDataSet) end; implementation +uses + ormbr.dataset.consts; { TContainerClientDataSet } @@ -59,7 +61,7 @@ constructor TContainerClientDataSet.Create(AConnection: IDBConnection; ADataSet: TDataSet; APageSize: Integer; AMasterObject: TObject); begin if not (ADataSet is TClientDataSet) then - raise Exception.Create('Is not TClientDataSet type'); + raise Exception.Create(SIsNotClientDatasetType); FDataSetAdapter := TClientDataSetAdapter.Create(AConnection, ADataSet, APageSize, AMasterObject) end; diff --git a/Source/Dataset/ormbr.container.fdmemtable.pas b/Source/Dataset/ormbr.container.fdmemtable.pas index cf98d44a..12e28ea3 100644 --- a/Source/Dataset/ormbr.container.fdmemtable.pas +++ b/Source/Dataset/ormbr.container.fdmemtable.pas @@ -54,6 +54,8 @@ TContainerFDMemTable = class(TContainerDataSet) end; implementation +uses + ormbr.dataset.consts; { TContainerFDMemTable } @@ -61,7 +63,7 @@ constructor TContainerFDMemTable.Create(AConnection: IDBConnection; ADataSet: TDataSet; APageSize: Integer; AMasterObject: TObject); begin if not (ADataSet is TFDMemTable) then - raise Exception.Create('Is not TFDMemTable type'); + raise Exception.Create(SIsNotFDMemTableType); FDataSetAdapter := TFDMemTableAdapter.Create(AConnection, ADataSet, APageSize, AMasterObject) end; diff --git a/Source/Dataset/ormbr.dataset.base.adapter.pas b/Source/Dataset/ormbr.dataset.base.adapter.pas index ff4ab4ab..c1873f5d 100644 --- a/Source/Dataset/ormbr.dataset.base.adapter.pas +++ b/Source/Dataset/ormbr.dataset.base.adapter.pas @@ -350,7 +350,7 @@ procedure TDataSetBaseAdapter._ExecuteOneToMany(AObject: M; LPropertyType := AProperty.GetTypeValue(LPropertyType); if not LPropertyType.IsInstance then raise Exception - .Create('Not in instance ' + LPropertyType.Parent.ClassName + ' - ' + .Create(SNotInInstance + LPropertyType.Parent.ClassName + ' - ' + LPropertyType.Name); // if ADatasetBase.FCurrentInternal.ClassType <> diff --git a/Source/Dataset/ormbr.dataset.consts.pas b/Source/Dataset/ormbr.dataset.consts.pas index 60216159..b474fd98 100644 --- a/Source/Dataset/ormbr.dataset.consts.pas +++ b/Source/Dataset/ormbr.dataset.consts.pas @@ -31,11 +31,43 @@ interface +{$INCLUDE ..\ormbr.inc} + const cFIELDEVENTS = '%s event required in column [%s]!'; cNOTFIELDTYPEBLOB = 'Column [%s] must have blob value'; cCREATEBINDDATASET = 'Access class %s by method %s'; +resourcestring +{$IFDEF CBLIB_BR} + SIsNotClientDatasetType = 'Is not TClientDataSet type'; + SIsNotFDMemTableType = 'Is not TFDMemTable type'; + SNotInInstance = 'Not in instance '; + SCalculatedField 'O Campo calculado : '; + SExists = ' já existe'; + SAggregatedField = 'O Campo agregado de nome : '; + SEnableDirective = 'Enable the directive in file ormbr.inc : '; +{$ENDIF} + +{$IFDEF CBLIB_EN} + SIsNotClientDatasetType = 'Is not TClientDataSet type'; + SIsNotFDMemTableType = 'Is not TFDMemTable type'; + SNotInInstance = 'Not in instance '; + SCalculatedField 'The Calculated Field: '; + SExists = ' already exist'; + SAggregatedField = 'Aggregated field : '; + SEnableDirective = 'Enable the directive in file ormbr.inc : '; +{$ENDIF} + +{$IFDEF CBLIB_RU} + SIsNotClientDatasetType = 'Íå ÿâëÿåòñÿ òèïîì TClientDataSet'; + SIsNotFDMemTableType = 'Íå ÿâëÿåòñÿ òèïîì TFDMemTable'; + SNotInInstance = 'Not in instance '; + SCalculatedField 'Âû÷èñëÿåìîå ïîëå : '; + SExists = ' óæå ñóùåñòâóåò'; + SAggregatedField = 'Àãðåãàòíîå ïîëå : '; + SEnableDirective = 'Âêëþ÷èòå äèðåêòèâó â ôàéëå ormbr.inc : '; +{$ENDIF} implementation end. diff --git a/Source/Dataset/ormbr.dataset.fields.pas b/Source/Dataset/ormbr.dataset.fields.pas index be15ca17..ccd33d86 100644 --- a/Source/Dataset/ormbr.dataset.fields.pas +++ b/Source/Dataset/ormbr.dataset.fields.pas @@ -100,6 +100,8 @@ TFieldSingleton = class(TInterfacedObject, IFieldSingleton) end; implementation +uses + ormbr.dataset.consts; procedure TFieldSingleton.AddField(const ADataSet: TDataSet; const AFieldName: String; @@ -252,7 +254,7 @@ procedure TFieldSingleton.AddCalcField(const ADataSet: TDataSet; LField: TField; begin if (ADataSet.FindField(AFieldName) <> nil) then - raise Exception.Create('O Campo calculado : ' + AFieldName + ' já existe'); + raise Exception.Create(SCalculatedField + AFieldName + SExists); LField := GetFieldType(ADataSet, AFieldType); if LField = nil then @@ -281,7 +283,7 @@ procedure TFieldSingleton.AddAggregateField(const ADataSet: TDataSet; LField: TAggregateField; begin if ADataSet.FindField(AFieldName) <> nil then - raise Exception.Create('O Campo agregado de nome : ' + AFieldName + ' já existe'); + raise Exception.Create(SAggregatedField + AFieldName + SExists); LField := TAggregateField.Create(ADataSet); if LField = nil then diff --git a/Source/Dataset/ormbr.manager.dataset.pas b/Source/Dataset/ormbr.manager.dataset.pas index 2891e906..5c7fd569 100644 --- a/Source/Dataset/ormbr.manager.dataset.pas +++ b/Source/Dataset/ormbr.manager.dataset.pas @@ -117,6 +117,8 @@ TManagerDataSet = class end; implementation +uses + ormbr.dataset.consts; { TManagerDataSet } @@ -168,7 +170,7 @@ function TManagerDataSet.Find(const AID: TValue): T; if AID.IsType then Result := Resolver.Find(AID.ToString) else - raise Exception.Create('Invalid parameter type'); + raise Exception.Create(Invalid parameter type'); end; function TManagerDataSet.Find: TObjectList; @@ -356,14 +358,14 @@ procedure TManagerDataSet.ResolverDataSetType(const ADataSet: TDataSet); begin {$IFDEF USEFDMEMTABLE} if not (ADataSet is TFDMemTable) then - raise Exception.Create('Is not TFDMemTable type'); + raise Exception.Create( SIsNotFDMemTableType); {$ENDIF} {$IFDEF USECLIENTDATASET} if not (ADataSet is TClientDataSet) then - raise Exception.Create('Is not TClientDataSet type'); + raise Exception.Create(SIsNotClientDatasetType); {$ENDIF} {$IFNDEF USEMEMDATASET} - raise Exception.Create('Enable the directive "USEFDMEMTABLE" or "USECLIENTDATASET" in file ormbr.inc'); + raise Exception.Create(SEnableDirective + '"USEFDMEMTABLE" | "USECLIENTDATASET"'); {$ENDIF} end; diff --git a/Source/RESTful/Client/ormbr.client.consts.pas b/Source/RESTful/Client/ormbr.client.consts.pas index 9877f18b..eb9b8a32 100644 --- a/Source/RESTful/Client/ormbr.client.consts.pas +++ b/Source/RESTful/Client/ormbr.client.consts.pas @@ -29,6 +29,8 @@ interface +{$INCLUDE ..\..\ormbr.inc} + const cORMBRSOBRETITULOCLIENT = 'ORMBr - REST Client Components'; cORMBRVERSIONCLIENT = '1.2'; @@ -38,6 +40,57 @@ interface 'Version : ' + cORMBRVERSIONCLIENT + '.' + cORMBRRELEASECLIENT; cORMBRSOBRELICENCACLIENT = 'Registered'; +resourcestring +{$IFDEF CBLIB_BR} + SParamInsertWasNotPassed = 'Não foi passado o parâmetro com os dados do insert!'; + SResource = 'Resource : '; + SSubresource = 'SubResource : '; + SMessage = 'Message : '; + SStatusCode = 'Status Code : '; + SCouldNotFindInfo = 'Não foi possível encontrar a informação '; + SUrl = 'URL : '; + SMetod = 'Method : '; + SResult = 'Result : '; + SId = 'ID : '; + SError = 'Error : '; + SJSon = 'Json : '; + SWhere = 'Where : '; + SOrderBy = 'OrderBy: '; +{$ENDIF} + +{$IFDEF CBLIB_EN} + SParamInsertWasNotPassed = 'The parameter with the insert data was not passed!'; + SResource = 'Resource : '; + SSubresource = 'SubResource : '; + SMessage = 'Message : '; + SStatusCode = 'Status Code : '; + SCouldNotFindInfo = 'Could not find information'; + SUrl = 'URL : '; + SMetod = 'Method : '; + SResult = 'Result : '; + SId = 'ID : '; + SError = 'Error : '; + SJSon = 'Json : '; + SWhere = 'Where : '; + SOrderBy = 'OrderBy: '; +{$ENDIF} + +{$IFDEF CBLIB_RU} + SParamInsertWasNotPassed = 'The parameter with the insert data was not passed!'; + SResource = 'Resource : '; + SSubresource = 'SubResource : '; + SMessage = 'Ñîîáùåíèå : '; + SStatusCode = 'Status Code : '; + SCouldNotFindInfo = 'Íåâîçìîæíî íàéòè èíôîðìàöèþ '; + SUrl = 'URL : '; + SMetod = 'Method : '; + SResult = 'Result : '; + SId = 'ID : '; + SError = 'Oøèáêà : '; + SJSon = 'Json : '; + SWhere = 'Where : '; + SOrderBy = 'OrderBy: '; +{$ENDIF} implementation end. diff --git a/Source/RESTful/Client/ormbr.client.datasnap.pas b/Source/RESTful/Client/ormbr.client.datasnap.pas index 1c3abac1..6fdf7769 100644 --- a/Source/RESTful/Client/ormbr.client.datasnap.pas +++ b/Source/RESTful/Client/ormbr.client.datasnap.pas @@ -76,7 +76,8 @@ TRESTClientDataSnap = class(TORMBrClient) implementation uses - ormbr.client.restdatasnap.factory; + ormbr.client.restdatasnap.factory, + ormbr.client.consts; { TRESTClientDataSnap } @@ -455,7 +456,7 @@ procedure TRESTClientDataSnap.SetParamsBodyValue; LFor: Integer; begin if FBodyParams.Count = 0 then - raise Exception.Create('Não foi passado o parâmetro com os dados do insert!'); + raise Exception.Create(SParamInsertWasNotPassed); for LFor := 0 to FBodyParams.Count -1 do FRESTRequest.Body.Add(FBodyParams.Items[LFor].AsString, ContentTypeFromString('application/json')); diff --git a/Source/RESTful/Client/ormbr.client.horse.pas b/Source/RESTful/Client/ormbr.client.horse.pas index 86b28555..bf3e15f8 100644 --- a/Source/RESTful/Client/ormbr.client.horse.pas +++ b/Source/RESTful/Client/ormbr.client.horse.pas @@ -78,7 +78,8 @@ TRESTClientHorse = class(TORMBrClient) implementation uses - ormbr.client.resthorse.factory; + ormbr.client.resthorse.factory, + ormbr.client.consts; { TRESTClientHorse } @@ -465,7 +466,7 @@ procedure TRESTClientHorse.SetParamsBodyValue; LFor: Integer; begin if FBodyParams.Count = 0 then - raise Exception.Create('Não foi passado o parâmetro com os dados do insert!'); + raise Exception.Create(SParamInsertWasNotPassed); for LFor := 0 to FBodyParams.Count -1 do FRESTRequest.Body.Add(FBodyParams.Items[LFor].AsString, ContentTypeFromString('application/json')); diff --git a/Source/RESTful/Client/ormbr.client.mars.pas b/Source/RESTful/Client/ormbr.client.mars.pas index ee2e690e..a674a97b 100644 --- a/Source/RESTful/Client/ormbr.client.mars.pas +++ b/Source/RESTful/Client/ormbr.client.mars.pas @@ -76,7 +76,8 @@ TRESTClientMARS = class(TORMBrClient) implementation uses - ormbr.client.restmars.factory; + ormbr.client.restmars.factory, + ormbr.client.consts; { TRESTClientMARS } @@ -442,7 +443,7 @@ procedure TRESTClientMARS.SetParamsBodyValue(var AParams: String); LFor: Integer; begin if FBodyParams.Count = 0 then - raise Exception.Create('Não foi passado o parâmetro com os dados do insert!'); + raise Exception.Create(SParamInsertWasNotPassed); for LFor := 0 to FBodyParams.Count -1 do AParams := AParams + FBodyParams.Items[LFor].AsString; diff --git a/Source/RESTful/Client/ormbr.client.restexception.pas b/Source/RESTful/Client/ormbr.client.restexception.pas index 312e88f5..d8427ede 100644 --- a/Source/RESTful/Client/ormbr.client.restexception.pas +++ b/Source/RESTful/Client/ormbr.client.restexception.pas @@ -43,6 +43,8 @@ EORMBrRESTException = class(Exception) end; implementation +uses + ormbr.client.consts; { EORMBrRESTException } @@ -51,13 +53,13 @@ constructor EORMBrRESTException.Create(const AURL, AResource, ASubResource, var LMessage: String; begin - LMessage := 'URL : ' + AURL + sLineBreak + - 'Resource : ' + AResource + sLineBreak + - 'SubResource : ' + ASubResource + sLineBreak + - 'Method : ' + AMethodType + sLineBreak + - 'Message : ' + AMessage + sLineBreak + - 'Error : ' + AMessageError + sLineBreak + - 'Status Code : ' + IntToStr(AStatusCode); + LMessage := SUrl + AURL + sLineBreak + + SResource + AResource + sLineBreak + + SSubResource + ASubResource + sLineBreak + + SMetod + AMethodType + sLineBreak + + SMessage + AMessage + sLineBreak + + SError + AMessageError + sLineBreak + + SStatusCode + IntToStr(AStatusCode); inherited Create(LMessage); end; diff --git a/Source/RESTful/Client/ormbr.client.wirl.pas b/Source/RESTful/Client/ormbr.client.wirl.pas index 03d24d08..9aace795 100644 --- a/Source/RESTful/Client/ormbr.client.wirl.pas +++ b/Source/RESTful/Client/ormbr.client.wirl.pas @@ -75,7 +75,8 @@ TRESTClientWiRL = class(TORMBrClient) implementation uses - ormbr.client.restwirl.factory; + ormbr.client.restwirl.factory, + ormbr.client.consts; { TRESTClientWiRL } @@ -445,7 +446,7 @@ procedure TRESTClientWiRL.SetProxyParamsBodyValue(var AParams: String); LFor: Integer; begin if FBodyParams.Count = 0 then - raise Exception.Create('Não foi passado o parâmetro com os dados do insert!'); + raise Exception.Create(SParamInsertWasNotPassed); for LFor := 0 to FBodyParams.Count -1 do AParams := AParams + FBodyParams.Items[LFor].AsString; diff --git a/Source/RESTful/Client/ormbr.client.ws.pas b/Source/RESTful/Client/ormbr.client.ws.pas index 4c89cc3f..dc054829 100644 --- a/Source/RESTful/Client/ormbr.client.ws.pas +++ b/Source/RESTful/Client/ormbr.client.ws.pas @@ -74,7 +74,8 @@ TRESTClientWS = class(TORMBrClient) implementation uses - ormbr.client.restws.factory; + ormbr.client.restws.factory, + ormbr.client.consts; { TRESTClientWS } @@ -377,7 +378,7 @@ procedure TRESTClientWS.SetParamsBodyValue; LFor: Integer; begin if FBodyParams.Count = 0 then - raise Exception.Create('Não foi passado o parâmetro com os dados do insert!'); + raise Exception.Create(SParamInsertWasNotPassed); for LFor := 0 to FBodyParams.Count -1 do FRESTRequest.Body.Add(FBodyParams.Items[LFor].AsString, ContentTypeFromString('application/json')); diff --git a/Source/RESTful/Client/ormbr.restdataset.adapter.pas b/Source/RESTful/Client/ormbr.restdataset.adapter.pas index a7b5c837..a17aeab9 100644 --- a/Source/RESTful/Client/ormbr.restdataset.adapter.pas +++ b/Source/RESTful/Client/ormbr.restdataset.adapter.pas @@ -86,7 +86,8 @@ implementation ormbr.objects.helper, ormbr.rtti.helper, dbcbr.mapping.explorer, - dbcbr.mapping.attributes; + dbcbr.mapping.attributes, + ormbr.client.consts; { TRESTDataSetAdapter } @@ -448,7 +449,7 @@ procedure TRESTDataSetAdapter.RefreshDataSetOneToOneChilds(AFieldName: String LObjectFind.OwnsObjects := True; try if LObjectFind.Count = 0 then - raise Exception.Create('Não foi possível encontrar a informação ' + LKeyFieldName + '=' + LKeyValue); + raise Exception.Create(SCouldNotFindInfo + LKeyFieldName + '=' + LKeyValue); LDataSetChild.FOrmDataSet.DisableControls; LDataSetChild.DisableDataSetEvents; LDataSetChild.FOrmDataSet.Append; diff --git a/Source/RESTful/Client/ormbr.session.restful.pas b/Source/RESTful/Client/ormbr.session.restful.pas index b3e400a6..768728d7 100644 --- a/Source/RESTful/Client/ormbr.session.restful.pas +++ b/Source/RESTful/Client/ormbr.session.restful.pas @@ -90,6 +90,7 @@ implementation uses ormbr.json, ormbr.core.consts, + ormbr.client.consts, ormbr.objects.utils, ormbr.objects.helper, dbcbr.mapping.classes, @@ -217,10 +218,10 @@ procedure TSessionRestFul.Delete(const AID: Integer); if FConnection.CommandMonitor <> nil then begin LURL := FConnection.FullURL; - FConnection.CommandMonitor.Command('URI : ' + LURL + sLineBreak + - 'ID : ' + IntToStr(AID) + sLineBreak + - 'Método : DELETE' + sLineBreak + - 'Result : ' + LResult, nil); + FConnection.CommandMonitor.Command(SUrl + LURL + sLineBreak + + SId + IntToStr(AID) + sLineBreak + + SMetod + 'DELETE' + sLineBreak + + SResult + LResult, nil); end; end; end; @@ -270,11 +271,11 @@ function TSessionRestFul.FindWhere(const AWhere, AOrderBy: String): TObjectLi if FConnection.CommandMonitor <> nil then begin LURL := FConnection.FullURL; - FConnection.CommandMonitor.Command('URI : ' + LURL + sLineBreak + - 'Where : ' + AWhere + sLineBreak + - 'OrderBy: ' + AOrderBy + sLineBreak + - 'Método : GET' + sLineBreak + - 'Json : ' + LJSON, nil); + FConnection.CommandMonitor.Command(SUrl + LURL + sLineBreak + + SWhere + AWhere + sLineBreak + + SOrderBy + AOrderBy + sLineBreak + + SMetod + 'GET' + sLineBreak + + SJson + LJSON, nil); end; end; end; @@ -320,10 +321,10 @@ function TSessionRestFul.Find(const AID: String): M; if FConnection.CommandMonitor <> nil then begin LURL := FConnection.FullURL; - FConnection.CommandMonitor.Command('URI : ' + LURL + sLineBreak + - 'ID : ' + AID + sLineBreak + - 'Método : GET' + sLineBreak + - 'Json : ' + LJSON, nil); + FConnection.CommandMonitor.Command(SUrl + LURL + sLineBreak + + SId + AID + sLineBreak + + SMetod + 'GET' + sLineBreak + + SJson + LJSON, nil); end; end; end; @@ -358,9 +359,9 @@ function TSessionRestFul.Find: TObjectList; if FConnection.CommandMonitor <> nil then begin LURL := FConnection.FullURL; - FConnection.CommandMonitor.Command('URI : ' + LURL + sLineBreak + - 'Método : GET' + sLineBreak + - 'Json : ' + LJSON, nil); + FConnection.CommandMonitor.Command(SUrl + LURL + sLineBreak + + SMetod + 'GET' + sLineBreak + + SJson + LJSON, nil); end; end; end; @@ -417,10 +418,10 @@ procedure TSessionRestFul.Insert(const AObject: M); if FConnection.CommandMonitor <> nil then begin LURL := FConnection.FullURL; - FConnection.CommandMonitor.Command('URI : ' + LURL + sLineBreak + - 'Método : POST' + sLineBreak + - 'Result : ' + LResult + sLineBreak + - 'Json : ' + LJSON, nil); + FConnection.CommandMonitor.Command(SUrl + LURL + sLineBreak + + SMetod + 'POST' + sLineBreak + + SResult + LResult + sLineBreak + + SJson + LJSON, nil); end; end; end; @@ -497,9 +498,9 @@ function TSessionRestFul._NextPacketMethod(AWhere, AOrderBy: String): TObject if Length(LSubResource) > 0 then LURL := LURL + '/' + LSubResource; - FConnection.CommandMonitor.Command('URI : ' + LURL + sLineBreak + - 'Método : GET' + sLineBreak + - 'Json : ' + LJSON, nil); + FConnection.CommandMonitor.Command(SUrl + LURL + sLineBreak + + SMetod + 'GET' + sLineBreak + + SJson + LJSON, nil); end; end; end; @@ -534,9 +535,9 @@ function TSessionRestFul._NextPacketMethod: TObjectList; LURL := LURL + '/' + LSubResource; // Gera Lentidão se tiver campo TBlob no JSON - FConnection.CommandMonitor.Command('URI : ' + LURL + sLineBreak + - 'Método : GET' + sLineBreak + - 'Json : ' + LJSON, nil); + FConnection.CommandMonitor.Command(SUrl + LURL + sLineBreak + + SMetod + 'GET' + sLineBreak + + SJson + LJSON, nil); end; end; end; @@ -570,10 +571,10 @@ procedure TSessionRestFul.Update(const AObjectList: TObjectList); if FConnection.CommandMonitor <> nil then begin LURL := FConnection.FullURL; - FConnection.CommandMonitor.Command('URI : ' + LURL + sLineBreak + - 'Método : PUT' + sLineBreak + - 'Result : ' + LResult + sLineBreak + - 'Json : ' + LJSON, nil); + FConnection.CommandMonitor.Command(SUrl + LURL + sLineBreak + + SMetod + 'PUT' + sLineBreak + + SResult + LResult + sLineBreak + + SJson + LJSON, nil); end; end; end; @@ -651,9 +652,9 @@ function TSessionRestFul.Find(const AMethodName: String; if FConnection.CommandMonitor <> nil then begin LURL := FConnection.FullURL; - FConnection.CommandMonitor.Command('URI : ' + LURL + sLineBreak + - 'Método : GET' + sLineBreak + - 'Json : ' + LJSON, nil); + FConnection.CommandMonitor.Command(SUrl + LURL + sLineBreak + + SMetod + 'GET' + sLineBreak + + SJson + LJSON, nil); end; end; end; diff --git a/Source/ormbr.inc b/Source/ormbr.inc index 714aaca0..c15cc8ca 100644 --- a/Source/ormbr.inc +++ b/Source/ormbr.inc @@ -60,6 +60,11 @@ {.$DEFINE USECLIENTDATASET} {.$DEFINE MONITORRESTFULCLIENT} +//Localization +{DEFINE CBLIB_BR} +{.DEFINE CBLIB_EN} +{.DEFINE CBLIB_RU} + {$IFDEF FMX} {$DEFINE HAS_FMX} {$ENDIF}