Hi Rafael,
If you just want the value of one field in the message header, probably the
best way to do so would be using the PreParser:
http://hl7api.sourceforge.net/base/apidocs/ca/uhn/hl7v2/preparser/PreParser.html
One other thing to note- Parser objects are very heavyweight to create, so
you would probably see a significant performance improvement on the method
you posted if you kept the parser in a static field between calls. You
would need to synchronize access though, as these objects are not
threadsafe.
Cheers,
James
2014-05-07 4:22 GMT-04:00 <rsanvi...@fsoria.com>:
>
> Hi,
> In our source code, we parse the full message (from string data) to get
> the MessageControlID value.
> How can I get the MessageControlID value without parsing the full message
> (Example: parsing only the MSH Segment)?
>
> Note: I attach the "getUID" method to get this value.
> Best regards.
> Rafael.
>
>
> * import* ca.uhn.hl7v2.model.Message;
> * import* ca.uhn.hl7v2.model.v25.segment.MSH;
>
> /**
> * Get MessageControlID
> * *@param* mensaje
> * *@return* MessageControlID
> */
> *public* *static* String getUID(String mensaje)
> {
> *try*
> {
> Parser parseador = *new* GenericParser();
> parseador.*setValidationContext(**new**
> NoValidation())*;
>
> Message mensajeHAPI = parseador.parse(mensaje);
>
> MSH segmentoHAPI_MSH = (MSH)
> mensajeHAPI.get(Parametros.*MSH*);
>
> *return*segmentoHAPI_MSH.getMessageControlID().getValue();
> }
> *catch* (Exception e) {}
> *return* *null*;
> }
>
>
>
> * Rafael San Vidal Hidalgo - Dpto. Sistemas de Diagnóstico *
> * Tlf.: 914702104 (ext.158) - Fax: 915261867 *
> *rsanvi...@fsoria.com * <rsanvi...@fsoria.com>*- **www.f-soria.es
> *<http://www.f-soria.es/>
>
> *AVISO DE CONFIDENCIALIDAD *
>
> ------------------------------
> La información contenida en este mensaje y archivos adjuntos es privada,
> confidencial y de uso exclusivo de la(s) persona(s) y entidad(es) a la(s)
> que va dirigido. Si Ud. no es el destinatario de esta información se le
> notifica que está expresamente prohibida la declaración, reproducción,
> distribución o la toma de cualquier acción basada en el contenido de esta
> comunicación. Si ha recibido este mensaje por error, le rogamos que nos lo
> comunique inmediatamente y proceda a eliminarlo de todos sus sistemas.
> Francisco Soria Melguizo, S.A. no asume responsabilidad legal por el
> contenido de esta comunicación, ni representa la opinión de la firma, salvo
> que expresamente se especifique lo contrario y que el remitente esté
> autorizado para hacerlo. Gracias.
>
>
> ------------------------------------------------------------------------------
> Is your legacy SCM system holding you back? Join Perforce May 7 to find
> out:
> • 3 signs your SCM is hindering your productivity
> • Requirements for releasing software faster
> • Expert tips and advice for migrating your SCM now
> http://p.sf.net/sfu/perforce
> _______________________________________________
> Hl7api-devel mailing list
> Hl7api-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/hl7api-devel
>
>
------------------------------------------------------------------------------
Is your legacy SCM system holding you back? Join Perforce May 7 to find out:
• 3 signs your SCM is hindering your productivity
• Requirements for releasing software faster
• Expert tips and advice for migrating your SCM now
http://p.sf.net/sfu/perforce
_______________________________________________
Hl7api-devel mailing list
Hl7api-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hl7api-devel