• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ResourceNotFoundException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: fetchOne

import org.springframework.data.rest.webmvc.ResourceNotFoundException; //导入依赖的package包/类
@Override
public SubmissionEnvelope fetchOne(String submissionId) {
    Submission minimalSub = submissionRepository.findOne(submissionId);

    if (minimalSub == null) {
        throw new ResourceNotFoundException();
    }

    SubmissionEnvelope submissionEnvelope = new SubmissionEnvelope(minimalSub);

    submissionEnvelope.getAnalyses().addAll(analysisRepository.findBySubmissionId(submissionId));
    submissionEnvelope.getAssayData().addAll(assayDataRepository.findBySubmissionId(submissionId));
    submissionEnvelope.getAssays().addAll(assayRepository.findBySubmissionId(submissionId));
    submissionEnvelope.getEgaDacPolicies().addAll(egaDacPolicyRepository.findBySubmissionId(submissionId));
    submissionEnvelope.getEgaDacs().addAll(egaDacRepository.findBySubmissionId(submissionId));
    submissionEnvelope.getEgaDatasets().addAll(egaDatasetRepository.findBySubmissionId(submissionId));
    submissionEnvelope.getProjects().addAll(projectRepository.findBySubmissionId(submissionId));
    submissionEnvelope.getProtocols().addAll(protocolRepository.findBySubmissionId(submissionId));
    submissionEnvelope.getSampleGroups().addAll(sampleGroupRepository.findBySubmissionId(submissionId));
    submissionEnvelope.getSamples().addAll(sampleRepository.findBySubmissionId(submissionId));
    submissionEnvelope.getStudies().addAll(studyRepository.findBySubmissionId(submissionId));

    return submissionEnvelope;
}
 
开发者ID:EMBL-EBI-SUBS-OLD,项目名称:subs,代码行数:25,代码来源:SubmissionEnvelopeServiceImpl.java


示例2: getTeam

import org.springframework.data.rest.webmvc.ResourceNotFoundException; //导入依赖的package包/类
@RequestMapping("/teams/{teamName:.+}")
@PreAuthorizeParamTeamName
public Resource<Team> getTeam(@PathVariable @P("teamName") String teamName) {
    //TODO this is a stub, we should make sure that the Teams are real and that the user is authorised
    Team d = new Team();
    d.setName(teamName);

    Page<Submission> subsPage = submissionRepository.findByTeamName(teamName, new PageRequest(0, 1));

    if (subsPage.getTotalElements() == 0) {
        throw new ResourceNotFoundException();
        //TODO temporary check until we have real team support
    }

    Resource<Team> resource = new Resource<>(d);

    resource.add(
            linkTo(
                    methodOn(this.getClass()).getTeam(
                            d.getName()
                    )
            ).withSelfRel()
    );

    return resource;
}
 
开发者ID:EMBL-EBI-SUBS-OLD,项目名称:subs,代码行数:27,代码来源:TeamController.java


示例3: getFDPMetaData

import org.springframework.data.rest.webmvc.ResourceNotFoundException; //导入依赖的package包/类
/**
 * To handle GET FDP metadata request. (Note:) The first value in the
 * produces annotation is used as a fallback value, for the request with the
 * accept header value (* / *), manually setting the contentType of the
 * response is not working.
 *
 * @param request Http request
 * @param response Http response
 * @return Metadata about the FDP in one of the acceptable formats (RDF
 * Turtle, JSON-LD, RDF XML and RDF N3)
 * @throws nl.dtls.fairdatapoint.service.FairMetadataServiceException
 * @throws nl.dtl.fairmetadata4j.io.MetadataException
 */
@ApiOperation(value = "FDP metadata")
@RequestMapping(method = RequestMethod.GET,
        produces = {"text/turtle",
            "application/ld+json", "application/rdf+xml", "text/n3"}
)
@ResponseStatus(HttpStatus.OK)
public FDPMetadata getFDPMetaData(final HttpServletRequest request,
        HttpServletResponse response) throws FairMetadataServiceException,
        ResourceNotFoundException,
        MetadataException {
    LOGGER.info("Request to get FDP metadata");
    LOGGER.info("GET : " + request.getRequestURL());
    String uri = getRequesedURL(request);
    if (!isFDPMetaDataAvailable) {
        storeDefaultFDPMetadata(request);
    }
    FDPMetadata metadata = fairMetaDataService.retrieveFDPMetaData(
            valueFactory.createIRI(uri));
    LoggerUtils.logRequest(LOGGER, request, response);
    return metadata;
}
 
开发者ID:DTL-FAIRData,项目名称:FAIRDataPoint,代码行数:35,代码来源:MetadataController.java


示例4: getHtmlFdpMetadata

import org.springframework.data.rest.webmvc.ResourceNotFoundException; //导入依赖的package包/类
@ApiIgnore
@RequestMapping(method = RequestMethod.GET,
        produces = MediaType.TEXT_HTML_VALUE)
public ModelAndView getHtmlFdpMetadata(HttpServletRequest request) throws
        FairMetadataServiceException, ResourceNotFoundException,
        MetadataException {
    ModelAndView mav = new ModelAndView("repository");
    LOGGER.info("Request to get FDP metadata");
    LOGGER.info("GET : " + request.getRequestURL());
    String uri = getRequesedURL(request);
    if (!isFDPMetaDataAvailable) {
        storeDefaultFDPMetadata(request);
    }
    FDPMetadata metadata = fairMetaDataService.retrieveFDPMetaData(
            valueFactory.createIRI(uri));
    mav.addObject("metadata", metadata);
    mav.addObject("jsonLd", MetadataUtils.getString(metadata,
            RDFFormat.JSONLD));
    return mav;
}
 
开发者ID:DTL-FAIRData,项目名称:FAIRDataPoint,代码行数:21,代码来源:MetadataController.java


示例5: getCatalogMetaData

import org.springframework.data.rest.webmvc.ResourceNotFoundException; //导入依赖的package包/类
/**
 * Get catalog metadata
 *
 * @param id
 * @param request
 * @param response
 * @return Metadata about the catalog in one of the acceptable formats (RDF
 * Turtle, JSON-LD, RDF XML and RDF N3)
 *
 * @throws IllegalStateException
 * @throws FairMetadataServiceException
 */
@ApiOperation(value = "Catalog metadata")
@RequestMapping(value = "/catalog/{id}", method = RequestMethod.GET,
        produces = {"text/turtle",
            "application/ld+json", "application/rdf+xml", "text/n3"}
)
@ResponseStatus(HttpStatus.OK)
public CatalogMetadata getCatalogMetaData(
        @PathVariable final String id, HttpServletRequest request,
        HttpServletResponse response) throws FairMetadataServiceException,
        ResourceNotFoundException {
    LOGGER.info("Request to get CATALOG metadata with ID ", id);
    LOGGER.info("GET : " + request.getRequestURL());
    String uri = getRequesedURL(request);
    CatalogMetadata metadata = fairMetaDataService.
            retrieveCatalogMetaData(valueFactory.createIRI(uri));
    LoggerUtils.logRequest(LOGGER, request, response);
    return metadata;
}
 
开发者ID:DTL-FAIRData,项目名称:FAIRDataPoint,代码行数:31,代码来源:MetadataController.java


示例6: getDatasetMetaData

import org.springframework.data.rest.webmvc.ResourceNotFoundException; //导入依赖的package包/类
/**
 * Get dataset metadata
 *
 * @param id
 * @param request
 * @param response
 * @return Metadata about the dataset in one of the acceptable formats (RDF
 * Turtle, JSON-LD, RDF XML and RDF N3)
 *
 * @throws FairMetadataServiceException
 */
@ApiOperation(value = "Dataset metadata")
@RequestMapping(value = "/dataset/{id}",
        method = RequestMethod.GET,
        produces = {"text/turtle",
            "application/ld+json", "application/rdf+xml", "text/n3"}
)
@ResponseStatus(HttpStatus.OK)
public DatasetMetadata getDatasetMetaData(
        @PathVariable final String id, HttpServletRequest request,
        HttpServletResponse response) throws FairMetadataServiceException,
        ResourceNotFoundException {
    LOGGER.info("Request to get DATASET metadata with ID ", id);
    LOGGER.info("GET : " + request.getRequestURL());
    String uri = getRequesedURL(request);
    DatasetMetadata metadata = fairMetaDataService.
            retrieveDatasetMetaData(valueFactory.createIRI(uri));
    LoggerUtils.logRequest(LOGGER, request, response);
    return metadata;
}
 
开发者ID:DTL-FAIRData,项目名称:FAIRDataPoint,代码行数:31,代码来源:MetadataController.java


示例7: getDistribution

import org.springframework.data.rest.webmvc.ResourceNotFoundException; //导入依赖的package包/类
/**
 * Get distribution metadata
 *
 * @param id
 * @param request
 * @param response
 * @return Metadata about the dataset distribution in one of the acceptable
 * formats (RDF Turtle, JSON-LD, RDF XML and RDF N3)
 *
 * @throws FairMetadataServiceException
 */
@ApiOperation(value = "Dataset distribution metadata")
@RequestMapping(value = "/distribution/{id}",
        produces = {"text/turtle",
            "application/ld+json", "application/rdf+xml", "text/n3"},
        method = RequestMethod.GET)
@ResponseStatus(HttpStatus.OK)
public DistributionMetadata getDistribution(
        @PathVariable final String id,
        HttpServletRequest request,
        HttpServletResponse response) throws FairMetadataServiceException,
        ResourceNotFoundException {
    LOGGER.info("Request to get dataset's distribution wih ID ",
            id);
    LOGGER.info("GET : " + request.getRequestURL());
    String uri = getRequesedURL(request);
    DistributionMetadata metadata = fairMetaDataService.
            retrieveDistributionMetaData(valueFactory.createIRI(uri));
    LoggerUtils.logRequest(LOGGER, request, response);
    return metadata;
}
 
开发者ID:DTL-FAIRData,项目名称:FAIRDataPoint,代码行数:32,代码来源:MetadataController.java


示例8: retrieveStatements

import org.springframework.data.rest.webmvc.ResourceNotFoundException; //导入依赖的package包/类
private List<Statement> retrieveStatements(@Nonnull IRI uri) throws
        FairMetadataServiceException, ResourceNotFoundException {
    try {
        Preconditions.checkNotNull(uri, "Resource uri not be null.");
        List<Statement> statements = storeManager.retrieveResource(uri);
        if (statements.isEmpty()) {
            String msg = ("No metadata found for the uri : " + uri);
            throw (new ResourceNotFoundException(msg));
        }
        addAddtionalResource(statements);
        return statements;
    } catch (StoreManagerException ex) {
        LOGGER.error("Error retrieving fdp metadata from the store");
        throw (new FairMetadataServiceException(ex.getMessage()));
    }
}
 
开发者ID:DTL-FAIRData,项目名称:FAIRDataPoint,代码行数:17,代码来源:FairMetaDataServiceImpl.java


示例9: populateProjectSchemaYear

import org.springframework.data.rest.webmvc.ResourceNotFoundException; //导入依赖的package包/类
public void populateProjectSchemaYear(HousingInventory inventory,Session session,String trustedAppId) throws Exception {
	 
 			UUID projectId = inventory.getProjectId();
 			Map<String,Object> searchParams = new HashMap<>();
 			searchParams.put("q", projectId);
 			SearchRequest searchRequest = new SearchRequest();
 			searchRequest.setSearchParams(searchParams);
 			searchRequest.setSessionToken(session.getToken());
 			searchRequest.setTrustedAppId(trustedAppId);
 			searchRequest.setSearchEntity("projects");
 			List<BaseProject> projects =  (List<BaseProject>) searchServiceClient.search(searchRequest);
 			if(!projects.isEmpty())
 				inventory.setSchemaYear(projects.get(0).getSchemaYear());
 			else
 				throw new ResourceNotFoundException("Invalid Project Identification "+projectId);
 	
}
 
开发者ID:hserv,项目名称:coordinated-entry,代码行数:18,代码来源:HousingInventoryResource.java


示例10: gather

import org.springframework.data.rest.webmvc.ResourceNotFoundException; //导入依赖的package包/类
@Override
@Transactional
public ChartStock gather(String userId, String stockProductId, ChartType type,
		ChartHistoSize histoSize, ChartHistoMovingAverage histoAverage,
		ChartHistoTimeSpan histoPeriod, Integer intradayWidth,
		Integer intradayHeight) throws ResourceNotFoundException {
	Preconditions.checkNotNull(type, "ChartType must not be null!");
	
	StockProduct stock = gather(userId, stockProductId);

	ChartStock chartStock = getChartStock(stock, type, histoSize, histoAverage, histoPeriod, intradayWidth, intradayHeight);

	if(AuthenticationUtil.userHasRole(Role.ROLE_OAUTH2)){
		updateChartStockFromYahoo(stock, type, histoSize, histoAverage, histoPeriod, intradayWidth, intradayHeight);
		return getChartStock(stock, type, histoSize, histoAverage, histoPeriod, intradayWidth, intradayHeight);
	}
	else if(chartStock != null){
		return chartStock;
	}
	throw new ResourceNotFoundException();
}
 
开发者ID:alex-bretet,项目名称:cloudstreetmarket.com,代码行数:22,代码来源:StockProductServiceOfflineImpl.java


示例11: gather

import org.springframework.data.rest.webmvc.ResourceNotFoundException; //导入依赖的package包/类
@Override
@Transactional
public ChartStock gather(String stockProductId, ChartType type,
		ChartHistoSize histoSize, ChartHistoMovingAverage histoAverage,
		ChartHistoTimeSpan histoPeriod, Integer intradayWidth,
		Integer intradayHeight) throws ResourceNotFoundException {
	Preconditions.checkNotNull(type, "ChartType must not be null!");
	
	StockProduct stock = gather(stockProductId);

	ChartStock chartStock = getChartStock(stock, type, histoSize, histoAverage, histoPeriod, intradayWidth, intradayHeight);

	if(AuthenticationUtil.userHasRole(Role.ROLE_OAUTH2)){
		updateChartStockFromYahoo(stock, type, histoSize, histoAverage, histoPeriod, intradayWidth, intradayHeight);
		return getChartStock(stock, type, histoSize, histoAverage, histoPeriod, intradayWidth, intradayHeight);
	}
	else if(chartStock != null){
		return chartStock;
	}
	throw new ResourceNotFoundException();
}
 
开发者ID:alex-bretet,项目名称:cloudstreetmarket.com,代码行数:22,代码来源:StockProductServiceOnlineImpl.java


示例12: handleResourceNotFound

import org.springframework.data.rest.webmvc.ResourceNotFoundException; //导入依赖的package包/类
@ResponseStatus(HttpStatus.NOT_FOUND)
@ExceptionHandler(ResourceNotFoundException.class)
public @ResponseBody ExceptionInfo handleResourceNotFound(HttpServletRequest request, Exception e) {
    getLog().warn(String.format("Caught a resource not found exception argument at '%s'; " +
            "this will generate a NOT_FOUND RESPONSE",
        request.getRequestURL().toString()));
    getLog().debug("Handling ResourceNotFoundException and returning NOT_FOUND response", e);
    return new ExceptionInfo(request.getRequestURL().toString(), e.getLocalizedMessage());
}
 
开发者ID:HumanCellAtlas,项目名称:ingest-core,代码行数:10,代码来源:GlobalStateExceptionHandler.java


示例13: processingStatus

import org.springframework.data.rest.webmvc.ResourceNotFoundException; //导入依赖的package包/类
@RequestMapping("/processingStatuses/{status}")
public Resource<StatusDescription> processingStatus(@PathVariable String status) {
    Optional<StatusDescription> optionalStatus = processingStatuses.stream().filter(s -> s.getStatusName().equals(status))
            .findFirst();

    if (optionalStatus.isPresent()) {
        return processingStatusResourceAssembler.toResource(optionalStatus.get());
    } else {
        throw new ResourceNotFoundException();
    }
}
 
开发者ID:EMBL-EBI-SUBS-OLD,项目名称:subs,代码行数:12,代码来源:StatusDescriptionController.java


示例14: releaseStatus

import org.springframework.data.rest.webmvc.ResourceNotFoundException; //导入依赖的package包/类
@RequestMapping("/releaseStatuses/{status}")
public Resource<StatusDescription> releaseStatus(@PathVariable String status) {
    Optional<StatusDescription> optionalStatus = releaseStatuses.stream().filter(s -> s.getStatusName().equals(status))
            .findFirst();

    if (optionalStatus.isPresent()) {
        return releaseStatusResourceAssembler.toResource(optionalStatus.get());
    } else {
        throw new ResourceNotFoundException();
    }
}
 
开发者ID:EMBL-EBI-SUBS-OLD,项目名称:subs,代码行数:12,代码来源:StatusDescriptionController.java


示例15: submissionStatus

import org.springframework.data.rest.webmvc.ResourceNotFoundException; //导入依赖的package包/类
@RequestMapping("submissionStatuses/{status}")
public Resource<StatusDescription> submissionStatus(@PathVariable String status) {
    Optional<StatusDescription> optionalStatus = submissionStatuses.stream().filter(s -> s.getStatusName().equals(status))
            .findFirst();

    if (optionalStatus.isPresent()) {
        return submissionStatusResourceAssembler.toResource(optionalStatus.get());
    } else {
        throw new ResourceNotFoundException();
    }
}
 
开发者ID:EMBL-EBI-SUBS-OLD,项目名称:subs,代码行数:12,代码来源:StatusDescriptionController.java


示例16: handleResourceNotFound

import org.springframework.data.rest.webmvc.ResourceNotFoundException; //导入依赖的package包/类
@ExceptionHandler(ResourceNotFoundException.class)
public ResponseEntity<String> handleResourceNotFound(
        ResourceNotFoundException ex, HttpServletResponse response) {
    HttpHeaders headers = new HttpHeaders();    
    headers.setContentType(MediaType.TEXT_PLAIN);
    String msg = ex.getMessage();
    LOGGER.error(msg);
    return new ResponseEntity<>(msg, headers, 
            HttpStatus.NOT_FOUND);
}
 
开发者ID:DTL-FAIRData,项目名称:FAIRDataPoint,代码行数:11,代码来源:ExceptionHandlerAdvice.java


示例17: getHtmlCatalogMetadata

import org.springframework.data.rest.webmvc.ResourceNotFoundException; //导入依赖的package包/类
@ApiIgnore
@RequestMapping(value = "/catalog/{id}", method = RequestMethod.GET,
        produces = MediaType.TEXT_HTML_VALUE)
public ModelAndView getHtmlCatalogMetadata(HttpServletRequest request)
        throws FairMetadataServiceException, ResourceNotFoundException,
        MetadataException {
    ModelAndView mav = new ModelAndView("catalog");
    String uri = getRequesedURL(request);
    CatalogMetadata metadata = fairMetaDataService.
            retrieveCatalogMetaData(valueFactory.createIRI(uri));
    mav.addObject("metadata", metadata);
    mav.addObject("jsonLd", MetadataUtils.getString(metadata,
            RDFFormat.JSONLD));
    return mav;
}
 
开发者ID:DTL-FAIRData,项目名称:FAIRDataPoint,代码行数:16,代码来源:MetadataController.java


示例18: getHtmlDatsetMetadata

import org.springframework.data.rest.webmvc.ResourceNotFoundException; //导入依赖的package包/类
@ApiIgnore
@RequestMapping(value = "/dataset/{id}", method = RequestMethod.GET,
        produces = MediaType.TEXT_HTML_VALUE)
public ModelAndView getHtmlDatsetMetadata(HttpServletRequest request)
        throws FairMetadataServiceException, ResourceNotFoundException,
        MetadataException {
    ModelAndView mav = new ModelAndView("dataset");
    String uri = getRequesedURL(request);
    DatasetMetadata metadata = fairMetaDataService.
            retrieveDatasetMetaData(valueFactory.createIRI(uri));
    mav.addObject("metadata", metadata);
    mav.addObject("jsonLd", MetadataUtils.getString(metadata,
            RDFFormat.JSONLD));
    return mav;
}
 
开发者ID:DTL-FAIRData,项目名称:FAIRDataPoint,代码行数:16,代码来源:MetadataController.java


示例19: getHtmlDistributionMetadata

import org.springframework.data.rest.webmvc.ResourceNotFoundException; //导入依赖的package包/类
@ApiIgnore
@RequestMapping(value = "/distribution/{id}", method = RequestMethod.GET,
        produces = MediaType.TEXT_HTML_VALUE)
public ModelAndView getHtmlDistributionMetadata(HttpServletRequest request)
        throws FairMetadataServiceException, ResourceNotFoundException,
        MetadataException {
    ModelAndView mav = new ModelAndView("distribution");
    String uri = getRequesedURL(request);
    DistributionMetadata metadata = fairMetaDataService.
            retrieveDistributionMetaData(valueFactory.createIRI(uri));
    mav.addObject("metadata", metadata);
    mav.addObject("jsonLd", MetadataUtils.getString(metadata,
            RDFFormat.JSONLD));
    return mav;
}
 
开发者ID:DTL-FAIRData,项目名称:FAIRDataPoint,代码行数:16,代码来源:MetadataController.java


示例20: retrieveFDPMetaData

import org.springframework.data.rest.webmvc.ResourceNotFoundException; //导入依赖的package包/类
@Override
public FDPMetadata retrieveFDPMetaData(@Nonnull IRI uri) throws
        FairMetadataServiceException, ResourceNotFoundException {
    List<Statement> statements = retrieveStatements(uri);
    FDPMetadataParser parser = MetadataParserUtils.getFdpParser();
    FDPMetadata metadata = parser.parse(statements, uri);
    return metadata;
}
 
开发者ID:DTL-FAIRData,项目名称:FAIRDataPoint,代码行数:9,代码来源:FairMetaDataServiceImpl.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java FileTemplateLoader类代码示例发布时间:2022-05-22
下一篇:
Java Transport类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap