Package ca.uhn.fhir.model.primitive

Examples of ca.uhn.fhir.model.primitive.IdDt


    theState.setStack(myState);
    myState = theState;
  }

  private void putPlacerResourceInDeletedEntry(BundleEntry entry) {
    IdDt id = null;
    if (entry.getLinkSelf() != null && entry.getLinkSelf().isEmpty() == false) {
      id = new IdDt(entry.getLinkSelf().getValue());
    } else {
      id = entry.getId();
    }

    IResource resource = entry.getResource();
    if (resource == null && id != null && isNotBlank(id.getResourceType())) {
      String resourceType = id.getResourceType();
      RuntimeResourceDefinition def = myContext.getResourceDefinition(resourceType);
      if (def == null) {
        throw new DataFormatException("Entry references unknown resource type: " + resourceType);
      }
      resource = def.newInstance();
View Full Code Here


    }

    @Override
    public void attributeValue(String theName, String theValue) throws DataFormatException {
      if ("ref".equals(theName)) {
        getEntry().setId(new IdDt(theValue));
      } else if ("when".equals(theName)) {
        getEntry().setDeleted(new InstantDt(theValue));
      }
    }
View Full Code Here

    Profile retVal = new Profile();
   
    RuntimeResourceDefinition def = this;

    if (StringUtils.isNotBlank(myId)) {
      retVal.setId(new IdDt(myId));
    }else {
      throw new ConfigurationException("Resource class " + getImplementingClass().getCanonicalName() + " has no ID specified");
    }
   
    // Scan for extensions
View Full Code Here

      RestResource resource = rest.addResource();

      String resourceName = next.getResourceName();
      RuntimeResourceDefinition def = myRestfulServer.getFhirContext().getResourceDefinition(resourceName);
      resource.getType().setValue(def.getName());
      resource.getProfile().setReference(new IdDt(def.getResourceProfile()));

      TreeSet<String> includes = new TreeSet<String>();

      // Map<String, Conformance.RestResourceSearchParam> nameToSearchParam = new HashMap<String,
      // Conformance.RestResourceSearchParam>();
View Full Code Here

    private void populateResourceMetadata() {
      if (myEntry.getResource() == null) {
        return;
      }

      IdDt id = myEntry.getId();
      if (id != null && id.isEmpty() == false) {
        myEntry.getResource().setId(id);
      }

      Map<ResourceMetadataKeyEnum<?>, Object> metadata = myEntry.getResource().getResourceMetadata();
      if (myEntry.getPublished().isEmpty() == false) {
        ResourceMetadataKeyEnum.PUBLISHED.put(myEntry.getResource(), myEntry.getPublished());
      }
      if (myEntry.getUpdated().isEmpty() == false) {
        ResourceMetadataKeyEnum.UPDATED.put(myEntry.getResource(), myEntry.getUpdated());
      }

      ResourceMetadataKeyEnum.TITLE.put(myEntry.getResource(), myEntry.getTitle().getValue());

      if (myEntry.getCategories().isEmpty() == false) {
        TagList tagList = new TagList();
        for (Tag next : myEntry.getCategories()) {
          tagList.add(next);
        }
        ResourceMetadataKeyEnum.TAG_LIST.put(myEntry.getResource(), tagList);
      }
      if (!myEntry.getLinkSelf().isEmpty()) {
        String linkSelfValue = myEntry.getLinkSelf().getValue();
        IdDt linkSelf = new IdDt(linkSelfValue);
        myEntry.getResource().setId(linkSelf);
        if (isNotBlank(linkSelf.getVersionIdPart())) {
          metadata.put(ResourceMetadataKeyEnum.VERSION_ID, linkSelf);
        }
      }

    }
View Full Code Here

    return mySystemOperationType;
  }

  @Override
  public BaseHttpClientInvocation invokeClient(Object[] theArgs) throws InternalErrorException {
    IdDt id = null;
    String resourceName = myResourceName;
    if (myIdParamIndex != null) {
      id = (IdDt) theArgs[myIdParamIndex];
      if (id == null || isBlank(id.getValue())) {
        throw new NullPointerException("ID can not be null");
      }
    }

    HttpGetClientInvocation retVal = createHistoryInvocation(resourceName, id, null, null);
View Full Code Here

        for (IResource nextResource : retVal) {
          if (nextResource.getId() == null || isBlank(nextResource.getId().getIdPart())) {
            throw new InternalErrorException("Server provided resource at index " + index + " with no ID set (using IResource#setId(IdDt))");
          }
          if (isBlank(nextResource.getId().getVersionIdPart())) {
            IdDt versionId = (IdDt) ResourceMetadataKeyEnum.VERSION_ID.get(nextResource);
            if (versionId == null || versionId.isEmpty()) {
              throw new InternalErrorException("Server provided resource at index " + index + " with no Version ID set (using IResource#setId(IdDt))");
            }
          }
          index++;
        }
View Full Code Here

  protected static void parseContentLocation(MethodOutcome theOutcomeToPopulate, String theResourceName, String theLocationHeader) {
    if (StringUtils.isBlank(theLocationHeader)) {
      return;
    }
   
    theOutcomeToPopulate.setId(new IdDt(theLocationHeader));

    String resourceNamePart = "/" + theResourceName + "/";
    int resourceIndex = theLocationHeader.lastIndexOf(resourceNamePart);
    if (resourceIndex > -1) {
      int idIndexStart = resourceIndex + resourceNamePart.length();
      int idIndexEnd = theLocationHeader.indexOf('/', idIndexStart);
      if (idIndexEnd == -1) {
        // nothing
      } else {
        String versionIdPart = "/_history/";
        int historyIdStart = theLocationHeader.indexOf(versionIdPart, idIndexEnd);
        if (historyIdStart != -1) {
          theOutcomeToPopulate.setVersionId(new IdDt(theLocationHeader.substring(historyIdStart + versionIdPart.length())));
        }
      }
    }
  }
View Full Code Here

  @Override
  protected BaseHttpClientInvocation createClientInvocation(Object[] theArgs, IResource theResource) {
    FhirContext context = getContext();
   
    IdDt idDt=null;
    if (myIdParameterIndex != null) {
      idDt = (IdDt) theArgs[myIdParameterIndex];
    }

    HttpPostClientInvocation retVal = createValidateInvocation(theResource, idDt, context);
View Full Code Here

    /*
     * We are being a bit lenient here, since technically the client is supposed to include the version in the
     * Content-Location header, but we allow it in the PUT URL as well..
     */
    String locationHeader = theRequest.getServletRequest().getHeader(Constants.HEADER_CONTENT_LOCATION);
    IdDt id = new IdDt(locationHeader);
    if (isNotBlank(id.getResourceType())) {
      if (!getResourceName().equals(id.getResourceType())) {
        throw new InvalidRequestException("Attempting to update '" + getResourceName() + "' but content-location header specifies different resource type '" + id.getResourceType() + "' - header value: " + locationHeader);
      }
    }

    if (isNotBlank(locationHeader)) {
      MethodOutcome mo = new MethodOutcome();
View Full Code Here

TOP

Related Classes of ca.uhn.fhir.model.primitive.IdDt

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.