@Operation(name = MARK_ALL_RESOURCES_FOR_REINDEXING, idempotent = true, returnParameters = { @OperationParam(name = "status") }) public IBaseResource markAllResourcesForReindexing() { getResourceReindexingSvc().markAllResourcesForReindexing(); IBaseParameters retVal = ParametersUtil.newInstance(getContext()); IPrimitiveType<?> string = ParametersUtil.createString(getContext(), "Marked resources"); ParametersUtil.addParameterToParameters(getContext(), retVal, "status", string); return retVal; }
private static void addClientParameter(FhirContext theContext, Object theValue, IBaseResource theTargetResource, BaseRuntimeChildDefinition paramChild, BaseRuntimeElementCompositeDefinition<?> paramChildElem, String theName) { if (theValue instanceof IBaseResource) { IBase parameter = createParameterRepetition(theContext, theTargetResource, paramChild, paramChildElem, theName); paramChildElem.getChildByName("resource").getMutator().addValue(parameter, (IBaseResource) theValue); } else if (theValue instanceof IBaseDatatype) { IBase parameter = createParameterRepetition(theContext, theTargetResource, paramChild, paramChildElem, theName); paramChildElem.getChildByName("value[x]").getMutator().addValue(parameter, (IBaseDatatype) theValue); } else if (theValue instanceof Collection) { Collection<?> collection = (Collection<?>) theValue; for (Object next : collection) { addClientParameter(theContext, next, theTargetResource, paramChild, paramChildElem, theName); } } else { throw new IllegalArgumentException("Don't know how to handle value of type " + theValue.getClass() + " for parameter " + theName); } }
@Override public Object outgoingClient(Object theObject) { return ParametersUtil.createString(theContext, theObject.toString()); } });
IBaseParameters parameters = ParametersUtil.newInstance(myContext); switch (myOperation) { case ADD: ParametersUtil.addParameterToParameters(myContext, parameters, "meta", myMeta); invocation = OperationMethodBinding.createOperationInvocation(myContext, myId.getResourceType(), myId.getIdPart(), null, "$meta-add", parameters, false); break; case DELETE: ParametersUtil.addParameterToParameters(myContext, parameters, "meta", myMeta); invocation = OperationMethodBinding.createOperationInvocation(myContext, myId.getResourceType(), myId.getIdPart(), null, "$meta-delete", parameters, false); break;
@Override public void translateClientArgumentIntoQueryArgument(FhirContext theContext, Object theSourceClientArgument, Map<String, List<String>> theTargetQueryArguments, IBaseResource theTargetResource) throws InternalErrorException { assert theTargetResource != null; Object sourceClientArgument = theSourceClientArgument; if (sourceClientArgument == null) { return; } if (myConverter != null) { sourceClientArgument = myConverter.outgoingClient(sourceClientArgument); } ParametersUtil.addParameterToParameters(theContext, (IBaseParameters) theTargetResource, myName, sourceClientArgument); }
/** * Add a paratemer value to a Parameters resource * * @param theContext The FhirContext * @param theParameters The Parameters resource * @param theName The parametr name * @param theValue The parameter value (can be a {@link IBaseResource resource} or a {@link IBaseDatatype datatype}) */ public static void addParameterToParameters(FhirContext theContext, IBaseParameters theParameters, String theName, Object theValue) { RuntimeResourceDefinition def = theContext.getResourceDefinition(theParameters); BaseRuntimeChildDefinition paramChild = def.getChildByName("parameter"); BaseRuntimeElementCompositeDefinition<?> paramChildElem = (BaseRuntimeElementCompositeDefinition<?>) paramChild.getChildByName("parameter"); addClientParameter(theContext, theValue, theParameters, paramChild, paramChildElem, theName); }
@Override public Object outgoingClient(Object theObject) { return ParametersUtil.createString(theContext, theObject.toString()); } });
IBaseParameters retVal = ParametersUtil.newInstance(myFhirContext); IPrimitiveType<?> value = (IPrimitiveType<?>) myFhirContext.getElementDefinition("string").newInstance(); value.setValueAsString("Subscription triggering job submitted as JOB ID: " + jobDetails.myJobId); ParametersUtil.addParameterToParameters(myFhirContext, retVal, "information", value); return retVal;
public static BaseHttpClientInvocation createValidateInvocation(FhirContext theContext, IBaseResource theResource) { IBaseParameters parameters = (IBaseParameters) theContext.getResourceDefinition("Parameters").newInstance(); ParametersUtil.addParameterToParameters(theContext, parameters, "resource", theResource); String resourceName = theContext.getResourceDefinition(theResource).getName(); String resourceId = theResource.getIdElement().getIdPart(); BaseHttpClientInvocation retVal = createOperationInvocation(theContext, resourceName, resourceId, null,Constants.EXTOP_VALIDATE, parameters, false); return retVal; }
/** * Add a paratemer value to a Parameters resource * * @param theContext The FhirContext * @param theParameters The Parameters resource * @param theName The parametr name * @param theValue The parameter value (can be a {@link IBaseResource resource} or a {@link IBaseDatatype datatype}) */ public static void addParameterToParameters(FhirContext theContext, IBaseParameters theParameters, String theName, Object theValue) { RuntimeResourceDefinition def = theContext.getResourceDefinition(theParameters); BaseRuntimeChildDefinition paramChild = def.getChildByName("parameter"); BaseRuntimeElementCompositeDefinition<?> paramChildElem = (BaseRuntimeElementCompositeDefinition<?>) paramChild.getChildByName("parameter"); addClientParameter(theContext, theValue, theParameters, paramChild, paramChildElem, theName); }
@Operation(name = PERFORM_REINDEXING_PASS, idempotent = true, returnParameters = { @OperationParam(name = "status") }) public IBaseResource performReindexingPass() { Integer count = getResourceReindexingSvc().runReindexingPass(); IBaseParameters retVal = ParametersUtil.newInstance(getContext()); IPrimitiveType<?> string; if (count == null) { string = ParametersUtil.createString(getContext(), "Index pass already proceeding"); } else { string = ParametersUtil.createString(getContext(), "Indexed " + count + " resources"); } ParametersUtil.addParameterToParameters(getContext(), retVal, "status", string); return retVal; }
@Override public Object outgoingClient(Object theObject) { return ParametersUtil.createString(theContext, ((ValidationModeEnum) theObject).getCode()); } });
IBaseParameters parameters = ParametersUtil.newInstance(myContext); switch (myOperation) { case ADD: ParametersUtil.addParameterToParameters(myContext, parameters, "meta", myMeta); invocation = OperationMethodBinding.createOperationInvocation(myContext, myId.getResourceType(), myId.getIdPart(), null, "$meta-add", parameters, false); break; case DELETE: ParametersUtil.addParameterToParameters(myContext, parameters, "meta", myMeta); invocation = OperationMethodBinding.createOperationInvocation(myContext, myId.getResourceType(), myId.getIdPart(), null, "$meta-delete", parameters, false); break;
@Override public void translateClientArgumentIntoQueryArgument(FhirContext theContext, Object theSourceClientArgument, Map<String, List<String>> theTargetQueryArguments, IBaseResource theTargetResource) throws InternalErrorException { assert theTargetResource != null; Object sourceClientArgument = theSourceClientArgument; if (sourceClientArgument == null) { return; } if (myConverter != null) { sourceClientArgument = myConverter.outgoingClient(sourceClientArgument); } ParametersUtil.addParameterToParameters(theContext, (IBaseParameters) theTargetResource, myName, sourceClientArgument); }
private static void addClientParameter(FhirContext theContext, Object theValue, IBaseResource theTargetResource, BaseRuntimeChildDefinition paramChild, BaseRuntimeElementCompositeDefinition<?> paramChildElem, String theName) { if (theValue instanceof IBaseResource) { IBase parameter = createParameterRepetition(theContext, theTargetResource, paramChild, paramChildElem, theName); paramChildElem.getChildByName("resource").getMutator().addValue(parameter, (IBaseResource) theValue); } else if (theValue instanceof IBaseDatatype) { IBase parameter = createParameterRepetition(theContext, theTargetResource, paramChild, paramChildElem, theName); paramChildElem.getChildByName("value[x]").getMutator().addValue(parameter, (IBaseDatatype) theValue); } else if (theValue instanceof Collection) { Collection<?> collection = (Collection<?>) theValue; for (Object next : collection) { addClientParameter(theContext, next, theTargetResource, paramChild, paramChildElem, theName); } } else { throw new IllegalArgumentException("Don't know how to handle value of type " + theValue.getClass() + " for parameter " + theName); } }
@Operation(name = MARK_ALL_RESOURCES_FOR_REINDEXING, idempotent = true, returnParameters = { @OperationParam(name = "status") }) public IBaseResource markAllResourcesForReindexing() { getResourceReindexingSvc().markAllResourcesForReindexing(); IBaseParameters retVal = ParametersUtil.newInstance(getContext()); IPrimitiveType<?> string = ParametersUtil.createString(getContext(), "Marked resources"); ParametersUtil.addParameterToParameters(getContext(), retVal, "status", string); return retVal; }
@Override public Object outgoingClient(Object theObject) { return ParametersUtil.createString(theContext, ((ValidationModeEnum) theObject).getCode()); } });
IBaseParameters retVal = ParametersUtil.newInstance(myFhirContext); IPrimitiveType<?> value = (IPrimitiveType<?>) myFhirContext.getElementDefinition("string").newInstance(); value.setValueAsString("Subscription triggering job submitted as JOB ID: " + jobDetails.myJobId); ParametersUtil.addParameterToParameters(myFhirContext, retVal, "information", value); return retVal;
public static BaseHttpClientInvocation createValidateInvocation(FhirContext theContext, IBaseResource theResource) { IBaseParameters parameters = (IBaseParameters) theContext.getResourceDefinition("Parameters").newInstance(); ParametersUtil.addParameterToParameters(theContext, parameters, "resource", theResource); String resourceName = theContext.getResourceDefinition(theResource).getName(); String resourceId = theResource.getIdElement().getIdPart(); BaseHttpClientInvocation retVal = createOperationInvocation(theContext, resourceName, resourceId, null,Constants.EXTOP_VALIDATE, parameters, false); return retVal; }
@Operation(name = PERFORM_REINDEXING_PASS, idempotent = true, returnParameters = { @OperationParam(name = "status") }) public IBaseResource performReindexingPass() { Integer count = getResourceReindexingSvc().runReindexingPass(); IBaseParameters retVal = ParametersUtil.newInstance(getContext()); IPrimitiveType<?> string; if (count == null) { string = ParametersUtil.createString(getContext(), "Index pass already proceeding"); } else { string = ParametersUtil.createString(getContext(), "Indexed " + count + " resources"); } ParametersUtil.addParameterToParameters(getContext(), retVal, "status", string); return retVal; }