Skip to content
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

RESTWS-963: Remove the manual methods used for swagger spec generation #100

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
import java.util.ArrayList;
import java.util.List;

import io.swagger.models.Model;
import io.swagger.models.ModelImpl;
import io.swagger.models.properties.IntegerProperty;
import io.swagger.models.properties.StringProperty;
import org.apache.commons.lang3.StringUtils;
import org.openmrs.api.context.Context;
import org.openmrs.module.patientflags.DisplayPoint;
Expand Down Expand Up @@ -75,16 +71,6 @@ public DelegatingResourceDescription getRepresentationDescription(Representation
return description;
}

@Override
public Model getGETModel(Representation rep) {
ModelImpl model = (ModelImpl) super.getGETModel(rep);
return model
.property("uuid", new StringProperty())
.property("displayPointId", new IntegerProperty())
.property("name", new StringProperty())
.property("auditInfo", new StringProperty());
}

@Override
protected PageableResult doGetAll(RequestContext context) throws ResponseException {
return new NeedsPaging<DisplayPoint>(getService().getAllDisplayPoints(), context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@
import java.util.Arrays;
import java.util.List;

import io.swagger.models.Model;
import io.swagger.models.ModelImpl;
import io.swagger.models.properties.BooleanProperty;
import io.swagger.models.properties.RefProperty;
import io.swagger.models.properties.StringProperty;
import org.apache.commons.lang3.StringUtils;
import org.openmrs.Patient;
import org.openmrs.api.context.Context;
Expand Down Expand Up @@ -99,42 +94,6 @@ public DelegatingResourceDescription getUpdatableProperties() {
return cp;
}

@Override
public Model getGETModel(Representation rep) {
ModelImpl model = (ModelImpl) super.getGETModel(rep);
if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) {
model.property("uuid", new StringProperty());
model.property("name", new StringProperty());
model.property("criteria", new StringProperty());
model.property("evaluator", new StringProperty());
model.property("message", new StringProperty());
model.property("priority", new RefProperty("#/definitions/PatientflagsPriorityGet"));
model.property("enabled", new BooleanProperty());
model.property("tags", new RefProperty("#/definitions/PatientflagsTagGet"));
model.property("auditInfo", new StringProperty());
}
return model;
}

@Override
public Model getCREATEModel(Representation rep) {
ModelImpl model = (ModelImpl) super.getCREATEModel(rep);
model.property("name", new StringProperty());
model.property("criteria", new StringProperty());
model.property("evaluator", new StringProperty());
model.property("message", new StringProperty());
model.property("priority", new RefProperty("#/definitions/PatientflagsPriorityCreate"));
model.property("enabled", new BooleanProperty());
model.property("tags", new RefProperty("#/definitions/PatientflagsTagCreate"))
.required("name").required("criteria").required("evaluator").required("message");
return model;
}

@Override
public Model getUPDATEModel(Representation rep) {
return getCREATEModel(rep);
}

@Override
public Flag getByUniqueId(String flagId) {
Flag flag = Context.getService(FlagService.class).getFlagByUuid(flagId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@

import java.util.Arrays;

import io.swagger.models.Model;
import io.swagger.models.ModelImpl;
import io.swagger.models.properties.IntegerProperty;
import io.swagger.models.properties.StringProperty;
import org.openmrs.api.context.Context;
import org.openmrs.module.patientflags.Priority;
import org.openmrs.module.patientflags.api.FlagService;
Expand Down Expand Up @@ -51,20 +47,6 @@ public DelegatingResourceDescription getRepresentationDescription(Representation
return description;
}

@Override
public Model getGETModel(Representation rep) {
ModelImpl model = (ModelImpl) super.getGETModel(rep);
if (rep instanceof FullRepresentation) {
model.property("auditInfo", new IntegerProperty());
} else if (rep instanceof DefaultRepresentation) {
model
.property("name", new StringProperty())
.property("style", new StringProperty())
.property("rank", new IntegerProperty());
}
return model;
}

public Priority newDelegate() {
return new Priority();
}
Expand All @@ -84,16 +66,6 @@ public DelegatingResourceDescription getCreatableProperties() {
return cp;
}

@Override
public Model getCREATEModel(Representation rep) {
return new ModelImpl().property("name", new StringProperty()).property("style", new StringProperty()).property("rank", new IntegerProperty());
}

@Override
public Model getUPDATEModel(Representation rep) {
return getCREATEModel(rep);
}

@Override
public DelegatingResourceDescription getUpdatableProperties() {
DelegatingResourceDescription cp = super.getUpdatableProperties();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
package org.openmrs.module.patientflags.web.rest.resources;

import io.swagger.models.Model;
import io.swagger.models.ModelImpl;
import io.swagger.models.properties.BooleanProperty;
import io.swagger.models.properties.RefProperty;
import io.swagger.models.properties.StringProperty;
import org.apache.commons.lang3.StringUtils;
import org.openmrs.Patient;
import org.openmrs.api.context.Context;
Expand Down Expand Up @@ -65,31 +60,6 @@ public DelegatingResourceDescription getCreatableProperties() throws ResourceDoe
return cp;
}

@Override
public Model getGETModel(Representation rep) {
ModelImpl model = (ModelImpl) super.getGETModel(rep);
return model
.property("uuid", new StringProperty())
.property("message", new StringProperty())
.property("patient", new RefProperty("#/definitions/PatientGet"))
.property("flag", new RefProperty("#/definitions/PatientflagsFlagGet"))
.property("tags", new RefProperty("#/definitions/PatientflagsTagCreate"))
.property("voided", new BooleanProperty());
}

@Override
public Model getCREATEModel(Representation rep) {
return new ModelImpl()
.property("patient", new RefProperty("#/definitions/PatientCreate"))
.property("flag", new RefProperty("#/definitions/PatientflagsFlagCreate"))
.property("message", new StringProperty());
}

@Override
public Model getUPDATEModel(Representation rep) {
return getCREATEModel(rep);
}

@Override
public DelegatingResourceDescription getUpdatableProperties() throws ResourceDoesNotSupportOperationException {
return getCreatableProperties();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@
import java.util.ArrayList;
import java.util.List;

import io.swagger.models.Model;
import io.swagger.models.ModelImpl;
import io.swagger.models.properties.ArrayProperty;
import io.swagger.models.properties.IntegerProperty;
import io.swagger.models.properties.RefProperty;
import io.swagger.models.properties.StringProperty;
import org.apache.commons.lang3.StringUtils;
import org.openmrs.api.context.Context;
import org.openmrs.module.patientflags.Tag;
Expand Down Expand Up @@ -72,28 +66,6 @@ public DelegatingResourceDescription getCreatableProperties() {
return cp;
}

@Override
public Model getCREATEModel(Representation rep) {
return new ModelImpl()
.property("name", new StringProperty())
.property("roles", new ArrayProperty(new RefProperty("#/definitions/RoleCreate")))
.property("displayPoints", new ArrayProperty(new RefProperty("#/definitions/PatientflagsDisplaypointCreate")));
}

@Override
public Model getUPDATEModel(Representation rep) {
return getCREATEModel(rep);
}

@Override
public Model getGETModel(Representation rep) {
ModelImpl model = (ModelImpl) super.getGETModel(rep);
return model.property("tagId", new IntegerProperty()).property("name", new StringProperty())
.property("roles", new ArrayProperty(new RefProperty("#/definitions/RoleGet")))
.property("displayPoints", new ArrayProperty(new RefProperty("#/definitions/PatientflagsDisplaypointGet")))
.property("auditInfo", new StringProperty());
}

@Override
public DelegatingResourceDescription getRepresentationDescription(Representation rep) {
DelegatingResourceDescription description = null;
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@
<uiframeworkVersion>3.11.0</uiframeworkVersion>
<metadatadeployVersion>1.8.1</metadatadeployVersion>
<metadatasharingVersion>1.2.2</metadatasharingVersion>
<webservices.rest-omod.version>2.40.0</webservices.rest-omod.version>
<webservices.rest-omod.version>2.47.0-SNAPSHOT</webservices.rest-omod.version>
<legacyuiVersion>1.16.0</legacyuiVersion>
<fhirversion>2.0.0</fhirversion>
<lombokVersion>1.18.26</lombokVersion>
Expand Down
Loading