Skip to content

Instantly share code, notes, and snippets.

@suthagar23
Created March 21, 2018 07:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save suthagar23/dfe7423128c5489077a7661923393875 to your computer and use it in GitHub Desktop.
Save suthagar23/dfe7423128c5489077a7661923393875 to your computer and use it in GitHub Desktop.
/**
* 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.openmrs1_8;
import io.swagger.models.Model;
import io.swagger.models.ModelImpl;
import io.swagger.models.properties.ArrayProperty;
import io.swagger.models.properties.StringProperty;
import org.openmrs.module.webservices.helper.ServerLogActionWrapper;
import org.openmrs.module.webservices.rest.SimpleObject;
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.resource.api.Listable;
import org.openmrs.module.webservices.rest.web.response.ResponseException;
/**
* {@link Resource} for ServerLogController, supporting standard CRUD operations
*/
@Resource(name = RestConstants.VERSION_1 + "/serverlog", supportedClass = ServerLogActionWrapper.class, supportedOpenmrsVersions = {
"1.8.*", "1.9.*", "1.10.*", "1.11.*", "1.12.*", "2.0.*", "2.1.*", "2.2.*" })
public class ServerLogResource1_8 implements Listable {
private ServerLogActionWrapper serverLogActionWrapper = new ServerLogActionWrapper();
public void setServerLogActionWrapper(ServerLogActionWrapper serverLogActionWrapper) {
this.serverLogActionWrapper = serverLogActionWrapper;
}
@Override
public SimpleObject getAll(RequestContext context) throws ResponseException {
SimpleObject rest = new SimpleObject();
rest.put("serverLog", serverLogActionWrapper.getServerLogs());
return rest;
}
public Model getCREATEModel() {
ModelImpl model = new ModelImpl();
model.property("serverLog", new ArrayProperty(new StringProperty()));
return model;
}
@Override
public String getUri(Object instance) {
return RestConstants.URI_PREFIX + "/serverlog";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment