Created
November 11, 2012 01:28
-
-
Save fabito/4053299 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
package org.talesolutions.cep.appengine; | |
import java.util.List; | |
import javax.inject.Named; | |
import org.talesolutions.cep.CEP; | |
import org.talesolutions.cep.CEPService; | |
import org.talesolutions.cep.CEPServiceFactory; | |
import com.google.api.server.spi.config.Api; | |
import com.google.api.server.spi.config.ApiMethod; | |
/** | |
* Expoe os serviços de busca de CEPs | |
* | |
* @author fuechi | |
*/ | |
@Api(name = "buscacep", description = "Conjunto de serviços para consulta de CEP") | |
public class CepEndpoint { | |
private CEPService cepService = new MemcacheCepServiceDecorator(CEPServiceFactory.getCEPService()); | |
/** | |
* Obtem um CEP pelo numero do CEP | |
* | |
* @param numeroCep | |
* formatado com hifem ou não | |
* @return CEP | |
*/ | |
@ApiMethod(httpMethod = "GET", name = "cep.get") | |
public CEP getCep(@Named("numeroCep") String numeroCep) { | |
return cepService.obtemPorNumeroCEP(numeroCep); | |
} | |
/** | |
* @param query | |
* @return | |
*/ | |
@ApiMethod(httpMethod = "GET", name = "cep.search") | |
public List<CEP> searchCep(@Named("term") String query) { | |
return cepService.obtemPorEndereco(query); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment