/*
 * The contents of this file are subject to the OpenMRS Public License
 * Version 2.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.resource;

import org.openmrs.module.openhmis.commons.api.entity.IObjectDataService;
import org.openmrs.module.openhmis.inventory.api.model.StockOperationTransaction;
import org.openmrs.module.openhmis.inventory.web.ModuleRestConstants;
import org.openmrs.module.webservices.rest.web.annotation.Resource;
import org.openmrs.module.webservices.rest.web.representation.RefRepresentation;
import org.openmrs.module.webservices.rest.web.representation.Representation;
import org.openmrs.module.webservices.rest.web.resource.impl.DelegatingResourceDescription;

@Resource(name = ModuleRestConstants.OPERATION_TRANSACTION_RESOURCE, supportedClass=StockOperationTransaction.class,
		supportedOpenmrsVersions={"1.9.*", "1.10.*"})
public class StockOperationTransactionResource extends TransactionBaseResource<StockOperationTransaction> {
	@Override
	public StockOperationTransaction newDelegate() {
		return new StockOperationTransaction();
	}

	@Override
	public Class<? extends IObjectDataService<StockOperationTransaction>> getServiceClass() {
		return null;
	}

	@Override
	public DelegatingResourceDescription getRepresentationDescription(Representation rep) {
		DelegatingResourceDescription description = super.getRepresentationDescription(rep);
		if (!(rep instanceof RefRepresentation)) {
			description.addProperty("patient", Representation.REF);
			description.addProperty("institution", Representation.REF);
		}
		description.addProperty("stockroom", Representation.REF);

		return description;
	}
}


@@ -1827,16 +1827,80 @@
 n(rep);%0A
+%09%09%0A%09%09description.addProperty(%22stockroom%22, Representation.REF);%0A%0A
 %09%09if (!(
@@ -2065,68 +2065,8 @@
 %0A%09%09%7D
-%0A%09%09description.addProperty(%22stockroom%22, Representation.REF);
 %0A%0A%09%09

change order of property