forked from hapifhir/hapi-hl7v2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f43e18d
commit c89a787
Showing
26 changed files
with
682 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
hapi-examples/src/main/java/ca/uhn/hl7v2/examples/sourcegen/ExampleUseConfGen.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package ca.uhn.hl7v2.examples.sourcegen; | ||
|
||
import java.io.IOException; | ||
|
||
import ca.uhn.hl7v2.DefaultHapiContext; | ||
import ca.uhn.hl7v2.HL7Exception; | ||
import ca.uhn.hl7v2.app.Connection; | ||
import ca.uhn.hl7v2.app.HL7Service; | ||
import ca.uhn.hl7v2.examples.custommodel.v25.message.ZDT_A01; | ||
import ca.uhn.hl7v2.llp.LLPException; | ||
import ca.uhn.hl7v2.model.Message; | ||
import ca.uhn.hl7v2.parser.CanonicalModelClassFactory; | ||
import ca.uhn.hl7v2.parser.ModelClassFactory; | ||
|
||
public class ExampleUseConfGen { | ||
|
||
public static void main(String[] args) throws HL7Exception, IOException, LLPException { | ||
// Sending a message | ||
|
||
{ | ||
// Create a new instance of the message and initialize it | ||
ZDT_A01 outMsg = new ZDT_A01(); | ||
outMsg.initQuickstart("ZDT", "A01", "T"); | ||
|
||
// .. populate other segments .. | ||
// e.g. outMsg.getPID().getPid3_PatientIdentifierList(0)....... | ||
|
||
// Create a hapi context and send the message | ||
DefaultHapiContext ctx = new DefaultHapiContext(); | ||
Connection conn = ctx.newClient("someserver.com", 8888, false); | ||
|
||
// Send the message | ||
Message response = conn.getInitiator().sendAndReceive(outMsg); | ||
} | ||
|
||
|
||
DefaultHapiContext ctx = new DefaultHapiContext(); | ||
ModelClassFactory mcf = new CanonicalModelClassFactory(ZDT_A01.class); | ||
ctx.setModelClassFactory(mcf); | ||
|
||
HL7Service server = ctx.newServer(8888, false); | ||
server.start(); | ||
|
||
} | ||
|
||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,35 +42,9 @@ GNU General Public License (the �GPL�), in which case the provisions of the | |
import ca.uhn.hl7v2.sourcegen.conf.ProfileSourceGenerator; | ||
|
||
/** | ||
* <p> | ||
* Maven Plugin Mojo for generating HAPI message structure classes which are based on | ||
* an HL7 conformance profile file. For more information on this plugin, see | ||
* <a href="http://hl7api.sourceforge.net/conformance.html">here</a>. | ||
* </p> | ||
* <p> | ||
* Usage is as follows: | ||
* </p> | ||
* <pre> | ||
* <plugin> | ||
* <groupId>ca.uhn.hapi</groupId> | ||
* <artifactId>hapi-sourcegen</artifactId> | ||
* <version>2.0</version> | ||
* <executions> | ||
* <execution> | ||
* <id>build</id> | ||
* <goals> | ||
* <goal>confgen</goal> | ||
* </goals> | ||
* <configuration> | ||
* <targetDirectory>${basedir}/target/generated-sources/confgen</targetDirectory> | ||
* <packageName>ca.uhn.hl7v2.test.nodt.conf</packageName> | ||
* <profile>${basedir}/src/test/resources/ca/uhn/hl7v2/conf/parser/ADT_A01.xml</profile> | ||
* <generateDateTypes>NONE</generateDateTypes> | ||
* </configuration> | ||
* </execution> | ||
* </execution> | ||
* </plugin> | ||
* </pre> | ||
* Maven Plugin for generating HAPI message structure classes which are based on | ||
* an HL7 conformance profile file. For more information on using this plugin, see | ||
* the <a href="confgen-usage.html">Confgen Usage</a> page. | ||
* | ||
* @author <a href="mailto:[email protected]">James Agnew</a> | ||
* @goal confgen | ||
|
@@ -84,7 +58,7 @@ public class ConfGenMojo extends AbstractMojo { | |
/** | ||
* The maven project. | ||
* | ||
* @parameter expression="${project}" | ||
* @parameter property="project" | ||
* @required | ||
* @readonly | ||
*/ | ||
|
@@ -107,17 +81,15 @@ public class ConfGenMojo extends AbstractMojo { | |
String profile; | ||
|
||
/** | ||
* The package for the generated source | ||
* The package for the generated source, e.g. "com.acme.hl7structure.adt" | ||
* | ||
* @parameter | ||
* @required | ||
*/ | ||
String packageName; | ||
|
||
/** | ||
* <p> | ||
* Should data types be generated. Valid options are: | ||
* </p> | ||
* <ul> | ||
* <li><b>NONE</b>: Do not generate custom data types, use HAPI's normal | ||
* data type classes for the HL7 version that the profile corresponds to | ||
|
@@ -149,17 +121,13 @@ public class ConfGenMojo extends AbstractMojo { | |
|
||
/** | ||
* Should structures be treated as resources | ||
* | ||
* @parameter default="false" | ||
*/ | ||
boolean structuresAsResources; | ||
private boolean structuresAsResources; | ||
|
||
/** | ||
* Should structures be treated as resources | ||
* | ||
* @parameter default="java" | ||
* File extension for the generated source files. | ||
*/ | ||
String fileExt = "java"; | ||
private String fileExt = "java"; | ||
|
||
/** | ||
* {@inheritDoc} | ||
|
Oops, something went wrong.