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


Java ResponseException类代码示例

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


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

示例1: retrieve

import org.openmrs.module.webservices.rest.web.response.ResponseException; //导入依赖的package包/类
@Override
public Object retrieve(String patientUuid, RequestContext requestContext) throws ResponseException {
    // TODO figure out how to make tests work and do this instead of directly using PatientService
    // DelegatingCrudResource<Patient> patientResource = (DelegatingCrudResource<Patient>) Context.getService(RestService.class).getResourceByName("patient");
    // Patient patient = patientResource.getByUniqueId(patientUuid);

    Patient patient = Context.getPatientService().getPatientByUuid(patientUuid);
    if (patient == null) {
        throw new NullPointerException();
    }
    Allergies allergies = Context.getService(PatientService.class).getAllergies(patient);

    SimpleObject ret = new SimpleObject();
    ret.add("status", allergies.getAllergyStatus());
    ret.add("allergies", ConversionUtil.convertToRepresentation(allergies, requestContext.getRepresentation()));
    return ret;
}
 
开发者ID:openmrs,项目名称:openmrs-module-allergyapi,代码行数:18,代码来源:AllergiesResource.java

示例2: search

import org.openmrs.module.webservices.rest.web.response.ResponseException; //导入依赖的package包/类
/**
 * @see org.openmrs.module.webservices.rest.web.resource.api.SearchHandler#getSearchConfig()
 * @should return all report templates that match given title
 * @should return empty search result if title does not exist
 * @should return all mrrt templates that match given title and totalCount if requested
 * @should return all report templates by given publisher
 * @should return empty search result if publisher does not exist
 * @should return all report templates that match given license
 * @should return empty search result if license does not exist
 * @should return all report templates that match given creator
 * @should return empty search result if creator does not exist
 */
@Override
public PageableResult search(RequestContext context) throws ResponseException {
    
    final String templateTitle = context.getParameter("title");
    final String publisher = context.getParameter("publisher");
    final String templateLicense = context.getParameter("license");
    final String templateCreator = context.getParameter("creator");
    
    final MrrtReportTemplateSearchCriteria searchCriteria =
            new MrrtReportTemplateSearchCriteria.Builder().withTitle(templateTitle)
                    .withPublisher(publisher)
                    .withLicense(templateLicense)
                    .withCreator(templateCreator)
                    .build();
    
    final List<MrrtReportTemplate> result = mrrtReportTemplateService.getMrrtReportTemplates(searchCriteria);
    if (result.isEmpty()) {
        return new EmptySearchResult();
    } else {
        return new NeedsPaging<MrrtReportTemplate>(result, context);
    }
}
 
开发者ID:openmrs,项目名称:openmrs-module-radiology,代码行数:35,代码来源:MrrtReportTemplateSearchHandler.java

示例3: delete

import org.openmrs.module.webservices.rest.web.response.ResponseException; //导入依赖的package包/类
/**
 * Overridden to Permanently delete a {@link DHISMapping} instead of
 * retiring it, no support for voiding one is included so-far
 */
@Override
protected void delete(Object o, String s, RequestContext requestContext) throws ResponseException {
	if(Context.getService(DHISConnectorService.class).permanentlyDeleteMapping((DHISMapping) o)) {
		//TODO anything to be done here?
	}
}
 
开发者ID:jembi,项目名称:openmrs-module-dhisconnector,代码行数:11,代码来源:MappingResource.java

示例4: purge

import org.openmrs.module.webservices.rest.web.response.ResponseException; //导入依赖的package包/类
@Override
public void purge(Object o, RequestContext requestContext) throws ResponseException {
}
 
开发者ID:jembi,项目名称:openmrs-module-dhisconnector,代码行数:4,代码来源:MappingResource.java

示例5: delete

import org.openmrs.module.webservices.rest.web.response.ResponseException; //导入依赖的package包/类
@Override
protected void delete(Object o, String s, RequestContext requestContext) throws ResponseException {
	// Not used
}
 
开发者ID:jembi,项目名称:openmrs-module-dhisconnector,代码行数:5,代码来源:DHISOrganisationUnitResource.java

示例6: delete

import org.openmrs.module.webservices.rest.web.response.ResponseException; //导入依赖的package包/类
@Override
protected void delete(Object o, String s, RequestContext requestContext) throws ResponseException {
	// not supporting
}
 
开发者ID:jembi,项目名称:openmrs-module-dhisconnector,代码行数:5,代码来源:DHISDataSetsResource.java

示例7: purge

import org.openmrs.module.webservices.rest.web.response.ResponseException; //导入依赖的package包/类
@Override
public void purge(Object o, RequestContext requestContext) throws ResponseException {
	// not supporting
}
 
开发者ID:jembi,项目名称:openmrs-module-dhisconnector,代码行数:5,代码来源:DHISDataSetsResource.java

示例8: delete

import org.openmrs.module.webservices.rest.web.response.ResponseException; //导入依赖的package包/类
@Override
protected void delete(Object o, String s, RequestContext requestContext) throws ResponseException {
	// not supporting delete
}
 
开发者ID:jembi,项目名称:openmrs-module-dhisconnector,代码行数:5,代码来源:PeriodIndicatorReportsResource.java

示例9: purge

import org.openmrs.module.webservices.rest.web.response.ResponseException; //导入依赖的package包/类
@Override
public void purge(Object o, RequestContext requestContext) throws ResponseException {
	// not supporting purge
}
 
开发者ID:jembi,项目名称:openmrs-module-dhisconnector,代码行数:5,代码来源:PeriodIndicatorReportsResource.java

示例10: search

import org.openmrs.module.webservices.rest.web.response.ResponseException; //导入依赖的package包/类
/**
 * @see org.openmrs.module.webservices.rest.web.resource.api.SearchHandler#search(RequestContext)
 * @should return all radiology orders for given accession number
 * @should return empty search result if no radiology order exists for given accession number
 * @should return all radiology orders for given patient
 * @should return empty search result if patient cannot be found
 * @should return empty search result if patient has no radiology orders
 * @should return all radiology orders with effective order start date in given date range if to date and from date are specified
 * @should return all radiology orders with effective order start date after or equal to from date if only from date is specified
 * @should return all radiology orders with effective order start date before or equal to to date if only to date is specified
 * @should return empty search result if no effective order start is in date range
 * @should return all radiology orders for given urgency
 * @should return empty search result if no radiology order exists for given urgency
 * @should throw illegal argument exception if urgency doesn't exist
 * @should return all radiology orders matching the search query and totalCount if
 *         requested
 */
@Override
public PageableResult search(RequestContext context) throws ResponseException {
    
    final String patientUuid = context.getRequest()
            .getParameter(REQUEST_PARAM_PATIENT);
    Patient patient = null;
    if (StringUtils.isNotBlank(patientUuid)) {
        patient = ((PatientResource1_9) Context.getService(RestService.class)
                .getResourceBySupportedClass(Patient.class)).getByUniqueId(patientUuid);
        if (patient == null) {
            return new EmptySearchResult();
        }
    }
    
    final String fromEffectiveStartDateString = context.getRequest()
            .getParameter(REQUEST_PARAM_EFFECTIVE_START_DATE_FROM);
    Date fromEffectiveStartDate = null;
    if (StringUtils.isNotBlank(fromEffectiveStartDateString)) {
        fromEffectiveStartDate = (Date) ConversionUtil.convert(fromEffectiveStartDateString, java.util.Date.class);
    }
    
    final String toEffectiveStartDateString = context.getRequest()
            .getParameter(REQUEST_PARAM_EFFECTIVE_START_DATE_TO);
    Date toEffectiveStartDate = null;
    if (StringUtils.isNotBlank(toEffectiveStartDateString)) {
        toEffectiveStartDate = (Date) ConversionUtil.convert(toEffectiveStartDateString, java.util.Date.class);
    }
    
    final String urgencyString = context.getRequest()
            .getParameter(REQUEST_PARAM_URGENCY);
    Urgency urgency = null;
    if (StringUtils.isNotBlank(urgencyString)) {
        urgency = Urgency.valueOf(urgencyString);
    }
    
    final String accessionNumber = context.getRequest()
            .getParameter(REQUEST_PARAM_ACCESSION_NUMBER);
    
    final RadiologyOrderSearchCriteria radiologyOrderSearchCriteria =
            new RadiologyOrderSearchCriteria.Builder().withAccessionNumber(accessionNumber)
                    .withPatient(patient)
                    .fromEffectiveStartDate(fromEffectiveStartDate)
                    .toEffectiveStartDate(toEffectiveStartDate)
                    .withUrgency(urgency)
                    .build();
    
    final List<RadiologyOrder> result = radiologyOrderService.getRadiologyOrders(radiologyOrderSearchCriteria);
    
    if (result.isEmpty()) {
        return new EmptySearchResult();
    }
    return new NeedsPaging<RadiologyOrder>(result, context);
}
 
开发者ID:openmrs,项目名称:openmrs-module-radiology,代码行数:71,代码来源:RadiologyOrderSearchHandler.java

示例11: search

import org.openmrs.module.webservices.rest.web.response.ResponseException; //导入依赖的package包/类
/**
 * @see org.openmrs.module.webservices.rest.web.resource.api.SearchHandler#search(RequestContext)
 * @throws IllegalArgumentException if report status doesn't exist
 * @should return all radiology reports (including voided) matching the search query if include all is set
 * @should return all radiology reports within given date range if date to and date from are specified
 * @should return all radiology reports with report date after or equal to from date if only date from is specified
 * @should return all radiology reports with report date before or equal to to date if only date to is specified
 * @should return empty search result if no report is in date range
 * @should return all radiology reports for given principal results interpreter
 * @should return empty search result if no report exists for principal results interpreter
 * @should return empty search result if principal results interpreter cannot be found
 * @should return all radiology reports with given status
 * @should return empty search result if no report exists for given status
 * @should throw illegal argument exception if report status doesn't exist
 * @should return all radiology reports matching the search query and totalCount if requested
 */
@Override
public PageableResult search(RequestContext context) throws ResponseException {
    
    final String principalResultsInterpreterUuid = context.getRequest()
            .getParameter(REQUEST_PARAM_PRINCIPAL_RESULT_INTERPRETER);
    Provider principalResultsInterpreter = null;
    if (StringUtils.isNotBlank(principalResultsInterpreterUuid)) {
        principalResultsInterpreter = ((ProviderResource1_9) Context.getService(RestService.class)
                .getResourceBySupportedClass(Provider.class)).getByUniqueId(principalResultsInterpreterUuid);
        if (principalResultsInterpreter == null) {
            return new EmptySearchResult();
        }
    }
    
    final String fromDateString = context.getRequest()
            .getParameter(REQUEST_PARAM_DATE_FROM);
    Date fromDate = null;
    if (StringUtils.isNotBlank(fromDateString)) {
        fromDate = (Date) ConversionUtil.convert(fromDateString, java.util.Date.class);
    }
    
    final String toDateString = context.getRequest()
            .getParameter(REQUEST_PARAM_DATE_TO);
    Date toDate = null;
    if (StringUtils.isNotBlank(toDateString)) {
        toDate = (Date) ConversionUtil.convert(toDateString, java.util.Date.class);
    }
    
    final String statusString = context.getRequest()
            .getParameter(REQUEST_PARAM_STATUS);
    RadiologyReportStatus status = null;
    if (StringUtils.isNotBlank(statusString)) {
        status = RadiologyReportStatus.valueOf(statusString);
    }
    
    RadiologyReportSearchCriteria.Builder radiologyReportSearchCriteriaBuilder =
            new RadiologyReportSearchCriteria.Builder();
    if (context.getIncludeAll()) {
        radiologyReportSearchCriteriaBuilder.includeVoided();
    }
    RadiologyReportSearchCriteria radiologyReportSearchCriteria = radiologyReportSearchCriteriaBuilder.fromDate(fromDate)
            .toDate(toDate)
            .withPrincipalResultsInterpreter(principalResultsInterpreter)
            .withStatus(status)
            .build();
    
    final List<RadiologyReport> result = radiologyReportService.getRadiologyReports(radiologyReportSearchCriteria);
    
    if (result.isEmpty()) {
        return new EmptySearchResult();
    }
    return new NeedsPaging<RadiologyReport>(result, context);
}
 
开发者ID:openmrs,项目名称:openmrs-module-radiology,代码行数:70,代码来源:RadiologyReportSearchHandler.java

示例12: delete

import org.openmrs.module.webservices.rest.web.response.ResponseException; //导入依赖的package包/类
/**
 * @see org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource#delete(Object, String, RequestContext)
 * @should retire given radiology modality
 */
@Override
public void delete(RadiologyModality delegate, String reason, RequestContext context) throws ResponseException {
    Context.getService(RadiologyModalityService.class)
            .retireRadiologyModality(delegate, reason);
}
 
开发者ID:openmrs,项目名称:openmrs-module-radiology,代码行数:10,代码来源:RadiologyModalityResource.java

示例13: purge

import org.openmrs.module.webservices.rest.web.response.ResponseException; //导入依赖的package包/类
/**
 * @see org.openmrs.module.webservices.rest.web.resource.impl.BaseDelegatingResource#purge(Object, RequestContext)
 * @should throw ResourceDoesNotSupportOperationException
 */
@Override
public void purge(RadiologyModality delegate, RequestContext context) throws ResponseException {
    throw new ResourceDoesNotSupportOperationException();
}
 
开发者ID:openmrs,项目名称:openmrs-module-radiology,代码行数:9,代码来源:RadiologyModalityResource.java

示例14: delete

import org.openmrs.module.webservices.rest.web.response.ResponseException; //导入依赖的package包/类
@Override
protected void delete(Object o, String s, RequestContext requestContext) throws ResponseException {

}
 
开发者ID:jembi,项目名称:openmrs-module-dhisconnector,代码行数:5,代码来源:DHISDataValueSetsResource.java

示例15: purge

import org.openmrs.module.webservices.rest.web.response.ResponseException; //导入依赖的package包/类
@Override
public void purge(Object o, RequestContext requestContext) throws ResponseException {

}
 
开发者ID:jembi,项目名称:openmrs-module-dhisconnector,代码行数:5,代码来源:DHISDataValueSetsResource.java


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