Class JCoHelper
java.lang.Object
de.hybris.platform.sap.core.bol.backend.jco.JCoHelper
Convenience class for the management of JCo. The implementation of JCo is sometimes a little bit low level for the
purposes of the internet sales application. Because of this the
JCoHelper class provides some helper
classes and convenience methods to simplify the handling of JCo and especially its data structures.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classWraps around a JCo record and decorates the record with convenient methods to set the record's data.static classRepresents the data returned by a call to the function module. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleangetBoolean(com.sap.conn.jco.JCoField field) Converts the ABAP logic for booleans,"" = false,"X" = trueinto a Java boolean.static booleangetBoolean(com.sap.conn.jco.JCoRecord record, String field) Converts the ABAP logic for booleans,"" = false,"X" = trueinto a Java boolean.static booleangetBoolean(String string) Converts the ABAP logic for booleans,"" = false,"X" = trueinto a Java boolean.static DateReturns the specified field of a JCo record converted to a date.static StringgetExceptionGroupAsString(com.sap.conn.jco.JCoException jcoEx) Returns the group of the JCOException as a String.static StringReturns the specified field of a JCo record converted to a string.static StringgetStringFromNUMC(com.sap.conn.jco.JCoRecord record, String field) Converts an ABAP NUMC data type to an String which means it's trims all leading zeros.static StringgetStringFromRaw(com.sap.conn.jco.JCoRecord record, String field) Returns the specified raw field of a JCo record converted to a string.static StringgetStringPerfOpt(com.sap.conn.jco.JCoRecord jcoRecord, String arg0) This methods avoids creation of independent copies of "" in order to save memory.static TechKeygetTechKey(com.sap.conn.jco.JCoRecord record, String field) Converts a technical key stored in a JCo record into an object of typeTechKey.static TechKeygetTechKeyFromRaw(com.sap.conn.jco.JCoRecord record, String field) Converts a technical key stored in a JCo record as raw value into an object of typeTechKey.static StringHelper for String-formatting Returns a String filled up to the left with filler up to the length len.protected static voidLogs a RFC-call into the log file of the application.static voidlogCall(String functionName, com.sap.conn.jco.JCoRecord input, com.sap.conn.jco.JCoRecord output, org.apache.log4j.Logger log) Logs a RFC-call into the log file of the application.protected static voidLogs a RFC-call into the log file of the application.static voidlogCall(String functionName, com.sap.conn.jco.JCoTable input, com.sap.conn.jco.JCoTable output, Log4JWrapper log) Logs a RFC-call into the log file of the application.protected static voidlogCall(String functionName, JCoHelper.RecordWrapper input, JCoHelper.RecordWrapper output) Logs a RFC-call into the log file of the application.static voidlogCall(String functionName, JCoHelper.RecordWrapper input, JCoHelper.RecordWrapper output, org.apache.log4j.Logger log) Logs a RFC-call into the log file of the application.static voidlogCall(String functionName, String marker, com.sap.conn.jco.JCoTable table, String[] obfuscatedColumns, org.apache.log4j.Logger log) Logs a RFC-call into the log file of the application.protected static voidlogException(String functionName, com.sap.conn.jco.JCoException ex) Log an exception with level ERROR.static StringObfuscate string value.static voidSets the given field of the JCo structure to the provided value.static voidSets the given field of the JCo structure to the provided value.static voidSets the given field of the JCo structure to the provided value.static voidSets the given field of the JCo structure to the provided value.static voidSets the given field of the JCo structure to the provided value.static voidsetValueAsRaw(com.sap.conn.jco.JCoRecord record, TechKey value, String field) Sets the given string field of the JCo structure to the provided value as Raw, that means the value is converted into a byte Array.static voidsetValueAsRaw(com.sap.conn.jco.JCoRecord record, String value, String field) Sets the given string field of the JCo structure to the provided value as Raw, that means the value is converted into a byte Array.
-
Constructor Details
-
JCoHelper
public JCoHelper()
-
-
Method Details
-
lFillStr
Helper for String-formatting Returns a String filled up to the left with filler up to the length len.- Parameters:
src- the sourcefiller- the fillerlen- the length- Returns:
- newStr
-
getExceptionGroupAsString
Returns the group of the JCOException as a String.- Parameters:
jcoEx- the JCO exception- Returns:
- string describing the group of the exception
-
getBoolean
Converts the ABAP logic for booleans,"" = false,"X" = trueinto a Java boolean. Instead of using this method, you may want to use theWrapperclass. The use of this method is only helpful, if you want to convert a limited amount of fields, mostly booleans.- Parameters:
string- String to be converted into a boolean- Returns:
falseif the string is empty, otherwisetrue.
-
getBoolean
public static boolean getBoolean(com.sap.conn.jco.JCoField field) Converts the ABAP logic for booleans,"" = false,"X" = trueinto a Java boolean. Instead of using this method, you may want to use theWrapperclass. The use of this method is only helpful, if you want to convert a limited amount of fields, mostly booleans.- Parameters:
field- JCO.Field to be converted into a boolean- Returns:
falseif the string is empty, otherwisetrue.
-
getBoolean
Converts the ABAP logic for booleans,"" = false,"X" = trueinto a Java boolean. Instead of using this method, you may want to use theWrapperclass. The use of this method is only helpful, if you want to convert a limited amount of fields, mostly booleans.- Parameters:
record- JCO.Record containing the column to be converted into a booleanfield- Name of the column to be converted- Returns:
falseif the string is empty, otherwisetrue.
-
getString
Returns the specified field of a JCo record converted to a string.- Parameters:
record- JCO.Record containing the column to be converted into a Stringfield- Name of the column to be converted- Returns:
- The value as String
-
getStringFromRaw
Returns the specified raw field of a JCo record converted to a string.- Parameters:
record- JCO.Record containing the column to be converted into a Stringfield- Name of the column to be converted- Returns:
- The value as String
-
getDate
Returns the specified field of a JCo record converted to a date.- Parameters:
record- JCO.Record containing the column to be converted into a Datefield- Name of the column to be converted- Returns:
- The value as Date
-
getTechKey
Converts a technical key stored in a JCo record into an object of typeTechKey. The use of this method is only helpful, if you want to convert a limited amount of fields, mostly booleans.- Parameters:
record- JCO.Record containing the column to be converted into a technical key. If this parameter isnullthe method returnsnullfield- Name of the column to be converted- Returns:
- a technical key for the specified column.
-
getTechKeyFromRaw
Converts a technical key stored in a JCo record as raw value into an object of typeTechKey. T- Parameters:
record- JCO.Record containing the column to be converted into a technical key. If this parameter isnullthe method returnsnullfield- Name of the column to be converted- Returns:
- a technical key for the specified column.
-
setValue
Sets the given field of the JCo structure to the provided value.- Parameters:
record- The JCo record to work withvalue- Value to be setfield- JCo field to be filled with the value
-
setValue
Sets the given field of the JCo structure to the provided value.- Parameters:
record- The JCo record to work withvalue- Value to be setfield- JCo field to be filled with the value
-
setValueAsRaw
Sets the given string field of the JCo structure to the provided value as Raw, that means the value is converted into a byte Array.- Parameters:
record- The JCo record to work withvalue- Value to be setfield- JCo field to be filled with the value
-
setValue
Sets the given field of the JCo structure to the provided value.- Parameters:
record- The JCo record to work withvalue- Value to be setfield- JCo field to be filled with the value
-
setValue
Sets the given field of the JCo structure to the provided value.- Parameters:
record- The JCo record to work withvalue- Value to be setfield- JCo field to be filled with the value
-
setValue
Sets the given field of the JCo structure to the provided value. If the provided tech key isnullnothing is done and the method returns immediately.- Parameters:
record- The JCo record to work withvalue- Value to be setfield- JCo field to be filled with the value
-
setValueAsRaw
Sets the given string field of the JCo structure to the provided value as Raw, that means the value is converted into a byte Array. If the provided tech key isnullnothing is done and the method returns immediately.- Parameters:
record- The JCo record to work withvalue- Value to be setfield- JCo field to be filled with the value
-
getStringFromNUMC
Converts an ABAP NUMC data type to an String which means it's trims all leading zeros.- Parameters:
record- the JCo record to extract field fromfield- the name of the field that should be extracted from the record- Returns:
- the trimed string
-
logCall
public static void logCall(String functionName, com.sap.conn.jco.JCoRecord input, com.sap.conn.jco.JCoRecord output, org.apache.log4j.Logger log) Logs a RFC-call into the log file of the application.- Parameters:
functionName- the name of the JCo function that was executedinput- input data for the function module. You may set this parameter tonullif you don't have any data to be logged.output- output data for the function module. You may set this parameter tonullif you don't have any data to be logged.log- the logging context to be used
-
logCall
public static void logCall(String functionName, JCoHelper.RecordWrapper input, JCoHelper.RecordWrapper output, org.apache.log4j.Logger log) Logs a RFC-call into the log file of the application.- Parameters:
functionName- the name of the JCo function that was executedinput- input data for the function module. You may set this parameter tonullif you don't have any data to be logged.output- output data for the function module. You may set this parameter tonullif you don't have any data to be logged.log- the logging context to be used
-
logCall
public static void logCall(String functionName, com.sap.conn.jco.JCoTable input, com.sap.conn.jco.JCoTable output, Log4JWrapper log) Logs a RFC-call into the log file of the application.- Parameters:
functionName- the name of the JCo function that was executedinput- input data for the function module. You may set this parameter tonullif you don't have any data to be logged.output- output data for the function module. You may set this parameter tonullif you don't have any data to be logged.log- the logging context to be used
-
logCall
protected static void logCall(String functionName, com.sap.conn.jco.JCoRecord input, com.sap.conn.jco.JCoRecord output) Logs a RFC-call into the log file of the application.- Parameters:
functionName- the function name to be loggedinput- input recordoutput- output record
-
logCall
protected static void logCall(String functionName, JCoHelper.RecordWrapper input, JCoHelper.RecordWrapper output) Logs a RFC-call into the log file of the application.- Parameters:
functionName- the function name to be loggedinput- input record wrapperoutput- output record wrapper
-
logCall
protected static void logCall(String functionName, com.sap.conn.jco.JCoTable input, com.sap.conn.jco.JCoTable output) Logs a RFC-call into the log file of the application.- Parameters:
functionName- the function name to be loggedinput- input JCo tableoutput- output JCo table
-
logException
Log an exception with level ERROR.- Parameters:
functionName- the function name to be loggedex- the Exception to be logged
-
getStringPerfOpt
This methods avoids creation of independent copies of "" in order to save memory.- Parameters:
jcoRecord- the JCo recordarg0- argument- Returns:
- result
-
obfuscate
Obfuscate string value. String is replaced with a list of "*".- Parameters:
value- the value to be obfuscated- Returns:
- obfuscated value
-
logCall
public static void logCall(String functionName, String marker, com.sap.conn.jco.JCoTable table, String[] obfuscatedColumns, org.apache.log4j.Logger log) Logs a RFC-call into the log file of the application.- Parameters:
functionName- the name of the JCo function that was executedmarker- textual maker to identify a particular loggingtable- input data for the function module. You may set this parameter tonullif you don't have any data to be logged.obfuscatedColumns- columns, values of this columns will be obfuscatedlog- the logging context to be used
-