/**
 * The contents of this file are subject to the OpenMRS Public License
 * Version 1.0 (the "License"); you may not use this file except in
 * compliance with the License. You may obtain a copy of the License at
 * http://license.openmrs.org
 *
 * Software distributed under the License is distributed on an "AS IS"
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
 * License for the specific language governing rights and limitations
 * under the License.
 *
 * Copyright (C) OpenMRS, LLC.  All Rights Reserved.
 */
package org.openmrs.module.webservices.rest.web.v1_0.resource;

import org.openmrs.annotation.Handler;
import org.openmrs.api.context.Context;
import org.openmrs.hl7.HL7Source;
import org.openmrs.module.webservices.rest.web.RequestContext;
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.DelegatingResourceDescription;
import org.openmrs.module.webservices.rest.web.resource.impl.MetadataDelegatingCrudResource;
import org.openmrs.module.webservices.rest.web.response.ResourceDoesNotSupportOperationException;
import org.openmrs.module.webservices.rest.web.response.ResponseException;

/**
 * {@link Resource} for {@link HL7Source}, supporting standard CRUD operations
 */
@Resource("hl7source")
@Handler(supports = HL7Source.class, order = 0)
public class HL7SourceResource extends MetadataDelegatingCrudResource<HL7Source> {
	
	/**
	 * @see org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource#getByUniqueId(java.lang.String)
	 */
	@Override
	public HL7Source getByUniqueId(String uniqueId) {
		return Context.getHL7Service().getHL7SourceByName(uniqueId);
	}
	
	/**
	 * @see org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource#getRepresentationDescription(org.openmrs.module.webservices.rest.web.representation.Representation)
	 */
	@Override
	public DelegatingResourceDescription getRepresentationDescription(Representation rep) {
		return null;
	}
	
	/**
	 * @see org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource#newDelegate()
	 */
	@Override
	public HL7Source newDelegate() {
		return new HL7Source();
	}
	
	/**
	 * @see org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource#purge(java.lang.Object, org.openmrs.module.webservices.rest.web.RequestContext)
	 */
	@Override
	public void purge(HL7Source delegate, RequestContext context) throws ResponseException {
		throw new ResourceDoesNotSupportOperationException();
	}
	
	/**
	 * @see org.openmrs.module.webservices.rest.web.resource.impl.DelegatingResourceHandler#save(java.lang.Object)
	 */
	@Override
	public HL7Source save(HL7Source delegate) {
		return Context.getHL7Service().saveHL7Source(delegate);
	}
	
}

@@ -2939,11 +2939,427 @@
 %0A%09%7D%0D%0A%09%0D%0A
+%09/**%0D%0A%09 * @see org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource#getCreatableProperties()%0D%0A%09 */%0D%0A%09@Override%0D%0A%09public DelegatingResourceDescription getCreatableProperties() %7B%0D%0A%09%09DelegatingResourceDescription description = new DelegatingResourceDescription();%0D%0A%09%09%0D%0A%09%09description.addRequiredProperty(%22name%22);%0D%0A%09%09description.addRequiredProperty(%22description%22);%0D%0A%09%09%0D%0A%09%09return description;%0D%0A%09%7D%0D%0A
 %7D%0D%0A

Define creatable/updatable properties on HL7Source resource - RESTWS-236