當前位置: 首頁>>代碼示例>>Java>>正文


Java Resource.getContent方法代碼示例

本文整理匯總了Java中org.springframework.hateoas.Resource.getContent方法的典型用法代碼示例。如果您正苦於以下問題:Java Resource.getContent方法的具體用法?Java Resource.getContent怎麽用?Java Resource.getContent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.springframework.hateoas.Resource的用法示例。


在下文中一共展示了Resource.getContent方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: process

import org.springframework.hateoas.Resource; //導入方法依賴的package包/類
public Resource<SubmissionEnvelope> process(Resource<SubmissionEnvelope> resource) {
    SubmissionEnvelope submissionEnvelope = resource.getContent();

    // add subresource links for each type of metadata document in a submission envelope
    resource.add(getAnalysesLink(submissionEnvelope));
    resource.add(getAssaysLink(submissionEnvelope));
    resource.add(getFilesLink(submissionEnvelope));
    resource.add(getProjectsLink(submissionEnvelope));
    resource.add(getProtocolsLink(submissionEnvelope));
    resource.add(getSamplesLink(submissionEnvelope));

    // add subresource links for events that occur in response to state transitions
    submissionEnvelope.allowedStateTransitions().stream()
            .map(submissionState -> getStateTransitionLink(submissionEnvelope, submissionState))
            .filter(Optional::isPresent)
            .map(Optional::get)
            .forEach(resource::add);

    return resource;
}
 
開發者ID:HumanCellAtlas,項目名稱:ingest-core,代碼行數:21,代碼來源:SubmissionEnvelopeResourceProcessor.java

示例2: process

import org.springframework.hateoas.Resource; //導入方法依賴的package包/類
@Override
public Resource<LineItem> process(Resource<LineItem> resource) {

	LineItem content = resource.getContent();

	Optional.ofNullable(productResource.getLink())//
			.map(it -> it.expand(content.getProductNumber().getValue())) //
			.map(it -> it.withRel("product")) //
			.ifPresent(it -> resource.add(it));

	return resource;
}
 
開發者ID:olivergierke,項目名稱:sos,代碼行數:13,代碼來源:LineItemResourceProcessor.java

示例3: initProductInfo

import org.springframework.hateoas.Resource; //導入方法依賴的package包/類
private void initProductInfo(Resource<ProductAdded> resource) {

		ProductId productId = ProductId.of(resource.getLink("product").getHref());
		ProductAdded event = resource.getContent();
		Product product = event.getProduct();

		log.info("Creating inventory item for product {}.", product.getDescription());

		productInfos.findByProductId(productId) //
				.orElseGet(() -> productInfos.save(ProductInfo.of(productId, product.getDescription(), product.getPrice())));
	}
 
開發者ID:olivergierke,項目名稱:sos,代碼行數:12,代碼來源:CatalogIntegration.java

示例4: findOne

import org.springframework.hateoas.Resource; //導入方法依賴的package包/類
@GetMapping(value = "/supervisors/{id}", produces = MediaTypes.HAL_JSON_VALUE)
public ResponseEntity<Resource<Supervisor>> findOne(@PathVariable Long id) {

	Resource<Manager> managerResource = controller.findOne(id).getBody();
	Resource<Supervisor> supervisorResource = new Resource<>(
		new Supervisor(managerResource.getContent()),
		managerResource.getLinks());

	return ResponseEntity.ok(supervisorResource);
}
 
開發者ID:spring-projects,項目名稱:spring-hateoas-examples,代碼行數:11,代碼來源:SupervisorController.java

示例5: process

import org.springframework.hateoas.Resource; //導入方法依賴的package包/類
@Override public Resource<MetadataDocument> process(Resource<MetadataDocument> resource) {
    MetadataDocument metadataDocument = resource.getContent();

    metadataDocument.allowedStateTransitions().stream()
            .map(validationState -> getStateTransitionLink(metadataDocument, validationState))
            .filter(Optional::isPresent)
            .map(Optional::get)
            .forEach(resource::add);

    return resource;
}
 
開發者ID:HumanCellAtlas,項目名稱:ingest-core,代碼行數:12,代碼來源:MetadataDocumentResourceProcessor.java

示例6: process

import org.springframework.hateoas.Resource; //導入方法依賴的package包/類
public Resource<Assay> process(Resource<Assay> assayResource) {
    Assay assay = assayResource.getContent();
    assayResource.add(getFileReferenceLink(assay));
    return assayResource;
}
 
開發者ID:HumanCellAtlas,項目名稱:ingest-core,代碼行數:6,代碼來源:AssayResourceProcessor.java

示例7: process

import org.springframework.hateoas.Resource; //導入方法依賴的package包/類
public Resource<Analysis> process(Resource<Analysis> analysisResource) {
    Analysis analysis = analysisResource.getContent();
    analysisResource.add(getBundleReferencesLink(analysis), getFileReferenceLink(analysis));
    return analysisResource;
}
 
開發者ID:HumanCellAtlas,項目名稱:ingest-core,代碼行數:6,代碼來源:AnalysisResourceProcessor.java

示例8: process

import org.springframework.hateoas.Resource; //導入方法依賴的package包/類
@Override
public Resource<ProductAdded> process(Resource<ProductAdded> resource) {

	ProductAdded content = resource.getContent();

	resource.add(entityLinks.linkToSingleResource(Product.class, content.getProduct().getId()));

	return resource;
}
 
開發者ID:olivergierke,項目名稱:sos,代碼行數:10,代碼來源:ProductAddedResourceProcessor.java


注:本文中的org.springframework.hateoas.Resource.getContent方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。