• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java TemporalPrecisionEnum类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中ca.uhn.fhir.model.api.TemporalPrecisionEnum的典型用法代码示例。如果您正苦于以下问题:Java TemporalPrecisionEnum类的具体用法?Java TemporalPrecisionEnum怎么用?Java TemporalPrecisionEnum使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

TemporalPrecisionEnum类属于ca.uhn.fhir.model.api包,在下文中一共展示了TemporalPrecisionEnum类的35个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: tTS2Date

点赞 3

import ca.uhn.fhir.model.api.TemporalPrecisionEnum; //导入依赖的package包/类
public DateDt tTS2Date(TS ts){
	DateDt date = (DateDt) tTS2BaseDateTime(ts,DateDt.class);
	if(date == null)
		return null;
	
	// TimeZone is NOT permitted
	if(date.getTimeZone() != null) {
		date.setTimeZone(null);
	}
	
	// precision should be YEAR, MONTH or DAY. otherwise, set it to DAY
	if(date.getPrecision() != TemporalPrecisionEnum.YEAR && date.getPrecision() != TemporalPrecisionEnum.MONTH && date.getPrecision() != TemporalPrecisionEnum.DAY) {
		date.setPrecision(TemporalPrecisionEnum.DAY);
	}
	
	return date;
}
 

开发者ID:srdc,
项目名称:cda2fhir,
代码行数:18,
代码来源:DataTypesTransformerImpl.java

示例2: tTS2DateTime

点赞 3

import ca.uhn.fhir.model.api.TemporalPrecisionEnum; //导入依赖的package包/类
public DateTimeDt tTS2DateTime(TS ts) {
	DateTimeDt dateTime = (DateTimeDt) tTS2BaseDateTime(ts,DateTimeDt.class);
	
	if(dateTime == null)
		return null;
	
	// if the precision is not YEAR or MONTH, TimeZone SHALL be populated
	if(dateTime.getPrecision() != TemporalPrecisionEnum.YEAR && dateTime.getPrecision() != TemporalPrecisionEnum.MONTH) {
		if(dateTime.getTimeZone() == null) {
			dateTime.setTimeZone(TimeZone.getDefault());
		}
	}
	
	// if the precision is MINUTE, seconds SHALL be populated
	if(dateTime.getPrecision() == TemporalPrecisionEnum.MINUTE) {
		dateTime.setPrecision(TemporalPrecisionEnum.SECOND);
		dateTime.setSecond(0);
	}
	
	return dateTime;
}
 

开发者ID:srdc,
项目名称:cda2fhir,
代码行数:22,
代码来源:DataTypesTransformerImpl.java

示例3: tTS2Instant

点赞 3

import ca.uhn.fhir.model.api.TemporalPrecisionEnum; //导入依赖的package包/类
public InstantDt tTS2Instant(TS ts) {
	InstantDt instant = (InstantDt) tTS2BaseDateTime(ts,InstantDt.class);
	if(instant == null)
		return null;
	
	// if the precision is not SECOND or MILLI, convert its precision to SECOND
	if(instant.getPrecision() != TemporalPrecisionEnum.SECOND && instant.getPrecision() != TemporalPrecisionEnum.MILLI) {
		instant.setPrecision(TemporalPrecisionEnum.SECOND);
	}
	
	// if it doesn't include a timezone, add the local timezone
	if(instant.getTimeZone() == null) {
		instant.setTimeZone(TimeZone.getDefault());
	}
	return instant;
}
 

开发者ID:srdc,
项目名称:cda2fhir,
代码行数:17,
代码来源:DataTypesTransformerImpl.java

示例4: datatypes

点赞 3

import ca.uhn.fhir.model.api.TemporalPrecisionEnum; //导入依赖的package包/类
public static void datatypes() {
   // START SNIPPET: datatypes
   Observation obs = new Observation();

   // These are all equivalent
   obs.setIssued(new InstantDt(new Date()));
   obs.setIssued(new Date(), TemporalPrecisionEnum.MILLI);
   obs.setIssuedWithMillisPrecision(new Date());

   // The InstantDt also lets you work with the instant as a Java Date
   // object or as a FHIR String.
   Date date = obs.getIssuedElement().getValue(); // A date object
   String dateString = obs.getIssuedElement().getValueAsString(); // "2014-03-08T12:59:58.068-05:00"
   // END SNIPPET: datatypes

   System.out.println(date);
   System.out.println(dateString);

}
 

开发者ID:gajen0981,
项目名称:FHIR-Server,
代码行数:20,
代码来源:FhirDataModel.java

示例5: testDateParsesWithInvalidPrecision

点赞 3

import ca.uhn.fhir.model.api.TemporalPrecisionEnum; //导入依赖的package包/类
/**
 * Test for #57
 */
@Test
public void testDateParsesWithInvalidPrecision() {
	Condition c = new Condition();
	c.setDateAsserted(new DateDt());
	c.getDateAsserted().setValueAsString("2001-01-02T11:13:33");
	assertEquals(TemporalPrecisionEnum.SECOND, c.getDateAsserted().getPrecision());

	String encoded = ourCtx.newXmlParser().encodeResourceToString(c);
	Assert.assertThat(encoded, Matchers.containsString("value=\"2001-01-02T11:13:33\""));

	c = ourCtx.newXmlParser().parseResource(Condition.class, encoded);

	assertEquals("2001-01-02T11:13:33", c.getDateAsserted().getValueAsString());
	assertEquals(TemporalPrecisionEnum.SECOND, c.getDateAsserted().getPrecision());

	ValidationResult outcome = ourCtx.newValidator().validateWithResult(c);
	String outcomeStr = ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(outcome.getOperationOutcome());
	ourLog.info(outcomeStr);

	assertThat(outcomeStr, containsString("date-primitive"));
}
 

开发者ID:gajen0981,
项目名称:FHIR-Server,
代码行数:25,
代码来源:BaseDateTimeDtTest.java

示例6: testDateParsesWithInvalidPrecision

点赞 3

import ca.uhn.fhir.model.api.TemporalPrecisionEnum; //导入依赖的package包/类
/**
 * Test for #57
 */
@Test
public void testDateParsesWithInvalidPrecision() {
	Condition c = new Condition();
	c.setDateRecorded(new DateDt());
	c.getDateRecordedElement().setValueAsString("2001-01-02T11:13:33");
	assertEquals(TemporalPrecisionEnum.SECOND, c.getDateRecordedElement().getPrecision());

	String encoded = ourCtx.newXmlParser().encodeResourceToString(c);
	Assert.assertThat(encoded, Matchers.containsString("value=\"2001-01-02T11:13:33\""));

	c = ourCtx.newXmlParser().parseResource(Condition.class, encoded);

	assertEquals("2001-01-02T11:13:33", c.getDateRecordedElement().getValueAsString());
	assertEquals(TemporalPrecisionEnum.SECOND, c.getDateRecordedElement().getPrecision());

	ValidationResult outcome = ourCtx.newValidator().validateWithResult(c);
	String outcomeStr = ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(outcome.toOperationOutcome());
	ourLog.info(outcomeStr);

	assertThat(outcomeStr, containsString("date-primitive"));
}
 

开发者ID:jamesagnew,
项目名称:hapi-fhir,
代码行数:25,
代码来源:BaseDateTimeDtDstu2Test.java

示例7: testDateParsesWithInvalidPrecision

点赞 3

import ca.uhn.fhir.model.api.TemporalPrecisionEnum; //导入依赖的package包/类
/**
 * Test for #57
 */
@Test
public void testDateParsesWithInvalidPrecision() {
	Goal c = new Goal();
	c.setStatusDateElement(new DateType());
	c.getStatusDateElement().setValueAsString("2001-01-02T11:13:33");
	assertEquals(TemporalPrecisionEnum.SECOND, c.getStatusDateElement().getPrecision());

	String encoded = ourCtx.newXmlParser().encodeResourceToString(c);
	Assert.assertThat(encoded, Matchers.containsString("value=\"2001-01-02T11:13:33\""));

	c = ourCtx.newXmlParser().parseResource(Goal.class, encoded);

	assertEquals("2001-01-02T11:13:33", c.getStatusDateElement().getValueAsString());
	assertEquals(TemporalPrecisionEnum.SECOND, c.getStatusDateElement().getPrecision());

	ValidationResult outcome = ourCtx.newValidator().validateWithResult(c);
	String outcomeStr = ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(outcome.toOperationOutcome());
	ourLog.info(outcomeStr);

	assertThat(outcomeStr, containsString("date-primitive"));
}
 

开发者ID:jamesagnew,
项目名称:hapi-fhir,
代码行数:25,
代码来源:BaseDateTimeTypeDstu3Test.java

示例8: testRangeFromDates

点赞 3

import ca.uhn.fhir.model.api.TemporalPrecisionEnum; //导入依赖的package包/类
@Test
public void testRangeFromDates() {
	TimeZone tz = TimeZone.getDefault();
	TimeZone.setDefault(TimeZone.getTimeZone("America/Toronto"));
	try {
		Date startDate = new InstantDt("2010-01-01T00:00:00.000Z").getValue();
		Date endDate = new InstantDt("2010-01-01T00:00:00.001Z").getValue();
		DateTimeDt startDateTime = new DateTimeDt(startDate, TemporalPrecisionEnum.MILLI);
		DateTimeDt endDateTime = new DateTimeDt(endDate, TemporalPrecisionEnum.MILLI);

		DateRangeParam range = new DateRangeParam(startDateTime, endDateTime);
		assertEquals("2009-12-31T19:00:00.000-05:00", range.getValuesAsQueryTokens().get(0).getValueAsString());
		assertEquals("2009-12-31T19:00:00.001-05:00", range.getValuesAsQueryTokens().get(1).getValueAsString());

		// Now try with arguments reversed (should still create same range)
		range = new DateRangeParam(endDateTime, startDateTime);
		assertEquals("2009-12-31T19:00:00.000-05:00", range.getValuesAsQueryTokens().get(0).getValueAsString());
		assertEquals("2009-12-31T19:00:00.001-05:00", range.getValuesAsQueryTokens().get(1).getValueAsString());

	} finally {
		TimeZone.setDefault(tz);
	}
}
 

开发者ID:jamesagnew,
项目名称:hapi-fhir,
代码行数:24,
代码来源:DateRangeParamTest.java

示例9: testGeneratePatient

点赞 3

import ca.uhn.fhir.model.api.TemporalPrecisionEnum; //导入依赖的package包/类
@Test
public void testGeneratePatient() throws DataFormatException {
	Patient value = new Patient();

	value.addIdentifier().setSystem("urn:names").setValue("123456");
	value.addName().addFamily("blow").addGiven("joe").addGiven((String) null).addGiven("john");
	value.getAddressFirstRep().addLine("123 Fake Street").addLine("Unit 1");
	value.getAddressFirstRep().setCity("Toronto").setState("ON").setCountry("Canada");

	value.setBirthDate(new Date(), TemporalPrecisionEnum.DAY);

	NarrativeDt narrative = new NarrativeDt();
	myGen.generateNarrative(ourCtx, value, narrative);
	String output = narrative.getDiv().getValueAsString();
	ourLog.info(output);
	assertThat(output, StringContains.containsString("<div class=\"hapiHeaderText\">joe john <b>BLOW </b></div>"));

}
 

开发者ID:jamesagnew,
项目名称:hapi-fhir,
代码行数:19,
代码来源:DefaultThymeleafNarrativeGeneratorDstu2Test.java

示例10: testGeneratePatient

点赞 3

import ca.uhn.fhir.model.api.TemporalPrecisionEnum; //导入依赖的package包/类
@Test
	public void testGeneratePatient() throws DataFormatException {
		Patient value = new Patient();

		value.addIdentifier().setSystem("urn:names").setValue("123456");
		value.addName().addFamily("blow").addGiven("joe").addGiven(null).addGiven("john");
		value.getAddressFirstRep().addLine("123 Fake Street").addLine("Unit 1");
		value.getAddressFirstRep().setCity("Toronto").setState("ON").setCountry("Canada");

		value.setBirthDate(new Date(), TemporalPrecisionEnum.DAY);

		NarrativeDt narrative = new NarrativeDt();
		gen.generateNarrative(myCtx, value, narrative);
		String output = narrative.getDiv().getValueAsString();
		assertThat(output, StringContains.containsString("<div class=\"hapiHeaderText\">joe john <b>BLOW </b></div>"));

		// Removed because label is gone in DSTU2
//		value.getIdentifierFirstRep().setLabel("FOO MRN 123");
//		title = gen.generateTitle(value);
//		assertEquals("joe john BLOW (FOO MRN 123)", title);
//		ourLog.info(title);

	}
 

开发者ID:jamesagnew,
项目名称:hapi-fhir,
代码行数:24,
代码来源:DefaultThymeleafNarrativeGeneratorTest.java

示例11: setValue

点赞 3

import ca.uhn.fhir.model.api.TemporalPrecisionEnum; //导入依赖的package包/类
/**
 * Sets the value for this type using the given Java Date object as the time, and using the specified precision, as
 * well as the local timezone as determined by the local operating system. Both of
 * these properties may be modified in subsequent calls if neccesary.
 * 
 * @param theValue
 *           The date value
 * @param thePrecision
 *           The precision
 * @throws DataFormatException
 */
public void setValue(Date theValue, TemporalPrecisionEnum thePrecision) throws DataFormatException {
	if (getTimeZone() == null) {
		setTimeZone(TimeZone.getDefault());
	}
	myPrecision = thePrecision;
	myFractionalSeconds = "";
	if (theValue != null) {
		long millis = theValue.getTime() % 1000;
		if (millis < 0) {
			// This is for times before 1970 (see bug #444)
			millis = 1000 + millis;
		}
		String fractionalSeconds = Integer.toString((int) millis);
		myFractionalSeconds = StringUtils.leftPad(fractionalSeconds, 3, '0');
	}
	super.setValue(theValue);
}
 

开发者ID:jamesagnew,
项目名称:hapi-fhir,
代码行数:29,
代码来源:BaseDateTimeType.java

示例12: searchByObservationNames

点赞 2

import ca.uhn.fhir.model.api.TemporalPrecisionEnum; //导入依赖的package包/类
@Search()
public List<Patient> searchByObservationNames( @RequiredParam(name=Patient.SP_BIRTHDATE) DateParam theDate ) {
   QuantityCompararatorEnum comparator = theDate.getComparator(); // e.g. <=
   Date date = theDate.getValue(); // e.g. 2011-01-02
   TemporalPrecisionEnum precision = theDate.getPrecision(); // e.g. DAY
	
   List<Patient> retVal = new ArrayList<Patient>();
   // ...populate...
   return retVal;
}
 

开发者ID:gajen0981,
项目名称:FHIR-Server,
代码行数:11,
代码来源:RestfulPatientResourceProviderMore.java

示例13: isPrecisionAllowed

点赞 2

import ca.uhn.fhir.model.api.TemporalPrecisionEnum; //导入依赖的package包/类
@Override
boolean isPrecisionAllowed(TemporalPrecisionEnum thePrecision) {
	switch (thePrecision) {
	case YEAR:
	case MONTH:
	case DAY:
		return true;
	default:
		return false;
	}
}
 

开发者ID:gajen0981,
项目名称:FHIR-Server,
代码行数:12,
代码来源:DateDt.java

示例14: isPrecisionAllowed

点赞 2

import ca.uhn.fhir.model.api.TemporalPrecisionEnum; //导入依赖的package包/类
@Override
boolean isPrecisionAllowed(TemporalPrecisionEnum thePrecision) {
	switch (thePrecision) {
	case YEAR:
	case MONTH:
	case DAY:
	case SECOND:
	case MILLI:
		return true;
	default:
		return false;
	}
}
 

开发者ID:gajen0981,
项目名称:FHIR-Server,
代码行数:14,
代码来源:DateTimeDt.java

示例15: BaseDateTimeDt

点赞 2

import ca.uhn.fhir.model.api.TemporalPrecisionEnum; //导入依赖的package包/类
/**
 * Constructor
 * 
 * @throws DataFormatException
 *             If the specified precision is not allowed for this type
 */
public BaseDateTimeDt(Date theDate, TemporalPrecisionEnum thePrecision) {
	setValue(theDate, thePrecision);
	if (isPrecisionAllowed(thePrecision) == false) {
		throw new DataFormatException("Invalid date/time string (datatype " + getClass().getSimpleName() + " does not support " + thePrecision + " precision): " + theDate);
	}
}
 

开发者ID:gajen0981,
项目名称:FHIR-Server,
代码行数:13,
代码来源:BaseDateTimeDt.java

示例16: getPrecision

点赞 2

import ca.uhn.fhir.model.api.TemporalPrecisionEnum; //导入依赖的package包/类
/**
 * Gets the precision for this datatype (using the default for the given type if not set)
 * 
 * @see #setPrecision(TemporalPrecisionEnum)
 */
public TemporalPrecisionEnum getPrecision() {
	if (myPrecision == null) {
		return getDefaultPrecisionForDatatype();
	}
	return myPrecision;
}
 

开发者ID:gajen0981,
项目名称:FHIR-Server,
代码行数:12,
代码来源:BaseDateTimeDt.java

示例17: setPrecision

点赞 2

import ca.uhn.fhir.model.api.TemporalPrecisionEnum; //导入依赖的package包/类
/**
 * Sets the precision for this datatype
 * 
 * @throws DataFormatException
 */
public void setPrecision(TemporalPrecisionEnum thePrecision) throws DataFormatException {
	if (thePrecision == null) {
		throw new NullPointerException("Precision may not be null");
	}
	myPrecision = thePrecision;
	updateStringValue();
}
 

开发者ID:gajen0981,
项目名称:FHIR-Server,
代码行数:13,
代码来源:BaseDateTimeDt.java

示例18: isPrecisionAllowed

点赞 2

import ca.uhn.fhir.model.api.TemporalPrecisionEnum; //导入依赖的package包/类
@Override
boolean isPrecisionAllowed(TemporalPrecisionEnum thePrecision) {
	switch (thePrecision) {
	case SECOND:
	case MILLI:
		return true;
	default:
		return false;
	}
}
 

开发者ID:gajen0981,
项目名称:FHIR-Server,
代码行数:11,
代码来源:InstantDt.java

示例19: testGeneratePatient

点赞 2

import ca.uhn.fhir.model.api.TemporalPrecisionEnum; //导入依赖的package包/类
@Test
	public void testGeneratePatient() throws DataFormatException {
		Patient value = new Patient();

		value.addIdentifier().setSystem("urn:names").setValue("123456");
		value.addName().addFamily("blow").addGiven("joe").addGiven(null).addGiven("john");
		value.getAddressFirstRep().addLine("123 Fake Street").addLine("Unit 1");
		value.getAddressFirstRep().setCity("Toronto").setState("ON").setCountry("Canada");

		value.setBirthDate(new Date(), TemporalPrecisionEnum.DAY);

		NarrativeDt narrative = new NarrativeDt();
		gen.generateNarrative(value, narrative);
		String output = narrative.getDiv().getValueAsString();
		assertThat(output, StringContains.containsString("<div class=\"hapiHeaderText\"> joe john <b>BLOW </b></div>"));

		String title = gen.generateTitle(value);
		assertEquals("joe john BLOW (123456)", title);
		ourLog.info(title);

		// Removed because label is gone in DSTU2
//		value.getIdentifierFirstRep().setLabel("FOO MRN 123");
//		title = gen.generateTitle(value);
//		assertEquals("joe john BLOW (FOO MRN 123)", title);
//		ourLog.info(title);

	}
 

开发者ID:gajen0981,
项目名称:FHIR-Server,
代码行数:28,
代码来源:DefaultThymeleafNarrativeGeneratorTest.java

示例20: testPrecision

点赞 2

import ca.uhn.fhir.model.api.TemporalPrecisionEnum; //导入依赖的package包/类
/**
 * See #101
 */
@Test
public void testPrecision() throws Exception {
	Calendar cal = Calendar.getInstance();
	cal.setTime(myDateInstantParser.parse("2012-01-02 22:31:02.333"));
	cal.setTimeZone(TimeZone.getTimeZone("EST"));
	
	Patient patient = new Patient();
	patient.setBirthDate(cal.getTime(), TemporalPrecisionEnum.DAY);
	String out = ourCtx.newXmlParser().encodeResourceToString(patient);
	assertThat(out, containsString("<birthDate value=\"2012-01-02\"/>"));
}
 

开发者ID:gajen0981,
项目名称:FHIR-Server,
代码行数:15,
代码来源:BaseDateTimeDtTest.java

示例21: testParseDay

点赞 2

import ca.uhn.fhir.model.api.TemporalPrecisionEnum; //导入依赖的package包/类
@Test
public void testParseDay() throws DataFormatException {
	DateTimeDt dt = new DateTimeDt();
	dt.setValueAsString("2013-02-03");

	assertEquals("2013-02-03", myDateInstantParser.format(dt.getValue()).substring(0, 10));
	assertEquals("2013-02-03", dt.getValueAsString());
	assertEquals(false, dt.isTimeZoneZulu());
	assertNull(dt.getTimeZone());
	assertEquals(TemporalPrecisionEnum.DAY, dt.getPrecision());
}
 

开发者ID:gajen0981,
项目名称:FHIR-Server,
代码行数:12,
代码来源:BaseDateTimeDtTest.java

示例22: testParseMilli

点赞 2

import ca.uhn.fhir.model.api.TemporalPrecisionEnum; //导入依赖的package包/类
@Test
public void testParseMilli() throws DataFormatException {
	InstantDt dt = new InstantDt();
	dt.setValueAsString("2013-02-03T11:22:33.234");

	assertEquals("2013-02-03 11:22:33.234", myDateInstantParser.format(dt.getValue()).substring(0, 23));
	assertEquals("2013-02-03T11:22:33.234", dt.getValueAsString());
	assertEquals(false, dt.isTimeZoneZulu());
	assertNull(dt.getTimeZone());
	assertEquals(TemporalPrecisionEnum.MILLI, dt.getPrecision());
}
 

开发者ID:gajen0981,
项目名称:FHIR-Server,
代码行数:12,
代码来源:BaseDateTimeDtTest.java

示例23: testParseMilliZone

点赞 2

import ca.uhn.fhir.model.api.TemporalPrecisionEnum; //导入依赖的package包/类
@Test
public void testParseMilliZone() throws DataFormatException {
	InstantDt dt = new InstantDt();
	dt.setValueAsString("2013-02-03T11:22:33.234-02:00");

	assertEquals("2013-02-03 11:22:33.234-0200", myDateInstantZoneParser.format(dt.getValue()));
	assertEquals("2013-02-03T11:22:33.234-02:00", dt.getValueAsString());
	assertEquals(false, dt.isTimeZoneZulu());
	assertEquals(TimeZone.getTimeZone("GMT-02:00"), dt.getTimeZone());
	assertEquals(TemporalPrecisionEnum.MILLI, dt.getPrecision());
}
 

开发者ID:gajen0981,
项目名称:FHIR-Server,
代码行数:12,
代码来源:BaseDateTimeDtTest.java

示例24: testParseMilliZulu

点赞 2

import ca.uhn.fhir.model.api.TemporalPrecisionEnum; //导入依赖的package包/类
@Test
public void testParseMilliZulu() throws DataFormatException {
	InstantDt dt = new InstantDt();
	dt.setValueAsString("2013-02-03T11:22:33.234Z");

	assertEquals("2013-02-03 09:22:33.234-0200", myDateInstantZoneParser.format(dt.getValue()));
	assertEquals("2013-02-03T11:22:33.234Z", dt.getValueAsString());
	assertEquals(true, dt.isTimeZoneZulu());
	assertNull(dt.getTimeZone());
	assertEquals(TemporalPrecisionEnum.MILLI, dt.getPrecision());
}
 

开发者ID:gajen0981,
项目名称:FHIR-Server,
代码行数:12,
代码来源:BaseDateTimeDtTest.java

示例25: testParseMonth

点赞 2

import ca.uhn.fhir.model.api.TemporalPrecisionEnum; //导入依赖的package包/类
@Test
public void testParseMonth() throws DataFormatException {
	DateTimeDt dt = new DateTimeDt();
	dt.setValueAsString("2013-02");

	assertEquals("2013-02", myDateInstantParser.format(dt.getValue()).substring(0, 7));
	assertEquals("2013-02", dt.getValueAsString());
	assertEquals(false, dt.isTimeZoneZulu());
	assertNull(dt.getTimeZone());
	assertEquals(TemporalPrecisionEnum.MONTH, dt.getPrecision());
}
 

开发者ID:gajen0981,
项目名称:FHIR-Server,
代码行数:12,
代码来源:BaseDateTimeDtTest.java

示例26: testParseMonthNoDashes

点赞 2

import ca.uhn.fhir.model.api.TemporalPrecisionEnum; //导入依赖的package包/类
@Test
public void testParseMonthNoDashes() throws DataFormatException {
	DateTimeDt dt = new DateTimeDt();
	dt.setValueAsString("201302");

	assertEquals("2013-02", myDateInstantParser.format(dt.getValue()).substring(0, 7));
	assertEquals("201302", dt.getValueAsString());
	assertEquals(false, dt.isTimeZoneZulu());
	assertNull(dt.getTimeZone());
	assertEquals(TemporalPrecisionEnum.MONTH, dt.getPrecision());
}
 

开发者ID:gajen0981,
项目名称:FHIR-Server,
代码行数:12,
代码来源:BaseDateTimeDtTest.java

示例27: testParseSecond

点赞 2

import ca.uhn.fhir.model.api.TemporalPrecisionEnum; //导入依赖的package包/类
@Test
public void testParseSecond() throws DataFormatException {
	DateTimeDt dt = new DateTimeDt();
	dt.setValueAsString("2013-02-03T11:22:33");

	assertEquals("2013-02-03 11:22:33", myDateInstantParser.format(dt.getValue()).substring(0, 19));
	assertEquals("2013-02-03T11:22:33", dt.getValueAsString());
	assertEquals(false, dt.isTimeZoneZulu());
	assertNull(dt.getTimeZone());
	assertEquals(TemporalPrecisionEnum.SECOND, dt.getPrecision());
}
 

开发者ID:gajen0981,
项目名称:FHIR-Server,
代码行数:12,
代码来源:BaseDateTimeDtTest.java

示例28: testParseSecondulu

点赞 2

import ca.uhn.fhir.model.api.TemporalPrecisionEnum; //导入依赖的package包/类
@Test
public void testParseSecondulu() throws DataFormatException {
	DateTimeDt dt = new DateTimeDt();
	dt.setValueAsString("2013-02-03T11:22:33Z");

	assertEquals("2013-02-03T11:22:33Z", dt.getValueAsString());
	assertEquals(true, dt.isTimeZoneZulu());
	assertEquals(null, dt.getTimeZone());
	assertEquals(TemporalPrecisionEnum.SECOND, dt.getPrecision());
}
 

开发者ID:gajen0981,
项目名称:FHIR-Server,
代码行数:11,
代码来源:BaseDateTimeDtTest.java

示例29: testParseSecondZone

点赞 2

import ca.uhn.fhir.model.api.TemporalPrecisionEnum; //导入依赖的package包/类
@Test
public void testParseSecondZone() throws DataFormatException {
	DateTimeDt dt = new DateTimeDt();
	dt.setValueAsString("2013-02-03T11:22:33-02:00");

	assertEquals("2013-02-03T11:22:33-02:00", dt.getValueAsString());
	assertEquals(false, dt.isTimeZoneZulu());
	assertEquals(TimeZone.getTimeZone("GMT-02:00"), dt.getTimeZone());
	assertEquals(TemporalPrecisionEnum.SECOND, dt.getPrecision());
}
 

开发者ID:gajen0981,
项目名称:FHIR-Server,
代码行数:11,
代码来源:BaseDateTimeDtTest.java

示例30: testParseYear

点赞 2

import ca.uhn.fhir.model.api.TemporalPrecisionEnum; //导入依赖的package包/类
@Test
public void testParseYear() throws DataFormatException {
	DateTimeDt dt = new DateTimeDt();
	dt.setValueAsString("2013");

	assertEquals("2013", myDateInstantParser.format(dt.getValue()).substring(0, 4));
	assertEquals("2013", dt.getValueAsString());
	assertEquals(false, dt.isTimeZoneZulu());
	assertNull(dt.getTimeZone());
	assertEquals(TemporalPrecisionEnum.YEAR, dt.getPrecision());
}
 

开发者ID:gajen0981,
项目名称:FHIR-Server,
代码行数:12,
代码来源:BaseDateTimeDtTest.java

示例31: testGeneratePatient

点赞 2

import ca.uhn.fhir.model.api.TemporalPrecisionEnum; //导入依赖的package包/类
@Test
	public void testGeneratePatient() throws DataFormatException {
		Patient value = new Patient();

		value.addIdentifier().setSystem("urn:names").setValue("123456");
		value.addName().addFamily("blow").addGiven("joe").addGiven(null).addGiven("john");
		value.getAddressFirstRep().addLine("123 Fake Street").addLine("Unit 1");
		value.getAddressFirstRep().setCity("Toronto").setState("ON").setCountry("Canada");

		value.setBirthDate(new Date(), TemporalPrecisionEnum.DAY);

		NarrativeDt narrative = new NarrativeDt();
		myGen.generateNarrative(value, narrative);
		String output = narrative.getDiv().getValueAsString();
		ourLog.info(output);
		assertThat(output, StringContains.containsString("<div class=\"hapiHeaderText\"> joe john <b>BLOW </b></div>"));

		String title = myGen.generateTitle(value);
		assertEquals("joe john BLOW (123456)", title);
//		ourLog.info(title);

		value.getIdentifierFirstRep().setValue("FOO MRN 123");
		title = myGen.generateTitle(value);
		assertEquals("joe john BLOW (FOO MRN 123)", title);
//		ourLog.info(title);

	}
 

开发者ID:gajen0981,
项目名称:FHIR-Server,
代码行数:28,
代码来源:DefaultThymeleafNarrativeGeneratorTestDstu2.java

示例32: testPrecisionRespectedForSetValueWithPrecision

点赞 2

import ca.uhn.fhir.model.api.TemporalPrecisionEnum; //导入依赖的package包/类
/**
 * See HAPI #101 - https://github.com/jamesagnew/hapi-fhir/issues/101
 */
@Test
public void testPrecisionRespectedForSetValueWithPrecision() throws Exception {
	Calendar cal = Calendar.getInstance();
	cal.setTime(myDateInstantParser.parse("2012-01-02 22:31:02.333"));
	cal.setTimeZone(TimeZone.getTimeZone("EST"));
	
	Date time = cal.getTime();
	
	DateDt date = new DateDt();
	date.setValue(time, TemporalPrecisionEnum.DAY);
	assertEquals("2012-01-02", date.getValueAsString());
}
 

开发者ID:gajen0981,
项目名称:FHIR-Server,
代码行数:16,
代码来源:BaseDateTimeDtTest.java

示例33: testParseMonth

点赞 2

import ca.uhn.fhir.model.api.TemporalPrecisionEnum; //导入依赖的package包/类
@Test
public void testParseMonth() throws DataFormatException {
	DateTimeDt dt = new DateTimeDt();
	dt.setValueAsString("2013-02");

	ourLog.info("Date: {}", dt.getValue());
	assertEquals("2013-02", dt.getValueAsString());
	assertEquals(false, dt.isTimeZoneZulu());
	assertNull(dt.getTimeZone());
	assertEquals(TemporalPrecisionEnum.MONTH, dt.getPrecision());

	assertEquals("2013-02", myDateInstantParser.format(dt.getValue()).substring(0, 7));
}
 

开发者ID:jamesagnew,
项目名称:hapi-fhir,
代码行数:14,
代码来源:BaseDateTimeDtDstu2Test.java

示例34: isPrecisionAllowed

点赞 2

import ca.uhn.fhir.model.api.TemporalPrecisionEnum; //导入依赖的package包/类
@Override
boolean isPrecisionAllowed(TemporalPrecisionEnum thePrecision) {
	switch (thePrecision) {
		case YEAR:
		case MONTH:
		case DAY:
			return true;
		default:
			return false;
	}
}
 

开发者ID:jamesagnew,
项目名称:hapi-fhir,
代码行数:12,
代码来源:DateType.java

示例35: testSerialization2

点赞 2

import ca.uhn.fhir.model.api.TemporalPrecisionEnum; //导入依赖的package包/类
/**
 * Contributed by Travis from iSalus
 */
@Test
public void testSerialization2() {
	Patient patient = new Patient().addName(new HumanNameDt().addGiven("George").addFamily("Washington")).addName(new HumanNameDt().addGiven("George2").addFamily("Washington2"))
			.addAddress(new AddressDt().addLine("line 1").addLine("line 2").setCity("city").setState("UT"))
			.addAddress(new AddressDt().addLine("line 1b").addLine("line 2b").setCity("cityb").setState("UT")).setBirthDate(new Date(), TemporalPrecisionEnum.DAY);

	testIsSerializable(patient);
}
 

开发者ID:jamesagnew,
项目名称:hapi-fhir,
代码行数:12,
代码来源:ModelSerializationDstu2Test.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)