Scout/Tutorial/3.8/webservices/CompanyWebService implementation

From Eclipsepedia

< Scout‎ | Tutorial‎ | 3.8
Jump to: navigation, search


Scout
Wiki Home
Website
DownloadGit
Community
ForumsBlogTwitter
Bugzilla
Bugzilla
@ScoutWebService
@WebService(endpointInterface = "org.eclipse.scout.tutorial.jaxws.services.ws.companywebservice.CompanyWebServicePortType")
public class CompanyWebService implements CompanyWebServicePortType {
 
  @Override
  public List<Company> getCompanies() {
    // holder to create a company bean for each company record in database
    BeanArrayHolder<Company> companyBeanHolder = new BeanArrayHolder<Company>(Company.class);
    try {
      // run SQL
      SQL.selectInto("" +
          "SELECT   NAME, " +
          "         SYMBOL " +
          "FROM     COMPANY " +
          "INTO     :{name}, " +
          "         :{symbol}"
          , companyBeanHolder
          );
    }
    catch (ProcessingException e) {
      ScoutLogManager.getLogger(CompanyWebService.class).error("failed to load company data", e);
    }
    return Arrays.asList(companyBeanHolder.getBeans());
  }
}