Package ca.uhn.fhir.model.api

Examples of ca.uhn.fhir.model.api.IResource


        }
      }
      break;
    }
    case RESOURCE: {
      IResource resource;
      if (myResourceType != null) {
        resource = parser.parseResource(myResourceType, theResponseReader);
      } else {
        resource = parser.parseResource(theResponseReader);
      }

      List<String> lmHeaders = theHeaders.get(Constants.HEADER_LAST_MODIFIED_LOWERCASE);
      if (lmHeaders != null && lmHeaders.size() > 0 && StringUtils.isNotBlank(lmHeaders.get(0))) {
        String headerValue = lmHeaders.get(0);
        Date headerDateValue;
        try {
          headerDateValue = DateUtils.parseDate(headerValue);
          InstantDt lmValue = new InstantDt(headerDateValue);
          resource.getResourceMetadata().put(ResourceMetadataKeyEnum.UPDATED, lmValue);
        } catch (Exception e) {
          ourLog.warn("Unable to parse date string '{}'. Error is: {}", headerValue, e.toString());
        }
      }
View Full Code Here


      pop();
    }

    @Override
    public void wereBack() {
      IResource res = getCurrentElement();
      assert res != null;
      if (res.getId() == null || res.getId().isEmpty()) {
        ourLog.debug("Discarding contained resource with no ID!");
      } else {
        getPreResourceState().getContainedResources().put(res.getId().getValueAsString(), res);
      }
      getPreResourceState().getCurrentElement().getContained().getContainedResources().add(res);
    }
View Full Code Here

        eventWriter.writeEnd();
      }

      writeAuthor(nextEntry, eventWriter);

      IResource resource = nextEntry.getResource();
      RuntimeResourceDefinition resDef = myContext.getResourceDefinition(resource);
      encodeResourceToJsonStreamWriter(resDef, resource, eventWriter, "content");

      eventWriter.writeEnd(); // entry object
    }
View Full Code Here

  @Override
  public void invokeServer(RestfulServer theServer, Request theRequest, HttpServletResponse theResponse) throws BaseServerResponseException, IOException {
    EncodingEnum encoding = determineResponseEncoding(theRequest);
    IParser parser = encoding.newParser(getContext());
    IResource resource;
    if (requestContainsResource()) {
      resource = parser.parseResource(theRequest.getInputReader());
      TagList tagList = new TagList();
      for (Enumeration<String> enumeration = theRequest.getServletRequest().getHeaders(Constants.HEADER_CATEGORY); enumeration.hasMoreElements();) {
        String nextTagComplete = enumeration.nextElement();
        StringBuilder next = new StringBuilder(nextTagComplete);
        parseTagValue(tagList, nextTagComplete, next);
      }
      if (tagList.isEmpty() == false) {
        resource.getResourceMetadata().put(ResourceMetadataKeyEnum.TAG_LIST, tagList);
      }
    } else {
      resource = null;
    }
View Full Code Here

          reader = null;
        }

        if (reader != null) {
          IParser parser = ct.newParser(theContext);
          IResource outcome = parser.parseResource(reader);
          if (outcome instanceof OperationOutcome) {
            retVal.setOperationOutcome((OperationOutcome) outcome);
          }
        }
View Full Code Here

    return new GetClientInvocation("metadata");
  }

  @Override
  public List<IResource> invokeServer(Request theRequest, Object[] theMethodParams) throws BaseServerResponseException {
    IResource conf = (IResource) invokeServerMethod(theMethodParams);
    return Collections.singletonList(conf);
  }
View Full Code Here

  }

  @Override
  public List<IResource> invokeServer(Object theResourceProvider, IdDt theId, IdDt theVersionId, Map<String, String[]> theParameterValues) throws InvalidRequestException,
      InternalErrorException {
    IResource conf;
    try {
      conf = (Conformance) getMethod().invoke(theResourceProvider);
    } catch (Exception e) {
      throw new InternalErrorException("Failed to call access method", e);
    }
View Full Code Here

   
  }

  @Override
  public Object translateQueryParametersIntoServerArgument(Map<String, String[]> theQueryParameters, Object theRequestContents) throws InternalErrorException, InvalidRequestException {
    IResource resource = (IResource) theRequestContents;
    return resource;
  }
View Full Code Here

    List<ResourceReferenceDt> allElements = theResource.getAllPopulatedChildElementsOfType(ResourceReferenceDt.class);

    Set<String> allIds = new HashSet<String>();

    for (ResourceReferenceDt next : allElements) {
      IResource resource = next.getResource();
      if (resource != null) {
        if (resource.getId().isEmpty()) {
          resource.setId(new IdDt(UUID.randomUUID().toString()));
        }

        if (!allIds.contains(resource.getId().getValue())) {
          theResource.getContained().getContainedResources().add(resource);
          allIds.add(resource.getId().getValue());
        }

        next.setReference("#" + resource.getId().getValue());
      }
    }

  }
View Full Code Here

 
  @Override
  public void invokeServer(RestfulServer theServer, Request theRequest, HttpServletResponse theResponse) throws BaseServerResponseException, IOException {
    EncodingUtil encoding = BaseMethodBinding.determineResponseEncoding(theRequest.getServletRequest(), theRequest.getParameters());
    IParser parser = encoding.newParser(getContext());
    IResource resource = parser.parseResource(theRequest.getInputReader());

    Object[] params = new Object[getParameters().size()];
    for (int i = 0; i < getParameters().size(); i++) {
      IParameter param = getParameters().get(i);
      if (param == null) {
View Full Code Here

TOP

Related Classes of ca.uhn.fhir.model.api.IResource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.