build first rest api
This commit is contained in:
parent
8ffa54cc6a
commit
19422f3827
@ -0,0 +1,38 @@
|
|||||||
|
package de.hsadmin.rest.customer;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.ws.rs.GET;
|
||||||
|
import javax.ws.rs.HeaderParam;
|
||||||
|
import javax.ws.rs.Path;
|
||||||
|
import javax.ws.rs.PathParam;
|
||||||
|
|
||||||
|
import de.hsadmin.common.error.TechnicalException;
|
||||||
|
import de.hsadmin.common.error.UserException;
|
||||||
|
import de.hsadmin.login.LoginService;
|
||||||
|
import de.hsadmin.login.RequestContext;
|
||||||
|
import de.hsadmin.service.customer.ContactService;
|
||||||
|
import de.hsadmin.service.customer.ContactVO;
|
||||||
|
|
||||||
|
@Path("/contacts")
|
||||||
|
public class ContactsAPI {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
LoginService login;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
ContactService ejb;
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("/{customer}")
|
||||||
|
public List<ContactVO> getContactsByMember(@PathParam("customer") String customer, @HeaderParam("Authorization") String ticket) throws UserException, TechnicalException {
|
||||||
|
RequestContext context = login.createContext(ticket, null);
|
||||||
|
ContactVO vo = new ContactVO();
|
||||||
|
vo.setCustomer(customer);
|
||||||
|
List<ContactVO> list = ejb.read(context, vo);
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user