private int validateConceptForStorage(TermConcept theConcept, TermCodeSystemVersion theCodeSystem, ArrayList<String> theConceptsStack, IdentityHashMap<TermConcept, Object> theAllConcepts) { ValidateUtil.isTrueOrThrowInvalidRequest(theConcept.getCodeSystemVersion() != null, "CodesystemValue is null"); ValidateUtil.isTrueOrThrowInvalidRequest(theConcept.getCodeSystemVersion() == theCodeSystem, "CodeSystems are not equal"); ValidateUtil.isNotBlankOrThrowInvalidRequest(theConcept.getCode(), "Codesystem contains a code with no code value"); if (theConceptsStack.contains(theConcept.getCode())) { throw new InvalidRequestException("CodeSystem contains circular reference around code " + theConcept.getCode()); } theConceptsStack.add(theConcept.getCode()); int retVal = 0; if (theAllConcepts.put(theConcept, theAllConcepts) == null) { if (theAllConcepts.size() % 1000 == 0) { ourLog.info("Have validated {} concepts", theAllConcepts.size()); } retVal = 1; } for (TermConceptParentChildLink next : theConcept.getChildren()) { next.setCodeSystem(theCodeSystem); retVal += validateConceptForStorage(next.getChild(), theCodeSystem, theConceptsStack, theAllConcepts); } theConceptsStack.remove(theConceptsStack.size() - 1); return retVal; }
/** * Constructor */ public DateParam(ParamPrefixEnum thePrefix, long theDate) { ValidateUtil.isGreaterThan(theDate, 0, "theDate must not be 0 or negative"); setPrefix(thePrefix); setValue(new Date(theDate)); }
ourLog.info("Storing TermConceptMap {}", theConceptMap.getIdElement().getValue()); ValidateUtil.isTrueOrThrowInvalidRequest(theResourceTable != null, "No resource supplied"); ValidateUtil.isNotBlankOrThrowUnprocessableEntity(theConceptMap.getUrl(), "ConceptMap has no value for ConceptMap.url");
/** * @param theConditional This is provided only so that subclasses can implement if they want */ @Update public MethodOutcome update( @ResourceParam T theResource, @ConditionalUrlParam String theConditional) { ValidateUtil.isTrueOrThrowInvalidRequest(isBlank(theConditional), "This server doesn't support conditional update"); String idPartAsString = theResource.getIdElement().getIdPart(); TreeMap<Long, T> versionToResource = getVersionToResource(idPartAsString); Long versionIdPart; boolean created; if (versionToResource.isEmpty()) { versionIdPart = 1L; created = true; } else { versionIdPart = versionToResource.lastKey() + 1L; created = false; } IIdType id = store(theResource, idPartAsString, versionIdPart); myUpdateCount.incrementAndGet(); return new MethodOutcome() .setCreated(created) .setId(id); }
public void setCode(String theCode) { ValidateUtil.isNotBlankOrThrowInvalidRequest(theCode, "Code must not be null or empty"); myCode = theCode; }
BaseRuntimeDeclaredChildDefinition(Field theField, Child theChildAnnotation, Description theDescriptionAnnotation, String theElementName) throws ConfigurationException { super(); Validate.notNull(theField, "No field speficied"); ValidateUtil.isGreaterThanOrEqualTo(theChildAnnotation.min(), 0, "Min must be >= 0"); Validate.isTrue(theChildAnnotation.max() == -1 || theChildAnnotation.max() >= theChildAnnotation.min(), "Max must be >= Min (unless it is -1 / unlimited)"); Validate.notBlank(theElementName, "Element name must not be blank"); myField = theField; myMin = theChildAnnotation.min(); myMax = theChildAnnotation.max(); mySummary = theChildAnnotation.summary(); myModifier = theChildAnnotation.modifier(); myElementName = theElementName; if (theDescriptionAnnotation != null) { myShortDefinition = theDescriptionAnnotation.shortDefinition(); myFormalDefinition = theDescriptionAnnotation.formalDefinition(); } else { myShortDefinition = null; myFormalDefinition = null; } myField.setAccessible(true); if (List.class.equals(myField.getType())) { // TODO: verify that generic type is IElement myAccessor = new FieldListAccessor(); myMutator = new FieldListMutator(); } else { myAccessor = new FieldPlainAccessor(); myMutator = new FieldPlainMutator(); } }
ourLog.info("Storing TermConceptMap {}", theConceptMap.getIdElement().getValue()); ValidateUtil.isTrueOrThrowInvalidRequest(theResourceTable != null, "No resource supplied"); ValidateUtil.isNotBlankOrThrowUnprocessableEntity(theConceptMap.getUrl(), "ConceptMap has no value for ConceptMap.url");
ValidateUtil.isTrueOrThrowInvalidRequest(resourceId.hasResourceType(), RESOURCE_ID + " parameter must have resource type"); ValidateUtil.isTrueOrThrowInvalidRequest(resourceId.hasIdPart(), RESOURCE_ID + " parameter must have resource ID part");
public void setCode(String theCode) { ValidateUtil.isNotBlankOrThrowInvalidRequest(theCode, "Code must not be null or empty"); myCode = theCode; }
BaseRuntimeDeclaredChildDefinition(Field theField, Child theChildAnnotation, Description theDescriptionAnnotation, String theElementName) throws ConfigurationException { super(); Validate.notNull(theField, "No field speficied"); ValidateUtil.isGreaterThanOrEqualTo(theChildAnnotation.min(), 0, "Min must be >= 0"); Validate.isTrue(theChildAnnotation.max() == -1 || theChildAnnotation.max() >= theChildAnnotation.min(), "Max must be >= Min (unless it is -1 / unlimited)"); Validate.notBlank(theElementName, "Element name must not be blank"); myField = theField; myMin = theChildAnnotation.min(); myMax = theChildAnnotation.max(); mySummary = theChildAnnotation.summary(); myModifier = theChildAnnotation.modifier(); myElementName = theElementName; if (theDescriptionAnnotation != null) { myShortDefinition = theDescriptionAnnotation.shortDefinition(); myFormalDefinition = theDescriptionAnnotation.formalDefinition(); } else { myShortDefinition = null; myFormalDefinition = null; } myField.setAccessible(true); if (List.class.equals(myField.getType())) { // TODO: verify that generic type is IElement myAccessor = new FieldListAccessor(); myMutator = new FieldListMutator(); } else { myAccessor = new FieldPlainAccessor(); myMutator = new FieldPlainMutator(); } }
ourLog.info("Storing code system"); ValidateUtil.isTrueOrThrowInvalidRequest(theCodeSystemVersion.getResource() != null, "No resource supplied"); ValidateUtil.isNotBlankOrThrowInvalidRequest(theSystemUri, "No system URI supplied");
/** * @param theConditional This is provided only so that subclasses can implement if they want */ @Update public MethodOutcome update( @ResourceParam T theResource, @ConditionalUrlParam String theConditional) { ValidateUtil.isTrueOrThrowInvalidRequest(isBlank(theConditional), "This server doesn't support conditional update"); String idPartAsString = theResource.getIdElement().getIdPart(); TreeMap<Long, T> versionToResource = getVersionToResource(idPartAsString); Long versionIdPart; boolean created; if (versionToResource.isEmpty()) { versionIdPart = 1L; created = true; } else { versionIdPart = versionToResource.lastKey() + 1L; created = false; } IIdType id = store(theResource, idPartAsString, versionIdPart); myUpdateCount.incrementAndGet(); return new MethodOutcome() .setCreated(created) .setId(id); }
/** * Constructor */ public DateParam(ParamPrefixEnum thePrefix, long theDate) { ValidateUtil.isGreaterThan(theDate, 0, "theDate must not be 0 or negative"); setPrefix(thePrefix); setValue(new Date(theDate)); }
private int validateConceptForStorage(TermConcept theConcept, TermCodeSystemVersion theCodeSystem, ArrayList<String> theConceptsStack, IdentityHashMap<TermConcept, Object> theAllConcepts) { ValidateUtil.isTrueOrThrowInvalidRequest(theConcept.getCodeSystemVersion() != null, "CodesystemValue is null"); ValidateUtil.isTrueOrThrowInvalidRequest(theConcept.getCodeSystemVersion() == theCodeSystem, "CodeSystems are not equal"); ValidateUtil.isNotBlankOrThrowInvalidRequest(theConcept.getCode(), "Codesystem contains a code with no code value"); if (theConceptsStack.contains(theConcept.getCode())) { throw new InvalidRequestException("CodeSystem contains circular reference around code " + theConcept.getCode()); } theConceptsStack.add(theConcept.getCode()); int retVal = 0; if (theAllConcepts.put(theConcept, theAllConcepts) == null) { if (theAllConcepts.size() % 1000 == 0) { ourLog.info("Have validated {} concepts", theAllConcepts.size()); } retVal = 1; } for (TermConceptParentChildLink next : theConcept.getChildren()) { next.setCodeSystem(theCodeSystem); retVal += validateConceptForStorage(next.getChild(), theCodeSystem, theConceptsStack, theAllConcepts); } theConceptsStack.remove(theConceptsStack.size() - 1); return retVal; }
ValidateUtil.isTrueOrThrowInvalidRequest(resourceId.hasResourceType(), RESOURCE_ID + " parameter must have resource type"); ValidateUtil.isTrueOrThrowInvalidRequest(resourceId.hasIdPart(), RESOURCE_ID + " parameter must have resource ID part");
ourLog.info("Storing code system"); ValidateUtil.isTrueOrThrowInvalidRequest(theCodeSystemVersion.getResource() != null, "No resource supplied"); ValidateUtil.isNotBlankOrThrowInvalidRequest(theSystemUri, "No system URI supplied");