|
Letzte
Bearbeitung dieses Dokuments: |
Code
Erklärungen
und Anwendungsbeispiele
Verwandte
Dokumentation
package
js_base.boc;/*
* de: Packages mit den Klassen für
SQL-Datenbanken.
* en: Packages with the classes for the
SQL-classes. */import
java.sql.*;/*
* de: Packages mit der Generellen und Server-seitige
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
*
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; /**
*
* @author kurt(at)javascout[biz]
* @date
2013-02-08
*
* @description
* de:
*
Client-seitiger Teil des Business Object für die 'PDFP'.
*
.
*
* Diese Klasse hat die
folgenden Aufgaben:
* * Methode zum Speichern der
neuen oder geänderten Werte des Business Object.
*
Die Entscheidung ob 'store' das 'INSERT' eines neuen Objekts
bedeutet
* oder ob ein 'UPDATE' auf ein bereits
bestehendes Objekt ausgeführt werden
*
muss, wird im Server-seitigen Teil des Business Object
entschieden.
* * Methoden zum Lesen (Selektieren)
eines Objektes.
* Es sind nur Methoden für
Selektions-Kriterien implementiert, die per Definition
*
nur einen Datensatz zurückliefern.
*
Nebenbemerkung: Zum Selektieren mit Kriterien die ein Set von
Business Objects
*
zurückliefern können ist eine
eigene Klasse implementiert.
*
*
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.
* -------------------
* en: *
Client-Side derivation of the Business Object for the
'FramePosition'.
*
* This class has the
following functions:
* * Method to store new or
changed values of the Business Object.
* The
decision, if the 'store' means INSERT of a new Object
* or
an already existing Object has to be UPDATEd, is made
* at
the Server-Side derivation of the Business Object.
* * Methods
to read (SELECT) a Object.
* These
methods are only implemented for search criteria that can
* deliver only one
database-record.
* N.B.: for reading
with search-criteria that may deliver a set of objects,
* a
own class is implemented.
*
* 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_PDFP_BOC
extends
JSBS_PDFP_BO {/*
*
de:
* Variablen die bei der 'Konstruktion' der Klasse
übertragen werden.
* Im Unterschied zu BOC die nur für
ein bestimmtes Anwendungsprogramm verwendet werden
* (und
bei denen es reicht, das aufrufende 'TaskFrame' in einer Variable zu
halten)
* benötigt diese Klasse detailiertere Werte
damit diese Klasse auch innerhalb eines
* beliebigen
'Start-Frames' (das die Klasse JSBS_StartFrame erbt) konstruiert
werden kann.
* en: *
Variables that are transferred at the construction of the class.
*
Different to other BOC, which are only used with a specific
application-programm (where it is
* sufficient to keep the
'calling' TaskFrame within a variable),
* this class needs
more detailed variables as this class can also be constructed
*
with a JSBS_StartFrame as parameter. */
int
RunVersion;
JSBS_MinimalParameters
structJSBS_MinimalParameters;
JSBS_DB_ConnectionManager
structJSBS_DB_ConnectionManager;
JSBS_StartFrame frmCC;/* *
de: *
Referenz zur bestehenden Verbindung zur Datenbank. *
Dieser Werte muss von der aufrufenden Methode als Parameter übergeben
werden *
wenn diese Klasse 'konstruiert' wird. *
en: *
Referenc to the established connection to the database.
* This
value has to be passed by the calling method when this class is
constructed. */ private
Connection
structDBCon
=
null;/* *
de: *
Referenz zur Datenbank-Verbindung die durch den ConnectionManager
verwaltet wird. *
Dieser Wert wird von ConnectionManager vergeben wenn eine Verbindung
zur Datenbank *
hergestellt wurde und wird gebraucht, wenn die Verbindung zur
Datenbank in dieser *
Klasse nicht mehr gebraucht wird und an den ConnectionManager
'zurückgegeben' 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 it is no longer needed *
within this class. */ private
int intDBConReference
=
0;
/*
*
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.
* Die nicht
übergebenen Werte für Variablen dieser Klasse werden im
Constructor ermittelt.
* en: * Takes
the task that constructed this class (which is passed as a parameter)
and stores it
* in the above defined variable.
*
Not transferred values for the variables will be derived within the
constructor. */ public
JSBS_PDFP_BOC(JSBS_TaskFrame
parmfrmTask) {
frmCC
= parmfrmTask.frmCC;
RunVersion
=
parmfrmTask.frmCC.RunVersion;
structJSBS_MinimalParameters
=
parmfrmTask.structMinParm;
structJSBS_DB_ConnectionManager
=
parmfrmTask.frmCC.structJSBS_DB_ConnectionManager;
}
/*
***** */
public
JSBS_PDFP_BOC(JSBS_StartFrame
parmfrmStart) {
frmCC
=
parmfrmStart;
RunVersion
=
parmfrmStart.RunVersion;
structJSBS_MinimalParameters
=
new
JSBS_MinimalParameters(parmfrmStart.structJSBS_UniversalParameters);
structJSBS_DB_ConnectionManager
=
parmfrmStart.structJSBS_DB_ConnectionManager;
}/*
*
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.
* 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. */
private
boolean getDatabaseConnection(boolean
parmReadOnly)
{/*
* de:
Eine Referenz zu einer Datenbank-Verbindung vom ConnectionManager
anfordern.
* en: Get a reference to the
database-connection provided by the ConnectionManager.
*/ intDBConReference
=
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
=
CONST_DB_SYSTEM_ERROR;
StatusMsg
=
structJSBS_DB_ConnectionManager.StatusMsg;
return
false;
}/*
* de:
Datenbank-Verbindung holen und in der Variable in dieser Klasse
abspreichern.
* en: Get the database-connection and
store it in the variable within this class. */ structDBCon
=
structJSBS_DB_ConnectionManager.getReservedConnection(this,
intDBConReference);
return
true;
}
/*
* --------------------
*
de:
* METHODE zum Speichern neu erfasster oder geänderter
Werte dieses Business Objects.
* Die Entscheidung, ob ein
INSERT oder UPDATE durchgeführt wird, wird in der
*
Server-seitigen Klasse des BO getroffen.
* en: *
METHOD to store the new entered or changed values of this Business
Object.
* The decision if an INSERT or UPDATE is needed
is made in the server-side-class
* of this BO. */
public
void store()
{/*
de:
* Entscheiden mit welcher Version das
Anwendungsprogramm läuft.
* Im Unterschied zum
Design-Pattern für BOC wird in dieser Klasse nicht mit
'switch/case'
* entschieden sondern mit 'if'.
* Der
Grund dafür ist, dass bei einer 'MobileClient'-Version der PDFP
immer auf der
* lokalen Datenbank gespeichert wird.
*
en:
* Decide what version the application runs.
*
Contrary to the design-pattern for BOC in this class the decision is
made with 'if'
* and not with 'switch/case'. Reason for that
is, that at a 'MobileClient'-version
* the PDFP is always
stored on the local database. */ if
((RunVersion
==
JSBS_StartFrame.CONST_StandAlone)
||
(RunVersion
==
JSBS_StartFrame.CONST_MobileClient))
{/*
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(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 prober 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
=
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_PDFP_BOS
bosJSBS_PDFP_BOS =
new
JSBS_PDFP_BOS(structJSBS_MinimalParameters,
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_PDFP_BOS.store();/*
de:
* Übertragen der zurückgelieferten Werte weil
diese jetzt den Status und eventuell
* (vom BOS ausgeführte)
Änderungen bei allgemeinen Attributen (Common Attributes)
enthalten.
* en:
* Transfer the returned values as
they include the Status and
* changed Common
Attributes (performed by the BOS).
*/ copyFromJSBS_PDFP_BO(bosJSBS_PDFP_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);
}
else {/*
de: Der Zugriff auf die Datenbank läuft über den
EJB-Mechanismus.
* en: Access to the database is by using
the EJB-mechanism. *//*
* de:
* Zuerst ein BO konstruieren mit dem die
Werte zum EJB übertragen werden und das
* danach die
neuen Werte nach dem 'store()' enthält.
* en:
*
First construct a BO to transfer the values to the EJB and which
contains the
* new values after the 'store()'.
*/ JSBS_PDFP_BO
boJSBS_PDFP_BO = new
JSBS_PDFP_BO(); boJSBS_PDFP_BO.copyFromJSBS_PDFP_BO(this);/*
***** */ 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_PDFP_BO.CONST_DB_UNKNOWN_ERROR; this.StatusMsg
=
"No
connection to JAS; method:
JSBS_PDFP_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_PDFP_BO
= remoteJSBS_StandardEJBBean.
JSBS_PDFP_BO__store(structJSBS_MinimalParameters, boJSBS_PDFP_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_PDFP_BO(boJSBS_PDFP_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_PDFP_BO.CONST_DB_UNKNOWN_ERROR;
this.StatusMsg
= e.getMessage();
} }
}/*
* --------------------
*
de:
* METHODE zum Holen des einen Datensatzes der durch die
Anwender-bekannte-Identifikation
* 'Hostname' definiert
ist.
* en:
* METHOD to get the one dataset that is
defined by the user-known-key 'Hostname'. */
public
void getValidByHostname(String
parmHostname) {/*
de:
* Entscheiden mit welcher Version das
Anwendungsprogramm läuft.
* Im Unterschied zum
Design-Pattern für BOC wird in dieser Klasse nicht mit
'switch/case'
* entschieden sondern mit 'if'.
* Der
Grund dafür ist, dass bei einer 'MobileClient'-Version der PDFP
immer auf der
* lokalen Datenbank gespeichert wird.
*
en:
* Decide what version the application runs.
*
Contrary to the design-pattern for BOC in this class the decision is
made with 'if'
* and not with 'switch/case'. Reason for that
is, that at a 'MobileClient'-version
* the PDFP is alway
stored on the local database. */ if
(
(RunVersion
== JSBS_StartFrame.CONST_StandAlone)
||
(RunVersion
== JSBS_StartFrame.CONST_MobileClient))
{/*
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 prober 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
= 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_PDFP_BOS
bosJSBS_PDFP_BOS =
new
JSBS_PDFP_BOS(structJSBS_MinimalParameters,
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_PDFP_BOS.selectByHostname(parmHostname);/*
de:
* Übertragen der zurückgelieferten Werte der
Variablen und den Status enthalten.
* 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 accesses as soon as this method has ended.
*/ copyFromJSBS_PDFP_BO(bosJSBS_PDFP_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);
}
else {/*
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_PDFP_BO.CONST_DB_UNKNOWN_ERROR; this.StatusMsg
= "No
connection to JAS; method:
JSBS_PDFP_BOC.selectByHostname()"; 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_PDFP_BO
boJSBS_PDFP_BO
= remoteJSBS_StandardEJBBean.JSBS_PDFP_BO__selectByHostname( structJSBS_MinimalParameters, parmHostname);/*
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_PDFP_BO(boJSBS_PDFP_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_PDFP_BO.CONST_DB_UNKNOWN_ERROR;
this.StatusMsg
= e.getMessage();
} }
}/*
* --------------------
*
de:
* METHODE zum Holen des einen Datensatzes der durch die
alternative Anwender-bekannte-Identifikation
*
'TCPIP_Address' definiert ist.
* en: *
METHOD to get the one dataset that is defined by the alternative
user-known-key 'TCPIP_Address'. */
public
void getValidByTCPIP_Address(String
parmTCPIP_Address) {/*
de:
* Entscheiden mit welcher Version das
Anwendungsprogramm läuft.
* Im Unterschied zum
Design-Pattern für BOC wird in dieser Klasse nicht mit
'switch/case'
* entschieden sondern mit 'if'.
* Der
Grund dafür ist, dass bei einer 'MobileClient'-Version der PDFP
immer auf der
* lokalen Datenbank gespeichert wird.
*
en:
* Decide what version the application runs.
*
Contrary to the design-pattern for BOC in this class the decision is
made with 'if'
* and not with 'switch/case'. Reason for that
is, that at a 'MobileClient'-version
* the PDFP is alway
stored on the local database. */ if
(
(RunVersion
== JSBS_StartFrame.CONST_StandAlone)
||
(RunVersion
== JSBS_StartFrame.CONST_MobileClient))
{/*
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 prober 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
= 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_PDFP_BOS
bosJSBS_PDFP_BOS =
new
JSBS_PDFP_BOS(structJSBS_MinimalParameters,
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_PDFP_BOS.selectByTCPIP_Address(parmTCPIP_Address);/*
de:
* Übertragen der zurückgelieferten Werte der
Variablen und den Status enthalten.
* 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 accesses as soon as this method has ended.
*/ copyFromJSBS_PDFP_BO(bosJSBS_PDFP_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);
}
else {/*
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_PDFP_BO.CONST_DB_UNKNOWN_ERROR; this.StatusMsg
= "No
connection to JAS; method:
JSBS_PDFP_BOC.selectByTCPIP_Address()"; 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_PDFP_BO
boJSBS_PDFP_BO
= remoteJSBS_StandardEJBBean.JSBS_PDFP_BO__selectByTCPIP_Address( structJSBS_MinimalParameters, parmTCPIP_Address);/*
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_PDFP_BO(boJSBS_PDFP_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_PDFP_BO.CONST_DB_UNKNOWN_ERROR;
this.StatusMsg
= e.getMessage();
} }
}}
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 |
|
|
|