com.ibm.icu.text.SimpleDateFormat Java Examples

The following examples show how to use com.ibm.icu.text.SimpleDateFormat. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DateFormatter.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Returns format code according to format type and current locale
 */
public String getLocalizedFormatCode() {
	if ( UNFORMATTED.equals( formatPattern ) ||
			DATETIME_UNFORMATTED.equals( formatPattern ) ||
			DATE_UNFORMATTED.equals( formatPattern ) ||
			TIME_UNFORMATTED.equals( formatPattern ) )
	{
		return ( (SimpleDateFormat) dateFormat ).toLocalizedPattern( );
	}
		
	SimpleDateFormat format = getFormatter( );
	if ( format == null )
	{
		return ( (SimpleDateFormat) dateFormat ).toPattern( );
	}
	else
	{
		return format.toLocalizedPattern( );
	}
}
 
Example #2
Source File: DateFormatISO8601.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Format a date/time object.
 * 
 * @param date
 * @param timeZone
 * @return
 * @throws BirtException
 */
public static String format( Date date, TimeZone timeZone ) throws BirtException
{
	if ( date == null  )
	{
		return null;
	}
	
	Object simpleDateFormatter = DateFormatFactory.getPatternInstance( PatternKey.getPatterKey( "yyyy-MM-dd HH:mm:ss.sZ" ) );
	if ( simpleDateFormatter != null )
	{
		try
		{
			SimpleDateFormat sdf = ( (SimpleDateFormat) simpleDateFormatter );
			sdf.setTimeZone( timeZone );
			return sdf.format( date );
		}
		catch ( Exception e1 )
		{
		}
	}
	// for the String can not be parsed, throws a BirtException
	throw new CoreException( ResourceConstants.CONVERT_FAILS, new Object[]{
			date.toString( ), "ISO8601 Format"
	} );
}
 
Example #3
Source File: ExcelUtil.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * format the date with defined time zone.
 * 
 * @param data
 * @param timeZone
 * @return
 */
public static String formatDate( Object data, TimeZone timeZone )
{
	Date date = getDate( data );
	if ( date == null )
	{
		return null;
	}
	SimpleDateFormat dateFormat = new SimpleDateFormat(
			"yyyy-MM-dd'T'HH:mm:ss.SSS", Locale.ENGLISH );
	if ( timeZone != null && needAdjustWithTimeZone( date ) )
	{
		dateFormat.setTimeZone( timeZone );
	}
	return dateFormat.format( date );
}
 
Example #4
Source File: LoggerSettingManager.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * This is a utility function that will create an unique file name with the
 * timestamp information in the file name and append the file name into the
 * directory name. For example, if the directory name is C:\Log, the
 * returned file name will be C:\Log\ReportEngine_2005_02_26_11_26_56.log.
 * 
 * @param directoryName
 *            - the directory name of the log file.
 * @param fileName
 *            the log file name
 * @return An unique Log file name which is the directory name plus the file
 *         name.
 */
private String generateUniqueLogFileName( String directoryName,
		String fileName )
{
	if ( fileName == null )
	{
		SimpleDateFormat df = new SimpleDateFormat( "yyyy_MM_dd_HH_mm_ss" ); //$NON-NLS-1$
		String dateTimeString = df.format( new Date( ) );
		fileName = "ReportEngine_" + dateTimeString + ".log"; //$NON-NLS-1$; $NON-NLS-2$;
	}

	if ( directoryName == null || directoryName.length( ) == 0 )
	{
		return fileName;
	}

	File folder = new File( directoryName );
	File file = new File( folder, fileName );
	return file.getPath( );
}
 
Example #5
Source File: DateFormatISO8601.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Parse a date/time string.
 * @param source
 * @return
 * @throws ParseException
 */
public static Date parse( String source ) throws ParseException,
		ParseException
{
	if( source == null )
	{
		return null;
	}
	Date resultDate = null;
	source = cleanDate( source );
	Object simpleDateFormatter = DateFormatFactory.getPatternInstance( PatternKey.getPatterKey( source ) );
	if ( simpleDateFormatter != null )
	{
		try
		{
			resultDate = ( (SimpleDateFormat) simpleDateFormatter ).parse( source );
			return resultDate;
		}
		catch ( ParseException e1 )
		{
		}
	}
	throw new ParseException( 
	        NLS.bind( Messages.getString( "dateFormatISO_cannotConvert" ), source ), //$NON-NLS-1$
			0 );		
}
 
Example #6
Source File: DateTimeFormatObject.java    From es6draft with MIT License 6 votes vote down vote up
private DateFormat createDateFormat() {
    ULocale locale = ULocale.forLanguageTag(this.locale);
    // calendar and numberingSystem are already handled in language-tag
    // assert locale.getKeywordValue("calendar").equals(calendar);
    // assert locale.getKeywordValue("numbers").equals(numberingSystem);
    SimpleDateFormat dateFormat = new SimpleDateFormat(pattern.get(), locale);
    if (timeZone != null) {
        dateFormat.setTimeZone(TimeZone.getTimeZone(timeZone));
    }
    Calendar calendar = dateFormat.getCalendar();
    if (calendar instanceof GregorianCalendar) {
        // format uses a proleptic Gregorian calendar with no year 0
        GregorianCalendar gregorian = (GregorianCalendar) calendar;
        gregorian.setGregorianChange(new Date(Long.MIN_VALUE));
    }
    return dateFormat;
}
 
Example #7
Source File: DateFormatter.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
private com.ibm.icu.text.DateFormat hackMilliSecond(
		com.ibm.icu.text.DateFormat factoryFormat )
{
	if ( factoryFormat instanceof SimpleDateFormat )
	{
		SimpleDateFormat factorySimpleFormat = (SimpleDateFormat) factoryFormat;
		String pattern = factorySimpleFormat.toPattern( );

		if ( pattern.indexOf( "SSS" ) == -1 )
		{
			int idx = pattern.indexOf( "ss" );
			if ( idx >= 0 )
			{
				StringBuffer strBuf = new StringBuffer( pattern );

				strBuf.insert( idx + 2, ".SSS" );
				pattern = strBuf.toString( );
			}
		}
		return new SimpleDateFormat( pattern, locale );
	}
	return factoryFormat;
}
 
Example #8
Source File: DateFormatter.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Returns format code according to format type and current locale
 */
public String getFormatCode( )
{
	if ( UNFORMATTED.equals( formatPattern ) ||
			DATETIME_UNFORMATTED.equals( formatPattern ) ||
			DATE_UNFORMATTED.equals( formatPattern ) ||
			TIME_UNFORMATTED.equals( formatPattern ) )
	{
		return ( (SimpleDateFormat) dateFormat ).toPattern( );
	}
		
	SimpleDateFormat format = getFormatter( );
	if ( format == null )
	{
		return ( (SimpleDateFormat) dateFormat ).toPattern( );
	}
	else
	{
		return format.toPattern( );
	}
}
 
Example #9
Source File: DateFormatter.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
private com.ibm.icu.text.DateFormat hackYear(
		com.ibm.icu.text.DateFormat factoryFormat )
{
	// Try cast this to SimpleDateFormat - DateFormat
	// JavaDoc says this should
	// succeed in most cases
	if ( factoryFormat instanceof SimpleDateFormat )
	{
		SimpleDateFormat factorySimpleFormat = (SimpleDateFormat) factoryFormat;

		String pattern = factorySimpleFormat.toPattern( );
		// Search for 'yy', then add a 'y' to make the year 4
		// digits
		if ( pattern.indexOf( "yyyy" ) == -1 )
		{
			int idx = pattern.indexOf( "yy" );
			if ( idx >= 0 )
			{
				StringBuffer strBuf = new StringBuffer( pattern );
				strBuf.insert( idx, 'y' );
				pattern = strBuf.toString( );
			}
		}
		return new SimpleDateFormat( pattern, locale );
	}
	return factoryFormat;
}
 
Example #10
Source File: XlsxFileReader.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
private SheetHandler(StylesTable st, SharedStringsTable sst, XlsxRowCallBack callback, int xlsxRowsToRead) {
	this.sst = sst;
	this.st = st;
	this.callback = callback;
	values = new ArrayList<Object>();
	this.cellDataType = cDataType.NUMBER;
	this.xlsxRowsToRead = xlsxRowsToRead;
	sdf = new SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ssZ" );//ISO date format
}
 
Example #11
Source File: DateFormatFactory.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Gets DateFormat instance allocated to the current thread for the given
 * pattern. Returned instance is safe to use
 * 
 */
public static SimpleDateFormat getPatternInstance( PatternKey pattern )
{

	HashMap patternMap = (HashMap) patternCache.get( );
	assert patternMap != null;

	return (SimpleDateFormat) patternMap.get( pattern );
}
 
Example #12
Source File: ExcelFileReader.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public ExcelFileReader(InputStream fis, String fileExtension,
		List<String> sheetNameList, int rowsToRead) {
	this.fis = fis;
	this.fileExtension = fileExtension;
	this.workSheetList = sheetNameList;
	this.xlsxRowsToRead = rowsToRead;
	sdf = new SimpleDateFormat( );
}
 
Example #13
Source File: DateTimeFormatConstructor.java    From es6draft with MIT License 5 votes vote down vote up
/**
 * Retrieve the default hour format character for the supplied locale.
 * 
 * @param locale
 *            the locale
 * @return the hour format character
 * @see <a href="http://bugs.icu-project.org/trac/ticket/9997">ICU bug 9997</a>
 */
private static char defaultHourFormat(ULocale locale) {
    // Use short time format, just as ICU4J does internally. And as suggested in
    // <http://unicode.org/reports/tr35/tr35-dates.html#availableFormats_appendItems>.
    SimpleDateFormat df = (SimpleDateFormat) DateFormat.getTimeInstance(DateFormat.SHORT, locale);
    Skeleton skeleton = Skeleton.fromPattern(df.toPattern());
    if (skeleton.has(DateField.Hour)) {
        return skeleton.getSymbol(DateField.Hour);
    }
    return 'H';
}
 
Example #14
Source File: DateFormatter.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 *   Convert into predefine pattern, when format is null, the case cover english. 
 *   It will add if other language is require
 * @param dateformat
 * @param locale
 * @return 
 */
@SuppressWarnings("nls")
private SimpleDateFormat toPredefinedPattern( SimpleDateFormat dateformat,
		ULocale locale )
{
	if ( "en".equals( locale.getLanguage( ) ) )
	{	//predefine format for US_en:  MMM d, y h:mm a 
		String PredefinePattern = dateformat.toPattern( ).replace( "y,",
				"y" );
		return new SimpleDateFormat( PredefinePattern, locale );
	}
	return dateformat;
}
 
Example #15
Source File: BirtDateTime.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public Object execute( Object[] arguments, IScriptFunctionContext scriptContext )
		throws BirtException
{
	if ( scriptContext != null )
	{
		Object locale = scriptContext.findProperty(
				org.eclipse.birt.core.script.functionservice.IScriptFunctionContext.LOCALE );
		if ( !( locale instanceof ULocale ) )
		{
			locale = ULocale.getDefault( );
		}
		if ( threadLocale.get( ) != locale )
		{
			threadLocale.set( (ULocale) locale );
			List<SimpleDateFormat> sdfList = new ArrayList<SimpleDateFormat>( );
			sdfList.add(
					new SimpleDateFormat( "MMM", threadLocale.get( ) ) );
			sdfList.add(
					new SimpleDateFormat( "MMMM", threadLocale.get( ) ) );
			sdfList.add(
					new SimpleDateFormat( "EEE", threadLocale.get( ) ) );
			sdfList.add(
					new SimpleDateFormat( "EEEE", threadLocale.get( ) ) );
			threadSDFArray.set( sdfList );
		}

		Object timeZone = scriptContext.findProperty(
				org.eclipse.birt.core.script.functionservice.IScriptFunctionContext.TIMEZONE );
		if ( !( timeZone instanceof TimeZone ) )
		{
			timeZone = TimeZone.getDefault( );
		}
		if ( threadTimeZone.get( ) != timeZone )
		{
			threadTimeZone.set( (TimeZone) timeZone );
		}
	}
	return this.executor.execute( arguments, scriptContext );
}
 
Example #16
Source File: OdsUtil.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public static String formatDate( Object data )
{
	SimpleDateFormat dateFormat = new SimpleDateFormat(
			"yyyy-MM-dd'T'HH:mm:ss", Locale.ENGLISH );
	Date date = getDate( data );
	if(date == null) {
		return null;
	}
	return  dateFormat.format( date );        
}
 
Example #17
Source File: DateFormatFactory.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Gets DateFormat instance allocated to the current thread for the given
 * pattern. Returned instance is safe to use
 * 
 */
public static SimpleDateFormat getPatternInstance( PatternKey pattern )
{

	HashMap patternMap = (HashMap) patternCache.get( );
	assert patternMap != null;

	return (SimpleDateFormat) patternMap.get( pattern );
}
 
Example #18
Source File: TimeLabel.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
private String getShowText( String type )
{
	//		StringBuffer retValue = new StringBuffer( );

	Calendar calendar = Calendar.getInstance( TimeZone.getTimeZone( id ) );
	calendar.setTimeInMillis( time );

	SimpleDateFormat formatter = new SimpleDateFormat( formatType );
	String result = formatter.format( calendar.getTime( ) );
	return result;

}
 
Example #19
Source File: ForumSubscriptionScenariosNewEntryTest.java    From olat with Apache License 2.0 5 votes vote down vote up
private Date getEventDate(String date) {

        SimpleDateFormat format = new SimpleDateFormat("DD.MM.YYYY HH:mm");
        try {
            return format.parse(date);
        } catch (ParseException e) {
            throw new AssertionError("wrong date format");
        }

    }
 
Example #20
Source File: LogFileHandler.java    From MergeProcessor with Apache License 2.0 5 votes vote down vote up
private static String getPattern() {
	final Date date = new Date();
	final Format fileDateFormat = new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss");
	final String pathLogFileFolder = Configuration.getPathLogFileFolder();
	final Path logFileFolder = Paths.get(pathLogFileFolder);
	if (Files.notExists(logFileFolder)) {
		try {
			Files.createDirectories(logFileFolder);
		} catch (IOException e) {
			Logger.getLogger(LogFileHandler.class.getName()).log(Level.SEVERE, "Could not create log file folder",
					e);
		}
	}
	return pathLogFileFolder + "mp_" + fileDateFormat.format(date) + ".log";
}
 
Example #21
Source File: DateFormatService.java    From singleton with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Format a long date to localized date
 *
 * @param locale A string representing a specific locale in [lang]_[country (region)] format. e.g., ja_JP, zh_CN
 * @param date Java timestamp format, e.g: 1472728030290
 * @param pattern Date pattern,e.g: [YEAR = "y",QUARTER = "QQQQ"], ABBR_QUARTER =
 *        "QQQ",YEAR_QUARTER = "yQQQQ",YEAR_ABBR_QUARTER = "yQQQ" and so on.
 * @return Localized date
 * @throws L2APIException
 */
public String formatDate(String locale, long date, String pattern) throws L2APIException {
	try{
		ULocale uLocale = new ULocale(locale);
		Date d = new Date(date);
		SimpleDateFormat format = new SimpleDateFormat(pattern, uLocale);
		return format.format(d);
	}catch(Exception e){
		throw new L2APIException(e.getMessage());
	}
}
 
Example #22
Source File: NotificationNewsTableDataModel.java    From olat with Apache License 2.0 5 votes vote down vote up
@Override
public void render(StringOutput sb, Renderer renderer, Object val, Locale locale, int alignment, String action) {
    Date creationDate = (Date) val;
    SimpleDateFormat formatDate = new SimpleDateFormat("dd.MM.yyyy", translator.getLocale());
    SimpleDateFormat formatTime = new SimpleDateFormat("HH:mm", translator.getLocale());
    // title
    String dateInfo = formatDate.format(creationDate) + " " + formatTime.format(creationDate);
    sb.append(dateInfo);
}
 
Example #23
Source File: NotificationNewsTableDataModel.java    From olat with Apache License 2.0 5 votes vote down vote up
@Override
public void render(StringOutput sb, Renderer renderer, Object val, Locale locale, int alignment, String action) {
    Date creationDate = (Date) val;
    SimpleDateFormat formatDate = new SimpleDateFormat("dd.MM.yyyy", translator.getLocale());
    SimpleDateFormat formatTime = new SimpleDateFormat("HH:mm", translator.getLocale());
    // title
    String dateInfo = formatDate.format(creationDate) + " " + formatTime.format(creationDate);
    sb.append(dateInfo);
}
 
Example #24
Source File: JavaDateFormatSpecifierImpl.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public String format( Calendar c, ULocale lcl )
{
	// ATTN: LOCALE IS UNUSED WHEN THE FORMAT PATTERN IS SPECIFIED
	final SimpleDateFormat sdf = new SimpleDateFormat( getPattern( ), lcl );
	// Only Datetime supports TimeZone
	if ( c instanceof CDateTime && ( (CDateTime) c ).isFullDateTime( ) )
	{
		sdf.setTimeZone( c.getTimeZone( ) );
	}
	return sdf.format( c.getTime( ) );
}
 
Example #25
Source File: DateFormatWrapperFactory.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Returns a preferred format specifier for tick labels that represent axis
 * values that will be computed based on the difference between cdt1 and
 * cdt2
 * 
 * @param iUnit
 *            The unit for which a preferred pattern is being requested
 * @param locale
 *            The locale for format style
 * @param keepHierarchy
 *            indicates if the format should keep hierarchy
 * 
 * @return A preferred datetime format for the given unit
 */
public static final IDateFormatWrapper getPreferredDateFormat( int iUnit,
		ULocale locale, boolean keepHierarchy )
{
	IDateFormatWrapper df = null;
	String pattern = ChartUtil.createDefaultFormatPattern( iUnit,
			keepHierarchy );
	df = new CommonDateFormatWrapper( new SimpleDateFormat( pattern, locale ) );
	// Special cases for dynamic patterns
	switch ( iUnit )
	{
		case Calendar.MONTH :
			if ( keepHierarchy )
			{
				df = new MonthDateFormat( locale );
			}
			break;
		case Calendar.DAY_OF_MONTH :// Same as DATE
			if ( keepHierarchy )
			{
				df = new CommonDateFormatWrapper( DateFormat.getDateInstance( DateFormat.MEDIUM,
						locale ) );
			}
			break;
	}
	return df;
}
 
Example #26
Source File: DateFormatWrapperFactory.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public String toLocalizedPattern( )
{
	if ( formater instanceof SimpleDateFormat )
	{
		return ( (SimpleDateFormat) formater ).toLocalizedPattern( );
	}
	return "MMM d, yyyy h:mm:ss a"; //$NON-NLS-1$
}
 
Example #27
Source File: DateFormatWrapperFactory.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public String toLocalizedPattern( )
{
	DateFormat df = DateFormat.getDateInstance( DateFormat.LONG, locale );
	if ( df instanceof SimpleDateFormat )
	{
		return ( (SimpleDateFormat) df ).toLocalizedPattern( )
				+ "\n"  //$NON-NLS-1$
				+ new SimpleDateFormat( "HH:mm", locale ).toLocalizedPattern( ); //$NON-NLS-1$
	}
	return "MMMM d, yyyy HH:mm";  //$NON-NLS-1$
}
 
Example #28
Source File: DateFormatWrapperFactory.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public String toLocalizedPattern( )
{
	DateFormat df = DateFormat.getDateInstance( DateFormat.MEDIUM,
			locale );
	if ( df instanceof SimpleDateFormat )
	{
		String pattern = ( (SimpleDateFormat) df ).toLocalizedPattern( );
		return pattern.replaceAll( "(-|/)?d+(\\.|,|/|-)?\\s?", "" ).trim( ); //$NON-NLS-1$ //$NON-NLS-2$  
	}
	return "MMM yyyy";  //$NON-NLS-1$
}
 
Example #29
Source File: ViewHelper.java    From fess with Apache License 2.0 4 votes vote down vote up
public String createCacheContent(final Map<String, Object> doc, final String[] queries) {
    final FessConfig fessConfig = ComponentUtil.getFessConfig();
    final FileTemplateLoader loader = new FileTemplateLoader(ResourceUtil.getViewTemplatePath().toFile());
    final Handlebars handlebars = new Handlebars(loader);

    Locale locale = ComponentUtil.getRequestManager().getUserLocale();
    if (locale == null) {
        locale = Locale.ENGLISH;
    }
    String url = DocumentUtil.getValue(doc, fessConfig.getIndexFieldUrl(), String.class);
    if (url == null) {
        url = ComponentUtil.getMessageManager().getMessage(locale, "labels.search_unknown");
    }
    doc.put(fessConfig.getResponseFieldUrlLink(), getUrlLink(doc));
    String createdStr;
    final Date created = DocumentUtil.getValue(doc, fessConfig.getIndexFieldCreated(), Date.class);
    if (created != null) {
        final SimpleDateFormat sdf = new SimpleDateFormat(CoreLibConstants.DATE_FORMAT_ISO_8601_EXTEND);
        createdStr = sdf.format(created);
    } else {
        createdStr = ComponentUtil.getMessageManager().getMessage(locale, "labels.search_unknown");
    }
    doc.put(CACHE_MSG, ComponentUtil.getMessageManager().getMessage(locale, "labels.search_cache_msg", url, createdStr));

    doc.put(QUERIES, queries);

    String cache = DocumentUtil.getValue(doc, fessConfig.getIndexFieldCache(), String.class);
    if (cache != null) {
        final String mimetype = DocumentUtil.getValue(doc, fessConfig.getIndexFieldMimetype(), String.class);
        if (!ComponentUtil.getFessConfig().isHtmlMimetypeForCache(mimetype)) {
            cache = StringEscapeUtils.escapeHtml4(cache);
        }
        cache = ComponentUtil.getPathMappingHelper().replaceUrls(cache);
        if (queries != null && queries.length > 0) {
            doc.put(HL_CACHE, replaceHighlightQueries(cache, queries));
        } else {
            doc.put(HL_CACHE, cache);
        }
    } else {
        doc.put(fessConfig.getIndexFieldCache(), StringUtil.EMPTY);
        doc.put(HL_CACHE, StringUtil.EMPTY);
    }

    try {
        final Template template = handlebars.compile(cacheTemplateName);
        final Context hbsContext = Context.newContext(doc);
        return template.apply(hbsContext);
    } catch (final Exception e) {
        logger.warn("Failed to create a cache response.", e);
    }

    return null;
}
 
Example #30
Source File: Test_HL7_v271_Imports.java    From elexis-3-core with Eclipse Public License 1.0 4 votes vote down vote up
@Test
public void testReadObservationOfAlerelisFile() throws ElexisException, IOException{
	File alerelisFile = loadSpecificv271File("alerelis.hl7");
	assertNotNull(alerelisFile);
	
	List<HL7Reader> hl7Readers = HL7ReaderFactory.INSTANCE.getReader(alerelisFile);
	assertNotNull(hl7Readers);
	assertEquals(1, hl7Readers.size());
	HL7Reader reader = hl7Readers.get(0);
	
	ObservationMessage observationMsg = reader.readObservation(resolver, false);
	Date msgDate = observationMsg.getDateTimeOfMessage();
	SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy-hh:mm:ss");
	assertEquals("18.11.2015-11:26:21", sdf.format(msgDate));
	
	List<IValueType> observations = observationMsg.getObservations();
	assertEquals(27, observations.size());
	
	assertTrue(observations.get(0) instanceof LabResultData);
	assertTrue(observations.get(2) instanceof LabResultData);
	assertTrue(observations.get(3) instanceof LabResultData);
	assertTrue(observations.get(7) instanceof LabResultData);
	assertTrue(observations.get(13) instanceof LabResultData);
	assertTrue(observations.get(22) instanceof EncapsulatedData);
	assertTrue(observations.get(23) instanceof EncapsulatedData);
	assertTrue(observations.get(24) instanceof EncapsulatedData);
	assertTrue(observations.get(25) instanceof LabResultData);
	
	LabResultData lrWBC = (LabResultData) observations.get(0);
	assertEquals("WBC", lrWBC.getName());
	assertEquals("4.43", lrWBC.getValue());
	assertEquals("10^9/l", lrWBC.getUnit());
	assertNull(lrWBC.getDate());
	assertNull(lrWBC.getOBRDateTime());
	
	LabResultData lrMON = (LabResultData) observations.get(2);
	assertEquals("MON", lrMON.getName());
	assertEquals("0.33", lrMON.getValue());
	assertEquals("10^9/l", lrMON.getUnit());
	assertNull(lrMON.getDate());
	assertNull(lrMON.getOBRDateTime());
	
	LabResultData lrGRA = (LabResultData) observations.get(3);
	assertEquals("GRA", lrGRA.getName());
	assertEquals("2.59", lrGRA.getValue());
	assertEquals("10^9/l", lrGRA.getUnit());
	assertNull(lrGRA.getDate());
	assertNull(lrGRA.getOBRDateTime());
	
	LabResultData lrRBC = (LabResultData) observations.get(7);
	assertEquals("RBC", lrRBC.getName());
	assertEquals("4.29", lrRBC.getValue());
	assertEquals("10^12/l", lrRBC.getUnit());
	assertNull(lrRBC.getDate());
	assertNull(lrRBC.getOBRDateTime());
	
	LabResultData lrRDWc = (LabResultData) observations.get(13);
	assertEquals("RDWc", lrRDWc.getName());
	assertEquals("15.8", lrRDWc.getValue());
	assertEquals("%", lrRDWc.getUnit());
	assertNull(lrRDWc.getDate());
	assertNull(lrRDWc.getOBRDateTime());
	
	EncapsulatedData encData1 = (EncapsulatedData) observations.get(22);
	assertEquals("image/jpeg", encData1.getName());
	assertEquals("0023", encData1.getSequence());
	assertNotNull(encData1.getData());
	assertNull(encData1.getDate());
	assertNull(encData1.getComment());
	
	EncapsulatedData encData2 = (EncapsulatedData) observations.get(23);
	assertEquals("image/jpeg", encData2.getName());
	assertEquals("0024", encData2.getSequence());
	assertNotNull(encData2.getData());
	assertNull(encData2.getDate());
	assertNull(encData2.getComment());
	
	EncapsulatedData encData3 = (EncapsulatedData) observations.get(24);
	assertEquals("image/jpeg", encData3.getName());
	assertEquals("0025", encData3.getSequence());
	assertNotNull(encData3.getData());
	assertNull(encData3.getDate());
	assertNull(encData3.getComment());
	
	LabResultData lrHuman = (LabResultData) observations.get(25);
	assertEquals("Mode", lrHuman.getName());
	assertEquals("Human", lrHuman.getValue());
	assertNull(lrHuman.getDate());
	assertNull(lrHuman.getUnit());
	assertNull(lrHuman.getOBRDateTime());
	
	assertEquals("poctGate", observationMsg.getSendingApplication());
	assertEquals("poctGate", observationMsg.getSendingFacility());
	
}