Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

Introduction

This document describes the steps to add customised tokens used for various label types in OpenSpecimen. For example specimen print tokens, specimen label tokens, visit label tokens, PPID label tokens, etc. This guide is intended for developers or technical IT staff. 

Prerequisites

  1. Know how to create plugins in OpenSpecimen - how to write a plugin for OpenSpecimen?
  2. Know Java programming language

Steps   

 Below is the detailed example of specimen print label token to add collection container name. At the bottom of each step, specified the changes required to implement other type of tokens.

  1. Write a Java class that extends AbstractLabelTmplToken and implements LabelTmplToken. The following example describes how to implement LabelTmplToken:

...

Code Block
<bean id="pluginInitializer" class="com.krishagni.openspecimen.plugin.init.PluginInitializer">
  <property name="labelTokensRegistrar" ref="specimenPrintLabelTokensRegistrar"/>
</bean>

     4. Add message property for label token, which is used to show token's display name in generated print file . Add below line in src/main/resources/errors/messages.properties file. Make sure key should be same as token name.as shown below. The format of the key is print_<token_name_in_lowercase>


Code Block
languagejava
print_specimen_collection_container=Collection Procedure


In above bean specimenPrintLabelTokensRegistrar is to register specimen print label token. Replace registrar bean name according to your label token type by referring below list

Label TypeRegistrar Bean
PPID Label Token
ppidTokensRegistrar
Specimen Label Token
specimenTokenRegistrar
Visit Label Token
visitTokenRegistrar


You can download the complete working example from here:

...