-
-
Save mhautman/e178fdcca46331e1f4932b1cd7074de7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SearchStreet { | |
private static final Logger LOGGER = LoggerFactory.getLogger(SearchStreet.class); | |
@Inject | |
private AddressService addressService; | |
@Property | |
private String streetName; | |
@Property | |
private String zipCode; | |
@Property | |
private String municipalityCode; | |
@Property | |
private Street street; | |
@Property | |
private Set<Street> streets; | |
Object onSuccess() { | |
LOGGER.debug(String.format("Called SearchStreet with following parameters: %s %s %s", streetName, zipCode, municipalityCode)); | |
Set<Street> streets = new HashSet<Street>(); | |
if (zipCode != null && !zipCode.equals("")) { | |
List<Street> streetsByZip = addressService.getStreetsByZip(zipCode); | |
if (streetsByZip != null || !streetsByZip.isEmpty()) { | |
streets.addAll(streetsByZip); | |
} | |
} | |
if (municipalityCode != null && !municipalityCode.equals("")) { | |
List<Street> streetsByMunicipality = addressService.getStreetsByMunicipality(municipalityCode); | |
if (streetsByMunicipality != null || !streetsByMunicipality.isEmpty()) { | |
streets.addAll(streetsByMunicipality); | |
} | |
} | |
this.streets = streets; | |
return this; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<t:form> | |
<t:label for="streetName"/>: | |
<t:textfield t:id="streetName" /> | |
<br/> | |
<t:label for="zipCode"/>: | |
<t:textfield t:id="zipCode" validate="regexp"/> | |
<br/> | |
<t:label for="municipalityCode"/>: | |
<t:textfield t:id="municipalityCode" validate="regexp"/> | |
<br/> | |
<t:submit t:id="search" value="Search"/> | |
<br/> | |
<t:grid source="streets" row="street"> | |
</t:grid> | |
</t:form> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment