-
Notifications
You must be signed in to change notification settings - Fork 525
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(fix) RESTWS-908 Diagnosis resource should return formNamespace and formPath on core 2.5+ #577
base: master
Are you sure you want to change the base?
Changes from 1 commit
264e1fc
3ff6440
399f469
da91cf5
ebbc9a0
50c14e4
79e86b1
0f1d4ac
96df47b
4d9b8f0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,219 @@ | ||||||||
<?xml version="1.0" encoding="UTF-8"?> | ||||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||||||||
<modelVersion>4.0.0</modelVersion> | ||||||||
|
||||||||
<parent> | ||||||||
<artifactId>webservices.rest</artifactId> | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: indentation
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems to be indented correctly locally in my IDE but when i push the changes that specific section is distorted. |
||||||||
<groupId>org.openmrs.module</groupId> | ||||||||
<version>2.40.0-SNAPSHOT</version> | ||||||||
</parent> | ||||||||
|
||||||||
<artifactId>webservices.rest-omod-2.5</artifactId> | ||||||||
<name>Rest Web Services 2.5 OMOD</name> | ||||||||
|
||||||||
<properties> | ||||||||
<openmrs.version.2.5.0>2.5.0</openmrs.version.2.5.0> | ||||||||
</properties> | ||||||||
|
||||||||
<dependencies> | ||||||||
<dependency> | ||||||||
<groupId>${project.parent.groupId}</groupId> | ||||||||
<artifactId>${project.parent.artifactId}-omod-common</artifactId> | ||||||||
<version>${project.parent.version}</version> | ||||||||
</dependency> | ||||||||
|
||||||||
<dependency> | ||||||||
<groupId>${project.parent.groupId}</groupId> | ||||||||
<artifactId>${project.parent.artifactId}-omod-common</artifactId> | ||||||||
<version>${project.parent.version}</version> | ||||||||
<classifier>tests</classifier> | ||||||||
<scope>test</scope> | ||||||||
</dependency> | ||||||||
|
||||||||
<dependency> | ||||||||
<groupId>${project.parent.groupId}</groupId> | ||||||||
<artifactId>${project.parent.artifactId}-omod-1.8</artifactId> | ||||||||
<version>${project.parent.version}</version> | ||||||||
</dependency> | ||||||||
|
||||||||
<dependency> | ||||||||
<groupId>${project.parent.groupId}</groupId> | ||||||||
<artifactId>${project.parent.artifactId}-omod-1.8</artifactId> | ||||||||
<version>${project.parent.version}</version> | ||||||||
<classifier>tests</classifier> | ||||||||
<scope>test</scope> | ||||||||
</dependency> | ||||||||
|
||||||||
<dependency> | ||||||||
<groupId>${project.parent.groupId}</groupId> | ||||||||
<artifactId>${project.parent.artifactId}-omod-1.9</artifactId> | ||||||||
<version>${project.parent.version}</version> | ||||||||
</dependency> | ||||||||
|
||||||||
<dependency> | ||||||||
<groupId>${project.parent.groupId}</groupId> | ||||||||
<artifactId>${project.parent.artifactId}-omod-1.9</artifactId> | ||||||||
<version>${project.parent.version}</version> | ||||||||
<classifier>tests</classifier> | ||||||||
<scope>test</scope> | ||||||||
</dependency> | ||||||||
|
||||||||
<dependency> | ||||||||
<groupId>${project.parent.groupId}</groupId> | ||||||||
<artifactId>${project.parent.artifactId}-omod-1.10</artifactId> | ||||||||
<version>${project.parent.version}</version> | ||||||||
</dependency> | ||||||||
|
||||||||
<dependency> | ||||||||
<groupId>${project.parent.groupId}</groupId> | ||||||||
<artifactId>${project.parent.artifactId}-omod-1.10</artifactId> | ||||||||
<version>${project.parent.version}</version> | ||||||||
<classifier>tests</classifier> | ||||||||
<scope>test</scope> | ||||||||
</dependency> | ||||||||
|
||||||||
<dependency> | ||||||||
<groupId>${project.parent.groupId}</groupId> | ||||||||
<artifactId>${project.parent.artifactId}-omod-1.11</artifactId> | ||||||||
<version>${project.parent.version}</version> | ||||||||
</dependency> | ||||||||
|
||||||||
<dependency> | ||||||||
<groupId>${project.parent.groupId}</groupId> | ||||||||
<artifactId>${project.parent.artifactId}-omod-1.11</artifactId> | ||||||||
<version>${project.parent.version}</version> | ||||||||
<classifier>tests</classifier> | ||||||||
<scope>test</scope> | ||||||||
</dependency> | ||||||||
|
||||||||
<dependency> | ||||||||
<groupId>${project.parent.groupId}</groupId> | ||||||||
<artifactId>${project.parent.artifactId}-omod-2.0</artifactId> | ||||||||
<version>${project.parent.version}</version> | ||||||||
</dependency> | ||||||||
|
||||||||
<dependency> | ||||||||
<groupId>${project.parent.groupId}</groupId> | ||||||||
<artifactId>${project.parent.artifactId}-omod-2.2</artifactId> | ||||||||
<version>${project.parent.version}</version> | ||||||||
</dependency> | ||||||||
|
||||||||
<dependency> | ||||||||
<groupId>${project.parent.groupId}</groupId> | ||||||||
<artifactId>${project.parent.artifactId}-omod-2.2</artifactId> | ||||||||
<version>${project.parent.version}</version> | ||||||||
<classifier>tests</classifier> | ||||||||
<scope>test</scope> | ||||||||
</dependency> | ||||||||
|
||||||||
<dependency> | ||||||||
<groupId>${project.parent.groupId}</groupId> | ||||||||
<artifactId>${project.parent.artifactId}-omod-2.3</artifactId> | ||||||||
<version>${project.parent.version}</version> | ||||||||
</dependency> | ||||||||
|
||||||||
<dependency> | ||||||||
<groupId>${project.parent.groupId}</groupId> | ||||||||
<artifactId>${project.parent.artifactId}-omod-2.3</artifactId> | ||||||||
<version>${project.parent.version}</version> | ||||||||
<classifier>tests</classifier> | ||||||||
<scope>test</scope> | ||||||||
</dependency> | ||||||||
|
||||||||
<dependency> | ||||||||
<groupId>${project.parent.groupId}</groupId> | ||||||||
<artifactId>${project.parent.artifactId}-omod-2.4</artifactId> | ||||||||
<version>${project.parent.version}</version> | ||||||||
</dependency> | ||||||||
|
||||||||
<dependency> | ||||||||
<groupId>${project.parent.groupId}</groupId> | ||||||||
<artifactId>${project.parent.artifactId}-omod-2.4</artifactId> | ||||||||
<version>${project.parent.version}</version> | ||||||||
<classifier>tests</classifier> | ||||||||
<scope>test</scope> | ||||||||
</dependency> | ||||||||
|
||||||||
<dependency> | ||||||||
<groupId>${project.parent.groupId}</groupId> | ||||||||
<artifactId>${project.parent.artifactId}-omod-2.0</artifactId> | ||||||||
<version>${project.parent.version}</version> | ||||||||
<classifier>tests</classifier> | ||||||||
<scope>test</scope> | ||||||||
</dependency> | ||||||||
|
||||||||
<dependency> | ||||||||
<groupId>org.openmrs.api</groupId> | ||||||||
<artifactId>openmrs-api</artifactId> | ||||||||
<version>${openmrs.version.2.5.0}</version><!--$NO-MVN-MAN-VER$--> | ||||||||
suubi-joshua marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||
</dependency> | ||||||||
|
||||||||
<dependency> | ||||||||
<groupId>org.openmrs.api</groupId> | ||||||||
<artifactId>openmrs-api</artifactId> | ||||||||
<type>test-jar</type> | ||||||||
<scope>test</scope> | ||||||||
<version>${openmrs.version.2.5.0}</version><!--$NO-MVN-MAN-VER$--> | ||||||||
</dependency> | ||||||||
|
||||||||
<dependency> | ||||||||
<groupId>org.openmrs.web</groupId> | ||||||||
<artifactId>openmrs-web</artifactId> | ||||||||
<version>${openmrs.version.2.5.0}</version> <!-- $NO-MVN-MAN-VER$ --> | ||||||||
<exclusions> | ||||||||
<exclusion> | ||||||||
<groupId>javax.servlet</groupId> | ||||||||
<artifactId>servlet-api</artifactId> | ||||||||
</exclusion> | ||||||||
</exclusions> | ||||||||
</dependency> | ||||||||
|
||||||||
<dependency> | ||||||||
<groupId>org.openmrs.web</groupId> | ||||||||
<artifactId>openmrs-web</artifactId> | ||||||||
<type>test-jar</type> | ||||||||
<scope>test</scope> | ||||||||
<version>${openmrs.version.2.5.0}</version> <!-- $NO-MVN-MAN-VER$--> | ||||||||
</dependency> | ||||||||
|
||||||||
<dependency> | ||||||||
<groupId>org.openmrs.test</groupId> | ||||||||
<artifactId>openmrs-test</artifactId> | ||||||||
<type>pom</type> | ||||||||
<scope>test</scope> | ||||||||
<version>${openmrs.version.2.5.0}</version> <!-- $NO-MVN-MAN-VER$ --> | ||||||||
</dependency> | ||||||||
|
||||||||
<dependency> | ||||||||
<groupId>javax.servlet</groupId> | ||||||||
<artifactId>javax.servlet-api</artifactId> | ||||||||
<version>${javaxVersion}</version> | ||||||||
<scope>test</scope> | ||||||||
</dependency> | ||||||||
|
||||||||
<dependency> | ||||||||
<groupId>org.apache.tomcat</groupId> | ||||||||
<artifactId>jasper</artifactId> | ||||||||
<version>6.0.18</version> | ||||||||
<scope>provided</scope> | ||||||||
</dependency> | ||||||||
|
||||||||
</dependencies> | ||||||||
|
||||||||
<build> | ||||||||
<plugins> | ||||||||
<plugin> | ||||||||
<groupId>org.jacoco</groupId> | ||||||||
<artifactId>jacoco-maven-plugin</artifactId> | ||||||||
</plugin> | ||||||||
<plugin> | ||||||||
<groupId>com.mycila</groupId> | ||||||||
<artifactId>license-maven-plugin</artifactId> | ||||||||
<configuration> | ||||||||
<header>${project.parent.basedir}/license-header.txt</header> | ||||||||
</configuration> | ||||||||
</plugin> | ||||||||
</plugins> | ||||||||
</build> | ||||||||
|
||||||||
</project> | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/** | ||
* This Source Code Form is subject to the terms of the Mozilla Public License, | ||
* v. 2.0. If a copy of the MPL was not distributed with this file, You can | ||
* obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under | ||
* the terms of the Healthcare Disclaimer located at http://openmrs.org/license. | ||
* | ||
* Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS | ||
* graphic logo is a trademark of OpenMRS Inc. | ||
*/ | ||
package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs2_5; | ||
|
||
import org.openmrs.Diagnosis; | ||
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.DefaultRepresentation; | ||
import org.openmrs.module.webservices.rest.web.representation.FullRepresentation; | ||
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.response.ResourceDoesNotSupportOperationException; | ||
import org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs2_2.DiagnosisResource2_2; | ||
|
||
/** | ||
* {@link Resource} for Diagnosis, supporting standard CRUD operations | ||
*/ | ||
@Resource(name = RestConstants.VERSION_1 | ||
+ "/patientdiagnoses", supportedClass = Diagnosis.class, supportedOpenmrsVersions = { "2.5.* - 9.*" }) | ||
public class DiagnosisResource2_5 extends DiagnosisResource2_2 { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should also have a change to DiagnosisResource2_2 so that it's only supported up to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should I create another ticket to resolve this? |
||
|
||
/** | ||
* @see org.openmrs.module.webservices.rest.web.resource.impl.DelegatingCrudResource#getRepresentationDescription(org.openmrs.module.webservices.rest.web.representation.Representation) | ||
*/ | ||
@Override | ||
public DelegatingResourceDescription getRepresentationDescription(Representation representation) { | ||
if (representation instanceof DefaultRepresentation) { | ||
DelegatingResourceDescription description = super.getRepresentationDescription(representation); | ||
description.addProperty("formNamespace"); | ||
description.addProperty("formPath"); | ||
return description; | ||
} else if (representation instanceof FullRepresentation) { | ||
DelegatingResourceDescription description = super.getRepresentationDescription(representation); | ||
description.addProperty("formNamespace"); | ||
description.addProperty("formPath"); | ||
return description; | ||
} | ||
|
||
return null; | ||
} | ||
|
||
/** | ||
* @see org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource#getCreatableProperties() | ||
*/ | ||
@Override | ||
public DelegatingResourceDescription getCreatableProperties() throws ResourceDoesNotSupportOperationException { | ||
DelegatingResourceDescription description = super.getCreatableProperties(); | ||
|
||
description.addRequiredProperty("formNamespace"); | ||
description.addRequiredProperty("formPath"); | ||
|
||
return description; | ||
|
||
} | ||
|
||
/** | ||
* @see org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource#getUpdatableProperties() | ||
*/ | ||
@Override | ||
public DelegatingResourceDescription getUpdatableProperties() throws ResourceDoesNotSupportOperationException { | ||
DelegatingResourceDescription description = super.getUpdatableProperties(); | ||
|
||
description.addRequiredProperty("formNamespace"); | ||
description.addRequiredProperty("formPath"); | ||
|
||
return description; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/** | ||
* This Source Code Form is subject to the terms of the Mozilla Public License, | ||
* v. 2.0. If a copy of the MPL was not distributed with this file, You can | ||
* obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under | ||
* the terms of the Healthcare Disclaimer located at http://openmrs.org/license. | ||
* | ||
* Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS | ||
* graphic logo is a trademark of OpenMRS Inc. | ||
*/ | ||
package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs2_5; | ||
|
||
import org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs2_2.DiagnosisResource2_2; | ||
import org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs2_2.DiagnosisResource2_2Test; | ||
|
||
/** | ||
* Tests functionality of {@link DiagnosisResource2_2}. | ||
*/ | ||
public class DiagnosisResource2_5Test extends DiagnosisResource2_2Test { | ||
|
||
@Override | ||
public void validateDefaultRepresentation() throws Exception { | ||
super.validateDefaultRepresentation(); | ||
assertPropPresent("formNamespace"); | ||
assertPropPresent("formPath"); | ||
} | ||
|
||
@Override | ||
public void validateFullRepresentation() throws Exception { | ||
super.validateDefaultRepresentation(); | ||
assertPropPresent("formNamespace"); | ||
assertPropPresent("formPath"); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just use the profiles: