/** * Example license header for Java files * * http://www.andromda.org/ */ // // Attention: Generated code! Do not modify by hand! // Generated by: SpringServiceBase.vsl in andromda-spring-cartridge. // /** * TEMPLATE: SpringServiceBase.vsl in andromda-spring cartridge * MODEL CLASS: Spring Example::org.andromda.test::3::RentalService * STEREOTYPE: Service */ package org.andromda.test.3; /** *

* Spring Service base class for org.andromda.test.3.RentalService, * provides access to all services and entities referenced by this service. *

* * @see org.andromda.test.3.RentalService */ public abstract class RentalServiceBase implements org.andromda.test.3.RentalService { private org.andromda.test.3.CarDao carDao; /** * Sets the reference to car's DAO. * @param carDaoIn */ public void setCarDao(org.andromda.test.3.CarDao carDaoIn) { this.carDao = carDaoIn; } /** * Gets the reference to car's DAO. * @return carDao */ protected org.andromda.test.3.CarDao getCarDao() { return this.carDao; } private org.andromda.test.3.PersonDao personDao; /** * Sets the reference to person's DAO. * @param personDaoIn */ public void setPersonDao(org.andromda.test.3.PersonDao personDaoIn) { this.personDao = personDaoIn; } /** * Gets the reference to person's DAO. * @return personDao */ protected org.andromda.test.3.PersonDao getPersonDao() { return this.personDao; } /** * {@inheritDoc} */ @Override public java.util.List getAllCars() { try { return this.handleGetAllCars(); } catch (Throwable th) { throw new org.andromda.test.3.RentalServiceException( "Error performing 'org.andromda.test.3.RentalService.getAllCars()' --> " + th, th); } } /** * Performs the core logic for {@link #getAllCars()} * @return java.util.List * @throws Exception */ protected abstract java.util.List handleGetAllCars() throws Exception; /** * {@inheritDoc} */ @Override public java.util.List getCustomersByName(final java.lang.String name) { if (name == null || name.trim().length() == 0) { throw new IllegalArgumentException( "org.andromda.test.3.RentalService.getCustomersByName(java.lang.String name) - 'name' can not be null or empty"); } try { return this.handleGetCustomersByName(name); } catch (Throwable th) { throw new org.andromda.test.3.RentalServiceException( "Error performing 'org.andromda.test.3.RentalService.getCustomersByName(java.lang.String name)' --> " + th, th); } } /** * Performs the core logic for {@link #getCustomersByName(java.lang.String)} * @param name java.lang.String * @return java.util.List * @throws Exception */ protected abstract java.util.List handleGetCustomersByName(java.lang.String name) throws Exception; /** * Gets the current principal if one has been set, * otherwise returns null. * * @return the current principal */ protected java.security.Principal getPrincipal() { return org.andromda.spring.PrincipalStore.get(); } /** * Gets the message source available to this service. * @return MessageSource */ protected org.springframework.context.MessageSource getMessages() { return (org.springframework.context.MessageSource) org.andromda.spring.BeanLocator.instance().getBean("messageSource"); } /** * Gets the message having the given key in the underlying message bundle. * * @param key the key of the message in the messages.properties message bundle. * @return String */ protected String getMessage(final String key) { return this.getMessages().getMessage(key, null, null); } /** * Gets the message having the given key and arguments in the * underlying message bundle. * * @param key the key of the message in the messages.properties message bundle. * @param arguments any arguments to substitute when resolving the message. * @return String */ protected String getMessage(final String key, final Object[] arguments) { return this.getMessages().getMessage(key, arguments, null); } /** * Gets the message having the given key using the given arguments * for the given locale. * * @param key the key of the message in the messages.properties message bundle. * @param arguments any arguments to substitute when resolving the message. * @param locale the locale of the messages to retrieve. * @return String */ protected String getMessage( final String key, final Object[] arguments, final java.util.Locale locale) { return this.getMessages().getMessage(key, arguments, locale); } /** * Gets all roles belonging to the current principal. * * @return the names of the current principal roles. */ public String[] getPrincipalRoles() { return org.andromda.spring.PrincipalStore.getPrincipalRoles(); } }