Skip to content

Commit

Permalink
remove OpenMRS Formatter and re-format
Browse files Browse the repository at this point in the history
  • Loading branch information
mogoodrich committed Jan 7, 2025
1 parent c0609d5 commit be8d7b3
Show file tree
Hide file tree
Showing 32 changed files with 1,025 additions and 1,245 deletions.
278 changes: 0 additions & 278 deletions OpenMRSFormatter.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -27,49 +27,50 @@
import org.springframework.stereotype.Component;

/**
* This class contains the logic that is run every time this module is either started or stopped.
* This class contains the logic that is run every time this module is either
* started or stopped.
*/
@Component(AttachmentsConstants.COMPONENT_ATT_ACTIVATOR)
public class AttachmentsActivator extends BaseModuleActivator {

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

/**
* @see ModuleActivator${symbol_pound}willRefreshContext()
*/
public void willRefreshContext() {
log.info("Refreshing " + AttachmentsConstants.MODULE_NAME + " Module");
}

/**
* @see ModuleActivator${symbol_pound}contextRefreshed()
*/
public void contextRefreshed() {
log.info(AttachmentsConstants.MODULE_NAME + " Module refreshed");
}

/**
* @see ModuleActivator${symbol_pound}willStart()
*/
public void willStart() {
log.info("Starting " + AttachmentsConstants.MODULE_NAME + " Module");
}

/**
* @see ModuleActivator${symbol_pound}started()
*/
public void started() {

// Concepts Complex
{
final String name = AttachmentsConstants.MODULE_SHORT_ID + " DEFAULT ATTACHMENT";
final String desc = "Concept complex for 'default attachment' complex obs.";
final String uuid = AttachmentsConstants.CONCEPT_DEFAULT_UUID;

ConceptService conceptService = Context.getConceptService();

if (null == conceptService.getConceptByUuid(uuid)) {

ConceptComplex conceptComplex = new ConceptComplex();
conceptComplex.setUuid(uuid);
conceptComplex.setHandler(DefaultAttachmentHandler.class.getSimpleName());
Expand All @@ -79,19 +80,19 @@ public void started() {
conceptComplex.setConceptClass(conceptService.getConceptClassByName("Question"));
conceptComplex.setDatatype(conceptService.getConceptDatatypeByUuid(ConceptDatatype.COMPLEX_UUID));
conceptComplex.addDescription(new ConceptDescription(desc, Locale.ENGLISH));

conceptService.saveConcept(conceptComplex);
}
}
{
final String name = AttachmentsConstants.MODULE_SHORT_ID + " IMAGE ATTACHMENT";
final String desc = "Concept complex for 'image attachments with thumbnails' complex obs.";
final String uuid = AttachmentsConstants.CONCEPT_IMAGE_UUID;

ConceptService conceptService = Context.getConceptService();

if (null == conceptService.getConceptByUuid(uuid)) {

ConceptComplex conceptComplex = new ConceptComplex();
conceptComplex.setUuid(uuid);
conceptComplex.setHandler(ImageAttachmentHandler.class.getSimpleName());
Expand All @@ -101,43 +102,43 @@ public void started() {
conceptComplex.setConceptClass(conceptService.getConceptClassByName("Question"));
conceptComplex.setDatatype(conceptService.getConceptDatatypeByUuid(ConceptDatatype.COMPLEX_UUID));
conceptComplex.addDescription(new ConceptDescription(desc, Locale.ENGLISH));

conceptService.saveConcept(conceptComplex);
}
}

// Encounter Type
{
final String name = "Attachment Upload";
final String desc = "Encounters used to record uploads of attachments.";
final String uuid = AttachmentsConstants.ENCOUNTER_TYPE_UUID; // this is also the default GP value set in
// config.xml
// config.xml

EncounterService es = Context.getEncounterService();
EncounterType encounterType = es.getEncounterTypeByUuid(uuid);

if (encounterType == null) {
encounterType = new EncounterType(name, desc);
encounterType.setUuid(uuid);
es.saveEncounterType(encounterType);
}
}

log.info(AttachmentsConstants.MODULE_NAME + " Module started");
}

/**
* @see ModuleActivator${symbol_pound}willStop()
*/
public void willStop() {
log.info("Stopping " + AttachmentsConstants.MODULE_NAME + " Module");
}

/**
* @see ModuleActivator${symbol_pound}stopped()
*/
public void stopped() {
log.info(AttachmentsConstants.MODULE_NAME + " Module stopped");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -10,135 +10,133 @@
package org.openmrs.module.attachments;

public class AttachmentsConstants {

public static enum ContentFamily {
IMAGE,
PDF,
OTHER
IMAGE, PDF, OTHER
}

/*
* Module ids
*/
public static final String MODULE_NAME = "Attachments";

public static final String MODULE_ARTIFACT_ID = "attachments";

public static final String MODULE_SHORT_ID = "ATT";

public static final String MODULE_BASE_URL = "/" + MODULE_ARTIFACT_ID;

public static final String ATTACHMENT_URI = "attachment";

public static final String UPLOAD_ATTACHMENT_URL = "/rest/v1/" + ATTACHMENT_URI;

public static final String LEGACY_UPLOAD_ATTACHMENT_URL = MODULE_BASE_URL + "/upload";

public static final String DOWNLOAD_ATTACHMENT_URL = MODULE_BASE_URL + "/download";

public static final String ATTACHMENT_BYTES_URI = "/{uuid}/bytes";

/*
* Spring components qualifiers
*/
public static final String COMPONENT_ATT_CONTEXT = MODULE_ARTIFACT_ID + ".AttachmentsContext";

public static final String COMPONENT_ATT_ACTIVATOR = MODULE_ARTIFACT_ID + ".AttachmentsActivator";

public static final String COMPONENT_COMPLEXDATA_HELPER = MODULE_ARTIFACT_ID + ".ComplexDataHelper";

public static final String COMPONENT_VISIT_COMPATIBILITY = MODULE_ARTIFACT_ID + ".VisitCompatibility";

public static final String COMPONENT_COMPLEXOBS_SAVER = MODULE_ARTIFACT_ID + ".ComplexObsSaver";

public static final String COMPONENT_COMPLEXVIEW_HELPER = MODULE_ARTIFACT_ID + ".ComplexViewHelper";

/*
* Concepts (also used in global prop. in config.xml)
*/
public static final String CONCEPT_DEFAULT_UUID = "42ed45fd-f3f6-44b6-bfc2-8bde1bb41e00";

public static final String CONCEPT_IMAGE_UUID = "7cac8397-53cd-4f00-a6fe-028e8d743f8e";

public static final String ENCOUNTER_TYPE_UUID = "5021b1a1-e7f6-44b4-ba02-da2f2bcf8718";

/*
* Docs config
*/
public static final String INSTRUCTIONS_PREFIX = "instructions";

public static final String UNKNOWN_MIME_TYPE = "application/octet-stream";

public static final String ATT_VIEW_ORIGINAL = "complexdata.view.original";

public static final String ATT_VIEW_THUMBNAIL = "complexdata.view.thumbnail";

public static final String ATT_VIEW_CRUD = ATT_VIEW_ORIGINAL; // Use this view for CRUD operations where a view must
// be provided.
// be provided.

public static final String ATT_VIEW_RANDOM = "complexdata.view.random:m3k0m";

public static final String IMAGE_HANDLER_VIEW = "RAW_VIEW"; // Default/unique view handled by Core's ImageHandler

public static final String BINARYDATA_HANDLER_VIEW = "RAW_VIEW"; // Default/unique view handled by Core's
// BinaryDataHandler
// BinaryDataHandler

/*
* Global properties
*/
public static final String GP_DEFAULT_CONCEPT_COMPLEX_UUID = MODULE_ARTIFACT_ID + ".defaultConceptComplexUuid";

public static final String GP_CONCEPT_COMPLEX_UUID_MAP = MODULE_ARTIFACT_ID + ".conceptComplexUuidMap"; // Map
// between
// content
// families
// and
// concept
// complex
// UUIDs
// between
// content
// families
// and
// concept
// complex
// UUIDs

public static final String GP_CONCEPT_COMPLEX_UUID_LIST = MODULE_ARTIFACT_ID + ".conceptComplexUuidList"; // List of
// concepts
// complex
// UUIDs
// for
// listing/viewing.
// concepts
// complex
// UUIDs
// for
// listing/viewing.

public static final String GP_ENCOUNTER_TYPE_UUID = MODULE_ARTIFACT_ID + ".encounterTypeUuid";

public static final String GP_ASSOCIATE_WITH_VISIT = MODULE_ARTIFACT_ID + ".associateWithVisit";

public static final String GP_MAX_UPLOAD_FILE_SIZE = MODULE_ARTIFACT_ID + ".maxUploadFileSize";

public static final String GP_MAX_STORAGE_FILE_SIZE = MODULE_ARTIFACT_ID + ".maxStorageFileSize";

public static final String GP_ALLOWED_FILE_EXTENSIONS = MODULE_ARTIFACT_ID + ".allowedFileExtensions";

public static final String GP_DENIED_FILE_NAMES = MODULE_ARTIFACT_ID + ".deniedFileNames";

public static final String GP_WEBCAM_ALLOWED = MODULE_ARTIFACT_ID + ".allowWebcam";

public static final String GP_ENCOUNTER_SAVING_FLOW = MODULE_ARTIFACT_ID + ".encounterSavingFlow";

public static final String GP_ALLOW_NO_CAPTION = MODULE_ARTIFACT_ID + ".allowNoCaption";

public static final String GP_DASHBOARD_THUMBNAIL_COUNT = MODULE_ARTIFACT_ID + ".dashboardThumbnailCount";

// Should always be the same as
// RestConstants.MAX_RESULTS_DEFAULT_GLOBAL_PROPERTY_NAME
public static final String GP_RESTWS_MAX_RESULTS_DEFAULT_GLOBAL_PROPERTY_NAME = "webservices.rest.maxResultsDefault";

/*
* REST
*/
public static final String REPRESENTATION_OBS = "(uuid:ref,comment:ref,obsDatetime:ref)";

public static final String REPRESENTATION_VISIT = "(uuid:ref,stopDatetime:ref)";

/**
* PRIVILEGES
*/
public static final String CREATE_ATTACHMENTS = "Create Attachments";

public static final String VIEW_ATTACHMENTS = "View Attachments";
}
Loading

0 comments on commit be8d7b3

Please sign in to comment.