package se.kodapan.osm.sweden.ext.se.posten.postnummer; import com.sleepycat.persist.model.Persistent; import java.util.ArrayList; import java.util.List; /** * @author kalle * @since 2013-01-02 01:26 */ @Persistent public class PostenPostnummerServiceResponse { private List<PostenPostnummerServiceRecord> records; private List<String> postnummerCells; private List<String> postortCells; private List<String> gatunamnCells; private List<Integer> starthusnummerCells; private List<Integer> sluthusnummerCells; /** true if too many results was returned */ private boolean limitedResults = false; public PostenPostnummerServiceResponse() { } public PostenPostnummerServiceResponse(List<PostenPostnummerServiceRecord> records) { this.records = records; } public void createColumns() { postnummerCells = new ArrayList<String>(records.size()); postortCells = new ArrayList<String>(records.size()); gatunamnCells = new ArrayList<String>(records.size()); starthusnummerCells = new ArrayList<Integer>(records.size()); sluthusnummerCells = new ArrayList<Integer>(records.size()); for (PostenPostnummerServiceRecord record : records) { postnummerCells.add(record.getPostnummer()); postortCells.add(record.getPostort()); gatunamnCells.add(record.getGatunamn()); starthusnummerCells.add(record.getStarthusnummer()); sluthusnummerCells.add(record.getSluthusnummer()); } } public List<PostenPostnummerServiceRecord> getRecords() { return records; } public void setRecords(List<PostenPostnummerServiceRecord> records) { this.records = records; } public List<String> getPostnummerCells() { return postnummerCells; } public void setPostnummerCells(List<String> postnummerCells) { this.postnummerCells = postnummerCells; } public List<String> getPostortCells() { return postortCells; } public void setPostortCells(List<String> postortCells) { this.postortCells = postortCells; } public List<String> getGatunamnCells() { return gatunamnCells; } public void setGatunamnCells(List<String> gatunamnCells) { this.gatunamnCells = gatunamnCells; } public List<Integer> getStarthusnummerCells() { return starthusnummerCells; } public void setStarthusnummerCells(List<Integer> starthusnummerCells) { this.starthusnummerCells = starthusnummerCells; } public List<Integer> getSluthusnummerCells() { return sluthusnummerCells; } public void setSluthusnummerCells(List<Integer> sluthusnummerCells) { this.sluthusnummerCells = sluthusnummerCells; } public boolean isLimitedResults() { return limitedResults; } public void setLimitedResults(boolean limitedResults) { this.limitedResults = limitedResults; } @Override public String toString() { return "PostenPostnummerServiceResponse{" + "limitedResults=" + limitedResults + ", records=" + records + '}'; } }