图 1. Payroll 模块关系图 |
图 2. Payroll front-end 模块 |
| <?xml version="1.0" encoding="ASCII"?> <module xmlns="http://www.osoa.org/xmlns/sca/0.9" name="innovasolutions.payrollmodule"> </module> |
| package services.payrolldata; public interface PayrollDataService { float getBasic(String employeeID); float getvariablePay(String employeeID); float getHRA(String employeeID); float getProvidentFund(String employeeID); float getConveyance(String employeeID); float getIncomeTax(String employeeID); float getProfessionalTax(String employeeID); float getNetPay(String employeeID); } |
| package services.payrolldata; @Service(PayrollDataService.class) public class payrollDataServiceImpl implements payrollDataService { public float getBasic(String employeeID){ . . . } public float getVariablePay(String employeeID){ . . . } public float getHRA(String employeeID){ . . . } public float getProvidentFund(String employeeID){ . . . } float getConveyance(String employeeID){ . . .} float getProfessionalTax(String employeeID){ . . . } public float getNetPay(String employeeID){ . . . } } |
| <xml version="1.0" encoding="ASCII"?> <componentType xmlns="http://www.osoa.org/xmlns/sca/0.9"> <service name="payrollDataService"> <interface.java interface="services.payrolldata.PayrollDataService"/> </service> </componentType> |
| <?xml version="1.0" encoding="ASCII"?> <module xmlns="http://www.osoa.org/xmlns/sca/0.9" name="innovasolutions.payrollmodule"> <component name="payrollDataServiceComponent"> <implementation.java class="services.payrolldata.PayrollDataServiceImpl"> </component> </module> |
| package services.taxrate; public interface TaxRateRulesService { public float getTaxRate (Float taxableIncome); } |
| <externalService name="TaxRateRulesService"> <interface.java interface="services.taxraterules.TaxRateRulesService"/> <binding.ws port="http://www.taxrules.com/ TaxRateRulesService # wsdl.endpoint(TaxRateRulesService / TaxRateRulesService SOAP)"/> </externalService> |
| package services.payroll; import org.osoa.sca.annotations.Remotable; @Remotable public interface PayrollService{ public PayrollStatement getPayrollStatement(String employeeID); |
| package services.payroll; import java.util.List; public interface PayrollStatement { List getPayrollDetails(); float getNetPay(); } |
| package services.payroll; public interface PaySplitUP { String getPaycategory(); void setPaycategory(String payCategory); void setEarnings(); void setDeductions(); float getEarnings(); float getDeductions(); } |
| package services.payroll; import java.util.List; import commonj.sdo.DataFactory; import org.osoa.sca.annotations.Property; import org.osoa.sca.annotations.Reference; import services.payrolldata.PayrollDataService; import services.taxrate.TaxRateRulesService; public class PayrollServiceImpl implements PayrollService { @Property private String currency = "INR"; @Reference private PayrollDataService payrollDataService; @Reference private TaxRateRulesService taxraterulesService; public PayrollStatement getPayrollStatement (String employeeID) { DataFactory dataFactory = DataFactory.INSTANCE; PayrollStatement payrollStatement = (PayrollStatement)dataFactory.create(PayrollStatement.class); List payslip = payrollStatement.getPayrollDetails(); float basic = payrollDataService.getBasic(employeeID); PlaySplitUP basicSalary= (PlaySplitUP)dataFactory.create(PlaySplitUP.class); basicSalary.setPaycategory("BASIC"); basicSalary.setEarnings(currencyConverter(basic)); payslip.add(basicSalary); . . . . . . . code for HRA . . . . . . . . . . . code for Variable pay . . . . . . . . . . . code for conveyance. . . . . . . . . . . code for Profident fund . . . . float IncomeTaxAmount = payrollDataService.getIncomeTax(employeeID); PlaySplitUP IncomeTax= (PlaySplitUP)dataFactory.create(PlaySplitUP.class); IncomeTax.setPaycategory("INCOMETAX"); IncomeTax.setDeductions(currencyConverter(IncomeTaxAmount)); payslip.add(IncomeTax); . . . . . . . code for Professional Tax . . . . . . return payrollStatement; } private float currencyConverter(float value){ if (currency.equals("INR")) return value; else if (currency.equals("USD")) return value * 45.5f; else return 0.0f; } } |
| <?xml version="1.0" encoding="ASCII"?> <componentType xmlns="http://www.osoa.org/xmlns/sca/0.9" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <service name="PayrollService"> <interface.java interface="services.payroll.PayrollService"/> </service> <reference name="payrollDataService"> <interface.java interface="services.payrolldata.PayrollDataService"/> </reference> <reference name="stockRatestockQuoteService"> <interface.java interface="services.taxRateRules.TaxRateRulesService"/> </reference> <property name="currency" type="xsd:string" default="INR"/> </componentType> |
| <component name="PayrollServiceComponent"> <implementation.java class="services.payroll.payrollServiceImpl"/> <properties> <v:currency>INR</v:currency> </properties> <references> <v:payrollDataService>PayrollDataServiceComponent</v:payrollDataService> <v:taxRateRulesService>TaxRateRulesService</v:taxRateRulesService> </references> </component> |
| <entryPoint name="PayrollService"> <interface.java interface="services.payroll.PayrollService"/> <binding.ws port="http://www.innovasolutions.com/PayrollService# wsdl.endpoint(PayrollService/PayrollServiceSOAP)"/> <reference>PayrollServiceComponent</reference> </entryPoint> |
| package services.profile; public interface LoginService{ public static final int SUCCESS = 1; public static final int INVALID_LOGIN = -1; public static final int INVALID_PASSWORD = -2; public int login(String employeeID, String password); } |
| package services.profile; import org.osoa.sca.annotations.Service; import org.osoa.sca.annotations.Reference; @Service(LoginService.class) public class LoginServiceImpl implements LoginService{ @Reference private ProfileService profileService; public int login(String employeeID, String password) { …. } } |
| <?xml version="1.0" encoding="ASCII"?> <module xmlns="http://www.osoa.org/xmlns/sca/0.9" xmlns:v="http://www.osoa.org/xmlns/sca/values/0.9" name="innovasolutions.webclientmodule"> <component name="LoginServiceComponent"> <implementation.java class="services.profile.LoginServiceImpl"/> </component> </module> |
| package services.profile; import org.osoa.sca.annotations.Scope; @Scope("session") public interface ProfileService{ public String getFirstName(); public void setFirstName(String pName); public String getLastName(); public void setLastName(String pName); public boolean isLoggedIn(); public void setLoggedIn(boolean pStatus); public String getId(); public void setId(String pId); } |
| package services.profile; import org.osoa.sca.annotations.Property; import org.osoa.sca.annotations.Scope; import org.osoa.sca.annotations.Service; @Service(ProfileService.class") @Scope("session") public class ProfileServiceImpl implements ProfileService{ @Property private String firstName; . . . . . . } } |
| <component name="ProfileServiceComponent"> <implementation.java class="services.profile.ProfileImpl"/> <properties> <v:firstName>Anonymous</v:firstName> </properties> </component> |
| <references> <v:profileService>ProfileServiceComponent</v:profileService> </references> |
| <externalService name="PayrollService"> <interface.java interface="services.account.PayrollService"/> <binding.ws port="http://www.innovasolutions.com/PayrollService# wsdl.endpoint(PayrollService/PayrollServiceSOAP)"/> </externalService> |
| <?xml version="1.0" encoding="ASCII"?> <subsystem xmlns="http://www.osoa.org/xmlns/sca/0.9" name="innovasolutions.payrollsubsytem"> <moduleComponent name="PayrollModuleComponent"module="innovasolutions.payrollmodule"/> </subsystem> |
| <?xml version="1.0" encoding="ASCII"?> <subsystem xmlns="http://www.osoa.org/xmlns/sca/0.9" xmlns:v="http://www.osoa.org/xmlns/sca/values/0.9" name="innovasolutions.webclientsubsytem"> <moduleComponent name="WebClientModuleComponent" module="innovasolutions.webclientmodule"> <references> <v:PayrollService>innovasolutions.payrollsunbsystem/ PayrollModuleComponent/PayrollService</v:PayrollService> </references> </moduleComponent> </subsystem> |