File: eaf_n_cst_component.sru
Size: 39309
Date: Tue, 22 Jan 2008 23:39:46 +0100
$PBExportHeader$eaf_n_cst_component.sru
forward
global type eaf_n_cst_component from nonvisualobject
end type
end forward

global type eaf_n_cst_component from nonvisualobject
event activate pbm_component_activate
event deactivate pbm_component_deactivate
end type
global eaf_n_cst_component eaf_n_cst_component

type variables
Public:

n_cst_messageservice          inv_messaging

Protected:

//Debugging/Error references
boolean                       ib_trace = false
boolean                       ib_debug = false
boolean                       ib_detailed = false
boolean                       ib_usedatabaselogging = false
boolean                       ib_warning = false

string                        is_loggingservice

n_cst_objectservice           inv_objecthelper

n_cst_loggingservice          inv_log

n_cst_constants               inv_constants


string                        is_username

long                          il_languageid = 1

string                        is_componentname
end variables

forward prototypes
protected function long componentconnectend ()
protected function long componentconnectstart ()
protected function long componentdisconnectend ()
protected function long componentdisconnectstart ()
protected function boolean istransactionaborted ()
protected function boolean isintransaction ()
protected function long setcomplete ()
protected function long setabort ()
protected function long componentconnectmain ()
protected function long componentdisconnectmain ()
protected function long componentdisconnect ()
public function long ping ()
protected function long componentconnect ()
protected function long buildmessagelist ()
public function string getproductname ()
public function string getproductversion ()
public function datetime getbuilddate ()
protected function long adderror (string as_methodname, string as_message)
protected function long defineloggingservice ()
public function long setdetailed (boolean ab_value)
public function long setwarning (boolean ab_value)
public function long setusedatabaselogging (boolean ab_value)
public function long settrace (boolean ab_value)
public function long setdebug (boolean ab_value)
public function date getproductversiondate ()
public function string getusername ()
public function long setusername (string as_username)
public function long getlanguageid ()
public function long setlanguageid (long al_languageid)
public subroutine setcomponentname (string as_componentname)
public function string getcomponentname ()
end prototypes

event activate;///////////////////////////////////////////////////////////////////////////////////
// Description:
//    Activate processing
// Revisions
//    1.0   - Initial version
// Arguments:  
//    None
// Returns: 
//     None
///////////////////////////////////////////////////////////////////////////////////
// Copyright © 2000 - 2007 Youngsoft, Inc.  All rights reserved.
// Any distribution of the Youngsoft, Inc. Enterprise Application Framework
// source code in whole or part by other than Youngsoft, Inc. is prohibited.
/////////////////////////////////////////////////////////////////////////////////// 

constant string METHOD_NAME = "activate "

inv_log.traceLog (METHOD_NAME, "")

Return
end event

event deactivate;///////////////////////////////////////////////////////////////////////////////////
// Description:
//    Deactivate processing
// Revisions
//    1.0   - Initial version
// Arguments:  
//    None
// Returns: 
//     None
///////////////////////////////////////////////////////////////////////////////////
// Copyright © 2000 - 2007 Youngsoft, Inc.  All rights reserved.
// Any distribution of the Youngsoft, Inc. Enterprise Application Framework
// source code in whole or part by other than Youngsoft, Inc. is prohibited.
/////////////////////////////////////////////////////////////////////////////////// 

constant string METHOD_NAME = "deactivate "

inv_log.traceLog (METHOD_NAME, "")

inv_messaging.reset()

Return 
end event

protected function long componentconnectend ();constant string METHOD_NAME = "componentConnectEnd "
///////////////////////////////////////////////////////////////////////////////////
// Description:
//    Invoked by the Framework from the componentConnect().
//    Occurs when the Connection is complete.
// Revisions
//    1.0   - Initial version
// Arguments:  
//    None
// Returns: 
//     1 - Success - Continue Action
//    -1 - Failure 
///////////////////////////////////////////////////////////////////////////////////
// Copyright © 2000 - 2007 Youngsoft, Inc.  All rights reserved.
// Any distribution of the Youngsoft, Inc. Enterprise Application Framework
// source code in whole or part by other than Youngsoft, Inc. is prohibited.
/////////////////////////////////////////////////////////////////////////////////// 

If ib_trace And ib_detailed Then
   inv_log.traceLog (METHOD_NAME, "")
End If   

Return 1
end function

protected function long componentconnectstart ();constant string METHOD_NAME = "componentConnectStart "
///////////////////////////////////////////////////////////////////////////////////
// Description:
//    Invoked by the Framework from the componentConnect().
//    Occurs when the Connection process is about to begin
// Revisions
//    1.0   - Initial version
// Arguments:  
//    None
// Returns: 
//     2 - Success - Connection has been performed (skip connection process)
//     1 - Success - Continue Action
//     0 - Do not perform the connection
//    -1 - Failure - Do not perform the connection
///////////////////////////////////////////////////////////////////////////////////
// Copyright © 2000 - 2007 Youngsoft, Inc.  All rights reserved.
// Any distribution of the Youngsoft, Inc. Enterprise Application Framework
// source code in whole or part by other than Youngsoft, Inc. is prohibited.
/////////////////////////////////////////////////////////////////////////////////// 

If ib_trace And ib_detailed Then
   inv_log.traceLog (METHOD_NAME, "")
End If   

Return 1
end function

protected function long componentdisconnectend ();constant string METHOD_NAME = "componentDisconnectEnd "
///////////////////////////////////////////////////////////////////////////////////
// Description:
//    Invoked by the Framework from the componentDisconnect().
//    Occurs when the Disconnection is complete.
// Revisions
//    1.0   - Initial version
// Arguments:  
//    None
// Returns: 
//     1 - Success - Continue Action
//    -1 - Failure 
///////////////////////////////////////////////////////////////////////////////////
// Copyright © 2000 - 2007 Youngsoft, Inc.  All rights reserved.
// Any distribution of the Youngsoft, Inc. Enterprise Application Framework
// source code in whole or part by other than Youngsoft, Inc. is prohibited.
/////////////////////////////////////////////////////////////////////////////////// 

If ib_trace And ib_detailed Then
   inv_log.traceLog (METHOD_NAME, "")
End If   

Return 1
end function

protected function long componentdisconnectstart ();constant string METHOD_NAME = "componentDisconnectStart "
///////////////////////////////////////////////////////////////////////////////////
// Description:
//    Invoked by the Framework from the componentDisconnect().
//    Occurs when the DisConnection process is about to begin
// Revisions
//    1.0   - Initial version
// Arguments:  
//    None
// Returns: 
//     2 - Success - DisConnection has been performed (skip disconnection process)
//     1 - Success - Continue Action
//     0 - Do not perform the Disconnection
//    -1 - Failure - Do not perform the Disconnection
///////////////////////////////////////////////////////////////////////////////////
// Copyright © 2000 - 2007 Youngsoft, Inc.  All rights reserved.
// Any distribution of the Youngsoft, Inc. Enterprise Application Framework
// source code in whole or part by other than Youngsoft, Inc. is prohibited.
/////////////////////////////////////////////////////////////////////////////////// 

If ib_trace And ib_detailed Then
   inv_log.traceLog (METHOD_NAME, "")
End If   

Return 1
end function

protected function boolean istransactionaborted ();constant string METHOD_NAME = "isTransactionAborted "
///////////////////////////////////////////////////////////////////////////////////
// Description:
//    Determines whether the current transaction in which
//    the component participates has been aborted
// Revisions
//    1.0   - Initial version
// Arguments:  
//    None
// Returns: 
//    Returns False if the current transaction is still a go for a
//             a good Completion
//    Return True in any other situation
///////////////////////////////////////////////////////////////////////////////////
// Copyright © 2000 - 2007 Youngsoft, Inc.  All rights reserved.
// Any distribution of the Youngsoft, Inc. Enterprise Application Framework
// source code in whole or part by other than Youngsoft, Inc. is prohibited.
/////////////////////////////////////////////////////////////////////////////////// 

transactionserver          ltrs_obj
String                     ls_jaguarpath

If ib_trace and ib_detailed Then
   inv_log.traceLog (METHOD_NAME, "")
End If   

inv_objecthelper.getEnvironmentVariable( "JAGUAR", ls_jaguarpath )

if Len(ls_jaguarpath) > 0 then
   // Get the supported Context Services
   if getContextService("TransactionServer",ltrs_obj) = 1 then
      return ltrs_obj.isTransactionAborted()
   else
      return false
   end if
else
   return false
end if
end function

protected function boolean isintransaction ();constant string METHOD_NAME = "isInTransaction "
///////////////////////////////////////////////////////////////////////////////////
// Description:
//    Determines whether the component is executing in a transaction
// Revisions
//    1.0   - Initial version
// Arguments:  
//    None
// Returns: 
//    Returns True if executing in a transaction
//    Return False in any other situation
///////////////////////////////////////////////////////////////////////////////////
// Copyright © 2000 - 2007 Youngsoft, Inc.  All rights reserved.
// Any distribution of the Youngsoft, Inc. Enterprise Application Framework
// source code in whole or part by other than Youngsoft, Inc. is prohibited.
/////////////////////////////////////////////////////////////////////////////////// 

transactionserver          ltrs_obj
String                     ls_jaguarpath

If ib_trace and ib_detailed Then
   inv_log.traceLog (METHOD_NAME, "")
End If   

inv_objecthelper.getEnvironmentVariable( "JAGUAR", ls_jaguarpath )

if Len(ls_jaguarpath) > 0 then
   // Get the supported Context Services
   if getContextService("TransactionServer",ltrs_obj) = 1 then
      return ltrs_obj.isInTransaction()
   else
      return true
   end if
else
   return true
end if

end function

protected function long setcomplete ();constant string METHOD_NAME = "setComplete "
///////////////////////////////////////////////////////////////////////////////////
// Description:
//    Set Complete processing
// Revisions
//    1.0   - Initial version
// Arguments:  
//    None
// Returns: 
//     1 - Success
//    -1 - Failure
///////////////////////////////////////////////////////////////////////////////////
// Copyright © 2000 - 2007 Youngsoft, Inc.  All rights reserved.
// Any distribution of the Youngsoft, Inc. Enterprise Application Framework
// source code in whole or part by other than Youngsoft, Inc. is prohibited.
/////////////////////////////////////////////////////////////////////////////////// 

transactionserver          ltrs_obj
String                     ls_jaguarpath

If ib_trace Then
   inv_log.traceLog (METHOD_NAME, "")
End If

If Not isInTransaction() Then
   inv_log.warningLog(METHOD_NAME, "about to be executed.  " + &
      "Component is Not participating in Transaction ")  
End If

inv_objecthelper.getEnvironmentVariable( "JAGUAR", ls_jaguarpath )

if Len(ls_jaguarpath) > 0 then
   // Get the supported Context Services
   if getContextService("TransactionServer",ltrs_obj) = 1 then
      return ltrs_obj.SetComplete()
   else
      return 1
   end if
else
   return 1
end if
end function

protected function long setabort ();constant string METHOD_NAME = "setAbort "
///////////////////////////////////////////////////////////////////////////////////
// Description:
//    Set Abort processing
// Revisions
//    1.0   - Initial version
// Arguments:  
//    None
// Returns: 
//     1 - Success
//    -1 - Failure
///////////////////////////////////////////////////////////////////////////////////
// Copyright © 2000 - 2007 Youngsoft, Inc.  All rights reserved.
// Any distribution of the Youngsoft, Inc. Enterprise Application Framework
// source code in whole or part by other than Youngsoft, Inc. is prohibited.
/////////////////////////////////////////////////////////////////////////////////// 

transactionserver          ltrs_obj
String                     ls_jaguarpath

If ib_trace Then
   inv_log.traceLog (METHOD_NAME, "")
End If   

If Not isInTransaction() Then
   inv_log.warningLog(METHOD_NAME, "about to be executed.  " + &
      "Component is Not participating in Transaction ")  
End If

inv_objecthelper.getEnvironmentVariable( "JAGUAR", ls_jaguarpath )

if Len(ls_jaguarpath) > 0 then
   // Get the supported Context Services
   if getContextService("TransactionServer",ltrs_obj) = 1 then
      return ltrs_obj.SetAbort()
   else
      return 1
   end if
else
   return 1
end if
end function

protected function long componentconnectmain ();constant string METHOD_NAME = "componentConnectMain "
///////////////////////////////////////////////////////////////////////////////////
// Description:
//    Invoked by the Framework from the componentConnect().
//    Performs the default Connection process.
// Revisions
//    1.0   - Initial version
// Arguments:  
//    None
// Returns: 
//     1 - Success
//    -1 - Failure 
///////////////////////////////////////////////////////////////////////////////////
// Copyright © 2000 - 2007 Youngsoft, Inc.  All rights reserved.
// Any distribution of the Youngsoft, Inc. Enterprise Application Framework
// source code in whole or part by other than Youngsoft, Inc. is prohibited.
/////////////////////////////////////////////////////////////////////////////////// 

If ib_trace And ib_detailed Then
   inv_log.traceLog (METHOD_NAME, "")
End If   

// Declare local variables
long     ll_rc
string   ls_error

// Validate required references
If isNull(SQLCA) Or Not isValid(SQLCA) Then
   addError (METHOD_NAME, "Invalid SQLCA reference")
   Return -1
End If

// Perform the actual connection
ll_rc = SQLCA.transactionConnect()

If isNull(ll_rc) Or ll_rc <= 0 Then
   inv_messaging.append( sqlca.inv_messaging )
   sqlca.inv_messaging.reset()
   Return -1
End If   

Return 1
end function

protected function long componentdisconnectmain ();constant string METHOD_NAME = "componentDisconnectMain "
///////////////////////////////////////////////////////////////////////////////////
// Description:
//    Invoked by the Framework from the componentDisconnect().
//    Performs the default DisConnection process.
// Revisions
//    1.0   - Initial version
// Arguments:  
//    None
// Returns: 
//     1 - Success
//    -1 - Failure 
///////////////////////////////////////////////////////////////////////////////////
// Copyright © 2000 - 2007 Youngsoft, Inc.  All rights reserved.
// Any distribution of the Youngsoft, Inc. Enterprise Application Framework
// source code in whole or part by other than Youngsoft, Inc. is prohibited.
/////////////////////////////////////////////////////////////////////////////////// 

If ib_trace And ib_detailed Then
   inv_log.traceLog (METHOD_NAME, "")
End If   

// Declare local variables
long     ll_rc
string   ls_error

// Perform the actual disconnect
ll_rc = SQLCA.transactionDisconnect()

If isNull(ll_rc) Or ll_rc <= 0 Then
   inv_messaging.append( sqlca.inv_messaging )
   sqlca.inv_messaging.reset()
   Return -1
End If   

Return 1
end function

protected function long componentdisconnect ();constant string METHOD_NAME = "componentDisconnect "
///////////////////////////////////////////////////////////////////////////////////
// Description:
//    Component level disconnection processing
//
//    Contains Start and End processing
// Revisions
//    1.0   - Initial version
// Arguments:  
//    None
// Returns: 
//     1 - Success
//    -1 - Failure
///////////////////////////////////////////////////////////////////////////////////
// Copyright © 2000 - 2007 Youngsoft, Inc.  All rights reserved.
// Any distribution of the Youngsoft, Inc. Enterprise Application Framework
// source code in whole or part by other than Youngsoft, Inc. is prohibited.
/////////////////////////////////////////////////////////////////////////////////// 

If ib_trace And ib_detailed Then
   inv_log.traceLog (METHOD_NAME, "")
End If

// Declare local variables
long     ll_start_rc
long     ll_end_rc
long     ll_rc

// Invoke the Start processing method
ll_start_rc = this.componentDisconnectStart()
If ll_start_rc < 0 Then
   addError (METHOD_NAME, "Operation componentDisconnectStart() failed with RC="+string(ll_start_rc))
   Return -1   
ElseIf ll_start_rc = 0 Then
   If ib_debug Then
      inv_log.warningLog(METHOD_NAME, "Call to componentDisconnectStart() has cancelled operation RC="+string(ll_start_rc))
   End If
   Return -1
End If

// Perform the actual Disconnection (skipped if ll_start_rc =2 )
If ll_start_rc = 1 Then
   ll_rc = this.componentDisconnectMain()
   If ll_rc <= 0 Then
      addError(METHOD_NAME, "Operation componentDisconnectMain() failed with RC="+string(ll_rc))
      Return -1
   End If
End If

// Invoke the End processing method
ll_end_rc = this.componentDisconnectEnd()
If ll_end_rc < 0 Then
   addError(METHOD_NAME, "Invalid componentDisconnectEnd() operation")
   Return -1   
End If

Return 1

end function

public function long ping ();constant string METHOD_NAME = "ping "
///////////////////////////////////////////////////////////////////////////////////
// Description:
//    Allows the component to be ping-ed
// Revisions
//    1.0   - Initial version
// Arguments:  
//    None
// Returns: 
//     1 - Success
///////////////////////////////////////////////////////////////////////////////////
// Copyright © 2000 - 2007 Youngsoft, Inc.  All rights reserved.
// Any distribution of the Youngsoft, Inc. Enterprise Application Framework
// source code in whole or part by other than Youngsoft, Inc. is prohibited.
/////////////////////////////////////////////////////////////////////////////////// 

ErrorLogging lel
getContextService( "errorlogging", lel )

lel.log ("Ping")

If ib_trace Then
   inv_log.traceLog (METHOD_NAME, "")
End If   

Return 1
end function

protected function long componentconnect ();constant string METHOD_NAME = "componentConnect "
///////////////////////////////////////////////////////////////////////////////////
// Description:
//    Component level connection processing
//
//    Contains Start and End processing
// Revisions
//    1.0   - Initial version
// Arguments:
//    None
// Returns: 
//     1 - Success
//    -1 - Failure
///////////////////////////////////////////////////////////////////////////////////
// Copyright © 2000 - 2007 Youngsoft, Inc.  All rights reserved.
// Any distribution of the Youngsoft, Inc. Enterprise Application Framework
// source code in whole or part by other than Youngsoft, Inc. is prohibited.
/////////////////////////////////////////////////////////////////////////////////// 

If ib_trace And ib_detailed Then
   inv_log.traceLog (METHOD_NAME, "")
End If

// Declare local variables
long     ll_start_rc
long     ll_end_rc
long     ll_rc

// Validate required references
If isNull(SQLCA) Or Not isValid(SQLCA) Then
   addError (METHOD_NAME, "Invalid SQLCA reference")
   Return -1
End If

// Not need connect
if SQLCA.DBMS = "" then return 1

if SQLCA.isTransactionConnected() then return 1

// Invoke the Start processing method
ll_start_rc = this.componentConnectStart()
If ll_start_rc < 0 Then
   addError (METHOD_NAME, "Operation componentConnectStart() failed with RC="+string(ll_start_rc))
   Return -1   
ElseIf ll_start_rc = 0 Then
   If ib_debug Then
      inv_log.warningLog(METHOD_NAME, "Call to componentConnectStart() has cancelled operation RC="+string(ll_start_rc))
   End If
   Return -1
End If

// Perform the actual connection (skipped if ll_start_rc =2 )
If ll_start_rc = 1 Then
   ll_rc = this.componentConnectMain()
   If ll_rc <= 0 Then
      addError(METHOD_NAME, "Operation componentConnectMain() failed with RC="+string(ll_rc))
      Return -1
   End If   
End If

// Invoke the End processing method
ll_end_rc = this.componentConnectEnd()
If ll_end_rc < 0 Then
   addError(METHOD_NAME, "Invalid componentConnectEnd() operation")
   Return -1   
End If

Return 1
end function

protected function long buildmessagelist ();constant string METHOD_NAME = "buildMessageList "
///////////////////////////////////////////////////////////////////////////////////
// Description:
//    Build message List containing all the possible messages
//    genearated by this object
// Note.
//    Extend in order to have other messages
// Revisions
//    1.0   - Initial version
// Arguments:
//    None
// Returns: 
//     1 - Success 
//    -1 - Failure 
///////////////////////////////////////////////////////////////////////////////////
// Copyright © 2000 - 2007 Youngsoft, Inc.  All rights reserved.
// Any distribution of the Youngsoft, Inc. Enterprise Application Framework
// source code in whole or part by other than Youngsoft, Inc. is prohibited.
/////////////////////////////////////////////////////////////////////////////////// 

If ib_trace Then
   inv_log.traceLog (METHOD_NAME, "")
End If   

// Validate required references
If isNull(inv_objecthelper) Or Not isValid(inv_objecthelper) Then
   addError(METHOD_NAME, "Invalie inv_objecthelper reference")
   Return -1
End If

inv_objecthelper.addMessage("eaf_filter_missing_value", 1, "Required value missing for %s.")
inv_objecthelper.addMessage("eaf_primary_missing_value", 1, "Required value missing for %s.")
inv_objecthelper.addMessage("eaf_filter_missing_value", 2, "Requirida informacion para %s no se encountra.")
inv_objecthelper.addMessage("eaf_primary_missing_value", 2, "Requirida informacion para %s no se encountra.")

Return 1

end function

public function string getproductname ();constant string METHOD_NAME = "getProductName() "
///////////////////////////////////////////////////////////////////////////////////
// Description:
//    Returns the product name constant value
// Revisions
//    3.0   - Initial version
// Arguments:  
//    None
// Returns: 
//     Product name
///////////////////////////////////////////////////////////////////////////////////
// Copyright © 2000 - 2007 Youngsoft, Inc.  All rights reserved.
// Any distribution of the Youngsoft, Inc. Enterprise Application Framework
// source code in whole or part by other than Youngsoft, Inc. is prohibited.
/////////////////////////////////////////////////////////////////////////////////// 


return inv_constants.PRODUCT_NAME

end function

public function string getproductversion ();constant string METHOD_NAME = "getProductVersion() "
///////////////////////////////////////////////////////////////////////////////////
// Description:
//    Returns the product name constant value
// Revisions
//    3.0   - Initial version
// Arguments:  
//    None
// Returns: 
//     Product name
///////////////////////////////////////////////////////////////////////////////////
// Copyright © 2000 - 2007 Youngsoft, Inc.  All rights reserved.
// Any distribution of the Youngsoft, Inc. Enterprise Application Framework
// source code in whole or part by other than Youngsoft, Inc. is prohibited.
/////////////////////////////////////////////////////////////////////////////////// 


return inv_constants.PRODUCT_VERSION

end function

public function datetime getbuilddate ();constant string METHOD_NAME = "getBuildDate() "
///////////////////////////////////////////////////////////////////////////////////
// Description:
//    Returns the product version date constant value
// Revisions
//    3.0   - Initial version
// Arguments:  
//    None
// Returns: 
//     Product name
///////////////////////////////////////////////////////////////////////////////////
// Copyright © 2000 - 2007 Youngsoft, Inc.  All rights reserved.
// Any distribution of the Youngsoft, Inc. Enterprise Application Framework
// source code in whole or part by other than Youngsoft, Inc. is prohibited.
/////////////////////////////////////////////////////////////////////////////////// 


return dateTime( inv_constants.BUILD_DATE, inv_constants.BUILD_TIME )

end function

protected function long adderror (string as_methodname, string as_message);///////////////////////////////////////////////////////////////////////////////////
// Description:
//    Adds the error to the message stack and logs the error
//    Sets the last error variable for legacy code support
//    
// Revisions
//    3.0   - Initial version
// Arguments:  
//    as_error - The actual error messsage
// Returns:
//     1 - Success
//    -1 - Failure
////////////////////////////////////////////////////////////////////////////////////
// Copyright © 2000 - 2007 Youngsoft, Inc.  All rights reserved.
// Any distribution of the Youngsoft, Inc. Enterprise Application Framework
// source code in whole or part by other than Youngsoft, Inc. is prohibited.
/////////////////////////////////////////////////////////////////////////////////// 

inv_log.addError(as_methodname, as_message, inv_messaging)


return 1

end function

protected function long defineloggingservice ();constant string METHOD_NAME = "defineLoggingService( ) "
///////////////////////////////////////////////////////////////////////////////////
// Description:
//    Sets the logging service implementation class name
//    Allows descendants to define their own logging services
// Revisions
//    3.0   - Initial version
// Arguments:  
//    as_error - The actual error messsage
// Returns:
//     1 - Success
//    -1 - Failure
///////////////////////////////////////////////////////////////////////////////////
// Copyright © 2000 - 2007 Youngsoft, Inc.  All rights reserved.
// Any distribution of the Youngsoft, Inc. Enterprise Application Framework
// source code in whole or part by other than Youngsoft, Inc. is prohibited.
/////////////////////////////////////////////////////////////////////////////////// 

is_loggingservice = "n_cst_loggingservice"

Return 1
end function

public function long setdetailed (boolean ab_value);constant string METHOD_NAME = "setDetailed( boolean value ) "
///////////////////////////////////////////////////////////////////////////////////
// Description:
//    Sets the detailed debug variable
//    Required for the LogPropagation interface
//    
// Revisions
//    1.0   - Initial version
// Arguments:  
//    as_error - The actual error messsage
// Returns:
//     1 - Success
//    -1 - Failure
///////////////////////////////////////////////////////////////////////////////////
// Copyright © 2000 - 2007 Youngsoft, Inc.  All rights reserved.
// Any distribution of the Youngsoft, Inc. Enterprise Application Framework
// source code in whole or part by other than Youngsoft, Inc. is prohibited.
/////////////////////////////////////////////////////////////////////////////////// 

ib_detailed = ab_value

inv_log.setDetailed( ib_detailed )

Return 1
end function

public function long setwarning (boolean ab_value);constant string METHOD_NAME = "setWarning( boolean value ) "
///////////////////////////////////////////////////////////////////////////////////
// Description:
//    Sets the warning variable
//    Required for the LogPropagation interface
//    
// Revisions
//    1.0   - Initial version
// Arguments:  
//    as_error - The actual error messsage
// Returns:
//     1 - Success
//    -1 - Failure
///////////////////////////////////////////////////////////////////////////////////
// Copyright © 2000 - 2007 Youngsoft, Inc.  All rights reserved.
// Any distribution of the Youngsoft, Inc. Enterprise Application Framework
// source code in whole or part by other than Youngsoft, Inc. is prohibited.
/////////////////////////////////////////////////////////////////////////////////// 

ib_warning = ab_value

inv_log.setWarning( ib_warning )

Return 1

end function

public function long setusedatabaselogging (boolean ab_value);constant string METHOD_NAME = "setUseDatabaseLogging( boolean value ) "
///////////////////////////////////////////////////////////////////////////////////
// Description:
//    Sets the warning variable
//    Required for the LogPropagation interface
//    
// Revisions
//    1.0   - Initial version
// Arguments:  
//    as_error - The actual error messsage
// Returns:
//     1 - Success
//    -1 - Failure
///////////////////////////////////////////////////////////////////////////////////
// Copyright © 2000 - 2007 Youngsoft, Inc.  All rights reserved.
// Any distribution of the Youngsoft, Inc. Enterprise Application Framework
// source code in whole or part by other than Youngsoft, Inc. is prohibited.
/////////////////////////////////////////////////////////////////////////////////// 

ib_usedatabaselogging = ab_value

inv_log.setUseDatabaseLogging( ib_usedatabaselogging )

Return 1

end function

public function long settrace (boolean ab_value);constant string METHOD_NAME = "setTrace( boolean value ) "
///////////////////////////////////////////////////////////////////////////////////
// Description:
//    Sets the trace variable
//    Required for the LogPropagation interface
//    
// Revisions
//    1.0   - Initial version
// Arguments:  
//    as_error - The actual error messsage
// Returns:
//     1 - Success
//    -1 - Failure
///////////////////////////////////////////////////////////////////////////////////
// Copyright © 2000 - 2007 Youngsoft, Inc.  All rights reserved.
// Any distribution of the Youngsoft, Inc. Enterprise Application Framework
// source code in whole or part by other than Youngsoft, Inc. is prohibited.
/////////////////////////////////////////////////////////////////////////////////// 

ib_trace = ab_value

inv_log.setTrace( ib_trace )

Return 1
end function

public function long setdebug (boolean ab_value);constant string METHOD_NAME = "setDebug( boolean value ) "
///////////////////////////////////////////////////////////////////////////////////
// Description:
//    Sets the debug variable
//    Required for the LogPropagation interface
//    
// Revisions
//    1.0   - Initial version
// Arguments:  
//    as_error - The actual error messsage
// Returns:
//     1 - Success
//    -1 - Failure
///////////////////////////////////////////////////////////////////////////////////
// Copyright © 2000 - 2007 Youngsoft, Inc.  All rights reserved.
// Any distribution of the Youngsoft, Inc. Enterprise Application Framework
// source code in whole or part by other than Youngsoft, Inc. is prohibited.
/////////////////////////////////////////////////////////////////////////////////// 

ib_debug = ab_value

inv_log.setDebug( ib_debug )

Return 1
end function

public function date getproductversiondate ();constant string METHOD_NAME = "getProductVersionDate() "
///////////////////////////////////////////////////////////////////////////////////
// Description:
//    Returns the product name constant value
// Revisions
//    3.0   - Initial version
// Arguments:  
//    None
// Returns: 
//     Product name
///////////////////////////////////////////////////////////////////////////////////
// Copyright © 2000 - 2007 Youngsoft, Inc.  All rights reserved.
// Any distribution of the Youngsoft, Inc. Enterprise Application Framework
// source code in whole or part by other than Youngsoft, Inc. is prohibited.
/////////////////////////////////////////////////////////////////////////////////// 


return inv_constants.PRODUCT_VERSION_DATE

end function

public function string getusername ();///////////////////////////////////////////////////////////////////////////////////
// Description:
//    Gets the User Name property.  
//    1.0   - Initial version
// Arguments:  
//    None
// Returns:
//     The User Name property
///////////////////////////////////////////////////////////////////////////////////
// Copyright © 2000 - 2007 Youngsoft, Inc.  All rights reserved.
// Any distribution of the Youngsoft, Inc. Enterprise Applirk
// source code in whole or part by other than Youngsoft, Inc. is prohibited.
/////////////////////////////////////////////////////////////////////////////////// 

constant string METHOD_NAME = "getUserName "

If ib_trace Then
   inv_log.traceLog (METHOD_NAME, "")
End If   

Return is_username
end function

public function long setusername (string as_username);///////////////////////////////////////////////////////////////////////////////////
// Description:
//    Sets the User Name property.  
//    1.0   - Initial version
// Arguments:  
//    al_UserName - The Login User Name
// Returns:
//     1 - Success
//    -1 - Failure
///////////////////////////////////////////////////////////////////////////////////
// Copyright © 2000 - 2007 Youngsoft, Inc.  All rights reserved.
// Any distribution of thems, Inc. Enterprise Application Framework
// source code in whole or part by other than Youngsoft, Inc. is prohibited.
/////////////////////////////////////////////////////////////////////////////////// 

constant string METHOD_NAME = "setUserName "

If ib_trace Then
   inv_log.traceLog (METHOD_NAME, "(as_UserName)   as_UserName="+string(as_UserName))
End If   

// Validate arguments
If isNull(as_UserName) Or Len(as_UserName) <= 0 Then
   addError (METHOD_NAME, "Invalid al_UserName argument")
   Return -1
End If

is_UserName = as_UserName

Return 1
end function

public function long getlanguageid ();///////////////////////////////////////////////////////////////////////////////////
// Description:
//    Gets the Language ID property.  
//    1.0   - Initial version
// Arguments:  
//    None
// Returns:
//     The Language ID property
///////////////////////////////////////////////////////////////////////////////////
// Copyright © 2000 - 2007 Youngsoft, Inc.  All rights reserved.
// Any distribution of the Youngsoft, Inc. Enterprise Applirk
// source code in whole or part by other than Youngsoft, Inc. is prohibited.
/////////////////////////////////////////////////////////////////////////////////// 

constant string METHOD_NAME = "getLanguageID "

If ib_trace Then
   inv_log.traceLog (METHOD_NAME, "")
End If   

Return il_languageid
end function

public function long setlanguageid (long al_languageid);///////////////////////////////////////////////////////////////////////////////////
// Description:
//    Sets the Language ID property.  
//    1.0   - Initial version
// Arguments:  
//    al_languageid - The new default Language
// Returns:
//     1 - Success
//    -1 - Failure
///////////////////////////////////////////////////////////////////////////////////
// Copyright © 2000 - 2007 Youngsoft, Inc.  All rights reserved.
// Any distribution of thems, Inc. Enterprise Application Framework
// source code in whole or part by other than Youngsoft, Inc. is prohibited.
/////////////////////////////////////////////////////////////////////////////////// 

constant string METHOD_NAME = "setLanguageID "

If ib_trace Then
   inv_log.traceLog (METHOD_NAME, "(al_languageid)   al_languageid="+string(al_languageid))
End If   

// Validate arguments
If isNull(al_languageid) Or al_languageid <= 0 Then
   addError (METHOD_NAME, "Invalid al_languageid argument")
   Return -1
End If

il_languageid = al_languageid
Return 1
end function

public subroutine setcomponentname (string as_componentname);is_componentname = as_componentname
end subroutine

public function string getcomponentname ();return is_componentname
end function

on eaf_n_cst_component.create
call super::create
TriggerEvent( this, "constructor" )
end on

on eaf_n_cst_component.destroy
TriggerEvent( this, "destructor" )
call super::destroy
end on

event constructor;///////////////////////////////////////////////////////////////////////////////////
// Description:
//    Constructor processing
// Revisions
//    1.0   - Initial version
//    2.0   - Removed function/method endTrace() from object
//            It was found revision 1.0 but served no purpose
//    2.1   - Added code to create SQLCA if not created by PBVM
// Arguments:  
//    None
// Returns: 
//     None
///////////////////////////////////////////////////////////////////////////////////
// Copyright © 2000 - 2007 Youngsoft, Inc.  All rights reserved.
// Any distribution of the Youngsoft, Inc. Enterprise Application Framework
// source code in whole or part by other than Youngsoft, Inc. is prohibited.
/////////////////////////////////////////////////////////////////////////////////// 

constant string METHOD_NAME = "constructor "

//create constants object
inv_constants = create n_cst_constants

//create the message service
inv_messaging = create n_cst_messageservice

//Define logging service implementation class
defineLoggingService()

//Create and initialize the logging service
inv_log = create using is_loggingservice
inv_log.setRequestor(this)
inv_log.populateSettings()

inv_log.traceLog (METHOD_NAME, "")

//Get debug settings and propagate to component
//Primarily to support previous versions and code that rely upon the instance variables
setDebug( inv_log.getDebug() )
setTrace( inv_log.getTrace() )
setDetailed( inv_log.getDetailed() )
setWarning( inv_log.getWarning() )
setUseDatabaseLogging( inv_log.getUseDatabaseLogging() )

//create object helper
inv_objecthelper = create n_cst_objectservice
inv_log.propagateSettings( inv_objecthelper )

// If the MessageManager is not available, build the possible Object Message List
If Not inv_objecthelper.isMessageManagerAvailable() Then
   this.buildMessageList()
End If   

Return 
end event

event destructor;///////////////////////////////////////////////////////////////////////////////////
// Description:
//    Destructor processing
// Revisions
//    1.0   - Initial version
// Arguments:  
//    None
// Returns: 
//    None
///////////////////////////////////////////////////////////////////////////////////
// Copyright © 2000 - 2007 Youngsoft, Inc.  All rights reserved.
// Any distribution of the Youngsoft, Inc. Enterprise Application Framework
// source code in whole or part by other than Youngsoft, Inc. is prohibited.
/////////////////////////////////////////////////////////////////////////////////// 

constant string METHOD_NAME = "destructor "

if isValid( inv_constants ) then
   destroy inv_constants
end if

if isValid( inv_objecthelper ) then
   destroy inv_objecthelper
end if

if isValid( inv_log ) then
   destroy inv_log
end if

if isValid( inv_messaging ) then
   destroy inv_messaging
end if

Return


end event