Storage
This example show how to:
Create a credit case
Store the credit case
Fetch the credit case
Delete the credit case
/* Creates an instance of the webservice client */ ApplicationserviceImpl appImp = new ApplicationserviceImpl(); ApplicationserviceImplSEI app = appImp.getApplicationserviceImplSEIPort(); /* Set endpoint url, username and password (http basic auth) */ Map<String, Object> reqContext = ((BindingProvider) app).getRequestContext(); reqContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, ENDPOINT); reqContext.put(BindingProvider.USERNAME_PROPERTY, USERNAME); reqContext.put(BindingProvider.PASSWORD_PROPERTY, PASSWORD); //Create the credit case input CompanyCalcInput companyCalcInput1 = new CompanyCalcInput(); companyCalcInput1.setCalculationYear( 2020 ); companyCalcInput1.setCalculationMonth( 10 ); companyCalcInput1.setMainCurrency(Currency.SEK); companyCalcInput1.setCalcInformation( new CalcInformation()); DateWithDay actualDate1 = new DateWithDay(); companyCalcInput1.setActualDate(actualDate1); actualDate1.setDay( 14 ); actualDate1.setYear( 2020 ); actualDate1.setMonth( 10 ); Company company1 = new Company(); companyCalcInput1.getCompanies().add(company1); company1.setID( "5B0A693B-65AB-46B6-826E-7B9362743D4C" ); company1.setCaseSubsidiary(SubsidiaryMode.EXISTING_CASE_SUBSIDIARY); company1.setMainCurrency(Currency.SEK); CompanyInformation companyInformation1 = new CompanyInformation(); company1.setCompanyInformation(companyInformation1); companyInformation1.setOrgNo( "1234567890" ); ActualFigures actualFigures1 = new ActualFigures(); company1.setActualFigures(actualFigures1); actualFigures1.setBalanceSheetCurrentYear( new BalanceSheetPartOfYear()); actualFigures1.setIncomestatementCurrentYear( new IncomestatementPartOfYear()); Incomestatement incomestatement1 = new Incomestatement(); actualFigures1.getHistoricalIncomestatements().add(incomestatement1); incomestatement1.setRevenue( 100000.0 ); Incomestatement incomestatement2 = new Incomestatement(); actualFigures1.getHistoricalIncomestatements().add(incomestatement2); incomestatement2.setRevenue( 200000.0 ); Incomestatement incomestatement3 = new Incomestatement(); actualFigures1.getHistoricalIncomestatements().add(incomestatement3); incomestatement3.setRevenue( 300000.0 ); BalanceSheet balanceSheet1 = new BalanceSheet(); actualFigures1.getHistoricalBalanceSheet().add(balanceSheet1); balanceSheet1.setCash( 100000.0 ); balanceSheet1.setUnrestrictedEquity( 100000.0 ); BalanceSheet balanceSheet2 = new BalanceSheet(); actualFigures1.getHistoricalBalanceSheet().add(balanceSheet2); balanceSheet2.setCash( 200000.0 ); balanceSheet2.setUnrestrictedEquity( 200000.0 ); BalanceSheet balanceSheet3 = new BalanceSheet(); actualFigures1.getHistoricalBalanceSheet().add(balanceSheet3); balanceSheet3.setCash( 300000.0 ); balanceSheet3.setUnrestrictedEquity( 300000.0 ); //Store the credit case and retrieve the ID for the case String calcID = app.saveCalculation(companyCalcInput1).getInformation(); //Fetch the stored credit case Id id = new Id(); id.setID(calcID); CompanyCalcInput fetchedCalculation = app.fetchCalculation(id); //Check some data in the feteched credit case Assert.assertEquals( 100000.0 , fetchedCalculation.getCompanies().get( 0 ).getActualFigures().getHistoricalIncomestatements().get( 0 ).getRevenue(), 0.0 ); //Delete the credit case and check that it was properly deleted boolean deleteOk = app.deleteCalculation(id).isOk(); Assert.assertEquals( true , deleteOk); |