This chapter lists and describes the Java hooks available for the Oracle Communications Offline Mediation Controller suspense handling.
Java hooks are an advanced feature of NPL (Node Programming Language) that make it possible to call a Java method from an NPL program. For more information on using Java hooks with NPL, see the discussion on Java hooks in Offline Mediation Controller Cartridge Development Kit NPL Reference Guide.
Table 7-1 lists the suspense Java hooks methods.
Table 7-1 Suspense Java Hooks Method Summary
Modifier and Type | Method and Description |
---|---|
|
append(DCFieldContainer in, DCFieldContainer out) Copies to the output record all suspense fields that exist in the input record. |
|
assemble(DCFieldContainer inContainer, DCFieldContainer outContainer, LongField errorCode, StringField pipelineName, StringField pipelineCategory) Clones the input record to the output record, adding the suspense fields. |
|
assemble(DCFieldContainer inContainer, DCFieldContainer outContainer, LongField errorCode, StringField pipelineName, StringField pipelineCategory, StringField sourceFileName, StringField serviceCode) Clones the input record to the output record, adding the suspense fields. |
|
assemble(DCFieldContainer out, StringField sourceFileName, StringField pipelineName, LongField errorCode) Adds to the output record the suspense fields and their values. |
|
assemble(DCFieldContainer out, StringField sourceFileName, StringField pipelineName, LongField errorCode, StringField errorDir, StringField errorFileName) Adds to the output record the suspense fields and their values. |
|
assemble(DCFieldContainer out, StringField sourceFileName, StringField pipelineName, LongField errorCode, StringField errorDir, StringField errorFileName, StringField sender, StringField batchId, StringField sequenceNumber, StringField tapInfo, StringField pipelineCategory) Adds to the output record the suspense fields and their values. |
|
bytesAsString(BytesField inputBytes) Converts the given BytesField to StringField. The StringField return value contains a string of hex byte values. |
|
exists(DCFieldContainer container) If 1 or more key suspense fields exist in the given record, returns true (1). |
|
float2int(FloatField fd) throws NDKException Converts the given FloatField to an IntField. Note that data may be truncated. |
|
float2long(FloatField fd) throws NDKException Converts the given FloatField to a LongtField. Note that data may be truncated. |
|
get3GPPTimeStamp(BytesField threeGPPDateField) Converts the BytesField of a byte array containing date in yyMMddhhmmss format to StringField of timestamp in seconds. |
|
get3GPPTimeStamp(BytesField threeGPPDateField, StringField dateFormat) Converts the BytesField of a byte array containing date in yyMMddhhmmss format to StringField of timestamp in the given date format. |
|
get3GPPTimeStamp(LongField timestampInSecs) Converts the given LongField containing the timestamp in seconds into BytesField of a byte array containing date in yyMMddhhmmss format. |
|
getDurationInSeconds(StringField startDate, StringField endDate) Returns the StringField containing the absolute long value of duration in seconds between the two given dates both in "yyyy-MM-dd HH:mm:ss" format. |
|
getDurationInSeconds(StringField startDate, StringField endDate, StringField dateFormat) Returns the StringField containing the absolute long value of duration in seconds between the two given the date format. |
|
getValue(ListField list, StringField mapName, StringField fieldName) Returns the value for the first fieldName found directly tied to the given ListField or in the first map found in the ListField. |
|
getValue(ListField list, StringField mapName, StringField fieldName, StringField defaultValue) Returns the value for the first fieldName found directly tied to the given ListField, in the first map found in the ListField, or the given default value. |
|
getValue(MapField mapField, StringField fieldName) Returns the value for the given field tied to the MapField. |
|
getValue(MapField mapField, StringField fieldName, StringField defaultValue) Returns the value for the given field tied to the MapField or the given default value. |
LongField |
getValueSum(ListField listField, StringField mapName, StringField fieldname) Returns the sum in long of the values found for all the named field under the named map in the ListField. The sum is returned as a long, 0 is the default. |
|
int2float(IntField intd) throws NDKException Converts the given IntField to a FloatField. |
|
isRecycled(DCFieldContainer container) If the DETAIL:ASS_SUSPENSE_EXT:SUSPENSE_ID field is found in the given record and its value is greater than 0, returns true (1). |
FloatField |
long2float(DCFieldContainer container) Converts the given LongField to a FloatField. |
|
makeField(StringField listName, StringField mapName, StringField fieldName, DCField field) Creates the named ListField and the new field to a new MapField created for it. |
|
makeField(StringField mapName, StringField fieldName, DCField field) Creates the named MapField and adds the new field to it. |
|
move(StringField sourceDir, StringField sourcePrefix, StringField sourceSuffix, StringField targetDir, StringField targetPrefix, StringField targetSuffix) throws Exception. Moves file(s) matching specified patterns from source directory to the target directory. |
|
move(StringField sourceFileWithFullPath, StringField targetFileWithFullPath) throws Exception. Moves source file with full path to the target file with full path. |
|
setValue(ListField list, StringField mapName, StringField fieldName, DCField field) throws NDKException Adds or updates a field directly tied to the given ListField or to a map of the given ListField. The ListField must exist, use Boolean fieldExists(OutputRec rec, String fieldID) to check for existence. |
|
setValue(MapField mapField, StringField fieldName, DCField field) throws NDKException Adds or updates the field in the MapField. The MapField must exist, use Boolean fieldExists(OutputRec rec, String fieldID) to check for existence. |
|
stringAsBytes(StringField inputString) Converts the given StringField containing a string of hex byte values to a BytesField, which is returned. |
The section describes the suspense Java hook methods.
public void append(DCFieldContainer in, DCFieldContainer out)
Copies all existing suspense fields from the input field to the output record. Fields that already exist in the output record are not overwritten.
Copying all the existing suspense fields, proceeds only if the exists(in) method returns a true value, which indicates that one or more key suspense fields exist.
in - the input record.
out - the output record.
public void assemble(DCFieldContainer inContainer, DCFieldContainer outContainer, LongField errorCode, StringField pipelineName, StringField pipelineCategory) throws Exception
Clones input record to output record and adds to the output record the following fields:
* DETAIL:ASS_SUSPENSE_EXT:ERROR_CODE
* DETAIL:ASS_SUSPENSE_EXT:PIPELINE_NAME
* DETAIL:ASS_SUSPENSE_EXT:PIPELINE_CATEGORY
This method is equivalent to writing the following statements in NPL:
out=clone(in);
out.DETAIL:ASS_SUSPENSE_EXT:ERROR_CODE=<error code>;
out.DETAIL:ASS_SUSPENSE_EXT:PIPELINE_NAME=<pipeline name>;
out.DETAIL:ASS_SUSPENSE_EXT:PIPELINE_CATEGORY=<pipeline category>;
Note:
Fields existing in the outContainer are replaced or removed as a result of the clone operation.Both input record and output record must be in NAR format, otherwise an exception is thrown, the statement that contains the function call is skipped, and execution will continue with the next statement in the NPL program.
A warning is written to the node's log file if the node's configured debug level is set at the logging warnings level.
inContainer - the input record, which must be in NAR format.
outContainer - the output record, which must be in the NAR format.
errorCode - the error code to be added to the output record.
pipelineName - the cartridge name/ID that detects the error and suspends the input record.
pipelineCategory - the group name in which the cartridge that initiates the suspense belongs.
Exception - if the input record or the output record is not in NAR format.
public void assemble(DCFieldContainer inContainer, DCFieldContainer outContainer, LongField errorCode, StringField pipelineName, StringField pipelineCategory, StringField sourceFileName, StringField serviceCode) throws Exception
Clones input a record to an output record, and adds to the output record the following fields:
* DETAIL:ASS_SUSPENSE_EXT:ERROR_CODE
* DETAIL:ASS_SUSPENSE_EXT:PIPELINE_NAME
* DETAIL:ASS_SUSPENSE_EXT:PIPELINE_CATEGORY
* DETAIL:ASS_SUSPENSE_EXT:SOURCE_FILENAME
* DETAIL:ASS_SUSPENSE_EXT:SERVICE_CODE
This method is equivalent to writing the following statements in NPL:
out=clone(in);
out.DETAIL:ASS_SUSPENSE_EXT:ERROR_CODE=<error code>;
out.DETAIL:ASS_SUSPENSE_EXT:PIPELINE_NAME=<pipeline name>;
out.DETAIL:ASS_SUSPENSE_EXT:PIPELINE_CATEGORY=<pipeline category>;
out.DETAIL:ASS_SUSPENSE_EXT:SOURCE_FILENAME=<source_filename>;
out.DETAIL:ASS_SUSPENSE_EXT:SERVICE_CODE=<service_code>;
Note:
Fields existing in the outContainer are replaced or removed as a result of the clone operation.Both the input record and output record must be in NAR format, or an exception is thrown, the statement that contains the function call is skipped, and processing will continue with the next statement in the NPL program.
A warning is written to the node's log file if the node's configured debug level is set at the logging warnings level.
inContainer - the input record, which must be in NAR format.
outContainer - the output record, which must be in the NAR format.
errorCode - the error code, which is added to the output record.
pipelineName - the cartridge names ID that detects the error and suspends the input record.
pipelineCategory - the group name in which the cartridge that initiates the suspense belongs.
sourceFileName - the input source file name for the suspended CDR.
serviceCode - the service code for the suspended record CDR.
Exception - if the input record or the output record is not in NAR format.
public void assemble(DCFieldContainer out, StringField sourceFileName, StringField pipelineName, LongField errorCode)
Adds to output record the following fields with the given values:
* DETAIL:ASS_SUSPENSE_EXT:SOURCE_FILENAME
* DETAIL:ASS_SUSPENSE_EXT:PIPELINE_NAME
* DETAIL:ASS_SUSPENSE_EXT:ERROR_CODE
Existing values are overwritten if the field already exists in the output record.
out - the output record.
sourceFileName - the input source file that is suspended.
pipelineName - the cartridge name/ID that detects the error and suspends the input record.
errorCode - the error code to be added to the output record.
public void assemble(DCFieldContainer out, String sourceFileName, String pipelineName, long errorCode, String errorDir, String errorFileName)
Adds to output record the following fields with the given values:
* DETAIL:ASS_SUSPENSE_EXT:SOURCE_FILENAME
* DETAIL:ASS_SUSPENSE_EXT:PIPELINE_NAME
* DETAIL:ASS_SUSPENSE_EXT:ERROR_CODE
* DETAIL:ASS_SUSPENSE_EXT:ERROR_PATH
* DETAIL:ASS_SUSPENSE_EXT:ERROR_FILENAME
Existing values are overwritten if the field already exists in the output record.
out - the output record.
sourceFileName - the input source file that is suspended.
pipelineName - the cartridge name/ID that detects the error and suspends the input record.
errorCode - the error code to be added to the output record.
errorDir - the directory path where the suspended files are located.
errorFileName - the error filename.
public void assemble(DCFieldContainer out, StringField sourceFileName, StringField pipelineName, LongField errorCode, StringField errorDir, StringField errorFileName, StringField sender, StringField batchId, StringField sequenceNumber, StringField tapInfo, StringField pipelineCategory)
Adds to output record the following fields with the given values:
* DETAIL:ASS_SUSPENSE_EXT:SOURCE_FILENAME
* DETAIL:ASS_SUSPENSE_EXT:PIPELINE_NAME
* DETAIL:ASS_SUSPENSE_EXT:ERROR_CODE
* DETAIL:ASS_SUSPENSE_EXT:ERROR_PATH
* DETAIL:ASS_SUSPENSE_EXT:ERROR_FILENAME
*HEADER:SENDER
*HEADER:BATCH_ID
*HEADER:SEQUENCE_NUMBER
*HEADER:TAP_PROCESSING_INFO
*DETAIL:ASS_SUSPENSE_EXT:PIPELINE_CATEGORY
Existing values are overwritten if the field already exists in the output record.
out - the output record.
sourceFileName - the suspended input source file.
pipelineName - the cartridge name/ID that detects the error and suspends the input record.
errorCode - the error code, which is added to the output record.
errorDir - the directory path where the suspended files are located.
errorFileName - the error filename.
sender - the sender of the input source file.
batchId - the batch ID assigned with this suspension.
sequenceNumber - the sequence number associated with the suspended file.
tapInfo - the TAP processing information.
pipelineCategory - the group name in which the cartridge that initiates the suspense belongs.
public StringField bytesAsString(BytesField inputBytes)
Converts the given BytesField to StringField, containing a string of hex byte values, which is returned.
inputBytes - the BytesField containing the byte array, which is converted to a string.
The conversion resulted string in StringField.
public IntField exists(DCFieldContainer container)
Returns true (1) if 1 or more key suspense fields exist in the given record.
* DETAIL:ASS_SUSPENSE_EXT:SUSPENSE_ID
* DETAIL:ASS_SUSPENSE_EXT:ERROR_CODE
* DETAIL:ASS_SUSPENSE_EXT:SUSPENSE_STATUS
container - the record to check.
true if one of the above suspense fields is found in the given record.
public IntField float2int(FloatField fd) throws NDKException
Converts the given FloatField to an IntField. Note that data may be truncated.
fd - The FloatField to be converted from a float to an integer.
The conversion resulted integer in IntField.
NDKException.
public LongField float2long(FloatField fd) throws NDKException
Converts the given FloatField to a LongField. Note that data may be truncated.
fd - the FloatField to be converted from a float to a long.
The conversion resulted long in LongField.
NDKException.
public StringField get3GPPTimeStamp(BytesField threeGPPDateField)
Converts the BytesField of a byte array containing the date in yyMMddhhmmss format to StringField of timestamp in seconds.
The following example shows the DETAIL:CHARGING_START_TIMESTAMP is set to the timestamp in seconds converted from ServiceDeliveryStartTimeStamp:
out.DETAIL:CHARGING_START_TIMESTAMP=str2long(suspHandler.get3GPPTimeStamp(in.ServiceDeliveryStartTimeStamp));
threeGPPDateField - the BytesField containing date in yyMMddhhmmss format.
StringField containing time in seconds, which can be converted into a long.
public StringField get3GPPTimeStamp(BytesField threeGPPDateField, StringField dateFormat)
Converts the BytesField of a byte array containing the date in yyMMddhhmmss format to StringField of timestamp in the given date format.
The following example shows how to log an entry by printing ServiceDeliveryStartTimeStamp as a string in yyyy-MM-dd HH:mm:ss date format:
logInfo("StartDate="+suspHandler.get3GPPTimeStamp(in.ServiceDeliveryStartTimeStamp, "yyyy-MM-dd HH:mm:ss"));
threeGPPDateField - the BytesField containing the date in yyMMddhhmmss format.
dateFormat - a date format according to the Java documentation of the time pattern format syntax for the SimpleDateFormat class.
For example, yyyy-MM-dd HH:mm:ss.
Use "" (blank) to get the timestamp in seconds without the date format, which is equivalent to get3GPPTimeStamp(BytesFieldthreeGPPDateField)
StringField containing date in the given format.
public BytesField get3GPPTimeStamp(LongField timestampInSecs)
Converts the given LongField containing the timestamp in seconds into BytesField of a byte array containing the date in yyMMddhhmmss format.
The following example shows the BytesField named ServiceDeliveryStartTimeStamp is set to the LongField DETAIL:CHARGING_START_TIMESTAMP, converted to a byte array containing the date in yyMMddhhmmss format:
out.ServiceDeliveryStartTimeStamp=suspHandler.get3GPPTimeStamp(in.DETAIL:CHARGING_START_TIMESTAMP);
timestampInSecs - the given LongField, which is the timestamp in seconds.
BytesField of a byte array containing date in yyMMddhhmmss format.
public StringField getDurationInSeconds(StringField startDate, StringField endDate)
Returns the StringField containing the absolute long value of duration in seconds between the two given dates, both in "yyyy-MM-dd HH:mm:ss" format.
The following example shows how to log an entry for the duration between ServiceDeliveryStartTimeStamp and ServiceDeliveryEndTimeStamp:
logInfo("Duration="+suspHandler.getDurationInSeconds( suspHandler.get3GPPTimeStamp(in.ServiceDeliveryStartTimeStamp), suspHandler.get3GPPTimeStamp(in.ServiceDeliveryEndTimeStamp)));
startDate - the given start date.
endDate - the given end date.
StringField containing the long value of duration between startDate and endDate, both in "yyyy-MM-dd HH:mm:ss" format.
StringField containing the long value of duration between startDate and endDate in the given format.
public StringField getDurationInSeconds(StringField startDate, StringField endDate, StringField dateFormat)
Returns the StringField containing the absolute long value of duration in seconds between the two given the date format.
The following example shows how to log an entry for the duration between ServiceDeliveryStartTimeStamp and ServiceDeliveryEndTimeStamp:
logInfo("Duration="+suspHandler.getDurationInSeconds( suspHandler.get3GPPTimeStamp(in.ServiceDeliveryEndTimeStamp, "yyyy-MM-dd HH:mm:ss"), suspHandler.get3GPPTimeStamp(in.ServiceDeliveryStartTimeStamp, "yyyy-MM-dd HH:mm:ss"), "yyyy-MM-dd HH:mm:ss"));
startDate - the given start date.
endDate - the given end date.
dateFormat - the date format for the two dates.
StringField containing the long value of duration between startDate and endDate in the given format.
public StringField getValue(ListField list, StringField mapName, StringField fieldName)
Returns the value for the first fieldName found directly tied to the given ListField or in the first map found in the ListField.
The following example shows the DETAIL:A_NUMBER is set to the value of SIP_URI field or TEL_URI fields in any MapField under ListField named List_Of_Calling_Party_Address:
out.DETAIL:A_NUMBER=suspHandler.getValue(in.List_Of_Calling_Party_Address,"*","SIP_URI,TEL_URI");
list - the ListField in which fieldName is searched and a value returned.
mapName - the map name directly under the list.
Multiple map names may be entered, delimited by a comma. The first matched map is used to find the matching fieldName.
Use "*" for the first map found.
Use "" for the field directly tied to the list without a map.
fieldName - the field name where the value is returned.
Multiple field names may be entered, delimited by comma. The first value for the fieldName found is returned.
The String value associated with the field name.
An empty string ("") is returned if the field is not found.
public StringField getValue(ListField list, StringField mapName, StringField fieldName, StringField defaultValue)
Returns the value for the first fieldName found directly tied to the given ListField, in the first map found in the ListField, or the given default value
The following example shows the DETAIL:VOLUME_SENT is set to the value of Content_Length field in any MapField under ListField named List_Of_Message_Bodies, given the default value of 0:
out.DETAIL:VOLUME_SENT=str2float(suspHandler.getValue(in.List_Of_Message_Bodies, "*", "Content_Length","0"));
list - the ListField in which fieldName is searched and a value returned.
mapName - the map name directly under the list.
Multiple map names may be entered, delimited by a comma. The first matched map is used to find the matching fieldName.
Use "*" for the first map found.
Use "" for the field directly tied to the list without a map.
fieldName - the field name in which the value is returned.
Multiple field names may be entered, delimited by comma. The first value for the fieldName found is returned.
defaultValue - the value to return if fieldName is not found.
The String value associated with the field name or the given default value if fieldName is not found.
public StringField getValue(MapField mapField, StringField fieldName)
Returns the value for the given field tied to the MapField.
The following example shows DETAIL:B_NUMBER is set to the value of SIP_URI or TEL_URL fields in the MapField named Called_Party_Address:
out.DETAIL:B_NUMBER=suspHandler.getValue(in.Called_Party_Address,"SIP_URI,TEL_URI");
mapField - the MapField in which the value for the given fieldName is to be found.
fieldName - the field name for which the value is to be returned.
Multiple field names may be entered, delimited by comma. The first value for the fieldName found is returned.
The String value associated with the field name.
An empty string ("") is returned if the field is not found.
public StringField getValue(MapField mapField, StringField fieldName, StringField defaultValue)
Returns the value for the given field tied to the MapField or the given value.
The following example shows DETAIL:B_NUMBER is set to the value of TEL_URL fields in the MapField named Called_Party_Address, given the default value of 9990000:
out.DETAIL:B_NUMBER=suspHandler.getValue(in.Called_Party_Address,"TEL_URI", "9990000");
mapField - the MapField in which the value for the given fieldName is to be found.
fieldName - the field name for which the value is to be returned.
Multiple field names may be entered, delimited by a comma. The first value for the fieldName found is returned.
defaultValue - the value to return if fieldName is not found.
The String value associated with the field name or the default value if fieldName is not found.
public LongField getValueSum(ListField list, StringField mapName, StringField fieldName)
Returns the sum in long of the values found for all the named field under the named map in the ListField. The sum is returned as a long, 0 is the default.
The following example shows DETAIL:VOLUME_SENT is set to the sum of the value of all DataVolumeGPRSUplink fields of any MapField in ListField 20209:
out.DETAIL:VOLUME_SENT = suspHandler.long2float(suspHandler.getValueSum(in.20209, "*", "DataVolumeGPRSUplink"));
list - the ListField in which fieldName is searched and value returned.
mapName - The name of the map to which the field is tied.
Use "*" for the first map found in the ListField.
Use "" for the field directly tied to the list without a map.
fieldName - the named field. The type of the field for the given fieldName must be of long, int, or short to be summed.
The sum in long of the values found for all the named field.
public FloatField int2float(IntField intd) throws NDKException
Converts the given IntField to a FloatField.
intd - The IntField to be converted from an integer to a float.
The conversion resulted float in FloatField.
NDKException.
public IntField isRecycled(DCFieldContainer container)
Returns true (1) if DETAIL:ASS_SUSPENSE_EXT:SUSPENSE_ID field is found in the given record and its value is greater than 0.
container - the record to check.
True (1) if DETAIL:ASS_SUSPENSE_EXT:SUSPENSE_ID field exists and its value is greater than 0. Else, false.
public FloatField long2float(LongField longfd) throws NDKException
Converts the given LongField to a FloatField.
longfd - The LongField to be converted from an long to a float.
The conversion resulted float in FloatField.
NDKException.
public ListField makeField(StringField listName, StringField mapName, StringField fieldName, DCField field)
Creates the named ListField and the new field to a new MapField created for it.
The following example shows that a ListField named "List_Of_Calling_Party_Address" is to be created with a MapField with no name to which a new field TEL_URI is created with data type and value from TEL_URI:
out.List_Of_Calling_Party_Address=suspHandler.makeField("List_Of_Calling_Party_Address", "*", "TEL_URI", TEL_URI);
listName - the name of the ListField to create.
mapName - the map name for the new map. Use "*" or "" for map of no name.
fieldName - the field name of the new field to create and add to the map.
field - the DCField that contains the field type and field value for the named field.
The ListField created.
public MapField makeField(StringField mapName, StringField fieldName, DCField field)
Creates the named MapField and adds the new field to it.
The following example shows that the MapField Called_Party_Address is created and the field TEL_URI is added to it. The data type and value is given in TEL_URL:
out.Called_Party_Address=suspHandler.makeField("Called_Party_Address", "TEL_URI", TEL_URI);
mapName - the map name for the new map. Use "*" or "" for map of no name.
fieldName - the field name of the new field to create and add to the map.
field - the DCField that contains the field type and field value for the named field.
The MapField created.
public IntField move(String sourceDir, String sourcePrefix, String sourceSuffix, String targetDir, String targetPrefix, String targetSuffix) throws Exception
Moves files in sourceDir having sourcePrefix and sourceSuffix to targetDir replacing file names with targetPrefix and targetSuffix.
Ordinary files are moved, but not directories. The number of files moved (and renamed) is returned.
If the target file exists, it is replaced with a delete before the file move.
Note:
This method uses Java File.renameTo(File) so its limitation is inherent.In the example below, n=move("/home/pin", "my_", "txt", "/tmp", "err_", "bad"), where n=2
ls /home/pin my_file101.txt my_file102.txt web/ (after the move) ls /home/pin web/ ls /tmp err_file101.bad err_file102.bad
sourceDir - the source directory from where files are to be moved.
sourcePrefix - the beginning string to match the source file name for move.
sourceSuffix - the ending string to match the source file name for move.
targetDir - the destination directory to where files are moved.
targetPrefix - the string to add at the beginning of the target file name.
targetSuffix - the string to append at the end of the target file name.
The number of files moved.
Exception - if the specified directories are not valid, the source directory is not readable, target directory is not writable, or when the existing target file cannot be replaced.
public IntField move(String sourceFileWithFullPath, String targetFileWithFullPath) throws Exception
Moves the source file with full path to the target file with full path.
If the target file exists, it is deleted before the file is moved. The number of files moved is returned, that is, 1 if successful, else 0.
Note:
This method uses Java File.renameTo(File) so its limitation is inherent.sourceFileWithFullPath - the full path of the source file to be moved (renamed).
targetFileWithFullPath - the full path of the target file.
1 if move was successful, else returns 0.
Exception - if either file is invalid, the source file is not found, or when the existing target file cannot be replaced.
public ListField setValue(ListField list, StringField mapName, StringField fieldName, DCField field) throws NDKException
Adds or updates a field directly tied to the given ListField or to a map of the given ListField.
The ListField must exist. Use Boolean fieldExists(OutputRec rec, String fieldID) to check for existence.
The following example shows that ListField InterOperatorIdentifiers is updated where OriginatingIOI field in MapField InterOperatorIdentifiers is set to the value of OperatorID, if OriginatingIOI field does not exist, it is added:
out.InterOperatorIdentifiers=suspHandler.setValue(out.InterOperatorIdentifiers, "InterOperatorIdentifiers", "OriginatingIOI", OperatorID);
Example below shows how to update or create ListField:
if (fieldExists(out, "InterOperatorIdentifiers")) { out.InterOperatorIdentifiers=suspHandler.setValue(out.InterOperatorIdentifiers, "InterOperatorIdentifiers", "OriginatingIOI", OperatorID); } else { out.InterOperatorIdentifiers=suspHandler.makeField("InterOperatorIdentifiers", "InterOperatorIdentifiers", "OriginatingIOI", OperatorID); }
listField - the listField to which the field is directly tied or the map of which the field is a member.
mapName - the name of the map to which the field is tied.
Use "*" for the first map found.
Use "" for the field directly tied to the list without a map.
fieldName - the name of the field to add or update.
field - the DCField that contains the field type and field value for the named field.
The updated ListField.
NDKException
public MapField setValue(MapField mapField, StringField fieldName, DCField field) throws NDKException
Adds or updates the field in the MapField.
The MapField must exist, use Boolean fieldExists(OutputRec rec, String fieldID) to check for existence.
In the following example, MapField Called_Party_Address is updated, and the TEL_URI field is set to the value of DETAIL:A_NUMBER. If the TEL_URI field does not exist, it is added:
out.Called_Party_Address=suspHandler.setValue(out.Called_Party_Address, "TEL_URI", in.DETAIL:A_NUMBER);
mapField - the MapField to which field will be added or updated with the field and value given.
fieldName - the name of the field to add or update.
field - the DCField that contains the field type and field value for the named field.
The updated MapField.
NDKException
public BytesField stringAsBytes(StringField inputString)
Converts the given StringField containing a string of hex byte values to a BytesField, which is returned.
inputString - the StringField containing a string of hex byte values, which are converted to a byte array.
The conversion resulted byte array in the BytesField.