/* * This file was automatically generated by MD4J. * * Licensed under the GNU General Public License, Version 2.0 (the "License") or above; * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * *http://www.gnu.org/licenses/gpl.txt * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package gr.abiss.md4j.sampledomain.web; import java.util.Map; import java.util.HashMap; import java.util.HashMap; import org.apache.commons.lang.BooleanUtils; import org.apache.struts.validator.ValidatorForm; import gr.abiss.md4j.dao.Order; import gr.abiss.md4j.web.PagedSearchResultsForm; import gr.abiss.md4j.util.Md4jGlobals; import org.apache.log4j.Logger; /** * @struts.form name="CitySearchForm" * */ public class CitySearchForm extends ValidatorForm implements PagedSearchResultsForm{ private static Logger log = Logger.getLogger(CitySearchForm.class); private Map parentSelectOptions = new HashMap(); // property: class element /** * City */ private Integer resultsPageNumber; private String orderByPropertyName = "id"; private String orderByAscending = "true"; // before property call: id element // property: id element /** * id */ private String id; // before property call: property element // property: property element /** * name */ private String name; // before property call: property element // property: property element /** * region */ private String region; // before property call: property element // property: property element /** * population */ private String population; // before property call: many-to-one element // property: many-to-one element /** * country */ private String country; public Map getParentSelectOptions() { return this.parentSelectOptions; } /** */ public void setParentSelectOptions(Map options) { String countryKey = Md4jGlobals.PARENT_OPTIONS + "#country"; this.parentSelectOptions.put(countryKey, options.get(countryKey)); } /** */ public Order getOrder() { return new Order().addOrder(this.orderByPropertyName, BooleanUtils.toBooleanDefaultIfNull(BooleanUtils.toBooleanObject(this.orderByAscending), Boolean.TRUE.booleanValue())); } // before propertyMethods call: id element // propertyMethods: id element /** * Get the id * @return the id */ public String getId(){ return this.id; } /** * Set the id * @param id the id to set * @struts.validator type="long" * @struts.validator-args arg0resource="CitySearchForm.id" */ public void setId(String id){ this.id = id; } // before propertyMethods call: property element // propertyMethods: property element /** * Get the name * @return the name */ public String getName(){ return this.name; } /** * Set the name */ public void setName(String name){ this.name = name; } // before propertyMethods call: property element // propertyMethods: property element /** * Get the region * @return the region */ public String getRegion(){ return this.region; } /** * Set the region */ public void setRegion(String region){ this.region = region; } // before propertyMethods call: property element // propertyMethods: property element /** * Get the population * @return the population */ public String getPopulation(){ return this.population; } /** * Set the population * @param population the population to set * @struts.validator type="integer" * @struts.validator-args arg0resource="CitySearchForm.population" */ public void setPopulation(String population){ this.population = population; } // before propertyMethods call: many-to-one element // propertyMethods: many-to-one element /** * Get the country * @return the country */ public String getCountry(){ return this.country; } /** * Set the country */ public void setCountry(String country){ this.country = country; } // propertyMethods: class element /** * Get the resultsPageNumber * @return the resultsPageNumber */ public Integer getResultsPageNumber(){ return this.resultsPageNumber; } /** * Set the resultsPageNumber * @param resultsPageNumber the resultsPageNumber to set * @struts.validator type="integer" * @struts.validator-args arg0resource="CitySearchForm.City" */ public void setResultsPageNumber(Integer resultsPageNumber){ this.resultsPageNumber = resultsPageNumber; } // propertyMethods: class element /** * Get the orderByPropertyName * @return the orderByPropertyName */ public String getOrderByPropertyName(){ return this.orderByPropertyName; } /** * Set the orderByPropertyName * @param orderByPropertyName the orderByPropertyName to set * @struts.validator type="required" * @struts.validator-args arg0resource="CitySearchForm.City" */ public void setOrderByPropertyName(String orderByPropertyName){ this.orderByPropertyName = orderByPropertyName; } // propertyMethods: class element /** * Get the orderByAscending * @return the orderByAscending */ public String getOrderByAscending(){ return this.orderByAscending; } /** * Set the orderByAscending * @param orderByAscending the orderByAscending to set * @struts.validator type="required,validwhen" msgkey="boolean" * @struts.validator-var name="test" value="((*this* == null) or ((*this* == 'true') or (*this* == 'false')))" * @struts.validator-args arg0resource="CitySearchForm.City" */ public void setOrderByAscending(String orderByAscending){ this.orderByAscending = orderByAscending; } /** * Get the attribute vale pairs of this form bean instance as a Map * @see gr.abiss.md4j.web.Md4jActionForm#toMap() */ public Map toMap() { Map params = new HashMap(); if(this.id != null && this.id.length() > 0){ params.put("id", this.id); } if(this.name != null && this.name.length() > 0){ params.put("name", this.name); } if(this.region != null && this.region.length() > 0){ params.put("region", this.region); } if(this.population != null && this.population.length() > 0){ params.put("population", this.population); } if(this.country != null && this.country.length() > 0){ params.put("country", this.country); } return params; } }