1 package org.paneris.jammyjoes.controller; 2 3 import org.melati.util.UTF8URLEncoder; 4 import org.paneris.jammyjoes.model.Manufacturer; 5 6 public class SearchMaufacturer { 7 8 private Manufacturer manufacturer; 9 private String name; 10 private boolean isNull = true; 11 12 public SearchMaufacturer(Manufacturer manufacturer) { 13 this.manufacturer = manufacturer; 14 this.name = null; 15 isNull = false; 16 } 17 18 public SearchMaufacturer(String name) { 19 this.name = name; 20 this.manufacturer = null; 21 isNull = false; 22 } 23 24 public SearchMaufacturer() { 25 this.name = null; 26 this.manufacturer = null; 27 } 28 29 public String toString() { 30 if (isNull) return ""; 31 return (manufacturer == null) ? name : manufacturer.getName(); 32 } 33 34 public boolean isNull() { 35 return isNull; 36 } 37 38 public String pathise() { 39 if (manufacturer == null) 40 return "/_"; 41 return "/" + UTF8URLEncoder.encode(manufacturer.getName()); 42 } 43 44 }