|
Letzte Bearbeitung dieses Dokuments: |
Code
Erklärungen
und Anwendungsbeispiele
Verwandte
Dokumentation
package
js_base.boc;
/*
* de: Package und Klasse für die Verarbeitung von Dezimalzahlen.
* en: Package and class to process decimal numbers. */
import
java.math.BigDecimal;
/*
* de: Package und Klasse für die Herstellung der
Verbindung zur Datenbank.
* en: Package and class to
establish the connection to the database. */
import
java.sql.Connection;
/*
* de:
* Packages mit den Klassen für die
Elemente der Benutzeroberfläche (GUI)
* Diese Klassen
werden benötigt weil in dieser BOC-Klasse auch die Methoden zum
* Füllen und Auslesen der Werte von GUI-Elementen enthalten ist.
* en:
* Packages with the classes for
the elements of the Graphic User Interface (GUI)
* These
classes are needed because this BOC-class contains the method to fill
or
* read the content of GUI-elements.
*/
import
javax.swing.*;
/*
* de: Packages mit der Generellen und Server-seitigen
Klasse für dieses BO.
* en: Packages with the general an
server-side class for this BO. */
import
js_base.bo.*;
import
js_base.bos.*;
/*
* de:
* Klasse für die effiziente
Verwaltung der Verbindungen zur Datenbank.
* Wird
verwendet wenn das Anwendungsprogramm als Einzelplatz-System
konfiguriert ist
* und der Zugriff direkt auf die
Datenbank erfolgt.
* en:
* Class for a
performant administration of the connection to the database.
* Is
used in case that the application program is configured as
'stand-alone' and
* the database is directly accessed.
*/
import
js_base.connections.JSBS_DB_ConnectionManager;
/*
* de:
* Interface für die Verbindung des Clients zum EJB
('Remote interface').
* Wird verwendet wenn das
Anwendungsprogramm als Client/Server konfiguriert ist und
der
* Zugriff über den EJB-Mechanismus erfolgt.
*
en:
* Interface handling the connection of the client
with the EJB ('Remote interface').
* Is used in case
that the application program is configured as 'client/server' and
* the database is accessed over the EJB-mechanism.
*/
import
js_base.ejb.interfaces.remote.JSBS_StandardEJBBeanRemote;
/*
de:
* Package mit der Klasse für das StartFrame (aus dem
Parameter verwendet werden) und
* Methoden für die
Bearbeitung von JFrames.
* en:
* Package with the
class for the StartFrame (which delivers parameters needed) and
* methods to manipulate JFrames. */
import
js_base.frame.*;
/*
de:
* Klasse mit speziellen Werten des Client-programms die
auf der Server-Seite
* des BO benötigt werden.
*
en:
* Class with specific values of the client-program
which are needed at the
* server-side of the BO. */
import
js_base.structures.JSBS_MinimalParameters
;
/*
de:
* Klasse mit den statischen Methoden zum Umwandeln von numerischen Werten in Zeichenketten.
*
en:
* Class with static methods to convert numeric values into strings. */
import
js_base.utilities.JSBS_Formatter
;
/**
*
* @author kurt(at)javascout[dot]biz
* @date
2011-10-03
*
* @description
* de:
*
Client-seitiger Teil des Business Object für die 'Currency'
(Währung).
*
* Innerhalb dieser
Klasse wird die Entscheidung getroffen ob das Anwendungsprogramm
*
als 'Stand-Alone' Version (mit der Datenbank auf dem gleichen
Computer) oder
* als 'Client-Server' Version
(bei der die Daten auf einem Java Application Server / JAS
*
gehalten werden und die Daten über den Mechanismus der EJB / Enterprise Java Beans
* verwaltet werden) ausgeführt wird.
*
-------------------
* en:
*
Client-Side derivation of the Business Object for the
'Currency'.
*
* Within this class the
selection is made, if the application is running with the database
* on the same machine (Stand-Alone) or
* it
is a 'client-server' application and the data is held on a
Java-Application-Server (JAS)
* and has to be
retrieved using the EJB / Enterprise Java Bean mechanism.
*
*
@change-log
*
when who why
*
--------------------------------------------------------
*
*/
public
class
JSBS_Currency_BOC
extends
JSBS_Cur
renc
y_BO {
/* ---------------------
* VARIABLE dieser Klasse / VARIABLES of this
class.
* --------------------- */
/*
*
de:
* Referenz auf das Start-Frame (CommandCenter), das bei
der 'Konstruktion' eines Objekts
* dieser Klasse übergeben
wurde.
* Über diese Referenz werden jene Parameter
abgefragt, die steuern, ob der zugehörige
* Server-Side
Teil des BO direkt 'konstruiert' werden soll (bei einer StandAlone /
Einzelplatz-
* Version) oder ein EJB (Enterprise-Java-Bean)
aufgerufen werden muss (bei einer Client/Server-
*
Version).
* en:
*
Reference to the Start-Frame (CommandCenter) that was passed during
the 'construction' of
*
an object
of
this class.
* This reference is used to access the
parameters, which control if the associated
*
Server-Side
part of the BO
will
be constructed directly (at a StandAlone-Version) or
* an
EJB (Enterprise-Java-Bean) has to be called (at a
Client/Server-Version). */
private
JSBS_StartFrame
frmCC
=
null
;
/*
*
de:
* Referenz auf das Task-Frame, das das Objekt dieser
Klasse 'konstruiert' hat.
* Diese Referenz wird benötigt um
den genauen Namen der Klasse des Task-Frames zu ermitteln
*
wenn in der Methode 'setToGUI(...)' die Tabelle aufgebaut werden
muss.
* en:
*
Reference to the Task-Frame that 'constructed' an object of this
class.
* This reference is needed to get the exact name of
the class (of the Task-Frame) when
*
a
table has to be build within the method 'setToGUI(...)'. */
public
JSBS_TaskFrame
frmTask
=
null
;
/*
*
de:
*
Referenz zur bestehenden Verbindung zur Datenbank.
*
Dieser Wert muss von der aufrufenden Methode als Parameter übergeben
werden
*
wenn diese Klasse 'konstruiert' wird.
*
en:
*
Reference to the established connection to the database.
* This
value has to be passed by the calling method when this class is
constructed. */
public
Connection
structDBCon
=
null
;
/*
*
de:
*
Referenz zur Datenbank-Verbindung die durch den ConnectionManager
verwaltet wird.
*
Dieser Wert wird vom ConnectionManager vergeben wenn eine Verbindung
zur Datenbank
*
hergestellt wurde und wird gebraucht, um die Verbindung zur
Datenbank an den
*
ConnectionManager 'zurückzugeben' wenn die Verbindung in dieser Klasse
nicht mehr
*
gebraucht wird
.
*
en:
* Reference
to the DB-Connection administered by the
ConnectionManager.
* Provided from the
ConnectionManager at the establishing of a DB-Connection
and
* needed to return the DB-Connection to the
ConnectionManager when the Connection
*
is no longer needed
within
this class. */
public
int
intDBConReference
=
0;
/*
*
de:
*
Objekt für den Abgleich bei einer 'MobileClient' Version.
*
In der Klasse ist implementiert, wie die Daten eines mobilen Client mit
den Daten
*
am Server abgeglichen werden nachdem der mobile Client wieder mit dem
Server verbunden ist.
*
en:
*
Object for the synchronisation at a 'MobileClient' version.
* Within that class is implemented, how the data of a mobile
client is synchronised with
* the data of the server after the mobile client is reconnected
to the server.
*
within this class. */
private
JSBS_Currency_BO_Synchronizer
structJSBS_Currency_BO_Synchronizer
=
null
;
/*
*
CONSTRUCTOR
* --------------------
* de:
*
Übernehmen des jeweiligen Tasks der diese Klasse konstruiert hat
(und als Parameter übergeben
* wird) und speichern des Task
in den oberhalb definierten Variablen.
* Das Objekt des
Start-Frame (parmfrmStart) könnte zwar aus dem Task-Frame ermittelt
werden - aus
* Gründen der Komptibilität zu den
Design-Patterns (Muster) für die Entwicklung eines
*
Anwendungsprogramms werden aber beide Werte übergeben.
*
en:
* Takes
the task that constructed this class (which is passed as a parameter)
and stores it
* in the above defined variable.
*
The object of the Start-Frame (parmfrmStart) could be derived from
the Task-Frame - for
* the compatibility to the
design-pattern (templates) for the development of an application-
*
program, both values are passed. */
public
JSBS_Cur
renc
y_BOC(JSBS_StartFrame
parmfrmStart, JSBS_TaskFrame parmfrmTask) {
frmCC
= parmfrmStart;
frmTask
= parmfrmTask;
}
/*
* --------------------
* de:
* Spezieller 'Constructor' für diese Klasse.
* Dieser 'Constructor' wird gebraucht, weil eine Variable dieses
BOC auch direkt
* im JSBS_StartFrame definiert ist. Dort wird es von der Methode
zum Füllen von
* Comboboxen
für
die Auswahl einer Sprache gebraucht.
* Die Variable für das Task-Frame wird in dieser
Constructor-Methode mit gültigen Werten
* versorgt.
* en:
*
Particular 'Constructor' for this class.
* This 'Constructor' is needed as a variable of this BOC is
defined directly within
* the JSBS_StartFrame. There it is used by the method to fill
combo-boxes with valid
* values for the selection of a language.
*
The variable for the Task-Frame is supplied with valid values within
this constuctor-
* method.
*/
public
JSBS_Cur
renc
y_BOC(JSBS_StartFrame
parmfrmStart) {
frmCC
= parmfrmStart;
frmTask
=
new
JSBS_TaskFrame(
frmCC
);
}
/*
*
METHODEN / METHODS
* ----------------------
*/
/*
* --------------------
* de:
* METHODE
zum Herstellen einer Verbindung zum Datenbanksystem.
* Der
Parameter steuert ob die Verbindung mit 'autocommit' versehen
wird
* (wenn der Parameter 'parmReadOnly' 'true'
ist).
* Das Setzen von 'autocommit' verbessert die
Performanz des Datenbanksystem;
* verhindert aber eine
programm-gesteuerte Ausführung der Transaktion damit
die
* Integrität von Datenänderungen erhalten bleibt.
* Der zurück gegebene Wert signalisiert, ob die
Verbindung zur Datenbank
* erfolgreich hergestellt
wurde.
*
* en:
* METHOD
to establish a connection to the database-system.
* The
parameter controls, if the connection is set to 'autocommit'
* (when
the parameter 'parmReadOnly' is 'true').
* Setting
'autocommit' increases the performance of the database-system
* but
prevents a program-controlled transaction-sequence to keep the
integrity of
* data-relations.
* The returned
value signals if the connection to the database was successfully
*
established. */
public
boolean
getDatabaseConnection(
boolean
parmReadOnly)
{
/*
* de:
* Eine Referenz zu einer Datenbank-Verbindung vom
ConnectionManager anfordern.
* Die Referenz-Nummer wird in
der globalen Variable dieser Klasse gespeichert.
* en:
* Get a reference to the database-connection provided by
the ConnectionManager
* The reference-number will be stored
within the global variable of this class. */
intDBConReference
=
frmCC
.
structJSBS_DB_ConnectionManager
.reserveConnection(
this
,
parmReadOnly);
/*
* de:
* Prüfen
ob eine Verbindung zur Datenbank verfügbar ist (ConnectionReference
>= 0);
* sonst einen Fehler zurück
liefern.
* en:
* Check if the
database-connection is available (ConnectionReference >= 0);
* otherwise return error. */
if
(
intDBConReference
<
0) {
StatusCode
=
JSBS_BO.
CONST_DB_SYSTEM_ERROR
;
StatusMsg
=
frmCC
.
structJSBS_DB_ConnectionManager
.
StatusMsg
;
return
false
;
}
/*
* de:
Datenbank-Verbindung holen und in der Variable in dieser Klasse
abspeichern.
* en: Get the database-connection and
store it in the variable within this class. */
structDBCon
=
frmCC
.
structJSBS_DB_ConnectionManager
.getReservedConnection(
this
,
intDBConReference
);
return
true
;
}
/*
* --------------------
*
de:
* METHODE zum Übertragen der Werte aus den als
Parameter übergebenen GUI-Elementen
*
in die Variablen dieses BO.
*
* en:
*
METHOD to transfer the values from the GUI-elements passed as
parameters into the
* variables of this BO. */
public
void
getFromGUI(JTextField
parmISOCurrencyCode
,
JCheckBox
parmLeadCurrencyIndicatorMarker
,
JComboBox
parmLanguageCodeForLabelling,
JCheckBox
parmMarker01,
JCheckBox
parmMarker02,
JCheckBox
parmMarker03,
JCheckBox
parmMarker04,
JCheckBox
parmMarker05,
JCheckBox
parmMarker06,
JCheckBox
parmMarker07,
JCheckBox
parmMarker08,
JCheckBox
parmMarker09,
JCheckBox
parmMarker10,
JCheckBox
parmMarker11,
JCheckBox
parmMarker12,
JCheckBox
parmMarker13,
JCheckBox
parmMarker14,
JCheckBox
parmMarker15,
JCheckBox
parmMarker16,
JCheckBox
parmMarker17,
JCheckBox
parmMarker18,
JCheckBox
parmMarker19,
JCheckBox
parmMarker20,
JTextField
parmCurrencyName
,
JTextField parmMiddleRateToLeadCurrency
,
JTextField parmBuyingRateToLeadCurrency
,
JTextField parmSellingRateToLeadCurrency
)
{
/*
* de:
* Flag, ob für die
Bezeichnungssprache ('LanguageCodeForLabelling') der Index 0 (gilt
als 'default'
*
gewählt wurde. Dieser Wert wird auf 'false' gesetzt damit keine
inkonsistente Situation entsteht
*
wenn das GUI-Element in 'parmLanguageCodeForLabelling' nicht
übergeben wird.
* en:
* Flag, if the index 0
(marks
the
'default' Currency-name) was selected from the combo-box
*
('LanguageCodeForLabelling')
for
the
language
for the Currency-name. This value is set to 'false'
*
so that an inconsistent situation is avoided if a GUI-element is not
passed in the parameter
* 'parmLanguageCodeForLabelling.
*/
boolean
bolDefaultLanguageForLabelling
=
false
;
/*
* de:
* Im folgenden Abschnitt werden jene Attribute bearbeitet deren Wert nicht vom Wert eines anderen
* Attributes abhängt.
* en:
* Within the following section, all attributes which value does not dpend on the value of another
* attribute, are processed. */
/*
* de:
* Prüfen, ob ein GUI-Element im
jeweiligen Parameter übergeben wurde und Übertragen des
jeweiligen
Wertes.
* en:
* Check if a GUI-element was
passed in the associated parameter and transfer the value. */
if
(parmISOCurrencyCode
!=
null
)
this
.
ISOCurrencyCode
= JSBS_GUIServices.getTextFromJTextField(parmISOCurrencyCode);
/*
* de: Die Bezeichnung der Währung übernehmen.
* en: Transfer the Currency-name. */
if
(parmCurrencyName
!=
null
)
this
.
CurrencyName
=
JSBS_GUIServices.getTextFromJTextField(parmCurrencyName);
/*
* de:
* Spezielle Behandlung der Combobox
für die Auswahl der Sprache für die Bezeichnung der Währung.
*
Wenn der erste Eintrag der Combobox ausgewählt ist dann ist die
Bezeichnung der Währung der
* 'default'-Wert und es dürfen
auch die anderen Werte verändert werden.
* Die jeweilige Auswahl
in der Combobox wird in der Variable 'bolDefaultLanguageForLabelling'
für
* weitere Abfragen gespeichert.
* en:
*
Special processing of the combo-box for the selection of the language
for the Currency-name.
* If the first entry of the combo-box
is selected, the Currency-name is the 'default'-value
*
and the other values are allowed to be changed.
* The choosen
selection of the combo-box-entry is saved in the variable
'bolDefaultLanguageForLabelling'
* and can be used for
further processing. */
if
(parmLanguageCodeForLabelling
!=
null
)
{
/*
* de:
* Zuerst abfragen ob der erste Eintrag
in der Combobox gewählt wurde.
* en:
* First
check if the first entry of the combo-box is selected. */
if
(
JSBS_GUIServices.isJComboBoxItem0Selected(parmLanguageCodeForLabelling)
)
/*
* de:
* Attribut mit leerer Zeichenkette versorgen; das ist das Zeichen für die 'Standardbezeichnung'
* des Namens für das Land.
* en:
* Supply the attribute with an empty string; that is the sign for the 'default' naming of the
* country-name. */
this
.
LanguageCodeForLabelling
=
""
;
else
{
/*
* de:
* Entweder eine andere Sprache
ausgewählt oder die Combobox hat keinen Eintrag.
* Eine
'leere' Combobox sollte nicht vorkommen kann aber bei einem
Programmierfehler
* im Anwendungsprogramm passieren.
*
Bei so einem Fehler ebenfalls die 'default'-Sprache setzen.
* en:
* Either another language was selected or the combo-box has
no entry.
* An 'empty' combo-box should not happen but might
occur when a faulty programming
* occurs in the
application-program.
* If such an error occurs, set the
'default'-language, too. */
if
(
parmLanguageCodeForLabelling.getItemCount()
<= 0
)
this
.
LanguageCodeForLabelling
=
""
;
else
/*
* de:
* Andere Sprache gewählt; den ISO-Code dafür aus der Combobox auslesen.
* en:
* Another language chosen; derive the ISO-code for it from the combo-box. */
this
.
LanguageCodeForLabelling
=
JSBS_GUIServices.getSelectedCodeFromJComboBox(
parmLanguageCodeForLabelling
,
"
- "
);
}
}
/*
* de:
* Ende des Abschnittes für die Attribute deren Wert bedingunslos aus den GUI-Feldern übernommen wird.
* en:
* End of the section with the attributes which values are unconditionally transferred from the GUI-fields.
* **************************************************** */
/*
* de:
* Attribut des BO prüfen ob die 'Standard-Sprache' für die Bezeichnung enthalten ist (oder nicht)
* und das Flag entsprechend setzen.
* en:
* Verify the attribute of the BO if it contains the 'default-language' for the name (or not) and
* set the flag according to it. */
bolDefaultLanguageForLabelling
= (
this
.
LanguageCodeForLabelling
.length() == 0);
/*
* de:
* Für jeden Marker wird geprüft ob er selektiert ist.
* Das Attribut für den Marker wird aber nur auf 'true' gesetzt wenn auch die 'Standard-Sprache' (für die Bezeichnung) gilt.
* en:
* Each marker is checked if it is selected.
* The attribute for the marker is set to 'true' only if the 'default-language' for the name is valid. */
if
(parmMarker01
!=
null
)
if
(parmMarker01.isSelected() && bolDefaultLanguageForLabelling)
this
.
Marker01
=
true
;
else
this
.
Marker01
=
false
;
if
(parmMarker02
!=
null
)
if
(parmMarker02.isSelected() && bolDefaultLanguageForLabelling)
this
.
Marker02
=
true
;
else
this
.
Marker02
=
false
;
if
(parmMarker03
!=
null
)
if
(parmMarker03.isSelected() && bolDefaultLanguageForLabelling)
this
.
Marker03
=
true
;
else
this
.
Marker03
=
false
;
if
(parmMarker04
!=
null
)
if
(parmMarker04.isSelected() && bolDefaultLanguageForLabelling)
this
.
Marker04
=
true
;
else
this
.
Marker04
=
false
;
if
(parmMarker05
!=
null
)
if
(parmMarker05.isSelected() && bolDefaultLanguageForLabelling)
this
.
Marker05
=
true
;
else
this
.
Marker05
=
false
;
if
(parmMarker06
!=
null
)
if
(parmMarker06.isSelected() && bolDefaultLanguageForLabelling)
this
.
Marker06
=
true
;
else
this
.
Marker06
=
false
;
if
(parmMarker07
!=
null
)
if
(parmMarker07.isSelected() && bolDefaultLanguageForLabelling)
this
.
Marker07
=
true
;
else
this
.
Marker07
=
false
;
if
(parmMarker08
!=
null
)
if
(parmMarker08.isSelected() && bolDefaultLanguageForLabelling)
this
.
Marker08
=
true
;
else
this
.
Marker08
=
false
;
if
(parmMarker09
!=
null
)
if
(parmMarker09.isSelected() && bolDefaultLanguageForLabelling)
this
.
Marker09
=
true
;
else
this
.
Marker09
=
false
;
if
(parmMarker10
!=
null
)
if
(parmMarker10.isSelected() && bolDefaultLanguageForLabelling)
this
.
Marker10
=
true
;
else
this
.
Marker10
=
false
;
if
(parmMarker11
!=
null
)
if
(parmMarker11.isSelected() && bolDefaultLanguageForLabelling)
this
.
Marker11
=
true
;
else
this
.
Marker11
=
false
;
if
(parmMarker12
!=
null
)
if
(parmMarker12.isSelected() && bolDefaultLanguageForLabelling)
this
.
Marker12
=
true
;
else
this
.
Marker12
=
false
;
if
(parmMarker13
!=
null
)
if
(parmMarker13.isSelected() && bolDefaultLanguageForLabelling)
this
.
Marker13
=
true
;
else
this
.
Marker13
=
false
;
if
(parmMarker14
!=
null
)
if
(parmMarker14.isSelected() && bolDefaultLanguageForLabelling)
this
.
Marker14
=
true
;
else
this
.
Marker14
=
false
;
if
(parmMarker15
!=
null
)
if
(parmMarker15.isSelected() && bolDefaultLanguageForLabelling)
this
.
Marker15
=
true
;
else
this
.
Marker15
=
false
;
if
(parmMarker16
!=
null
)
if
(parmMarker16.isSelected() && bolDefaultLanguageForLabelling)
this
.
Marker16
=
true
;
else
this
.
Marker16
=
false
;
if
(parmMarker17
!=
null
)
if
(parmMarker17.isSelected() && bolDefaultLanguageForLabelling)
this
.
Marker17
=
true
;
else
this
.
Marker17
=
false
;
if
(parmMarker18
!=
null
)
if
(parmMarker18.isSelected() && bolDefaultLanguageForLabelling)
this
.
Marker18
=
true
;
else
this
.
Marker18
=
false
;
if
(parmMarker19
!=
null
)
if
(parmMarker19.isSelected() && bolDefaultLanguageForLabelling)
this
.
Marker19
=
true
;
else
this
.
Marker19
=
false
;
if
(parmMarker20
!=
null
)
if
(parmMarker20.isSelected() && bolDefaultLanguageForLabelling)
this
.
Marker20
=
true
;
else
this
.
Marker20
=
false
;
/*
* de:
* Die Werte für die Umrechnungskurse werden ebenfalls nur
* übernommen wenn als
Bezeichnungssprache 'default' gewählt wurde.
* en:
* The values for the conversion rates are
* transferred only if the 'default' language for the currency-name
is selected. */
if
(parmMiddleRateToLeadCurrency
!=
null
)
{
if
(
bolDefaultLanguageForLabelling
) {
this
.
MiddleRateToLeadCurrency
=
JSBS_GUIServices.getBigDecimal(
parmMiddleRateToLeadCurrency,
frmTask
);
/*
* de:
* Prüfen ob in dem Eingabefeld auch ein gültiger Wert enthalten war; sonst den Wert
* des Attributs auf '0' setzen.
* en:
* Verify, if the entry-field contained a valid value; otherwise set the value
* of the attribute to '0'. */
if
(
this
.
MiddleRateToLeadCurrency
=
=
null
)
this
.
MiddleRateToLeadCurrency
=
new
BigDecimal(1)
;
}
else
/*
* de:
* Attribut wird mit dem Wert 0 versorgt wenn das BO 'nur' eine zusätzliche Bezeichnung
* in einer anderen Sprache enthält.
* en:
* Attribute is supplied with the value 0 if the BO contains 'only' a name in another language. */
this
.
MiddleRateToLeadCurrency
=
new
BigDecimal(1)
;
}
if
(parmBuyingRateToLeadCurrency
!=
null
)
{
if
(
bolDefaultLanguageForLabelling
)
{
this
.
BuyingRateToLeadCurrency
=
JSBS_GUIServices.getBigDecimal(
parmBuyingRateToLeadCurrency,
frmTask
)
;
if
(
this
.
BuyingRateToLeadCurrency
=
=
null
)
this
.
BuyingRateToLeadCurrency
=
new
BigDecimal(1)
;
}
else
this
.
BuyingRateToLeadCurrency
=
new
BigDecimal(1)
;
}
if
(parmSellingRateToLeadCurrency
!=
null
)
{
if
(
bolDefaultLanguageForLabelling
)
{
this
.
SellingRateToLeadCurrency
=
JSBS_GUIServices.getBigDecimal(
parmSellingRateToLeadCurrency,
frmTask
)
;
if
(
this
.
SellingRateToLeadCurrency
=
=
null
)
this
.
SellingRateToLeadCurrency
=
new
BigDecimal(1)
;
}
else
this
.
SellingRateToLeadCurrency
=
new
BigDecimal(1)
;
}
}
/*
* --------------------
*
de:
* METHODE zum Anzeigen der Werte aus diesem BO in den
GUI-Elementen, die als Parameter
*
übergeben werden.
*
* en:
*
METHOD to dispay the values of this BO in the GUI-elements that are
passed to this
* method as parameter. */
public
void
setToGUI(
JTextField
parmISOCurrencyCode
,
JCheckBox
parmLeadCurrencyIndicatorMarker
,
JComboBox
parmLanguageCodeForLabelling,
JCheckBox
parmMarker01,
JCheckBox
parmMarker02,
JCheckBox
parmMarker03,
JCheckBox
parmMarker04,
JCheckBox
parmMarker05,
JCheckBox
parmMarker06,
JCheckBox
parmMarker07,
JCheckBox
parmMarker08,
JCheckBox
parmMarker09,
JCheckBox
parmMarker10,
JCheckBox
parmMarker11,
JCheckBox
parmMarker12,
JCheckBox
parmMarker13,
JCheckBox
parmMarker14,
JCheckBox
parmMarker15,
JCheckBox
parmMarker16,
JCheckBox
parmMarker17,
JCheckBox
parmMarker18,
JCheckBox
parmMarker19,
JCheckBox
parmMarker20,
JTextField
parmCurrencyName
,
JTextField parmMiddleRateToLeadCurrency
,
JTextField parmBuyingRateToLeadCurrency
,
JTextField parmSellingRateToLeadCurrency
)
{
/*
* de:
* Flag, ob für die
Bezeichnungssprache ('LanguageCodeForLabelling') eine leere
Zeichenkette
* (gilt
als 'default') als Wert im Attribut enthalten ist
.
* en:
* Flag, if an empty string
(marks
the
'default' Currency-name) ist the value of the attribute
. */
boolean
bolDefaultLanguageForLabelling
=
this
.
LanguageCodeForLabelling
.trim().length()
<= 0
;
/*
* de:
* Prüfen, ob ein GUI-Element im
jeweiligen Parameter übergeben wurde und Übertragen des
jeweiligen
Wertes.
* en:
* Check if a GUI-element was
passed in the associated parameter and transfer the value. */
if
(parmISOCurrencyCode
!=
null
)
JSBS_GUIServices.setTextToJTextField(parmISOCurrencyCode,
this
.
ISOCurrencyCode
);
/*
* de:
* Spezielle Behandlung der Combobox
für die Auswahl der Sprache für die Bezeichnung der Währung.
*
Wenn in der Variablen des BO eine leere Zeichenkette enthalten ist,
dann bedeutet das, dass
* im BO die Definition für die
'default'-Sprache
enthalten ist. In diesem Fall wird der Eintrag
* mit dem
Index 0 aus der Combobox ausgewählt.
* en:
*
Special processing of the combo-box for the selection of the language
for the Currency-name.
* If the variable of the BO contains
an empty string, it means that the BO contains the definition
*
for the 'default'-language. In that case, the entry with the indes 0
is selected in the combo-box. */
if
(parmLanguageCodeForLabelling
!=
null
)
{
/*
* de:
* Die Abfrage auf den Wert der
Variable des BO erfolgte schon 'früher' im Code.
* en:
* The check for the value of the variable was done
'earlier' in the code. */
if
(bolDefaultLanguageForLabelling)
JSBS_GUIServices.setJComboBoxItem0(parmLanguageCodeForLabelling);
else
JSBS_GUIServices.setJComboBoxItem(parmLanguageCodeForLabelling,
this
.
LanguageCodeForLabelling
,
frmTask
.
frmCC
.
structJSBS_UniversalParameters
,
true
)
;
}
/*
* de:
* Die Checkboxen für die Marker
werden nur gesetzt wenn das BO jenes für die 'default'-Sprache
*
ist.
* en:
* The check-boxes for the Marker
are set only if this BO is the one for the 'default'-language.
*
language-name is choosen. */
if
(
parmMarker01
!=
null
)
{
if
(bolDefaultLanguageForLabelling)
parmMarker01.setSelected(
this
.
Marker01
)
;
else
parmMarker01.setSelected(
false
)
;
}
if
(
parmMarker02
!=
null
)
{
if
(bolDefaultLanguageForLabelling)
parmMarker02.setSelected(
this
.
Marker02
)
;
else
parmMarker02.setSelected(
false
)
;
}
if
(
parmMarker03
!=
null
)
{
if
(bolDefaultLanguageForLabelling)
parmMarker03.setSelected(
this
.
Marker03
)
;
else
parmMarker03.setSelected(
false
)
;
}
if
(
parmMarker04
!=
null
)
{
if
(bolDefaultLanguageForLabelling)
parmMarker04.setSelected(
this
.
Marker04
)
;
else
parmMarker04.setSelected(
false
)
;
}
if
(
parmMarker05
!=
null
)
{
if
(bolDefaultLanguageForLabelling)
parmMarker05.setSelected(
this
.
Marker05
)
;
else
parmMarker05.setSelected(
false
)
;
}
if
(
parmMarker06
!=
null
)
{
if
(bolDefaultLanguageForLabelling)
parmMarker06.setSelected(
this
.
Marker06
)
;
else
parmMarker06.setSelected(
false
)
;
}
if
(
parmMarker07
!=
null
)
{
if
(bolDefaultLanguageForLabelling)
parmMarker07.setSelected(
this
.
Marker07
)
;
else
parmMarker07.setSelected(
false
)
;
}
if
(
parmMarker08
!=
null
)
{
if
(bolDefaultLanguageForLabelling)
parmMarker08.setSelected(
this
.
Marker08
)
;
else
parmMarker08.setSelected(
false
)
;
}
if
(
parmMarker09
!=
null
)
{
if
(bolDefaultLanguageForLabelling)
parmMarker09.setSelected(
this
.
Marker09
)
;
else
parmMarker09.setSelected(
false
)
;
}
if
(
parmMarker10
!=
null
)
{
if
(bolDefaultLanguageForLabelling)
parmMarker10.setSelected(
this
.
Marker10
)
;
else
parmMarker10.setSelected(
false
)
;
}
if
(
parmMarker11
!=
null
)
{
if
(bolDefaultLanguageForLabelling)
parmMarker11.setSelected(
this
.
Marker11
)
;
else
parmMarker11.setSelected(
false
)
;
}
if
(
parmMarker12
!=
null
)
{
if
(bolDefaultLanguageForLabelling)
parmMarker12.setSelected(
this
.
Marker12
)
;
else
parmMarker12.setSelected(
false
)
;
}
if
(
parmMarker13
!=
null
)
{
if
(bolDefaultLanguageForLabelling)
parmMarker13.setSelected(
this
.
Marker13
)
;
else
parmMarker13.setSelected(
false
)
;
}
if
(
parmMarker14
!=
null
)
{
if
(bolDefaultLanguageForLabelling)
parmMarker14.setSelected(
this
.
Marker14
)
;
else
parmMarker14.setSelected(
false
)
;
}
if
(
parmMarker15
!=
null
)
{
if
(bolDefaultLanguageForLabelling)
parmMarker15.setSelected(
this
.
Marker15
)
;
else
parmMarker15.setSelected(
false
)
;
}
if
(
parmMarker16
!=
null
)
{
if
(bolDefaultLanguageForLabelling)
parmMarker16.setSelected(
this
.
Marker16
)
;
else
parmMarker16.setSelected(
false
)
;
}
if
(
parmMarker17
!=
null
)
{
if
(bolDefaultLanguageForLabelling)
parmMarker17.setSelected(
this
.
Marker17
)
;
else
parmMarker17.setSelected(
false
)
;
}
if
(
parmMarker18
!=
null
)
{
if
(bolDefaultLanguageForLabelling)
parmMarker18.setSelected(
this
.
Marker18
)
;
else
parmMarker18.setSelected(
false
)
;
}
if
(
parmMarker19
!=
null
)
{
if
(bolDefaultLanguageForLabelling)
parmMarker19.setSelected(
this
.
Marker19
)
;
else
parmMarker19.setSelected(
false
)
;
}
if
(
parmMarker20
!=
null
)
{
if
(bolDefaultLanguageForLabelling)
parmMarker20.setSelected(
this
.
Marker20
)
;
else
parmMarker20.setSelected(
false
)
;
}
/*
* de: Bezeichnung der Währung übernehmen.
* en: Transfer the Currency-name. */
if
(parmCurrencyName
!=
null
)
JSBS_GUIServices.setTextToJTextField(parmCurrencyName,
this
.
CurrencyName
);
/*
* de:
* Die Umrechnungskurse werden nur angezeigt
wenn als Bezeichnungssprache
'default' gewählt wurde.
* en:
* The conversion-rates are displayed only if the 'default' language for the currency-name
is selected
. */
if
(parmMiddleRateToLeadCurrency
!=
null
)
{
if
(bolDefaultLanguageForLabelling)
JSBS_GUIServices.setTextToJTextField(
parmMiddleRateToLeadCurrency,
JSBS_Formatter.toFormattedString(
this
.
MiddleRateToLeadCurrency
,
frmTask
.
frmCC
.
structJSBS_UniversalParameters
.
strLanguageDependantDecimalPoint
.charAt(0), 3)
);
else
JSBS_GUIServices.setTextToJTextField(
parmMiddleRateToLeadCurrency,
"1"
);
}
/* */
if
(parmBuyingRateToLeadCurrency
!=
null
)
{
if
(bolDefaultLanguageForLabelling)
JSBS_GUIServices.setTextToJTextField(
parmBuyingRateToLeadCurrency,
JSBS_Formatter.toFormattedString(
this
.
BuyingRateToLeadCurrency
,
frmTask
.
frmCC
.
structJSBS_UniversalParameters
.
strLanguageDependantDecimalPoint
.charAt(0), 3)
);
else
JSBS_GUIServices.setTextToJTextField
(
parmBuyingRateToLeadCurrency
,
"1"
);
}
/* */
if
(parmSellingRateToLeadCurrency
!=
null
)
{
if
(bolDefaultLanguageForLabelling)
JSBS_GUIServices.setTextToJTextField(
parmSellingRateToLeadCurrency,
JSBS_Formatter.toFormattedString(
this
.
SellingRateToLeadCurrency
,
frmTask
.
frmCC
.
structJSBS_UniversalParameters
.
strLanguageDependantDecimalPoint
.charAt(0), 3)
);
else
JSBS_GUIServices.setTextToJTextField
(
parmSellingRateToLeadCurrency
,
"1"
);
}
}
/*
* --------------------
*
de:
* METHODE zum Aufrufen des nebenläufigen Prozess
(Thread) zum Abgleichen von BO wenn das
*
Anwendungsprogramm in der Version 'MobileClient' läuft.
*
* en:
*
METHOD to call the thread to synchronize BO if the
application-programm runs with the
* version 'MobileClient'.
*/
public
void
synchronizeBO()
{
/*
* de:
* Zuerst prüfen ob schon ein Objekt
für den nebenläufigen Prozess (Thread) existiert
* und bei
Bedarf ein Thread-Objekt konstruieren.
* en:
*
First check if an object for the thread already exist and construct
one if needed. */
if
(
structJSBS_Currency_BO_Synchronizer
==
null
)
structJSBS_Currency_BO_Synchronizer
=
new
JSBS_Currency_BO_Synchronizer(
frmCC
,
frmTask
);
/*
* de:
* Dieses BO (gesamtes Objekt) an den
Synchronizer übergeben.
* Der nebenläufige, asynchrone
Prozess wird in der aufgerufenen Methode gestartet.
* en:
* Pass this BO (complete object)
to
the Synchronizer.
* The asynchronous thread will be started
within the called method. */
structJSBS_Currency_BO_Synchronizer
.passBO(
this
);
}
/*
* --------------------
*
de:
* METHODE zum Vergleichen von zwei BO und Übernehmen
der jeweils neuesten Version
*
in die Attribute dieses Objekts.
* --------------------
*
en:
*
METHOD to compare two BO and transfer of the newest version of a BO
into the
* attributes of this object. */
private
void
getNewestBO(JSBS_Currency_BO
parmJSBS_Currency_BO_1,
JSBS_Currency_BO
parmJSBS_Currency_BO_2) {
/*
* de: Zuerst Prüfen ob gültige Werte in den
Parametern vorhanden sind.
* en: First verify if valid
values are passed in the parameters. */
if
(parmJSBS_Currency_BO_1
==
null
)
{
this
.
StatusCode
=
JSBS_BO.
CONST_INCONSISTENT_DATA
;
this
.
StatusMsg
=
"mergeList:
parmJSBS_Currency_BO_1 is 'null'"
;
}
if
(parmJSBS_Currency_BO_2
==
null
)
{
this
.
StatusCode
=
JSBS_BO.
CONST_INCONSISTENT_DATA
;
this
.
StatusMsg
=
"mergeList:
parmJSBS_Currency_BO_2 is 'null'"
;
}
/*
de: Prüfen, ob das BO aus dem Parameter 2 'jünger' ist.
* en:
Check, if the BO in parameter 2 is 'younger'. */
if
(parmJSBS_Currency_BO_1.
ChangedAt
.after(parmJSBS_Currency_BO_2.
ChangedAt
))
/*
de:
* BO aus dem Parameter 1 ist 'jünger'; dessen Werte in
die Variablen dieses Objekts übertragen.
* en:
* BO from parameter 1 is 'younger'; transfer its
values
into the variables of this object. */
this
.copyFromJSBS_Currency_BO(parmJSBS_Currency_BO_1);
else
/*
de:
* BO aus dem Parameter 2 ist 'jünger'; dessen Werte in
die Variablen dieses Objekts übertragen.
* en:
* BO from parameter 2 is 'younger'; transfer its
values
into the variables of this object. */
this
.copyFromJSBS_Currency_BO(parmJSBS_Currency_BO_2);
}
/*
* --------------------
*
de:
*
METHODEN zum Lesen des Datensatzes der durch die DataSetID eindeutig
identifiziert ist
*
von der Datenbank.
*
en:
*
METHODS to read the dataset which is exactly determined by the
DataSetID from the database.
*/
/*
* de:
METHODE zum Lesen der Daten von der lokalen Datenbank.
*
en:
METHODS
to read the data from the local database. */
protected
void
selectByDataSetID_DB(
double
parmDataSetID)
{
/*
de:
*
Datenbank läuft auf der lokalen Maschine; Verbindung zur Datenbank
herstellen.
*
en:
*
Database is running on the local machine; establish the connection to
the database. */
getDatabaseConnection(
true
);
/*
de:
*
Prüfen ob eine Verbindung zur Datenbank hergestellt werden
konnte.
*
Eine Referenznummer gleich oder größer 0 bedeutet eine
ordnungsgemäße Verbindung zur DB.
*
en:
*
Verify if a connection to the database could have been
established.
*
A reference-number of 0 or greater signals a proper connection to the
database. */
if
(
intDBConReference
<
0) {
/*
de:
*
Fehler beim Verbinden zur Datenbank; über Status-Variable an die
aufrufende Methode
*
signalisieren. Diese Methode beenden.
*
en:
*
Error when connecting to the database; signal this to the calling
method using
*
the status-variables. End this Method. */
StatusCode
=
JSBS_BO.
CONST_DB_SYSTEM_ERROR
;
StatusMsg
=
frmCC
.
structJSBS_DB_ConnectionManager
.
StatusMsg
;
return
;
}
/*
de:
*
Datenbank läuft auf der lokalen Maschine; 'Server-Seitige' Klasse
des BO direkt
*
'konstruieren'.
*
Verbindung zur Datenbank und die Werte dieser 'Client-seitigen'
BO-Klasse
*
als Parameter übertragen.
*
en:
*
Database is running on the local machine; construct the 'Server-Side'
BO directly.
* Pass
the database-connection and the values of this 'Client-Side' BO as
parameters. */
JSBS_Currency_BOS
bosJSBS_Currency_BOS =
new
JSBS_Currency_BOS(
frmTask
.
structMinParm
,
structDBCon
,
true
);
/*
de: Aufrufen der Methode, die die Operation auf der Datenbank
ausführt.
*
en: Call the method to perform the database-operation(s).
*/
bosJSBS_Currency_BOS.selectByDataSetID(parmDataSetID);
/*
de:
*
Übertragen der zurückgelieferten Werte der Variablen und des Status.
*
Ausserdem kann auf das BOS nicht mehr zugegriffen werden sobald diese
Methode beendet ist.
*
en:
*
Transfer the returned values of the variables and the Status.
*
Additionally the values of the BOS can no longer be accessed as soon
as this method has ended.
*/
copyFromJSBS_Currency_BO(bosJSBS_Currency_BOS);
/*
de:
*
Verbindung zur Datenbank an den Connection-Manager zurück geben.
*
Der Connection Manager verwaltet die offenen Verbindungen zur
Datenbank und verwendet
*
sie wieder bei der nächsten Anforderung.
*
en:
*
Return the connection to the database to the Connection-Manager.
* The
Connection-Manager administers open connections to the database and
reuses it
*
at the next request.
*/
frmCC
.
structJSBS_DB_ConnectionManager
.returnReservedConnection(
this
,
intDBConReference
);
}
/*
* --------------------
*
de:
*
METHODEN zum Speichern eines einzelnes Datensatzes (als Teil der
Historie eines BO)
*
auf der lokalen Datenbank eines mobilen Client.
*
Dieses Speichern wird gebraucht wenn die Daten eines mobilen Clients
mit den Daten des
*
Servers synchronisiert werden müssen.
*
Wenn der Parameter 'parmDataSetIDToSelect' den Wert 0 hat wird jener
Datensatz
*
geändert, dessen DataSetID dem Wert des DatSetID dieses BO entspricht
bzw. wird ein
*
neuer Datensatz in die DB-Tabelle eingefügt.
*
Wenn ein Wert ungleich 0 im Parameter übergeben wird, dann wird
jener Datensatz, dessen
*
DataSetID dem Wert des übergebenen Parameter enspricht, geändert.
Das bedeutet, dass auch
*
der Primärschlüssel (DataSetID) geändert wird.
*
en:
*
METHODS to store a single dataset (as part of the history of a BO) at
the local database
*
of a MobileClient.
*
This kind of store is needed when the data of a MobileClient has to
be synchronized with
*
the data of the server.
*
If the parameter 'parmDataSetIDToSelect' has the value 0, the dataset
whose DataSetID
*
is equal to the DataSetID of this BO is changed; or a new dataset is
inserted, respectively.
*
If a value different than 0 is passed in the parameter, then the
dataset which DataSetID
*
is equal to the value passed in the parameter is updated. That
incorporates that the
*
primary-key (DataSetID) is changed, too. */
/*
* de:
METHODE zum Speichern der Daten auf der lokalen Datenbank.
*
en:
METHOD
to store the data on the local database. */
protected
void
synchronizedStore_DB(
double
parmDataSetIDToSelect)
{
/*
de:
*
Datenbank läuft auf der lokalen Maschine; Verbindung zur Datenbank
herstellen.
*
Weil auf der Datenbank Änderungen ausgeführt werden wird der
Parameter für
*
'ReadOnly' auf 'false' gesetzt.
*
en:
*
Database is running on the local machine; establish the connection to
the database.
*
As changes are made on the database, the parameter for 'ReadOnly' is
set to 'false'. */
getDatabaseConnection(
false
);
/*
de:
*
Prüfen ob eine Verbindung zur Datenbank hergestellt werden
konnte.
*
Eine Referenznummer gleich oder größer 0 bedeutet eine
ordnungsgemäße Verbindung zur DB.
*
en:
*
Verify if a connection to the database could have been
established.
*
A reference-number of 0 or greater signals a proper connection to the
database. */
if
(
intDBConReference
<
0) {
/*
de:
*
Fehler beim Verbinden zur Datenbank; über Status-Variable an die
aufrufende Methode
*
signalisieren. Diese Methode beenden.
*
en:
*
Error when connecting to the database; signal this to the calling
method using
*
the status-variables. End this Method. */
StatusCode
=
JSBS_BO.
CONST_DB_SYSTEM_ERROR
;
StatusMsg
=
frmCC
.
structJSBS_DB_ConnectionManager
.
StatusMsg
;
return
;
}
/*
de:
*
Datenbank läuft auf der lokalen Maschine; 'Server-Seitige' Klasse
des BO direkt
*
'konstruieren'.
*
Verbindung zur Datenbank und die Werte dieser 'Client-seitigen'
BO-Klasse
*
als Parameter übertragen.
*
en:
*
Database is running on the local machine; construct the 'Server-Side'
BO directly.
* Pass
the database-connection and the values of this 'Client-Side' BO as
parameters. */
JSBS_Currency_BOS
bosJSBS_Currency_BOS =
new
JSBS_Currency_BOS(
frmTask
.
structMinParm
,
structDBCon
,
this
,
true
);
/*
de: Aufrufen der Methode, die die Operation auf der Datenbank
ausführt.
*
en: Call the method to perform the database-operation(s).
*/
bosJSBS_Currency_BOS.synchronizedStore(parmDataSetIDToSelect);
/*
de:
*
Fehlerbehandlung wenn das store nicht ordnungsgemäß beendet
wurde.
*
'Rollback' ausführen und die Connection zur Datenbank schließen.
*
Nebenbemerkung:
*
In der Methode 'returnReservedConnection(..)' (etwas weiter unten)
wird geprüft, ob
*
die Connection noch 'offen' ist. Wenn die Connection bei dieser
Fehlerbehandlung
*
geschlossen wird, dann wird in 'returnReservedConnection(...) keine
weitere
*
Bearbeitung der Connection (z.B. 'commit()') mehr ausgeführt.
*
en:
*
Error-handling if the store did not end as expected.
*
Do a 'rollback' and close the connection to the database.
*
Side note:
*
Within the method 'returnReservedConnection(...)' (a little bit down)
is checked if
*
the connection is still 'open'. If the connection is closed during
this error-
*
handling, then within 'returnReservedConnection(...) no further
processind of the
*
connection (e.g. 'commit()') is done. */
if
(bosJSBS_Currency_BOS.
StatusCode
!=
JSBS_BO.
CONST_OK
)
{
/*
de:
*
Sowohl 'close()' als auch 'rollback()' liefern im Fehlerfall eine
Exception.
*
en:
*
Both 'close()' and 'rollback()' return an expection for an error.
*/
try
{
structDBCon
.rollback();
structDBCon
.close();
}
catch
(Exception
e) {
/*
de:
*
Blöde Situation wenn 'rollback()' und 'close()' auch nicht mehr
funktionieren.
*
Nachdem im Status-Code aber ein Fehler an die aufrufende Methode
mitgeteilt wird,
*
wird darauf vertraut, dass die aufrufende Methode die Verarbeitung
nicht fortsetzt.
*
en:
*
Tricky situation as 'rollback()' and 'close()' are not working any
more.
*
As an error is reported to the calling method (via the Status-Code),
it is
*
trusted that the calling method does not continue processing. */
}
}
/*
de:
*
Übertragen der neuen Werte des BOS in dieses BO.
*
Damit sind geänderte CommonAttributes, Status-Code und
Status-Message in diesem BOC verfügbar.
*
en:
*
Transfer the new values of the BOS to this BOC.
*
So, changed CommonAttributes, Status-Code and Status-Message are
available in this BOC.
*/
copyFromJSBS_Currency_BO(bosJSBS_Currency_BOS);
/*
de:
*
Verbindung zur Datenbank an den Connection-Manager zurück geben.
*
Der Connection Manager verwaltet die offenen Verbindungen zur
Datenbank und verwendet
*
sie wieder bei der nächsten Anforderung.
*
en:
*
Return the connection to the database to the Connection-Manager.
* The
Connection-Manager administers open connections to the database and
reuses it
*
at the next request.
*/
frmCC
.
structJSBS_DB_ConnectionManager
.returnReservedConnection(
this
,
intDBConReference
);
}
/*
* --------------------
*
de:
*
METHODE zum Speichern eines einzelnes Datensatzes (als Teil der
Historie eines BO)
*
auf der Datenbank des Servers.
*
Dieses Speichern wird gebraucht wenn die Daten eines mobilen Clients
mit den Daten des
*
Servers synchronisiert werden müssen.
*
Im Gegensatz zu der entsprechenden Methode für das Speichern auf der
lokalen Datenbank
*
kann der Primärschlüssel (DataSetID) auf dem Server nicht durch den
Client geändert werden.
*
Wurde auf dem Server der gleiche Primärschlüssel bereits vergeben
dann wird auf der
*
'Server-Seite' dieses BO (BOS) ein neuer Primärschlüssel für
dieses BO vergeben und
*
zurück geliefert.
*
en:
*
METHOD to store a single dataset (as part of the history of a BO) at
the local database
*
of a MobileClient.
*
This kind of store is needed when the data of a MobileClient has to
be synchronized with
*
the data of the server.
*
Contrary to the similar method to store on the local database, the
primary-key (DataSetID)
*
on the server can not be changed by the client. If the same
primary-key already exists
*
on the server, then a new primary-key is assigned to this BO on the
'server-side' of
*
this BO (BOS) and this new DataSetID is returned to the client.
*/
protected
void
synchronizedStore_JAS()
{
/*
de:
*
Ein BO konstruieren mit dem die Werte zum Server übertragen werden
und das nach dem store()
*
die neuen Attributswerte enthält.
*
en:
*
Construct a BO that is used to transfer the values to the server and
that contains
*
the new attributes-values after the store(). */
JSBS_Currency_BO
boJSBS_Currency_BO =
new
JSBS_Currency_BO();
/*
de: Die Werte in den Attributen dieses BOC auf das gerade
konstruierte BO kopieren.
*
en: Copy the values in the attributes of this BOC to the just
constructed BO.
*/
boJSBS_Currency_BO.copyFromJSBS_Currency_BO(
this
);
/*
de: Der Zugriff auf die Datenbank läuft über den
EJB-Mechanismus.
*
en: Access to the database is by using the EJB-mechanism.
*/
try
{
/*
de:
*
Instanziieren (Konstruieren) des Client-seitigen Objekts ('Remote
interface') für
*
den Aufruf von Methoden des EJB.
*
Die Methode zum Instanziieren ist im Start-Frame implementiert.
*
en:
*
Instantiate (construct) the client-side object ('Remote interface')
for calling
*
methods of the EJB.
*
The method to instantiate is implemented in the Start-Frame.
*/
JSBS_StandardEJBBeanRemote
remoteJSBS_StandardEJBBean
=
frmCC
.get_JSBS_StandardEJBBeanRemote();
/*
*
de: Prüfen, ob überhaupt eine Verbindung zum JAS hergestellt werden
konnte.
*
en: Verify if a connection to the JAS has been established.
*/
if
(remoteJSBS_StandardEJBBean
==
null
)
{
/*
*
de: Keine Verbindung zum JAS; Fehler zurückmelden.
*
en: No connection to the JAS; report error.
*/
this
.
StatusCode
=
JSBS_BO.
CONST_DB_UNKNOWN_ERROR
;
this
.
StatusMsg
=
"No
connection to JAS; method:
JSBS_Currency_BOC.synchronizedStore()"
;
return
;
}
/*
de:
*
Aufrufen der 'Wrapper'-Methode des EJB. In dieser 'Wrapper'-Methode
wird die - zu diesem
*
Client-seitigen Teil des BO - passende Server-seitige Methode
aufgerufen.
*
Neue Werte für die Variablen des BO und eventuelle Fehlermeldungen
sind im zurückgelieferten
*
BO enthalten.
*
en:
*
Call the 'wrapper'-method of the EJB. Within this 'wrapper'-method
the server-side method
*
- which fits this method of the client-side derivation of the BO - is
called.
*
New values for variables of the BO and probably occured
error-messages are contained in the
*
returned BO. */
boJSBS_Currency_BO
=
remoteJSBS_StandardEJBBean.
JSBS_Currency_BO__synchronizedStore(
frmTask
.
structMinParm
,
boJSBS_Currency_BO);
/*
de:
*
Werte des zurück gelieferten BO auf dieses BOC (Client-seitiger Teil
des BO) kopieren.
*
en:
*
Copy the values of the returned BO to this BOC (client-side
derivation of the BO). */
this
.copyFromJSBS_Currency_BO(boJSBS_Currency_BO);
}
catch
(Exception
e) {
/*
de:
*
Fehler beim Ausführen der Methode des EJB.
*
Fehlermeldung aus der Exception übernehmen und Status setzen.
*
en:
*
Error when executing the method of the EJB.
*
Transfer the error-message from the Exception and set status.
*/
this
.
StatusCode
=
JSBS_BO.
CONST_DB_UNKNOWN_ERROR
;
this
.
StatusMsg
= e.getMessage();
}
}
/*
* --------------------
*
de:
*
METHODEN zum Speichern der aktuellen Werte eines BO (in Form eines
einzelnes Datensatzes
*
als Teil der Historie eines BO auf der lokalen Datenbank eines
mobilen Client oder
*
bei der Einzelplatz-Version.
*
en:
*
METHODS to store the actual values of a BO (in a single dataset as part
of the history of a BO
*
at the local database of a MobileClient or a StandAlone-Version.
*/
/*
* de:
METHODE zum Speichern der Daten auf der lokalen Datenbank.
*
en:
METHOD
to store the data on the local database. */
protected
void
store_DB()
{
/*
de:
*
Datenbank läuft auf der lokalen Maschine; Verbindung zur Datenbank
herstellen.
*
Weil auf der Datenbank Änderungen ausgeführt werden wird der
Parameter für
*
'ReadOnly' auf 'false' gesetzt.
*
en:
*
Database is running on the local machine; establish the connection to
the database.
*
As changes are made on the database, the parameter for 'ReadOnly' is
set to 'false'.. */
getDatabaseConnection(
false
);
/*
de:
*
Prüfen ob eine Verbindung zur Datenbank hergestellt werden
konnte.
*
Eine Referenznummer gleich oder größer 0 bedeutet eine
ordnungsgemäße Verbindung zur DB.
*
en:
*
Verify if a connection to the database could have been
established.
*
A reference-number of 0 or greater signals a proper connection to the
database. */
if
(
intDBConReference
<
0) {
/*
de:
*
Fehler beim Verbinden zur Datenbank; über Status-Variable an die
aufrufende Methode
*
signalisieren. Diese Methode beenden.
*
en:
*
Error when connecting to the database; signal this to the calling
method using
*
the status-variables. End this Method. */
StatusCode
=
JSBS_BO.
CONST_DB_SYSTEM_ERROR
;
StatusMsg
=
frmCC
.
structJSBS_DB_ConnectionManager
.
StatusMsg
;
return
;
}
/*
de:
*
Datenbank läuft auf der lokalen Maschine; 'Server-Seitige' Klasse
des BO direkt
*
'konstruieren'.
*
Verbindung zur Datenbank und die Werte dieser 'Client-seitigen'
BO-Klasse
*
als Parameter übertragen.
*
en:
*
Database is running on the local machine; construct the 'Server-Side'
BO directly.
* Pass
the database-connection and the values of this 'Client-Side' BO as
parameters. */
JSBS_Currency_BOS
bosJSBS_Currency_BOS =
new
JSBS_Currency_BOS(
frmTask
.
structMinParm
,
structDBCon
,
this
,
true
);
/*
de: Aufrufen der Methode, die die Operation auf der Datenbank
ausführt.
*
en: Call the method to perform the database-operation(s).
*/
bosJSBS_Currency_BOS.store();
/*
de:
*
Fehlerbehandlung wenn das store nicht ordnungsgemäß beendet
wurde.
*
'Rollback' ausführen und die Connection zur Datenbank schließen.
*
Nebenbemerkung:
*
In der Methode 'returnReservedConnection(..)' (etwas weiter unten)
wird geprüft, ob
*
die Connection noch 'offen' ist. Wenn die Connection bei dieser
Fehlerbehandlung
*
geschlossen wird, dann wird in 'returnReservedConnection(...) keine
weitere
*
Bearbeitung der Connection (z.B. 'commit()') mehr ausgeführt.
*
en:
*
Error-handling if the store did not end as expected.
*
Do a 'rollback' and close the connection to the database.
*
Side note:
*
Within the method 'returnReservedConnection(...)' (a little bit down)
is checked if
*
the connection is still 'open'. If the connection is closed during
this error-
*
handling, then within 'returnReservedConnection(...) no further
processind of the
*
connection (e.g. 'commit()') is done. */
if
(bosJSBS_Currency_BOS.
StatusCode
!=
JSBS_BO.
CONST_OK
)
{
/*
de:
*
Sowohl 'close()' als auch 'rollback()' liefern im Fehlerfall eine
Exception.
*
en:
*
Both 'close()' and 'rollback()' return an expection for an error.
*/
try
{
structDBCon
.rollback();
structDBCon
.close();
}
catch
(Exception
e) {
/*
de:
*
Blöde Situation wenn 'rollback()' und 'close()' auch nicht mehr
funktionieren.
*
Nachdem im Status-Code aber ein Fehler an die aufrufende Methode
mitgeteilt wird,
*
wird darauf vertraut, dass die aufrufende Methode die Verarbeitung
nicht fortsetzt.
*
en:
*
Tricky situation as 'rollback()' and 'close()' are not working any
more.
*
As an error is reported to the calling method (via the Status-Code),
it is
*
trusted that the calling method does not continue processing. */
}
}
/*
de:
*
Übertragen der neuen Werte des BOS in dieses BO.
*
Damit sind geänderte CommonAttributes, Status-Code und
Status-Message in diesem BOC verfügbar.
*
en:
*
Transfer the new values of the BOS to this BOC.
*
So, changed CommonAttributes, Status-Code and Status-Message are
available in this BOC.
*/
copyFromJSBS_Currency_BO(bosJSBS_Currency_BOS);
/*
de:
*
Verbindung zur Datenbank an den Connection-Manager zurück geben.
*
Der Connection Manager verwaltet die offenen Verbindungen zur
Datenbank und verwendet
*
sie wieder bei der nächsten Anforderung.
*
en:
*
Return the connection to the database to the Connection-Manager.
* The
Connection-Manager administers open connections to the database and
reuses it
*
at the next request.
*/
frmCC
.
structJSBS_DB_ConnectionManager
.returnReservedConnection(
this
,
intDBConReference
);
}
/*
* --------------------
*
de:
*
METHODE zum Speichern der aktuellen Werte eines BO (in Form eines
einzelnes Datensatzes
*
als Teil der Historie eines BO auf der Datenbank des Java Application
Server (JAS).
*
en:
*
METHOD to store the actual values of a BO (in a single dataset as part
of the history of a BO
*
at the database of the Java Application Server (JAS). */
protected
void
store_JAS()
{
/*
de:
*
Ein BO konstruieren mit dem die Werte zum Server übertragen werden
und das nach dem store()
*
die neuen Attributswerte enthält.
*
en:
*
Construct a BO that is used to transfer the values to the server and
that contains
*
the new attributes-values after the store(). */
JSBS_Currency_BO
boJSBS_Currency_BO =
new
JSBS_Currency_BO();
/*
de: Die Werte in den Attributen dieses BOC auf das gerade
konstruierte BO kopieren.
*
en: Copy the values in the attributes of this BOC to the just
constructed BO.
*/
boJSBS_Currency_BO.copyFromJSBS_Currency_BO(
this
);
/*
de: Der Zugriff auf die Datenbank läuft über den
EJB-Mechanismus.
*
en: Access to the database is by using the EJB-mechanism.
*/
try
{
/*
de:
*
Instanziieren (Konstruieren) des Client-seitigen Objekts ('Remote
interface') für
*
den Aufruf von Methoden des EJB.
*
Die Methode zum Instanziieren ist im Start-Frame implementiert.
*
en:
*
Instantiate (construct) the client-side object ('Remote interface')
for calling
*
methods of the EJB.
*
The method to instantiate is implemented in the Start-Frame.
*/
JSBS_StandardEJBBeanRemote
remoteJSBS_StandardEJBBean
=
frmCC
.get_JSBS_StandardEJBBeanRemote();
/*
*
de: Prüfen, ob überhaupt eine Verbindung zum JAS hergestellt werden
konnte.
*
en: Verify if a connection to the JAS has been established.
*/
if
(remoteJSBS_StandardEJBBean
==
null
)
{
/*
*
de: Keine Verbindung zum JAS; Fehler zurückmelden.
*
en: No connection to the JAS; report error.
*/
this
.
StatusCode
=
JSBS_BO.
CONST_DB_UNKNOWN_ERROR
;
this
.
StatusMsg
=
"No
connection to JAS; method:
JSBS_BOC.store()"
;
return
;
}
/*
de:
*
Aufrufen der 'Wrapper'-Methode des EJB. In dieser 'Wrapper'-Methode
wird die - zu diesem
*
Client-seitigen Teil des BO - passende Server-seitige Methode
aufgerufen.
*
Neue Werte für die Variablen des BO und eventuelle Fehlermeldungen
sind im zurückgelieferten
*
BO enthalten.
*
en:
*
Call the 'wrapper'-method of the EJB. Within this 'wrapper'-method
the server-side method
*
- which fits this method of the client-side derivation of the BO - is
called.
*
New values for variables of the BO and probably occured
error-messages are contained in the
*
returned BO. */
boJSBS_Currency_BO
=
remoteJSBS_StandardEJBBean.
JSBS_Currency_BO__store(
frmTask
.
structMinParm
,
boJSBS_Currency_BO);
/*
de:
*
Werte des zurück gelieferten BO auf dieses BOC (Client-seitiger Teil
des BO) kopieren.
*
en:
*
Copy the values of the returned BO to this BOC (client-side
derivation of the BO). */
this
.copyFromJSBS_Currency_BO(boJSBS_Currency_BO);
}
catch
(Exception
e) {
/*
de:
*
Fehler beim Ausführen der Methode des EJB.
*
Fehlermeldung aus der Exception übernehmen und Status setzen.
*
en:
*
Error when executing the method of the EJB.
*
Transfer the error-message from the Exception and set status.
*/
this
.
StatusCode
=
JSBS_BO.
CONST_DB_UNKNOWN_ERROR
;
this
.
StatusMsg
= e.getMessage();
}
}
/*
* --------------------
*
de:
* METHODE zum Speichern der aktuellen Werte eines BO auf
der Datenbank.
* en:
*
METHOD to store the actual values of a BO on the database.
*/
public
void
store()
{
/*
*
de: Entscheiden mit welcher Version das Anwendungsprogramm läuft.
*
en: Decide what version the application runs. */
switch
(
frmCC
.
RunVersion
)
{
case
JSBS_StartFrame.
CONST_StandAlone
:
/*
de:
*
Einzelplatzversion. Datenbank läuft auf der lokalen Maschine;
Spezielle Methode aufrufen.
*
en:
*
Stand-alone version. Database is running on the local machine; call
the specialized method. */
store_DB();
break
;
case
JSBS_StartFrame.
CONST_FatClient
:
/*
de:
*
Client-Server-Version.
*
Datenzugriff erfolgt über den EJB-Mechanismus und JAS (Java
Application Server); spezielle Methode aufrufen.
*
en:
*
Client-Server-version.
*
Data is accessed via the EJB-mechanism and the JAS (Java Application
Server); call the specialized method. */
store_JAS();
break
;
case
JSBS_StartFrame.
CONST_MobileClient
:
/*
de:
*
Prüfen, ob die Verbindung zum JAS existiert. Abhängig davon erfolgt
die weitere Verarbeitung.
*
en:
*
Verify, if the connection to the JAS exists. The further processing
depends
on the result. */
if
(
frmCC
.testJASConnection())
{
/*
de: Daten des BO am JAS speichern.
*
en: Store the data of the BOT at the JAS. */
store_JAS();
/*
de:
*
Prüfen, ob das Speichern am JAS ohne Fehler beendet wurde. In diesem
Fall die
*
Methode aufrufen, die alle Datensätze für das BO mit der lokalen
Datenbank synchronisiert.
*
Damit wird der auf dem JAS erzeugte Datensatz für das BO auch auf
die lokale Datenbank
*
übertragen.
*
en:
*
Verify, if the store on the JAS ended without an error. In that case
call the method to
*
synchronize all datasets with the local database. This synchronizing
includes the transfer
*
of the dataset just created on the JAS back to the local database.
*/
if
(
this
.
StatusCode
==
JSBS_BO.
CONST_OK
)
synchronizeBO();
/*
de: Fehler beim Speichern am JAS; Methode beenden.
*
en: error when storing on the JAS; end this method. */
else
return
;
}
else
{
/*
de: Verbindung zum JAS unterbrochen; nur auf lokaler Datenbank
speichern.
*
en: Connection to JAS interrupted; store on local database only.
*/
store_DB();
}
break
;
}
}
/*
* --------------------
*
de:
*
METHODEN zum Deaktivieren (logischen Löschen) eines BO für
einen
mobilen Client oder
*
bei der Einzelplatz-Version.
*
en:
*
METHODS to deactivate (logically delete) a BO at the local database
of a MobileClient
*
or a StandAlone-Version. */
/*
* de:
METHODE zum Deaktivieren des BO auf der lokalen Datenbank.
*
en:
METHODS
to deactivate the BO on the local database. */
public
void
deactivate_DB()
{
/*
de:
*
Datenbank läuft auf der lokalen Maschine; Verbindung zur Datenbank
herstellen.
*
Weil auf der Datenbank Änderungen ausgeführt werden wird der
Parameter für
*
'ReadOnly' auf 'false' gesetzt.
*
en:
*
Database is running on the local machine; establish the connection to
the database.
*
As changes are made on the database, the parameter for 'ReadOnly' is
set to 'false'. */
getDatabaseConnection(
false
);
/*
de:
*
Prüfen ob eine Verbindung zur Datenbank hergestellt werden
konnte.
*
Eine Referenznummer gleich oder größer 0 bedeutet eine
ordnungsgemäße Verbindung zur DB.
*
en:
*
Verify if a connection to the database could have been
established.
*
A reference-number of 0 or greater signals a proper connection to the
database. */
if
(
intDBConReference
<
0) {
/*
de:
*
Fehler beim Verbinden zur Datenbank; über Status-Variable an die
aufrufende Methode
*
signalisieren. Diese Methode beenden.
*
en:
*
Error when connecting to the database; signal this to the calling
method using
*
the status-variables. End this Method. */
StatusCode
=
JSBS_BO.
CONST_DB_SYSTEM_ERROR
;
StatusMsg
=
frmCC
.
structJSBS_DB_ConnectionManager
.
StatusMsg
;
return
;
}
/*
de:
*
Datenbank läuft auf der lokalen Maschine; 'Server-Seitige' Klasse
des BO direkt
*
'konstruieren'.
*
Verbindung zur Datenbank und die Werte dieser 'Client-seitigen'
BO-Klasse
*
als Parameter übertragen.
*
en:
*
Database is running on the local machine; construct the 'Server-Side'
BO directly.
* Pass
the database-connection and the values of this 'Client-Side' BO as
parameters. */
JSBS_Currency_BOS
bosJSBS_Currency_BOS =
new
JSBS_Currency_BOS(
frmTask
.
structMinParm
,
structDBCon
,
this
,
true
);
/*
de: Aufrufen der Methode, die die Operation auf der Datenbank
ausführt.
*
en: Call the method to perform the database-operation(s).
*/
bosJSBS_Currency_BOS.deactivate();
/*
de:
*
Fehlerbehandlung wenn das deactivate nicht ordnungsgemäß beendet
wurde.
*
'Rollback' ausführen und die Connection zur Datenbank schließen.
*
Nebenbemerkung:
*
In der Methode 'returnReservedConnection(..)' (etwas weiter unten)
wird geprüft, ob
*
die Connection noch 'offen' ist. Wenn die Connection bei dieser
Fehlerbehandlung
*
geschlossen wird, dann wird in 'returnReservedConnection(...) keine
weitere
*
Bearbeitung der Connection (z.B. 'commit()') mehr ausgeführt.
*
en:
*
Error-handling if the deactivate did not end as expected.
*
Do a 'rollback' and close the connection to the database.
*
Side note:
*
Within the method 'returnReservedConnection(...)' (a little bit down)
is checked if
*
the connection is still 'open'. If the connection is closed during
this error-
*
handling, then within 'returnReservedConnection(...) no further
processind of the
*
connection (e.g. 'commit()') is done. */
if
(bosJSBS_Currency_BOS.
StatusCode
!=
JSBS_BO.
CONST_OK
)
{
/*
de:
*
Sowohl 'close()' als auch 'rollback()' liefern im Fehlerfall eine
Exception.
*
en:
*
Both 'close()' and 'rollback()' return an expection for an error.
*/
try
{
structDBCon
.rollback();
structDBCon
.close();
}
catch
(Exception
e) {
/*
de:
*
Blöde Situation wenn 'rollback()' und 'close()' auch nicht mehr
funktionieren.
*
Nachdem im Status-Code aber ein Fehler an die aufrufende Methode
mitgeteilt wird,
*
wird darauf vertraut, dass die aufrufende Methode die Verarbeitung
nicht fortsetzt.
*
en:
*
Tricky situation as 'rollback()' and 'close()' are not working any
more.
*
As an error is reported to the calling method (via the Status-Code),
it is
*
trusted that the calling method does not continue processing. */
}
}
/*
de:
*
Übertragen der neuen Werte des BOS in dieses BO.
*
Damit sind geänderte CommonAttributes, Status-Code und
Status-Message in diesem BOC verfügbar.
*
en:
*
Transfer the new values of the BOS to this BOC.
*
So, changed CommonAttributes, Status-Code and Status-Message are
available in this BOC.
*/
copyFromJSBS_Currency_BO(bosJSBS_Currency_BOS);
/*
de:
*
Verbindung zur Datenbank an den Connection-Manager zurück geben.
*
Der Connection Manager verwaltet die offenen Verbindungen zur
Datenbank und verwendet
*
sie wieder bei der nächsten Anforderung.
*
en:
*
Return the connection to the database to the Connection-Manager.
* The
Connection-Manager administers open connections to the database and
reuses it
*
at the next request.
*/
frmCC
.
structJSBS_DB_ConnectionManager
.returnReservedConnection(
this
,
intDBConReference
);
}
/*
* --------------------
*
de:
*
METHODEN zum Deaktivieren (logisches Löschen) eines BO
auf
der Datenbank des
*
Java Application Server (JAS).
*
en:
*
METHODS to deactivate BO at the database of the Java Application
Server (JAS). */
public
void
deactivate_JAS()
{
/*
de:
*
Ein BO konstruieren mit dem die Werte zum Server übertragen werden
und das nach dem store()
*
die neuen Attributswerte enthält.
*
en:
*
Construct a BO that is used to transfer the values to the server and
that contains
*
the new attribute-values after the store(). */
JSBS_Currency_BO
boJSBS_Currency_BO =
new
JSBS_Currency_BO();
/*
de: Die Werte in den Attributen dieses BOC auf das gerade
konstruierte BO kopieren.
*
en: Copy the values in the attributes of this BOC to the just
constructed BO.
*/
boJSBS_Currency_BO.copyFromJSBS_Currency_BO(
this
);
/*
de: Der Zugriff auf die Datenbank läuft über den
EJB-Mechanismus.
*
en: Access to the database is by using the EJB-mechanism.
*/
try
{
/*
de:
*
Instanziieren (Konstruieren) des Client-seitigen Objekts ('Remote
interface') für
*
den Aufruf von Methoden des EJB.
*
Die Methode zum Instanziieren ist im Start-Frame implementiert.
*
en:
*
Instantiate (construct) the client-side object ('Remote interface')
for calling
*
methods of the EJB.
*
The method to instantiate is implemented in the Start-Frame.
*/
JSBS_StandardEJBBeanRemote
remoteJSBS_StandardEJBBean
=
frmCC
.get_JSBS_StandardEJBBeanRemote();
/*
*
de: Prüfen, ob überhaupt eine Verbindung zum JAS hergestellt werden
konnte.
*
en: Verify if a connection to the JAS has been established.
*/
if
(remoteJSBS_StandardEJBBean
==
null
)
{
/*
*
de: Keine Verbindung zum JAS; Fehler zurückmelden.
*
en: No connection to the JAS; report error.
*/
this
.
StatusCode
=
JSBS_Currency_BO.
CONST_DB_UNKNOWN_ERROR
;
this
.
StatusMsg
=
"No
connection to JAS; method:
JSBS_Currency_BOC.deactivate()"
;
return
;
}
/*
de:
*
Aufrufen der 'Wrapper'-Methode des EJB. In dieser 'Wrapper'-Methode
wird die - zu diesem
*
Client-seitigen Teil des BO - passende Server-seitige Methode
aufgerufen.
*
Neue Werte für die Variablen des BO und eventuelle Fehlermeldungen
sind im zurückgelieferten
*
BO enthalten.
*
en:
*
Call the 'wrapper'-method of the EJB. Within this 'wrapper'-method
the server-side method
*
- which fits this method of the client-side derivation of the BO - is
called.
*
New values for variables of the BO and probably occured
error-messages are contained in the
*
returned BO. */
boJSBS_Currency_BO
=
remoteJSBS_StandardEJBBean.
JSBS_Currency_BO__deactivate(
frmTask
.
structMinParm
,
boJSBS_Currency_BO);
/*
de:
*
Werte des zurück gelieferten BO auf dieses BOC (Client-seitiger Teil
des BO) kopieren.
*
en:
*
Copy the values of the returned BO to this BOC (client-side
derivation of the BO). */
this
.copyFromJSBS_Currency_BO(boJSBS_Currency_BO);
}
catch
(Exception
e) {
/*
de:
*
Fehler beim Ausführen der Methode des EJB.
*
Fehlermeldung aus der Exception übernehmen und Status setzen.
*
en:
*
Error when executing the method of the EJB.
*
Transfer the error-message from the Exception and set status.
*/
this
.
StatusCode
=
JSBS_BO.
CONST_DB_UNKNOWN_ERROR
;
this
.
StatusMsg
= e.getMessage();
}
}
/*
* --------------------
*
de:
* METHODE zum Deaktivieren eines BO auf lokaler Datenbank
und/oder Datenbank des JAS.
* en:
*
METHOD to deactivate a BO on the local database and/or the database of
the JAS. */
public
void
deactivate()
{
/*
*
de: Entscheiden mit welcher Version das
Anwendungsprogramm läuft.
*
en: Decide what version the application
runs. */
switch
(
frmCC
.
RunVersion
)
{
case
JSBS_StartFrame.
CONST_StandAlone
:
/*
de:
*
Einzelplatzversion. Datenbank läuft auf der lokalen Maschine; Spezielle
Methode aufrufen.
*
en:
*
Stand-alone version. Database is running on the local machine; call the
specialized method. */
deactivate_DB(
);
break
;
case
JSBS_StartFrame.
CONST_FatClient
:
/*
de:
*
Client-Server-Version.
*
Datenzugriff erfolgt über den
EJB-Mechanismus und JAS (Java Application Server); spezielle Methode
aufrufen.
*
en:
*
Client-Server-version.
*
Data is accessed via the EJB-mechanism
and the JAS (Java Application Server); call the specialized method. */
deactivate_JAS(
);
break
;
case
JSBS_StartFrame.
CONST_MobileClient
:
/*
de:
*
Prüfen, ob die Verbindung zum JAS existiert
.
Abhängig davon erfolgt die weitere Verarbeitung.
*
en:
*
Verify, if the connection to the JAS exists. The further processing
depends on the result. */
if
(
frmCC
.testJASConnection
(
)
)
{
/*
de: Daten des BO am JAS deaktivieren.
*
en: Deactivate the data of the BOT at the JAS
.
*/
deactivate_JAS(
);
/*
de:
*
Prüfen, ob das Deaktivieren am JAS ohne Fehler beendet wurde. In
diesem Fall die
*
Methode aufrufen, die alle Datensätze für das BO mit der lokalen
Datenbank synchronisiert.
*
Damit wird der auf dem JAS erzeugte Datensatz für das BO auch auf die
lokale Datenbank
*
übertragen
.
*
en:
*
Verify, if the deactivate on the JAS ended without an error. In that
case call the method to
*
synchronize all datasets with the local database. This synchronizing
includes the transfer
*
of the dataset just created on the JAS back to the local database
.
*/
if
(
this
.
StatusCode
== JSBS_BO.
CONST_OK
)
synchronizeBO(
);
/*
de: Fehler beim Speichern am JAS; Methode beenden.
*
en: error when storing on the JAS; end this method
.
*/
else
return
;
}
else
{
/*
de: Verbindung zum JAS unterbrochen; nur auf lokaler Datenbank
deaktivieren.
*
en: Connection to JAS interrupted; deactivate on local database only
.
*/
deactivate_DB(
);
}
break
;
}
}
/*
* --------------------
*
de:
*
METHODEN zum Selektieren der aktuell gültigen Daten jenes BO, dessen
Anwender-bekannte Identifikation
*
in der Reihenfolge nach der
Identifikation, die in den Parametern übergeben wird, kommt.
*
en:
*
METHODS to select the actual data of the BO, which user-known key is in
the sort-order after
*
the key that is passed in the parameters
.
*/
/*
* de:
METHODE zum Lesen der Daten von der lokalen Datenbank
.
*
en:
METHOD to read the data from the local
database. */
private
void
selectNext_DB(String
parmISOCurrencyCode, String parmLanguageCodeForLabelling)
{
/*
de:
*
Datenbank läuft auf der lokalen Maschine;
Verbindung zur Datenbank herstellen.
*
en:
*
Database is running on the local machine; establish the connection to
the database. */
getDatabaseConnection(
true
);
/*
de:
*
Prüfen ob eine Verbindung zur Datenbank
hergestellt werden konnte.
*
Eine Referenznummer gleich oder
größer 0 bedeutet eine ordnungsgemäße
Verbindung zur DB.
*
en:
*
Verify if a connection
to the database could have been established.
*
A
reference-number of 0 or greater signals a proper connection to the
database. */
if
(
intDBConReference
<
0) {
/*
de:
*
Fehler beim Verbinden zur Datenbank; über
Status-Variable an die aufrufende Methode
*
signalisieren.
Diese Methode beenden.
*
en:
*
Error when
connecting to the database; signal this to the calling method using
*
the status-variables. End this Method.
*/
StatusCode
= JSBS_BO.
CONST_DB_SYSTEM_ERROR
;
StatusMsg
=
frmCC
.
structJSBS_DB_ConnectionManager
.
StatusMsg
;
return
;
}
/*
de:
*
Datenbank läuft auf der lokalen Maschine;
'Server-Seitige' Klasse des BO direkt
*
'konstruieren'.
*
Verbindung zur Datenbank und die Werte dieser 'Client-seitigen'
BO-Klasse
*
als Parameter übertragen.
*
en:
*
Database is running on the local machine; construct
the 'Server-Side' BO directly.
* Pass
the
database-connection and the values of this 'Client-Side' BO as
parameters. */
JSBS_Currency_BOS
bosJSBS_Currency_BOS =
new
JSBS_Currency_BOS(
frmTask
.
structMinParm
,
structDBCon
,
true
);
/*
de: Aufrufen der Methode, die die Operation auf der Datenbank
ausführt.
*
en: Call the method to perform the
database-operation(s).
*/
bosJSBS_Currency_BOS.selectNext(
parmISOCurrencyCode,
parmLanguageCodeForLabelling
);
/*
de:
*
Übertragen der zurückgelieferten Werte der
Variablen und des Status.
*
Ausserdem kann auf das
BOS nicht mehr zugegriffen werden sobald diese Methode beendet
ist.
*
en:
*
Transfer the returned values of the
variables and the Status.
*
Additionally the values of the
BOS can no longer be accessed as soon as this method has ended.
*/
copyFromJSBS_Currency_BO(bosJSBS_Currency_BOS);
/*
de:
*
Verbindung zur Datenbank an den Connection-Manager
zurück geben.
*
Der Connection Manager verwaltet die
offenen Verbindungen zur Datenbank und verwendet
*
sie
wieder bei der nächsten Anforderung.
*
en:
*
Return the connection to the database to the Connection-Manager.
* The
Connection-Manager administers open connections
to the database and reuses it
*
at the next request.
*/
frmCC
.
structJSBS_DB_ConnectionManager
.returnReservedConnection(
this
,
intDBConReference
);
}
/*
* de:
METHODE zum Selektieren der Daten über den JAS (Java Application Server)
.
*
en:
METHOD to select the data via the JAS (Java Application Server). */
private
void
selectNext_JAS(
String
parmISOCurrencyCode, String parmLanguageCodeForLabelling
)
{
/*
de: Der Zugriff auf die Datenbank läuft über den
EJB-Mechanismus.
*
en: Access to the database is by using
the EJB-mechanism. */
try
{
/*
de:
*
Instanziieren (Konstruieren) des Client-seitigen
Objekts ('Remote interface') für
*
den Aufruf von
Methoden des EJB.
*
Die Methode zum Instanziieren ist im
Start-Frame implementiert.
*
en:
*
Instantiate
(construct) the client-side object ('Remote interface') for
calling
*
methods of the EJB.
*
The method to
instantiate is implemented in the Start-Frame.
*/
JSBS_StandardEJBBeanRemote
remoteJSBS_StandardEJBBean
=
frmCC
.get_JSBS_StandardEJBBeanRemote();
/*
*
de: Prüfen, ob überhaupt eine Verbindung zum JAS
hergestellt werden konnte.
*
en: Verify if a connection to
the JAS has been established. */
if
(remoteJSBS_StandardEJBBean
==
null
)
{
/*
*
de: Keine Verbindung zum JAS; Fehler zurückmelden.
*
en: No connection to the JAS; report error.
*/
this
.
StatusCode
= JSBS_BO.
CONST_DB_UNKNOWN_ERROR
;
this
.
StatusMsg
=
"No
connection to JAS; method: JSBS_Currency_BOC.selectNext()"
;
return
;
}
/*
de:
*
Aufrufen der 'Wrapper'-Methode des EJB. In dieser
'Wrapper'-Methode wird die - zu diesem
*
Client-seitigen
Teil des BO - passende Server-seitige Methode aufgerufen.
*
Neue Werte für die Variablen des BO und eventuelle
Fehlermeldungen sind im zurückgelieferten
*
BO
enthalten.
*
en:
*
Call the 'wrapper'-method of
the EJB. Within this 'wrapper'-method the server-side method
*
- which fits this method of the client-side derivation of the BO - is
called.
*
New values for variables of the BO and probably
occured error-messages are contained in the
*
returned BO.
*/
JSBS_Currency_BO
boJSBS_Currency_BO =
remoteJSBS_StandardEJBBean.
JSBS_Currency_BO__selectNext(
frmTask
.
structMinParm
,
parmISOCurrencyCode,
parmLanguageCodeForLabelling
);
/*
de:
*
Werte des zurück gelieferten BO auf dieses BOC
(Client-seitiger Teil des BO) kopieren.
*
en:
*
Copy the values of the returned BO to this BOC (client-side
derivation of the BO). */
this
.copyFromJSBS_Currency_BO(boJSBS_Currency_BO);
}
catch
(Exception
e) {
/*
de:
*
Fehler beim Ausführen der Methode des EJB.
*
Fehlermeldung aus der Exception übernehmen und Status setzen.
*
en:
*
Error when executing the method of the EJB.
*
Transfer the error-message from the Exception and set status.
*/
this
.
StatusCode
= JSBS_BO.
CONST_DB_UNKNOWN_ERROR
;
this
.
StatusMsg
= e.getMessage();
}
}
/*
* --------------------
*
de:
*
METHODE zum Selektieren der aktuell gültigen Daten jenes BO, dessen
Anwender-bekannte Identifikation
*
in der Reihenfolge nach der
Identifikation, die in den Parameter übergeben wird, kommt.
*
en:
*
METHOD to select tha actual data of the BO, which user-known key is in
the sort-order after
*
the key that is passed in the parameters
.
*/
public
void
selectNext(String
parmISOCurrencyCode, String parmLanguageCodeForLabelling)
{
/*
*
de: Entscheiden mit welcher Version das
Anwendungsprogramm läuft.
*
en: Decide what version the application
runs. */
switch
(
frmCC
.
RunVersion
)
{
case
JSBS_StartFrame.
CONST_StandAlone
:
/*
de:
*
Einzelplatzversion. Datenbank läuft auf der lokalen Maschine; Spezielle
Methode aufrufen.
*
en:
*
Stand-alone version. Database is running on the local machine; call the
specialized method. */
selectNext_DB(
parmISOCurrencyCode
,
parmLanguageCodeForLabelling);
break
;
case
JSBS_StartFrame.
CONST_FatClient
:
/*
de:
*
Client-Server-Version.
*
Datenzugriff erfolgt über den
EJB-Mechanismus und JAS (Java Application Server); spezielle Methode
aufrufen.
*
en:
*
Client-Server-version.
*
Data is accessed via the EJB-mechanism
and the JAS (Java Application Server); call the specialized method. */
select
Next_JAS(
parmISOCurrencyCode
,
parmLanguageCodeForLabelling);
break
;
case
JSBS_StartFrame.
CONST_MobileClient
:
/*
de:
*
Zuerst die Daten von der lokalen Datenbank abfragen.
Per
Definition muss das immer möglich sein.
*
en:
*
Read the data from the local database. As per definition this must
always be possible
.
*/
selectNext_DB(
parmISOCurrencyCode
,
parmLanguageCodeForLabelling);
/*
de:
*
Prüfen, ob ein Fehler bei der Abfrage auf der lokalen Datenbank
aufgetreten ist. In diesem Fall die
*
Methode beenden - damit ist der Status für die aufrufende Methode
verfügbar
.
*
en:
*
Verify, if an error occured when reading the local database. In that
case end this method - that makes
*
the status available for the calling method
.
*/
if
((
this
.
StatusCode
== JSBS_BO.
CONST_OK
)
||
(
this
.
StatusCode
== JSBS_BO.
CONST_NOT_FOUND
)
)
{
/*
de: 'Erlaubte' Status-Codes für die Abfrage von der lokalen Datenbank.
*
en: 'Permitted' status-codes for the read from the local database
.
*/
}
else
return
;
/*
de:
*
Prüfen, ob die Verbindung zum JAS existiert
.
Abhängig davon erfolgt die weitere Verarbeitung.
*
en:
*
Verify, if the connection to the JAS exists. The further processing
depends on the result. */
if
(
frmCC
.testJASConnection
(
)
)
{
/*
de:
*
BO für die Daten der lokalen Datenbank und den Daten vom JAS
konstruieren.
*
Damit können später die jeweiligen Daten
verglichen und Unterschiede behandelt werden.
*
en:
*
Construct BO for the data from the local database and the data
from the JAS.
*
This allows to compare the data later and
process differences. */
JSBS_Currency_BO
structJSBS_Currency_BO_Local =
new
JSBS_Currency_BO()
;
JSBS_Currency_BO
structJSBS_Currency_BO_JAS =
new
JSBS_Currency_BO()
;
/*
de:
*
Ergebnis der Abfrage der lokalen Datenbank auf die dafür vorgesehene
Variable übertragen und den
*
Vector mit den BO in diesem Objekt leeren.
*
en:
*
Transfer the result of the read from the local database to the variable
designated for that.
*
Empty the vector with the BO within this
object thereafter. */
structJSBS_Currency_BO_Local.copyFromJSBS_Currency_BO(
this
)
;
/*
de: Daten vom JAS abfragen
.
*
en: Read the data from the JAS
.
*/
selectNext_JAS(
parmISOCurrencyCode,
parmLanguageCodeForLabelling
);
/*
de:
*
Prüfen, ob ein Fehler bei der Abfrage vom JAS aufgetreten ist. In
diesem Fall die
*
Methode beenden - damit ist der Status für die aufrufende Methode
verfügbar
.
*
en:
*
Verify, if an error occured when reading from the JAS. In that case end
this method - that makes
*
the status available for the calling method
.
*/
if
((
this
.
StatusCode
== JSBS_BO.
CONST_OK
)
||
(
this
.
StatusCode
== JSBS_BO.
CONST_NOT_FOUND
)
)
{
/*
de: 'Erlaubte' Status-Codes für die Abfrage von der lokalen Datenbank.
*
en: 'Permitted' status-codes for the read from the local database
.
*/
}
else
return
;
/*
de:
*
Ergebnis der Abfrage über den JAS auf die dafür vorgesehene Variable
übertragen und den
*
Vector mit den BO in diesem Objekt leeren.
*
en:
*
Transfer the result of the read via the JAS to the variable designated
for that.
*
Empty the vector with the BO within this
object thereafter. */
structJSBS_Currency_BO_JAS.copyFromJSBS_Currency_BO(
this
)
;
/*
de: Methode zum Abgleich der Daten von beiden Quellen aufrufen
.
*
en: Call the method that merges the data from both sources
.
*/
getNewestBO(
structJSBS_Currency_BO_Local
,
structJSBS_Currency_BO_JAS
);
/*
de:
*
Methode zum Prüfen, ob die Daten zwischen
Server und mobilem Client abgeglichen werden müssen,
*
aufrufen. In der aufgerufenen Methode wird auch ein eventuell
notwendiger Abgleich ausgeführt
.
*
en:
*
Call the method to verify, if the data
between server and MobileClient have to be synchronized.
*
Within the called method the synchronization is started - if needed
.
*/
synchronizeBO(
);
}
break
;
}
}
/*
* --------------------
*
de:
*
METHODEN zum Selektieren der aktuell gültigen Daten jenes BO, dessen
Anwender-bekannte Identifikation
*
in der Reihenfolge vor der
Identifikation, die in den Parametern übergeben wird, kommt.
*
en:
*
METHODS to select the actual data of the BO, which user-known key is in
the sort-order before
*
the key that is passed in the parameters
.
*/
/*
* de:
METHODE zum Lesen der Daten von der lokalen Datenbank
.
*
en:
METHOD to read the data from the local
database. */
private
void
selectPrevious_DB(String
parmISOCurrencyCode, String parmLanguageCodeForLabelling)
{
/*
de:
*
Datenbank läuft auf der lokalen Maschine;
Verbindung zur Datenbank herstellen.
*
en:
*
Database is running on the local machine; establish the connection to
the database. */
getDatabaseConnection(
true
);
/*
de:
*
Prüfen ob eine Verbindung zur Datenbank
hergestellt werden konnte.
*
Eine Referenznummer gleich oder
größer 0 bedeutet eine ordnungsgemäße
Verbindung zur DB.
*
en:
*
Verify if a connection
to the database could have been established.
*
A
reference-number of 0 or greater signals a proper connection to the
database. */
if
(
intDBConReference
<
0) {
/*
de:
*
Fehler beim Verbinden zur Datenbank; über
Status-Variable an die aufrufende Methode
*
signalisieren.
Diese Methode beenden.
*
en:
*
Error when
connecting to the database; signal this to the calling method using
*
the status-variables. End this Method.
*/
StatusCode
= JSBS_BO.
CONST_DB_SYSTEM_ERROR
;
StatusMsg
=
frmCC
.
structJSBS_DB_ConnectionManager
.
StatusMsg
;
return
;
}
/*
de:
*
Datenbank läuft auf der lokalen Maschine;
'Server-Seitige' Klasse des BO direkt
*
'konstruieren'.
*
Verbindung zur Datenbank und die Werte dieser 'Client-seitigen'
BO-Klasse
*
als Parameter übertragen.
*
en:
*
Database is running on the local machine; construct
the 'Server-Side' BO directly.
* Pass
the
database-connection and the values of this 'Client-Side' BO as
parameters. */
JSBS_Currency_BOS
bosJSBS_Currency_BOS =
new
JSBS_Currency_BOS(
frmTask
.
structMinParm
,
structDBCon
,
true
);
/*
de: Aufrufen der Methode, die die Operation auf der Datenbank
ausführt.
*
en: Call the method to perform the
database-operation(s).
*/
bosJSBS_Currency_BOS.selectPrevious(
parmISOCurrencyCode,
parmLanguageCodeForLabelling
);
/*
de:
*
Übertragen der zurückgelieferten Werte der
Variablen und des Status.
*
Ausserdem kann auf das
BOS nicht mehr zugegriffen werden sobald diese Methode beendet
ist.
*
en:
*
Transfer the returned values of the
variables and the Status.
*
Additionally the values of the
BOS can no longer be accessed as soon as this method has ended.
*/
copyFromJSBS_Currency_BO(bosJSBS_Currency_BOS);
/*
de:
*
Verbindung zur Datenbank an den Connection-Manager
zurück geben.
*
Der Connection Manager verwaltet die
offenen Verbindungen zur Datenbank und verwendet
*
sie
wieder bei der nächsten Anforderung.
*
en:
*
Return the connection to the database to the Connection-Manager.
* The
Connection-Manager administers open connections
to the database and reuses it
*
at the next request.
*/
frmCC
.
structJSBS_DB_ConnectionManager
.returnReservedConnection(
this
,
intDBConReference
);
}
/*
* de:
METHODE zum Selektieren der Daten über den JAS (Java Application Server)
.
*
en:
METHOD to select the data via the JAS (Java Application Server). */
private
void
selectPrevious_JAS(
String
parmISOCurrencyCode, String parmLanguageCodeForLabelling
)
{
/*
de: Der Zugriff auf die Datenbank läuft über den
EJB-Mechanismus.
*
en: Access to the database is by using
the EJB-mechanism. */
try
{
/*
de:
*
Instanziieren (Konstruieren) des Client-seitigen
Objekts ('Remote interface') für
*
den Aufruf von
Methoden des EJB.
*
Die Methode zum Instanziieren ist im
Start-Frame implementiert.
*
en:
*
Instantiate
(construct) the client-side object ('Remote interface') for
calling
*
methods of the EJB.
*
The method to
instantiate is implemented in the Start-Frame.
*/
JSBS_StandardEJBBeanRemote
remoteJSBS_StandardEJBBean
=
frmCC
.get_JSBS_StandardEJBBeanRemote();
/*
*
de: Prüfen, ob überhaupt eine Verbindung zum JAS
hergestellt werden konnte.
*
en: Verify if a connection to
the JAS has been established. */
if
(remoteJSBS_StandardEJBBean
==
null
)
{
/*
*
de: Keine Verbindung zum JAS; Fehler zurückmelden.
*
en: No connection to the JAS; report error.
*/
this
.
StatusCode
= JSBS_BO.
CONST_DB_UNKNOWN_ERROR
;
this
.
StatusMsg
=
"No
connection to JAS; method: JSBS_Currency_BOC.selectPrevious()"
;
return
;
}
/*
de:
*
Aufrufen der 'Wrapper'-Methode des EJB. In dieser
'Wrapper'-Methode wird die - zu diesem
*
Client-seitigen
Teil des BO - passende Server-seitige Methode aufgerufen.
*
Neue Werte für die Variablen des BO und eventuelle
Fehlermeldungen sind im zurückgelieferten
*
BO
enthalten.
*
en:
*
Call the 'wrapper'-method of
the EJB. Within this 'wrapper'-method the server-side method
*
- which fits this method of the client-side derivation of the BO - is
called.
*
New values for variables of the BO and probably
occured error-messages are contained in the
*
returned BO.
*/
JSBS_Currency_BO
boJSBS_Currency_BO =
remoteJSBS_StandardEJBBean.
JSBS_Currency_BO__selectPrevious(
frmTask
.
structMinParm
,
parmISOCurrencyCode,
parmLanguageCodeForLabelling
);
/*
de:
*
Werte des zurück gelieferten BO auf dieses BOC
(Client-seitiger Teil des BO) kopieren.
*
en:
*
Copy the values of the returned BO to this BOC (client-side
derivation of the BO). */
this
.copyFromJSBS_Currency_BO(boJSBS_Currency_BO);
}
catch
(Exception
e) {
/*
de:
*
Fehler beim Ausführen der Methode des EJB.
*
Fehlermeldung aus der Exception übernehmen und Status setzen.
*
en:
*
Error when executing the method of the EJB.
*
Transfer the error-message from the Exception and set status.
*/
this
.
StatusCode
= JSBS_BO.
CONST_DB_UNKNOWN_ERROR
;
this
.
StatusMsg
= e.getMessage();
}
}
/*
* --------------------
*
de:
*
METHODE zum Selektieren der aktuell gültigen Daten jenes BO, dessen
Anwender-bekannte Identifikation
*
in der Reihenfolge vor der
Identifikation, die in den Parametern übergeben wird, kommt.
*
en:
*
METHOD to select the actual data of the BO, which user-known key is in
the sort-order before
*
the key that is passed in the parameters
.
*/
public
void
selectPrevious(String
parmISOCurrencyCode, String parmLanguageCodeForLabelling)
{
/*
*
de: Entscheiden mit welcher Version das
Anwendungsprogramm läuft.
*
en: Decide what version the application
runs. */
switch
(
frmCC
.
RunVersion
)
{
case
JSBS_StartFrame.
CONST_StandAlone
:
/*
de:
*
Einzelplatzversion. Datenbank läuft auf der lokalen Maschine; Spezielle
Methode aufrufen.
*
en:
*
Stand-alone version. Database is running on the local machine; call the
specialized method. */
selectPrevious_DB(
parmISOCurrencyCode
,
parmLanguageCodeForLabelling);
break
;
case
JSBS_StartFrame.
CONST_FatClient
:
/*
de:
*
Client-Server-Version.
*
Datenzugriff erfolgt über den
EJB-Mechanismus und JAS (Java Application Server); spezielle Methode
aufrufen.
*
en:
*
Client-Server-version.
*
Data is accessed via the EJB-mechanism
and the JAS (Java Application Server); call the specialized method. */
selectPrevious
_JAS(
parmISOCurrencyCode
,
parmLanguageCodeForLabelling);
break
;
case
JSBS_StartFrame.
CONST_MobileClient
:
/*
de:
*
Zuerst die Daten von der lokalen Datenbank abfragen.
Per
Definition muss das immer möglich sein.
*
en:
*
Read the data from the local database. As per definition this must
always be possible
.
*/
selectPrevious_DB(
parmISOCurrencyCode
,
parmLanguageCodeForLabelling);
/*
de:
*
Prüfen, ob ein Fehler bei der Abfrage auf der lokalen Datenbank
aufgetreten ist. In diesem Fall die
*
Methode beenden - damit ist der Status für die aufrufende Methode
verfügbar
.
*
en:
*
Verify, if an error occured when reading the local database. In that
case end this method - that makes
*
the status available for the calling method
.
*/
if
((
this
.
StatusCode
== JSBS_BO.
CONST_OK
)
||
(
this
.
StatusCode
== JSBS_BO.
CONST_NOT_FOUND
)
)
{
/*
de: 'Erlaubte' Status-Codes für die Abfrage von der lokalen Datenbank.
*
en: 'Permitted' status-codes for the read from the local database
.
*/
}
else
return
;
/*
de:
*
Prüfen, ob die Verbindung zum JAS existiert
.
Abhängig davon erfolgt die weitere Verarbeitung.
*
en:
*
Verify, if the connection to the JAS exists. The further processing
depends on the result. */
if
(
frmCC
.testJASConnection
(
)
)
{
/*
de:
*
BO für die Daten der lokalen Datenbank und den Daten vom JAS
konstruieren.
*
Damit können später die jeweiligen Daten
verglichen und Unterschiede behandelt werden.
*
en:
*
Construct BO for the data from the local database and the data
from the JAS.
*
This allows to compare the data later and
process differences. */
JSBS_Currency_BO
structJSBS_Currency_BO_Local =
new
JSBS_Currency_BO()
;
JSBS_Currency_BO
structJSBS_Currency_BO_JAS =
new
JSBS_Currency_BO()
;
/*
de:
*
Ergebnis der Abfrage der lokalen Datenbank auf die dafür vorgesehene
Variable übertragen und den
*
Vector mit den BO in diesem Objekt leeren.
*
en:
*
Transfer the result of the read from the local database to the variable
designated for that.
*
Empty the vector with the BO within this
object thereafter. */
structJSBS_Currency_BO_Local.copyFromJSBS_Currency_BO(
this
)
;
/*
de: Daten vom JAS abfragen
.
*
en: Read the data from the JAS
.
*/
selectPrevious_JAS(
parmISOCurrencyCode,
parmLanguageCodeForLabelling
);
/*
de:
*
Prüfen, ob ein Fehler bei der Abfrage vom JAS aufgetreten ist. In
diesem Fall die
*
Methode beenden - damit ist der Status für die aufrufende Methode
verfügbar
.
*
en:
*
Verify, if an error occured when reading from the JAS. In that case end
this method - that makes
*
the status available for the calling method
.
*/
if
((
this
.
StatusCode
== JSBS_BO.
CONST_OK
)
||
(
this
.
StatusCode
== JSBS_BO.
CONST_NOT_FOUND
)
)
{
/*
de: 'Erlaubte' Status-Codes für die Abfrage von der lokalen Datenbank.
*
en: 'Permitted' status-codes for the read from the local database
.
*/
}
else
return
;
/*
de:
*
Ergebnis der Abfrage über den JAS auf die dafür vorgesehene Variable
übertragen und den
*
Vector mit den BO in diesem Objekt leeren.
*
en:
*
Transfer the result of the read via the JAS to the variable designated
for that.
*
Empty the vector with the BO within this
object thereafter. */
structJSBS_Currency_BO_JAS.copyFromJSBS_Currency_BO(
this
)
;
/*
de: Methode zum Abgleich der Daten von beiden Quellen aufrufen
.
*
en: Call the method that merges the data from both sources
.
*/
getNewestBO(
structJSBS_Currency_BO_Local
,
structJSBS_Currency_BO_JAS
);
/*
de:
*
Methode zum Prüfen, ob die Daten zwischen
Server und mobilem Client abgeglichen werden müssen,
*
aufrufen. In der aufgerufenen Methode wird auch ein eventuell
notwendiger Abgleich ausgeführt
.
*
en:
*
Call the method to verify, if the data
between server and MobileClient have to be synchronized.
*
Within the called method the synchronization is started - if needed
.
*/
synchronizeBO(
);
}
break
;
}
}
/*
* --------------------
*
de:
*
METHODEN zum Selektieren der aktuell gültigen Daten jenes BO, dessen
Anwender-bekannte Identifikation
*
in den Parametern übergeben wird.
*
en:
*
METHODS to select the actual data of the BO, which user-known key is
passed in the parameters
.
*/
/*
* de:
METHODE zum Lesen der Daten von der lokalen Datenbank
.
*
en:
METHOD to read the data from the local
database. */
private
void
selectByUserKnownKey_DB(String
parmISOCurrencyCode, String parmLanguageCodeForLabelling)
{
/*
de:
*
Datenbank läuft auf der lokalen Maschine;
Verbindung zur Datenbank herstellen.
*
en:
*
Database is running on the local machine; establish the connection to
the database. */
getDatabaseConnection(
true
);
/*
de:
*
Prüfen ob eine Verbindung zur Datenbank
hergestellt werden konnte.
*
Eine Referenznummer gleich oder
größer 0 bedeutet eine ordnungsgemäße
Verbindung zur DB.
*
en:
*
Verify if a connection
to the database could have been established.
*
A
reference-number of 0 or greater signals a proper connection to the
database. */
if
(
intDBConReference
<
0) {
/*
de:
*
Fehler beim Verbinden zur Datenbank; über
Status-Variable an die aufrufende Methode
*
signalisieren.
Diese Methode beenden.
*
en:
*
Error when
connecting to the database; signal this to the calling method using
*
the status-variables. End this Method.
*/
StatusCode
= JSBS_BO.
CONST_DB_SYSTEM_ERROR
;
StatusMsg
=
frmCC
.
structJSBS_DB_ConnectionManager
.
StatusMsg
;
return
;
}
/*
de:
*
Datenbank läuft auf der lokalen Maschine;
'Server-Seitige' Klasse des BO direkt
*
'konstruieren'.
*
Verbindung zur Datenbank und die Werte dieser 'Client-seitigen'
BO-Klasse
*
als Parameter übertragen.
*
en:
*
Database is running on the local machine; construct
the 'Server-Side' BO directly.
* Pass
the
database-connection and the values of this 'Client-Side' BO as
parameters. */
JSBS_Currency_BOS
bosJSBS_Currency_BOS =
new
JSBS_Currency_BOS(
frmTask
.
structMinParm
,
structDBCon
,
true
);
/*
de: Aufrufen der Methode, die die Operation auf der Datenbank
ausführt.
*
en: Call the method to perform the
database-operation(s).
*/
bosJSBS_Currency_BOS.selectByUserKnownKey(
parmISOCurrencyCode,
parmLanguageCodeForLabelling
);
/*
de:
*
Übertragen der zurückgelieferten Werte der
Variablen und des Status.
*
Ausserdem kann auf das
BOS nicht mehr zugegriffen werden sobald diese Methode beendet
ist.
*
en:
*
Transfer the returned values of the
variables and the Status.
*
Additionally the values of the
BOS can no longer be accessed as soon as this method has ended.
*/
copyFromJSBS_Currency_BO(bosJSBS_Currency_BOS);
/*
de:
*
Verbindung zur Datenbank an den Connection-Manager
zurück geben.
*
Der Connection Manager verwaltet die
offenen Verbindungen zur Datenbank und verwendet
*
sie
wieder bei der nächsten Anforderung.
*
en:
*
Return the connection to the database to the Connection-Manager.
* The
Connection-Manager administers open connections
to the database and reuses it
*
at the next request.
*/
frmCC
.
structJSBS_DB_ConnectionManager
.returnReservedConnection(
this
,
intDBConReference
);
}
/*
* de:
METHODE zum Selektieren der Daten über den JAS (Java Application Server)
.
*
en:
METHOD to select the data via the JAS (Java Application Server). */
private
void
selectByUserKnownKey_JAS(
String
parmISOCurrencyCode, String parmLanguageCodeForLabelling
)
{
/*
de: Der Zugriff auf die Datenbank läuft über den
EJB-Mechanismus.
*
en: Access to the database is by using
the EJB-mechanism. */
try
{
/*
de:
*
Instanziieren (Konstruieren) des Client-seitigen
Objekts ('Remote interface') für
*
den Aufruf von
Methoden des EJB.
*
Die Methode zum Instanziieren ist im
Start-Frame implementiert.
*
en:
*
Instantiate
(construct) the client-side object ('Remote interface') for
calling
*
methods of the EJB.
*
The method to
instantiate is implemented in the Start-Frame.
*/
JSBS_StandardEJBBeanRemote
remoteJSBS_StandardEJBBean
=
frmCC
.get_JSBS_StandardEJBBeanRemote();
/*
*
de: Prüfen, ob überhaupt eine Verbindung zum JAS
hergestellt werden konnte.
*
en: Verify if a connection to
the JAS has been established. */
if
(remoteJSBS_StandardEJBBean
==
null
)
{
/*
*
de: Keine Verbindung zum JAS; Fehler zurückmelden.
*
en: No connection to the JAS; report error.
*/
this
.
StatusCode
= JSBS_BO.
CONST_DB_UNKNOWN_ERROR
;
this
.
StatusMsg
=
"No
connection to JAS; method: JSBS_Currency_BOC.selectByUserKnownKey()"
;
return
;
}
/*
de:
*
Aufrufen der 'Wrapper'-Methode des EJB. In dieser
'Wrapper'-Methode wird die - zu diesem
*
Client-seitigen
Teil des BO - passende Server-seitige Methode aufgerufen.
*
Neue Werte für die Variablen des BO und eventuelle
Fehlermeldungen sind im zurückgelieferten
*
BO
enthalten.
*
en:
*
Call the 'wrapper'-method of
the EJB. Within this 'wrapper'-method the server-side method
*
- which fits this method of the client-side derivation of the BO - is
called.
*
New values for variables of the BO and probably
occured error-messages are contained in the
*
returned BO.
*/
JSBS_Currency_BO
boJSBS_Currency_BO =
remoteJSBS_StandardEJBBean.
JSBS_Currency_BO__selectByUserKnownKey(
frmTask
.
structMinParm
,
parmISOCurrencyCode,
parmLanguageCodeForLabelling
);
/*
de:
*
Werte des zurück gelieferten BO auf dieses BOC
(Client-seitiger Teil des BO) kopieren.
*
en:
*
Copy the values of the returned BO to this BOC (client-side
derivation of the BO). */
this
.copyFromJSBS_Currency_BO(boJSBS_Currency_BO);
}
catch
(Exception
e) {
/*
de:
*
Fehler beim Ausführen der Methode des EJB.
*
Fehlermeldung aus der Exception übernehmen und Status setzen.
*
en:
*
Error when executing the method of the EJB.
*
Transfer the error-message from the Exception and set status.
*/
this
.
StatusCode
= JSBS_BO.
CONST_DB_UNKNOWN_ERROR
;
this
.
StatusMsg
= e.getMessage();
}
}
/*
* --------------------
*
de:
*
METHODE zum Selektieren der aktuell gültigen Daten jenes BO, dessen
Anwender-bekannte Identifikation
*
in den Parametern übergeben wird.
*
en:
*
METHOD to select tha actual data of the BO, which user-known key is
passed
in the parameters
.
*/
public
void
selectByUserKnownKey(String
parmISOCurrencyCode, String parmLanguageCodeForLabelling)
{
/*
*
de: Entscheiden mit welcher Version das
Anwendungsprogramm läuft.
*
en: Decide what version the application
runs. */
switch
(
frmCC
.
RunVersion
)
{
case
JSBS_StartFrame.
CONST_StandAlone
:
/*
de:
*
Einzelplatzversion. Datenbank läuft auf der lokalen Maschine; Spezielle
Methode aufrufen.
*
en:
*
Stand-alone version. Database is running on the local machine; call the
specialized method. */
selectByUserKnownKey_DB(
parmISOCurrencyCode
,
parmLanguageCodeForLabelling);
break
;
case
JSBS_StartFrame.
CONST_FatClient
:
/*
de:
*
Client-Server-Version.
*
Datenzugriff erfolgt über den
EJB-Mechanismus und JAS (Java Application Server); spezielle Methode
aufrufen.
*
en:
*
Client-Server-version.
*
Data is accessed via the EJB-mechanism
and the JAS (Java Application Server); call the specialized method. */
select
ByUserKnownKey_JAS(
parmISOCurrencyCode
,
parmLanguageCodeForLabelling);
break
;
case
JSBS_StartFrame.
CONST_MobileClient
:
/*
de:
*
Zuerst die Daten von der lokalen Datenbank abfragen.
Per
Definition muss das immer möglich sein.
*
en:
*
Read the data from the local database. As per definition this must
always be possible
.
*/
selectByUserKnownKey_DB(
parmISOCurrencyCode
,
parmLanguageCodeForLabelling);
/*
de:
*
Prüfen, ob ein Fehler bei der Abfrage auf der lokalen Datenbank
aufgetreten ist. In diesem Fall die
*
Methode beenden - damit ist der Status für die aufrufende Methode
verfügbar
.
*
en:
*
Verify, if an error occured when reading the local database. In that
case end this method - that makes
*
the status available for the calling method
.
*/
if
((
this
.
StatusCode
== JSBS_BO.
CONST_OK
)
||
(
this
.
StatusCode
== JSBS_BO.
CONST_NOT_FOUND
)
)
{
/*
de: 'Erlaubte' Status-Codes für die Abfrage von der lokalen Datenbank.
*
en: 'Permitted' status-codes for the read from the local database
.
*/
}
else
return
;
/*
de:
*
Prüfen, ob die Verbindung zum JAS existiert
.
Abhängig davon erfolgt die weitere Verarbeitung.
*
en:
*
Verify, if the connection to the JAS exists. The further processing
depends on the result. */
if
(
frmCC
.testJASConnection
(
)
)
{
/*
de:
*
BO für die Daten der lokalen Datenbank und den Daten vom JAS
konstruieren.
*
Damit können später die jeweiligen Daten
verglichen und Unterschiede behandelt werden.
*
en:
*
Construct BO for the data from the local database and the data
from the JAS.
*
This allows to compare the data later and
process differences. */
JSBS_Currency_BO
structJSBS_Currency_BO_Local =
new
JSBS_Currency_BO()
;
JSBS_Currency_BO
structJSBS_Currency_BO_JAS =
new
JSBS_Currency_BO()
;
/*
de:
*
Ergebnis der Abfrage der lokalen Datenbank auf die dafür vorgesehene
Variable übertragen und den
*
Vector mit den BO in diesem Objekt leeren.
*
en:
*
Transfer the result of the read from the local database to the variable
designated for that.
*
Empty the vector with the BO within this
object thereafter. */
structJSBS_Currency_BO_Local.copyFromJSBS_Currency_BO(
this
)
;
/*
de: Daten vom JAS abfragen
.
*
en: Read the data from the JAS
.
*/
selectByUserKnownKey_JAS(
parmISOCurrencyCode,
parmLanguageCodeForLabelling
);
/*
de:
*
Prüfen, ob ein Fehler bei der Abfrage vom JAS aufgetreten ist. In
diesem Fall die
*
Methode beenden - damit ist der Status für die aufrufende Methode
verfügbar
.
*
en:
*
Verify, if an error occured when reading from the JAS. In that case end
this method - that makes
*
the status available for the calling method
.
*/
if
((
this
.
StatusCode
== JSBS_BO.
CONST_OK
)
||
(
this
.
StatusCode
== JSBS_BO.
CONST_NOT_FOUND
)
)
{
/*
de: 'Erlaubte' Status-Codes für die Abfrage von der lokalen Datenbank.
*
en: 'Permitted' status-codes for the read from the local database
.
*/
}
else
return
;
/*
de:
*
Ergebnis der Abfrage über den JAS auf die dafür vorgesehene Variable
übertragen und den
*
Vector mit den BO in diesem Objekt leeren.
*
en:
*
Transfer the result of the read via the JAS to the variable designated
for that.
*
Empty the vector with the BO within this
object thereafter. */
structJSBS_Currency_BO_JAS.copyFromJSBS_Currency_BO(
this
)
;
/*
de: Methode zum Abgleich der Daten von beiden Quellen aufrufen
.
*
en: Call the method that merges the data from both sources
.
*/
getNewestBO(
structJSBS_Currency_BO_Local
,
structJSBS_Currency_BO_JAS
);
/*
de:
*
Methode zum Prüfen, ob die Daten zwischen
Server und mobilem Client abgeglichen werden müssen,
*
aufrufen. In der aufgerufenen Methode wird auch ein eventuell
notwendiger Abgleich ausgeführt
.
*
en:
*
Call the method to verify, if the data
between server and MobileClient have to be synchronized.
*
Within the called method the synchronization is started - if needed
.
*/
synchronizeBO(
);
}
break
;
}
}
}
Die Methoden dieser Klasse werden nur von Methoden innerhalb des JavaScout Basis-Systems aufgerufen und sind nicht für eine allgemeine Verwendung gedacht.
Dokument |
Inhalt |
|
|