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 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/DefaultDatastoreReader.java | DefaultDatastoreReader.load | public <E> E load(Class<E> entityClass, DatastoreKey parentKey, long id) {
EntityMetadata entityMetadata = EntityIntrospector.introspect(entityClass);
Key nativeKey;
if (parentKey == null) {
nativeKey = entityManager.newNativeKeyFactory().setKind(entityMetadata.getKind()).newKey(id);
} else {
... | java | public <E> E load(Class<E> entityClass, DatastoreKey parentKey, long id) {
EntityMetadata entityMetadata = EntityIntrospector.introspect(entityClass);
Key nativeKey;
if (parentKey == null) {
nativeKey = entityManager.newNativeKeyFactory().setKind(entityMetadata.getKind()).newKey(id);
} else {
... | [
"public",
"<",
"E",
">",
"E",
"load",
"(",
"Class",
"<",
"E",
">",
"entityClass",
",",
"DatastoreKey",
"parentKey",
",",
"long",
"id",
")",
"{",
"EntityMetadata",
"entityMetadata",
"=",
"EntityIntrospector",
".",
"introspect",
"(",
"entityClass",
")",
";",
... | Loads and returns the entity with the given ID. The entity kind is determined from the supplied
class.
@param entityClass
the entity class
@param parentKey
the parent key of the entity.
@param id
the ID of the entity
@return the Entity object or <code>null</code>, if the the entity with the given ID does not
exist in ... | [
"Loads",
"and",
"returns",
"the",
"entity",
"with",
"the",
"given",
"ID",
".",
"The",
"entity",
"kind",
"is",
"determined",
"from",
"the",
"supplied",
"class",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/DefaultDatastoreReader.java#L125-L134 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/DefaultDatastoreReader.java | DefaultDatastoreReader.load | public <E> E load(Class<E> entityClass, DatastoreKey key) {
return fetch(entityClass, key.nativeKey());
} | java | public <E> E load(Class<E> entityClass, DatastoreKey key) {
return fetch(entityClass, key.nativeKey());
} | [
"public",
"<",
"E",
">",
"E",
"load",
"(",
"Class",
"<",
"E",
">",
"entityClass",
",",
"DatastoreKey",
"key",
")",
"{",
"return",
"fetch",
"(",
"entityClass",
",",
"key",
".",
"nativeKey",
"(",
")",
")",
";",
"}"
] | Retrieves and returns the entity with the given key.
@param entityClass
the expected result type
@param key
the entity key
@return the entity with the given key, or <code>null</code>, if no entity exists with the given
key.
@throws EntityManagerException
if any error occurs while accessing the Datastore. | [
"Retrieves",
"and",
"returns",
"the",
"entity",
"with",
"the",
"given",
"key",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/DefaultDatastoreReader.java#L191-L193 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/DefaultDatastoreReader.java | DefaultDatastoreReader.loadByKey | public <E> List<E> loadByKey(Class<E> entityClass, List<DatastoreKey> keys) {
Key[] nativeKeys = DatastoreUtils.toNativeKeys(keys);
return fetch(entityClass, nativeKeys);
} | java | public <E> List<E> loadByKey(Class<E> entityClass, List<DatastoreKey> keys) {
Key[] nativeKeys = DatastoreUtils.toNativeKeys(keys);
return fetch(entityClass, nativeKeys);
} | [
"public",
"<",
"E",
">",
"List",
"<",
"E",
">",
"loadByKey",
"(",
"Class",
"<",
"E",
">",
"entityClass",
",",
"List",
"<",
"DatastoreKey",
">",
"keys",
")",
"{",
"Key",
"[",
"]",
"nativeKeys",
"=",
"DatastoreUtils",
".",
"toNativeKeys",
"(",
"keys",
... | Retrieves and returns the entities for the given keys.
@param entityClass
the expected result type
@param keys
the entity keys
@return the entities for the given keys. If one or more requested keys do not exist in the
Cloud Datastore, the corresponding item in the returned list be <code>null</code>.
@throws EntityMan... | [
"Retrieves",
"and",
"returns",
"the",
"entities",
"for",
"the",
"given",
"keys",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/DefaultDatastoreReader.java#L246-L249 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/DefaultDatastoreReader.java | DefaultDatastoreReader.fetch | private <E> E fetch(Class<E> entityClass, Key nativeKey) {
try {
Entity nativeEntity = nativeReader.get(nativeKey);
E entity = Unmarshaller.unmarshal(nativeEntity, entityClass);
entityManager.executeEntityListeners(CallbackType.POST_LOAD, entity);
return entity;
} catch (DatastoreExcepti... | java | private <E> E fetch(Class<E> entityClass, Key nativeKey) {
try {
Entity nativeEntity = nativeReader.get(nativeKey);
E entity = Unmarshaller.unmarshal(nativeEntity, entityClass);
entityManager.executeEntityListeners(CallbackType.POST_LOAD, entity);
return entity;
} catch (DatastoreExcepti... | [
"private",
"<",
"E",
">",
"E",
"fetch",
"(",
"Class",
"<",
"E",
">",
"entityClass",
",",
"Key",
"nativeKey",
")",
"{",
"try",
"{",
"Entity",
"nativeEntity",
"=",
"nativeReader",
".",
"get",
"(",
"nativeKey",
")",
";",
"E",
"entity",
"=",
"Unmarshaller"... | Fetches the entity given the native key.
@param entityClass
the expected result type
@param nativeKey
the native key
@return the entity with the given key, or <code>null</code>, if no entity exists with the given
key. | [
"Fetches",
"the",
"entity",
"given",
"the",
"native",
"key",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/DefaultDatastoreReader.java#L261-L270 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/DefaultDatastoreReader.java | DefaultDatastoreReader.fetch | private <E> List<E> fetch(Class<E> entityClass, Key[] nativeKeys) {
try {
List<Entity> nativeEntities = nativeReader.fetch(nativeKeys);
List<E> entities = DatastoreUtils.toEntities(entityClass, nativeEntities);
entityManager.executeEntityListeners(CallbackType.POST_LOAD, entities);
return en... | java | private <E> List<E> fetch(Class<E> entityClass, Key[] nativeKeys) {
try {
List<Entity> nativeEntities = nativeReader.fetch(nativeKeys);
List<E> entities = DatastoreUtils.toEntities(entityClass, nativeEntities);
entityManager.executeEntityListeners(CallbackType.POST_LOAD, entities);
return en... | [
"private",
"<",
"E",
">",
"List",
"<",
"E",
">",
"fetch",
"(",
"Class",
"<",
"E",
">",
"entityClass",
",",
"Key",
"[",
"]",
"nativeKeys",
")",
"{",
"try",
"{",
"List",
"<",
"Entity",
">",
"nativeEntities",
"=",
"nativeReader",
".",
"fetch",
"(",
"n... | Fetches a list of entities for the given native keys.
@param entityClass
the expected result type
@param nativeKeys
the native keys of the entities
@return the list of entities. If one or more keys do not exist, the corresponding item in the
returned list will be <code>null</code>. | [
"Fetches",
"a",
"list",
"of",
"entities",
"for",
"the",
"given",
"native",
"keys",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/DefaultDatastoreReader.java#L282-L291 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/DefaultDatastoreReader.java | DefaultDatastoreReader.longListToNativeKeys | private Key[] longListToNativeKeys(Class<?> entityClass, List<Long> identifiers) {
if (identifiers == null || identifiers.isEmpty()) {
return new Key[0];
}
EntityMetadata entityMetadata = EntityIntrospector.introspect(entityClass);
Key[] nativeKeys = new Key[identifiers.size()];
KeyFactory key... | java | private Key[] longListToNativeKeys(Class<?> entityClass, List<Long> identifiers) {
if (identifiers == null || identifiers.isEmpty()) {
return new Key[0];
}
EntityMetadata entityMetadata = EntityIntrospector.introspect(entityClass);
Key[] nativeKeys = new Key[identifiers.size()];
KeyFactory key... | [
"private",
"Key",
"[",
"]",
"longListToNativeKeys",
"(",
"Class",
"<",
"?",
">",
"entityClass",
",",
"List",
"<",
"Long",
">",
"identifiers",
")",
"{",
"if",
"(",
"identifiers",
"==",
"null",
"||",
"identifiers",
".",
"isEmpty",
"(",
")",
")",
"{",
"re... | Converts the given list of identifiers into an array of native Key objects.
@param entityClass
the entity class to which these identifiers belong to.
@param identifiers
the list of identifiers to convert.
@return an array of Key objects | [
"Converts",
"the",
"given",
"list",
"of",
"identifiers",
"into",
"an",
"array",
"of",
"native",
"Key",
"objects",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/DefaultDatastoreReader.java#L460-L473 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/DefaultEntityManager.java | DefaultEntityManager.getIncompleteKey | private IncompleteKey getIncompleteKey(Object entity) {
EntityMetadata entityMetadata = EntityIntrospector.introspect(entity.getClass());
String kind = entityMetadata.getKind();
ParentKeyMetadata parentKeyMetadata = entityMetadata.getParentKeyMetadata();
DatastoreKey parentKey = null;
IncompleteKey ... | java | private IncompleteKey getIncompleteKey(Object entity) {
EntityMetadata entityMetadata = EntityIntrospector.introspect(entity.getClass());
String kind = entityMetadata.getKind();
ParentKeyMetadata parentKeyMetadata = entityMetadata.getParentKeyMetadata();
DatastoreKey parentKey = null;
IncompleteKey ... | [
"private",
"IncompleteKey",
"getIncompleteKey",
"(",
"Object",
"entity",
")",
"{",
"EntityMetadata",
"entityMetadata",
"=",
"EntityIntrospector",
".",
"introspect",
"(",
"entity",
".",
"getClass",
"(",
")",
")",
";",
"String",
"kind",
"=",
"entityMetadata",
".",
... | Returns an IncompleteKey of the given entity.
@param entity
the entity
@return the incomplete key | [
"Returns",
"an",
"IncompleteKey",
"of",
"the",
"given",
"entity",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/DefaultEntityManager.java#L378-L394 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/DefaultEntityManager.java | DefaultEntityManager.executeEntityListeners | public void executeEntityListeners(CallbackType callbackType, Object entity) {
// We may get null entities here. For example loading a nonexistent ID
// or IDs.
if (entity == null) {
return;
}
EntityListenersMetadata entityListenersMetadata = EntityIntrospector
.getEntityListenersMetad... | java | public void executeEntityListeners(CallbackType callbackType, Object entity) {
// We may get null entities here. For example loading a nonexistent ID
// or IDs.
if (entity == null) {
return;
}
EntityListenersMetadata entityListenersMetadata = EntityIntrospector
.getEntityListenersMetad... | [
"public",
"void",
"executeEntityListeners",
"(",
"CallbackType",
"callbackType",
",",
"Object",
"entity",
")",
"{",
"// We may get null entities here. For example loading a nonexistent ID",
"// or IDs.",
"if",
"(",
"entity",
"==",
"null",
")",
"{",
"return",
";",
"}",
"... | Executes the entity listeners associated with the given entity.
@param callbackType
the event type
@param entity
the entity that produced the event | [
"Executes",
"the",
"entity",
"listeners",
"associated",
"with",
"the",
"given",
"entity",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/DefaultEntityManager.java#L440-L470 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/DefaultEntityManager.java | DefaultEntityManager.executeEntityListeners | public void executeEntityListeners(CallbackType callbackType, List<?> entities) {
for (Object entity : entities) {
executeEntityListeners(callbackType, entity);
}
} | java | public void executeEntityListeners(CallbackType callbackType, List<?> entities) {
for (Object entity : entities) {
executeEntityListeners(callbackType, entity);
}
} | [
"public",
"void",
"executeEntityListeners",
"(",
"CallbackType",
"callbackType",
",",
"List",
"<",
"?",
">",
"entities",
")",
"{",
"for",
"(",
"Object",
"entity",
":",
"entities",
")",
"{",
"executeEntityListeners",
"(",
"callbackType",
",",
"entity",
")",
";"... | Executes the entity listeners associated with the given list of entities.
@param callbackType
the callback type
@param entities
the entities | [
"Executes",
"the",
"entity",
"listeners",
"associated",
"with",
"the",
"given",
"list",
"of",
"entities",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/DefaultEntityManager.java#L480-L484 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/DefaultEntityManager.java | DefaultEntityManager.executeGlobalListeners | private void executeGlobalListeners(CallbackType callbackType, Object entity) {
if (globalCallbacks == null) {
return;
}
List<CallbackMetadata> callbacks = globalCallbacks.get(callbackType);
if (callbacks == null) {
return;
}
for (CallbackMetadata callback : callbacks) {
Object... | java | private void executeGlobalListeners(CallbackType callbackType, Object entity) {
if (globalCallbacks == null) {
return;
}
List<CallbackMetadata> callbacks = globalCallbacks.get(callbackType);
if (callbacks == null) {
return;
}
for (CallbackMetadata callback : callbacks) {
Object... | [
"private",
"void",
"executeGlobalListeners",
"(",
"CallbackType",
"callbackType",
",",
"Object",
"entity",
")",
"{",
"if",
"(",
"globalCallbacks",
"==",
"null",
")",
"{",
"return",
";",
"}",
"List",
"<",
"CallbackMetadata",
">",
"callbacks",
"=",
"globalCallback... | Executes the global listeners for the given event type for the given entity.
@param callbackType
the event type
@param entity
the entity | [
"Executes",
"the",
"global",
"listeners",
"for",
"the",
"given",
"event",
"type",
"for",
"the",
"given",
"entity",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/DefaultEntityManager.java#L494-L506 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/DefaultEntityManager.java | DefaultEntityManager.invokeCallbackMethod | private static void invokeCallbackMethod(Method callbackMethod, Object listener, Object entity) {
try {
callbackMethod.invoke(listener, entity);
} catch (Exception exp) {
String message = String.format("Failed to execute callback method %s of class %s",
callbackMethod.getName(), callbackMe... | java | private static void invokeCallbackMethod(Method callbackMethod, Object listener, Object entity) {
try {
callbackMethod.invoke(listener, entity);
} catch (Exception exp) {
String message = String.format("Failed to execute callback method %s of class %s",
callbackMethod.getName(), callbackMe... | [
"private",
"static",
"void",
"invokeCallbackMethod",
"(",
"Method",
"callbackMethod",
",",
"Object",
"listener",
",",
"Object",
"entity",
")",
"{",
"try",
"{",
"callbackMethod",
".",
"invoke",
"(",
"listener",
",",
"entity",
")",
";",
"}",
"catch",
"(",
"Exc... | Invokes the given callback method on the given target object.
@param callbackMethod
the callback method
@param listener
the listener object on which to invoke the method
@param entity
the entity for which the callback is being invoked. | [
"Invokes",
"the",
"given",
"callback",
"method",
"on",
"the",
"given",
"target",
"object",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/DefaultEntityManager.java#L518-L527 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/IndexerFactory.java | IndexerFactory.createIndexer | @SuppressWarnings("unchecked")
private <T extends Indexer> T createIndexer(Class<T> indexerClass) {
synchronized (indexerClass) {
Indexer indexer = cache.get(indexerClass);
if (indexer == null) {
indexer = (Indexer) IntrospectionUtils.instantiateObject(indexerClass);
cache.put(indexerC... | java | @SuppressWarnings("unchecked")
private <T extends Indexer> T createIndexer(Class<T> indexerClass) {
synchronized (indexerClass) {
Indexer indexer = cache.get(indexerClass);
if (indexer == null) {
indexer = (Indexer) IntrospectionUtils.instantiateObject(indexerClass);
cache.put(indexerC... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"<",
"T",
"extends",
"Indexer",
">",
"T",
"createIndexer",
"(",
"Class",
"<",
"T",
">",
"indexerClass",
")",
"{",
"synchronized",
"(",
"indexerClass",
")",
"{",
"Indexer",
"indexer",
"=",
"cache"... | Creates the Indexer of the given class.
@param indexerClass
the indexer implementation class
@return the Indexer. | [
"Creates",
"the",
"Indexer",
"of",
"the",
"given",
"class",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/IndexerFactory.java#L106-L116 | train |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/IndexerFactory.java | IndexerFactory.getDefaultIndexer | private Indexer getDefaultIndexer(Field field) {
Type type = field.getGenericType();
if (type instanceof Class && type.equals(String.class)) {
return getIndexer(LowerCaseStringIndexer.class);
} else if (type instanceof ParameterizedType) {
ParameterizedType parameterizedType = (ParameterizedType... | java | private Indexer getDefaultIndexer(Field field) {
Type type = field.getGenericType();
if (type instanceof Class && type.equals(String.class)) {
return getIndexer(LowerCaseStringIndexer.class);
} else if (type instanceof ParameterizedType) {
ParameterizedType parameterizedType = (ParameterizedType... | [
"private",
"Indexer",
"getDefaultIndexer",
"(",
"Field",
"field",
")",
"{",
"Type",
"type",
"=",
"field",
".",
"getGenericType",
"(",
")",
";",
"if",
"(",
"type",
"instanceof",
"Class",
"&&",
"type",
".",
"equals",
"(",
"String",
".",
"class",
")",
")",
... | Returns the default indexer for the given field.
@param field
the field.
@return the default indexer. | [
"Returns",
"the",
"default",
"indexer",
"for",
"the",
"given",
"field",
"."
] | 96d4c6dce3a5009624f7112a398406914dd19165 | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/IndexerFactory.java#L125-L142 | train |
greengerong/prerender-java | src/main/java/com/github/greengerong/PrerenderSeoService.java | PrerenderSeoService.copyRequestHeaders | private void copyRequestHeaders(HttpServletRequest servletRequest, HttpRequest proxyRequest)
throws URISyntaxException {
// Get an Enumeration of all of the header names sent by the client
Enumeration<?> enumerationOfHeaderNames = servletRequest.getHeaderNames();
while (enumerationOf... | java | private void copyRequestHeaders(HttpServletRequest servletRequest, HttpRequest proxyRequest)
throws URISyntaxException {
// Get an Enumeration of all of the header names sent by the client
Enumeration<?> enumerationOfHeaderNames = servletRequest.getHeaderNames();
while (enumerationOf... | [
"private",
"void",
"copyRequestHeaders",
"(",
"HttpServletRequest",
"servletRequest",
",",
"HttpRequest",
"proxyRequest",
")",
"throws",
"URISyntaxException",
"{",
"// Get an Enumeration of all of the header names sent by the client",
"Enumeration",
"<",
"?",
">",
"enumerationOfH... | Copy request headers from the servlet client to the proxy request.
@throws java.net.URISyntaxException | [
"Copy",
"request",
"headers",
"from",
"the",
"servlet",
"client",
"to",
"the",
"proxy",
"request",
"."
] | f7fc7a5e9adea8cf556c653a87bbac2cfcac3d06 | https://github.com/greengerong/prerender-java/blob/f7fc7a5e9adea8cf556c653a87bbac2cfcac3d06/src/main/java/com/github/greengerong/PrerenderSeoService.java#L159-L184 | train |
greengerong/prerender-java | src/main/java/com/github/greengerong/PrerenderSeoService.java | PrerenderSeoService.copyResponseHeaders | private void copyResponseHeaders(HttpResponse proxyResponse, final HttpServletResponse servletResponse) {
servletResponse.setCharacterEncoding(getContentCharSet(proxyResponse.getEntity()));
from(Arrays.asList(proxyResponse.getAllHeaders())).filter(new Predicate<Header>() {
@Override
... | java | private void copyResponseHeaders(HttpResponse proxyResponse, final HttpServletResponse servletResponse) {
servletResponse.setCharacterEncoding(getContentCharSet(proxyResponse.getEntity()));
from(Arrays.asList(proxyResponse.getAllHeaders())).filter(new Predicate<Header>() {
@Override
... | [
"private",
"void",
"copyResponseHeaders",
"(",
"HttpResponse",
"proxyResponse",
",",
"final",
"HttpServletResponse",
"servletResponse",
")",
"{",
"servletResponse",
".",
"setCharacterEncoding",
"(",
"getContentCharSet",
"(",
"proxyResponse",
".",
"getEntity",
"(",
")",
... | Copy proxied response headers back to the servlet client. | [
"Copy",
"proxied",
"response",
"headers",
"back",
"to",
"the",
"servlet",
"client",
"."
] | f7fc7a5e9adea8cf556c653a87bbac2cfcac3d06 | https://github.com/greengerong/prerender-java/blob/f7fc7a5e9adea8cf556c653a87bbac2cfcac3d06/src/main/java/com/github/greengerong/PrerenderSeoService.java#L211-L225 | train |
greengerong/prerender-java | src/main/java/com/github/greengerong/PrerenderSeoService.java | PrerenderSeoService.getContentCharSet | private String getContentCharSet(final HttpEntity entity) throws ParseException {
if (entity == null) {
return null;
}
String charset = null;
if (entity.getContentType() != null) {
HeaderElement values[] = entity.getContentType().getElements();
if (val... | java | private String getContentCharSet(final HttpEntity entity) throws ParseException {
if (entity == null) {
return null;
}
String charset = null;
if (entity.getContentType() != null) {
HeaderElement values[] = entity.getContentType().getElements();
if (val... | [
"private",
"String",
"getContentCharSet",
"(",
"final",
"HttpEntity",
"entity",
")",
"throws",
"ParseException",
"{",
"if",
"(",
"entity",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"String",
"charset",
"=",
"null",
";",
"if",
"(",
"entity",
".",
... | Get the charset used to encode the http entity. | [
"Get",
"the",
"charset",
"used",
"to",
"encode",
"the",
"http",
"entity",
"."
] | f7fc7a5e9adea8cf556c653a87bbac2cfcac3d06 | https://github.com/greengerong/prerender-java/blob/f7fc7a5e9adea8cf556c653a87bbac2cfcac3d06/src/main/java/com/github/greengerong/PrerenderSeoService.java#L230-L245 | train |
OrienteerBAP/wicket-orientdb | wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/model/NvlModel.java | NvlModel.getDefaultObject | @SuppressWarnings("unchecked")
public T getDefaultObject() {
if(defaultValue instanceof IModel) {
return ((IModel<T>)defaultValue).getObject();
} else {
return (T) defaultValue;
}
} | java | @SuppressWarnings("unchecked")
public T getDefaultObject() {
if(defaultValue instanceof IModel) {
return ((IModel<T>)defaultValue).getObject();
} else {
return (T) defaultValue;
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"T",
"getDefaultObject",
"(",
")",
"{",
"if",
"(",
"defaultValue",
"instanceof",
"IModel",
")",
"{",
"return",
"(",
"(",
"IModel",
"<",
"T",
">",
")",
"defaultValue",
")",
".",
"getObject",
"(",... | Returns default value
@return default value | [
"Returns",
"default",
"value"
] | eb1d94f00a6bff9e266c5c032baa6043afc1db92 | https://github.com/OrienteerBAP/wicket-orientdb/blob/eb1d94f00a6bff9e266c5c032baa6043afc1db92/wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/model/NvlModel.java#L41-L48 | train |
sailthru/sailthru-java-client | src/main/com/sailthru/client/SailthruClient.java | SailthruClient.getEmail | public JsonResponse getEmail(String email) throws IOException {
Email emailObj = new Email();
emailObj.setEmail(email);
return apiGet(emailObj);
} | java | public JsonResponse getEmail(String email) throws IOException {
Email emailObj = new Email();
emailObj.setEmail(email);
return apiGet(emailObj);
} | [
"public",
"JsonResponse",
"getEmail",
"(",
"String",
"email",
")",
"throws",
"IOException",
"{",
"Email",
"emailObj",
"=",
"new",
"Email",
"(",
")",
";",
"emailObj",
".",
"setEmail",
"(",
"email",
")",
";",
"return",
"apiGet",
"(",
"emailObj",
")",
";",
... | Get information about one of your users.
@param email
@throws IOException | [
"Get",
"information",
"about",
"one",
"of",
"your",
"users",
"."
] | 62b491f6a39b41b836bfc021779200d29b6d2069 | https://github.com/sailthru/sailthru-java-client/blob/62b491f6a39b41b836bfc021779200d29b6d2069/src/main/com/sailthru/client/SailthruClient.java#L83-L87 | train |
sailthru/sailthru-java-client | src/main/com/sailthru/client/SailthruClient.java | SailthruClient.getSend | public JsonResponse getSend(String sendId) throws IOException {
Map<String, Object> data = new HashMap<String, Object>();
data.put(Send.PARAM_SEND_ID, sendId);
return apiGet(ApiAction.send, data);
} | java | public JsonResponse getSend(String sendId) throws IOException {
Map<String, Object> data = new HashMap<String, Object>();
data.put(Send.PARAM_SEND_ID, sendId);
return apiGet(ApiAction.send, data);
} | [
"public",
"JsonResponse",
"getSend",
"(",
"String",
"sendId",
")",
"throws",
"IOException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"data",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"data",
".",
"put",
"(",
"Send",... | Get the status of a transational send
@param sendId Unique send id
@throws IOException | [
"Get",
"the",
"status",
"of",
"a",
"transational",
"send"
] | 62b491f6a39b41b836bfc021779200d29b6d2069 | https://github.com/sailthru/sailthru-java-client/blob/62b491f6a39b41b836bfc021779200d29b6d2069/src/main/com/sailthru/client/SailthruClient.java#L103-L107 | train |
sailthru/sailthru-java-client | src/main/com/sailthru/client/SailthruClient.java | SailthruClient.cancelSend | public JsonResponse cancelSend(String sendId) throws IOException {
Map<String, Object> data = new HashMap<String, Object>();
data.put(Send.PARAM_SEND_ID, sendId);
return apiDelete(ApiAction.send, data);
} | java | public JsonResponse cancelSend(String sendId) throws IOException {
Map<String, Object> data = new HashMap<String, Object>();
data.put(Send.PARAM_SEND_ID, sendId);
return apiDelete(ApiAction.send, data);
} | [
"public",
"JsonResponse",
"cancelSend",
"(",
"String",
"sendId",
")",
"throws",
"IOException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"data",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"data",
".",
"put",
"(",
"Sen... | Cancel a send that was scheduled for a future time.
@param sendId
@return JsonResponse
@throws IOException | [
"Cancel",
"a",
"send",
"that",
"was",
"scheduled",
"for",
"a",
"future",
"time",
"."
] | 62b491f6a39b41b836bfc021779200d29b6d2069 | https://github.com/sailthru/sailthru-java-client/blob/62b491f6a39b41b836bfc021779200d29b6d2069/src/main/com/sailthru/client/SailthruClient.java#L133-L137 | train |
sailthru/sailthru-java-client | src/main/com/sailthru/client/SailthruClient.java | SailthruClient.getBlast | public JsonResponse getBlast(Integer blastId) throws IOException {
Blast blast = new Blast();
blast.setBlastId(blastId);
return apiGet(blast);
} | java | public JsonResponse getBlast(Integer blastId) throws IOException {
Blast blast = new Blast();
blast.setBlastId(blastId);
return apiGet(blast);
} | [
"public",
"JsonResponse",
"getBlast",
"(",
"Integer",
"blastId",
")",
"throws",
"IOException",
"{",
"Blast",
"blast",
"=",
"new",
"Blast",
"(",
")",
";",
"blast",
".",
"setBlastId",
"(",
"blastId",
")",
";",
"return",
"apiGet",
"(",
"blast",
")",
";",
"}... | get information about a blast
@param blastId
@return JsonResponse
@throws IOException | [
"get",
"information",
"about",
"a",
"blast"
] | 62b491f6a39b41b836bfc021779200d29b6d2069 | https://github.com/sailthru/sailthru-java-client/blob/62b491f6a39b41b836bfc021779200d29b6d2069/src/main/com/sailthru/client/SailthruClient.java#L155-L159 | train |
sailthru/sailthru-java-client | src/main/com/sailthru/client/SailthruClient.java | SailthruClient.scheduleBlastFromTemplate | public JsonResponse scheduleBlastFromTemplate(String template, String list, Date scheduleTime, Blast blast) throws IOException {
blast.setCopyTemplate(template);
blast.setList(list);
blast.setScheduleTime(scheduleTime);
return apiPost(blast);
} | java | public JsonResponse scheduleBlastFromTemplate(String template, String list, Date scheduleTime, Blast blast) throws IOException {
blast.setCopyTemplate(template);
blast.setList(list);
blast.setScheduleTime(scheduleTime);
return apiPost(blast);
} | [
"public",
"JsonResponse",
"scheduleBlastFromTemplate",
"(",
"String",
"template",
",",
"String",
"list",
",",
"Date",
"scheduleTime",
",",
"Blast",
"blast",
")",
"throws",
"IOException",
"{",
"blast",
".",
"setCopyTemplate",
"(",
"template",
")",
";",
"blast",
"... | Schedule a mass mail from a template
@param template template name
@param list list name
@param scheduleTime schedule time for the blast
@param blast Blast Object
@throws IOException | [
"Schedule",
"a",
"mass",
"mail",
"from",
"a",
"template"
] | 62b491f6a39b41b836bfc021779200d29b6d2069 | https://github.com/sailthru/sailthru-java-client/blob/62b491f6a39b41b836bfc021779200d29b6d2069/src/main/com/sailthru/client/SailthruClient.java#L179-L184 | train |
sailthru/sailthru-java-client | src/main/com/sailthru/client/SailthruClient.java | SailthruClient.scheduleBlastFromBlast | public JsonResponse scheduleBlastFromBlast(Integer blastId, Date scheduleTime, Blast blast) throws IOException {
blast.setCopyBlast(blastId);
blast.setScheduleTime(scheduleTime);
return apiPost(blast);
} | java | public JsonResponse scheduleBlastFromBlast(Integer blastId, Date scheduleTime, Blast blast) throws IOException {
blast.setCopyBlast(blastId);
blast.setScheduleTime(scheduleTime);
return apiPost(blast);
} | [
"public",
"JsonResponse",
"scheduleBlastFromBlast",
"(",
"Integer",
"blastId",
",",
"Date",
"scheduleTime",
",",
"Blast",
"blast",
")",
"throws",
"IOException",
"{",
"blast",
".",
"setCopyBlast",
"(",
"blastId",
")",
";",
"blast",
".",
"setScheduleTime",
"(",
"s... | Schedule a mass mail blast from previous blast
@param blastId blast ID
@param scheduleTime schedule time for the blast
@param blast Blast object
@return JsonResponse
@throws IOException | [
"Schedule",
"a",
"mass",
"mail",
"blast",
"from",
"previous",
"blast"
] | 62b491f6a39b41b836bfc021779200d29b6d2069 | https://github.com/sailthru/sailthru-java-client/blob/62b491f6a39b41b836bfc021779200d29b6d2069/src/main/com/sailthru/client/SailthruClient.java#L210-L214 | train |
sailthru/sailthru-java-client | src/main/com/sailthru/client/SailthruClient.java | SailthruClient.updateBlast | public JsonResponse updateBlast(Integer blastId) throws IOException {
Blast blast = new Blast();
blast.setBlastId(blastId);
return apiPost(blast);
} | java | public JsonResponse updateBlast(Integer blastId) throws IOException {
Blast blast = new Blast();
blast.setBlastId(blastId);
return apiPost(blast);
} | [
"public",
"JsonResponse",
"updateBlast",
"(",
"Integer",
"blastId",
")",
"throws",
"IOException",
"{",
"Blast",
"blast",
"=",
"new",
"Blast",
"(",
")",
";",
"blast",
".",
"setBlastId",
"(",
"blastId",
")",
";",
"return",
"apiPost",
"(",
"blast",
")",
";",
... | Update existing blast
@param blastId
@throws IOException | [
"Update",
"existing",
"blast"
] | 62b491f6a39b41b836bfc021779200d29b6d2069 | https://github.com/sailthru/sailthru-java-client/blob/62b491f6a39b41b836bfc021779200d29b6d2069/src/main/com/sailthru/client/SailthruClient.java#L234-L238 | train |
sailthru/sailthru-java-client | src/main/com/sailthru/client/SailthruClient.java | SailthruClient.deleteBlast | public JsonResponse deleteBlast(Integer blastId) throws IOException {
Blast blast = new Blast();
blast.setBlastId(blastId);
return apiDelete(blast);
} | java | public JsonResponse deleteBlast(Integer blastId) throws IOException {
Blast blast = new Blast();
blast.setBlastId(blastId);
return apiDelete(blast);
} | [
"public",
"JsonResponse",
"deleteBlast",
"(",
"Integer",
"blastId",
")",
"throws",
"IOException",
"{",
"Blast",
"blast",
"=",
"new",
"Blast",
"(",
")",
";",
"blast",
".",
"setBlastId",
"(",
"blastId",
")",
";",
"return",
"apiDelete",
"(",
"blast",
")",
";"... | Delete existing blast
@param blastId
@throws IOException | [
"Delete",
"existing",
"blast"
] | 62b491f6a39b41b836bfc021779200d29b6d2069 | https://github.com/sailthru/sailthru-java-client/blob/62b491f6a39b41b836bfc021779200d29b6d2069/src/main/com/sailthru/client/SailthruClient.java#L256-L260 | train |
sailthru/sailthru-java-client | src/main/com/sailthru/client/SailthruClient.java | SailthruClient.cancelBlast | public JsonResponse cancelBlast(Integer blastId) throws IOException {
Blast blast = new Blast();
Date d = null;
blast
.setBlastId(blastId)
.setScheduleTime(d);
return apiPost(blast);
} | java | public JsonResponse cancelBlast(Integer blastId) throws IOException {
Blast blast = new Blast();
Date d = null;
blast
.setBlastId(blastId)
.setScheduleTime(d);
return apiPost(blast);
} | [
"public",
"JsonResponse",
"cancelBlast",
"(",
"Integer",
"blastId",
")",
"throws",
"IOException",
"{",
"Blast",
"blast",
"=",
"new",
"Blast",
"(",
")",
";",
"Date",
"d",
"=",
"null",
";",
"blast",
".",
"setBlastId",
"(",
"blastId",
")",
".",
"setScheduleTi... | Cancel a scheduled Blast
@param blastId Unique Blast ID
@throws IOException | [
"Cancel",
"a",
"scheduled",
"Blast"
] | 62b491f6a39b41b836bfc021779200d29b6d2069 | https://github.com/sailthru/sailthru-java-client/blob/62b491f6a39b41b836bfc021779200d29b6d2069/src/main/com/sailthru/client/SailthruClient.java#L267-L274 | train |
sailthru/sailthru-java-client | src/main/com/sailthru/client/SailthruClient.java | SailthruClient.getTemplate | public JsonResponse getTemplate(String template) throws IOException {
Map<String, Object> data = new HashMap<String, Object>();
data.put(Template.PARAM_TEMPLATE, template);
return apiGet(ApiAction.template, data);
} | java | public JsonResponse getTemplate(String template) throws IOException {
Map<String, Object> data = new HashMap<String, Object>();
data.put(Template.PARAM_TEMPLATE, template);
return apiGet(ApiAction.template, data);
} | [
"public",
"JsonResponse",
"getTemplate",
"(",
"String",
"template",
")",
"throws",
"IOException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"data",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"data",
".",
"put",
"(",
"... | Get template information
@param template template name
@throws IOException | [
"Get",
"template",
"information"
] | 62b491f6a39b41b836bfc021779200d29b6d2069 | https://github.com/sailthru/sailthru-java-client/blob/62b491f6a39b41b836bfc021779200d29b6d2069/src/main/com/sailthru/client/SailthruClient.java#L281-L285 | train |
sailthru/sailthru-java-client | src/main/com/sailthru/client/SailthruClient.java | SailthruClient.deleteTemplate | public JsonResponse deleteTemplate(String template) throws IOException {
Map<String, Object> data = new HashMap<String, Object>();
data.put(Template.PARAM_TEMPLATE, template);
return apiDelete(ApiAction.template, data);
} | java | public JsonResponse deleteTemplate(String template) throws IOException {
Map<String, Object> data = new HashMap<String, Object>();
data.put(Template.PARAM_TEMPLATE, template);
return apiDelete(ApiAction.template, data);
} | [
"public",
"JsonResponse",
"deleteTemplate",
"(",
"String",
"template",
")",
"throws",
"IOException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"data",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"data",
".",
"put",
"(",
... | Delete existing template
@param template template name
@throws IOException | [
"Delete",
"existing",
"template"
] | 62b491f6a39b41b836bfc021779200d29b6d2069 | https://github.com/sailthru/sailthru-java-client/blob/62b491f6a39b41b836bfc021779200d29b6d2069/src/main/com/sailthru/client/SailthruClient.java#L301-L305 | train |
sailthru/sailthru-java-client | src/main/com/sailthru/client/SailthruClient.java | SailthruClient.getAlert | public JsonResponse getAlert(String email) throws IOException {
Map<String, Object> data = new HashMap<String, Object>();
data.put(Alert.PARAM_EMAIL, email);
return apiGet(ApiAction.alert, data);
} | java | public JsonResponse getAlert(String email) throws IOException {
Map<String, Object> data = new HashMap<String, Object>();
data.put(Alert.PARAM_EMAIL, email);
return apiGet(ApiAction.alert, data);
} | [
"public",
"JsonResponse",
"getAlert",
"(",
"String",
"email",
")",
"throws",
"IOException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"data",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"data",
".",
"put",
"(",
"Alert"... | Retrieve a user's alert settings
@param email
@return JsonResponse
@throws IOException | [
"Retrieve",
"a",
"user",
"s",
"alert",
"settings"
] | 62b491f6a39b41b836bfc021779200d29b6d2069 | https://github.com/sailthru/sailthru-java-client/blob/62b491f6a39b41b836bfc021779200d29b6d2069/src/main/com/sailthru/client/SailthruClient.java#L331-L335 | train |
sailthru/sailthru-java-client | src/main/com/sailthru/client/SailthruClient.java | SailthruClient.deleteAlert | public JsonResponse deleteAlert(String email, String alertId) throws IOException {
Map<String, Object> data = new HashMap<String, Object>();
data.put(Alert.PARAM_EMAIL, email);
data.put(Alert.PARAM_ALERT_ID, alertId);
return apiDelete(ApiAction.alert, data);
} | java | public JsonResponse deleteAlert(String email, String alertId) throws IOException {
Map<String, Object> data = new HashMap<String, Object>();
data.put(Alert.PARAM_EMAIL, email);
data.put(Alert.PARAM_ALERT_ID, alertId);
return apiDelete(ApiAction.alert, data);
} | [
"public",
"JsonResponse",
"deleteAlert",
"(",
"String",
"email",
",",
"String",
"alertId",
")",
"throws",
"IOException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"data",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"data... | Delete existing user alert
@param email User.java Email
@param alertId Alert ID
@throws IOException | [
"Delete",
"existing",
"user",
"alert"
] | 62b491f6a39b41b836bfc021779200d29b6d2069 | https://github.com/sailthru/sailthru-java-client/blob/62b491f6a39b41b836bfc021779200d29b6d2069/src/main/com/sailthru/client/SailthruClient.java#L353-L358 | train |
sailthru/sailthru-java-client | src/main/com/sailthru/client/SailthruClient.java | SailthruClient.listStats | public Map<String, Object> listStats(ListStat stat) throws IOException {
return (Map<String, Object>)this.stats(stat);
} | java | public Map<String, Object> listStats(ListStat stat) throws IOException {
return (Map<String, Object>)this.stats(stat);
} | [
"public",
"Map",
"<",
"String",
",",
"Object",
">",
"listStats",
"(",
"ListStat",
"stat",
")",
"throws",
"IOException",
"{",
"return",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
")",
"this",
".",
"stats",
"(",
"stat",
")",
";",
"}"
] | get list stats information
@param stat
@return JsonResponse
@throws IOException | [
"get",
"list",
"stats",
"information"
] | 62b491f6a39b41b836bfc021779200d29b6d2069 | https://github.com/sailthru/sailthru-java-client/blob/62b491f6a39b41b836bfc021779200d29b6d2069/src/main/com/sailthru/client/SailthruClient.java#L384-L386 | train |
sailthru/sailthru-java-client | src/main/com/sailthru/client/SailthruClient.java | SailthruClient.blastStats | public Map<String, Object> blastStats(BlastStat stat) throws IOException {
return (Map<String, Object>)this.stats(stat);
} | java | public Map<String, Object> blastStats(BlastStat stat) throws IOException {
return (Map<String, Object>)this.stats(stat);
} | [
"public",
"Map",
"<",
"String",
",",
"Object",
">",
"blastStats",
"(",
"BlastStat",
"stat",
")",
"throws",
"IOException",
"{",
"return",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
")",
"this",
".",
"stats",
"(",
"stat",
")",
";",
"}"
] | get blast stats information
@param stat
@return JsonResponse
@throws IOException | [
"get",
"blast",
"stats",
"information"
] | 62b491f6a39b41b836bfc021779200d29b6d2069 | https://github.com/sailthru/sailthru-java-client/blob/62b491f6a39b41b836bfc021779200d29b6d2069/src/main/com/sailthru/client/SailthruClient.java#L394-L396 | train |
sailthru/sailthru-java-client | src/main/com/sailthru/client/SailthruClient.java | SailthruClient.getJobStatus | public JsonResponse getJobStatus(String jobId) throws IOException {
Map<String, Object> params = new HashMap<String, Object>();
params.put(Job.JOB_ID, jobId);
return apiGet(ApiAction.job, params);
} | java | public JsonResponse getJobStatus(String jobId) throws IOException {
Map<String, Object> params = new HashMap<String, Object>();
params.put(Job.JOB_ID, jobId);
return apiGet(ApiAction.job, params);
} | [
"public",
"JsonResponse",
"getJobStatus",
"(",
"String",
"jobId",
")",
"throws",
"IOException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"params",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"params",
".",
"put",
"(",
... | Get status of a job
@param jobId
@return JsonResponse
@throws IOException | [
"Get",
"status",
"of",
"a",
"job"
] | 62b491f6a39b41b836bfc021779200d29b6d2069 | https://github.com/sailthru/sailthru-java-client/blob/62b491f6a39b41b836bfc021779200d29b6d2069/src/main/com/sailthru/client/SailthruClient.java#L405-L409 | train |
OrienteerBAP/wicket-orientdb | wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/utils/OSchemaHelper.java | OSchemaHelper.linkedClass | public OSchemaHelper linkedClass(String className)
{
checkOProperty();
OClass linkedToClass = schema.getClass(className);
if(linkedToClass==null) throw new IllegalArgumentException("Target OClass '"+className+"' to link to not found");
if(!Objects.equal(linkedToClass, lastProperty.getLinkedClass()))
{
la... | java | public OSchemaHelper linkedClass(String className)
{
checkOProperty();
OClass linkedToClass = schema.getClass(className);
if(linkedToClass==null) throw new IllegalArgumentException("Target OClass '"+className+"' to link to not found");
if(!Objects.equal(linkedToClass, lastProperty.getLinkedClass()))
{
la... | [
"public",
"OSchemaHelper",
"linkedClass",
"(",
"String",
"className",
")",
"{",
"checkOProperty",
"(",
")",
";",
"OClass",
"linkedToClass",
"=",
"schema",
".",
"getClass",
"(",
"className",
")",
";",
"if",
"(",
"linkedToClass",
"==",
"null",
")",
"throw",
"n... | Set linked class to a current property
@param className class name to set as a linked class
@return this helper | [
"Set",
"linked",
"class",
"to",
"a",
"current",
"property"
] | eb1d94f00a6bff9e266c5c032baa6043afc1db92 | https://github.com/OrienteerBAP/wicket-orientdb/blob/eb1d94f00a6bff9e266c5c032baa6043afc1db92/wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/utils/OSchemaHelper.java#L148-L158 | train |
OrienteerBAP/wicket-orientdb | wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/utils/OSchemaHelper.java | OSchemaHelper.linkedType | public OSchemaHelper linkedType(OType linkedType)
{
checkOProperty();
if(!Objects.equal(linkedType, lastProperty.getLinkedType()))
{
lastProperty.setLinkedType(linkedType);
}
return this;
} | java | public OSchemaHelper linkedType(OType linkedType)
{
checkOProperty();
if(!Objects.equal(linkedType, lastProperty.getLinkedType()))
{
lastProperty.setLinkedType(linkedType);
}
return this;
} | [
"public",
"OSchemaHelper",
"linkedType",
"(",
"OType",
"linkedType",
")",
"{",
"checkOProperty",
"(",
")",
";",
"if",
"(",
"!",
"Objects",
".",
"equal",
"(",
"linkedType",
",",
"lastProperty",
".",
"getLinkedType",
"(",
")",
")",
")",
"{",
"lastProperty",
... | Set linked type to a current property
@param linkedType {@link OType} to set as a linked type
@return this helper | [
"Set",
"linked",
"type",
"to",
"a",
"current",
"property"
] | eb1d94f00a6bff9e266c5c032baa6043afc1db92 | https://github.com/OrienteerBAP/wicket-orientdb/blob/eb1d94f00a6bff9e266c5c032baa6043afc1db92/wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/utils/OSchemaHelper.java#L165-L173 | train |
OrienteerBAP/wicket-orientdb | wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/utils/OSchemaHelper.java | OSchemaHelper.field | public OSchemaHelper field(String field, Object value)
{
checkODocument();
lastDocument.field(field, value);
return this;
} | java | public OSchemaHelper field(String field, Object value)
{
checkODocument();
lastDocument.field(field, value);
return this;
} | [
"public",
"OSchemaHelper",
"field",
"(",
"String",
"field",
",",
"Object",
"value",
")",
"{",
"checkODocument",
"(",
")",
";",
"lastDocument",
".",
"field",
"(",
"field",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Sets a field value for a current document
@param field field name
@param value value to set
@return this helper | [
"Sets",
"a",
"field",
"value",
"for",
"a",
"current",
"document"
] | eb1d94f00a6bff9e266c5c032baa6043afc1db92 | https://github.com/OrienteerBAP/wicket-orientdb/blob/eb1d94f00a6bff9e266c5c032baa6043afc1db92/wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/utils/OSchemaHelper.java#L345-L350 | train |
OrienteerBAP/wicket-orientdb | wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/utils/DBClosure.java | DBClosure.sudo | public static <R> R sudo(Function<ODatabaseDocument, R> func) {
return new DBClosure<R>() {
@Override
protected R execute(ODatabaseDocument db) {
return func.apply(db);
}
}.execute();
} | java | public static <R> R sudo(Function<ODatabaseDocument, R> func) {
return new DBClosure<R>() {
@Override
protected R execute(ODatabaseDocument db) {
return func.apply(db);
}
}.execute();
} | [
"public",
"static",
"<",
"R",
">",
"R",
"sudo",
"(",
"Function",
"<",
"ODatabaseDocument",
",",
"R",
">",
"func",
")",
"{",
"return",
"new",
"DBClosure",
"<",
"R",
">",
"(",
")",
"{",
"@",
"Override",
"protected",
"R",
"execute",
"(",
"ODatabaseDocumen... | Simplified function to execute under admin
@param func function to be executed
@param <R> type of returned value
@return result of a function | [
"Simplified",
"function",
"to",
"execute",
"under",
"admin"
] | eb1d94f00a6bff9e266c5c032baa6043afc1db92 | https://github.com/OrienteerBAP/wicket-orientdb/blob/eb1d94f00a6bff9e266c5c032baa6043afc1db92/wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/utils/DBClosure.java#L97-L104 | train |
OrienteerBAP/wicket-orientdb | wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/utils/DBClosure.java | DBClosure.sudoConsumer | public static void sudoConsumer(Consumer<ODatabaseDocument> consumer) {
new DBClosure<Void>() {
@Override
protected Void execute(ODatabaseDocument db) {
consumer.accept(db);
return null;
}
}.execute();
} | java | public static void sudoConsumer(Consumer<ODatabaseDocument> consumer) {
new DBClosure<Void>() {
@Override
protected Void execute(ODatabaseDocument db) {
consumer.accept(db);
return null;
}
}.execute();
} | [
"public",
"static",
"void",
"sudoConsumer",
"(",
"Consumer",
"<",
"ODatabaseDocument",
">",
"consumer",
")",
"{",
"new",
"DBClosure",
"<",
"Void",
">",
"(",
")",
"{",
"@",
"Override",
"protected",
"Void",
"execute",
"(",
"ODatabaseDocument",
"db",
")",
"{",
... | Simplified consumer to execute under admin
@param consumer - consumer to be executed | [
"Simplified",
"consumer",
"to",
"execute",
"under",
"admin"
] | eb1d94f00a6bff9e266c5c032baa6043afc1db92 | https://github.com/OrienteerBAP/wicket-orientdb/blob/eb1d94f00a6bff9e266c5c032baa6043afc1db92/wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/utils/DBClosure.java#L110-L118 | train |
OrienteerBAP/wicket-orientdb | wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/utils/DBClosure.java | DBClosure.sudoSave | public static void sudoSave(final ODocument... docs) {
if(docs==null || docs.length==0) return;
new DBClosure<Boolean>() {
@Override
protected Boolean execute(ODatabaseDocument db) {
db.begin();
for (ODocument doc : docs) {
db.save(doc);
}
db.commit();
return true;
}
}.execute()... | java | public static void sudoSave(final ODocument... docs) {
if(docs==null || docs.length==0) return;
new DBClosure<Boolean>() {
@Override
protected Boolean execute(ODatabaseDocument db) {
db.begin();
for (ODocument doc : docs) {
db.save(doc);
}
db.commit();
return true;
}
}.execute()... | [
"public",
"static",
"void",
"sudoSave",
"(",
"final",
"ODocument",
"...",
"docs",
")",
"{",
"if",
"(",
"docs",
"==",
"null",
"||",
"docs",
".",
"length",
"==",
"0",
")",
"return",
";",
"new",
"DBClosure",
"<",
"Boolean",
">",
"(",
")",
"{",
"@",
"O... | Allow to save set of document under admin
@param docs set of document to be saved | [
"Allow",
"to",
"save",
"set",
"of",
"document",
"under",
"admin"
] | eb1d94f00a6bff9e266c5c032baa6043afc1db92 | https://github.com/OrienteerBAP/wicket-orientdb/blob/eb1d94f00a6bff9e266c5c032baa6043afc1db92/wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/utils/DBClosure.java#L125-L139 | train |
OrienteerBAP/wicket-orientdb | wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/utils/DBClosure.java | DBClosure.sudoSave | public static void sudoSave(final ODocumentWrapper... dws) {
if(dws==null || dws.length==0) return;
new DBClosure<Boolean>() {
@Override
protected Boolean execute(ODatabaseDocument db) {
db.begin();
for (ODocumentWrapper dw : dws) {
dw.save();
}
db.commit();
return true;
}
}.exe... | java | public static void sudoSave(final ODocumentWrapper... dws) {
if(dws==null || dws.length==0) return;
new DBClosure<Boolean>() {
@Override
protected Boolean execute(ODatabaseDocument db) {
db.begin();
for (ODocumentWrapper dw : dws) {
dw.save();
}
db.commit();
return true;
}
}.exe... | [
"public",
"static",
"void",
"sudoSave",
"(",
"final",
"ODocumentWrapper",
"...",
"dws",
")",
"{",
"if",
"(",
"dws",
"==",
"null",
"||",
"dws",
".",
"length",
"==",
"0",
")",
"return",
";",
"new",
"DBClosure",
"<",
"Boolean",
">",
"(",
")",
"{",
"@",
... | Allow to save set of document wrappers under admin
@param dws set of document to be saved | [
"Allow",
"to",
"save",
"set",
"of",
"document",
"wrappers",
"under",
"admin"
] | eb1d94f00a6bff9e266c5c032baa6043afc1db92 | https://github.com/OrienteerBAP/wicket-orientdb/blob/eb1d94f00a6bff9e266c5c032baa6043afc1db92/wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/utils/DBClosure.java#L145-L159 | train |
OrienteerBAP/wicket-orientdb | wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/model/AbstractNamingModel.java | AbstractNamingModel.buitify | public static String buitify(String string)
{
char[] chars = string.toCharArray();
StringBuilder sb = new StringBuilder();
int lastApplied=0;
for(int i=0; i<chars.length;i++)
{
char pCh = i>0?chars[i-1]:0;
char ch = chars[i];
if(ch=='_' || ch=='-' || Character.isWhitespace(ch))
{
sb.append(ch... | java | public static String buitify(String string)
{
char[] chars = string.toCharArray();
StringBuilder sb = new StringBuilder();
int lastApplied=0;
for(int i=0; i<chars.length;i++)
{
char pCh = i>0?chars[i-1]:0;
char ch = chars[i];
if(ch=='_' || ch=='-' || Character.isWhitespace(ch))
{
sb.append(ch... | [
"public",
"static",
"String",
"buitify",
"(",
"String",
"string",
")",
"{",
"char",
"[",
"]",
"chars",
"=",
"string",
".",
"toCharArray",
"(",
")",
";",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"int",
"lastApplied",
"=",
"0",
... | Utility method to make source string more human readable
@param string source string
@return buitified source string | [
"Utility",
"method",
"to",
"make",
"source",
"string",
"more",
"human",
"readable"
] | eb1d94f00a6bff9e266c5c032baa6043afc1db92 | https://github.com/OrienteerBAP/wicket-orientdb/blob/eb1d94f00a6bff9e266c5c032baa6043afc1db92/wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/model/AbstractNamingModel.java#L94-L128 | train |
OrienteerBAP/wicket-orientdb | wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/proto/AbstractPrototyper.java | AbstractPrototyper.getDefaultValue | protected Object getDefaultValue(String propName, Class<?> returnType)
{
Object ret = null;
if(returnType.isPrimitive())
{
if(returnType.equals(boolean.class))
{
return false;
}
else if(returnType.equals(char.class))
{
return '\0';
}
else
{
try
{
Class<?> wrapperClass... | java | protected Object getDefaultValue(String propName, Class<?> returnType)
{
Object ret = null;
if(returnType.isPrimitive())
{
if(returnType.equals(boolean.class))
{
return false;
}
else if(returnType.equals(char.class))
{
return '\0';
}
else
{
try
{
Class<?> wrapperClass... | [
"protected",
"Object",
"getDefaultValue",
"(",
"String",
"propName",
",",
"Class",
"<",
"?",
">",
"returnType",
")",
"{",
"Object",
"ret",
"=",
"null",
";",
"if",
"(",
"returnType",
".",
"isPrimitive",
"(",
")",
")",
"{",
"if",
"(",
"returnType",
".",
... | Method for obtaining default value of required property
@param propName name of a property
@param returnType type of a property
@return default value for particular property | [
"Method",
"for",
"obtaining",
"default",
"value",
"of",
"required",
"property"
] | eb1d94f00a6bff9e266c5c032baa6043afc1db92 | https://github.com/OrienteerBAP/wicket-orientdb/blob/eb1d94f00a6bff9e266c5c032baa6043afc1db92/wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/proto/AbstractPrototyper.java#L265-L291 | train |
OrienteerBAP/wicket-orientdb | wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/security/OSecurityHelper.java | OSecurityHelper.isAllowed | public static boolean isAllowed(ORule.ResourceGeneric resource, String specific, OrientPermission... permissions)
{
return OrientDbWebSession.get().getEffectiveUser()
.checkIfAllowed(resource, specific, OrientPermission.combinedPermission(permissions))!=null;
} | java | public static boolean isAllowed(ORule.ResourceGeneric resource, String specific, OrientPermission... permissions)
{
return OrientDbWebSession.get().getEffectiveUser()
.checkIfAllowed(resource, specific, OrientPermission.combinedPermission(permissions))!=null;
} | [
"public",
"static",
"boolean",
"isAllowed",
"(",
"ORule",
".",
"ResourceGeneric",
"resource",
",",
"String",
"specific",
",",
"OrientPermission",
"...",
"permissions",
")",
"{",
"return",
"OrientDbWebSession",
".",
"get",
"(",
")",
".",
"getEffectiveUser",
"(",
... | Check that all required permissions present for specified resource and specific
@param resource specific resource to secure
@param specific specific resource to secure
@param permissions {@link OrientPermission}s to check
@return true of require resource if allowed for current user | [
"Check",
"that",
"all",
"required",
"permissions",
"present",
"for",
"specified",
"resource",
"and",
"specific"
] | eb1d94f00a6bff9e266c5c032baa6043afc1db92 | https://github.com/OrienteerBAP/wicket-orientdb/blob/eb1d94f00a6bff9e266c5c032baa6043afc1db92/wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/security/OSecurityHelper.java#L213-L217 | train |
OrienteerBAP/wicket-orientdb | wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/security/OSecurityHelper.java | OSecurityHelper.getResourceSpecific | public static String getResourceSpecific(String name)
{
ORule.ResourceGeneric generic = getResourceGeneric(name);
String specific = generic!=null?Strings.afterFirst(name, '.'):name;
return Strings.isEmpty(specific)?null:specific;
} | java | public static String getResourceSpecific(String name)
{
ORule.ResourceGeneric generic = getResourceGeneric(name);
String specific = generic!=null?Strings.afterFirst(name, '.'):name;
return Strings.isEmpty(specific)?null:specific;
} | [
"public",
"static",
"String",
"getResourceSpecific",
"(",
"String",
"name",
")",
"{",
"ORule",
".",
"ResourceGeneric",
"generic",
"=",
"getResourceGeneric",
"(",
"name",
")",
";",
"String",
"specific",
"=",
"generic",
"!=",
"null",
"?",
"Strings",
".",
"afterF... | Extract specific from resource string
@param name name to transform
@return specific resource or null | [
"Extract",
"specific",
"from",
"resource",
"string"
] | eb1d94f00a6bff9e266c5c032baa6043afc1db92 | https://github.com/OrienteerBAP/wicket-orientdb/blob/eb1d94f00a6bff9e266c5c032baa6043afc1db92/wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/security/OSecurityHelper.java#L270-L275 | train |
OrienteerBAP/wicket-orientdb | wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/OrientDbSettings.java | OrientDbSettings.resolveOrientDBRestApiUrl | public String resolveOrientDBRestApiUrl()
{
OrientDbWebApplication app = OrientDbWebApplication.get();
OServer server = app.getServer();
if(server!=null)
{
OServerNetworkListener http = server.getListenerByProtocol(ONetworkProtocolHttpAbstract.class);
if(http!=null)
{
return "http://"+http.getList... | java | public String resolveOrientDBRestApiUrl()
{
OrientDbWebApplication app = OrientDbWebApplication.get();
OServer server = app.getServer();
if(server!=null)
{
OServerNetworkListener http = server.getListenerByProtocol(ONetworkProtocolHttpAbstract.class);
if(http!=null)
{
return "http://"+http.getList... | [
"public",
"String",
"resolveOrientDBRestApiUrl",
"(",
")",
"{",
"OrientDbWebApplication",
"app",
"=",
"OrientDbWebApplication",
".",
"get",
"(",
")",
";",
"OServer",
"server",
"=",
"app",
".",
"getServer",
"(",
")",
";",
"if",
"(",
"server",
"!=",
"null",
")... | Resolve OrientDB REST API URL to be used for OrientDb REST bridge
@return OrientDB REST API URL | [
"Resolve",
"OrientDB",
"REST",
"API",
"URL",
"to",
"be",
"used",
"for",
"OrientDb",
"REST",
"bridge"
] | eb1d94f00a6bff9e266c5c032baa6043afc1db92 | https://github.com/OrienteerBAP/wicket-orientdb/blob/eb1d94f00a6bff9e266c5c032baa6043afc1db92/wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/OrientDbSettings.java#L138-L151 | train |
OrienteerBAP/wicket-orientdb | wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/AbstractContentAwareTransactionRequestCycleListener.java | AbstractContentAwareTransactionRequestCycleListener.isInProgress | public boolean isInProgress(RequestCycle cycle)
{
Boolean inProgress = cycle.getMetaData(IN_PROGRESS_KEY);
return inProgress!=null?inProgress:false;
} | java | public boolean isInProgress(RequestCycle cycle)
{
Boolean inProgress = cycle.getMetaData(IN_PROGRESS_KEY);
return inProgress!=null?inProgress:false;
} | [
"public",
"boolean",
"isInProgress",
"(",
"RequestCycle",
"cycle",
")",
"{",
"Boolean",
"inProgress",
"=",
"cycle",
".",
"getMetaData",
"(",
"IN_PROGRESS_KEY",
")",
";",
"return",
"inProgress",
"!=",
"null",
"?",
"inProgress",
":",
"false",
";",
"}"
] | Is current 'transaction' in progress?
@param cycle {@link RequestCycle}
@return true - if we are within a transaction, false - if not | [
"Is",
"current",
"transaction",
"in",
"progress?"
] | eb1d94f00a6bff9e266c5c032baa6043afc1db92 | https://github.com/OrienteerBAP/wicket-orientdb/blob/eb1d94f00a6bff9e266c5c032baa6043afc1db92/wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/AbstractContentAwareTransactionRequestCycleListener.java#L40-L44 | train |
OrienteerBAP/wicket-orientdb | wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/model/OQueryModel.java | OQueryModel.probeOClass | public OClass probeOClass(int probeLimit) {
Iterator<ODocument> it = iterator(0, probeLimit, null);
return OSchemaUtils.probeOClass(it, probeLimit);
} | java | public OClass probeOClass(int probeLimit) {
Iterator<ODocument> it = iterator(0, probeLimit, null);
return OSchemaUtils.probeOClass(it, probeLimit);
} | [
"public",
"OClass",
"probeOClass",
"(",
"int",
"probeLimit",
")",
"{",
"Iterator",
"<",
"ODocument",
">",
"it",
"=",
"iterator",
"(",
"0",
",",
"probeLimit",
",",
"null",
")",
";",
"return",
"OSchemaUtils",
".",
"probeOClass",
"(",
"it",
",",
"probeLimit",... | Probe the dataset and returns upper OClass for sample
@param probeLimit size of a probe
@return OClass or null if there is no common parent for {@link ODocument}'s in a sample | [
"Probe",
"the",
"dataset",
"and",
"returns",
"upper",
"OClass",
"for",
"sample"
] | eb1d94f00a6bff9e266c5c032baa6043afc1db92 | https://github.com/OrienteerBAP/wicket-orientdb/blob/eb1d94f00a6bff9e266c5c032baa6043afc1db92/wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/model/OQueryModel.java#L234-L237 | train |
OrienteerBAP/wicket-orientdb | wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/model/OQueryModel.java | OQueryModel.size | public long size()
{
if(size==null)
{
ODatabaseDocument db = OrientDbWebSession.get().getDatabase();
OSQLSynchQuery<ODocument> query = new OSQLSynchQuery<ODocument>(queryManager.getCountSql());
List<ODocument> ret = db.query(enhanceContextByVariables(query), prepareParams());
if(re... | java | public long size()
{
if(size==null)
{
ODatabaseDocument db = OrientDbWebSession.get().getDatabase();
OSQLSynchQuery<ODocument> query = new OSQLSynchQuery<ODocument>(queryManager.getCountSql());
List<ODocument> ret = db.query(enhanceContextByVariables(query), prepareParams());
if(re... | [
"public",
"long",
"size",
"(",
")",
"{",
"if",
"(",
"size",
"==",
"null",
")",
"{",
"ODatabaseDocument",
"db",
"=",
"OrientDbWebSession",
".",
"get",
"(",
")",
".",
"getDatabase",
"(",
")",
";",
"OSQLSynchQuery",
"<",
"ODocument",
">",
"query",
"=",
"n... | Get the size of the data
@return results size | [
"Get",
"the",
"size",
"of",
"the",
"data"
] | eb1d94f00a6bff9e266c5c032baa6043afc1db92 | https://github.com/OrienteerBAP/wicket-orientdb/blob/eb1d94f00a6bff9e266c5c032baa6043afc1db92/wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/model/OQueryModel.java#L248-L266 | train |
OrienteerBAP/wicket-orientdb | wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/model/OQueryModel.java | OQueryModel.setSort | public OQueryModel<K> setSort(String sortableParameter, SortOrder order)
{
setSortableParameter(sortableParameter);
setAscending(SortOrder.ASCENDING.equals(order));
return this;
} | java | public OQueryModel<K> setSort(String sortableParameter, SortOrder order)
{
setSortableParameter(sortableParameter);
setAscending(SortOrder.ASCENDING.equals(order));
return this;
} | [
"public",
"OQueryModel",
"<",
"K",
">",
"setSort",
"(",
"String",
"sortableParameter",
",",
"SortOrder",
"order",
")",
"{",
"setSortableParameter",
"(",
"sortableParameter",
")",
";",
"setAscending",
"(",
"SortOrder",
".",
"ASCENDING",
".",
"equals",
"(",
"order... | Set sorting configration
@param sortableParameter sortable parameter to sort on
@param order {@link SortOrder} to sort on
@return this {@link OQueryModel} | [
"Set",
"sorting",
"configration"
] | eb1d94f00a6bff9e266c5c032baa6043afc1db92 | https://github.com/OrienteerBAP/wicket-orientdb/blob/eb1d94f00a6bff9e266c5c032baa6043afc1db92/wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/model/OQueryModel.java#L325-L330 | train |
sailthru/sailthru-java-client | src/main/com/sailthru/client/SailthruUtil.java | SailthruUtil.md5 | public static String md5(String data) {
try {
return DigestUtils.md5Hex(data.toString().getBytes("UTF-8"));
}
catch (UnsupportedEncodingException e) {
return DigestUtils.md5Hex(data.toString());
}
} | java | public static String md5(String data) {
try {
return DigestUtils.md5Hex(data.toString().getBytes("UTF-8"));
}
catch (UnsupportedEncodingException e) {
return DigestUtils.md5Hex(data.toString());
}
} | [
"public",
"static",
"String",
"md5",
"(",
"String",
"data",
")",
"{",
"try",
"{",
"return",
"DigestUtils",
".",
"md5Hex",
"(",
"data",
".",
"toString",
"(",
")",
".",
"getBytes",
"(",
"\"UTF-8\"",
")",
")",
";",
"}",
"catch",
"(",
"UnsupportedEncodingExc... | generates MD5 Hash
@param data parameter data
@return MD5 hashed string | [
"generates",
"MD5",
"Hash"
] | 62b491f6a39b41b836bfc021779200d29b6d2069 | https://github.com/sailthru/sailthru-java-client/blob/62b491f6a39b41b836bfc021779200d29b6d2069/src/main/com/sailthru/client/SailthruUtil.java#L24-L31 | train |
sailthru/sailthru-java-client | src/main/com/sailthru/client/SailthruUtil.java | SailthruUtil.arrayListToCSV | public static String arrayListToCSV(List<String> list) {
StringBuilder csv = new StringBuilder();
for (String str : list) {
csv.append(str);
csv.append(",");
}
int lastIndex = csv.length() - 1;
char last = csv.charAt(lastIndex);
if (last == ',') {
... | java | public static String arrayListToCSV(List<String> list) {
StringBuilder csv = new StringBuilder();
for (String str : list) {
csv.append(str);
csv.append(",");
}
int lastIndex = csv.length() - 1;
char last = csv.charAt(lastIndex);
if (last == ',') {
... | [
"public",
"static",
"String",
"arrayListToCSV",
"(",
"List",
"<",
"String",
">",
"list",
")",
"{",
"StringBuilder",
"csv",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"String",
"str",
":",
"list",
")",
"{",
"csv",
".",
"append",
"(",
"str",... | Converts String ArrayList to CSV string
@param list List of String to create a CSV string
@return CSV string | [
"Converts",
"String",
"ArrayList",
"to",
"CSV",
"string"
] | 62b491f6a39b41b836bfc021779200d29b6d2069 | https://github.com/sailthru/sailthru-java-client/blob/62b491f6a39b41b836bfc021779200d29b6d2069/src/main/com/sailthru/client/SailthruUtil.java#L38-L50 | train |
sailthru/sailthru-java-client | src/main/com/sailthru/client/AbstractSailthruClient.java | AbstractSailthruClient.getScheme | protected Scheme getScheme() {
String scheme;
try {
URI uri = new URI(this.apiUrl);
scheme = uri.getScheme();
} catch (URISyntaxException e) {
scheme = "http";
}
if (scheme.equals("https")) {
return new Scheme(scheme, DEFAULT_HTTPS_... | java | protected Scheme getScheme() {
String scheme;
try {
URI uri = new URI(this.apiUrl);
scheme = uri.getScheme();
} catch (URISyntaxException e) {
scheme = "http";
}
if (scheme.equals("https")) {
return new Scheme(scheme, DEFAULT_HTTPS_... | [
"protected",
"Scheme",
"getScheme",
"(",
")",
"{",
"String",
"scheme",
";",
"try",
"{",
"URI",
"uri",
"=",
"new",
"URI",
"(",
"this",
".",
"apiUrl",
")",
";",
"scheme",
"=",
"uri",
".",
"getScheme",
"(",
")",
";",
"}",
"catch",
"(",
"URISyntaxExcepti... | Get Scheme Object | [
"Get",
"Scheme",
"Object"
] | 62b491f6a39b41b836bfc021779200d29b6d2069 | https://github.com/sailthru/sailthru-java-client/blob/62b491f6a39b41b836bfc021779200d29b6d2069/src/main/com/sailthru/client/AbstractSailthruClient.java#L129-L142 | train |
sailthru/sailthru-java-client | src/main/com/sailthru/client/AbstractSailthruClient.java | AbstractSailthruClient.httpRequest | protected Object httpRequest(ApiAction action, HttpRequestMethod method, Map<String, Object> data) throws IOException {
String url = this.apiUrl + "/" + action.toString().toLowerCase();
Type type = new TypeToken<Map<String, Object>>() {}.getType();
String json = GSON.toJson(data, type);
... | java | protected Object httpRequest(ApiAction action, HttpRequestMethod method, Map<String, Object> data) throws IOException {
String url = this.apiUrl + "/" + action.toString().toLowerCase();
Type type = new TypeToken<Map<String, Object>>() {}.getType();
String json = GSON.toJson(data, type);
... | [
"protected",
"Object",
"httpRequest",
"(",
"ApiAction",
"action",
",",
"HttpRequestMethod",
"method",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"data",
")",
"throws",
"IOException",
"{",
"String",
"url",
"=",
"this",
".",
"apiUrl",
"+",
"\"/\"",
"+",
... | Make Http request to Sailthru API for given resource with given method and data
@param action
@param method
@param data parameter data
@return Object
@throws IOException | [
"Make",
"Http",
"request",
"to",
"Sailthru",
"API",
"for",
"given",
"resource",
"with",
"given",
"method",
"and",
"data"
] | 62b491f6a39b41b836bfc021779200d29b6d2069 | https://github.com/sailthru/sailthru-java-client/blob/62b491f6a39b41b836bfc021779200d29b6d2069/src/main/com/sailthru/client/AbstractSailthruClient.java#L153-L161 | train |
sailthru/sailthru-java-client | src/main/com/sailthru/client/AbstractSailthruClient.java | AbstractSailthruClient.httpRequest | protected Object httpRequest(HttpRequestMethod method, ApiParams apiParams) throws IOException {
ApiAction action = apiParams.getApiCall();
String url = apiUrl + "/" + action.toString().toLowerCase();
String json = GSON.toJson(apiParams, apiParams.getType());
Map<String, String> params =... | java | protected Object httpRequest(HttpRequestMethod method, ApiParams apiParams) throws IOException {
ApiAction action = apiParams.getApiCall();
String url = apiUrl + "/" + action.toString().toLowerCase();
String json = GSON.toJson(apiParams, apiParams.getType());
Map<String, String> params =... | [
"protected",
"Object",
"httpRequest",
"(",
"HttpRequestMethod",
"method",
",",
"ApiParams",
"apiParams",
")",
"throws",
"IOException",
"{",
"ApiAction",
"action",
"=",
"apiParams",
".",
"getApiCall",
"(",
")",
";",
"String",
"url",
"=",
"apiUrl",
"+",
"\"/\"",
... | Make HTTP Request to Sailthru API but with Api Params rather than generalized Map, this is recommended way to make request if data structure is complex
@param method HTTP method
@param apiParams
@return Object
@throws IOException | [
"Make",
"HTTP",
"Request",
"to",
"Sailthru",
"API",
"but",
"with",
"Api",
"Params",
"rather",
"than",
"generalized",
"Map",
"this",
"is",
"recommended",
"way",
"to",
"make",
"request",
"if",
"data",
"structure",
"is",
"complex"
] | 62b491f6a39b41b836bfc021779200d29b6d2069 | https://github.com/sailthru/sailthru-java-client/blob/62b491f6a39b41b836bfc021779200d29b6d2069/src/main/com/sailthru/client/AbstractSailthruClient.java#L170-L178 | train |
sailthru/sailthru-java-client | src/main/com/sailthru/client/AbstractSailthruClient.java | AbstractSailthruClient.buildPayload | private Map<String, String> buildPayload(String jsonPayload) {
Map<String, String> params = new HashMap<String, String>();
params.put("api_key", apiKey);
params.put("format", handler.getSailthruResponseHandler().getFormat());
params.put("json", jsonPayload);
params.put("sig", get... | java | private Map<String, String> buildPayload(String jsonPayload) {
Map<String, String> params = new HashMap<String, String>();
params.put("api_key", apiKey);
params.put("format", handler.getSailthruResponseHandler().getFormat());
params.put("json", jsonPayload);
params.put("sig", get... | [
"private",
"Map",
"<",
"String",
",",
"String",
">",
"buildPayload",
"(",
"String",
"jsonPayload",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"params",
"=",
"new",
"HashMap",
"<",
"String",
",",
"String",
">",
"(",
")",
";",
"params",
".",
"... | Build HTTP Request Payload
@param jsonPayload JSON payload
@return Map Object | [
"Build",
"HTTP",
"Request",
"Payload"
] | 62b491f6a39b41b836bfc021779200d29b6d2069 | https://github.com/sailthru/sailthru-java-client/blob/62b491f6a39b41b836bfc021779200d29b6d2069/src/main/com/sailthru/client/AbstractSailthruClient.java#L215-L222 | train |
sailthru/sailthru-java-client | src/main/com/sailthru/client/AbstractSailthruClient.java | AbstractSailthruClient.getSignatureHash | protected String getSignatureHash(Map<String, String> parameters) {
List<String> values = new ArrayList<String>();
StringBuilder data = new StringBuilder();
data.append(this.apiSecret);
for (Entry<String, String> entry : parameters.entrySet()) {
values.add(entry.getValue());... | java | protected String getSignatureHash(Map<String, String> parameters) {
List<String> values = new ArrayList<String>();
StringBuilder data = new StringBuilder();
data.append(this.apiSecret);
for (Entry<String, String> entry : parameters.entrySet()) {
values.add(entry.getValue());... | [
"protected",
"String",
"getSignatureHash",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"parameters",
")",
"{",
"List",
"<",
"String",
">",
"values",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"StringBuilder",
"data",
"=",
"new",
"Stri... | Get Signature Hash from given Map | [
"Get",
"Signature",
"Hash",
"from",
"given",
"Map"
] | 62b491f6a39b41b836bfc021779200d29b6d2069 | https://github.com/sailthru/sailthru-java-client/blob/62b491f6a39b41b836bfc021779200d29b6d2069/src/main/com/sailthru/client/AbstractSailthruClient.java#L227-L243 | train |
sailthru/sailthru-java-client | src/main/com/sailthru/client/AbstractSailthruClient.java | AbstractSailthruClient.apiGet | public JsonResponse apiGet(ApiAction action, Map<String, Object> data) throws IOException {
return httpRequestJson(action, HttpRequestMethod.GET, data);
} | java | public JsonResponse apiGet(ApiAction action, Map<String, Object> data) throws IOException {
return httpRequestJson(action, HttpRequestMethod.GET, data);
} | [
"public",
"JsonResponse",
"apiGet",
"(",
"ApiAction",
"action",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"data",
")",
"throws",
"IOException",
"{",
"return",
"httpRequestJson",
"(",
"action",
",",
"HttpRequestMethod",
".",
"GET",
",",
"data",
")",
";",... | HTTP GET Request with Map
@param action API action
@param data Parameter data
@throws IOException | [
"HTTP",
"GET",
"Request",
"with",
"Map"
] | 62b491f6a39b41b836bfc021779200d29b6d2069 | https://github.com/sailthru/sailthru-java-client/blob/62b491f6a39b41b836bfc021779200d29b6d2069/src/main/com/sailthru/client/AbstractSailthruClient.java#L252-L254 | train |
sailthru/sailthru-java-client | src/main/com/sailthru/client/AbstractSailthruClient.java | AbstractSailthruClient.apiPost | public JsonResponse apiPost(ApiAction action, Map<String, Object> data) throws IOException {
return httpRequestJson(action, HttpRequestMethod.POST, data);
} | java | public JsonResponse apiPost(ApiAction action, Map<String, Object> data) throws IOException {
return httpRequestJson(action, HttpRequestMethod.POST, data);
} | [
"public",
"JsonResponse",
"apiPost",
"(",
"ApiAction",
"action",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"data",
")",
"throws",
"IOException",
"{",
"return",
"httpRequestJson",
"(",
"action",
",",
"HttpRequestMethod",
".",
"POST",
",",
"data",
")",
";... | HTTP POST Request with Map
@param action
@param data
@throws IOException | [
"HTTP",
"POST",
"Request",
"with",
"Map"
] | 62b491f6a39b41b836bfc021779200d29b6d2069 | https://github.com/sailthru/sailthru-java-client/blob/62b491f6a39b41b836bfc021779200d29b6d2069/src/main/com/sailthru/client/AbstractSailthruClient.java#L271-L273 | train |
sailthru/sailthru-java-client | src/main/com/sailthru/client/AbstractSailthruClient.java | AbstractSailthruClient.apiPost | public JsonResponse apiPost(ApiParams data, ApiFileParams fileParams) throws IOException {
return httpRequestJson(HttpRequestMethod.POST, data, fileParams);
} | java | public JsonResponse apiPost(ApiParams data, ApiFileParams fileParams) throws IOException {
return httpRequestJson(HttpRequestMethod.POST, data, fileParams);
} | [
"public",
"JsonResponse",
"apiPost",
"(",
"ApiParams",
"data",
",",
"ApiFileParams",
"fileParams",
")",
"throws",
"IOException",
"{",
"return",
"httpRequestJson",
"(",
"HttpRequestMethod",
".",
"POST",
",",
"data",
",",
"fileParams",
")",
";",
"}"
] | HTTP POST Request with Interface implementation of ApiParams and ApiFileParams
@param data
@param fileParams
@throws IOException | [
"HTTP",
"POST",
"Request",
"with",
"Interface",
"implementation",
"of",
"ApiParams",
"and",
"ApiFileParams"
] | 62b491f6a39b41b836bfc021779200d29b6d2069 | https://github.com/sailthru/sailthru-java-client/blob/62b491f6a39b41b836bfc021779200d29b6d2069/src/main/com/sailthru/client/AbstractSailthruClient.java#L291-L293 | train |
sailthru/sailthru-java-client | src/main/com/sailthru/client/AbstractSailthruClient.java | AbstractSailthruClient.apiDelete | public JsonResponse apiDelete(ApiAction action, Map<String, Object> data) throws IOException {
return httpRequestJson(action, HttpRequestMethod.DELETE, data);
} | java | public JsonResponse apiDelete(ApiAction action, Map<String, Object> data) throws IOException {
return httpRequestJson(action, HttpRequestMethod.DELETE, data);
} | [
"public",
"JsonResponse",
"apiDelete",
"(",
"ApiAction",
"action",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"data",
")",
"throws",
"IOException",
"{",
"return",
"httpRequestJson",
"(",
"action",
",",
"HttpRequestMethod",
".",
"DELETE",
",",
"data",
")",
... | HTTP DELETE Request
@param action
@param data
@throws IOException | [
"HTTP",
"DELETE",
"Request"
] | 62b491f6a39b41b836bfc021779200d29b6d2069 | https://github.com/sailthru/sailthru-java-client/blob/62b491f6a39b41b836bfc021779200d29b6d2069/src/main/com/sailthru/client/AbstractSailthruClient.java#L302-L304 | train |
GCRC/nunaliit | nunaliit2-dbSec/src/main/java/ca/carleton/gcrc/dbSec/impl/ColumnDataUtils.java | ColumnDataUtils.obtainNextIncrementInteger | static public int obtainNextIncrementInteger(Connection connection, ColumnData autoIncrementIntegerColumn) throws Exception {
try {
String sqlQuery = "SELECT nextval(?);";
// Create SQL command
PreparedStatement pstmt = null;
{
pstmt = connection.prepareStatement(sqlQuery);
// Populate prepa... | java | static public int obtainNextIncrementInteger(Connection connection, ColumnData autoIncrementIntegerColumn) throws Exception {
try {
String sqlQuery = "SELECT nextval(?);";
// Create SQL command
PreparedStatement pstmt = null;
{
pstmt = connection.prepareStatement(sqlQuery);
// Populate prepa... | [
"static",
"public",
"int",
"obtainNextIncrementInteger",
"(",
"Connection",
"connection",
",",
"ColumnData",
"autoIncrementIntegerColumn",
")",
"throws",
"Exception",
"{",
"try",
"{",
"String",
"sqlQuery",
"=",
"\"SELECT nextval(?);\"",
";",
"// Create SQL command",
"Prep... | Performs a database query to find the next integer in the sequence reserved for
the given column.
@param autoIncrementIntegerColumn Column data where a new integer is required
@return The next integer in sequence
@throws Exception | [
"Performs",
"a",
"database",
"query",
"to",
"find",
"the",
"next",
"integer",
"in",
"the",
"sequence",
"reserved",
"for",
"the",
"given",
"column",
"."
] | 0b4abfc64eef2eb8b94f852ce697de2e851d8e67 | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-dbSec/src/main/java/ca/carleton/gcrc/dbSec/impl/ColumnDataUtils.java#L355-L386 | train |
GCRC/nunaliit | nunaliit2-json/src/main/java/org/json/XMLTokener.java | XMLTokener.unescapeEntity | static String unescapeEntity(String e) {
// validate
if (e == null || e.isEmpty()) {
return "";
}
// if our entity is an encoded unicode point, parse it.
if (e.charAt(0) == '#') {
int cp;
if (e.charAt(1) == 'x') {
// hex encoded... | java | static String unescapeEntity(String e) {
// validate
if (e == null || e.isEmpty()) {
return "";
}
// if our entity is an encoded unicode point, parse it.
if (e.charAt(0) == '#') {
int cp;
if (e.charAt(1) == 'x') {
// hex encoded... | [
"static",
"String",
"unescapeEntity",
"(",
"String",
"e",
")",
"{",
"// validate",
"if",
"(",
"e",
"==",
"null",
"||",
"e",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"\"\"",
";",
"}",
"// if our entity is an encoded unicode point, parse it.",
"if",
"(",
... | Unescapes an XML entity encoding;
@param e entity (only the actual entity value, not the preceding & or ending ;
@return | [
"Unescapes",
"an",
"XML",
"entity",
"encoding",
";"
] | 0b4abfc64eef2eb8b94f852ce697de2e851d8e67 | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-json/src/main/java/org/json/XMLTokener.java#L159-L182 | train |
GCRC/nunaliit | nunaliit2-couch-client/src/main/java/ca/carleton/gcrc/couch/client/impl/CouchDbChangeMonitorThread.java | CouchDbChangeMonitorThread.convertLastSeqObj | private String convertLastSeqObj(Object lastSeqObj) throws Exception {
if( null == lastSeqObj ) {
return null;
} else if( lastSeqObj instanceof String ) {
return (String)lastSeqObj;
} else if( lastSeqObj instanceof Number ) {
// Convert to string
return "" + lastSeqObj;
} else {
throw new Excepti... | java | private String convertLastSeqObj(Object lastSeqObj) throws Exception {
if( null == lastSeqObj ) {
return null;
} else if( lastSeqObj instanceof String ) {
return (String)lastSeqObj;
} else if( lastSeqObj instanceof Number ) {
// Convert to string
return "" + lastSeqObj;
} else {
throw new Excepti... | [
"private",
"String",
"convertLastSeqObj",
"(",
"Object",
"lastSeqObj",
")",
"throws",
"Exception",
"{",
"if",
"(",
"null",
"==",
"lastSeqObj",
")",
"{",
"return",
"null",
";",
"}",
"else",
"if",
"(",
"lastSeqObj",
"instanceof",
"String",
")",
"{",
"return",
... | Converts the object "last_seq" found in the change feed to a String.
In CouchDB 1.x, last_seq is an integer. In CouchDB 2.x, last_seq is a string.
@param lastSeqObj Object retrieved from the change feed
@return A string representing the object
@throws Exception | [
"Converts",
"the",
"object",
"last_seq",
"found",
"in",
"the",
"change",
"feed",
"to",
"a",
"String",
".",
"In",
"CouchDB",
"1",
".",
"x",
"last_seq",
"is",
"an",
"integer",
".",
"In",
"CouchDB",
"2",
".",
"x",
"last_seq",
"is",
"a",
"string",
"."
] | 0b4abfc64eef2eb8b94f852ce697de2e851d8e67 | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-couch-client/src/main/java/ca/carleton/gcrc/couch/client/impl/CouchDbChangeMonitorThread.java#L180-L191 | train |
GCRC/nunaliit | nunaliit2-couch-onUpload/src/main/java/ca/carleton/gcrc/couch/onUpload/conversion/AttachmentDescriptor.java | AttachmentDescriptor.renameAttachmentTo | public void renameAttachmentTo(String newAttachmentName) throws Exception {
JSONObject doc = documentDescriptor.getJson();
JSONObject _attachments = doc.optJSONObject("_attachments");
JSONObject nunaliit_attachments = doc.getJSONObject(UploadConstants.KEY_DOC_ATTACHMENTS);
JSONObject files = nunaliit_attachment... | java | public void renameAttachmentTo(String newAttachmentName) throws Exception {
JSONObject doc = documentDescriptor.getJson();
JSONObject _attachments = doc.optJSONObject("_attachments");
JSONObject nunaliit_attachments = doc.getJSONObject(UploadConstants.KEY_DOC_ATTACHMENTS);
JSONObject files = nunaliit_attachment... | [
"public",
"void",
"renameAttachmentTo",
"(",
"String",
"newAttachmentName",
")",
"throws",
"Exception",
"{",
"JSONObject",
"doc",
"=",
"documentDescriptor",
".",
"getJson",
"(",
")",
";",
"JSONObject",
"_attachments",
"=",
"doc",
".",
"optJSONObject",
"(",
"\"_att... | Renames an attachment. This ensures that there is no collision and that
all references to this attachment are updated properly, within this document.
@param newAttachmentName The new attachment name.
@throws Exception | [
"Renames",
"an",
"attachment",
".",
"This",
"ensures",
"that",
"there",
"is",
"no",
"collision",
"and",
"that",
"all",
"references",
"to",
"this",
"attachment",
"are",
"updated",
"properly",
"within",
"this",
"document",
"."
] | 0b4abfc64eef2eb8b94f852ce697de2e851d8e67 | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-couch-onUpload/src/main/java/ca/carleton/gcrc/couch/onUpload/conversion/AttachmentDescriptor.java#L65-L136 | train |
GCRC/nunaliit | nunaliit2-couch-client/src/main/java/ca/carleton/gcrc/couch/fsentry/FSEntryFile.java | FSEntryFile.getPositionedFile | static public FSEntry getPositionedFile(String path, File file) throws Exception {
List<String> pathFrags = FSEntrySupport.interpretPath(path);
// Start at leaf and work our way back
int index = pathFrags.size() - 1;
FSEntry root = new FSEntryFile(pathFrags.get(index), file);
--index;
while(index >= 0... | java | static public FSEntry getPositionedFile(String path, File file) throws Exception {
List<String> pathFrags = FSEntrySupport.interpretPath(path);
// Start at leaf and work our way back
int index = pathFrags.size() - 1;
FSEntry root = new FSEntryFile(pathFrags.get(index), file);
--index;
while(index >= 0... | [
"static",
"public",
"FSEntry",
"getPositionedFile",
"(",
"String",
"path",
",",
"File",
"file",
")",
"throws",
"Exception",
"{",
"List",
"<",
"String",
">",
"pathFrags",
"=",
"FSEntrySupport",
".",
"interpretPath",
"(",
"path",
")",
";",
"// Start at leaf and wo... | Create a virtual tree hierarchy with a file supporting the leaf.
@param path Position of the file in the hierarchy, including its name
@param file The actual file, or directory , abcking the end leaf
@return The FSEntry root for this hierarchy
@throws Exception Invalid parameter | [
"Create",
"a",
"virtual",
"tree",
"hierarchy",
"with",
"a",
"file",
"supporting",
"the",
"leaf",
"."
] | 0b4abfc64eef2eb8b94f852ce697de2e851d8e67 | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-couch-client/src/main/java/ca/carleton/gcrc/couch/fsentry/FSEntryFile.java#L23-L39 | train |
GCRC/nunaliit | nunaliit2-search/src/main/java/ca/carleton/gcrc/search/Searches.java | Searches.computeSelectScore | private String computeSelectScore(List<String> searchFields) throws Exception {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
if( 0 == searchFields.size() ) {
throw new Exception("Must supply at least one search field");
} else if( 1 == searchFields.size() ) {
pw.print... | java | private String computeSelectScore(List<String> searchFields) throws Exception {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
if( 0 == searchFields.size() ) {
throw new Exception("Must supply at least one search field");
} else if( 1 == searchFields.size() ) {
pw.print... | [
"private",
"String",
"computeSelectScore",
"(",
"List",
"<",
"String",
">",
"searchFields",
")",
"throws",
"Exception",
"{",
"StringWriter",
"sw",
"=",
"new",
"StringWriter",
"(",
")",
";",
"PrintWriter",
"pw",
"=",
"new",
"PrintWriter",
"(",
"sw",
")",
";",... | Create a SQL fragment that can be used to compute a score based
on a search.
For one search field: coalesce(nullif(position(lower(?) IN lower(X)), 0), 9999)
for multiple fields: least(coalesce(nullif(position(lower(?) IN lower(X)), 0), 9999),...)
@param searchFields Columns to search in column
@return SQL fragment to... | [
"Create",
"a",
"SQL",
"fragment",
"that",
"can",
"be",
"used",
"to",
"compute",
"a",
"score",
"based",
"on",
"a",
"search",
"."
] | 0b4abfc64eef2eb8b94f852ce697de2e851d8e67 | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-search/src/main/java/ca/carleton/gcrc/search/Searches.java#L419-L450 | train |
GCRC/nunaliit | nunaliit2-search/src/main/java/ca/carleton/gcrc/search/Searches.java | Searches.computeWhereFragment | private String computeWhereFragment(List<String> searchFields) throws Exception {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
boolean first = true;
for(int loop=0; loop<searchFields.size(); ++loop) {
if( first ) {
first = false;
pw.print(" WHERE ");
} else {
... | java | private String computeWhereFragment(List<String> searchFields) throws Exception {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
boolean first = true;
for(int loop=0; loop<searchFields.size(); ++loop) {
if( first ) {
first = false;
pw.print(" WHERE ");
} else {
... | [
"private",
"String",
"computeWhereFragment",
"(",
"List",
"<",
"String",
">",
"searchFields",
")",
"throws",
"Exception",
"{",
"StringWriter",
"sw",
"=",
"new",
"StringWriter",
"(",
")",
";",
"PrintWriter",
"pw",
"=",
"new",
"PrintWriter",
"(",
"sw",
")",
";... | Given a number of search fields, compute the SQL fragment
used to filter the searched rows
WHERE lower(X) LIKE lower(?)
OR lower(Y) LIKE lower(?)...
@param searchFields Columns to search
@return
@throws Exception | [
"Given",
"a",
"number",
"of",
"search",
"fields",
"compute",
"the",
"SQL",
"fragment",
"used",
"to",
"filter",
"the",
"searched",
"rows"
] | 0b4abfc64eef2eb8b94f852ce697de2e851d8e67 | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-search/src/main/java/ca/carleton/gcrc/search/Searches.java#L463-L482 | train |
GCRC/nunaliit | nunaliit2-search/src/main/java/ca/carleton/gcrc/search/Searches.java | Searches.executeStatementToJson | private JSONArray executeStatementToJson(
PreparedStatement stmt,
List<SelectedColumn> selectFields) throws Exception {
//logger.info("about to execute: " + stmt.toString());
if( stmt.execute() ) {
// There's a ResultSet to be had
ResultSet rs = stmt.getResultSet();
JSONArray array = new JSONArray()... | java | private JSONArray executeStatementToJson(
PreparedStatement stmt,
List<SelectedColumn> selectFields) throws Exception {
//logger.info("about to execute: " + stmt.toString());
if( stmt.execute() ) {
// There's a ResultSet to be had
ResultSet rs = stmt.getResultSet();
JSONArray array = new JSONArray()... | [
"private",
"JSONArray",
"executeStatementToJson",
"(",
"PreparedStatement",
"stmt",
",",
"List",
"<",
"SelectedColumn",
">",
"selectFields",
")",
"throws",
"Exception",
"{",
"//logger.info(\"about to execute: \" + stmt.toString());",
"if",
"(",
"stmt",
".",
"execute",
"("... | This method executes a prepared SQL statement and returns a JSON
array that contains the result.
@param stmt Prepared SQL statement to execute
@param selectFields Column to return in results
@return A JSONArray containing the requested information
@throws Exception | [
"This",
"method",
"executes",
"a",
"prepared",
"SQL",
"statement",
"and",
"returns",
"a",
"JSON",
"array",
"that",
"contains",
"the",
"result",
"."
] | 0b4abfc64eef2eb8b94f852ce697de2e851d8e67 | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-search/src/main/java/ca/carleton/gcrc/search/Searches.java#L511-L574 | train |
GCRC/nunaliit | nunaliit2-search/src/main/java/ca/carleton/gcrc/search/Searches.java | Searches.getAudioMediaFromPlaceId | public JSONObject getAudioMediaFromPlaceId(String place_id) throws Exception {
List<SelectedColumn> selectFields = new Vector<SelectedColumn>();
selectFields.add( new SelectedColumn(SelectedColumn.Type.INTEGER, "id") );
selectFields.add( new SelectedColumn(SelectedColumn.Type.INTEGER, "place_id") );
selectFiel... | java | public JSONObject getAudioMediaFromPlaceId(String place_id) throws Exception {
List<SelectedColumn> selectFields = new Vector<SelectedColumn>();
selectFields.add( new SelectedColumn(SelectedColumn.Type.INTEGER, "id") );
selectFields.add( new SelectedColumn(SelectedColumn.Type.INTEGER, "place_id") );
selectFiel... | [
"public",
"JSONObject",
"getAudioMediaFromPlaceId",
"(",
"String",
"place_id",
")",
"throws",
"Exception",
"{",
"List",
"<",
"SelectedColumn",
">",
"selectFields",
"=",
"new",
"Vector",
"<",
"SelectedColumn",
">",
"(",
")",
";",
"selectFields",
".",
"add",
"(",
... | Finds and returns all audio media associated with a place id.
@param place_id Id of associated place
@return A JSON object containing all audio media
@throws Exception | [
"Finds",
"and",
"returns",
"all",
"audio",
"media",
"associated",
"with",
"a",
"place",
"id",
"."
] | 0b4abfc64eef2eb8b94f852ce697de2e851d8e67 | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-search/src/main/java/ca/carleton/gcrc/search/Searches.java#L663-L685 | train |
GCRC/nunaliit | nunaliit2-couch-client/src/main/java/ca/carleton/gcrc/couch/app/impl/DocumentManifest.java | DocumentManifest.hasDocumentBeenModified | static public boolean hasDocumentBeenModified(
JSONObject targetDoc
) {
JSONObject targetManifest = targetDoc.optJSONObject(MANIFEST_KEY);
if( null == targetManifest ) {
// Can not verify digest on target document. Let's assume it has
// been modified
return true;
}
String targetDigest = target... | java | static public boolean hasDocumentBeenModified(
JSONObject targetDoc
) {
JSONObject targetManifest = targetDoc.optJSONObject(MANIFEST_KEY);
if( null == targetManifest ) {
// Can not verify digest on target document. Let's assume it has
// been modified
return true;
}
String targetDigest = target... | [
"static",
"public",
"boolean",
"hasDocumentBeenModified",
"(",
"JSONObject",
"targetDoc",
")",
"{",
"JSONObject",
"targetManifest",
"=",
"targetDoc",
".",
"optJSONObject",
"(",
"MANIFEST_KEY",
")",
";",
"if",
"(",
"null",
"==",
"targetManifest",
")",
"{",
"// Can ... | Analyzes a document and determines if the document has been modified
since the time the manifest was computed.
@param targetDoc Remote JSON document to test for modification
@param digestComputer Digest computer used to verify the compute intermediate
digest and verify authenticity of given manifest.
@return True, if r... | [
"Analyzes",
"a",
"document",
"and",
"determines",
"if",
"the",
"document",
"has",
"been",
"modified",
"since",
"the",
"time",
"the",
"manifest",
"was",
"computed",
"."
] | 0b4abfc64eef2eb8b94f852ce697de2e851d8e67 | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-couch-client/src/main/java/ca/carleton/gcrc/couch/app/impl/DocumentManifest.java#L28-L127 | train |
GCRC/nunaliit | nunaliit2-couch-client/src/main/java/ca/carleton/gcrc/couch/app/impl/DocumentManifest.java | DocumentManifest.getAttachmentPosition | static public Integer getAttachmentPosition(
JSONObject targetDoc
,String attachmentName
) {
JSONObject targetAttachments = targetDoc.optJSONObject("_attachments");
if( null == targetAttachments ) {
// No attachment on target doc
return null;
}
JSONObject targetAttachment = targetAttachment... | java | static public Integer getAttachmentPosition(
JSONObject targetDoc
,String attachmentName
) {
JSONObject targetAttachments = targetDoc.optJSONObject("_attachments");
if( null == targetAttachments ) {
// No attachment on target doc
return null;
}
JSONObject targetAttachment = targetAttachment... | [
"static",
"public",
"Integer",
"getAttachmentPosition",
"(",
"JSONObject",
"targetDoc",
",",
"String",
"attachmentName",
")",
"{",
"JSONObject",
"targetAttachments",
"=",
"targetDoc",
".",
"optJSONObject",
"(",
"\"_attachments\"",
")",
";",
"if",
"(",
"null",
"==",
... | Given a JSON document and an attachment name, returns the
revision position associated with the attachment.
@param targetDoc
@param attachmentName
@return | [
"Given",
"a",
"JSON",
"document",
"and",
"an",
"attachment",
"name",
"returns",
"the",
"revision",
"position",
"associated",
"with",
"the",
"attachment",
"."
] | 0b4abfc64eef2eb8b94f852ce697de2e851d8e67 | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-couch-client/src/main/java/ca/carleton/gcrc/couch/app/impl/DocumentManifest.java#L136-L162 | train |
GCRC/nunaliit | nunaliit2-multimedia/src/main/java/ca/carleton/gcrc/olkit/multimedia/apachePDFBox/imageio/TIFFUtil.java | TIFFUtil.setCompressionType | public static void setCompressionType(ImageWriteParam param, BufferedImage image)
{
// avoid error: first compression type is RLE, not optimal and incorrect for color images
// TODO expose this choice to the user?
if (image.getType() == BufferedImage.TYPE_BYTE_BINARY &&
image.get... | java | public static void setCompressionType(ImageWriteParam param, BufferedImage image)
{
// avoid error: first compression type is RLE, not optimal and incorrect for color images
// TODO expose this choice to the user?
if (image.getType() == BufferedImage.TYPE_BYTE_BINARY &&
image.get... | [
"public",
"static",
"void",
"setCompressionType",
"(",
"ImageWriteParam",
"param",
",",
"BufferedImage",
"image",
")",
"{",
"// avoid error: first compression type is RLE, not optimal and incorrect for color images",
"// TODO expose this choice to the user?",
"if",
"(",
"image",
".... | Sets the ImageIO parameter compression type based on the given image.
@param image buffered image used to decide compression type
@param param ImageIO write parameter to update | [
"Sets",
"the",
"ImageIO",
"parameter",
"compression",
"type",
"based",
"on",
"the",
"given",
"image",
"."
] | 0b4abfc64eef2eb8b94f852ce697de2e851d8e67 | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-multimedia/src/main/java/ca/carleton/gcrc/olkit/multimedia/apachePDFBox/imageio/TIFFUtil.java#L48-L61 | train |
GCRC/nunaliit | nunaliit2-couch-client/src/main/java/ca/carleton/gcrc/couch/fsentry/FSEntryResource.java | FSEntryResource.getPositionedResource | static public FSEntry getPositionedResource(String path, ClassLoader classLoader, String resourceName) throws Exception {
List<String> pathFrags = FSEntrySupport.interpretPath(path);
// Start at leaf and work our way back
int index = pathFrags.size() - 1;
FSEntry root = create(pathFrags.get(index), classLoad... | java | static public FSEntry getPositionedResource(String path, ClassLoader classLoader, String resourceName) throws Exception {
List<String> pathFrags = FSEntrySupport.interpretPath(path);
// Start at leaf and work our way back
int index = pathFrags.size() - 1;
FSEntry root = create(pathFrags.get(index), classLoad... | [
"static",
"public",
"FSEntry",
"getPositionedResource",
"(",
"String",
"path",
",",
"ClassLoader",
"classLoader",
",",
"String",
"resourceName",
")",
"throws",
"Exception",
"{",
"List",
"<",
"String",
">",
"pathFrags",
"=",
"FSEntrySupport",
".",
"interpretPath",
... | Create a virtual tree hierarchy with a resource supporting the leaf.
@param path Position of the file in the hierarchy, including its name
@param classLoader Class loader used to find the needed resource
@param resourceName Name of the actual resource to obtain using class loader
@return The FSEntry root for this hiera... | [
"Create",
"a",
"virtual",
"tree",
"hierarchy",
"with",
"a",
"resource",
"supporting",
"the",
"leaf",
"."
] | 0b4abfc64eef2eb8b94f852ce697de2e851d8e67 | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-couch-client/src/main/java/ca/carleton/gcrc/couch/fsentry/FSEntryResource.java#L24-L40 | train |
GCRC/nunaliit | nunaliit2-couch-client/src/main/java/ca/carleton/gcrc/couch/fsentry/FSEntryResource.java | FSEntryResource.create | static public FSEntryResource create(ClassLoader classLoader, String resourceName) throws Exception {
return create(null, classLoader, resourceName);
} | java | static public FSEntryResource create(ClassLoader classLoader, String resourceName) throws Exception {
return create(null, classLoader, resourceName);
} | [
"static",
"public",
"FSEntryResource",
"create",
"(",
"ClassLoader",
"classLoader",
",",
"String",
"resourceName",
")",
"throws",
"Exception",
"{",
"return",
"create",
"(",
"null",
",",
"classLoader",
",",
"resourceName",
")",
";",
"}"
] | Creates an instance of FSEntryResource to represent an entry based on the resource
specified by the classLoader and resource name.
@param classLoader Class loader used to find the resource
@param resourceName Actual name of resource
@return An entry representing the specified resource.
@throws Exception Invalid request | [
"Creates",
"an",
"instance",
"of",
"FSEntryResource",
"to",
"represent",
"an",
"entry",
"based",
"on",
"the",
"resource",
"specified",
"by",
"the",
"classLoader",
"and",
"resource",
"name",
"."
] | 0b4abfc64eef2eb8b94f852ce697de2e851d8e67 | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-couch-client/src/main/java/ca/carleton/gcrc/couch/fsentry/FSEntryResource.java#L50-L52 | train |
GCRC/nunaliit | nunaliit2-couch-client/src/main/java/ca/carleton/gcrc/couch/fsentry/FSEntryResource.java | FSEntryResource.create | static public FSEntryResource create(String name, ClassLoader classLoader, String resourceName) throws Exception {
URL url = classLoader.getResource(resourceName);
if( "jar".equals( url.getProtocol() ) ) {
String path = url.getPath();
if( path.startsWith("file:") ) {
int bangIndex = path.indexOf('!');
... | java | static public FSEntryResource create(String name, ClassLoader classLoader, String resourceName) throws Exception {
URL url = classLoader.getResource(resourceName);
if( "jar".equals( url.getProtocol() ) ) {
String path = url.getPath();
if( path.startsWith("file:") ) {
int bangIndex = path.indexOf('!');
... | [
"static",
"public",
"FSEntryResource",
"create",
"(",
"String",
"name",
",",
"ClassLoader",
"classLoader",
",",
"String",
"resourceName",
")",
"throws",
"Exception",
"{",
"URL",
"url",
"=",
"classLoader",
".",
"getResource",
"(",
"resourceName",
")",
";",
"if",
... | Creates an instance of FSEntryResource to represent an entry based on the resource
specified by the classLoader and resource name. This resource can be a file or a
directory. Furthermore, this resource can be located on file system or inside
a JAR file.
@param name Name that the resource claims as its own. Useful to im... | [
"Creates",
"an",
"instance",
"of",
"FSEntryResource",
"to",
"represent",
"an",
"entry",
"based",
"on",
"the",
"resource",
"specified",
"by",
"the",
"classLoader",
"and",
"resource",
"name",
".",
"This",
"resource",
"can",
"be",
"a",
"file",
"or",
"a",
"direc... | 0b4abfc64eef2eb8b94f852ce697de2e851d8e67 | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-couch-client/src/main/java/ca/carleton/gcrc/couch/fsentry/FSEntryResource.java#L65-L113 | train |
GCRC/nunaliit | nunaliit2-auth-cookie/src/main/java/ca/carleton/gcrc/auth/cookie/AuthServlet.java | AuthServlet.performAdjustCookies | private void performAdjustCookies(HttpServletRequest request, HttpServletResponse response) throws Exception {
boolean loggedIn = false;
User user = null;
try {
Cookie cookie = getCookieFromRequest(request);
if( null != cookie ) {
user = CookieAuthentication.verifyCookieString(userRepository, cookie.ge... | java | private void performAdjustCookies(HttpServletRequest request, HttpServletResponse response) throws Exception {
boolean loggedIn = false;
User user = null;
try {
Cookie cookie = getCookieFromRequest(request);
if( null != cookie ) {
user = CookieAuthentication.verifyCookieString(userRepository, cookie.ge... | [
"private",
"void",
"performAdjustCookies",
"(",
"HttpServletRequest",
"request",
",",
"HttpServletResponse",
"response",
")",
"throws",
"Exception",
"{",
"boolean",
"loggedIn",
"=",
"false",
";",
"User",
"user",
"=",
"null",
";",
"try",
"{",
"Cookie",
"cookie",
... | Adjusts the information cookie based on the authentication token
@param request
@param response
@throws ServletException
@throws IOException | [
"Adjusts",
"the",
"information",
"cookie",
"based",
"on",
"the",
"authentication",
"token"
] | 0b4abfc64eef2eb8b94f852ce697de2e851d8e67 | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-auth-cookie/src/main/java/ca/carleton/gcrc/auth/cookie/AuthServlet.java#L186-L205 | train |
GCRC/nunaliit | nunaliit2-couch-date/src/main/java/ca/carleton/gcrc/couch/date/cluster/TreeRebalanceProcess.java | TreeRebalanceProcess.createTree | static public TreeRebalanceProcess.Result createTree(List<? extends TreeElement> elements) throws Exception {
Result results = new Result();
// Compute full interval, next cluster id and legacy nodes
TimeInterval fullRegularInterval = null;
TimeInterval fullOngoingInterval = null;
results.nextClusterId = 1;
... | java | static public TreeRebalanceProcess.Result createTree(List<? extends TreeElement> elements) throws Exception {
Result results = new Result();
// Compute full interval, next cluster id and legacy nodes
TimeInterval fullRegularInterval = null;
TimeInterval fullOngoingInterval = null;
results.nextClusterId = 1;
... | [
"static",
"public",
"TreeRebalanceProcess",
".",
"Result",
"createTree",
"(",
"List",
"<",
"?",
"extends",
"TreeElement",
">",
"elements",
")",
"throws",
"Exception",
"{",
"Result",
"results",
"=",
"new",
"Result",
"(",
")",
";",
"// Compute full interval, next cl... | Creates a new cluster tree given the provided elements. If these elements were already
part of a cluster, then legacy cluster nodes are created to account for those elements.
This is the perfect process in case the previous tree was lost.
@param elements Elements to be considered for the new tree.
@return Results of cr... | [
"Creates",
"a",
"new",
"cluster",
"tree",
"given",
"the",
"provided",
"elements",
".",
"If",
"these",
"elements",
"were",
"already",
"part",
"of",
"a",
"cluster",
"then",
"legacy",
"cluster",
"nodes",
"are",
"created",
"to",
"account",
"for",
"those",
"eleme... | 0b4abfc64eef2eb8b94f852ce697de2e851d8e67 | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-couch-date/src/main/java/ca/carleton/gcrc/couch/date/cluster/TreeRebalanceProcess.java#L34-L115 | train |
GCRC/nunaliit | nunaliit2-jdbc/src/main/java/ca/carleton/gcrc/jdbc/JdbcConnections.java | JdbcConnections.getDb | synchronized public Connection getDb(String db) throws Exception {
Connection con = null;
if (nameToConnection.containsKey(db)) {
con = nameToConnection.get(db);
} else {
ConnectionInfo info = nameToInfo.get(db);
if( null == info ) {
throw new Exception("No information provided for database named... | java | synchronized public Connection getDb(String db) throws Exception {
Connection con = null;
if (nameToConnection.containsKey(db)) {
con = nameToConnection.get(db);
} else {
ConnectionInfo info = nameToInfo.get(db);
if( null == info ) {
throw new Exception("No information provided for database named... | [
"synchronized",
"public",
"Connection",
"getDb",
"(",
"String",
"db",
")",
"throws",
"Exception",
"{",
"Connection",
"con",
"=",
"null",
";",
"if",
"(",
"nameToConnection",
".",
"containsKey",
"(",
"db",
")",
")",
"{",
"con",
"=",
"nameToConnection",
".",
... | This method checks for the presence of a Connection associated with the input db parameter.
It attempts to create the Connection and adds it to the connection map if it does not
already exist. If the Connection exists or is created, it is returned.
@param db database name.
@return Returns the desired Connection insta... | [
"This",
"method",
"checks",
"for",
"the",
"presence",
"of",
"a",
"Connection",
"associated",
"with",
"the",
"input",
"db",
"parameter",
".",
"It",
"attempts",
"to",
"create",
"the",
"Connection",
"and",
"adds",
"it",
"to",
"the",
"connection",
"map",
"if",
... | 0b4abfc64eef2eb8b94f852ce697de2e851d8e67 | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-jdbc/src/main/java/ca/carleton/gcrc/jdbc/JdbcConnections.java#L149-L175 | train |
GCRC/nunaliit | nunaliit2-couch-client/src/main/java/ca/carleton/gcrc/couch/client/impl/ConnectionUtils.java | ConnectionUtils.captureReponseErrors | static public void captureReponseErrors(Object response, String errorMessage) throws Exception {
if( null == response ) {
throw new Exception("Capturing errors from null response");
}
if( false == (response instanceof JSONObject) ) {
// Not an error
return;
}
JSONObject obj = (JSONObject)response;
... | java | static public void captureReponseErrors(Object response, String errorMessage) throws Exception {
if( null == response ) {
throw new Exception("Capturing errors from null response");
}
if( false == (response instanceof JSONObject) ) {
// Not an error
return;
}
JSONObject obj = (JSONObject)response;
... | [
"static",
"public",
"void",
"captureReponseErrors",
"(",
"Object",
"response",
",",
"String",
"errorMessage",
")",
"throws",
"Exception",
"{",
"if",
"(",
"null",
"==",
"response",
")",
"{",
"throw",
"new",
"Exception",
"(",
"\"Capturing errors from null response\"",... | Analyze a CouchDb response and raises an exception if an error was returned
in the response.
@param response JSON response sent by server
@param errorMessage Message of top exception
@throws Exception If error is returned in response | [
"Analyze",
"a",
"CouchDb",
"response",
"and",
"raises",
"an",
"exception",
"if",
"an",
"error",
"was",
"returned",
"in",
"the",
"response",
"."
] | 0b4abfc64eef2eb8b94f852ce697de2e851d8e67 | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-couch-client/src/main/java/ca/carleton/gcrc/couch/client/impl/ConnectionUtils.java#L427-L449 | train |
GCRC/nunaliit | nunaliit2-couch-command/src/main/java/ca/carleton/gcrc/couch/command/impl/PathComputer.java | PathComputer.computeAtlasDir | static public File computeAtlasDir(String name) {
File atlasDir = null;
if( null == name ) {
// Current dir
atlasDir = new File(".");
} else {
atlasDir = new File(name);
}
// Force absolute
if( false == atlasDir.isAbsolute() ){
atlasDir = atlasDir.getAbsoluteFile();
}
return atlasDi... | java | static public File computeAtlasDir(String name) {
File atlasDir = null;
if( null == name ) {
// Current dir
atlasDir = new File(".");
} else {
atlasDir = new File(name);
}
// Force absolute
if( false == atlasDir.isAbsolute() ){
atlasDir = atlasDir.getAbsoluteFile();
}
return atlasDi... | [
"static",
"public",
"File",
"computeAtlasDir",
"(",
"String",
"name",
")",
"{",
"File",
"atlasDir",
"=",
"null",
";",
"if",
"(",
"null",
"==",
"name",
")",
"{",
"// Current dir",
"atlasDir",
"=",
"new",
"File",
"(",
"\".\"",
")",
";",
"}",
"else",
"{",... | Computes the directory where the atlas resides given a command-line
argument provided by the user. If the argument is not given, then
this method should be called with a null argument.
@param name Path given by user at the command-line to refer to the atlas
@return Directory where atlas resides, based on the given argu... | [
"Computes",
"the",
"directory",
"where",
"the",
"atlas",
"resides",
"given",
"a",
"command",
"-",
"line",
"argument",
"provided",
"by",
"the",
"user",
".",
"If",
"the",
"argument",
"is",
"not",
"given",
"then",
"this",
"method",
"should",
"be",
"called",
"... | 0b4abfc64eef2eb8b94f852ce697de2e851d8e67 | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-couch-command/src/main/java/ca/carleton/gcrc/couch/command/impl/PathComputer.java#L17-L33 | train |
GCRC/nunaliit | nunaliit2-couch-command/src/main/java/ca/carleton/gcrc/couch/command/impl/PathComputer.java | PathComputer.computeInstallDir | static public File computeInstallDir() {
File installDir = null;
// Try to find the path of a known resource file
File knownResourceFile = null;
{
URL url = Main.class.getClassLoader().getResource("commandResourceDummy.txt");
if( null == url ){
// Nothing we can do since the resource is not found
... | java | static public File computeInstallDir() {
File installDir = null;
// Try to find the path of a known resource file
File knownResourceFile = null;
{
URL url = Main.class.getClassLoader().getResource("commandResourceDummy.txt");
if( null == url ){
// Nothing we can do since the resource is not found
... | [
"static",
"public",
"File",
"computeInstallDir",
"(",
")",
"{",
"File",
"installDir",
"=",
"null",
";",
"// Try to find the path of a known resource file",
"File",
"knownResourceFile",
"=",
"null",
";",
"{",
"URL",
"url",
"=",
"Main",
".",
"class",
".",
"getClassL... | Computes the installation directory for the command line tool.
This is done by looking for a known resource in a JAR file that
ships with the command-line tool. When the resource is found, the
location of the associated JAR file is derived. From there, the
root directory of the installation is deduced.
If the command-l... | [
"Computes",
"the",
"installation",
"directory",
"for",
"the",
"command",
"line",
"tool",
".",
"This",
"is",
"done",
"by",
"looking",
"for",
"a",
"known",
"resource",
"in",
"a",
"JAR",
"file",
"that",
"ships",
"with",
"the",
"command",
"-",
"line",
"tool",
... | 0b4abfc64eef2eb8b94f852ce697de2e851d8e67 | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-couch-command/src/main/java/ca/carleton/gcrc/couch/command/impl/PathComputer.java#L48-L103 | train |
GCRC/nunaliit | nunaliit2-couch-command/src/main/java/ca/carleton/gcrc/couch/command/impl/PathComputer.java | PathComputer.computeContentDir | static public File computeContentDir(File installDir) {
if( null != installDir ) {
// Command-line package
File contentDir = new File(installDir, "content");
if( contentDir.exists() && contentDir.isDirectory() ) {
return contentDir;
}
// Development environment
File nunaliit2Dir = computeNun... | java | static public File computeContentDir(File installDir) {
if( null != installDir ) {
// Command-line package
File contentDir = new File(installDir, "content");
if( contentDir.exists() && contentDir.isDirectory() ) {
return contentDir;
}
// Development environment
File nunaliit2Dir = computeNun... | [
"static",
"public",
"File",
"computeContentDir",
"(",
"File",
"installDir",
")",
"{",
"if",
"(",
"null",
"!=",
"installDir",
")",
"{",
"// Command-line package",
"File",
"contentDir",
"=",
"new",
"File",
"(",
"installDir",
",",
"\"content\"",
")",
";",
"if",
... | Finds the "content" directory from the installation location
and returns it. If the command-line tool is packaged and
deployed, then the "content" directory is found at the
root of the installation. If the command-line tool is run
from the development environment, then the "content" directory
is found in the SDK sub-pr... | [
"Finds",
"the",
"content",
"directory",
"from",
"the",
"installation",
"location",
"and",
"returns",
"it",
".",
"If",
"the",
"command",
"-",
"line",
"tool",
"is",
"packaged",
"and",
"deployed",
"then",
"the",
"content",
"directory",
"is",
"found",
"at",
"the... | 0b4abfc64eef2eb8b94f852ce697de2e851d8e67 | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-couch-command/src/main/java/ca/carleton/gcrc/couch/command/impl/PathComputer.java#L145-L162 | train |
GCRC/nunaliit | nunaliit2-couch-command/src/main/java/ca/carleton/gcrc/couch/command/impl/PathComputer.java | PathComputer.computeBinDir | static public File computeBinDir(File installDir) {
if( null != installDir ) {
// Command-line package
File binDir = new File(installDir, "bin");
if( binDir.exists() && binDir.isDirectory() ) {
return binDir;
}
// Development environment
File nunaliit2Dir = computeNunaliitDir(installDir);
... | java | static public File computeBinDir(File installDir) {
if( null != installDir ) {
// Command-line package
File binDir = new File(installDir, "bin");
if( binDir.exists() && binDir.isDirectory() ) {
return binDir;
}
// Development environment
File nunaliit2Dir = computeNunaliitDir(installDir);
... | [
"static",
"public",
"File",
"computeBinDir",
"(",
"File",
"installDir",
")",
"{",
"if",
"(",
"null",
"!=",
"installDir",
")",
"{",
"// Command-line package",
"File",
"binDir",
"=",
"new",
"File",
"(",
"installDir",
",",
"\"bin\"",
")",
";",
"if",
"(",
"bin... | Finds the "bin" directory from the installation location
and returns it. If the command-line tool is packaged and
deployed, then the "bin" directory is found at the
root of the installation. If the command-line tool is run
from the development environment, then the "bin" directory
is found in the SDK sub-project.
@para... | [
"Finds",
"the",
"bin",
"directory",
"from",
"the",
"installation",
"location",
"and",
"returns",
"it",
".",
"If",
"the",
"command",
"-",
"line",
"tool",
"is",
"packaged",
"and",
"deployed",
"then",
"the",
"bin",
"directory",
"is",
"found",
"at",
"the",
"ro... | 0b4abfc64eef2eb8b94f852ce697de2e851d8e67 | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-couch-command/src/main/java/ca/carleton/gcrc/couch/command/impl/PathComputer.java#L174-L191 | train |
GCRC/nunaliit | nunaliit2-couch-command/src/main/java/ca/carleton/gcrc/couch/command/impl/PathComputer.java | PathComputer.computeSiteDesignDir | static public File computeSiteDesignDir(File installDir) {
if( null != installDir ) {
// Command-line package
File templatesDir = new File(installDir, "internal/siteDesign");
if( templatesDir.exists() && templatesDir.isDirectory() ) {
return templatesDir;
}
// Development environment
File nu... | java | static public File computeSiteDesignDir(File installDir) {
if( null != installDir ) {
// Command-line package
File templatesDir = new File(installDir, "internal/siteDesign");
if( templatesDir.exists() && templatesDir.isDirectory() ) {
return templatesDir;
}
// Development environment
File nu... | [
"static",
"public",
"File",
"computeSiteDesignDir",
"(",
"File",
"installDir",
")",
"{",
"if",
"(",
"null",
"!=",
"installDir",
")",
"{",
"// Command-line package",
"File",
"templatesDir",
"=",
"new",
"File",
"(",
"installDir",
",",
"\"internal/siteDesign\"",
")",... | Finds the "siteDesign" directory from the installation location
and returns it. If the command-line tool is packaged and
deployed, then the "siteDesign" directory is found at the
root of the installation. If the command-line tool is run
from the development environment, then the "siteDesign" directory
is found in the S... | [
"Finds",
"the",
"siteDesign",
"directory",
"from",
"the",
"installation",
"location",
"and",
"returns",
"it",
".",
"If",
"the",
"command",
"-",
"line",
"tool",
"is",
"packaged",
"and",
"deployed",
"then",
"the",
"siteDesign",
"directory",
"is",
"found",
"at",
... | 0b4abfc64eef2eb8b94f852ce697de2e851d8e67 | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-couch-command/src/main/java/ca/carleton/gcrc/couch/command/impl/PathComputer.java#L203-L220 | train |
GCRC/nunaliit | nunaliit2-couch-command/src/main/java/ca/carleton/gcrc/couch/command/impl/PathComputer.java | PathComputer.computeNunaliitDir | static public File computeNunaliitDir(File installDir) {
while( null != installDir ){
// The root of the nunalii2 project contains "nunaliit2-couch-command",
// "nunaliit2-couch-sdk" and "nunaliit2-js"
boolean commandExists = (new File(installDir, "nunaliit2-couch-command")).exists();
boolean sdkExists = ... | java | static public File computeNunaliitDir(File installDir) {
while( null != installDir ){
// The root of the nunalii2 project contains "nunaliit2-couch-command",
// "nunaliit2-couch-sdk" and "nunaliit2-js"
boolean commandExists = (new File(installDir, "nunaliit2-couch-command")).exists();
boolean sdkExists = ... | [
"static",
"public",
"File",
"computeNunaliitDir",
"(",
"File",
"installDir",
")",
"{",
"while",
"(",
"null",
"!=",
"installDir",
")",
"{",
"// The root of the nunalii2 project contains \"nunaliit2-couch-command\",",
"// \"nunaliit2-couch-sdk\" and \"nunaliit2-js\"",
"boolean",
... | Given an installation directory, find the root directory
for the nunaliit2 project. This makes sense only in the
context that the command-line tool is run from a development
environment.
@param installDir Computed install directory where command-line is run
@return Root directory where nunaliit2 project is located, or ... | [
"Given",
"an",
"installation",
"directory",
"find",
"the",
"root",
"directory",
"for",
"the",
"nunaliit2",
"project",
".",
"This",
"makes",
"sense",
"only",
"in",
"the",
"context",
"that",
"the",
"command",
"-",
"line",
"tool",
"is",
"run",
"from",
"a",
"d... | 0b4abfc64eef2eb8b94f852ce697de2e851d8e67 | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-couch-command/src/main/java/ca/carleton/gcrc/couch/command/impl/PathComputer.java#L439-L456 | train |
GCRC/nunaliit | nunaliit2-utils/src/main/java/ca/carleton/gcrc/utils/Files.java | Files.getDescendantPathNames | static public Set<String> getDescendantPathNames(File dir, boolean includeDirectories) {
Set<String> paths = new HashSet<String>();
if( dir.exists() && dir.isDirectory() ) {
String[] names = dir.list();
for(String name : names){
File child = new File(dir,name);
getPathNames(child, paths, null, include... | java | static public Set<String> getDescendantPathNames(File dir, boolean includeDirectories) {
Set<String> paths = new HashSet<String>();
if( dir.exists() && dir.isDirectory() ) {
String[] names = dir.list();
for(String name : names){
File child = new File(dir,name);
getPathNames(child, paths, null, include... | [
"static",
"public",
"Set",
"<",
"String",
">",
"getDescendantPathNames",
"(",
"File",
"dir",
",",
"boolean",
"includeDirectories",
")",
"{",
"Set",
"<",
"String",
">",
"paths",
"=",
"new",
"HashSet",
"<",
"String",
">",
"(",
")",
";",
"if",
"(",
"dir",
... | Given a directory, returns a set of strings which are the paths to all elements
within the directory. This process recurses through all sub-directories.
@param dir The directory to be traversed
@param includeDirectories If set, the name of the paths to directories are included
in the result.
@return A set of paths to a... | [
"Given",
"a",
"directory",
"returns",
"a",
"set",
"of",
"strings",
"which",
"are",
"the",
"paths",
"to",
"all",
"elements",
"within",
"the",
"directory",
".",
"This",
"process",
"recurses",
"through",
"all",
"sub",
"-",
"directories",
"."
] | 0b4abfc64eef2eb8b94f852ce697de2e851d8e67 | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-utils/src/main/java/ca/carleton/gcrc/utils/Files.java#L85-L95 | train |
GCRC/nunaliit | nunaliit2-utils/src/main/java/ca/carleton/gcrc/utils/Files.java | Files.emptyDirectory | static public void emptyDirectory(File dir) throws Exception {
String[] fileNames = dir.list();
if( null != fileNames ) {
for(String fileName : fileNames){
File file = new File(dir,fileName);
if( file.isDirectory() ) {
emptyDirectory(file);
}
boolean deleted = false;
try {
deleted =... | java | static public void emptyDirectory(File dir) throws Exception {
String[] fileNames = dir.list();
if( null != fileNames ) {
for(String fileName : fileNames){
File file = new File(dir,fileName);
if( file.isDirectory() ) {
emptyDirectory(file);
}
boolean deleted = false;
try {
deleted =... | [
"static",
"public",
"void",
"emptyDirectory",
"(",
"File",
"dir",
")",
"throws",
"Exception",
"{",
"String",
"[",
"]",
"fileNames",
"=",
"dir",
".",
"list",
"(",
")",
";",
"if",
"(",
"null",
"!=",
"fileNames",
")",
"{",
"for",
"(",
"String",
"fileName"... | Given a directory, removes all the content found in the directory.
@param dir The directory to be emptied
@throws Exception | [
"Given",
"a",
"directory",
"removes",
"all",
"the",
"content",
"found",
"in",
"the",
"directory",
"."
] | 0b4abfc64eef2eb8b94f852ce697de2e851d8e67 | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-utils/src/main/java/ca/carleton/gcrc/utils/Files.java#L157-L176 | train |
GCRC/nunaliit | nunaliit2-couch-onUpload/src/main/java/ca/carleton/gcrc/couch/onUpload/mail/MailVetterDailyNotificationTask.java | MailVetterDailyNotificationTask.scheduleTask | static public MailVetterDailyNotificationTask scheduleTask(
CouchDesignDocument serverDesignDoc
,MailNotification mailNotification
){
Timer timer = new Timer();
MailVetterDailyNotificationTask installedTask = new MailVetterDailyNotificationTask(
timer
,serverDesignDoc
,mailNotification
... | java | static public MailVetterDailyNotificationTask scheduleTask(
CouchDesignDocument serverDesignDoc
,MailNotification mailNotification
){
Timer timer = new Timer();
MailVetterDailyNotificationTask installedTask = new MailVetterDailyNotificationTask(
timer
,serverDesignDoc
,mailNotification
... | [
"static",
"public",
"MailVetterDailyNotificationTask",
"scheduleTask",
"(",
"CouchDesignDocument",
"serverDesignDoc",
",",
"MailNotification",
"mailNotification",
")",
"{",
"Timer",
"timer",
"=",
"new",
"Timer",
"(",
")",
";",
"MailVetterDailyNotificationTask",
"installedTa... | 24 hours in ms | [
"24",
"hours",
"in",
"ms"
] | 0b4abfc64eef2eb8b94f852ce697de2e851d8e67 | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-couch-onUpload/src/main/java/ca/carleton/gcrc/couch/onUpload/mail/MailVetterDailyNotificationTask.java#L22-L66 | train |
GCRC/nunaliit | nunaliit2-couch-onUpload/src/main/java/ca/carleton/gcrc/couch/onUpload/simplifyGeoms/GeometrySimplificationProcessImpl.java | GeometrySimplificationProcessImpl.simplifyGeometryAtResolution | public Geometry simplifyGeometryAtResolution(Geometry geometry, double resolution) throws Exception {
double inverseRes = 1/resolution;
double p = Math.log10(inverseRes);
double exp = Math.ceil( p );
if( exp < 0 ) exp = 0;
double factor = Math.pow(10,exp);
Geometry simplifiedGeometry = simplify(geometry, r... | java | public Geometry simplifyGeometryAtResolution(Geometry geometry, double resolution) throws Exception {
double inverseRes = 1/resolution;
double p = Math.log10(inverseRes);
double exp = Math.ceil( p );
if( exp < 0 ) exp = 0;
double factor = Math.pow(10,exp);
Geometry simplifiedGeometry = simplify(geometry, r... | [
"public",
"Geometry",
"simplifyGeometryAtResolution",
"(",
"Geometry",
"geometry",
",",
"double",
"resolution",
")",
"throws",
"Exception",
"{",
"double",
"inverseRes",
"=",
"1",
"/",
"resolution",
";",
"double",
"p",
"=",
"Math",
".",
"log10",
"(",
"inverseRes"... | Accepts a geometry and a resolution. Returns a version of the geometry
which is simplified for the given resolution. If the initial geometry
is already simplified enough, then return null.
@param geometry Geometry to simplify
@param resolution Resolution at which the geometry should be simplified
@return The simplified... | [
"Accepts",
"a",
"geometry",
"and",
"a",
"resolution",
".",
"Returns",
"a",
"version",
"of",
"the",
"geometry",
"which",
"is",
"simplified",
"for",
"the",
"given",
"resolution",
".",
"If",
"the",
"initial",
"geometry",
"is",
"already",
"simplified",
"enough",
... | 0b4abfc64eef2eb8b94f852ce697de2e851d8e67 | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-couch-onUpload/src/main/java/ca/carleton/gcrc/couch/onUpload/simplifyGeoms/GeometrySimplificationProcessImpl.java#L100-L110 | train |
GCRC/nunaliit | nunaliit2-dbWeb/src/main/java/ca/carleton/gcrc/dbWeb/DbWebServlet.java | DbWebServlet.performQuery | private void performQuery(HttpServletRequest request, HttpServletResponse response) throws Exception {
User user = AuthenticationUtils.getUserFromRequest(request);
String tableName = getTableNameFromRequest(request);
DbTableAccess tableAccess = DbTableAccess.getAccess(dbSecurity, tableName, new DbUserAdaptor(u... | java | private void performQuery(HttpServletRequest request, HttpServletResponse response) throws Exception {
User user = AuthenticationUtils.getUserFromRequest(request);
String tableName = getTableNameFromRequest(request);
DbTableAccess tableAccess = DbTableAccess.getAccess(dbSecurity, tableName, new DbUserAdaptor(u... | [
"private",
"void",
"performQuery",
"(",
"HttpServletRequest",
"request",
",",
"HttpServletResponse",
"response",
")",
"throws",
"Exception",
"{",
"User",
"user",
"=",
"AuthenticationUtils",
".",
"getUserFromRequest",
"(",
"request",
")",
";",
"String",
"tableName",
... | Perform a SQL query of a specified table, that must be accessible via dbSec.
The http parms must include:
table=<tableName> specifying a valid and accessible table.
the http parms may include one or more (each) of:
select=<e1>[,<e2>[,...]] where each <ei> is the name of a valid and accessible column or
is an expressi... | [
"Perform",
"a",
"SQL",
"query",
"of",
"a",
"specified",
"table",
"that",
"must",
"be",
"accessible",
"via",
"dbSec",
"."
] | 0b4abfc64eef2eb8b94f852ce697de2e851d8e67 | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-dbWeb/src/main/java/ca/carleton/gcrc/dbWeb/DbWebServlet.java#L231-L257 | train |
GCRC/nunaliit | nunaliit2-dbWeb/src/main/java/ca/carleton/gcrc/dbWeb/DbWebServlet.java | DbWebServlet.performMultiQuery | private void performMultiQuery(HttpServletRequest request, HttpServletResponse response) throws Exception {
User user = AuthenticationUtils.getUserFromRequest(request);
String[] queriesStrings = request.getParameterValues("queries");
if( 1 != queriesStrings.length ) {
throw new Exception("Parameter 'queries' ... | java | private void performMultiQuery(HttpServletRequest request, HttpServletResponse response) throws Exception {
User user = AuthenticationUtils.getUserFromRequest(request);
String[] queriesStrings = request.getParameterValues("queries");
if( 1 != queriesStrings.length ) {
throw new Exception("Parameter 'queries' ... | [
"private",
"void",
"performMultiQuery",
"(",
"HttpServletRequest",
"request",
",",
"HttpServletResponse",
"response",
")",
"throws",
"Exception",
"{",
"User",
"user",
"=",
"AuthenticationUtils",
".",
"getUserFromRequest",
"(",
"request",
")",
";",
"String",
"[",
"]"... | Perform multiple SQL queries via dbSec.
queries = {
key1: {
table: <table name>
,select: [
<selectExpression>
,...
]
,where: [
'<columnName>,<comparator>'
,'<columnName>,<comparator>'
,...
]
,groupBy: [
<columnName>
,...
]
}
,key2: {
...
}
, ...
}
<selectExpression> :
<columnName>
sum(<columnName>)
min(<columnName>)
... | [
"Perform",
"multiple",
"SQL",
"queries",
"via",
"dbSec",
"."
] | 0b4abfc64eef2eb8b94f852ce697de2e851d8e67 | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-dbWeb/src/main/java/ca/carleton/gcrc/dbWeb/DbWebServlet.java#L316-L363 | train |
GCRC/nunaliit | nunaliit2-dbWeb/src/main/java/ca/carleton/gcrc/dbWeb/DbWebServlet.java | DbWebServlet.getFieldSelectorsFromRequest | private List<FieldSelector> getFieldSelectorsFromRequest(HttpServletRequest request) throws Exception {
String[] fieldSelectorStrings = request.getParameterValues("select");
if( null == fieldSelectorStrings ) {
return null;
}
if( 0 == fieldSelectorStrings.length ) {
return null;
}
List<FieldSele... | java | private List<FieldSelector> getFieldSelectorsFromRequest(HttpServletRequest request) throws Exception {
String[] fieldSelectorStrings = request.getParameterValues("select");
if( null == fieldSelectorStrings ) {
return null;
}
if( 0 == fieldSelectorStrings.length ) {
return null;
}
List<FieldSele... | [
"private",
"List",
"<",
"FieldSelector",
">",
"getFieldSelectorsFromRequest",
"(",
"HttpServletRequest",
"request",
")",
"throws",
"Exception",
"{",
"String",
"[",
"]",
"fieldSelectorStrings",
"=",
"request",
".",
"getParameterValues",
"(",
"\"select\"",
")",
";",
"... | Return a list of column names to be included in a select clause.
@param request http request containing a (possibly empty) set of 'select' parms. Each select
parm may contain a comma-separated list of column names.
@return List of column names specified by those select parameters
@throws Exception | [
"Return",
"a",
"list",
"of",
"column",
"names",
"to",
"be",
"included",
"in",
"a",
"select",
"clause",
"."
] | 0b4abfc64eef2eb8b94f852ce697de2e851d8e67 | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-dbWeb/src/main/java/ca/carleton/gcrc/dbWeb/DbWebServlet.java#L719-L736 | train |
GCRC/nunaliit | nunaliit2-dbWeb/src/main/java/ca/carleton/gcrc/dbWeb/DbWebServlet.java | DbWebServlet.getOrderByList | private List<OrderSpecifier> getOrderByList(HttpServletRequest request) throws Exception {
String[] orderByStrings = request.getParameterValues("orderBy");
if( null == orderByStrings ) {
return null;
}
if( 0 == orderByStrings.length ) {
return null;
}
List<OrderSpecifier> result = new Vector<OrderS... | java | private List<OrderSpecifier> getOrderByList(HttpServletRequest request) throws Exception {
String[] orderByStrings = request.getParameterValues("orderBy");
if( null == orderByStrings ) {
return null;
}
if( 0 == orderByStrings.length ) {
return null;
}
List<OrderSpecifier> result = new Vector<OrderS... | [
"private",
"List",
"<",
"OrderSpecifier",
">",
"getOrderByList",
"(",
"HttpServletRequest",
"request",
")",
"throws",
"Exception",
"{",
"String",
"[",
"]",
"orderByStrings",
"=",
"request",
".",
"getParameterValues",
"(",
"\"orderBy\"",
")",
";",
"if",
"(",
"nul... | Return a list of order specifiers found in request
@param request http request containing a (possibly empty) set of 'orderBy' parms.
@return List of order specifiers given by those orderBy parameters
@throws Exception | [
"Return",
"a",
"list",
"of",
"order",
"specifiers",
"found",
"in",
"request"
] | 0b4abfc64eef2eb8b94f852ce697de2e851d8e67 | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-dbWeb/src/main/java/ca/carleton/gcrc/dbWeb/DbWebServlet.java#L857-L874 | train |
GCRC/nunaliit | nunaliit2-dbSec/src/main/java/ca/carleton/gcrc/dbSec/DbSecurity.java | DbSecurity.getTableSchemaFromName | public TableSchema getTableSchemaFromName(String tableName, DbUser user) throws Exception {
List<String> tableNames = new Vector<String>();
tableNames.add(tableName);
Map<String,TableSchemaImpl> nameToTableMap = getTableDataFromGroups(user,tableNames);
if( false == nameToTableMap.containsKey(tableName) ) ... | java | public TableSchema getTableSchemaFromName(String tableName, DbUser user) throws Exception {
List<String> tableNames = new Vector<String>();
tableNames.add(tableName);
Map<String,TableSchemaImpl> nameToTableMap = getTableDataFromGroups(user,tableNames);
if( false == nameToTableMap.containsKey(tableName) ) ... | [
"public",
"TableSchema",
"getTableSchemaFromName",
"(",
"String",
"tableName",
",",
"DbUser",
"user",
")",
"throws",
"Exception",
"{",
"List",
"<",
"String",
">",
"tableNames",
"=",
"new",
"Vector",
"<",
"String",
">",
"(",
")",
";",
"tableNames",
".",
"add"... | Computes from the database the access to a table for a given user. In
this call, a user is represented by the set of groups it belongs to.
@param tableName Name of the table to be queried
@param user User requesting access to the schema
@return An object that represents available access to a table. Null if the table
no... | [
"Computes",
"from",
"the",
"database",
"the",
"access",
"to",
"a",
"table",
"for",
"a",
"given",
"user",
".",
"In",
"this",
"call",
"a",
"user",
"is",
"represented",
"by",
"the",
"set",
"of",
"groups",
"it",
"belongs",
"to",
"."
] | 0b4abfc64eef2eb8b94f852ce697de2e851d8e67 | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-dbSec/src/main/java/ca/carleton/gcrc/dbSec/DbSecurity.java#L87-L98 | train |
GCRC/nunaliit | nunaliit2-dbSec/src/main/java/ca/carleton/gcrc/dbSec/DbSecurity.java | DbSecurity.getAvailableTablesFromGroups | public List<TableSchema> getAvailableTablesFromGroups(DbUser user) throws Exception {
Map<String,TableSchemaImpl> nameToTableMap = getTableDataFromGroups(user,null);
List<TableSchema> result = new Vector<TableSchema>();
result.addAll(nameToTableMap.values());
return result;
} | java | public List<TableSchema> getAvailableTablesFromGroups(DbUser user) throws Exception {
Map<String,TableSchemaImpl> nameToTableMap = getTableDataFromGroups(user,null);
List<TableSchema> result = new Vector<TableSchema>();
result.addAll(nameToTableMap.values());
return result;
} | [
"public",
"List",
"<",
"TableSchema",
">",
"getAvailableTablesFromGroups",
"(",
"DbUser",
"user",
")",
"throws",
"Exception",
"{",
"Map",
"<",
"String",
",",
"TableSchemaImpl",
">",
"nameToTableMap",
"=",
"getTableDataFromGroups",
"(",
"user",
",",
"null",
")",
... | Computes from the database the access to all tables for a given user. In
this call, a user is represented by the set of groups it belongs to.
@param user User requesting access to the database
@return An list that represents available access to all visible tables.
@throws Exception | [
"Computes",
"from",
"the",
"database",
"the",
"access",
"to",
"all",
"tables",
"for",
"a",
"given",
"user",
".",
"In",
"this",
"call",
"a",
"user",
"is",
"represented",
"by",
"the",
"set",
"of",
"groups",
"it",
"belongs",
"to",
"."
] | 0b4abfc64eef2eb8b94f852ce697de2e851d8e67 | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-dbSec/src/main/java/ca/carleton/gcrc/dbSec/DbSecurity.java#L107-L113 | train |
GCRC/nunaliit | nunaliit2-utils/src/main/java/ca/carleton/gcrc/utils/CommandUtils.java | CommandUtils.breakUpCommand | static public List<String> breakUpCommand(String command) throws Exception{
try {
List<String> commandTokens = new Vector<String>();
StringBuilder currentToken = null;
boolean isTokenQuoted = false;
StringReader sr = new StringReader(command);
int b = sr.read();
while( b >= 0 ){
char c = (ch... | java | static public List<String> breakUpCommand(String command) throws Exception{
try {
List<String> commandTokens = new Vector<String>();
StringBuilder currentToken = null;
boolean isTokenQuoted = false;
StringReader sr = new StringReader(command);
int b = sr.read();
while( b >= 0 ){
char c = (ch... | [
"static",
"public",
"List",
"<",
"String",
">",
"breakUpCommand",
"(",
"String",
"command",
")",
"throws",
"Exception",
"{",
"try",
"{",
"List",
"<",
"String",
">",
"commandTokens",
"=",
"new",
"Vector",
"<",
"String",
">",
"(",
")",
";",
"StringBuilder",
... | Takes a single line command as a string and breaks it up in tokens
acceptable for the java.lang.ProcessBuilder.ProcessBuilder
@param command Complete command as a single string
@return Array of strings that are acceptable tokens for ProcessBuilder
@throws Exception | [
"Takes",
"a",
"single",
"line",
"command",
"as",
"a",
"string",
"and",
"breaks",
"it",
"up",
"in",
"tokens",
"acceptable",
"for",
"the",
"java",
".",
"lang",
".",
"ProcessBuilder",
".",
"ProcessBuilder"
] | 0b4abfc64eef2eb8b94f852ce697de2e851d8e67 | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-utils/src/main/java/ca/carleton/gcrc/utils/CommandUtils.java#L29-L97 | train |
GCRC/nunaliit | nunaliit2-auth-common/src/main/java/ca/carleton/gcrc/auth/common/UserRepositoryDb.java | UserRepositoryDb.executeStatementToUser | private UserAndPassword executeStatementToUser(PreparedStatement preparedStmt) throws Exception {
if( preparedStmt.execute() ) {
// There's a ResultSet to be had
ResultSet rs = preparedStmt.getResultSet();
ResultSetMetaData rsmd = rs.getMetaData();
int numColumns = rsmd.getColumnCount();
if( numColumn... | java | private UserAndPassword executeStatementToUser(PreparedStatement preparedStmt) throws Exception {
if( preparedStmt.execute() ) {
// There's a ResultSet to be had
ResultSet rs = preparedStmt.getResultSet();
ResultSetMetaData rsmd = rs.getMetaData();
int numColumns = rsmd.getColumnCount();
if( numColumn... | [
"private",
"UserAndPassword",
"executeStatementToUser",
"(",
"PreparedStatement",
"preparedStmt",
")",
"throws",
"Exception",
"{",
"if",
"(",
"preparedStmt",
".",
"execute",
"(",
")",
")",
"{",
"// There's a ResultSet to be had",
"ResultSet",
"rs",
"=",
"preparedStmt",
... | This method executes a prepared SQL statement against the user table
and returns a User.
@param stmt Prepared SQL statement to execute
@return An instance of User based on the information found in the database
@throws Exception | [
"This",
"method",
"executes",
"a",
"prepared",
"SQL",
"statement",
"against",
"the",
"user",
"table",
"and",
"returns",
"a",
"User",
"."
] | 0b4abfc64eef2eb8b94f852ce697de2e851d8e67 | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-auth-common/src/main/java/ca/carleton/gcrc/auth/common/UserRepositoryDb.java#L126-L171 | train |
GCRC/nunaliit | nunaliit2-geom/src/main/java/ca/carleton/gcrc/geom/wkt/WktWriter.java | WktWriter.writeNumber | private void writeNumber(PrintWriter pw, NumberFormat numFormat, Number num){
if( num.doubleValue() == Math.round(num.doubleValue()) ){
// Integer
if( null != numFormat ){
pw.print( numFormat.format(num.intValue()) );
} else {
pw.print( num.intValue() );
}
} else {
if( null != numFormat )... | java | private void writeNumber(PrintWriter pw, NumberFormat numFormat, Number num){
if( num.doubleValue() == Math.round(num.doubleValue()) ){
// Integer
if( null != numFormat ){
pw.print( numFormat.format(num.intValue()) );
} else {
pw.print( num.intValue() );
}
} else {
if( null != numFormat )... | [
"private",
"void",
"writeNumber",
"(",
"PrintWriter",
"pw",
",",
"NumberFormat",
"numFormat",
",",
"Number",
"num",
")",
"{",
"if",
"(",
"num",
".",
"doubleValue",
"(",
")",
"==",
"Math",
".",
"round",
"(",
"num",
".",
"doubleValue",
"(",
")",
")",
")"... | Writes a number to the print writer. If the number is an integer, do not
write the decimal points.
@param pw
@param num | [
"Writes",
"a",
"number",
"to",
"the",
"print",
"writer",
".",
"If",
"the",
"number",
"is",
"an",
"integer",
"do",
"not",
"write",
"the",
"decimal",
"points",
"."
] | 0b4abfc64eef2eb8b94f852ce697de2e851d8e67 | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-geom/src/main/java/ca/carleton/gcrc/geom/wkt/WktWriter.java#L284-L300 | train |
GCRC/nunaliit | nunaliit2-utils/src/main/java/ca/carleton/gcrc/utils/DateUtils.java | DateUtils.parseGpsTimestamp | static public Date parseGpsTimestamp(String gpsTimestamp) throws Exception {
try {
Matcher matcherTime = patternTime.matcher(gpsTimestamp);
if( matcherTime.matches() ) {
int year = Integer.parseInt( matcherTime.group(1) );
int month = Integer.parseInt( matcherTime.group(2) );
int day = Integer.parse... | java | static public Date parseGpsTimestamp(String gpsTimestamp) throws Exception {
try {
Matcher matcherTime = patternTime.matcher(gpsTimestamp);
if( matcherTime.matches() ) {
int year = Integer.parseInt( matcherTime.group(1) );
int month = Integer.parseInt( matcherTime.group(2) );
int day = Integer.parse... | [
"static",
"public",
"Date",
"parseGpsTimestamp",
"(",
"String",
"gpsTimestamp",
")",
"throws",
"Exception",
"{",
"try",
"{",
"Matcher",
"matcherTime",
"=",
"patternTime",
".",
"matcher",
"(",
"gpsTimestamp",
")",
";",
"if",
"(",
"matcherTime",
".",
"matches",
... | Parses a GPS timestamp with a 1 second precision.
@param gpsTimestamp String containing time stamp
@return A date, precise to the second, representing the given timestamp.
@throws Exception | [
"Parses",
"a",
"GPS",
"timestamp",
"with",
"a",
"1",
"second",
"precision",
"."
] | 0b4abfc64eef2eb8b94f852ce697de2e851d8e67 | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-utils/src/main/java/ca/carleton/gcrc/utils/DateUtils.java#L19-L42 | train |
GCRC/nunaliit | nunaliit2-jdbc/src/main/java/ca/carleton/gcrc/jdbc/JdbcUtils.java | JdbcUtils.safeSqlQueryStringValue | static public String safeSqlQueryStringValue(String in) throws Exception {
if( null == in ) {
return "NULL";
}
if( in.indexOf('\0') >= 0 ) {
throw new Exception("Null character found in string value");
}
// All quotes should be escaped
in = in.replace("'", "''");
// Add quotes again
return "'" ... | java | static public String safeSqlQueryStringValue(String in) throws Exception {
if( null == in ) {
return "NULL";
}
if( in.indexOf('\0') >= 0 ) {
throw new Exception("Null character found in string value");
}
// All quotes should be escaped
in = in.replace("'", "''");
// Add quotes again
return "'" ... | [
"static",
"public",
"String",
"safeSqlQueryStringValue",
"(",
"String",
"in",
")",
"throws",
"Exception",
"{",
"if",
"(",
"null",
"==",
"in",
")",
"{",
"return",
"\"NULL\"",
";",
"}",
"if",
"(",
"in",
".",
"indexOf",
"(",
"'",
"'",
")",
">=",
"0",
")... | This method converts a string into a new one that is safe for
a SQL query. It deals with strings that are expected to be string
values.
@param in Original string
@return Safe string for a query.
@throws Exception | [
"This",
"method",
"converts",
"a",
"string",
"into",
"a",
"new",
"one",
"that",
"is",
"safe",
"for",
"a",
"SQL",
"query",
".",
"It",
"deals",
"with",
"strings",
"that",
"are",
"expected",
"to",
"be",
"string",
"values",
"."
] | 0b4abfc64eef2eb8b94f852ce697de2e851d8e67 | https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-jdbc/src/main/java/ca/carleton/gcrc/jdbc/JdbcUtils.java#L48-L60 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.