arputh Contributor.
Contributor.
140 views

Financial Web Services to Update User Data

Jump to solution

Hi,

 

I am trying to update a userdata field in the cost line of a Financial Summary. I am using web service to do that because users currently capture the "Purchase Order Number" on the request type and don't to duplicate work effort.

 

I have the java class method which pass the ForecastActual Object and Oracle connection which works fine to get the UserData:

****************************************************************

public void doFsActualsUpdate() throws RemoteException{
try {
FinancialSummaryInfo fsi = getFinancialSummary();
// Set Variable and Instantiate the OracleDataHandler class for sql queries
OracleDataHandler odh = new OracleDataHandler();
// Set the JDBC URL, User and Password for Oracle DB
odh.setJdbcURL(jdbcUrl);
odh.setDbUser(dbUser);
odh.setDbPassword(dbPassword);

getPoUserData(fsi.getForecastActual(),odh);
// Close the connection, statements and resultset
odh.closeAll();
} catch (SQLException ex) {
Logger.getLogger(FinancialSummary.class.getName()).log(Level.SEVERE, null, ex);
}
}

*************************************************************************

 

I get an the following error message in the getPoUserData method after I added this statement(userData.unsetVisUserData20();) :

***********************************************************************

Exception in thread "main" java.lang.IndexOutOfBoundsException
    at org.apache.xmlbeans.impl.store.Xobj.removeElement(Xobj.java:2188)
    at org.apache.xmlbeans.impl.store.Xobj.remove_element(Xobj.java:2218)
    at com.mercury.itg.ws.fm.client.impl.UserDataInfoImpl.unsetVisUserData20(UserDataInfoImpl.java:3780)
    at corp.vodacom.vprompt.fin.automation.FinancialSummary.getPoUserData(FinancialSummary.java:177)
    at corp.vodacom.vprompt.fin.automation.FinancialSummary.doFsActualsUpdate(FinancialSummary.java:73)

*************************************************************************

 

The getPoUserData method with statement that cause the error in red:

*************************************************************************

public void getPoUserData(final ForecastActualInfo forecastActual, final OracleDataHandler odh) throws SQLException{
        // Check that there is Cost Line information
        if((forecastActual != null) && (forecastActual.getLines() != null)){
            //Get all the cost lines
            final ForecastActualInfo.Lines cLines = forecastActual.getLines();
            log("- contains " + cLines.sizeOfLineArray() + " of Cost Line(s)");
            
            // Check if Cost Lines are not empty. Do not prosecc empty lines
            if(!isEmpty(cLines)){
                //Loop through the cost lines
                for(int i = 0; i < cLines.getLineArray().length; i++){
                    //Get each line entry
                    final ForecastActualInfo.Lines.Line cLine = cLines.getLineArray(i);
                    // Get the User Data for that cLine
                    final UserDataInfo userData = cLine.getUserData();
                    // Check PO Number and update from Cash Flow Table or DAC Table
                    if(isLong(userData.getUserData2())){
                        log("The PO Number for line " + i + ": " + userData.getVisUserData2());
                    } else {
                        // Check RFE Number and update PO Number
                        if(isLong(userData.getUserData1())){
                            log("The RFE Number: " + userData.getVisUserData1());
                            ResultSet rsRfe = odh.getPoNumber(Long.parseLong(userData.getUserData1().toString()));
                            userData.unsetVisUserData20();
                            while(rsRfe.next()){                                
                                userData.setUserData2(rsRfe.getString("po_num").toString());
                            }
                        } else {
                            log("No RFE Number captured");
                        } // End Check RFE Number and update PO Number
                    } // End Check PO Number and update from Cash Flow Table or DAC Table
                } // End Loop through the cost lines
            } // End Check if Cost Lines are not empty.
        } else {
            log("\n<<-- No Cost lines has been added to this Financial Summary! -->>");
        } // End Check that there is Cost Line information     
    }

*********************************************************************************************

 

userData.setUserData2(rsRfe.getString("po_num").toString()); does not update the data in the DB.

 

What am I doing wrong?

 

Thanks.

Alfred Puth
PPM Consultant
EOH Application Management
0 Likes
1 Solution

Accepted Solutions
Absent Member.. AbrahamRB Absent Member..
Absent Member..

Re: Financial Web Services to Update User Data

Jump to solution

Helo Arputh

 

As I am understanding, you are not able to find examples about updating the User Data fields in the Financial summary in the guides.
In my opinion if there is no examples of it, it could be that it isn't supported so it would be a customization.

 

If you want to make sure about this you can open a case and they can confirm you if it is or not supported.

 

Also you can put your question in this public Forum (http://h30499.www3.hp.com/t5/Project-and-Portfolio-Management/bd-p/itrc-935#.VIH3X3l0zcs) and maybe somebody else has done what you need.

 

Best regards

5 Replies
Absent Member.. AbrahamRB Absent Member..
Absent Member..

Re: Financial Web Services to Update User Data

Jump to solution

Hello Arputh.

 

It is not a recommendation, to change the application code itself. If you need to customize the application, you should contact the PSO team; and they will help you with this customization.

 

Best regards

0 Likes
arputh Contributor.
Contributor.

Re: Financial Web Services to Update User Data

Jump to solution

Hi AbrahamRB,

 

The issue that I have with the web services examples provided is that there is no exmple of updating the User Data fields in the Financial summary only how to extract the data.

 

The "com.mercury.itg.ws.fm.client.UserDataInfo" does though have the unset... and set... methods to be used.

 

I am sure I am just using it incorrectly.

 

Regards,

Alfred Puth
PPM Consultant
EOH Application Management
0 Likes
Absent Member.. AbrahamRB Absent Member..
Absent Member..

Re: Financial Web Services to Update User Data

Jump to solution

Helo Arputh

 

As I am understanding, you are not able to find examples about updating the User Data fields in the Financial summary in the guides.
In my opinion if there is no examples of it, it could be that it isn't supported so it would be a customization.

 

If you want to make sure about this you can open a case and they can confirm you if it is or not supported.

 

Also you can put your question in this public Forum (http://h30499.www3.hp.com/t5/Project-and-Portfolio-Management/bd-p/itrc-935#.VIH3X3l0zcs) and maybe somebody else has done what you need.

 

Best regards

Absent Member.. AbrahamRB Absent Member..
Absent Member..

Re: Financial Web Services to Update User Data

Jump to solution

Hello Arputh.

 

I would like to know if my answer was helpful for you, or if you still need more assistance. If you don't need more help from our side could you please select in my answer the option "accept as a solution".

 

Thanks and best regards

0 Likes
arputh Contributor.
Contributor.

Re: Financial Web Services to Update User Data

Jump to solution

Hi AbrahamRB,

 

I figured it out and found how to update the user data. See the following method in the attached FinancialSummary.java source file:

 

protected void updatePOnumber(final FinancialSummaryInfo fs) throws AxisFault, RemoteException, SQLException{
        // Set the Oracle Connection cridential
        odh.setJdbcURL(this.jdbcUrl);
        odh.setDbUser(this.dbUser);
        odh.setDbPassword(this.dbPassword);
        // Create or update forecast/actual costs.
        //ForecastActualInfo updateAllTypeActuals = null;
        final ForecastActualInfo.Lines actLines = fs.getForecastActual().getLines();
        if(!isEmpty(actLines)){ // Check if lines is not empty
             for (int i = 0; i < actLines.getLineArray().length; i++){ //Loop through the Lines
                 //Get the PO Number from the User data
                final UserDataInfo lineUserData = actLines.getLineArray(i).getUserData();
                if(lineUserData.getUserData2() == null && isLong(lineUserData.getUserData1())){ // Check PO Number empty and RFE Number not empty
                    log("RFE Number: " + lineUserData.getUserData1() + " for line " + i);
                    final ResultSet rsPO = odh.getPoNumber(Long.parseLong(lineUserData.getUserData1()));
                    while(rsPO.next()){ //  Loop through the PO Number
                        if(!rsPO.getString("po_num").equalsIgnoreCase("000")){ //Check default PO Number
                            lineUserData.setUserData2(rsPO.getString("po_num"));
                            log("- PO Number is set to " + lineUserData.getUserData2() + " for line " + i);
                        } else {
                            log("- PO Number is not a valid number for line " + i);
                        } // End: Check default PO Number
                    } // End: Loop through the PO Number                 
                } else if(lineUserData.getUserData2() != null && isLong(lineUserData.getUserData1())){
                    log("PO Number already captured for line " + i);
                } else{
                    log("No RFE Number captured for line " + i);
                } // End: Check PO Number empty and RFE Number not empty
             } //End: Loop through the Lines
        } // End: Check if lines is not empty
         //Submit the changes applied
        fs.setForecastActual(fs.getForecastActual());

        final UpdateFinancialSummaryDocument requestDoc = UpdateFinancialSummaryDocument.Factory.newInstance();
        requestDoc.addNewUpdateFinancialSummary().setFinancialSummary(fs);

        final FinanceServiceStub stub = new FinanceServiceStub(this.context, this.serviceUrl);
        stub.updateFinancialSummary(requestDoc);
        // Close All the connections
        odh.closeAll();
    }

 

Alfred Puth
PPM Consultant
EOH Application Management
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.