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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
authlete/authlete-java-common | src/main/java/com/authlete/common/web/BearerToken.java | BearerToken.parse | public static String parse(String input)
{
if (input == null)
{
return null;
}
// First, check whether the input matches the pattern
// "Bearer {access-token}".
Matcher matcher = CHALLENGE_PATTERN.matcher(input);
// If the input matche... | java | public static String parse(String input)
{
if (input == null)
{
return null;
}
// First, check whether the input matches the pattern
// "Bearer {access-token}".
Matcher matcher = CHALLENGE_PATTERN.matcher(input);
// If the input matche... | [
"public",
"static",
"String",
"parse",
"(",
"String",
"input",
")",
"{",
"if",
"(",
"input",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"// First, check whether the input matches the pattern\r",
"// \"Bearer {access-token}\".\r",
"Matcher",
"matcher",
"=",
... | Extract the access token embedded in the input string.
<p>
This method assumes that the input string comes from one of
the following three places that are mentioned in "RFC 6750
(OAuth 2.0 Bearer Token Usage),
<a href="http://tools.ietf.org/html/rfc6750#section-2"
>2. Authenticated Requests</a>".
</p>
<blockquote>
<o... | [
"Extract",
"the",
"access",
"token",
"embedded",
"in",
"the",
"input",
"string",
"."
] | 49c94c483713cbf5a04d805ff7dbd83766c9c964 | https://github.com/authlete/authlete-java-common/blob/49c94c483713cbf5a04d805ff7dbd83766c9c964/src/main/java/com/authlete/common/web/BearerToken.java#L102-L126 | train |
authlete/authlete-java-common | src/main/java/com/authlete/common/dto/Scope.java | Scope.setAttributes | public Scope setAttributes(Iterable<Pair> attributes)
{
if (attributes == null)
{
this.attributes = null;
return this;
}
List<Pair> list = new ArrayList<Pair>();
for (Pair attribute : attributes)
{
if (attribute == n... | java | public Scope setAttributes(Iterable<Pair> attributes)
{
if (attributes == null)
{
this.attributes = null;
return this;
}
List<Pair> list = new ArrayList<Pair>();
for (Pair attribute : attributes)
{
if (attribute == n... | [
"public",
"Scope",
"setAttributes",
"(",
"Iterable",
"<",
"Pair",
">",
"attributes",
")",
"{",
"if",
"(",
"attributes",
"==",
"null",
")",
"{",
"this",
".",
"attributes",
"=",
"null",
";",
"return",
"this",
";",
"}",
"List",
"<",
"Pair",
">",
"list",
... | Set attributes.
@param attributes
Attributes.
@return
{@code this} object.
@since 2.12 | [
"Set",
"attributes",
"."
] | 49c94c483713cbf5a04d805ff7dbd83766c9c964 | https://github.com/authlete/authlete-java-common/blob/49c94c483713cbf5a04d805ff7dbd83766c9c964/src/main/java/com/authlete/common/dto/Scope.java#L249-L283 | train |
authlete/authlete-java-common | src/main/java/com/authlete/common/dto/Scope.java | Scope.extractNames | public static String[] extractNames(Scope[] scopes)
{
if (scopes == null)
{
return null;
}
// Create an array for scope names.
String[] names = new String[scopes.length];
// For each scope.
for (int i = 0; i < scopes.length; ++i)
... | java | public static String[] extractNames(Scope[] scopes)
{
if (scopes == null)
{
return null;
}
// Create an array for scope names.
String[] names = new String[scopes.length];
// For each scope.
for (int i = 0; i < scopes.length; ++i)
... | [
"public",
"static",
"String",
"[",
"]",
"extractNames",
"(",
"Scope",
"[",
"]",
"scopes",
")",
"{",
"if",
"(",
"scopes",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"// Create an array for scope names.\r",
"String",
"[",
"]",
"names",
"=",
"new",
... | Extract scope names.
@param scopes
Scopes.
@return
Scope names. If {@code scopes} is {@code null},
{@code null} is returned. | [
"Extract",
"scope",
"names",
"."
] | 49c94c483713cbf5a04d805ff7dbd83766c9c964 | https://github.com/authlete/authlete-java-common/blob/49c94c483713cbf5a04d805ff7dbd83766c9c964/src/main/java/com/authlete/common/dto/Scope.java#L296-L318 | train |
authlete/authlete-java-common | src/main/java/com/authlete/common/web/URLCoder.java | URLCoder.encode | public static String encode(String input)
{
try
{
return URLEncoder.encode(input, "UTF-8");
}
catch (UnsupportedEncodingException e)
{
// This never happens.
return input;
}
} | java | public static String encode(String input)
{
try
{
return URLEncoder.encode(input, "UTF-8");
}
catch (UnsupportedEncodingException e)
{
// This never happens.
return input;
}
} | [
"public",
"static",
"String",
"encode",
"(",
"String",
"input",
")",
"{",
"try",
"{",
"return",
"URLEncoder",
".",
"encode",
"(",
"input",
",",
"\"UTF-8\"",
")",
";",
"}",
"catch",
"(",
"UnsupportedEncodingException",
"e",
")",
"{",
"// This never happens.\r",... | URL-encode the input with UTF-8.
@param input
A string to be encoded.
@return
Encoded string. | [
"URL",
"-",
"encode",
"the",
"input",
"with",
"UTF",
"-",
"8",
"."
] | 49c94c483713cbf5a04d805ff7dbd83766c9c964 | https://github.com/authlete/authlete-java-common/blob/49c94c483713cbf5a04d805ff7dbd83766c9c964/src/main/java/com/authlete/common/web/URLCoder.java#L42-L53 | train |
authlete/authlete-java-common | src/main/java/com/authlete/common/web/URLCoder.java | URLCoder.decode | public static String decode(String input)
{
try
{
return URLDecoder.decode(input, "UTF-8");
}
catch (UnsupportedEncodingException e)
{
// This never happens.
return input;
}
} | java | public static String decode(String input)
{
try
{
return URLDecoder.decode(input, "UTF-8");
}
catch (UnsupportedEncodingException e)
{
// This never happens.
return input;
}
} | [
"public",
"static",
"String",
"decode",
"(",
"String",
"input",
")",
"{",
"try",
"{",
"return",
"URLDecoder",
".",
"decode",
"(",
"input",
",",
"\"UTF-8\"",
")",
";",
"}",
"catch",
"(",
"UnsupportedEncodingException",
"e",
")",
"{",
"// This never happens.\r",... | URL-decode the input with UTF-8.
@param input
An encoded string.
@return
Decoded string. | [
"URL",
"-",
"decode",
"the",
"input",
"with",
"UTF",
"-",
"8",
"."
] | 49c94c483713cbf5a04d805ff7dbd83766c9c964 | https://github.com/authlete/authlete-java-common/blob/49c94c483713cbf5a04d805ff7dbd83766c9c964/src/main/java/com/authlete/common/web/URLCoder.java#L65-L76 | train |
authlete/authlete-java-common | src/main/java/com/authlete/common/api/AuthleteApiException.java | AuthleteApiException.setResponse | private void setResponse(int statusCode, String statusMessage, String responseBody, Map<String, List<String>> responseHeaders)
{
mStatusCode = statusCode;
mStatusMessage = statusMessage;
mResponseBody = responseBody;
mResponseHeaders = responseHeaders;
} | java | private void setResponse(int statusCode, String statusMessage, String responseBody, Map<String, List<String>> responseHeaders)
{
mStatusCode = statusCode;
mStatusMessage = statusMessage;
mResponseBody = responseBody;
mResponseHeaders = responseHeaders;
} | [
"private",
"void",
"setResponse",
"(",
"int",
"statusCode",
",",
"String",
"statusMessage",
",",
"String",
"responseBody",
",",
"Map",
"<",
"String",
",",
"List",
"<",
"String",
">",
">",
"responseHeaders",
")",
"{",
"mStatusCode",
"=",
"statusCode",
";",
"m... | Set the data fields related to HTTP response information.
@param statusCode
HTTP status code.
@param statusMessage
HTTP status message.
@param responseBody
HTTP response body. | [
"Set",
"the",
"data",
"fields",
"related",
"to",
"HTTP",
"response",
"information",
"."
] | 49c94c483713cbf5a04d805ff7dbd83766c9c964 | https://github.com/authlete/authlete-java-common/blob/49c94c483713cbf5a04d805ff7dbd83766c9c964/src/main/java/com/authlete/common/api/AuthleteApiException.java#L293-L299 | train |
authlete/authlete-java-common | src/main/java/com/authlete/common/dto/BackchannelAuthenticationCompleteRequest.java | BackchannelAuthenticationCompleteRequest.setClaims | public BackchannelAuthenticationCompleteRequest setClaims(Map<String, Object> claims)
{
if (claims == null || claims.size() == 0)
{
this.claims = null;
}
else
{
setClaims(Utils.toJson(claims));
}
return this;
} | java | public BackchannelAuthenticationCompleteRequest setClaims(Map<String, Object> claims)
{
if (claims == null || claims.size() == 0)
{
this.claims = null;
}
else
{
setClaims(Utils.toJson(claims));
}
return this;
} | [
"public",
"BackchannelAuthenticationCompleteRequest",
"setClaims",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"claims",
")",
"{",
"if",
"(",
"claims",
"==",
"null",
"||",
"claims",
".",
"size",
"(",
")",
"==",
"0",
")",
"{",
"this",
".",
"claims",
"=... | Set additional claims which will be embedded in the ID token.
<p>
The argument is converted into a JSON string and passed to
{@link #setClaims(String)} method.
</p>
@param claims
Additional claims. Keys are claim names.
@return
{@code this} object. | [
"Set",
"additional",
"claims",
"which",
"will",
"be",
"embedded",
"in",
"the",
"ID",
"token",
"."
] | 49c94c483713cbf5a04d805ff7dbd83766c9c964 | https://github.com/authlete/authlete-java-common/blob/49c94c483713cbf5a04d805ff7dbd83766c9c964/src/main/java/com/authlete/common/dto/BackchannelAuthenticationCompleteRequest.java#L573-L585 | train |
authlete/authlete-java-common | src/main/java/com/authlete/common/api/AuthleteApiImpl.java | AuthleteApiImpl.callServiceOwnerGetApi | private <TResponse> TResponse callServiceOwnerGetApi(
String path, Map<String, String> queryParams,
Class<TResponse> responseClass) throws AuthleteApiException
{
return callGetApi(mServiceOwnerCredentials, path, queryParams, responseClass);
} | java | private <TResponse> TResponse callServiceOwnerGetApi(
String path, Map<String, String> queryParams,
Class<TResponse> responseClass) throws AuthleteApiException
{
return callGetApi(mServiceOwnerCredentials, path, queryParams, responseClass);
} | [
"private",
"<",
"TResponse",
">",
"TResponse",
"callServiceOwnerGetApi",
"(",
"String",
"path",
",",
"Map",
"<",
"String",
",",
"String",
">",
"queryParams",
",",
"Class",
"<",
"TResponse",
">",
"responseClass",
")",
"throws",
"AuthleteApiException",
"{",
"retur... | Call an API with HTTP GET method and Service Owner credentials. | [
"Call",
"an",
"API",
"with",
"HTTP",
"GET",
"method",
"and",
"Service",
"Owner",
"credentials",
"."
] | 49c94c483713cbf5a04d805ff7dbd83766c9c964 | https://github.com/authlete/authlete-java-common/blob/49c94c483713cbf5a04d805ff7dbd83766c9c964/src/main/java/com/authlete/common/api/AuthleteApiImpl.java#L262-L267 | train |
authlete/authlete-java-common | src/main/java/com/authlete/common/api/AuthleteApiImpl.java | AuthleteApiImpl.callServiceGetApi | private <TResponse> TResponse callServiceGetApi(
String path, Map<String, String> queryParams,
Class<TResponse> responseClass) throws AuthleteApiException
{
return callGetApi(mServiceCredentials, path, queryParams, responseClass);
} | java | private <TResponse> TResponse callServiceGetApi(
String path, Map<String, String> queryParams,
Class<TResponse> responseClass) throws AuthleteApiException
{
return callGetApi(mServiceCredentials, path, queryParams, responseClass);
} | [
"private",
"<",
"TResponse",
">",
"TResponse",
"callServiceGetApi",
"(",
"String",
"path",
",",
"Map",
"<",
"String",
",",
"String",
">",
"queryParams",
",",
"Class",
"<",
"TResponse",
">",
"responseClass",
")",
"throws",
"AuthleteApiException",
"{",
"return",
... | Call an API with HTTP GET method and Service credentials. | [
"Call",
"an",
"API",
"with",
"HTTP",
"GET",
"method",
"and",
"Service",
"credentials",
"."
] | 49c94c483713cbf5a04d805ff7dbd83766c9c964 | https://github.com/authlete/authlete-java-common/blob/49c94c483713cbf5a04d805ff7dbd83766c9c964/src/main/java/com/authlete/common/api/AuthleteApiImpl.java#L283-L288 | train |
authlete/authlete-java-common | src/main/java/com/authlete/common/api/AuthleteApiImpl.java | AuthleteApiImpl.callGetApi | private <TResponse> TResponse callGetApi(
BasicCredentials credentials, String path, Map<String, String> queryParams,
Class<TResponse> responseClass) throws AuthleteApiException
{
return callApi(HttpMethod.GET, credentials, path, queryParams, (Object)null, responseClass);
} | java | private <TResponse> TResponse callGetApi(
BasicCredentials credentials, String path, Map<String, String> queryParams,
Class<TResponse> responseClass) throws AuthleteApiException
{
return callApi(HttpMethod.GET, credentials, path, queryParams, (Object)null, responseClass);
} | [
"private",
"<",
"TResponse",
">",
"TResponse",
"callGetApi",
"(",
"BasicCredentials",
"credentials",
",",
"String",
"path",
",",
"Map",
"<",
"String",
",",
"String",
">",
"queryParams",
",",
"Class",
"<",
"TResponse",
">",
"responseClass",
")",
"throws",
"Auth... | Call an API with HTTP GET method. | [
"Call",
"an",
"API",
"with",
"HTTP",
"GET",
"method",
"."
] | 49c94c483713cbf5a04d805ff7dbd83766c9c964 | https://github.com/authlete/authlete-java-common/blob/49c94c483713cbf5a04d805ff7dbd83766c9c964/src/main/java/com/authlete/common/api/AuthleteApiImpl.java#L294-L299 | train |
authlete/authlete-java-common | src/main/java/com/authlete/common/api/AuthleteApiImpl.java | AuthleteApiImpl.callServiceOwnerPostApi | private <TResponse> TResponse callServiceOwnerPostApi(
String path, Map<String, String> queryParams,
Object requestBody, Class<TResponse> responseClass) throws AuthleteApiException
{
return callPostApi(mServiceOwnerCredentials, path, queryParams, requestBody, responseClass);
} | java | private <TResponse> TResponse callServiceOwnerPostApi(
String path, Map<String, String> queryParams,
Object requestBody, Class<TResponse> responseClass) throws AuthleteApiException
{
return callPostApi(mServiceOwnerCredentials, path, queryParams, requestBody, responseClass);
} | [
"private",
"<",
"TResponse",
">",
"TResponse",
"callServiceOwnerPostApi",
"(",
"String",
"path",
",",
"Map",
"<",
"String",
",",
"String",
">",
"queryParams",
",",
"Object",
"requestBody",
",",
"Class",
"<",
"TResponse",
">",
"responseClass",
")",
"throws",
"A... | Call an API with HTTP POST method and Service Owner credentials. | [
"Call",
"an",
"API",
"with",
"HTTP",
"POST",
"method",
"and",
"Service",
"Owner",
"credentials",
"."
] | 49c94c483713cbf5a04d805ff7dbd83766c9c964 | https://github.com/authlete/authlete-java-common/blob/49c94c483713cbf5a04d805ff7dbd83766c9c964/src/main/java/com/authlete/common/api/AuthleteApiImpl.java#L315-L320 | train |
authlete/authlete-java-common | src/main/java/com/authlete/common/api/AuthleteApiImpl.java | AuthleteApiImpl.callServicePostApi | private <TResponse> TResponse callServicePostApi(
String path, Map<String, String> queryParams,
Object requestBody, Class<TResponse> responseClass) throws AuthleteApiException
{
return callPostApi(mServiceCredentials, path, queryParams, requestBody, responseClass);
} | java | private <TResponse> TResponse callServicePostApi(
String path, Map<String, String> queryParams,
Object requestBody, Class<TResponse> responseClass) throws AuthleteApiException
{
return callPostApi(mServiceCredentials, path, queryParams, requestBody, responseClass);
} | [
"private",
"<",
"TResponse",
">",
"TResponse",
"callServicePostApi",
"(",
"String",
"path",
",",
"Map",
"<",
"String",
",",
"String",
">",
"queryParams",
",",
"Object",
"requestBody",
",",
"Class",
"<",
"TResponse",
">",
"responseClass",
")",
"throws",
"Authle... | Call an API with HTTP POST method and Service credentials. | [
"Call",
"an",
"API",
"with",
"HTTP",
"POST",
"method",
"and",
"Service",
"credentials",
"."
] | 49c94c483713cbf5a04d805ff7dbd83766c9c964 | https://github.com/authlete/authlete-java-common/blob/49c94c483713cbf5a04d805ff7dbd83766c9c964/src/main/java/com/authlete/common/api/AuthleteApiImpl.java#L336-L341 | train |
authlete/authlete-java-common | src/main/java/com/authlete/common/api/AuthleteApiImpl.java | AuthleteApiImpl.callPostApi | private <TResponse> TResponse callPostApi(
BasicCredentials credentials, String path, Map<String, String> queryParams,
Object requestBody, Class<TResponse> responseClass) throws AuthleteApiException
{
return callApi(HttpMethod.POST, credentials, path, queryParams, requestBody, respon... | java | private <TResponse> TResponse callPostApi(
BasicCredentials credentials, String path, Map<String, String> queryParams,
Object requestBody, Class<TResponse> responseClass) throws AuthleteApiException
{
return callApi(HttpMethod.POST, credentials, path, queryParams, requestBody, respon... | [
"private",
"<",
"TResponse",
">",
"TResponse",
"callPostApi",
"(",
"BasicCredentials",
"credentials",
",",
"String",
"path",
",",
"Map",
"<",
"String",
",",
"String",
">",
"queryParams",
",",
"Object",
"requestBody",
",",
"Class",
"<",
"TResponse",
">",
"respo... | Call an API with HTTP POST method. | [
"Call",
"an",
"API",
"with",
"HTTP",
"POST",
"method",
"."
] | 49c94c483713cbf5a04d805ff7dbd83766c9c964 | https://github.com/authlete/authlete-java-common/blob/49c94c483713cbf5a04d805ff7dbd83766c9c964/src/main/java/com/authlete/common/api/AuthleteApiImpl.java#L347-L352 | train |
authlete/authlete-java-common | src/main/java/com/authlete/common/api/AuthleteApiImpl.java | AuthleteApiImpl.callServiceOwnerDeleteApi | private <TResponse> void callServiceOwnerDeleteApi(
String path, Map<String, String> queryParams) throws AuthleteApiException
{
callDeleteApi(mServiceOwnerCredentials, path, queryParams);
} | java | private <TResponse> void callServiceOwnerDeleteApi(
String path, Map<String, String> queryParams) throws AuthleteApiException
{
callDeleteApi(mServiceOwnerCredentials, path, queryParams);
} | [
"private",
"<",
"TResponse",
">",
"void",
"callServiceOwnerDeleteApi",
"(",
"String",
"path",
",",
"Map",
"<",
"String",
",",
"String",
">",
"queryParams",
")",
"throws",
"AuthleteApiException",
"{",
"callDeleteApi",
"(",
"mServiceOwnerCredentials",
",",
"path",
"... | Call an API with HTTP DELETE method and Service Owner credentials. | [
"Call",
"an",
"API",
"with",
"HTTP",
"DELETE",
"method",
"and",
"Service",
"Owner",
"credentials",
"."
] | 49c94c483713cbf5a04d805ff7dbd83766c9c964 | https://github.com/authlete/authlete-java-common/blob/49c94c483713cbf5a04d805ff7dbd83766c9c964/src/main/java/com/authlete/common/api/AuthleteApiImpl.java#L367-L371 | train |
authlete/authlete-java-common | src/main/java/com/authlete/common/api/AuthleteApiImpl.java | AuthleteApiImpl.callServiceDeleteApi | private <TResponse> void callServiceDeleteApi(
String path, Map<String, String> queryParams) throws AuthleteApiException
{
callDeleteApi(mServiceCredentials, path, queryParams);
} | java | private <TResponse> void callServiceDeleteApi(
String path, Map<String, String> queryParams) throws AuthleteApiException
{
callDeleteApi(mServiceCredentials, path, queryParams);
} | [
"private",
"<",
"TResponse",
">",
"void",
"callServiceDeleteApi",
"(",
"String",
"path",
",",
"Map",
"<",
"String",
",",
"String",
">",
"queryParams",
")",
"throws",
"AuthleteApiException",
"{",
"callDeleteApi",
"(",
"mServiceCredentials",
",",
"path",
",",
"que... | Call an API with HTTP DELETE method and Service credentials. | [
"Call",
"an",
"API",
"with",
"HTTP",
"DELETE",
"method",
"and",
"Service",
"credentials",
"."
] | 49c94c483713cbf5a04d805ff7dbd83766c9c964 | https://github.com/authlete/authlete-java-common/blob/49c94c483713cbf5a04d805ff7dbd83766c9c964/src/main/java/com/authlete/common/api/AuthleteApiImpl.java#L386-L390 | train |
authlete/authlete-java-common | src/main/java/com/authlete/common/api/AuthleteApiImpl.java | AuthleteApiImpl.callDeleteApi | private <TResponse> void callDeleteApi(
BasicCredentials credentials, String path,
Map<String, String> queryParams) throws AuthleteApiException
{
callApi(HttpMethod.DELETE, credentials, path, queryParams, (Object)null, (Class<TResponse>)null);
} | java | private <TResponse> void callDeleteApi(
BasicCredentials credentials, String path,
Map<String, String> queryParams) throws AuthleteApiException
{
callApi(HttpMethod.DELETE, credentials, path, queryParams, (Object)null, (Class<TResponse>)null);
} | [
"private",
"<",
"TResponse",
">",
"void",
"callDeleteApi",
"(",
"BasicCredentials",
"credentials",
",",
"String",
"path",
",",
"Map",
"<",
"String",
",",
"String",
">",
"queryParams",
")",
"throws",
"AuthleteApiException",
"{",
"callApi",
"(",
"HttpMethod",
".",... | Call an API with HTTP DELETE method. | [
"Call",
"an",
"API",
"with",
"HTTP",
"DELETE",
"method",
"."
] | 49c94c483713cbf5a04d805ff7dbd83766c9c964 | https://github.com/authlete/authlete-java-common/blob/49c94c483713cbf5a04d805ff7dbd83766c9c964/src/main/java/com/authlete/common/api/AuthleteApiImpl.java#L396-L401 | train |
authlete/authlete-java-common | src/main/java/com/authlete/common/api/AuthleteApiImpl.java | AuthleteApiImpl.callApi | private <TResponse> TResponse callApi(
HttpMethod method, BasicCredentials credentials,
String path, Map<String, String> queryParams,
Object requestBody, Class<TResponse> responseClass) throws AuthleteApiException
{
// Create a connection to the Authlete API.
Http... | java | private <TResponse> TResponse callApi(
HttpMethod method, BasicCredentials credentials,
String path, Map<String, String> queryParams,
Object requestBody, Class<TResponse> responseClass) throws AuthleteApiException
{
// Create a connection to the Authlete API.
Http... | [
"private",
"<",
"TResponse",
">",
"TResponse",
"callApi",
"(",
"HttpMethod",
"method",
",",
"BasicCredentials",
"credentials",
",",
"String",
"path",
",",
"Map",
"<",
"String",
",",
"String",
">",
"queryParams",
",",
"Object",
"requestBody",
",",
"Class",
"<",... | Call an API. | [
"Call",
"an",
"API",
"."
] | 49c94c483713cbf5a04d805ff7dbd83766c9c964 | https://github.com/authlete/authlete-java-common/blob/49c94c483713cbf5a04d805ff7dbd83766c9c964/src/main/java/com/authlete/common/api/AuthleteApiImpl.java#L407-L426 | train |
authlete/authlete-java-common | src/main/java/com/authlete/common/util/Utils.java | Utils.join | public static String join(String[] strings, String delimiter)
{
if (strings == null)
{
return null;
}
if (strings.length == 0)
{
return "";
}
boolean useDelimiter = (delimiter != null && delimiter.length() != 0);
... | java | public static String join(String[] strings, String delimiter)
{
if (strings == null)
{
return null;
}
if (strings.length == 0)
{
return "";
}
boolean useDelimiter = (delimiter != null && delimiter.length() != 0);
... | [
"public",
"static",
"String",
"join",
"(",
"String",
"[",
"]",
"strings",
",",
"String",
"delimiter",
")",
"{",
"if",
"(",
"strings",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"strings",
".",
"length",
"==",
"0",
")",
"{",
"ret... | Concatenate string with the specified delimiter.
@param strings
Strings to be concatenated.
@param delimiter
A delimiter used between strings. If {@code null} or an empty
string is given, delimiters are not inserted between strings.
@return
A concatenated string. If {@code strings} is {@code null},
{@code null} is r... | [
"Concatenate",
"string",
"with",
"the",
"specified",
"delimiter",
"."
] | 49c94c483713cbf5a04d805ff7dbd83766c9c964 | https://github.com/authlete/authlete-java-common/blob/49c94c483713cbf5a04d805ff7dbd83766c9c964/src/main/java/com/authlete/common/util/Utils.java#L53-L86 | train |
authlete/authlete-java-common | src/main/java/com/authlete/common/util/Utils.java | Utils.stringifyScopeNames | public static String stringifyScopeNames(Scope[] scopes)
{
if (scopes == null)
{
return null;
}
String[] array = new String[scopes.length];
for (int i = 0; i < scopes.length; ++i)
{
array[i] = (scopes[i] == null) ? null : scopes[i]... | java | public static String stringifyScopeNames(Scope[] scopes)
{
if (scopes == null)
{
return null;
}
String[] array = new String[scopes.length];
for (int i = 0; i < scopes.length; ++i)
{
array[i] = (scopes[i] == null) ? null : scopes[i]... | [
"public",
"static",
"String",
"stringifyScopeNames",
"(",
"Scope",
"[",
"]",
"scopes",
")",
"{",
"if",
"(",
"scopes",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"String",
"[",
"]",
"array",
"=",
"new",
"String",
"[",
"scopes",
".",
"length",
... | Generate a list of scope names.
@param scopes
An array of {@link Scope}. If {@code null} is given,
{@code null} is returned.
@return
A string containing scope names using white spaces as
the delimiter.
@since 2.5 | [
"Generate",
"a",
"list",
"of",
"scope",
"names",
"."
] | 49c94c483713cbf5a04d805ff7dbd83766c9c964 | https://github.com/authlete/authlete-java-common/blob/49c94c483713cbf5a04d805ff7dbd83766c9c964/src/main/java/com/authlete/common/util/Utils.java#L257-L272 | train |
EvidentSolutions/dalesbred | dalesbred/src/main/java/org/dalesbred/query/QueryBuilder.java | QueryBuilder.append | public @NotNull QueryBuilder append(@SuppressWarnings("ParameterHidesMemberVariable") @NotNull SqlQuery query) {
this.query.append(query.getSql());
arguments.addAll(query.getArguments());
return this;
} | java | public @NotNull QueryBuilder append(@SuppressWarnings("ParameterHidesMemberVariable") @NotNull SqlQuery query) {
this.query.append(query.getSql());
arguments.addAll(query.getArguments());
return this;
} | [
"public",
"@",
"NotNull",
"QueryBuilder",
"append",
"(",
"@",
"SuppressWarnings",
"(",
"\"ParameterHidesMemberVariable\"",
")",
"@",
"NotNull",
"SqlQuery",
"query",
")",
"{",
"this",
".",
"query",
".",
"append",
"(",
"query",
".",
"getSql",
"(",
")",
")",
";... | Appends given query and its arguments to this query. | [
"Appends",
"given",
"query",
"and",
"its",
"arguments",
"to",
"this",
"query",
"."
] | 713f5b6e152d97e1672ca68b9ff9c7c6c288ceb1 | https://github.com/EvidentSolutions/dalesbred/blob/713f5b6e152d97e1672ca68b9ff9c7c6c288ceb1/dalesbred/src/main/java/org/dalesbred/query/QueryBuilder.java#L99-L103 | train |
terrestris/shogun-core | src/shogun-core-main/src/main/java/de/terrestris/shoguncore/service/PasswordResetTokenService.java | PasswordResetTokenService.buildConcreteInstance | @SuppressWarnings("unchecked")
@Override
protected E buildConcreteInstance(User user, Integer expirationTimeInMinutes) {
if (expirationTimeInMinutes == null) {
return (E) new PasswordResetToken(user);
}
return (E) new PasswordResetToken(user, expirationTimeInMinutes);
} | java | @SuppressWarnings("unchecked")
@Override
protected E buildConcreteInstance(User user, Integer expirationTimeInMinutes) {
if (expirationTimeInMinutes == null) {
return (E) new PasswordResetToken(user);
}
return (E) new PasswordResetToken(user, expirationTimeInMinutes);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"@",
"Override",
"protected",
"E",
"buildConcreteInstance",
"(",
"User",
"user",
",",
"Integer",
"expirationTimeInMinutes",
")",
"{",
"if",
"(",
"expirationTimeInMinutes",
"==",
"null",
")",
"{",
"return",
"(",
... | Builds a concrete instance of this class. | [
"Builds",
"a",
"concrete",
"instance",
"of",
"this",
"class",
"."
] | 3dbabda35ae63235265913c865dba389b050b6e6 | https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/service/PasswordResetTokenService.java#L102-L109 | train |
terrestris/shogun-core | src/shogun-core-main/src/main/java/de/terrestris/shoguncore/service/InitializationService.java | InitializationService.saveUser | public void saveUser(User user) {
LOG.trace("Trying to create a new user");
// encode the raw password using bcrypt
final String pwHash = passwordEncoder.encode(user.getPassword());
user.setPassword(pwHash);
dao.saveOrUpdate(user);
LOG.info("Created the user " + user.getA... | java | public void saveUser(User user) {
LOG.trace("Trying to create a new user");
// encode the raw password using bcrypt
final String pwHash = passwordEncoder.encode(user.getPassword());
user.setPassword(pwHash);
dao.saveOrUpdate(user);
LOG.info("Created the user " + user.getA... | [
"public",
"void",
"saveUser",
"(",
"User",
"user",
")",
"{",
"LOG",
".",
"trace",
"(",
"\"Trying to create a new user\"",
")",
";",
"// encode the raw password using bcrypt",
"final",
"String",
"pwHash",
"=",
"passwordEncoder",
".",
"encode",
"(",
"user",
".",
"ge... | Used to create a user. Implements special logic by encoding the password.
@param user | [
"Used",
"to",
"create",
"a",
"user",
".",
"Implements",
"special",
"logic",
"by",
"encoding",
"the",
"password",
"."
] | 3dbabda35ae63235265913c865dba389b050b6e6 | https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/service/InitializationService.java#L63-L70 | train |
terrestris/shogun-core | src/shogun-core-main/src/main/java/de/terrestris/shoguncore/web/MapController.java | MapController.setLayersForMap | @RequestMapping(value = "/setLayersForMap.action", method = RequestMethod.POST)
public @ResponseBody
java.util.Map<String, Object> setLayersForMap(
@RequestParam("mapModuleId") Integer mapModuleId,
@RequestParam("layerIds") List<Integer> layerIds) {
try {
if (mapModuleId == n... | java | @RequestMapping(value = "/setLayersForMap.action", method = RequestMethod.POST)
public @ResponseBody
java.util.Map<String, Object> setLayersForMap(
@RequestParam("mapModuleId") Integer mapModuleId,
@RequestParam("layerIds") List<Integer> layerIds) {
try {
if (mapModuleId == n... | [
"@",
"RequestMapping",
"(",
"value",
"=",
"\"/setLayersForMap.action\"",
",",
"method",
"=",
"RequestMethod",
".",
"POST",
")",
"public",
"@",
"ResponseBody",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"Object",
">",
"setLayersForMap",
"(",
"@",
"R... | Set layers for map
@param mapModuleId The map module id
@param layerIds The list of layer ids
@return | [
"Set",
"layers",
"for",
"map"
] | 3dbabda35ae63235265913c865dba389b050b6e6 | https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/web/MapController.java#L64-L78 | train |
terrestris/shogun-core | src/shogun-core-main/src/main/java/de/terrestris/shoguncore/web/FileController.java | FileController.uploadFile | @RequestMapping(value = "/upload.action", method = RequestMethod.POST)
public ResponseEntity<?> uploadFile(
@RequestParam("file") MultipartFile uploadedFile) {
LOG.debug("Requested to upload a multipart-file");
// build response map
Map<String, Object> responseMap = new HashMap<Str... | java | @RequestMapping(value = "/upload.action", method = RequestMethod.POST)
public ResponseEntity<?> uploadFile(
@RequestParam("file") MultipartFile uploadedFile) {
LOG.debug("Requested to upload a multipart-file");
// build response map
Map<String, Object> responseMap = new HashMap<Str... | [
"@",
"RequestMapping",
"(",
"value",
"=",
"\"/upload.action\"",
",",
"method",
"=",
"RequestMethod",
".",
"POST",
")",
"public",
"ResponseEntity",
"<",
"?",
">",
"uploadFile",
"(",
"@",
"RequestParam",
"(",
"\"file\"",
")",
"MultipartFile",
"uploadedFile",
")",
... | Persists a file as bytearray in the database
@param uploadedFile | [
"Persists",
"a",
"file",
"as",
"bytearray",
"in",
"the",
"database"
] | 3dbabda35ae63235265913c865dba389b050b6e6 | https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/web/FileController.java#L65-L88 | train |
terrestris/shogun-core | src/shogun-core-main/src/main/java/de/terrestris/shoguncore/util/http/HttpUtil.java | HttpUtil.get | public static Response get(String url, Credentials credentials, Header[] requestHeaders)
throws URISyntaxException, HttpException {
return send(new HttpGet(url), credentials, requestHeaders);
} | java | public static Response get(String url, Credentials credentials, Header[] requestHeaders)
throws URISyntaxException, HttpException {
return send(new HttpGet(url), credentials, requestHeaders);
} | [
"public",
"static",
"Response",
"get",
"(",
"String",
"url",
",",
"Credentials",
"credentials",
",",
"Header",
"[",
"]",
"requestHeaders",
")",
"throws",
"URISyntaxException",
",",
"HttpException",
"{",
"return",
"send",
"(",
"new",
"HttpGet",
"(",
"url",
")",... | Performs an HTTP GET on the given URL.
@param url The URL to connect to.
@param credentials instance implementing {@link Credentials} interface holding a set of credentials
@param requestHeaders Additional HTTP headers added to the request
@return The HTTP response as Response object.
@throws URISyntaxEx... | [
"Performs",
"an",
"HTTP",
"GET",
"on",
"the",
"given",
"URL",
"."
] | 3dbabda35ae63235265913c865dba389b050b6e6 | https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/util/http/HttpUtil.java#L147-L150 | train |
terrestris/shogun-core | src/shogun-core-main/src/main/java/de/terrestris/shoguncore/util/http/HttpUtil.java | HttpUtil.get | public static Response get(URI uri) throws URISyntaxException, HttpException {
return send(new HttpGet(uri), null, null);
} | java | public static Response get(URI uri) throws URISyntaxException, HttpException {
return send(new HttpGet(uri), null, null);
} | [
"public",
"static",
"Response",
"get",
"(",
"URI",
"uri",
")",
"throws",
"URISyntaxException",
",",
"HttpException",
"{",
"return",
"send",
"(",
"new",
"HttpGet",
"(",
"uri",
")",
",",
"null",
",",
"null",
")",
";",
"}"
] | Performs an HTTP GET on the given URI.
No credentials needed.
@param uri The URI to connect to.
@return The HTTP response as Response object.
@throws URISyntaxException
@throws HttpException | [
"Performs",
"an",
"HTTP",
"GET",
"on",
"the",
"given",
"URI",
".",
"No",
"credentials",
"needed",
"."
] | 3dbabda35ae63235265913c865dba389b050b6e6 | https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/util/http/HttpUtil.java#L189-L191 | train |
terrestris/shogun-core | src/shogun-core-main/src/main/java/de/terrestris/shoguncore/util/http/HttpUtil.java | HttpUtil.get | public static Response get(URI uri, Credentials credentials, Header[] requestHeaders)
throws URISyntaxException, HttpException {
return send(new HttpGet(uri), credentials, requestHeaders);
} | java | public static Response get(URI uri, Credentials credentials, Header[] requestHeaders)
throws URISyntaxException, HttpException {
return send(new HttpGet(uri), credentials, requestHeaders);
} | [
"public",
"static",
"Response",
"get",
"(",
"URI",
"uri",
",",
"Credentials",
"credentials",
",",
"Header",
"[",
"]",
"requestHeaders",
")",
"throws",
"URISyntaxException",
",",
"HttpException",
"{",
"return",
"send",
"(",
"new",
"HttpGet",
"(",
"uri",
")",
... | Performs an HTTP GET on the given URI.
Basic auth is used if both username and pw are not null.
@param uri The URI to connect to.
@param credentials Instance implementing {@link Credentials} interface holding a set of credentials
@param requestHeaders Additional HTTP headers added to the request
@return ... | [
"Performs",
"an",
"HTTP",
"GET",
"on",
"the",
"given",
"URI",
".",
"Basic",
"auth",
"is",
"used",
"if",
"both",
"username",
"and",
"pw",
"are",
"not",
"null",
"."
] | 3dbabda35ae63235265913c865dba389b050b6e6 | https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/util/http/HttpUtil.java#L266-L269 | train |
terrestris/shogun-core | src/shogun-core-main/src/main/java/de/terrestris/shoguncore/util/http/HttpUtil.java | HttpUtil.forwardGet | public static Response forwardGet(URI uri, HttpServletRequest request, boolean forwardHeaders)
throws URISyntaxException, HttpException {
Header[] headersToForward = null;
if (request != null && forwardHeaders) {
headersToForward = HttpUtil.getHeadersFromRequest(request);
}... | java | public static Response forwardGet(URI uri, HttpServletRequest request, boolean forwardHeaders)
throws URISyntaxException, HttpException {
Header[] headersToForward = null;
if (request != null && forwardHeaders) {
headersToForward = HttpUtil.getHeadersFromRequest(request);
}... | [
"public",
"static",
"Response",
"forwardGet",
"(",
"URI",
"uri",
",",
"HttpServletRequest",
"request",
",",
"boolean",
"forwardHeaders",
")",
"throws",
"URISyntaxException",
",",
"HttpException",
"{",
"Header",
"[",
"]",
"headersToForward",
"=",
"null",
";",
"if",... | Forward GET request to uri based on given request
@param uri uri The URI to forward to.
@param request The original {@link HttpServletRequest}
@param forwardHeaders Should headers of request should be forwarded
@return The HTTP response as Response object.
@throws URISyntaxException
@throws HttpExcep... | [
"Forward",
"GET",
"request",
"to",
"uri",
"based",
"on",
"given",
"request"
] | 3dbabda35ae63235265913c865dba389b050b6e6 | https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/util/http/HttpUtil.java#L281-L291 | train |
terrestris/shogun-core | src/shogun-core-main/src/main/java/de/terrestris/shoguncore/util/http/HttpUtil.java | HttpUtil.post | public static Response post(String url, String password, String username)
throws URISyntaxException, UnsupportedEncodingException, HttpException {
return postParams(new HttpPost(url), new ArrayList<NameValuePair>(), new UsernamePasswordCredentials(username, password), null);
} | java | public static Response post(String url, String password, String username)
throws URISyntaxException, UnsupportedEncodingException, HttpException {
return postParams(new HttpPost(url), new ArrayList<NameValuePair>(), new UsernamePasswordCredentials(username, password), null);
} | [
"public",
"static",
"Response",
"post",
"(",
"String",
"url",
",",
"String",
"password",
",",
"String",
"username",
")",
"throws",
"URISyntaxException",
",",
"UnsupportedEncodingException",
",",
"HttpException",
"{",
"return",
"postParams",
"(",
"new",
"HttpPost",
... | Performs an HTTP POST on the given URL.
Basic auth is used if both and password are not null.
@param url The URI to connect to as String.
@param username Credentials - username
@param password Credentials - password
@return The HTTP response as Response object.
@throws URISyntaxException
@throws UnsupportedEncodi... | [
"Performs",
"an",
"HTTP",
"POST",
"on",
"the",
"given",
"URL",
".",
"Basic",
"auth",
"is",
"used",
"if",
"both",
"and",
"password",
"are",
"not",
"null",
"."
] | 3dbabda35ae63235265913c865dba389b050b6e6 | https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/util/http/HttpUtil.java#L334-L337 | train |
terrestris/shogun-core | src/shogun-core-main/src/main/java/de/terrestris/shoguncore/util/http/HttpUtil.java | HttpUtil.post | public static Response post(URI uri)
throws URISyntaxException, UnsupportedEncodingException, HttpException {
return postParams(new HttpPost(uri), new ArrayList<NameValuePair>(), null, null);
} | java | public static Response post(URI uri)
throws URISyntaxException, UnsupportedEncodingException, HttpException {
return postParams(new HttpPost(uri), new ArrayList<NameValuePair>(), null, null);
} | [
"public",
"static",
"Response",
"post",
"(",
"URI",
"uri",
")",
"throws",
"URISyntaxException",
",",
"UnsupportedEncodingException",
",",
"HttpException",
"{",
"return",
"postParams",
"(",
"new",
"HttpPost",
"(",
"uri",
")",
",",
"new",
"ArrayList",
"<",
"NameVa... | Performs an HTTP POST on the given URI.
@param uri The URI to connect to.
@return The HTTP response as Response object.
@throws URISyntaxException
@throws UnsupportedEncodingException
@throws HttpException | [
"Performs",
"an",
"HTTP",
"POST",
"on",
"the",
"given",
"URI",
"."
] | 3dbabda35ae63235265913c865dba389b050b6e6 | https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/util/http/HttpUtil.java#L399-L402 | train |
terrestris/shogun-core | src/shogun-core-main/src/main/java/de/terrestris/shoguncore/util/http/HttpUtil.java | HttpUtil.forwardPost | public static Response forwardPost(URI uri, HttpServletRequest request, boolean forwardHeaders) throws URISyntaxException, HttpException {
Header[] headersToForward = null;
if (request != null && forwardHeaders) {
headersToForward = HttpUtil.getHeadersFromRequest(request);
}
... | java | public static Response forwardPost(URI uri, HttpServletRequest request, boolean forwardHeaders) throws URISyntaxException, HttpException {
Header[] headersToForward = null;
if (request != null && forwardHeaders) {
headersToForward = HttpUtil.getHeadersFromRequest(request);
}
... | [
"public",
"static",
"Response",
"forwardPost",
"(",
"URI",
"uri",
",",
"HttpServletRequest",
"request",
",",
"boolean",
"forwardHeaders",
")",
"throws",
"URISyntaxException",
",",
"HttpException",
"{",
"Header",
"[",
"]",
"headersToForward",
"=",
"null",
";",
"if"... | Forward POST to uri based on given request
@param uri uri The URI to forward to.
@param request The original {@link HttpServletRequest}
@param forwardHeaders Should headers of request should be forwarded
@return
@throws URISyntaxException
@throws HttpException | [
"Forward",
"POST",
"to",
"uri",
"based",
"on",
"given",
"request"
] | 3dbabda35ae63235265913c865dba389b050b6e6 | https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/util/http/HttpUtil.java#L1214-L1225 | train |
terrestris/shogun-core | src/shogun-core-main/src/main/java/de/terrestris/shoguncore/util/http/HttpUtil.java | HttpUtil.put | public static Response put(URI uri, String body, ContentType contentType, String username, String password) throws URISyntaxException, HttpException {
return putBody(new HttpPut(uri), body, contentType, new UsernamePasswordCredentials(username, password), null);
} | java | public static Response put(URI uri, String body, ContentType contentType, String username, String password) throws URISyntaxException, HttpException {
return putBody(new HttpPut(uri), body, contentType, new UsernamePasswordCredentials(username, password), null);
} | [
"public",
"static",
"Response",
"put",
"(",
"URI",
"uri",
",",
"String",
"body",
",",
"ContentType",
"contentType",
",",
"String",
"username",
",",
"String",
"password",
")",
"throws",
"URISyntaxException",
",",
"HttpException",
"{",
"return",
"putBody",
"(",
... | Performs an HTTP PUT on the given URL.
@param uri
@param body
@param contentType
@param username
@param password
@return
@throws URISyntaxException
@throws HttpException | [
"Performs",
"an",
"HTTP",
"PUT",
"on",
"the",
"given",
"URL",
"."
] | 3dbabda35ae63235265913c865dba389b050b6e6 | https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/util/http/HttpUtil.java#L1530-L1532 | train |
terrestris/shogun-core | src/shogun-core-main/src/main/java/de/terrestris/shoguncore/util/http/HttpUtil.java | HttpUtil.isSaneRequest | public static boolean isSaneRequest(HttpServletRequest request) {
if (request != null && request.getMethod() != null) {
return true;
}
return false;
} | java | public static boolean isSaneRequest(HttpServletRequest request) {
if (request != null && request.getMethod() != null) {
return true;
}
return false;
} | [
"public",
"static",
"boolean",
"isSaneRequest",
"(",
"HttpServletRequest",
"request",
")",
"{",
"if",
"(",
"request",
"!=",
"null",
"&&",
"request",
".",
"getMethod",
"(",
")",
"!=",
"null",
")",
"{",
"return",
"true",
";",
"}",
"return",
"false",
";",
"... | Checks if request and request method are not null
@param request {@link HttpServletRequest} to check
@return true if sane, false otherwise | [
"Checks",
"if",
"request",
"and",
"request",
"method",
"are",
"not",
"null"
] | 3dbabda35ae63235265913c865dba389b050b6e6 | https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/util/http/HttpUtil.java#L1941-L1946 | train |
terrestris/shogun-core | src/shogun-core-main/src/main/java/de/terrestris/shoguncore/util/http/HttpUtil.java | HttpUtil.removeHeaders | private static Header[] removeHeaders(Header[] headersToClean, String[] headersToRemove) {
ArrayList<Header> headers = new ArrayList<>();
if (headersToClean == null) {
return null;
}
for (Header header : headersToClean) {
if (!StringUtils.equalsAnyIgnoreCase(heade... | java | private static Header[] removeHeaders(Header[] headersToClean, String[] headersToRemove) {
ArrayList<Header> headers = new ArrayList<>();
if (headersToClean == null) {
return null;
}
for (Header header : headersToClean) {
if (!StringUtils.equalsAnyIgnoreCase(heade... | [
"private",
"static",
"Header",
"[",
"]",
"removeHeaders",
"(",
"Header",
"[",
"]",
"headersToClean",
",",
"String",
"[",
"]",
"headersToRemove",
")",
"{",
"ArrayList",
"<",
"Header",
">",
"headers",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"if",
"("... | Remove headers form header array that match Strings in headersToRemove
@param headersToClean Array of {@link Header}: Headers to clean up
@param headersToRemove Header names to remove | [
"Remove",
"headers",
"form",
"header",
"array",
"that",
"match",
"Strings",
"in",
"headersToRemove"
] | 3dbabda35ae63235265913c865dba389b050b6e6 | https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/util/http/HttpUtil.java#L2045-L2060 | train |
terrestris/shogun-core | src/shogun-core-main/src/main/java/de/terrestris/shoguncore/importer/GeoServerRESTImporter.java | GeoServerRESTImporter.createImportJob | public RESTImport createImportJob(String workSpaceName, String dataStoreName)
throws Exception {
if (StringUtils.isEmpty(workSpaceName)) {
throw new GeoServerRESTImporterException("No workspace given. Please provide a "
+ "workspace to import the data in.");
}
... | java | public RESTImport createImportJob(String workSpaceName, String dataStoreName)
throws Exception {
if (StringUtils.isEmpty(workSpaceName)) {
throw new GeoServerRESTImporterException("No workspace given. Please provide a "
+ "workspace to import the data in.");
}
... | [
"public",
"RESTImport",
"createImportJob",
"(",
"String",
"workSpaceName",
",",
"String",
"dataStoreName",
")",
"throws",
"Exception",
"{",
"if",
"(",
"StringUtils",
".",
"isEmpty",
"(",
"workSpaceName",
")",
")",
"{",
"throw",
"new",
"GeoServerRESTImporterException... | Create a new import job. | [
"Create",
"a",
"new",
"import",
"job",
"."
] | 3dbabda35ae63235265913c865dba389b050b6e6 | https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/importer/GeoServerRESTImporter.java#L106-L149 | train |
terrestris/shogun-core | src/shogun-core-main/src/main/java/de/terrestris/shoguncore/importer/GeoServerRESTImporter.java | GeoServerRESTImporter.createReprojectTransformTask | public boolean createReprojectTransformTask(Integer importJobId, Integer taskId,
String sourceSrs, String targetSrs) throws URISyntaxException, HttpException {
RESTReprojectTransform transformTask = new RESTReprojectTransform();
if (StringUtils.isNotEmpty(... | java | public boolean createReprojectTransformTask(Integer importJobId, Integer taskId,
String sourceSrs, String targetSrs) throws URISyntaxException, HttpException {
RESTReprojectTransform transformTask = new RESTReprojectTransform();
if (StringUtils.isNotEmpty(... | [
"public",
"boolean",
"createReprojectTransformTask",
"(",
"Integer",
"importJobId",
",",
"Integer",
"taskId",
",",
"String",
"sourceSrs",
",",
"String",
"targetSrs",
")",
"throws",
"URISyntaxException",
",",
"HttpException",
"{",
"RESTReprojectTransform",
"transformTask",... | Create a reprojection task. | [
"Create",
"a",
"reprojection",
"task",
"."
] | 3dbabda35ae63235265913c865dba389b050b6e6 | https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/importer/GeoServerRESTImporter.java#L155-L164 | train |
terrestris/shogun-core | src/shogun-core-main/src/main/java/de/terrestris/shoguncore/importer/GeoServerRESTImporter.java | GeoServerRESTImporter.uploadFile | public RESTImportTaskList uploadFile(Integer importJobId, File file, String sourceSrs) throws Exception {
LOG.debug("Uploading file " + file.getName() + " to import job " + importJobId);
Response httpResponse = HttpUtil.post(
this.addEndPoint(importJobId + "/tasks"),
file,
... | java | public RESTImportTaskList uploadFile(Integer importJobId, File file, String sourceSrs) throws Exception {
LOG.debug("Uploading file " + file.getName() + " to import job " + importJobId);
Response httpResponse = HttpUtil.post(
this.addEndPoint(importJobId + "/tasks"),
file,
... | [
"public",
"RESTImportTaskList",
"uploadFile",
"(",
"Integer",
"importJobId",
",",
"File",
"file",
",",
"String",
"sourceSrs",
")",
"throws",
"Exception",
"{",
"LOG",
".",
"debug",
"(",
"\"Uploading file \"",
"+",
"file",
".",
"getName",
"(",
")",
"+",
"\" to i... | Upload an import file. | [
"Upload",
"an",
"import",
"file",
"."
] | 3dbabda35ae63235265913c865dba389b050b6e6 | https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/importer/GeoServerRESTImporter.java#L208-L271 | train |
terrestris/shogun-core | src/shogun-core-main/src/main/java/de/terrestris/shoguncore/importer/GeoServerRESTImporter.java | GeoServerRESTImporter.updateImportTask | public boolean updateImportTask(int importJobId, int importTaskId,
AbstractRESTEntity updateTaskEntity) throws Exception {
LOG.debug("Updating the import task " + importTaskId + " in job " + importJobId +
" with " + updateTaskEntity);
Response httpRespon... | java | public boolean updateImportTask(int importJobId, int importTaskId,
AbstractRESTEntity updateTaskEntity) throws Exception {
LOG.debug("Updating the import task " + importTaskId + " in job " + importJobId +
" with " + updateTaskEntity);
Response httpRespon... | [
"public",
"boolean",
"updateImportTask",
"(",
"int",
"importJobId",
",",
"int",
"importTaskId",
",",
"AbstractRESTEntity",
"updateTaskEntity",
")",
"throws",
"Exception",
"{",
"LOG",
".",
"debug",
"(",
"\"Updating the import task \"",
"+",
"importTaskId",
"+",
"\" in ... | Updates the given import task. | [
"Updates",
"the",
"given",
"import",
"task",
"."
] | 3dbabda35ae63235265913c865dba389b050b6e6 | https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/importer/GeoServerRESTImporter.java#L276-L299 | train |
terrestris/shogun-core | src/shogun-core-main/src/main/java/de/terrestris/shoguncore/importer/GeoServerRESTImporter.java | GeoServerRESTImporter.deleteImportJob | public boolean deleteImportJob(Integer importJobId) throws URISyntaxException, HttpException {
LOG.debug("Deleting the import job " + importJobId);
Response httpResponse = HttpUtil.delete(
this.addEndPoint(importJobId.toString()),
this.username,
this.password);
... | java | public boolean deleteImportJob(Integer importJobId) throws URISyntaxException, HttpException {
LOG.debug("Deleting the import job " + importJobId);
Response httpResponse = HttpUtil.delete(
this.addEndPoint(importJobId.toString()),
this.username,
this.password);
... | [
"public",
"boolean",
"deleteImportJob",
"(",
"Integer",
"importJobId",
")",
"throws",
"URISyntaxException",
",",
"HttpException",
"{",
"LOG",
".",
"debug",
"(",
"\"Deleting the import job \"",
"+",
"importJobId",
")",
";",
"Response",
"httpResponse",
"=",
"HttpUtil",
... | Deletes an importJob. | [
"Deletes",
"an",
"importJob",
"."
] | 3dbabda35ae63235265913c865dba389b050b6e6 | https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/importer/GeoServerRESTImporter.java#L304-L322 | train |
terrestris/shogun-core | src/shogun-core-main/src/main/java/de/terrestris/shoguncore/importer/GeoServerRESTImporter.java | GeoServerRESTImporter.runImportJob | public boolean runImportJob(Integer importJobId) throws
UnsupportedEncodingException, URISyntaxException, HttpException {
LOG.debug("Starting the import for job " + importJobId);
Response httpResponse = HttpUtil.post(
this.addEndPoint(Integer.toString(importJobId)),
thi... | java | public boolean runImportJob(Integer importJobId) throws
UnsupportedEncodingException, URISyntaxException, HttpException {
LOG.debug("Starting the import for job " + importJobId);
Response httpResponse = HttpUtil.post(
this.addEndPoint(Integer.toString(importJobId)),
thi... | [
"public",
"boolean",
"runImportJob",
"(",
"Integer",
"importJobId",
")",
"throws",
"UnsupportedEncodingException",
",",
"URISyntaxException",
",",
"HttpException",
"{",
"LOG",
".",
"debug",
"(",
"\"Starting the import for job \"",
"+",
"importJobId",
")",
";",
"Response... | Run a previously configured import job. | [
"Run",
"a",
"previously",
"configured",
"import",
"job",
"."
] | 3dbabda35ae63235265913c865dba389b050b6e6 | https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/importer/GeoServerRESTImporter.java#L327-L347 | train |
terrestris/shogun-core | src/shogun-core-main/src/main/java/de/terrestris/shoguncore/importer/GeoServerRESTImporter.java | GeoServerRESTImporter.getLayer | public RESTLayer getLayer(Integer importJobId, Integer taskId) throws Exception {
Response httpResponse = HttpUtil.get(
this.addEndPoint(importJobId + "/tasks/" + taskId + "/layer"),
this.username,
this.password
);
return (RESTLayer) this.asEntity(httpRespons... | java | public RESTLayer getLayer(Integer importJobId, Integer taskId) throws Exception {
Response httpResponse = HttpUtil.get(
this.addEndPoint(importJobId + "/tasks/" + taskId + "/layer"),
this.username,
this.password
);
return (RESTLayer) this.asEntity(httpRespons... | [
"public",
"RESTLayer",
"getLayer",
"(",
"Integer",
"importJobId",
",",
"Integer",
"taskId",
")",
"throws",
"Exception",
"{",
"Response",
"httpResponse",
"=",
"HttpUtil",
".",
"get",
"(",
"this",
".",
"addEndPoint",
"(",
"importJobId",
"+",
"\"/tasks/\"",
"+",
... | Get a layer. | [
"Get",
"a",
"layer",
"."
] | 3dbabda35ae63235265913c865dba389b050b6e6 | https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/importer/GeoServerRESTImporter.java#L352-L360 | train |
terrestris/shogun-core | src/shogun-core-main/src/main/java/de/terrestris/shoguncore/importer/GeoServerRESTImporter.java | GeoServerRESTImporter.getAllImportedLayers | public List<RESTLayer> getAllImportedLayers(Integer importJobId, List<RESTImportTask> tasks) throws Exception {
ArrayList<RESTLayer> layers = new ArrayList<RESTLayer>();
for (RESTImportTask task : tasks) {
RESTImportTask refreshedTask = this.getRESTImportTask(importJobId, task.getId());
... | java | public List<RESTLayer> getAllImportedLayers(Integer importJobId, List<RESTImportTask> tasks) throws Exception {
ArrayList<RESTLayer> layers = new ArrayList<RESTLayer>();
for (RESTImportTask task : tasks) {
RESTImportTask refreshedTask = this.getRESTImportTask(importJobId, task.getId());
... | [
"public",
"List",
"<",
"RESTLayer",
">",
"getAllImportedLayers",
"(",
"Integer",
"importJobId",
",",
"List",
"<",
"RESTImportTask",
">",
"tasks",
")",
"throws",
"Exception",
"{",
"ArrayList",
"<",
"RESTLayer",
">",
"layers",
"=",
"new",
"ArrayList",
"<",
"REST... | fetch all created Layers of import job | [
"fetch",
"all",
"created",
"Layers",
"of",
"import",
"job"
] | 3dbabda35ae63235265913c865dba389b050b6e6 | https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/importer/GeoServerRESTImporter.java#L365-L386 | train |
terrestris/shogun-core | src/shogun-core-main/src/main/java/de/terrestris/shoguncore/importer/GeoServerRESTImporter.java | GeoServerRESTImporter.getDataOfImportTask | public RESTData getDataOfImportTask(Integer importJobId, Integer taskId)
throws Exception {
final DeserializationFeature unwrapRootValueFeature = DeserializationFeature.UNWRAP_ROOT_VALUE;
boolean unwrapRootValueFeatureIsEnabled = mapper.isEnabled(unwrapRootValueFeature);
Response httpRe... | java | public RESTData getDataOfImportTask(Integer importJobId, Integer taskId)
throws Exception {
final DeserializationFeature unwrapRootValueFeature = DeserializationFeature.UNWRAP_ROOT_VALUE;
boolean unwrapRootValueFeatureIsEnabled = mapper.isEnabled(unwrapRootValueFeature);
Response httpRe... | [
"public",
"RESTData",
"getDataOfImportTask",
"(",
"Integer",
"importJobId",
",",
"Integer",
"taskId",
")",
"throws",
"Exception",
"{",
"final",
"DeserializationFeature",
"unwrapRootValueFeature",
"=",
"DeserializationFeature",
".",
"UNWRAP_ROOT_VALUE",
";",
"boolean",
"un... | Get the data of an import task. | [
"Get",
"the",
"data",
"of",
"an",
"import",
"task",
"."
] | 3dbabda35ae63235265913c865dba389b050b6e6 | https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/importer/GeoServerRESTImporter.java#L391-L412 | train |
terrestris/shogun-core | src/shogun-core-main/src/main/java/de/terrestris/shoguncore/importer/GeoServerRESTImporter.java | GeoServerRESTImporter.getRESTImportTask | public RESTImportTask getRESTImportTask(Integer importJobId, Integer taskId) throws
Exception {
Response httpResponse = HttpUtil.get(
this.addEndPoint(importJobId + "/tasks/" + taskId),
this.username,
this.password
);
return (RESTImportTask) this.asEn... | java | public RESTImportTask getRESTImportTask(Integer importJobId, Integer taskId) throws
Exception {
Response httpResponse = HttpUtil.get(
this.addEndPoint(importJobId + "/tasks/" + taskId),
this.username,
this.password
);
return (RESTImportTask) this.asEn... | [
"public",
"RESTImportTask",
"getRESTImportTask",
"(",
"Integer",
"importJobId",
",",
"Integer",
"taskId",
")",
"throws",
"Exception",
"{",
"Response",
"httpResponse",
"=",
"HttpUtil",
".",
"get",
"(",
"this",
".",
"addEndPoint",
"(",
"importJobId",
"+",
"\"/tasks/... | Get an import task. | [
"Get",
"an",
"import",
"task",
"."
] | 3dbabda35ae63235265913c865dba389b050b6e6 | https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/importer/GeoServerRESTImporter.java#L417-L426 | train |
terrestris/shogun-core | src/shogun-core-main/src/main/java/de/terrestris/shoguncore/importer/GeoServerRESTImporter.java | GeoServerRESTImporter.createTransformTask | private boolean createTransformTask(Integer importJobId, Integer taskId, RESTTransform transformTask)
throws URISyntaxException, HttpException {
LOG.debug("Creating a new transform task for import job" + importJobId + " and task " + taskId);
mapper.disable(SerializationFeature.WRAP_ROOT_VALUE)... | java | private boolean createTransformTask(Integer importJobId, Integer taskId, RESTTransform transformTask)
throws URISyntaxException, HttpException {
LOG.debug("Creating a new transform task for import job" + importJobId + " and task " + taskId);
mapper.disable(SerializationFeature.WRAP_ROOT_VALUE)... | [
"private",
"boolean",
"createTransformTask",
"(",
"Integer",
"importJobId",
",",
"Integer",
"taskId",
",",
"RESTTransform",
"transformTask",
")",
"throws",
"URISyntaxException",
",",
"HttpException",
"{",
"LOG",
".",
"debug",
"(",
"\"Creating a new transform task for impo... | Helper method to create an importer transformTask | [
"Helper",
"method",
"to",
"create",
"an",
"importer",
"transformTask"
] | 3dbabda35ae63235265913c865dba389b050b6e6 | https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/importer/GeoServerRESTImporter.java#L444-L468 | train |
terrestris/shogun-core | src/shogun-core-main/src/main/java/de/terrestris/shoguncore/importer/GeoServerRESTImporter.java | GeoServerRESTImporter.addPrjFileToArchive | public static File addPrjFileToArchive(File file, String targetCrs)
throws ZipException, IOException, NoSuchAuthorityCodeException, FactoryException {
ZipFile zipFile = new ZipFile(file);
CoordinateReferenceSystem decodedTargetCrs = CRS.decode(targetCrs);
String targetCrsWkt = toSingle... | java | public static File addPrjFileToArchive(File file, String targetCrs)
throws ZipException, IOException, NoSuchAuthorityCodeException, FactoryException {
ZipFile zipFile = new ZipFile(file);
CoordinateReferenceSystem decodedTargetCrs = CRS.decode(targetCrs);
String targetCrsWkt = toSingle... | [
"public",
"static",
"File",
"addPrjFileToArchive",
"(",
"File",
"file",
",",
"String",
"targetCrs",
")",
"throws",
"ZipException",
",",
"IOException",
",",
"NoSuchAuthorityCodeException",
",",
"FactoryException",
"{",
"ZipFile",
"zipFile",
"=",
"new",
"ZipFile",
"("... | Add a projection file to a shapefile zip archive. | [
"Add",
"a",
"projection",
"file",
"to",
"a",
"shapefile",
"zip",
"archive",
"."
] | 3dbabda35ae63235265913c865dba389b050b6e6 | https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/importer/GeoServerRESTImporter.java#L473-L511 | train |
terrestris/shogun-core | src/shogun-core-main/src/main/java/de/terrestris/shoguncore/importer/GeoServerRESTImporter.java | GeoServerRESTImporter.toSingleLineWKT | public static String toSingleLineWKT(CoordinateReferenceSystem crs) {
String wkt = null;
try {
// this is a lenient transformation, works with polar stereographics too
Formattable formattable = (Formattable) crs;
wkt = formattable.toWKT(0, false);
} catch (Cla... | java | public static String toSingleLineWKT(CoordinateReferenceSystem crs) {
String wkt = null;
try {
// this is a lenient transformation, works with polar stereographics too
Formattable formattable = (Formattable) crs;
wkt = formattable.toWKT(0, false);
} catch (Cla... | [
"public",
"static",
"String",
"toSingleLineWKT",
"(",
"CoordinateReferenceSystem",
"crs",
")",
"{",
"String",
"wkt",
"=",
"null",
";",
"try",
"{",
"// this is a lenient transformation, works with polar stereographics too",
"Formattable",
"formattable",
"=",
"(",
"Formattabl... | Turns the CRS into a single line WKT
@param crs CoordinateReferenceSystem which should be formatted
@return Single line String which can be written to PRJ file | [
"Turns",
"the",
"CRS",
"into",
"a",
"single",
"line",
"WKT"
] | 3dbabda35ae63235265913c865dba389b050b6e6 | https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/importer/GeoServerRESTImporter.java#L519-L531 | train |
terrestris/shogun-core | src/shogun-core-main/src/main/java/de/terrestris/shoguncore/importer/GeoServerRESTImporter.java | GeoServerRESTImporter.asEntity | private AbstractRESTEntity asEntity(byte[] responseBody, Class<?> clazz)
throws Exception {
AbstractRESTEntity entity = null;
entity = (AbstractRESTEntity) mapper.readValue(responseBody, clazz);
return entity;
} | java | private AbstractRESTEntity asEntity(byte[] responseBody, Class<?> clazz)
throws Exception {
AbstractRESTEntity entity = null;
entity = (AbstractRESTEntity) mapper.readValue(responseBody, clazz);
return entity;
} | [
"private",
"AbstractRESTEntity",
"asEntity",
"(",
"byte",
"[",
"]",
"responseBody",
",",
"Class",
"<",
"?",
">",
"clazz",
")",
"throws",
"Exception",
"{",
"AbstractRESTEntity",
"entity",
"=",
"null",
";",
"entity",
"=",
"(",
"AbstractRESTEntity",
")",
"mapper"... | Convert a byte array to an importer REST entity. | [
"Convert",
"a",
"byte",
"array",
"to",
"an",
"importer",
"REST",
"entity",
"."
] | 3dbabda35ae63235265913c865dba389b050b6e6 | https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/importer/GeoServerRESTImporter.java#L536-L544 | train |
terrestris/shogun-core | src/shogun-core-main/src/main/java/de/terrestris/shoguncore/importer/GeoServerRESTImporter.java | GeoServerRESTImporter.asJSON | private String asJSON(Object entity) {
String entityJson = null;
try {
entityJson = this.mapper.writeValueAsString(entity);
} catch (Exception e) {
LOG.error("Could not parse as JSON: " + e.getMessage());
}
return entityJson;
} | java | private String asJSON(Object entity) {
String entityJson = null;
try {
entityJson = this.mapper.writeValueAsString(entity);
} catch (Exception e) {
LOG.error("Could not parse as JSON: " + e.getMessage());
}
return entityJson;
} | [
"private",
"String",
"asJSON",
"(",
"Object",
"entity",
")",
"{",
"String",
"entityJson",
"=",
"null",
";",
"try",
"{",
"entityJson",
"=",
"this",
".",
"mapper",
".",
"writeValueAsString",
"(",
"entity",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")"... | Convert an object to json. | [
"Convert",
"an",
"object",
"to",
"json",
"."
] | 3dbabda35ae63235265913c865dba389b050b6e6 | https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/importer/GeoServerRESTImporter.java#L549-L560 | train |
terrestris/shogun-core | src/shogun-core-main/src/main/java/de/terrestris/shoguncore/importer/GeoServerRESTImporter.java | GeoServerRESTImporter.addEndPoint | private URI addEndPoint(String endPoint) throws URISyntaxException {
if (StringUtils.isEmpty(endPoint) || endPoint.equals("/")) {
return this.baseUri;
}
if (this.baseUri.getPath().endsWith("/") || endPoint.startsWith("/")) {
endPoint = this.baseUri.getPath() + endPoint;... | java | private URI addEndPoint(String endPoint) throws URISyntaxException {
if (StringUtils.isEmpty(endPoint) || endPoint.equals("/")) {
return this.baseUri;
}
if (this.baseUri.getPath().endsWith("/") || endPoint.startsWith("/")) {
endPoint = this.baseUri.getPath() + endPoint;... | [
"private",
"URI",
"addEndPoint",
"(",
"String",
"endPoint",
")",
"throws",
"URISyntaxException",
"{",
"if",
"(",
"StringUtils",
".",
"isEmpty",
"(",
"endPoint",
")",
"||",
"endPoint",
".",
"equals",
"(",
"\"/\"",
")",
")",
"{",
"return",
"this",
".",
"base... | Add an endpoint. | [
"Add",
"an",
"endpoint",
"."
] | 3dbabda35ae63235265913c865dba389b050b6e6 | https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/importer/GeoServerRESTImporter.java#L565-L588 | train |
terrestris/shogun-core | src/shogun-core-main/src/main/java/de/terrestris/shoguncore/util/data/ResultSet.java | ResultSet.error | public static final Map<String, Object> error(String errorMsg, Map additionalReturnValuesMap) {
Map<String, Object> returnMap = new HashMap<String, Object>(3);
returnMap.put("message", errorMsg);
returnMap.put("additionalInfo", additionalReturnValuesMap);
returnMap.put("success", false)... | java | public static final Map<String, Object> error(String errorMsg, Map additionalReturnValuesMap) {
Map<String, Object> returnMap = new HashMap<String, Object>(3);
returnMap.put("message", errorMsg);
returnMap.put("additionalInfo", additionalReturnValuesMap);
returnMap.put("success", false)... | [
"public",
"static",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"error",
"(",
"String",
"errorMsg",
",",
"Map",
"additionalReturnValuesMap",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"returnMap",
"=",
"new",
"HashMap",
"<",
"String",
",",
... | Method returning error message and additional return values
@param errorMsg The error message
@param additionalReturnValuesMap {@link Map} containing additional information
@return Map to use e.g. as {@link org.springframework.http.ResponseEntity} | [
"Method",
"returning",
"error",
"message",
"and",
"additional",
"return",
"values"
] | 3dbabda35ae63235265913c865dba389b050b6e6 | https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/util/data/ResultSet.java#L60-L68 | train |
terrestris/shogun-core | src/shogun-core-main/src/main/java/de/terrestris/shoguncore/service/Csv2ExtJsLocaleService.java | Csv2ExtJsLocaleService.detectColumnIndexOfLocale | private int detectColumnIndexOfLocale(String locale, CSVReader csvReader) throws Exception {
int indexOfLocale = -1;
List<String> headerLine = Arrays.asList(ArrayUtils.nullToEmpty(csvReader.readNext()));
if (headerLine == null || headerLine.isEmpty()) {
throw new Exception("CSV loca... | java | private int detectColumnIndexOfLocale(String locale, CSVReader csvReader) throws Exception {
int indexOfLocale = -1;
List<String> headerLine = Arrays.asList(ArrayUtils.nullToEmpty(csvReader.readNext()));
if (headerLine == null || headerLine.isEmpty()) {
throw new Exception("CSV loca... | [
"private",
"int",
"detectColumnIndexOfLocale",
"(",
"String",
"locale",
",",
"CSVReader",
"csvReader",
")",
"throws",
"Exception",
"{",
"int",
"indexOfLocale",
"=",
"-",
"1",
";",
"List",
"<",
"String",
">",
"headerLine",
"=",
"Arrays",
".",
"asList",
"(",
"... | Extracts the column index of the given locale in the CSV file.
@param locale
@param csvReader
@return
@throws IOException
@throws Exception | [
"Extracts",
"the",
"column",
"index",
"of",
"the",
"given",
"locale",
"in",
"the",
"CSV",
"file",
"."
] | 3dbabda35ae63235265913c865dba389b050b6e6 | https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/service/Csv2ExtJsLocaleService.java#L140-L166 | train |
terrestris/shogun-core | src/shogun-core-main/src/main/java/de/terrestris/shoguncore/service/HttpProxyService.java | HttpProxyService.isInWhiteList | private boolean isInWhiteList(URL url) {
final String host = url.getHost();
final int port = url.getPort();
final String protocol = url.getProtocol();
final int portToTest = (port != -1) ? port : (StringUtils.equalsIgnoreCase(protocol, "https") ? 443 : 80);
List<String> matchin... | java | private boolean isInWhiteList(URL url) {
final String host = url.getHost();
final int port = url.getPort();
final String protocol = url.getProtocol();
final int portToTest = (port != -1) ? port : (StringUtils.equalsIgnoreCase(protocol, "https") ? 443 : 80);
List<String> matchin... | [
"private",
"boolean",
"isInWhiteList",
"(",
"URL",
"url",
")",
"{",
"final",
"String",
"host",
"=",
"url",
".",
"getHost",
"(",
")",
";",
"final",
"int",
"port",
"=",
"url",
".",
"getPort",
"(",
")",
";",
"final",
"String",
"protocol",
"=",
"url",
".... | Helper method to check whether the URI is contained in the host whitelist provided in list of whitelisted hosts
@param url {@link URI} to check
@return true if contained, false otherwise | [
"Helper",
"method",
"to",
"check",
"whether",
"the",
"URI",
"is",
"contained",
"in",
"the",
"host",
"whitelist",
"provided",
"in",
"list",
"of",
"whitelisted",
"hosts"
] | 3dbabda35ae63235265913c865dba389b050b6e6 | https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/service/HttpProxyService.java#L317-L342 | train |
terrestris/shogun-core | src/shogun-core-main/src/main/java/de/terrestris/shoguncore/web/EndpointDocController.java | EndpointDocController.getEndpoints | @RequestMapping(value = "/endpointdoc", method = RequestMethod.GET)
public @ResponseBody
Set<RequestMappingInfo> getEndpoints() {
return this.service.getEndpoints(requestMappingHandlerMapping);
} | java | @RequestMapping(value = "/endpointdoc", method = RequestMethod.GET)
public @ResponseBody
Set<RequestMappingInfo> getEndpoints() {
return this.service.getEndpoints(requestMappingHandlerMapping);
} | [
"@",
"RequestMapping",
"(",
"value",
"=",
"\"/endpointdoc\"",
",",
"method",
"=",
"RequestMethod",
".",
"GET",
")",
"public",
"@",
"ResponseBody",
"Set",
"<",
"RequestMappingInfo",
">",
"getEndpoints",
"(",
")",
"{",
"return",
"this",
".",
"service",
".",
"g... | Provides an overview of all mapped endpoints. | [
"Provides",
"an",
"overview",
"of",
"all",
"mapped",
"endpoints",
"."
] | 3dbabda35ae63235265913c865dba389b050b6e6 | https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/web/EndpointDocController.java#L42-L47 | train |
terrestris/shogun-core | src/shogun-core-main/src/main/java/de/terrestris/shoguncore/dao/GenericHibernateDao.java | GenericHibernateDao.findById | public E findById(ID id) {
LOG.trace("Finding " + entityClass.getSimpleName() + " with ID " + id);
return (E) getSession().get(entityClass, id);
} | java | public E findById(ID id) {
LOG.trace("Finding " + entityClass.getSimpleName() + " with ID " + id);
return (E) getSession().get(entityClass, id);
} | [
"public",
"E",
"findById",
"(",
"ID",
"id",
")",
"{",
"LOG",
".",
"trace",
"(",
"\"Finding \"",
"+",
"entityClass",
".",
"getSimpleName",
"(",
")",
"+",
"\" with ID \"",
"+",
"id",
")",
";",
"return",
"(",
"E",
")",
"getSession",
"(",
")",
".",
"get"... | Return the real object from the database. Returns null if the object does
not exist.
@param id
@return The object from the database or null if it does not exist
@see http://www.mkyong.com/hibernate/different-between-session-get-and-session-load/ | [
"Return",
"the",
"real",
"object",
"from",
"the",
"database",
".",
"Returns",
"null",
"if",
"the",
"object",
"does",
"not",
"exist",
"."
] | 3dbabda35ae63235265913c865dba389b050b6e6 | https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/dao/GenericHibernateDao.java#L89-L92 | train |
terrestris/shogun-core | src/shogun-core-main/src/main/java/de/terrestris/shoguncore/dao/GenericHibernateDao.java | GenericHibernateDao.saveOrUpdate | public void saveOrUpdate(E e) {
final Integer id = e.getId();
final boolean hasId = id != null;
String createOrUpdatePrefix = hasId ? "Updating" : "Creating a new";
String idSuffix = hasId ? " with ID " + id : "";
LOG.trace(createOrUpdatePrefix + " instance of " + entityClass.ge... | java | public void saveOrUpdate(E e) {
final Integer id = e.getId();
final boolean hasId = id != null;
String createOrUpdatePrefix = hasId ? "Updating" : "Creating a new";
String idSuffix = hasId ? " with ID " + id : "";
LOG.trace(createOrUpdatePrefix + " instance of " + entityClass.ge... | [
"public",
"void",
"saveOrUpdate",
"(",
"E",
"e",
")",
"{",
"final",
"Integer",
"id",
"=",
"e",
".",
"getId",
"(",
")",
";",
"final",
"boolean",
"hasId",
"=",
"id",
"!=",
"null",
";",
"String",
"createOrUpdatePrefix",
"=",
"hasId",
"?",
"\"Updating\"",
... | Saves or updates the passed entity.
@param e The entity to save or update in the database. | [
"Saves",
"or",
"updates",
"the",
"passed",
"entity",
"."
] | 3dbabda35ae63235265913c865dba389b050b6e6 | https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/dao/GenericHibernateDao.java#L203-L214 | train |
terrestris/shogun-core | src/shogun-core-main/src/main/java/de/terrestris/shoguncore/dao/GenericHibernateDao.java | GenericHibernateDao.delete | public void delete(E e) {
LOG.trace("Deleting " + entityClass.getSimpleName() + " with ID " + e.getId());
getSession().delete(e);
} | java | public void delete(E e) {
LOG.trace("Deleting " + entityClass.getSimpleName() + " with ID " + e.getId());
getSession().delete(e);
} | [
"public",
"void",
"delete",
"(",
"E",
"e",
")",
"{",
"LOG",
".",
"trace",
"(",
"\"Deleting \"",
"+",
"entityClass",
".",
"getSimpleName",
"(",
")",
"+",
"\" with ID \"",
"+",
"e",
".",
"getId",
"(",
")",
")",
";",
"getSession",
"(",
")",
".",
"delete... | Deletes the passed entity.
@param e The entity to remove from the database. | [
"Deletes",
"the",
"passed",
"entity",
"."
] | 3dbabda35ae63235265913c865dba389b050b6e6 | https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/dao/GenericHibernateDao.java#L221-L224 | train |
terrestris/shogun-core | src/shogun-core-main/src/main/java/de/terrestris/shoguncore/dao/GenericHibernateDao.java | GenericHibernateDao.findByCriteria | @SuppressWarnings("unchecked")
public List<E> findByCriteria(Criterion... criterion) throws HibernateException {
LOG.trace("Finding instances of " + entityClass.getSimpleName()
+ " based on " + criterion.length + " criteria");
Criteria criteria = createDistinctRootEntityCriteria(criteri... | java | @SuppressWarnings("unchecked")
public List<E> findByCriteria(Criterion... criterion) throws HibernateException {
LOG.trace("Finding instances of " + entityClass.getSimpleName()
+ " based on " + criterion.length + " criteria");
Criteria criteria = createDistinctRootEntityCriteria(criteri... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"List",
"<",
"E",
">",
"findByCriteria",
"(",
"Criterion",
"...",
"criterion",
")",
"throws",
"HibernateException",
"{",
"LOG",
".",
"trace",
"(",
"\"Finding instances of \"",
"+",
"entityClass",
".",
... | Gets the results, that match a variable number of passed criterions. Call
this method without arguments to find all entities.
@param criterion A variable number of hibernate criterions
@return Entities matching the passed hibernate criterions | [
"Gets",
"the",
"results",
"that",
"match",
"a",
"variable",
"number",
"of",
"passed",
"criterions",
".",
"Call",
"this",
"method",
"without",
"arguments",
"to",
"find",
"all",
"entities",
"."
] | 3dbabda35ae63235265913c865dba389b050b6e6 | https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/dao/GenericHibernateDao.java#L261-L268 | train |
terrestris/shogun-core | src/shogun-core-main/src/main/java/de/terrestris/shoguncore/dao/GenericHibernateDao.java | GenericHibernateDao.findByUniqueCriteria | @SuppressWarnings("unchecked")
public E findByUniqueCriteria(Criterion... criterion) throws HibernateException {
LOG.trace("Finding one unique " + entityClass.getSimpleName()
+ " based on " + criterion.length + " criteria");
Criteria criteria = createDistinctRootEntityCriteria(criterion... | java | @SuppressWarnings("unchecked")
public E findByUniqueCriteria(Criterion... criterion) throws HibernateException {
LOG.trace("Finding one unique " + entityClass.getSimpleName()
+ " based on " + criterion.length + " criteria");
Criteria criteria = createDistinctRootEntityCriteria(criterion... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"E",
"findByUniqueCriteria",
"(",
"Criterion",
"...",
"criterion",
")",
"throws",
"HibernateException",
"{",
"LOG",
".",
"trace",
"(",
"\"Finding one unique \"",
"+",
"entityClass",
".",
"getSimpleName",
... | Gets the unique result, that matches a variable number of passed
criterions.
@param criterion A variable number of hibernate criterions
@return Entity matching the passed hibernate criterions
@throws HibernateException if there is more than one matching result | [
"Gets",
"the",
"unique",
"result",
"that",
"matches",
"a",
"variable",
"number",
"of",
"passed",
"criterions",
"."
] | 3dbabda35ae63235265913c865dba389b050b6e6 | https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/dao/GenericHibernateDao.java#L319-L326 | train |
terrestris/shogun-core | src/shogun-core-main/src/main/java/de/terrestris/shoguncore/dao/GenericHibernateDao.java | GenericHibernateDao.findByCriteriaWithSortingAndPaging | @SuppressWarnings("unchecked")
public PagingResult<E> findByCriteriaWithSortingAndPaging(Integer firstResult,
Integer maxResults, List<Order> sorters, Criterion... criterion) throws HibernateException {
int nrOfSorters = sorters == null ? 0 : so... | java | @SuppressWarnings("unchecked")
public PagingResult<E> findByCriteriaWithSortingAndPaging(Integer firstResult,
Integer maxResults, List<Order> sorters, Criterion... criterion) throws HibernateException {
int nrOfSorters = sorters == null ? 0 : so... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"PagingResult",
"<",
"E",
">",
"findByCriteriaWithSortingAndPaging",
"(",
"Integer",
"firstResult",
",",
"Integer",
"maxResults",
",",
"List",
"<",
"Order",
">",
"sorters",
",",
"Criterion",
"...",
"cri... | Gets the results, that match a variable number of passed criterions,
considering the paging- and sort-info at the same time.
@param firstResult Starting index for the paging request.
@param maxResults Max number of result size.
@param criterion A variable number of hibernate criterions
@return | [
"Gets",
"the",
"results",
"that",
"match",
"a",
"variable",
"number",
"of",
"passed",
"criterions",
"considering",
"the",
"paging",
"-",
"and",
"sort",
"-",
"info",
"at",
"the",
"same",
"time",
"."
] | 3dbabda35ae63235265913c865dba389b050b6e6 | https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/dao/GenericHibernateDao.java#L337-L368 | train |
terrestris/shogun-core | src/shogun-core-main/src/main/java/de/terrestris/shoguncore/dao/GenericHibernateDao.java | GenericHibernateDao.getTotalCount | public Number getTotalCount(Criterion... criterion) throws HibernateException {
Criteria criteria = getSession().createCriteria(entityClass);
addCriterionsToCriteria(criteria, criterion);
criteria.setProjection(Projections.rowCount());
return (Long) criteria.uniqueResult();
} | java | public Number getTotalCount(Criterion... criterion) throws HibernateException {
Criteria criteria = getSession().createCriteria(entityClass);
addCriterionsToCriteria(criteria, criterion);
criteria.setProjection(Projections.rowCount());
return (Long) criteria.uniqueResult();
} | [
"public",
"Number",
"getTotalCount",
"(",
"Criterion",
"...",
"criterion",
")",
"throws",
"HibernateException",
"{",
"Criteria",
"criteria",
"=",
"getSession",
"(",
")",
".",
"createCriteria",
"(",
"entityClass",
")",
";",
"addCriterionsToCriteria",
"(",
"criteria",... | Returns the total count of db entries for the current type.
@param criterion
@return | [
"Returns",
"the",
"total",
"count",
"of",
"db",
"entries",
"for",
"the",
"current",
"type",
"."
] | 3dbabda35ae63235265913c865dba389b050b6e6 | https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/dao/GenericHibernateDao.java#L476-L481 | train |
terrestris/shogun-core | src/shogun-core-main/src/main/java/de/terrestris/shoguncore/service/LdapService.java | LdapService.authenticate | public void authenticate(String username, String password) {
ldapTemplate.authenticate(query().where("objectClass").is("simpleSecurityObject").and("cn").is(username), password);
LOGGER.info("Successfully authenticated " + username);
} | java | public void authenticate(String username, String password) {
ldapTemplate.authenticate(query().where("objectClass").is("simpleSecurityObject").and("cn").is(username), password);
LOGGER.info("Successfully authenticated " + username);
} | [
"public",
"void",
"authenticate",
"(",
"String",
"username",
",",
"String",
"password",
")",
"{",
"ldapTemplate",
".",
"authenticate",
"(",
"query",
"(",
")",
".",
"where",
"(",
"\"objectClass\"",
")",
".",
"is",
"(",
"\"simpleSecurityObject\"",
")",
".",
"a... | Authenticate against ldap.
@param username the username
@param password the password | [
"Authenticate",
"against",
"ldap",
"."
] | 3dbabda35ae63235265913c865dba389b050b6e6 | https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/service/LdapService.java#L44-L47 | train |
terrestris/shogun-core | src/shogun-core-main/src/main/java/de/terrestris/shoguncore/service/LdapService.java | LdapService.getGroups | public List<String> getGroups(String username, String property) {
final List<String> result = new ArrayList<>();
ldapTemplate.search(query().where("cn").is(username), new AttributesMapper<String>() {
public String mapFromAttributes(Attributes attrs) throws NamingException {
N... | java | public List<String> getGroups(String username, String property) {
final List<String> result = new ArrayList<>();
ldapTemplate.search(query().where("cn").is(username), new AttributesMapper<String>() {
public String mapFromAttributes(Attributes attrs) throws NamingException {
N... | [
"public",
"List",
"<",
"String",
">",
"getGroups",
"(",
"String",
"username",
",",
"String",
"property",
")",
"{",
"final",
"List",
"<",
"String",
">",
"result",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"ldapTemplate",
".",
"search",
"(",
"query",
... | Extract groups from ldap.
@param username username to search for
@param property the property to extract the groups from
@return a list of group names from ldap | [
"Extract",
"groups",
"from",
"ldap",
"."
] | 3dbabda35ae63235265913c865dba389b050b6e6 | https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/service/LdapService.java#L56-L71 | train |
terrestris/shogun-core | src/shogun-core-main/src/main/java/de/terrestris/shoguncore/util/mail/MailPublisher.java | MailPublisher.sendMail | public void sendMail(String from, String replyTo, String[] to, String[] cc,
String[] bcc, String subject, String msg) throws Exception {
SimpleMailMessage simpleMailMassage = new SimpleMailMessage();
// fallback to default mail sender
if (from == null || from.isEmpty()... | java | public void sendMail(String from, String replyTo, String[] to, String[] cc,
String[] bcc, String subject, String msg) throws Exception {
SimpleMailMessage simpleMailMassage = new SimpleMailMessage();
// fallback to default mail sender
if (from == null || from.isEmpty()... | [
"public",
"void",
"sendMail",
"(",
"String",
"from",
",",
"String",
"replyTo",
",",
"String",
"[",
"]",
"to",
",",
"String",
"[",
"]",
"cc",
",",
"String",
"[",
"]",
"bcc",
",",
"String",
"subject",
",",
"String",
"msg",
")",
"throws",
"Exception",
"... | Sends a SimpleMailMessage.
@param from The mail sender address.
@param replyTo The reply to address.
@param to A list of mail recipient addresses.
@param cc A list of carbon copy mail recipient addresses.
@param bcc A list of blind carbon copy mail recipient addresses.
@param subject The mail subject.... | [
"Sends",
"a",
"SimpleMailMessage",
"."
] | 3dbabda35ae63235265913c865dba389b050b6e6 | https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/util/mail/MailPublisher.java#L56-L75 | train |
terrestris/shogun-core | src/shogun-core-main/src/main/java/de/terrestris/shoguncore/util/mail/MailPublisher.java | MailPublisher.sendMimeMail | public void sendMimeMail(String from, String replyTo, String[] to, String[] cc,
String[] bcc, String subject, String msg, Boolean html,
String attachmentFilename, File attachmentFile)
throws MessagingException, MailException {
Boolean multipart ... | java | public void sendMimeMail(String from, String replyTo, String[] to, String[] cc,
String[] bcc, String subject, String msg, Boolean html,
String attachmentFilename, File attachmentFile)
throws MessagingException, MailException {
Boolean multipart ... | [
"public",
"void",
"sendMimeMail",
"(",
"String",
"from",
",",
"String",
"replyTo",
",",
"String",
"[",
"]",
"to",
",",
"String",
"[",
"]",
"cc",
",",
"String",
"[",
"]",
"bcc",
",",
"String",
"subject",
",",
"String",
"msg",
",",
"Boolean",
"html",
"... | Sends a MimeMessage.
@param from The mail sender address.
@param replyTo The reply to address.
@param to A list of mail recipient addresses.
@param cc A list of carbon copy mail recipient addresses.
@param bcc A list of blind carbon copy mail reci... | [
"Sends",
"a",
"MimeMessage",
"."
] | 3dbabda35ae63235265913c865dba389b050b6e6 | https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/util/mail/MailPublisher.java#L93-L141 | train |
terrestris/shogun-core | src/shogun-core-main/src/main/java/de/terrestris/shoguncore/util/naming/ImplicitNamingStrategyShogunCore.java | ImplicitNamingStrategyShogunCore.transformEntityName | @Override
protected String transformEntityName(EntityNaming entityNaming) {
String singular = super.transformEntityName(entityNaming);
return transformToPluralForm(singular);
} | java | @Override
protected String transformEntityName(EntityNaming entityNaming) {
String singular = super.transformEntityName(entityNaming);
return transformToPluralForm(singular);
} | [
"@",
"Override",
"protected",
"String",
"transformEntityName",
"(",
"EntityNaming",
"entityNaming",
")",
"{",
"String",
"singular",
"=",
"super",
".",
"transformEntityName",
"(",
"entityNaming",
")",
";",
"return",
"transformToPluralForm",
"(",
"singular",
")",
";",... | Transforms an entity name to plural form. | [
"Transforms",
"an",
"entity",
"name",
"to",
"plural",
"form",
"."
] | 3dbabda35ae63235265913c865dba389b050b6e6 | https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/util/naming/ImplicitNamingStrategyShogunCore.java#L114-L120 | train |
terrestris/shogun-core | src/shogun-core-main/src/main/java/de/terrestris/shoguncore/service/UserService.java | UserService.registerUser | public E registerUser(E user, HttpServletRequest request) throws Exception {
String email = user.getEmail();
// check if a user with the email already exists
E existingUser = dao.findByEmail(email);
if (existingUser != null) {
final String errorMessage = "User with eMail '... | java | public E registerUser(E user, HttpServletRequest request) throws Exception {
String email = user.getEmail();
// check if a user with the email already exists
E existingUser = dao.findByEmail(email);
if (existingUser != null) {
final String errorMessage = "User with eMail '... | [
"public",
"E",
"registerUser",
"(",
"E",
"user",
",",
"HttpServletRequest",
"request",
")",
"throws",
"Exception",
"{",
"String",
"email",
"=",
"user",
".",
"getEmail",
"(",
")",
";",
"// check if a user with the email already exists",
"E",
"existingUser",
"=",
"d... | Registers a new user. Initially, the user will be inactive. An email with
an activation link will be sent to the user.
@param user A user with an UNencrypted password (!)
@param request
@throws Exception | [
"Registers",
"a",
"new",
"user",
".",
"Initially",
"the",
"user",
"will",
"be",
"inactive",
".",
"An",
"email",
"with",
"an",
"activation",
"link",
"will",
"be",
"sent",
"to",
"the",
"user",
"."
] | 3dbabda35ae63235265913c865dba389b050b6e6 | https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/service/UserService.java#L122-L141 | train |
terrestris/shogun-core | src/shogun-core-main/src/main/java/de/terrestris/shoguncore/service/UserService.java | UserService.persistNewUser | public E persistNewUser(E user, boolean encryptPassword) {
if (user.getId() != null) {
// to be sure that we are in the
// "create" case, the id must be null
return user;
}
if (encryptPassword) {
user.setPassword(passwordEncoder.encode(user.getPa... | java | public E persistNewUser(E user, boolean encryptPassword) {
if (user.getId() != null) {
// to be sure that we are in the
// "create" case, the id must be null
return user;
}
if (encryptPassword) {
user.setPassword(passwordEncoder.encode(user.getPa... | [
"public",
"E",
"persistNewUser",
"(",
"E",
"user",
",",
"boolean",
"encryptPassword",
")",
"{",
"if",
"(",
"user",
".",
"getId",
"(",
")",
"!=",
"null",
")",
"{",
"// to be sure that we are in the",
"// \"create\" case, the id must be null",
"return",
"user",
";",... | Persists a new user in the database.
@param user The user to create
@param encryptPassword Whether or not the current password of the user object should
be encrypted or not before the object is persisted in the db
@return The persisted user object (incl. ID value) | [
"Persists",
"a",
"new",
"user",
"in",
"the",
"database",
"."
] | 3dbabda35ae63235265913c865dba389b050b6e6 | https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/service/UserService.java#L189-L204 | train |
terrestris/shogun-core | src/shogun-core-main/src/main/java/de/terrestris/shoguncore/converter/PropertyValueConverter.java | PropertyValueConverter.convertToEntityAttribute | @Override
public Object convertToEntityAttribute(String dbData) {
if ("true".equalsIgnoreCase(dbData)) {
return true;
} else if ("false".equalsIgnoreCase(dbData)) {
return false;
} else if (NumberUtils.isParsable(dbData)) {
if (NumberUtils.isDigits(dbData)... | java | @Override
public Object convertToEntityAttribute(String dbData) {
if ("true".equalsIgnoreCase(dbData)) {
return true;
} else if ("false".equalsIgnoreCase(dbData)) {
return false;
} else if (NumberUtils.isParsable(dbData)) {
if (NumberUtils.isDigits(dbData)... | [
"@",
"Override",
"public",
"Object",
"convertToEntityAttribute",
"(",
"String",
"dbData",
")",
"{",
"if",
"(",
"\"true\"",
".",
"equalsIgnoreCase",
"(",
"dbData",
")",
")",
"{",
"return",
"true",
";",
"}",
"else",
"if",
"(",
"\"false\"",
".",
"equalsIgnoreCa... | Converts a string value from the database to the best matching java
primitive type. | [
"Converts",
"a",
"string",
"value",
"from",
"the",
"database",
"to",
"the",
"best",
"matching",
"java",
"primitive",
"type",
"."
] | 3dbabda35ae63235265913c865dba389b050b6e6 | https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/converter/PropertyValueConverter.java#L37-L53 | train |
terrestris/shogun-core | src/shogun-core-main/src/main/java/de/terrestris/shoguncore/security/access/entity/UserGroupPermissionEvaluator.java | UserGroupPermissionEvaluator.hasPermission | @Override
public boolean hasPermission(User user, E userGroup, Permission permission) {
// always grant READ access to groups in which the user itself is a member
if (user != null && permission.equals(Permission.READ)
&& userGroup.getMembers().contains(user)) {
LOG.trace("Gr... | java | @Override
public boolean hasPermission(User user, E userGroup, Permission permission) {
// always grant READ access to groups in which the user itself is a member
if (user != null && permission.equals(Permission.READ)
&& userGroup.getMembers().contains(user)) {
LOG.trace("Gr... | [
"@",
"Override",
"public",
"boolean",
"hasPermission",
"(",
"User",
"user",
",",
"E",
"userGroup",
",",
"Permission",
"permission",
")",
"{",
"// always grant READ access to groups in which the user itself is a member",
"if",
"(",
"user",
"!=",
"null",
"&&",
"permission... | Grants READ permission on groups where the user is a member.
Uses default implementation otherwise. | [
"Grants",
"READ",
"permission",
"on",
"groups",
"where",
"the",
"user",
"is",
"a",
"member",
".",
"Uses",
"default",
"implementation",
"otherwise",
"."
] | 3dbabda35ae63235265913c865dba389b050b6e6 | https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/security/access/entity/UserGroupPermissionEvaluator.java#L34-L46 | train |
terrestris/shogun-core | src/shogun-core-main/src/main/java/de/terrestris/shoguncore/util/naming/PhysicalNamingStrategyShogunCore.java | PhysicalNamingStrategyShogunCore.toPhysicalTableName | @Override
public Identifier toPhysicalTableName(Identifier tableIdentifier, JdbcEnvironment context) {
return convertToLimitedLowerCase(context, tableIdentifier, tablePrefix);
} | java | @Override
public Identifier toPhysicalTableName(Identifier tableIdentifier, JdbcEnvironment context) {
return convertToLimitedLowerCase(context, tableIdentifier, tablePrefix);
} | [
"@",
"Override",
"public",
"Identifier",
"toPhysicalTableName",
"(",
"Identifier",
"tableIdentifier",
",",
"JdbcEnvironment",
"context",
")",
"{",
"return",
"convertToLimitedLowerCase",
"(",
"context",
",",
"tableIdentifier",
",",
"tablePrefix",
")",
";",
"}"
] | Converts table names to lower case and limits the length if necessary. | [
"Converts",
"table",
"names",
"to",
"lower",
"case",
"and",
"limits",
"the",
"length",
"if",
"necessary",
"."
] | 3dbabda35ae63235265913c865dba389b050b6e6 | https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/util/naming/PhysicalNamingStrategyShogunCore.java#L48-L51 | train |
terrestris/shogun-core | src/shogun-core-main/src/main/java/de/terrestris/shoguncore/util/naming/PhysicalNamingStrategyShogunCore.java | PhysicalNamingStrategyShogunCore.toPhysicalColumnName | @Override
public Identifier toPhysicalColumnName(Identifier columnIdentifier, JdbcEnvironment context) {
return convertToLimitedLowerCase(context, columnIdentifier, null);
} | java | @Override
public Identifier toPhysicalColumnName(Identifier columnIdentifier, JdbcEnvironment context) {
return convertToLimitedLowerCase(context, columnIdentifier, null);
} | [
"@",
"Override",
"public",
"Identifier",
"toPhysicalColumnName",
"(",
"Identifier",
"columnIdentifier",
",",
"JdbcEnvironment",
"context",
")",
"{",
"return",
"convertToLimitedLowerCase",
"(",
"context",
",",
"columnIdentifier",
",",
"null",
")",
";",
"}"
] | Converts column names to lower case and limits the length if necessary. | [
"Converts",
"column",
"names",
"to",
"lower",
"case",
"and",
"limits",
"the",
"length",
"if",
"necessary",
"."
] | 3dbabda35ae63235265913c865dba389b050b6e6 | https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/util/naming/PhysicalNamingStrategyShogunCore.java#L56-L59 | train |
terrestris/shogun-core | src/shogun-core-main/src/main/java/de/terrestris/shoguncore/util/naming/PhysicalNamingStrategyShogunCore.java | PhysicalNamingStrategyShogunCore.getIdentifierLengthLimit | protected Integer getIdentifierLengthLimit(JdbcEnvironment context) {
// https://docs.jboss.org/hibernate/orm/5.0/javadocs/org/hibernate/dialect/package-summary.html
String dialectName = context.getDialect().getClass().getSimpleName();
if (dialectName.startsWith("Oracle")) {
// iden... | java | protected Integer getIdentifierLengthLimit(JdbcEnvironment context) {
// https://docs.jboss.org/hibernate/orm/5.0/javadocs/org/hibernate/dialect/package-summary.html
String dialectName = context.getDialect().getClass().getSimpleName();
if (dialectName.startsWith("Oracle")) {
// iden... | [
"protected",
"Integer",
"getIdentifierLengthLimit",
"(",
"JdbcEnvironment",
"context",
")",
"{",
"// https://docs.jboss.org/hibernate/orm/5.0/javadocs/org/hibernate/dialect/package-summary.html",
"String",
"dialectName",
"=",
"context",
".",
"getDialect",
"(",
")",
".",
"getClass... | Determines the identifier length limit for the given JDBC context.
Returns null if no limitation is necessary.
@param context The current JDBC context
@return The identifier length limit for the given context. null
otherwise. | [
"Determines",
"the",
"identifier",
"length",
"limit",
"for",
"the",
"given",
"JDBC",
"context",
".",
"Returns",
"null",
"if",
"no",
"limitation",
"is",
"necessary",
"."
] | 3dbabda35ae63235265913c865dba389b050b6e6 | https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/util/naming/PhysicalNamingStrategyShogunCore.java#L101-L120 | train |
terrestris/shogun-core | src/shogun-core-main/src/main/java/de/terrestris/shoguncore/util/interceptor/MutableHttpServletRequest.java | MutableHttpServletRequest.getParameterIgnoreCase | public String getParameterIgnoreCase(String name) {
for (Map.Entry<String, String[]> entry : customParameters.entrySet()) {
if (entry.getKey().equalsIgnoreCase(name)) {
return StringUtils.join(entry.getValue(), ",");
}
}
return null;
} | java | public String getParameterIgnoreCase(String name) {
for (Map.Entry<String, String[]> entry : customParameters.entrySet()) {
if (entry.getKey().equalsIgnoreCase(name)) {
return StringUtils.join(entry.getValue(), ",");
}
}
return null;
} | [
"public",
"String",
"getParameterIgnoreCase",
"(",
"String",
"name",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"String",
"[",
"]",
">",
"entry",
":",
"customParameters",
".",
"entrySet",
"(",
")",
")",
"{",
"if",
"(",
"entry",
".",... | Get a parameter by name, ignoring case.
@param name the parameter to get
@return a comma separated list of parameter values | [
"Get",
"a",
"parameter",
"by",
"name",
"ignoring",
"case",
"."
] | 3dbabda35ae63235265913c865dba389b050b6e6 | https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/util/interceptor/MutableHttpServletRequest.java#L358-L365 | train |
terrestris/shogun-core | src/shogun-core-main/src/main/java/de/terrestris/shoguncore/init/ContentInitializer.java | ContentInitializer.initializeDatabaseContent | public void initializeDatabaseContent() {
if (this.shogunInitEnabled) {
LOG.info("Initializing SHOGun content");
for (PersistentObject object : objectsToCreate) {
if (object instanceof User) {
// special handling of users to encrypt the password!
... | java | public void initializeDatabaseContent() {
if (this.shogunInitEnabled) {
LOG.info("Initializing SHOGun content");
for (PersistentObject object : objectsToCreate) {
if (object instanceof User) {
// special handling of users to encrypt the password!
... | [
"public",
"void",
"initializeDatabaseContent",
"(",
")",
"{",
"if",
"(",
"this",
".",
"shogunInitEnabled",
")",
"{",
"LOG",
".",
"info",
"(",
"\"Initializing SHOGun content\"",
")",
";",
"for",
"(",
"PersistentObject",
"object",
":",
"objectsToCreate",
")",
"{",... | The method called on initialization | [
"The",
"method",
"called",
"on",
"initialization"
] | 3dbabda35ae63235265913c865dba389b050b6e6 | https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/init/ContentInitializer.java#L56-L70 | train |
terrestris/shogun-core | src/shogun-core-main/src/main/java/de/terrestris/shoguncore/service/FileService.java | FileService.uploadFile | @PreAuthorize("isAuthenticated()")
public E uploadFile(MultipartFile file) throws Exception {
if (file == null) {
final String errMsg = "Upload failed. File is null.";
LOG.error(errMsg);
throw new Exception(errMsg);
} else if (file.isEmpty()) {
final ... | java | @PreAuthorize("isAuthenticated()")
public E uploadFile(MultipartFile file) throws Exception {
if (file == null) {
final String errMsg = "Upload failed. File is null.";
LOG.error(errMsg);
throw new Exception(errMsg);
} else if (file.isEmpty()) {
final ... | [
"@",
"PreAuthorize",
"(",
"\"isAuthenticated()\"",
")",
"public",
"E",
"uploadFile",
"(",
"MultipartFile",
"file",
")",
"throws",
"Exception",
"{",
"if",
"(",
"file",
"==",
"null",
")",
"{",
"final",
"String",
"errMsg",
"=",
"\"Upload failed. File is null.\"",
"... | Method persists a given MultipartFile as a bytearray in the database
@param file
@throws Exception | [
"Method",
"persists",
"a",
"given",
"MultipartFile",
"as",
"a",
"bytearray",
"in",
"the",
"database"
] | 3dbabda35ae63235265913c865dba389b050b6e6 | https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/service/FileService.java#L59-L92 | train |
terrestris/shogun-core | src/shogun-core-main/src/main/java/de/terrestris/shoguncore/service/ImageFileService.java | ImageFileService.saveImage | @PreAuthorize("isAuthenticated()")
public E saveImage(MultipartFile file, boolean createThumbnail, Integer thumbnailTargetSize)
throws Exception {
InputStream is = null;
ByteArrayInputStream bais = null;
E imageToPersist = null;
try {
is = file.getInputStream();... | java | @PreAuthorize("isAuthenticated()")
public E saveImage(MultipartFile file, boolean createThumbnail, Integer thumbnailTargetSize)
throws Exception {
InputStream is = null;
ByteArrayInputStream bais = null;
E imageToPersist = null;
try {
is = file.getInputStream();... | [
"@",
"PreAuthorize",
"(",
"\"isAuthenticated()\"",
")",
"public",
"E",
"saveImage",
"(",
"MultipartFile",
"file",
",",
"boolean",
"createThumbnail",
",",
"Integer",
"thumbnailTargetSize",
")",
"throws",
"Exception",
"{",
"InputStream",
"is",
"=",
"null",
";",
"Byt... | Method persists a given Image as a bytearray in the database
@param file
@param createThumbnail
@param thumbnailTargetSize
@throws Exception | [
"Method",
"persists",
"a",
"given",
"Image",
"as",
"a",
"bytearray",
"in",
"the",
"database"
] | 3dbabda35ae63235265913c865dba389b050b6e6 | https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/service/ImageFileService.java#L98-L148 | train |
terrestris/shogun-core | src/shogun-core-main/src/main/java/de/terrestris/shoguncore/service/ImageFileService.java | ImageFileService.scaleImage | public static byte[] scaleImage(byte[] imageBytes, String outputFormat,
Integer targetSize) throws Exception {
InputStream is = null;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
byte[] imageInBytes = null;
BufferedImage image = null;
... | java | public static byte[] scaleImage(byte[] imageBytes, String outputFormat,
Integer targetSize) throws Exception {
InputStream is = null;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
byte[] imageInBytes = null;
BufferedImage image = null;
... | [
"public",
"static",
"byte",
"[",
"]",
"scaleImage",
"(",
"byte",
"[",
"]",
"imageBytes",
",",
"String",
"outputFormat",
",",
"Integer",
"targetSize",
")",
"throws",
"Exception",
"{",
"InputStream",
"is",
"=",
"null",
";",
"ByteArrayOutputStream",
"baos",
"=",
... | Scales an image by the given dimensions
@param outputFormat
@param targetSize width/height in px (square)
@throws Exception | [
"Scales",
"an",
"image",
"by",
"the",
"given",
"dimensions"
] | 3dbabda35ae63235265913c865dba389b050b6e6 | https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/service/ImageFileService.java#L157-L185 | train |
jenkinsci/support-core-plugin | src/main/java/com/cloudbees/jenkins/support/impl/JenkinsLogs.java | JenkinsLogs.addMasterJulLogRecords | private void addMasterJulLogRecords(Container result) {
// this file captures the most recent of those that are still kept around in memory.
// this overlaps with Jenkins.logRecords, and also overlaps with what's written in files,
// but added nonetheless just in case.
//
// shou... | java | private void addMasterJulLogRecords(Container result) {
// this file captures the most recent of those that are still kept around in memory.
// this overlaps with Jenkins.logRecords, and also overlaps with what's written in files,
// but added nonetheless just in case.
//
// shou... | [
"private",
"void",
"addMasterJulLogRecords",
"(",
"Container",
"result",
")",
"{",
"// this file captures the most recent of those that are still kept around in memory.",
"// this overlaps with Jenkins.logRecords, and also overlaps with what's written in files,",
"// but added nonetheless just i... | Adds j.u.l logging output that the support-core plugin captures.
<p>
Compared to {@link #addMasterJulRingBuffer(Container)}, this one uses disk files,
so it remembers larger number of entries. | [
"Adds",
"j",
".",
"u",
".",
"l",
"logging",
"output",
"that",
"the",
"support",
"-",
"core",
"plugin",
"captures",
"."
] | bcbe1dfd5bf48ac89903645cd48ed897c1a04688 | https://github.com/jenkinsci/support-core-plugin/blob/bcbe1dfd5bf48ac89903645cd48ed897c1a04688/src/main/java/com/cloudbees/jenkins/support/impl/JenkinsLogs.java#L172-L195 | train |
jenkinsci/support-core-plugin | src/main/java/com/cloudbees/jenkins/support/impl/LoadStats.java | LoadStats.camelCaseToSentenceCase | private static String camelCaseToSentenceCase(String camelCase) {
String name = StringUtils.join(StringUtils.splitByCharacterTypeCamelCase(camelCase), " ");
return name.substring(0, 1).toUpperCase(Locale.ENGLISH) + name.substring(1)
.toLowerCase(Locale.ENGLISH);
} | java | private static String camelCaseToSentenceCase(String camelCase) {
String name = StringUtils.join(StringUtils.splitByCharacterTypeCamelCase(camelCase), " ");
return name.substring(0, 1).toUpperCase(Locale.ENGLISH) + name.substring(1)
.toLowerCase(Locale.ENGLISH);
} | [
"private",
"static",
"String",
"camelCaseToSentenceCase",
"(",
"String",
"camelCase",
")",
"{",
"String",
"name",
"=",
"StringUtils",
".",
"join",
"(",
"StringUtils",
".",
"splitByCharacterTypeCamelCase",
"(",
"camelCase",
")",
",",
"\" \"",
")",
";",
"return",
... | Converts "aCamelCaseString" into "A sentence case string".
@param camelCase camelCase.
@return Sentence case. | [
"Converts",
"aCamelCaseString",
"into",
"A",
"sentence",
"case",
"string",
"."
] | bcbe1dfd5bf48ac89903645cd48ed897c1a04688 | https://github.com/jenkinsci/support-core-plugin/blob/bcbe1dfd5bf48ac89903645cd48ed897c1a04688/src/main/java/com/cloudbees/jenkins/support/impl/LoadStats.java#L295-L299 | train |
jenkinsci/support-core-plugin | src/main/java/com/cloudbees/jenkins/support/filter/ContentMappings.java | ContentMappings.newInstance | public static @Extension ContentMappings newInstance() throws IOException {
ContentMappings mappings = Persistence.load(ContentMappings.class);
if (mappings == null) {
mappings = (ContentMappings) new XmlProxy().readResolve();
}
return mappings;
} | java | public static @Extension ContentMappings newInstance() throws IOException {
ContentMappings mappings = Persistence.load(ContentMappings.class);
if (mappings == null) {
mappings = (ContentMappings) new XmlProxy().readResolve();
}
return mappings;
} | [
"public",
"static",
"@",
"Extension",
"ContentMappings",
"newInstance",
"(",
")",
"throws",
"IOException",
"{",
"ContentMappings",
"mappings",
"=",
"Persistence",
".",
"load",
"(",
"ContentMappings",
".",
"class",
")",
";",
"if",
"(",
"mappings",
"==",
"null",
... | Constructs a new ContentMappings using an existing config file or default settings if not found. | [
"Constructs",
"a",
"new",
"ContentMappings",
"using",
"an",
"existing",
"config",
"file",
"or",
"default",
"settings",
"if",
"not",
"found",
"."
] | bcbe1dfd5bf48ac89903645cd48ed897c1a04688 | https://github.com/jenkinsci/support-core-plugin/blob/bcbe1dfd5bf48ac89903645cd48ed897c1a04688/src/main/java/com/cloudbees/jenkins/support/filter/ContentMappings.java#L74-L80 | train |
jenkinsci/support-core-plugin | src/main/java/com/cloudbees/jenkins/support/SupportAction.java | SupportAction.doDownload | @RequirePOST
public void doDownload(StaplerRequest req, StaplerResponse rsp) throws ServletException, IOException {
doGenerateAllBundles(req, rsp);
} | java | @RequirePOST
public void doDownload(StaplerRequest req, StaplerResponse rsp) throws ServletException, IOException {
doGenerateAllBundles(req, rsp);
} | [
"@",
"RequirePOST",
"public",
"void",
"doDownload",
"(",
"StaplerRequest",
"req",
",",
"StaplerResponse",
"rsp",
")",
"throws",
"ServletException",
",",
"IOException",
"{",
"doGenerateAllBundles",
"(",
"req",
",",
"rsp",
")",
";",
"}"
] | Generates a support bundle.
@param req The stapler request
@param rsp The stapler response
@throws ServletException
@throws IOException | [
"Generates",
"a",
"support",
"bundle",
"."
] | bcbe1dfd5bf48ac89903645cd48ed897c1a04688 | https://github.com/jenkinsci/support-core-plugin/blob/bcbe1dfd5bf48ac89903645cd48ed897c1a04688/src/main/java/com/cloudbees/jenkins/support/SupportAction.java#L165-L168 | train |
jenkinsci/support-core-plugin | src/main/java/com/cloudbees/jenkins/support/api/FileContent.java | FileContent.isBinary | private boolean isBinary() {
try (InputStream in = getInputStream()) {
long size = Files.size(file.toPath());
if (size == 0) {
// Empty file, so no need to check
return true;
}
byte[] b = new byte[( size < StreamUtils.DEFAULT_PROBE... | java | private boolean isBinary() {
try (InputStream in = getInputStream()) {
long size = Files.size(file.toPath());
if (size == 0) {
// Empty file, so no need to check
return true;
}
byte[] b = new byte[( size < StreamUtils.DEFAULT_PROBE... | [
"private",
"boolean",
"isBinary",
"(",
")",
"{",
"try",
"(",
"InputStream",
"in",
"=",
"getInputStream",
"(",
")",
")",
"{",
"long",
"size",
"=",
"Files",
".",
"size",
"(",
"file",
".",
"toPath",
"(",
")",
")",
";",
"if",
"(",
"size",
"==",
"0",
... | Check if the file is binary or not | [
"Check",
"if",
"the",
"file",
"is",
"binary",
"or",
"not"
] | bcbe1dfd5bf48ac89903645cd48ed897c1a04688 | https://github.com/jenkinsci/support-core-plugin/blob/bcbe1dfd5bf48ac89903645cd48ed897c1a04688/src/main/java/com/cloudbees/jenkins/support/api/FileContent.java#L169-L190 | train |
rosette-api/java | api/src/main/java/com/basistech/rosette/api/HttpRosetteAPI.java | HttpRosetteAPI.getVersion | private static String getVersion() {
Properties properties = new Properties();
try (InputStream ins = HttpRosetteAPI.class.getClassLoader().getResourceAsStream("version.properties")) {
properties.load(ins);
} catch (IOException e) {
// should not happen
}
... | java | private static String getVersion() {
Properties properties = new Properties();
try (InputStream ins = HttpRosetteAPI.class.getClassLoader().getResourceAsStream("version.properties")) {
properties.load(ins);
} catch (IOException e) {
// should not happen
}
... | [
"private",
"static",
"String",
"getVersion",
"(",
")",
"{",
"Properties",
"properties",
"=",
"new",
"Properties",
"(",
")",
";",
"try",
"(",
"InputStream",
"ins",
"=",
"HttpRosetteAPI",
".",
"class",
".",
"getClassLoader",
"(",
")",
".",
"getResourceAsStream",... | Returns the version of the binding.
@return version of the binding | [
"Returns",
"the",
"version",
"of",
"the",
"binding",
"."
] | 35faf9fbb9c940eae47df004da7639a3b177b80b | https://github.com/rosette-api/java/blob/35faf9fbb9c940eae47df004da7639a3b177b80b/api/src/main/java/com/basistech/rosette/api/HttpRosetteAPI.java#L144-L152 | train |
rosette-api/java | api/src/main/java/com/basistech/rosette/api/HttpRosetteAPI.java | HttpRosetteAPI.getBytes | private static byte[] getBytes(InputStream is) throws IOException {
ByteArrayOutputStream out = new ByteArrayOutputStream();
byte[] buf = new byte[4096];
while (true) {
int r = is.read(buf);
if (r == -1) {
out.flush();
return out.toByteAr... | java | private static byte[] getBytes(InputStream is) throws IOException {
ByteArrayOutputStream out = new ByteArrayOutputStream();
byte[] buf = new byte[4096];
while (true) {
int r = is.read(buf);
if (r == -1) {
out.flush();
return out.toByteAr... | [
"private",
"static",
"byte",
"[",
"]",
"getBytes",
"(",
"InputStream",
"is",
")",
"throws",
"IOException",
"{",
"ByteArrayOutputStream",
"out",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"byte",
"[",
"]",
"buf",
"=",
"new",
"byte",
"[",
"4096",
"]... | Returns a byte array from InputStream.
@param is InputStream
@return byte array
@throws IOException | [
"Returns",
"a",
"byte",
"array",
"from",
"InputStream",
"."
] | 35faf9fbb9c940eae47df004da7639a3b177b80b | https://github.com/rosette-api/java/blob/35faf9fbb9c940eae47df004da7639a3b177b80b/api/src/main/java/com/basistech/rosette/api/HttpRosetteAPI.java#L161-L174 | train |
rosette-api/java | api/src/main/java/com/basistech/rosette/api/HttpRosetteAPI.java | HttpRosetteAPI.getSupportedLanguages | @Override
public SupportedLanguagesResponse getSupportedLanguages(String endpoint) throws HttpRosetteAPIException {
if (DOC_ENDPOINTS.contains(endpoint) || NAME_DEDUPLICATION_SERVICE_PATH.equals(endpoint)) {
return sendGetRequest(urlBase + endpoint + SUPPORTED_LANGUAGES_SUBPATH, SupportedLangua... | java | @Override
public SupportedLanguagesResponse getSupportedLanguages(String endpoint) throws HttpRosetteAPIException {
if (DOC_ENDPOINTS.contains(endpoint) || NAME_DEDUPLICATION_SERVICE_PATH.equals(endpoint)) {
return sendGetRequest(urlBase + endpoint + SUPPORTED_LANGUAGES_SUBPATH, SupportedLangua... | [
"@",
"Override",
"public",
"SupportedLanguagesResponse",
"getSupportedLanguages",
"(",
"String",
"endpoint",
")",
"throws",
"HttpRosetteAPIException",
"{",
"if",
"(",
"DOC_ENDPOINTS",
".",
"contains",
"(",
"endpoint",
")",
"||",
"NAME_DEDUPLICATION_SERVICE_PATH",
".",
"... | Gets the set of language and script codes supported by the specified Rosette API endpoint.
@return SupportedLanguagesResponse
@throws HttpRosetteAPIException for an error returned from the Rosette API. | [
"Gets",
"the",
"set",
"of",
"language",
"and",
"script",
"codes",
"supported",
"by",
"the",
"specified",
"Rosette",
"API",
"endpoint",
"."
] | 35faf9fbb9c940eae47df004da7639a3b177b80b | https://github.com/rosette-api/java/blob/35faf9fbb9c940eae47df004da7639a3b177b80b/api/src/main/java/com/basistech/rosette/api/HttpRosetteAPI.java#L240-L247 | train |
rosette-api/java | api/src/main/java/com/basistech/rosette/api/HttpRosetteAPI.java | HttpRosetteAPI.getSupportedLanguagePairs | @Override
public SupportedLanguagePairsResponse getSupportedLanguagePairs(String endpoint) throws HttpRosetteAPIException {
if (NAMES_ENDPOINTS.contains(endpoint) && !NAME_DEDUPLICATION_SERVICE_PATH.equals(endpoint)) {
return sendGetRequest(urlBase + endpoint + SUPPORTED_LANGUAGES_SUBPATH, Supp... | java | @Override
public SupportedLanguagePairsResponse getSupportedLanguagePairs(String endpoint) throws HttpRosetteAPIException {
if (NAMES_ENDPOINTS.contains(endpoint) && !NAME_DEDUPLICATION_SERVICE_PATH.equals(endpoint)) {
return sendGetRequest(urlBase + endpoint + SUPPORTED_LANGUAGES_SUBPATH, Supp... | [
"@",
"Override",
"public",
"SupportedLanguagePairsResponse",
"getSupportedLanguagePairs",
"(",
"String",
"endpoint",
")",
"throws",
"HttpRosetteAPIException",
"{",
"if",
"(",
"NAMES_ENDPOINTS",
".",
"contains",
"(",
"endpoint",
")",
"&&",
"!",
"NAME_DEDUPLICATION_SERVICE_... | Gets the set of language, script codes and transliteration scheme pairs supported by the specified Rosette API
endpoint.
@param endpoint Rosette API endpoint.
@return SupportedLanguagePairsResponse
@throws HttpRosetteAPIException for an error returned from the Rosette API. | [
"Gets",
"the",
"set",
"of",
"language",
"script",
"codes",
"and",
"transliteration",
"scheme",
"pairs",
"supported",
"by",
"the",
"specified",
"Rosette",
"API",
"endpoint",
"."
] | 35faf9fbb9c940eae47df004da7639a3b177b80b | https://github.com/rosette-api/java/blob/35faf9fbb9c940eae47df004da7639a3b177b80b/api/src/main/java/com/basistech/rosette/api/HttpRosetteAPI.java#L257-L264 | train |
rosette-api/java | api/src/main/java/com/basistech/rosette/api/HttpRosetteAPI.java | HttpRosetteAPI.performAsync | @Override
public <RequestType extends Request, ResponseType extends Response> Future<ResponseType> performAsync(String endpoint, RequestType request, Class<ResponseType> responseClass) throws HttpRosetteAPIException {
throw new UnsupportedOperationException("Asynchronous operations are not yet supported");
... | java | @Override
public <RequestType extends Request, ResponseType extends Response> Future<ResponseType> performAsync(String endpoint, RequestType request, Class<ResponseType> responseClass) throws HttpRosetteAPIException {
throw new UnsupportedOperationException("Asynchronous operations are not yet supported");
... | [
"@",
"Override",
"public",
"<",
"RequestType",
"extends",
"Request",
",",
"ResponseType",
"extends",
"Response",
">",
"Future",
"<",
"ResponseType",
">",
"performAsync",
"(",
"String",
"endpoint",
",",
"RequestType",
"request",
",",
"Class",
"<",
"ResponseType",
... | This method always throws UnsupportedOperationException. | [
"This",
"method",
"always",
"throws",
"UnsupportedOperationException",
"."
] | 35faf9fbb9c940eae47df004da7639a3b177b80b | https://github.com/rosette-api/java/blob/35faf9fbb9c940eae47df004da7639a3b177b80b/api/src/main/java/com/basistech/rosette/api/HttpRosetteAPI.java#L311-L314 | train |
rosette-api/java | api/src/main/java/com/basistech/rosette/api/HttpRosetteAPI.java | HttpRosetteAPI.getResponse | private <T extends Object> T getResponse(HttpResponse httpResponse, Class<T> clazz) throws IOException, HttpRosetteAPIException {
int status = httpResponse.getStatusLine().getStatusCode();
String encoding = headerValueOrNull(httpResponse.getFirstHeader(HttpHeaders.CONTENT_ENCODING));
try (
... | java | private <T extends Object> T getResponse(HttpResponse httpResponse, Class<T> clazz) throws IOException, HttpRosetteAPIException {
int status = httpResponse.getStatusLine().getStatusCode();
String encoding = headerValueOrNull(httpResponse.getFirstHeader(HttpHeaders.CONTENT_ENCODING));
try (
... | [
"private",
"<",
"T",
"extends",
"Object",
">",
"T",
"getResponse",
"(",
"HttpResponse",
"httpResponse",
",",
"Class",
"<",
"T",
">",
"clazz",
")",
"throws",
"IOException",
",",
"HttpRosetteAPIException",
"{",
"int",
"status",
"=",
"httpResponse",
".",
"getStat... | Gets response from HTTP connection, according to the specified response class;
throws for an error response.
@param httpResponse the response object
@param clazz Response class
@return Response
@throws IOException | [
"Gets",
"response",
"from",
"HTTP",
"connection",
"according",
"to",
"the",
"specified",
"response",
"class",
";",
"throws",
"for",
"an",
"error",
"response",
"."
] | 35faf9fbb9c940eae47df004da7639a3b177b80b | https://github.com/rosette-api/java/blob/35faf9fbb9c940eae47df004da7639a3b177b80b/api/src/main/java/com/basistech/rosette/api/HttpRosetteAPI.java#L535-L585 | train |
jenkinsci/support-core-plugin | src/main/java/com/cloudbees/jenkins/support/configfiles/SecretHandler.java | SecretHandler.findSecrets | public static String findSecrets(File xmlFile) throws SAXException, IOException, TransformerException {
XMLReader xr = new XMLFilterImpl(XMLReaderFactory.createXMLReader()) {
private String tagName = "";
@Override
public void startElement(String uri, String localName, Strin... | java | public static String findSecrets(File xmlFile) throws SAXException, IOException, TransformerException {
XMLReader xr = new XMLFilterImpl(XMLReaderFactory.createXMLReader()) {
private String tagName = "";
@Override
public void startElement(String uri, String localName, Strin... | [
"public",
"static",
"String",
"findSecrets",
"(",
"File",
"xmlFile",
")",
"throws",
"SAXException",
",",
"IOException",
",",
"TransformerException",
"{",
"XMLReader",
"xr",
"=",
"new",
"XMLFilterImpl",
"(",
"XMLReaderFactory",
".",
"createXMLReader",
"(",
")",
")"... | find the secret in the xml file and replace it with the place holder
@param xmlFile we want to parse
@return the patched xml content with redacted secrets
@throws SAXException if some XML parsing issue occurs.
@throws IOException if some issue occurs while reading the providing file.
@throws TransformerException if an ... | [
"find",
"the",
"secret",
"in",
"the",
"xml",
"file",
"and",
"replace",
"it",
"with",
"the",
"place",
"holder"
] | bcbe1dfd5bf48ac89903645cd48ed897c1a04688 | https://github.com/jenkinsci/support-core-plugin/blob/bcbe1dfd5bf48ac89903645cd48ed897c1a04688/src/main/java/com/cloudbees/jenkins/support/configfiles/SecretHandler.java#L62-L117 | train |
jenkinsci/support-core-plugin | src/main/java/com/cloudbees/jenkins/support/configfiles/SecretHandler.java | SecretHandler.createSafeSource | private static Source createSafeSource(XMLReader reader, InputSource source) {
try {
reader.setFeature("http://xml.org/sax/features/external-general-entities", false);
} catch (SAXException ignored) {
/* Fallback entity resolver will be used */
}
try {
... | java | private static Source createSafeSource(XMLReader reader, InputSource source) {
try {
reader.setFeature("http://xml.org/sax/features/external-general-entities", false);
} catch (SAXException ignored) {
/* Fallback entity resolver will be used */
}
try {
... | [
"private",
"static",
"Source",
"createSafeSource",
"(",
"XMLReader",
"reader",
",",
"InputSource",
"source",
")",
"{",
"try",
"{",
"reader",
".",
"setFeature",
"(",
"\"http://xml.org/sax/features/external-general-entities\"",
",",
"false",
")",
";",
"}",
"catch",
"(... | Converts a Source into a Source that is protected against XXE attacks.
@see jenkins.util.xml.XMLUtils#safeTransform | [
"Converts",
"a",
"Source",
"into",
"a",
"Source",
"that",
"is",
"protected",
"against",
"XXE",
"attacks",
"."
] | bcbe1dfd5bf48ac89903645cd48ed897c1a04688 | https://github.com/jenkinsci/support-core-plugin/blob/bcbe1dfd5bf48ac89903645cd48ed897c1a04688/src/main/java/com/cloudbees/jenkins/support/configfiles/SecretHandler.java#L138-L154 | train |
jenkinsci/support-core-plugin | src/main/java/com/cloudbees/jenkins/support/impl/FileDescriptorLimit.java | FileDescriptorLimit.getUlimit | @edu.umd.cs.findbugs.annotations.SuppressWarnings({"DM_DEFAULT_ENCODING", "OS_OPEN_STREAM"})
private static void getUlimit(PrintWriter writer) throws IOException {
// TODO should first check whether /bin/bash even exists
InputStream is = new ProcessBuilder("bash", "-c", "ulimit -a").start().getInput... | java | @edu.umd.cs.findbugs.annotations.SuppressWarnings({"DM_DEFAULT_ENCODING", "OS_OPEN_STREAM"})
private static void getUlimit(PrintWriter writer) throws IOException {
// TODO should first check whether /bin/bash even exists
InputStream is = new ProcessBuilder("bash", "-c", "ulimit -a").start().getInput... | [
"@",
"edu",
".",
"umd",
".",
"cs",
".",
"findbugs",
".",
"annotations",
".",
"SuppressWarnings",
"(",
"{",
"\"DM_DEFAULT_ENCODING\"",
",",
"\"OS_OPEN_STREAM\"",
"}",
")",
"private",
"static",
"void",
"getUlimit",
"(",
"PrintWriter",
"writer",
")",
"throws",
"I... | This method executes the command "bash -c ulimit -a" on the machine. | [
"This",
"method",
"executes",
"the",
"command",
"bash",
"-",
"c",
"ulimit",
"-",
"a",
"on",
"the",
"machine",
"."
] | bcbe1dfd5bf48ac89903645cd48ed897c1a04688 | https://github.com/jenkinsci/support-core-plugin/blob/bcbe1dfd5bf48ac89903645cd48ed897c1a04688/src/main/java/com/cloudbees/jenkins/support/impl/FileDescriptorLimit.java#L188-L202 | train |
rosette-api/java | model/src/main/java/com/basistech/rosette/apimodel/Response.java | Response.addExtendedInformation | public void addExtendedInformation(String key, Object value) {
if (extendedInformation == null) {
extendedInformation = new HashMap<>();
}
extendedInformation.put(key, value);
} | java | public void addExtendedInformation(String key, Object value) {
if (extendedInformation == null) {
extendedInformation = new HashMap<>();
}
extendedInformation.put(key, value);
} | [
"public",
"void",
"addExtendedInformation",
"(",
"String",
"key",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"extendedInformation",
"==",
"null",
")",
"{",
"extendedInformation",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"}",
"extendedInformation",
".",
... | add more extended information to the response
@param key
@param value | [
"add",
"more",
"extended",
"information",
"to",
"the",
"response"
] | 35faf9fbb9c940eae47df004da7639a3b177b80b | https://github.com/rosette-api/java/blob/35faf9fbb9c940eae47df004da7639a3b177b80b/model/src/main/java/com/basistech/rosette/apimodel/Response.java#L40-L45 | train |
jenkinsci/support-core-plugin | src/main/java/com/cloudbees/jenkins/support/filter/FilteredOutputStream.java | FilteredOutputStream.flush | @Override
public synchronized void flush() throws IOException {
ensureOpen();
if (decodedBuf.position() > 0) {
decodedBuf.flip();
String contents = decodedBuf.toString();
String filtered = contentFilter.filter(contents);
out.write(filtered.getBytes(cha... | java | @Override
public synchronized void flush() throws IOException {
ensureOpen();
if (decodedBuf.position() > 0) {
decodedBuf.flip();
String contents = decodedBuf.toString();
String filtered = contentFilter.filter(contents);
out.write(filtered.getBytes(cha... | [
"@",
"Override",
"public",
"synchronized",
"void",
"flush",
"(",
")",
"throws",
"IOException",
"{",
"ensureOpen",
"(",
")",
";",
"if",
"(",
"decodedBuf",
".",
"position",
"(",
")",
">",
"0",
")",
"{",
"decodedBuf",
".",
"flip",
"(",
")",
";",
"String",... | Flushes the current buffered contents and filters them as is. | [
"Flushes",
"the",
"current",
"buffered",
"contents",
"and",
"filters",
"them",
"as",
"is",
"."
] | bcbe1dfd5bf48ac89903645cd48ed897c1a04688 | https://github.com/jenkinsci/support-core-plugin/blob/bcbe1dfd5bf48ac89903645cd48ed897c1a04688/src/main/java/com/cloudbees/jenkins/support/filter/FilteredOutputStream.java#L131-L142 | train |
jenkinsci/support-core-plugin | src/main/java/com/cloudbees/jenkins/support/filter/FilteredOutputStream.java | FilteredOutputStream.reset | public synchronized void reset() {
ensureOpen();
encodedBuf.clear();
if (decodedBuf.capacity() > FilteredConstants.DEFAULT_DECODER_CAPACITY) {
this.decodedBuf = CharBuffer.allocate(FilteredConstants.DEFAULT_DECODER_CAPACITY);
} else {
decodedBuf.clear();
}... | java | public synchronized void reset() {
ensureOpen();
encodedBuf.clear();
if (decodedBuf.capacity() > FilteredConstants.DEFAULT_DECODER_CAPACITY) {
this.decodedBuf = CharBuffer.allocate(FilteredConstants.DEFAULT_DECODER_CAPACITY);
} else {
decodedBuf.clear();
}... | [
"public",
"synchronized",
"void",
"reset",
"(",
")",
"{",
"ensureOpen",
"(",
")",
";",
"encodedBuf",
".",
"clear",
"(",
")",
";",
"if",
"(",
"decodedBuf",
".",
"capacity",
"(",
")",
">",
"FilteredConstants",
".",
"DEFAULT_DECODER_CAPACITY",
")",
"{",
"this... | Resets the state of this stream's decoders and buffers. | [
"Resets",
"the",
"state",
"of",
"this",
"stream",
"s",
"decoders",
"and",
"buffers",
"."
] | bcbe1dfd5bf48ac89903645cd48ed897c1a04688 | https://github.com/jenkinsci/support-core-plugin/blob/bcbe1dfd5bf48ac89903645cd48ed897c1a04688/src/main/java/com/cloudbees/jenkins/support/filter/FilteredOutputStream.java#L199-L208 | train |
jenkinsci/support-core-plugin | src/main/java/com/cloudbees/jenkins/support/impl/SlaveLogs.java | SlaveLogs.getActiveCacheKeys | private Set<String> getActiveCacheKeys(final List<Node> nodes) {
Set<String> cacheKeys = new HashSet<>(nodes.size());
for (Node node : nodes) {
// can't use node.getRootPath() cause won't work with disconnected agents.
String cacheKey = Util.getDigestOf(node.getNodeName() + ":" +... | java | private Set<String> getActiveCacheKeys(final List<Node> nodes) {
Set<String> cacheKeys = new HashSet<>(nodes.size());
for (Node node : nodes) {
// can't use node.getRootPath() cause won't work with disconnected agents.
String cacheKey = Util.getDigestOf(node.getNodeName() + ":" +... | [
"private",
"Set",
"<",
"String",
">",
"getActiveCacheKeys",
"(",
"final",
"List",
"<",
"Node",
">",
"nodes",
")",
"{",
"Set",
"<",
"String",
">",
"cacheKeys",
"=",
"new",
"HashSet",
"<>",
"(",
"nodes",
".",
"size",
"(",
")",
")",
";",
"for",
"(",
"... | Build a Set including the cacheKeys associated to every agent in the instance | [
"Build",
"a",
"Set",
"including",
"the",
"cacheKeys",
"associated",
"to",
"every",
"agent",
"in",
"the",
"instance"
] | bcbe1dfd5bf48ac89903645cd48ed897c1a04688 | https://github.com/jenkinsci/support-core-plugin/blob/bcbe1dfd5bf48ac89903645cd48ed897c1a04688/src/main/java/com/cloudbees/jenkins/support/impl/SlaveLogs.java#L234-L243 | train |
jenkinsci/support-core-plugin | src/main/java/com/cloudbees/jenkins/support/impl/AboutJenkins.java | AboutJenkins.mayBeDate | static boolean mayBeDate(String s) {
if (s == null || s.length() != "yyyy-MM-dd_HH-mm-ss".length()) {
return false;
}
for (int i = 0; i < s.length(); i++) {
switch (s.charAt(i)) {
case '-':
switch (i) {
case 4:
... | java | static boolean mayBeDate(String s) {
if (s == null || s.length() != "yyyy-MM-dd_HH-mm-ss".length()) {
return false;
}
for (int i = 0; i < s.length(); i++) {
switch (s.charAt(i)) {
case '-':
switch (i) {
case 4:
... | [
"static",
"boolean",
"mayBeDate",
"(",
"String",
"s",
")",
"{",
"if",
"(",
"s",
"==",
"null",
"||",
"s",
".",
"length",
"(",
")",
"!=",
"\"yyyy-MM-dd_HH-mm-ss\"",
".",
"length",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"for",
"(",
"int",
"i... | A pre-check to see if a string is a build timestamp formatted date.
@param s the string.
@return {@code true} if it is likely that the string will parse as a build timestamp formatted date. | [
"A",
"pre",
"-",
"check",
"to",
"see",
"if",
"a",
"string",
"is",
"a",
"build",
"timestamp",
"formatted",
"date",
"."
] | bcbe1dfd5bf48ac89903645cd48ed897c1a04688 | https://github.com/jenkinsci/support-core-plugin/blob/bcbe1dfd5bf48ac89903645cd48ed897c1a04688/src/main/java/com/cloudbees/jenkins/support/impl/AboutJenkins.java#L141-L247 | train |
jenkinsci/support-core-plugin | src/main/java/com/cloudbees/jenkins/support/impl/AboutJenkins.java | AboutJenkins.getPluginsSorted | private static Iterable<PluginWrapper> getPluginsSorted() {
PluginManager pluginManager = Jenkins.getInstance().getPluginManager();
return getPluginsSorted(pluginManager);
} | java | private static Iterable<PluginWrapper> getPluginsSorted() {
PluginManager pluginManager = Jenkins.getInstance().getPluginManager();
return getPluginsSorted(pluginManager);
} | [
"private",
"static",
"Iterable",
"<",
"PluginWrapper",
">",
"getPluginsSorted",
"(",
")",
"{",
"PluginManager",
"pluginManager",
"=",
"Jenkins",
".",
"getInstance",
"(",
")",
".",
"getPluginManager",
"(",
")",
";",
"return",
"getPluginsSorted",
"(",
"pluginManager... | Fixes JENKINS-47779 caused by JENKINS-47713
Not using SortedSet because of PluginWrapper doesn't implements equals and hashCode.
@return new copy of the PluginManager.getPlugins sorted | [
"Fixes",
"JENKINS",
"-",
"47779",
"caused",
"by",
"JENKINS",
"-",
"47713",
"Not",
"using",
"SortedSet",
"because",
"of",
"PluginWrapper",
"doesn",
"t",
"implements",
"equals",
"and",
"hashCode",
"."
] | bcbe1dfd5bf48ac89903645cd48ed897c1a04688 | https://github.com/jenkinsci/support-core-plugin/blob/bcbe1dfd5bf48ac89903645cd48ed897c1a04688/src/main/java/com/cloudbees/jenkins/support/impl/AboutJenkins.java#L876-L879 | train |
rosette-api/java | examples/src/main/java/com/basistech/rosette/examples/ExampleBase.java | ExampleBase.showUsage | protected static void showUsage(Class<? extends ExampleBase> commandClass) {
System.err.println(USAGE_STR + commandClass.getName());
} | java | protected static void showUsage(Class<? extends ExampleBase> commandClass) {
System.err.println(USAGE_STR + commandClass.getName());
} | [
"protected",
"static",
"void",
"showUsage",
"(",
"Class",
"<",
"?",
"extends",
"ExampleBase",
">",
"commandClass",
")",
"{",
"System",
".",
"err",
".",
"println",
"(",
"USAGE_STR",
"+",
"commandClass",
".",
"getName",
"(",
")",
")",
";",
"}"
] | Prints out how to run the program
@param commandClass the class to use in the usage message. | [
"Prints",
"out",
"how",
"to",
"run",
"the",
"program"
] | 35faf9fbb9c940eae47df004da7639a3b177b80b | https://github.com/rosette-api/java/blob/35faf9fbb9c940eae47df004da7639a3b177b80b/examples/src/main/java/com/basistech/rosette/examples/ExampleBase.java#L61-L63 | train |
rosette-api/java | examples/src/main/java/com/basistech/rosette/examples/ExampleBase.java | ExampleBase.responseToJson | protected static String responseToJson(Response response) throws JsonProcessingException {
ObjectMapper mapper = ApiModelMixinModule.setupObjectMapper(new ObjectMapper());
mapper.enable(SerializationFeature.INDENT_OUTPUT);
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
r... | java | protected static String responseToJson(Response response) throws JsonProcessingException {
ObjectMapper mapper = ApiModelMixinModule.setupObjectMapper(new ObjectMapper());
mapper.enable(SerializationFeature.INDENT_OUTPUT);
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
r... | [
"protected",
"static",
"String",
"responseToJson",
"(",
"Response",
"response",
")",
"throws",
"JsonProcessingException",
"{",
"ObjectMapper",
"mapper",
"=",
"ApiModelMixinModule",
".",
"setupObjectMapper",
"(",
"new",
"ObjectMapper",
"(",
")",
")",
";",
"mapper",
"... | Converts a response to JSON string
@param response {@link com.basistech.rosette.apimodel.Response Response} from RosetteAPI
@return the json string.
@throws JsonProcessingException if the Jackson library throws an error serializing. | [
"Converts",
"a",
"response",
"to",
"JSON",
"string"
] | 35faf9fbb9c940eae47df004da7639a3b177b80b | https://github.com/rosette-api/java/blob/35faf9fbb9c940eae47df004da7639a3b177b80b/examples/src/main/java/com/basistech/rosette/examples/ExampleBase.java#L72-L77 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.