/** * Generate a message only if the message has not been overridden and has the same severity or * worse than the existing messages * * @param session - the Equation Standard session * @param fms - function messages to add the the new message * @param screenSetId - screen set Id * @param scrnNo - the screen where the message occurred * @param fieldName - the field that generated the message * @param sequence - sequence number * @param fieldData - the field data * @param messageText - the message * @param firstLevelText - text to be appended to the start of messageText * @param secondLevelText - text to be appended to the end of messageText * @param ignoreMessages - the message severity to ignore. All equal/lower message severity will * be ignored * @return the function message added * @throws EQException */ public FunctionMessage generateMessage( EquationStandardSession session, FunctionMessages fms, int screenSetId, int scrnNo, String fieldName, int sequence, FieldData fieldData, String messageText, String firstLevelText, String secondLevelText, int ignoreMessages) throws EQException { // get the message EQMessage eqMessage; try { eqMessage = session.getMessage(messageText); } catch (Exception e) { eqMessage = session.getMessage("KSM7340" + Toolbox.getExceptionMessage(e)); } // generate return generateMessage( fms, screenSetId, scrnNo, fieldName, sequence, fieldData, eqMessage, firstLevelText, secondLevelText, ignoreMessages); }
/** * Check if a message already exists in the list of overridden or displayed messages * * @param screenSetId - screen set Id * @param scrnNo - the screen where the message occurred * @param fieldName - the field that generated the message * @param sequence - sequence number * @param fieldData - the field data * @param eqMessage - the Equation message * @return the Equation message if it it not existing<br> * Otherwise, return NULL * @throws EQException */ public EQMessage chkMessage( int screenSetId, int scrnNo, String fieldName, int sequence, FieldData fieldData, EQMessage eqMessage) { // check the message severity int msgSev = Toolbox.parseInt(eqMessage.getSeverity(), FunctionMessages.MSG_ERROR); // if this is a warning check if it has already been overridden, if is has, then do not issue // this anymore if (msgSev == FunctionMessages.MSG_WARN) { if (overWarnMessages.chkMessageExists( screenSetId, scrnNo, fieldName, sequence, eqMessage.getDsepms())) { return null; } } // if this is an informational message check if it has already been displayed to the user, if it // has, then do not issue // this anymore else if (msgSev == FunctionMessages.MSG_INFO) { if (dispInfoMessages.chkMessageExists( screenSetId, scrnNo, fieldName, sequence, eqMessage.getDsepms())) { return null; } } // not found return eqMessage; }
private void test() { // Have a bash... try { // Create the FUNCTION Function function = new Function(); function.setId("PVJ"); function.setLabel("Prompt and Validate Test Stub"); function.setDescription("Prompt and Validate Test Stub"); // Records DisplayFieldSetWrapper setWrapper = getRecord1(); function.addInputFieldSet(setWrapper.getInputFieldSet()); Layout layout = new Layout(function, setWrapper.getDisplayAttributesSet()); // Print the XML EqBeanFactory beanFactory = EqBeanFactory.getEqBeanFactory(); String serviceXML = beanFactory.serialiseBeanAsXML(function); System.out.println(serviceXML); String layoutXML = beanFactory.serialiseBeanAsXML(layout); System.out.println(layoutXML); // Write to GAXPF XMLToolbox.getXMLToolbox() .writeDefinitionXMLtoDB( session, unit.getKFILLibrary(), GAXRecordDataModel.SERVICE_CODE, function.getId(), Toolbox.formatDate(Calendar.getInstance(), Toolbox.TIMESTAMP_FORMAT), serviceXML); // Write to GBXPF XMLToolbox.getXMLToolbox() .writeDefinitionXMLtoDB( session, unit.getKFILLibrary(), GAXRecordDataModel.LAYOUT_CODE, layout.getId(), Toolbox.formatDate(Calendar.getInstance(), Toolbox.TIMESTAMP_FORMAT), layoutXML); } catch (Exception e) { e.printStackTrace(); } }
/** * Insert messages to the other messages * * @param screenSetId - screen set id * @param scrnNo - screen no * @param ksmId - KSM id * @param msgSev - message severity * @param msgText - message text * @param firstLevelText - text to be appended to the start of messageText * @param secondLevelText - text to be appended to the end of messageText * @return */ public int insertOtherMessage( int screenSetId, int scrnNo, String ksmId, String msgSev, String msgText, String firstLevelText, String secondLevelText) { EQMessage eqMessage = new EQMessage(ksmId, msgSev, msgText, ""); otherMessages.insertMessage( screenSetId, scrnNo, "", 1, eqMessage, firstLevelText, secondLevelText); return Toolbox.parseInt(msgSev, FunctionMessages.MSG_ERROR); }
/** * Generate a message only if the message has not been overridden and has the same severity or * worse than the existing messages * * @param fms - function messages to add the the new message * @param screenSetId - screen set Id * @param scrnNo - the screen where the message occurred * @param fieldName - the field that generated the message * @param sequence - sequence number * @param fieldData - the field data * @param eqMessage - the Equation message * @param firstLevelText - text to be appended to the start of messageText * @param secondLevelText - text to be appended to the end of messageText * @param ignoreMessages - the message severity to ignore. All equal/lower message severity will * be ignored * @return the function message added */ public FunctionMessage generateMessage( FunctionMessages fms, int screenSetId, int scrnNo, String fieldName, int sequence, FieldData fieldData, EQMessage eqMessage, String firstLevelText, String secondLevelText, int ignoreMessages) { // message to be ignored? if (Toolbox.parseInt(eqMessage.getSeverity(), FunctionMessages.MSG_ERROR) <= ignoreMessages) { return null; } // is the message already existing? eqMessage = chkMessage(screenSetId, scrnNo, fieldName, sequence, fieldData, eqMessage); if (eqMessage == null) { return null; } // is the message already exists in the list? if (fms.chkMessageExists(screenSetId, scrnNo, fieldName, sequence, eqMessage.getDsepms())) { return null; } // add the message FunctionMessage fm = fms.insertMessage( screenSetId, scrnNo, fieldName, sequence, eqMessage, firstLevelText, secondLevelText); if (fm == null) { return null; } // add the error message to the field if (fieldData != null) { fieldData .getFunctionMessages() .insertMessage( screenSetId, scrnNo, fieldName, sequence, eqMessage, firstLevelText, secondLevelText); } // message severity return fm; }
public boolean test() { // Have a bash... FunctionHandler functionHandler2 = null; try { // Maintain System.out.println("--------------------------- MA1"); functionHandler2 = FunctionToolboxStub.getFunctionHandler(user, "SESSIONID", ""); functionHandler2.doNewTransaction("MA1", ""); FunctionData functionData2 = functionHandler2.getFhd().getScreenSetHandler().rtvScrnSetCurrent().getFunctionData(); functionData2.chgFieldInputValue("MAB_AB", "0000"); functionData2.chgFieldInputValue("MAB_AN", "0000001"); functionData2.chgFieldInputValue("MAB_AS", "001"); functionHandler2.applyRetrieveTransaction(); functionHandler2.applyTransaction(); Toolbox.printList(functionHandler2.print()); FunctionToolboxStub.printMessages(functionHandler2.rtvFunctionMessages().getMessages()); JournalHeader journalHeader = functionHandler2.getFhd().getJournalHeader(); if (journalHeader != null) { System.out.println("Journal 2=" + journalHeader); } else { System.out.println("Journal 2=" + "ERROR"); } return (journalHeader != null); } catch (Exception e) { e.printStackTrace(); return false; } finally { cleanUp(); } }
/** * Convert a String containing a numeric rate into the form x000...000nnnnmmmmmmmm000...000 where * nnnn.mmmmmmmm is passed and x can be a negative sign * * @param ns - numeric string * @param intLen - the length of the integer part * @param decLen - the length of the decimal part * @return the formatted numeric string */ public static String formatDouble(String ns, int intLen, int decLen) { return Toolbox.formatDouble(ns, intLen, decLen); }
/** * Convert a String containing a numeric into the form x000...000nnnn where n is passed and x can * be a negative sign * * @param ns - string * @param len - length of the numeric portion without the sign * @return the formatted numeric string */ public static String formatInteger(String ns, int len) { return Toolbox.formatInteger(ns, len); }
/** * Truncate the String so that is has the maximum specified length * * @param string - the string to parse * @param length - maximum length of the string * @return the truncated string */ public static String truncate(String string, int length) { return Toolbox.trim(string, length); }
/** * Pad trailing spaces so that it has at least the specified length * * @param string - the string to parse * @param length - minimum length of the string * @return the padded string */ public static String pad(String string, int length) { return Toolbox.pad(string, length); }
public boolean test() { // Have a bash... FunctionHandler functionHandler = null; try { System.out.println("------------------------------- 1"); functionHandler = FunctionToolboxStub.getFunctionHandler(user, "SESSIONID", ""); functionHandler.doNewTransaction("RLX", ""); FunctionData functionData = functionHandler.getFhd().getScreenSetHandler().rtvScrnSetCurrent().getFunctionData(); String LNR = Toolbox.formatDate(Calendar.getInstance(), Toolbox.TIMESTAMP_FORMAT) .replaceAll(" ", "") .replaceAll(":", ""); String LNR2 = LNR.substring(LNR.length() - 13); if (externalInputTest) { LNR2 = "7.08150344998"; } functionData.chgFieldInputValue("LNP", "CR2"); functionData.chgFieldInputValue("LNR", LNR2); // functionData.chgFieldInputValue("BRNM", ""); functionData.chgFieldInputValue("CUS", "312162"); functionData.chgFieldInputValue("CLC", "789"); functionData.chgFieldInputValue("CCY", "GBP"); functionData.chgFieldInputValue("DLA", "10T"); functionData.chgFieldInputValue("SDT", "011299"); functionData.chgFieldInputValue("CTRD", "011299"); functionData.chgFieldInputValue("RAT", "10"); functionData.chgFieldInputValue("IDB", "10"); functionData.chgFieldInputValue("CPI", "N"); functionData.chgFieldInputValue("RPYM", "1"); functionData.chgFieldInputValue("SCHC", "2"); functionData.chgFieldInputValue("NPY", "10"); functionData.chgFieldInputValue("RPQ", "V01"); functionData.chgFieldInputValue("RPA", ""); functionData.chgFieldInputValue("FTA", ""); functionData.chgFieldInputValue("FDT", "010100"); functionData.chgFieldInputValue("DIF", "N"); functionData.chgFieldInputValue("MDT", ""); functionData.chgFieldInputValue("AB", "9132"); functionData.chgFieldInputValue("AN", "234567"); functionData.chgFieldInputValue("AS", "001"); functionData.chgFieldInputValue("SAP", "N"); functionData.chgFieldInputValue("PYT", "KBC"); functionData.chgFieldInputValue("RCCY", "GBP"); functionData.chgFieldInputValue("RAMT", "10T"); functionData.chgFieldInputValue("PCCY", "USD"); functionData.chgFieldInputValue("XREF", LNR2); functionData.chgFieldInputValue("RMTR", "Remitter Id"); functionData.chgFieldInputValue("NST1", "GBP R"); functionData.chgFieldInputValue("SAD1", "Sender line 1"); functionData.chgFieldInputValue("SAD2", "Sender line 2"); functionData.chgFieldInputValue("SAD3", "Sender line 3"); functionData.chgFieldInputValue("SAD4", "Sender line 4"); functionData.chgFieldInputValue("NST2", "BARUSD"); functionData.chgFieldInputValue("OAN1", "Beneficiary account number"); functionData.chgFieldInputValue("BAD1", "Beneficiary line 1"); functionData.chgFieldInputValue("BAD2", "Beneficiary line 2"); functionData.chgFieldInputValue("BAD3", "Beneficiary line 3"); functionData.chgFieldInputValue("BAD4", "Beneficiary line 4"); functionData.chgFieldInputValue("OAN2", "A/c with inst account number"); functionData.chgFieldInputValue("AAD1", "A/c with inst line 1"); functionData.chgFieldInputValue("AAD2", "A/c with inst line 2"); functionData.chgFieldInputValue("AAD3", "A/c with inst line 3"); functionData.chgFieldInputValue("AAD4", "A/c with inst line 4"); functionData.chgFieldInputValue("US1", "A/c ref 1"); functionData.chgFieldInputValue("US2", "A/c ref 2"); functionHandler.applyTransaction(); FunctionToolboxStub.printMessages(functionHandler.rtvFunctionMessages().getMessages()); // retrieve journal header System.out.println(LNR2); JournalHeader journalHeader = functionHandler.getFhd().getJournalHeader(); if (journalHeader != null) { System.out.println("Journal 1=" + journalHeader); } else { System.out.println("Journal 1=" + "ERROR"); } return (journalHeader != null); } catch (Exception e) { e.printStackTrace(); return false; } finally { if (functionHandler != null) { if (functionHandler.getFhd().getFunctionSession() != null) { SupervisorToolbox.removeSession( functionHandler.getFhd().getFunctionSession(), functionHandler.getFhd().getEquationUser().getEquationUnit()); } } cleanUp(); } }