Organization.java

  1. package net.swindle.springdemo.domain;

  2. import net.swindle.springdemo.service.BusinessService;

  3. import org.springframework.beans.factory.annotation.Autowired;

  4. /**
  5.  * Organizations.
  6.  *
  7.  * @author swindle
  8.  */
  9. public class Organization {

  10.   private final String companyName;
  11.   private String slogan;
  12.   private BusinessService businessService;

  13.   /**
  14.    * Constructor method.
  15.    *
  16.    * @param companyName The company name
  17.    */
  18.   public Organization(String companyName) {
  19.     this.companyName = companyName;
  20.   }

  21.   /**
  22.    * Access company name.
  23.    *
  24.    * @return companyName The company name
  25.    */
  26.   public String getCompanyName() {
  27.     return companyName;
  28.   }

  29.   /**
  30.    * Provide for Spring Bean mutation.
  31.    *
  32.    * @param postalCode The postal/regional code.
  33.    */
  34.   @Autowired(required = false)
  35.   public void setPostalCode(String postalCode) {}

  36.   /**
  37.    * Provide for Spring Bean mutation.
  38.    *
  39.    * @param employeeCount The number of people employeed in the company.
  40.    */
  41.   @Autowired(required = false)
  42.   public void setEmployeeCount(int employeeCount) {}

  43.   /**
  44.    * Modify the company slogan.
  45.    *
  46.    * @param slogan The company's slogan.
  47.    */
  48.   public void setSlogan(String slogan) {
  49.     this.slogan = slogan;
  50.   }

  51.   /**
  52.    * Provide for Spring Bean mutation.
  53.    *
  54.    * @param businessService Reference to outsourced service-provider.
  55.    */
  56.   public void setBusinessService(BusinessService businessService) {
  57.     this.businessService = businessService;
  58.   }

  59.   /**
  60.    * Announce the company's slogan.
  61.    *
  62.    * @return The company slogan.
  63.    */
  64.   public String corporateSlogan() {
  65.     return slogan;
  66.   }

  67.   /**
  68.    * Announce services provided.
  69.    *
  70.    * @return Statement of services offered
  71.    */
  72.   public String corporateService() {
  73.     return businessService.offerService(companyName);
  74.   }
  75. }