@Override public boolean incomingServerRequestMatchesMethod(RequestDetails theRequest) { if (!Constants.PARAM_HISTORY.equals(theRequest.getOperation())) { return false; } if (theRequest.getResourceName() == null) { return myResourceOperationType == RestOperationTypeEnum.HISTORY_SYSTEM; } if (!StringUtils.equals(theRequest.getResourceName(), myResourceName)) { return false; } boolean haveIdParam = theRequest.getId() != null && !theRequest.getId().isEmpty(); boolean wantIdParam = myIdParamIndex != null; if (haveIdParam != wantIdParam) { return false; } if (theRequest.getId() == null) { return myResourceOperationType == RestOperationTypeEnum.HISTORY_TYPE; } else if (theRequest.getId().hasVersionIdPart()) { return false; } return true; }
if (next.getIdElement().isEmpty() == false) { addedResourceIds.add(next.getIdElement()); Set<String> containedIds = new HashSet<String>(); for (IBaseResource nextContained : next.getContained()) { if (nextContained.getIdElement().isEmpty() == false) { containedIds.add(nextContained.getIdElement().getValue());
IdDt oldId = oldIds.get(retResources.get(i)); IBaseResource newRes = retResources.get(i); if (newRes.getIdElement() == null || newRes.getIdElement().isEmpty()) { if (!(newRes instanceof BaseOperationOutcome)) { throw new InternalErrorException("Transaction method returned resource at index " + i + " with no id specified - IResource#setId(IdDt)");
if (next.getIdElement().isEmpty() == false) { addedResourceIds.add(next.getIdElement());
if (next.getIdElement().isEmpty() == false) { addedResourceIds.add(next.getIdElement());
if (next.getIdElement().isEmpty() == false) { addedResourceIds.add(next.getIdElement());
if (next.getIdElement().isEmpty() == false) { addedResourceIds.add((IdDt) next.getIdElement());
if (next.getIdElement().isEmpty() == false) { addedResourceIds.add(next.getIdElement());
if (next.getIdElement().isEmpty() == false) { addedResourceIds.add(next.getIdElement());
if (next.getIdElement() == null || next.getIdElement().isEmpty()) { if (!(next instanceof BaseOperationOutcome)) { throw new InternalErrorException("Server method returned resource of type[" + next.getClass().getSimpleName() + "] with no ID specified (IResource#setId(IdDt) must be called)");
/** * Returns the newly created forced ID. If the entity already had a forced ID, or if * none was created, returns null. */ protected ForcedId createForcedIdIfNeeded(ResourceTable theEntity, IIdType theId, boolean theCreateForPureNumericIds) { if (theId.isEmpty() == false && theId.hasIdPart() && theEntity.getForcedId() == null) { if (!theCreateForPureNumericIds && IdHelperService.isValidPid(theId)) { return null; } ForcedId fid = new ForcedId(); fid.setResourceType(theEntity.getResourceType()); fid.setForcedId(theId.getIdPart()); fid.setResource(theEntity); theEntity.setForcedId(fid); return fid; } return null; }
if (next.getIdElement().isEmpty() == false) { addedResourceIds.add(next.getIdElement());
@Override public void addRootPropertiesToBundle(String theId, String theServerBase, String theLinkSelf, String theLinkPrev, String theLinkNext, Integer theTotalResults, BundleTypeEnum theBundleType, IPrimitiveType<Date> theLastUpdated) { myBase = theServerBase; if (myBundle.getIdElement().isEmpty()) { myBundle.setId(theId); } if (myBundle.getId().isEmpty()) { myBundle.setId(UUID.randomUUID().toString()); } if (ResourceMetadataKeyEnum.UPDATED.get(myBundle) == null) { ResourceMetadataKeyEnum.UPDATED.put(myBundle, (InstantDt) theLastUpdated); } if (!hasLink(Constants.LINK_SELF, myBundle) && isNotBlank(theLinkSelf)) { myBundle.addLink().setRelation(Constants.LINK_SELF).setUrl(theLinkSelf); } if (!hasLink(Constants.LINK_NEXT, myBundle) && isNotBlank(theLinkNext)) { myBundle.addLink().setRelation(Constants.LINK_NEXT).setUrl(theLinkNext); } if (!hasLink(Constants.LINK_PREVIOUS, myBundle) && isNotBlank(theLinkPrev)) { myBundle.addLink().setRelation(Constants.LINK_PREVIOUS).setUrl(theLinkPrev); } if (myBundle.getTypeElement().isEmpty() && theBundleType != null) { myBundle.getTypeElement().setValueAsString(theBundleType.getCode()); } if (myBundle.getTotalElement().isEmpty() && theTotalResults != null) { myBundle.getTotalElement().setValue(theTotalResults); } }
MethodOutcome mo = new MethodOutcome(); parseContentLocation(getContext(), mo, locationHeader); if (mo.getId() == null || mo.getId().isEmpty()) { throw new InvalidRequestException("Invalid Content-Location header for resource " + getResourceName() + ": " + locationHeader);
IBaseResource resource = next.getResource(); if (resource != null) { if (resource.getIdElement().isEmpty() || resource.getIdElement().isLocal()) { if (theContained.getResourceId(resource) != null) {
if (theRef.getResource() != null) { IIdType containedId = getContainedResources().getResourceId(theRef.getResource()); if (containedId != null && !containedId.isEmpty()) { if (containedId.isLocal()) { reference = containedId.getValue();
if (next.getIdElement().isEmpty()) { nextEntry.getRequest().setMethod(HTTPVerb.POST); } else {
@Override public boolean incomingServerRequestMatchesMethod(RequestDetails theRequest) { if (!Constants.PARAM_HISTORY.equals(theRequest.getOperation())) { return false; } if (theRequest.getResourceName() == null) { return myResourceOperationType == RestOperationTypeEnum.HISTORY_SYSTEM; } if (!StringUtils.equals(theRequest.getResourceName(), myResourceName)) { return false; } boolean haveIdParam = theRequest.getId() != null && !theRequest.getId().isEmpty(); boolean wantIdParam = myIdParamIndex != null; if (haveIdParam != wantIdParam) { return false; } if (theRequest.getId() == null) { return myResourceOperationType == RestOperationTypeEnum.HISTORY_TYPE; } else if (theRequest.getId().hasVersionIdPart()) { return false; } return true; }
/** * Returns the newly created forced ID. If the entity already had a forced ID, or if * none was created, returns null. */ protected ForcedId createForcedIdIfNeeded(ResourceTable theEntity, IIdType theId, boolean theCreateForPureNumericIds) { if (theId.isEmpty() == false && theId.hasIdPart() && theEntity.getForcedId() == null) { if (!theCreateForPureNumericIds && IdHelperService.isValidPid(theId)) { return null; } ForcedId fid = new ForcedId(); fid.setResourceType(theEntity.getResourceType()); fid.setForcedId(theId.getIdPart()); fid.setResource(theEntity); theEntity.setForcedId(fid); return fid; } return null; }