Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package org.openmrs.module.receivedrugs.web.controller;
- import org.openmrs.api.context.Context;
- import org.openmrs.module.receivedrugs.api.ReceivedrugsService;
- import org.openmrs.module.receivedrugs.api.pojo.ReceiveDrugs;
- import org.openmrs.module.webservices.rest.web.RequestContext;
- import org.openmrs.module.webservices.rest.web.RestConstants;
- import org.openmrs.module.webservices.rest.web.annotation.Resource;
- import org.openmrs.module.webservices.rest.web.representation.Representation;
- import org.openmrs.module.webservices.rest.web.resource.impl.DataDelegatingCrudResource;
- import org.openmrs.module.webservices.rest.web.resource.impl.DelegatingResourceDescription;
- import org.openmrs.module.webservices.rest.web.resource.impl.NeedsPaging;
- import org.openmrs.module.webservices.rest.web.response.ResourceDoesNotSupportOperationException;
- import org.openmrs.module.webservices.rest.web.response.ResponseException;
- @Resource(name = RestConstants.VERSION_1 + "/receivedrugs", supportedClass = ReceiveDrugs.class, supportedOpenmrsVersions = {
- "1.8.*", "2.0.*", "2.1.*", "2.2.*", "2.3.*", "2.4.* " })
- public class ReceivedDrugsSaveResources extends DataDelegatingCrudResource<ReceiveDrugs> {
- @Override
- public DelegatingResourceDescription getRepresentationDescription(Representation r) {
- DelegatingResourceDescription description = new DelegatingResourceDescription();
- description.addProperty("id");
- description.addProperty("locationuuid");
- description.addProperty("grnno");
- description.addProperty("received_from");
- description.addProperty("received_to");
- description.addProperty("order_no");
- description.addProperty("remarks");
- description.addProperty("supplier");
- description.addProperty("receive_date");
- description.addProperty("uuid");
- return description;
- }
- @Override
- public DelegatingResourceDescription getCreatableProperties() {
- DelegatingResourceDescription description = new DelegatingResourceDescription();
- description.addRequiredProperty("locationuuid");
- description.addRequiredProperty("received_from");
- description.addRequiredProperty("received_to");
- description.addRequiredProperty("order_no");
- description.addRequiredProperty("remarks");
- description.addRequiredProperty("supplier");
- description.addRequiredProperty("receive_date");
- description.addRequiredProperty("instituteId");
- return description;
- }
- @Override
- public DelegatingResourceDescription getUpdatableProperties() throws ResourceDoesNotSupportOperationException {
- return getCreatableProperties();
- }
- @Override
- public ReceiveDrugs newDelegate() {
- return new ReceiveDrugs();
- }
- @Override
- public ReceiveDrugs save(ReceiveDrugs t) {
- ReceiveDrugs item = Context.getService(ReceivedrugsService.class).SaveReceiveDrugs(t);
- return item;
- }
- @Override
- protected void delete(ReceiveDrugs t, String arg1, RequestContext arg2) throws ResponseException {
- }
- @Override
- public ReceiveDrugs getByUniqueId(String uuid) {
- return null;
- }
- @Override
- public void purge(ReceiveDrugs t, RequestContext context) throws ResponseException {
- }
- @Override
- public NeedsPaging<ReceiveDrugs> doGetAll(RequestContext context) {
- return null;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement