当前位置: 首页>>代码示例>>Java>>正文


Java Representation类代码示例

本文整理汇总了Java中org.openmrs.module.webservices.rest.web.representation.Representation的典型用法代码示例。如果您正苦于以下问题:Java Representation类的具体用法?Java Representation怎么用?Java Representation使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Representation类属于org.openmrs.module.webservices.rest.web.representation包,在下文中一共展示了Representation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getRepresentationDescription

import org.openmrs.module.webservices.rest.web.representation.Representation; //导入依赖的package包/类
@Override
public DelegatingResourceDescription getRepresentationDescription(Representation representation) {
	DelegatingResourceDescription description = new DelegatingResourceDescription();

	if (representation instanceof FullRepresentation) {
		description.addProperty("id");
		description.addProperty("name");
		description.addProperty("code");
		description.addProperty("periodType");
		description.addProperty("code");
		description.addProperty("categoryCombo");
		description.addProperty("dataElements");
		description.addProperty("dataSetElements");
	} else {
		description.addProperty("id");
		description.addProperty("name");
		description.addProperty("code");
		description.addProperty("created");
		description.addProperty("lastUpdated");
		description.addProperty("href");
	}

	return description;
}
 
开发者ID:jembi,项目名称:openmrs-module-dhisconnector,代码行数:25,代码来源:DHISDataSetsResource.java

示例2: asRepresentation

import org.openmrs.module.webservices.rest.web.representation.Representation; //导入依赖的package包/类
@Override
public SimpleObject asRepresentation(Allergy allergy, Representation representation) throws ConversionException {
    SimpleObject ret = new SimpleObject()
            .add("uuid", allergy.getUuid())
            .add("display", allergy.getAllergen().toString());
    if (representation.equals(Representation.DEFAULT)) {
        ret.add("allergen", ConversionUtil.convertToRepresentation(allergy.getAllergen(), Representation.REF));
        ret.add("severity", ConversionUtil.convertToRepresentation(allergy.getSeverity(), Representation.REF));
        ret.add("reactions", ConversionUtil.convertToRepresentation(allergy.getReactions(), Representation.REF));
        ret.add("comment", allergy.getComment());
    }
    else if (representation.equals(Representation.FULL)) {
        ret.add("patient", ConversionUtil.convertToRepresentation(allergy.getAllergen(), Representation.REF));
        ret.add("allergen", ConversionUtil.convertToRepresentation(allergy.getAllergen(), Representation.DEFAULT));
        ret.add("severity", ConversionUtil.convertToRepresentation(allergy.getSeverity(), Representation.DEFAULT));
        ret.add("reactions", ConversionUtil.convertToRepresentation(allergy.getReactions(), Representation.DEFAULT));
        ret.add("comment", allergy.getComment());
    }
    return ret;
}
 
开发者ID:openmrs,项目名称:openmrs-module-allergyapi,代码行数:21,代码来源:AllergyConverter.java

示例3: getRepresentationDescription

import org.openmrs.module.webservices.rest.web.representation.Representation; //导入依赖的package包/类
/**
* @see org.openmrs.module.webservices.rest.web.resource.impl.DelegatingCrudResource#getRepresentationDescription(org.openmrs.module.webservices.rest.web.representation.Representation)
 * @should return default representation given instance of defaultrepresentation
 * @should return full representation given instance of fullrepresentation
 * @should return null for representation other then default or full
 */
@Override
public DelegatingResourceDescription getRepresentationDescription(Representation rep) {
    if (rep instanceof DefaultRepresentation || rep instanceof FullRepresentation) {
        DelegatingResourceDescription description = new DelegatingResourceDescription();
        description.addProperty("uuid");
        description.addProperty("display");
        description.addProperty("aeTitle");
        description.addProperty("name");
        description.addProperty("description");
        description.addProperty("retired");
        description.addSelfLink();
        if (rep instanceof DefaultRepresentation) {
            description.addLink("full", ".?v=" + RestConstants.REPRESENTATION_FULL);
        } else {
            description.addProperty("auditInfo");
        }
        return description;
    }
    return null;
}
 
开发者ID:openmrs,项目名称:openmrs-module-radiology,代码行数:27,代码来源:RadiologyModalityResource.java

示例4: shouldReturnAllRadiologyOrdersForGivenAccessionNumber

import org.openmrs.module.webservices.rest.web.representation.Representation; //导入依赖的package包/类
/**
 * @see RadiologyOrderSearchHandler#search(RequestContext)
 */
@Test
public void shouldReturnAllRadiologyOrdersForGivenAccessionNumber() throws Exception {
    
    MockHttpServletRequest requestAccessionNumberWithOrder = request(RequestMethod.GET, getURI());
    requestAccessionNumberWithOrder.setParameter(RadiologyOrderSearchHandler.REQUEST_PARAM_ACCESSION_NUMBER,
        ACCESSION_NUMBER_WITH_ORDER);
    requestAccessionNumberWithOrder.setParameter("v", Representation.FULL.getRepresentation());
    
    SimpleObject resultAccessionNumberWithOrder = deserialize(handle(requestAccessionNumberWithOrder));
    
    assertNotNull(resultAccessionNumberWithOrder);
    List<Object> hits = (List<Object>) resultAccessionNumberWithOrder.get("results");
    assertThat(hits.size(), is(1));
    assertThat(PropertyUtils.getProperty(hits.get(0), "accessionNumber"), is(ACCESSION_NUMBER_WITH_ORDER));
    assertNull(PropertyUtils.getProperty(resultAccessionNumberWithOrder, "totalCount"));
}
 
开发者ID:openmrs,项目名称:openmrs-module-radiology,代码行数:20,代码来源:RadiologyOrderSearchHandlerComponentTest.java

示例5: shouldReturnEmptySearchResultIfNoEffectiveOrderStartIsInDateRange

import org.openmrs.module.webservices.rest.web.representation.Representation; //导入依赖的package包/类
/**
 * @see RadiologyOrderSearchHandler#search(RequestContext)
 */
@Test
public void shouldReturnEmptySearchResultIfNoEffectiveOrderStartIsInDateRange() throws Exception {
    
    MockHttpServletRequest request = request(RequestMethod.GET, getURI());
    request.setParameter(RadiologyOrderSearchHandler.REQUEST_PARAM_EFFECTIVE_START_DATE_FROM,
        DATE_AFTER_ORDER_EFFECTIVE_START_DATES);
    request.setParameter("v", Representation.FULL.getRepresentation());
    
    SimpleObject result = deserialize(handle(request));
    
    assertNotNull(result);
    List<Object> hits = (List<Object>) result.get("results");
    assertThat(hits.size(), is(0));
    assertNull(PropertyUtils.getProperty(result, "totalCount"));
}
 
开发者ID:openmrs,项目名称:openmrs-module-radiology,代码行数:19,代码来源:RadiologyOrderSearchHandlerComponentTest.java

示例6: shouldReturnDefaultRepresentationGivenInstanceOfDefaultrepresentation

import org.openmrs.module.webservices.rest.web.representation.Representation; //导入依赖的package包/类
@Test
public void shouldReturnDefaultRepresentationGivenInstanceOfDefaultrepresentation() throws Exception {
    
    DefaultRepresentation defaultRepresentation = new DefaultRepresentation();
    
    DelegatingResourceDescription resourceDescription =
            radiologyReportResource.getRepresentationDescription(defaultRepresentation);
    assertThat(resourceDescription.getProperties()
            .keySet(),
        contains("uuid", "radiologyOrder", "date", "principalResultsInterpreter", "status", "body", "display",
            "voided"));
    assertThat(resourceDescription.getProperties()
            .get("radiologyOrder")
            .getRep(),
        is(Representation.REF));
}
 
开发者ID:openmrs,项目名称:openmrs-module-radiology,代码行数:17,代码来源:RadiologyReportResourceTest.java

示例7: shouldReturnFullRepresentationGivenInstanceOfFullrepresentation

import org.openmrs.module.webservices.rest.web.representation.Representation; //导入依赖的package包/类
@Test
public void shouldReturnFullRepresentationGivenInstanceOfFullrepresentation() throws Exception {
    
    FullRepresentation fullRepresentation = new FullRepresentation();
    
    DelegatingResourceDescription resourceDescription =
            radiologyReportResource.getRepresentationDescription(fullRepresentation);
    assertThat(resourceDescription.getProperties()
            .keySet(),
        contains("uuid", "radiologyOrder", "date", "principalResultsInterpreter", "status", "body", "display", "voided",
            "auditInfo"));
    assertThat(resourceDescription.getProperties()
            .get("radiologyOrder")
            .getRep(),
        is(Representation.REF));
}
 
开发者ID:openmrs,项目名称:openmrs-module-radiology,代码行数:17,代码来源:RadiologyReportResourceTest.java

示例8: shouldReturnAllRadiologyReportsIncludingDiscontinuedMatchingTheSearchQueryIfIncludeAllIsSet

import org.openmrs.module.webservices.rest.web.representation.Representation; //导入依赖的package包/类
@Test
public void shouldReturnAllRadiologyReportsIncludingDiscontinuedMatchingTheSearchQueryIfIncludeAllIsSet()
        throws Exception {
    
    MockHttpServletRequest request = request(RequestMethod.GET, getURI());
    request.setParameter(RadiologyReportSearchHandler.REQUEST_PARAM_PRINCIPAL_RESULT_INTERPRETER,
        PROVIDER_WITH_RADIOLOGY_REPORTS);
    request.setParameter(RestConstants.REQUEST_PROPERTY_FOR_INCLUDE_ALL, "true");
    request.setParameter("v", Representation.FULL.getRepresentation());
    
    SimpleObject result = deserialize(handle(request));
    
    assertNotNull(result);
    List<Object> hits = (List<Object>) result.get("results");
    assertThat(hits.size(), is(3));
    assertThat(PropertyUtils.getProperty(hits.get(2), "uuid"), is(RADIOLOGY_REPORT_UUID_OF_VOIDED));
    assertThat(PropertyUtils.getProperty(hits.get(2), "voided"), is(true));
}
 
开发者ID:openmrs,项目名称:openmrs-module-radiology,代码行数:19,代码来源:RadiologyReportSearchHandlerComponentTest.java

示例9: shouldReturnAllRadiologyReportsWithReportDateAfterOrEqualToFromDateIfOnlyDateFromWasSpecified

import org.openmrs.module.webservices.rest.web.representation.Representation; //导入依赖的package包/类
@Test
public void shouldReturnAllRadiologyReportsWithReportDateAfterOrEqualToFromDateIfOnlyDateFromWasSpecified()
        throws Exception {
    
    MockHttpServletRequest request = request(RequestMethod.GET, getURI());
    request.setParameter(RadiologyReportSearchHandler.REQUEST_PARAM_DATE_FROM, DATE_BETWEEN_REPORT_DATES);
    request.setParameter("v", Representation.FULL.getRepresentation());
    
    SimpleObject result = deserialize(handle(request));
    
    assertNotNull(result);
    List<Object> hits = (List<Object>) result.get("results");
    assertThat(hits.size(), is(1));
    assertNull(PropertyUtils.getProperty(result, "totalCount"));
    
    RadiologyReportSearchCriteria radiologyReportSearchCriteria =
            new RadiologyReportSearchCriteria.Builder().fromDate(format.parse(DATE_BETWEEN_REPORT_DATES))
                    .build();
    
    assertThat(PropertyUtils.getProperty(hits.get(0), "date"),
        is(resultFormat.format(radiologyReportService.getRadiologyReports(radiologyReportSearchCriteria)
                .get(0)
                .getDate())));
    assertThat(PropertyUtils.getProperty(hits.get(0), "voided"), is(false));
}
 
开发者ID:openmrs,项目名称:openmrs-module-radiology,代码行数:26,代码来源:RadiologyReportSearchHandlerComponentTest.java

示例10: shouldReturnAllRadiologyReportsWithReportDateBeforeOrEqualToToDateIfOnlyDateToWasSpecified

import org.openmrs.module.webservices.rest.web.representation.Representation; //导入依赖的package包/类
@Test
public void shouldReturnAllRadiologyReportsWithReportDateBeforeOrEqualToToDateIfOnlyDateToWasSpecified()
        throws Exception {
    
    MockHttpServletRequest request = request(RequestMethod.GET, getURI());
    request.setParameter(RadiologyReportSearchHandler.REQUEST_PARAM_DATE_TO, DATE_BETWEEN_REPORT_DATES);
    request.setParameter("v", Representation.FULL.getRepresentation());
    
    SimpleObject result = deserialize(handle(request));
    
    assertNotNull(result);
    List<Object> hits = (List<Object>) result.get("results");
    assertThat(hits.size(), is(1));
    assertNull(PropertyUtils.getProperty(result, "totalCount"));
    
    RadiologyReportSearchCriteria radiologyReportSearchCriteria =
            new RadiologyReportSearchCriteria.Builder().toDate(format.parse(DATE_BETWEEN_REPORT_DATES))
                    .build();
    
    assertThat(PropertyUtils.getProperty(hits.get(0), "date"),
        is(resultFormat.format(radiologyReportService.getRadiologyReports(radiologyReportSearchCriteria)
                .get(0)
                .getDate())));
    assertThat(PropertyUtils.getProperty(hits.get(0), "voided"), is(false));
}
 
开发者ID:openmrs,项目名称:openmrs-module-radiology,代码行数:26,代码来源:RadiologyReportSearchHandlerComponentTest.java

示例11: shouldReturnAllRadiologyReportsForGivenPrincipalResultsInterpreter

import org.openmrs.module.webservices.rest.web.representation.Representation; //导入依赖的package包/类
@Test
public void shouldReturnAllRadiologyReportsForGivenPrincipalResultsInterpreter() throws Exception {
    
    MockHttpServletRequest request = request(RequestMethod.GET, getURI());
    request.setParameter(RadiologyReportSearchHandler.REQUEST_PARAM_PRINCIPAL_RESULT_INTERPRETER,
        PROVIDER_WITH_RADIOLOGY_REPORTS);
    request.setParameter("v", Representation.FULL.getRepresentation());
    
    SimpleObject result = deserialize(handle(request));
    
    assertNotNull(result);
    List<Object> hits = (List<Object>) result.get("results");
    assertThat(hits.size(), is(2));
    assertThat(PropertyUtils.getProperty(hits.get(0), "voided"), is(false));
    assertThat(PropertyUtils.getProperty(hits.get(1), "voided"), is(false));
}
 
开发者ID:openmrs,项目名称:openmrs-module-radiology,代码行数:17,代码来源:RadiologyReportSearchHandlerComponentTest.java

示例12: shouldReturnAllReportTemplatesThatMatchGivenTitle

import org.openmrs.module.webservices.rest.web.representation.Representation; //导入依赖的package包/类
@Test
public void shouldReturnAllReportTemplatesThatMatchGivenTitle() throws Exception {
    
    MockHttpServletRequest mrrtReportTemplateRequest = request(RequestMethod.GET, getURI());
    mrrtReportTemplateRequest.setParameter(MrrtReportTemplateSearchHandler.REQUEST_PARAM_TITLE, TITLE_QUERY);
    mrrtReportTemplateRequest.setParameter("v", Representation.FULL.getRepresentation());
    SimpleObject resultMrrtReportTemplate = deserialize(handle(mrrtReportTemplateRequest));
    
    assertNotNull(resultMrrtReportTemplate);
    List<Object> hits = (List<Object>) resultMrrtReportTemplate.get("results");
    MrrtReportTemplateSearchCriteria searchCriteria =
            new MrrtReportTemplateSearchCriteria.Builder().withTitle(TITLE_QUERY)
                    .build();
    assertThat(hits.size(), is(2));
    assertThat(PropertyUtils.getProperty(hits.get(0), "uuid"),
        is(mrrtReportTemplateService.getMrrtReportTemplates(searchCriteria)
                .get(0)
                .getUuid()));
    assertNull(PropertyUtils.getProperty(resultMrrtReportTemplate, "totalCount"));
}
 
开发者ID:openmrs,项目名称:openmrs-module-radiology,代码行数:21,代码来源:MrrtReportTemplateSearchHandlerComponentTest.java

示例13: getRepresentationDescription

import org.openmrs.module.webservices.rest.web.representation.Representation; //导入依赖的package包/类
@Override
public DelegatingResourceDescription getRepresentationDescription(Representation representation) {
	DelegatingResourceDescription description = new DelegatingResourceDescription();
	description.addProperty("dataSet");
	description.addProperty("period");
	description.addProperty("orgUnit");
	description.addProperty("dataValues");
	return description;
}
 
开发者ID:jembi,项目名称:openmrs-module-dhisconnector,代码行数:10,代码来源:DHISDataValueSetsResource.java

示例14: getRepresentationDescription

import org.openmrs.module.webservices.rest.web.representation.Representation; //导入依赖的package包/类
@Override
public DelegatingResourceDescription getRepresentationDescription(Representation representation) {
	DelegatingResourceDescription description = new DelegatingResourceDescription();
	description.addProperty("id");
	description.addProperty("name");
	description.addProperty("categoryOptionCombos");
	description.addProperty("categories");
	return description;
}
 
开发者ID:jembi,项目名称:openmrs-module-dhisconnector,代码行数:10,代码来源:DHISCategoryCombosResource.java

示例15: getRepresentationDescription

import org.openmrs.module.webservices.rest.web.representation.Representation; //导入依赖的package包/类
@Override
public DelegatingResourceDescription getRepresentationDescription(Representation representation) {
	DelegatingResourceDescription description = new DelegatingResourceDescription();
	description.addProperty("id");
	description.addProperty("dataElement", Representation.REF);
	description.addProperty("dataSet", Representation.REF);
	return description;
}
 
开发者ID:jembi,项目名称:openmrs-module-dhisconnector,代码行数:9,代码来源:DHISDataSetElementResource.java


注:本文中的org.openmrs.module.webservices.rest.web.representation.Representation类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。