Skip to content

Commit

Permalink
LUI-159:Add parent, openmrsPlatformVersion and plugin for formatting (o…
Browse files Browse the repository at this point in the history
…penmrs#118)

Add parent, openmrsPlatformVersion and plugin for formatting

Formatting changes

Remove include section
  • Loading branch information
PremnishaTW committed Apr 16, 2020
1 parent 2548574 commit 50a0b83
Show file tree
Hide file tree
Showing 223 changed files with 2,807 additions and 2,580 deletions.
110 changes: 55 additions & 55 deletions api/src/main/java/org/openmrs/module/legacyui/GeneralUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,59 +13,59 @@
import org.openmrs.api.context.Context;

public class GeneralUtils {


public static boolean isValidUuidFormat(String uuid) {
return uuid.length() >= 36 && uuid.length() <= 38 && !uuid.contains(" ");
}

/**
* Get the concept by id, the id can either be 1)an integer id like 5090 or 2)mapping type id
* like "XYZ:HT" or 3)uuid like "a3e12268-74bf-11df-9768-17cfc9833272"
*
* @param id
* @return the concept if exist, else null
* @should find a concept by its conceptId
* @should find a concept by its mapping
* @should find a concept by its uuid
* @should return null otherwise
* @should find a concept by its mapping with a space in between
*/
public static Concept getConcept(String id) {
Concept cpt = null;

if (id != null) {

// see if this is a parseable int; if so, try looking up concept by id
try { //handle integer: id
int conceptId = Integer.parseInt(id);
cpt = Context.getConceptService().getConcept(conceptId);

if (cpt != null) {
return cpt;
}
} catch (Exception ex) {
//do nothing
}

// handle mapping id: xyz:ht
int index = id.indexOf(":");
if (index != -1) {
String mappingCode = id.substring(0, index).trim();
String conceptCode = id.substring(index + 1, id.length()).trim();
cpt = Context.getConceptService().getConceptByMapping(conceptCode, mappingCode);

if (cpt != null) {
return cpt;
}
}

//handle uuid id: "a3e1302b-74bf-11df-9768-17cfc9833272", if the id matches a uuid format
if (isValidUuidFormat(id)) {
cpt = Context.getConceptService().getConceptByUuid(id);
}
}

return cpt;
}
public static boolean isValidUuidFormat(String uuid) {
return uuid.length() >= 36 && uuid.length() <= 38 && !uuid.contains(" ");
}
/**
* Get the concept by id, the id can either be 1)an integer id like 5090 or 2)mapping type id
* like "XYZ:HT" or 3)uuid like "a3e12268-74bf-11df-9768-17cfc9833272"
*
* @param id
* @return the concept if exist, else null
* @should find a concept by its conceptId
* @should find a concept by its mapping
* @should find a concept by its uuid
* @should return null otherwise
* @should find a concept by its mapping with a space in between
*/
public static Concept getConcept(String id) {
Concept cpt = null;
if (id != null) {
// see if this is a parseable int; if so, try looking up concept by id
try { //handle integer: id
int conceptId = Integer.parseInt(id);
cpt = Context.getConceptService().getConcept(conceptId);
if (cpt != null) {
return cpt;
}
}
catch (Exception ex) {
//do nothing
}
// handle mapping id: xyz:ht
int index = id.indexOf(":");
if (index != -1) {
String mappingCode = id.substring(0, index).trim();
String conceptCode = id.substring(index + 1, id.length()).trim();
cpt = Context.getConceptService().getConceptByMapping(conceptCode, mappingCode);
if (cpt != null) {
return cpt;
}
}
//handle uuid id: "a3e1302b-74bf-11df-9768-17cfc9833272", if the id matches a uuid format
if (isValidUuidFormat(id)) {
cpt = Context.getConceptService().getConceptByUuid(id);
}
}
return cpt;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
*/
package org.openmrs.module.legacyui;


import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.openmrs.module.BaseModuleActivator;
Expand All @@ -21,7 +20,7 @@
public class LegacyUIActivator extends BaseModuleActivator {

protected Log log = LogFactory.getLog(getClass());

/**
* @see ModuleActivator#willRefreshContext()
*/
Expand Down Expand Up @@ -63,5 +62,5 @@ public void willStop() {
public void stopped() {
log.info("Legacy UI Module stopped");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,4 @@ private HL7InQueueProcessor getHL7InQueueProcessor() {
}
return processor;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class Hl7InArchiveListController {

/**
* Render the archived HL7 messages page
*
*
* @param modelMap
* @return path
*/
Expand All @@ -51,7 +51,7 @@ public String listArchivedHL7s(ModelMap modelMap) {

/**
* method for returning a batch of HL7s from the queue based on datatable parameters
*
*
* @param iDisplayStart start index for search
* @param iDisplayLength amount of terms to return
* @param sSearch search term(s)
Expand All @@ -78,8 +78,8 @@ Map<String, Object> getHL7InArchiveBatchAsJson(@RequestParam("iDisplayStart") in
// build the response
Map<String, Object> response = new HashMap<String, Object>();
response.put("iTotalRecords", Context.getHL7Service().countHL7InArchive(HL7Constants.HL7_STATUS_PROCESSED, null));
response.put("iTotalDisplayRecords", Context.getHL7Service().countHL7InArchive(HL7Constants.HL7_STATUS_PROCESSED,
sSearch));
response.put("iTotalDisplayRecords",
Context.getHL7Service().countHL7InArchive(HL7Constants.HL7_STATUS_PROCESSED, sSearch));
response.put("sEcho", sEcho);
response.put("aaData", results.toArray());

Expand All @@ -89,7 +89,7 @@ Map<String, Object> getHL7InArchiveBatchAsJson(@RequestParam("iDisplayStart") in

/**
* create an object array for a given HL7InArchive
*
*
* @param q HL7InArchive object
* @return object array for use with datatables
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class Hl7InErrorListController {

/**
* Render the HL7 error queue messages page
*
*
* @return path
*/
@RequestMapping("/admin/hl7/hl7InError.htm")
Expand All @@ -49,7 +49,7 @@ public String listErrorHL7s() {

/**
* submits an HL7InError back to the HL7 queue
*
*
* @param id HL7InErrorId for identifying the HL7 message
* @return formatted success or failure message for display
* @throws Exception
Expand Down Expand Up @@ -97,7 +97,7 @@ Map<String, Object> resubmitHL7InError(@RequestParam("hl7InErrorId") int id) thr
/**
* method for returning a batch of HL7s from the queue based on datatable parameters; sorting is
* unavailable at this time
*
*
* @param iDisplayStart start index for search
* @param iDisplayLength amount of terms to return
* @param sSearch search term(s)
Expand Down Expand Up @@ -133,7 +133,7 @@ Map<String, Object> getHL7InErrorBatchAsJson(@RequestParam("iDisplayStart") int

/**
* create an object array for a given HL7InError
*
*
* @param q HL7InError object
* @return object array for use with datatables
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class Hl7InQueueListController {

/**
* Render the pending HL7 queue messages page
*
*
* @param modelMap
* @return path
*/
Expand All @@ -52,7 +52,7 @@ public String listPendingHL7s(ModelMap modelMap) {

/**
* Render the suspended HL7 queue messages page
*
*
* @param modelMap
* @return path
*/
Expand All @@ -64,7 +64,7 @@ public String listSuspendedHL7s(ModelMap modelMap) {

/**
* suspends or restores a HL7InQueue based on current status
*
*
* @param id HL7InQueueId for identifying the HL7 message
* @return formatted success or failure message for display
* @throws Exception
Expand Down Expand Up @@ -116,7 +116,7 @@ Map<String, Object> toggleHL7InQueue(@RequestParam("hl7InQueueId") int id) throw

/**
* method for returning a batch of HL7s from the queue based on datatable parameters
*
*
* @param iDisplayStart start index for search
* @param iDisplayLength amount of terms to return
* @param sSearch search term(s)
Expand Down Expand Up @@ -154,7 +154,7 @@ Map<String, Object> getHL7InQueueBatchAsJson(@RequestParam("iDisplayStart") int

/**
* create an object array for a given HL7InQueue
*
*
* @param q HL7InQueue object
* @return object array for use with datatables
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ public void setPerson(Person person) {
this.person = person;
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,9 @@ public class ModuleListController extends SimpleFormController {
/**
* The onSubmit function receives the form/command object that was modified by the input form
* and saves it to the db
*
*
* @see org.springframework.web.servlet.mvc.SimpleFormController#onSubmit(HttpServletRequest,
* HttpServletResponse, Object,
* BindException)
* HttpServletResponse, Object, BindException)
*/
@Override
protected ModelAndView onSubmit(HttpServletRequest request, HttpServletResponse response, Object command,
Expand Down Expand Up @@ -302,10 +301,11 @@ protected ModelAndView onSubmit(HttpServletRequest request, HttpServletResponse

return new ModelAndView(new RedirectView(view));
}

/**
* @param modulesToStart
* @return a new list, with the same elements as modulesToStart, sorted so that no module is before a module it depends on
* @return a new list, with the same elements as modulesToStart, sorted so that no module is
* before a module it depends on
* @should sort modules correctly
*/
List<Module> sortStartupOrder(List<Module> modulesToStart) {
Expand All @@ -322,11 +322,11 @@ List<Module> sortStartupOrder(List<Module> modulesToStart) {
}
return ret;
}

/**
* Looks for a module in the list that doesn't depend on any other modules in the list.
* If any is found, that module is removed from the list and returned.
*
* Looks for a module in the list that doesn't depend on any other modules in the list. If any
* is found, that module is removed from the list and returned.
*
* @param candidates
* @return
*/
Expand All @@ -347,11 +347,11 @@ private Module removeModuleWithNoDependencies(List<Module> candidates) {
}
return null;
}

/**
* This is called prior to displaying a form for the first time. It tells Spring the
* form/command object to load into the request
*
*
* @see org.springframework.web.servlet.mvc.AbstractFormController#formBackingObject(HttpServletRequest)
*/
@Override
Expand All @@ -370,10 +370,10 @@ protected Map<String, Object> referenceData(HttpServletRequest request) throws E
MessageSourceAccessor msa = getMessageSourceAccessor();

map.put("allowAdmin", ModuleUtil.allowAdmin().toString());
map.put("disallowUploads", msa.getMessage("Module.disallowUploads",
new String[] { ModuleConstants.RUNTIMEPROPERTY_ALLOW_ADMIN }));
map.put("disallowUploads",
msa.getMessage("Module.disallowUploads", new String[] { ModuleConstants.RUNTIMEPROPERTY_ALLOW_ADMIN }));

map.put("openmrsVersion", OpenmrsConstants.OPENMRS_VERSION_SHORT);
map.put("openmrsPlatformVersion", OpenmrsConstants.OPENMRS_VERSION_SHORT);
map.put("moduleRepositoryURL", WebConstants.MODULE_REPOSITORY_URL);

map.put("loadedModules", ModuleFactory.getLoadedModules());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
import org.springframework.web.bind.annotation.ResponseBody;

/**
* Controller which allows users to identify dependencies between modules for shutdown/restart purposes.
* Controller which allows users to identify dependencies between modules for shutdown/restart
* purposes.
*/
@Controller
@RequestMapping(value = "/admin/modules/manage/")
Expand Down
Loading

0 comments on commit 50a0b83

Please sign in to comment.