package ExemplosBusinessPeriodService; import javax.xml.ws. BindingProvider; import com. datasul .technology. webdesk. foundation.ws. BusinessPeriodDto; import com. datasul .technology. webdesk. foundation.ws. BusinessPeriodDtoArray; import com. datasul .technology. webdesk. foundation.ws. BusinessPeriodInfoDto; import com. datasul .technology. webdesk. foundation.ws. BusinessPeriodService; import com. datasul .technology. webdesk. foundation.ws. BusinessPeriodServiceService; /** * Class that uses all the methods of BusinessPeriodService. * With this class, you can search working hours registered in the ECM. * On the setParameters method, you can set some of the variables that are most used as parameters in the methods of this class. * On the changeMethod method, you can choose which method will be executed. */ public class BusinessPeriodServiceClient { // Variables. String loginColaborador, senhaColaborador; int codigoEmpresa; // Instantiates BusinessPeriodServiceService. BusinessPeriodServiceService businessPeriodServiceService = new BusinessPeriodServiceService (); BusinessPeriodService service = businessPeriodServiceService.getBusinessPeriodServicePort(); // Starts execution of the class. public static void main (String args[]) { System.out.println("\nClasse BusinessPeriodService"); // Instantiates GlobalParamServiceClient class. BusinessPeriodServiceClient gpsc = new BusinessPeriodServiceClient (); // Configures access to WebServices. BindingProvider bp = (BindingProvider) gpsc.service; bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://10.80.74.87:8080/webdesk/BusinessPeriodService"); try { // Calls method that configures the values of the variables. gpsc.setParameters(); // Calls method responsible for performing the methods of the class. gpsc.changeMethod(); } catch (Exception e) { e.printStackTrace(); } } /** * Configures parameters. * In this method you can set some of the variables that are most used as parameters in the methods of this class. */ public void setParameters () throws Exception { this.loginColaborador = "adm"; this.senhaColaborador = "adm"; this.codigoEmpresa = 1; } /** * Chooses method. * In this method, you can choose which method of the class to be executed. */ public void changeMethod() throws Exception { // Calls getBusinessPeriods method. this.getBusinessPeriods(); } /** * Returns information of the registered Working hours. * * Method: getBusinessPeriods. * * Parameters: * - User Login; * - User password; * - Company code; */ public void getBusinessPeriods () throws Exception { System.out.println("\nMétodo getBusinessPeriods\n"); // Returns all the volume of a company. BusinessPeriodDtoArray periodDtoArray = service. getBusinessPeriods (this. loginColaborador, this. senhaColaborador, this. codigoEmpresa); // Shows result. if(!periodDtoArray.getItem().isEmpty()){ for(BusinessPeriodDto periodDto: periodDtoArray: getItem ()) { System.out.println("ID: " + periodDto. getPeriodId ()); for(BusinessPeriodInfoDto periodInfoDto: periodDto. getPeriodInfos ()) { System.out.println("Sequence: " + periodInfoDto. getSequence ()); System.out.println("WeekDay: " + periodInfoDto. getWeekDay ()); System.out.println("InitialHour: " + periodInfoDto. getInitialHour ()); System.out.println("FinalHour: " + periodInfoDto. getFinalHour ()); } System.out.println("..."); } }else{ System.out.println("Não no working hours found registered!"); } } }