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
147,700
yfpeng/pengyifan-bioc
src/main/java/com/pengyifan/bioc/util/BioCValidate3.java
BioCValidate3.check
public void check(BioCPassage passage) { String text = checkText(passage); check(passage, passage.getOffset(), text); for (BioCSentence sentence : passage.getSentences()) { check(sentence, 0, text, passage); } }
java
public void check(BioCPassage passage) { String text = checkText(passage); check(passage, passage.getOffset(), text); for (BioCSentence sentence : passage.getSentences()) { check(sentence, 0, text, passage); } }
[ "public", "void", "check", "(", "BioCPassage", "passage", ")", "{", "String", "text", "=", "checkText", "(", "passage", ")", ";", "check", "(", "passage", ",", "passage", ".", "getOffset", "(", ")", ",", "text", ")", ";", "for", "(", "BioCSentence", "sentence", ":", "passage", ".", "getSentences", "(", ")", ")", "{", "check", "(", "sentence", ",", "0", ",", "text", ",", "passage", ")", ";", "}", "}" ]
Checks text, annotations and relations of the passage. @param passage input passage
[ "Checks", "text", "annotations", "and", "relations", "of", "the", "passage", "." ]
e09cce1969aa598ff89e7957237375715d7a1a3a
https://github.com/yfpeng/pengyifan-bioc/blob/e09cce1969aa598ff89e7957237375715d7a1a3a/src/main/java/com/pengyifan/bioc/util/BioCValidate3.java#L72-L78
147,701
yfpeng/pengyifan-bioc
src/main/java/com/pengyifan/bioc/util/BioCValidate3.java
BioCValidate3.check
public void check(BioCSentence sentence) { String text = checkText(sentence); check(sentence, sentence.getOffset(), text); }
java
public void check(BioCSentence sentence) { String text = checkText(sentence); check(sentence, sentence.getOffset(), text); }
[ "public", "void", "check", "(", "BioCSentence", "sentence", ")", "{", "String", "text", "=", "checkText", "(", "sentence", ")", ";", "check", "(", "sentence", ",", "sentence", ".", "getOffset", "(", ")", ",", "text", ")", ";", "}" ]
Checks text, annotations and relations of the sentence. @param sentence input sentence
[ "Checks", "text", "annotations", "and", "relations", "of", "the", "sentence", "." ]
e09cce1969aa598ff89e7957237375715d7a1a3a
https://github.com/yfpeng/pengyifan-bioc/blob/e09cce1969aa598ff89e7957237375715d7a1a3a/src/main/java/com/pengyifan/bioc/util/BioCValidate3.java#L85-L88
147,702
yfpeng/pengyifan-bioc
src/main/java/com/pengyifan/bioc/util/BioCValidate3.java
BioCValidate3.check
public void check(BioCStructure structure, int offset, String text, BioCStructure... parents) { BioCStructure[] path = new BioCStructure[parents.length + 1]; System.arraycopy(parents, 0, path, 0, parents.length); path[path.length - 1] = structure; String location = log(path); checkAnnotations(structure, offset, text, location); checkRelations(structure, location); }
java
public void check(BioCStructure structure, int offset, String text, BioCStructure... parents) { BioCStructure[] path = new BioCStructure[parents.length + 1]; System.arraycopy(parents, 0, path, 0, parents.length); path[path.length - 1] = structure; String location = log(path); checkAnnotations(structure, offset, text, location); checkRelations(structure, location); }
[ "public", "void", "check", "(", "BioCStructure", "structure", ",", "int", "offset", ",", "String", "text", ",", "BioCStructure", "...", "parents", ")", "{", "BioCStructure", "[", "]", "path", "=", "new", "BioCStructure", "[", "parents", ".", "length", "+", "1", "]", ";", "System", ".", "arraycopy", "(", "parents", ",", "0", ",", "path", ",", "0", ",", "parents", ".", "length", ")", ";", "path", "[", "path", ".", "length", "-", "1", "]", "=", "structure", ";", "String", "location", "=", "log", "(", "path", ")", ";", "checkAnnotations", "(", "structure", ",", "offset", ",", "text", ",", "location", ")", ";", "checkRelations", "(", "structure", ",", "location", ")", ";", "}" ]
Check the annotation and relation in the structure. @param structure the specified structure @param offset the offset of this structure @param text the text that annotations should match @param parents the path from root until this structure (not included
[ "Check", "the", "annotation", "and", "relation", "in", "the", "structure", "." ]
e09cce1969aa598ff89e7957237375715d7a1a3a
https://github.com/yfpeng/pengyifan-bioc/blob/e09cce1969aa598ff89e7957237375715d7a1a3a/src/main/java/com/pengyifan/bioc/util/BioCValidate3.java#L98-L105
147,703
ZenHarbinger/l2fprod-properties-editor
src/main/java/com/l2fprod/common/beans/BeanUtils.java
BeanUtils.getReadMethod
public static Method getReadMethod(Class<?> clazz, String propertyName) { Method readMethod = null; try { PropertyDescriptor[] thisProps = Introspector.getBeanInfo(clazz).getPropertyDescriptors(); for (PropertyDescriptor pd : thisProps) { if (pd.getName().equals(propertyName) && pd.getReadMethod() != null) { readMethod = pd.getReadMethod(); break; } } } catch (IntrospectionException ex) { Logger.getLogger(BeanUtils.class.getName()).log(Level.SEVERE, null, ex); } return readMethod; }
java
public static Method getReadMethod(Class<?> clazz, String propertyName) { Method readMethod = null; try { PropertyDescriptor[] thisProps = Introspector.getBeanInfo(clazz).getPropertyDescriptors(); for (PropertyDescriptor pd : thisProps) { if (pd.getName().equals(propertyName) && pd.getReadMethod() != null) { readMethod = pd.getReadMethod(); break; } } } catch (IntrospectionException ex) { Logger.getLogger(BeanUtils.class.getName()).log(Level.SEVERE, null, ex); } return readMethod; }
[ "public", "static", "Method", "getReadMethod", "(", "Class", "<", "?", ">", "clazz", ",", "String", "propertyName", ")", "{", "Method", "readMethod", "=", "null", ";", "try", "{", "PropertyDescriptor", "[", "]", "thisProps", "=", "Introspector", ".", "getBeanInfo", "(", "clazz", ")", ".", "getPropertyDescriptors", "(", ")", ";", "for", "(", "PropertyDescriptor", "pd", ":", "thisProps", ")", "{", "if", "(", "pd", ".", "getName", "(", ")", ".", "equals", "(", "propertyName", ")", "&&", "pd", ".", "getReadMethod", "(", ")", "!=", "null", ")", "{", "readMethod", "=", "pd", ".", "getReadMethod", "(", ")", ";", "break", ";", "}", "}", "}", "catch", "(", "IntrospectionException", "ex", ")", "{", "Logger", ".", "getLogger", "(", "BeanUtils", ".", "class", ".", "getName", "(", ")", ")", ".", "log", "(", "Level", ".", "SEVERE", ",", "null", ",", "ex", ")", ";", "}", "return", "readMethod", ";", "}" ]
Helper method for getting a read method for a property. @param clazz the type to get the method for. @param propertyName the name of the property. @return the method for reading the property.
[ "Helper", "method", "for", "getting", "a", "read", "method", "for", "a", "property", "." ]
d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32
https://github.com/ZenHarbinger/l2fprod-properties-editor/blob/d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32/src/main/java/com/l2fprod/common/beans/BeanUtils.java#L45-L59
147,704
synchronoss/cpo-api
cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/JdbcCpoAdapter.java
JdbcCpoAdapter.getInstance
public static JdbcCpoAdapter getInstance(JdbcCpoMetaDescriptor metaDescriptor, DataSourceInfo<DataSource> jdsiWrite, DataSourceInfo<DataSource> jdsiRead) throws CpoException { String adapterKey = metaDescriptor + ":" + jdsiWrite.getDataSourceName() + ":" + jdsiRead.getDataSourceName(); JdbcCpoAdapter adapter = (JdbcCpoAdapter) findCpoAdapter(adapterKey); if (adapter == null) { adapter = new JdbcCpoAdapter(metaDescriptor, jdsiWrite, jdsiRead); addCpoAdapter(adapterKey, adapter); } return adapter; }
java
public static JdbcCpoAdapter getInstance(JdbcCpoMetaDescriptor metaDescriptor, DataSourceInfo<DataSource> jdsiWrite, DataSourceInfo<DataSource> jdsiRead) throws CpoException { String adapterKey = metaDescriptor + ":" + jdsiWrite.getDataSourceName() + ":" + jdsiRead.getDataSourceName(); JdbcCpoAdapter adapter = (JdbcCpoAdapter) findCpoAdapter(adapterKey); if (adapter == null) { adapter = new JdbcCpoAdapter(metaDescriptor, jdsiWrite, jdsiRead); addCpoAdapter(adapterKey, adapter); } return adapter; }
[ "public", "static", "JdbcCpoAdapter", "getInstance", "(", "JdbcCpoMetaDescriptor", "metaDescriptor", ",", "DataSourceInfo", "<", "DataSource", ">", "jdsiWrite", ",", "DataSourceInfo", "<", "DataSource", ">", "jdsiRead", ")", "throws", "CpoException", "{", "String", "adapterKey", "=", "metaDescriptor", "+", "\":\"", "+", "jdsiWrite", ".", "getDataSourceName", "(", ")", "+", "\":\"", "+", "jdsiRead", ".", "getDataSourceName", "(", ")", ";", "JdbcCpoAdapter", "adapter", "=", "(", "JdbcCpoAdapter", ")", "findCpoAdapter", "(", "adapterKey", ")", ";", "if", "(", "adapter", "==", "null", ")", "{", "adapter", "=", "new", "JdbcCpoAdapter", "(", "metaDescriptor", ",", "jdsiWrite", ",", "jdsiRead", ")", ";", "addCpoAdapter", "(", "adapterKey", ",", "adapter", ")", ";", "}", "return", "adapter", ";", "}" ]
Creates a JdbcCpoAdapter. @param metaDescriptor This datasource that identifies the cpo metadata datasource @param jdsiWrite The datasource that identifies the transaction database for write transactions. @param jdsiRead The datasource that identifies the transaction database for read-only transactions. @throws org.synchronoss.cpo.CpoException exception
[ "Creates", "a", "JdbcCpoAdapter", "." ]
dc745aca3b3206abf80b85d9689b0132f5baa694
https://github.com/synchronoss/cpo-api/blob/dc745aca3b3206abf80b85d9689b0132f5baa694/cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/JdbcCpoAdapter.java#L170-L178
147,705
synchronoss/cpo-api
cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/JdbcCpoAdapter.java
JdbcCpoAdapter.processExecuteGroup
protected <T, C> T processExecuteGroup(String name, C criteria, T result) throws CpoException { Connection c = null; T obj = null; try { c = getWriteConnection(); obj = processExecuteGroup(name, criteria, result, c); commitLocalConnection(c); } catch (Exception e) { // Any exception has to try to rollback the work; rollbackLocalConnection(c); ExceptionHelper.reThrowCpoException(e, "processExecuteGroup(String name, Object criteria, Object result) failed"); } finally { closeLocalConnection(c); } return obj; }
java
protected <T, C> T processExecuteGroup(String name, C criteria, T result) throws CpoException { Connection c = null; T obj = null; try { c = getWriteConnection(); obj = processExecuteGroup(name, criteria, result, c); commitLocalConnection(c); } catch (Exception e) { // Any exception has to try to rollback the work; rollbackLocalConnection(c); ExceptionHelper.reThrowCpoException(e, "processExecuteGroup(String name, Object criteria, Object result) failed"); } finally { closeLocalConnection(c); } return obj; }
[ "protected", "<", "T", ",", "C", ">", "T", "processExecuteGroup", "(", "String", "name", ",", "C", "criteria", ",", "T", "result", ")", "throws", "CpoException", "{", "Connection", "c", "=", "null", ";", "T", "obj", "=", "null", ";", "try", "{", "c", "=", "getWriteConnection", "(", ")", ";", "obj", "=", "processExecuteGroup", "(", "name", ",", "criteria", ",", "result", ",", "c", ")", ";", "commitLocalConnection", "(", "c", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "// Any exception has to try to rollback the work;", "rollbackLocalConnection", "(", "c", ")", ";", "ExceptionHelper", ".", "reThrowCpoException", "(", "e", ",", "\"processExecuteGroup(String name, Object criteria, Object result) failed\"", ")", ";", "}", "finally", "{", "closeLocalConnection", "(", "c", ")", ";", "}", "return", "obj", ";", "}" ]
Executes an Object whose MetaData contains a stored procedure. An assumption is that the object exists in the datasource. @param name The filter name which tells the datasource which objects should be returned. The name also signifies what data in the object will be populated. @param criteria This is an object that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the object does not exist in the datasource, an exception will be thrown. This object is used to populate the IN arguments used to retrieve the collection of objects. @param result This is an object that has been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. If the object does not exist in the datasource, an exception will be thrown. This object defines the object type that will be returned in the @return A result object populate with the OUT arguments @throws CpoException DOCUMENT ME!
[ "Executes", "an", "Object", "whose", "MetaData", "contains", "a", "stored", "procedure", ".", "An", "assumption", "is", "that", "the", "object", "exists", "in", "the", "datasource", "." ]
dc745aca3b3206abf80b85d9689b0132f5baa694
https://github.com/synchronoss/cpo-api/blob/dc745aca3b3206abf80b85d9689b0132f5baa694/cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/JdbcCpoAdapter.java#L2160-L2177
147,706
pulse00/Composer-Java-Bindings
java-api/src/main/java/com/dubture/getcomposer/core/entities/JsonValue.java
JsonValue.getAsArray
public JsonArray getAsArray() { if (!(value instanceof JsonArray)) { JsonArray val = new JsonArray(); val.add(value); value = val; } return (JsonArray)value; }
java
public JsonArray getAsArray() { if (!(value instanceof JsonArray)) { JsonArray val = new JsonArray(); val.add(value); value = val; } return (JsonArray)value; }
[ "public", "JsonArray", "getAsArray", "(", ")", "{", "if", "(", "!", "(", "value", "instanceof", "JsonArray", ")", ")", "{", "JsonArray", "val", "=", "new", "JsonArray", "(", ")", ";", "val", ".", "add", "(", "value", ")", ";", "value", "=", "val", ";", "}", "return", "(", "JsonArray", ")", "value", ";", "}" ]
Returns the value as array. @return the value
[ "Returns", "the", "value", "as", "array", "." ]
0aa572567db37d047a41a57c32ede7c7fd5d4938
https://github.com/pulse00/Composer-Java-Bindings/blob/0aa572567db37d047a41a57c32ede7c7fd5d4938/java-api/src/main/java/com/dubture/getcomposer/core/entities/JsonValue.java#L125-L132
147,707
pulse00/Composer-Java-Bindings
java-api/src/main/java/com/dubture/getcomposer/core/entities/JsonValue.java
JsonValue.getAsBoolean
public Boolean getAsBoolean() { if (value instanceof String) { return Boolean.parseBoolean((String)value); } return (Boolean)value; }
java
public Boolean getAsBoolean() { if (value instanceof String) { return Boolean.parseBoolean((String)value); } return (Boolean)value; }
[ "public", "Boolean", "getAsBoolean", "(", ")", "{", "if", "(", "value", "instanceof", "String", ")", "{", "return", "Boolean", ".", "parseBoolean", "(", "(", "String", ")", "value", ")", ";", "}", "return", "(", "Boolean", ")", "value", ";", "}" ]
Returns the value as boolean. @return the value as boolean
[ "Returns", "the", "value", "as", "boolean", "." ]
0aa572567db37d047a41a57c32ede7c7fd5d4938
https://github.com/pulse00/Composer-Java-Bindings/blob/0aa572567db37d047a41a57c32ede7c7fd5d4938/java-api/src/main/java/com/dubture/getcomposer/core/entities/JsonValue.java#L148-L153
147,708
pulse00/Composer-Java-Bindings
java-api/src/main/java/com/dubture/getcomposer/core/entities/JsonValue.java
JsonValue.getAsInteger
public Integer getAsInteger() { if (value instanceof String) { return Integer.valueOf((String)value); } else if (value instanceof Long) { return ((Long)value).intValue(); } return (Integer)value; }
java
public Integer getAsInteger() { if (value instanceof String) { return Integer.valueOf((String)value); } else if (value instanceof Long) { return ((Long)value).intValue(); } return (Integer)value; }
[ "public", "Integer", "getAsInteger", "(", ")", "{", "if", "(", "value", "instanceof", "String", ")", "{", "return", "Integer", ".", "valueOf", "(", "(", "String", ")", "value", ")", ";", "}", "else", "if", "(", "value", "instanceof", "Long", ")", "{", "return", "(", "(", "Long", ")", "value", ")", ".", "intValue", "(", ")", ";", "}", "return", "(", "Integer", ")", "value", ";", "}" ]
Returns the value as integer. @return the value as integer
[ "Returns", "the", "value", "as", "integer", "." ]
0aa572567db37d047a41a57c32ede7c7fd5d4938
https://github.com/pulse00/Composer-Java-Bindings/blob/0aa572567db37d047a41a57c32ede7c7fd5d4938/java-api/src/main/java/com/dubture/getcomposer/core/entities/JsonValue.java#L160-L167
147,709
opendatatrentino/s-match
src/main/java/it/unitn/disi/smatch/matchers/element/string/EditDistanceOptimized.java
EditDistanceOptimized.match
public char match(String str1, String str2) { if (null == str1 || null == str2 || 0 == str1.length() || 0 == str2.length()) { return IMappingElement.IDK; } float sim = 1 - (float) getLevenshteinDistance(str1, str2) / java.lang.Math.max(str1.length(), str2.length()); if (threshold <= sim) { return IMappingElement.EQUIVALENCE; } else { return IMappingElement.IDK; } }
java
public char match(String str1, String str2) { if (null == str1 || null == str2 || 0 == str1.length() || 0 == str2.length()) { return IMappingElement.IDK; } float sim = 1 - (float) getLevenshteinDistance(str1, str2) / java.lang.Math.max(str1.length(), str2.length()); if (threshold <= sim) { return IMappingElement.EQUIVALENCE; } else { return IMappingElement.IDK; } }
[ "public", "char", "match", "(", "String", "str1", ",", "String", "str2", ")", "{", "if", "(", "null", "==", "str1", "||", "null", "==", "str2", "||", "0", "==", "str1", ".", "length", "(", ")", "||", "0", "==", "str2", ".", "length", "(", ")", ")", "{", "return", "IMappingElement", ".", "IDK", ";", "}", "float", "sim", "=", "1", "-", "(", "float", ")", "getLevenshteinDistance", "(", "str1", ",", "str2", ")", "/", "java", ".", "lang", ".", "Math", ".", "max", "(", "str1", ".", "length", "(", ")", ",", "str2", ".", "length", "(", ")", ")", ";", "if", "(", "threshold", "<=", "sim", ")", "{", "return", "IMappingElement", ".", "EQUIVALENCE", ";", "}", "else", "{", "return", "IMappingElement", ".", "IDK", ";", "}", "}" ]
Computes the relation with optimized edit distance matcher. @param str1 source input string @param str2 target input string @return synonym or IDK relation
[ "Computes", "the", "relation", "with", "optimized", "edit", "distance", "matcher", "." ]
ba5982ef406b7010c2f92592e43887a485935aa1
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/matchers/element/string/EditDistanceOptimized.java#L43-L53
147,710
awltech/org.parallelj
parallelj-core-parent/parallelj-core-api/src/main/java/org/parallelj/internal/kernel/KProgram.java
KProgram.init
void init(KProcess process) { process.markings = new Object[this.elements.size()]; for (KElement element : this.elements) { element.init(process); } }
java
void init(KProcess process) { process.markings = new Object[this.elements.size()]; for (KElement element : this.elements) { element.init(process); } }
[ "void", "init", "(", "KProcess", "process", ")", "{", "process", ".", "markings", "=", "new", "Object", "[", "this", ".", "elements", ".", "size", "(", ")", "]", ";", "for", "(", "KElement", "element", ":", "this", ".", "elements", ")", "{", "element", ".", "init", "(", "process", ")", ";", "}", "}" ]
Initialize a process. @param program
[ "Initialize", "a", "process", "." ]
2a2498cc4ac6227df6f45d295ec568cad3cffbc4
https://github.com/awltech/org.parallelj/blob/2a2498cc4ac6227df6f45d295ec568cad3cffbc4/parallelj-core-parent/parallelj-core-api/src/main/java/org/parallelj/internal/kernel/KProgram.java#L115-L120
147,711
awltech/org.parallelj
parallelj-core-parent/parallelj-core-api/src/main/java/org/parallelj/internal/kernel/KProgram.java
KProgram.addElement
void addElement(KElement element) { if (!this.elements.contains(element)) { element.setIndex(this.elements.size()); this.elements.add(element); } }
java
void addElement(KElement element) { if (!this.elements.contains(element)) { element.setIndex(this.elements.size()); this.elements.add(element); } }
[ "void", "addElement", "(", "KElement", "element", ")", "{", "if", "(", "!", "this", ".", "elements", ".", "contains", "(", "element", ")", ")", "{", "element", ".", "setIndex", "(", "this", ".", "elements", ".", "size", "(", ")", ")", ";", "this", ".", "elements", ".", "add", "(", "element", ")", ";", "}", "}" ]
Add an element @param element the element to add
[ "Add", "an", "element" ]
2a2498cc4ac6227df6f45d295ec568cad3cffbc4
https://github.com/awltech/org.parallelj/blob/2a2498cc4ac6227df6f45d295ec568cad3cffbc4/parallelj-core-parent/parallelj-core-api/src/main/java/org/parallelj/internal/kernel/KProgram.java#L128-L133
147,712
kmi/iserve
iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/Util.java
Util.getStringValueFromRow
private static String getStringValueFromRow(QuerySolution resultRow, String variableName) { // Check the input and exit immediately if null if (resultRow == null) { return null; } String result = null; Resource res = resultRow.getResource(variableName); if (res != null && res.isLiteral()) { result = res.asLiteral().getString(); } return result; }
java
private static String getStringValueFromRow(QuerySolution resultRow, String variableName) { // Check the input and exit immediately if null if (resultRow == null) { return null; } String result = null; Resource res = resultRow.getResource(variableName); if (res != null && res.isLiteral()) { result = res.asLiteral().getString(); } return result; }
[ "private", "static", "String", "getStringValueFromRow", "(", "QuerySolution", "resultRow", ",", "String", "variableName", ")", "{", "// Check the input and exit immediately if null", "if", "(", "resultRow", "==", "null", ")", "{", "return", "null", ";", "}", "String", "result", "=", "null", ";", "Resource", "res", "=", "resultRow", ".", "getResource", "(", "variableName", ")", ";", "if", "(", "res", "!=", "null", "&&", "res", ".", "isLiteral", "(", ")", ")", "{", "result", "=", "res", ".", "asLiteral", "(", ")", ".", "getString", "(", ")", ";", "}", "return", "result", ";", "}" ]
Given a query result from a SPARQL query, obtain the given variable value as a String @param resultRow the result from a SPARQL query @param variableName the name of the variable to obtain @return the value or null if it could not be found
[ "Given", "a", "query", "result", "from", "a", "SPARQL", "query", "obtain", "the", "given", "variable", "value", "as", "a", "String" ]
13e7016e64c1d5a539b838c6debf1a5cc4aefcb7
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/Util.java#L85-L99
147,713
kmi/iserve
iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/Util.java
Util.getUrlValueFromRow
private static URL getUrlValueFromRow(QuerySolution resultRow, String variableName) { // Check the input and exit immediately if null if (resultRow == null) { return null; } URL result = null; Resource res = resultRow.getResource(variableName); // Ignore and track services that are blank nodes if (res.isAnon()) { log.warn("Blank node found and ignored " + res.toString()); } else if (res.isURIResource()) { try { result = new URL(res.getURI()); } catch (MalformedURLException e) { log.error("Malformed URL for node", e); } catch (ClassCastException e) { log.error("The node is not a URI", e); } } return result; }
java
private static URL getUrlValueFromRow(QuerySolution resultRow, String variableName) { // Check the input and exit immediately if null if (resultRow == null) { return null; } URL result = null; Resource res = resultRow.getResource(variableName); // Ignore and track services that are blank nodes if (res.isAnon()) { log.warn("Blank node found and ignored " + res.toString()); } else if (res.isURIResource()) { try { result = new URL(res.getURI()); } catch (MalformedURLException e) { log.error("Malformed URL for node", e); } catch (ClassCastException e) { log.error("The node is not a URI", e); } } return result; }
[ "private", "static", "URL", "getUrlValueFromRow", "(", "QuerySolution", "resultRow", ",", "String", "variableName", ")", "{", "// Check the input and exit immediately if null", "if", "(", "resultRow", "==", "null", ")", "{", "return", "null", ";", "}", "URL", "result", "=", "null", ";", "Resource", "res", "=", "resultRow", ".", "getResource", "(", "variableName", ")", ";", "// Ignore and track services that are blank nodes", "if", "(", "res", ".", "isAnon", "(", ")", ")", "{", "log", ".", "warn", "(", "\"Blank node found and ignored \"", "+", "res", ".", "toString", "(", ")", ")", ";", "}", "else", "if", "(", "res", ".", "isURIResource", "(", ")", ")", "{", "try", "{", "result", "=", "new", "URL", "(", "res", ".", "getURI", "(", ")", ")", ";", "}", "catch", "(", "MalformedURLException", "e", ")", "{", "log", ".", "error", "(", "\"Malformed URL for node\"", ",", "e", ")", ";", "}", "catch", "(", "ClassCastException", "e", ")", "{", "log", ".", "error", "(", "\"The node is not a URI\"", ",", "e", ")", ";", "}", "}", "return", "result", ";", "}" ]
Given a query result from a SPARQL query, obtain the given variable value as a URL @param resultRow the result from a SPARQL query @param variableName the name of the variable to obtain @return the value or null if it could not be obtained
[ "Given", "a", "query", "result", "from", "a", "SPARQL", "query", "obtain", "the", "given", "variable", "value", "as", "a", "URL" ]
13e7016e64c1d5a539b838c6debf1a5cc4aefcb7
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/Util.java#L131-L154
147,714
kmi/iserve
iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/Util.java
Util.isVariableSet
public static boolean isVariableSet(QuerySolution resultRow, String variableName) { if (resultRow != null) { return resultRow.contains(variableName); } return false; }
java
public static boolean isVariableSet(QuerySolution resultRow, String variableName) { if (resultRow != null) { return resultRow.contains(variableName); } return false; }
[ "public", "static", "boolean", "isVariableSet", "(", "QuerySolution", "resultRow", ",", "String", "variableName", ")", "{", "if", "(", "resultRow", "!=", "null", ")", "{", "return", "resultRow", ".", "contains", "(", "variableName", ")", ";", "}", "return", "false", ";", "}" ]
Given a query result from a SPARQL query, check if the given variable has a value or not @param resultRow the result from a SPARQL query @param variableName the name of the variable to obtain @return true if the variable has a value, false otherwise
[ "Given", "a", "query", "result", "from", "a", "SPARQL", "query", "check", "if", "the", "given", "variable", "has", "a", "value", "or", "not" ]
13e7016e64c1d5a539b838c6debf1a5cc4aefcb7
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/Util.java#L164-L171
147,715
kmi/iserve
iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/Util.java
Util.getIntegerValue
public static Integer getIntegerValue(QuerySolution resultRow, String variableName) { if (resultRow != null) { Resource res = resultRow.getResource(variableName); if (res != null && res.isLiteral()) { Literal val = res.asLiteral(); if (val != null) { return Integer.valueOf(val.getInt()); } } } return null; }
java
public static Integer getIntegerValue(QuerySolution resultRow, String variableName) { if (resultRow != null) { Resource res = resultRow.getResource(variableName); if (res != null && res.isLiteral()) { Literal val = res.asLiteral(); if (val != null) { return Integer.valueOf(val.getInt()); } } } return null; }
[ "public", "static", "Integer", "getIntegerValue", "(", "QuerySolution", "resultRow", ",", "String", "variableName", ")", "{", "if", "(", "resultRow", "!=", "null", ")", "{", "Resource", "res", "=", "resultRow", ".", "getResource", "(", "variableName", ")", ";", "if", "(", "res", "!=", "null", "&&", "res", ".", "isLiteral", "(", ")", ")", "{", "Literal", "val", "=", "res", ".", "asLiteral", "(", ")", ";", "if", "(", "val", "!=", "null", ")", "{", "return", "Integer", ".", "valueOf", "(", "val", ".", "getInt", "(", ")", ")", ";", "}", "}", "}", "return", "null", ";", "}" ]
Given a query result from a SPARQL query, obtain the number value at the given variable @param resultRow the result from a SPARQL query @param variableName the name of the variable to obtain @return the Integer value, or null otherwise
[ "Given", "a", "query", "result", "from", "a", "SPARQL", "query", "obtain", "the", "number", "value", "at", "the", "given", "variable" ]
13e7016e64c1d5a539b838c6debf1a5cc4aefcb7
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/Util.java#L181-L194
147,716
kmi/iserve
iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/Util.java
Util.generateLabelPattern
public static String generateLabelPattern(String var, String labelVar) { return new StringBuilder() .append("?").append(var).append(" ") .append(sparqlWrapUri(RDFS.label.getURI())).append(" ") .append("?").append(labelVar).append(". ") .toString(); }
java
public static String generateLabelPattern(String var, String labelVar) { return new StringBuilder() .append("?").append(var).append(" ") .append(sparqlWrapUri(RDFS.label.getURI())).append(" ") .append("?").append(labelVar).append(". ") .toString(); }
[ "public", "static", "String", "generateLabelPattern", "(", "String", "var", ",", "String", "labelVar", ")", "{", "return", "new", "StringBuilder", "(", ")", ".", "append", "(", "\"?\"", ")", ".", "append", "(", "var", ")", ".", "append", "(", "\" \"", ")", ".", "append", "(", "sparqlWrapUri", "(", "RDFS", ".", "label", ".", "getURI", "(", ")", ")", ")", ".", "append", "(", "\" \"", ")", ".", "append", "(", "\"?\"", ")", ".", "append", "(", "labelVar", ")", ".", "append", "(", "\". \"", ")", ".", "toString", "(", ")", ";", "}" ]
Generate a pattern for binding to a label @param var the name of the variable @param labelVar the name of the label varible @return
[ "Generate", "a", "pattern", "for", "binding", "to", "a", "label" ]
13e7016e64c1d5a539b838c6debf1a5cc4aefcb7
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/Util.java#L203-L209
147,717
kmi/iserve
iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/Util.java
Util.generateSubclassPattern
public static String generateSubclassPattern(URI origin, URI destination) { return new StringBuilder() .append(sparqlWrapUri(destination)).append(" ") .append(sparqlWrapUri(RDFS.subClassOf.getURI())).append("+ ") .append(sparqlWrapUri(origin)).append(" .") .toString(); }
java
public static String generateSubclassPattern(URI origin, URI destination) { return new StringBuilder() .append(sparqlWrapUri(destination)).append(" ") .append(sparqlWrapUri(RDFS.subClassOf.getURI())).append("+ ") .append(sparqlWrapUri(origin)).append(" .") .toString(); }
[ "public", "static", "String", "generateSubclassPattern", "(", "URI", "origin", ",", "URI", "destination", ")", "{", "return", "new", "StringBuilder", "(", ")", ".", "append", "(", "sparqlWrapUri", "(", "destination", ")", ")", ".", "append", "(", "\" \"", ")", ".", "append", "(", "sparqlWrapUri", "(", "RDFS", ".", "subClassOf", ".", "getURI", "(", ")", ")", ")", ".", "append", "(", "\"+ \"", ")", ".", "append", "(", "sparqlWrapUri", "(", "origin", ")", ")", ".", "append", "(", "\" .\"", ")", ".", "toString", "(", ")", ";", "}" ]
Generate a pattern for checking if destination is a subclass of origin @param origin @param destination @return
[ "Generate", "a", "pattern", "for", "checking", "if", "destination", "is", "a", "subclass", "of", "origin" ]
13e7016e64c1d5a539b838c6debf1a5cc4aefcb7
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/Util.java#L233-L239
147,718
kmi/iserve
iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/Util.java
Util.generateSuperclassPattern
public static String generateSuperclassPattern(URI origin, String matchVariable) { return new StringBuilder() .append(sparqlWrapUri(origin)).append(" ") .append(sparqlWrapUri(RDFS.subClassOf.getURI())).append("+ ") .append("?").append(matchVariable).append(" .") .toString(); }
java
public static String generateSuperclassPattern(URI origin, String matchVariable) { return new StringBuilder() .append(sparqlWrapUri(origin)).append(" ") .append(sparqlWrapUri(RDFS.subClassOf.getURI())).append("+ ") .append("?").append(matchVariable).append(" .") .toString(); }
[ "public", "static", "String", "generateSuperclassPattern", "(", "URI", "origin", ",", "String", "matchVariable", ")", "{", "return", "new", "StringBuilder", "(", ")", ".", "append", "(", "sparqlWrapUri", "(", "origin", ")", ")", ".", "append", "(", "\" \"", ")", ".", "append", "(", "sparqlWrapUri", "(", "RDFS", ".", "subClassOf", ".", "getURI", "(", ")", ")", ")", ".", "append", "(", "\"+ \"", ")", ".", "append", "(", "\"?\"", ")", ".", "append", "(", "matchVariable", ")", ".", "append", "(", "\" .\"", ")", ".", "toString", "(", ")", ";", "}" ]
Generate a pattern for matching var to the superclasses of clazz @param origin @param matchVariable @return
[ "Generate", "a", "pattern", "for", "matching", "var", "to", "the", "superclasses", "of", "clazz" ]
13e7016e64c1d5a539b838c6debf1a5cc4aefcb7
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/Util.java#L248-L254
147,719
kmi/iserve
iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/Util.java
Util.generateUnionStatement
public static String generateUnionStatement(List<String> patterns) { // Check the input and exit immediately if null if (patterns == null || patterns.isEmpty()) { return ""; } // This is a trivial UNION if (patterns.size() == 1) { return patterns.get(0); } // General case StringBuffer query = new StringBuffer(); // Add the first one as a special case and then loop over the rest query.append(" {" + NL); query.append(patterns.get(0)); query.append(" }" + NL); for (int i = 1; i < patterns.size(); i++) { query.append(" UNION {" + NL); query.append(patterns.get(i)); query.append(" }" + NL); } return query.toString(); }
java
public static String generateUnionStatement(List<String> patterns) { // Check the input and exit immediately if null if (patterns == null || patterns.isEmpty()) { return ""; } // This is a trivial UNION if (patterns.size() == 1) { return patterns.get(0); } // General case StringBuffer query = new StringBuffer(); // Add the first one as a special case and then loop over the rest query.append(" {" + NL); query.append(patterns.get(0)); query.append(" }" + NL); for (int i = 1; i < patterns.size(); i++) { query.append(" UNION {" + NL); query.append(patterns.get(i)); query.append(" }" + NL); } return query.toString(); }
[ "public", "static", "String", "generateUnionStatement", "(", "List", "<", "String", ">", "patterns", ")", "{", "// Check the input and exit immediately if null", "if", "(", "patterns", "==", "null", "||", "patterns", ".", "isEmpty", "(", ")", ")", "{", "return", "\"\"", ";", "}", "// This is a trivial UNION", "if", "(", "patterns", ".", "size", "(", ")", "==", "1", ")", "{", "return", "patterns", ".", "get", "(", "0", ")", ";", "}", "// General case", "StringBuffer", "query", "=", "new", "StringBuffer", "(", ")", ";", "// Add the first one as a special case and then loop over the rest", "query", ".", "append", "(", "\" {\"", "+", "NL", ")", ";", "query", ".", "append", "(", "patterns", ".", "get", "(", "0", ")", ")", ";", "query", ".", "append", "(", "\" }\"", "+", "NL", ")", ";", "for", "(", "int", "i", "=", "1", ";", "i", "<", "patterns", ".", "size", "(", ")", ";", "i", "++", ")", "{", "query", ".", "append", "(", "\" UNION {\"", "+", "NL", ")", ";", "query", ".", "append", "(", "patterns", ".", "get", "(", "i", ")", ")", ";", "query", ".", "append", "(", "\" }\"", "+", "NL", ")", ";", "}", "return", "query", ".", "toString", "(", ")", ";", "}" ]
Generates a UNION SPARQL statement for the patterns passed in the input @param patterns the patterns to make a UNION of @return the UNION SPARQL statement
[ "Generates", "a", "UNION", "SPARQL", "statement", "for", "the", "patterns", "passed", "in", "the", "input" ]
13e7016e64c1d5a539b838c6debf1a5cc4aefcb7
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/Util.java#L285-L310
147,720
kmi/iserve
iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/Util.java
Util.generateExactMatchPattern
public static String generateExactMatchPattern(URI origin, URI destination, String bindingVar, boolean includeUrisBound) { List<String> patterns = new ArrayList<String>(); // Exact match pattern StringBuffer query = new StringBuffer(); query.append(Util.generateSubclassPattern(origin, destination) + NL); query.append(Util.generateSuperclassPattern(origin, destination) + NL); patterns.add(query.toString()); // Find same term cases query = new StringBuffer(); query.append("FILTER (str("). append(sparqlWrapUri(origin)). append(") = str("). append(sparqlWrapUri(destination)). append(") ) . " + NL); patterns.add(query.toString()); StringBuffer result = new StringBuffer(generateUnionStatement(patterns)); // Bind a variable for inspection result.append("BIND (true as ?" + bindingVar + ") ." + NL); // Include origin and destination in the returned bindings if requested if (includeUrisBound) { result.append("BIND (").append(sparqlWrapUri(origin)).append(" as ?origin) .").append(NL); result.append("BIND (").append(sparqlWrapUri(destination)).append(" as ?destination) .").append(NL); } return result.toString(); }
java
public static String generateExactMatchPattern(URI origin, URI destination, String bindingVar, boolean includeUrisBound) { List<String> patterns = new ArrayList<String>(); // Exact match pattern StringBuffer query = new StringBuffer(); query.append(Util.generateSubclassPattern(origin, destination) + NL); query.append(Util.generateSuperclassPattern(origin, destination) + NL); patterns.add(query.toString()); // Find same term cases query = new StringBuffer(); query.append("FILTER (str("). append(sparqlWrapUri(origin)). append(") = str("). append(sparqlWrapUri(destination)). append(") ) . " + NL); patterns.add(query.toString()); StringBuffer result = new StringBuffer(generateUnionStatement(patterns)); // Bind a variable for inspection result.append("BIND (true as ?" + bindingVar + ") ." + NL); // Include origin and destination in the returned bindings if requested if (includeUrisBound) { result.append("BIND (").append(sparqlWrapUri(origin)).append(" as ?origin) .").append(NL); result.append("BIND (").append(sparqlWrapUri(destination)).append(" as ?destination) .").append(NL); } return result.toString(); }
[ "public", "static", "String", "generateExactMatchPattern", "(", "URI", "origin", ",", "URI", "destination", ",", "String", "bindingVar", ",", "boolean", "includeUrisBound", ")", "{", "List", "<", "String", ">", "patterns", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "// Exact match pattern", "StringBuffer", "query", "=", "new", "StringBuffer", "(", ")", ";", "query", ".", "append", "(", "Util", ".", "generateSubclassPattern", "(", "origin", ",", "destination", ")", "+", "NL", ")", ";", "query", ".", "append", "(", "Util", ".", "generateSuperclassPattern", "(", "origin", ",", "destination", ")", "+", "NL", ")", ";", "patterns", ".", "add", "(", "query", ".", "toString", "(", ")", ")", ";", "// Find same term cases", "query", "=", "new", "StringBuffer", "(", ")", ";", "query", ".", "append", "(", "\"FILTER (str(\"", ")", ".", "append", "(", "sparqlWrapUri", "(", "origin", ")", ")", ".", "append", "(", "\") = str(\"", ")", ".", "append", "(", "sparqlWrapUri", "(", "destination", ")", ")", ".", "append", "(", "\") ) . \"", "+", "NL", ")", ";", "patterns", ".", "add", "(", "query", ".", "toString", "(", ")", ")", ";", "StringBuffer", "result", "=", "new", "StringBuffer", "(", "generateUnionStatement", "(", "patterns", ")", ")", ";", "// Bind a variable for inspection", "result", ".", "append", "(", "\"BIND (true as ?\"", "+", "bindingVar", "+", "\") .\"", "+", "NL", ")", ";", "// Include origin and destination in the returned bindings if requested", "if", "(", "includeUrisBound", ")", "{", "result", ".", "append", "(", "\"BIND (\"", ")", ".", "append", "(", "sparqlWrapUri", "(", "origin", ")", ")", ".", "append", "(", "\" as ?origin) .\"", ")", ".", "append", "(", "NL", ")", ";", "result", ".", "append", "(", "\"BIND (\"", ")", ".", "append", "(", "sparqlWrapUri", "(", "destination", ")", ")", ".", "append", "(", "\" as ?destination) .\"", ")", ".", "append", "(", "NL", ")", ";", "}", "return", "result", ".", "toString", "(", ")", ";", "}" ]
Generate a pattern for check if two concepts have an exact match. Basically we look for either identical classes or equivalent ones Uses BIND which Requires SPARQL 1.1 @param origin the URL of the class we want to find exact matches for @param destination the URL of the class we are checking the match for @param bindingVar the name of the variable we will bind results to for ulterior inspection @param includeUrisBound @return the query pattern
[ "Generate", "a", "pattern", "for", "check", "if", "two", "concepts", "have", "an", "exact", "match", ".", "Basically", "we", "look", "for", "either", "identical", "classes", "or", "equivalent", "ones", "Uses", "BIND", "which", "Requires", "SPARQL", "1", ".", "1" ]
13e7016e64c1d5a539b838c6debf1a5cc4aefcb7
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/Util.java#L356-L388
147,721
kmi/iserve
iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/Util.java
Util.generateMatchStrictSubclassesPattern
public static String generateMatchStrictSubclassesPattern(URI origin, String matchVariable, String flagVar, boolean includeUrisBound) { StringBuffer query = new StringBuffer(); query.append(Util.generateSubclassPattern(origin, matchVariable) + NL); query.append("FILTER NOT EXISTS { ") .append(Util.generateSuperclassPattern(origin, matchVariable)) .append("}") .append(NL); // Bind a variable for inspection query.append("BIND (true as ?").append(flagVar).append(") .").append(NL); // Include origin and destination in the returned bindings if requested if (includeUrisBound) { query.append("BIND (").append(sparqlWrapUri(origin)).append(" as ?origin) .").append(NL); query.append("BIND (?").append(matchVariable).append(" as ?destination) .").append(NL); //FIXME } return query.toString(); }
java
public static String generateMatchStrictSubclassesPattern(URI origin, String matchVariable, String flagVar, boolean includeUrisBound) { StringBuffer query = new StringBuffer(); query.append(Util.generateSubclassPattern(origin, matchVariable) + NL); query.append("FILTER NOT EXISTS { ") .append(Util.generateSuperclassPattern(origin, matchVariable)) .append("}") .append(NL); // Bind a variable for inspection query.append("BIND (true as ?").append(flagVar).append(") .").append(NL); // Include origin and destination in the returned bindings if requested if (includeUrisBound) { query.append("BIND (").append(sparqlWrapUri(origin)).append(" as ?origin) .").append(NL); query.append("BIND (?").append(matchVariable).append(" as ?destination) .").append(NL); //FIXME } return query.toString(); }
[ "public", "static", "String", "generateMatchStrictSubclassesPattern", "(", "URI", "origin", ",", "String", "matchVariable", ",", "String", "flagVar", ",", "boolean", "includeUrisBound", ")", "{", "StringBuffer", "query", "=", "new", "StringBuffer", "(", ")", ";", "query", ".", "append", "(", "Util", ".", "generateSubclassPattern", "(", "origin", ",", "matchVariable", ")", "+", "NL", ")", ";", "query", ".", "append", "(", "\"FILTER NOT EXISTS { \"", ")", ".", "append", "(", "Util", ".", "generateSuperclassPattern", "(", "origin", ",", "matchVariable", ")", ")", ".", "append", "(", "\"}\"", ")", ".", "append", "(", "NL", ")", ";", "// Bind a variable for inspection", "query", ".", "append", "(", "\"BIND (true as ?\"", ")", ".", "append", "(", "flagVar", ")", ".", "append", "(", "\") .\"", ")", ".", "append", "(", "NL", ")", ";", "// Include origin and destination in the returned bindings if requested", "if", "(", "includeUrisBound", ")", "{", "query", ".", "append", "(", "\"BIND (\"", ")", ".", "append", "(", "sparqlWrapUri", "(", "origin", ")", ")", ".", "append", "(", "\" as ?origin) .\"", ")", ".", "append", "(", "NL", ")", ";", "query", ".", "append", "(", "\"BIND (?\"", ")", ".", "append", "(", "matchVariable", ")", ".", "append", "(", "\" as ?destination) .\"", ")", ".", "append", "(", "NL", ")", ";", "//FIXME", "}", "return", "query", ".", "toString", "(", ")", ";", "}" ]
Generate a pattern for obtaining the strict subclasses of a concept. Uses BIND which Requires SPARQL 1.1 @param origin the URL of the class we want to find subclasses for @param matchVariable the model reference variable @param flagVar the name of the variable we will bind results to for ulterior inspection @param includeUrisBound @return the query pattern
[ "Generate", "a", "pattern", "for", "obtaining", "the", "strict", "subclasses", "of", "a", "concept", ".", "Uses", "BIND", "which", "Requires", "SPARQL", "1", ".", "1" ]
13e7016e64c1d5a539b838c6debf1a5cc4aefcb7
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/Util.java#L401-L419
147,722
kmi/iserve
iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/Util.java
Util.generateMatchStrictSuperclassesPattern
public static String generateMatchStrictSuperclassesPattern(URI origin, String matchVariable, String bindingVar, boolean includeUrisBound) { StringBuffer query = new StringBuffer(); query.append(Util.generateSuperclassPattern(origin, matchVariable) + NL); query.append("FILTER NOT EXISTS { " + Util.generateSubclassPattern(origin, matchVariable) + "}" + NL); // Bind a variable for inspection query.append("BIND (true as ?" + bindingVar + ") ." + NL); // Include origin and destination in the returned bindings if requested if (includeUrisBound) { query.append("BIND (").append(sparqlWrapUri(origin)).append(" as ?origin) .").append(NL); query.append("BIND (?").append(matchVariable).append(" as ?destination) .").append(NL); // FIXME } return query.toString(); }
java
public static String generateMatchStrictSuperclassesPattern(URI origin, String matchVariable, String bindingVar, boolean includeUrisBound) { StringBuffer query = new StringBuffer(); query.append(Util.generateSuperclassPattern(origin, matchVariable) + NL); query.append("FILTER NOT EXISTS { " + Util.generateSubclassPattern(origin, matchVariable) + "}" + NL); // Bind a variable for inspection query.append("BIND (true as ?" + bindingVar + ") ." + NL); // Include origin and destination in the returned bindings if requested if (includeUrisBound) { query.append("BIND (").append(sparqlWrapUri(origin)).append(" as ?origin) .").append(NL); query.append("BIND (?").append(matchVariable).append(" as ?destination) .").append(NL); // FIXME } return query.toString(); }
[ "public", "static", "String", "generateMatchStrictSuperclassesPattern", "(", "URI", "origin", ",", "String", "matchVariable", ",", "String", "bindingVar", ",", "boolean", "includeUrisBound", ")", "{", "StringBuffer", "query", "=", "new", "StringBuffer", "(", ")", ";", "query", ".", "append", "(", "Util", ".", "generateSuperclassPattern", "(", "origin", ",", "matchVariable", ")", "+", "NL", ")", ";", "query", ".", "append", "(", "\"FILTER NOT EXISTS { \"", "+", "Util", ".", "generateSubclassPattern", "(", "origin", ",", "matchVariable", ")", "+", "\"}\"", "+", "NL", ")", ";", "// Bind a variable for inspection", "query", ".", "append", "(", "\"BIND (true as ?\"", "+", "bindingVar", "+", "\") .\"", "+", "NL", ")", ";", "// Include origin and destination in the returned bindings if requested", "if", "(", "includeUrisBound", ")", "{", "query", ".", "append", "(", "\"BIND (\"", ")", ".", "append", "(", "sparqlWrapUri", "(", "origin", ")", ")", ".", "append", "(", "\" as ?origin) .\"", ")", ".", "append", "(", "NL", ")", ";", "query", ".", "append", "(", "\"BIND (?\"", ")", ".", "append", "(", "matchVariable", ")", ".", "append", "(", "\" as ?destination) .\"", ")", ".", "append", "(", "NL", ")", ";", "// FIXME", "}", "return", "query", ".", "toString", "(", ")", ";", "}" ]
Generate a pattern for obtaining the strict superclasses of a concept. Uses BIND which Requires SPARQL 1.1 @param origin the URL of the class we want to find superclasses for @param matchVariable the model reference variable @param bindingVar the name of the variable we will bind results to for ulterior inspection @param includeUrisBound @return the query pattern
[ "Generate", "a", "pattern", "for", "obtaining", "the", "strict", "superclasses", "of", "a", "concept", ".", "Uses", "BIND", "which", "Requires", "SPARQL", "1", ".", "1" ]
13e7016e64c1d5a539b838c6debf1a5cc4aefcb7
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/Util.java#L461-L476
147,723
kmi/iserve
iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/Util.java
Util.getMatchType
public static DiscoMatchType getMatchType(boolean isSubsume, boolean isPlugin) { if (isSubsume) { if (isPlugin) { // If plugin and subsume -> this is an exact match return DiscoMatchType.Exact; } return DiscoMatchType.Subsume; } else { if (isPlugin) { return DiscoMatchType.Plugin; } } return DiscoMatchType.Fail; }
java
public static DiscoMatchType getMatchType(boolean isSubsume, boolean isPlugin) { if (isSubsume) { if (isPlugin) { // If plugin and subsume -> this is an exact match return DiscoMatchType.Exact; } return DiscoMatchType.Subsume; } else { if (isPlugin) { return DiscoMatchType.Plugin; } } return DiscoMatchType.Fail; }
[ "public", "static", "DiscoMatchType", "getMatchType", "(", "boolean", "isSubsume", ",", "boolean", "isPlugin", ")", "{", "if", "(", "isSubsume", ")", "{", "if", "(", "isPlugin", ")", "{", "// If plugin and subsume -> this is an exact match", "return", "DiscoMatchType", ".", "Exact", ";", "}", "return", "DiscoMatchType", ".", "Subsume", ";", "}", "else", "{", "if", "(", "isPlugin", ")", "{", "return", "DiscoMatchType", ".", "Plugin", ";", "}", "}", "return", "DiscoMatchType", ".", "Fail", ";", "}" ]
Given the match between concepts obtain the match type @param isSubsume true if the concept match is subsumes @param isPlugin true if the concept match is plugin @return Exact, Plugin or Subsumes depending on the values
[ "Given", "the", "match", "between", "concepts", "obtain", "the", "match", "type" ]
13e7016e64c1d5a539b838c6debf1a5cc4aefcb7
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/Util.java#L513-L526
147,724
kmi/iserve
iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/Util.java
Util.calculateCompositeMatchType
public static DiscoMatchType calculateCompositeMatchType(MatchType bestMatch, MatchType worstMatch) { if (bestMatch instanceof LogicConceptMatchType && worstMatch instanceof LogicConceptMatchType) { return calculateCompositeMatchType((LogicConceptMatchType) bestMatch, (LogicConceptMatchType) worstMatch); } return DiscoMatchType.Fail; }
java
public static DiscoMatchType calculateCompositeMatchType(MatchType bestMatch, MatchType worstMatch) { if (bestMatch instanceof LogicConceptMatchType && worstMatch instanceof LogicConceptMatchType) { return calculateCompositeMatchType((LogicConceptMatchType) bestMatch, (LogicConceptMatchType) worstMatch); } return DiscoMatchType.Fail; }
[ "public", "static", "DiscoMatchType", "calculateCompositeMatchType", "(", "MatchType", "bestMatch", ",", "MatchType", "worstMatch", ")", "{", "if", "(", "bestMatch", "instanceof", "LogicConceptMatchType", "&&", "worstMatch", "instanceof", "LogicConceptMatchType", ")", "{", "return", "calculateCompositeMatchType", "(", "(", "LogicConceptMatchType", ")", "bestMatch", ",", "(", "LogicConceptMatchType", ")", "worstMatch", ")", ";", "}", "return", "DiscoMatchType", ".", "Fail", ";", "}" ]
Given the best and worst match figure out the match type for the composite. The composite match type is determined by the worst case except when it is a FAIL. In this case, if the best is EXACT or PLUGIN the composite match will be PARTIAL_PLUGIN. If the best is SUBSUMES it is PARTIAL_SUBSUMES. @param bestMatch best match type within the composite match @param worstMatch worst match type within the composite match @return match type for the composite match
[ "Given", "the", "best", "and", "worst", "match", "figure", "out", "the", "match", "type", "for", "the", "composite", ".", "The", "composite", "match", "type", "is", "determined", "by", "the", "worst", "case", "except", "when", "it", "is", "a", "FAIL", ".", "In", "this", "case", "if", "the", "best", "is", "EXACT", "or", "PLUGIN", "the", "composite", "match", "will", "be", "PARTIAL_PLUGIN", ".", "If", "the", "best", "is", "SUBSUMES", "it", "is", "PARTIAL_SUBSUMES", "." ]
13e7016e64c1d5a539b838c6debf1a5cc4aefcb7
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/Util.java#L538-L545
147,725
kmi/iserve
iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/Util.java
Util.getMatchUrl
public static URL getMatchUrl(QuerySolution row, boolean operationDiscovery) { // Check the input and return immediately if null if (row == null) { return null; } URL matchUrl; if (operationDiscovery) { matchUrl = Util.getOperationUrl(row); } else { matchUrl = Util.getServiceUrl(row); } return matchUrl; }
java
public static URL getMatchUrl(QuerySolution row, boolean operationDiscovery) { // Check the input and return immediately if null if (row == null) { return null; } URL matchUrl; if (operationDiscovery) { matchUrl = Util.getOperationUrl(row); } else { matchUrl = Util.getServiceUrl(row); } return matchUrl; }
[ "public", "static", "URL", "getMatchUrl", "(", "QuerySolution", "row", ",", "boolean", "operationDiscovery", ")", "{", "// Check the input and return immediately if null", "if", "(", "row", "==", "null", ")", "{", "return", "null", ";", "}", "URL", "matchUrl", ";", "if", "(", "operationDiscovery", ")", "{", "matchUrl", "=", "Util", ".", "getOperationUrl", "(", "row", ")", ";", "}", "else", "{", "matchUrl", "=", "Util", ".", "getServiceUrl", "(", "row", ")", ";", "}", "return", "matchUrl", ";", "}" ]
Obtain the match url given the query row and the kind of discovery we are carrying out @param row the result from a SPARQL query @param operationDiscovery true if we are doing operation discovery @return the URL for the match result
[ "Obtain", "the", "match", "url", "given", "the", "query", "row", "and", "the", "kind", "of", "discovery", "we", "are", "carrying", "out" ]
13e7016e64c1d5a539b838c6debf1a5cc4aefcb7
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/Util.java#L592-L607
147,726
kmi/iserve
iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/Util.java
Util.getOrGenerateMatchLabel
public static String getOrGenerateMatchLabel(QuerySolution row, boolean operationDiscovery) { String label; if (operationDiscovery) { label = getOrGenerateOperationLabel(row); } else { label = getOrGenerateServiceLabel(row); } return label; }
java
public static String getOrGenerateMatchLabel(QuerySolution row, boolean operationDiscovery) { String label; if (operationDiscovery) { label = getOrGenerateOperationLabel(row); } else { label = getOrGenerateServiceLabel(row); } return label; }
[ "public", "static", "String", "getOrGenerateMatchLabel", "(", "QuerySolution", "row", ",", "boolean", "operationDiscovery", ")", "{", "String", "label", ";", "if", "(", "operationDiscovery", ")", "{", "label", "=", "getOrGenerateOperationLabel", "(", "row", ")", ";", "}", "else", "{", "label", "=", "getOrGenerateServiceLabel", "(", "row", ")", ";", "}", "return", "label", ";", "}" ]
Obtain or generate a label for the match result given a row resulting from a query. @param row the result from a SPARQL query @param operationDiscovery true if we are doing operation discovery @return
[ "Obtain", "or", "generate", "a", "label", "for", "the", "match", "result", "given", "a", "row", "resulting", "from", "a", "query", "." ]
13e7016e64c1d5a539b838c6debf1a5cc4aefcb7
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/Util.java#L639-L647
147,727
kmi/iserve
iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/Util.java
Util.getOrGenerateOperationLabel
private static String getOrGenerateOperationLabel(QuerySolution row) { String result; String svcLabel = getOrGenerateServiceLabel(row); String opLabel = getOperationLabel(row); if (opLabel == null) { URL opUrl = getOperationUrl(row); result = URIUtil.generateItemLabel(svcLabel, opUrl); } else { result = svcLabel + "." + opLabel; } return result; }
java
private static String getOrGenerateOperationLabel(QuerySolution row) { String result; String svcLabel = getOrGenerateServiceLabel(row); String opLabel = getOperationLabel(row); if (opLabel == null) { URL opUrl = getOperationUrl(row); result = URIUtil.generateItemLabel(svcLabel, opUrl); } else { result = svcLabel + "." + opLabel; } return result; }
[ "private", "static", "String", "getOrGenerateOperationLabel", "(", "QuerySolution", "row", ")", "{", "String", "result", ";", "String", "svcLabel", "=", "getOrGenerateServiceLabel", "(", "row", ")", ";", "String", "opLabel", "=", "getOperationLabel", "(", "row", ")", ";", "if", "(", "opLabel", "==", "null", ")", "{", "URL", "opUrl", "=", "getOperationUrl", "(", "row", ")", ";", "result", "=", "URIUtil", ".", "generateItemLabel", "(", "svcLabel", ",", "opUrl", ")", ";", "}", "else", "{", "result", "=", "svcLabel", "+", "\".\"", "+", "opLabel", ";", "}", "return", "result", ";", "}" ]
Obtain or generate a label for an operation. TODO: Deal better with WSDL naming convention @param row the result from a SPARQL query @return
[ "Obtain", "or", "generate", "a", "label", "for", "an", "operation", "." ]
13e7016e64c1d5a539b838c6debf1a5cc4aefcb7
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/Util.java#L674-L685
147,728
kmi/iserve
iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/Util.java
Util.showMapDetails
private static void showMapDetails(Map<URL, MatchResult> map) { for (Entry<URL, MatchResult> entry : map.entrySet()) { log.info("Match " + entry.getKey().toString() + NL); } }
java
private static void showMapDetails(Map<URL, MatchResult> map) { for (Entry<URL, MatchResult> entry : map.entrySet()) { log.info("Match " + entry.getKey().toString() + NL); } }
[ "private", "static", "void", "showMapDetails", "(", "Map", "<", "URL", ",", "MatchResult", ">", "map", ")", "{", "for", "(", "Entry", "<", "URL", ",", "MatchResult", ">", "entry", ":", "map", ".", "entrySet", "(", ")", ")", "{", "log", ".", "info", "(", "\"Match \"", "+", "entry", ".", "getKey", "(", ")", ".", "toString", "(", ")", "+", "NL", ")", ";", "}", "}" ]
Expose the data within the map @param map
[ "Expose", "the", "data", "within", "the", "map" ]
13e7016e64c1d5a539b838c6debf1a5cc4aefcb7
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-semantic-discovery/src/main/java/uk/ac/open/kmi/iserve/discovery/disco/Util.java#L733-L737
147,729
udoprog/ffwd-client-java
src/main/java/com/google/protobuf250/CodedInputStream.java
CodedInputStream.newInstance
public static CodedInputStream newInstance(final byte[] buf, final int off, final int len) { CodedInputStream result = new CodedInputStream(buf, off, len); try { // Some uses of CodedInputStream can be more efficient if they know // exactly how many bytes are available. By pushing the end point of the // buffer as a limit, we allow them to get this information via // getBytesUntilLimit(). Pushing a limit that we know is at the end of // the stream can never hurt, since we can never past that point anyway. result.pushLimit(len); } catch (InvalidProtocolBufferException ex) { // The only reason pushLimit() might throw an exception here is if len // is negative. Normally pushLimit()'s parameter comes directly off the // wire, so it's important to catch exceptions in case of corrupt or // malicious data. However, in this case, we expect that len is not a // user-supplied value, so we can assume that it being negative indicates // a programming error. Therefore, throwing an unchecked exception is // appropriate. throw new IllegalArgumentException(ex); } return result; }
java
public static CodedInputStream newInstance(final byte[] buf, final int off, final int len) { CodedInputStream result = new CodedInputStream(buf, off, len); try { // Some uses of CodedInputStream can be more efficient if they know // exactly how many bytes are available. By pushing the end point of the // buffer as a limit, we allow them to get this information via // getBytesUntilLimit(). Pushing a limit that we know is at the end of // the stream can never hurt, since we can never past that point anyway. result.pushLimit(len); } catch (InvalidProtocolBufferException ex) { // The only reason pushLimit() might throw an exception here is if len // is negative. Normally pushLimit()'s parameter comes directly off the // wire, so it's important to catch exceptions in case of corrupt or // malicious data. However, in this case, we expect that len is not a // user-supplied value, so we can assume that it being negative indicates // a programming error. Therefore, throwing an unchecked exception is // appropriate. throw new IllegalArgumentException(ex); } return result; }
[ "public", "static", "CodedInputStream", "newInstance", "(", "final", "byte", "[", "]", "buf", ",", "final", "int", "off", ",", "final", "int", "len", ")", "{", "CodedInputStream", "result", "=", "new", "CodedInputStream", "(", "buf", ",", "off", ",", "len", ")", ";", "try", "{", "// Some uses of CodedInputStream can be more efficient if they know", "// exactly how many bytes are available. By pushing the end point of the", "// buffer as a limit, we allow them to get this information via", "// getBytesUntilLimit(). Pushing a limit that we know is at the end of", "// the stream can never hurt, since we can never past that point anyway.", "result", ".", "pushLimit", "(", "len", ")", ";", "}", "catch", "(", "InvalidProtocolBufferException", "ex", ")", "{", "// The only reason pushLimit() might throw an exception here is if len", "// is negative. Normally pushLimit()'s parameter comes directly off the", "// wire, so it's important to catch exceptions in case of corrupt or", "// malicious data. However, in this case, we expect that len is not a", "// user-supplied value, so we can assume that it being negative indicates", "// a programming error. Therefore, throwing an unchecked exception is", "// appropriate.", "throw", "new", "IllegalArgumentException", "(", "ex", ")", ";", "}", "return", "result", ";", "}" ]
Create a new CodedInputStream wrapping the given byte array slice.
[ "Create", "a", "new", "CodedInputStream", "wrapping", "the", "given", "byte", "array", "slice", "." ]
b4161d2b138e3edb8fa9420cc3cc653d5764cf5b
https://github.com/udoprog/ffwd-client-java/blob/b4161d2b138e3edb8fa9420cc3cc653d5764cf5b/src/main/java/com/google/protobuf250/CodedInputStream.java#L68-L89
147,730
netceteragroup/trema-core
src/main/java/com/netcetera/trema/core/exporting/AndroidExportFilter.java
AndroidExportFilter.escapeXmlSpecialCharacters
protected static String escapeXmlSpecialCharacters(String aText) { String result = aText; result = result.replaceAll("&", "&amp;"); result = result.replaceAll("\'", "\\\\&#039;"); result = result.replaceAll("'", "\\\\&#039;"); return result; }
java
protected static String escapeXmlSpecialCharacters(String aText) { String result = aText; result = result.replaceAll("&", "&amp;"); result = result.replaceAll("\'", "\\\\&#039;"); result = result.replaceAll("'", "\\\\&#039;"); return result; }
[ "protected", "static", "String", "escapeXmlSpecialCharacters", "(", "String", "aText", ")", "{", "String", "result", "=", "aText", ";", "result", "=", "result", ".", "replaceAll", "(", "\"&\"", ",", "\"&amp;\"", ")", ";", "result", "=", "result", ".", "replaceAll", "(", "\"\\'\"", ",", "\"\\\\\\\\&#039;\"", ")", ";", "result", "=", "result", ".", "replaceAll", "(", "\"'\"", ",", "\"\\\\\\\\&#039;\"", ")", ";", "return", "result", ";", "}" ]
Android specific escaping of characters. Note that since this is no real XML escaping, the output string.xml file is potentially not valid XML. However this is explicitly allowed by Android. <P> The following characters are replaced with corresponding character entities : <table border='1' cellpadding='3' cellspacing='0' summary="' is replaced with char 39, amp is replaced with entity amp"> <tr> <th>Character</th> <th>Encoding</th> </tr> <tr> <td>'</td> <td>\\&amp;#039;</td> </tr> <tr> <td>\'</td> <td>\\&amp;#039;</td> </tr> <tr> <td>&amp;</td> <td>&amp;amp;</td> </tr> </table> @param aText text to escape, must not be null @return escaped text
[ "Android", "specific", "escaping", "of", "characters", ".", "Note", "that", "since", "this", "is", "no", "real", "XML", "escaping", "the", "output", "string", ".", "xml", "file", "is", "potentially", "not", "valid", "XML", ".", "However", "this", "is", "explicitly", "allowed", "by", "Android", "." ]
e5367f4b80b38038d462627aa146a62bc34fc489
https://github.com/netceteragroup/trema-core/blob/e5367f4b80b38038d462627aa146a62bc34fc489/src/main/java/com/netcetera/trema/core/exporting/AndroidExportFilter.java#L51-L57
147,731
netceteragroup/trema-core
src/main/java/com/netcetera/trema/core/exporting/AbstractSpreadSheetExporter.java
AbstractSpreadSheetExporter.getRow
protected String[] getRow(String masterLanguage, ITextNode textNode, IValueNode valueNode) { List<String> row = new ArrayList<>(); row.add(textNode.getKey()); row.add(valueNode.getStatus().getName()); if (!valueNode.getLanguage().equals(masterLanguage)) { IValueNode masterValueNode = textNode.getValueNode(masterLanguage); if (masterValueNode == null) { row.add(""); } else { row.add(masterValueNode.getValue()); } } row.add(valueNode.getValue()); row.add(textNode.getContext()); return row.toArray(new String[row.size()]); }
java
protected String[] getRow(String masterLanguage, ITextNode textNode, IValueNode valueNode) { List<String> row = new ArrayList<>(); row.add(textNode.getKey()); row.add(valueNode.getStatus().getName()); if (!valueNode.getLanguage().equals(masterLanguage)) { IValueNode masterValueNode = textNode.getValueNode(masterLanguage); if (masterValueNode == null) { row.add(""); } else { row.add(masterValueNode.getValue()); } } row.add(valueNode.getValue()); row.add(textNode.getContext()); return row.toArray(new String[row.size()]); }
[ "protected", "String", "[", "]", "getRow", "(", "String", "masterLanguage", ",", "ITextNode", "textNode", ",", "IValueNode", "valueNode", ")", "{", "List", "<", "String", ">", "row", "=", "new", "ArrayList", "<>", "(", ")", ";", "row", ".", "add", "(", "textNode", ".", "getKey", "(", ")", ")", ";", "row", ".", "add", "(", "valueNode", ".", "getStatus", "(", ")", ".", "getName", "(", ")", ")", ";", "if", "(", "!", "valueNode", ".", "getLanguage", "(", ")", ".", "equals", "(", "masterLanguage", ")", ")", "{", "IValueNode", "masterValueNode", "=", "textNode", ".", "getValueNode", "(", "masterLanguage", ")", ";", "if", "(", "masterValueNode", "==", "null", ")", "{", "row", ".", "add", "(", "\"\"", ")", ";", "}", "else", "{", "row", ".", "add", "(", "masterValueNode", ".", "getValue", "(", ")", ")", ";", "}", "}", "row", ".", "add", "(", "valueNode", ".", "getValue", "(", ")", ")", ";", "row", ".", "add", "(", "textNode", ".", "getContext", "(", ")", ")", ";", "return", "row", ".", "toArray", "(", "new", "String", "[", "row", ".", "size", "(", ")", "]", ")", ";", "}" ]
Constructs a row for a Trema CSV export file. @param masterLanguage the masterLanguage @param textNode the parent text node @param valueNode the value node to export @return the row.
[ "Constructs", "a", "row", "for", "a", "Trema", "CSV", "export", "file", "." ]
e5367f4b80b38038d462627aa146a62bc34fc489
https://github.com/netceteragroup/trema-core/blob/e5367f4b80b38038d462627aa146a62bc34fc489/src/main/java/com/netcetera/trema/core/exporting/AbstractSpreadSheetExporter.java#L50-L67
147,732
netceteragroup/trema-core
src/main/java/com/netcetera/trema/core/exporting/AbstractSpreadSheetExporter.java
AbstractSpreadSheetExporter.getValues
protected String[][] getValues(ITextNode[] textNodes, String masterLanguage, String language, Status[] status) { int numberOfColumns = (masterLanguage.equals(language)) ? 4 : 5; List<String[]> rows = new ArrayList<>(); // add the header row rows.add(getHeaderRow(masterLanguage, new String[]{language})); for (ITextNode textNode : textNodes) { IValueNode valueNode = textNode.getValueNode(language); if (valueNode != null) { if (status == null || TremaCoreUtil.containsStatus(valueNode.getStatus(), status)) { rows.add(getRow(masterLanguage, textNode, valueNode)); // add the row } } } return rows.toArray(new String[rows.size()][numberOfColumns]); }
java
protected String[][] getValues(ITextNode[] textNodes, String masterLanguage, String language, Status[] status) { int numberOfColumns = (masterLanguage.equals(language)) ? 4 : 5; List<String[]> rows = new ArrayList<>(); // add the header row rows.add(getHeaderRow(masterLanguage, new String[]{language})); for (ITextNode textNode : textNodes) { IValueNode valueNode = textNode.getValueNode(language); if (valueNode != null) { if (status == null || TremaCoreUtil.containsStatus(valueNode.getStatus(), status)) { rows.add(getRow(masterLanguage, textNode, valueNode)); // add the row } } } return rows.toArray(new String[rows.size()][numberOfColumns]); }
[ "protected", "String", "[", "]", "[", "]", "getValues", "(", "ITextNode", "[", "]", "textNodes", ",", "String", "masterLanguage", ",", "String", "language", ",", "Status", "[", "]", "status", ")", "{", "int", "numberOfColumns", "=", "(", "masterLanguage", ".", "equals", "(", "language", ")", ")", "?", "4", ":", "5", ";", "List", "<", "String", "[", "]", ">", "rows", "=", "new", "ArrayList", "<>", "(", ")", ";", "// add the header row", "rows", ".", "add", "(", "getHeaderRow", "(", "masterLanguage", ",", "new", "String", "[", "]", "{", "language", "}", ")", ")", ";", "for", "(", "ITextNode", "textNode", ":", "textNodes", ")", "{", "IValueNode", "valueNode", "=", "textNode", ".", "getValueNode", "(", "language", ")", ";", "if", "(", "valueNode", "!=", "null", ")", "{", "if", "(", "status", "==", "null", "||", "TremaCoreUtil", ".", "containsStatus", "(", "valueNode", ".", "getStatus", "(", ")", ",", "status", ")", ")", "{", "rows", ".", "add", "(", "getRow", "(", "masterLanguage", ",", "textNode", ",", "valueNode", ")", ")", ";", "// add the row", "}", "}", "}", "return", "rows", ".", "toArray", "(", "new", "String", "[", "rows", ".", "size", "(", ")", "]", "[", "numberOfColumns", "]", ")", ";", "}" ]
Gets a 2 dimensional string array representation of the CSV export data ready to be written to a CSV file. @param textNodes the nodes to get the values for @param masterLanguage the masterLanguage @param language the language @param status the states to get the values for. If <code>null</code>, all status will be exported @return the CSV export values.
[ "Gets", "a", "2", "dimensional", "string", "array", "representation", "of", "the", "CSV", "export", "data", "ready", "to", "be", "written", "to", "a", "CSV", "file", "." ]
e5367f4b80b38038d462627aa146a62bc34fc489
https://github.com/netceteragroup/trema-core/blob/e5367f4b80b38038d462627aa146a62bc34fc489/src/main/java/com/netcetera/trema/core/exporting/AbstractSpreadSheetExporter.java#L80-L97
147,733
eurekaclinical/aiw-i2b2-etl
src/main/java/edu/emory/cci/aiw/i2b2etl/dest/metadata/ProviderConceptTreeBuilder.java
ProviderConceptTreeBuilder.build
@Override public void build(Concept parent) throws OntologyBuildException { if (!this.skipProviderHierarchy) { try { root = this.metadata.getOrCreateHardCodedFolder("Provider"); root.setFactTableColumn("provider_id"); root.setTableName("provider_dimension"); root.setColumnName("provider_path"); if (parent != null) { root.setAlreadyLoaded(parent.isAlreadyLoaded()); parent.add(root); } alpha = createAlphaCategoryConcepts(); } catch (InvalidConceptCodeException ex) { throw new OntologyBuildException("Could not build provider concept tree", ex); } } }
java
@Override public void build(Concept parent) throws OntologyBuildException { if (!this.skipProviderHierarchy) { try { root = this.metadata.getOrCreateHardCodedFolder("Provider"); root.setFactTableColumn("provider_id"); root.setTableName("provider_dimension"); root.setColumnName("provider_path"); if (parent != null) { root.setAlreadyLoaded(parent.isAlreadyLoaded()); parent.add(root); } alpha = createAlphaCategoryConcepts(); } catch (InvalidConceptCodeException ex) { throw new OntologyBuildException("Could not build provider concept tree", ex); } } }
[ "@", "Override", "public", "void", "build", "(", "Concept", "parent", ")", "throws", "OntologyBuildException", "{", "if", "(", "!", "this", ".", "skipProviderHierarchy", ")", "{", "try", "{", "root", "=", "this", ".", "metadata", ".", "getOrCreateHardCodedFolder", "(", "\"Provider\"", ")", ";", "root", ".", "setFactTableColumn", "(", "\"provider_id\"", ")", ";", "root", ".", "setTableName", "(", "\"provider_dimension\"", ")", ";", "root", ".", "setColumnName", "(", "\"provider_path\"", ")", ";", "if", "(", "parent", "!=", "null", ")", "{", "root", ".", "setAlreadyLoaded", "(", "parent", ".", "isAlreadyLoaded", "(", ")", ")", ";", "parent", ".", "add", "(", "root", ")", ";", "}", "alpha", "=", "createAlphaCategoryConcepts", "(", ")", ";", "}", "catch", "(", "InvalidConceptCodeException", "ex", ")", "{", "throw", "new", "OntologyBuildException", "(", "\"Could not build provider concept tree\"", ",", "ex", ")", ";", "}", "}", "}" ]
Create a hierarchy of providers organized by first letter of their full name. @return the root of the hierarchy. @throws OntologyBuildException if an error occurs building the hierarchy.
[ "Create", "a", "hierarchy", "of", "providers", "organized", "by", "first", "letter", "of", "their", "full", "name", "." ]
3eed6bda7755919cb9466d2930723a0f4748341a
https://github.com/eurekaclinical/aiw-i2b2-etl/blob/3eed6bda7755919cb9466d2930723a0f4748341a/src/main/java/edu/emory/cci/aiw/i2b2etl/dest/metadata/ProviderConceptTreeBuilder.java#L51-L68
147,734
ZenHarbinger/l2fprod-properties-editor
src/main/java/com/l2fprod/common/propertysheet/PropertyEditorRegistry.java
PropertyEditorRegistry.loadPropertyEditor
private PropertyEditor loadPropertyEditor(Class<?> clz) { PropertyEditor editor = null; try { editor = (PropertyEditor) clz.newInstance(); } catch (InstantiationException e) { Logger.getLogger(PropertyEditorRegistry.class.getName()).log(Level.SEVERE, null, e); } catch (IllegalAccessException e) { Logger.getLogger(PropertyEditorRegistry.class.getName()).log(Level.SEVERE, null, e); } return editor; }
java
private PropertyEditor loadPropertyEditor(Class<?> clz) { PropertyEditor editor = null; try { editor = (PropertyEditor) clz.newInstance(); } catch (InstantiationException e) { Logger.getLogger(PropertyEditorRegistry.class.getName()).log(Level.SEVERE, null, e); } catch (IllegalAccessException e) { Logger.getLogger(PropertyEditorRegistry.class.getName()).log(Level.SEVERE, null, e); } return editor; }
[ "private", "PropertyEditor", "loadPropertyEditor", "(", "Class", "<", "?", ">", "clz", ")", "{", "PropertyEditor", "editor", "=", "null", ";", "try", "{", "editor", "=", "(", "PropertyEditor", ")", "clz", ".", "newInstance", "(", ")", ";", "}", "catch", "(", "InstantiationException", "e", ")", "{", "Logger", ".", "getLogger", "(", "PropertyEditorRegistry", ".", "class", ".", "getName", "(", ")", ")", ".", "log", "(", "Level", ".", "SEVERE", ",", "null", ",", "e", ")", ";", "}", "catch", "(", "IllegalAccessException", "e", ")", "{", "Logger", ".", "getLogger", "(", "PropertyEditorRegistry", ".", "class", ".", "getName", "(", ")", ")", ".", "log", "(", "Level", ".", "SEVERE", ",", "null", ",", "e", ")", ";", "}", "return", "editor", ";", "}" ]
Load PropertyEditor from clz through reflection. @param clz Class to load from. @return Loaded propertyEditor
[ "Load", "PropertyEditor", "from", "clz", "through", "reflection", "." ]
d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32
https://github.com/ZenHarbinger/l2fprod-properties-editor/blob/d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32/src/main/java/com/l2fprod/common/propertysheet/PropertyEditorRegistry.java#L155-L165
147,735
wkgcass/Style
src/main/java/net/cassite/style/aggregation/IteratorInfo.java
IteratorInfo.setValues
IteratorInfo<R> setValues(int previousIndex, int nextIndex, boolean hasPrevious, boolean hasNext, int currentIndex, int effectiveIndex, R res) { this.previousIndex = previousIndex; this.nextIndex = nextIndex; this.hasPrevious = hasPrevious; this.hasNext = hasNext; return (IteratorInfo<R>) setValues(currentIndex, effectiveIndex, res); }
java
IteratorInfo<R> setValues(int previousIndex, int nextIndex, boolean hasPrevious, boolean hasNext, int currentIndex, int effectiveIndex, R res) { this.previousIndex = previousIndex; this.nextIndex = nextIndex; this.hasPrevious = hasPrevious; this.hasNext = hasNext; return (IteratorInfo<R>) setValues(currentIndex, effectiveIndex, res); }
[ "IteratorInfo", "<", "R", ">", "setValues", "(", "int", "previousIndex", ",", "int", "nextIndex", ",", "boolean", "hasPrevious", ",", "boolean", "hasNext", ",", "int", "currentIndex", ",", "int", "effectiveIndex", ",", "R", "res", ")", "{", "this", ".", "previousIndex", "=", "previousIndex", ";", "this", ".", "nextIndex", "=", "nextIndex", ";", "this", ".", "hasPrevious", "=", "hasPrevious", ";", "this", ".", "hasNext", "=", "hasNext", ";", "return", "(", "IteratorInfo", "<", "R", ">", ")", "setValues", "(", "currentIndex", ",", "effectiveIndex", ",", "res", ")", ";", "}" ]
set all fields of the Iterator Info @param previousIndex previous index @param nextIndex next index @param hasPrevious has previous @param hasNext has next @param currentIndex current index @param effectiveIndex effective index the times 'last loop value' has been modified @param res last loop result @return <code>this</code>
[ "set", "all", "fields", "of", "the", "Iterator", "Info" ]
db3ea64337251f46f734279480e365293bececbd
https://github.com/wkgcass/Style/blob/db3ea64337251f46f734279480e365293bececbd/src/main/java/net/cassite/style/aggregation/IteratorInfo.java#L48-L55
147,736
innoq/LiQID
ldap-connector/src/main/java/com/innoq/ldap/connector/LdapHelper.java
LdapHelper.getInstance
public static LdapHelper getInstance(String instance) { if (!helpers.containsKey(instance)) { helpers.put(instance, new LdapHelper(instance)); } LdapHelper helper = helpers.get(instance); if (!helper.online) { helper.loadProperties(); } return helper; }
java
public static LdapHelper getInstance(String instance) { if (!helpers.containsKey(instance)) { helpers.put(instance, new LdapHelper(instance)); } LdapHelper helper = helpers.get(instance); if (!helper.online) { helper.loadProperties(); } return helper; }
[ "public", "static", "LdapHelper", "getInstance", "(", "String", "instance", ")", "{", "if", "(", "!", "helpers", ".", "containsKey", "(", "instance", ")", ")", "{", "helpers", ".", "put", "(", "instance", ",", "new", "LdapHelper", "(", "instance", ")", ")", ";", "}", "LdapHelper", "helper", "=", "helpers", ".", "get", "(", "instance", ")", ";", "if", "(", "!", "helper", ".", "online", ")", "{", "helper", ".", "loadProperties", "(", ")", ";", "}", "return", "helper", ";", "}" ]
Returns a new Instance of LdapHelper. @param instance the identifyer of the LDAP Instance (e.g. ldap1) @return a new Instance.
[ "Returns", "a", "new", "Instance", "of", "LdapHelper", "." ]
ae3de2c1fd78c40219780d510eba57c931901279
https://github.com/innoq/LiQID/blob/ae3de2c1fd78c40219780d510eba57c931901279/ldap-connector/src/main/java/com/innoq/ldap/connector/LdapHelper.java#L110-L119
147,737
innoq/LiQID
ldap-connector/src/main/java/com/innoq/ldap/connector/LdapHelper.java
LdapHelper.setUserAsUser
@Override public boolean setUserAsUser(Node node, String uid, String password) throws Exception { boolean status = false; StringBuilder sb = new StringBuilder(userIdentifyer + "=").append(uid).append(","); sb.append(Configuration.getProperty(instanceName + LdapKeys.ATTR_OU_PEOPLE)).append(","); sb.append(baseDn); if (uid == null || uid.isEmpty() || password == null || password.isEmpty()) { return false; } try { Hashtable<String, String> environment = (Hashtable<String, String>) ctx.getEnvironment().clone(); environment.put(Context.SECURITY_PRINCIPAL, sb.toString()); environment.put(Context.SECURITY_CREDENTIALS, password); DirContext dirContext = new InitialDirContext(environment); status = setUserInContext(dirContext, node); dirContext.close(); } catch (NamingException ex) { handleNamingException("NamingException " + ex.getLocalizedMessage(), ex); } return status; }
java
@Override public boolean setUserAsUser(Node node, String uid, String password) throws Exception { boolean status = false; StringBuilder sb = new StringBuilder(userIdentifyer + "=").append(uid).append(","); sb.append(Configuration.getProperty(instanceName + LdapKeys.ATTR_OU_PEOPLE)).append(","); sb.append(baseDn); if (uid == null || uid.isEmpty() || password == null || password.isEmpty()) { return false; } try { Hashtable<String, String> environment = (Hashtable<String, String>) ctx.getEnvironment().clone(); environment.put(Context.SECURITY_PRINCIPAL, sb.toString()); environment.put(Context.SECURITY_CREDENTIALS, password); DirContext dirContext = new InitialDirContext(environment); status = setUserInContext(dirContext, node); dirContext.close(); } catch (NamingException ex) { handleNamingException("NamingException " + ex.getLocalizedMessage(), ex); } return status; }
[ "@", "Override", "public", "boolean", "setUserAsUser", "(", "Node", "node", ",", "String", "uid", ",", "String", "password", ")", "throws", "Exception", "{", "boolean", "status", "=", "false", ";", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", "userIdentifyer", "+", "\"=\"", ")", ".", "append", "(", "uid", ")", ".", "append", "(", "\",\"", ")", ";", "sb", ".", "append", "(", "Configuration", ".", "getProperty", "(", "instanceName", "+", "LdapKeys", ".", "ATTR_OU_PEOPLE", ")", ")", ".", "append", "(", "\",\"", ")", ";", "sb", ".", "append", "(", "baseDn", ")", ";", "if", "(", "uid", "==", "null", "||", "uid", ".", "isEmpty", "(", ")", "||", "password", "==", "null", "||", "password", ".", "isEmpty", "(", ")", ")", "{", "return", "false", ";", "}", "try", "{", "Hashtable", "<", "String", ",", "String", ">", "environment", "=", "(", "Hashtable", "<", "String", ",", "String", ">", ")", "ctx", ".", "getEnvironment", "(", ")", ".", "clone", "(", ")", ";", "environment", ".", "put", "(", "Context", ".", "SECURITY_PRINCIPAL", ",", "sb", ".", "toString", "(", ")", ")", ";", "environment", ".", "put", "(", "Context", ".", "SECURITY_CREDENTIALS", ",", "password", ")", ";", "DirContext", "dirContext", "=", "new", "InitialDirContext", "(", "environment", ")", ";", "status", "=", "setUserInContext", "(", "dirContext", ",", "node", ")", ";", "dirContext", ".", "close", "(", ")", ";", "}", "catch", "(", "NamingException", "ex", ")", "{", "handleNamingException", "(", "\"NamingException \"", "+", "ex", ".", "getLocalizedMessage", "(", ")", ",", "ex", ")", ";", "}", "return", "status", ";", "}" ]
Writes the modifications on an user object back to the LDAP using a specific context. @param node the LDAP Node with User Content. @param uid the uid of the User that adds the Node. @param password the password of the User that adds the Node. @return true if the user was set correct, false otherwise. @throws Exception if adding a User fails.
[ "Writes", "the", "modifications", "on", "an", "user", "object", "back", "to", "the", "LDAP", "using", "a", "specific", "context", "." ]
ae3de2c1fd78c40219780d510eba57c931901279
https://github.com/innoq/LiQID/blob/ae3de2c1fd78c40219780d510eba57c931901279/ldap-connector/src/main/java/com/innoq/ldap/connector/LdapHelper.java#L153-L173
147,738
innoq/LiQID
ldap-connector/src/main/java/com/innoq/ldap/connector/LdapHelper.java
LdapHelper.rmUser
@Override public boolean rmUser(final Node node) { LdapUser user = (LdapUser) node; if(node == null) { return false; } try { deletionCount++; ctx.unbind(getOuForNode(user)); } catch (NamingException ex) { handleNamingException(user, ex); } Node ldapUser = getUser(user.getUid()); return ldapUser.isEmpty(); }
java
@Override public boolean rmUser(final Node node) { LdapUser user = (LdapUser) node; if(node == null) { return false; } try { deletionCount++; ctx.unbind(getOuForNode(user)); } catch (NamingException ex) { handleNamingException(user, ex); } Node ldapUser = getUser(user.getUid()); return ldapUser.isEmpty(); }
[ "@", "Override", "public", "boolean", "rmUser", "(", "final", "Node", "node", ")", "{", "LdapUser", "user", "=", "(", "LdapUser", ")", "node", ";", "if", "(", "node", "==", "null", ")", "{", "return", "false", ";", "}", "try", "{", "deletionCount", "++", ";", "ctx", ".", "unbind", "(", "getOuForNode", "(", "user", ")", ")", ";", "}", "catch", "(", "NamingException", "ex", ")", "{", "handleNamingException", "(", "user", ",", "ex", ")", ";", "}", "Node", "ldapUser", "=", "getUser", "(", "user", ".", "getUid", "(", ")", ")", ";", "return", "ldapUser", ".", "isEmpty", "(", ")", ";", "}" ]
Deletes an LDAP-User. @param node of the LDAP-User to be deleted. @return true if User was deleted, otherwise false.
[ "Deletes", "an", "LDAP", "-", "User", "." ]
ae3de2c1fd78c40219780d510eba57c931901279
https://github.com/innoq/LiQID/blob/ae3de2c1fd78c40219780d510eba57c931901279/ldap-connector/src/main/java/com/innoq/ldap/connector/LdapHelper.java#L181-L195
147,739
innoq/LiQID
ldap-connector/src/main/java/com/innoq/ldap/connector/LdapHelper.java
LdapHelper.rmGroup
@Override public boolean rmGroup(Node node) { LdapGroup group = (LdapGroup) node; try { deletionCount++; ctx.unbind(getOuForNode(group)); } catch (NamingException ex) { handleNamingException(group, ex); } Node ldapGroup = getGroup(group.getCn()); return ldapGroup.isEmpty(); }
java
@Override public boolean rmGroup(Node node) { LdapGroup group = (LdapGroup) node; try { deletionCount++; ctx.unbind(getOuForNode(group)); } catch (NamingException ex) { handleNamingException(group, ex); } Node ldapGroup = getGroup(group.getCn()); return ldapGroup.isEmpty(); }
[ "@", "Override", "public", "boolean", "rmGroup", "(", "Node", "node", ")", "{", "LdapGroup", "group", "=", "(", "LdapGroup", ")", "node", ";", "try", "{", "deletionCount", "++", ";", "ctx", ".", "unbind", "(", "getOuForNode", "(", "group", ")", ")", ";", "}", "catch", "(", "NamingException", "ex", ")", "{", "handleNamingException", "(", "group", ",", "ex", ")", ";", "}", "Node", "ldapGroup", "=", "getGroup", "(", "group", ".", "getCn", "(", ")", ")", ";", "return", "ldapGroup", ".", "isEmpty", "(", ")", ";", "}" ]
Deletes a LDAP-Group. @param node of the LDAP-Group to be deleted. @return true if Group was deleted, otherwise false.
[ "Deletes", "a", "LDAP", "-", "Group", "." ]
ae3de2c1fd78c40219780d510eba57c931901279
https://github.com/innoq/LiQID/blob/ae3de2c1fd78c40219780d510eba57c931901279/ldap-connector/src/main/java/com/innoq/ldap/connector/LdapHelper.java#L203-L214
147,740
innoq/LiQID
ldap-connector/src/main/java/com/innoq/ldap/connector/LdapHelper.java
LdapHelper.setGroup
@Override public boolean setGroup(Node node) throws Exception { LdapGroup newLdapGroup = (LdapGroup) node; newLdapGroup = updateGroupMembers(newLdapGroup); LdapGroup oldLdapGroup = (LdapGroup) getGroup(newLdapGroup.getCn()); if (oldLdapGroup.isEmpty()) { creationCount++; Logger.info(LOG_BIND + getOuForNode(newLdapGroup)); ctx.bind(getOuForNode(newLdapGroup), null, newLdapGroup.getAttributes()); return true; } else { ModificationItem[] mods = buildModificationsForGroup(newLdapGroup, oldLdapGroup); if (mods.length > 0) { modificationCount++; Logger.info(LOG_MODIFY_ATTRIBUTES + getOuForNode(newLdapGroup)); ctx.modifyAttributes(getOuForNode(newLdapGroup), mods); return true; } } return false; }
java
@Override public boolean setGroup(Node node) throws Exception { LdapGroup newLdapGroup = (LdapGroup) node; newLdapGroup = updateGroupMembers(newLdapGroup); LdapGroup oldLdapGroup = (LdapGroup) getGroup(newLdapGroup.getCn()); if (oldLdapGroup.isEmpty()) { creationCount++; Logger.info(LOG_BIND + getOuForNode(newLdapGroup)); ctx.bind(getOuForNode(newLdapGroup), null, newLdapGroup.getAttributes()); return true; } else { ModificationItem[] mods = buildModificationsForGroup(newLdapGroup, oldLdapGroup); if (mods.length > 0) { modificationCount++; Logger.info(LOG_MODIFY_ATTRIBUTES + getOuForNode(newLdapGroup)); ctx.modifyAttributes(getOuForNode(newLdapGroup), mods); return true; } } return false; }
[ "@", "Override", "public", "boolean", "setGroup", "(", "Node", "node", ")", "throws", "Exception", "{", "LdapGroup", "newLdapGroup", "=", "(", "LdapGroup", ")", "node", ";", "newLdapGroup", "=", "updateGroupMembers", "(", "newLdapGroup", ")", ";", "LdapGroup", "oldLdapGroup", "=", "(", "LdapGroup", ")", "getGroup", "(", "newLdapGroup", ".", "getCn", "(", ")", ")", ";", "if", "(", "oldLdapGroup", ".", "isEmpty", "(", ")", ")", "{", "creationCount", "++", ";", "Logger", ".", "info", "(", "LOG_BIND", "+", "getOuForNode", "(", "newLdapGroup", ")", ")", ";", "ctx", ".", "bind", "(", "getOuForNode", "(", "newLdapGroup", ")", ",", "null", ",", "newLdapGroup", ".", "getAttributes", "(", ")", ")", ";", "return", "true", ";", "}", "else", "{", "ModificationItem", "[", "]", "mods", "=", "buildModificationsForGroup", "(", "newLdapGroup", ",", "oldLdapGroup", ")", ";", "if", "(", "mods", ".", "length", ">", "0", ")", "{", "modificationCount", "++", ";", "Logger", ".", "info", "(", "LOG_MODIFY_ATTRIBUTES", "+", "getOuForNode", "(", "newLdapGroup", ")", ")", ";", "ctx", ".", "modifyAttributes", "(", "getOuForNode", "(", "newLdapGroup", ")", ",", "mods", ")", ";", "return", "true", ";", "}", "}", "return", "false", ";", "}" ]
Adds or updates a LDAP-Group. @param node of the LDAP-Group to be set. @return true if the Group was added/updated, otherwise false. @throws Exception if adding a Group fails.
[ "Adds", "or", "updates", "a", "LDAP", "-", "Group", "." ]
ae3de2c1fd78c40219780d510eba57c931901279
https://github.com/innoq/LiQID/blob/ae3de2c1fd78c40219780d510eba57c931901279/ldap-connector/src/main/java/com/innoq/ldap/connector/LdapHelper.java#L223-L243
147,741
innoq/LiQID
ldap-connector/src/main/java/com/innoq/ldap/connector/LdapHelper.java
LdapHelper.getUser
@Override public Node getUser(final String uid) { try { String query = "(&(objectClass=" + userObjectClass + ")(" + userIdentifyer + "=" + uid + "))"; SearchResult searchResult; Attributes attributes; SearchControls controls = new SearchControls(); controls.setReturningAttributes(new String[]{LdapKeys.ASTERISK, LdapKeys.MODIFY_TIMESTAMP, LdapKeys.MODIFIERS_NAME, LdapKeys.ENTRY_UUID}); controls.setSearchScope(SearchControls.SUBTREE_SCOPE); NamingEnumeration<SearchResult> results = ctx.search("", query, controls); queryCount++; if (results.hasMore()) { searchResult = results.next(); attributes = searchResult.getAttributes(); LdapUser user = new LdapUser(uid, this); user.setDn(searchResult.getNameInNamespace()); user = fillAttributesInUser((LdapUser) user, attributes); return user; } } catch (NamingException ex) { handleNamingException(instanceName + ":" + uid, ex); } return new LdapUser(); }
java
@Override public Node getUser(final String uid) { try { String query = "(&(objectClass=" + userObjectClass + ")(" + userIdentifyer + "=" + uid + "))"; SearchResult searchResult; Attributes attributes; SearchControls controls = new SearchControls(); controls.setReturningAttributes(new String[]{LdapKeys.ASTERISK, LdapKeys.MODIFY_TIMESTAMP, LdapKeys.MODIFIERS_NAME, LdapKeys.ENTRY_UUID}); controls.setSearchScope(SearchControls.SUBTREE_SCOPE); NamingEnumeration<SearchResult> results = ctx.search("", query, controls); queryCount++; if (results.hasMore()) { searchResult = results.next(); attributes = searchResult.getAttributes(); LdapUser user = new LdapUser(uid, this); user.setDn(searchResult.getNameInNamespace()); user = fillAttributesInUser((LdapUser) user, attributes); return user; } } catch (NamingException ex) { handleNamingException(instanceName + ":" + uid, ex); } return new LdapUser(); }
[ "@", "Override", "public", "Node", "getUser", "(", "final", "String", "uid", ")", "{", "try", "{", "String", "query", "=", "\"(&(objectClass=\"", "+", "userObjectClass", "+", "\")(\"", "+", "userIdentifyer", "+", "\"=\"", "+", "uid", "+", "\"))\"", ";", "SearchResult", "searchResult", ";", "Attributes", "attributes", ";", "SearchControls", "controls", "=", "new", "SearchControls", "(", ")", ";", "controls", ".", "setReturningAttributes", "(", "new", "String", "[", "]", "{", "LdapKeys", ".", "ASTERISK", ",", "LdapKeys", ".", "MODIFY_TIMESTAMP", ",", "LdapKeys", ".", "MODIFIERS_NAME", ",", "LdapKeys", ".", "ENTRY_UUID", "}", ")", ";", "controls", ".", "setSearchScope", "(", "SearchControls", ".", "SUBTREE_SCOPE", ")", ";", "NamingEnumeration", "<", "SearchResult", ">", "results", "=", "ctx", ".", "search", "(", "\"\"", ",", "query", ",", "controls", ")", ";", "queryCount", "++", ";", "if", "(", "results", ".", "hasMore", "(", ")", ")", "{", "searchResult", "=", "results", ".", "next", "(", ")", ";", "attributes", "=", "searchResult", ".", "getAttributes", "(", ")", ";", "LdapUser", "user", "=", "new", "LdapUser", "(", "uid", ",", "this", ")", ";", "user", ".", "setDn", "(", "searchResult", ".", "getNameInNamespace", "(", ")", ")", ";", "user", "=", "fillAttributesInUser", "(", "(", "LdapUser", ")", "user", ",", "attributes", ")", ";", "return", "user", ";", "}", "}", "catch", "(", "NamingException", "ex", ")", "{", "handleNamingException", "(", "instanceName", "+", "\":\"", "+", "uid", ",", "ex", ")", ";", "}", "return", "new", "LdapUser", "(", ")", ";", "}" ]
Returns an LDAP-User. @param uid the uid of the User. @see com.innoq.liqid.model.Node#getName @return the Node of that User, either filled (if User was found), or empty.
[ "Returns", "an", "LDAP", "-", "User", "." ]
ae3de2c1fd78c40219780d510eba57c931901279
https://github.com/innoq/LiQID/blob/ae3de2c1fd78c40219780d510eba57c931901279/ldap-connector/src/main/java/com/innoq/ldap/connector/LdapHelper.java#L288-L312
147,742
innoq/LiQID
ldap-connector/src/main/java/com/innoq/ldap/connector/LdapHelper.java
LdapHelper.findUsers
@Override public Set<Node> findUsers(final String uid) { QueryBuilder qb = new LdapQueryBuilder(); if ("*".equals(uid)) { qb.append(LdapKeys.OBJECT_CLASS, userObjectClass); } else { qb.append(LdapKeys.OBJECT_CLASS, userObjectClass); qb.append(userIdentifyer, uid + "*"); } return findUsers(qb); }
java
@Override public Set<Node> findUsers(final String uid) { QueryBuilder qb = new LdapQueryBuilder(); if ("*".equals(uid)) { qb.append(LdapKeys.OBJECT_CLASS, userObjectClass); } else { qb.append(LdapKeys.OBJECT_CLASS, userObjectClass); qb.append(userIdentifyer, uid + "*"); } return findUsers(qb); }
[ "@", "Override", "public", "Set", "<", "Node", ">", "findUsers", "(", "final", "String", "uid", ")", "{", "QueryBuilder", "qb", "=", "new", "LdapQueryBuilder", "(", ")", ";", "if", "(", "\"*\"", ".", "equals", "(", "uid", ")", ")", "{", "qb", ".", "append", "(", "LdapKeys", ".", "OBJECT_CLASS", ",", "userObjectClass", ")", ";", "}", "else", "{", "qb", ".", "append", "(", "LdapKeys", ".", "OBJECT_CLASS", ",", "userObjectClass", ")", ";", "qb", ".", "append", "(", "userIdentifyer", ",", "uid", "+", "\"*\"", ")", ";", "}", "return", "findUsers", "(", "qb", ")", ";", "}" ]
Returns several LDAP-Users for a given search-String. @param uid the uid or part of uid of the Users. @return Users as a Set of com.innoq.liqid.model.Node.
[ "Returns", "several", "LDAP", "-", "Users", "for", "a", "given", "search", "-", "String", "." ]
ae3de2c1fd78c40219780d510eba57c931901279
https://github.com/innoq/LiQID/blob/ae3de2c1fd78c40219780d510eba57c931901279/ldap-connector/src/main/java/com/innoq/ldap/connector/LdapHelper.java#L320-L330
147,743
innoq/LiQID
ldap-connector/src/main/java/com/innoq/ldap/connector/LdapHelper.java
LdapHelper.getGroup
@Override public Node getGroup(final String cn) { try { String query = "(&(objectClass=" + groupObjectClass + ")(" + groupIdentifyer + "=" + cn + "))"; SearchResult searchResult; Attributes attributes; SearchControls controls = new SearchControls(); controls.setReturningAttributes(new String[]{LdapKeys.ASTERISK, LdapKeys.MODIFY_TIMESTAMP, LdapKeys.MODIFIERS_NAME, LdapKeys.ENTRY_UUID}); controls.setSearchScope(SearchControls.SUBTREE_SCOPE); NamingEnumeration<SearchResult> results = ctx.search("", query, controls); queryCount++; if (results.hasMore()) { LdapGroup group = new LdapGroup(cn, this); searchResult = results.next(); group.setDn(searchResult.getNameInNamespace()); attributes = searchResult.getAttributes(); group = fillAttributesInGroup((LdapGroup) group, attributes); return group; } } catch (NamingException ex) { handleNamingException(instanceName + ":" + cn, ex); } return new LdapGroup(); }
java
@Override public Node getGroup(final String cn) { try { String query = "(&(objectClass=" + groupObjectClass + ")(" + groupIdentifyer + "=" + cn + "))"; SearchResult searchResult; Attributes attributes; SearchControls controls = new SearchControls(); controls.setReturningAttributes(new String[]{LdapKeys.ASTERISK, LdapKeys.MODIFY_TIMESTAMP, LdapKeys.MODIFIERS_NAME, LdapKeys.ENTRY_UUID}); controls.setSearchScope(SearchControls.SUBTREE_SCOPE); NamingEnumeration<SearchResult> results = ctx.search("", query, controls); queryCount++; if (results.hasMore()) { LdapGroup group = new LdapGroup(cn, this); searchResult = results.next(); group.setDn(searchResult.getNameInNamespace()); attributes = searchResult.getAttributes(); group = fillAttributesInGroup((LdapGroup) group, attributes); return group; } } catch (NamingException ex) { handleNamingException(instanceName + ":" + cn, ex); } return new LdapGroup(); }
[ "@", "Override", "public", "Node", "getGroup", "(", "final", "String", "cn", ")", "{", "try", "{", "String", "query", "=", "\"(&(objectClass=\"", "+", "groupObjectClass", "+", "\")(\"", "+", "groupIdentifyer", "+", "\"=\"", "+", "cn", "+", "\"))\"", ";", "SearchResult", "searchResult", ";", "Attributes", "attributes", ";", "SearchControls", "controls", "=", "new", "SearchControls", "(", ")", ";", "controls", ".", "setReturningAttributes", "(", "new", "String", "[", "]", "{", "LdapKeys", ".", "ASTERISK", ",", "LdapKeys", ".", "MODIFY_TIMESTAMP", ",", "LdapKeys", ".", "MODIFIERS_NAME", ",", "LdapKeys", ".", "ENTRY_UUID", "}", ")", ";", "controls", ".", "setSearchScope", "(", "SearchControls", ".", "SUBTREE_SCOPE", ")", ";", "NamingEnumeration", "<", "SearchResult", ">", "results", "=", "ctx", ".", "search", "(", "\"\"", ",", "query", ",", "controls", ")", ";", "queryCount", "++", ";", "if", "(", "results", ".", "hasMore", "(", ")", ")", "{", "LdapGroup", "group", "=", "new", "LdapGroup", "(", "cn", ",", "this", ")", ";", "searchResult", "=", "results", ".", "next", "(", ")", ";", "group", ".", "setDn", "(", "searchResult", ".", "getNameInNamespace", "(", ")", ")", ";", "attributes", "=", "searchResult", ".", "getAttributes", "(", ")", ";", "group", "=", "fillAttributesInGroup", "(", "(", "LdapGroup", ")", "group", ",", "attributes", ")", ";", "return", "group", ";", "}", "}", "catch", "(", "NamingException", "ex", ")", "{", "handleNamingException", "(", "instanceName", "+", "\":\"", "+", "cn", ",", "ex", ")", ";", "}", "return", "new", "LdapGroup", "(", ")", ";", "}" ]
Returns a LDAP-Group. @param cn the cn of that Group. @see com.innoq.liqid.model.Node#getName() @return the Node of that Group, either filled (if Group was found), or empty.
[ "Returns", "a", "LDAP", "-", "Group", "." ]
ae3de2c1fd78c40219780d510eba57c931901279
https://github.com/innoq/LiQID/blob/ae3de2c1fd78c40219780d510eba57c931901279/ldap-connector/src/main/java/com/innoq/ldap/connector/LdapHelper.java#L368-L391
147,744
innoq/LiQID
ldap-connector/src/main/java/com/innoq/ldap/connector/LdapHelper.java
LdapHelper.findGroups
@Override public Set<Node> findGroups(final String cn) { QueryBuilder qb = new LdapQueryBuilder(); if ("*".equals(cn)) { qb.append(LdapKeys.OBJECT_CLASS, groupObjectClass); } else { qb.append(LdapKeys.OBJECT_CLASS, groupObjectClass); qb.append(groupIdentifyer, cn + "*"); } return findGroups(qb); }
java
@Override public Set<Node> findGroups(final String cn) { QueryBuilder qb = new LdapQueryBuilder(); if ("*".equals(cn)) { qb.append(LdapKeys.OBJECT_CLASS, groupObjectClass); } else { qb.append(LdapKeys.OBJECT_CLASS, groupObjectClass); qb.append(groupIdentifyer, cn + "*"); } return findGroups(qb); }
[ "@", "Override", "public", "Set", "<", "Node", ">", "findGroups", "(", "final", "String", "cn", ")", "{", "QueryBuilder", "qb", "=", "new", "LdapQueryBuilder", "(", ")", ";", "if", "(", "\"*\"", ".", "equals", "(", "cn", ")", ")", "{", "qb", ".", "append", "(", "LdapKeys", ".", "OBJECT_CLASS", ",", "groupObjectClass", ")", ";", "}", "else", "{", "qb", ".", "append", "(", "LdapKeys", ".", "OBJECT_CLASS", ",", "groupObjectClass", ")", ";", "qb", ".", "append", "(", "groupIdentifyer", ",", "cn", "+", "\"*\"", ")", ";", "}", "return", "findGroups", "(", "qb", ")", ";", "}" ]
Returns several LDAP-Groups for a given search-String. @param cn the cn (or part of cn) for the groups. @return Groups as a Set of Nodes.
[ "Returns", "several", "LDAP", "-", "Groups", "for", "a", "given", "search", "-", "String", "." ]
ae3de2c1fd78c40219780d510eba57c931901279
https://github.com/innoq/LiQID/blob/ae3de2c1fd78c40219780d510eba57c931901279/ldap-connector/src/main/java/com/innoq/ldap/connector/LdapHelper.java#L399-L409
147,745
innoq/LiQID
ldap-connector/src/main/java/com/innoq/ldap/connector/LdapHelper.java
LdapHelper.getPrincipal
@Override public Node getPrincipal() { if (principal == null) { principal = new LdapUser(); LdapUser p = (LdapUser) principal; p.setDn(Configuration.getProperty(instanceName + ".principal").trim()); p.setUid(getUidForDN(p.getDn())); } return principal; }
java
@Override public Node getPrincipal() { if (principal == null) { principal = new LdapUser(); LdapUser p = (LdapUser) principal; p.setDn(Configuration.getProperty(instanceName + ".principal").trim()); p.setUid(getUidForDN(p.getDn())); } return principal; }
[ "@", "Override", "public", "Node", "getPrincipal", "(", ")", "{", "if", "(", "principal", "==", "null", ")", "{", "principal", "=", "new", "LdapUser", "(", ")", ";", "LdapUser", "p", "=", "(", "LdapUser", ")", "principal", ";", "p", ".", "setDn", "(", "Configuration", ".", "getProperty", "(", "instanceName", "+", "\".principal\"", ")", ".", "trim", "(", ")", ")", ";", "p", ".", "setUid", "(", "getUidForDN", "(", "p", ".", "getDn", "(", ")", ")", ")", ";", "}", "return", "principal", ";", "}" ]
Returns the LDAP-Principal as a LdapUser. @return the Principal of that instanceName as a Node
[ "Returns", "the", "LDAP", "-", "Principal", "as", "a", "LdapUser", "." ]
ae3de2c1fd78c40219780d510eba57c931901279
https://github.com/innoq/LiQID/blob/ae3de2c1fd78c40219780d510eba57c931901279/ldap-connector/src/main/java/com/innoq/ldap/connector/LdapHelper.java#L445-L454
147,746
innoq/LiQID
ldap-connector/src/main/java/com/innoq/ldap/connector/LdapHelper.java
LdapHelper.getDefault
public String getDefault(final String key) { if (defaultValues.containsKey(key)) { return defaultValues.get(key); } return ""; }
java
public String getDefault(final String key) { if (defaultValues.containsKey(key)) { return defaultValues.get(key); } return ""; }
[ "public", "String", "getDefault", "(", "final", "String", "key", ")", "{", "if", "(", "defaultValues", ".", "containsKey", "(", "key", ")", ")", "{", "return", "defaultValues", ".", "get", "(", "key", ")", ";", "}", "return", "\"\"", ";", "}" ]
Returns a Value from the Default Collection. @param key the key of the default-collection. @return the default value for that key if exists otherwise an empty string.
[ "Returns", "a", "Value", "from", "the", "Default", "Collection", "." ]
ae3de2c1fd78c40219780d510eba57c931901279
https://github.com/innoq/LiQID/blob/ae3de2c1fd78c40219780d510eba57c931901279/ldap-connector/src/main/java/com/innoq/ldap/connector/LdapHelper.java#L463-L468
147,747
innoq/LiQID
ldap-connector/src/main/java/com/innoq/ldap/connector/LdapHelper.java
LdapHelper.getGroupsForUser
@Override public Set<Node> getGroupsForUser(Node user) { Set<Node> groups = new TreeSet<>(); try { String query = "(& (objectClass=" + groupObjectClass + ") (" + groupMemberAttribut + "=" + ((LdapUser) user).getDn() + "))"; SearchResult searchResult; Attributes attributes; SearchControls controls = new SearchControls(); controls.setSearchScope(SearchControls.SUBTREE_SCOPE); NamingEnumeration<SearchResult> results = ctx.search("", query, controls); queryCount++; Node group; while (results.hasMore()) { searchResult = results.next(); attributes = searchResult.getAttributes(); group = getGroup(getAttributeOrNa(attributes, groupIdentifyer)); group.setDn(searchResult.getNameInNamespace()); groups.add(group); } } catch (NamingException ex) { handleNamingException(user, ex); } return groups; }
java
@Override public Set<Node> getGroupsForUser(Node user) { Set<Node> groups = new TreeSet<>(); try { String query = "(& (objectClass=" + groupObjectClass + ") (" + groupMemberAttribut + "=" + ((LdapUser) user).getDn() + "))"; SearchResult searchResult; Attributes attributes; SearchControls controls = new SearchControls(); controls.setSearchScope(SearchControls.SUBTREE_SCOPE); NamingEnumeration<SearchResult> results = ctx.search("", query, controls); queryCount++; Node group; while (results.hasMore()) { searchResult = results.next(); attributes = searchResult.getAttributes(); group = getGroup(getAttributeOrNa(attributes, groupIdentifyer)); group.setDn(searchResult.getNameInNamespace()); groups.add(group); } } catch (NamingException ex) { handleNamingException(user, ex); } return groups; }
[ "@", "Override", "public", "Set", "<", "Node", ">", "getGroupsForUser", "(", "Node", "user", ")", "{", "Set", "<", "Node", ">", "groups", "=", "new", "TreeSet", "<>", "(", ")", ";", "try", "{", "String", "query", "=", "\"(& (objectClass=\"", "+", "groupObjectClass", "+", "\") (\"", "+", "groupMemberAttribut", "+", "\"=\"", "+", "(", "(", "LdapUser", ")", "user", ")", ".", "getDn", "(", ")", "+", "\"))\"", ";", "SearchResult", "searchResult", ";", "Attributes", "attributes", ";", "SearchControls", "controls", "=", "new", "SearchControls", "(", ")", ";", "controls", ".", "setSearchScope", "(", "SearchControls", ".", "SUBTREE_SCOPE", ")", ";", "NamingEnumeration", "<", "SearchResult", ">", "results", "=", "ctx", ".", "search", "(", "\"\"", ",", "query", ",", "controls", ")", ";", "queryCount", "++", ";", "Node", "group", ";", "while", "(", "results", ".", "hasMore", "(", ")", ")", "{", "searchResult", "=", "results", ".", "next", "(", ")", ";", "attributes", "=", "searchResult", ".", "getAttributes", "(", ")", ";", "group", "=", "getGroup", "(", "getAttributeOrNa", "(", "attributes", ",", "groupIdentifyer", ")", ")", ";", "group", ".", "setDn", "(", "searchResult", ".", "getNameInNamespace", "(", ")", ")", ";", "groups", ".", "add", "(", "group", ")", ";", "}", "}", "catch", "(", "NamingException", "ex", ")", "{", "handleNamingException", "(", "user", ",", "ex", ")", ";", "}", "return", "groups", ";", "}" ]
Load all Groups for a given User. @param user the given User. @return Groups as a Set of Nodes for that User.
[ "Load", "all", "Groups", "for", "a", "given", "User", "." ]
ae3de2c1fd78c40219780d510eba57c931901279
https://github.com/innoq/LiQID/blob/ae3de2c1fd78c40219780d510eba57c931901279/ldap-connector/src/main/java/com/innoq/ldap/connector/LdapHelper.java#L522-L545
147,748
innoq/LiQID
ldap-connector/src/main/java/com/innoq/ldap/connector/LdapHelper.java
LdapHelper.getUsersForGroup
@Override public Set<Node> getUsersForGroup(Node group) { Set<Node> users = new TreeSet<>(); try { String query = "(" + groupIdentifyer + "=" + group.getName() + ")"; SearchResult searchResult; Attributes attributes; SearchControls controls = new SearchControls(); controls.setSearchScope(SearchControls.SUBTREE_SCOPE); NamingEnumeration<SearchResult> results = ctx.search("", query, controls); Node user; while (results.hasMore()) { searchResult = results.next(); attributes = searchResult.getAttributes(); NamingEnumeration<?> members = attributes.get(groupMemberAttribut).getAll(); while (members.hasMoreElements()) { String memberDN = (String) members.nextElement(); String uid = getIdentifyerValueFromDN(memberDN); user = getUser(uid); user.setDn(memberDN); users.add(user); } } } catch (NamingException ex) { handleNamingException(group, ex); } return users; }
java
@Override public Set<Node> getUsersForGroup(Node group) { Set<Node> users = new TreeSet<>(); try { String query = "(" + groupIdentifyer + "=" + group.getName() + ")"; SearchResult searchResult; Attributes attributes; SearchControls controls = new SearchControls(); controls.setSearchScope(SearchControls.SUBTREE_SCOPE); NamingEnumeration<SearchResult> results = ctx.search("", query, controls); Node user; while (results.hasMore()) { searchResult = results.next(); attributes = searchResult.getAttributes(); NamingEnumeration<?> members = attributes.get(groupMemberAttribut).getAll(); while (members.hasMoreElements()) { String memberDN = (String) members.nextElement(); String uid = getIdentifyerValueFromDN(memberDN); user = getUser(uid); user.setDn(memberDN); users.add(user); } } } catch (NamingException ex) { handleNamingException(group, ex); } return users; }
[ "@", "Override", "public", "Set", "<", "Node", ">", "getUsersForGroup", "(", "Node", "group", ")", "{", "Set", "<", "Node", ">", "users", "=", "new", "TreeSet", "<>", "(", ")", ";", "try", "{", "String", "query", "=", "\"(\"", "+", "groupIdentifyer", "+", "\"=\"", "+", "group", ".", "getName", "(", ")", "+", "\")\"", ";", "SearchResult", "searchResult", ";", "Attributes", "attributes", ";", "SearchControls", "controls", "=", "new", "SearchControls", "(", ")", ";", "controls", ".", "setSearchScope", "(", "SearchControls", ".", "SUBTREE_SCOPE", ")", ";", "NamingEnumeration", "<", "SearchResult", ">", "results", "=", "ctx", ".", "search", "(", "\"\"", ",", "query", ",", "controls", ")", ";", "Node", "user", ";", "while", "(", "results", ".", "hasMore", "(", ")", ")", "{", "searchResult", "=", "results", ".", "next", "(", ")", ";", "attributes", "=", "searchResult", ".", "getAttributes", "(", ")", ";", "NamingEnumeration", "<", "?", ">", "members", "=", "attributes", ".", "get", "(", "groupMemberAttribut", ")", ".", "getAll", "(", ")", ";", "while", "(", "members", ".", "hasMoreElements", "(", ")", ")", "{", "String", "memberDN", "=", "(", "String", ")", "members", ".", "nextElement", "(", ")", ";", "String", "uid", "=", "getIdentifyerValueFromDN", "(", "memberDN", ")", ";", "user", "=", "getUser", "(", "uid", ")", ";", "user", ".", "setDn", "(", "memberDN", ")", ";", "users", ".", "add", "(", "user", ")", ";", "}", "}", "}", "catch", "(", "NamingException", "ex", ")", "{", "handleNamingException", "(", "group", ",", "ex", ")", ";", "}", "return", "users", ";", "}" ]
Load all Users for a given Group. @param group the given Group. @return Users as a Set of Nodes for that Group.
[ "Load", "all", "Users", "for", "a", "given", "Group", "." ]
ae3de2c1fd78c40219780d510eba57c931901279
https://github.com/innoq/LiQID/blob/ae3de2c1fd78c40219780d510eba57c931901279/ldap-connector/src/main/java/com/innoq/ldap/connector/LdapHelper.java#L553-L580
147,749
innoq/LiQID
ldap-connector/src/main/java/com/innoq/ldap/connector/LdapHelper.java
LdapHelper.getUserTemplate
public LdapUser getUserTemplate(String uid) { LdapUser user = new LdapUser(uid, this); user.set("dn", getDNForNode(user)); for (String oc : userObjectClasses) { user.addObjectClass(oc.trim()); } user = (LdapUser) updateObjectClasses(user); // TODO this needs to be cleaner :-/. // for inetOrgPerson if (user.getObjectClasses().contains("inetOrgPerson") || user.getObjectClasses().contains("person")) { user.set("sn", uid); } // for JabberAccount if (user.getObjectClasses().contains("JabberAccount")) { user.set("jabberID", uid + "@" + defaultValues.get("jabberServer")); user.set("jabberAccess", "TRUE"); } // for posixAccount if (user.getObjectClasses().contains("posixAccount")) { user.set("uidNumber", "99999"); user.set("gidNumber", "99999"); user.set("cn", uid); user.set("homeDirectory", "/dev/null"); } // for ldapPublicKey if (user.getObjectClasses().contains("ldapPublicKey")) { user.set("sshPublicKey", defaultValues.get("sshKey")); } return user; }
java
public LdapUser getUserTemplate(String uid) { LdapUser user = new LdapUser(uid, this); user.set("dn", getDNForNode(user)); for (String oc : userObjectClasses) { user.addObjectClass(oc.trim()); } user = (LdapUser) updateObjectClasses(user); // TODO this needs to be cleaner :-/. // for inetOrgPerson if (user.getObjectClasses().contains("inetOrgPerson") || user.getObjectClasses().contains("person")) { user.set("sn", uid); } // for JabberAccount if (user.getObjectClasses().contains("JabberAccount")) { user.set("jabberID", uid + "@" + defaultValues.get("jabberServer")); user.set("jabberAccess", "TRUE"); } // for posixAccount if (user.getObjectClasses().contains("posixAccount")) { user.set("uidNumber", "99999"); user.set("gidNumber", "99999"); user.set("cn", uid); user.set("homeDirectory", "/dev/null"); } // for ldapPublicKey if (user.getObjectClasses().contains("ldapPublicKey")) { user.set("sshPublicKey", defaultValues.get("sshKey")); } return user; }
[ "public", "LdapUser", "getUserTemplate", "(", "String", "uid", ")", "{", "LdapUser", "user", "=", "new", "LdapUser", "(", "uid", ",", "this", ")", ";", "user", ".", "set", "(", "\"dn\"", ",", "getDNForNode", "(", "user", ")", ")", ";", "for", "(", "String", "oc", ":", "userObjectClasses", ")", "{", "user", ".", "addObjectClass", "(", "oc", ".", "trim", "(", ")", ")", ";", "}", "user", "=", "(", "LdapUser", ")", "updateObjectClasses", "(", "user", ")", ";", "// TODO this needs to be cleaner :-/.", "// for inetOrgPerson", "if", "(", "user", ".", "getObjectClasses", "(", ")", ".", "contains", "(", "\"inetOrgPerson\"", ")", "||", "user", ".", "getObjectClasses", "(", ")", ".", "contains", "(", "\"person\"", ")", ")", "{", "user", ".", "set", "(", "\"sn\"", ",", "uid", ")", ";", "}", "// for JabberAccount", "if", "(", "user", ".", "getObjectClasses", "(", ")", ".", "contains", "(", "\"JabberAccount\"", ")", ")", "{", "user", ".", "set", "(", "\"jabberID\"", ",", "uid", "+", "\"@\"", "+", "defaultValues", ".", "get", "(", "\"jabberServer\"", ")", ")", ";", "user", ".", "set", "(", "\"jabberAccess\"", ",", "\"TRUE\"", ")", ";", "}", "// for posixAccount", "if", "(", "user", ".", "getObjectClasses", "(", ")", ".", "contains", "(", "\"posixAccount\"", ")", ")", "{", "user", ".", "set", "(", "\"uidNumber\"", ",", "\"99999\"", ")", ";", "user", ".", "set", "(", "\"gidNumber\"", ",", "\"99999\"", ")", ";", "user", ".", "set", "(", "\"cn\"", ",", "uid", ")", ";", "user", ".", "set", "(", "\"homeDirectory\"", ",", "\"/dev/null\"", ")", ";", "}", "// for ldapPublicKey", "if", "(", "user", ".", "getObjectClasses", "(", ")", ".", "contains", "(", "\"ldapPublicKey\"", ")", ")", "{", "user", ".", "set", "(", "\"sshPublicKey\"", ",", "defaultValues", ".", "get", "(", "\"sshKey\"", ")", ")", ";", "}", "return", "user", ";", "}" ]
Returns a basic LDAP-User-Template for a new LDAP-User. @param uid of the new LDAP-User. @return the (prefiled) User-Template.
[ "Returns", "a", "basic", "LDAP", "-", "User", "-", "Template", "for", "a", "new", "LDAP", "-", "User", "." ]
ae3de2c1fd78c40219780d510eba57c931901279
https://github.com/innoq/LiQID/blob/ae3de2c1fd78c40219780d510eba57c931901279/ldap-connector/src/main/java/com/innoq/ldap/connector/LdapHelper.java#L619-L654
147,750
innoq/LiQID
ldap-connector/src/main/java/com/innoq/ldap/connector/LdapHelper.java
LdapHelper.getIdentifyerFromDN
public static String getIdentifyerFromDN(String dn) { if (dn != null) { String[] parts = dn.trim().split(","); String[] kvs; if(parts.length > 0 && parts[0].contains("=")) { kvs = parts[0].trim().split("="); return kvs.length > 0 ? kvs[0] : null; } } return null; }
java
public static String getIdentifyerFromDN(String dn) { if (dn != null) { String[] parts = dn.trim().split(","); String[] kvs; if(parts.length > 0 && parts[0].contains("=")) { kvs = parts[0].trim().split("="); return kvs.length > 0 ? kvs[0] : null; } } return null; }
[ "public", "static", "String", "getIdentifyerFromDN", "(", "String", "dn", ")", "{", "if", "(", "dn", "!=", "null", ")", "{", "String", "[", "]", "parts", "=", "dn", ".", "trim", "(", ")", ".", "split", "(", "\",\"", ")", ";", "String", "[", "]", "kvs", ";", "if", "(", "parts", ".", "length", ">", "0", "&&", "parts", "[", "0", "]", ".", "contains", "(", "\"=\"", ")", ")", "{", "kvs", "=", "parts", "[", "0", "]", ".", "trim", "(", ")", ".", "split", "(", "\"=\"", ")", ";", "return", "kvs", ".", "length", ">", "0", "?", "kvs", "[", "0", "]", ":", "null", ";", "}", "}", "return", "null", ";", "}" ]
Return the Value of the given Identifyer from a given dn. @param dn of the entry. @return the identifyer.
[ "Return", "the", "Value", "of", "the", "given", "Identifyer", "from", "a", "given", "dn", "." ]
ae3de2c1fd78c40219780d510eba57c931901279
https://github.com/innoq/LiQID/blob/ae3de2c1fd78c40219780d510eba57c931901279/ldap-connector/src/main/java/com/innoq/ldap/connector/LdapHelper.java#L773-L783
147,751
kmi/iserve
iserve-elda/src/main/java/uk/ac/open/kmi/iserve/elda/EldaRouterRestletSupport.java
EldaRouterRestletSupport.createRouterFor
public static Router createRouterFor(ServletContext con) { String contextName = EldaRouterRestletSupport.flatContextPath(con.getContextPath()); List<PrefixAndFilename> pfs = prefixAndFilenames(con, contextName); // Router result = new DefaultRouter(); String baseFilePath = ServletUtils.withTrailingSlash(con.getRealPath("/")); AuthMap am = AuthMap.loadAuthMap(EldaFileManager.get(), noNamesAndValues); ModelLoader modelLoader = new APIModelLoader(baseFilePath); addBaseFilepath(baseFilePath); // SpecManagerImpl sm = new SpecManagerImpl(result, modelLoader); SpecManagerFactory.set(sm); // for (PrefixAndFilename pf : pfs) { loadOneConfigFile(result, am, modelLoader, pf.prefixPath, pf.fileName); } int count = result.countTemplates(); return count == 0 ? RouterFactory.getDefaultRouter() : result; }
java
public static Router createRouterFor(ServletContext con) { String contextName = EldaRouterRestletSupport.flatContextPath(con.getContextPath()); List<PrefixAndFilename> pfs = prefixAndFilenames(con, contextName); // Router result = new DefaultRouter(); String baseFilePath = ServletUtils.withTrailingSlash(con.getRealPath("/")); AuthMap am = AuthMap.loadAuthMap(EldaFileManager.get(), noNamesAndValues); ModelLoader modelLoader = new APIModelLoader(baseFilePath); addBaseFilepath(baseFilePath); // SpecManagerImpl sm = new SpecManagerImpl(result, modelLoader); SpecManagerFactory.set(sm); // for (PrefixAndFilename pf : pfs) { loadOneConfigFile(result, am, modelLoader, pf.prefixPath, pf.fileName); } int count = result.countTemplates(); return count == 0 ? RouterFactory.getDefaultRouter() : result; }
[ "public", "static", "Router", "createRouterFor", "(", "ServletContext", "con", ")", "{", "String", "contextName", "=", "EldaRouterRestletSupport", ".", "flatContextPath", "(", "con", ".", "getContextPath", "(", ")", ")", ";", "List", "<", "PrefixAndFilename", ">", "pfs", "=", "prefixAndFilenames", "(", "con", ",", "contextName", ")", ";", "//", "Router", "result", "=", "new", "DefaultRouter", "(", ")", ";", "String", "baseFilePath", "=", "ServletUtils", ".", "withTrailingSlash", "(", "con", ".", "getRealPath", "(", "\"/\"", ")", ")", ";", "AuthMap", "am", "=", "AuthMap", ".", "loadAuthMap", "(", "EldaFileManager", ".", "get", "(", ")", ",", "noNamesAndValues", ")", ";", "ModelLoader", "modelLoader", "=", "new", "APIModelLoader", "(", "baseFilePath", ")", ";", "addBaseFilepath", "(", "baseFilePath", ")", ";", "//", "SpecManagerImpl", "sm", "=", "new", "SpecManagerImpl", "(", "result", ",", "modelLoader", ")", ";", "SpecManagerFactory", ".", "set", "(", "sm", ")", ";", "//", "for", "(", "PrefixAndFilename", "pf", ":", "pfs", ")", "{", "loadOneConfigFile", "(", "result", ",", "am", ",", "modelLoader", ",", "pf", ".", "prefixPath", ",", "pf", ".", "fileName", ")", ";", "}", "int", "count", "=", "result", ".", "countTemplates", "(", ")", ";", "return", "count", "==", "0", "?", "RouterFactory", ".", "getDefaultRouter", "(", ")", ":", "result", ";", "}" ]
Create a new Router initialised with the configs appropriate to the contextPath.
[ "Create", "a", "new", "Router", "initialised", "with", "the", "configs", "appropriate", "to", "the", "contextPath", "." ]
13e7016e64c1d5a539b838c6debf1a5cc4aefcb7
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-elda/src/main/java/uk/ac/open/kmi/iserve/elda/EldaRouterRestletSupport.java#L109-L127
147,752
kmi/iserve
iserve-elda/src/main/java/uk/ac/open/kmi/iserve/elda/EldaRouterRestletSupport.java
EldaRouterRestletSupport.changeMediaType
protected static Renderer changeMediaType(final Renderer r, final MediaType mt) { return new Renderer() { @Override public MediaType getMediaType(Bindings unused) { return mt; } @Override public BytesOut render(Times t, Bindings rc, Map<String, String> termBindings, APIResultSet results) { return r.render(t, rc, termBindings, results); } @Override public String getPreferredSuffix() { return r.getPreferredSuffix(); } @Override public CompleteContext.Mode getMode() { return r.getMode(); } }; }
java
protected static Renderer changeMediaType(final Renderer r, final MediaType mt) { return new Renderer() { @Override public MediaType getMediaType(Bindings unused) { return mt; } @Override public BytesOut render(Times t, Bindings rc, Map<String, String> termBindings, APIResultSet results) { return r.render(t, rc, termBindings, results); } @Override public String getPreferredSuffix() { return r.getPreferredSuffix(); } @Override public CompleteContext.Mode getMode() { return r.getMode(); } }; }
[ "protected", "static", "Renderer", "changeMediaType", "(", "final", "Renderer", "r", ",", "final", "MediaType", "mt", ")", "{", "return", "new", "Renderer", "(", ")", "{", "@", "Override", "public", "MediaType", "getMediaType", "(", "Bindings", "unused", ")", "{", "return", "mt", ";", "}", "@", "Override", "public", "BytesOut", "render", "(", "Times", "t", ",", "Bindings", "rc", ",", "Map", "<", "String", ",", "String", ">", "termBindings", ",", "APIResultSet", "results", ")", "{", "return", "r", ".", "render", "(", "t", ",", "rc", ",", "termBindings", ",", "results", ")", ";", "}", "@", "Override", "public", "String", "getPreferredSuffix", "(", ")", "{", "return", "r", ".", "getPreferredSuffix", "(", ")", ";", "}", "@", "Override", "public", "CompleteContext", ".", "Mode", "getMode", "(", ")", "{", "return", "r", ".", "getMode", "(", ")", ";", "}", "}", ";", "}" ]
Given a renderer r and a media type mt, return a new renderer which behaves like r except that it announces its media type as mt. r itself is not changed. This code should be somewhere more sensible. In fact the whole renderer-choosing machinery needs a good cleanup.
[ "Given", "a", "renderer", "r", "and", "a", "media", "type", "mt", "return", "a", "new", "renderer", "which", "behaves", "like", "r", "except", "that", "it", "announces", "its", "media", "type", "as", "mt", ".", "r", "itself", "is", "not", "changed", "." ]
13e7016e64c1d5a539b838c6debf1a5cc4aefcb7
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-elda/src/main/java/uk/ac/open/kmi/iserve/elda/EldaRouterRestletSupport.java#L188-L211
147,753
opendatatrentino/s-match
src/main/java/it/unitn/disi/smatch/matchers/element/gloss/WNGloss.java
WNGloss.match
public char match(ISense source, ISense target) throws MatcherLibraryException { String sSynset = source.getGloss(); String tSynset = target.getGloss(); StringTokenizer stSource = new StringTokenizer(sSynset, " ,.\"'();"); StringTokenizer stTarget = new StringTokenizer(tSynset, " ,.\"'();"); String lemma; int counter = 0; while (stSource.hasMoreTokens()) { lemma = stSource.nextToken(); if (!meaninglessWords.contains(lemma)) { List<String> lemmas = target.getLemmas(); for (String lemmaToCompare : lemmas) { if (lemma.equals(lemmaToCompare)) { counter++; } } } } if (counter >= threshold) { return IMappingElement.LESS_GENERAL; } while (stTarget.hasMoreTokens()) { lemma = stTarget.nextToken(); if (!meaninglessWords.contains(lemma)) { List<String> lemmas = source.getLemmas(); for (String lemmaToCompare : lemmas) { if (lemma.equals(lemmaToCompare)) { counter++; } } } } if (counter >= threshold) { return IMappingElement.MORE_GENERAL; } return IMappingElement.IDK; }
java
public char match(ISense source, ISense target) throws MatcherLibraryException { String sSynset = source.getGloss(); String tSynset = target.getGloss(); StringTokenizer stSource = new StringTokenizer(sSynset, " ,.\"'();"); StringTokenizer stTarget = new StringTokenizer(tSynset, " ,.\"'();"); String lemma; int counter = 0; while (stSource.hasMoreTokens()) { lemma = stSource.nextToken(); if (!meaninglessWords.contains(lemma)) { List<String> lemmas = target.getLemmas(); for (String lemmaToCompare : lemmas) { if (lemma.equals(lemmaToCompare)) { counter++; } } } } if (counter >= threshold) { return IMappingElement.LESS_GENERAL; } while (stTarget.hasMoreTokens()) { lemma = stTarget.nextToken(); if (!meaninglessWords.contains(lemma)) { List<String> lemmas = source.getLemmas(); for (String lemmaToCompare : lemmas) { if (lemma.equals(lemmaToCompare)) { counter++; } } } } if (counter >= threshold) { return IMappingElement.MORE_GENERAL; } return IMappingElement.IDK; }
[ "public", "char", "match", "(", "ISense", "source", ",", "ISense", "target", ")", "throws", "MatcherLibraryException", "{", "String", "sSynset", "=", "source", ".", "getGloss", "(", ")", ";", "String", "tSynset", "=", "target", ".", "getGloss", "(", ")", ";", "StringTokenizer", "stSource", "=", "new", "StringTokenizer", "(", "sSynset", ",", "\" ,.\\\"'();\"", ")", ";", "StringTokenizer", "stTarget", "=", "new", "StringTokenizer", "(", "tSynset", ",", "\" ,.\\\"'();\"", ")", ";", "String", "lemma", ";", "int", "counter", "=", "0", ";", "while", "(", "stSource", ".", "hasMoreTokens", "(", ")", ")", "{", "lemma", "=", "stSource", ".", "nextToken", "(", ")", ";", "if", "(", "!", "meaninglessWords", ".", "contains", "(", "lemma", ")", ")", "{", "List", "<", "String", ">", "lemmas", "=", "target", ".", "getLemmas", "(", ")", ";", "for", "(", "String", "lemmaToCompare", ":", "lemmas", ")", "{", "if", "(", "lemma", ".", "equals", "(", "lemmaToCompare", ")", ")", "{", "counter", "++", ";", "}", "}", "}", "}", "if", "(", "counter", ">=", "threshold", ")", "{", "return", "IMappingElement", ".", "LESS_GENERAL", ";", "}", "while", "(", "stTarget", ".", "hasMoreTokens", "(", ")", ")", "{", "lemma", "=", "stTarget", ".", "nextToken", "(", ")", ";", "if", "(", "!", "meaninglessWords", ".", "contains", "(", "lemma", ")", ")", "{", "List", "<", "String", ">", "lemmas", "=", "source", ".", "getLemmas", "(", ")", ";", "for", "(", "String", "lemmaToCompare", ":", "lemmas", ")", "{", "if", "(", "lemma", ".", "equals", "(", "lemmaToCompare", ")", ")", "{", "counter", "++", ";", "}", "}", "}", "}", "if", "(", "counter", ">=", "threshold", ")", "{", "return", "IMappingElement", ".", "MORE_GENERAL", ";", "}", "return", "IMappingElement", ".", "IDK", ";", "}" ]
Computes the relations with WordNet gloss matcher. @param source gloss of source @param target gloss of target @return more general, less general or IDK relation
[ "Computes", "the", "relations", "with", "WordNet", "gloss", "matcher", "." ]
ba5982ef406b7010c2f92592e43887a485935aa1
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/matchers/element/gloss/WNGloss.java#L57-L94
147,754
kmi/iserve
iserve-rest/src/main/java/uk/ac/open/kmi/iserve/rest/sal/resource/ServicesResource.java
ServicesResource.clearServices
@DELETE @Produces({MediaType.TEXT_HTML, "application/json"}) @ApiOperation(value = "Delete all the registered services", notes = "BE CAREFUL! You can lose all your data. It returns a message which confirms all the service deletions.") @ApiResponses( value = { @ApiResponse(code = 200, message = "Registry cleaned. All the services are deleted."), @ApiResponse(code = 304, message = "The services could not be cleared."), @ApiResponse(code = 403, message = "You have not got the appropriate permissions for clearing the services"), @ApiResponse(code = 500, message = "Internal error")}) public Response clearServices( @ApiParam(value = "Response message media type", allowableValues = "application/json,text/html") @HeaderParam("Accept") String accept) { // Check first that the user is allowed to upload a service // Subject currentUser = SecurityUtils.getSubject(); // if (!currentUser.isPermitted("services:delete")) { // log.warn("User without the appropriate permissions attempted to clear the services: " + currentUser.getPrincipal()); // // String htmlString = "<html>\n <head>\n <meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n </head>\n" + // " <body>\n You have not got the appropriate permissions for clearing the services. Please login and ensure you have the correct permissions. </body>\n</html>"; // // return Response.status(Response.Status.FORBIDDEN).entity(htmlString).build(); // } URI serviceUri = uriInfo.getRequestUri(); String response; try { if (manager.getServiceManager().clearServices()) { // The registry was cleared if (accept.contains(MediaType.TEXT_HTML)) { response = "<html>\n <head>\n <meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n </head>\n" + " <body>\n The services have been cleared.\n </body>\n</html>"; } else { JsonObject message = new JsonObject(); message.add("message", new JsonPrimitive("The services have been cleared.")); response = message.toString(); } return Response.status(Status.OK).contentLocation(serviceUri).entity(response).build(); } else { // The registry was not cleared if (accept.contains(MediaType.TEXT_HTML)) { response = "<html>\n <head>\n <meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n </head>\n" + " <body>\n The services could not be cleared. Try again or contact a server administrator.\n </body>\n</html>"; } else { JsonObject message = new JsonObject(); message.add("message", new JsonPrimitive("The services could not be cleared. Try again or contact a server administrator.")); response = message.toString(); } return Response.status(Status.NOT_MODIFIED).contentLocation(serviceUri).entity(response).build(); } } catch (SalException e) { if (accept.contains(MediaType.TEXT_HTML)) { response = "<html>\n <head>\n <meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n </head>\n" + "<body>\nThere was an error while clearing the services. Contact the system administrator. \n </body>\n</html>"; } else { JsonObject message = new JsonObject(); message.add("message", new JsonPrimitive("There was an error while clearing the services. Contact the system administrator.")); response = message.toString(); } // TODO: Add logging log.error("SAL Exception while deleting service", e); return Response.status(Status.INTERNAL_SERVER_ERROR).entity(response).build(); } }
java
@DELETE @Produces({MediaType.TEXT_HTML, "application/json"}) @ApiOperation(value = "Delete all the registered services", notes = "BE CAREFUL! You can lose all your data. It returns a message which confirms all the service deletions.") @ApiResponses( value = { @ApiResponse(code = 200, message = "Registry cleaned. All the services are deleted."), @ApiResponse(code = 304, message = "The services could not be cleared."), @ApiResponse(code = 403, message = "You have not got the appropriate permissions for clearing the services"), @ApiResponse(code = 500, message = "Internal error")}) public Response clearServices( @ApiParam(value = "Response message media type", allowableValues = "application/json,text/html") @HeaderParam("Accept") String accept) { // Check first that the user is allowed to upload a service // Subject currentUser = SecurityUtils.getSubject(); // if (!currentUser.isPermitted("services:delete")) { // log.warn("User without the appropriate permissions attempted to clear the services: " + currentUser.getPrincipal()); // // String htmlString = "<html>\n <head>\n <meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n </head>\n" + // " <body>\n You have not got the appropriate permissions for clearing the services. Please login and ensure you have the correct permissions. </body>\n</html>"; // // return Response.status(Response.Status.FORBIDDEN).entity(htmlString).build(); // } URI serviceUri = uriInfo.getRequestUri(); String response; try { if (manager.getServiceManager().clearServices()) { // The registry was cleared if (accept.contains(MediaType.TEXT_HTML)) { response = "<html>\n <head>\n <meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n </head>\n" + " <body>\n The services have been cleared.\n </body>\n</html>"; } else { JsonObject message = new JsonObject(); message.add("message", new JsonPrimitive("The services have been cleared.")); response = message.toString(); } return Response.status(Status.OK).contentLocation(serviceUri).entity(response).build(); } else { // The registry was not cleared if (accept.contains(MediaType.TEXT_HTML)) { response = "<html>\n <head>\n <meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n </head>\n" + " <body>\n The services could not be cleared. Try again or contact a server administrator.\n </body>\n</html>"; } else { JsonObject message = new JsonObject(); message.add("message", new JsonPrimitive("The services could not be cleared. Try again or contact a server administrator.")); response = message.toString(); } return Response.status(Status.NOT_MODIFIED).contentLocation(serviceUri).entity(response).build(); } } catch (SalException e) { if (accept.contains(MediaType.TEXT_HTML)) { response = "<html>\n <head>\n <meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n </head>\n" + "<body>\nThere was an error while clearing the services. Contact the system administrator. \n </body>\n</html>"; } else { JsonObject message = new JsonObject(); message.add("message", new JsonPrimitive("There was an error while clearing the services. Contact the system administrator.")); response = message.toString(); } // TODO: Add logging log.error("SAL Exception while deleting service", e); return Response.status(Status.INTERNAL_SERVER_ERROR).entity(response).build(); } }
[ "@", "DELETE", "@", "Produces", "(", "{", "MediaType", ".", "TEXT_HTML", ",", "\"application/json\"", "}", ")", "@", "ApiOperation", "(", "value", "=", "\"Delete all the registered services\"", ",", "notes", "=", "\"BE CAREFUL! You can lose all your data. It returns a message which confirms all the service deletions.\"", ")", "@", "ApiResponses", "(", "value", "=", "{", "@", "ApiResponse", "(", "code", "=", "200", ",", "message", "=", "\"Registry cleaned. All the services are deleted.\"", ")", ",", "@", "ApiResponse", "(", "code", "=", "304", ",", "message", "=", "\"The services could not be cleared.\"", ")", ",", "@", "ApiResponse", "(", "code", "=", "403", ",", "message", "=", "\"You have not got the appropriate permissions for clearing the services\"", ")", ",", "@", "ApiResponse", "(", "code", "=", "500", ",", "message", "=", "\"Internal error\"", ")", "}", ")", "public", "Response", "clearServices", "(", "@", "ApiParam", "(", "value", "=", "\"Response message media type\"", ",", "allowableValues", "=", "\"application/json,text/html\"", ")", "@", "HeaderParam", "(", "\"Accept\"", ")", "String", "accept", ")", "{", "// Check first that the user is allowed to upload a service", "// Subject currentUser = SecurityUtils.getSubject();", "// if (!currentUser.isPermitted(\"services:delete\")) {", "// log.warn(\"User without the appropriate permissions attempted to clear the services: \" + currentUser.getPrincipal());", "//", "// String htmlString = \"<html>\\n <head>\\n <meta http-equiv=\\\"content-type\\\" content=\\\"text/html; charset=UTF-8\\\">\\n </head>\\n\" +", "// \" <body>\\n You have not got the appropriate permissions for clearing the services. Please login and ensure you have the correct permissions. </body>\\n</html>\";", "//", "// return Response.status(Response.Status.FORBIDDEN).entity(htmlString).build();", "// }", "URI", "serviceUri", "=", "uriInfo", ".", "getRequestUri", "(", ")", ";", "String", "response", ";", "try", "{", "if", "(", "manager", ".", "getServiceManager", "(", ")", ".", "clearServices", "(", ")", ")", "{", "// The registry was cleared", "if", "(", "accept", ".", "contains", "(", "MediaType", ".", "TEXT_HTML", ")", ")", "{", "response", "=", "\"<html>\\n <head>\\n <meta http-equiv=\\\"content-type\\\" content=\\\"text/html; charset=UTF-8\\\">\\n </head>\\n\"", "+", "\" <body>\\n The services have been cleared.\\n </body>\\n</html>\"", ";", "}", "else", "{", "JsonObject", "message", "=", "new", "JsonObject", "(", ")", ";", "message", ".", "add", "(", "\"message\"", ",", "new", "JsonPrimitive", "(", "\"The services have been cleared.\"", ")", ")", ";", "response", "=", "message", ".", "toString", "(", ")", ";", "}", "return", "Response", ".", "status", "(", "Status", ".", "OK", ")", ".", "contentLocation", "(", "serviceUri", ")", ".", "entity", "(", "response", ")", ".", "build", "(", ")", ";", "}", "else", "{", "// The registry was not cleared", "if", "(", "accept", ".", "contains", "(", "MediaType", ".", "TEXT_HTML", ")", ")", "{", "response", "=", "\"<html>\\n <head>\\n <meta http-equiv=\\\"content-type\\\" content=\\\"text/html; charset=UTF-8\\\">\\n </head>\\n\"", "+", "\" <body>\\n The services could not be cleared. Try again or contact a server administrator.\\n </body>\\n</html>\"", ";", "}", "else", "{", "JsonObject", "message", "=", "new", "JsonObject", "(", ")", ";", "message", ".", "add", "(", "\"message\"", ",", "new", "JsonPrimitive", "(", "\"The services could not be cleared. Try again or contact a server administrator.\"", ")", ")", ";", "response", "=", "message", ".", "toString", "(", ")", ";", "}", "return", "Response", ".", "status", "(", "Status", ".", "NOT_MODIFIED", ")", ".", "contentLocation", "(", "serviceUri", ")", ".", "entity", "(", "response", ")", ".", "build", "(", ")", ";", "}", "}", "catch", "(", "SalException", "e", ")", "{", "if", "(", "accept", ".", "contains", "(", "MediaType", ".", "TEXT_HTML", ")", ")", "{", "response", "=", "\"<html>\\n <head>\\n <meta http-equiv=\\\"content-type\\\" content=\\\"text/html; charset=UTF-8\\\">\\n </head>\\n\"", "+", "\"<body>\\nThere was an error while clearing the services. Contact the system administrator. \\n </body>\\n</html>\"", ";", "}", "else", "{", "JsonObject", "message", "=", "new", "JsonObject", "(", ")", ";", "message", ".", "add", "(", "\"message\"", ",", "new", "JsonPrimitive", "(", "\"There was an error while clearing the services. Contact the system administrator.\"", ")", ")", ";", "response", "=", "message", ".", "toString", "(", ")", ";", "}", "// TODO: Add logging", "log", ".", "error", "(", "\"SAL Exception while deleting service\"", ",", "e", ")", ";", "return", "Response", ".", "status", "(", "Status", ".", "INTERNAL_SERVER_ERROR", ")", ".", "entity", "(", "response", ")", ".", "build", "(", ")", ";", "}", "}" ]
Clears the services registry From HTTP Method definition 9.7 DELETE A successful response SHOULD be 200 (OK) if the response includes an entity describing the status, 202 (Accepted) if the action has not yet been enacted, or 204 (No Content) if the action has been enacted but the response does not include an entity. @return
[ "Clears", "the", "services", "registry" ]
13e7016e64c1d5a539b838c6debf1a5cc4aefcb7
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-rest/src/main/java/uk/ac/open/kmi/iserve/rest/sal/resource/ServicesResource.java#L398-L464
147,755
opendatatrentino/s-match
src/main/java/it/unitn/disi/smatch/matchers/element/string/GPrefix.java
GPrefix.matchPrefix
private char matchPrefix(String str1, String str2) { //here always str1.startsWith(str2) colorless!color char rel = IMappingElement.IDK; int spacePos1 = str1.indexOf(' '); String suffix = str1.substring(str2.length()); if (-1 < spacePos1 && !suffixes.containsKey(suffix)) {//check suffixes - pole vault=pole vaulter if (str2.length() == spacePos1) {//plant part<plant rel = IMappingElement.LESS_GENERAL; } else {//plant part<plan String left = str1.substring(0, spacePos1); char secondRel = match(left, str2); if (IMappingElement.MORE_GENERAL == secondRel || IMappingElement.EQUIVALENCE == secondRel) { rel = IMappingElement.LESS_GENERAL; } else { //?,<,! rel = secondRel; } } } else { //spelling: -tree and tree if (suffix.startsWith("-")) { suffix = suffix.substring(1); } if (suffix.endsWith("-") || suffix.endsWith(";") || suffix.endsWith(".") || suffix.endsWith(",") || suffix.endsWith("-")) { suffix = suffix.substring(0, suffix.length() - 1); } if (suffixes.containsKey(suffix)) { rel = suffixes.get(suffix); rel = reverseRelation(rel); } //another approximation = Gversion4 // if (rel == MatchManager.LESS_GENERAL || rel == MatchManager.MORE_GENERAL) { // rel = MatchManager.EQUIVALENCE; // } } //filter = Gversion3 // if (MatchManager.LESS_GENERAL == rel || MatchManager.MORE_GENERAL == rel) { // rel = MatchManager.EQUIVALENCE; // } return rel; }
java
private char matchPrefix(String str1, String str2) { //here always str1.startsWith(str2) colorless!color char rel = IMappingElement.IDK; int spacePos1 = str1.indexOf(' '); String suffix = str1.substring(str2.length()); if (-1 < spacePos1 && !suffixes.containsKey(suffix)) {//check suffixes - pole vault=pole vaulter if (str2.length() == spacePos1) {//plant part<plant rel = IMappingElement.LESS_GENERAL; } else {//plant part<plan String left = str1.substring(0, spacePos1); char secondRel = match(left, str2); if (IMappingElement.MORE_GENERAL == secondRel || IMappingElement.EQUIVALENCE == secondRel) { rel = IMappingElement.LESS_GENERAL; } else { //?,<,! rel = secondRel; } } } else { //spelling: -tree and tree if (suffix.startsWith("-")) { suffix = suffix.substring(1); } if (suffix.endsWith("-") || suffix.endsWith(";") || suffix.endsWith(".") || suffix.endsWith(",") || suffix.endsWith("-")) { suffix = suffix.substring(0, suffix.length() - 1); } if (suffixes.containsKey(suffix)) { rel = suffixes.get(suffix); rel = reverseRelation(rel); } //another approximation = Gversion4 // if (rel == MatchManager.LESS_GENERAL || rel == MatchManager.MORE_GENERAL) { // rel = MatchManager.EQUIVALENCE; // } } //filter = Gversion3 // if (MatchManager.LESS_GENERAL == rel || MatchManager.MORE_GENERAL == rel) { // rel = MatchManager.EQUIVALENCE; // } return rel; }
[ "private", "char", "matchPrefix", "(", "String", "str1", ",", "String", "str2", ")", "{", "//here always str1.startsWith(str2) colorless!color\r", "char", "rel", "=", "IMappingElement", ".", "IDK", ";", "int", "spacePos1", "=", "str1", ".", "indexOf", "(", "'", "'", ")", ";", "String", "suffix", "=", "str1", ".", "substring", "(", "str2", ".", "length", "(", ")", ")", ";", "if", "(", "-", "1", "<", "spacePos1", "&&", "!", "suffixes", ".", "containsKey", "(", "suffix", ")", ")", "{", "//check suffixes - pole vault=pole vaulter\r", "if", "(", "str2", ".", "length", "(", ")", "==", "spacePos1", ")", "{", "//plant part<plant\r", "rel", "=", "IMappingElement", ".", "LESS_GENERAL", ";", "}", "else", "{", "//plant part<plan\r", "String", "left", "=", "str1", ".", "substring", "(", "0", ",", "spacePos1", ")", ";", "char", "secondRel", "=", "match", "(", "left", ",", "str2", ")", ";", "if", "(", "IMappingElement", ".", "MORE_GENERAL", "==", "secondRel", "||", "IMappingElement", ".", "EQUIVALENCE", "==", "secondRel", ")", "{", "rel", "=", "IMappingElement", ".", "LESS_GENERAL", ";", "}", "else", "{", "//?,<,!\r", "rel", "=", "secondRel", ";", "}", "}", "}", "else", "{", "//spelling: -tree and tree\r", "if", "(", "suffix", ".", "startsWith", "(", "\"-\"", ")", ")", "{", "suffix", "=", "suffix", ".", "substring", "(", "1", ")", ";", "}", "if", "(", "suffix", ".", "endsWith", "(", "\"-\"", ")", "||", "suffix", ".", "endsWith", "(", "\";\"", ")", "||", "suffix", ".", "endsWith", "(", "\".\"", ")", "||", "suffix", ".", "endsWith", "(", "\",\"", ")", "||", "suffix", ".", "endsWith", "(", "\"-\"", ")", ")", "{", "suffix", "=", "suffix", ".", "substring", "(", "0", ",", "suffix", ".", "length", "(", ")", "-", "1", ")", ";", "}", "if", "(", "suffixes", ".", "containsKey", "(", "suffix", ")", ")", "{", "rel", "=", "suffixes", ".", "get", "(", "suffix", ")", ";", "rel", "=", "reverseRelation", "(", "rel", ")", ";", "}", "//another approximation = Gversion4\r", "// if (rel == MatchManager.LESS_GENERAL || rel == MatchManager.MORE_GENERAL) {\r", "// rel = MatchManager.EQUIVALENCE;\r", "// }\r", "}", "//filter = Gversion3\r", "// if (MatchManager.LESS_GENERAL == rel || MatchManager.MORE_GENERAL == rel) {\r", "// rel = MatchManager.EQUIVALENCE;\r", "// }\r", "return", "rel", ";", "}" ]
Computes relation with prefix matcher. @param str1 the source input @param str2 the target input @return synonym, more general, less general or IDK relation
[ "Computes", "relation", "with", "prefix", "matcher", "." ]
ba5982ef406b7010c2f92592e43887a485935aa1
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/matchers/element/string/GPrefix.java#L607-L650
147,756
synchronoss/cpo-api
cpo-core/src/main/java/org/synchronoss/cpo/exporter/CpoClassSourceGenerator.java
CpoClassSourceGenerator.reset
protected void reset() { attributeStatics = new StringBuilder(); functionGroupStatics = new StringBuilder(); properties = new StringBuilder(); constructor = new StringBuilder(); gettersSetters = new StringBuilder(); equals = new StringBuilder(); hashCode = new StringBuilder(); toString = new StringBuilder(); footer = new StringBuilder(); }
java
protected void reset() { attributeStatics = new StringBuilder(); functionGroupStatics = new StringBuilder(); properties = new StringBuilder(); constructor = new StringBuilder(); gettersSetters = new StringBuilder(); equals = new StringBuilder(); hashCode = new StringBuilder(); toString = new StringBuilder(); footer = new StringBuilder(); }
[ "protected", "void", "reset", "(", ")", "{", "attributeStatics", "=", "new", "StringBuilder", "(", ")", ";", "functionGroupStatics", "=", "new", "StringBuilder", "(", ")", ";", "properties", "=", "new", "StringBuilder", "(", ")", ";", "constructor", "=", "new", "StringBuilder", "(", ")", ";", "gettersSetters", "=", "new", "StringBuilder", "(", ")", ";", "equals", "=", "new", "StringBuilder", "(", ")", ";", "hashCode", "=", "new", "StringBuilder", "(", ")", ";", "toString", "=", "new", "StringBuilder", "(", ")", ";", "footer", "=", "new", "StringBuilder", "(", ")", ";", "}" ]
Resets all of the buffers. This is needed if you intend to reuse the visitor. This is always called by visit(CpoClass)
[ "Resets", "all", "of", "the", "buffers", "." ]
dc745aca3b3206abf80b85d9689b0132f5baa694
https://github.com/synchronoss/cpo-api/blob/dc745aca3b3206abf80b85d9689b0132f5baa694/cpo-core/src/main/java/org/synchronoss/cpo/exporter/CpoClassSourceGenerator.java#L62-L72
147,757
synchronoss/cpo-api
cpo-core/src/main/java/org/synchronoss/cpo/exporter/CpoClassSourceGenerator.java
CpoClassSourceGenerator.generateInterfaceName
protected String generateInterfaceName(CpoClass cpoClass) { String className = cpoClass.getName(); if (className.lastIndexOf(".") != -1) { className = className.substring(className.lastIndexOf(".") + 1); } return className; }
java
protected String generateInterfaceName(CpoClass cpoClass) { String className = cpoClass.getName(); if (className.lastIndexOf(".") != -1) { className = className.substring(className.lastIndexOf(".") + 1); } return className; }
[ "protected", "String", "generateInterfaceName", "(", "CpoClass", "cpoClass", ")", "{", "String", "className", "=", "cpoClass", ".", "getName", "(", ")", ";", "if", "(", "className", ".", "lastIndexOf", "(", "\".\"", ")", "!=", "-", "1", ")", "{", "className", "=", "className", ".", "substring", "(", "className", ".", "lastIndexOf", "(", "\".\"", ")", "+", "1", ")", ";", "}", "return", "className", ";", "}" ]
The cpoClass name will be used for the name of the interface
[ "The", "cpoClass", "name", "will", "be", "used", "for", "the", "name", "of", "the", "interface" ]
dc745aca3b3206abf80b85d9689b0132f5baa694
https://github.com/synchronoss/cpo-api/blob/dc745aca3b3206abf80b85d9689b0132f5baa694/cpo-core/src/main/java/org/synchronoss/cpo/exporter/CpoClassSourceGenerator.java#L133-L139
147,758
pulse00/Composer-Java-Bindings
java-api/src/main/java/com/dubture/getcomposer/core/entities/Entity.java
Entity.firePropertyChange
protected void firePropertyChange(String propertyName, Object oldValue, Object newValue) { if (oldValue instanceof JsonValue) { oldValue = getRawObject((JsonValue)oldValue); } if (newValue instanceof JsonValue) { newValue = getRawObject((JsonValue)newValue); } changeSupport.firePropertyChange(propertyName, oldValue, newValue); }
java
protected void firePropertyChange(String propertyName, Object oldValue, Object newValue) { if (oldValue instanceof JsonValue) { oldValue = getRawObject((JsonValue)oldValue); } if (newValue instanceof JsonValue) { newValue = getRawObject((JsonValue)newValue); } changeSupport.firePropertyChange(propertyName, oldValue, newValue); }
[ "protected", "void", "firePropertyChange", "(", "String", "propertyName", ",", "Object", "oldValue", ",", "Object", "newValue", ")", "{", "if", "(", "oldValue", "instanceof", "JsonValue", ")", "{", "oldValue", "=", "getRawObject", "(", "(", "JsonValue", ")", "oldValue", ")", ";", "}", "if", "(", "newValue", "instanceof", "JsonValue", ")", "{", "newValue", "=", "getRawObject", "(", "(", "JsonValue", ")", "newValue", ")", ";", "}", "changeSupport", ".", "firePropertyChange", "(", "propertyName", ",", "oldValue", ",", "newValue", ")", ";", "}" ]
Notify listeners that a property has changed its value @param propertyName @param oldValue @param newValue
[ "Notify", "listeners", "that", "a", "property", "has", "changed", "its", "value" ]
0aa572567db37d047a41a57c32ede7c7fd5d4938
https://github.com/pulse00/Composer-Java-Bindings/blob/0aa572567db37d047a41a57c32ede7c7fd5d4938/java-api/src/main/java/com/dubture/getcomposer/core/entities/Entity.java#L58-L70
147,759
netceteragroup/trema-core
src/main/java/com/netcetera/trema/core/Status.java
Status.getAvailableStatusNames
public static String[] getAvailableStatusNames() { List<String> nameList = new ArrayList<>(); for (Status status : INSTANCES.values()) { nameList.add(status.getName()); } return nameList.toArray(new String[nameList.size()]); }
java
public static String[] getAvailableStatusNames() { List<String> nameList = new ArrayList<>(); for (Status status : INSTANCES.values()) { nameList.add(status.getName()); } return nameList.toArray(new String[nameList.size()]); }
[ "public", "static", "String", "[", "]", "getAvailableStatusNames", "(", ")", "{", "List", "<", "String", ">", "nameList", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "Status", "status", ":", "INSTANCES", ".", "values", "(", ")", ")", "{", "nameList", ".", "add", "(", "status", ".", "getName", "(", ")", ")", ";", "}", "return", "nameList", ".", "toArray", "(", "new", "String", "[", "nameList", ".", "size", "(", ")", "]", ")", ";", "}" ]
Gets the available status names in ascending order of their corresponding status. @return the available status names in ascending order of their corresponding status.
[ "Gets", "the", "available", "status", "names", "in", "ascending", "order", "of", "their", "corresponding", "status", "." ]
e5367f4b80b38038d462627aa146a62bc34fc489
https://github.com/netceteragroup/trema-core/blob/e5367f4b80b38038d462627aa146a62bc34fc489/src/main/java/com/netcetera/trema/core/Status.java#L147-L153
147,760
yfpeng/pengyifan-bioc
src/main/java/com/pengyifan/bioc/io/BioCDocumentReader.java
BioCDocumentReader.readDocument
public BioCDocument readDocument() throws XMLStreamException { if (reader.document != null) { BioCDocument thisDocument = reader.document; reader.read(); return thisDocument; } else { return null; } }
java
public BioCDocument readDocument() throws XMLStreamException { if (reader.document != null) { BioCDocument thisDocument = reader.document; reader.read(); return thisDocument; } else { return null; } }
[ "public", "BioCDocument", "readDocument", "(", ")", "throws", "XMLStreamException", "{", "if", "(", "reader", ".", "document", "!=", "null", ")", "{", "BioCDocument", "thisDocument", "=", "reader", ".", "document", ";", "reader", ".", "read", "(", ")", ";", "return", "thisDocument", ";", "}", "else", "{", "return", "null", ";", "}", "}" ]
Reads one BioC document from the XML file. @return the BioC document @throws XMLStreamException if an unexpected processing error occurs
[ "Reads", "one", "BioC", "document", "from", "the", "XML", "file", "." ]
e09cce1969aa598ff89e7957237375715d7a1a3a
https://github.com/yfpeng/pengyifan-bioc/blob/e09cce1969aa598ff89e7957237375715d7a1a3a/src/main/java/com/pengyifan/bioc/io/BioCDocumentReader.java#L143-L153
147,761
mlhartme/sushi
src/main/java/net/oneandone/sushi/fs/ssh/Process.java
Process.waitFor
public void waitFor(long timeout) throws JSchException, ExitCode, InterruptedException { long deadline; try { deadline = System.currentTimeMillis() + timeout; while (!channel.isClosed()) { if (System.currentTimeMillis() >= deadline) { throw new TimeoutException(this); } Thread.sleep(100); // throws InterruptedException } if (channel.getExitStatus() != 0) { throw new ExitCode(new Launcher(command), channel.getExitStatus()); } } finally { channel.disconnect(); } }
java
public void waitFor(long timeout) throws JSchException, ExitCode, InterruptedException { long deadline; try { deadline = System.currentTimeMillis() + timeout; while (!channel.isClosed()) { if (System.currentTimeMillis() >= deadline) { throw new TimeoutException(this); } Thread.sleep(100); // throws InterruptedException } if (channel.getExitStatus() != 0) { throw new ExitCode(new Launcher(command), channel.getExitStatus()); } } finally { channel.disconnect(); } }
[ "public", "void", "waitFor", "(", "long", "timeout", ")", "throws", "JSchException", ",", "ExitCode", ",", "InterruptedException", "{", "long", "deadline", ";", "try", "{", "deadline", "=", "System", ".", "currentTimeMillis", "(", ")", "+", "timeout", ";", "while", "(", "!", "channel", ".", "isClosed", "(", ")", ")", "{", "if", "(", "System", ".", "currentTimeMillis", "(", ")", ">=", "deadline", ")", "{", "throw", "new", "TimeoutException", "(", "this", ")", ";", "}", "Thread", ".", "sleep", "(", "100", ")", ";", "// throws InterruptedException", "}", "if", "(", "channel", ".", "getExitStatus", "(", ")", "!=", "0", ")", "{", "throw", "new", "ExitCode", "(", "new", "Launcher", "(", "command", ")", ",", "channel", ".", "getExitStatus", "(", ")", ")", ";", "}", "}", "finally", "{", "channel", ".", "disconnect", "(", ")", ";", "}", "}" ]
Waits for termination. @param timeout CAUTION: &lt;= 0 immediately times out
[ "Waits", "for", "termination", "." ]
4af33414b04bd58584d4febe5cc63ef6c7346a75
https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/fs/ssh/Process.java#L84-L101
147,762
synchronoss/cpo-api
cpo-jdbc/src/main/java/org/synchronoss/cpo/transform/jdbc/TransformNoOp.java
TransformNoOp.transformIn
@Override public Integer transformIn(Integer dbIn) throws CpoException { logger.debug("Inside TransformNoOp::transformIn(" + dbIn + ");"); return dbIn; }
java
@Override public Integer transformIn(Integer dbIn) throws CpoException { logger.debug("Inside TransformNoOp::transformIn(" + dbIn + ");"); return dbIn; }
[ "@", "Override", "public", "Integer", "transformIn", "(", "Integer", "dbIn", ")", "throws", "CpoException", "{", "logger", ".", "debug", "(", "\"Inside TransformNoOp::transformIn(\"", "+", "dbIn", "+", "\");\"", ")", ";", "return", "dbIn", ";", "}" ]
Transforms the datasource object into an object required by the class. The type of the dbIn parameter and the type of the return value must change to match the types being converted. Reflection is used to true everything up at runtime. e.g public byte[] transformIn(Blob dbIn) would be the signature for converting a Blob to a byte[] to be stored in the pojo. @param dbIn The value from the datasource that will be transformed into the format that is required by the pojo. @return The object to be stored in the attribute @throws CpoException
[ "Transforms", "the", "datasource", "object", "into", "an", "object", "required", "by", "the", "class", ".", "The", "type", "of", "the", "dbIn", "parameter", "and", "the", "type", "of", "the", "return", "value", "must", "change", "to", "match", "the", "types", "being", "converted", ".", "Reflection", "is", "used", "to", "true", "everything", "up", "at", "runtime", "." ]
dc745aca3b3206abf80b85d9689b0132f5baa694
https://github.com/synchronoss/cpo-api/blob/dc745aca3b3206abf80b85d9689b0132f5baa694/cpo-jdbc/src/main/java/org/synchronoss/cpo/transform/jdbc/TransformNoOp.java#L54-L58
147,763
awltech/org.parallelj
parallelj-core-parent/parallelj-core-api/src/main/java/org/parallelj/internal/kernel/KReflection.java
KReflection.dispatch
public void dispatch(Event<?> event) { //eventManagement.dispatch(event); for (EventListener listener : KReflection.Holder.INSTANCE.listeners) { try { listener.handleEvent(event); } catch (Exception e) { // ignore // TODO add message kind } } }
java
public void dispatch(Event<?> event) { //eventManagement.dispatch(event); for (EventListener listener : KReflection.Holder.INSTANCE.listeners) { try { listener.handleEvent(event); } catch (Exception e) { // ignore // TODO add message kind } } }
[ "public", "void", "dispatch", "(", "Event", "<", "?", ">", "event", ")", "{", "//eventManagement.dispatch(event);", "for", "(", "EventListener", "listener", ":", "KReflection", ".", "Holder", ".", "INSTANCE", ".", "listeners", ")", "{", "try", "{", "listener", ".", "handleEvent", "(", "event", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "// ignore", "// TODO add message kind", "}", "}", "}" ]
Dispatch an event to all listeners. @param event the event to dispatch
[ "Dispatch", "an", "event", "to", "all", "listeners", "." ]
2a2498cc4ac6227df6f45d295ec568cad3cffbc4
https://github.com/awltech/org.parallelj/blob/2a2498cc4ac6227df6f45d295ec568cad3cffbc4/parallelj-core-parent/parallelj-core-api/src/main/java/org/parallelj/internal/kernel/KReflection.java#L257-L267
147,764
opendatatrentino/s-match
src/main/java/it/unitn/disi/smatch/deciders/CachingSolver.java
CachingSolver.isSatisfiable
public boolean isSatisfiable(String input) throws SATSolverException { Boolean result = solutionsCache.get(input); if (null == result) { result = satSolver.isSatisfiable(input); solutionsCache.put(input, result); } return result; }
java
public boolean isSatisfiable(String input) throws SATSolverException { Boolean result = solutionsCache.get(input); if (null == result) { result = satSolver.isSatisfiable(input); solutionsCache.put(input, result); } return result; }
[ "public", "boolean", "isSatisfiable", "(", "String", "input", ")", "throws", "SATSolverException", "{", "Boolean", "result", "=", "solutionsCache", ".", "get", "(", "input", ")", ";", "if", "(", "null", "==", "result", ")", "{", "result", "=", "satSolver", ".", "isSatisfiable", "(", "input", ")", ";", "solutionsCache", ".", "put", "(", "input", ",", "result", ")", ";", "}", "return", "result", ";", "}" ]
Calls the solver and caches the answer. @param input The String that contains sat problem in DIMACS's format @return boolean True if the formula is satisfiable, false otherwise @throws SATSolverException SATSolverException
[ "Calls", "the", "solver", "and", "caches", "the", "answer", "." ]
ba5982ef406b7010c2f92592e43887a485935aa1
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/deciders/CachingSolver.java#L51-L58
147,765
ZenHarbinger/l2fprod-properties-editor
src/main/java/com/l2fprod/common/beans/ExtendedPropertyDescriptor.java
ExtendedPropertyDescriptor.setReadOnly
public ExtendedPropertyDescriptor setReadOnly() { try { setWriteMethod(null); } catch (IntrospectionException e) { Logger.getLogger(ExtendedPropertyDescriptor.class.getName()).log(Level.SEVERE, null, e); } return this; }
java
public ExtendedPropertyDescriptor setReadOnly() { try { setWriteMethod(null); } catch (IntrospectionException e) { Logger.getLogger(ExtendedPropertyDescriptor.class.getName()).log(Level.SEVERE, null, e); } return this; }
[ "public", "ExtendedPropertyDescriptor", "setReadOnly", "(", ")", "{", "try", "{", "setWriteMethod", "(", "null", ")", ";", "}", "catch", "(", "IntrospectionException", "e", ")", "{", "Logger", ".", "getLogger", "(", "ExtendedPropertyDescriptor", ".", "class", ".", "getName", "(", ")", ")", ".", "log", "(", "Level", ".", "SEVERE", ",", "null", ",", "e", ")", ";", "}", "return", "this", ";", "}" ]
Force this property to be readonly. @return this property for chaining calls.
[ "Force", "this", "property", "to", "be", "readonly", "." ]
d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32
https://github.com/ZenHarbinger/l2fprod-properties-editor/blob/d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32/src/main/java/com/l2fprod/common/beans/ExtendedPropertyDescriptor.java#L122-L129
147,766
awltech/org.parallelj
parallelj-core-parent/parallelj-core-api/src/main/java/org/parallelj/internal/kernel/loop/KWhileLoop.java
KWhileLoop.complete
private void complete(KSplit split, KCall call) { reset(call.getProcess()); split.split(call); }
java
private void complete(KSplit split, KCall call) { reset(call.getProcess()); split.split(call); }
[ "private", "void", "complete", "(", "KSplit", "split", ",", "KCall", "call", ")", "{", "reset", "(", "call", ".", "getProcess", "(", ")", ")", ";", "split", ".", "split", "(", "call", ")", ";", "}" ]
Called at the end of a KWhileLoop @param split @param call @return void
[ "Called", "at", "the", "end", "of", "a", "KWhileLoop" ]
2a2498cc4ac6227df6f45d295ec568cad3cffbc4
https://github.com/awltech/org.parallelj/blob/2a2498cc4ac6227df6f45d295ec568cad3cffbc4/parallelj-core-parent/parallelj-core-api/src/main/java/org/parallelj/internal/kernel/loop/KWhileLoop.java#L145-L148
147,767
awltech/org.parallelj
parallelj-core-parent/parallelj-core-api/src/main/java/org/parallelj/internal/log/LogEntry.java
LogEntry.end
public void end(String state, String attributes) { this.end = System.currentTimeMillis();// - epoch; this.state = state; this.attributes = attributes; // System.out.println(this); }
java
public void end(String state, String attributes) { this.end = System.currentTimeMillis();// - epoch; this.state = state; this.attributes = attributes; // System.out.println(this); }
[ "public", "void", "end", "(", "String", "state", ",", "String", "attributes", ")", "{", "this", ".", "end", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "// - epoch;", "this", ".", "state", "=", "state", ";", "this", ".", "attributes", "=", "attributes", ";", "// System.out.println(this);", "}" ]
Called when it is ended @param state the final state @param attributes the attributes
[ "Called", "when", "it", "is", "ended" ]
2a2498cc4ac6227df6f45d295ec568cad3cffbc4
https://github.com/awltech/org.parallelj/blob/2a2498cc4ac6227df6f45d295ec568cad3cffbc4/parallelj-core-parent/parallelj-core-api/src/main/java/org/parallelj/internal/log/LogEntry.java#L116-L121
147,768
ZenHarbinger/l2fprod-properties-editor
src/main/java/com/l2fprod/common/util/ResourceManager.java
ResourceManager.get
public static ResourceManager get(String bundleName) { ResourceManager rm = (ResourceManager) nameToRM.get(bundleName); if (rm == null) { ResourceBundle rb = ResourceBundle.getBundle(bundleName); rm = new ResourceManager(rb); nameToRM.put(bundleName, rm); } return rm; }
java
public static ResourceManager get(String bundleName) { ResourceManager rm = (ResourceManager) nameToRM.get(bundleName); if (rm == null) { ResourceBundle rb = ResourceBundle.getBundle(bundleName); rm = new ResourceManager(rb); nameToRM.put(bundleName, rm); } return rm; }
[ "public", "static", "ResourceManager", "get", "(", "String", "bundleName", ")", "{", "ResourceManager", "rm", "=", "(", "ResourceManager", ")", "nameToRM", ".", "get", "(", "bundleName", ")", ";", "if", "(", "rm", "==", "null", ")", "{", "ResourceBundle", "rb", "=", "ResourceBundle", ".", "getBundle", "(", "bundleName", ")", ";", "rm", "=", "new", "ResourceManager", "(", "rb", ")", ";", "nameToRM", ".", "put", "(", "bundleName", ",", "rm", ")", ";", "}", "return", "rm", ";", "}" ]
Gets the ResourceManager with the given name. @param bundleName @return the ResourceManager with the given name.
[ "Gets", "the", "ResourceManager", "with", "the", "given", "name", "." ]
d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32
https://github.com/ZenHarbinger/l2fprod-properties-editor/blob/d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32/src/main/java/com/l2fprod/common/util/ResourceManager.java#L61-L69
147,769
opendatatrentino/s-match
src/main/java/it/unitn/disi/common/utils/MiscUtils.java
MiscUtils.configureLog4J
public static void configureLog4J() { String log4jConf = System.getProperty("log4j.configuration"); if (null != log4jConf) { PropertyConfigurator.configure(log4jConf); } else { System.err.println("No log4j.configuration property specified. Using defaults."); BasicConfigurator.configure(); } }
java
public static void configureLog4J() { String log4jConf = System.getProperty("log4j.configuration"); if (null != log4jConf) { PropertyConfigurator.configure(log4jConf); } else { System.err.println("No log4j.configuration property specified. Using defaults."); BasicConfigurator.configure(); } }
[ "public", "static", "void", "configureLog4J", "(", ")", "{", "String", "log4jConf", "=", "System", ".", "getProperty", "(", "\"log4j.configuration\"", ")", ";", "if", "(", "null", "!=", "log4jConf", ")", "{", "PropertyConfigurator", ".", "configure", "(", "log4jConf", ")", ";", "}", "else", "{", "System", ".", "err", ".", "println", "(", "\"No log4j.configuration property specified. Using defaults.\"", ")", ";", "BasicConfigurator", ".", "configure", "(", ")", ";", "}", "}" ]
Configures LOG4J using a configuration file given in a log4j.configuration system property.
[ "Configures", "LOG4J", "using", "a", "configuration", "file", "given", "in", "a", "log4j", ".", "configuration", "system", "property", "." ]
ba5982ef406b7010c2f92592e43887a485935aa1
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/common/utils/MiscUtils.java#L22-L30
147,770
opendatatrentino/s-match
src/main/java/it/unitn/disi/common/utils/MiscUtils.java
MiscUtils.writeObject
public static void writeObject(Object object, String fileName) throws DISIException { log.info("Writing " + fileName); try { FileOutputStream fos = new FileOutputStream(fileName); ObjectOutputStream oos = new ObjectOutputStream(fos); oos.writeObject(object); oos.close(); fos.close(); } catch (IOException e) { final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage(); log.error(errMessage, e); throw new DISIException(errMessage, e); } }
java
public static void writeObject(Object object, String fileName) throws DISIException { log.info("Writing " + fileName); try { FileOutputStream fos = new FileOutputStream(fileName); ObjectOutputStream oos = new ObjectOutputStream(fos); oos.writeObject(object); oos.close(); fos.close(); } catch (IOException e) { final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage(); log.error(errMessage, e); throw new DISIException(errMessage, e); } }
[ "public", "static", "void", "writeObject", "(", "Object", "object", ",", "String", "fileName", ")", "throws", "DISIException", "{", "log", ".", "info", "(", "\"Writing \"", "+", "fileName", ")", ";", "try", "{", "FileOutputStream", "fos", "=", "new", "FileOutputStream", "(", "fileName", ")", ";", "ObjectOutputStream", "oos", "=", "new", "ObjectOutputStream", "(", "fos", ")", ";", "oos", ".", "writeObject", "(", "object", ")", ";", "oos", ".", "close", "(", ")", ";", "fos", ".", "close", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "final", "String", "errMessage", "=", "e", ".", "getClass", "(", ")", ".", "getSimpleName", "(", ")", "+", "\": \"", "+", "e", ".", "getMessage", "(", ")", ";", "log", ".", "error", "(", "errMessage", ",", "e", ")", ";", "throw", "new", "DISIException", "(", "errMessage", ",", "e", ")", ";", "}", "}" ]
Writes Java object to a file. @param object the object @param fileName the file where the object will be written @throws DISIException DISIException
[ "Writes", "Java", "object", "to", "a", "file", "." ]
ba5982ef406b7010c2f92592e43887a485935aa1
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/common/utils/MiscUtils.java#L39-L52
147,771
opendatatrentino/s-match
src/main/java/it/unitn/disi/common/utils/MiscUtils.java
MiscUtils.readObject
public static Object readObject(String fileName, boolean isInternalFile) throws DISIException { Object result; try { InputStream fos = null; if (isInternalFile == true) { fos = Thread.currentThread().getContextClassLoader().getResource(fileName).openStream(); } else { fos = new FileInputStream(fileName); } BufferedInputStream bis = new BufferedInputStream(fos); ObjectInputStream oos = new ObjectInputStream(bis); try { result = oos.readObject(); } catch (IOException e) { final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage(); log.error(errMessage, e); throw new DISIException(errMessage, e); } catch (ClassNotFoundException e) { final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage(); log.error(errMessage, e); throw new DISIException(errMessage, e); } oos.close(); bis.close(); fos.close(); } catch (IOException e) { final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage(); log.error(errMessage, e); throw new DISIException(errMessage, e); } return result; }
java
public static Object readObject(String fileName, boolean isInternalFile) throws DISIException { Object result; try { InputStream fos = null; if (isInternalFile == true) { fos = Thread.currentThread().getContextClassLoader().getResource(fileName).openStream(); } else { fos = new FileInputStream(fileName); } BufferedInputStream bis = new BufferedInputStream(fos); ObjectInputStream oos = new ObjectInputStream(bis); try { result = oos.readObject(); } catch (IOException e) { final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage(); log.error(errMessage, e); throw new DISIException(errMessage, e); } catch (ClassNotFoundException e) { final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage(); log.error(errMessage, e); throw new DISIException(errMessage, e); } oos.close(); bis.close(); fos.close(); } catch (IOException e) { final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage(); log.error(errMessage, e); throw new DISIException(errMessage, e); } return result; }
[ "public", "static", "Object", "readObject", "(", "String", "fileName", ",", "boolean", "isInternalFile", ")", "throws", "DISIException", "{", "Object", "result", ";", "try", "{", "InputStream", "fos", "=", "null", ";", "if", "(", "isInternalFile", "==", "true", ")", "{", "fos", "=", "Thread", ".", "currentThread", "(", ")", ".", "getContextClassLoader", "(", ")", ".", "getResource", "(", "fileName", ")", ".", "openStream", "(", ")", ";", "}", "else", "{", "fos", "=", "new", "FileInputStream", "(", "fileName", ")", ";", "}", "BufferedInputStream", "bis", "=", "new", "BufferedInputStream", "(", "fos", ")", ";", "ObjectInputStream", "oos", "=", "new", "ObjectInputStream", "(", "bis", ")", ";", "try", "{", "result", "=", "oos", ".", "readObject", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "final", "String", "errMessage", "=", "e", ".", "getClass", "(", ")", ".", "getSimpleName", "(", ")", "+", "\": \"", "+", "e", ".", "getMessage", "(", ")", ";", "log", ".", "error", "(", "errMessage", ",", "e", ")", ";", "throw", "new", "DISIException", "(", "errMessage", ",", "e", ")", ";", "}", "catch", "(", "ClassNotFoundException", "e", ")", "{", "final", "String", "errMessage", "=", "e", ".", "getClass", "(", ")", ".", "getSimpleName", "(", ")", "+", "\": \"", "+", "e", ".", "getMessage", "(", ")", ";", "log", ".", "error", "(", "errMessage", ",", "e", ")", ";", "throw", "new", "DISIException", "(", "errMessage", ",", "e", ")", ";", "}", "oos", ".", "close", "(", ")", ";", "bis", ".", "close", "(", ")", ";", "fos", ".", "close", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "final", "String", "errMessage", "=", "e", ".", "getClass", "(", ")", ".", "getSimpleName", "(", ")", "+", "\": \"", "+", "e", ".", "getMessage", "(", ")", ";", "log", ".", "error", "(", "errMessage", ",", "e", ")", ";", "throw", "new", "DISIException", "(", "errMessage", ",", "e", ")", ";", "}", "return", "result", ";", "}" ]
Reads Java object from a file. @param fileName the file where the object is stored @parm isInternalFile reads from internal data file in resources folder @return the object @throws DISIException DISIException
[ "Reads", "Java", "object", "from", "a", "file", "." ]
ba5982ef406b7010c2f92592e43887a485935aa1
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/common/utils/MiscUtils.java#L62-L95
147,772
synchronoss/cpo-api
cpo-core/src/main/java/org/synchronoss/cpo/Node.java
Node.release
public void release() { parent = null; firstChild = null; prevSibling = null; nextSibling = null; allowChildren = true; }
java
public void release() { parent = null; firstChild = null; prevSibling = null; nextSibling = null; allowChildren = true; }
[ "public", "void", "release", "(", ")", "{", "parent", "=", "null", ";", "firstChild", "=", "null", ";", "prevSibling", "=", "null", ";", "nextSibling", "=", "null", ";", "allowChildren", "=", "true", ";", "}" ]
Resets all the attributes to their default state.
[ "Resets", "all", "the", "attributes", "to", "their", "default", "state", "." ]
dc745aca3b3206abf80b85d9689b0132f5baa694
https://github.com/synchronoss/cpo-api/blob/dc745aca3b3206abf80b85d9689b0132f5baa694/cpo-core/src/main/java/org/synchronoss/cpo/Node.java#L103-L110
147,773
synchronoss/cpo-api
cpo-core/src/main/java/org/synchronoss/cpo/Node.java
Node.addChild
public void addChild(Node node) throws ChildNodeException { if (node != null) { if (!allowChildren) { throw new ChildNodeException(); } if (getFirstChild() == null) { setFirstChild(node); getFirstChild().setPrevSibling(firstChild); getFirstChild().setNextSibling(firstChild); } else { // Add it to the end of the list Node lastChild = getFirstChild().getPrevSibling(); if (lastChild != null) { lastChild.setNextSibling(node); } node.setNextSibling(getFirstChild()); } node.setParent(this); } }
java
public void addChild(Node node) throws ChildNodeException { if (node != null) { if (!allowChildren) { throw new ChildNodeException(); } if (getFirstChild() == null) { setFirstChild(node); getFirstChild().setPrevSibling(firstChild); getFirstChild().setNextSibling(firstChild); } else { // Add it to the end of the list Node lastChild = getFirstChild().getPrevSibling(); if (lastChild != null) { lastChild.setNextSibling(node); } node.setNextSibling(getFirstChild()); } node.setParent(this); } }
[ "public", "void", "addChild", "(", "Node", "node", ")", "throws", "ChildNodeException", "{", "if", "(", "node", "!=", "null", ")", "{", "if", "(", "!", "allowChildren", ")", "{", "throw", "new", "ChildNodeException", "(", ")", ";", "}", "if", "(", "getFirstChild", "(", ")", "==", "null", ")", "{", "setFirstChild", "(", "node", ")", ";", "getFirstChild", "(", ")", ".", "setPrevSibling", "(", "firstChild", ")", ";", "getFirstChild", "(", ")", ".", "setNextSibling", "(", "firstChild", ")", ";", "}", "else", "{", "// Add it to the end of the list", "Node", "lastChild", "=", "getFirstChild", "(", ")", ".", "getPrevSibling", "(", ")", ";", "if", "(", "lastChild", "!=", "null", ")", "{", "lastChild", ".", "setNextSibling", "(", "node", ")", ";", "}", "node", ".", "setNextSibling", "(", "getFirstChild", "(", ")", ")", ";", "}", "node", ".", "setParent", "(", "this", ")", ";", "}", "}" ]
This function adds a child to the linked-list of children for this node. It adds the child to the end of the list. @param node Node that is the node to be added as a child of this Node. @throws ChildNodeException
[ "This", "function", "adds", "a", "child", "to", "the", "linked", "-", "list", "of", "children", "for", "this", "node", ".", "It", "adds", "the", "child", "to", "the", "end", "of", "the", "list", "." ]
dc745aca3b3206abf80b85d9689b0132f5baa694
https://github.com/synchronoss/cpo-api/blob/dc745aca3b3206abf80b85d9689b0132f5baa694/cpo-core/src/main/java/org/synchronoss/cpo/Node.java#L205-L224
147,774
synchronoss/cpo-api
cpo-core/src/main/java/org/synchronoss/cpo/Node.java
Node.insertSiblingBefore
public void insertSiblingBefore(Node node) throws ChildNodeException { if (node != null) { node.setPrevSibling(getPrevSibling()); node.setNextSibling(this); } }
java
public void insertSiblingBefore(Node node) throws ChildNodeException { if (node != null) { node.setPrevSibling(getPrevSibling()); node.setNextSibling(this); } }
[ "public", "void", "insertSiblingBefore", "(", "Node", "node", ")", "throws", "ChildNodeException", "{", "if", "(", "node", "!=", "null", ")", "{", "node", ".", "setPrevSibling", "(", "getPrevSibling", "(", ")", ")", ";", "node", ".", "setNextSibling", "(", "this", ")", ";", "}", "}" ]
Inserts a Sibling into the linked list just prior to this Node @param node Node to be made the prevSibling
[ "Inserts", "a", "Sibling", "into", "the", "linked", "list", "just", "prior", "to", "this", "Node" ]
dc745aca3b3206abf80b85d9689b0132f5baa694
https://github.com/synchronoss/cpo-api/blob/dc745aca3b3206abf80b85d9689b0132f5baa694/cpo-core/src/main/java/org/synchronoss/cpo/Node.java#L294-L299
147,775
synchronoss/cpo-api
cpo-core/src/main/java/org/synchronoss/cpo/Node.java
Node.insertSiblingAfter
public void insertSiblingAfter(Node node) { if (node != null) { node.setNextSibling(getNextSibling()); node.setPrevSibling(this); } }
java
public void insertSiblingAfter(Node node) { if (node != null) { node.setNextSibling(getNextSibling()); node.setPrevSibling(this); } }
[ "public", "void", "insertSiblingAfter", "(", "Node", "node", ")", "{", "if", "(", "node", "!=", "null", ")", "{", "node", ".", "setNextSibling", "(", "getNextSibling", "(", ")", ")", ";", "node", ".", "setPrevSibling", "(", "this", ")", ";", "}", "}" ]
Adds a Sibling immediately following this Node. @param node Node to be made the next sibling
[ "Adds", "a", "Sibling", "immediately", "following", "this", "Node", "." ]
dc745aca3b3206abf80b85d9689b0132f5baa694
https://github.com/synchronoss/cpo-api/blob/dc745aca3b3206abf80b85d9689b0132f5baa694/cpo-core/src/main/java/org/synchronoss/cpo/Node.java#L306-L311
147,776
synchronoss/cpo-api
cpo-core/src/main/java/org/synchronoss/cpo/Node.java
Node.insertParentBefore
public void insertParentBefore(Node node) throws ChildNodeException { if (node != null) { if (hasParent()) { getParentNode().addChild(node); getParentNode().removeChild(this); } node.addChild(this); } }
java
public void insertParentBefore(Node node) throws ChildNodeException { if (node != null) { if (hasParent()) { getParentNode().addChild(node); getParentNode().removeChild(this); } node.addChild(this); } }
[ "public", "void", "insertParentBefore", "(", "Node", "node", ")", "throws", "ChildNodeException", "{", "if", "(", "node", "!=", "null", ")", "{", "if", "(", "hasParent", "(", ")", ")", "{", "getParentNode", "(", ")", ".", "addChild", "(", "node", ")", ";", "getParentNode", "(", ")", ".", "removeChild", "(", "this", ")", ";", "}", "node", ".", "addChild", "(", "this", ")", ";", "}", "}" ]
Inserts a new Parent into the tree structure and adds this node as its child. @param node Node that will become this nodes new Parent.
[ "Inserts", "a", "new", "Parent", "into", "the", "tree", "structure", "and", "adds", "this", "node", "as", "its", "child", "." ]
dc745aca3b3206abf80b85d9689b0132f5baa694
https://github.com/synchronoss/cpo-api/blob/dc745aca3b3206abf80b85d9689b0132f5baa694/cpo-core/src/main/java/org/synchronoss/cpo/Node.java#L318-L326
147,777
synchronoss/cpo-api
cpo-core/src/main/java/org/synchronoss/cpo/Node.java
Node.insertParentAfter
public void insertParentAfter(Node node) throws ChildNodeException { if (node != null) { // give this node my children node.setFirstChild(getFirstChild()); setFirstChild(null); // clear our list addChild(node); // make our child } }
java
public void insertParentAfter(Node node) throws ChildNodeException { if (node != null) { // give this node my children node.setFirstChild(getFirstChild()); setFirstChild(null); // clear our list addChild(node); // make our child } }
[ "public", "void", "insertParentAfter", "(", "Node", "node", ")", "throws", "ChildNodeException", "{", "if", "(", "node", "!=", "null", ")", "{", "// give this node my children", "node", ".", "setFirstChild", "(", "getFirstChild", "(", ")", ")", ";", "setFirstChild", "(", "null", ")", ";", "// clear our list", "addChild", "(", "node", ")", ";", "// make our child", "}", "}" ]
Inserts a new Parent Node as a child of this node and moves all pre-existing children to be children of the new Parent Node. @param node Node to become a child of this node and parent to all pre-existing children of this node.
[ "Inserts", "a", "new", "Parent", "Node", "as", "a", "child", "of", "this", "node", "and", "moves", "all", "pre", "-", "existing", "children", "to", "be", "children", "of", "the", "new", "Parent", "Node", "." ]
dc745aca3b3206abf80b85d9689b0132f5baa694
https://github.com/synchronoss/cpo-api/blob/dc745aca3b3206abf80b85d9689b0132f5baa694/cpo-core/src/main/java/org/synchronoss/cpo/Node.java#L334-L342
147,778
synchronoss/cpo-api
cpo-core/src/main/java/org/synchronoss/cpo/Node.java
Node.removeChild
public boolean removeChild(Node node) throws ChildNodeException { Node currNode = getFirstChild(); boolean rc = false; if (!allowChildren) { throw new ChildNodeException(); } if (node != null && !isLeaf()) { // Is this the first and only child if (node == currNode && node == currNode.getNextSibling()) { setFirstChild(null); rc = true; } else { // Verify that this Node is a child here do { if (currNode == node) { // Remove this child if (node.getPrevSibling() != null) { node.getPrevSibling().setNextSibling(node.getNextSibling()); } if (node == getFirstChild()) { setFirstChild(node.getNextSibling()); } rc = true; // do not release. Item.resolve expects the // pointers to be intact after a remove //node.release(); break; } currNode = currNode.getNextSibling(); } while (currNode != getFirstChild()); } } return rc; }
java
public boolean removeChild(Node node) throws ChildNodeException { Node currNode = getFirstChild(); boolean rc = false; if (!allowChildren) { throw new ChildNodeException(); } if (node != null && !isLeaf()) { // Is this the first and only child if (node == currNode && node == currNode.getNextSibling()) { setFirstChild(null); rc = true; } else { // Verify that this Node is a child here do { if (currNode == node) { // Remove this child if (node.getPrevSibling() != null) { node.getPrevSibling().setNextSibling(node.getNextSibling()); } if (node == getFirstChild()) { setFirstChild(node.getNextSibling()); } rc = true; // do not release. Item.resolve expects the // pointers to be intact after a remove //node.release(); break; } currNode = currNode.getNextSibling(); } while (currNode != getFirstChild()); } } return rc; }
[ "public", "boolean", "removeChild", "(", "Node", "node", ")", "throws", "ChildNodeException", "{", "Node", "currNode", "=", "getFirstChild", "(", ")", ";", "boolean", "rc", "=", "false", ";", "if", "(", "!", "allowChildren", ")", "{", "throw", "new", "ChildNodeException", "(", ")", ";", "}", "if", "(", "node", "!=", "null", "&&", "!", "isLeaf", "(", ")", ")", "{", "// Is this the first and only child", "if", "(", "node", "==", "currNode", "&&", "node", "==", "currNode", ".", "getNextSibling", "(", ")", ")", "{", "setFirstChild", "(", "null", ")", ";", "rc", "=", "true", ";", "}", "else", "{", "// Verify that this Node is a child here", "do", "{", "if", "(", "currNode", "==", "node", ")", "{", "// Remove this child", "if", "(", "node", ".", "getPrevSibling", "(", ")", "!=", "null", ")", "{", "node", ".", "getPrevSibling", "(", ")", ".", "setNextSibling", "(", "node", ".", "getNextSibling", "(", ")", ")", ";", "}", "if", "(", "node", "==", "getFirstChild", "(", ")", ")", "{", "setFirstChild", "(", "node", ".", "getNextSibling", "(", ")", ")", ";", "}", "rc", "=", "true", ";", "// do not release. Item.resolve expects the ", "// pointers to be intact after a remove", "//node.release();", "break", ";", "}", "currNode", "=", "currNode", ".", "getNextSibling", "(", ")", ";", "}", "while", "(", "currNode", "!=", "getFirstChild", "(", ")", ")", ";", "}", "}", "return", "rc", ";", "}" ]
Searches for an immediate child node and if found removes it from the linked-list of children. @param node Node to be searched for and removed if found.
[ "Searches", "for", "an", "immediate", "child", "node", "and", "if", "found", "removes", "it", "from", "the", "linked", "-", "list", "of", "children", "." ]
dc745aca3b3206abf80b85d9689b0132f5baa694
https://github.com/synchronoss/cpo-api/blob/dc745aca3b3206abf80b85d9689b0132f5baa694/cpo-core/src/main/java/org/synchronoss/cpo/Node.java#L349-L387
147,779
synchronoss/cpo-api
cpo-core/src/main/java/org/synchronoss/cpo/Node.java
Node.removeChildNode
public void removeChildNode() throws ChildNodeException { Node parentLast; Node thisLast; // Add this nodes children to the end of the Parents children list if (!isLeaf() && hasParent()) { parentLast = getParentNode().getFirstChild().getPrevSibling(); thisLast = getFirstChild().getPrevSibling(); // add the first child to the end of the parent list parentLast.setNextSibling(getFirstChild()); //point the last child to the start of the parent list thisLast.setNextSibling(getParentNode().getFirstChild()); // Now remove self getParentNode().removeChild(this); } }
java
public void removeChildNode() throws ChildNodeException { Node parentLast; Node thisLast; // Add this nodes children to the end of the Parents children list if (!isLeaf() && hasParent()) { parentLast = getParentNode().getFirstChild().getPrevSibling(); thisLast = getFirstChild().getPrevSibling(); // add the first child to the end of the parent list parentLast.setNextSibling(getFirstChild()); //point the last child to the start of the parent list thisLast.setNextSibling(getParentNode().getFirstChild()); // Now remove self getParentNode().removeChild(this); } }
[ "public", "void", "removeChildNode", "(", ")", "throws", "ChildNodeException", "{", "Node", "parentLast", ";", "Node", "thisLast", ";", "// Add this nodes children to the end of the Parents children list", "if", "(", "!", "isLeaf", "(", ")", "&&", "hasParent", "(", ")", ")", "{", "parentLast", "=", "getParentNode", "(", ")", ".", "getFirstChild", "(", ")", ".", "getPrevSibling", "(", ")", ";", "thisLast", "=", "getFirstChild", "(", ")", ".", "getPrevSibling", "(", ")", ";", "// add the first child to the end of the parent list", "parentLast", ".", "setNextSibling", "(", "getFirstChild", "(", ")", ")", ";", "//point the last child to the start of the parent list", "thisLast", ".", "setNextSibling", "(", "getParentNode", "(", ")", ".", "getFirstChild", "(", ")", ")", ";", "// Now remove self", "getParentNode", "(", ")", ".", "removeChild", "(", "this", ")", ";", "}", "}" ]
Remove just this node from the tree. The children of this node get attached to the parent.
[ "Remove", "just", "this", "node", "from", "the", "tree", ".", "The", "children", "of", "this", "node", "get", "attached", "to", "the", "parent", "." ]
dc745aca3b3206abf80b85d9689b0132f5baa694
https://github.com/synchronoss/cpo-api/blob/dc745aca3b3206abf80b85d9689b0132f5baa694/cpo-core/src/main/java/org/synchronoss/cpo/Node.java#L392-L410
147,780
mlhartme/sushi
src/main/java/net/oneandone/sushi/fs/file/FileNode.java
FileNode.getPath
@Override public String getPath() { String result; result = path.toString().substring(getRoot().getAbsolute().length()); return result.replace(File.separatorChar, Filesystem.SEPARATOR_CHAR); }
java
@Override public String getPath() { String result; result = path.toString().substring(getRoot().getAbsolute().length()); return result.replace(File.separatorChar, Filesystem.SEPARATOR_CHAR); }
[ "@", "Override", "public", "String", "getPath", "(", ")", "{", "String", "result", ";", "result", "=", "path", ".", "toString", "(", ")", ".", "substring", "(", "getRoot", "(", ")", ".", "getAbsolute", "(", ")", ".", "length", "(", ")", ")", ";", "return", "result", ".", "replace", "(", "File", ".", "separatorChar", ",", "Filesystem", ".", "SEPARATOR_CHAR", ")", ";", "}" ]
does not include the drive on windows
[ "does", "not", "include", "the", "drive", "on", "windows" ]
4af33414b04bd58584d4febe5cc63ef6c7346a75
https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/fs/file/FileNode.java#L109-L115
147,781
mlhartme/sushi
src/main/java/net/oneandone/sushi/fs/file/FileNode.java
FileNode.deleteTree
@Override public FileNode deleteTree() throws DeleteException, NodeNotFoundException { if (!exists()) { throw new NodeNotFoundException(this); } try { doDeleteTree(path); } catch (IOException e) { throw new DeleteException(this, e); } return this; }
java
@Override public FileNode deleteTree() throws DeleteException, NodeNotFoundException { if (!exists()) { throw new NodeNotFoundException(this); } try { doDeleteTree(path); } catch (IOException e) { throw new DeleteException(this, e); } return this; }
[ "@", "Override", "public", "FileNode", "deleteTree", "(", ")", "throws", "DeleteException", ",", "NodeNotFoundException", "{", "if", "(", "!", "exists", "(", ")", ")", "{", "throw", "new", "NodeNotFoundException", "(", "this", ")", ";", "}", "try", "{", "doDeleteTree", "(", "path", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "DeleteException", "(", "this", ",", "e", ")", ";", "}", "return", "this", ";", "}" ]
Deletes a file or directory. Directories are deleted recursively. Handles Links.
[ "Deletes", "a", "file", "or", "directory", ".", "Directories", "are", "deleted", "recursively", ".", "Handles", "Links", "." ]
4af33414b04bd58584d4febe5cc63ef6c7346a75
https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/fs/file/FileNode.java#L411-L422
147,782
netceteragroup/trema-core
src/main/java/com/netcetera/trema/core/importing/ChangesAnalyzer.java
ChangesAnalyzer.analyze
public void analyze() { for (String key : importSource.getKeys()) { Change change = createChange(key); setConflictAttributes(change); if (change.getType() != Change.TYPE_NO_CHANGE) { if (change.isConflicting()) { conflictingChanges.add(change); } else { nonConflictingChanges.add(change); } } } }
java
public void analyze() { for (String key : importSource.getKeys()) { Change change = createChange(key); setConflictAttributes(change); if (change.getType() != Change.TYPE_NO_CHANGE) { if (change.isConflicting()) { conflictingChanges.add(change); } else { nonConflictingChanges.add(change); } } } }
[ "public", "void", "analyze", "(", ")", "{", "for", "(", "String", "key", ":", "importSource", ".", "getKeys", "(", ")", ")", "{", "Change", "change", "=", "createChange", "(", "key", ")", ";", "setConflictAttributes", "(", "change", ")", ";", "if", "(", "change", ".", "getType", "(", ")", "!=", "Change", ".", "TYPE_NO_CHANGE", ")", "{", "if", "(", "change", ".", "isConflicting", "(", ")", ")", "{", "conflictingChanges", ".", "add", "(", "change", ")", ";", "}", "else", "{", "nonConflictingChanges", ".", "add", "(", "change", ")", ";", "}", "}", "}", "}" ]
Determines the changes between the import source and the database and classifies them as conflicting and non-conflicting.
[ "Determines", "the", "changes", "between", "the", "import", "source", "and", "the", "database", "and", "classifies", "them", "as", "conflicting", "and", "non", "-", "conflicting", "." ]
e5367f4b80b38038d462627aa146a62bc34fc489
https://github.com/netceteragroup/trema-core/blob/e5367f4b80b38038d462627aa146a62bc34fc489/src/main/java/com/netcetera/trema/core/importing/ChangesAnalyzer.java#L68-L81
147,783
netceteragroup/trema-core
src/main/java/com/netcetera/trema/core/importing/ChangesAnalyzer.java
ChangesAnalyzer.setConflictAttributes
protected void setConflictAttributes(Change change) throws IllegalArgumentException { // default values change.setAcceptStatus(change.getImportedStatus()); change.setAcceptValue(change.getImportedValue()); if (useMasterValueFromFile) { change.setAcceptMasterValue(change.getImportedMasterValue()); } else { change.setAcceptMasterValue(change.getDbMasterValue()); } switch (change.getType()) { case Change.TYPE_NO_CHANGE: break; case Change.TYPE_MASTER_VALUE_CHANGED: change.setConflicting(true); change.setAcceptable(true); // ...in contrast to the original specifiaction by JH change.setAccept(false); break; case Change.TYPE_IMPORTED_STATUS_OLDER: change.setConflicting(true); change.setAcceptable(true); change.setAccept(true); break; case Change.TYPE_IMPORTED_STATUS_NEWER: change.setConflicting(false); change.setAcceptable(true); change.setAccept(true); break; case Change.TYPE_LANGUAGE_ADDITION: change.setConflicting(true); change.setAcceptable(false); // only the developer should be able to add languages break; case Change.TYPE_MASTER_LANGUAGE_ADDITION: change.setConflicting(true); change.setAcceptable(false); // only the developer should be able to add languages break; case Change.TYPE_VALUE_CHANGED: case Change.TYPE_VALUE_AND_STATUS_CHANGED: // default values change.setConflicting(false); change.setAcceptable(true); change.setAccept(true); // proceed according to the "old status" / "new status" matrix Status importedStatus = change.getImportedStatus(); Status dbStatus = change.getDbStatus(); if (dbStatus == Status.SPECIAL) { change.setConflicting(true); change.setAcceptable(false); } else if (dbStatus == Status.INITIAL) { if (importedStatus == Status.INITIAL) { change.setAcceptStatus(Status.TRANSLATED); } else if (importedStatus == Status.SPECIAL) { change.setConflicting(true); change.setAcceptable(false); change.setAcceptStatus(Status.TRANSLATED); } } else if (dbStatus == Status.TRANSLATED) { if (importedStatus == Status.INITIAL || importedStatus == Status.SPECIAL) { change.setConflicting(true); change.setAcceptStatus(Status.TRANSLATED); } } else if (dbStatus == Status.VERIFIED) { change.setConflicting(true); if (importedStatus == Status.VERIFIED) { change.setAccept(false); } } break; case Change.TYPE_KEY_ADDITION: change.setConflicting(true); change.setAcceptable(false); // only the developer should be able to add keys break; default: throw new IllegalArgumentException("Unknown change type: " + change.getType()); } }
java
protected void setConflictAttributes(Change change) throws IllegalArgumentException { // default values change.setAcceptStatus(change.getImportedStatus()); change.setAcceptValue(change.getImportedValue()); if (useMasterValueFromFile) { change.setAcceptMasterValue(change.getImportedMasterValue()); } else { change.setAcceptMasterValue(change.getDbMasterValue()); } switch (change.getType()) { case Change.TYPE_NO_CHANGE: break; case Change.TYPE_MASTER_VALUE_CHANGED: change.setConflicting(true); change.setAcceptable(true); // ...in contrast to the original specifiaction by JH change.setAccept(false); break; case Change.TYPE_IMPORTED_STATUS_OLDER: change.setConflicting(true); change.setAcceptable(true); change.setAccept(true); break; case Change.TYPE_IMPORTED_STATUS_NEWER: change.setConflicting(false); change.setAcceptable(true); change.setAccept(true); break; case Change.TYPE_LANGUAGE_ADDITION: change.setConflicting(true); change.setAcceptable(false); // only the developer should be able to add languages break; case Change.TYPE_MASTER_LANGUAGE_ADDITION: change.setConflicting(true); change.setAcceptable(false); // only the developer should be able to add languages break; case Change.TYPE_VALUE_CHANGED: case Change.TYPE_VALUE_AND_STATUS_CHANGED: // default values change.setConflicting(false); change.setAcceptable(true); change.setAccept(true); // proceed according to the "old status" / "new status" matrix Status importedStatus = change.getImportedStatus(); Status dbStatus = change.getDbStatus(); if (dbStatus == Status.SPECIAL) { change.setConflicting(true); change.setAcceptable(false); } else if (dbStatus == Status.INITIAL) { if (importedStatus == Status.INITIAL) { change.setAcceptStatus(Status.TRANSLATED); } else if (importedStatus == Status.SPECIAL) { change.setConflicting(true); change.setAcceptable(false); change.setAcceptStatus(Status.TRANSLATED); } } else if (dbStatus == Status.TRANSLATED) { if (importedStatus == Status.INITIAL || importedStatus == Status.SPECIAL) { change.setConflicting(true); change.setAcceptStatus(Status.TRANSLATED); } } else if (dbStatus == Status.VERIFIED) { change.setConflicting(true); if (importedStatus == Status.VERIFIED) { change.setAccept(false); } } break; case Change.TYPE_KEY_ADDITION: change.setConflicting(true); change.setAcceptable(false); // only the developer should be able to add keys break; default: throw new IllegalArgumentException("Unknown change type: " + change.getType()); } }
[ "protected", "void", "setConflictAttributes", "(", "Change", "change", ")", "throws", "IllegalArgumentException", "{", "// default values", "change", ".", "setAcceptStatus", "(", "change", ".", "getImportedStatus", "(", ")", ")", ";", "change", ".", "setAcceptValue", "(", "change", ".", "getImportedValue", "(", ")", ")", ";", "if", "(", "useMasterValueFromFile", ")", "{", "change", ".", "setAcceptMasterValue", "(", "change", ".", "getImportedMasterValue", "(", ")", ")", ";", "}", "else", "{", "change", ".", "setAcceptMasterValue", "(", "change", ".", "getDbMasterValue", "(", ")", ")", ";", "}", "switch", "(", "change", ".", "getType", "(", ")", ")", "{", "case", "Change", ".", "TYPE_NO_CHANGE", ":", "break", ";", "case", "Change", ".", "TYPE_MASTER_VALUE_CHANGED", ":", "change", ".", "setConflicting", "(", "true", ")", ";", "change", ".", "setAcceptable", "(", "true", ")", ";", "// ...in contrast to the original specifiaction by JH", "change", ".", "setAccept", "(", "false", ")", ";", "break", ";", "case", "Change", ".", "TYPE_IMPORTED_STATUS_OLDER", ":", "change", ".", "setConflicting", "(", "true", ")", ";", "change", ".", "setAcceptable", "(", "true", ")", ";", "change", ".", "setAccept", "(", "true", ")", ";", "break", ";", "case", "Change", ".", "TYPE_IMPORTED_STATUS_NEWER", ":", "change", ".", "setConflicting", "(", "false", ")", ";", "change", ".", "setAcceptable", "(", "true", ")", ";", "change", ".", "setAccept", "(", "true", ")", ";", "break", ";", "case", "Change", ".", "TYPE_LANGUAGE_ADDITION", ":", "change", ".", "setConflicting", "(", "true", ")", ";", "change", ".", "setAcceptable", "(", "false", ")", ";", "// only the developer should be able to add languages", "break", ";", "case", "Change", ".", "TYPE_MASTER_LANGUAGE_ADDITION", ":", "change", ".", "setConflicting", "(", "true", ")", ";", "change", ".", "setAcceptable", "(", "false", ")", ";", "// only the developer should be able to add languages", "break", ";", "case", "Change", ".", "TYPE_VALUE_CHANGED", ":", "case", "Change", ".", "TYPE_VALUE_AND_STATUS_CHANGED", ":", "// default values", "change", ".", "setConflicting", "(", "false", ")", ";", "change", ".", "setAcceptable", "(", "true", ")", ";", "change", ".", "setAccept", "(", "true", ")", ";", "// proceed according to the \"old status\" / \"new status\" matrix", "Status", "importedStatus", "=", "change", ".", "getImportedStatus", "(", ")", ";", "Status", "dbStatus", "=", "change", ".", "getDbStatus", "(", ")", ";", "if", "(", "dbStatus", "==", "Status", ".", "SPECIAL", ")", "{", "change", ".", "setConflicting", "(", "true", ")", ";", "change", ".", "setAcceptable", "(", "false", ")", ";", "}", "else", "if", "(", "dbStatus", "==", "Status", ".", "INITIAL", ")", "{", "if", "(", "importedStatus", "==", "Status", ".", "INITIAL", ")", "{", "change", ".", "setAcceptStatus", "(", "Status", ".", "TRANSLATED", ")", ";", "}", "else", "if", "(", "importedStatus", "==", "Status", ".", "SPECIAL", ")", "{", "change", ".", "setConflicting", "(", "true", ")", ";", "change", ".", "setAcceptable", "(", "false", ")", ";", "change", ".", "setAcceptStatus", "(", "Status", ".", "TRANSLATED", ")", ";", "}", "}", "else", "if", "(", "dbStatus", "==", "Status", ".", "TRANSLATED", ")", "{", "if", "(", "importedStatus", "==", "Status", ".", "INITIAL", "||", "importedStatus", "==", "Status", ".", "SPECIAL", ")", "{", "change", ".", "setConflicting", "(", "true", ")", ";", "change", ".", "setAcceptStatus", "(", "Status", ".", "TRANSLATED", ")", ";", "}", "}", "else", "if", "(", "dbStatus", "==", "Status", ".", "VERIFIED", ")", "{", "change", ".", "setConflicting", "(", "true", ")", ";", "if", "(", "importedStatus", "==", "Status", ".", "VERIFIED", ")", "{", "change", ".", "setAccept", "(", "false", ")", ";", "}", "}", "break", ";", "case", "Change", ".", "TYPE_KEY_ADDITION", ":", "change", ".", "setConflicting", "(", "true", ")", ";", "change", ".", "setAcceptable", "(", "false", ")", ";", "// only the developer should be able to add keys", "break", ";", "default", ":", "throw", "new", "IllegalArgumentException", "(", "\"Unknown change type: \"", "+", "change", ".", "getType", "(", ")", ")", ";", "}", "}" ]
Determines whether a change is conflicting, acceptable and to be accepted and sets the values to be accepted. This routine is the only one dealing with the mentioned conflict attributes. It may be overridden to change the conflict specification. @param change the change to be analyzed @throws IllegalArgumentException if an unknown change type is encountered.
[ "Determines", "whether", "a", "change", "is", "conflicting", "acceptable", "and", "to", "be", "accepted", "and", "sets", "the", "values", "to", "be", "accepted", ".", "This", "routine", "is", "the", "only", "one", "dealing", "with", "the", "mentioned", "conflict", "attributes", ".", "It", "may", "be", "overridden", "to", "change", "the", "conflict", "specification", "." ]
e5367f4b80b38038d462627aa146a62bc34fc489
https://github.com/netceteragroup/trema-core/blob/e5367f4b80b38038d462627aa146a62bc34fc489/src/main/java/com/netcetera/trema/core/importing/ChangesAnalyzer.java#L200-L277
147,784
kmi/iserve
iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/ConcurrentSparqlGraphStoreManager.java
ConcurrentSparqlGraphStoreManager.setupModelSpecification
private void setupModelSpecification(Map<String, String> locationMappings, Set<String> ignoredImports) { OntDocumentManager documentManager = new OntDocumentManager(); // Add mapping specific to OWLS TC 4 tests. // Add mappings to local files to save time and avoid connection issues for (Map.Entry<String, String> mapping : locationMappings.entrySet()) { documentManager.addAltEntry(mapping.getKey(), mapping.getValue()); } // Ignore the imports indicated for (String ignoreUri : ignoredImports) { documentManager.addIgnoreImport(ignoreUri); } // Don't follow imports for now until we find a way to control this well // documentManager.setProcessImports(true); documentManager.setProcessImports(false); documentManager.setCacheModels(false); // No inferencing here. Leaving this for the backend this.modelSpec = new OntModelSpec(OntModelSpec.OWL_MEM); // this.modelSpec = new OntModelSpec(OntModelSpec.OWL_MEM_MICRO_RULE_INF); this.modelSpec.setDocumentManager(documentManager); }
java
private void setupModelSpecification(Map<String, String> locationMappings, Set<String> ignoredImports) { OntDocumentManager documentManager = new OntDocumentManager(); // Add mapping specific to OWLS TC 4 tests. // Add mappings to local files to save time and avoid connection issues for (Map.Entry<String, String> mapping : locationMappings.entrySet()) { documentManager.addAltEntry(mapping.getKey(), mapping.getValue()); } // Ignore the imports indicated for (String ignoreUri : ignoredImports) { documentManager.addIgnoreImport(ignoreUri); } // Don't follow imports for now until we find a way to control this well // documentManager.setProcessImports(true); documentManager.setProcessImports(false); documentManager.setCacheModels(false); // No inferencing here. Leaving this for the backend this.modelSpec = new OntModelSpec(OntModelSpec.OWL_MEM); // this.modelSpec = new OntModelSpec(OntModelSpec.OWL_MEM_MICRO_RULE_INF); this.modelSpec.setDocumentManager(documentManager); }
[ "private", "void", "setupModelSpecification", "(", "Map", "<", "String", ",", "String", ">", "locationMappings", ",", "Set", "<", "String", ">", "ignoredImports", ")", "{", "OntDocumentManager", "documentManager", "=", "new", "OntDocumentManager", "(", ")", ";", "// Add mapping specific to OWLS TC 4 tests.", "// Add mappings to local files to save time and avoid connection issues", "for", "(", "Map", ".", "Entry", "<", "String", ",", "String", ">", "mapping", ":", "locationMappings", ".", "entrySet", "(", ")", ")", "{", "documentManager", ".", "addAltEntry", "(", "mapping", ".", "getKey", "(", ")", ",", "mapping", ".", "getValue", "(", ")", ")", ";", "}", "// Ignore the imports indicated", "for", "(", "String", "ignoreUri", ":", "ignoredImports", ")", "{", "documentManager", ".", "addIgnoreImport", "(", "ignoreUri", ")", ";", "}", "// Don't follow imports for now until we find a way to control this well", "// documentManager.setProcessImports(true);", "documentManager", ".", "setProcessImports", "(", "false", ")", ";", "documentManager", ".", "setCacheModels", "(", "false", ")", ";", "// No inferencing here. Leaving this for the backend", "this", ".", "modelSpec", "=", "new", "OntModelSpec", "(", "OntModelSpec", ".", "OWL_MEM", ")", ";", "// this.modelSpec = new OntModelSpec(OntModelSpec.OWL_MEM_MICRO_RULE_INF);", "this", ".", "modelSpec", ".", "setDocumentManager", "(", "documentManager", ")", ";", "}" ]
Setup a the OntModelSpec to be used when parsing services. In particular, setup import redirections, etc. @param locationMappings @param ignoredImports @return
[ "Setup", "a", "the", "OntModelSpec", "to", "be", "used", "when", "parsing", "services", ".", "In", "particular", "setup", "import", "redirections", "etc", "." ]
13e7016e64c1d5a539b838c6debf1a5cc4aefcb7
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/ConcurrentSparqlGraphStoreManager.java#L166-L191
147,785
kmi/iserve
iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/ConcurrentSparqlGraphStoreManager.java
ConcurrentSparqlGraphStoreManager.shutdown
@Override public void shutdown() { log.info("Shutting down Ontology crawlers."); this.executor.shutdown(); // Disable new tasks from being submitted try { // Wait a while for existing tasks to terminate if (!this.executor.awaitTermination(5, TimeUnit.SECONDS)) { this.executor.shutdownNow(); // Cancel currently executing tasks // Wait a while for tasks to respond to being cancelled if (!this.executor.awaitTermination(2, TimeUnit.SECONDS)) log.error("Pool did not terminate"); } } catch (InterruptedException ie) { // (Re-)Cancel if current thread also interrupted this.executor.shutdownNow(); // Preserve interrupt status Thread.currentThread().interrupt(); } }
java
@Override public void shutdown() { log.info("Shutting down Ontology crawlers."); this.executor.shutdown(); // Disable new tasks from being submitted try { // Wait a while for existing tasks to terminate if (!this.executor.awaitTermination(5, TimeUnit.SECONDS)) { this.executor.shutdownNow(); // Cancel currently executing tasks // Wait a while for tasks to respond to being cancelled if (!this.executor.awaitTermination(2, TimeUnit.SECONDS)) log.error("Pool did not terminate"); } } catch (InterruptedException ie) { // (Re-)Cancel if current thread also interrupted this.executor.shutdownNow(); // Preserve interrupt status Thread.currentThread().interrupt(); } }
[ "@", "Override", "public", "void", "shutdown", "(", ")", "{", "log", ".", "info", "(", "\"Shutting down Ontology crawlers.\"", ")", ";", "this", ".", "executor", ".", "shutdown", "(", ")", ";", "// Disable new tasks from being submitted", "try", "{", "// Wait a while for existing tasks to terminate", "if", "(", "!", "this", ".", "executor", ".", "awaitTermination", "(", "5", ",", "TimeUnit", ".", "SECONDS", ")", ")", "{", "this", ".", "executor", ".", "shutdownNow", "(", ")", ";", "// Cancel currently executing tasks", "// Wait a while for tasks to respond to being cancelled", "if", "(", "!", "this", ".", "executor", ".", "awaitTermination", "(", "2", ",", "TimeUnit", ".", "SECONDS", ")", ")", "log", ".", "error", "(", "\"Pool did not terminate\"", ")", ";", "}", "}", "catch", "(", "InterruptedException", "ie", ")", "{", "// (Re-)Cancel if current thread also interrupted", "this", ".", "executor", ".", "shutdownNow", "(", ")", ";", "// Preserve interrupt status", "Thread", ".", "currentThread", "(", ")", ".", "interrupt", "(", ")", ";", "}", "}" ]
This method will be called when the server is being shutdown. Ensure a clean shutdown.
[ "This", "method", "will", "be", "called", "when", "the", "server", "is", "being", "shutdown", ".", "Ensure", "a", "clean", "shutdown", "." ]
13e7016e64c1d5a539b838c6debf1a5cc4aefcb7
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/ConcurrentSparqlGraphStoreManager.java#L206-L224
147,786
kmi/iserve
iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/ConcurrentSparqlGraphStoreManager.java
ConcurrentSparqlGraphStoreManager.addModelToGraph
@Override public void addModelToGraph(URI graphUri, Model data) { if (graphUri == null || data == null) return; // Use HTTP protocol if possible if (this.sparqlServiceEndpoint != null) { datasetAccessor.add(graphUri.toASCIIString(), data); } else { this.addModelToGraphSparqlQuery(graphUri, data); } }
java
@Override public void addModelToGraph(URI graphUri, Model data) { if (graphUri == null || data == null) return; // Use HTTP protocol if possible if (this.sparqlServiceEndpoint != null) { datasetAccessor.add(graphUri.toASCIIString(), data); } else { this.addModelToGraphSparqlQuery(graphUri, data); } }
[ "@", "Override", "public", "void", "addModelToGraph", "(", "URI", "graphUri", ",", "Model", "data", ")", "{", "if", "(", "graphUri", "==", "null", "||", "data", "==", "null", ")", "return", ";", "// Use HTTP protocol if possible", "if", "(", "this", ".", "sparqlServiceEndpoint", "!=", "null", ")", "{", "datasetAccessor", ".", "add", "(", "graphUri", ".", "toASCIIString", "(", ")", ",", "data", ")", ";", "}", "else", "{", "this", ".", "addModelToGraphSparqlQuery", "(", "graphUri", ",", "data", ")", ";", "}", "}" ]
Add statements to a named model @param graphUri @param data
[ "Add", "statements", "to", "a", "named", "model" ]
13e7016e64c1d5a539b838c6debf1a5cc4aefcb7
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/ConcurrentSparqlGraphStoreManager.java#L301-L312
147,787
kmi/iserve
iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/ConcurrentSparqlGraphStoreManager.java
ConcurrentSparqlGraphStoreManager.deleteGraph
@Override public void deleteGraph(URI graphUri) { if (graphUri == null || !this.canBeModified()) return; // Use HTTP protocol if possible if (this.sparqlServiceEndpoint != null) { this.datasetAccessor.deleteModel(graphUri.toASCIIString()); } else { deleteGraphSparqlUpdate(graphUri); } log.debug("Graph deleted: {}", graphUri.toASCIIString()); }
java
@Override public void deleteGraph(URI graphUri) { if (graphUri == null || !this.canBeModified()) return; // Use HTTP protocol if possible if (this.sparqlServiceEndpoint != null) { this.datasetAccessor.deleteModel(graphUri.toASCIIString()); } else { deleteGraphSparqlUpdate(graphUri); } log.debug("Graph deleted: {}", graphUri.toASCIIString()); }
[ "@", "Override", "public", "void", "deleteGraph", "(", "URI", "graphUri", ")", "{", "if", "(", "graphUri", "==", "null", "||", "!", "this", ".", "canBeModified", "(", ")", ")", "return", ";", "// Use HTTP protocol if possible", "if", "(", "this", ".", "sparqlServiceEndpoint", "!=", "null", ")", "{", "this", ".", "datasetAccessor", ".", "deleteModel", "(", "graphUri", ".", "toASCIIString", "(", ")", ")", ";", "}", "else", "{", "deleteGraphSparqlUpdate", "(", "graphUri", ")", ";", "}", "log", ".", "debug", "(", "\"Graph deleted: {}\"", ",", "graphUri", ".", "toASCIIString", "(", ")", ")", ";", "}" ]
Delete a named model of a Dataset @param graphUri
[ "Delete", "a", "named", "model", "of", "a", "Dataset" ]
13e7016e64c1d5a539b838c6debf1a5cc4aefcb7
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/ConcurrentSparqlGraphStoreManager.java#L352-L366
147,788
kmi/iserve
iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/ConcurrentSparqlGraphStoreManager.java
ConcurrentSparqlGraphStoreManager.deleteGraphSparqlUpdate
private void deleteGraphSparqlUpdate(URI graphUri) { UpdateRequest request = UpdateFactory.create(); request.setPrefixMapping(PrefixMapping.Factory.create().setNsPrefixes(Vocabularies.prefixes)); request.add(new UpdateDrop(graphUri.toASCIIString())); // Use create form for Sesame-based engines. TODO: Generalise and push to config. UpdateProcessor processor = UpdateExecutionFactory.createRemoteForm(request, this.getSparqlUpdateEndpoint().toASCIIString()); processor.execute(); // TODO: anyway to know if things went ok? }
java
private void deleteGraphSparqlUpdate(URI graphUri) { UpdateRequest request = UpdateFactory.create(); request.setPrefixMapping(PrefixMapping.Factory.create().setNsPrefixes(Vocabularies.prefixes)); request.add(new UpdateDrop(graphUri.toASCIIString())); // Use create form for Sesame-based engines. TODO: Generalise and push to config. UpdateProcessor processor = UpdateExecutionFactory.createRemoteForm(request, this.getSparqlUpdateEndpoint().toASCIIString()); processor.execute(); // TODO: anyway to know if things went ok? }
[ "private", "void", "deleteGraphSparqlUpdate", "(", "URI", "graphUri", ")", "{", "UpdateRequest", "request", "=", "UpdateFactory", ".", "create", "(", ")", ";", "request", ".", "setPrefixMapping", "(", "PrefixMapping", ".", "Factory", ".", "create", "(", ")", ".", "setNsPrefixes", "(", "Vocabularies", ".", "prefixes", ")", ")", ";", "request", ".", "add", "(", "new", "UpdateDrop", "(", "graphUri", ".", "toASCIIString", "(", ")", ")", ")", ";", "// Use create form for Sesame-based engines. TODO: Generalise and push to config.", "UpdateProcessor", "processor", "=", "UpdateExecutionFactory", ".", "createRemoteForm", "(", "request", ",", "this", ".", "getSparqlUpdateEndpoint", "(", ")", ".", "toASCIIString", "(", ")", ")", ";", "processor", ".", "execute", "(", ")", ";", "// TODO: anyway to know if things went ok?", "}" ]
Delete Graph using SPARQL Update @param graphUri
[ "Delete", "Graph", "using", "SPARQL", "Update" ]
13e7016e64c1d5a539b838c6debf1a5cc4aefcb7
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/ConcurrentSparqlGraphStoreManager.java#L373-L381
147,789
kmi/iserve
iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/ConcurrentSparqlGraphStoreManager.java
ConcurrentSparqlGraphStoreManager.getGraph
protected OntModel getGraph() { // Use HTTP protocol if possible if (this.sparqlServiceEndpoint != null) { return ModelFactory.createOntologyModel(this.modelSpec, datasetAccessor.getModel()); } else { return this.getGraphSparqlQuery(); } }
java
protected OntModel getGraph() { // Use HTTP protocol if possible if (this.sparqlServiceEndpoint != null) { return ModelFactory.createOntologyModel(this.modelSpec, datasetAccessor.getModel()); } else { return this.getGraphSparqlQuery(); } }
[ "protected", "OntModel", "getGraph", "(", ")", "{", "// Use HTTP protocol if possible", "if", "(", "this", ".", "sparqlServiceEndpoint", "!=", "null", ")", "{", "return", "ModelFactory", ".", "createOntologyModel", "(", "this", ".", "modelSpec", ",", "datasetAccessor", ".", "getModel", "(", ")", ")", ";", "}", "else", "{", "return", "this", ".", "getGraphSparqlQuery", "(", ")", ";", "}", "}" ]
Gets the default model of a Dataset @return
[ "Gets", "the", "default", "model", "of", "a", "Dataset" ]
13e7016e64c1d5a539b838c6debf1a5cc4aefcb7
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/ConcurrentSparqlGraphStoreManager.java#L388-L396
147,790
kmi/iserve
iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/ConcurrentSparqlGraphStoreManager.java
ConcurrentSparqlGraphStoreManager.getGraph
@Override public OntModel getGraph(URI graphUri) { log.debug("Obtaining graph: {}", graphUri.toASCIIString()); if (graphUri == null) return null; // FIXME: For now Jena and Sesame can't talk to each other // Jena will ignore a named graph as the output. // Use HTTP protocol if possible // if (this.sparqlServiceEndpoint != null) { // Model model = datasetAccessor.getModel(graphUri); // return ModelFactory.createOntologyModel(this.modelSpec, model); // // } else { return this.getGraphSparqlQuery(graphUri); // } }
java
@Override public OntModel getGraph(URI graphUri) { log.debug("Obtaining graph: {}", graphUri.toASCIIString()); if (graphUri == null) return null; // FIXME: For now Jena and Sesame can't talk to each other // Jena will ignore a named graph as the output. // Use HTTP protocol if possible // if (this.sparqlServiceEndpoint != null) { // Model model = datasetAccessor.getModel(graphUri); // return ModelFactory.createOntologyModel(this.modelSpec, model); // // } else { return this.getGraphSparqlQuery(graphUri); // } }
[ "@", "Override", "public", "OntModel", "getGraph", "(", "URI", "graphUri", ")", "{", "log", ".", "debug", "(", "\"Obtaining graph: {}\"", ",", "graphUri", ".", "toASCIIString", "(", ")", ")", ";", "if", "(", "graphUri", "==", "null", ")", "return", "null", ";", "// FIXME: For now Jena and Sesame can't talk to each other", "// Jena will ignore a named graph as the output.", "// Use HTTP protocol if possible", "// if (this.sparqlServiceEndpoint != null) {", "// Model model = datasetAccessor.getModel(graphUri);", "// return ModelFactory.createOntologyModel(this.modelSpec, model);", "//", "// } else {", "return", "this", ".", "getGraphSparqlQuery", "(", "graphUri", ")", ";", "// }", "}" ]
Get a named model of a Dataset @param graphUri @return the Ontology Model
[ "Get", "a", "named", "model", "of", "a", "Dataset" ]
13e7016e64c1d5a539b838c6debf1a5cc4aefcb7
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/ConcurrentSparqlGraphStoreManager.java#L409-L426
147,791
kmi/iserve
iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/ConcurrentSparqlGraphStoreManager.java
ConcurrentSparqlGraphStoreManager.getGraphSparqlQuery
private OntModel getGraphSparqlQuery(URI graphUri) { StringBuilder queryStr = new StringBuilder("CONSTRUCT { ?s ?p ?o } \n") .append("WHERE {\n"); // Add named graph if necessary if (graphUri != null) { queryStr.append("GRAPH <").append(graphUri.toASCIIString()).append("> "); } queryStr.append("{ ?s ?p ?o } } \n"); log.debug("Querying graph store: {}", queryStr.toString()); Query query = QueryFactory.create(queryStr.toString()); QueryExecution qe = QueryExecutionFactory.sparqlService(this.getSparqlQueryEndpoint().toASCIIString(), query); MonitoredQueryExecution qexec = new MonitoredQueryExecution(qe); // Note that we are not using the store specification here to avoid retrieving remote models // OntModel resultModel = ModelFactory.createOntologyModel(); OntModel resultModel = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM_MICRO_RULE_INF); try { qexec.execConstruct(resultModel); return resultModel; } finally { qexec.close(); } }
java
private OntModel getGraphSparqlQuery(URI graphUri) { StringBuilder queryStr = new StringBuilder("CONSTRUCT { ?s ?p ?o } \n") .append("WHERE {\n"); // Add named graph if necessary if (graphUri != null) { queryStr.append("GRAPH <").append(graphUri.toASCIIString()).append("> "); } queryStr.append("{ ?s ?p ?o } } \n"); log.debug("Querying graph store: {}", queryStr.toString()); Query query = QueryFactory.create(queryStr.toString()); QueryExecution qe = QueryExecutionFactory.sparqlService(this.getSparqlQueryEndpoint().toASCIIString(), query); MonitoredQueryExecution qexec = new MonitoredQueryExecution(qe); // Note that we are not using the store specification here to avoid retrieving remote models // OntModel resultModel = ModelFactory.createOntologyModel(); OntModel resultModel = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM_MICRO_RULE_INF); try { qexec.execConstruct(resultModel); return resultModel; } finally { qexec.close(); } }
[ "private", "OntModel", "getGraphSparqlQuery", "(", "URI", "graphUri", ")", "{", "StringBuilder", "queryStr", "=", "new", "StringBuilder", "(", "\"CONSTRUCT { ?s ?p ?o } \\n\"", ")", ".", "append", "(", "\"WHERE {\\n\"", ")", ";", "// Add named graph if necessary", "if", "(", "graphUri", "!=", "null", ")", "{", "queryStr", ".", "append", "(", "\"GRAPH <\"", ")", ".", "append", "(", "graphUri", ".", "toASCIIString", "(", ")", ")", ".", "append", "(", "\"> \"", ")", ";", "}", "queryStr", ".", "append", "(", "\"{ ?s ?p ?o } } \\n\"", ")", ";", "log", ".", "debug", "(", "\"Querying graph store: {}\"", ",", "queryStr", ".", "toString", "(", ")", ")", ";", "Query", "query", "=", "QueryFactory", ".", "create", "(", "queryStr", ".", "toString", "(", ")", ")", ";", "QueryExecution", "qe", "=", "QueryExecutionFactory", ".", "sparqlService", "(", "this", ".", "getSparqlQueryEndpoint", "(", ")", ".", "toASCIIString", "(", ")", ",", "query", ")", ";", "MonitoredQueryExecution", "qexec", "=", "new", "MonitoredQueryExecution", "(", "qe", ")", ";", "// Note that we are not using the store specification here to avoid retrieving remote models", "// OntModel resultModel = ModelFactory.createOntologyModel();", "OntModel", "resultModel", "=", "ModelFactory", ".", "createOntologyModel", "(", "OntModelSpec", ".", "OWL_MEM_MICRO_RULE_INF", ")", ";", "try", "{", "qexec", ".", "execConstruct", "(", "resultModel", ")", ";", "return", "resultModel", ";", "}", "finally", "{", "qexec", ".", "close", "(", ")", ";", "}", "}" ]
Obtains the OntModel within a named graph or the default graph if no graphUri is provided @param graphUri @return
[ "Obtains", "the", "OntModel", "within", "a", "named", "graph", "or", "the", "default", "graph", "if", "no", "graphUri", "is", "provided" ]
13e7016e64c1d5a539b838c6debf1a5cc4aefcb7
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/ConcurrentSparqlGraphStoreManager.java#L489-L514
147,792
kmi/iserve
iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/ConcurrentSparqlGraphStoreManager.java
ConcurrentSparqlGraphStoreManager.listStoredGraphs
@Override public Set<URI> listStoredGraphs() { StringBuilder strBuilder = new StringBuilder() .append("SELECT DISTINCT ?graph WHERE {").append("\n") .append("GRAPH ?graph {").append("?s ?p ?o").append(" }").append("\n") .append("}").append("\n"); return listResourcesByQuery(strBuilder.toString(), "graph"); }
java
@Override public Set<URI> listStoredGraphs() { StringBuilder strBuilder = new StringBuilder() .append("SELECT DISTINCT ?graph WHERE {").append("\n") .append("GRAPH ?graph {").append("?s ?p ?o").append(" }").append("\n") .append("}").append("\n"); return listResourcesByQuery(strBuilder.toString(), "graph"); }
[ "@", "Override", "public", "Set", "<", "URI", ">", "listStoredGraphs", "(", ")", "{", "StringBuilder", "strBuilder", "=", "new", "StringBuilder", "(", ")", ".", "append", "(", "\"SELECT DISTINCT ?graph WHERE {\"", ")", ".", "append", "(", "\"\\n\"", ")", ".", "append", "(", "\"GRAPH ?graph {\"", ")", ".", "append", "(", "\"?s ?p ?o\"", ")", ".", "append", "(", "\" }\"", ")", ".", "append", "(", "\"\\n\"", ")", ".", "append", "(", "\"}\"", ")", ".", "append", "(", "\"\\n\"", ")", ";", "return", "listResourcesByQuery", "(", "strBuilder", ".", "toString", "(", ")", ",", "\"graph\"", ")", ";", "}" ]
Figure out the models that are already in the Knowledge Base @return the Set of URIs of the models loaded
[ "Figure", "out", "the", "models", "that", "are", "already", "in", "the", "Knowledge", "Base" ]
13e7016e64c1d5a539b838c6debf1a5cc4aefcb7
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/ConcurrentSparqlGraphStoreManager.java#L624-L633
147,793
udoprog/ffwd-client-java
src/main/java/com/google/protobuf250/UnknownFieldSet.java
UnknownFieldSet.getSerializedSize
public int getSerializedSize() { int result = 0; for (final Map.Entry<Integer, Field> entry : fields.entrySet()) { result += entry.getValue().getSerializedSize(entry.getKey()); } return result; }
java
public int getSerializedSize() { int result = 0; for (final Map.Entry<Integer, Field> entry : fields.entrySet()) { result += entry.getValue().getSerializedSize(entry.getKey()); } return result; }
[ "public", "int", "getSerializedSize", "(", ")", "{", "int", "result", "=", "0", ";", "for", "(", "final", "Map", ".", "Entry", "<", "Integer", ",", "Field", ">", "entry", ":", "fields", ".", "entrySet", "(", ")", ")", "{", "result", "+=", "entry", ".", "getValue", "(", ")", ".", "getSerializedSize", "(", "entry", ".", "getKey", "(", ")", ")", ";", "}", "return", "result", ";", "}" ]
Get the number of bytes required to encode this set.
[ "Get", "the", "number", "of", "bytes", "required", "to", "encode", "this", "set", "." ]
b4161d2b138e3edb8fa9420cc3cc653d5764cf5b
https://github.com/udoprog/ffwd-client-java/blob/b4161d2b138e3edb8fa9420cc3cc653d5764cf5b/src/main/java/com/google/protobuf250/UnknownFieldSet.java#L197-L203
147,794
pulse00/Composer-Java-Bindings
java-api/src/main/java/com/dubture/getcomposer/core/entities/AbstractJsonArray.java
AbstractJsonArray.add
public void add(V value) { values.add(value); if (value instanceof JsonEntity) { ((JsonEntity)value).addPropertyChangeListener(propListener); } firePropertyChange("#" + (values.size() - 1), null, value); }
java
public void add(V value) { values.add(value); if (value instanceof JsonEntity) { ((JsonEntity)value).addPropertyChangeListener(propListener); } firePropertyChange("#" + (values.size() - 1), null, value); }
[ "public", "void", "add", "(", "V", "value", ")", "{", "values", ".", "add", "(", "value", ")", ";", "if", "(", "value", "instanceof", "JsonEntity", ")", "{", "(", "(", "JsonEntity", ")", "value", ")", ".", "addPropertyChangeListener", "(", "propListener", ")", ";", "}", "firePropertyChange", "(", "\"#\"", "+", "(", "values", ".", "size", "(", ")", "-", "1", ")", ",", "null", ",", "value", ")", ";", "}" ]
Adds a value to the receiver's collection @param value the new value
[ "Adds", "a", "value", "to", "the", "receiver", "s", "collection" ]
0aa572567db37d047a41a57c32ede7c7fd5d4938
https://github.com/pulse00/Composer-Java-Bindings/blob/0aa572567db37d047a41a57c32ede7c7fd5d4938/java-api/src/main/java/com/dubture/getcomposer/core/entities/AbstractJsonArray.java#L89-L97
147,795
pulse00/Composer-Java-Bindings
java-api/src/main/java/com/dubture/getcomposer/core/entities/AbstractJsonArray.java
AbstractJsonArray.remove
public void remove(V value) { int index = values.indexOf(value); values.remove(value); if (value instanceof JsonEntity) { ((JsonEntity)value).removePropertyChangeListener(propListener); } firePropertyChange("#" + index, value, null); }
java
public void remove(V value) { int index = values.indexOf(value); values.remove(value); if (value instanceof JsonEntity) { ((JsonEntity)value).removePropertyChangeListener(propListener); } firePropertyChange("#" + index, value, null); }
[ "public", "void", "remove", "(", "V", "value", ")", "{", "int", "index", "=", "values", ".", "indexOf", "(", "value", ")", ";", "values", ".", "remove", "(", "value", ")", ";", "if", "(", "value", "instanceof", "JsonEntity", ")", "{", "(", "(", "JsonEntity", ")", "value", ")", ".", "removePropertyChangeListener", "(", "propListener", ")", ";", "}", "firePropertyChange", "(", "\"#\"", "+", "index", ",", "value", ",", "null", ")", ";", "}" ]
Removes a value from the receiver's collection @param value the value to remove
[ "Removes", "a", "value", "from", "the", "receiver", "s", "collection" ]
0aa572567db37d047a41a57c32ede7c7fd5d4938
https://github.com/pulse00/Composer-Java-Bindings/blob/0aa572567db37d047a41a57c32ede7c7fd5d4938/java-api/src/main/java/com/dubture/getcomposer/core/entities/AbstractJsonArray.java#L104-L113
147,796
pulse00/Composer-Java-Bindings
java-api/src/main/java/com/dubture/getcomposer/core/entities/AbstractJsonArray.java
AbstractJsonArray.replace
public void replace(V oldValue, V newValue) { if (values.contains(oldValue)) { int index = values.indexOf(oldValue); values.remove(oldValue); values.add(index, newValue); if (oldValue instanceof JsonEntity) { ((JsonEntity)oldValue).removePropertyChangeListener(propListener); } if (newValue instanceof JsonEntity) { ((JsonEntity)newValue).removePropertyChangeListener(propListener); } firePropertyChange("#" + index, oldValue, newValue); } }
java
public void replace(V oldValue, V newValue) { if (values.contains(oldValue)) { int index = values.indexOf(oldValue); values.remove(oldValue); values.add(index, newValue); if (oldValue instanceof JsonEntity) { ((JsonEntity)oldValue).removePropertyChangeListener(propListener); } if (newValue instanceof JsonEntity) { ((JsonEntity)newValue).removePropertyChangeListener(propListener); } firePropertyChange("#" + index, oldValue, newValue); } }
[ "public", "void", "replace", "(", "V", "oldValue", ",", "V", "newValue", ")", "{", "if", "(", "values", ".", "contains", "(", "oldValue", ")", ")", "{", "int", "index", "=", "values", ".", "indexOf", "(", "oldValue", ")", ";", "values", ".", "remove", "(", "oldValue", ")", ";", "values", ".", "add", "(", "index", ",", "newValue", ")", ";", "if", "(", "oldValue", "instanceof", "JsonEntity", ")", "{", "(", "(", "JsonEntity", ")", "oldValue", ")", ".", "removePropertyChangeListener", "(", "propListener", ")", ";", "}", "if", "(", "newValue", "instanceof", "JsonEntity", ")", "{", "(", "(", "JsonEntity", ")", "newValue", ")", ".", "removePropertyChangeListener", "(", "propListener", ")", ";", "}", "firePropertyChange", "(", "\"#\"", "+", "index", ",", "oldValue", ",", "newValue", ")", ";", "}", "}" ]
If oldValue exists, replaces with newValue @param oldValue @param newValue
[ "If", "oldValue", "exists", "replaces", "with", "newValue" ]
0aa572567db37d047a41a57c32ede7c7fd5d4938
https://github.com/pulse00/Composer-Java-Bindings/blob/0aa572567db37d047a41a57c32ede7c7fd5d4938/java-api/src/main/java/com/dubture/getcomposer/core/entities/AbstractJsonArray.java#L121-L137
147,797
netceteragroup/trema-core
src/main/java/com/netcetera/trema/core/XMLDatabase.java
XMLDatabase.init
private void init() { masterLanguage = null; additionalRootAttrs.clear(); // the collection is not modifiable and therefore cannot be cleared. additionalNamespaces = new ArrayList<>(); textNodeList.clear(); parseWarnings.clear(); }
java
private void init() { masterLanguage = null; additionalRootAttrs.clear(); // the collection is not modifiable and therefore cannot be cleared. additionalNamespaces = new ArrayList<>(); textNodeList.clear(); parseWarnings.clear(); }
[ "private", "void", "init", "(", ")", "{", "masterLanguage", "=", "null", ";", "additionalRootAttrs", ".", "clear", "(", ")", ";", "// the collection is not modifiable and therefore cannot be cleared.", "additionalNamespaces", "=", "new", "ArrayList", "<>", "(", ")", ";", "textNodeList", ".", "clear", "(", ")", ";", "parseWarnings", ".", "clear", "(", ")", ";", "}" ]
Reinitializes the instance variables for a new build.
[ "Reinitializes", "the", "instance", "variables", "for", "a", "new", "build", "." ]
e5367f4b80b38038d462627aa146a62bc34fc489
https://github.com/netceteragroup/trema-core/blob/e5367f4b80b38038d462627aa146a62bc34fc489/src/main/java/com/netcetera/trema/core/XMLDatabase.java#L169-L176
147,798
netceteragroup/trema-core
src/main/java/com/netcetera/trema/core/XMLDatabase.java
XMLDatabase.writeXML
public void writeXML(OutputStream outputStream, String encoding, String indent, String lineSeparator) throws IOException { XMLOutputter outputter = new XMLOutputter(); Format format = Format.getPrettyFormat(); format.setEncoding(encoding); format.setIndent(indent); format.setLineSeparator(lineSeparator); outputter.setFormat(format); outputter.output(getDocument(), outputStream); }
java
public void writeXML(OutputStream outputStream, String encoding, String indent, String lineSeparator) throws IOException { XMLOutputter outputter = new XMLOutputter(); Format format = Format.getPrettyFormat(); format.setEncoding(encoding); format.setIndent(indent); format.setLineSeparator(lineSeparator); outputter.setFormat(format); outputter.output(getDocument(), outputStream); }
[ "public", "void", "writeXML", "(", "OutputStream", "outputStream", ",", "String", "encoding", ",", "String", "indent", ",", "String", "lineSeparator", ")", "throws", "IOException", "{", "XMLOutputter", "outputter", "=", "new", "XMLOutputter", "(", ")", ";", "Format", "format", "=", "Format", ".", "getPrettyFormat", "(", ")", ";", "format", ".", "setEncoding", "(", "encoding", ")", ";", "format", ".", "setIndent", "(", "indent", ")", ";", "format", ".", "setLineSeparator", "(", "lineSeparator", ")", ";", "outputter", ".", "setFormat", "(", "format", ")", ";", "outputter", ".", "output", "(", "getDocument", "(", ")", ",", "outputStream", ")", ";", "}" ]
Serializes the database to the output stream. @param outputStream the output @param encoding the encoding to use @param indent the indent @param lineSeparator the lineSeparator @throws IOException in case the xml could not be written
[ "Serializes", "the", "database", "to", "the", "output", "stream", "." ]
e5367f4b80b38038d462627aa146a62bc34fc489
https://github.com/netceteragroup/trema-core/blob/e5367f4b80b38038d462627aa146a62bc34fc489/src/main/java/com/netcetera/trema/core/XMLDatabase.java#L281-L290
147,799
netceteragroup/trema-core
src/main/java/com/netcetera/trema/core/XMLDatabase.java
XMLDatabase.getTextNode
@Override public ITextNode getTextNode(String key) { for (ITextNode node : textNodeList) { if (key.equals(node.getKey())) { return node; } } return null; }
java
@Override public ITextNode getTextNode(String key) { for (ITextNode node : textNodeList) { if (key.equals(node.getKey())) { return node; } } return null; }
[ "@", "Override", "public", "ITextNode", "getTextNode", "(", "String", "key", ")", "{", "for", "(", "ITextNode", "node", ":", "textNodeList", ")", "{", "if", "(", "key", ".", "equals", "(", "node", ".", "getKey", "(", ")", ")", ")", "{", "return", "node", ";", "}", "}", "return", "null", ";", "}" ]
Gets the text node for a given key. @param key the key of the text node to get @return the text node for the given key or <code>null</code> if no text node exists for the given key.
[ "Gets", "the", "text", "node", "for", "a", "given", "key", "." ]
e5367f4b80b38038d462627aa146a62bc34fc489
https://github.com/netceteragroup/trema-core/blob/e5367f4b80b38038d462627aa146a62bc34fc489/src/main/java/com/netcetera/trema/core/XMLDatabase.java#L380-L388