id int32 0 165k | repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1 value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 |
|---|---|---|---|---|---|---|---|---|---|---|---|
22,500 | jamesagnew/hapi-fhir | hapi-fhir-narrativegenerator/src/main/java/ca/uhn/fhir/narrative/template/Template.java | Template.toStringAST | public String toStringAST() {
StringBuilder builder = new StringBuilder();
walk(root, builder);
return builder.toString();
} | java | public String toStringAST() {
StringBuilder builder = new StringBuilder();
walk(root, builder);
return builder.toString();
} | [
"public",
"String",
"toStringAST",
"(",
")",
"{",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"walk",
"(",
"root",
",",
"builder",
")",
";",
"return",
"builder",
".",
"toString",
"(",
")",
";",
"}"
] | Returns a string representation of the AST of the parsed
input source.
@return a string representation of the AST of the parsed
input source. | [
"Returns",
"a",
"string",
"representation",
"of",
"the",
"AST",
"of",
"the",
"parsed",
"input",
"source",
"."
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-narrativegenerator/src/main/java/ca/uhn/fhir/narrative/template/Template.java#L187-L194 |
22,501 | jamesagnew/hapi-fhir | hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/index/DaoSearchParamSynchronizer.java | DaoSearchParamSynchronizer.tryToReuseIndexEntities | private <T extends BaseResourceIndex> void tryToReuseIndexEntities(List<T> theIndexesToRemove, List<T> theIndexesToAdd) {
for (int addIndex = 0; addIndex < theIndexesToAdd.size(); addIndex++) {
// If there are no more rows to remove, there's nothing we can reuse
if (theIndexesToRemove.isEmpty()) {
break;
}
T targetEntity = theIndexesToAdd.get(addIndex);
if (targetEntity.getId() != null) {
continue;
}
// Take a row we were going to remove, and repurpose its ID
T entityToReuse = theIndexesToRemove.remove(theIndexesToRemove.size() - 1);
targetEntity.setId(entityToReuse.getId());
}
} | java | private <T extends BaseResourceIndex> void tryToReuseIndexEntities(List<T> theIndexesToRemove, List<T> theIndexesToAdd) {
for (int addIndex = 0; addIndex < theIndexesToAdd.size(); addIndex++) {
// If there are no more rows to remove, there's nothing we can reuse
if (theIndexesToRemove.isEmpty()) {
break;
}
T targetEntity = theIndexesToAdd.get(addIndex);
if (targetEntity.getId() != null) {
continue;
}
// Take a row we were going to remove, and repurpose its ID
T entityToReuse = theIndexesToRemove.remove(theIndexesToRemove.size() - 1);
targetEntity.setId(entityToReuse.getId());
}
} | [
"private",
"<",
"T",
"extends",
"BaseResourceIndex",
">",
"void",
"tryToReuseIndexEntities",
"(",
"List",
"<",
"T",
">",
"theIndexesToRemove",
",",
"List",
"<",
"T",
">",
"theIndexesToAdd",
")",
"{",
"for",
"(",
"int",
"addIndex",
"=",
"0",
";",
"addIndex",
"<",
"theIndexesToAdd",
".",
"size",
"(",
")",
";",
"addIndex",
"++",
")",
"{",
"// If there are no more rows to remove, there's nothing we can reuse",
"if",
"(",
"theIndexesToRemove",
".",
"isEmpty",
"(",
")",
")",
"{",
"break",
";",
"}",
"T",
"targetEntity",
"=",
"theIndexesToAdd",
".",
"get",
"(",
"addIndex",
")",
";",
"if",
"(",
"targetEntity",
".",
"getId",
"(",
")",
"!=",
"null",
")",
"{",
"continue",
";",
"}",
"// Take a row we were going to remove, and repurpose its ID",
"T",
"entityToReuse",
"=",
"theIndexesToRemove",
".",
"remove",
"(",
"theIndexesToRemove",
".",
"size",
"(",
")",
"-",
"1",
")",
";",
"targetEntity",
".",
"setId",
"(",
"entityToReuse",
".",
"getId",
"(",
")",
")",
";",
"}",
"}"
] | The logic here is that often times when we update a resource we are dropping
one index row and adding another. This method tries to reuse rows that would otherwise
have been deleted by updating them with the contents of rows that would have
otherwise been added. In other words, we're trying to replace
"one delete + one insert" with "one update"
@param theIndexesToRemove The rows that would be removed
@param theIndexesToAdd The rows that would be added | [
"The",
"logic",
"here",
"is",
"that",
"often",
"times",
"when",
"we",
"update",
"a",
"resource",
"we",
"are",
"dropping",
"one",
"index",
"row",
"and",
"adding",
"another",
".",
"This",
"method",
"tries",
"to",
"reuse",
"rows",
"that",
"would",
"otherwise",
"have",
"been",
"deleted",
"by",
"updating",
"them",
"with",
"the",
"contents",
"of",
"rows",
"that",
"would",
"have",
"otherwise",
"been",
"added",
".",
"In",
"other",
"words",
"we",
"re",
"trying",
"to",
"replace",
"one",
"delete",
"+",
"one",
"insert",
"with",
"one",
"update"
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/index/DaoSearchParamSynchronizer.java#L83-L100 |
22,502 | jamesagnew/hapi-fhir | hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/util/JaxRsMethodBindings.java | JaxRsMethodBindings.getMapForOperation | private ConcurrentHashMap<String, BaseMethodBinding<?>> getMapForOperation(RestOperationTypeEnum operationType) {
ConcurrentHashMap<String, BaseMethodBinding<?>> result = operationBindings.get(operationType);
if(result == null) {
operationBindings.putIfAbsent(operationType, new ConcurrentHashMap<String, BaseMethodBinding<?>>());
return getMapForOperation(operationType);
} else {
return result;
}
} | java | private ConcurrentHashMap<String, BaseMethodBinding<?>> getMapForOperation(RestOperationTypeEnum operationType) {
ConcurrentHashMap<String, BaseMethodBinding<?>> result = operationBindings.get(operationType);
if(result == null) {
operationBindings.putIfAbsent(operationType, new ConcurrentHashMap<String, BaseMethodBinding<?>>());
return getMapForOperation(operationType);
} else {
return result;
}
} | [
"private",
"ConcurrentHashMap",
"<",
"String",
",",
"BaseMethodBinding",
"<",
"?",
">",
">",
"getMapForOperation",
"(",
"RestOperationTypeEnum",
"operationType",
")",
"{",
"ConcurrentHashMap",
"<",
"String",
",",
"BaseMethodBinding",
"<",
"?",
">",
">",
"result",
"=",
"operationBindings",
".",
"get",
"(",
"operationType",
")",
";",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"operationBindings",
".",
"putIfAbsent",
"(",
"operationType",
",",
"new",
"ConcurrentHashMap",
"<",
"String",
",",
"BaseMethodBinding",
"<",
"?",
">",
">",
"(",
")",
")",
";",
"return",
"getMapForOperation",
"(",
"operationType",
")",
";",
"}",
"else",
"{",
"return",
"result",
";",
"}",
"}"
] | Get the map for the given operation type. If no map exists for this operation type, create a new hashmap for this
operation type and add it to the operation bindings.
@param operationType the operation type.
@return the map defined in the operation bindings | [
"Get",
"the",
"map",
"for",
"the",
"given",
"operation",
"type",
".",
"If",
"no",
"map",
"exists",
"for",
"this",
"operation",
"type",
"create",
"a",
"new",
"hashmap",
"for",
"this",
"operation",
"type",
"and",
"add",
"it",
"to",
"the",
"operation",
"bindings",
"."
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/util/JaxRsMethodBindings.java#L101-L109 |
22,503 | jamesagnew/hapi-fhir | hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/util/JaxRsMethodBindings.java | JaxRsMethodBindings.getBinding | public BaseMethodBinding<?> getBinding(RestOperationTypeEnum operationType, String theBindingKey) {
String bindingKey = StringUtils.defaultIfBlank(theBindingKey, DEFAULT_METHOD_KEY);
ConcurrentHashMap<String, BaseMethodBinding<?>> map = getMapForOperation(operationType);
if(map == null || !map.containsKey(bindingKey)) {
throw new NotImplementedOperationException("Operation not implemented");
} else {
return map.get(bindingKey);
}
} | java | public BaseMethodBinding<?> getBinding(RestOperationTypeEnum operationType, String theBindingKey) {
String bindingKey = StringUtils.defaultIfBlank(theBindingKey, DEFAULT_METHOD_KEY);
ConcurrentHashMap<String, BaseMethodBinding<?>> map = getMapForOperation(operationType);
if(map == null || !map.containsKey(bindingKey)) {
throw new NotImplementedOperationException("Operation not implemented");
} else {
return map.get(bindingKey);
}
} | [
"public",
"BaseMethodBinding",
"<",
"?",
">",
"getBinding",
"(",
"RestOperationTypeEnum",
"operationType",
",",
"String",
"theBindingKey",
")",
"{",
"String",
"bindingKey",
"=",
"StringUtils",
".",
"defaultIfBlank",
"(",
"theBindingKey",
",",
"DEFAULT_METHOD_KEY",
")",
";",
"ConcurrentHashMap",
"<",
"String",
",",
"BaseMethodBinding",
"<",
"?",
">",
">",
"map",
"=",
"getMapForOperation",
"(",
"operationType",
")",
";",
"if",
"(",
"map",
"==",
"null",
"||",
"!",
"map",
".",
"containsKey",
"(",
"bindingKey",
")",
")",
"{",
"throw",
"new",
"NotImplementedOperationException",
"(",
"\"Operation not implemented\"",
")",
";",
"}",
"else",
"{",
"return",
"map",
".",
"get",
"(",
"bindingKey",
")",
";",
"}",
"}"
] | Get the binding
@param operationType the type of operation
@param theBindingKey the binding key
@return the binding defined
@throws NotImplementedOperationException cannot be found | [
"Get",
"the",
"binding"
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/util/JaxRsMethodBindings.java#L119-L127 |
22,504 | jamesagnew/hapi-fhir | hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/util/JaxRsMethodBindings.java | JaxRsMethodBindings.getMethodBindings | public static JaxRsMethodBindings getMethodBindings(AbstractJaxRsProvider theProvider, Class<? extends AbstractJaxRsProvider> theProviderClass) {
if(!getClassBindings().containsKey(theProviderClass)) {
JaxRsMethodBindings foundBindings = new JaxRsMethodBindings(theProvider, theProviderClass);
getClassBindings().putIfAbsent(theProviderClass, foundBindings);
}
return getClassBindings().get(theProviderClass);
} | java | public static JaxRsMethodBindings getMethodBindings(AbstractJaxRsProvider theProvider, Class<? extends AbstractJaxRsProvider> theProviderClass) {
if(!getClassBindings().containsKey(theProviderClass)) {
JaxRsMethodBindings foundBindings = new JaxRsMethodBindings(theProvider, theProviderClass);
getClassBindings().putIfAbsent(theProviderClass, foundBindings);
}
return getClassBindings().get(theProviderClass);
} | [
"public",
"static",
"JaxRsMethodBindings",
"getMethodBindings",
"(",
"AbstractJaxRsProvider",
"theProvider",
",",
"Class",
"<",
"?",
"extends",
"AbstractJaxRsProvider",
">",
"theProviderClass",
")",
"{",
"if",
"(",
"!",
"getClassBindings",
"(",
")",
".",
"containsKey",
"(",
"theProviderClass",
")",
")",
"{",
"JaxRsMethodBindings",
"foundBindings",
"=",
"new",
"JaxRsMethodBindings",
"(",
"theProvider",
",",
"theProviderClass",
")",
";",
"getClassBindings",
"(",
")",
".",
"putIfAbsent",
"(",
"theProviderClass",
",",
"foundBindings",
")",
";",
"}",
"return",
"getClassBindings",
"(",
")",
".",
"get",
"(",
"theProviderClass",
")",
";",
"}"
] | Get the method bindings for the given class. If this class is not yet contained in the classBindings, they will be added for this class
@param theProvider the implementation class
@param theProviderClass the provider class
@return the methodBindings for this class | [
"Get",
"the",
"method",
"bindings",
"for",
"the",
"given",
"class",
".",
"If",
"this",
"class",
"is",
"not",
"yet",
"contained",
"in",
"the",
"classBindings",
"they",
"will",
"be",
"added",
"for",
"this",
"class"
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/util/JaxRsMethodBindings.java#L136-L142 |
22,505 | jamesagnew/hapi-fhir | hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/ArbitrarySqlTask.java | ArbitrarySqlTask.addExecuteOnlyIfColumnExists | public void addExecuteOnlyIfColumnExists(String theTableName, String theColumnName) {
myConditionalOnExistenceOf.add(new TableAndColumn(theTableName, theColumnName));
} | java | public void addExecuteOnlyIfColumnExists(String theTableName, String theColumnName) {
myConditionalOnExistenceOf.add(new TableAndColumn(theTableName, theColumnName));
} | [
"public",
"void",
"addExecuteOnlyIfColumnExists",
"(",
"String",
"theTableName",
",",
"String",
"theColumnName",
")",
"{",
"myConditionalOnExistenceOf",
".",
"add",
"(",
"new",
"TableAndColumn",
"(",
"theTableName",
",",
"theColumnName",
")",
")",
";",
"}"
] | This task will only execute if the following column exists | [
"This",
"task",
"will",
"only",
"execute",
"if",
"the",
"following",
"column",
"exists"
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/ArbitrarySqlTask.java#L98-L100 |
22,506 | jamesagnew/hapi-fhir | hapi-fhir-utilities/src/main/java/org/hl7/fhir/utilities/Inflector.java | Inflector.pluralize | public String pluralize( Object word ) {
if (word == null) return null;
String wordStr = word.toString().trim();
if (wordStr.length() == 0) return wordStr;
if (isUncountable(wordStr)) return wordStr;
for (Rule rule : this.plurals) {
String result = rule.apply(wordStr);
if (result != null) return result;
}
return wordStr;
} | java | public String pluralize( Object word ) {
if (word == null) return null;
String wordStr = word.toString().trim();
if (wordStr.length() == 0) return wordStr;
if (isUncountable(wordStr)) return wordStr;
for (Rule rule : this.plurals) {
String result = rule.apply(wordStr);
if (result != null) return result;
}
return wordStr;
} | [
"public",
"String",
"pluralize",
"(",
"Object",
"word",
")",
"{",
"if",
"(",
"word",
"==",
"null",
")",
"return",
"null",
";",
"String",
"wordStr",
"=",
"word",
".",
"toString",
"(",
")",
".",
"trim",
"(",
")",
";",
"if",
"(",
"wordStr",
".",
"length",
"(",
")",
"==",
"0",
")",
"return",
"wordStr",
";",
"if",
"(",
"isUncountable",
"(",
"wordStr",
")",
")",
"return",
"wordStr",
";",
"for",
"(",
"Rule",
"rule",
":",
"this",
".",
"plurals",
")",
"{",
"String",
"result",
"=",
"rule",
".",
"apply",
"(",
"wordStr",
")",
";",
"if",
"(",
"result",
"!=",
"null",
")",
"return",
"result",
";",
"}",
"return",
"wordStr",
";",
"}"
] | Returns the plural form of the word in the string.
Examples:
<pre>
inflector.pluralize("post") #=> "posts"
inflector.pluralize("octopus") #=> "octopi"
inflector.pluralize("sheep") #=> "sheep"
inflector.pluralize("words") #=> "words"
inflector.pluralize("the blue mailman") #=> "the blue mailmen"
inflector.pluralize("CamelOctopus") #=> "CamelOctopi"
</pre>
Note that if the {@link Object#toString()} is called on the supplied object, so this method works for non-strings, too.
@param word the word that is to be pluralized.
@return the pluralized form of the word, or the word itself if it could not be pluralized
@see #singularize(Object) | [
"Returns",
"the",
"plural",
"form",
"of",
"the",
"word",
"in",
"the",
"string",
"."
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-utilities/src/main/java/org/hl7/fhir/utilities/Inflector.java#L174-L184 |
22,507 | jamesagnew/hapi-fhir | hapi-fhir-utilities/src/main/java/org/hl7/fhir/utilities/Inflector.java | Inflector.singularize | public String singularize( Object word ) {
if (word == null) return null;
String wordStr = word.toString().trim();
if (wordStr.length() == 0) return wordStr;
if (isUncountable(wordStr)) return wordStr;
for (Rule rule : this.singulars) {
String result = rule.apply(wordStr);
if (result != null) return result;
}
return wordStr;
} | java | public String singularize( Object word ) {
if (word == null) return null;
String wordStr = word.toString().trim();
if (wordStr.length() == 0) return wordStr;
if (isUncountable(wordStr)) return wordStr;
for (Rule rule : this.singulars) {
String result = rule.apply(wordStr);
if (result != null) return result;
}
return wordStr;
} | [
"public",
"String",
"singularize",
"(",
"Object",
"word",
")",
"{",
"if",
"(",
"word",
"==",
"null",
")",
"return",
"null",
";",
"String",
"wordStr",
"=",
"word",
".",
"toString",
"(",
")",
".",
"trim",
"(",
")",
";",
"if",
"(",
"wordStr",
".",
"length",
"(",
")",
"==",
"0",
")",
"return",
"wordStr",
";",
"if",
"(",
"isUncountable",
"(",
"wordStr",
")",
")",
"return",
"wordStr",
";",
"for",
"(",
"Rule",
"rule",
":",
"this",
".",
"singulars",
")",
"{",
"String",
"result",
"=",
"rule",
".",
"apply",
"(",
"wordStr",
")",
";",
"if",
"(",
"result",
"!=",
"null",
")",
"return",
"result",
";",
"}",
"return",
"wordStr",
";",
"}"
] | Returns the singular form of the word in the string.
Examples:
<pre>
inflector.singularize("posts") #=> "post"
inflector.singularize("octopi") #=> "octopus"
inflector.singularize("sheep") #=> "sheep"
inflector.singularize("words") #=> "word"
inflector.singularize("the blue mailmen") #=> "the blue mailman"
inflector.singularize("CamelOctopi") #=> "CamelOctopus"
</pre>
Note that if the {@link Object#toString()} is called on the supplied object, so this method works for non-strings, too.
@param word the word that is to be pluralized.
@return the pluralized form of the word, or the word itself if it could not be pluralized
@see #pluralize(Object) | [
"Returns",
"the",
"singular",
"form",
"of",
"the",
"word",
"in",
"the",
"string",
"."
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-utilities/src/main/java/org/hl7/fhir/utilities/Inflector.java#L218-L228 |
22,508 | jamesagnew/hapi-fhir | hapi-fhir-utilities/src/main/java/org/hl7/fhir/utilities/Inflector.java | Inflector.capitalize | public String capitalize( String words ) {
if (words == null) return null;
String result = words.trim();
if (result.length() == 0) return "";
if (result.length() == 1) return result.toUpperCase();
return "" + Character.toUpperCase(result.charAt(0)) + result.substring(1).toLowerCase();
} | java | public String capitalize( String words ) {
if (words == null) return null;
String result = words.trim();
if (result.length() == 0) return "";
if (result.length() == 1) return result.toUpperCase();
return "" + Character.toUpperCase(result.charAt(0)) + result.substring(1).toLowerCase();
} | [
"public",
"String",
"capitalize",
"(",
"String",
"words",
")",
"{",
"if",
"(",
"words",
"==",
"null",
")",
"return",
"null",
";",
"String",
"result",
"=",
"words",
".",
"trim",
"(",
")",
";",
"if",
"(",
"result",
".",
"length",
"(",
")",
"==",
"0",
")",
"return",
"\"\"",
";",
"if",
"(",
"result",
".",
"length",
"(",
")",
"==",
"1",
")",
"return",
"result",
".",
"toUpperCase",
"(",
")",
";",
"return",
"\"\"",
"+",
"Character",
".",
"toUpperCase",
"(",
"result",
".",
"charAt",
"(",
"0",
")",
")",
"+",
"result",
".",
"substring",
"(",
"1",
")",
".",
"toLowerCase",
"(",
")",
";",
"}"
] | Returns a copy of the input with the first character converted to uppercase and the remainder to lowercase.
@param words the word to be capitalized
@return the string with the first character capitalized and the remaining characters lowercased | [
"Returns",
"a",
"copy",
"of",
"the",
"input",
"with",
"the",
"first",
"character",
"converted",
"to",
"uppercase",
"and",
"the",
"remainder",
"to",
"lowercase",
"."
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-utilities/src/main/java/org/hl7/fhir/utilities/Inflector.java#L375-L381 |
22,509 | jamesagnew/hapi-fhir | hapi-fhir-structures-dstu/src/main/java/ca/uhn/fhir/rest/server/interceptor/AuditingInterceptor.java | AuditingInterceptor.outgoingResponse | @Override
public boolean outgoingResponse(RequestDetails theRequestDetails, Bundle theResponseObject, HttpServletRequest theServletRequest, HttpServletResponse theServletResponse) throws AuthenticationException {
if (myClientParamsOptional && myDataStore == null) {
// auditing is not required or configured, so do nothing here
log.debug("No auditing configured.");
return true;
}
if (theResponseObject == null || theResponseObject.isEmpty()) {
log.debug("No bundle to audit");
return true;
}
try {
log.info("Auditing bundle: " + theResponseObject + " from request " + theRequestDetails);
SecurityEvent auditEvent = new SecurityEvent();
auditEvent.setEvent(getEventInfo(theRequestDetails));
// get user info from request if available
Participant participant = getParticipant(theServletRequest);
if (participant == null) {
log.debug("No participant to audit");
return true; // no user to audit - throws exception if client params are required
}
List<Participant> participants = new ArrayList<SecurityEvent.Participant>(1);
participants.add(participant);
auditEvent.setParticipant(participants);
SecurityEventObjectLifecycleEnum lifecycle = mapResourceTypeToSecurityLifecycle(theRequestDetails.getRestOperationType());
byte[] query = getQueryFromRequestDetails(theRequestDetails);
List<ObjectElement> auditableObjects = new ArrayList<SecurityEvent.ObjectElement>();
for (BundleEntry entry : theResponseObject.getEntries()) {
IResource resource = entry.getResource();
ObjectElement auditableObject = getObjectElement(resource, lifecycle, query);
if (auditableObject != null)
auditableObjects.add(auditableObject);
}
if (auditableObjects.isEmpty()) {
log.debug("No auditable resources to audit.");
return true; // no PHI to audit
} else {
log.debug("Auditing " + auditableObjects.size() + " resources.");
}
auditEvent.setObject(auditableObjects);
auditEvent.setSource(getSourceElement(theServletRequest));
store(auditEvent);
return true; // success
} catch (Exception e) {
log.error("Unable to audit resource: " + theResponseObject + " from request: " + theRequestDetails, e);
throw new InternalErrorException("Auditing failed, unable to complete request", e);
}
} | java | @Override
public boolean outgoingResponse(RequestDetails theRequestDetails, Bundle theResponseObject, HttpServletRequest theServletRequest, HttpServletResponse theServletResponse) throws AuthenticationException {
if (myClientParamsOptional && myDataStore == null) {
// auditing is not required or configured, so do nothing here
log.debug("No auditing configured.");
return true;
}
if (theResponseObject == null || theResponseObject.isEmpty()) {
log.debug("No bundle to audit");
return true;
}
try {
log.info("Auditing bundle: " + theResponseObject + " from request " + theRequestDetails);
SecurityEvent auditEvent = new SecurityEvent();
auditEvent.setEvent(getEventInfo(theRequestDetails));
// get user info from request if available
Participant participant = getParticipant(theServletRequest);
if (participant == null) {
log.debug("No participant to audit");
return true; // no user to audit - throws exception if client params are required
}
List<Participant> participants = new ArrayList<SecurityEvent.Participant>(1);
participants.add(participant);
auditEvent.setParticipant(participants);
SecurityEventObjectLifecycleEnum lifecycle = mapResourceTypeToSecurityLifecycle(theRequestDetails.getRestOperationType());
byte[] query = getQueryFromRequestDetails(theRequestDetails);
List<ObjectElement> auditableObjects = new ArrayList<SecurityEvent.ObjectElement>();
for (BundleEntry entry : theResponseObject.getEntries()) {
IResource resource = entry.getResource();
ObjectElement auditableObject = getObjectElement(resource, lifecycle, query);
if (auditableObject != null)
auditableObjects.add(auditableObject);
}
if (auditableObjects.isEmpty()) {
log.debug("No auditable resources to audit.");
return true; // no PHI to audit
} else {
log.debug("Auditing " + auditableObjects.size() + " resources.");
}
auditEvent.setObject(auditableObjects);
auditEvent.setSource(getSourceElement(theServletRequest));
store(auditEvent);
return true; // success
} catch (Exception e) {
log.error("Unable to audit resource: " + theResponseObject + " from request: " + theRequestDetails, e);
throw new InternalErrorException("Auditing failed, unable to complete request", e);
}
} | [
"@",
"Override",
"public",
"boolean",
"outgoingResponse",
"(",
"RequestDetails",
"theRequestDetails",
",",
"Bundle",
"theResponseObject",
",",
"HttpServletRequest",
"theServletRequest",
",",
"HttpServletResponse",
"theServletResponse",
")",
"throws",
"AuthenticationException",
"{",
"if",
"(",
"myClientParamsOptional",
"&&",
"myDataStore",
"==",
"null",
")",
"{",
"// auditing is not required or configured, so do nothing here",
"log",
".",
"debug",
"(",
"\"No auditing configured.\"",
")",
";",
"return",
"true",
";",
"}",
"if",
"(",
"theResponseObject",
"==",
"null",
"||",
"theResponseObject",
".",
"isEmpty",
"(",
")",
")",
"{",
"log",
".",
"debug",
"(",
"\"No bundle to audit\"",
")",
";",
"return",
"true",
";",
"}",
"try",
"{",
"log",
".",
"info",
"(",
"\"Auditing bundle: \"",
"+",
"theResponseObject",
"+",
"\" from request \"",
"+",
"theRequestDetails",
")",
";",
"SecurityEvent",
"auditEvent",
"=",
"new",
"SecurityEvent",
"(",
")",
";",
"auditEvent",
".",
"setEvent",
"(",
"getEventInfo",
"(",
"theRequestDetails",
")",
")",
";",
"// get user info from request if available",
"Participant",
"participant",
"=",
"getParticipant",
"(",
"theServletRequest",
")",
";",
"if",
"(",
"participant",
"==",
"null",
")",
"{",
"log",
".",
"debug",
"(",
"\"No participant to audit\"",
")",
";",
"return",
"true",
";",
"// no user to audit - throws exception if client params are required",
"}",
"List",
"<",
"Participant",
">",
"participants",
"=",
"new",
"ArrayList",
"<",
"SecurityEvent",
".",
"Participant",
">",
"(",
"1",
")",
";",
"participants",
".",
"add",
"(",
"participant",
")",
";",
"auditEvent",
".",
"setParticipant",
"(",
"participants",
")",
";",
"SecurityEventObjectLifecycleEnum",
"lifecycle",
"=",
"mapResourceTypeToSecurityLifecycle",
"(",
"theRequestDetails",
".",
"getRestOperationType",
"(",
")",
")",
";",
"byte",
"[",
"]",
"query",
"=",
"getQueryFromRequestDetails",
"(",
"theRequestDetails",
")",
";",
"List",
"<",
"ObjectElement",
">",
"auditableObjects",
"=",
"new",
"ArrayList",
"<",
"SecurityEvent",
".",
"ObjectElement",
">",
"(",
")",
";",
"for",
"(",
"BundleEntry",
"entry",
":",
"theResponseObject",
".",
"getEntries",
"(",
")",
")",
"{",
"IResource",
"resource",
"=",
"entry",
".",
"getResource",
"(",
")",
";",
"ObjectElement",
"auditableObject",
"=",
"getObjectElement",
"(",
"resource",
",",
"lifecycle",
",",
"query",
")",
";",
"if",
"(",
"auditableObject",
"!=",
"null",
")",
"auditableObjects",
".",
"add",
"(",
"auditableObject",
")",
";",
"}",
"if",
"(",
"auditableObjects",
".",
"isEmpty",
"(",
")",
")",
"{",
"log",
".",
"debug",
"(",
"\"No auditable resources to audit.\"",
")",
";",
"return",
"true",
";",
"// no PHI to audit",
"}",
"else",
"{",
"log",
".",
"debug",
"(",
"\"Auditing \"",
"+",
"auditableObjects",
".",
"size",
"(",
")",
"+",
"\" resources.\"",
")",
";",
"}",
"auditEvent",
".",
"setObject",
"(",
"auditableObjects",
")",
";",
"auditEvent",
".",
"setSource",
"(",
"getSourceElement",
"(",
"theServletRequest",
")",
")",
";",
"store",
"(",
"auditEvent",
")",
";",
"return",
"true",
";",
"// success",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"log",
".",
"error",
"(",
"\"Unable to audit resource: \"",
"+",
"theResponseObject",
"+",
"\" from request: \"",
"+",
"theRequestDetails",
",",
"e",
")",
";",
"throw",
"new",
"InternalErrorException",
"(",
"\"Auditing failed, unable to complete request\"",
",",
"e",
")",
";",
"}",
"}"
] | Intercept the outgoing response to perform auditing of the request data if the bundle contains auditable
resources. | [
"Intercept",
"the",
"outgoing",
"response",
"to",
"perform",
"auditing",
"of",
"the",
"request",
"data",
"if",
"the",
"bundle",
"contains",
"auditable",
"resources",
"."
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-structures-dstu/src/main/java/ca/uhn/fhir/rest/server/interceptor/AuditingInterceptor.java#L116-L164 |
22,510 | jamesagnew/hapi-fhir | hapi-fhir-structures-dstu/src/main/java/ca/uhn/fhir/rest/server/interceptor/AuditingInterceptor.java | AuditingInterceptor.getEventInfo | protected Event getEventInfo(RequestDetails theRequestDetails) {
Event event = new Event();
event.setAction(mapResourceTypeToSecurityEventAction(theRequestDetails.getRestOperationType()));
event.setDateTimeWithMillisPrecision(new Date());
event.setOutcome(SecurityEventOutcomeEnum.SUCCESS); // we audit successful return of PHI only, otherwise an
// exception is thrown and no resources are returned to be
// audited
return event;
} | java | protected Event getEventInfo(RequestDetails theRequestDetails) {
Event event = new Event();
event.setAction(mapResourceTypeToSecurityEventAction(theRequestDetails.getRestOperationType()));
event.setDateTimeWithMillisPrecision(new Date());
event.setOutcome(SecurityEventOutcomeEnum.SUCCESS); // we audit successful return of PHI only, otherwise an
// exception is thrown and no resources are returned to be
// audited
return event;
} | [
"protected",
"Event",
"getEventInfo",
"(",
"RequestDetails",
"theRequestDetails",
")",
"{",
"Event",
"event",
"=",
"new",
"Event",
"(",
")",
";",
"event",
".",
"setAction",
"(",
"mapResourceTypeToSecurityEventAction",
"(",
"theRequestDetails",
".",
"getRestOperationType",
"(",
")",
")",
")",
";",
"event",
".",
"setDateTimeWithMillisPrecision",
"(",
"new",
"Date",
"(",
")",
")",
";",
"event",
".",
"setOutcome",
"(",
"SecurityEventOutcomeEnum",
".",
"SUCCESS",
")",
";",
"// we audit successful return of PHI only, otherwise an",
"// exception is thrown and no resources are returned to be",
"// audited",
"return",
"event",
";",
"}"
] | Generates the Event segment of the SecurityEvent based on the incoming request details
@param theRequestDetails
the RequestDetails of the incoming request
@return an Event populated with the action, date, and outcome | [
"Generates",
"the",
"Event",
"segment",
"of",
"the",
"SecurityEvent",
"based",
"on",
"the",
"incoming",
"request",
"details"
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-structures-dstu/src/main/java/ca/uhn/fhir/rest/server/interceptor/AuditingInterceptor.java#L236-L245 |
22,511 | jamesagnew/hapi-fhir | hapi-fhir-structures-dstu/src/main/java/ca/uhn/fhir/rest/server/interceptor/AuditingInterceptor.java | AuditingInterceptor.getQueryFromRequestDetails | protected byte[] getQueryFromRequestDetails(RequestDetails theRequestDetails) {
byte[] query;
try {
query = theRequestDetails.getCompleteUrl().getBytes("UTF-8");
} catch (UnsupportedEncodingException e1) {
log.warn("Unable to encode URL to bytes in UTF-8, defaulting to platform default charset.", e1);
query = theRequestDetails.getCompleteUrl().getBytes();
}
return query;
} | java | protected byte[] getQueryFromRequestDetails(RequestDetails theRequestDetails) {
byte[] query;
try {
query = theRequestDetails.getCompleteUrl().getBytes("UTF-8");
} catch (UnsupportedEncodingException e1) {
log.warn("Unable to encode URL to bytes in UTF-8, defaulting to platform default charset.", e1);
query = theRequestDetails.getCompleteUrl().getBytes();
}
return query;
} | [
"protected",
"byte",
"[",
"]",
"getQueryFromRequestDetails",
"(",
"RequestDetails",
"theRequestDetails",
")",
"{",
"byte",
"[",
"]",
"query",
";",
"try",
"{",
"query",
"=",
"theRequestDetails",
".",
"getCompleteUrl",
"(",
")",
".",
"getBytes",
"(",
"\"UTF-8\"",
")",
";",
"}",
"catch",
"(",
"UnsupportedEncodingException",
"e1",
")",
"{",
"log",
".",
"warn",
"(",
"\"Unable to encode URL to bytes in UTF-8, defaulting to platform default charset.\"",
",",
"e1",
")",
";",
"query",
"=",
"theRequestDetails",
".",
"getCompleteUrl",
"(",
")",
".",
"getBytes",
"(",
")",
";",
"}",
"return",
"query",
";",
"}"
] | Return the query URL encoded to bytes to be set as the Object.query on the Security Event
@param theRequestDetails
the RequestDetails of the incoming request
@return the query URL of the request encoded to bytes | [
"Return",
"the",
"query",
"URL",
"encoded",
"to",
"bytes",
"to",
"be",
"set",
"as",
"the",
"Object",
".",
"query",
"on",
"the",
"Security",
"Event"
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-structures-dstu/src/main/java/ca/uhn/fhir/rest/server/interceptor/AuditingInterceptor.java#L254-L263 |
22,512 | jamesagnew/hapi-fhir | hapi-fhir-structures-dstu/src/main/java/ca/uhn/fhir/rest/server/interceptor/AuditingInterceptor.java | AuditingInterceptor.getObjectElement | protected ObjectElement getObjectElement(IResource resource, SecurityEventObjectLifecycleEnum lifecycle, byte[] query) throws InstantiationException, IllegalAccessException {
String resourceType = resource.getResourceName();
if (myAuditableResources.containsKey(resourceType)) {
log.debug("Found auditable resource of type: " + resourceType);
@SuppressWarnings("unchecked")
IResourceAuditor<IResource> auditableResource = (IResourceAuditor<IResource>) myAuditableResources.get(resourceType).newInstance();
auditableResource.setResource(resource);
if (auditableResource.isAuditable()) {
ObjectElement object = new ObjectElement();
object.setReference(new ResourceReferenceDt(resource.getId()));
object.setLifecycle(lifecycle);
object.setQuery(query);
object.setName(auditableResource.getName());
object.setIdentifier((IdentifierDt) auditableResource.getIdentifier());
object.setType(auditableResource.getType());
object.setDescription(auditableResource.getDescription());
Map<String, String> detailMap = auditableResource.getDetail();
if (detailMap != null && !detailMap.isEmpty()) {
List<ObjectDetail> details = new ArrayList<SecurityEvent.ObjectDetail>();
for (Entry<String, String> entry : detailMap.entrySet()) {
ObjectDetail detail = makeObjectDetail(entry.getKey(), entry.getValue());
details.add(detail);
}
object.setDetail(details);
}
if (auditableResource.getSensitivity() != null) {
CodingDt coding = object.getSensitivity().addCoding();
coding.setSystem(auditableResource.getSensitivity().getSystemElement().getValue());
coding.setCode(auditableResource.getSensitivity().getCodeElement().getValue());
coding.setDisplay(auditableResource.getSensitivity().getDisplayElement().getValue());
}
return object;
} else {
log.debug("Resource is not auditable");
}
} else {
log.debug("No auditor configured for resource type " + resourceType);
}
return null; // not something we care to audit
} | java | protected ObjectElement getObjectElement(IResource resource, SecurityEventObjectLifecycleEnum lifecycle, byte[] query) throws InstantiationException, IllegalAccessException {
String resourceType = resource.getResourceName();
if (myAuditableResources.containsKey(resourceType)) {
log.debug("Found auditable resource of type: " + resourceType);
@SuppressWarnings("unchecked")
IResourceAuditor<IResource> auditableResource = (IResourceAuditor<IResource>) myAuditableResources.get(resourceType).newInstance();
auditableResource.setResource(resource);
if (auditableResource.isAuditable()) {
ObjectElement object = new ObjectElement();
object.setReference(new ResourceReferenceDt(resource.getId()));
object.setLifecycle(lifecycle);
object.setQuery(query);
object.setName(auditableResource.getName());
object.setIdentifier((IdentifierDt) auditableResource.getIdentifier());
object.setType(auditableResource.getType());
object.setDescription(auditableResource.getDescription());
Map<String, String> detailMap = auditableResource.getDetail();
if (detailMap != null && !detailMap.isEmpty()) {
List<ObjectDetail> details = new ArrayList<SecurityEvent.ObjectDetail>();
for (Entry<String, String> entry : detailMap.entrySet()) {
ObjectDetail detail = makeObjectDetail(entry.getKey(), entry.getValue());
details.add(detail);
}
object.setDetail(details);
}
if (auditableResource.getSensitivity() != null) {
CodingDt coding = object.getSensitivity().addCoding();
coding.setSystem(auditableResource.getSensitivity().getSystemElement().getValue());
coding.setCode(auditableResource.getSensitivity().getCodeElement().getValue());
coding.setDisplay(auditableResource.getSensitivity().getDisplayElement().getValue());
}
return object;
} else {
log.debug("Resource is not auditable");
}
} else {
log.debug("No auditor configured for resource type " + resourceType);
}
return null; // not something we care to audit
} | [
"protected",
"ObjectElement",
"getObjectElement",
"(",
"IResource",
"resource",
",",
"SecurityEventObjectLifecycleEnum",
"lifecycle",
",",
"byte",
"[",
"]",
"query",
")",
"throws",
"InstantiationException",
",",
"IllegalAccessException",
"{",
"String",
"resourceType",
"=",
"resource",
".",
"getResourceName",
"(",
")",
";",
"if",
"(",
"myAuditableResources",
".",
"containsKey",
"(",
"resourceType",
")",
")",
"{",
"log",
".",
"debug",
"(",
"\"Found auditable resource of type: \"",
"+",
"resourceType",
")",
";",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"IResourceAuditor",
"<",
"IResource",
">",
"auditableResource",
"=",
"(",
"IResourceAuditor",
"<",
"IResource",
">",
")",
"myAuditableResources",
".",
"get",
"(",
"resourceType",
")",
".",
"newInstance",
"(",
")",
";",
"auditableResource",
".",
"setResource",
"(",
"resource",
")",
";",
"if",
"(",
"auditableResource",
".",
"isAuditable",
"(",
")",
")",
"{",
"ObjectElement",
"object",
"=",
"new",
"ObjectElement",
"(",
")",
";",
"object",
".",
"setReference",
"(",
"new",
"ResourceReferenceDt",
"(",
"resource",
".",
"getId",
"(",
")",
")",
")",
";",
"object",
".",
"setLifecycle",
"(",
"lifecycle",
")",
";",
"object",
".",
"setQuery",
"(",
"query",
")",
";",
"object",
".",
"setName",
"(",
"auditableResource",
".",
"getName",
"(",
")",
")",
";",
"object",
".",
"setIdentifier",
"(",
"(",
"IdentifierDt",
")",
"auditableResource",
".",
"getIdentifier",
"(",
")",
")",
";",
"object",
".",
"setType",
"(",
"auditableResource",
".",
"getType",
"(",
")",
")",
";",
"object",
".",
"setDescription",
"(",
"auditableResource",
".",
"getDescription",
"(",
")",
")",
";",
"Map",
"<",
"String",
",",
"String",
">",
"detailMap",
"=",
"auditableResource",
".",
"getDetail",
"(",
")",
";",
"if",
"(",
"detailMap",
"!=",
"null",
"&&",
"!",
"detailMap",
".",
"isEmpty",
"(",
")",
")",
"{",
"List",
"<",
"ObjectDetail",
">",
"details",
"=",
"new",
"ArrayList",
"<",
"SecurityEvent",
".",
"ObjectDetail",
">",
"(",
")",
";",
"for",
"(",
"Entry",
"<",
"String",
",",
"String",
">",
"entry",
":",
"detailMap",
".",
"entrySet",
"(",
")",
")",
"{",
"ObjectDetail",
"detail",
"=",
"makeObjectDetail",
"(",
"entry",
".",
"getKey",
"(",
")",
",",
"entry",
".",
"getValue",
"(",
")",
")",
";",
"details",
".",
"add",
"(",
"detail",
")",
";",
"}",
"object",
".",
"setDetail",
"(",
"details",
")",
";",
"}",
"if",
"(",
"auditableResource",
".",
"getSensitivity",
"(",
")",
"!=",
"null",
")",
"{",
"CodingDt",
"coding",
"=",
"object",
".",
"getSensitivity",
"(",
")",
".",
"addCoding",
"(",
")",
";",
"coding",
".",
"setSystem",
"(",
"auditableResource",
".",
"getSensitivity",
"(",
")",
".",
"getSystemElement",
"(",
")",
".",
"getValue",
"(",
")",
")",
";",
"coding",
".",
"setCode",
"(",
"auditableResource",
".",
"getSensitivity",
"(",
")",
".",
"getCodeElement",
"(",
")",
".",
"getValue",
"(",
")",
")",
";",
"coding",
".",
"setDisplay",
"(",
"auditableResource",
".",
"getSensitivity",
"(",
")",
".",
"getDisplayElement",
"(",
")",
".",
"getValue",
"(",
")",
")",
";",
"}",
"return",
"object",
";",
"}",
"else",
"{",
"log",
".",
"debug",
"(",
"\"Resource is not auditable\"",
")",
";",
"}",
"}",
"else",
"{",
"log",
".",
"debug",
"(",
"\"No auditor configured for resource type \"",
"+",
"resourceType",
")",
";",
"}",
"return",
"null",
";",
"// not something we care to audit",
"}"
] | If the resource is considered an auditable resource containing PHI, create an ObjectElement, otherwise return null
@param resource
the resource to be audited
@param lifecycle
the SecurityEventObjectLifecycleEnum of the request
@param query
the byte encoded query string of the request
@return an ObjectElement populated with information about the resource
@throws IllegalAccessException
if the auditor for this resource cannot be instantiated
@throws InstantiationException
if the auditor for this resource cannot be instantiated | [
"If",
"the",
"resource",
"is",
"considered",
"an",
"auditable",
"resource",
"containing",
"PHI",
"create",
"an",
"ObjectElement",
"otherwise",
"return",
"null"
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-structures-dstu/src/main/java/ca/uhn/fhir/rest/server/interceptor/AuditingInterceptor.java#L280-L321 |
22,513 | jamesagnew/hapi-fhir | hapi-fhir-structures-dstu/src/main/java/ca/uhn/fhir/rest/server/interceptor/AuditingInterceptor.java | AuditingInterceptor.makeObjectDetail | protected ObjectDetail makeObjectDetail(String type, String value) {
ObjectDetail detail = new ObjectDetail();
if (type != null)
detail.setType(type);
if (value != null)
detail.setValue(value.getBytes());
return detail;
} | java | protected ObjectDetail makeObjectDetail(String type, String value) {
ObjectDetail detail = new ObjectDetail();
if (type != null)
detail.setType(type);
if (value != null)
detail.setValue(value.getBytes());
return detail;
} | [
"protected",
"ObjectDetail",
"makeObjectDetail",
"(",
"String",
"type",
",",
"String",
"value",
")",
"{",
"ObjectDetail",
"detail",
"=",
"new",
"ObjectDetail",
"(",
")",
";",
"if",
"(",
"type",
"!=",
"null",
")",
"detail",
".",
"setType",
"(",
"type",
")",
";",
"if",
"(",
"value",
"!=",
"null",
")",
"detail",
".",
"setValue",
"(",
"value",
".",
"getBytes",
"(",
")",
")",
";",
"return",
"detail",
";",
"}"
] | Helper method to create an ObjectDetail from a pair of Strings.
@param type
the type of the ObjectDetail
@param value
the value of the ObejctDetail to be encoded
@return an ObjectDetail of the given type and value | [
"Helper",
"method",
"to",
"create",
"an",
"ObjectDetail",
"from",
"a",
"pair",
"of",
"Strings",
"."
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-structures-dstu/src/main/java/ca/uhn/fhir/rest/server/interceptor/AuditingInterceptor.java#L332-L339 |
22,514 | jamesagnew/hapi-fhir | hapi-fhir-structures-dstu/src/main/java/ca/uhn/fhir/rest/server/interceptor/AuditingInterceptor.java | AuditingInterceptor.getAccessType | protected List<CodingDt> getAccessType(HttpServletRequest theServletRequest) {
List<CodingDt> types = new ArrayList<CodingDt>();
if (theServletRequest.getHeader(Constants.HEADER_AUTHORIZATION) != null && theServletRequest.getHeader(Constants.HEADER_AUTHORIZATION).startsWith("OAuth")) {
types.add(new CodingDt(SecurityEventSourceTypeEnum.USER_DEVICE.getSystem(), SecurityEventSourceTypeEnum.USER_DEVICE.getCode()));
} else {
String userId = theServletRequest.getHeader(UserInfoInterceptor.HEADER_USER_ID);
String appId = theServletRequest.getHeader(UserInfoInterceptor.HEADER_APPLICATION_NAME);
if (userId == null && appId != null)
types.add(new CodingDt(SecurityEventSourceTypeEnum.APPLICATION_SERVER.getSystem(), SecurityEventSourceTypeEnum.APPLICATION_SERVER.getCode()));
else
types.add(new CodingDt(SecurityEventSourceTypeEnum.USER_DEVICE.getSystem(), SecurityEventSourceTypeEnum.USER_DEVICE.getCode()));
}
return types;
} | java | protected List<CodingDt> getAccessType(HttpServletRequest theServletRequest) {
List<CodingDt> types = new ArrayList<CodingDt>();
if (theServletRequest.getHeader(Constants.HEADER_AUTHORIZATION) != null && theServletRequest.getHeader(Constants.HEADER_AUTHORIZATION).startsWith("OAuth")) {
types.add(new CodingDt(SecurityEventSourceTypeEnum.USER_DEVICE.getSystem(), SecurityEventSourceTypeEnum.USER_DEVICE.getCode()));
} else {
String userId = theServletRequest.getHeader(UserInfoInterceptor.HEADER_USER_ID);
String appId = theServletRequest.getHeader(UserInfoInterceptor.HEADER_APPLICATION_NAME);
if (userId == null && appId != null)
types.add(new CodingDt(SecurityEventSourceTypeEnum.APPLICATION_SERVER.getSystem(), SecurityEventSourceTypeEnum.APPLICATION_SERVER.getCode()));
else
types.add(new CodingDt(SecurityEventSourceTypeEnum.USER_DEVICE.getSystem(), SecurityEventSourceTypeEnum.USER_DEVICE.getCode()));
}
return types;
} | [
"protected",
"List",
"<",
"CodingDt",
">",
"getAccessType",
"(",
"HttpServletRequest",
"theServletRequest",
")",
"{",
"List",
"<",
"CodingDt",
">",
"types",
"=",
"new",
"ArrayList",
"<",
"CodingDt",
">",
"(",
")",
";",
"if",
"(",
"theServletRequest",
".",
"getHeader",
"(",
"Constants",
".",
"HEADER_AUTHORIZATION",
")",
"!=",
"null",
"&&",
"theServletRequest",
".",
"getHeader",
"(",
"Constants",
".",
"HEADER_AUTHORIZATION",
")",
".",
"startsWith",
"(",
"\"OAuth\"",
")",
")",
"{",
"types",
".",
"add",
"(",
"new",
"CodingDt",
"(",
"SecurityEventSourceTypeEnum",
".",
"USER_DEVICE",
".",
"getSystem",
"(",
")",
",",
"SecurityEventSourceTypeEnum",
".",
"USER_DEVICE",
".",
"getCode",
"(",
")",
")",
")",
";",
"}",
"else",
"{",
"String",
"userId",
"=",
"theServletRequest",
".",
"getHeader",
"(",
"UserInfoInterceptor",
".",
"HEADER_USER_ID",
")",
";",
"String",
"appId",
"=",
"theServletRequest",
".",
"getHeader",
"(",
"UserInfoInterceptor",
".",
"HEADER_APPLICATION_NAME",
")",
";",
"if",
"(",
"userId",
"==",
"null",
"&&",
"appId",
"!=",
"null",
")",
"types",
".",
"add",
"(",
"new",
"CodingDt",
"(",
"SecurityEventSourceTypeEnum",
".",
"APPLICATION_SERVER",
".",
"getSystem",
"(",
")",
",",
"SecurityEventSourceTypeEnum",
".",
"APPLICATION_SERVER",
".",
"getCode",
"(",
")",
")",
")",
";",
"else",
"types",
".",
"add",
"(",
"new",
"CodingDt",
"(",
"SecurityEventSourceTypeEnum",
".",
"USER_DEVICE",
".",
"getSystem",
"(",
")",
",",
"SecurityEventSourceTypeEnum",
".",
"USER_DEVICE",
".",
"getCode",
"(",
")",
")",
")",
";",
"}",
"return",
"types",
";",
"}"
] | Return the access type for this request
@param theServletRequest
the incoming request
@return the SecurityEventSourceTypeEnum representing the type of request being made | [
"Return",
"the",
"access",
"type",
"for",
"this",
"request"
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-structures-dstu/src/main/java/ca/uhn/fhir/rest/server/interceptor/AuditingInterceptor.java#L427-L440 |
22,515 | jamesagnew/hapi-fhir | hapi-fhir-structures-dstu/src/main/java/ca/uhn/fhir/rest/server/interceptor/AuditingInterceptor.java | AuditingInterceptor.mapResourceTypeToSecurityEventAction | protected SecurityEventActionEnum mapResourceTypeToSecurityEventAction(ca.uhn.fhir.rest.api.RestOperationTypeEnum theRestfulOperationTypeEnum) {
if (theRestfulOperationTypeEnum == null)
return null;
switch (theRestfulOperationTypeEnum) {
case READ:
return SecurityEventActionEnum.READ_VIEW_PRINT;
case CREATE:
return SecurityEventActionEnum.CREATE;
case DELETE:
return SecurityEventActionEnum.DELETE;
case HISTORY_INSTANCE:
return SecurityEventActionEnum.READ_VIEW_PRINT;
case HISTORY_TYPE:
return SecurityEventActionEnum.READ_VIEW_PRINT;
case SEARCH_TYPE:
return SecurityEventActionEnum.READ_VIEW_PRINT;
case UPDATE:
return SecurityEventActionEnum.UPDATE;
case VALIDATE:
return SecurityEventActionEnum.READ_VIEW_PRINT;
case VREAD:
return SecurityEventActionEnum.READ_VIEW_PRINT;
default:
return SecurityEventActionEnum.READ_VIEW_PRINT; // read/view catch all
}
} | java | protected SecurityEventActionEnum mapResourceTypeToSecurityEventAction(ca.uhn.fhir.rest.api.RestOperationTypeEnum theRestfulOperationTypeEnum) {
if (theRestfulOperationTypeEnum == null)
return null;
switch (theRestfulOperationTypeEnum) {
case READ:
return SecurityEventActionEnum.READ_VIEW_PRINT;
case CREATE:
return SecurityEventActionEnum.CREATE;
case DELETE:
return SecurityEventActionEnum.DELETE;
case HISTORY_INSTANCE:
return SecurityEventActionEnum.READ_VIEW_PRINT;
case HISTORY_TYPE:
return SecurityEventActionEnum.READ_VIEW_PRINT;
case SEARCH_TYPE:
return SecurityEventActionEnum.READ_VIEW_PRINT;
case UPDATE:
return SecurityEventActionEnum.UPDATE;
case VALIDATE:
return SecurityEventActionEnum.READ_VIEW_PRINT;
case VREAD:
return SecurityEventActionEnum.READ_VIEW_PRINT;
default:
return SecurityEventActionEnum.READ_VIEW_PRINT; // read/view catch all
}
} | [
"protected",
"SecurityEventActionEnum",
"mapResourceTypeToSecurityEventAction",
"(",
"ca",
".",
"uhn",
".",
"fhir",
".",
"rest",
".",
"api",
".",
"RestOperationTypeEnum",
"theRestfulOperationTypeEnum",
")",
"{",
"if",
"(",
"theRestfulOperationTypeEnum",
"==",
"null",
")",
"return",
"null",
";",
"switch",
"(",
"theRestfulOperationTypeEnum",
")",
"{",
"case",
"READ",
":",
"return",
"SecurityEventActionEnum",
".",
"READ_VIEW_PRINT",
";",
"case",
"CREATE",
":",
"return",
"SecurityEventActionEnum",
".",
"CREATE",
";",
"case",
"DELETE",
":",
"return",
"SecurityEventActionEnum",
".",
"DELETE",
";",
"case",
"HISTORY_INSTANCE",
":",
"return",
"SecurityEventActionEnum",
".",
"READ_VIEW_PRINT",
";",
"case",
"HISTORY_TYPE",
":",
"return",
"SecurityEventActionEnum",
".",
"READ_VIEW_PRINT",
";",
"case",
"SEARCH_TYPE",
":",
"return",
"SecurityEventActionEnum",
".",
"READ_VIEW_PRINT",
";",
"case",
"UPDATE",
":",
"return",
"SecurityEventActionEnum",
".",
"UPDATE",
";",
"case",
"VALIDATE",
":",
"return",
"SecurityEventActionEnum",
".",
"READ_VIEW_PRINT",
";",
"case",
"VREAD",
":",
"return",
"SecurityEventActionEnum",
".",
"READ_VIEW_PRINT",
";",
"default",
":",
"return",
"SecurityEventActionEnum",
".",
"READ_VIEW_PRINT",
";",
"// read/view catch all",
"}",
"}"
] | Returns the SecurityEventActionEnum corresponding to the specified RestfulOperationTypeEnum
@param theRestfulOperationTypeEnum
the type of operation (Read, Create, Delete, etc)
@return the corresponding SecurityEventActionEnum (Read/View/Print, Create, Delete, etc) | [
"Returns",
"the",
"SecurityEventActionEnum",
"corresponding",
"to",
"the",
"specified",
"RestfulOperationTypeEnum"
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-structures-dstu/src/main/java/ca/uhn/fhir/rest/server/interceptor/AuditingInterceptor.java#L449-L474 |
22,516 | jamesagnew/hapi-fhir | hapi-fhir-structures-dstu/src/main/java/ca/uhn/fhir/rest/server/interceptor/AuditingInterceptor.java | AuditingInterceptor.mapResourceTypeToSecurityLifecycle | protected SecurityEventObjectLifecycleEnum mapResourceTypeToSecurityLifecycle(ca.uhn.fhir.rest.api.RestOperationTypeEnum theRestfulOperationTypeEnum) {
if (theRestfulOperationTypeEnum == null)
return null;
switch (theRestfulOperationTypeEnum) {
case READ:
return SecurityEventObjectLifecycleEnum.ACCESS_OR_USE;
case CREATE:
return SecurityEventObjectLifecycleEnum.ORIGINATION_OR_CREATION;
case DELETE:
return SecurityEventObjectLifecycleEnum.LOGICAL_DELETION;
case HISTORY_INSTANCE:
return SecurityEventObjectLifecycleEnum.ACCESS_OR_USE;
case HISTORY_TYPE:
return SecurityEventObjectLifecycleEnum.ACCESS_OR_USE;
case SEARCH_TYPE:
return SecurityEventObjectLifecycleEnum.ACCESS_OR_USE;
case UPDATE:
return SecurityEventObjectLifecycleEnum.AMENDMENT;
case VALIDATE:
return SecurityEventObjectLifecycleEnum.VERIFICATION;
case VREAD:
return SecurityEventObjectLifecycleEnum.ACCESS_OR_USE;
default:
return SecurityEventObjectLifecycleEnum.ACCESS_OR_USE; // access/use catch all
}
} | java | protected SecurityEventObjectLifecycleEnum mapResourceTypeToSecurityLifecycle(ca.uhn.fhir.rest.api.RestOperationTypeEnum theRestfulOperationTypeEnum) {
if (theRestfulOperationTypeEnum == null)
return null;
switch (theRestfulOperationTypeEnum) {
case READ:
return SecurityEventObjectLifecycleEnum.ACCESS_OR_USE;
case CREATE:
return SecurityEventObjectLifecycleEnum.ORIGINATION_OR_CREATION;
case DELETE:
return SecurityEventObjectLifecycleEnum.LOGICAL_DELETION;
case HISTORY_INSTANCE:
return SecurityEventObjectLifecycleEnum.ACCESS_OR_USE;
case HISTORY_TYPE:
return SecurityEventObjectLifecycleEnum.ACCESS_OR_USE;
case SEARCH_TYPE:
return SecurityEventObjectLifecycleEnum.ACCESS_OR_USE;
case UPDATE:
return SecurityEventObjectLifecycleEnum.AMENDMENT;
case VALIDATE:
return SecurityEventObjectLifecycleEnum.VERIFICATION;
case VREAD:
return SecurityEventObjectLifecycleEnum.ACCESS_OR_USE;
default:
return SecurityEventObjectLifecycleEnum.ACCESS_OR_USE; // access/use catch all
}
} | [
"protected",
"SecurityEventObjectLifecycleEnum",
"mapResourceTypeToSecurityLifecycle",
"(",
"ca",
".",
"uhn",
".",
"fhir",
".",
"rest",
".",
"api",
".",
"RestOperationTypeEnum",
"theRestfulOperationTypeEnum",
")",
"{",
"if",
"(",
"theRestfulOperationTypeEnum",
"==",
"null",
")",
"return",
"null",
";",
"switch",
"(",
"theRestfulOperationTypeEnum",
")",
"{",
"case",
"READ",
":",
"return",
"SecurityEventObjectLifecycleEnum",
".",
"ACCESS_OR_USE",
";",
"case",
"CREATE",
":",
"return",
"SecurityEventObjectLifecycleEnum",
".",
"ORIGINATION_OR_CREATION",
";",
"case",
"DELETE",
":",
"return",
"SecurityEventObjectLifecycleEnum",
".",
"LOGICAL_DELETION",
";",
"case",
"HISTORY_INSTANCE",
":",
"return",
"SecurityEventObjectLifecycleEnum",
".",
"ACCESS_OR_USE",
";",
"case",
"HISTORY_TYPE",
":",
"return",
"SecurityEventObjectLifecycleEnum",
".",
"ACCESS_OR_USE",
";",
"case",
"SEARCH_TYPE",
":",
"return",
"SecurityEventObjectLifecycleEnum",
".",
"ACCESS_OR_USE",
";",
"case",
"UPDATE",
":",
"return",
"SecurityEventObjectLifecycleEnum",
".",
"AMENDMENT",
";",
"case",
"VALIDATE",
":",
"return",
"SecurityEventObjectLifecycleEnum",
".",
"VERIFICATION",
";",
"case",
"VREAD",
":",
"return",
"SecurityEventObjectLifecycleEnum",
".",
"ACCESS_OR_USE",
";",
"default",
":",
"return",
"SecurityEventObjectLifecycleEnum",
".",
"ACCESS_OR_USE",
";",
"// access/use catch all",
"}",
"}"
] | Returns the SecurityEventObjectLifecycleEnum corresponding to the specified RestfulOperationTypeEnum
@param theRestfulOperationTypeEnum
the type of operation (Read, Create, Delete, etc)
@return the corresponding SecurityEventObjectLifecycleEnum (Access/Use, Origination/Creation, Logical Deletion,
etc) | [
"Returns",
"the",
"SecurityEventObjectLifecycleEnum",
"corresponding",
"to",
"the",
"specified",
"RestfulOperationTypeEnum"
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-structures-dstu/src/main/java/ca/uhn/fhir/rest/server/interceptor/AuditingInterceptor.java#L484-L509 |
22,517 | jamesagnew/hapi-fhir | hapi-fhir-structures-dstu/src/main/java/ca/uhn/fhir/rest/server/interceptor/AuditingInterceptor.java | AuditingInterceptor.addAuditableResource | public void addAuditableResource(String resourceType, Class<? extends IResourceAuditor<? extends IResource>> auditableResource) {
if (myAuditableResources == null)
myAuditableResources = new HashMap<String, Class<? extends IResourceAuditor<? extends IResource>>>();
myAuditableResources.put(resourceType, auditableResource);
} | java | public void addAuditableResource(String resourceType, Class<? extends IResourceAuditor<? extends IResource>> auditableResource) {
if (myAuditableResources == null)
myAuditableResources = new HashMap<String, Class<? extends IResourceAuditor<? extends IResource>>>();
myAuditableResources.put(resourceType, auditableResource);
} | [
"public",
"void",
"addAuditableResource",
"(",
"String",
"resourceType",
",",
"Class",
"<",
"?",
"extends",
"IResourceAuditor",
"<",
"?",
"extends",
"IResource",
">",
">",
"auditableResource",
")",
"{",
"if",
"(",
"myAuditableResources",
"==",
"null",
")",
"myAuditableResources",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Class",
"<",
"?",
"extends",
"IResourceAuditor",
"<",
"?",
"extends",
"IResource",
">",
">",
">",
"(",
")",
";",
"myAuditableResources",
".",
"put",
"(",
"resourceType",
",",
"auditableResource",
")",
";",
"}"
] | Add a type of auditable resource and its auditor to this AuditingInterceptor's resource map
@param resourceType
the type of resource to be audited (Patient, Encounter, etc)
@param auditableResource
an implementation of IResourceAuditor that can audit resources of the given type | [
"Add",
"a",
"type",
"of",
"auditable",
"resource",
"and",
"its",
"auditor",
"to",
"this",
"AuditingInterceptor",
"s",
"resource",
"map"
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-structures-dstu/src/main/java/ca/uhn/fhir/rest/server/interceptor/AuditingInterceptor.java#L549-L553 |
22,518 | jamesagnew/hapi-fhir | hapi-fhir-base/src/main/java/ca/uhn/fhir/validation/ValidationResult.java | ValidationResult.toOperationOutcome | public IBaseOperationOutcome toOperationOutcome() {
IBaseOperationOutcome oo = (IBaseOperationOutcome) myCtx.getResourceDefinition("OperationOutcome").newInstance();
populateOperationOutcome(oo);
return oo;
} | java | public IBaseOperationOutcome toOperationOutcome() {
IBaseOperationOutcome oo = (IBaseOperationOutcome) myCtx.getResourceDefinition("OperationOutcome").newInstance();
populateOperationOutcome(oo);
return oo;
} | [
"public",
"IBaseOperationOutcome",
"toOperationOutcome",
"(",
")",
"{",
"IBaseOperationOutcome",
"oo",
"=",
"(",
"IBaseOperationOutcome",
")",
"myCtx",
".",
"getResourceDefinition",
"(",
"\"OperationOutcome\"",
")",
".",
"newInstance",
"(",
")",
";",
"populateOperationOutcome",
"(",
"oo",
")",
";",
"return",
"oo",
";",
"}"
] | Create an OperationOutcome resource which contains all of the messages found as a result of this validation | [
"Create",
"an",
"OperationOutcome",
"resource",
"which",
"contains",
"all",
"of",
"the",
"messages",
"found",
"as",
"a",
"result",
"of",
"this",
"validation"
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-base/src/main/java/ca/uhn/fhir/validation/ValidationResult.java#L103-L107 |
22,519 | jamesagnew/hapi-fhir | hapi-fhir-base/src/main/java/ca/uhn/fhir/validation/ValidationResult.java | ValidationResult.populateOperationOutcome | public void populateOperationOutcome(IBaseOperationOutcome theOperationOutcome) {
for (SingleValidationMessage next : myMessages) {
String location;
if (isNotBlank(next.getLocationString())) {
location = next.getLocationString();
} else if (next.getLocationLine() != null || next.getLocationCol() != null) {
location = "Line[" + next.getLocationLine() + "] Col[" + next.getLocationCol() + "]";
} else {
location = null;
}
String severity = next.getSeverity() != null ? next.getSeverity().getCode() : null;
OperationOutcomeUtil.addIssue(myCtx, theOperationOutcome, severity, next.getMessage(), location, Constants.OO_INFOSTATUS_PROCESSING);
}
if (myMessages.isEmpty()) {
String message = myCtx.getLocalizer().getMessage(ValidationResult.class, "noIssuesDetected");
OperationOutcomeUtil.addIssue(myCtx, theOperationOutcome, "information", message, null, "informational");
}
} | java | public void populateOperationOutcome(IBaseOperationOutcome theOperationOutcome) {
for (SingleValidationMessage next : myMessages) {
String location;
if (isNotBlank(next.getLocationString())) {
location = next.getLocationString();
} else if (next.getLocationLine() != null || next.getLocationCol() != null) {
location = "Line[" + next.getLocationLine() + "] Col[" + next.getLocationCol() + "]";
} else {
location = null;
}
String severity = next.getSeverity() != null ? next.getSeverity().getCode() : null;
OperationOutcomeUtil.addIssue(myCtx, theOperationOutcome, severity, next.getMessage(), location, Constants.OO_INFOSTATUS_PROCESSING);
}
if (myMessages.isEmpty()) {
String message = myCtx.getLocalizer().getMessage(ValidationResult.class, "noIssuesDetected");
OperationOutcomeUtil.addIssue(myCtx, theOperationOutcome, "information", message, null, "informational");
}
} | [
"public",
"void",
"populateOperationOutcome",
"(",
"IBaseOperationOutcome",
"theOperationOutcome",
")",
"{",
"for",
"(",
"SingleValidationMessage",
"next",
":",
"myMessages",
")",
"{",
"String",
"location",
";",
"if",
"(",
"isNotBlank",
"(",
"next",
".",
"getLocationString",
"(",
")",
")",
")",
"{",
"location",
"=",
"next",
".",
"getLocationString",
"(",
")",
";",
"}",
"else",
"if",
"(",
"next",
".",
"getLocationLine",
"(",
")",
"!=",
"null",
"||",
"next",
".",
"getLocationCol",
"(",
")",
"!=",
"null",
")",
"{",
"location",
"=",
"\"Line[\"",
"+",
"next",
".",
"getLocationLine",
"(",
")",
"+",
"\"] Col[\"",
"+",
"next",
".",
"getLocationCol",
"(",
")",
"+",
"\"]\"",
";",
"}",
"else",
"{",
"location",
"=",
"null",
";",
"}",
"String",
"severity",
"=",
"next",
".",
"getSeverity",
"(",
")",
"!=",
"null",
"?",
"next",
".",
"getSeverity",
"(",
")",
".",
"getCode",
"(",
")",
":",
"null",
";",
"OperationOutcomeUtil",
".",
"addIssue",
"(",
"myCtx",
",",
"theOperationOutcome",
",",
"severity",
",",
"next",
".",
"getMessage",
"(",
")",
",",
"location",
",",
"Constants",
".",
"OO_INFOSTATUS_PROCESSING",
")",
";",
"}",
"if",
"(",
"myMessages",
".",
"isEmpty",
"(",
")",
")",
"{",
"String",
"message",
"=",
"myCtx",
".",
"getLocalizer",
"(",
")",
".",
"getMessage",
"(",
"ValidationResult",
".",
"class",
",",
"\"noIssuesDetected\"",
")",
";",
"OperationOutcomeUtil",
".",
"addIssue",
"(",
"myCtx",
",",
"theOperationOutcome",
",",
"\"information\"",
",",
"message",
",",
"null",
",",
"\"informational\"",
")",
";",
"}",
"}"
] | Populate an operation outcome with the results of the validation | [
"Populate",
"an",
"operation",
"outcome",
"with",
"the",
"results",
"of",
"the",
"validation"
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-base/src/main/java/ca/uhn/fhir/validation/ValidationResult.java#L112-L130 |
22,520 | jamesagnew/hapi-fhir | hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoQuestionnaireResponseDstu2.java | FhirResourceDaoQuestionnaireResponseDstu2.initialize | @PostConstruct
public void initialize() {
try {
Class.forName("org.hl7.fhir.instance.model.QuestionnaireResponse");
myValidateResponses = true;
} catch (ClassNotFoundException e) {
myValidateResponses = Boolean.FALSE;
}
} | java | @PostConstruct
public void initialize() {
try {
Class.forName("org.hl7.fhir.instance.model.QuestionnaireResponse");
myValidateResponses = true;
} catch (ClassNotFoundException e) {
myValidateResponses = Boolean.FALSE;
}
} | [
"@",
"PostConstruct",
"public",
"void",
"initialize",
"(",
")",
"{",
"try",
"{",
"Class",
".",
"forName",
"(",
"\"org.hl7.fhir.instance.model.QuestionnaireResponse\"",
")",
";",
"myValidateResponses",
"=",
"true",
";",
"}",
"catch",
"(",
"ClassNotFoundException",
"e",
")",
"{",
"myValidateResponses",
"=",
"Boolean",
".",
"FALSE",
";",
"}",
"}"
] | Initialize the bean | [
"Initialize",
"the",
"bean"
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoQuestionnaireResponseDstu2.java#L61-L69 |
22,521 | jamesagnew/hapi-fhir | hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/formats/JsonParserBase.java | JsonParserBase.compose | public void compose(JsonCreator writer, Resource resource) throws IOException {
json = writer;
composeResource(resource);
} | java | public void compose(JsonCreator writer, Resource resource) throws IOException {
json = writer;
composeResource(resource);
} | [
"public",
"void",
"compose",
"(",
"JsonCreator",
"writer",
",",
"Resource",
"resource",
")",
"throws",
"IOException",
"{",
"json",
"=",
"writer",
";",
"composeResource",
"(",
"resource",
")",
";",
"}"
] | Compose a resource using a pre-existing JsonWriter
@throws IOException | [
"Compose",
"a",
"resource",
"using",
"a",
"pre",
"-",
"existing",
"JsonWriter"
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/formats/JsonParserBase.java#L131-L134 |
22,522 | jamesagnew/hapi-fhir | hapi-fhir-utilities/src/main/java/org/hl7/fhir/utilities/xml/XMLUtil.java | XMLUtil.escapeXML | public static String escapeXML(String rawContent, String charset, boolean isNoLines) {
if (rawContent == null)
return "";
else {
StringBuffer sb = new StringBuffer();
for (int i = 0; i < rawContent.length(); i++) {
char ch = rawContent.charAt(i);
if (ch == '\'')
sb.append("'");
else if (ch == '&')
sb.append("&");
else if (ch == '"')
sb.append(""");
else if (ch == '<')
sb.append("<");
else if (ch == '>')
sb.append(">");
else if (ch > '~' && charset != null && charSetImpliesAscii(charset))
// TODO - why is hashcode the only way to get the unicode number for the character
// in jre 5.0?
sb.append("&#x"+Integer.toHexString(ch).toUpperCase()+";");
else if (isNoLines) {
if (ch == '\r')
sb.append("
");
else if (ch != '\n')
sb.append(ch);
}
else
sb.append(ch);
}
return sb.toString();
}
} | java | public static String escapeXML(String rawContent, String charset, boolean isNoLines) {
if (rawContent == null)
return "";
else {
StringBuffer sb = new StringBuffer();
for (int i = 0; i < rawContent.length(); i++) {
char ch = rawContent.charAt(i);
if (ch == '\'')
sb.append("'");
else if (ch == '&')
sb.append("&");
else if (ch == '"')
sb.append(""");
else if (ch == '<')
sb.append("<");
else if (ch == '>')
sb.append(">");
else if (ch > '~' && charset != null && charSetImpliesAscii(charset))
// TODO - why is hashcode the only way to get the unicode number for the character
// in jre 5.0?
sb.append("&#x"+Integer.toHexString(ch).toUpperCase()+";");
else if (isNoLines) {
if (ch == '\r')
sb.append("
");
else if (ch != '\n')
sb.append(ch);
}
else
sb.append(ch);
}
return sb.toString();
}
} | [
"public",
"static",
"String",
"escapeXML",
"(",
"String",
"rawContent",
",",
"String",
"charset",
",",
"boolean",
"isNoLines",
")",
"{",
"if",
"(",
"rawContent",
"==",
"null",
")",
"return",
"\"\"",
";",
"else",
"{",
"StringBuffer",
"sb",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"rawContent",
".",
"length",
"(",
")",
";",
"i",
"++",
")",
"{",
"char",
"ch",
"=",
"rawContent",
".",
"charAt",
"(",
"i",
")",
";",
"if",
"(",
"ch",
"==",
"'",
"'",
")",
"sb",
".",
"append",
"(",
"\"'\"",
")",
";",
"else",
"if",
"(",
"ch",
"==",
"'",
"'",
")",
"sb",
".",
"append",
"(",
"\"&\"",
")",
";",
"else",
"if",
"(",
"ch",
"==",
"'",
"'",
")",
"sb",
".",
"append",
"(",
"\""\"",
")",
";",
"else",
"if",
"(",
"ch",
"==",
"'",
"'",
")",
"sb",
".",
"append",
"(",
"\"<\"",
")",
";",
"else",
"if",
"(",
"ch",
"==",
"'",
"'",
")",
"sb",
".",
"append",
"(",
"\">\"",
")",
";",
"else",
"if",
"(",
"ch",
">",
"'",
"'",
"&&",
"charset",
"!=",
"null",
"&&",
"charSetImpliesAscii",
"(",
"charset",
")",
")",
"// TODO - why is hashcode the only way to get the unicode number for the character\r",
"// in jre 5.0?\r",
"sb",
".",
"append",
"(",
"\"&#x\"",
"+",
"Integer",
".",
"toHexString",
"(",
"ch",
")",
".",
"toUpperCase",
"(",
")",
"+",
"\";\"",
")",
";",
"else",
"if",
"(",
"isNoLines",
")",
"{",
"if",
"(",
"ch",
"==",
"'",
"'",
")",
"sb",
".",
"append",
"(",
"\"
\"",
")",
";",
"else",
"if",
"(",
"ch",
"!=",
"'",
"'",
")",
"sb",
".",
"append",
"(",
"ch",
")",
";",
"}",
"else",
"sb",
".",
"append",
"(",
"ch",
")",
";",
"}",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}",
"}"
] | Converts the raw characters to XML escape characters.
@param rawContent
@param charset Null when charset is not known, so we assume it's unicode
@param isNoLines
@return escape string | [
"Converts",
"the",
"raw",
"characters",
"to",
"XML",
"escape",
"characters",
"."
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-utilities/src/main/java/org/hl7/fhir/utilities/xml/XMLUtil.java#L265-L298 |
22,523 | jamesagnew/hapi-fhir | hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/Base.java | Base.children | public List<Property> children() {
List<Property> result = new ArrayList<Property>();
listChildren(result);
return result;
} | java | public List<Property> children() {
List<Property> result = new ArrayList<Property>();
listChildren(result);
return result;
} | [
"public",
"List",
"<",
"Property",
">",
"children",
"(",
")",
"{",
"List",
"<",
"Property",
">",
"result",
"=",
"new",
"ArrayList",
"<",
"Property",
">",
"(",
")",
";",
"listChildren",
"(",
"result",
")",
";",
"return",
"result",
";",
"}"
] | Supports iterating the children elements in some generic processor or browser
All defined children will be listed, even if they have no value on this instance
Note that the actual content of primitive or xhtml elements is not iterated explicitly.
To find these, the processing code must recognise the element as a primitive, typecast
the value to a {@link Type}, and examine the value
@return a list of all the children defined for this element | [
"Supports",
"iterating",
"the",
"children",
"elements",
"in",
"some",
"generic",
"processor",
"or",
"browser",
"All",
"defined",
"children",
"will",
"be",
"listed",
"even",
"if",
"they",
"have",
"no",
"value",
"on",
"this",
"instance"
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/Base.java#L149-L153 |
22,524 | jamesagnew/hapi-fhir | hapi-fhir-base/src/main/java/ca/uhn/fhir/validation/FhirValidator.java | FhirValidator.registerValidatorModule | public synchronized void registerValidatorModule(IValidatorModule theValidator) {
Validate.notNull(theValidator, "theValidator must not be null");
ArrayList<IValidatorModule> newValidators = new ArrayList<IValidatorModule>(myValidators.size() + 1);
newValidators.addAll(myValidators);
newValidators.add(theValidator);
myValidators = newValidators;
} | java | public synchronized void registerValidatorModule(IValidatorModule theValidator) {
Validate.notNull(theValidator, "theValidator must not be null");
ArrayList<IValidatorModule> newValidators = new ArrayList<IValidatorModule>(myValidators.size() + 1);
newValidators.addAll(myValidators);
newValidators.add(theValidator);
myValidators = newValidators;
} | [
"public",
"synchronized",
"void",
"registerValidatorModule",
"(",
"IValidatorModule",
"theValidator",
")",
"{",
"Validate",
".",
"notNull",
"(",
"theValidator",
",",
"\"theValidator must not be null\"",
")",
";",
"ArrayList",
"<",
"IValidatorModule",
">",
"newValidators",
"=",
"new",
"ArrayList",
"<",
"IValidatorModule",
">",
"(",
"myValidators",
".",
"size",
"(",
")",
"+",
"1",
")",
";",
"newValidators",
".",
"addAll",
"(",
"myValidators",
")",
";",
"newValidators",
".",
"add",
"(",
"theValidator",
")",
";",
"myValidators",
"=",
"newValidators",
";",
"}"
] | Add a new validator module to this validator. You may register as many modules as you like at any time.
@param theValidator
The validator module. Must not be null. | [
"Add",
"a",
"new",
"validator",
"module",
"to",
"this",
"validator",
".",
"You",
"may",
"register",
"as",
"many",
"modules",
"as",
"you",
"like",
"at",
"any",
"time",
"."
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-base/src/main/java/ca/uhn/fhir/validation/FhirValidator.java#L114-L121 |
22,525 | jamesagnew/hapi-fhir | hapi-fhir-base/src/main/java/ca/uhn/fhir/validation/FhirValidator.java | FhirValidator.unregisterValidatorModule | public synchronized void unregisterValidatorModule(IValidatorModule theValidator) {
Validate.notNull(theValidator, "theValidator must not be null");
ArrayList<IValidatorModule> newValidators = new ArrayList<IValidatorModule>(myValidators.size() + 1);
newValidators.addAll(myValidators);
newValidators.remove(theValidator);
myValidators = newValidators;
} | java | public synchronized void unregisterValidatorModule(IValidatorModule theValidator) {
Validate.notNull(theValidator, "theValidator must not be null");
ArrayList<IValidatorModule> newValidators = new ArrayList<IValidatorModule>(myValidators.size() + 1);
newValidators.addAll(myValidators);
newValidators.remove(theValidator);
myValidators = newValidators;
} | [
"public",
"synchronized",
"void",
"unregisterValidatorModule",
"(",
"IValidatorModule",
"theValidator",
")",
"{",
"Validate",
".",
"notNull",
"(",
"theValidator",
",",
"\"theValidator must not be null\"",
")",
";",
"ArrayList",
"<",
"IValidatorModule",
">",
"newValidators",
"=",
"new",
"ArrayList",
"<",
"IValidatorModule",
">",
"(",
"myValidators",
".",
"size",
"(",
")",
"+",
"1",
")",
";",
"newValidators",
".",
"addAll",
"(",
"myValidators",
")",
";",
"newValidators",
".",
"remove",
"(",
"theValidator",
")",
";",
"myValidators",
"=",
"newValidators",
";",
"}"
] | Removes a validator module from this validator. You may register as many modules as you like, and remove them at any time.
@param theValidator
The validator module. Must not be null. | [
"Removes",
"a",
"validator",
"module",
"from",
"this",
"validator",
".",
"You",
"may",
"register",
"as",
"many",
"modules",
"as",
"you",
"like",
"and",
"remove",
"them",
"at",
"any",
"time",
"."
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-base/src/main/java/ca/uhn/fhir/validation/FhirValidator.java#L157-L164 |
22,526 | jamesagnew/hapi-fhir | hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/subscription/dbmatcher/DaoSubscriptionMatcher.java | DaoSubscriptionMatcher.performSearch | private IBundleProvider performSearch(String theCriteria) {
IFhirResourceDao<?> subscriptionDao = myDaoRegistry.getSubscriptionDao();
RuntimeResourceDefinition responseResourceDef = subscriptionDao.validateCriteriaAndReturnResourceDefinition(theCriteria);
SearchParameterMap responseCriteriaUrl = myMatchUrlService.translateMatchUrl(theCriteria, responseResourceDef);
IFhirResourceDao<? extends IBaseResource> responseDao = myDaoRegistry.getResourceDao(responseResourceDef.getImplementingClass());
responseCriteriaUrl.setLoadSynchronousUpTo(1);
TransactionTemplate txTemplate = new TransactionTemplate(myTxManager);
txTemplate.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW);
return txTemplate.execute(t -> responseDao.search(responseCriteriaUrl));
} | java | private IBundleProvider performSearch(String theCriteria) {
IFhirResourceDao<?> subscriptionDao = myDaoRegistry.getSubscriptionDao();
RuntimeResourceDefinition responseResourceDef = subscriptionDao.validateCriteriaAndReturnResourceDefinition(theCriteria);
SearchParameterMap responseCriteriaUrl = myMatchUrlService.translateMatchUrl(theCriteria, responseResourceDef);
IFhirResourceDao<? extends IBaseResource> responseDao = myDaoRegistry.getResourceDao(responseResourceDef.getImplementingClass());
responseCriteriaUrl.setLoadSynchronousUpTo(1);
TransactionTemplate txTemplate = new TransactionTemplate(myTxManager);
txTemplate.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW);
return txTemplate.execute(t -> responseDao.search(responseCriteriaUrl));
} | [
"private",
"IBundleProvider",
"performSearch",
"(",
"String",
"theCriteria",
")",
"{",
"IFhirResourceDao",
"<",
"?",
">",
"subscriptionDao",
"=",
"myDaoRegistry",
".",
"getSubscriptionDao",
"(",
")",
";",
"RuntimeResourceDefinition",
"responseResourceDef",
"=",
"subscriptionDao",
".",
"validateCriteriaAndReturnResourceDefinition",
"(",
"theCriteria",
")",
";",
"SearchParameterMap",
"responseCriteriaUrl",
"=",
"myMatchUrlService",
".",
"translateMatchUrl",
"(",
"theCriteria",
",",
"responseResourceDef",
")",
";",
"IFhirResourceDao",
"<",
"?",
"extends",
"IBaseResource",
">",
"responseDao",
"=",
"myDaoRegistry",
".",
"getResourceDao",
"(",
"responseResourceDef",
".",
"getImplementingClass",
"(",
")",
")",
";",
"responseCriteriaUrl",
".",
"setLoadSynchronousUpTo",
"(",
"1",
")",
";",
"TransactionTemplate",
"txTemplate",
"=",
"new",
"TransactionTemplate",
"(",
"myTxManager",
")",
";",
"txTemplate",
".",
"setPropagationBehavior",
"(",
"TransactionDefinition",
".",
"PROPAGATION_REQUIRES_NEW",
")",
";",
"return",
"txTemplate",
".",
"execute",
"(",
"t",
"->",
"responseDao",
".",
"search",
"(",
"responseCriteriaUrl",
")",
")",
";",
"}"
] | Search based on a query criteria | [
"Search",
"based",
"on",
"a",
"query",
"criteria"
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/subscription/dbmatcher/DaoSubscriptionMatcher.java#L74-L86 |
22,527 | jamesagnew/hapi-fhir | hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/model/ProfilingWrapper.java | ProfilingWrapper.wrap | private ProfilingWrapper wrap(Base object) {
ProfilingWrapper res = new ProfilingWrapper(context, resource, object);
res.cache = cache;
res.engine = engine;
return res;
} | java | private ProfilingWrapper wrap(Base object) {
ProfilingWrapper res = new ProfilingWrapper(context, resource, object);
res.cache = cache;
res.engine = engine;
return res;
} | [
"private",
"ProfilingWrapper",
"wrap",
"(",
"Base",
"object",
")",
"{",
"ProfilingWrapper",
"res",
"=",
"new",
"ProfilingWrapper",
"(",
"context",
",",
"resource",
",",
"object",
")",
";",
"res",
".",
"cache",
"=",
"cache",
";",
"res",
".",
"engine",
"=",
"engine",
";",
"return",
"res",
";",
"}"
] | This is a convenient called for
@param object
@return | [
"This",
"is",
"a",
"convenient",
"called",
"for"
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/model/ProfilingWrapper.java#L50-L55 |
22,528 | jamesagnew/hapi-fhir | hapi-fhir-validation/src/main/java/org/hl7/fhir/instance/validation/InstanceValidator.java | InstanceValidator.start | private void start(List<ValidationMessage> errors, WrapperElement resource, WrapperElement element, StructureDefinition profile, NodeStack stack) throws FHIRException {
// profile is valid, and matches the resource name
if (rule(errors, IssueType.STRUCTURE, element.line(), element.col(), stack.getLiteralPath(), profile.hasSnapshot(),
"StructureDefinition has no snapshot - validation is against the snapshot, so it must be provided")) {
validateElement(errors, profile, profile.getSnapshot().getElement().get(0), null, null, resource, element, element.getName(), stack, false);
checkDeclaredProfiles(errors, resource, element, stack);
// specific known special validations
if (element.getResourceType().equals("Bundle"))
validateBundle(errors, element, stack);
if (element.getResourceType().equals("Observation"))
validateObservation(errors, element, stack);
}
} | java | private void start(List<ValidationMessage> errors, WrapperElement resource, WrapperElement element, StructureDefinition profile, NodeStack stack) throws FHIRException {
// profile is valid, and matches the resource name
if (rule(errors, IssueType.STRUCTURE, element.line(), element.col(), stack.getLiteralPath(), profile.hasSnapshot(),
"StructureDefinition has no snapshot - validation is against the snapshot, so it must be provided")) {
validateElement(errors, profile, profile.getSnapshot().getElement().get(0), null, null, resource, element, element.getName(), stack, false);
checkDeclaredProfiles(errors, resource, element, stack);
// specific known special validations
if (element.getResourceType().equals("Bundle"))
validateBundle(errors, element, stack);
if (element.getResourceType().equals("Observation"))
validateObservation(errors, element, stack);
}
} | [
"private",
"void",
"start",
"(",
"List",
"<",
"ValidationMessage",
">",
"errors",
",",
"WrapperElement",
"resource",
",",
"WrapperElement",
"element",
",",
"StructureDefinition",
"profile",
",",
"NodeStack",
"stack",
")",
"throws",
"FHIRException",
"{",
"// profile is valid, and matches the resource name",
"if",
"(",
"rule",
"(",
"errors",
",",
"IssueType",
".",
"STRUCTURE",
",",
"element",
".",
"line",
"(",
")",
",",
"element",
".",
"col",
"(",
")",
",",
"stack",
".",
"getLiteralPath",
"(",
")",
",",
"profile",
".",
"hasSnapshot",
"(",
")",
",",
"\"StructureDefinition has no snapshot - validation is against the snapshot, so it must be provided\"",
")",
")",
"{",
"validateElement",
"(",
"errors",
",",
"profile",
",",
"profile",
".",
"getSnapshot",
"(",
")",
".",
"getElement",
"(",
")",
".",
"get",
"(",
"0",
")",
",",
"null",
",",
"null",
",",
"resource",
",",
"element",
",",
"element",
".",
"getName",
"(",
")",
",",
"stack",
",",
"false",
")",
";",
"checkDeclaredProfiles",
"(",
"errors",
",",
"resource",
",",
"element",
",",
"stack",
")",
";",
"// specific known special validations",
"if",
"(",
"element",
".",
"getResourceType",
"(",
")",
".",
"equals",
"(",
"\"Bundle\"",
")",
")",
"validateBundle",
"(",
"errors",
",",
"element",
",",
"stack",
")",
";",
"if",
"(",
"element",
".",
"getResourceType",
"(",
")",
".",
"equals",
"(",
"\"Observation\"",
")",
")",
"validateObservation",
"(",
"errors",
",",
"element",
",",
"stack",
")",
";",
"}",
"}"
] | the instance validator had no issues against the base resource profile | [
"the",
"instance",
"validator",
"had",
"no",
"issues",
"against",
"the",
"base",
"resource",
"profile"
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-validation/src/main/java/org/hl7/fhir/instance/validation/InstanceValidator.java#L1251-L1265 |
22,529 | jamesagnew/hapi-fhir | hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProvider.java | AbstractJaxRsResourceProvider.create | @POST
public Response create(final String resource)
throws IOException {
return execute(getResourceRequest(RequestTypeEnum.POST, RestOperationTypeEnum.CREATE).resource(resource));
} | java | @POST
public Response create(final String resource)
throws IOException {
return execute(getResourceRequest(RequestTypeEnum.POST, RestOperationTypeEnum.CREATE).resource(resource));
} | [
"@",
"POST",
"public",
"Response",
"create",
"(",
"final",
"String",
"resource",
")",
"throws",
"IOException",
"{",
"return",
"execute",
"(",
"getResourceRequest",
"(",
"RequestTypeEnum",
".",
"POST",
",",
"RestOperationTypeEnum",
".",
"CREATE",
")",
".",
"resource",
"(",
"resource",
")",
")",
";",
"}"
] | Create a new resource with a server assigned id
@param resource the body of the post method containing resource being created in a xml/json form
@return the response
@see <a href="https://www.hl7.org/fhir/http.html#create">https://www.hl7. org/fhir/http.html#create</a> | [
"Create",
"a",
"new",
"resource",
"with",
"a",
"server",
"assigned",
"id"
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProvider.java#L131-L135 |
22,530 | jamesagnew/hapi-fhir | hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProvider.java | AbstractJaxRsResourceProvider.conditionalUpdate | @PUT
public Response conditionalUpdate(final String resource)
throws IOException {
return execute(getResourceRequest(RequestTypeEnum.PUT, RestOperationTypeEnum.UPDATE).resource(resource));
} | java | @PUT
public Response conditionalUpdate(final String resource)
throws IOException {
return execute(getResourceRequest(RequestTypeEnum.PUT, RestOperationTypeEnum.UPDATE).resource(resource));
} | [
"@",
"PUT",
"public",
"Response",
"conditionalUpdate",
"(",
"final",
"String",
"resource",
")",
"throws",
"IOException",
"{",
"return",
"execute",
"(",
"getResourceRequest",
"(",
"RequestTypeEnum",
".",
"PUT",
",",
"RestOperationTypeEnum",
".",
"UPDATE",
")",
".",
"resource",
"(",
"resource",
")",
")",
";",
"}"
] | Update an existing resource based on the given condition
@param resource the body contents for the put method
@return the response
@see <a href="https://www.hl7.org/fhir/http.html#update">https://www.hl7.org/fhir/http.html#update</a> | [
"Update",
"an",
"existing",
"resource",
"based",
"on",
"the",
"given",
"condition"
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProvider.java#L168-L172 |
22,531 | jamesagnew/hapi-fhir | hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProvider.java | AbstractJaxRsResourceProvider.delete | @DELETE
public Response delete()
throws IOException {
return execute(getResourceRequest(RequestTypeEnum.DELETE, RestOperationTypeEnum.DELETE));
} | java | @DELETE
public Response delete()
throws IOException {
return execute(getResourceRequest(RequestTypeEnum.DELETE, RestOperationTypeEnum.DELETE));
} | [
"@",
"DELETE",
"public",
"Response",
"delete",
"(",
")",
"throws",
"IOException",
"{",
"return",
"execute",
"(",
"getResourceRequest",
"(",
"RequestTypeEnum",
".",
"DELETE",
",",
"RestOperationTypeEnum",
".",
"DELETE",
")",
")",
";",
"}"
] | Delete a resource based on the given condition
@return the response
@see <a href="https://www.hl7.org/fhir/http.html#delete">https://www.hl7.org/fhir/http.html#delete</a> | [
"Delete",
"a",
"resource",
"based",
"on",
"the",
"given",
"condition"
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProvider.java#L195-L199 |
22,532 | jamesagnew/hapi-fhir | hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProvider.java | AbstractJaxRsResourceProvider.delete | @DELETE
@Path("/{id}")
public Response delete(@PathParam("id") final String id)
throws IOException {
return execute(getResourceRequest(RequestTypeEnum.DELETE, RestOperationTypeEnum.DELETE).id(id));
} | java | @DELETE
@Path("/{id}")
public Response delete(@PathParam("id") final String id)
throws IOException {
return execute(getResourceRequest(RequestTypeEnum.DELETE, RestOperationTypeEnum.DELETE).id(id));
} | [
"@",
"DELETE",
"@",
"Path",
"(",
"\"/{id}\"",
")",
"public",
"Response",
"delete",
"(",
"@",
"PathParam",
"(",
"\"id\"",
")",
"final",
"String",
"id",
")",
"throws",
"IOException",
"{",
"return",
"execute",
"(",
"getResourceRequest",
"(",
"RequestTypeEnum",
".",
"DELETE",
",",
"RestOperationTypeEnum",
".",
"DELETE",
")",
".",
"id",
"(",
"id",
")",
")",
";",
"}"
] | Delete a resource
@param id the id of the resource to delete
@return the response
@see <a href="https://www.hl7.org/fhir/http.html#delete">https://www.hl7.org/fhir/http.html#delete</a> | [
"Delete",
"a",
"resource"
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProvider.java#L208-L213 |
22,533 | jamesagnew/hapi-fhir | hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProvider.java | AbstractJaxRsResourceProvider.find | @GET
@Path("/{id}")
public Response find(@PathParam("id") final String id)
throws IOException {
return execute(getResourceRequest(RequestTypeEnum.GET, RestOperationTypeEnum.READ).id(id));
} | java | @GET
@Path("/{id}")
public Response find(@PathParam("id") final String id)
throws IOException {
return execute(getResourceRequest(RequestTypeEnum.GET, RestOperationTypeEnum.READ).id(id));
} | [
"@",
"GET",
"@",
"Path",
"(",
"\"/{id}\"",
")",
"public",
"Response",
"find",
"(",
"@",
"PathParam",
"(",
"\"id\"",
")",
"final",
"String",
"id",
")",
"throws",
"IOException",
"{",
"return",
"execute",
"(",
"getResourceRequest",
"(",
"RequestTypeEnum",
".",
"GET",
",",
"RestOperationTypeEnum",
".",
"READ",
")",
".",
"id",
"(",
"id",
")",
")",
";",
"}"
] | Read the current state of the resource
@param id the id of the resource to read
@return the response
@see <a href="https://www.hl7.org/fhir/http.html#read">https://www.hl7.org/fhir/http.html#read</a> | [
"Read",
"the",
"current",
"state",
"of",
"the",
"resource"
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProvider.java#L222-L227 |
22,534 | jamesagnew/hapi-fhir | hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProvider.java | AbstractJaxRsResourceProvider.customOperation | protected Response customOperation(final String resource, final RequestTypeEnum requestType, final String id,
final String operationName, final RestOperationTypeEnum operationType)
throws IOException {
final Builder request = getResourceRequest(requestType, operationType).resource(resource).id(id);
return execute(request, operationName);
} | java | protected Response customOperation(final String resource, final RequestTypeEnum requestType, final String id,
final String operationName, final RestOperationTypeEnum operationType)
throws IOException {
final Builder request = getResourceRequest(requestType, operationType).resource(resource).id(id);
return execute(request, operationName);
} | [
"protected",
"Response",
"customOperation",
"(",
"final",
"String",
"resource",
",",
"final",
"RequestTypeEnum",
"requestType",
",",
"final",
"String",
"id",
",",
"final",
"String",
"operationName",
",",
"final",
"RestOperationTypeEnum",
"operationType",
")",
"throws",
"IOException",
"{",
"final",
"Builder",
"request",
"=",
"getResourceRequest",
"(",
"requestType",
",",
"operationType",
")",
".",
"resource",
"(",
"resource",
")",
".",
"id",
"(",
"id",
")",
";",
"return",
"execute",
"(",
"request",
",",
"operationName",
")",
";",
"}"
] | Execute a custom operation
@param resource the resource to create
@param requestType the type of request
@param id the id of the resource on which to perform the operation
@param operationName the name of the operation to execute
@param operationType the rest operation type
@return the response
@see <a href="https://www.hl7.org/fhir/operations.html">https://www.hl7.org/fhir/operations.html</a> | [
"Execute",
"a",
"custom",
"operation"
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProvider.java#L240-L245 |
22,535 | jamesagnew/hapi-fhir | hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProvider.java | AbstractJaxRsResourceProvider.findHistory | @GET
@Path("/{id}/_history/{version}")
public Response findHistory(@PathParam("id") final String id, @PathParam("version") final String version)
throws IOException {
final Builder theRequest = getResourceRequest(RequestTypeEnum.GET, RestOperationTypeEnum.VREAD).id(id).version(version);
return execute(theRequest);
} | java | @GET
@Path("/{id}/_history/{version}")
public Response findHistory(@PathParam("id") final String id, @PathParam("version") final String version)
throws IOException {
final Builder theRequest = getResourceRequest(RequestTypeEnum.GET, RestOperationTypeEnum.VREAD).id(id).version(version);
return execute(theRequest);
} | [
"@",
"GET",
"@",
"Path",
"(",
"\"/{id}/_history/{version}\"",
")",
"public",
"Response",
"findHistory",
"(",
"@",
"PathParam",
"(",
"\"id\"",
")",
"final",
"String",
"id",
",",
"@",
"PathParam",
"(",
"\"version\"",
")",
"final",
"String",
"version",
")",
"throws",
"IOException",
"{",
"final",
"Builder",
"theRequest",
"=",
"getResourceRequest",
"(",
"RequestTypeEnum",
".",
"GET",
",",
"RestOperationTypeEnum",
".",
"VREAD",
")",
".",
"id",
"(",
"id",
")",
".",
"version",
"(",
"version",
")",
";",
"return",
"execute",
"(",
"theRequest",
")",
";",
"}"
] | Retrieve the update history for a particular resource
@param id the id of the resource
@param version the version of the resource
@return the response
@see <a href="https://www.hl7.org/fhir/http.html#history">https://www.hl7.org/fhir/http.html#history</a> | [
"Retrieve",
"the",
"update",
"history",
"for",
"a",
"particular",
"resource"
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProvider.java#L255-L261 |
22,536 | jamesagnew/hapi-fhir | hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProvider.java | AbstractJaxRsResourceProvider.findCompartment | @GET
@Path("/{id}/{compartment}")
public Response findCompartment(@PathParam("id") final String id, @PathParam("compartment") final String compartment)
throws IOException {
final Builder theRequest = getResourceRequest(RequestTypeEnum.GET, RestOperationTypeEnum.SEARCH_TYPE).id(id).compartment(
compartment);
return execute(theRequest, compartment);
} | java | @GET
@Path("/{id}/{compartment}")
public Response findCompartment(@PathParam("id") final String id, @PathParam("compartment") final String compartment)
throws IOException {
final Builder theRequest = getResourceRequest(RequestTypeEnum.GET, RestOperationTypeEnum.SEARCH_TYPE).id(id).compartment(
compartment);
return execute(theRequest, compartment);
} | [
"@",
"GET",
"@",
"Path",
"(",
"\"/{id}/{compartment}\"",
")",
"public",
"Response",
"findCompartment",
"(",
"@",
"PathParam",
"(",
"\"id\"",
")",
"final",
"String",
"id",
",",
"@",
"PathParam",
"(",
"\"compartment\"",
")",
"final",
"String",
"compartment",
")",
"throws",
"IOException",
"{",
"final",
"Builder",
"theRequest",
"=",
"getResourceRequest",
"(",
"RequestTypeEnum",
".",
"GET",
",",
"RestOperationTypeEnum",
".",
"SEARCH_TYPE",
")",
".",
"id",
"(",
"id",
")",
".",
"compartment",
"(",
"compartment",
")",
";",
"return",
"execute",
"(",
"theRequest",
",",
"compartment",
")",
";",
"}"
] | Compartment Based Access
@param id the resource to which the compartment belongs
@param compartment the compartment
@return the repsonse
@see <a href="https://www.hl7.org/fhir/http.html#search">https://www.hl7.org/fhir/http.html#search</a>
@see <a href="https://www.hl7.org/fhir/compartments.html#compartment">https://www.hl7.org/fhir/compartments.html#compartment</a> | [
"Compartment",
"Based",
"Access"
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProvider.java#L272-L279 |
22,537 | jamesagnew/hapi-fhir | hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProvider.java | AbstractJaxRsResourceProvider.execute | private Response execute(final Builder theRequestBuilder, final String methodKey)
throws IOException {
final JaxRsRequest theRequest = theRequestBuilder.build();
final BaseMethodBinding<?> method = getBinding(theRequest.getRestOperationType(), methodKey);
try {
return (Response) method.invokeServer(this, theRequest);
}
catch (final Throwable theException) {
return handleException(theRequest, theException);
}
} | java | private Response execute(final Builder theRequestBuilder, final String methodKey)
throws IOException {
final JaxRsRequest theRequest = theRequestBuilder.build();
final BaseMethodBinding<?> method = getBinding(theRequest.getRestOperationType(), methodKey);
try {
return (Response) method.invokeServer(this, theRequest);
}
catch (final Throwable theException) {
return handleException(theRequest, theException);
}
} | [
"private",
"Response",
"execute",
"(",
"final",
"Builder",
"theRequestBuilder",
",",
"final",
"String",
"methodKey",
")",
"throws",
"IOException",
"{",
"final",
"JaxRsRequest",
"theRequest",
"=",
"theRequestBuilder",
".",
"build",
"(",
")",
";",
"final",
"BaseMethodBinding",
"<",
"?",
">",
"method",
"=",
"getBinding",
"(",
"theRequest",
".",
"getRestOperationType",
"(",
")",
",",
"methodKey",
")",
";",
"try",
"{",
"return",
"(",
"Response",
")",
"method",
".",
"invokeServer",
"(",
"this",
",",
"theRequest",
")",
";",
"}",
"catch",
"(",
"final",
"Throwable",
"theException",
")",
"{",
"return",
"handleException",
"(",
"theRequest",
",",
"theException",
")",
";",
"}",
"}"
] | Execute the method described by the requestBuilder and methodKey
@param theRequestBuilder the requestBuilder that contains the information about the request
@param methodKey the key determining the method to be executed
@return the response | [
"Execute",
"the",
"method",
"described",
"by",
"the",
"requestBuilder",
"and",
"methodKey"
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProvider.java#L294-L304 |
22,538 | jamesagnew/hapi-fhir | hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProvider.java | AbstractJaxRsResourceProvider.getBinding | protected BaseMethodBinding<?> getBinding(final RestOperationTypeEnum restOperation, final String theBindingKey) {
return getBindings().getBinding(restOperation, theBindingKey);
} | java | protected BaseMethodBinding<?> getBinding(final RestOperationTypeEnum restOperation, final String theBindingKey) {
return getBindings().getBinding(restOperation, theBindingKey);
} | [
"protected",
"BaseMethodBinding",
"<",
"?",
">",
"getBinding",
"(",
"final",
"RestOperationTypeEnum",
"restOperation",
",",
"final",
"String",
"theBindingKey",
")",
"{",
"return",
"getBindings",
"(",
")",
".",
"getBinding",
"(",
"restOperation",
",",
"theBindingKey",
")",
";",
"}"
] | Return the method binding for the given rest operation
@param restOperation the rest operation to retrieve
@param theBindingKey the key determining the method to be executed (needed for e.g. custom operation)
@return | [
"Return",
"the",
"method",
"binding",
"for",
"the",
"given",
"rest",
"operation"
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProvider.java#L324-L326 |
22,539 | jamesagnew/hapi-fhir | hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProvider.java | AbstractJaxRsResourceProvider.getResourceRequest | private Builder getResourceRequest(final RequestTypeEnum requestType, final RestOperationTypeEnum restOperation) {
return getRequest(requestType, restOperation, getResourceType().getSimpleName());
} | java | private Builder getResourceRequest(final RequestTypeEnum requestType, final RestOperationTypeEnum restOperation) {
return getRequest(requestType, restOperation, getResourceType().getSimpleName());
} | [
"private",
"Builder",
"getResourceRequest",
"(",
"final",
"RequestTypeEnum",
"requestType",
",",
"final",
"RestOperationTypeEnum",
"restOperation",
")",
"{",
"return",
"getRequest",
"(",
"requestType",
",",
"restOperation",
",",
"getResourceType",
"(",
")",
".",
"getSimpleName",
"(",
")",
")",
";",
"}"
] | Return the request builder based on the resource name for the server
@param requestType the type of the request
@param restOperation the rest operation type
@return the requestbuilder | [
"Return",
"the",
"request",
"builder",
"based",
"on",
"the",
"resource",
"name",
"for",
"the",
"server"
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProvider.java#L371-L373 |
22,540 | jamesagnew/hapi-fhir | hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/elementmodel/VerticalBarParser.java | Delimiters.reset | public void reset () {
fieldDelimiter = DEFAULT_DELIMITER_FIELD;
componentDelimiter = DEFAULT_DELIMITER_COMPONENT;
subComponentDelimiter = DEFAULT_DELIMITER_SUBCOMPONENT;
repetitionDelimiter = DEFAULT_DELIMITER_REPETITION;
escapeCharacter = DEFAULT_CHARACTER_ESCAPE;
} | java | public void reset () {
fieldDelimiter = DEFAULT_DELIMITER_FIELD;
componentDelimiter = DEFAULT_DELIMITER_COMPONENT;
subComponentDelimiter = DEFAULT_DELIMITER_SUBCOMPONENT;
repetitionDelimiter = DEFAULT_DELIMITER_REPETITION;
escapeCharacter = DEFAULT_CHARACTER_ESCAPE;
} | [
"public",
"void",
"reset",
"(",
")",
"{",
"fieldDelimiter",
"=",
"DEFAULT_DELIMITER_FIELD",
";",
"componentDelimiter",
"=",
"DEFAULT_DELIMITER_COMPONENT",
";",
"subComponentDelimiter",
"=",
"DEFAULT_DELIMITER_SUBCOMPONENT",
";",
"repetitionDelimiter",
"=",
"DEFAULT_DELIMITER_REPETITION",
";",
"escapeCharacter",
"=",
"DEFAULT_CHARACTER_ESCAPE",
";",
"}"
] | reset to default HL7 values | [
"reset",
"to",
"default",
"HL7",
"values"
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/elementmodel/VerticalBarParser.java#L188-L194 |
22,541 | jamesagnew/hapi-fhir | hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/elementmodel/VerticalBarParser.java | Delimiters.check | public void check() throws FHIRException {
rule(componentDelimiter != fieldDelimiter, "Delimiter Error: \""+componentDelimiter+"\" is used for both CPComponent and CPField");
rule(subComponentDelimiter != fieldDelimiter, "Delimiter Error: \""+subComponentDelimiter+"\" is used for both CPSubComponent and CPField");
rule(subComponentDelimiter != componentDelimiter, "Delimiter Error: \""+subComponentDelimiter+"\" is used for both CPSubComponent and CPComponent");
rule(repetitionDelimiter != fieldDelimiter, "Delimiter Error: \""+repetitionDelimiter+"\" is used for both Repetition and CPField");
rule(repetitionDelimiter != componentDelimiter, "Delimiter Error: \""+repetitionDelimiter+"\" is used for both Repetition and CPComponent");
rule(repetitionDelimiter != subComponentDelimiter, "Delimiter Error: \""+repetitionDelimiter+"\" is used for both Repetition and CPSubComponent");
rule(escapeCharacter != fieldDelimiter, "Delimiter Error: \""+escapeCharacter+"\" is used for both Escape and CPField");
rule(escapeCharacter != componentDelimiter, "Delimiter Error: \""+escapeCharacter+"\" is used for both Escape and CPComponent");
rule(escapeCharacter != subComponentDelimiter, "Delimiter Error: \""+escapeCharacter+"\" is used for both Escape and CPSubComponent");
rule(escapeCharacter != repetitionDelimiter, "Delimiter Error: \""+escapeCharacter+"\" is used for both Escape and Repetition");
} | java | public void check() throws FHIRException {
rule(componentDelimiter != fieldDelimiter, "Delimiter Error: \""+componentDelimiter+"\" is used for both CPComponent and CPField");
rule(subComponentDelimiter != fieldDelimiter, "Delimiter Error: \""+subComponentDelimiter+"\" is used for both CPSubComponent and CPField");
rule(subComponentDelimiter != componentDelimiter, "Delimiter Error: \""+subComponentDelimiter+"\" is used for both CPSubComponent and CPComponent");
rule(repetitionDelimiter != fieldDelimiter, "Delimiter Error: \""+repetitionDelimiter+"\" is used for both Repetition and CPField");
rule(repetitionDelimiter != componentDelimiter, "Delimiter Error: \""+repetitionDelimiter+"\" is used for both Repetition and CPComponent");
rule(repetitionDelimiter != subComponentDelimiter, "Delimiter Error: \""+repetitionDelimiter+"\" is used for both Repetition and CPSubComponent");
rule(escapeCharacter != fieldDelimiter, "Delimiter Error: \""+escapeCharacter+"\" is used for both Escape and CPField");
rule(escapeCharacter != componentDelimiter, "Delimiter Error: \""+escapeCharacter+"\" is used for both Escape and CPComponent");
rule(escapeCharacter != subComponentDelimiter, "Delimiter Error: \""+escapeCharacter+"\" is used for both Escape and CPSubComponent");
rule(escapeCharacter != repetitionDelimiter, "Delimiter Error: \""+escapeCharacter+"\" is used for both Escape and Repetition");
} | [
"public",
"void",
"check",
"(",
")",
"throws",
"FHIRException",
"{",
"rule",
"(",
"componentDelimiter",
"!=",
"fieldDelimiter",
",",
"\"Delimiter Error: \\\"\"",
"+",
"componentDelimiter",
"+",
"\"\\\" is used for both CPComponent and CPField\"",
")",
";",
"rule",
"(",
"subComponentDelimiter",
"!=",
"fieldDelimiter",
",",
"\"Delimiter Error: \\\"\"",
"+",
"subComponentDelimiter",
"+",
"\"\\\" is used for both CPSubComponent and CPField\"",
")",
";",
"rule",
"(",
"subComponentDelimiter",
"!=",
"componentDelimiter",
",",
"\"Delimiter Error: \\\"\"",
"+",
"subComponentDelimiter",
"+",
"\"\\\" is used for both CPSubComponent and CPComponent\"",
")",
";",
"rule",
"(",
"repetitionDelimiter",
"!=",
"fieldDelimiter",
",",
"\"Delimiter Error: \\\"\"",
"+",
"repetitionDelimiter",
"+",
"\"\\\" is used for both Repetition and CPField\"",
")",
";",
"rule",
"(",
"repetitionDelimiter",
"!=",
"componentDelimiter",
",",
"\"Delimiter Error: \\\"\"",
"+",
"repetitionDelimiter",
"+",
"\"\\\" is used for both Repetition and CPComponent\"",
")",
";",
"rule",
"(",
"repetitionDelimiter",
"!=",
"subComponentDelimiter",
",",
"\"Delimiter Error: \\\"\"",
"+",
"repetitionDelimiter",
"+",
"\"\\\" is used for both Repetition and CPSubComponent\"",
")",
";",
"rule",
"(",
"escapeCharacter",
"!=",
"fieldDelimiter",
",",
"\"Delimiter Error: \\\"\"",
"+",
"escapeCharacter",
"+",
"\"\\\" is used for both Escape and CPField\"",
")",
";",
"rule",
"(",
"escapeCharacter",
"!=",
"componentDelimiter",
",",
"\"Delimiter Error: \\\"\"",
"+",
"escapeCharacter",
"+",
"\"\\\" is used for both Escape and CPComponent\"",
")",
";",
"rule",
"(",
"escapeCharacter",
"!=",
"subComponentDelimiter",
",",
"\"Delimiter Error: \\\"\"",
"+",
"escapeCharacter",
"+",
"\"\\\" is used for both Escape and CPSubComponent\"",
")",
";",
"rule",
"(",
"escapeCharacter",
"!=",
"repetitionDelimiter",
",",
"\"Delimiter Error: \\\"\"",
"+",
"escapeCharacter",
"+",
"\"\\\" is used for both Escape and Repetition\"",
")",
";",
"}"
] | check that the delimiters are valid
@throws FHIRException | [
"check",
"that",
"the",
"delimiters",
"are",
"valid"
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/elementmodel/VerticalBarParser.java#L201-L212 |
22,542 | jamesagnew/hapi-fhir | hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/elementmodel/VerticalBarParser.java | Delimiters.getEscape | public String getEscape(char ch) {
if (ch == escapeCharacter)
return escapeCharacter + "E" + escapeCharacter;
else if (ch == fieldDelimiter)
return escapeCharacter + "F" + escapeCharacter;
else if (ch == componentDelimiter)
return escapeCharacter + "S" + escapeCharacter;
else if (ch == subComponentDelimiter)
return escapeCharacter + "T" + escapeCharacter;
else if (ch == repetitionDelimiter)
return escapeCharacter + "R" + escapeCharacter;
else
return null;
} | java | public String getEscape(char ch) {
if (ch == escapeCharacter)
return escapeCharacter + "E" + escapeCharacter;
else if (ch == fieldDelimiter)
return escapeCharacter + "F" + escapeCharacter;
else if (ch == componentDelimiter)
return escapeCharacter + "S" + escapeCharacter;
else if (ch == subComponentDelimiter)
return escapeCharacter + "T" + escapeCharacter;
else if (ch == repetitionDelimiter)
return escapeCharacter + "R" + escapeCharacter;
else
return null;
} | [
"public",
"String",
"getEscape",
"(",
"char",
"ch",
")",
"{",
"if",
"(",
"ch",
"==",
"escapeCharacter",
")",
"return",
"escapeCharacter",
"+",
"\"E\"",
"+",
"escapeCharacter",
";",
"else",
"if",
"(",
"ch",
"==",
"fieldDelimiter",
")",
"return",
"escapeCharacter",
"+",
"\"F\"",
"+",
"escapeCharacter",
";",
"else",
"if",
"(",
"ch",
"==",
"componentDelimiter",
")",
"return",
"escapeCharacter",
"+",
"\"S\"",
"+",
"escapeCharacter",
";",
"else",
"if",
"(",
"ch",
"==",
"subComponentDelimiter",
")",
"return",
"escapeCharacter",
"+",
"\"T\"",
"+",
"escapeCharacter",
";",
"else",
"if",
"(",
"ch",
"==",
"repetitionDelimiter",
")",
"return",
"escapeCharacter",
"+",
"\"R\"",
"+",
"escapeCharacter",
";",
"else",
"return",
"null",
";",
"}"
] | get the escape for a character
@param ch
@return | [
"get",
"the",
"escape",
"for",
"a",
"character"
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/elementmodel/VerticalBarParser.java#L237-L250 |
22,543 | jamesagnew/hapi-fhir | hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/elementmodel/VerticalBarParser.java | Delimiters.getDelimiterEscapeChar | public char getDelimiterEscapeChar(char ch) throws DefinitionException {
if (ch == 'E')
return escapeCharacter;
else if (ch == 'F')
return fieldDelimiter;
else if (ch == 'S')
return componentDelimiter;
else if (ch == 'T')
return subComponentDelimiter;
else if (ch == 'R')
return repetitionDelimiter;
else
throw new DefinitionException("internal error in getDelimiterEscapeChar");
} | java | public char getDelimiterEscapeChar(char ch) throws DefinitionException {
if (ch == 'E')
return escapeCharacter;
else if (ch == 'F')
return fieldDelimiter;
else if (ch == 'S')
return componentDelimiter;
else if (ch == 'T')
return subComponentDelimiter;
else if (ch == 'R')
return repetitionDelimiter;
else
throw new DefinitionException("internal error in getDelimiterEscapeChar");
} | [
"public",
"char",
"getDelimiterEscapeChar",
"(",
"char",
"ch",
")",
"throws",
"DefinitionException",
"{",
"if",
"(",
"ch",
"==",
"'",
"'",
")",
"return",
"escapeCharacter",
";",
"else",
"if",
"(",
"ch",
"==",
"'",
"'",
")",
"return",
"fieldDelimiter",
";",
"else",
"if",
"(",
"ch",
"==",
"'",
"'",
")",
"return",
"componentDelimiter",
";",
"else",
"if",
"(",
"ch",
"==",
"'",
"'",
")",
"return",
"subComponentDelimiter",
";",
"else",
"if",
"(",
"ch",
"==",
"'",
"'",
")",
"return",
"repetitionDelimiter",
";",
"else",
"throw",
"new",
"DefinitionException",
"(",
"\"internal error in getDelimiterEscapeChar\"",
")",
";",
"}"
] | get escape for ch in an escape
@param ch
@return
@throws DefinitionException
@throws FHIRException | [
"get",
"escape",
"for",
"ch",
"in",
"an",
"escape"
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/elementmodel/VerticalBarParser.java#L276-L289 |
22,544 | jamesagnew/hapi-fhir | hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsPageProvider.java | AbstractJaxRsPageProvider.getPages | @GET
public Response getPages(@QueryParam(Constants.PARAM_PAGINGACTION) String thePageId) throws IOException {
JaxRsRequest theRequest = getRequest(RequestTypeEnum.GET, RestOperationTypeEnum.GET_PAGE).build();
try {
return (Response) myBinding.invokeServer(this, theRequest);
} catch (JaxRsResponseException theException) {
return new JaxRsExceptionInterceptor().convertExceptionIntoResponse(theRequest, theException);
}
} | java | @GET
public Response getPages(@QueryParam(Constants.PARAM_PAGINGACTION) String thePageId) throws IOException {
JaxRsRequest theRequest = getRequest(RequestTypeEnum.GET, RestOperationTypeEnum.GET_PAGE).build();
try {
return (Response) myBinding.invokeServer(this, theRequest);
} catch (JaxRsResponseException theException) {
return new JaxRsExceptionInterceptor().convertExceptionIntoResponse(theRequest, theException);
}
} | [
"@",
"GET",
"public",
"Response",
"getPages",
"(",
"@",
"QueryParam",
"(",
"Constants",
".",
"PARAM_PAGINGACTION",
")",
"String",
"thePageId",
")",
"throws",
"IOException",
"{",
"JaxRsRequest",
"theRequest",
"=",
"getRequest",
"(",
"RequestTypeEnum",
".",
"GET",
",",
"RestOperationTypeEnum",
".",
"GET_PAGE",
")",
".",
"build",
"(",
")",
";",
"try",
"{",
"return",
"(",
"Response",
")",
"myBinding",
".",
"invokeServer",
"(",
"this",
",",
"theRequest",
")",
";",
"}",
"catch",
"(",
"JaxRsResponseException",
"theException",
")",
"{",
"return",
"new",
"JaxRsExceptionInterceptor",
"(",
")",
".",
"convertExceptionIntoResponse",
"(",
"theRequest",
",",
"theException",
")",
";",
"}",
"}"
] | This method implements the "getpages" action | [
"This",
"method",
"implements",
"the",
"getpages",
"action"
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsPageProvider.java#L88-L96 |
22,545 | jamesagnew/hapi-fhir | hapi-fhir-base/src/main/java/ca/uhn/fhir/util/BundleUtil.java | BundleUtil.toListOfResourcesOfType | @SuppressWarnings("unchecked")
public static <T extends IBaseResource> List<T> toListOfResourcesOfType(FhirContext theContext, IBaseBundle theBundle, Class<T> theTypeToInclude) {
Objects.requireNonNull(theTypeToInclude, "ResourceType must not be null");
List<T> retVal = new ArrayList<>();
RuntimeResourceDefinition def = theContext.getResourceDefinition(theBundle);
BaseRuntimeChildDefinition entryChild = def.getChildByName("entry");
List<IBase> entries = entryChild.getAccessor().getValues(theBundle);
BaseRuntimeElementCompositeDefinition<?> entryChildElem = (BaseRuntimeElementCompositeDefinition<?>) entryChild.getChildByName("entry");
BaseRuntimeChildDefinition resourceChild = entryChildElem.getChildByName("resource");
for (IBase nextEntry : entries) {
for (IBase next : resourceChild.getAccessor().getValues(nextEntry)) {
if (theTypeToInclude.isAssignableFrom(next.getClass())) {
retVal.add((T) next);
}
}
}
return retVal;
} | java | @SuppressWarnings("unchecked")
public static <T extends IBaseResource> List<T> toListOfResourcesOfType(FhirContext theContext, IBaseBundle theBundle, Class<T> theTypeToInclude) {
Objects.requireNonNull(theTypeToInclude, "ResourceType must not be null");
List<T> retVal = new ArrayList<>();
RuntimeResourceDefinition def = theContext.getResourceDefinition(theBundle);
BaseRuntimeChildDefinition entryChild = def.getChildByName("entry");
List<IBase> entries = entryChild.getAccessor().getValues(theBundle);
BaseRuntimeElementCompositeDefinition<?> entryChildElem = (BaseRuntimeElementCompositeDefinition<?>) entryChild.getChildByName("entry");
BaseRuntimeChildDefinition resourceChild = entryChildElem.getChildByName("resource");
for (IBase nextEntry : entries) {
for (IBase next : resourceChild.getAccessor().getValues(nextEntry)) {
if (theTypeToInclude.isAssignableFrom(next.getClass())) {
retVal.add((T) next);
}
}
}
return retVal;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
"extends",
"IBaseResource",
">",
"List",
"<",
"T",
">",
"toListOfResourcesOfType",
"(",
"FhirContext",
"theContext",
",",
"IBaseBundle",
"theBundle",
",",
"Class",
"<",
"T",
">",
"theTypeToInclude",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"theTypeToInclude",
",",
"\"ResourceType must not be null\"",
")",
";",
"List",
"<",
"T",
">",
"retVal",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"RuntimeResourceDefinition",
"def",
"=",
"theContext",
".",
"getResourceDefinition",
"(",
"theBundle",
")",
";",
"BaseRuntimeChildDefinition",
"entryChild",
"=",
"def",
".",
"getChildByName",
"(",
"\"entry\"",
")",
";",
"List",
"<",
"IBase",
">",
"entries",
"=",
"entryChild",
".",
"getAccessor",
"(",
")",
".",
"getValues",
"(",
"theBundle",
")",
";",
"BaseRuntimeElementCompositeDefinition",
"<",
"?",
">",
"entryChildElem",
"=",
"(",
"BaseRuntimeElementCompositeDefinition",
"<",
"?",
">",
")",
"entryChild",
".",
"getChildByName",
"(",
"\"entry\"",
")",
";",
"BaseRuntimeChildDefinition",
"resourceChild",
"=",
"entryChildElem",
".",
"getChildByName",
"(",
"\"resource\"",
")",
";",
"for",
"(",
"IBase",
"nextEntry",
":",
"entries",
")",
"{",
"for",
"(",
"IBase",
"next",
":",
"resourceChild",
".",
"getAccessor",
"(",
")",
".",
"getValues",
"(",
"nextEntry",
")",
")",
"{",
"if",
"(",
"theTypeToInclude",
".",
"isAssignableFrom",
"(",
"next",
".",
"getClass",
"(",
")",
")",
")",
"{",
"retVal",
".",
"add",
"(",
"(",
"T",
")",
"next",
")",
";",
"}",
"}",
"}",
"return",
"retVal",
";",
"}"
] | Extract all of the resources of a given type from a given bundle | [
"Extract",
"all",
"of",
"the",
"resources",
"of",
"a",
"given",
"type",
"from",
"a",
"given",
"bundle"
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/BundleUtil.java#L199-L218 |
22,546 | jamesagnew/hapi-fhir | hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/SearchParameterMap.java | SearchParameterMap.isAllParametersHaveNoModifier | public boolean isAllParametersHaveNoModifier() {
for (List<List<IQueryParameterType>> nextParamName : values()) {
for (List<IQueryParameterType> nextAnd : nextParamName) {
for (IQueryParameterType nextOr : nextAnd) {
if (isNotBlank(nextOr.getQueryParameterQualifier())) {
return false;
}
}
}
}
return true;
} | java | public boolean isAllParametersHaveNoModifier() {
for (List<List<IQueryParameterType>> nextParamName : values()) {
for (List<IQueryParameterType> nextAnd : nextParamName) {
for (IQueryParameterType nextOr : nextAnd) {
if (isNotBlank(nextOr.getQueryParameterQualifier())) {
return false;
}
}
}
}
return true;
} | [
"public",
"boolean",
"isAllParametersHaveNoModifier",
"(",
")",
"{",
"for",
"(",
"List",
"<",
"List",
"<",
"IQueryParameterType",
">",
">",
"nextParamName",
":",
"values",
"(",
")",
")",
"{",
"for",
"(",
"List",
"<",
"IQueryParameterType",
">",
"nextAnd",
":",
"nextParamName",
")",
"{",
"for",
"(",
"IQueryParameterType",
"nextOr",
":",
"nextAnd",
")",
"{",
"if",
"(",
"isNotBlank",
"(",
"nextOr",
".",
"getQueryParameterQualifier",
"(",
")",
")",
")",
"{",
"return",
"false",
";",
"}",
"}",
"}",
"}",
"return",
"true",
";",
"}"
] | This will only return true if all parameters have no modifier of any kind | [
"This",
"will",
"only",
"return",
"true",
"if",
"all",
"parameters",
"have",
"no",
"modifier",
"of",
"any",
"kind"
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/SearchParameterMap.java#L274-L285 |
22,547 | jamesagnew/hapi-fhir | hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/DateRangeParam.java | DateRangeParam.setLowerBoundInclusive | public DateRangeParam setLowerBoundInclusive(Date theLowerBound) {
validateAndSet(new DateParam(ParamPrefixEnum.GREATERTHAN_OR_EQUALS, theLowerBound), myUpperBound);
return this;
} | java | public DateRangeParam setLowerBoundInclusive(Date theLowerBound) {
validateAndSet(new DateParam(ParamPrefixEnum.GREATERTHAN_OR_EQUALS, theLowerBound), myUpperBound);
return this;
} | [
"public",
"DateRangeParam",
"setLowerBoundInclusive",
"(",
"Date",
"theLowerBound",
")",
"{",
"validateAndSet",
"(",
"new",
"DateParam",
"(",
"ParamPrefixEnum",
".",
"GREATERTHAN_OR_EQUALS",
",",
"theLowerBound",
")",
",",
"myUpperBound",
")",
";",
"return",
"this",
";",
"}"
] | Sets the lower bound to be greaterthan or equal to the given date | [
"Sets",
"the",
"lower",
"bound",
"to",
"be",
"greaterthan",
"or",
"equal",
"to",
"the",
"given",
"date"
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/DateRangeParam.java#L227-L230 |
22,548 | jamesagnew/hapi-fhir | hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/DateRangeParam.java | DateRangeParam.setUpperBoundInclusive | public DateRangeParam setUpperBoundInclusive(Date theUpperBound) {
validateAndSet(myLowerBound, new DateParam(ParamPrefixEnum.LESSTHAN_OR_EQUALS, theUpperBound));
return this;
} | java | public DateRangeParam setUpperBoundInclusive(Date theUpperBound) {
validateAndSet(myLowerBound, new DateParam(ParamPrefixEnum.LESSTHAN_OR_EQUALS, theUpperBound));
return this;
} | [
"public",
"DateRangeParam",
"setUpperBoundInclusive",
"(",
"Date",
"theUpperBound",
")",
"{",
"validateAndSet",
"(",
"myLowerBound",
",",
"new",
"DateParam",
"(",
"ParamPrefixEnum",
".",
"LESSTHAN_OR_EQUALS",
",",
"theUpperBound",
")",
")",
";",
"return",
"this",
";",
"}"
] | Sets the upper bound to be greaterthan or equal to the given date | [
"Sets",
"the",
"upper",
"bound",
"to",
"be",
"greaterthan",
"or",
"equal",
"to",
"the",
"given",
"date"
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/DateRangeParam.java#L235-L238 |
22,549 | jamesagnew/hapi-fhir | hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/DateRangeParam.java | DateRangeParam.setLowerBoundExclusive | public DateRangeParam setLowerBoundExclusive(Date theLowerBound) {
validateAndSet(new DateParam(ParamPrefixEnum.GREATERTHAN, theLowerBound), myUpperBound);
return this;
} | java | public DateRangeParam setLowerBoundExclusive(Date theLowerBound) {
validateAndSet(new DateParam(ParamPrefixEnum.GREATERTHAN, theLowerBound), myUpperBound);
return this;
} | [
"public",
"DateRangeParam",
"setLowerBoundExclusive",
"(",
"Date",
"theLowerBound",
")",
"{",
"validateAndSet",
"(",
"new",
"DateParam",
"(",
"ParamPrefixEnum",
".",
"GREATERTHAN",
",",
"theLowerBound",
")",
",",
"myUpperBound",
")",
";",
"return",
"this",
";",
"}"
] | Sets the lower bound to be greaterthan to the given date | [
"Sets",
"the",
"lower",
"bound",
"to",
"be",
"greaterthan",
"to",
"the",
"given",
"date"
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/DateRangeParam.java#L244-L247 |
22,550 | jamesagnew/hapi-fhir | hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/DateRangeParam.java | DateRangeParam.setUpperBoundExclusive | public DateRangeParam setUpperBoundExclusive(Date theUpperBound) {
validateAndSet(myLowerBound, new DateParam(ParamPrefixEnum.LESSTHAN, theUpperBound));
return this;
} | java | public DateRangeParam setUpperBoundExclusive(Date theUpperBound) {
validateAndSet(myLowerBound, new DateParam(ParamPrefixEnum.LESSTHAN, theUpperBound));
return this;
} | [
"public",
"DateRangeParam",
"setUpperBoundExclusive",
"(",
"Date",
"theUpperBound",
")",
"{",
"validateAndSet",
"(",
"myLowerBound",
",",
"new",
"DateParam",
"(",
"ParamPrefixEnum",
".",
"LESSTHAN",
",",
"theUpperBound",
")",
")",
";",
"return",
"this",
";",
"}"
] | Sets the upper bound to be greaterthan to the given date | [
"Sets",
"the",
"upper",
"bound",
"to",
"be",
"greaterthan",
"to",
"the",
"given",
"date"
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/DateRangeParam.java#L252-L255 |
22,551 | jamesagnew/hapi-fhir | hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/DateRangeParam.java | DateRangeParam.setRangeFromDatesInclusive | public void setRangeFromDatesInclusive(IPrimitiveType<Date> theLowerBound, IPrimitiveType<Date> theUpperBound) {
IPrimitiveType<Date> lowerBound = theLowerBound;
IPrimitiveType<Date> upperBound = theUpperBound;
if (lowerBound != null && lowerBound.getValue() != null && upperBound != null && upperBound.getValue() != null) {
if (lowerBound.getValue().after(upperBound.getValue())) {
IPrimitiveType<Date> temp = lowerBound;
lowerBound = upperBound;
upperBound = temp;
}
}
validateAndSet(
lowerBound != null ? new DateParam(GREATERTHAN_OR_EQUALS, lowerBound) : null,
upperBound != null ? new DateParam(LESSTHAN_OR_EQUALS, upperBound) : null);
} | java | public void setRangeFromDatesInclusive(IPrimitiveType<Date> theLowerBound, IPrimitiveType<Date> theUpperBound) {
IPrimitiveType<Date> lowerBound = theLowerBound;
IPrimitiveType<Date> upperBound = theUpperBound;
if (lowerBound != null && lowerBound.getValue() != null && upperBound != null && upperBound.getValue() != null) {
if (lowerBound.getValue().after(upperBound.getValue())) {
IPrimitiveType<Date> temp = lowerBound;
lowerBound = upperBound;
upperBound = temp;
}
}
validateAndSet(
lowerBound != null ? new DateParam(GREATERTHAN_OR_EQUALS, lowerBound) : null,
upperBound != null ? new DateParam(LESSTHAN_OR_EQUALS, upperBound) : null);
} | [
"public",
"void",
"setRangeFromDatesInclusive",
"(",
"IPrimitiveType",
"<",
"Date",
">",
"theLowerBound",
",",
"IPrimitiveType",
"<",
"Date",
">",
"theUpperBound",
")",
"{",
"IPrimitiveType",
"<",
"Date",
">",
"lowerBound",
"=",
"theLowerBound",
";",
"IPrimitiveType",
"<",
"Date",
">",
"upperBound",
"=",
"theUpperBound",
";",
"if",
"(",
"lowerBound",
"!=",
"null",
"&&",
"lowerBound",
".",
"getValue",
"(",
")",
"!=",
"null",
"&&",
"upperBound",
"!=",
"null",
"&&",
"upperBound",
".",
"getValue",
"(",
")",
"!=",
"null",
")",
"{",
"if",
"(",
"lowerBound",
".",
"getValue",
"(",
")",
".",
"after",
"(",
"upperBound",
".",
"getValue",
"(",
")",
")",
")",
"{",
"IPrimitiveType",
"<",
"Date",
">",
"temp",
"=",
"lowerBound",
";",
"lowerBound",
"=",
"upperBound",
";",
"upperBound",
"=",
"temp",
";",
"}",
"}",
"validateAndSet",
"(",
"lowerBound",
"!=",
"null",
"?",
"new",
"DateParam",
"(",
"GREATERTHAN_OR_EQUALS",
",",
"lowerBound",
")",
":",
"null",
",",
"upperBound",
"!=",
"null",
"?",
"new",
"DateParam",
"(",
"LESSTHAN_OR_EQUALS",
",",
"upperBound",
")",
":",
"null",
")",
";",
"}"
] | Sets the range from a pair of dates, inclusive on both ends. Note that if
theLowerBound is after theUpperBound, thie method will automatically reverse
the order of the arguments in order to create an inclusive range.
@param theLowerBound A qualified date param representing the lower date bound (optionally may include time), e.g.
"2011-02-22" or "2011-02-22T13:12:00Z". Will be treated inclusively. Either theLowerBound or
theUpperBound may both be populated, or one may be null, but it is not valid for both to be null.
@param theUpperBound A qualified date param representing the upper date bound (optionally may include time), e.g.
"2011-02-22" or "2011-02-22T13:12:00Z". Will be treated inclusively. Either theLowerBound or
theUpperBound may both be populated, or one may be null, but it is not valid for both to be null. | [
"Sets",
"the",
"range",
"from",
"a",
"pair",
"of",
"dates",
"inclusive",
"on",
"both",
"ends",
".",
"Note",
"that",
"if",
"theLowerBound",
"is",
"after",
"theUpperBound",
"thie",
"method",
"will",
"automatically",
"reverse",
"the",
"order",
"of",
"the",
"arguments",
"in",
"order",
"to",
"create",
"an",
"inclusive",
"range",
"."
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/DateRangeParam.java#L421-L434 |
22,552 | jamesagnew/hapi-fhir | hapi-fhir-base/src/main/java/ca/uhn/fhir/narrative/CustomThymeleafNarrativeGenerator.java | CustomThymeleafNarrativeGenerator.setPropertyFile | public void setPropertyFile(String... thePropertyFile) {
Validate.notNull(thePropertyFile, "Property file can not be null");
myPropertyFile = Arrays.asList(thePropertyFile);
} | java | public void setPropertyFile(String... thePropertyFile) {
Validate.notNull(thePropertyFile, "Property file can not be null");
myPropertyFile = Arrays.asList(thePropertyFile);
} | [
"public",
"void",
"setPropertyFile",
"(",
"String",
"...",
"thePropertyFile",
")",
"{",
"Validate",
".",
"notNull",
"(",
"thePropertyFile",
",",
"\"Property file can not be null\"",
")",
";",
"myPropertyFile",
"=",
"Arrays",
".",
"asList",
"(",
"thePropertyFile",
")",
";",
"}"
] | Set the property file to use
@param thePropertyFile
The name of the property file, in one of the following formats:
<ul>
<li>file:/path/to/file/file.properties</li>
<li>classpath:/com/package/file.properties</li>
</ul> | [
"Set",
"the",
"property",
"file",
"to",
"use"
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-base/src/main/java/ca/uhn/fhir/narrative/CustomThymeleafNarrativeGenerator.java#L57-L60 |
22,553 | jamesagnew/hapi-fhir | hapi-fhir-base/src/main/java/ca/uhn/fhir/util/UrlUtil.java | UrlUtil.constructAbsoluteUrl | public static String constructAbsoluteUrl(String theBase, String theEndpoint) {
if (theEndpoint == null) {
return null;
}
if (isAbsolute(theEndpoint)) {
return theEndpoint;
}
if (theBase == null) {
return theEndpoint;
}
try {
return new URL(new URL(theBase), theEndpoint).toString();
} catch (MalformedURLException e) {
ourLog.warn("Failed to resolve relative URL[" + theEndpoint + "] against absolute base[" + theBase + "]", e);
return theEndpoint;
}
} | java | public static String constructAbsoluteUrl(String theBase, String theEndpoint) {
if (theEndpoint == null) {
return null;
}
if (isAbsolute(theEndpoint)) {
return theEndpoint;
}
if (theBase == null) {
return theEndpoint;
}
try {
return new URL(new URL(theBase), theEndpoint).toString();
} catch (MalformedURLException e) {
ourLog.warn("Failed to resolve relative URL[" + theEndpoint + "] against absolute base[" + theBase + "]", e);
return theEndpoint;
}
} | [
"public",
"static",
"String",
"constructAbsoluteUrl",
"(",
"String",
"theBase",
",",
"String",
"theEndpoint",
")",
"{",
"if",
"(",
"theEndpoint",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"isAbsolute",
"(",
"theEndpoint",
")",
")",
"{",
"return",
"theEndpoint",
";",
"}",
"if",
"(",
"theBase",
"==",
"null",
")",
"{",
"return",
"theEndpoint",
";",
"}",
"try",
"{",
"return",
"new",
"URL",
"(",
"new",
"URL",
"(",
"theBase",
")",
",",
"theEndpoint",
")",
".",
"toString",
"(",
")",
";",
"}",
"catch",
"(",
"MalformedURLException",
"e",
")",
"{",
"ourLog",
".",
"warn",
"(",
"\"Failed to resolve relative URL[\"",
"+",
"theEndpoint",
"+",
"\"] against absolute base[\"",
"+",
"theBase",
"+",
"\"]\"",
",",
"e",
")",
";",
"return",
"theEndpoint",
";",
"}",
"}"
] | Resolve a relative URL - THIS METHOD WILL NOT FAIL but will log a warning and return theEndpoint if the input is invalid. | [
"Resolve",
"a",
"relative",
"URL",
"-",
"THIS",
"METHOD",
"WILL",
"NOT",
"FAIL",
"but",
"will",
"log",
"a",
"warning",
"and",
"return",
"theEndpoint",
"if",
"the",
"input",
"is",
"invalid",
"."
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/UrlUtil.java#L53-L70 |
22,554 | jamesagnew/hapi-fhir | hapi-fhir-base/src/main/java/ca/uhn/fhir/util/UrlUtil.java | UrlUtil.sanitizeUrlPart | public static String sanitizeUrlPart(String theString) {
if (theString == null) {
return null;
}
boolean needsSanitization = isNeedsSanitization(theString);
if (needsSanitization) {
// Ok, we're sanitizing
StringBuilder buffer = new StringBuilder(theString.length() + 10);
for (int j = 0; j < theString.length(); j++) {
char nextChar = theString.charAt(j);
switch (nextChar) {
case '"':
buffer.append(""");
break;
case '<':
buffer.append("<");
break;
default:
buffer.append(nextChar);
break;
}
} // for build escaped string
return buffer.toString();
}
return theString;
} | java | public static String sanitizeUrlPart(String theString) {
if (theString == null) {
return null;
}
boolean needsSanitization = isNeedsSanitization(theString);
if (needsSanitization) {
// Ok, we're sanitizing
StringBuilder buffer = new StringBuilder(theString.length() + 10);
for (int j = 0; j < theString.length(); j++) {
char nextChar = theString.charAt(j);
switch (nextChar) {
case '"':
buffer.append(""");
break;
case '<':
buffer.append("<");
break;
default:
buffer.append(nextChar);
break;
}
} // for build escaped string
return buffer.toString();
}
return theString;
} | [
"public",
"static",
"String",
"sanitizeUrlPart",
"(",
"String",
"theString",
")",
"{",
"if",
"(",
"theString",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"boolean",
"needsSanitization",
"=",
"isNeedsSanitization",
"(",
"theString",
")",
";",
"if",
"(",
"needsSanitization",
")",
"{",
"// Ok, we're sanitizing",
"StringBuilder",
"buffer",
"=",
"new",
"StringBuilder",
"(",
"theString",
".",
"length",
"(",
")",
"+",
"10",
")",
";",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"theString",
".",
"length",
"(",
")",
";",
"j",
"++",
")",
"{",
"char",
"nextChar",
"=",
"theString",
".",
"charAt",
"(",
"j",
")",
";",
"switch",
"(",
"nextChar",
")",
"{",
"case",
"'",
"'",
":",
"buffer",
".",
"append",
"(",
"\""\"",
")",
";",
"break",
";",
"case",
"'",
"'",
":",
"buffer",
".",
"append",
"(",
"\"<\"",
")",
";",
"break",
";",
"default",
":",
"buffer",
".",
"append",
"(",
"nextChar",
")",
";",
"break",
";",
"}",
"}",
"// for build escaped string",
"return",
"buffer",
".",
"toString",
"(",
")",
";",
"}",
"return",
"theString",
";",
"}"
] | This method specifically HTML-encodes the " and
< characters in order to prevent injection attacks | [
"This",
"method",
"specifically",
"HTML",
"-",
"encodes",
"the",
""",
";",
"and",
"<",
";",
"characters",
"in",
"order",
"to",
"prevent",
"injection",
"attacks"
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/UrlUtil.java#L305-L336 |
22,555 | jamesagnew/hapi-fhir | hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/TokenOrListParam.java | TokenOrListParam.add | public TokenOrListParam add(String theSystem, String theValue) {
add(new TokenParam(theSystem, theValue));
return this;
} | java | public TokenOrListParam add(String theSystem, String theValue) {
add(new TokenParam(theSystem, theValue));
return this;
} | [
"public",
"TokenOrListParam",
"add",
"(",
"String",
"theSystem",
",",
"String",
"theValue",
")",
"{",
"add",
"(",
"new",
"TokenParam",
"(",
"theSystem",
",",
"theValue",
")",
")",
";",
"return",
"this",
";",
"}"
] | Add a new token to this list
@param theSystem
The system to use for the one token to pre-populate in this list | [
"Add",
"a",
"new",
"token",
"to",
"this",
"list"
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/param/TokenOrListParam.java#L75-L78 |
22,556 | jamesagnew/hapi-fhir | hapi-fhir-base/src/main/java/ca/uhn/fhir/util/PortUtil.java | PortUtil.isAvailable | private static boolean isAvailable(int thePort) {
ourLog.info("Testing a bind on thePort {}", thePort);
try (ServerSocket ss = new ServerSocket()) {
ss.setReuseAddress(true);
ss.bind(new InetSocketAddress("0.0.0.0", thePort));
try (DatagramSocket ds = new DatagramSocket()) {
ds.setReuseAddress(true);
ds.connect(new InetSocketAddress("127.0.0.1", thePort));
ourLog.info("Successfully bound thePort {}", thePort);
} catch (IOException e) {
ourLog.info("Failed to bind thePort {}: {}", thePort, e.toString());
return false;
}
} catch (IOException e) {
ourLog.info("Failed to bind thePort {}: {}", thePort, e.toString());
return false;
}
try (ServerSocket ss = new ServerSocket()) {
ss.setReuseAddress(true);
ss.bind(new InetSocketAddress("localhost", thePort));
} catch (IOException e) {
ourLog.info("Failed to bind thePort {}: {}", thePort, e.toString());
return false;
}
return true;
} | java | private static boolean isAvailable(int thePort) {
ourLog.info("Testing a bind on thePort {}", thePort);
try (ServerSocket ss = new ServerSocket()) {
ss.setReuseAddress(true);
ss.bind(new InetSocketAddress("0.0.0.0", thePort));
try (DatagramSocket ds = new DatagramSocket()) {
ds.setReuseAddress(true);
ds.connect(new InetSocketAddress("127.0.0.1", thePort));
ourLog.info("Successfully bound thePort {}", thePort);
} catch (IOException e) {
ourLog.info("Failed to bind thePort {}: {}", thePort, e.toString());
return false;
}
} catch (IOException e) {
ourLog.info("Failed to bind thePort {}: {}", thePort, e.toString());
return false;
}
try (ServerSocket ss = new ServerSocket()) {
ss.setReuseAddress(true);
ss.bind(new InetSocketAddress("localhost", thePort));
} catch (IOException e) {
ourLog.info("Failed to bind thePort {}: {}", thePort, e.toString());
return false;
}
return true;
} | [
"private",
"static",
"boolean",
"isAvailable",
"(",
"int",
"thePort",
")",
"{",
"ourLog",
".",
"info",
"(",
"\"Testing a bind on thePort {}\"",
",",
"thePort",
")",
";",
"try",
"(",
"ServerSocket",
"ss",
"=",
"new",
"ServerSocket",
"(",
")",
")",
"{",
"ss",
".",
"setReuseAddress",
"(",
"true",
")",
";",
"ss",
".",
"bind",
"(",
"new",
"InetSocketAddress",
"(",
"\"0.0.0.0\"",
",",
"thePort",
")",
")",
";",
"try",
"(",
"DatagramSocket",
"ds",
"=",
"new",
"DatagramSocket",
"(",
")",
")",
"{",
"ds",
".",
"setReuseAddress",
"(",
"true",
")",
";",
"ds",
".",
"connect",
"(",
"new",
"InetSocketAddress",
"(",
"\"127.0.0.1\"",
",",
"thePort",
")",
")",
";",
"ourLog",
".",
"info",
"(",
"\"Successfully bound thePort {}\"",
",",
"thePort",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"ourLog",
".",
"info",
"(",
"\"Failed to bind thePort {}: {}\"",
",",
"thePort",
",",
"e",
".",
"toString",
"(",
")",
")",
";",
"return",
"false",
";",
"}",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"ourLog",
".",
"info",
"(",
"\"Failed to bind thePort {}: {}\"",
",",
"thePort",
",",
"e",
".",
"toString",
"(",
")",
")",
";",
"return",
"false",
";",
"}",
"try",
"(",
"ServerSocket",
"ss",
"=",
"new",
"ServerSocket",
"(",
")",
")",
"{",
"ss",
".",
"setReuseAddress",
"(",
"true",
")",
";",
"ss",
".",
"bind",
"(",
"new",
"InetSocketAddress",
"(",
"\"localhost\"",
",",
"thePort",
")",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"ourLog",
".",
"info",
"(",
"\"Failed to bind thePort {}: {}\"",
",",
"thePort",
",",
"e",
".",
"toString",
"(",
")",
")",
";",
"return",
"false",
";",
"}",
"return",
"true",
";",
"}"
] | This method checks if we are able to bind a given port to both
0.0.0.0 and localhost in order to be sure it's truly available. | [
"This",
"method",
"checks",
"if",
"we",
"are",
"able",
"to",
"bind",
"a",
"given",
"port",
"to",
"both",
"0",
".",
"0",
".",
"0",
".",
"0",
"and",
"localhost",
"in",
"order",
"to",
"be",
"sure",
"it",
"s",
"truly",
"available",
"."
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/PortUtil.java#L192-L219 |
22,557 | jamesagnew/hapi-fhir | hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeResourceDefinition.java | RuntimeResourceDefinition.getSearchParamsForCompartmentName | public List<RuntimeSearchParam> getSearchParamsForCompartmentName(String theCompartmentName) {
validateSealed();
List<RuntimeSearchParam> retVal = myCompartmentNameToSearchParams.get(theCompartmentName);
if (retVal == null) {
return Collections.emptyList();
}
return retVal;
} | java | public List<RuntimeSearchParam> getSearchParamsForCompartmentName(String theCompartmentName) {
validateSealed();
List<RuntimeSearchParam> retVal = myCompartmentNameToSearchParams.get(theCompartmentName);
if (retVal == null) {
return Collections.emptyList();
}
return retVal;
} | [
"public",
"List",
"<",
"RuntimeSearchParam",
">",
"getSearchParamsForCompartmentName",
"(",
"String",
"theCompartmentName",
")",
"{",
"validateSealed",
"(",
")",
";",
"List",
"<",
"RuntimeSearchParam",
">",
"retVal",
"=",
"myCompartmentNameToSearchParams",
".",
"get",
"(",
"theCompartmentName",
")",
";",
"if",
"(",
"retVal",
"==",
"null",
")",
"{",
"return",
"Collections",
".",
"emptyList",
"(",
")",
";",
"}",
"return",
"retVal",
";",
"}"
] | Will not return null | [
"Will",
"not",
"return",
"null"
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeResourceDefinition.java#L155-L162 |
22,558 | jamesagnew/hapi-fhir | hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/formats/XmlParserBase.java | XmlParserBase.parse | @Override
public Resource parse(InputStream input) throws IOException, FHIRFormatError {
try {
XmlPullParser xpp = loadXml(input);
return parse(xpp);
} catch (XmlPullParserException e) {
throw new FHIRFormatError(e.getMessage(), e);
}
} | java | @Override
public Resource parse(InputStream input) throws IOException, FHIRFormatError {
try {
XmlPullParser xpp = loadXml(input);
return parse(xpp);
} catch (XmlPullParserException e) {
throw new FHIRFormatError(e.getMessage(), e);
}
} | [
"@",
"Override",
"public",
"Resource",
"parse",
"(",
"InputStream",
"input",
")",
"throws",
"IOException",
",",
"FHIRFormatError",
"{",
"try",
"{",
"XmlPullParser",
"xpp",
"=",
"loadXml",
"(",
"input",
")",
";",
"return",
"parse",
"(",
"xpp",
")",
";",
"}",
"catch",
"(",
"XmlPullParserException",
"e",
")",
"{",
"throw",
"new",
"FHIRFormatError",
"(",
"e",
".",
"getMessage",
"(",
")",
",",
"e",
")",
";",
"}",
"}"
] | Parse content that is known to be a resource
@ | [
"Parse",
"content",
"that",
"is",
"known",
"to",
"be",
"a",
"resource"
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/formats/XmlParserBase.java#L84-L92 |
22,559 | jamesagnew/hapi-fhir | hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/formats/XmlParserBase.java | XmlParserBase.parse | public Resource parse(XmlPullParser xpp) throws IOException, FHIRFormatError, XmlPullParserException {
if (xpp.getNamespace() == null)
throw new FHIRFormatError("This does not appear to be a FHIR resource (no namespace '"+xpp.getNamespace()+"') (@ /) "+Integer.toString(xpp.getEventType()));
if (!xpp.getNamespace().equals(FHIR_NS))
throw new FHIRFormatError("This does not appear to be a FHIR resource (wrong namespace '"+xpp.getNamespace()+"') (@ /)");
return parseResource(xpp);
} | java | public Resource parse(XmlPullParser xpp) throws IOException, FHIRFormatError, XmlPullParserException {
if (xpp.getNamespace() == null)
throw new FHIRFormatError("This does not appear to be a FHIR resource (no namespace '"+xpp.getNamespace()+"') (@ /) "+Integer.toString(xpp.getEventType()));
if (!xpp.getNamespace().equals(FHIR_NS))
throw new FHIRFormatError("This does not appear to be a FHIR resource (wrong namespace '"+xpp.getNamespace()+"') (@ /)");
return parseResource(xpp);
} | [
"public",
"Resource",
"parse",
"(",
"XmlPullParser",
"xpp",
")",
"throws",
"IOException",
",",
"FHIRFormatError",
",",
"XmlPullParserException",
"{",
"if",
"(",
"xpp",
".",
"getNamespace",
"(",
")",
"==",
"null",
")",
"throw",
"new",
"FHIRFormatError",
"(",
"\"This does not appear to be a FHIR resource (no namespace '\"",
"+",
"xpp",
".",
"getNamespace",
"(",
")",
"+",
"\"') (@ /) \"",
"+",
"Integer",
".",
"toString",
"(",
"xpp",
".",
"getEventType",
"(",
")",
")",
")",
";",
"if",
"(",
"!",
"xpp",
".",
"getNamespace",
"(",
")",
".",
"equals",
"(",
"FHIR_NS",
")",
")",
"throw",
"new",
"FHIRFormatError",
"(",
"\"This does not appear to be a FHIR resource (wrong namespace '\"",
"+",
"xpp",
".",
"getNamespace",
"(",
")",
"+",
"\"') (@ /)\"",
")",
";",
"return",
"parseResource",
"(",
"xpp",
")",
";",
"}"
] | parse xml that is known to be a resource, and that is already being read by an XML Pull Parser
This is if a resource is in a bigger piece of XML.
@ | [
"parse",
"xml",
"that",
"is",
"known",
"to",
"be",
"a",
"resource",
"and",
"that",
"is",
"already",
"being",
"read",
"by",
"an",
"XML",
"Pull",
"Parser",
"This",
"is",
"if",
"a",
"resource",
"is",
"in",
"a",
"bigger",
"piece",
"of",
"XML",
"."
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/formats/XmlParserBase.java#L99-L105 |
22,560 | jamesagnew/hapi-fhir | hapi-fhir-validation/src/main/java/org/hl7/fhir/r4/validation/DefaultEnableWhenEvaluator.java | DefaultEnableWhenEvaluator.findQuestionAnswers | private List<Element> findQuestionAnswers(Element questionnaireResponse, String question) {
List<Element> retVal = new ArrayList<>();
List<Element> items = questionnaireResponse.getChildren(ITEM_ELEMENT);
for (Element next : items) {
if (hasLinkId(next, question)) {
List<Element> answers = extractAnswer(next);
retVal.addAll(answers);
}
retVal.addAll(findQuestionAnswers(next, question));
}
return retVal;
} | java | private List<Element> findQuestionAnswers(Element questionnaireResponse, String question) {
List<Element> retVal = new ArrayList<>();
List<Element> items = questionnaireResponse.getChildren(ITEM_ELEMENT);
for (Element next : items) {
if (hasLinkId(next, question)) {
List<Element> answers = extractAnswer(next);
retVal.addAll(answers);
}
retVal.addAll(findQuestionAnswers(next, question));
}
return retVal;
} | [
"private",
"List",
"<",
"Element",
">",
"findQuestionAnswers",
"(",
"Element",
"questionnaireResponse",
",",
"String",
"question",
")",
"{",
"List",
"<",
"Element",
">",
"retVal",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"List",
"<",
"Element",
">",
"items",
"=",
"questionnaireResponse",
".",
"getChildren",
"(",
"ITEM_ELEMENT",
")",
";",
"for",
"(",
"Element",
"next",
":",
"items",
")",
"{",
"if",
"(",
"hasLinkId",
"(",
"next",
",",
"question",
")",
")",
"{",
"List",
"<",
"Element",
">",
"answers",
"=",
"extractAnswer",
"(",
"next",
")",
";",
"retVal",
".",
"addAll",
"(",
"answers",
")",
";",
"}",
"retVal",
".",
"addAll",
"(",
"findQuestionAnswers",
"(",
"next",
",",
"question",
")",
")",
";",
"}",
"return",
"retVal",
";",
"}"
] | Recursively look for answers to questions with the given link id | [
"Recursively",
"look",
"for",
"answers",
"to",
"questions",
"with",
"the",
"given",
"link",
"id"
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-validation/src/main/java/org/hl7/fhir/r4/validation/DefaultEnableWhenEvaluator.java#L161-L174 |
22,561 | jamesagnew/hapi-fhir | hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/module/subscriber/SubscriptionDeliveringRestHookSubscriber.java | SubscriptionDeliveringRestHookSubscriber.sendNotification | protected void sendNotification(ResourceDeliveryMessage theMsg) {
Map<String, List<String>> params = new HashMap<>();
List<Header> headers = new ArrayList<>();
if (theMsg.getSubscription().getHeaders() != null) {
theMsg.getSubscription().getHeaders().stream().filter(Objects::nonNull).forEach(h -> {
final int sep = h.indexOf(':');
if (sep > 0) {
final String name = h.substring(0, sep);
final String value = h.substring(sep + 1);
if (StringUtils.isNotBlank(name)) {
headers.add(new Header(name.trim(), value.trim()));
}
}
});
}
StringBuilder url = new StringBuilder(theMsg.getSubscription().getEndpointUrl());
IHttpClient client = myFhirContext.getRestfulClientFactory().getHttpClient(url, params, "", RequestTypeEnum.POST, headers);
IHttpRequest request = client.createParamRequest(myFhirContext, params, null);
try {
IHttpResponse response = request.execute();
// close connection in order to return a possible cached connection to the connection pool
response.close();
} catch (IOException e) {
ourLog.error("Error trying to reach " + theMsg.getSubscription().getEndpointUrl());
e.printStackTrace();
throw new ResourceNotFoundException(e.getMessage());
}
} | java | protected void sendNotification(ResourceDeliveryMessage theMsg) {
Map<String, List<String>> params = new HashMap<>();
List<Header> headers = new ArrayList<>();
if (theMsg.getSubscription().getHeaders() != null) {
theMsg.getSubscription().getHeaders().stream().filter(Objects::nonNull).forEach(h -> {
final int sep = h.indexOf(':');
if (sep > 0) {
final String name = h.substring(0, sep);
final String value = h.substring(sep + 1);
if (StringUtils.isNotBlank(name)) {
headers.add(new Header(name.trim(), value.trim()));
}
}
});
}
StringBuilder url = new StringBuilder(theMsg.getSubscription().getEndpointUrl());
IHttpClient client = myFhirContext.getRestfulClientFactory().getHttpClient(url, params, "", RequestTypeEnum.POST, headers);
IHttpRequest request = client.createParamRequest(myFhirContext, params, null);
try {
IHttpResponse response = request.execute();
// close connection in order to return a possible cached connection to the connection pool
response.close();
} catch (IOException e) {
ourLog.error("Error trying to reach " + theMsg.getSubscription().getEndpointUrl());
e.printStackTrace();
throw new ResourceNotFoundException(e.getMessage());
}
} | [
"protected",
"void",
"sendNotification",
"(",
"ResourceDeliveryMessage",
"theMsg",
")",
"{",
"Map",
"<",
"String",
",",
"List",
"<",
"String",
">",
">",
"params",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"List",
"<",
"Header",
">",
"headers",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"if",
"(",
"theMsg",
".",
"getSubscription",
"(",
")",
".",
"getHeaders",
"(",
")",
"!=",
"null",
")",
"{",
"theMsg",
".",
"getSubscription",
"(",
")",
".",
"getHeaders",
"(",
")",
".",
"stream",
"(",
")",
".",
"filter",
"(",
"Objects",
"::",
"nonNull",
")",
".",
"forEach",
"(",
"h",
"->",
"{",
"final",
"int",
"sep",
"=",
"h",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"sep",
">",
"0",
")",
"{",
"final",
"String",
"name",
"=",
"h",
".",
"substring",
"(",
"0",
",",
"sep",
")",
";",
"final",
"String",
"value",
"=",
"h",
".",
"substring",
"(",
"sep",
"+",
"1",
")",
";",
"if",
"(",
"StringUtils",
".",
"isNotBlank",
"(",
"name",
")",
")",
"{",
"headers",
".",
"add",
"(",
"new",
"Header",
"(",
"name",
".",
"trim",
"(",
")",
",",
"value",
".",
"trim",
"(",
")",
")",
")",
";",
"}",
"}",
"}",
")",
";",
"}",
"StringBuilder",
"url",
"=",
"new",
"StringBuilder",
"(",
"theMsg",
".",
"getSubscription",
"(",
")",
".",
"getEndpointUrl",
"(",
")",
")",
";",
"IHttpClient",
"client",
"=",
"myFhirContext",
".",
"getRestfulClientFactory",
"(",
")",
".",
"getHttpClient",
"(",
"url",
",",
"params",
",",
"\"\"",
",",
"RequestTypeEnum",
".",
"POST",
",",
"headers",
")",
";",
"IHttpRequest",
"request",
"=",
"client",
".",
"createParamRequest",
"(",
"myFhirContext",
",",
"params",
",",
"null",
")",
";",
"try",
"{",
"IHttpResponse",
"response",
"=",
"request",
".",
"execute",
"(",
")",
";",
"// close connection in order to return a possible cached connection to the connection pool",
"response",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"ourLog",
".",
"error",
"(",
"\"Error trying to reach \"",
"+",
"theMsg",
".",
"getSubscription",
"(",
")",
".",
"getEndpointUrl",
"(",
")",
")",
";",
"e",
".",
"printStackTrace",
"(",
")",
";",
"throw",
"new",
"ResourceNotFoundException",
"(",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"}"
] | Sends a POST notification without a payload | [
"Sends",
"a",
"POST",
"notification",
"without",
"a",
"payload"
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/module/subscriber/SubscriptionDeliveringRestHookSubscriber.java#L193-L221 |
22,562 | jamesagnew/hapi-fhir | hapi-fhir-base/src/main/java/ca/uhn/fhir/interceptor/executor/InterceptorService.java | InterceptorService.getInvokersForPointcut | private List<BaseInvoker> getInvokersForPointcut(Pointcut thePointcut) {
List<BaseInvoker> invokers;
synchronized (myRegistryMutex) {
List<BaseInvoker> globalInvokers = myGlobalInvokers.get(thePointcut);
List<BaseInvoker> anonymousInvokers = myAnonymousInvokers.get(thePointcut);
List<BaseInvoker> threadLocalInvokers = null;
if (myThreadlocalInvokersEnabled) {
ListMultimap<Pointcut, BaseInvoker> pointcutToInvokers = myThreadlocalInvokers.get();
if (pointcutToInvokers != null) {
threadLocalInvokers = pointcutToInvokers.get(thePointcut);
}
}
invokers = union(globalInvokers, anonymousInvokers, threadLocalInvokers);
}
return invokers;
} | java | private List<BaseInvoker> getInvokersForPointcut(Pointcut thePointcut) {
List<BaseInvoker> invokers;
synchronized (myRegistryMutex) {
List<BaseInvoker> globalInvokers = myGlobalInvokers.get(thePointcut);
List<BaseInvoker> anonymousInvokers = myAnonymousInvokers.get(thePointcut);
List<BaseInvoker> threadLocalInvokers = null;
if (myThreadlocalInvokersEnabled) {
ListMultimap<Pointcut, BaseInvoker> pointcutToInvokers = myThreadlocalInvokers.get();
if (pointcutToInvokers != null) {
threadLocalInvokers = pointcutToInvokers.get(thePointcut);
}
}
invokers = union(globalInvokers, anonymousInvokers, threadLocalInvokers);
}
return invokers;
} | [
"private",
"List",
"<",
"BaseInvoker",
">",
"getInvokersForPointcut",
"(",
"Pointcut",
"thePointcut",
")",
"{",
"List",
"<",
"BaseInvoker",
">",
"invokers",
";",
"synchronized",
"(",
"myRegistryMutex",
")",
"{",
"List",
"<",
"BaseInvoker",
">",
"globalInvokers",
"=",
"myGlobalInvokers",
".",
"get",
"(",
"thePointcut",
")",
";",
"List",
"<",
"BaseInvoker",
">",
"anonymousInvokers",
"=",
"myAnonymousInvokers",
".",
"get",
"(",
"thePointcut",
")",
";",
"List",
"<",
"BaseInvoker",
">",
"threadLocalInvokers",
"=",
"null",
";",
"if",
"(",
"myThreadlocalInvokersEnabled",
")",
"{",
"ListMultimap",
"<",
"Pointcut",
",",
"BaseInvoker",
">",
"pointcutToInvokers",
"=",
"myThreadlocalInvokers",
".",
"get",
"(",
")",
";",
"if",
"(",
"pointcutToInvokers",
"!=",
"null",
")",
"{",
"threadLocalInvokers",
"=",
"pointcutToInvokers",
".",
"get",
"(",
"thePointcut",
")",
";",
"}",
"}",
"invokers",
"=",
"union",
"(",
"globalInvokers",
",",
"anonymousInvokers",
",",
"threadLocalInvokers",
")",
";",
"}",
"return",
"invokers",
";",
"}"
] | Returns an ordered list of invokers for the given pointcut. Note that
a new and stable list is returned to.. do whatever you want with it. | [
"Returns",
"an",
"ordered",
"list",
"of",
"invokers",
"for",
"the",
"given",
"pointcut",
".",
"Note",
"that",
"a",
"new",
"and",
"stable",
"list",
"is",
"returned",
"to",
"..",
"do",
"whatever",
"you",
"want",
"with",
"it",
"."
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-base/src/main/java/ca/uhn/fhir/interceptor/executor/InterceptorService.java#L290-L307 |
22,563 | jamesagnew/hapi-fhir | hapi-fhir-base/src/main/java/ca/uhn/fhir/interceptor/executor/InterceptorService.java | InterceptorService.union | @SafeVarargs
private final List<BaseInvoker> union(List<BaseInvoker>... theInvokersLists) {
List<BaseInvoker> haveOne = null;
boolean haveMultiple = false;
for (List<BaseInvoker> nextInvokerList : theInvokersLists) {
if (nextInvokerList == null || nextInvokerList.isEmpty()) {
continue;
}
if (haveOne == null) {
haveOne = nextInvokerList;
} else {
haveMultiple = true;
}
}
if (haveOne == null) {
return Collections.emptyList();
}
List<BaseInvoker> retVal;
if (haveMultiple == false) {
// The global list doesn't need to be sorted every time since it's sorted on
// insertion each time. Doing so is a waste of cycles..
if (haveOne == theInvokersLists[0]) {
retVal = haveOne;
} else {
retVal = new ArrayList<>(haveOne);
retVal.sort(Comparator.naturalOrder());
}
} else {
retVal = Arrays
.stream(theInvokersLists)
.filter(t -> t != null)
.flatMap(t -> t.stream())
.sorted()
.collect(Collectors.toList());
}
return retVal;
} | java | @SafeVarargs
private final List<BaseInvoker> union(List<BaseInvoker>... theInvokersLists) {
List<BaseInvoker> haveOne = null;
boolean haveMultiple = false;
for (List<BaseInvoker> nextInvokerList : theInvokersLists) {
if (nextInvokerList == null || nextInvokerList.isEmpty()) {
continue;
}
if (haveOne == null) {
haveOne = nextInvokerList;
} else {
haveMultiple = true;
}
}
if (haveOne == null) {
return Collections.emptyList();
}
List<BaseInvoker> retVal;
if (haveMultiple == false) {
// The global list doesn't need to be sorted every time since it's sorted on
// insertion each time. Doing so is a waste of cycles..
if (haveOne == theInvokersLists[0]) {
retVal = haveOne;
} else {
retVal = new ArrayList<>(haveOne);
retVal.sort(Comparator.naturalOrder());
}
} else {
retVal = Arrays
.stream(theInvokersLists)
.filter(t -> t != null)
.flatMap(t -> t.stream())
.sorted()
.collect(Collectors.toList());
}
return retVal;
} | [
"@",
"SafeVarargs",
"private",
"final",
"List",
"<",
"BaseInvoker",
">",
"union",
"(",
"List",
"<",
"BaseInvoker",
">",
"...",
"theInvokersLists",
")",
"{",
"List",
"<",
"BaseInvoker",
">",
"haveOne",
"=",
"null",
";",
"boolean",
"haveMultiple",
"=",
"false",
";",
"for",
"(",
"List",
"<",
"BaseInvoker",
">",
"nextInvokerList",
":",
"theInvokersLists",
")",
"{",
"if",
"(",
"nextInvokerList",
"==",
"null",
"||",
"nextInvokerList",
".",
"isEmpty",
"(",
")",
")",
"{",
"continue",
";",
"}",
"if",
"(",
"haveOne",
"==",
"null",
")",
"{",
"haveOne",
"=",
"nextInvokerList",
";",
"}",
"else",
"{",
"haveMultiple",
"=",
"true",
";",
"}",
"}",
"if",
"(",
"haveOne",
"==",
"null",
")",
"{",
"return",
"Collections",
".",
"emptyList",
"(",
")",
";",
"}",
"List",
"<",
"BaseInvoker",
">",
"retVal",
";",
"if",
"(",
"haveMultiple",
"==",
"false",
")",
"{",
"// The global list doesn't need to be sorted every time since it's sorted on",
"// insertion each time. Doing so is a waste of cycles..",
"if",
"(",
"haveOne",
"==",
"theInvokersLists",
"[",
"0",
"]",
")",
"{",
"retVal",
"=",
"haveOne",
";",
"}",
"else",
"{",
"retVal",
"=",
"new",
"ArrayList",
"<>",
"(",
"haveOne",
")",
";",
"retVal",
".",
"sort",
"(",
"Comparator",
".",
"naturalOrder",
"(",
")",
")",
";",
"}",
"}",
"else",
"{",
"retVal",
"=",
"Arrays",
".",
"stream",
"(",
"theInvokersLists",
")",
".",
"filter",
"(",
"t",
"->",
"t",
"!=",
"null",
")",
".",
"flatMap",
"(",
"t",
"->",
"t",
".",
"stream",
"(",
")",
")",
".",
"sorted",
"(",
")",
".",
"collect",
"(",
"Collectors",
".",
"toList",
"(",
")",
")",
";",
"}",
"return",
"retVal",
";",
"}"
] | First argument must be the global invoker list!! | [
"First",
"argument",
"must",
"be",
"the",
"global",
"invoker",
"list!!"
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-base/src/main/java/ca/uhn/fhir/interceptor/executor/InterceptorService.java#L312-L357 |
22,564 | jamesagnew/hapi-fhir | hapi-fhir-base/src/main/java/ca/uhn/fhir/interceptor/executor/InterceptorService.java | InterceptorService.haveAppropriateParams | boolean haveAppropriateParams(Pointcut thePointcut, HookParams theParams) {
Validate.isTrue(theParams.getParamsForType().values().size() == thePointcut.getParameterTypes().size(), "Wrong number of params for pointcut %s - Wanted %s but found %s", thePointcut.name(), toErrorString(thePointcut.getParameterTypes()), theParams.getParamsForType().values().stream().map(t -> t != null ? t.getClass().getSimpleName() : "null").sorted().collect(Collectors.toList()));
List<String> wantedTypes = new ArrayList<>(thePointcut.getParameterTypes());
ListMultimap<Class<?>, Object> givenTypes = theParams.getParamsForType();
for (Class<?> nextTypeClass : givenTypes.keySet()) {
String nextTypeName = nextTypeClass.getName();
for (Object nextParamValue : givenTypes.get(nextTypeClass)) {
Validate.isTrue(nextParamValue == null || nextTypeClass.isAssignableFrom(nextParamValue.getClass()), "Invalid params for pointcut %s - %s is not of type %s", thePointcut.name(), nextParamValue != null ? nextParamValue.getClass() : "null", nextTypeClass);
Validate.isTrue(wantedTypes.remove(nextTypeName), "Invalid params for pointcut %s - Wanted %s but found %s", thePointcut.name(), toErrorString(thePointcut.getParameterTypes()), nextTypeName);
}
}
return true;
} | java | boolean haveAppropriateParams(Pointcut thePointcut, HookParams theParams) {
Validate.isTrue(theParams.getParamsForType().values().size() == thePointcut.getParameterTypes().size(), "Wrong number of params for pointcut %s - Wanted %s but found %s", thePointcut.name(), toErrorString(thePointcut.getParameterTypes()), theParams.getParamsForType().values().stream().map(t -> t != null ? t.getClass().getSimpleName() : "null").sorted().collect(Collectors.toList()));
List<String> wantedTypes = new ArrayList<>(thePointcut.getParameterTypes());
ListMultimap<Class<?>, Object> givenTypes = theParams.getParamsForType();
for (Class<?> nextTypeClass : givenTypes.keySet()) {
String nextTypeName = nextTypeClass.getName();
for (Object nextParamValue : givenTypes.get(nextTypeClass)) {
Validate.isTrue(nextParamValue == null || nextTypeClass.isAssignableFrom(nextParamValue.getClass()), "Invalid params for pointcut %s - %s is not of type %s", thePointcut.name(), nextParamValue != null ? nextParamValue.getClass() : "null", nextTypeClass);
Validate.isTrue(wantedTypes.remove(nextTypeName), "Invalid params for pointcut %s - Wanted %s but found %s", thePointcut.name(), toErrorString(thePointcut.getParameterTypes()), nextTypeName);
}
}
return true;
} | [
"boolean",
"haveAppropriateParams",
"(",
"Pointcut",
"thePointcut",
",",
"HookParams",
"theParams",
")",
"{",
"Validate",
".",
"isTrue",
"(",
"theParams",
".",
"getParamsForType",
"(",
")",
".",
"values",
"(",
")",
".",
"size",
"(",
")",
"==",
"thePointcut",
".",
"getParameterTypes",
"(",
")",
".",
"size",
"(",
")",
",",
"\"Wrong number of params for pointcut %s - Wanted %s but found %s\"",
",",
"thePointcut",
".",
"name",
"(",
")",
",",
"toErrorString",
"(",
"thePointcut",
".",
"getParameterTypes",
"(",
")",
")",
",",
"theParams",
".",
"getParamsForType",
"(",
")",
".",
"values",
"(",
")",
".",
"stream",
"(",
")",
".",
"map",
"(",
"t",
"->",
"t",
"!=",
"null",
"?",
"t",
".",
"getClass",
"(",
")",
".",
"getSimpleName",
"(",
")",
":",
"\"null\"",
")",
".",
"sorted",
"(",
")",
".",
"collect",
"(",
"Collectors",
".",
"toList",
"(",
")",
")",
")",
";",
"List",
"<",
"String",
">",
"wantedTypes",
"=",
"new",
"ArrayList",
"<>",
"(",
"thePointcut",
".",
"getParameterTypes",
"(",
")",
")",
";",
"ListMultimap",
"<",
"Class",
"<",
"?",
">",
",",
"Object",
">",
"givenTypes",
"=",
"theParams",
".",
"getParamsForType",
"(",
")",
";",
"for",
"(",
"Class",
"<",
"?",
">",
"nextTypeClass",
":",
"givenTypes",
".",
"keySet",
"(",
")",
")",
"{",
"String",
"nextTypeName",
"=",
"nextTypeClass",
".",
"getName",
"(",
")",
";",
"for",
"(",
"Object",
"nextParamValue",
":",
"givenTypes",
".",
"get",
"(",
"nextTypeClass",
")",
")",
"{",
"Validate",
".",
"isTrue",
"(",
"nextParamValue",
"==",
"null",
"||",
"nextTypeClass",
".",
"isAssignableFrom",
"(",
"nextParamValue",
".",
"getClass",
"(",
")",
")",
",",
"\"Invalid params for pointcut %s - %s is not of type %s\"",
",",
"thePointcut",
".",
"name",
"(",
")",
",",
"nextParamValue",
"!=",
"null",
"?",
"nextParamValue",
".",
"getClass",
"(",
")",
":",
"\"null\"",
",",
"nextTypeClass",
")",
";",
"Validate",
".",
"isTrue",
"(",
"wantedTypes",
".",
"remove",
"(",
"nextTypeName",
")",
",",
"\"Invalid params for pointcut %s - Wanted %s but found %s\"",
",",
"thePointcut",
".",
"name",
"(",
")",
",",
"toErrorString",
"(",
"thePointcut",
".",
"getParameterTypes",
"(",
")",
")",
",",
"nextTypeName",
")",
";",
"}",
"}",
"return",
"true",
";",
"}"
] | Only call this when assertions are enabled, it's expensive | [
"Only",
"call",
"this",
"when",
"assertions",
"are",
"enabled",
"it",
"s",
"expensive"
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-base/src/main/java/ca/uhn/fhir/interceptor/executor/InterceptorService.java#L362-L377 |
22,565 | jamesagnew/hapi-fhir | hapi-fhir-base/src/main/java/ca/uhn/fhir/util/StopWatch.java | StopWatch.getEstimatedTimeRemaining | public String getEstimatedTimeRemaining(double theCompleteToDate, double theTotal) {
double millis = getMillis();
long millisRemaining = (long) (((theTotal / theCompleteToDate) * millis) - (millis));
return formatMillis(millisRemaining);
} | java | public String getEstimatedTimeRemaining(double theCompleteToDate, double theTotal) {
double millis = getMillis();
long millisRemaining = (long) (((theTotal / theCompleteToDate) * millis) - (millis));
return formatMillis(millisRemaining);
} | [
"public",
"String",
"getEstimatedTimeRemaining",
"(",
"double",
"theCompleteToDate",
",",
"double",
"theTotal",
")",
"{",
"double",
"millis",
"=",
"getMillis",
"(",
")",
";",
"long",
"millisRemaining",
"=",
"(",
"long",
")",
"(",
"(",
"(",
"theTotal",
"/",
"theCompleteToDate",
")",
"*",
"millis",
")",
"-",
"(",
"millis",
")",
")",
";",
"return",
"formatMillis",
"(",
"millisRemaining",
")",
";",
"}"
] | Given an amount of something completed so far, and a total amount, calculates how long it will take for something to complete
@param theCompleteToDate The amount so far
@param theTotal The total (must be higher than theCompleteToDate
@return A formatted amount of time | [
"Given",
"an",
"amount",
"of",
"something",
"completed",
"so",
"far",
"and",
"a",
"total",
"amount",
"calculates",
"how",
"long",
"it",
"will",
"take",
"for",
"something",
"to",
"complete"
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/StopWatch.java#L180-L184 |
22,566 | jamesagnew/hapi-fhir | hapi-fhir-base/src/main/java/ca/uhn/fhir/util/StopWatch.java | StopWatch.append | static private void append(StringBuilder tgt, String pfx, int dgt, long val) {
tgt.append(pfx);
if (dgt > 1) {
int pad = (dgt - 1);
for (long xa = val; xa > 9 && pad > 0; xa /= 10) {
pad--;
}
for (int xa = 0; xa < pad; xa++) {
tgt.append('0');
}
}
tgt.append(val);
} | java | static private void append(StringBuilder tgt, String pfx, int dgt, long val) {
tgt.append(pfx);
if (dgt > 1) {
int pad = (dgt - 1);
for (long xa = val; xa > 9 && pad > 0; xa /= 10) {
pad--;
}
for (int xa = 0; xa < pad; xa++) {
tgt.append('0');
}
}
tgt.append(val);
} | [
"static",
"private",
"void",
"append",
"(",
"StringBuilder",
"tgt",
",",
"String",
"pfx",
",",
"int",
"dgt",
",",
"long",
"val",
")",
"{",
"tgt",
".",
"append",
"(",
"pfx",
")",
";",
"if",
"(",
"dgt",
">",
"1",
")",
"{",
"int",
"pad",
"=",
"(",
"dgt",
"-",
"1",
")",
";",
"for",
"(",
"long",
"xa",
"=",
"val",
";",
"xa",
">",
"9",
"&&",
"pad",
">",
"0",
";",
"xa",
"/=",
"10",
")",
"{",
"pad",
"--",
";",
"}",
"for",
"(",
"int",
"xa",
"=",
"0",
";",
"xa",
"<",
"pad",
";",
"xa",
"++",
")",
"{",
"tgt",
".",
"append",
"(",
"'",
"'",
")",
";",
"}",
"}",
"tgt",
".",
"append",
"(",
"val",
")",
";",
"}"
] | Append a right-aligned and zero-padded numeric value to a `StringBuilder`. | [
"Append",
"a",
"right",
"-",
"aligned",
"and",
"zero",
"-",
"padded",
"numeric",
"value",
"to",
"a",
"StringBuilder",
"."
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/StopWatch.java#L327-L339 |
22,567 | jamesagnew/hapi-fhir | hapi-fhir-base/src/main/java/ca/uhn/fhir/narrative2/BaseNarrativeGenerator.java | BaseNarrativeGenerator.cleanWhitespace | public static String cleanWhitespace(String theResult) {
StringBuilder b = new StringBuilder();
boolean inWhitespace = false;
boolean betweenTags = false;
boolean lastNonWhitespaceCharWasTagEnd = false;
boolean inPre = false;
for (int i = 0; i < theResult.length(); i++) {
char nextChar = theResult.charAt(i);
if (inPre) {
b.append(nextChar);
continue;
} else if (nextChar == '>') {
b.append(nextChar);
betweenTags = true;
lastNonWhitespaceCharWasTagEnd = true;
continue;
} else if (nextChar == '\n' || nextChar == '\r') {
continue;
}
if (betweenTags) {
if (Character.isWhitespace(nextChar)) {
inWhitespace = true;
} else if (nextChar == '<') {
if (inWhitespace && !lastNonWhitespaceCharWasTagEnd) {
b.append(' ');
}
b.append(nextChar);
inWhitespace = false;
betweenTags = false;
lastNonWhitespaceCharWasTagEnd = false;
if (i + 3 < theResult.length()) {
char char1 = Character.toLowerCase(theResult.charAt(i + 1));
char char2 = Character.toLowerCase(theResult.charAt(i + 2));
char char3 = Character.toLowerCase(theResult.charAt(i + 3));
char char4 = Character.toLowerCase((i + 4 < theResult.length()) ? theResult.charAt(i + 4) : ' ');
if (char1 == 'p' && char2 == 'r' && char3 == 'e') {
inPre = true;
} else if (char1 == '/' && char2 == 'p' && char3 == 'r' && char4 == 'e') {
inPre = false;
}
}
} else {
lastNonWhitespaceCharWasTagEnd = false;
if (inWhitespace) {
b.append(' ');
inWhitespace = false;
}
b.append(nextChar);
}
} else {
b.append(nextChar);
}
}
return b.toString();
} | java | public static String cleanWhitespace(String theResult) {
StringBuilder b = new StringBuilder();
boolean inWhitespace = false;
boolean betweenTags = false;
boolean lastNonWhitespaceCharWasTagEnd = false;
boolean inPre = false;
for (int i = 0; i < theResult.length(); i++) {
char nextChar = theResult.charAt(i);
if (inPre) {
b.append(nextChar);
continue;
} else if (nextChar == '>') {
b.append(nextChar);
betweenTags = true;
lastNonWhitespaceCharWasTagEnd = true;
continue;
} else if (nextChar == '\n' || nextChar == '\r') {
continue;
}
if (betweenTags) {
if (Character.isWhitespace(nextChar)) {
inWhitespace = true;
} else if (nextChar == '<') {
if (inWhitespace && !lastNonWhitespaceCharWasTagEnd) {
b.append(' ');
}
b.append(nextChar);
inWhitespace = false;
betweenTags = false;
lastNonWhitespaceCharWasTagEnd = false;
if (i + 3 < theResult.length()) {
char char1 = Character.toLowerCase(theResult.charAt(i + 1));
char char2 = Character.toLowerCase(theResult.charAt(i + 2));
char char3 = Character.toLowerCase(theResult.charAt(i + 3));
char char4 = Character.toLowerCase((i + 4 < theResult.length()) ? theResult.charAt(i + 4) : ' ');
if (char1 == 'p' && char2 == 'r' && char3 == 'e') {
inPre = true;
} else if (char1 == '/' && char2 == 'p' && char3 == 'r' && char4 == 'e') {
inPre = false;
}
}
} else {
lastNonWhitespaceCharWasTagEnd = false;
if (inWhitespace) {
b.append(' ');
inWhitespace = false;
}
b.append(nextChar);
}
} else {
b.append(nextChar);
}
}
return b.toString();
} | [
"public",
"static",
"String",
"cleanWhitespace",
"(",
"String",
"theResult",
")",
"{",
"StringBuilder",
"b",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"boolean",
"inWhitespace",
"=",
"false",
";",
"boolean",
"betweenTags",
"=",
"false",
";",
"boolean",
"lastNonWhitespaceCharWasTagEnd",
"=",
"false",
";",
"boolean",
"inPre",
"=",
"false",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"theResult",
".",
"length",
"(",
")",
";",
"i",
"++",
")",
"{",
"char",
"nextChar",
"=",
"theResult",
".",
"charAt",
"(",
"i",
")",
";",
"if",
"(",
"inPre",
")",
"{",
"b",
".",
"append",
"(",
"nextChar",
")",
";",
"continue",
";",
"}",
"else",
"if",
"(",
"nextChar",
"==",
"'",
"'",
")",
"{",
"b",
".",
"append",
"(",
"nextChar",
")",
";",
"betweenTags",
"=",
"true",
";",
"lastNonWhitespaceCharWasTagEnd",
"=",
"true",
";",
"continue",
";",
"}",
"else",
"if",
"(",
"nextChar",
"==",
"'",
"'",
"||",
"nextChar",
"==",
"'",
"'",
")",
"{",
"continue",
";",
"}",
"if",
"(",
"betweenTags",
")",
"{",
"if",
"(",
"Character",
".",
"isWhitespace",
"(",
"nextChar",
")",
")",
"{",
"inWhitespace",
"=",
"true",
";",
"}",
"else",
"if",
"(",
"nextChar",
"==",
"'",
"'",
")",
"{",
"if",
"(",
"inWhitespace",
"&&",
"!",
"lastNonWhitespaceCharWasTagEnd",
")",
"{",
"b",
".",
"append",
"(",
"'",
"'",
")",
";",
"}",
"b",
".",
"append",
"(",
"nextChar",
")",
";",
"inWhitespace",
"=",
"false",
";",
"betweenTags",
"=",
"false",
";",
"lastNonWhitespaceCharWasTagEnd",
"=",
"false",
";",
"if",
"(",
"i",
"+",
"3",
"<",
"theResult",
".",
"length",
"(",
")",
")",
"{",
"char",
"char1",
"=",
"Character",
".",
"toLowerCase",
"(",
"theResult",
".",
"charAt",
"(",
"i",
"+",
"1",
")",
")",
";",
"char",
"char2",
"=",
"Character",
".",
"toLowerCase",
"(",
"theResult",
".",
"charAt",
"(",
"i",
"+",
"2",
")",
")",
";",
"char",
"char3",
"=",
"Character",
".",
"toLowerCase",
"(",
"theResult",
".",
"charAt",
"(",
"i",
"+",
"3",
")",
")",
";",
"char",
"char4",
"=",
"Character",
".",
"toLowerCase",
"(",
"(",
"i",
"+",
"4",
"<",
"theResult",
".",
"length",
"(",
")",
")",
"?",
"theResult",
".",
"charAt",
"(",
"i",
"+",
"4",
")",
":",
"'",
"'",
")",
";",
"if",
"(",
"char1",
"==",
"'",
"'",
"&&",
"char2",
"==",
"'",
"'",
"&&",
"char3",
"==",
"'",
"'",
")",
"{",
"inPre",
"=",
"true",
";",
"}",
"else",
"if",
"(",
"char1",
"==",
"'",
"'",
"&&",
"char2",
"==",
"'",
"'",
"&&",
"char3",
"==",
"'",
"'",
"&&",
"char4",
"==",
"'",
"'",
")",
"{",
"inPre",
"=",
"false",
";",
"}",
"}",
"}",
"else",
"{",
"lastNonWhitespaceCharWasTagEnd",
"=",
"false",
";",
"if",
"(",
"inWhitespace",
")",
"{",
"b",
".",
"append",
"(",
"'",
"'",
")",
";",
"inWhitespace",
"=",
"false",
";",
"}",
"b",
".",
"append",
"(",
"nextChar",
")",
";",
"}",
"}",
"else",
"{",
"b",
".",
"append",
"(",
"nextChar",
")",
";",
"}",
"}",
"return",
"b",
".",
"toString",
"(",
")",
";",
"}"
] | Trims the superfluous whitespace out of an HTML block | [
"Trims",
"the",
"superfluous",
"whitespace",
"out",
"of",
"an",
"HTML",
"block"
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-base/src/main/java/ca/uhn/fhir/narrative2/BaseNarrativeGenerator.java#L154-L209 |
22,568 | jamesagnew/hapi-fhir | hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsConformanceProvider.java | AbstractJaxRsConformanceProvider.conformance | @GET
@Path("/metadata")
public Response conformance() throws IOException {
setUpPostConstruct();
Builder request = getRequest(RequestTypeEnum.OPTIONS, RestOperationTypeEnum.METADATA);
IRestfulResponse response = request.build().getResponse();
response.addHeader(Constants.HEADER_CORS_ALLOW_ORIGIN, "*");
IBaseResource conformance;
FhirVersionEnum fhirContextVersion = super.getFhirContext().getVersion().getVersion();
switch (fhirContextVersion) {
case R4:
conformance = myR4CapabilityStatement;
break;
case DSTU3:
conformance = myDstu3CapabilityStatement;
break;
case DSTU2_1:
conformance = myDstu2_1Conformance;
break;
case DSTU2_HL7ORG:
conformance = myDstu2Hl7OrgConformance;
break;
case DSTU2:
conformance = myDstu2Conformance;
break;
default:
throw new ConfigurationException("Unsupported Fhir version: " + fhirContextVersion);
}
if (conformance != null) {
Set<SummaryEnum> summaryMode = Collections.emptySet();
return (Response) response.streamResponseAsResource(conformance, false, summaryMode, Constants.STATUS_HTTP_200_OK, null, true, false);
}
return (Response) response.returnResponse(null, Constants.STATUS_HTTP_500_INTERNAL_ERROR, true, null, getResourceType().getSimpleName());
} | java | @GET
@Path("/metadata")
public Response conformance() throws IOException {
setUpPostConstruct();
Builder request = getRequest(RequestTypeEnum.OPTIONS, RestOperationTypeEnum.METADATA);
IRestfulResponse response = request.build().getResponse();
response.addHeader(Constants.HEADER_CORS_ALLOW_ORIGIN, "*");
IBaseResource conformance;
FhirVersionEnum fhirContextVersion = super.getFhirContext().getVersion().getVersion();
switch (fhirContextVersion) {
case R4:
conformance = myR4CapabilityStatement;
break;
case DSTU3:
conformance = myDstu3CapabilityStatement;
break;
case DSTU2_1:
conformance = myDstu2_1Conformance;
break;
case DSTU2_HL7ORG:
conformance = myDstu2Hl7OrgConformance;
break;
case DSTU2:
conformance = myDstu2Conformance;
break;
default:
throw new ConfigurationException("Unsupported Fhir version: " + fhirContextVersion);
}
if (conformance != null) {
Set<SummaryEnum> summaryMode = Collections.emptySet();
return (Response) response.streamResponseAsResource(conformance, false, summaryMode, Constants.STATUS_HTTP_200_OK, null, true, false);
}
return (Response) response.returnResponse(null, Constants.STATUS_HTTP_500_INTERNAL_ERROR, true, null, getResourceType().getSimpleName());
} | [
"@",
"GET",
"@",
"Path",
"(",
"\"/metadata\"",
")",
"public",
"Response",
"conformance",
"(",
")",
"throws",
"IOException",
"{",
"setUpPostConstruct",
"(",
")",
";",
"Builder",
"request",
"=",
"getRequest",
"(",
"RequestTypeEnum",
".",
"OPTIONS",
",",
"RestOperationTypeEnum",
".",
"METADATA",
")",
";",
"IRestfulResponse",
"response",
"=",
"request",
".",
"build",
"(",
")",
".",
"getResponse",
"(",
")",
";",
"response",
".",
"addHeader",
"(",
"Constants",
".",
"HEADER_CORS_ALLOW_ORIGIN",
",",
"\"*\"",
")",
";",
"IBaseResource",
"conformance",
";",
"FhirVersionEnum",
"fhirContextVersion",
"=",
"super",
".",
"getFhirContext",
"(",
")",
".",
"getVersion",
"(",
")",
".",
"getVersion",
"(",
")",
";",
"switch",
"(",
"fhirContextVersion",
")",
"{",
"case",
"R4",
":",
"conformance",
"=",
"myR4CapabilityStatement",
";",
"break",
";",
"case",
"DSTU3",
":",
"conformance",
"=",
"myDstu3CapabilityStatement",
";",
"break",
";",
"case",
"DSTU2_1",
":",
"conformance",
"=",
"myDstu2_1Conformance",
";",
"break",
";",
"case",
"DSTU2_HL7ORG",
":",
"conformance",
"=",
"myDstu2Hl7OrgConformance",
";",
"break",
";",
"case",
"DSTU2",
":",
"conformance",
"=",
"myDstu2Conformance",
";",
"break",
";",
"default",
":",
"throw",
"new",
"ConfigurationException",
"(",
"\"Unsupported Fhir version: \"",
"+",
"fhirContextVersion",
")",
";",
"}",
"if",
"(",
"conformance",
"!=",
"null",
")",
"{",
"Set",
"<",
"SummaryEnum",
">",
"summaryMode",
"=",
"Collections",
".",
"emptySet",
"(",
")",
";",
"return",
"(",
"Response",
")",
"response",
".",
"streamResponseAsResource",
"(",
"conformance",
",",
"false",
",",
"summaryMode",
",",
"Constants",
".",
"STATUS_HTTP_200_OK",
",",
"null",
",",
"true",
",",
"false",
")",
";",
"}",
"return",
"(",
"Response",
")",
"response",
".",
"returnResponse",
"(",
"null",
",",
"Constants",
".",
"STATUS_HTTP_500_INTERNAL_ERROR",
",",
"true",
",",
"null",
",",
"getResourceType",
"(",
")",
".",
"getSimpleName",
"(",
")",
")",
";",
"}"
] | This method will retrieve the conformance using the http GET method
@return the response containing the conformance | [
"This",
"method",
"will",
"retrieve",
"the",
"conformance",
"using",
"the",
"http",
"GET",
"method"
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsConformanceProvider.java#L192-L228 |
22,569 | jamesagnew/hapi-fhir | hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/BaseParser.java | BaseParser.shouldEncodePath | protected boolean shouldEncodePath(IResource theResource, String thePath) {
if (myDontEncodeElements != null) {
String resourceName = myContext.getResourceDefinition(theResource).getName();
if (myDontEncodeElements.stream().anyMatch(t -> t.equalsPath(resourceName + "." + thePath))) {
return false;
} else if (myDontEncodeElements.stream().anyMatch(t -> t.equalsPath("*." + thePath))) {
return false;
}
}
return true;
} | java | protected boolean shouldEncodePath(IResource theResource, String thePath) {
if (myDontEncodeElements != null) {
String resourceName = myContext.getResourceDefinition(theResource).getName();
if (myDontEncodeElements.stream().anyMatch(t -> t.equalsPath(resourceName + "." + thePath))) {
return false;
} else if (myDontEncodeElements.stream().anyMatch(t -> t.equalsPath("*." + thePath))) {
return false;
}
}
return true;
} | [
"protected",
"boolean",
"shouldEncodePath",
"(",
"IResource",
"theResource",
",",
"String",
"thePath",
")",
"{",
"if",
"(",
"myDontEncodeElements",
"!=",
"null",
")",
"{",
"String",
"resourceName",
"=",
"myContext",
".",
"getResourceDefinition",
"(",
"theResource",
")",
".",
"getName",
"(",
")",
";",
"if",
"(",
"myDontEncodeElements",
".",
"stream",
"(",
")",
".",
"anyMatch",
"(",
"t",
"->",
"t",
".",
"equalsPath",
"(",
"resourceName",
"+",
"\".\"",
"+",
"thePath",
")",
")",
")",
"{",
"return",
"false",
";",
"}",
"else",
"if",
"(",
"myDontEncodeElements",
".",
"stream",
"(",
")",
".",
"anyMatch",
"(",
"t",
"->",
"t",
".",
"equalsPath",
"(",
"\"*.\"",
"+",
"thePath",
")",
")",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}"
] | Used for DSTU2 only | [
"Used",
"for",
"DSTU2",
"only"
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/BaseParser.java#L941-L951 |
22,570 | jamesagnew/hapi-fhir | hapi-fhir-converter/src/main/java/org/hl7/fhir/convertors/CCDAConverter.java | CCDAConverter.processAdverseReactionObservation | protected AllergyIntoleranceReactionComponent processAdverseReactionObservation(Element reaction) throws Exception {
checkNoNegationOrNullFlavor(reaction, "Adverse Reaction Observation");
checkNoSubject(reaction, "Adverse Reaction Observation");
// This clinical statement represents an undesired symptom, finding, etc., due to an administered or exposed substance. A reaction can be defined with respect to its severity, and can have been treated by one or more interventions.
AllergyIntoleranceReactionComponent ar = new AllergyIntoleranceReactionComponent();
// SHALL contain exactly one [1..1] id (CONF:7329).
for (Element e : cda.getChildren(reaction, "id"))
ToolingExtensions.addIdentifier(ar, convert.makeIdentifierFromII(e));
// SHALL contain exactly one [1..1] code (CONF:7327). The value set for this code element has not been specified.
// todo: what the heck is this?
// SHOULD contain zero or one [0..1] text (CONF:7330).
// todo: so what is this? how can we know whether to ignore it?
// 8. SHOULD contain zero or one [0..1] effectiveTime (CONF:7332).
// a. This effectiveTime SHOULD contain zero or one [0..1] low (CONF:7333).
// b. This effectiveTime SHOULD contain zero or one [0..1] high (CONF:7334).
// !this is a problem because FHIR just has a date, not a period.
ar.setOnsetElement(convert.makeDateTimeFromIVL(cda.getChild(reaction, "effectiveTime")));
// SHALL contain exactly one [1..1] value with @xsi:type="CD", where the @code SHALL be selected from ValueSet 2.16.840.1.113883.3.88.12.3221.7.4 Problem DYNAMIC (CONF:7335).
ar.getManifestation().add(convert.makeCodeableConceptFromCD(cda.getChild(reaction, "value")));
// SHOULD contain zero or one [0..1] entryRelationship (CONF:7580) such that it SHALL contain exactly one [1..1] Severity Observation (templateId:2.16.840.1.113883.10.20.22.4.8) (CONF:7582).
ar.setSeverity(readSeverity(cda.getSeverity(reaction)));
// MAY contain zero or more [0..*] entryRelationship (CONF:7337) such that it SHALL contain exactly one [1..1] Procedure Activity Procedure (templateId:2.16.840.1.113883.10.20.22.4.14) (CONF:7339).
// i. This procedure activity is intended to contain information about procedures that were performed in response to an allergy reaction
// todo: process these into an procedure and add as an extension
// MAY contain zero or more [0..*] entryRelationship (CONF:7340) such that it SHALL contain exactly one [1..1] Medication Activity (templateId:2.16.840.1.113883.10.20.22.4.16) (CONF:7342).
// i. This medication activity is intended to contain information about medications that were administered in response to an allergy reaction. (CONF:7584).
// todo: process these into an medication statement and add as an extension
return ar;
} | java | protected AllergyIntoleranceReactionComponent processAdverseReactionObservation(Element reaction) throws Exception {
checkNoNegationOrNullFlavor(reaction, "Adverse Reaction Observation");
checkNoSubject(reaction, "Adverse Reaction Observation");
// This clinical statement represents an undesired symptom, finding, etc., due to an administered or exposed substance. A reaction can be defined with respect to its severity, and can have been treated by one or more interventions.
AllergyIntoleranceReactionComponent ar = new AllergyIntoleranceReactionComponent();
// SHALL contain exactly one [1..1] id (CONF:7329).
for (Element e : cda.getChildren(reaction, "id"))
ToolingExtensions.addIdentifier(ar, convert.makeIdentifierFromII(e));
// SHALL contain exactly one [1..1] code (CONF:7327). The value set for this code element has not been specified.
// todo: what the heck is this?
// SHOULD contain zero or one [0..1] text (CONF:7330).
// todo: so what is this? how can we know whether to ignore it?
// 8. SHOULD contain zero or one [0..1] effectiveTime (CONF:7332).
// a. This effectiveTime SHOULD contain zero or one [0..1] low (CONF:7333).
// b. This effectiveTime SHOULD contain zero or one [0..1] high (CONF:7334).
// !this is a problem because FHIR just has a date, not a period.
ar.setOnsetElement(convert.makeDateTimeFromIVL(cda.getChild(reaction, "effectiveTime")));
// SHALL contain exactly one [1..1] value with @xsi:type="CD", where the @code SHALL be selected from ValueSet 2.16.840.1.113883.3.88.12.3221.7.4 Problem DYNAMIC (CONF:7335).
ar.getManifestation().add(convert.makeCodeableConceptFromCD(cda.getChild(reaction, "value")));
// SHOULD contain zero or one [0..1] entryRelationship (CONF:7580) such that it SHALL contain exactly one [1..1] Severity Observation (templateId:2.16.840.1.113883.10.20.22.4.8) (CONF:7582).
ar.setSeverity(readSeverity(cda.getSeverity(reaction)));
// MAY contain zero or more [0..*] entryRelationship (CONF:7337) such that it SHALL contain exactly one [1..1] Procedure Activity Procedure (templateId:2.16.840.1.113883.10.20.22.4.14) (CONF:7339).
// i. This procedure activity is intended to contain information about procedures that were performed in response to an allergy reaction
// todo: process these into an procedure and add as an extension
// MAY contain zero or more [0..*] entryRelationship (CONF:7340) such that it SHALL contain exactly one [1..1] Medication Activity (templateId:2.16.840.1.113883.10.20.22.4.16) (CONF:7342).
// i. This medication activity is intended to contain information about medications that were administered in response to an allergy reaction. (CONF:7584).
// todo: process these into an medication statement and add as an extension
return ar;
} | [
"protected",
"AllergyIntoleranceReactionComponent",
"processAdverseReactionObservation",
"(",
"Element",
"reaction",
")",
"throws",
"Exception",
"{",
"checkNoNegationOrNullFlavor",
"(",
"reaction",
",",
"\"Adverse Reaction Observation\"",
")",
";",
"checkNoSubject",
"(",
"reaction",
",",
"\"Adverse Reaction Observation\"",
")",
";",
"// This clinical statement represents an undesired symptom, finding, etc., due to an administered or exposed substance. A reaction can be defined with respect to its\tseverity, and can have been treated by one or more interventions.",
"AllergyIntoleranceReactionComponent",
"ar",
"=",
"new",
"AllergyIntoleranceReactionComponent",
"(",
")",
";",
"// SHALL contain exactly one [1..1] id (CONF:7329).",
"for",
"(",
"Element",
"e",
":",
"cda",
".",
"getChildren",
"(",
"reaction",
",",
"\"id\"",
")",
")",
"ToolingExtensions",
".",
"addIdentifier",
"(",
"ar",
",",
"convert",
".",
"makeIdentifierFromII",
"(",
")",
")",
";",
"// SHALL contain exactly one [1..1] code (CONF:7327). The value set for this code element has not been specified.",
"// todo: what the heck is this?",
"// SHOULD contain zero or one [0..1] text (CONF:7330).",
"// todo: so what is this? how can we know whether to ignore it?",
"// 8. SHOULD contain zero or one [0..1] effectiveTime (CONF:7332).",
"// \ta. This effectiveTime SHOULD contain zero or one [0..1] low (CONF:7333).",
"// \tb. This effectiveTime SHOULD contain zero or one [0..1] high (CONF:7334).",
"// !this is a problem because FHIR just has a date, not a period.",
"ar",
".",
"setOnsetElement",
"(",
"convert",
".",
"makeDateTimeFromIVL",
"(",
"cda",
".",
"getChild",
"(",
"reaction",
",",
"\"effectiveTime\"",
")",
")",
")",
";",
"// SHALL contain exactly one [1..1] value with @xsi:type=\"CD\", where the @code SHALL be selected from ValueSet 2.16.840.1.113883.3.88.12.3221.7.4 Problem\tDYNAMIC (CONF:7335).",
"ar",
".",
"getManifestation",
"(",
")",
".",
"add",
"(",
"convert",
".",
"makeCodeableConceptFromCD",
"(",
"cda",
".",
"getChild",
"(",
"reaction",
",",
"\"value\"",
")",
")",
")",
";",
"// SHOULD contain zero or one [0..1] entryRelationship (CONF:7580) such that it SHALL contain exactly one [1..1] Severity Observation (templateId:2.16.840.1.113883.10.20.22.4.8) (CONF:7582).",
"ar",
".",
"setSeverity",
"(",
"readSeverity",
"(",
"cda",
".",
"getSeverity",
"(",
"reaction",
")",
")",
")",
";",
"// MAY contain zero or more [0..*] entryRelationship (CONF:7337) such that it SHALL contain exactly one [1..1] Procedure Activity Procedure (templateId:2.16.840.1.113883.10.20.22.4.14) (CONF:7339).",
"// i. This procedure activity is intended to contain information about procedures that were performed in response to an allergy reaction",
"// todo: process these into an procedure and add as an extension",
"// MAY contain zero or more [0..*] entryRelationship (CONF:7340) such that it SHALL contain exactly one [1..1] Medication Activity (templateId:2.16.840.1.113883.10.20.22.4.16) (CONF:7342).",
"// i. This medication activity is intended to contain information about medications that were administered in response to an allergy reaction. (CONF:7584).",
"// todo: process these into an medication statement and add as an extension",
"return",
"ar",
";",
"}"
] | this is going to be a contained resource, so we aren't going to generate any narrative | [
"this",
"is",
"going",
"to",
"be",
"a",
"contained",
"resource",
"so",
"we",
"aren",
"t",
"going",
"to",
"generate",
"any",
"narrative"
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-converter/src/main/java/org/hl7/fhir/convertors/CCDAConverter.java#L836-L874 |
22,571 | jamesagnew/hapi-fhir | hapi-fhir-client/src/main/java/ca/uhn/fhir/rest/client/impl/BaseHttpClientInvocation.java | BaseHttpClientInvocation.createHttpRequest | protected IHttpRequest createHttpRequest(String theUrl, EncodingEnum theEncoding, RequestTypeEnum theRequestType) {
IHttpClient httpClient = getRestfulClientFactory().getHttpClient(new StringBuilder(theUrl), null, null, theRequestType, myHeaders);
return httpClient.createGetRequest(getContext(), theEncoding);
} | java | protected IHttpRequest createHttpRequest(String theUrl, EncodingEnum theEncoding, RequestTypeEnum theRequestType) {
IHttpClient httpClient = getRestfulClientFactory().getHttpClient(new StringBuilder(theUrl), null, null, theRequestType, myHeaders);
return httpClient.createGetRequest(getContext(), theEncoding);
} | [
"protected",
"IHttpRequest",
"createHttpRequest",
"(",
"String",
"theUrl",
",",
"EncodingEnum",
"theEncoding",
",",
"RequestTypeEnum",
"theRequestType",
")",
"{",
"IHttpClient",
"httpClient",
"=",
"getRestfulClientFactory",
"(",
")",
".",
"getHttpClient",
"(",
"new",
"StringBuilder",
"(",
"theUrl",
")",
",",
"null",
",",
"null",
",",
"theRequestType",
",",
"myHeaders",
")",
";",
"return",
"httpClient",
".",
"createGetRequest",
"(",
"getContext",
"(",
")",
",",
"theEncoding",
")",
";",
"}"
] | Create an HTTP request for the given url, encoding and request-type
@param theUrl
The complete FHIR url to which the http request will be sent
@param theEncoding
The encoding to use for any serialized content sent to the
server
@param theRequestType
the type of HTTP request (GET, DELETE, ..) | [
"Create",
"an",
"HTTP",
"request",
"for",
"the",
"given",
"url",
"encoding",
"and",
"request",
"-",
"type"
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-client/src/main/java/ca/uhn/fhir/rest/client/impl/BaseHttpClientInvocation.java#L75-L78 |
22,572 | jamesagnew/hapi-fhir | restful-server-example/src/main/java/ca/uhn/example/provider/PatientResourceProvider.java | PatientResourceProvider.addNewVersion | private void addNewVersion(Patient thePatient, Long theId) {
InstantDt publishedDate;
if (!myIdToPatientVersions.containsKey(theId)) {
myIdToPatientVersions.put(theId, new LinkedList<Patient>());
publishedDate = InstantDt.withCurrentTime();
} else {
Patient currentPatitne = myIdToPatientVersions.get(theId).getLast();
Map<ResourceMetadataKeyEnum<?>, Object> resourceMetadata = currentPatitne.getResourceMetadata();
publishedDate = (InstantDt) resourceMetadata.get(ResourceMetadataKeyEnum.PUBLISHED);
}
/*
* PUBLISHED time will always be set to the time that the first version was stored. UPDATED time is set to the time that the new version was stored.
*/
thePatient.getResourceMetadata().put(ResourceMetadataKeyEnum.PUBLISHED, publishedDate);
thePatient.getResourceMetadata().put(ResourceMetadataKeyEnum.UPDATED, InstantDt.withCurrentTime());
Deque<Patient> existingVersions = myIdToPatientVersions.get(theId);
// We just use the current number of versions as the next version number
String newVersion = Integer.toString(existingVersions.size());
// Create an ID with the new version and assign it back to the resource
IdDt newId = new IdDt("Patient", Long.toString(theId), newVersion);
thePatient.setId(newId);
existingVersions.add(thePatient);
} | java | private void addNewVersion(Patient thePatient, Long theId) {
InstantDt publishedDate;
if (!myIdToPatientVersions.containsKey(theId)) {
myIdToPatientVersions.put(theId, new LinkedList<Patient>());
publishedDate = InstantDt.withCurrentTime();
} else {
Patient currentPatitne = myIdToPatientVersions.get(theId).getLast();
Map<ResourceMetadataKeyEnum<?>, Object> resourceMetadata = currentPatitne.getResourceMetadata();
publishedDate = (InstantDt) resourceMetadata.get(ResourceMetadataKeyEnum.PUBLISHED);
}
/*
* PUBLISHED time will always be set to the time that the first version was stored. UPDATED time is set to the time that the new version was stored.
*/
thePatient.getResourceMetadata().put(ResourceMetadataKeyEnum.PUBLISHED, publishedDate);
thePatient.getResourceMetadata().put(ResourceMetadataKeyEnum.UPDATED, InstantDt.withCurrentTime());
Deque<Patient> existingVersions = myIdToPatientVersions.get(theId);
// We just use the current number of versions as the next version number
String newVersion = Integer.toString(existingVersions.size());
// Create an ID with the new version and assign it back to the resource
IdDt newId = new IdDt("Patient", Long.toString(theId), newVersion);
thePatient.setId(newId);
existingVersions.add(thePatient);
} | [
"private",
"void",
"addNewVersion",
"(",
"Patient",
"thePatient",
",",
"Long",
"theId",
")",
"{",
"InstantDt",
"publishedDate",
";",
"if",
"(",
"!",
"myIdToPatientVersions",
".",
"containsKey",
"(",
"theId",
")",
")",
"{",
"myIdToPatientVersions",
".",
"put",
"(",
"theId",
",",
"new",
"LinkedList",
"<",
"Patient",
">",
"(",
")",
")",
";",
"publishedDate",
"=",
"InstantDt",
".",
"withCurrentTime",
"(",
")",
";",
"}",
"else",
"{",
"Patient",
"currentPatitne",
"=",
"myIdToPatientVersions",
".",
"get",
"(",
"theId",
")",
".",
"getLast",
"(",
")",
";",
"Map",
"<",
"ResourceMetadataKeyEnum",
"<",
"?",
">",
",",
"Object",
">",
"resourceMetadata",
"=",
"currentPatitne",
".",
"getResourceMetadata",
"(",
")",
";",
"publishedDate",
"=",
"(",
"InstantDt",
")",
"resourceMetadata",
".",
"get",
"(",
"ResourceMetadataKeyEnum",
".",
"PUBLISHED",
")",
";",
"}",
"/*\n\t\t * PUBLISHED time will always be set to the time that the first version was stored. UPDATED time is set to the time that the new version was stored.\n\t\t */",
"thePatient",
".",
"getResourceMetadata",
"(",
")",
".",
"put",
"(",
"ResourceMetadataKeyEnum",
".",
"PUBLISHED",
",",
"publishedDate",
")",
";",
"thePatient",
".",
"getResourceMetadata",
"(",
")",
".",
"put",
"(",
"ResourceMetadataKeyEnum",
".",
"UPDATED",
",",
"InstantDt",
".",
"withCurrentTime",
"(",
")",
")",
";",
"Deque",
"<",
"Patient",
">",
"existingVersions",
"=",
"myIdToPatientVersions",
".",
"get",
"(",
"theId",
")",
";",
"// We just use the current number of versions as the next version number",
"String",
"newVersion",
"=",
"Integer",
".",
"toString",
"(",
"existingVersions",
".",
"size",
"(",
")",
")",
";",
"// Create an ID with the new version and assign it back to the resource",
"IdDt",
"newId",
"=",
"new",
"IdDt",
"(",
"\"Patient\"",
",",
"Long",
".",
"toString",
"(",
"theId",
")",
",",
"newVersion",
")",
";",
"thePatient",
".",
"setId",
"(",
"newId",
")",
";",
"existingVersions",
".",
"add",
"(",
"thePatient",
")",
";",
"}"
] | Stores a new version of the patient in memory so that it can be retrieved later.
@param thePatient
The patient resource to store
@param theId
The ID of the patient to retrieve | [
"Stores",
"a",
"new",
"version",
"of",
"the",
"patient",
"in",
"memory",
"so",
"that",
"it",
"can",
"be",
"retrieved",
"later",
"."
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/restful-server-example/src/main/java/ca/uhn/example/provider/PatientResourceProvider.java#L80-L107 |
22,573 | jamesagnew/hapi-fhir | restful-server-example/src/main/java/ca/uhn/example/provider/PatientResourceProvider.java | PatientResourceProvider.validateResource | private void validateResource(Patient thePatient) {
/*
* Our server will have a rule that patients must have a family name or we will reject them
*/
if (thePatient.getNameFirstRep().getFamilyFirstRep().isEmpty()) {
OperationOutcome outcome = new OperationOutcome();
outcome.addIssue().setSeverity(IssueSeverityEnum.FATAL).setDetails("No family name provided, Patient resources must have at least one family name.");
throw new UnprocessableEntityException(outcome);
}
} | java | private void validateResource(Patient thePatient) {
/*
* Our server will have a rule that patients must have a family name or we will reject them
*/
if (thePatient.getNameFirstRep().getFamilyFirstRep().isEmpty()) {
OperationOutcome outcome = new OperationOutcome();
outcome.addIssue().setSeverity(IssueSeverityEnum.FATAL).setDetails("No family name provided, Patient resources must have at least one family name.");
throw new UnprocessableEntityException(outcome);
}
} | [
"private",
"void",
"validateResource",
"(",
"Patient",
"thePatient",
")",
"{",
"/*\n\t\t * Our server will have a rule that patients must have a family name or we will reject them\n\t\t */",
"if",
"(",
"thePatient",
".",
"getNameFirstRep",
"(",
")",
".",
"getFamilyFirstRep",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"{",
"OperationOutcome",
"outcome",
"=",
"new",
"OperationOutcome",
"(",
")",
";",
"outcome",
".",
"addIssue",
"(",
")",
".",
"setSeverity",
"(",
"IssueSeverityEnum",
".",
"FATAL",
")",
".",
"setDetails",
"(",
"\"No family name provided, Patient resources must have at least one family name.\"",
")",
";",
"throw",
"new",
"UnprocessableEntityException",
"(",
"outcome",
")",
";",
"}",
"}"
] | This method just provides simple business validation for resources we are storing.
@param thePatient
The patient to validate | [
"This",
"method",
"just",
"provides",
"simple",
"business",
"validation",
"for",
"resources",
"we",
"are",
"storing",
"."
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/restful-server-example/src/main/java/ca/uhn/example/provider/PatientResourceProvider.java#L254-L263 |
22,574 | jamesagnew/hapi-fhir | examples/src/main/java/example/CompleteExampleClient.java | CompleteExampleClient.main | public static void main(String[] args) throws IOException {
// Create a client factory
FhirContext ctx = FhirContext.forDstu2();
// Create the client
String serverBase = "http://fhir.healthintersections.com.au/open";
ClientInterface client = ctx.newRestfulClient(ClientInterface.class, serverBase);
// Invoke the client to search for patient
List<Patient> patients = client.findPatientsForMrn(new IdentifierDt("urn:oid:1.2.36.146.595.217.0.1", "12345"));
System.out.println("Found " + patients.size() + " patients");
// Print a value from the loaded resource
Patient patient = patients.get(0);
System.out.println("Patient Last Name: " + patient.getName().get(0).getFamily().get(0).getValue());
// Load a referenced resource
ResourceReferenceDt managingRef = patient.getManagingOrganization();
Organization org = (Organization) managingRef.loadResource(client);
// Print organization name
System.out.println(org.getName());
} | java | public static void main(String[] args) throws IOException {
// Create a client factory
FhirContext ctx = FhirContext.forDstu2();
// Create the client
String serverBase = "http://fhir.healthintersections.com.au/open";
ClientInterface client = ctx.newRestfulClient(ClientInterface.class, serverBase);
// Invoke the client to search for patient
List<Patient> patients = client.findPatientsForMrn(new IdentifierDt("urn:oid:1.2.36.146.595.217.0.1", "12345"));
System.out.println("Found " + patients.size() + " patients");
// Print a value from the loaded resource
Patient patient = patients.get(0);
System.out.println("Patient Last Name: " + patient.getName().get(0).getFamily().get(0).getValue());
// Load a referenced resource
ResourceReferenceDt managingRef = patient.getManagingOrganization();
Organization org = (Organization) managingRef.loadResource(client);
// Print organization name
System.out.println(org.getName());
} | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"throws",
"IOException",
"{",
"// Create a client factory",
"FhirContext",
"ctx",
"=",
"FhirContext",
".",
"forDstu2",
"(",
")",
";",
"// Create the client",
"String",
"serverBase",
"=",
"\"http://fhir.healthintersections.com.au/open\"",
";",
"ClientInterface",
"client",
"=",
"ctx",
".",
"newRestfulClient",
"(",
"ClientInterface",
".",
"class",
",",
"serverBase",
")",
";",
"// Invoke the client to search for patient",
"List",
"<",
"Patient",
">",
"patients",
"=",
"client",
".",
"findPatientsForMrn",
"(",
"new",
"IdentifierDt",
"(",
"\"urn:oid:1.2.36.146.595.217.0.1\"",
",",
"\"12345\"",
")",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"Found \"",
"+",
"patients",
".",
"size",
"(",
")",
"+",
"\" patients\"",
")",
";",
"// Print a value from the loaded resource",
"Patient",
"patient",
"=",
"patients",
".",
"get",
"(",
"0",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"Patient Last Name: \"",
"+",
"patient",
".",
"getName",
"(",
")",
".",
"get",
"(",
"0",
")",
".",
"getFamily",
"(",
")",
".",
"get",
"(",
"0",
")",
".",
"getValue",
"(",
")",
")",
";",
"// Load a referenced resource",
"ResourceReferenceDt",
"managingRef",
"=",
"patient",
".",
"getManagingOrganization",
"(",
")",
";",
"Organization",
"org",
"=",
"(",
"Organization",
")",
"managingRef",
".",
"loadResource",
"(",
"client",
")",
";",
"// Print organization name",
"System",
".",
"out",
".",
"println",
"(",
"org",
".",
"getName",
"(",
")",
")",
";",
"}"
] | The main method here will directly call an open FHIR server and retrieve a
list of resources matching a given criteria, then load a linked resource. | [
"The",
"main",
"method",
"here",
"will",
"directly",
"call",
"an",
"open",
"FHIR",
"server",
"and",
"retrieve",
"a",
"list",
"of",
"resources",
"matching",
"a",
"given",
"criteria",
"then",
"load",
"a",
"linked",
"resource",
"."
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/examples/src/main/java/example/CompleteExampleClient.java#L37-L62 |
22,575 | jamesagnew/hapi-fhir | hapi-fhir-base/src/main/java/ca/uhn/fhir/util/OperationOutcomeUtil.java | OperationOutcomeUtil.addIssue | public static void addIssue(FhirContext theCtx, IBaseOperationOutcome theOperationOutcome, String theSeverity, String theDetails, String theLocation, String theCode) {
IBase issue = createIssue(theCtx, theOperationOutcome);
populateDetails(theCtx, issue, theSeverity, theDetails, theLocation, theCode);
} | java | public static void addIssue(FhirContext theCtx, IBaseOperationOutcome theOperationOutcome, String theSeverity, String theDetails, String theLocation, String theCode) {
IBase issue = createIssue(theCtx, theOperationOutcome);
populateDetails(theCtx, issue, theSeverity, theDetails, theLocation, theCode);
} | [
"public",
"static",
"void",
"addIssue",
"(",
"FhirContext",
"theCtx",
",",
"IBaseOperationOutcome",
"theOperationOutcome",
",",
"String",
"theSeverity",
",",
"String",
"theDetails",
",",
"String",
"theLocation",
",",
"String",
"theCode",
")",
"{",
"IBase",
"issue",
"=",
"createIssue",
"(",
"theCtx",
",",
"theOperationOutcome",
")",
";",
"populateDetails",
"(",
"theCtx",
",",
"issue",
",",
"theSeverity",
",",
"theDetails",
",",
"theLocation",
",",
"theCode",
")",
";",
"}"
] | Add an issue to an OperationOutcome
@param theCtx
The fhir context
@param theOperationOutcome
The OO resource to add to
@param theSeverity
The severity (fatal | error | warning | information)
@param theDetails
The details string
@param theCode | [
"Add",
"an",
"issue",
"to",
"an",
"OperationOutcome"
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/OperationOutcomeUtil.java#L57-L60 |
22,576 | jamesagnew/hapi-fhir | hapi-fhir-base/src/main/java/ca/uhn/fhir/util/OperationOutcomeUtil.java | OperationOutcomeUtil.hasIssues | public static boolean hasIssues(FhirContext theCtx, IBaseOperationOutcome theOutcome) {
if (theOutcome == null) {
return false;
}
RuntimeResourceDefinition ooDef = theCtx.getResourceDefinition(theOutcome);
BaseRuntimeChildDefinition issueChild = ooDef.getChildByName("issue");
return issueChild.getAccessor().getValues(theOutcome).size() > 0;
} | java | public static boolean hasIssues(FhirContext theCtx, IBaseOperationOutcome theOutcome) {
if (theOutcome == null) {
return false;
}
RuntimeResourceDefinition ooDef = theCtx.getResourceDefinition(theOutcome);
BaseRuntimeChildDefinition issueChild = ooDef.getChildByName("issue");
return issueChild.getAccessor().getValues(theOutcome).size() > 0;
} | [
"public",
"static",
"boolean",
"hasIssues",
"(",
"FhirContext",
"theCtx",
",",
"IBaseOperationOutcome",
"theOutcome",
")",
"{",
"if",
"(",
"theOutcome",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"RuntimeResourceDefinition",
"ooDef",
"=",
"theCtx",
".",
"getResourceDefinition",
"(",
"theOutcome",
")",
";",
"BaseRuntimeChildDefinition",
"issueChild",
"=",
"ooDef",
".",
"getChildByName",
"(",
"\"issue\"",
")",
";",
"return",
"issueChild",
".",
"getAccessor",
"(",
")",
".",
"getValues",
"(",
"theOutcome",
")",
".",
"size",
"(",
")",
">",
"0",
";",
"}"
] | Returns true if the given OperationOutcome has 1 or more Operation.issue repetitions | [
"Returns",
"true",
"if",
"the",
"given",
"OperationOutcome",
"has",
"1",
"or",
"more",
"Operation",
".",
"issue",
"repetitions"
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/OperationOutcomeUtil.java#L107-L114 |
22,577 | jamesagnew/hapi-fhir | hapi-fhir-structures-hl7org-dstu2/src/main/java/org/hl7/fhir/instance/model/BaseNarrative.java | BaseNarrative.setDivAsString | public void setDivAsString(String theString) {
XhtmlNode div;
if (StringUtils.isNotBlank(theString)) {
div = new XhtmlNode();
div.setValueAsString(theString);
} else {
div = null;
}
setDiv(div);
} | java | public void setDivAsString(String theString) {
XhtmlNode div;
if (StringUtils.isNotBlank(theString)) {
div = new XhtmlNode();
div.setValueAsString(theString);
} else {
div = null;
}
setDiv(div);
} | [
"public",
"void",
"setDivAsString",
"(",
"String",
"theString",
")",
"{",
"XhtmlNode",
"div",
";",
"if",
"(",
"StringUtils",
".",
"isNotBlank",
"(",
"theString",
")",
")",
"{",
"div",
"=",
"new",
"XhtmlNode",
"(",
")",
";",
"div",
".",
"setValueAsString",
"(",
"theString",
")",
";",
"}",
"else",
"{",
"div",
"=",
"null",
";",
"}",
"setDiv",
"(",
"div",
")",
";",
"}"
] | Sets the value of
@param theString
@throws Exception | [
"Sets",
"the",
"value",
"of"
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-structures-hl7org-dstu2/src/main/java/org/hl7/fhir/instance/model/BaseNarrative.java#L15-L24 |
22,578 | jamesagnew/hapi-fhir | hapi-fhir-utilities/src/main/java/org/hl7/fhir/utilities/IniFile.java | IniFile.getStringProperty | public String getStringProperty(String pstrSection, String pstrProp)
{
String strRet = null;
INIProperty objProp = null;
INISection objSec = null;
objSec = (INISection) this.mhmapSections.get(pstrSection);
if (objSec != null)
{
objProp = objSec.getProperty(pstrProp);
if (objProp != null)
{
strRet = objProp.getPropValue();
objProp = null;
}
objSec = null;
}
return strRet;
} | java | public String getStringProperty(String pstrSection, String pstrProp)
{
String strRet = null;
INIProperty objProp = null;
INISection objSec = null;
objSec = (INISection) this.mhmapSections.get(pstrSection);
if (objSec != null)
{
objProp = objSec.getProperty(pstrProp);
if (objProp != null)
{
strRet = objProp.getPropValue();
objProp = null;
}
objSec = null;
}
return strRet;
} | [
"public",
"String",
"getStringProperty",
"(",
"String",
"pstrSection",
",",
"String",
"pstrProp",
")",
"{",
"String",
"strRet",
"=",
"null",
";",
"INIProperty",
"objProp",
"=",
"null",
";",
"INISection",
"objSec",
"=",
"null",
";",
"objSec",
"=",
"(",
"INISection",
")",
"this",
".",
"mhmapSections",
".",
"get",
"(",
"pstrSection",
")",
";",
"if",
"(",
"objSec",
"!=",
"null",
")",
"{",
"objProp",
"=",
"objSec",
".",
"getProperty",
"(",
"pstrProp",
")",
";",
"if",
"(",
"objProp",
"!=",
"null",
")",
"{",
"strRet",
"=",
"objProp",
".",
"getPropValue",
"(",
")",
";",
"objProp",
"=",
"null",
";",
"}",
"objSec",
"=",
"null",
";",
"}",
"return",
"strRet",
";",
"}"
] | Returns the specified string property from the specified section.
@param pstrSection the INI section name.
@param pstrProp the property to be retrieved.
@return the string property value. | [
"Returns",
"the",
"specified",
"string",
"property",
"from",
"the",
"specified",
"section",
"."
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-utilities/src/main/java/org/hl7/fhir/utilities/IniFile.java#L113-L131 |
22,579 | jamesagnew/hapi-fhir | hapi-fhir-utilities/src/main/java/org/hl7/fhir/utilities/IniFile.java | IniFile.getIntegerProperty | public Integer getIntegerProperty(String pstrSection, String pstrProp)
{
Integer intRet = null;
String strVal = null;
INIProperty objProp = null;
INISection objSec = null;
objSec = (INISection) this.mhmapSections.get(pstrSection);
if (objSec != null)
{
objProp = objSec.getProperty(pstrProp);
try
{
if (objProp != null)
{
strVal = objProp.getPropValue();
if (strVal != null) intRet = new Integer(strVal);
}
}
catch (NumberFormatException NFExIgnore)
{
}
finally
{
if (objProp != null) objProp = null;
}
objSec = null;
}
return intRet;
} | java | public Integer getIntegerProperty(String pstrSection, String pstrProp)
{
Integer intRet = null;
String strVal = null;
INIProperty objProp = null;
INISection objSec = null;
objSec = (INISection) this.mhmapSections.get(pstrSection);
if (objSec != null)
{
objProp = objSec.getProperty(pstrProp);
try
{
if (objProp != null)
{
strVal = objProp.getPropValue();
if (strVal != null) intRet = new Integer(strVal);
}
}
catch (NumberFormatException NFExIgnore)
{
}
finally
{
if (objProp != null) objProp = null;
}
objSec = null;
}
return intRet;
} | [
"public",
"Integer",
"getIntegerProperty",
"(",
"String",
"pstrSection",
",",
"String",
"pstrProp",
")",
"{",
"Integer",
"intRet",
"=",
"null",
";",
"String",
"strVal",
"=",
"null",
";",
"INIProperty",
"objProp",
"=",
"null",
";",
"INISection",
"objSec",
"=",
"null",
";",
"objSec",
"=",
"(",
"INISection",
")",
"this",
".",
"mhmapSections",
".",
"get",
"(",
"pstrSection",
")",
";",
"if",
"(",
"objSec",
"!=",
"null",
")",
"{",
"objProp",
"=",
"objSec",
".",
"getProperty",
"(",
"pstrProp",
")",
";",
"try",
"{",
"if",
"(",
"objProp",
"!=",
"null",
")",
"{",
"strVal",
"=",
"objProp",
".",
"getPropValue",
"(",
")",
";",
"if",
"(",
"strVal",
"!=",
"null",
")",
"intRet",
"=",
"new",
"Integer",
"(",
"strVal",
")",
";",
"}",
"}",
"catch",
"(",
"NumberFormatException",
"NFExIgnore",
")",
"{",
"}",
"finally",
"{",
"if",
"(",
"objProp",
"!=",
"null",
")",
"objProp",
"=",
"null",
";",
"}",
"objSec",
"=",
"null",
";",
"}",
"return",
"intRet",
";",
"}"
] | Returns the specified integer property from the specified section.
@param pstrSection the INI section name.
@param pstrProp the property to be retrieved.
@return the integer property value. | [
"Returns",
"the",
"specified",
"integer",
"property",
"from",
"the",
"specified",
"section",
"."
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-utilities/src/main/java/org/hl7/fhir/utilities/IniFile.java#L180-L209 |
22,580 | jamesagnew/hapi-fhir | hapi-fhir-utilities/src/main/java/org/hl7/fhir/utilities/IniFile.java | IniFile.getLongProperty | public Long getLongProperty(String pstrSection, String pstrProp)
{
Long lngRet = null;
String strVal = null;
INIProperty objProp = null;
INISection objSec = null;
objSec = (INISection) this.mhmapSections.get(pstrSection);
if (objSec != null)
{
objProp = objSec.getProperty(pstrProp);
try
{
if (objProp != null)
{
strVal = objProp.getPropValue();
if (strVal != null) lngRet = new Long(strVal);
}
}
catch (NumberFormatException NFExIgnore)
{
}
finally
{
if (objProp != null) objProp = null;
}
objSec = null;
}
return lngRet;
} | java | public Long getLongProperty(String pstrSection, String pstrProp)
{
Long lngRet = null;
String strVal = null;
INIProperty objProp = null;
INISection objSec = null;
objSec = (INISection) this.mhmapSections.get(pstrSection);
if (objSec != null)
{
objProp = objSec.getProperty(pstrProp);
try
{
if (objProp != null)
{
strVal = objProp.getPropValue();
if (strVal != null) lngRet = new Long(strVal);
}
}
catch (NumberFormatException NFExIgnore)
{
}
finally
{
if (objProp != null) objProp = null;
}
objSec = null;
}
return lngRet;
} | [
"public",
"Long",
"getLongProperty",
"(",
"String",
"pstrSection",
",",
"String",
"pstrProp",
")",
"{",
"Long",
"lngRet",
"=",
"null",
";",
"String",
"strVal",
"=",
"null",
";",
"INIProperty",
"objProp",
"=",
"null",
";",
"INISection",
"objSec",
"=",
"null",
";",
"objSec",
"=",
"(",
"INISection",
")",
"this",
".",
"mhmapSections",
".",
"get",
"(",
"pstrSection",
")",
";",
"if",
"(",
"objSec",
"!=",
"null",
")",
"{",
"objProp",
"=",
"objSec",
".",
"getProperty",
"(",
"pstrProp",
")",
";",
"try",
"{",
"if",
"(",
"objProp",
"!=",
"null",
")",
"{",
"strVal",
"=",
"objProp",
".",
"getPropValue",
"(",
")",
";",
"if",
"(",
"strVal",
"!=",
"null",
")",
"lngRet",
"=",
"new",
"Long",
"(",
"strVal",
")",
";",
"}",
"}",
"catch",
"(",
"NumberFormatException",
"NFExIgnore",
")",
"{",
"}",
"finally",
"{",
"if",
"(",
"objProp",
"!=",
"null",
")",
"objProp",
"=",
"null",
";",
"}",
"objSec",
"=",
"null",
";",
"}",
"return",
"lngRet",
";",
"}"
] | Returns the specified long property from the specified section.
@param pstrSection the INI section name.
@param pstrProp the property to be retrieved.
@return the long property value. | [
"Returns",
"the",
"specified",
"long",
"property",
"from",
"the",
"specified",
"section",
"."
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-utilities/src/main/java/org/hl7/fhir/utilities/IniFile.java#L217-L246 |
22,581 | jamesagnew/hapi-fhir | hapi-fhir-utilities/src/main/java/org/hl7/fhir/utilities/IniFile.java | IniFile.getDoubleProperty | public Double getDoubleProperty(String pstrSection, String pstrProp)
{
Double dblRet = null;
String strVal = null;
INIProperty objProp = null;
INISection objSec = null;
objSec = (INISection) this.mhmapSections.get(pstrSection);
if (objSec != null)
{
objProp = objSec.getProperty(pstrProp);
try
{
if (objProp != null)
{
strVal = objProp.getPropValue();
if (strVal != null) dblRet = new Double(strVal);
}
}
catch (NumberFormatException NFExIgnore)
{
}
finally
{
if (objProp != null) objProp = null;
}
objSec = null;
}
return dblRet;
} | java | public Double getDoubleProperty(String pstrSection, String pstrProp)
{
Double dblRet = null;
String strVal = null;
INIProperty objProp = null;
INISection objSec = null;
objSec = (INISection) this.mhmapSections.get(pstrSection);
if (objSec != null)
{
objProp = objSec.getProperty(pstrProp);
try
{
if (objProp != null)
{
strVal = objProp.getPropValue();
if (strVal != null) dblRet = new Double(strVal);
}
}
catch (NumberFormatException NFExIgnore)
{
}
finally
{
if (objProp != null) objProp = null;
}
objSec = null;
}
return dblRet;
} | [
"public",
"Double",
"getDoubleProperty",
"(",
"String",
"pstrSection",
",",
"String",
"pstrProp",
")",
"{",
"Double",
"dblRet",
"=",
"null",
";",
"String",
"strVal",
"=",
"null",
";",
"INIProperty",
"objProp",
"=",
"null",
";",
"INISection",
"objSec",
"=",
"null",
";",
"objSec",
"=",
"(",
"INISection",
")",
"this",
".",
"mhmapSections",
".",
"get",
"(",
"pstrSection",
")",
";",
"if",
"(",
"objSec",
"!=",
"null",
")",
"{",
"objProp",
"=",
"objSec",
".",
"getProperty",
"(",
"pstrProp",
")",
";",
"try",
"{",
"if",
"(",
"objProp",
"!=",
"null",
")",
"{",
"strVal",
"=",
"objProp",
".",
"getPropValue",
"(",
")",
";",
"if",
"(",
"strVal",
"!=",
"null",
")",
"dblRet",
"=",
"new",
"Double",
"(",
"strVal",
")",
";",
"}",
"}",
"catch",
"(",
"NumberFormatException",
"NFExIgnore",
")",
"{",
"}",
"finally",
"{",
"if",
"(",
"objProp",
"!=",
"null",
")",
"objProp",
"=",
"null",
";",
"}",
"objSec",
"=",
"null",
";",
"}",
"return",
"dblRet",
";",
"}"
] | Returns the specified double property from the specified section.
@param pstrSection the INI section name.
@param pstrProp the property to be retrieved.
@return the double property value. | [
"Returns",
"the",
"specified",
"double",
"property",
"from",
"the",
"specified",
"section",
"."
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-utilities/src/main/java/org/hl7/fhir/utilities/IniFile.java#L254-L283 |
22,582 | jamesagnew/hapi-fhir | hapi-fhir-utilities/src/main/java/org/hl7/fhir/utilities/IniFile.java | IniFile.addSection | public void addSection(String pstrSection, String pstrComments)
{
INISection objSec = null;
objSec = (INISection) this.mhmapSections.get(pstrSection);
if (objSec == null)
{
objSec = new INISection(pstrSection);
this.mhmapSections.put(pstrSection, objSec);
}
objSec.setSecComments(delRemChars(pstrComments));
objSec = null;
} | java | public void addSection(String pstrSection, String pstrComments)
{
INISection objSec = null;
objSec = (INISection) this.mhmapSections.get(pstrSection);
if (objSec == null)
{
objSec = new INISection(pstrSection);
this.mhmapSections.put(pstrSection, objSec);
}
objSec.setSecComments(delRemChars(pstrComments));
objSec = null;
} | [
"public",
"void",
"addSection",
"(",
"String",
"pstrSection",
",",
"String",
"pstrComments",
")",
"{",
"INISection",
"objSec",
"=",
"null",
";",
"objSec",
"=",
"(",
"INISection",
")",
"this",
".",
"mhmapSections",
".",
"get",
"(",
"pstrSection",
")",
";",
"if",
"(",
"objSec",
"==",
"null",
")",
"{",
"objSec",
"=",
"new",
"INISection",
"(",
"pstrSection",
")",
";",
"this",
".",
"mhmapSections",
".",
"put",
"(",
"pstrSection",
",",
"objSec",
")",
";",
"}",
"objSec",
".",
"setSecComments",
"(",
"delRemChars",
"(",
"pstrComments",
")",
")",
";",
"objSec",
"=",
"null",
";",
"}"
] | Sets the comments associated with a section.
@param pstrSection the section name
@param pstrComments the comments. | [
"Sets",
"the",
"comments",
"associated",
"with",
"a",
"section",
"."
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-utilities/src/main/java/org/hl7/fhir/utilities/IniFile.java#L379-L391 |
22,583 | jamesagnew/hapi-fhir | hapi-fhir-utilities/src/main/java/org/hl7/fhir/utilities/IniFile.java | IniFile.setStringProperty | public void setStringProperty(String pstrSection, String pstrProp,
String pstrVal, String pstrComments)
{
INISection objSec = null;
objSec = (INISection) this.mhmapSections.get(pstrSection);
if (objSec == null)
{
objSec = new INISection(pstrSection);
this.mhmapSections.put(pstrSection, objSec);
}
objSec.setProperty(pstrProp, pstrVal, pstrComments);
} | java | public void setStringProperty(String pstrSection, String pstrProp,
String pstrVal, String pstrComments)
{
INISection objSec = null;
objSec = (INISection) this.mhmapSections.get(pstrSection);
if (objSec == null)
{
objSec = new INISection(pstrSection);
this.mhmapSections.put(pstrSection, objSec);
}
objSec.setProperty(pstrProp, pstrVal, pstrComments);
} | [
"public",
"void",
"setStringProperty",
"(",
"String",
"pstrSection",
",",
"String",
"pstrProp",
",",
"String",
"pstrVal",
",",
"String",
"pstrComments",
")",
"{",
"INISection",
"objSec",
"=",
"null",
";",
"objSec",
"=",
"(",
"INISection",
")",
"this",
".",
"mhmapSections",
".",
"get",
"(",
"pstrSection",
")",
";",
"if",
"(",
"objSec",
"==",
"null",
")",
"{",
"objSec",
"=",
"new",
"INISection",
"(",
"pstrSection",
")",
";",
"this",
".",
"mhmapSections",
".",
"put",
"(",
"pstrSection",
",",
"objSec",
")",
";",
"}",
"objSec",
".",
"setProperty",
"(",
"pstrProp",
",",
"pstrVal",
",",
"pstrComments",
")",
";",
"}"
] | Sets the specified string property.
@param pstrSection the INI section name.
@param pstrProp the property to be set.
@pstrVal the string value to be persisted | [
"Sets",
"the",
"specified",
"string",
"property",
"."
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-utilities/src/main/java/org/hl7/fhir/utilities/IniFile.java#L399-L411 |
22,584 | jamesagnew/hapi-fhir | hapi-fhir-utilities/src/main/java/org/hl7/fhir/utilities/IniFile.java | IniFile.setBooleanProperty | public void setBooleanProperty(String pstrSection, String pstrProp,
boolean pblnVal, String pstrComments)
{
INISection objSec = null;
objSec = (INISection) this.mhmapSections.get(pstrSection);
if (objSec == null)
{
objSec = new INISection(pstrSection);
this.mhmapSections.put(pstrSection, objSec);
}
if (pblnVal)
objSec.setProperty(pstrProp, "TRUE", pstrComments);
else
objSec.setProperty(pstrProp, "FALSE", pstrComments);
} | java | public void setBooleanProperty(String pstrSection, String pstrProp,
boolean pblnVal, String pstrComments)
{
INISection objSec = null;
objSec = (INISection) this.mhmapSections.get(pstrSection);
if (objSec == null)
{
objSec = new INISection(pstrSection);
this.mhmapSections.put(pstrSection, objSec);
}
if (pblnVal)
objSec.setProperty(pstrProp, "TRUE", pstrComments);
else
objSec.setProperty(pstrProp, "FALSE", pstrComments);
} | [
"public",
"void",
"setBooleanProperty",
"(",
"String",
"pstrSection",
",",
"String",
"pstrProp",
",",
"boolean",
"pblnVal",
",",
"String",
"pstrComments",
")",
"{",
"INISection",
"objSec",
"=",
"null",
";",
"objSec",
"=",
"(",
"INISection",
")",
"this",
".",
"mhmapSections",
".",
"get",
"(",
"pstrSection",
")",
";",
"if",
"(",
"objSec",
"==",
"null",
")",
"{",
"objSec",
"=",
"new",
"INISection",
"(",
"pstrSection",
")",
";",
"this",
".",
"mhmapSections",
".",
"put",
"(",
"pstrSection",
",",
"objSec",
")",
";",
"}",
"if",
"(",
"pblnVal",
")",
"objSec",
".",
"setProperty",
"(",
"pstrProp",
",",
"\"TRUE\"",
",",
"pstrComments",
")",
";",
"else",
"objSec",
".",
"setProperty",
"(",
"pstrProp",
",",
"\"FALSE\"",
",",
"pstrComments",
")",
";",
"}"
] | Sets the specified boolean property.
@param pstrSection the INI section name.
@param pstrProp the property to be set.
@param pblnVal the boolean value to be persisted | [
"Sets",
"the",
"specified",
"boolean",
"property",
"."
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-utilities/src/main/java/org/hl7/fhir/utilities/IniFile.java#L419-L434 |
22,585 | jamesagnew/hapi-fhir | hapi-fhir-utilities/src/main/java/org/hl7/fhir/utilities/IniFile.java | IniFile.setIntegerProperty | public void setIntegerProperty(String pstrSection, String pstrProp,
int pintVal, String pstrComments)
{
INISection objSec = null;
objSec = (INISection) this.mhmapSections.get(pstrSection);
if (objSec == null)
{
objSec = new INISection(pstrSection);
this.mhmapSections.put(pstrSection, objSec);
}
objSec.setProperty(pstrProp, Integer.toString(pintVal), pstrComments);
} | java | public void setIntegerProperty(String pstrSection, String pstrProp,
int pintVal, String pstrComments)
{
INISection objSec = null;
objSec = (INISection) this.mhmapSections.get(pstrSection);
if (objSec == null)
{
objSec = new INISection(pstrSection);
this.mhmapSections.put(pstrSection, objSec);
}
objSec.setProperty(pstrProp, Integer.toString(pintVal), pstrComments);
} | [
"public",
"void",
"setIntegerProperty",
"(",
"String",
"pstrSection",
",",
"String",
"pstrProp",
",",
"int",
"pintVal",
",",
"String",
"pstrComments",
")",
"{",
"INISection",
"objSec",
"=",
"null",
";",
"objSec",
"=",
"(",
"INISection",
")",
"this",
".",
"mhmapSections",
".",
"get",
"(",
"pstrSection",
")",
";",
"if",
"(",
"objSec",
"==",
"null",
")",
"{",
"objSec",
"=",
"new",
"INISection",
"(",
"pstrSection",
")",
";",
"this",
".",
"mhmapSections",
".",
"put",
"(",
"pstrSection",
",",
"objSec",
")",
";",
"}",
"objSec",
".",
"setProperty",
"(",
"pstrProp",
",",
"Integer",
".",
"toString",
"(",
"pintVal",
")",
",",
"pstrComments",
")",
";",
"}"
] | Sets the specified integer property.
@param pstrSection the INI section name.
@param pstrProp the property to be set.
@param pintVal the int property to be persisted. | [
"Sets",
"the",
"specified",
"integer",
"property",
"."
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-utilities/src/main/java/org/hl7/fhir/utilities/IniFile.java#L442-L454 |
22,586 | jamesagnew/hapi-fhir | hapi-fhir-utilities/src/main/java/org/hl7/fhir/utilities/IniFile.java | IniFile.setLongProperty | public void setLongProperty(String pstrSection, String pstrProp,
long plngVal, String pstrComments)
{
INISection objSec = null;
objSec = (INISection) this.mhmapSections.get(pstrSection);
if (objSec == null)
{
objSec = new INISection(pstrSection);
this.mhmapSections.put(pstrSection, objSec);
}
objSec.setProperty(pstrProp, Long.toString(plngVal), pstrComments);
} | java | public void setLongProperty(String pstrSection, String pstrProp,
long plngVal, String pstrComments)
{
INISection objSec = null;
objSec = (INISection) this.mhmapSections.get(pstrSection);
if (objSec == null)
{
objSec = new INISection(pstrSection);
this.mhmapSections.put(pstrSection, objSec);
}
objSec.setProperty(pstrProp, Long.toString(plngVal), pstrComments);
} | [
"public",
"void",
"setLongProperty",
"(",
"String",
"pstrSection",
",",
"String",
"pstrProp",
",",
"long",
"plngVal",
",",
"String",
"pstrComments",
")",
"{",
"INISection",
"objSec",
"=",
"null",
";",
"objSec",
"=",
"(",
"INISection",
")",
"this",
".",
"mhmapSections",
".",
"get",
"(",
"pstrSection",
")",
";",
"if",
"(",
"objSec",
"==",
"null",
")",
"{",
"objSec",
"=",
"new",
"INISection",
"(",
"pstrSection",
")",
";",
"this",
".",
"mhmapSections",
".",
"put",
"(",
"pstrSection",
",",
"objSec",
")",
";",
"}",
"objSec",
".",
"setProperty",
"(",
"pstrProp",
",",
"Long",
".",
"toString",
"(",
"plngVal",
")",
",",
"pstrComments",
")",
";",
"}"
] | Sets the specified long property.
@param pstrSection the INI section name.
@param pstrProp the property to be set.
@param plngVal the long value to be persisted. | [
"Sets",
"the",
"specified",
"long",
"property",
"."
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-utilities/src/main/java/org/hl7/fhir/utilities/IniFile.java#L462-L474 |
22,587 | jamesagnew/hapi-fhir | hapi-fhir-utilities/src/main/java/org/hl7/fhir/utilities/IniFile.java | IniFile.setDoubleProperty | public void setDoubleProperty(String pstrSection, String pstrProp,
double pdblVal, String pstrComments)
{
INISection objSec = null;
objSec = (INISection) this.mhmapSections.get(pstrSection);
if (objSec == null)
{
objSec = new INISection(pstrSection);
this.mhmapSections.put(pstrSection, objSec);
}
objSec.setProperty(pstrProp, Double.toString(pdblVal), pstrComments);
} | java | public void setDoubleProperty(String pstrSection, String pstrProp,
double pdblVal, String pstrComments)
{
INISection objSec = null;
objSec = (INISection) this.mhmapSections.get(pstrSection);
if (objSec == null)
{
objSec = new INISection(pstrSection);
this.mhmapSections.put(pstrSection, objSec);
}
objSec.setProperty(pstrProp, Double.toString(pdblVal), pstrComments);
} | [
"public",
"void",
"setDoubleProperty",
"(",
"String",
"pstrSection",
",",
"String",
"pstrProp",
",",
"double",
"pdblVal",
",",
"String",
"pstrComments",
")",
"{",
"INISection",
"objSec",
"=",
"null",
";",
"objSec",
"=",
"(",
"INISection",
")",
"this",
".",
"mhmapSections",
".",
"get",
"(",
"pstrSection",
")",
";",
"if",
"(",
"objSec",
"==",
"null",
")",
"{",
"objSec",
"=",
"new",
"INISection",
"(",
"pstrSection",
")",
";",
"this",
".",
"mhmapSections",
".",
"put",
"(",
"pstrSection",
",",
"objSec",
")",
";",
"}",
"objSec",
".",
"setProperty",
"(",
"pstrProp",
",",
"Double",
".",
"toString",
"(",
"pdblVal",
")",
",",
"pstrComments",
")",
";",
"}"
] | Sets the specified double property.
@param pstrSection the INI section name.
@param pstrProp the property to be set.
@param pdblVal the double value to be persisted. | [
"Sets",
"the",
"specified",
"double",
"property",
"."
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-utilities/src/main/java/org/hl7/fhir/utilities/IniFile.java#L482-L494 |
22,588 | jamesagnew/hapi-fhir | hapi-fhir-utilities/src/main/java/org/hl7/fhir/utilities/IniFile.java | IniFile.setDateProperty | public void setDateProperty(String pstrSection, String pstrProp,
Date pdtVal, String pstrComments)
{
INISection objSec = null;
objSec = (INISection) this.mhmapSections.get(pstrSection);
if (objSec == null)
{
objSec = new INISection(pstrSection);
this.mhmapSections.put(pstrSection, objSec);
}
objSec.setProperty(pstrProp, utilDateToStr(pdtVal, this.mstrDateFmt),
pstrComments);
} | java | public void setDateProperty(String pstrSection, String pstrProp,
Date pdtVal, String pstrComments)
{
INISection objSec = null;
objSec = (INISection) this.mhmapSections.get(pstrSection);
if (objSec == null)
{
objSec = new INISection(pstrSection);
this.mhmapSections.put(pstrSection, objSec);
}
objSec.setProperty(pstrProp, utilDateToStr(pdtVal, this.mstrDateFmt),
pstrComments);
} | [
"public",
"void",
"setDateProperty",
"(",
"String",
"pstrSection",
",",
"String",
"pstrProp",
",",
"Date",
"pdtVal",
",",
"String",
"pstrComments",
")",
"{",
"INISection",
"objSec",
"=",
"null",
";",
"objSec",
"=",
"(",
"INISection",
")",
"this",
".",
"mhmapSections",
".",
"get",
"(",
"pstrSection",
")",
";",
"if",
"(",
"objSec",
"==",
"null",
")",
"{",
"objSec",
"=",
"new",
"INISection",
"(",
"pstrSection",
")",
";",
"this",
".",
"mhmapSections",
".",
"put",
"(",
"pstrSection",
",",
"objSec",
")",
";",
"}",
"objSec",
".",
"setProperty",
"(",
"pstrProp",
",",
"utilDateToStr",
"(",
"pdtVal",
",",
"this",
".",
"mstrDateFmt",
")",
",",
"pstrComments",
")",
";",
"}"
] | Sets the specified java.util.Date property.
@param pstrSection the INI section name.
@param pstrProp the property to be set.
@param pdtVal the date value to be persisted. | [
"Sets",
"the",
"specified",
"java",
".",
"util",
".",
"Date",
"property",
"."
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-utilities/src/main/java/org/hl7/fhir/utilities/IniFile.java#L502-L515 |
22,589 | jamesagnew/hapi-fhir | hapi-fhir-utilities/src/main/java/org/hl7/fhir/utilities/IniFile.java | IniFile.setTimestampProperty | public void setTimestampProperty(String pstrSection, String pstrProp,
Timestamp ptsVal, String pstrComments)
{
INISection objSec = null;
objSec = (INISection) this.mhmapSections.get(pstrSection);
if (objSec == null)
{
objSec = new INISection(pstrSection);
this.mhmapSections.put(pstrSection, objSec);
}
objSec.setProperty(pstrProp, timeToStr(ptsVal, this.mstrTimeStampFmt),
pstrComments);
} | java | public void setTimestampProperty(String pstrSection, String pstrProp,
Timestamp ptsVal, String pstrComments)
{
INISection objSec = null;
objSec = (INISection) this.mhmapSections.get(pstrSection);
if (objSec == null)
{
objSec = new INISection(pstrSection);
this.mhmapSections.put(pstrSection, objSec);
}
objSec.setProperty(pstrProp, timeToStr(ptsVal, this.mstrTimeStampFmt),
pstrComments);
} | [
"public",
"void",
"setTimestampProperty",
"(",
"String",
"pstrSection",
",",
"String",
"pstrProp",
",",
"Timestamp",
"ptsVal",
",",
"String",
"pstrComments",
")",
"{",
"INISection",
"objSec",
"=",
"null",
";",
"objSec",
"=",
"(",
"INISection",
")",
"this",
".",
"mhmapSections",
".",
"get",
"(",
"pstrSection",
")",
";",
"if",
"(",
"objSec",
"==",
"null",
")",
"{",
"objSec",
"=",
"new",
"INISection",
"(",
"pstrSection",
")",
";",
"this",
".",
"mhmapSections",
".",
"put",
"(",
"pstrSection",
",",
"objSec",
")",
";",
"}",
"objSec",
".",
"setProperty",
"(",
"pstrProp",
",",
"timeToStr",
"(",
"ptsVal",
",",
"this",
".",
"mstrTimeStampFmt",
")",
",",
"pstrComments",
")",
";",
"}"
] | Sets the specified java.sql.Timestamp property.
@param pstrSection the INI section name.
@param pstrProp the property to be set.
@param ptsVal the timestamp value to be persisted. | [
"Sets",
"the",
"specified",
"java",
".",
"sql",
".",
"Timestamp",
"property",
"."
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-utilities/src/main/java/org/hl7/fhir/utilities/IniFile.java#L523-L536 |
22,590 | jamesagnew/hapi-fhir | hapi-fhir-utilities/src/main/java/org/hl7/fhir/utilities/IniFile.java | IniFile.getAllSectionNames | public String[] getAllSectionNames()
{
int iCntr = 0;
Iterator<String> iter = null;
String[] arrRet = null;
try
{
if (this.mhmapSections.size() > 0)
{
arrRet = new String[this.mhmapSections.size()];
for (iter = this.mhmapSections.keySet().iterator();;iter.hasNext())
{
arrRet[iCntr] = (String) iter.next();
iCntr++;
}
}
}
catch (NoSuchElementException NSEExIgnore)
{
}
finally
{
if (iter != null) iter = null;
}
return arrRet;
} | java | public String[] getAllSectionNames()
{
int iCntr = 0;
Iterator<String> iter = null;
String[] arrRet = null;
try
{
if (this.mhmapSections.size() > 0)
{
arrRet = new String[this.mhmapSections.size()];
for (iter = this.mhmapSections.keySet().iterator();;iter.hasNext())
{
arrRet[iCntr] = (String) iter.next();
iCntr++;
}
}
}
catch (NoSuchElementException NSEExIgnore)
{
}
finally
{
if (iter != null) iter = null;
}
return arrRet;
} | [
"public",
"String",
"[",
"]",
"getAllSectionNames",
"(",
")",
"{",
"int",
"iCntr",
"=",
"0",
";",
"Iterator",
"<",
"String",
">",
"iter",
"=",
"null",
";",
"String",
"[",
"]",
"arrRet",
"=",
"null",
";",
"try",
"{",
"if",
"(",
"this",
".",
"mhmapSections",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"arrRet",
"=",
"new",
"String",
"[",
"this",
".",
"mhmapSections",
".",
"size",
"(",
")",
"]",
";",
"for",
"(",
"iter",
"=",
"this",
".",
"mhmapSections",
".",
"keySet",
"(",
")",
".",
"iterator",
"(",
")",
";",
";",
"iter",
".",
"hasNext",
"(",
")",
")",
"{",
"arrRet",
"[",
"iCntr",
"]",
"=",
"(",
"String",
")",
"iter",
".",
"next",
"(",
")",
";",
"iCntr",
"++",
";",
"}",
"}",
"}",
"catch",
"(",
"NoSuchElementException",
"NSEExIgnore",
")",
"{",
"}",
"finally",
"{",
"if",
"(",
"iter",
"!=",
"null",
")",
"iter",
"=",
"null",
";",
"}",
"return",
"arrRet",
";",
"}"
] | Returns a string array containing names of all sections in INI file.
@return the string array of section names | [
"Returns",
"a",
"string",
"array",
"containing",
"names",
"of",
"all",
"sections",
"in",
"INI",
"file",
"."
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-utilities/src/main/java/org/hl7/fhir/utilities/IniFile.java#L574-L600 |
22,591 | jamesagnew/hapi-fhir | hapi-fhir-utilities/src/main/java/org/hl7/fhir/utilities/IniFile.java | IniFile.getPropertyNames | public String[] getPropertyNames(String pstrSection)
{
String[] arrRet = null;
INISection objSec = null;
objSec = (INISection) this.mhmapSections.get(pstrSection);
if (objSec != null)
{
arrRet = objSec.getPropNames();
objSec = null;
}
return arrRet;
} | java | public String[] getPropertyNames(String pstrSection)
{
String[] arrRet = null;
INISection objSec = null;
objSec = (INISection) this.mhmapSections.get(pstrSection);
if (objSec != null)
{
arrRet = objSec.getPropNames();
objSec = null;
}
return arrRet;
} | [
"public",
"String",
"[",
"]",
"getPropertyNames",
"(",
"String",
"pstrSection",
")",
"{",
"String",
"[",
"]",
"arrRet",
"=",
"null",
";",
"INISection",
"objSec",
"=",
"null",
";",
"objSec",
"=",
"(",
"INISection",
")",
"this",
".",
"mhmapSections",
".",
"get",
"(",
"pstrSection",
")",
";",
"if",
"(",
"objSec",
"!=",
"null",
")",
"{",
"arrRet",
"=",
"objSec",
".",
"getPropNames",
"(",
")",
";",
"objSec",
"=",
"null",
";",
"}",
"return",
"arrRet",
";",
"}"
] | Returns a string array containing names of all the properties under specified section.
@param pstrSection the name of the section for which names of properties is to be retrieved.
@return the string array of property names. | [
"Returns",
"a",
"string",
"array",
"containing",
"names",
"of",
"all",
"the",
"properties",
"under",
"specified",
"section",
"."
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-utilities/src/main/java/org/hl7/fhir/utilities/IniFile.java#L607-L619 |
22,592 | jamesagnew/hapi-fhir | hapi-fhir-utilities/src/main/java/org/hl7/fhir/utilities/IniFile.java | IniFile.getProperties | public Map<String, INIProperty> getProperties(String pstrSection)
{
Map<String, INIProperty> hmRet = null;
INISection objSec = null;
objSec = (INISection) this.mhmapSections.get(pstrSection);
if (objSec != null)
{
hmRet = objSec.getProperties();
objSec = null;
}
return hmRet;
} | java | public Map<String, INIProperty> getProperties(String pstrSection)
{
Map<String, INIProperty> hmRet = null;
INISection objSec = null;
objSec = (INISection) this.mhmapSections.get(pstrSection);
if (objSec != null)
{
hmRet = objSec.getProperties();
objSec = null;
}
return hmRet;
} | [
"public",
"Map",
"<",
"String",
",",
"INIProperty",
">",
"getProperties",
"(",
"String",
"pstrSection",
")",
"{",
"Map",
"<",
"String",
",",
"INIProperty",
">",
"hmRet",
"=",
"null",
";",
"INISection",
"objSec",
"=",
"null",
";",
"objSec",
"=",
"(",
"INISection",
")",
"this",
".",
"mhmapSections",
".",
"get",
"(",
"pstrSection",
")",
";",
"if",
"(",
"objSec",
"!=",
"null",
")",
"{",
"hmRet",
"=",
"objSec",
".",
"getProperties",
"(",
")",
";",
"objSec",
"=",
"null",
";",
"}",
"return",
"hmRet",
";",
"}"
] | Returns a map containing all the properties under specified section.
@param pstrSection the name of the section for which properties are to be retrieved.
@return the map of properties. | [
"Returns",
"a",
"map",
"containing",
"all",
"the",
"properties",
"under",
"specified",
"section",
"."
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-utilities/src/main/java/org/hl7/fhir/utilities/IniFile.java#L626-L638 |
22,593 | jamesagnew/hapi-fhir | hapi-fhir-utilities/src/main/java/org/hl7/fhir/utilities/IniFile.java | IniFile.removeProperty | public void removeProperty(String pstrSection, String pstrProp)
{
INISection objSec = null;
objSec = (INISection) this.mhmapSections.get(pstrSection);
if (objSec != null)
{
objSec.removeProperty(pstrProp);
objSec = null;
}
} | java | public void removeProperty(String pstrSection, String pstrProp)
{
INISection objSec = null;
objSec = (INISection) this.mhmapSections.get(pstrSection);
if (objSec != null)
{
objSec.removeProperty(pstrProp);
objSec = null;
}
} | [
"public",
"void",
"removeProperty",
"(",
"String",
"pstrSection",
",",
"String",
"pstrProp",
")",
"{",
"INISection",
"objSec",
"=",
"null",
";",
"objSec",
"=",
"(",
"INISection",
")",
"this",
".",
"mhmapSections",
".",
"get",
"(",
"pstrSection",
")",
";",
"if",
"(",
"objSec",
"!=",
"null",
")",
"{",
"objSec",
".",
"removeProperty",
"(",
"pstrProp",
")",
";",
"objSec",
"=",
"null",
";",
"}",
"}"
] | Removed specified property from the specified section. If the specified
section or the property does not exist, does nothing.
@param pstrSection the section name.
@param pstrProp the name of the property to be removed. | [
"Removed",
"specified",
"property",
"from",
"the",
"specified",
"section",
".",
"If",
"the",
"specified",
"section",
"or",
"the",
"property",
"does",
"not",
"exist",
"does",
"nothing",
"."
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-utilities/src/main/java/org/hl7/fhir/utilities/IniFile.java#L646-L656 |
22,594 | jamesagnew/hapi-fhir | hapi-fhir-utilities/src/main/java/org/hl7/fhir/utilities/IniFile.java | IniFile.save | public boolean save()
{
boolean blnRet = false;
File objFile = null;
String strName = null;
String strTemp = null;
Iterator<String> itrSec = null;
INISection objSec = null;
FileWriter objWriter = null;
try
{
if (this.mhmapSections.size() == 0) return false;
objFile = new CSFile(this.mstrFile);
if (objFile.exists()) objFile.delete();
objWriter = new FileWriter(objFile);
itrSec = this.mhmapSections.keySet().iterator();
while (itrSec.hasNext())
{
strName = (String) itrSec.next();
objSec = (INISection) this.mhmapSections.get(strName);
strTemp = objSec.toString();
objWriter.write(strTemp);
objWriter.write("\r\n");
objSec = null;
}
blnRet = true;
}
catch (IOException IOExIgnore)
{
}
finally
{
if (objWriter != null)
{
closeWriter(objWriter);
objWriter = null;
}
if (objFile != null) objFile = null;
if (itrSec != null) itrSec = null;
}
return blnRet;
} | java | public boolean save()
{
boolean blnRet = false;
File objFile = null;
String strName = null;
String strTemp = null;
Iterator<String> itrSec = null;
INISection objSec = null;
FileWriter objWriter = null;
try
{
if (this.mhmapSections.size() == 0) return false;
objFile = new CSFile(this.mstrFile);
if (objFile.exists()) objFile.delete();
objWriter = new FileWriter(objFile);
itrSec = this.mhmapSections.keySet().iterator();
while (itrSec.hasNext())
{
strName = (String) itrSec.next();
objSec = (INISection) this.mhmapSections.get(strName);
strTemp = objSec.toString();
objWriter.write(strTemp);
objWriter.write("\r\n");
objSec = null;
}
blnRet = true;
}
catch (IOException IOExIgnore)
{
}
finally
{
if (objWriter != null)
{
closeWriter(objWriter);
objWriter = null;
}
if (objFile != null) objFile = null;
if (itrSec != null) itrSec = null;
}
return blnRet;
} | [
"public",
"boolean",
"save",
"(",
")",
"{",
"boolean",
"blnRet",
"=",
"false",
";",
"File",
"objFile",
"=",
"null",
";",
"String",
"strName",
"=",
"null",
";",
"String",
"strTemp",
"=",
"null",
";",
"Iterator",
"<",
"String",
">",
"itrSec",
"=",
"null",
";",
"INISection",
"objSec",
"=",
"null",
";",
"FileWriter",
"objWriter",
"=",
"null",
";",
"try",
"{",
"if",
"(",
"this",
".",
"mhmapSections",
".",
"size",
"(",
")",
"==",
"0",
")",
"return",
"false",
";",
"objFile",
"=",
"new",
"CSFile",
"(",
"this",
".",
"mstrFile",
")",
";",
"if",
"(",
"objFile",
".",
"exists",
"(",
")",
")",
"objFile",
".",
"delete",
"(",
")",
";",
"objWriter",
"=",
"new",
"FileWriter",
"(",
"objFile",
")",
";",
"itrSec",
"=",
"this",
".",
"mhmapSections",
".",
"keySet",
"(",
")",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"itrSec",
".",
"hasNext",
"(",
")",
")",
"{",
"strName",
"=",
"(",
"String",
")",
"itrSec",
".",
"next",
"(",
")",
";",
"objSec",
"=",
"(",
"INISection",
")",
"this",
".",
"mhmapSections",
".",
"get",
"(",
"strName",
")",
";",
"strTemp",
"=",
"objSec",
".",
"toString",
"(",
")",
";",
"objWriter",
".",
"write",
"(",
"strTemp",
")",
";",
"objWriter",
".",
"write",
"(",
"\"\\r\\n\"",
")",
";",
"objSec",
"=",
"null",
";",
"}",
"blnRet",
"=",
"true",
";",
"}",
"catch",
"(",
"IOException",
"IOExIgnore",
")",
"{",
"}",
"finally",
"{",
"if",
"(",
"objWriter",
"!=",
"null",
")",
"{",
"closeWriter",
"(",
"objWriter",
")",
";",
"objWriter",
"=",
"null",
";",
"}",
"if",
"(",
"objFile",
"!=",
"null",
")",
"objFile",
"=",
"null",
";",
"if",
"(",
"itrSec",
"!=",
"null",
")",
"itrSec",
"=",
"null",
";",
"}",
"return",
"blnRet",
";",
"}"
] | Flush changes back to the disk file. If the disk file does not exists then
creates the new one.
@ | [
"Flush",
"changes",
"back",
"to",
"the",
"disk",
"file",
".",
"If",
"the",
"disk",
"file",
"does",
"not",
"exists",
"then",
"creates",
"the",
"new",
"one",
"."
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-utilities/src/main/java/org/hl7/fhir/utilities/IniFile.java#L673-L715 |
22,595 | jamesagnew/hapi-fhir | hapi-fhir-utilities/src/main/java/org/hl7/fhir/utilities/IniFile.java | IniFile.checkDateTimeFormat | private boolean checkDateTimeFormat(String pstrDtFmt)
{
boolean blnRet = false;
DateFormat objFmt = null;
try
{
objFmt = new SimpleDateFormat(pstrDtFmt);
blnRet = true;
}
catch (NullPointerException NPExIgnore)
{
}
catch (IllegalArgumentException IAExIgnore)
{
}
finally
{
if (objFmt != null) objFmt = null;
}
return blnRet;
} | java | private boolean checkDateTimeFormat(String pstrDtFmt)
{
boolean blnRet = false;
DateFormat objFmt = null;
try
{
objFmt = new SimpleDateFormat(pstrDtFmt);
blnRet = true;
}
catch (NullPointerException NPExIgnore)
{
}
catch (IllegalArgumentException IAExIgnore)
{
}
finally
{
if (objFmt != null) objFmt = null;
}
return blnRet;
} | [
"private",
"boolean",
"checkDateTimeFormat",
"(",
"String",
"pstrDtFmt",
")",
"{",
"boolean",
"blnRet",
"=",
"false",
";",
"DateFormat",
"objFmt",
"=",
"null",
";",
"try",
"{",
"objFmt",
"=",
"new",
"SimpleDateFormat",
"(",
"pstrDtFmt",
")",
";",
"blnRet",
"=",
"true",
";",
"}",
"catch",
"(",
"NullPointerException",
"NPExIgnore",
")",
"{",
"}",
"catch",
"(",
"IllegalArgumentException",
"IAExIgnore",
")",
"{",
"}",
"finally",
"{",
"if",
"(",
"objFmt",
"!=",
"null",
")",
"objFmt",
"=",
"null",
";",
"}",
"return",
"blnRet",
";",
"}"
] | Helper function to check the date time formats.
@param pstrDtFmt the date time format string to be checked.
@return true for valid date/time format, false otherwise. | [
"Helper",
"function",
"to",
"check",
"the",
"date",
"time",
"formats",
"."
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-utilities/src/main/java/org/hl7/fhir/utilities/IniFile.java#L811-L832 |
22,596 | jamesagnew/hapi-fhir | hapi-fhir-utilities/src/main/java/org/hl7/fhir/utilities/IniFile.java | IniFile.loadStream | private void loadStream(InputStream stream)
{
int iPos = -1;
String strLine = null;
String strSection = null;
String strRemarks = null;
BufferedReader objBRdr = null;
InputStreamReader objFRdr = null;
INISection objSec = null;
try
{
objFRdr = new InputStreamReader(stream);
if (objFRdr != null)
{
objBRdr = new BufferedReader(objFRdr);
if (objBRdr != null)
{
while (objBRdr.ready())
{
iPos = -1;
strLine = null;
strLine = objBRdr.readLine().trim();
if (strLine == null)
{
}
else if (strLine.length() == 0)
{
}
else if (strLine.substring(0, 1).equals(";"))
{
if (strRemarks == null)
strRemarks = strLine.substring(1);
else if (strRemarks.length() == 0)
strRemarks = strLine.substring(1);
else
strRemarks = strRemarks + "\r\n" + strLine.substring(1);
}
else if (strLine.startsWith("[") && strLine.endsWith("]"))
{
// Section start reached create new section
if (objSec != null)
this.mhmapSections.put(strSection.trim(), objSec);
objSec = null;
strSection = strLine.substring(1, strLine.length() - 1);
objSec = new INISection(strSection.trim(), strRemarks);
strRemarks = null;
}
else if ((iPos = strLine.indexOf("=")) > 0 && objSec != null)
{
// read the key value pair 012345=789
objSec.setProperty(strLine.substring(0, iPos).trim(),
strLine.substring(iPos + 1).trim(),
strRemarks);
strRemarks = null;
}
else
{
objSec.setProperty(strLine, "", strRemarks);
}
}
if (objSec != null)
this.mhmapSections.put(strSection.trim(), objSec);
this.mblnLoaded = true;
}
}
}
catch (FileNotFoundException FNFExIgnore)
{
this.mhmapSections.clear();
}
catch (IOException IOExIgnore)
{
this.mhmapSections.clear();
}
catch (NullPointerException NPExIgnore)
{
this.mhmapSections.clear();
}
finally
{
if (objBRdr != null)
{
closeReader(objBRdr);
objBRdr = null;
}
if (objFRdr != null)
{
closeReader(objFRdr);
objFRdr = null;
}
if (objSec != null) objSec = null;
}
} | java | private void loadStream(InputStream stream)
{
int iPos = -1;
String strLine = null;
String strSection = null;
String strRemarks = null;
BufferedReader objBRdr = null;
InputStreamReader objFRdr = null;
INISection objSec = null;
try
{
objFRdr = new InputStreamReader(stream);
if (objFRdr != null)
{
objBRdr = new BufferedReader(objFRdr);
if (objBRdr != null)
{
while (objBRdr.ready())
{
iPos = -1;
strLine = null;
strLine = objBRdr.readLine().trim();
if (strLine == null)
{
}
else if (strLine.length() == 0)
{
}
else if (strLine.substring(0, 1).equals(";"))
{
if (strRemarks == null)
strRemarks = strLine.substring(1);
else if (strRemarks.length() == 0)
strRemarks = strLine.substring(1);
else
strRemarks = strRemarks + "\r\n" + strLine.substring(1);
}
else if (strLine.startsWith("[") && strLine.endsWith("]"))
{
// Section start reached create new section
if (objSec != null)
this.mhmapSections.put(strSection.trim(), objSec);
objSec = null;
strSection = strLine.substring(1, strLine.length() - 1);
objSec = new INISection(strSection.trim(), strRemarks);
strRemarks = null;
}
else if ((iPos = strLine.indexOf("=")) > 0 && objSec != null)
{
// read the key value pair 012345=789
objSec.setProperty(strLine.substring(0, iPos).trim(),
strLine.substring(iPos + 1).trim(),
strRemarks);
strRemarks = null;
}
else
{
objSec.setProperty(strLine, "", strRemarks);
}
}
if (objSec != null)
this.mhmapSections.put(strSection.trim(), objSec);
this.mblnLoaded = true;
}
}
}
catch (FileNotFoundException FNFExIgnore)
{
this.mhmapSections.clear();
}
catch (IOException IOExIgnore)
{
this.mhmapSections.clear();
}
catch (NullPointerException NPExIgnore)
{
this.mhmapSections.clear();
}
finally
{
if (objBRdr != null)
{
closeReader(objBRdr);
objBRdr = null;
}
if (objFRdr != null)
{
closeReader(objFRdr);
objFRdr = null;
}
if (objSec != null) objSec = null;
}
} | [
"private",
"void",
"loadStream",
"(",
"InputStream",
"stream",
")",
"{",
"int",
"iPos",
"=",
"-",
"1",
";",
"String",
"strLine",
"=",
"null",
";",
"String",
"strSection",
"=",
"null",
";",
"String",
"strRemarks",
"=",
"null",
";",
"BufferedReader",
"objBRdr",
"=",
"null",
";",
"InputStreamReader",
"objFRdr",
"=",
"null",
";",
"INISection",
"objSec",
"=",
"null",
";",
"try",
"{",
"objFRdr",
"=",
"new",
"InputStreamReader",
"(",
"stream",
")",
";",
"if",
"(",
"objFRdr",
"!=",
"null",
")",
"{",
"objBRdr",
"=",
"new",
"BufferedReader",
"(",
"objFRdr",
")",
";",
"if",
"(",
"objBRdr",
"!=",
"null",
")",
"{",
"while",
"(",
"objBRdr",
".",
"ready",
"(",
")",
")",
"{",
"iPos",
"=",
"-",
"1",
";",
"strLine",
"=",
"null",
";",
"strLine",
"=",
"objBRdr",
".",
"readLine",
"(",
")",
".",
"trim",
"(",
")",
";",
"if",
"(",
"strLine",
"==",
"null",
")",
"{",
"}",
"else",
"if",
"(",
"strLine",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"}",
"else",
"if",
"(",
"strLine",
".",
"substring",
"(",
"0",
",",
"1",
")",
".",
"equals",
"(",
"\";\"",
")",
")",
"{",
"if",
"(",
"strRemarks",
"==",
"null",
")",
"strRemarks",
"=",
"strLine",
".",
"substring",
"(",
"1",
")",
";",
"else",
"if",
"(",
"strRemarks",
".",
"length",
"(",
")",
"==",
"0",
")",
"strRemarks",
"=",
"strLine",
".",
"substring",
"(",
"1",
")",
";",
"else",
"strRemarks",
"=",
"strRemarks",
"+",
"\"\\r\\n\"",
"+",
"strLine",
".",
"substring",
"(",
"1",
")",
";",
"}",
"else",
"if",
"(",
"strLine",
".",
"startsWith",
"(",
"\"[\"",
")",
"&&",
"strLine",
".",
"endsWith",
"(",
"\"]\"",
")",
")",
"{",
"// Section start reached create new section\r",
"if",
"(",
"objSec",
"!=",
"null",
")",
"this",
".",
"mhmapSections",
".",
"put",
"(",
"strSection",
".",
"trim",
"(",
")",
",",
"objSec",
")",
";",
"objSec",
"=",
"null",
";",
"strSection",
"=",
"strLine",
".",
"substring",
"(",
"1",
",",
"strLine",
".",
"length",
"(",
")",
"-",
"1",
")",
";",
"objSec",
"=",
"new",
"INISection",
"(",
"strSection",
".",
"trim",
"(",
")",
",",
"strRemarks",
")",
";",
"strRemarks",
"=",
"null",
";",
"}",
"else",
"if",
"(",
"(",
"iPos",
"=",
"strLine",
".",
"indexOf",
"(",
"\"=\"",
")",
")",
">",
"0",
"&&",
"objSec",
"!=",
"null",
")",
"{",
"// read the key value pair 012345=789\r",
"objSec",
".",
"setProperty",
"(",
"strLine",
".",
"substring",
"(",
"0",
",",
"iPos",
")",
".",
"trim",
"(",
")",
",",
"strLine",
".",
"substring",
"(",
"iPos",
"+",
"1",
")",
".",
"trim",
"(",
")",
",",
"strRemarks",
")",
";",
"strRemarks",
"=",
"null",
";",
"}",
"else",
"{",
"objSec",
".",
"setProperty",
"(",
"strLine",
",",
"\"\"",
",",
"strRemarks",
")",
";",
"}",
"}",
"if",
"(",
"objSec",
"!=",
"null",
")",
"this",
".",
"mhmapSections",
".",
"put",
"(",
"strSection",
".",
"trim",
"(",
")",
",",
"objSec",
")",
";",
"this",
".",
"mblnLoaded",
"=",
"true",
";",
"}",
"}",
"}",
"catch",
"(",
"FileNotFoundException",
"FNFExIgnore",
")",
"{",
"this",
".",
"mhmapSections",
".",
"clear",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"IOExIgnore",
")",
"{",
"this",
".",
"mhmapSections",
".",
"clear",
"(",
")",
";",
"}",
"catch",
"(",
"NullPointerException",
"NPExIgnore",
")",
"{",
"this",
".",
"mhmapSections",
".",
"clear",
"(",
")",
";",
"}",
"finally",
"{",
"if",
"(",
"objBRdr",
"!=",
"null",
")",
"{",
"closeReader",
"(",
"objBRdr",
")",
";",
"objBRdr",
"=",
"null",
";",
"}",
"if",
"(",
"objFRdr",
"!=",
"null",
")",
"{",
"closeReader",
"(",
"objFRdr",
")",
";",
"objFRdr",
"=",
"null",
";",
"}",
"if",
"(",
"objSec",
"!=",
"null",
")",
"objSec",
"=",
"null",
";",
"}",
"}"
] | Reads the INI file and load its contentens into a section collection after
parsing the file line by line. | [
"Reads",
"the",
"INI",
"file",
"and",
"load",
"its",
"contentens",
"into",
"a",
"section",
"collection",
"after",
"parsing",
"the",
"file",
"line",
"by",
"line",
"."
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-utilities/src/main/java/org/hl7/fhir/utilities/IniFile.java#L838-L932 |
22,597 | jamesagnew/hapi-fhir | hapi-fhir-utilities/src/main/java/org/hl7/fhir/utilities/IniFile.java | IniFile.checkFile | private boolean checkFile(String pstrFile)
{
boolean blnRet = false;
File objFile = null;
try
{
objFile = new CSFile(pstrFile);
blnRet = (objFile.exists() && objFile.isFile());
}
catch (Exception e)
{
blnRet = false;
}
finally
{
if (objFile != null) objFile = null;
}
return blnRet;
} | java | private boolean checkFile(String pstrFile)
{
boolean blnRet = false;
File objFile = null;
try
{
objFile = new CSFile(pstrFile);
blnRet = (objFile.exists() && objFile.isFile());
}
catch (Exception e)
{
blnRet = false;
}
finally
{
if (objFile != null) objFile = null;
}
return blnRet;
} | [
"private",
"boolean",
"checkFile",
"(",
"String",
"pstrFile",
")",
"{",
"boolean",
"blnRet",
"=",
"false",
";",
"File",
"objFile",
"=",
"null",
";",
"try",
"{",
"objFile",
"=",
"new",
"CSFile",
"(",
"pstrFile",
")",
";",
"blnRet",
"=",
"(",
"objFile",
".",
"exists",
"(",
")",
"&&",
"objFile",
".",
"isFile",
"(",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"blnRet",
"=",
"false",
";",
"}",
"finally",
"{",
"if",
"(",
"objFile",
"!=",
"null",
")",
"objFile",
"=",
"null",
";",
"}",
"return",
"blnRet",
";",
"}"
] | Helper method to check the existance of a file.
@param the full path and name of the file to be checked.
@return true if file exists, false otherwise. | [
"Helper",
"method",
"to",
"check",
"the",
"existance",
"of",
"a",
"file",
"."
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-utilities/src/main/java/org/hl7/fhir/utilities/IniFile.java#L1072-L1091 |
22,598 | jamesagnew/hapi-fhir | hapi-fhir-utilities/src/main/java/org/hl7/fhir/utilities/IniFile.java | IniFile.utilDateToStr | private String utilDateToStr(Date pdt, String pstrFmt)
{
String strRet = null;
SimpleDateFormat dtFmt = null;
try
{
dtFmt = new SimpleDateFormat(pstrFmt);
strRet = dtFmt.format(pdt);
}
catch (Exception e)
{
strRet = null;
}
finally
{
if (dtFmt != null) dtFmt = null;
}
return strRet;
} | java | private String utilDateToStr(Date pdt, String pstrFmt)
{
String strRet = null;
SimpleDateFormat dtFmt = null;
try
{
dtFmt = new SimpleDateFormat(pstrFmt);
strRet = dtFmt.format(pdt);
}
catch (Exception e)
{
strRet = null;
}
finally
{
if (dtFmt != null) dtFmt = null;
}
return strRet;
} | [
"private",
"String",
"utilDateToStr",
"(",
"Date",
"pdt",
",",
"String",
"pstrFmt",
")",
"{",
"String",
"strRet",
"=",
"null",
";",
"SimpleDateFormat",
"dtFmt",
"=",
"null",
";",
"try",
"{",
"dtFmt",
"=",
"new",
"SimpleDateFormat",
"(",
"pstrFmt",
")",
";",
"strRet",
"=",
"dtFmt",
".",
"format",
"(",
"pdt",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"strRet",
"=",
"null",
";",
"}",
"finally",
"{",
"if",
"(",
"dtFmt",
"!=",
"null",
")",
"dtFmt",
"=",
"null",
";",
"}",
"return",
"strRet",
";",
"}"
] | Converts a java.util.date into String
@param pd Date that need to be converted to String
@param pstrFmt The date format pattern.
@return String | [
"Converts",
"a",
"java",
".",
"util",
".",
"date",
"into",
"String"
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-utilities/src/main/java/org/hl7/fhir/utilities/IniFile.java#L1099-L1118 |
22,599 | jamesagnew/hapi-fhir | hapi-fhir-utilities/src/main/java/org/hl7/fhir/utilities/IniFile.java | IniFile.timeToStr | private String timeToStr(Timestamp pobjTS, String pstrFmt)
{
String strRet = null;
SimpleDateFormat dtFmt = null;
try
{
dtFmt = new SimpleDateFormat(pstrFmt);
strRet = dtFmt.format(pobjTS);
}
catch (IllegalArgumentException iae)
{
strRet = "";
}
catch (NullPointerException npe)
{
strRet = "";
}
finally
{
if (dtFmt != null) dtFmt = null;
}
return strRet;
} | java | private String timeToStr(Timestamp pobjTS, String pstrFmt)
{
String strRet = null;
SimpleDateFormat dtFmt = null;
try
{
dtFmt = new SimpleDateFormat(pstrFmt);
strRet = dtFmt.format(pobjTS);
}
catch (IllegalArgumentException iae)
{
strRet = "";
}
catch (NullPointerException npe)
{
strRet = "";
}
finally
{
if (dtFmt != null) dtFmt = null;
}
return strRet;
} | [
"private",
"String",
"timeToStr",
"(",
"Timestamp",
"pobjTS",
",",
"String",
"pstrFmt",
")",
"{",
"String",
"strRet",
"=",
"null",
";",
"SimpleDateFormat",
"dtFmt",
"=",
"null",
";",
"try",
"{",
"dtFmt",
"=",
"new",
"SimpleDateFormat",
"(",
"pstrFmt",
")",
";",
"strRet",
"=",
"dtFmt",
".",
"format",
"(",
"pobjTS",
")",
";",
"}",
"catch",
"(",
"IllegalArgumentException",
"iae",
")",
"{",
"strRet",
"=",
"\"\"",
";",
"}",
"catch",
"(",
"NullPointerException",
"npe",
")",
"{",
"strRet",
"=",
"\"\"",
";",
"}",
"finally",
"{",
"if",
"(",
"dtFmt",
"!=",
"null",
")",
"dtFmt",
"=",
"null",
";",
"}",
"return",
"strRet",
";",
"}"
] | Converts the given sql timestamp object to a string representation. The format
to be used is to be obtained from the configuration file.
@param pobjTS the sql timestamp object to be converted.
@param pblnGMT If true formats the string using GMT timezone
otherwise using local timezone.
@return the formatted string representation of the timestamp. | [
"Converts",
"the",
"given",
"sql",
"timestamp",
"object",
"to",
"a",
"string",
"representation",
".",
"The",
"format",
"to",
"be",
"used",
"is",
"to",
"be",
"obtained",
"from",
"the",
"configuration",
"file",
"."
] | 150a84d52fe691b7f48fcb28247c4bddb7aec352 | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-utilities/src/main/java/org/hl7/fhir/utilities/IniFile.java#L1129-L1152 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.