Scout/Tutorial/3.9/webservices/CompanyWebService implementation

From Eclipsepedia

< Scout‎ | Tutorial‎ | 3.9‎ | webservices
Revision as of 02:37, 2 April 2013 by Mbk.bsiag.com (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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());
  }
}