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
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/RunnersApi.java
RunnersApi.enableRunner
public Runner enableRunner(Object projectIdOrPath, Integer runnerId) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm().withParam("runner_id", runnerId, true); Response response = post(Response.Status.CREATED, formData.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "runners"); return (response.readEntity(Runner.class)); }
java
public Runner enableRunner(Object projectIdOrPath, Integer runnerId) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm().withParam("runner_id", runnerId, true); Response response = post(Response.Status.CREATED, formData.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "runners"); return (response.readEntity(Runner.class)); }
[ "public", "Runner", "enableRunner", "(", "Object", "projectIdOrPath", ",", "Integer", "runnerId", ")", "throws", "GitLabApiException", "{", "GitLabApiForm", "formData", "=", "new", "GitLabApiForm", "(", ")", ".", "withParam", "(", "\"runner_id\"", ",", "runnerId", ",", "true", ")", ";", "Response", "response", "=", "post", "(", "Response", ".", "Status", ".", "CREATED", ",", "formData", ".", "asMap", "(", ")", ",", "\"projects\"", ",", "getProjectIdOrPath", "(", "projectIdOrPath", ")", ",", "\"runners\"", ")", ";", "return", "(", "response", ".", "readEntity", "(", "Runner", ".", "class", ")", ")", ";", "}" ]
Enable an available specific runner in the project. <pre><code>GitLab Endpoint: POST /projects/:id/runners</code></pre> @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance @param runnerId The ID of a runner @return Runner instance of the Runner enabled @throws GitLabApiException if any exception occurs
[ "Enable", "an", "available", "specific", "runner", "in", "the", "project", "." ]
ab045070abac0a8f4ccbf17b5ed9bfdef5723eed
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/RunnersApi.java#L459-L464
train
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/RunnersApi.java
RunnersApi.registerRunner
public RunnerDetail registerRunner(String token, String description, Boolean active, List<String> tagList, Boolean runUntagged, Boolean locked, Integer maximumTimeout) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm() .withParam("token", token, true) .withParam("description", description, false) .withParam("active", active, false) .withParam("locked", locked, false) .withParam("run_untagged", runUntagged, false) .withParam("tag_list", tagList, false) .withParam("maximum_timeout", maximumTimeout, false); Response response = post(Response.Status.CREATED, formData.asMap(), "runners"); return (response.readEntity(RunnerDetail.class)); }
java
public RunnerDetail registerRunner(String token, String description, Boolean active, List<String> tagList, Boolean runUntagged, Boolean locked, Integer maximumTimeout) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm() .withParam("token", token, true) .withParam("description", description, false) .withParam("active", active, false) .withParam("locked", locked, false) .withParam("run_untagged", runUntagged, false) .withParam("tag_list", tagList, false) .withParam("maximum_timeout", maximumTimeout, false); Response response = post(Response.Status.CREATED, formData.asMap(), "runners"); return (response.readEntity(RunnerDetail.class)); }
[ "public", "RunnerDetail", "registerRunner", "(", "String", "token", ",", "String", "description", ",", "Boolean", "active", ",", "List", "<", "String", ">", "tagList", ",", "Boolean", "runUntagged", ",", "Boolean", "locked", ",", "Integer", "maximumTimeout", ")", "throws", "GitLabApiException", "{", "GitLabApiForm", "formData", "=", "new", "GitLabApiForm", "(", ")", ".", "withParam", "(", "\"token\"", ",", "token", ",", "true", ")", ".", "withParam", "(", "\"description\"", ",", "description", ",", "false", ")", ".", "withParam", "(", "\"active\"", ",", "active", ",", "false", ")", ".", "withParam", "(", "\"locked\"", ",", "locked", ",", "false", ")", ".", "withParam", "(", "\"run_untagged\"", ",", "runUntagged", ",", "false", ")", ".", "withParam", "(", "\"tag_list\"", ",", "tagList", ",", "false", ")", ".", "withParam", "(", "\"maximum_timeout\"", ",", "maximumTimeout", ",", "false", ")", ";", "Response", "response", "=", "post", "(", "Response", ".", "Status", ".", "CREATED", ",", "formData", ".", "asMap", "(", ")", ",", "\"runners\"", ")", ";", "return", "(", "response", ".", "readEntity", "(", "RunnerDetail", ".", "class", ")", ")", ";", "}" ]
Register a new runner for the gitlab instance. <pre><code>GitLab Endpoint: POST /runners/</code></pre> @param token the token of the project (for project specific runners) or the token from the admin page @param description The description of a runner @param active The state of a runner; can be set to true or false @param tagList The list of tags for a runner; put array of tags, that should be finally assigned to a runner @param runUntagged Flag indicating the runner can execute untagged jobs @param locked Flag indicating the runner is locked @param maximumTimeout the maximum timeout set when this Runner will handle the job @return RunnerDetail instance. @throws GitLabApiException if any exception occurs
[ "Register", "a", "new", "runner", "for", "the", "gitlab", "instance", "." ]
ab045070abac0a8f4ccbf17b5ed9bfdef5723eed
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/RunnersApi.java#L498-L511
train
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/RunnersApi.java
RunnersApi.deleteRunner
public void deleteRunner(String token) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm().withParam("token", token, true); delete(Response.Status.NO_CONTENT, formData.asMap(), "runners"); }
java
public void deleteRunner(String token) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm().withParam("token", token, true); delete(Response.Status.NO_CONTENT, formData.asMap(), "runners"); }
[ "public", "void", "deleteRunner", "(", "String", "token", ")", "throws", "GitLabApiException", "{", "GitLabApiForm", "formData", "=", "new", "GitLabApiForm", "(", ")", ".", "withParam", "(", "\"token\"", ",", "token", ",", "true", ")", ";", "delete", "(", "Response", ".", "Status", ".", "NO_CONTENT", ",", "formData", ".", "asMap", "(", ")", ",", "\"runners\"", ")", ";", "}" ]
Deletes a registered Runner. <pre><code>GitLab Endpoint: DELETE /runners/</code></pre> @param token the runners authentication token @throws GitLabApiException if any exception occurs
[ "Deletes", "a", "registered", "Runner", "." ]
ab045070abac0a8f4ccbf17b5ed9bfdef5723eed
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/RunnersApi.java#L521-L524
train
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/HookManager.java
HookManager.isValidSecretToken
public boolean isValidSecretToken(String secretToken) { return (this.secretToken == null || this.secretToken.equals(secretToken) ? true : false); }
java
public boolean isValidSecretToken(String secretToken) { return (this.secretToken == null || this.secretToken.equals(secretToken) ? true : false); }
[ "public", "boolean", "isValidSecretToken", "(", "String", "secretToken", ")", "{", "return", "(", "this", ".", "secretToken", "==", "null", "||", "this", ".", "secretToken", ".", "equals", "(", "secretToken", ")", "?", "true", ":", "false", ")", ";", "}" ]
Validate the provided secret token against the reference secret token. Returns true if the secret token is valid or there is no reference secret token to validate against, otherwise returns false. @param secretToken the token to validate @return true if the secret token is valid or there is no reference secret token to validate against
[ "Validate", "the", "provided", "secret", "token", "against", "the", "reference", "secret", "token", ".", "Returns", "true", "if", "the", "secret", "token", "is", "valid", "or", "there", "is", "no", "reference", "secret", "token", "to", "validate", "against", "otherwise", "returns", "false", "." ]
ab045070abac0a8f4ccbf17b5ed9bfdef5723eed
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/HookManager.java#L47-L49
train
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/HookManager.java
HookManager.isValidSecretToken
public boolean isValidSecretToken(HttpServletRequest request) { if (this.secretToken != null) { String secretToken = request.getHeader("X-Gitlab-Token"); return (isValidSecretToken(secretToken)); } return (true); }
java
public boolean isValidSecretToken(HttpServletRequest request) { if (this.secretToken != null) { String secretToken = request.getHeader("X-Gitlab-Token"); return (isValidSecretToken(secretToken)); } return (true); }
[ "public", "boolean", "isValidSecretToken", "(", "HttpServletRequest", "request", ")", "{", "if", "(", "this", ".", "secretToken", "!=", "null", ")", "{", "String", "secretToken", "=", "request", ".", "getHeader", "(", "\"X-Gitlab-Token\"", ")", ";", "return", "(", "isValidSecretToken", "(", "secretToken", ")", ")", ";", "}", "return", "(", "true", ")", ";", "}" ]
Validate the provided secret token found in the HTTP header against the reference secret token. Returns true if the secret token is valid or there is no reference secret token to validate against, otherwise returns false. @param request the HTTP request to verify the secret token @return true if the secret token is valid or there is no reference secret token to validate against
[ "Validate", "the", "provided", "secret", "token", "found", "in", "the", "HTTP", "header", "against", "the", "reference", "secret", "token", ".", "Returns", "true", "if", "the", "secret", "token", "is", "valid", "or", "there", "is", "no", "reference", "secret", "token", "to", "validate", "against", "otherwise", "returns", "false", "." ]
ab045070abac0a8f4ccbf17b5ed9bfdef5723eed
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/HookManager.java#L59-L67
train
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/NotesApi.java
NotesApi.getIssueNotes
public List<Note> getIssueNotes(Object projectIdOrPath, Integer issueIid, int page, int perPage) throws GitLabApiException { Response response = get(Response.Status.OK, getPageQueryParams(page, perPage),"projects", getProjectIdOrPath(projectIdOrPath), "issues", issueIid, "notes"); return (response.readEntity(new GenericType<List<Note>>() {})); }
java
public List<Note> getIssueNotes(Object projectIdOrPath, Integer issueIid, int page, int perPage) throws GitLabApiException { Response response = get(Response.Status.OK, getPageQueryParams(page, perPage),"projects", getProjectIdOrPath(projectIdOrPath), "issues", issueIid, "notes"); return (response.readEntity(new GenericType<List<Note>>() {})); }
[ "public", "List", "<", "Note", ">", "getIssueNotes", "(", "Object", "projectIdOrPath", ",", "Integer", "issueIid", ",", "int", "page", ",", "int", "perPage", ")", "throws", "GitLabApiException", "{", "Response", "response", "=", "get", "(", "Response", ".", "Status", ".", "OK", ",", "getPageQueryParams", "(", "page", ",", "perPage", ")", ",", "\"projects\"", ",", "getProjectIdOrPath", "(", "projectIdOrPath", ")", ",", "\"issues\"", ",", "issueIid", ",", "\"notes\"", ")", ";", "return", "(", "response", ".", "readEntity", "(", "new", "GenericType", "<", "List", "<", "Note", ">", ">", "(", ")", "{", "}", ")", ")", ";", "}" ]
Get a list of the issue's notes using the specified page and per page settings. <pre><code>GitLab Endpoint: GET /projects/:id/issues/:issue_iid/notes</code></pre> @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance @param issueIid the issue IID to get the notes for @param page the page to get @param perPage the number of notes per page @return the list of notes in the specified range @throws GitLabApiException if any exception occurs
[ "Get", "a", "list", "of", "the", "issue", "s", "notes", "using", "the", "specified", "page", "and", "per", "page", "settings", "." ]
ab045070abac0a8f4ccbf17b5ed9bfdef5723eed
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/NotesApi.java#L95-L99
train
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/NotesApi.java
NotesApi.getIssueNotesStream
public Stream<Note> getIssueNotesStream(Object projectIdOrPath, Integer issueIid) throws GitLabApiException { return (getIssueNotes(projectIdOrPath, issueIid, getDefaultPerPage()).stream()); }
java
public Stream<Note> getIssueNotesStream(Object projectIdOrPath, Integer issueIid) throws GitLabApiException { return (getIssueNotes(projectIdOrPath, issueIid, getDefaultPerPage()).stream()); }
[ "public", "Stream", "<", "Note", ">", "getIssueNotesStream", "(", "Object", "projectIdOrPath", ",", "Integer", "issueIid", ")", "throws", "GitLabApiException", "{", "return", "(", "getIssueNotes", "(", "projectIdOrPath", ",", "issueIid", ",", "getDefaultPerPage", "(", ")", ")", ".", "stream", "(", ")", ")", ";", "}" ]
Get a Stream of the issues's notes. <pre><code>GitLab Endpoint: GET /projects/:id/issues/:issue_iid/notes</code></pre> @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance @param issueIid the issue ID to get the notes for @return a Stream of the issues's notes @throws GitLabApiException if any exception occurs
[ "Get", "a", "Stream", "of", "the", "issues", "s", "notes", "." ]
ab045070abac0a8f4ccbf17b5ed9bfdef5723eed
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/NotesApi.java#L127-L129
train
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/NotesApi.java
NotesApi.getIssueNote
public Note getIssueNote(Object projectIdOrPath, Integer issueIid, Integer noteId) throws GitLabApiException { Response response = get(Response.Status.OK, getDefaultPerPageParam(), "projects", getProjectIdOrPath(projectIdOrPath), "issues", issueIid, "notes", noteId); return (response.readEntity(Note.class)); }
java
public Note getIssueNote(Object projectIdOrPath, Integer issueIid, Integer noteId) throws GitLabApiException { Response response = get(Response.Status.OK, getDefaultPerPageParam(), "projects", getProjectIdOrPath(projectIdOrPath), "issues", issueIid, "notes", noteId); return (response.readEntity(Note.class)); }
[ "public", "Note", "getIssueNote", "(", "Object", "projectIdOrPath", ",", "Integer", "issueIid", ",", "Integer", "noteId", ")", "throws", "GitLabApiException", "{", "Response", "response", "=", "get", "(", "Response", ".", "Status", ".", "OK", ",", "getDefaultPerPageParam", "(", ")", ",", "\"projects\"", ",", "getProjectIdOrPath", "(", "projectIdOrPath", ")", ",", "\"issues\"", ",", "issueIid", ",", "\"notes\"", ",", "noteId", ")", ";", "return", "(", "response", ".", "readEntity", "(", "Note", ".", "class", ")", ")", ";", "}" ]
Get the specified issues's note. @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance @param issueIid the issue IID to get the notes for @param noteId the ID of the Note to get @return a Note instance for the specified IDs @throws GitLabApiException if any exception occurs
[ "Get", "the", "specified", "issues", "s", "note", "." ]
ab045070abac0a8f4ccbf17b5ed9bfdef5723eed
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/NotesApi.java#L140-L144
train
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/NotesApi.java
NotesApi.updateIssueNote
public Note updateIssueNote(Object projectIdOrPath, Integer issueIid, Integer noteId, String body) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm().withParam("body", body, true); Response response = put(Response.Status.OK, formData.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "issues", issueIid, "notes", noteId); return (response.readEntity(Note.class)); }
java
public Note updateIssueNote(Object projectIdOrPath, Integer issueIid, Integer noteId, String body) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm().withParam("body", body, true); Response response = put(Response.Status.OK, formData.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "issues", issueIid, "notes", noteId); return (response.readEntity(Note.class)); }
[ "public", "Note", "updateIssueNote", "(", "Object", "projectIdOrPath", ",", "Integer", "issueIid", ",", "Integer", "noteId", ",", "String", "body", ")", "throws", "GitLabApiException", "{", "GitLabApiForm", "formData", "=", "new", "GitLabApiForm", "(", ")", ".", "withParam", "(", "\"body\"", ",", "body", ",", "true", ")", ";", "Response", "response", "=", "put", "(", "Response", ".", "Status", ".", "OK", ",", "formData", ".", "asMap", "(", ")", ",", "\"projects\"", ",", "getProjectIdOrPath", "(", "projectIdOrPath", ")", ",", "\"issues\"", ",", "issueIid", ",", "\"notes\"", ",", "noteId", ")", ";", "return", "(", "response", ".", "readEntity", "(", "Note", ".", "class", ")", ")", ";", "}" ]
Update the specified issues's note. @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance @param issueIid the issue IID to update the notes for @param noteId the ID of the node to update @param body the update content for the Note @return the modified Note instance @throws GitLabApiException if any exception occurs
[ "Update", "the", "specified", "issues", "s", "note", "." ]
ab045070abac0a8f4ccbf17b5ed9bfdef5723eed
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/NotesApi.java#L188-L194
train
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/NotesApi.java
NotesApi.getMergeRequestNotes
public List<Note> getMergeRequestNotes(Object projectIdOrPath, Integer mergeRequestIid) throws GitLabApiException { return (getMergeRequestNotes(projectIdOrPath, mergeRequestIid, null, null, getDefaultPerPage()).all()); }
java
public List<Note> getMergeRequestNotes(Object projectIdOrPath, Integer mergeRequestIid) throws GitLabApiException { return (getMergeRequestNotes(projectIdOrPath, mergeRequestIid, null, null, getDefaultPerPage()).all()); }
[ "public", "List", "<", "Note", ">", "getMergeRequestNotes", "(", "Object", "projectIdOrPath", ",", "Integer", "mergeRequestIid", ")", "throws", "GitLabApiException", "{", "return", "(", "getMergeRequestNotes", "(", "projectIdOrPath", ",", "mergeRequestIid", ",", "null", ",", "null", ",", "getDefaultPerPage", "(", ")", ")", ".", "all", "(", ")", ")", ";", "}" ]
Gets a list of all notes for a single merge request <pre><code>GitLab Endpoint: GET /projects/:id/merge_requests/:merge_request_iid/notes</code></pre> @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance @param mergeRequestIid the issue ID to get the notes for @return a list of the merge request's notes @throws GitLabApiException if any exception occurs
[ "Gets", "a", "list", "of", "all", "notes", "for", "a", "single", "merge", "request" ]
ab045070abac0a8f4ccbf17b5ed9bfdef5723eed
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/NotesApi.java#L229-L231
train
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/NotesApi.java
NotesApi.getMergeRequestNotes
public List<Note> getMergeRequestNotes(Object projectIdOrPath, Integer mergeRequestIid, SortOrder sortOrder, Note.OrderBy orderBy) throws GitLabApiException { return (getMergeRequestNotes(projectIdOrPath, mergeRequestIid, sortOrder, orderBy, getDefaultPerPage()).all()); }
java
public List<Note> getMergeRequestNotes(Object projectIdOrPath, Integer mergeRequestIid, SortOrder sortOrder, Note.OrderBy orderBy) throws GitLabApiException { return (getMergeRequestNotes(projectIdOrPath, mergeRequestIid, sortOrder, orderBy, getDefaultPerPage()).all()); }
[ "public", "List", "<", "Note", ">", "getMergeRequestNotes", "(", "Object", "projectIdOrPath", ",", "Integer", "mergeRequestIid", ",", "SortOrder", "sortOrder", ",", "Note", ".", "OrderBy", "orderBy", ")", "throws", "GitLabApiException", "{", "return", "(", "getMergeRequestNotes", "(", "projectIdOrPath", ",", "mergeRequestIid", ",", "sortOrder", ",", "orderBy", ",", "getDefaultPerPage", "(", ")", ")", ".", "all", "(", ")", ")", ";", "}" ]
Gets a list of all notes for a single merge request. <pre><code>GitLab Endpoint: GET /projects/:id/merge_requests/:merge_request_iid/notes</code></pre> @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance @param mergeRequestIid the issue ID to get the notes for @param sortOrder return merge request notes sorted in the specified sort order, default is DESC @param orderBy return merge request notes ordered by CREATED_AT or UPDATED_AT, default is CREATED_AT @return a list of the merge request's notes @throws GitLabApiException if any exception occurs
[ "Gets", "a", "list", "of", "all", "notes", "for", "a", "single", "merge", "request", "." ]
ab045070abac0a8f4ccbf17b5ed9bfdef5723eed
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/NotesApi.java#L245-L247
train
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/NotesApi.java
NotesApi.getMergeRequestNotesStream
public Stream<Note> getMergeRequestNotesStream(Object projectIdOrPath, Integer mergeRequestIid) throws GitLabApiException { return (getMergeRequestNotes(projectIdOrPath, mergeRequestIid, null, null, getDefaultPerPage()).stream()); }
java
public Stream<Note> getMergeRequestNotesStream(Object projectIdOrPath, Integer mergeRequestIid) throws GitLabApiException { return (getMergeRequestNotes(projectIdOrPath, mergeRequestIid, null, null, getDefaultPerPage()).stream()); }
[ "public", "Stream", "<", "Note", ">", "getMergeRequestNotesStream", "(", "Object", "projectIdOrPath", ",", "Integer", "mergeRequestIid", ")", "throws", "GitLabApiException", "{", "return", "(", "getMergeRequestNotes", "(", "projectIdOrPath", ",", "mergeRequestIid", ",", "null", ",", "null", ",", "getDefaultPerPage", "(", ")", ")", ".", "stream", "(", ")", ")", ";", "}" ]
Gets a Stream of all notes for a single merge request <pre><code>GitLab Endpoint: GET /projects/:id/merge_requests/:merge_request_iid/notes</code></pre> @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance @param mergeRequestIid the issue ID to get the notes for @return a Stream of the merge request's notes @throws GitLabApiException if any exception occurs
[ "Gets", "a", "Stream", "of", "all", "notes", "for", "a", "single", "merge", "request" ]
ab045070abac0a8f4ccbf17b5ed9bfdef5723eed
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/NotesApi.java#L317-L319
train
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/NotesApi.java
NotesApi.getMergeRequestNotesStream
public Stream<Note> getMergeRequestNotesStream(Object projectIdOrPath, Integer mergeRequestIid, SortOrder sortOrder, Note.OrderBy orderBy) throws GitLabApiException { return (getMergeRequestNotes(projectIdOrPath, mergeRequestIid, sortOrder, orderBy, getDefaultPerPage()).stream()); }
java
public Stream<Note> getMergeRequestNotesStream(Object projectIdOrPath, Integer mergeRequestIid, SortOrder sortOrder, Note.OrderBy orderBy) throws GitLabApiException { return (getMergeRequestNotes(projectIdOrPath, mergeRequestIid, sortOrder, orderBy, getDefaultPerPage()).stream()); }
[ "public", "Stream", "<", "Note", ">", "getMergeRequestNotesStream", "(", "Object", "projectIdOrPath", ",", "Integer", "mergeRequestIid", ",", "SortOrder", "sortOrder", ",", "Note", ".", "OrderBy", "orderBy", ")", "throws", "GitLabApiException", "{", "return", "(", "getMergeRequestNotes", "(", "projectIdOrPath", ",", "mergeRequestIid", ",", "sortOrder", ",", "orderBy", ",", "getDefaultPerPage", "(", ")", ")", ".", "stream", "(", ")", ")", ";", "}" ]
Gets a Stream of all notes for a single merge request. <pre><code>GitLab Endpoint: GET /projects/:id/merge_requests/:merge_request_iid/notes</code></pre> @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance @param mergeRequestIid the issue ID to get the notes for @param sortOrder return merge request notes sorted in the specified sort order, default is DESC @param orderBy return merge request notes ordered by CREATED_AT or UPDATED_AT, default is CREATED_AT @return a Stream of the merge request's notes @throws GitLabApiException if any exception occurs
[ "Gets", "a", "Stream", "of", "all", "notes", "for", "a", "single", "merge", "request", "." ]
ab045070abac0a8f4ccbf17b5ed9bfdef5723eed
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/NotesApi.java#L358-L360
train
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/NotesApi.java
NotesApi.getMergeRequestNote
public Note getMergeRequestNote(Object projectIdOrPath, Integer mergeRequestIid, Integer noteId) throws GitLabApiException { Response response = get(Response.Status.OK, getDefaultPerPageParam(), "projects", getProjectIdOrPath(projectIdOrPath), "merge_requests", mergeRequestIid, "notes", noteId); return (response.readEntity(Note.class)); }
java
public Note getMergeRequestNote(Object projectIdOrPath, Integer mergeRequestIid, Integer noteId) throws GitLabApiException { Response response = get(Response.Status.OK, getDefaultPerPageParam(), "projects", getProjectIdOrPath(projectIdOrPath), "merge_requests", mergeRequestIid, "notes", noteId); return (response.readEntity(Note.class)); }
[ "public", "Note", "getMergeRequestNote", "(", "Object", "projectIdOrPath", ",", "Integer", "mergeRequestIid", ",", "Integer", "noteId", ")", "throws", "GitLabApiException", "{", "Response", "response", "=", "get", "(", "Response", ".", "Status", ".", "OK", ",", "getDefaultPerPageParam", "(", ")", ",", "\"projects\"", ",", "getProjectIdOrPath", "(", "projectIdOrPath", ")", ",", "\"merge_requests\"", ",", "mergeRequestIid", ",", "\"notes\"", ",", "noteId", ")", ";", "return", "(", "response", ".", "readEntity", "(", "Note", ".", "class", ")", ")", ";", "}" ]
Get the specified merge request's note. @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance @param mergeRequestIid the merge request IID to get the notes for @param noteId the ID of the Note to get @return a Note instance for the specified IDs @throws GitLabApiException if any exception occurs
[ "Get", "the", "specified", "merge", "request", "s", "note", "." ]
ab045070abac0a8f4ccbf17b5ed9bfdef5723eed
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/NotesApi.java#L371-L375
train
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/NotesApi.java
NotesApi.createMergeRequestNote
public Note createMergeRequestNote(Object projectIdOrPath, Integer mergeRequestIid, String body) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm().withParam("body", body, true); Response response = post(Response.Status.CREATED, formData, "projects", getProjectIdOrPath(projectIdOrPath), "merge_requests", mergeRequestIid, "notes"); return (response.readEntity(Note.class)); }
java
public Note createMergeRequestNote(Object projectIdOrPath, Integer mergeRequestIid, String body) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm().withParam("body", body, true); Response response = post(Response.Status.CREATED, formData, "projects", getProjectIdOrPath(projectIdOrPath), "merge_requests", mergeRequestIid, "notes"); return (response.readEntity(Note.class)); }
[ "public", "Note", "createMergeRequestNote", "(", "Object", "projectIdOrPath", ",", "Integer", "mergeRequestIid", ",", "String", "body", ")", "throws", "GitLabApiException", "{", "GitLabApiForm", "formData", "=", "new", "GitLabApiForm", "(", ")", ".", "withParam", "(", "\"body\"", ",", "body", ",", "true", ")", ";", "Response", "response", "=", "post", "(", "Response", ".", "Status", ".", "CREATED", ",", "formData", ",", "\"projects\"", ",", "getProjectIdOrPath", "(", "projectIdOrPath", ")", ",", "\"merge_requests\"", ",", "mergeRequestIid", ",", "\"notes\"", ")", ";", "return", "(", "response", ".", "readEntity", "(", "Note", ".", "class", ")", ")", ";", "}" ]
Create a merge request's note. @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance @param mergeRequestIid the merge request IID to create the notes for @param body the content of note @return the created Note instance @throws GitLabApiException if any exception occurs
[ "Create", "a", "merge", "request", "s", "note", "." ]
ab045070abac0a8f4ccbf17b5ed9bfdef5723eed
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/NotesApi.java#L386-L391
train
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/NotesApi.java
NotesApi.deleteMergeRequestNote
public void deleteMergeRequestNote(Object projectIdOrPath, Integer mergeRequestIid, Integer noteId) throws GitLabApiException { if (mergeRequestIid == null) { throw new RuntimeException("mergeRequestIid cannot be null"); } if (noteId == null) { throw new RuntimeException("noteId cannot be null"); } Response.Status expectedStatus = (isApiVersion(GitLabApi.ApiVersion.V3) ? Response.Status.OK : Response.Status.NO_CONTENT); delete(expectedStatus, null, "projects", getProjectIdOrPath(projectIdOrPath), "merge_requests", mergeRequestIid, "notes", noteId); }
java
public void deleteMergeRequestNote(Object projectIdOrPath, Integer mergeRequestIid, Integer noteId) throws GitLabApiException { if (mergeRequestIid == null) { throw new RuntimeException("mergeRequestIid cannot be null"); } if (noteId == null) { throw new RuntimeException("noteId cannot be null"); } Response.Status expectedStatus = (isApiVersion(GitLabApi.ApiVersion.V3) ? Response.Status.OK : Response.Status.NO_CONTENT); delete(expectedStatus, null, "projects", getProjectIdOrPath(projectIdOrPath), "merge_requests", mergeRequestIid, "notes", noteId); }
[ "public", "void", "deleteMergeRequestNote", "(", "Object", "projectIdOrPath", ",", "Integer", "mergeRequestIid", ",", "Integer", "noteId", ")", "throws", "GitLabApiException", "{", "if", "(", "mergeRequestIid", "==", "null", ")", "{", "throw", "new", "RuntimeException", "(", "\"mergeRequestIid cannot be null\"", ")", ";", "}", "if", "(", "noteId", "==", "null", ")", "{", "throw", "new", "RuntimeException", "(", "\"noteId cannot be null\"", ")", ";", "}", "Response", ".", "Status", "expectedStatus", "=", "(", "isApiVersion", "(", "GitLabApi", ".", "ApiVersion", ".", "V3", ")", "?", "Response", ".", "Status", ".", "OK", ":", "Response", ".", "Status", ".", "NO_CONTENT", ")", ";", "delete", "(", "expectedStatus", ",", "null", ",", "\"projects\"", ",", "getProjectIdOrPath", "(", "projectIdOrPath", ")", ",", "\"merge_requests\"", ",", "mergeRequestIid", ",", "\"notes\"", ",", "noteId", ")", ";", "}" ]
Delete the specified merge request's note. @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance @param mergeRequestIid the merge request IID to delete the notes for @param noteId the ID of the node to delete @throws GitLabApiException if any exception occurs
[ "Delete", "the", "specified", "merge", "request", "s", "note", "." ]
ab045070abac0a8f4ccbf17b5ed9bfdef5723eed
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/NotesApi.java#L419-L432
train
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/TagsApi.java
TagsApi.getTagsStream
public Stream<Tag> getTagsStream(Object projectIdOrPath) throws GitLabApiException { return (getTags(projectIdOrPath, getDefaultPerPage()).stream()); }
java
public Stream<Tag> getTagsStream(Object projectIdOrPath) throws GitLabApiException { return (getTags(projectIdOrPath, getDefaultPerPage()).stream()); }
[ "public", "Stream", "<", "Tag", ">", "getTagsStream", "(", "Object", "projectIdOrPath", ")", "throws", "GitLabApiException", "{", "return", "(", "getTags", "(", "projectIdOrPath", ",", "getDefaultPerPage", "(", ")", ")", ".", "stream", "(", ")", ")", ";", "}" ]
Get a Stream of repository tags from a project, sorted by name in reverse alphabetical order. <pre><code>GitLab Endpoint: GET /projects/:id/repository/tags</code></pre> @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path @return a Stream of tags for the specified project ID @throws GitLabApiException if any exception occurs
[ "Get", "a", "Stream", "of", "repository", "tags", "from", "a", "project", "sorted", "by", "name", "in", "reverse", "alphabetical", "order", "." ]
ab045070abac0a8f4ccbf17b5ed9bfdef5723eed
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/TagsApi.java#L82-L84
train
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/TagsApi.java
TagsApi.getTag
public Tag getTag(Object projectIdOrPath, String tagName) throws GitLabApiException { Response response = get(Response.Status.OK, null, "projects", getProjectIdOrPath(projectIdOrPath), "repository", "tags", tagName); return (response.readEntity(Tag.class)); }
java
public Tag getTag(Object projectIdOrPath, String tagName) throws GitLabApiException { Response response = get(Response.Status.OK, null, "projects", getProjectIdOrPath(projectIdOrPath), "repository", "tags", tagName); return (response.readEntity(Tag.class)); }
[ "public", "Tag", "getTag", "(", "Object", "projectIdOrPath", ",", "String", "tagName", ")", "throws", "GitLabApiException", "{", "Response", "response", "=", "get", "(", "Response", ".", "Status", ".", "OK", ",", "null", ",", "\"projects\"", ",", "getProjectIdOrPath", "(", "projectIdOrPath", ")", ",", "\"repository\"", ",", "\"tags\"", ",", "tagName", ")", ";", "return", "(", "response", ".", "readEntity", "(", "Tag", ".", "class", ")", ")", ";", "}" ]
Get a specific repository tag determined by its name. <pre><code>GitLab Endpoint: GET /projects/:id/repository/tags/:tagName</code></pre> @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path @param tagName the name of the tag to fetch the info for @return a Tag instance with info on the specified tag @throws GitLabApiException if any exception occurs
[ "Get", "a", "specific", "repository", "tag", "determined", "by", "its", "name", "." ]
ab045070abac0a8f4ccbf17b5ed9bfdef5723eed
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/TagsApi.java#L96-L99
train
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/TagsApi.java
TagsApi.getOptionalTag
public Optional<Tag> getOptionalTag(Object projectIdOrPath, String tagName) throws GitLabApiException { try { return (Optional.ofNullable(getTag(projectIdOrPath, tagName))); } catch (GitLabApiException glae) { return (GitLabApi.createOptionalFromException(glae)); } }
java
public Optional<Tag> getOptionalTag(Object projectIdOrPath, String tagName) throws GitLabApiException { try { return (Optional.ofNullable(getTag(projectIdOrPath, tagName))); } catch (GitLabApiException glae) { return (GitLabApi.createOptionalFromException(glae)); } }
[ "public", "Optional", "<", "Tag", ">", "getOptionalTag", "(", "Object", "projectIdOrPath", ",", "String", "tagName", ")", "throws", "GitLabApiException", "{", "try", "{", "return", "(", "Optional", ".", "ofNullable", "(", "getTag", "(", "projectIdOrPath", ",", "tagName", ")", ")", ")", ";", "}", "catch", "(", "GitLabApiException", "glae", ")", "{", "return", "(", "GitLabApi", ".", "createOptionalFromException", "(", "glae", ")", ")", ";", "}", "}" ]
Get an Optional instance holding a Tag instance of a specific repository tag determined by its name. <pre><code>GitLab Endpoint: GET /projects/:id/repository/tags/:tagName</code></pre> @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path @param tagName the name of the tag to fetch the info for @return an Optional instance with the specified project tag as the value @throws GitLabApiException if any exception occurs
[ "Get", "an", "Optional", "instance", "holding", "a", "Tag", "instance", "of", "a", "specific", "repository", "tag", "determined", "by", "its", "name", "." ]
ab045070abac0a8f4ccbf17b5ed9bfdef5723eed
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/TagsApi.java#L111-L117
train
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/TagsApi.java
TagsApi.createTag
public Tag createTag(Object projectIdOrPath, String tagName, String ref) throws GitLabApiException { return (createTag(projectIdOrPath, tagName, ref, null, (String)null)); }
java
public Tag createTag(Object projectIdOrPath, String tagName, String ref) throws GitLabApiException { return (createTag(projectIdOrPath, tagName, ref, null, (String)null)); }
[ "public", "Tag", "createTag", "(", "Object", "projectIdOrPath", ",", "String", "tagName", ",", "String", "ref", ")", "throws", "GitLabApiException", "{", "return", "(", "createTag", "(", "projectIdOrPath", ",", "tagName", ",", "ref", ",", "null", ",", "(", "String", ")", "null", ")", ")", ";", "}" ]
Creates a tag on a particular ref of the given project. <pre><code>GitLab Endpoint: POST /projects/:id/repository/tags</code></pre> @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path @param tagName The name of the tag Must be unique for the project @param ref the git ref to place the tag on @return a Tag instance containing info on the newly created tag @throws GitLabApiException if any exception occurs
[ "Creates", "a", "tag", "on", "a", "particular", "ref", "of", "the", "given", "project", "." ]
ab045070abac0a8f4ccbf17b5ed9bfdef5723eed
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/TagsApi.java#L130-L132
train
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/TagsApi.java
TagsApi.createRelease
public Release createRelease(Object projectIdOrPath, String tagName, String releaseNotes) throws GitLabApiException { Form formData = new GitLabApiForm().withParam("description", releaseNotes); Response response = post(Response.Status.CREATED, formData.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "repository", "tags", tagName, "release"); return (response.readEntity(Release.class)); }
java
public Release createRelease(Object projectIdOrPath, String tagName, String releaseNotes) throws GitLabApiException { Form formData = new GitLabApiForm().withParam("description", releaseNotes); Response response = post(Response.Status.CREATED, formData.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "repository", "tags", tagName, "release"); return (response.readEntity(Release.class)); }
[ "public", "Release", "createRelease", "(", "Object", "projectIdOrPath", ",", "String", "tagName", ",", "String", "releaseNotes", ")", "throws", "GitLabApiException", "{", "Form", "formData", "=", "new", "GitLabApiForm", "(", ")", ".", "withParam", "(", "\"description\"", ",", "releaseNotes", ")", ";", "Response", "response", "=", "post", "(", "Response", ".", "Status", ".", "CREATED", ",", "formData", ".", "asMap", "(", ")", ",", "\"projects\"", ",", "getProjectIdOrPath", "(", "projectIdOrPath", ")", ",", "\"repository\"", ",", "\"tags\"", ",", "tagName", ",", "\"release\"", ")", ";", "return", "(", "response", ".", "readEntity", "(", "Release", ".", "class", ")", ")", ";", "}" ]
Add release notes to the existing git tag. <pre><code>GitLab Endpoint: POST /projects/:id/repository/tags/:tagName/release</code></pre> @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path @param tagName the name of a tag @param releaseNotes release notes with markdown support @return a Tag instance containing info on the newly created tag @throws GitLabApiException if any exception occurs
[ "Add", "release", "notes", "to", "the", "existing", "git", "tag", "." ]
ab045070abac0a8f4ccbf17b5ed9bfdef5723eed
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/TagsApi.java#L215-L220
train
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/TagsApi.java
TagsApi.updateRelease
public Release updateRelease(Object projectIdOrPath, String tagName, String releaseNotes) throws GitLabApiException { Form formData = new GitLabApiForm().withParam("description", releaseNotes); Response response = put(Response.Status.OK, formData.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "repository", "tags", tagName, "release"); return (response.readEntity(Release.class)); }
java
public Release updateRelease(Object projectIdOrPath, String tagName, String releaseNotes) throws GitLabApiException { Form formData = new GitLabApiForm().withParam("description", releaseNotes); Response response = put(Response.Status.OK, formData.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "repository", "tags", tagName, "release"); return (response.readEntity(Release.class)); }
[ "public", "Release", "updateRelease", "(", "Object", "projectIdOrPath", ",", "String", "tagName", ",", "String", "releaseNotes", ")", "throws", "GitLabApiException", "{", "Form", "formData", "=", "new", "GitLabApiForm", "(", ")", ".", "withParam", "(", "\"description\"", ",", "releaseNotes", ")", ";", "Response", "response", "=", "put", "(", "Response", ".", "Status", ".", "OK", ",", "formData", ".", "asMap", "(", ")", ",", "\"projects\"", ",", "getProjectIdOrPath", "(", "projectIdOrPath", ")", ",", "\"repository\"", ",", "\"tags\"", ",", "tagName", ",", "\"release\"", ")", ";", "return", "(", "response", ".", "readEntity", "(", "Release", ".", "class", ")", ")", ";", "}" ]
Updates the release notes of a given release. <pre><code>GitLab Endpoint: PUT /projects/:id/repository/tags/:tagName/release</code></pre> @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path @param tagName the name of a tag @param releaseNotes release notes with markdown support @return a Tag instance containing info on the newly created tag @throws GitLabApiException if any exception occurs
[ "Updates", "the", "release", "notes", "of", "a", "given", "release", "." ]
ab045070abac0a8f4ccbf17b5ed9bfdef5723eed
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/TagsApi.java#L233-L238
train
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/UserApi.java
UserApi.getUsers
public List<User> getUsers(int page, int perPage) throws GitLabApiException { Response response = get(Response.Status.OK, getPageQueryParams(page, perPage, customAttributesEnabled), "users"); return (response.readEntity(new GenericType<List<User>>() {})); }
java
public List<User> getUsers(int page, int perPage) throws GitLabApiException { Response response = get(Response.Status.OK, getPageQueryParams(page, perPage, customAttributesEnabled), "users"); return (response.readEntity(new GenericType<List<User>>() {})); }
[ "public", "List", "<", "User", ">", "getUsers", "(", "int", "page", ",", "int", "perPage", ")", "throws", "GitLabApiException", "{", "Response", "response", "=", "get", "(", "Response", ".", "Status", ".", "OK", ",", "getPageQueryParams", "(", "page", ",", "perPage", ",", "customAttributesEnabled", ")", ",", "\"users\"", ")", ";", "return", "(", "response", ".", "readEntity", "(", "new", "GenericType", "<", "List", "<", "User", ">", ">", "(", ")", "{", "}", ")", ")", ";", "}" ]
Get a list of users using the specified page and per page settings. <pre><code>GitLab Endpoint: GET /users</code></pre> @param page the page to get @param perPage the number of users per page @return the list of Users in the specified range @throws GitLabApiException if any exception occurs
[ "Get", "a", "list", "of", "users", "using", "the", "specified", "page", "and", "per", "page", "settings", "." ]
ab045070abac0a8f4ccbf17b5ed9bfdef5723eed
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/UserApi.java#L68-L71
train
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/UserApi.java
UserApi.getUsers
public Pager<User> getUsers(int itemsPerPage) throws GitLabApiException { return (new Pager<User>(this, User.class, itemsPerPage, createGitLabApiForm().asMap(), "users")); }
java
public Pager<User> getUsers(int itemsPerPage) throws GitLabApiException { return (new Pager<User>(this, User.class, itemsPerPage, createGitLabApiForm().asMap(), "users")); }
[ "public", "Pager", "<", "User", ">", "getUsers", "(", "int", "itemsPerPage", ")", "throws", "GitLabApiException", "{", "return", "(", "new", "Pager", "<", "User", ">", "(", "this", ",", "User", ".", "class", ",", "itemsPerPage", ",", "createGitLabApiForm", "(", ")", ".", "asMap", "(", ")", ",", "\"users\"", ")", ")", ";", "}" ]
Get a Pager of users. <pre><code>GitLab Endpoint: GET /users</code></pre> @param itemsPerPage the number of User instances that will be fetched per page @return a Pager of User @throws GitLabApiException if any exception occurs
[ "Get", "a", "Pager", "of", "users", "." ]
ab045070abac0a8f4ccbf17b5ed9bfdef5723eed
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/UserApi.java#L82-L84
train
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/UserApi.java
UserApi.getActiveUsers
public Pager<User> getActiveUsers(int itemsPerPage) throws GitLabApiException { GitLabApiForm formData = createGitLabApiForm().withParam("active", true); return (new Pager<User>(this, User.class, itemsPerPage, formData.asMap(), "users")); }
java
public Pager<User> getActiveUsers(int itemsPerPage) throws GitLabApiException { GitLabApiForm formData = createGitLabApiForm().withParam("active", true); return (new Pager<User>(this, User.class, itemsPerPage, formData.asMap(), "users")); }
[ "public", "Pager", "<", "User", ">", "getActiveUsers", "(", "int", "itemsPerPage", ")", "throws", "GitLabApiException", "{", "GitLabApiForm", "formData", "=", "createGitLabApiForm", "(", ")", ".", "withParam", "(", "\"active\"", ",", "true", ")", ";", "return", "(", "new", "Pager", "<", "User", ">", "(", "this", ",", "User", ".", "class", ",", "itemsPerPage", ",", "formData", ".", "asMap", "(", ")", ",", "\"users\"", ")", ")", ";", "}" ]
Get a Pager of active users. <pre><code>GitLab Endpoint: GET /users?active=true</code></pre> @param itemsPerPage the number of active User instances that will be fetched per page @return a Pager of active User @throws GitLabApiException if any exception occurs
[ "Get", "a", "Pager", "of", "active", "users", "." ]
ab045070abac0a8f4ccbf17b5ed9bfdef5723eed
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/UserApi.java#L138-L141
train
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/UserApi.java
UserApi.blockUser
public void blockUser(Integer userId) throws GitLabApiException { if (userId == null) { throw new RuntimeException("userId cannot be null"); } if (isApiVersion(ApiVersion.V3)) { put(Response.Status.CREATED, null, "users", userId, "block"); } else { post(Response.Status.CREATED, (Form) null, "users", userId, "block"); } }
java
public void blockUser(Integer userId) throws GitLabApiException { if (userId == null) { throw new RuntimeException("userId cannot be null"); } if (isApiVersion(ApiVersion.V3)) { put(Response.Status.CREATED, null, "users", userId, "block"); } else { post(Response.Status.CREATED, (Form) null, "users", userId, "block"); } }
[ "public", "void", "blockUser", "(", "Integer", "userId", ")", "throws", "GitLabApiException", "{", "if", "(", "userId", "==", "null", ")", "{", "throw", "new", "RuntimeException", "(", "\"userId cannot be null\"", ")", ";", "}", "if", "(", "isApiVersion", "(", "ApiVersion", ".", "V3", ")", ")", "{", "put", "(", "Response", ".", "Status", ".", "CREATED", ",", "null", ",", "\"users\"", ",", "userId", ",", "\"block\"", ")", ";", "}", "else", "{", "post", "(", "Response", ".", "Status", ".", "CREATED", ",", "(", "Form", ")", "null", ",", "\"users\"", ",", "userId", ",", "\"block\"", ")", ";", "}", "}" ]
Blocks the specified user. Available only for admin. <pre><code>GitLab Endpoint: POST /users/:id/block</code></pre> @param userId the ID of the user to block @throws GitLabApiException if any exception occurs
[ "Blocks", "the", "specified", "user", ".", "Available", "only", "for", "admin", "." ]
ab045070abac0a8f4ccbf17b5ed9bfdef5723eed
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/UserApi.java#L163-L173
train
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/UserApi.java
UserApi.getblockedUsers
public List<User> getblockedUsers(int page, int perPage) throws GitLabApiException { GitLabApiForm formData = createGitLabApiForm() .withParam("blocked", true) .withParam(PAGE_PARAM, page) .withParam(PER_PAGE_PARAM, perPage); Response response = get(Response.Status.OK, formData.asMap(), "users"); return (response.readEntity(new GenericType<List<User>>() {})); }
java
public List<User> getblockedUsers(int page, int perPage) throws GitLabApiException { GitLabApiForm formData = createGitLabApiForm() .withParam("blocked", true) .withParam(PAGE_PARAM, page) .withParam(PER_PAGE_PARAM, perPage); Response response = get(Response.Status.OK, formData.asMap(), "users"); return (response.readEntity(new GenericType<List<User>>() {})); }
[ "public", "List", "<", "User", ">", "getblockedUsers", "(", "int", "page", ",", "int", "perPage", ")", "throws", "GitLabApiException", "{", "GitLabApiForm", "formData", "=", "createGitLabApiForm", "(", ")", ".", "withParam", "(", "\"blocked\"", ",", "true", ")", ".", "withParam", "(", "PAGE_PARAM", ",", "page", ")", ".", "withParam", "(", "PER_PAGE_PARAM", ",", "perPage", ")", ";", "Response", "response", "=", "get", "(", "Response", ".", "Status", ".", "OK", ",", "formData", ".", "asMap", "(", ")", ",", "\"users\"", ")", ";", "return", "(", "response", ".", "readEntity", "(", "new", "GenericType", "<", "List", "<", "User", ">", ">", "(", ")", "{", "}", ")", ")", ";", "}" ]
Get a list of blocked users using the specified page and per page settings. <pre><code>GitLab Endpoint: GET /users?blocked=true</code></pre> @param page the page to get @param perPage the number of users per page @return the list of blocked Users in the specified range @throws GitLabApiException if any exception occurs
[ "Get", "a", "list", "of", "blocked", "users", "using", "the", "specified", "page", "and", "per", "page", "settings", "." ]
ab045070abac0a8f4ccbf17b5ed9bfdef5723eed
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/UserApi.java#L218-L225
train
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/UserApi.java
UserApi.getUser
public User getUser(int userId) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm().withParam("with_custom_attributes", customAttributesEnabled); Response response = get(Response.Status.OK, formData.asMap(), "users", userId); return (response.readEntity(User.class)); }
java
public User getUser(int userId) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm().withParam("with_custom_attributes", customAttributesEnabled); Response response = get(Response.Status.OK, formData.asMap(), "users", userId); return (response.readEntity(User.class)); }
[ "public", "User", "getUser", "(", "int", "userId", ")", "throws", "GitLabApiException", "{", "GitLabApiForm", "formData", "=", "new", "GitLabApiForm", "(", ")", ".", "withParam", "(", "\"with_custom_attributes\"", ",", "customAttributesEnabled", ")", ";", "Response", "response", "=", "get", "(", "Response", ".", "Status", ".", "OK", ",", "formData", ".", "asMap", "(", ")", ",", "\"users\"", ",", "userId", ")", ";", "return", "(", "response", ".", "readEntity", "(", "User", ".", "class", ")", ")", ";", "}" ]
Get a single user. <pre><code>GitLab Endpoint: GET /users/:id</code></pre> @param userId the ID of the user to get @return the User instance for the specified user ID @throws GitLabApiException if any exception occurs
[ "Get", "a", "single", "user", "." ]
ab045070abac0a8f4ccbf17b5ed9bfdef5723eed
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/UserApi.java#L262-L266
train
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/UserApi.java
UserApi.getOptionalUser
public Optional<User> getOptionalUser(int userId) { try { return (Optional.ofNullable(getUser(userId))); } catch (GitLabApiException glae) { return (GitLabApi.createOptionalFromException(glae)); } }
java
public Optional<User> getOptionalUser(int userId) { try { return (Optional.ofNullable(getUser(userId))); } catch (GitLabApiException glae) { return (GitLabApi.createOptionalFromException(glae)); } }
[ "public", "Optional", "<", "User", ">", "getOptionalUser", "(", "int", "userId", ")", "{", "try", "{", "return", "(", "Optional", ".", "ofNullable", "(", "getUser", "(", "userId", ")", ")", ")", ";", "}", "catch", "(", "GitLabApiException", "glae", ")", "{", "return", "(", "GitLabApi", ".", "createOptionalFromException", "(", "glae", ")", ")", ";", "}", "}" ]
Get a single user as an Optional instance. <pre><code>GitLab Endpoint: GET /users/:id</code></pre> @param userId the ID of the user to get @return the User for the specified user ID as an Optional instance
[ "Get", "a", "single", "user", "as", "an", "Optional", "instance", "." ]
ab045070abac0a8f4ccbf17b5ed9bfdef5723eed
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/UserApi.java#L276-L282
train
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/UserApi.java
UserApi.getUser
public User getUser(String username) throws GitLabApiException { GitLabApiForm formData = createGitLabApiForm().withParam("username", username, true); Response response = get(Response.Status.OK, formData.asMap(), "users"); List<User> users = response.readEntity(new GenericType<List<User>>() {}); return (users.isEmpty() ? null : users.get(0)); }
java
public User getUser(String username) throws GitLabApiException { GitLabApiForm formData = createGitLabApiForm().withParam("username", username, true); Response response = get(Response.Status.OK, formData.asMap(), "users"); List<User> users = response.readEntity(new GenericType<List<User>>() {}); return (users.isEmpty() ? null : users.get(0)); }
[ "public", "User", "getUser", "(", "String", "username", ")", "throws", "GitLabApiException", "{", "GitLabApiForm", "formData", "=", "createGitLabApiForm", "(", ")", ".", "withParam", "(", "\"username\"", ",", "username", ",", "true", ")", ";", "Response", "response", "=", "get", "(", "Response", ".", "Status", ".", "OK", ",", "formData", ".", "asMap", "(", ")", ",", "\"users\"", ")", ";", "List", "<", "User", ">", "users", "=", "response", ".", "readEntity", "(", "new", "GenericType", "<", "List", "<", "User", ">", ">", "(", ")", "{", "}", ")", ";", "return", "(", "users", ".", "isEmpty", "(", ")", "?", "null", ":", "users", ".", "get", "(", "0", ")", ")", ";", "}" ]
Lookup a user by username. Returns null if not found. <p>NOTE: This is for admin users only.</p> <pre><code>GitLab Endpoint: GET /users?username=:username</code></pre> @param username the username of the user to get @return the User instance for the specified username, or null if not found @throws GitLabApiException if any exception occurs
[ "Lookup", "a", "user", "by", "username", ".", "Returns", "null", "if", "not", "found", "." ]
ab045070abac0a8f4ccbf17b5ed9bfdef5723eed
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/UserApi.java#L295-L300
train
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/UserApi.java
UserApi.getOptionalUser
public Optional<User> getOptionalUser(String username) { try { return (Optional.ofNullable(getUser(username))); } catch (GitLabApiException glae) { return (GitLabApi.createOptionalFromException(glae)); } }
java
public Optional<User> getOptionalUser(String username) { try { return (Optional.ofNullable(getUser(username))); } catch (GitLabApiException glae) { return (GitLabApi.createOptionalFromException(glae)); } }
[ "public", "Optional", "<", "User", ">", "getOptionalUser", "(", "String", "username", ")", "{", "try", "{", "return", "(", "Optional", ".", "ofNullable", "(", "getUser", "(", "username", ")", ")", ")", ";", "}", "catch", "(", "GitLabApiException", "glae", ")", "{", "return", "(", "GitLabApi", ".", "createOptionalFromException", "(", "glae", ")", ")", ";", "}", "}" ]
Lookup a user by username and return an Optional instance. <p>NOTE: This is for admin users only.</p> <pre><code>GitLab Endpoint: GET /users?username=:username</code></pre> @param username the username of the user to get @return the User for the specified username as an Optional instance
[ "Lookup", "a", "user", "by", "username", "and", "return", "an", "Optional", "instance", "." ]
ab045070abac0a8f4ccbf17b5ed9bfdef5723eed
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/UserApi.java#L312-L318
train
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/UserApi.java
UserApi.findUsers
public List<User> findUsers(String emailOrUsername) throws GitLabApiException { return (findUsers(emailOrUsername, getDefaultPerPage()).all()); }
java
public List<User> findUsers(String emailOrUsername) throws GitLabApiException { return (findUsers(emailOrUsername, getDefaultPerPage()).all()); }
[ "public", "List", "<", "User", ">", "findUsers", "(", "String", "emailOrUsername", ")", "throws", "GitLabApiException", "{", "return", "(", "findUsers", "(", "emailOrUsername", ",", "getDefaultPerPage", "(", ")", ")", ".", "all", "(", ")", ")", ";", "}" ]
Search users by Email or username <pre><code>GitLab Endpoint: GET /users?search=:email_or_username</code></pre> @param emailOrUsername the email or username to search for @return the User List with the email or username like emailOrUsername @throws GitLabApiException if any exception occurs
[ "Search", "users", "by", "Email", "or", "username" ]
ab045070abac0a8f4ccbf17b5ed9bfdef5723eed
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/UserApi.java#L329-L331
train
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/UserApi.java
UserApi.findUsers
public Pager<User> findUsers(String emailOrUsername, int itemsPerPage) throws GitLabApiException { GitLabApiForm formData = createGitLabApiForm().withParam("search", emailOrUsername, true); return (new Pager<User>(this, User.class, itemsPerPage, formData.asMap(), "users")); }
java
public Pager<User> findUsers(String emailOrUsername, int itemsPerPage) throws GitLabApiException { GitLabApiForm formData = createGitLabApiForm().withParam("search", emailOrUsername, true); return (new Pager<User>(this, User.class, itemsPerPage, formData.asMap(), "users")); }
[ "public", "Pager", "<", "User", ">", "findUsers", "(", "String", "emailOrUsername", ",", "int", "itemsPerPage", ")", "throws", "GitLabApiException", "{", "GitLabApiForm", "formData", "=", "createGitLabApiForm", "(", ")", ".", "withParam", "(", "\"search\"", ",", "emailOrUsername", ",", "true", ")", ";", "return", "(", "new", "Pager", "<", "User", ">", "(", "this", ",", "User", ".", "class", ",", "itemsPerPage", ",", "formData", ".", "asMap", "(", ")", ",", "\"users\"", ")", ")", ";", "}" ]
Search users by Email or username and return a Pager <pre><code>GitLab Endpoint: GET /users?search=:email_or_username</code></pre> @param emailOrUsername the email or username to search for @param itemsPerPage the number of Project instances that will be fetched per page @return the User Pager with the email or username like emailOrUsername @throws GitLabApiException if any exception occurs
[ "Search", "users", "by", "Email", "or", "username", "and", "return", "a", "Pager" ]
ab045070abac0a8f4ccbf17b5ed9bfdef5723eed
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/UserApi.java#L364-L367
train
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/UserApi.java
UserApi.findUsersStream
public Stream<User> findUsersStream(String emailOrUsername) throws GitLabApiException { return (findUsers(emailOrUsername, getDefaultPerPage()).stream()); }
java
public Stream<User> findUsersStream(String emailOrUsername) throws GitLabApiException { return (findUsers(emailOrUsername, getDefaultPerPage()).stream()); }
[ "public", "Stream", "<", "User", ">", "findUsersStream", "(", "String", "emailOrUsername", ")", "throws", "GitLabApiException", "{", "return", "(", "findUsers", "(", "emailOrUsername", ",", "getDefaultPerPage", "(", ")", ")", ".", "stream", "(", ")", ")", ";", "}" ]
Search users by Email or username. <pre><code>GitLab Endpoint: GET /users?search=:email_or_username</code></pre> @param emailOrUsername the email or username to search for @return a Stream of User instances with the email or username like emailOrUsername @throws GitLabApiException if any exception occurs
[ "Search", "users", "by", "Email", "or", "username", "." ]
ab045070abac0a8f4ccbf17b5ed9bfdef5723eed
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/UserApi.java#L378-L380
train
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/UserApi.java
UserApi.modifyUser
@Deprecated public User modifyUser(User user, CharSequence password, Integer projectsLimit) throws GitLabApiException { Form form = userToForm(user, projectsLimit, password, false, false); Response response = put(Response.Status.OK, form.asMap(), "users", user.getId()); return (response.readEntity(User.class)); }
java
@Deprecated public User modifyUser(User user, CharSequence password, Integer projectsLimit) throws GitLabApiException { Form form = userToForm(user, projectsLimit, password, false, false); Response response = put(Response.Status.OK, form.asMap(), "users", user.getId()); return (response.readEntity(User.class)); }
[ "@", "Deprecated", "public", "User", "modifyUser", "(", "User", "user", ",", "CharSequence", "password", ",", "Integer", "projectsLimit", ")", "throws", "GitLabApiException", "{", "Form", "form", "=", "userToForm", "(", "user", ",", "projectsLimit", ",", "password", ",", "false", ",", "false", ")", ";", "Response", "response", "=", "put", "(", "Response", ".", "Status", ".", "OK", ",", "form", ".", "asMap", "(", ")", ",", "\"users\"", ",", "user", ".", "getId", "(", ")", ")", ";", "return", "(", "response", ".", "readEntity", "(", "User", ".", "class", ")", ")", ";", "}" ]
Modifies an existing user. Only administrators can change attributes of a user. <pre><code>GitLab Endpoint: PUT /users/:id</code></pre> <p>The following properties of the provided User instance can be set during update:<pre><code> email (required) - Email username (required) - Username name (required) - Name skype (optional) - Skype ID linkedin (optional) - LinkedIn twitter (optional) - Twitter account websiteUrl (optional) - Website URL organization (optional) - Organization name projectsLimit (optional) - Number of projects user can create externUid (optional) - External UID provider (optional) - External provider name bio (optional) - User's biography location (optional) - User's location admin (optional) - User is admin - true or false (default) canCreateGroup (optional) - User can create groups - true or false skipConfirmation (optional) - Skip confirmation - true or false (default) external (optional) - Flags the user as external - true or false(default) sharedRunnersMinutesLimit (optional) - Pipeline minutes quota for this user </code></pre> @param user the User instance with the user info to modify @param password the new password for the user @param projectsLimit the maximum number of project @return the modified User instance @throws GitLabApiException if any exception occurs @deprecated Will be removed in version 5.0, replaced by {@link #updateUser(User, CharSequence)}
[ "Modifies", "an", "existing", "user", ".", "Only", "administrators", "can", "change", "attributes", "of", "a", "user", "." ]
ab045070abac0a8f4ccbf17b5ed9bfdef5723eed
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/UserApi.java#L530-L535
train
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/UserApi.java
UserApi.deleteUser
public void deleteUser(Object userIdOrUsername, Boolean hardDelete) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm().withParam("hard_delete ", hardDelete); Response.Status expectedStatus = (isApiVersion(ApiVersion.V3) ? Response.Status.OK : Response.Status.NO_CONTENT); delete(expectedStatus, formData.asMap(), "users", getUserIdOrUsername(userIdOrUsername)); }
java
public void deleteUser(Object userIdOrUsername, Boolean hardDelete) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm().withParam("hard_delete ", hardDelete); Response.Status expectedStatus = (isApiVersion(ApiVersion.V3) ? Response.Status.OK : Response.Status.NO_CONTENT); delete(expectedStatus, formData.asMap(), "users", getUserIdOrUsername(userIdOrUsername)); }
[ "public", "void", "deleteUser", "(", "Object", "userIdOrUsername", ",", "Boolean", "hardDelete", ")", "throws", "GitLabApiException", "{", "GitLabApiForm", "formData", "=", "new", "GitLabApiForm", "(", ")", ".", "withParam", "(", "\"hard_delete \"", ",", "hardDelete", ")", ";", "Response", ".", "Status", "expectedStatus", "=", "(", "isApiVersion", "(", "ApiVersion", ".", "V3", ")", "?", "Response", ".", "Status", ".", "OK", ":", "Response", ".", "Status", ".", "NO_CONTENT", ")", ";", "delete", "(", "expectedStatus", ",", "formData", ".", "asMap", "(", ")", ",", "\"users\"", ",", "getUserIdOrUsername", "(", "userIdOrUsername", ")", ")", ";", "}" ]
Deletes a user. Available only for administrators. <pre><code>GitLab Endpoint: DELETE /users/:id</code></pre> @param userIdOrUsername the user in the form of an Integer(ID), String(username), or User instance @param hardDelete If true, contributions that would usually be moved to the ghost user will be deleted instead, as well as groups owned solely by this user @throws GitLabApiException if any exception occurs
[ "Deletes", "a", "user", ".", "Available", "only", "for", "administrators", "." ]
ab045070abac0a8f4ccbf17b5ed9bfdef5723eed
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/UserApi.java#L559-L563
train
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/UserApi.java
UserApi.getCurrentUser
public User getCurrentUser() throws GitLabApiException { Response response = get(Response.Status.OK, null, "user"); return (response.readEntity(User.class)); }
java
public User getCurrentUser() throws GitLabApiException { Response response = get(Response.Status.OK, null, "user"); return (response.readEntity(User.class)); }
[ "public", "User", "getCurrentUser", "(", ")", "throws", "GitLabApiException", "{", "Response", "response", "=", "get", "(", "Response", ".", "Status", ".", "OK", ",", "null", ",", "\"user\"", ")", ";", "return", "(", "response", ".", "readEntity", "(", "User", ".", "class", ")", ")", ";", "}" ]
Get currently authenticated user. <pre><code>GitLab Endpoint: GET /user</code></pre> @return the User instance for the currently authenticated user @throws GitLabApiException if any exception occurs
[ "Get", "currently", "authenticated", "user", "." ]
ab045070abac0a8f4ccbf17b5ed9bfdef5723eed
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/UserApi.java#L573-L576
train
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/UserApi.java
UserApi.getSshKeys
public List<SshKey> getSshKeys() throws GitLabApiException { Response response = get(Response.Status.OK, getDefaultPerPageParam(), "user", "keys"); return (response.readEntity(new GenericType<List<SshKey>>() {})); }
java
public List<SshKey> getSshKeys() throws GitLabApiException { Response response = get(Response.Status.OK, getDefaultPerPageParam(), "user", "keys"); return (response.readEntity(new GenericType<List<SshKey>>() {})); }
[ "public", "List", "<", "SshKey", ">", "getSshKeys", "(", ")", "throws", "GitLabApiException", "{", "Response", "response", "=", "get", "(", "Response", ".", "Status", ".", "OK", ",", "getDefaultPerPageParam", "(", ")", ",", "\"user\"", ",", "\"keys\"", ")", ";", "return", "(", "response", ".", "readEntity", "(", "new", "GenericType", "<", "List", "<", "SshKey", ">", ">", "(", ")", "{", "}", ")", ")", ";", "}" ]
Get a list of currently authenticated user's SSH keys. <pre><code>GitLab Endpoint: GET /user/keys</code></pre> @return a list of currently authenticated user's SSH keys @throws GitLabApiException if any exception occurs
[ "Get", "a", "list", "of", "currently", "authenticated", "user", "s", "SSH", "keys", "." ]
ab045070abac0a8f4ccbf17b5ed9bfdef5723eed
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/UserApi.java#L586-L589
train
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/UserApi.java
UserApi.getSshKeys
public List<SshKey> getSshKeys(Integer userId) throws GitLabApiException { if (userId == null) { throw new RuntimeException("userId cannot be null"); } Response response = get(Response.Status.OK, getDefaultPerPageParam(), "users", userId, "keys"); List<SshKey> keys = response.readEntity(new GenericType<List<SshKey>>() {}); if (keys != null) { keys.forEach(key -> key.setUserId(userId)); } return (keys); }
java
public List<SshKey> getSshKeys(Integer userId) throws GitLabApiException { if (userId == null) { throw new RuntimeException("userId cannot be null"); } Response response = get(Response.Status.OK, getDefaultPerPageParam(), "users", userId, "keys"); List<SshKey> keys = response.readEntity(new GenericType<List<SshKey>>() {}); if (keys != null) { keys.forEach(key -> key.setUserId(userId)); } return (keys); }
[ "public", "List", "<", "SshKey", ">", "getSshKeys", "(", "Integer", "userId", ")", "throws", "GitLabApiException", "{", "if", "(", "userId", "==", "null", ")", "{", "throw", "new", "RuntimeException", "(", "\"userId cannot be null\"", ")", ";", "}", "Response", "response", "=", "get", "(", "Response", ".", "Status", ".", "OK", ",", "getDefaultPerPageParam", "(", ")", ",", "\"users\"", ",", "userId", ",", "\"keys\"", ")", ";", "List", "<", "SshKey", ">", "keys", "=", "response", ".", "readEntity", "(", "new", "GenericType", "<", "List", "<", "SshKey", ">", ">", "(", ")", "{", "}", ")", ";", "if", "(", "keys", "!=", "null", ")", "{", "keys", ".", "forEach", "(", "key", "->", "key", ".", "setUserId", "(", "userId", ")", ")", ";", "}", "return", "(", "keys", ")", ";", "}" ]
Get a list of a specified user's SSH keys. Available only for admin users. <pre><code>GitLab Endpoint: GET /users/:id/keys</code></pre> @param userId the user ID to get the SSH keys for @return a list of a specified user's SSH keys @throws GitLabApiException if any exception occurs
[ "Get", "a", "list", "of", "a", "specified", "user", "s", "SSH", "keys", ".", "Available", "only", "for", "admin", "users", "." ]
ab045070abac0a8f4ccbf17b5ed9bfdef5723eed
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/UserApi.java#L600-L614
train
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/UserApi.java
UserApi.getSshKey
public SshKey getSshKey(Integer keyId) throws GitLabApiException { Response response = get(Response.Status.OK, null, "user", "keys", keyId); return (response.readEntity(SshKey.class)); }
java
public SshKey getSshKey(Integer keyId) throws GitLabApiException { Response response = get(Response.Status.OK, null, "user", "keys", keyId); return (response.readEntity(SshKey.class)); }
[ "public", "SshKey", "getSshKey", "(", "Integer", "keyId", ")", "throws", "GitLabApiException", "{", "Response", "response", "=", "get", "(", "Response", ".", "Status", ".", "OK", ",", "null", ",", "\"user\"", ",", "\"keys\"", ",", "keyId", ")", ";", "return", "(", "response", ".", "readEntity", "(", "SshKey", ".", "class", ")", ")", ";", "}" ]
Get a single SSH Key. <pre><code>GitLab Endpoint: GET /user/keys/:key_id</code></pre> @param keyId the ID of the SSH key. @return an SshKey instance holding the info on the SSH key specified by keyId @throws GitLabApiException if any exception occurs
[ "Get", "a", "single", "SSH", "Key", "." ]
ab045070abac0a8f4ccbf17b5ed9bfdef5723eed
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/UserApi.java#L625-L628
train
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/UserApi.java
UserApi.getOptionalSshKey
public Optional<SshKey> getOptionalSshKey(Integer keyId) { try { return (Optional.ofNullable(getSshKey(keyId))); } catch (GitLabApiException glae) { return (GitLabApi.createOptionalFromException(glae)); } }
java
public Optional<SshKey> getOptionalSshKey(Integer keyId) { try { return (Optional.ofNullable(getSshKey(keyId))); } catch (GitLabApiException glae) { return (GitLabApi.createOptionalFromException(glae)); } }
[ "public", "Optional", "<", "SshKey", ">", "getOptionalSshKey", "(", "Integer", "keyId", ")", "{", "try", "{", "return", "(", "Optional", ".", "ofNullable", "(", "getSshKey", "(", "keyId", ")", ")", ")", ";", "}", "catch", "(", "GitLabApiException", "glae", ")", "{", "return", "(", "GitLabApi", ".", "createOptionalFromException", "(", "glae", ")", ")", ";", "}", "}" ]
Get a single SSH Key as an Optional instance. <pre><code>GitLab Endpoint: GET /user/keys/:key_id</code></pre> @param keyId the ID of the SSH key @return an SshKey as an Optional instance holding the info on the SSH key specified by keyId
[ "Get", "a", "single", "SSH", "Key", "as", "an", "Optional", "instance", "." ]
ab045070abac0a8f4ccbf17b5ed9bfdef5723eed
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/UserApi.java#L638-L644
train
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/UserApi.java
UserApi.addSshKey
public SshKey addSshKey(String title, String key) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm().withParam("title", title).withParam("key", key); Response response = post(Response.Status.CREATED, formData, "user", "keys"); return (response.readEntity(SshKey.class)); }
java
public SshKey addSshKey(String title, String key) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm().withParam("title", title).withParam("key", key); Response response = post(Response.Status.CREATED, formData, "user", "keys"); return (response.readEntity(SshKey.class)); }
[ "public", "SshKey", "addSshKey", "(", "String", "title", ",", "String", "key", ")", "throws", "GitLabApiException", "{", "GitLabApiForm", "formData", "=", "new", "GitLabApiForm", "(", ")", ".", "withParam", "(", "\"title\"", ",", "title", ")", ".", "withParam", "(", "\"key\"", ",", "key", ")", ";", "Response", "response", "=", "post", "(", "Response", ".", "Status", ".", "CREATED", ",", "formData", ",", "\"user\"", ",", "\"keys\"", ")", ";", "return", "(", "response", ".", "readEntity", "(", "SshKey", ".", "class", ")", ")", ";", "}" ]
Creates a new key owned by the currently authenticated user. <pre><code>GitLab Endpoint: POST /user/keys</code></pre> @param title the new SSH Key's title @param key the new SSH key @return an SshKey instance with info on the added SSH key @throws GitLabApiException if any exception occurs
[ "Creates", "a", "new", "key", "owned", "by", "the", "currently", "authenticated", "user", "." ]
ab045070abac0a8f4ccbf17b5ed9bfdef5723eed
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/UserApi.java#L656-L660
train
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/UserApi.java
UserApi.addSshKey
public SshKey addSshKey(Integer userId, String title, String key) throws GitLabApiException { if (userId == null) { throw new RuntimeException("userId cannot be null"); } GitLabApiForm formData = new GitLabApiForm().withParam("title", title).withParam("key", key); Response response = post(Response.Status.CREATED, formData, "users", userId, "keys"); SshKey sshKey = response.readEntity(SshKey.class); if (sshKey != null) { sshKey.setUserId(userId); } return (sshKey); }
java
public SshKey addSshKey(Integer userId, String title, String key) throws GitLabApiException { if (userId == null) { throw new RuntimeException("userId cannot be null"); } GitLabApiForm formData = new GitLabApiForm().withParam("title", title).withParam("key", key); Response response = post(Response.Status.CREATED, formData, "users", userId, "keys"); SshKey sshKey = response.readEntity(SshKey.class); if (sshKey != null) { sshKey.setUserId(userId); } return (sshKey); }
[ "public", "SshKey", "addSshKey", "(", "Integer", "userId", ",", "String", "title", ",", "String", "key", ")", "throws", "GitLabApiException", "{", "if", "(", "userId", "==", "null", ")", "{", "throw", "new", "RuntimeException", "(", "\"userId cannot be null\"", ")", ";", "}", "GitLabApiForm", "formData", "=", "new", "GitLabApiForm", "(", ")", ".", "withParam", "(", "\"title\"", ",", "title", ")", ".", "withParam", "(", "\"key\"", ",", "key", ")", ";", "Response", "response", "=", "post", "(", "Response", ".", "Status", ".", "CREATED", ",", "formData", ",", "\"users\"", ",", "userId", ",", "\"keys\"", ")", ";", "SshKey", "sshKey", "=", "response", ".", "readEntity", "(", "SshKey", ".", "class", ")", ";", "if", "(", "sshKey", "!=", "null", ")", "{", "sshKey", ".", "setUserId", "(", "userId", ")", ";", "}", "return", "(", "sshKey", ")", ";", "}" ]
Create new key owned by specified user. Available only for admin users. <pre><code>GitLab Endpoint: POST /users/:id/keys</code></pre> @param userId the ID of the user to add the SSH key for @param title the new SSH Key's title @param key the new SSH key @return an SshKey instance with info on the added SSH key @throws GitLabApiException if any exception occurs
[ "Create", "new", "key", "owned", "by", "specified", "user", ".", "Available", "only", "for", "admin", "users", "." ]
ab045070abac0a8f4ccbf17b5ed9bfdef5723eed
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/UserApi.java#L673-L687
train
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/UserApi.java
UserApi.getImpersonationTokens
public List<ImpersonationToken> getImpersonationTokens(Object userIdOrUsername, ImpersonationState state) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm() .withParam("state", state) .withParam(PER_PAGE_PARAM, getDefaultPerPage()); Response response = get(Response.Status.OK, formData.asMap(), "users", getUserIdOrUsername(userIdOrUsername), "impersonation_tokens"); return (response.readEntity(new GenericType<List<ImpersonationToken>>() {})); }
java
public List<ImpersonationToken> getImpersonationTokens(Object userIdOrUsername, ImpersonationState state) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm() .withParam("state", state) .withParam(PER_PAGE_PARAM, getDefaultPerPage()); Response response = get(Response.Status.OK, formData.asMap(), "users", getUserIdOrUsername(userIdOrUsername), "impersonation_tokens"); return (response.readEntity(new GenericType<List<ImpersonationToken>>() {})); }
[ "public", "List", "<", "ImpersonationToken", ">", "getImpersonationTokens", "(", "Object", "userIdOrUsername", ",", "ImpersonationState", "state", ")", "throws", "GitLabApiException", "{", "GitLabApiForm", "formData", "=", "new", "GitLabApiForm", "(", ")", ".", "withParam", "(", "\"state\"", ",", "state", ")", ".", "withParam", "(", "PER_PAGE_PARAM", ",", "getDefaultPerPage", "(", ")", ")", ";", "Response", "response", "=", "get", "(", "Response", ".", "Status", ".", "OK", ",", "formData", ".", "asMap", "(", ")", ",", "\"users\"", ",", "getUserIdOrUsername", "(", "userIdOrUsername", ")", ",", "\"impersonation_tokens\"", ")", ";", "return", "(", "response", ".", "readEntity", "(", "new", "GenericType", "<", "List", "<", "ImpersonationToken", ">", ">", "(", ")", "{", "}", ")", ")", ";", "}" ]
Get a list of a specified user's impersonation tokens. Available only for admin users. <pre><code>GitLab Endpoint: GET /users/:id/impersonation_tokens</code></pre> @param userIdOrUsername the user in the form of an Integer(ID), String(username), or User instance @param state the state of impersonation tokens to list (ALL, ACTIVE, INACTIVE) @return a list of a specified user's impersonation tokens @throws GitLabApiException if any exception occurs
[ "Get", "a", "list", "of", "a", "specified", "user", "s", "impersonation", "tokens", ".", "Available", "only", "for", "admin", "users", "." ]
ab045070abac0a8f4ccbf17b5ed9bfdef5723eed
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/UserApi.java#L750-L756
train
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/UserApi.java
UserApi.getImpersonationToken
public ImpersonationToken getImpersonationToken(Object userIdOrUsername, Integer tokenId) throws GitLabApiException { if (tokenId == null) { throw new RuntimeException("tokenId cannot be null"); } Response response = get(Response.Status.OK, null, "users", getUserIdOrUsername(userIdOrUsername), "impersonation_tokens", tokenId); return (response.readEntity(ImpersonationToken.class)); }
java
public ImpersonationToken getImpersonationToken(Object userIdOrUsername, Integer tokenId) throws GitLabApiException { if (tokenId == null) { throw new RuntimeException("tokenId cannot be null"); } Response response = get(Response.Status.OK, null, "users", getUserIdOrUsername(userIdOrUsername), "impersonation_tokens", tokenId); return (response.readEntity(ImpersonationToken.class)); }
[ "public", "ImpersonationToken", "getImpersonationToken", "(", "Object", "userIdOrUsername", ",", "Integer", "tokenId", ")", "throws", "GitLabApiException", "{", "if", "(", "tokenId", "==", "null", ")", "{", "throw", "new", "RuntimeException", "(", "\"tokenId cannot be null\"", ")", ";", "}", "Response", "response", "=", "get", "(", "Response", ".", "Status", ".", "OK", ",", "null", ",", "\"users\"", ",", "getUserIdOrUsername", "(", "userIdOrUsername", ")", ",", "\"impersonation_tokens\"", ",", "tokenId", ")", ";", "return", "(", "response", ".", "readEntity", "(", "ImpersonationToken", ".", "class", ")", ")", ";", "}" ]
Get an impersonation token of a user. Available only for admin users. <pre><code>GitLab Endpoint: GET /users/:user_id/impersonation_tokens/:impersonation_token_id</code></pre> @param userIdOrUsername the user in the form of an Integer(ID), String(username), or User instance @param tokenId the impersonation token ID to get @return the specified impersonation token @throws GitLabApiException if any exception occurs
[ "Get", "an", "impersonation", "token", "of", "a", "user", ".", "Available", "only", "for", "admin", "users", "." ]
ab045070abac0a8f4ccbf17b5ed9bfdef5723eed
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/UserApi.java#L768-L776
train
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/UserApi.java
UserApi.getOptionalImpersonationToken
public Optional<ImpersonationToken> getOptionalImpersonationToken(Object userIdOrUsername, Integer tokenId) { try { return (Optional.ofNullable(getImpersonationToken(userIdOrUsername, tokenId))); } catch (GitLabApiException glae) { return (GitLabApi.createOptionalFromException(glae)); } }
java
public Optional<ImpersonationToken> getOptionalImpersonationToken(Object userIdOrUsername, Integer tokenId) { try { return (Optional.ofNullable(getImpersonationToken(userIdOrUsername, tokenId))); } catch (GitLabApiException glae) { return (GitLabApi.createOptionalFromException(glae)); } }
[ "public", "Optional", "<", "ImpersonationToken", ">", "getOptionalImpersonationToken", "(", "Object", "userIdOrUsername", ",", "Integer", "tokenId", ")", "{", "try", "{", "return", "(", "Optional", ".", "ofNullable", "(", "getImpersonationToken", "(", "userIdOrUsername", ",", "tokenId", ")", ")", ")", ";", "}", "catch", "(", "GitLabApiException", "glae", ")", "{", "return", "(", "GitLabApi", ".", "createOptionalFromException", "(", "glae", ")", ")", ";", "}", "}" ]
Get an impersonation token of a user as an Optional instance. Available only for admin users. <pre><code>GitLab Endpoint: GET /users/:user_id/impersonation_tokens/:impersonation_token_id</code></pre> @param userIdOrUsername the user in the form of an Integer(ID), String(username), or User instance @param tokenId the impersonation token ID to get @return the specified impersonation token as an Optional instance
[ "Get", "an", "impersonation", "token", "of", "a", "user", "as", "an", "Optional", "instance", ".", "Available", "only", "for", "admin", "users", "." ]
ab045070abac0a8f4ccbf17b5ed9bfdef5723eed
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/UserApi.java#L787-L793
train
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/UserApi.java
UserApi.createImpersonationToken
public ImpersonationToken createImpersonationToken(Object userIdOrUsername, String name, Date expiresAt, Scope[] scopes) throws GitLabApiException { if (scopes == null || scopes.length == 0) { throw new RuntimeException("scopes cannot be null or empty"); } GitLabApiForm formData = new GitLabApiForm() .withParam("name", name, true) .withParam("expires_at", expiresAt); for (Scope scope : scopes) { formData.withParam("scopes[]", scope.toString()); } Response response = post(Response.Status.CREATED, formData, "users", getUserIdOrUsername(userIdOrUsername), "impersonation_tokens"); return (response.readEntity(ImpersonationToken.class)); }
java
public ImpersonationToken createImpersonationToken(Object userIdOrUsername, String name, Date expiresAt, Scope[] scopes) throws GitLabApiException { if (scopes == null || scopes.length == 0) { throw new RuntimeException("scopes cannot be null or empty"); } GitLabApiForm formData = new GitLabApiForm() .withParam("name", name, true) .withParam("expires_at", expiresAt); for (Scope scope : scopes) { formData.withParam("scopes[]", scope.toString()); } Response response = post(Response.Status.CREATED, formData, "users", getUserIdOrUsername(userIdOrUsername), "impersonation_tokens"); return (response.readEntity(ImpersonationToken.class)); }
[ "public", "ImpersonationToken", "createImpersonationToken", "(", "Object", "userIdOrUsername", ",", "String", "name", ",", "Date", "expiresAt", ",", "Scope", "[", "]", "scopes", ")", "throws", "GitLabApiException", "{", "if", "(", "scopes", "==", "null", "||", "scopes", ".", "length", "==", "0", ")", "{", "throw", "new", "RuntimeException", "(", "\"scopes cannot be null or empty\"", ")", ";", "}", "GitLabApiForm", "formData", "=", "new", "GitLabApiForm", "(", ")", ".", "withParam", "(", "\"name\"", ",", "name", ",", "true", ")", ".", "withParam", "(", "\"expires_at\"", ",", "expiresAt", ")", ";", "for", "(", "Scope", "scope", ":", "scopes", ")", "{", "formData", ".", "withParam", "(", "\"scopes[]\"", ",", "scope", ".", "toString", "(", ")", ")", ";", "}", "Response", "response", "=", "post", "(", "Response", ".", "Status", ".", "CREATED", ",", "formData", ",", "\"users\"", ",", "getUserIdOrUsername", "(", "userIdOrUsername", ")", ",", "\"impersonation_tokens\"", ")", ";", "return", "(", "response", ".", "readEntity", "(", "ImpersonationToken", ".", "class", ")", ")", ";", "}" ]
Create an impersonation token. Available only for admin users. <pre><code>GitLab Endpoint: POST /users/:user_id/impersonation_tokens</code></pre> @param userIdOrUsername the user in the form of an Integer(ID), String(username), or User instance @param name the name of the impersonation token, required @param expiresAt the expiration date of the impersonation token, optional @param scopes an array of scopes of the impersonation token @return the created ImpersonationToken instance @throws GitLabApiException if any exception occurs
[ "Create", "an", "impersonation", "token", ".", "Available", "only", "for", "admin", "users", "." ]
ab045070abac0a8f4ccbf17b5ed9bfdef5723eed
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/UserApi.java#L807-L823
train
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/UserApi.java
UserApi.revokeImpersonationToken
public void revokeImpersonationToken(Object userIdOrUsername, Integer tokenId) throws GitLabApiException { if (tokenId == null) { throw new RuntimeException("tokenId cannot be null"); } Response.Status expectedStatus = (isApiVersion(ApiVersion.V3) ? Response.Status.OK : Response.Status.NO_CONTENT); delete(expectedStatus, null, "users", getUserIdOrUsername(userIdOrUsername), "impersonation_tokens", tokenId); }
java
public void revokeImpersonationToken(Object userIdOrUsername, Integer tokenId) throws GitLabApiException { if (tokenId == null) { throw new RuntimeException("tokenId cannot be null"); } Response.Status expectedStatus = (isApiVersion(ApiVersion.V3) ? Response.Status.OK : Response.Status.NO_CONTENT); delete(expectedStatus, null, "users", getUserIdOrUsername(userIdOrUsername), "impersonation_tokens", tokenId); }
[ "public", "void", "revokeImpersonationToken", "(", "Object", "userIdOrUsername", ",", "Integer", "tokenId", ")", "throws", "GitLabApiException", "{", "if", "(", "tokenId", "==", "null", ")", "{", "throw", "new", "RuntimeException", "(", "\"tokenId cannot be null\"", ")", ";", "}", "Response", ".", "Status", "expectedStatus", "=", "(", "isApiVersion", "(", "ApiVersion", ".", "V3", ")", "?", "Response", ".", "Status", ".", "OK", ":", "Response", ".", "Status", ".", "NO_CONTENT", ")", ";", "delete", "(", "expectedStatus", ",", "null", ",", "\"users\"", ",", "getUserIdOrUsername", "(", "userIdOrUsername", ")", ",", "\"impersonation_tokens\"", ",", "tokenId", ")", ";", "}" ]
Revokes an impersonation token. Available only for admin users. <pre><code>GitLab Endpoint: DELETE /users/:user_id/impersonation_tokens/:impersonation_token_id</code></pre> @param userIdOrUsername the user in the form of an Integer(ID), String(username), or User instance @param tokenId the impersonation token ID to revoke @throws GitLabApiException if any exception occurs
[ "Revokes", "an", "impersonation", "token", ".", "Available", "only", "for", "admin", "users", "." ]
ab045070abac0a8f4ccbf17b5ed9bfdef5723eed
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/UserApi.java#L834-L842
train
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/UserApi.java
UserApi.userToForm
Form userToForm(User user, Integer projectsLimit, CharSequence password, Boolean resetPassword, boolean create) { if (create) { if ((password == null || password.toString().trim().isEmpty()) && !resetPassword) { throw new IllegalArgumentException("either password or reset_password must be set"); } } projectsLimit = (projectsLimit == null) ? user.getProjectsLimit() : projectsLimit; String skipConfirmationFeildName = create ? "skip_confirmation" : "skip_reconfirmation"; return (new GitLabApiForm() .withParam("email", user.getEmail(), create) .withParam("password", password, false) .withParam("reset_password", resetPassword, false) .withParam("username", user.getUsername(), create) .withParam("name", user.getName(), create) .withParam("skype", user.getSkype(), false) .withParam("linkedin", user.getLinkedin(), false) .withParam("twitter", user.getTwitter(), false) .withParam("website_url", user.getWebsiteUrl(), false) .withParam("organization", user.getOrganization(), false) .withParam("projects_limit", projectsLimit, false) .withParam("extern_uid", user.getExternUid(), false) .withParam("provider", user.getProvider(), false) .withParam("bio", user.getBio(), false) .withParam("location", user.getLocation(), false) .withParam("admin", user.getIsAdmin(), false) .withParam("can_create_group", user.getCanCreateGroup(), false) .withParam(skipConfirmationFeildName, user.getSkipConfirmation(), false) .withParam("external", user.getExternal(), false) .withParam("shared_runners_minutes_limit", user.getSharedRunnersMinutesLimit(), false)); }
java
Form userToForm(User user, Integer projectsLimit, CharSequence password, Boolean resetPassword, boolean create) { if (create) { if ((password == null || password.toString().trim().isEmpty()) && !resetPassword) { throw new IllegalArgumentException("either password or reset_password must be set"); } } projectsLimit = (projectsLimit == null) ? user.getProjectsLimit() : projectsLimit; String skipConfirmationFeildName = create ? "skip_confirmation" : "skip_reconfirmation"; return (new GitLabApiForm() .withParam("email", user.getEmail(), create) .withParam("password", password, false) .withParam("reset_password", resetPassword, false) .withParam("username", user.getUsername(), create) .withParam("name", user.getName(), create) .withParam("skype", user.getSkype(), false) .withParam("linkedin", user.getLinkedin(), false) .withParam("twitter", user.getTwitter(), false) .withParam("website_url", user.getWebsiteUrl(), false) .withParam("organization", user.getOrganization(), false) .withParam("projects_limit", projectsLimit, false) .withParam("extern_uid", user.getExternUid(), false) .withParam("provider", user.getProvider(), false) .withParam("bio", user.getBio(), false) .withParam("location", user.getLocation(), false) .withParam("admin", user.getIsAdmin(), false) .withParam("can_create_group", user.getCanCreateGroup(), false) .withParam(skipConfirmationFeildName, user.getSkipConfirmation(), false) .withParam("external", user.getExternal(), false) .withParam("shared_runners_minutes_limit", user.getSharedRunnersMinutesLimit(), false)); }
[ "Form", "userToForm", "(", "User", "user", ",", "Integer", "projectsLimit", ",", "CharSequence", "password", ",", "Boolean", "resetPassword", ",", "boolean", "create", ")", "{", "if", "(", "create", ")", "{", "if", "(", "(", "password", "==", "null", "||", "password", ".", "toString", "(", ")", ".", "trim", "(", ")", ".", "isEmpty", "(", ")", ")", "&&", "!", "resetPassword", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"either password or reset_password must be set\"", ")", ";", "}", "}", "projectsLimit", "=", "(", "projectsLimit", "==", "null", ")", "?", "user", ".", "getProjectsLimit", "(", ")", ":", "projectsLimit", ";", "String", "skipConfirmationFeildName", "=", "create", "?", "\"skip_confirmation\"", ":", "\"skip_reconfirmation\"", ";", "return", "(", "new", "GitLabApiForm", "(", ")", ".", "withParam", "(", "\"email\"", ",", "user", ".", "getEmail", "(", ")", ",", "create", ")", ".", "withParam", "(", "\"password\"", ",", "password", ",", "false", ")", ".", "withParam", "(", "\"reset_password\"", ",", "resetPassword", ",", "false", ")", ".", "withParam", "(", "\"username\"", ",", "user", ".", "getUsername", "(", ")", ",", "create", ")", ".", "withParam", "(", "\"name\"", ",", "user", ".", "getName", "(", ")", ",", "create", ")", ".", "withParam", "(", "\"skype\"", ",", "user", ".", "getSkype", "(", ")", ",", "false", ")", ".", "withParam", "(", "\"linkedin\"", ",", "user", ".", "getLinkedin", "(", ")", ",", "false", ")", ".", "withParam", "(", "\"twitter\"", ",", "user", ".", "getTwitter", "(", ")", ",", "false", ")", ".", "withParam", "(", "\"website_url\"", ",", "user", ".", "getWebsiteUrl", "(", ")", ",", "false", ")", ".", "withParam", "(", "\"organization\"", ",", "user", ".", "getOrganization", "(", ")", ",", "false", ")", ".", "withParam", "(", "\"projects_limit\"", ",", "projectsLimit", ",", "false", ")", ".", "withParam", "(", "\"extern_uid\"", ",", "user", ".", "getExternUid", "(", ")", ",", "false", ")", ".", "withParam", "(", "\"provider\"", ",", "user", ".", "getProvider", "(", ")", ",", "false", ")", ".", "withParam", "(", "\"bio\"", ",", "user", ".", "getBio", "(", ")", ",", "false", ")", ".", "withParam", "(", "\"location\"", ",", "user", ".", "getLocation", "(", ")", ",", "false", ")", ".", "withParam", "(", "\"admin\"", ",", "user", ".", "getIsAdmin", "(", ")", ",", "false", ")", ".", "withParam", "(", "\"can_create_group\"", ",", "user", ".", "getCanCreateGroup", "(", ")", ",", "false", ")", ".", "withParam", "(", "skipConfirmationFeildName", ",", "user", ".", "getSkipConfirmation", "(", ")", ",", "false", ")", ".", "withParam", "(", "\"external\"", ",", "user", ".", "getExternal", "(", ")", ",", "false", ")", ".", "withParam", "(", "\"shared_runners_minutes_limit\"", ",", "user", ".", "getSharedRunnersMinutesLimit", "(", ")", ",", "false", ")", ")", ";", "}" ]
Populate the REST form with data from the User instance. @param user the User instance to populate the Form instance with @param projectsLimit the maximum number of projects the user is allowed (optional) @param password the password, required when creating a new user @param create whether the form is being populated to create a new user @return the populated Form instance
[ "Populate", "the", "REST", "form", "with", "data", "from", "the", "User", "instance", "." ]
ab045070abac0a8f4ccbf17b5ed9bfdef5723eed
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/UserApi.java#L853-L885
train
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/UserApi.java
UserApi.createCustomAttribute
public CustomAttribute createCustomAttribute(final Object userIdOrUsername, final String key, final String value) throws GitLabApiException { if (Objects.isNull(key) || key.trim().isEmpty()) { throw new IllegalArgumentException("Key can't be null or empty"); } if (Objects.isNull(value) || value.trim().isEmpty()) { throw new IllegalArgumentException("Value can't be null or empty"); } GitLabApiForm formData = new GitLabApiForm().withParam("value", value); Response response = put(Response.Status.OK, formData.asMap(), "users", getUserIdOrUsername(userIdOrUsername), "custom_attributes", key); return (response.readEntity(CustomAttribute.class)); }
java
public CustomAttribute createCustomAttribute(final Object userIdOrUsername, final String key, final String value) throws GitLabApiException { if (Objects.isNull(key) || key.trim().isEmpty()) { throw new IllegalArgumentException("Key can't be null or empty"); } if (Objects.isNull(value) || value.trim().isEmpty()) { throw new IllegalArgumentException("Value can't be null or empty"); } GitLabApiForm formData = new GitLabApiForm().withParam("value", value); Response response = put(Response.Status.OK, formData.asMap(), "users", getUserIdOrUsername(userIdOrUsername), "custom_attributes", key); return (response.readEntity(CustomAttribute.class)); }
[ "public", "CustomAttribute", "createCustomAttribute", "(", "final", "Object", "userIdOrUsername", ",", "final", "String", "key", ",", "final", "String", "value", ")", "throws", "GitLabApiException", "{", "if", "(", "Objects", ".", "isNull", "(", "key", ")", "||", "key", ".", "trim", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Key can't be null or empty\"", ")", ";", "}", "if", "(", "Objects", ".", "isNull", "(", "value", ")", "||", "value", ".", "trim", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Value can't be null or empty\"", ")", ";", "}", "GitLabApiForm", "formData", "=", "new", "GitLabApiForm", "(", ")", ".", "withParam", "(", "\"value\"", ",", "value", ")", ";", "Response", "response", "=", "put", "(", "Response", ".", "Status", ".", "OK", ",", "formData", ".", "asMap", "(", ")", ",", "\"users\"", ",", "getUserIdOrUsername", "(", "userIdOrUsername", ")", ",", "\"custom_attributes\"", ",", "key", ")", ";", "return", "(", "response", ".", "readEntity", "(", "CustomAttribute", ".", "class", ")", ")", ";", "}" ]
Creates custom attribute for the given user @param userIdOrUsername the user in the form of an Integer(ID), String(username), or User instance @param key for the customAttribute @param value or the customAttribute @return the created CustomAttribute @throws GitLabApiException on failure while setting customAttributes
[ "Creates", "custom", "attribute", "for", "the", "given", "user" ]
ab045070abac0a8f4ccbf17b5ed9bfdef5723eed
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/UserApi.java#L911-L924
train
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/UserApi.java
UserApi.changeCustomAttribute
public CustomAttribute changeCustomAttribute(final Object userIdOrUsername, final CustomAttribute customAttribute) throws GitLabApiException { if (Objects.isNull(customAttribute)) { throw new IllegalArgumentException("CustomAttributes can't be null"); } //changing & creating custom attributes is the same call in gitlab api // -> https://docs.gitlab.com/ce/api/custom_attributes.html#set-custom-attribute return createCustomAttribute(userIdOrUsername, customAttribute.getKey(), customAttribute.getValue()); }
java
public CustomAttribute changeCustomAttribute(final Object userIdOrUsername, final CustomAttribute customAttribute) throws GitLabApiException { if (Objects.isNull(customAttribute)) { throw new IllegalArgumentException("CustomAttributes can't be null"); } //changing & creating custom attributes is the same call in gitlab api // -> https://docs.gitlab.com/ce/api/custom_attributes.html#set-custom-attribute return createCustomAttribute(userIdOrUsername, customAttribute.getKey(), customAttribute.getValue()); }
[ "public", "CustomAttribute", "changeCustomAttribute", "(", "final", "Object", "userIdOrUsername", ",", "final", "CustomAttribute", "customAttribute", ")", "throws", "GitLabApiException", "{", "if", "(", "Objects", ".", "isNull", "(", "customAttribute", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"CustomAttributes can't be null\"", ")", ";", "}", "//changing & creating custom attributes is the same call in gitlab api", "// -> https://docs.gitlab.com/ce/api/custom_attributes.html#set-custom-attribute", "return", "createCustomAttribute", "(", "userIdOrUsername", ",", "customAttribute", ".", "getKey", "(", ")", ",", "customAttribute", ".", "getValue", "(", ")", ")", ";", "}" ]
Change custom attribute for the given user @param userIdOrUsername the user in the form of an Integer(ID), String(username), or User instance @param customAttribute the custome attribute to change @return the changed CustomAttribute @throws GitLabApiException on failure while changing customAttributes
[ "Change", "custom", "attribute", "for", "the", "given", "user" ]
ab045070abac0a8f4ccbf17b5ed9bfdef5723eed
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/UserApi.java#L934-L943
train
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/UserApi.java
UserApi.changeCustomAttribute
public CustomAttribute changeCustomAttribute(final Object userIdOrUsername, final String key, final String value) throws GitLabApiException { return createCustomAttribute(userIdOrUsername, key, value); }
java
public CustomAttribute changeCustomAttribute(final Object userIdOrUsername, final String key, final String value) throws GitLabApiException { return createCustomAttribute(userIdOrUsername, key, value); }
[ "public", "CustomAttribute", "changeCustomAttribute", "(", "final", "Object", "userIdOrUsername", ",", "final", "String", "key", ",", "final", "String", "value", ")", "throws", "GitLabApiException", "{", "return", "createCustomAttribute", "(", "userIdOrUsername", ",", "key", ",", "value", ")", ";", "}" ]
Changes custom attribute for the given user @param userIdOrUsername the user in the form of an Integer(ID), String(username), or User instance @param key for the customAttribute @param value for the customAttribute @return changedCustomAttribute @throws GitLabApiException on failure while changing customAttributes
[ "Changes", "custom", "attribute", "for", "the", "given", "user" ]
ab045070abac0a8f4ccbf17b5ed9bfdef5723eed
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/UserApi.java#L954-L956
train
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/UserApi.java
UserApi.createGitLabApiForm
private GitLabApiForm createGitLabApiForm() { GitLabApiForm formData = new GitLabApiForm(); return (customAttributesEnabled ? formData.withParam("with_custom_attributes", true) : formData); }
java
private GitLabApiForm createGitLabApiForm() { GitLabApiForm formData = new GitLabApiForm(); return (customAttributesEnabled ? formData.withParam("with_custom_attributes", true) : formData); }
[ "private", "GitLabApiForm", "createGitLabApiForm", "(", ")", "{", "GitLabApiForm", "formData", "=", "new", "GitLabApiForm", "(", ")", ";", "return", "(", "customAttributesEnabled", "?", "formData", ".", "withParam", "(", "\"with_custom_attributes\"", ",", "true", ")", ":", "formData", ")", ";", "}" ]
Creates a GitLabApiForm instance that will optionally include the with_custom_attributes query param if enabled. @return a GitLabApiForm instance that will optionally include the with_custom_attributes query param if enabled
[ "Creates", "a", "GitLabApiForm", "instance", "that", "will", "optionally", "include", "the", "with_custom_attributes", "query", "param", "if", "enabled", "." ]
ab045070abac0a8f4ccbf17b5ed9bfdef5723eed
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/UserApi.java#L996-L999
train
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/UserApi.java
UserApi.setUserAvatar
public User setUserAvatar(final Object userIdOrUsername, File avatarFile) throws GitLabApiException { Response response = putUpload(Response.Status.OK, "avatar", avatarFile, "users", getUserIdOrUsername(userIdOrUsername)); return (response.readEntity(User.class)); }
java
public User setUserAvatar(final Object userIdOrUsername, File avatarFile) throws GitLabApiException { Response response = putUpload(Response.Status.OK, "avatar", avatarFile, "users", getUserIdOrUsername(userIdOrUsername)); return (response.readEntity(User.class)); }
[ "public", "User", "setUserAvatar", "(", "final", "Object", "userIdOrUsername", ",", "File", "avatarFile", ")", "throws", "GitLabApiException", "{", "Response", "response", "=", "putUpload", "(", "Response", ".", "Status", ".", "OK", ",", "\"avatar\"", ",", "avatarFile", ",", "\"users\"", ",", "getUserIdOrUsername", "(", "userIdOrUsername", ")", ")", ";", "return", "(", "response", ".", "readEntity", "(", "User", ".", "class", ")", ")", ";", "}" ]
Uploads and sets the user's avatar for the specified user. <pre><code>PUT /users/:id</code></pre> @param userIdOrUsername the user in the form of an Integer(ID), String(username), or User instance @param avatarFile the File instance of the avatar file to upload @return the updated User instance @throws GitLabApiException if any exception occurs
[ "Uploads", "and", "sets", "the", "user", "s", "avatar", "for", "the", "specified", "user", "." ]
ab045070abac0a8f4ccbf17b5ed9bfdef5723eed
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/UserApi.java#L1011-L1014
train
javers/javers
javers-core/src/main/java/org/javers/core/graph/LiveGraphFactory.java
LiveGraphFactory.convertToObjectArray
private static Object[] convertToObjectArray(Object obj) { if (obj instanceof Object[]) { return (Object[]) obj; } int arrayLength = Array.getLength(obj); Object[] retArray = new Object[arrayLength]; for (int i = 0; i < arrayLength; ++i){ retArray[i] = Array.get(obj, i); } return retArray; }
java
private static Object[] convertToObjectArray(Object obj) { if (obj instanceof Object[]) { return (Object[]) obj; } int arrayLength = Array.getLength(obj); Object[] retArray = new Object[arrayLength]; for (int i = 0; i < arrayLength; ++i){ retArray[i] = Array.get(obj, i); } return retArray; }
[ "private", "static", "Object", "[", "]", "convertToObjectArray", "(", "Object", "obj", ")", "{", "if", "(", "obj", "instanceof", "Object", "[", "]", ")", "{", "return", "(", "Object", "[", "]", ")", "obj", ";", "}", "int", "arrayLength", "=", "Array", ".", "getLength", "(", "obj", ")", ";", "Object", "[", "]", "retArray", "=", "new", "Object", "[", "arrayLength", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "arrayLength", ";", "++", "i", ")", "{", "retArray", "[", "i", "]", "=", "Array", ".", "get", "(", "obj", ",", "i", ")", ";", "}", "return", "retArray", ";", "}" ]
as there seems be no legal way for casting
[ "as", "there", "seems", "be", "no", "legal", "way", "for", "casting" ]
a51511be7d8bcee3e1812db8b7e69a45330b4e14
https://github.com/javers/javers/blob/a51511be7d8bcee3e1812db8b7e69a45330b4e14/javers-core/src/main/java/org/javers/core/graph/LiveGraphFactory.java#L119-L129
train
javers/javers
javers-core/src/main/java/org/javers/common/properties/PropertiesUtil.java
PropertiesUtil.loadProperties
public static void loadProperties(String classpathName, Properties toProps) { Validate.argumentIsNotNull(classpathName); Validate.argumentIsNotNull(toProps); InputStream inputStream = PropertiesUtil.class.getClassLoader().getResourceAsStream(classpathName); if (inputStream == null) { throw new JaversException(CLASSPATH_RESOURCE_NOT_FOUND, classpathName); } try { toProps.load(inputStream); } catch (IOException e) { throw new RuntimeException(e); } }
java
public static void loadProperties(String classpathName, Properties toProps) { Validate.argumentIsNotNull(classpathName); Validate.argumentIsNotNull(toProps); InputStream inputStream = PropertiesUtil.class.getClassLoader().getResourceAsStream(classpathName); if (inputStream == null) { throw new JaversException(CLASSPATH_RESOURCE_NOT_FOUND, classpathName); } try { toProps.load(inputStream); } catch (IOException e) { throw new RuntimeException(e); } }
[ "public", "static", "void", "loadProperties", "(", "String", "classpathName", ",", "Properties", "toProps", ")", "{", "Validate", ".", "argumentIsNotNull", "(", "classpathName", ")", ";", "Validate", ".", "argumentIsNotNull", "(", "toProps", ")", ";", "InputStream", "inputStream", "=", "PropertiesUtil", ".", "class", ".", "getClassLoader", "(", ")", ".", "getResourceAsStream", "(", "classpathName", ")", ";", "if", "(", "inputStream", "==", "null", ")", "{", "throw", "new", "JaversException", "(", "CLASSPATH_RESOURCE_NOT_FOUND", ",", "classpathName", ")", ";", "}", "try", "{", "toProps", ".", "load", "(", "inputStream", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "}" ]
loads a properties file from classpath using default classloader @param classpathName classpath resource name @throws JaversException CLASSPATH_RESOURCE_NOT_FOUND @see ClassLoader#getResourceAsStream(String)
[ "loads", "a", "properties", "file", "from", "classpath", "using", "default", "classloader" ]
a51511be7d8bcee3e1812db8b7e69a45330b4e14
https://github.com/javers/javers/blob/a51511be7d8bcee3e1812db8b7e69a45330b4e14/javers-core/src/main/java/org/javers/common/properties/PropertiesUtil.java#L71-L86
train
javers/javers
javers-core/src/main/java/org/javers/guava/MultimapChangeAppender.java
MultimapChangeAppender.difference
private static Collection difference(Collection first, Collection second){ if (first == null) { return EMPTY_LIST; } if (second == null) { return first; } Collection difference = new ArrayList<>(first); for (Object current : second){ difference.remove(current); } return difference; }
java
private static Collection difference(Collection first, Collection second){ if (first == null) { return EMPTY_LIST; } if (second == null) { return first; } Collection difference = new ArrayList<>(first); for (Object current : second){ difference.remove(current); } return difference; }
[ "private", "static", "Collection", "difference", "(", "Collection", "first", ",", "Collection", "second", ")", "{", "if", "(", "first", "==", "null", ")", "{", "return", "EMPTY_LIST", ";", "}", "if", "(", "second", "==", "null", ")", "{", "return", "first", ";", "}", "Collection", "difference", "=", "new", "ArrayList", "<>", "(", "first", ")", ";", "for", "(", "Object", "current", ":", "second", ")", "{", "difference", ".", "remove", "(", "current", ")", ";", "}", "return", "difference", ";", "}" ]
Difference that handle properly collections with duplicates.
[ "Difference", "that", "handle", "properly", "collections", "with", "duplicates", "." ]
a51511be7d8bcee3e1812db8b7e69a45330b4e14
https://github.com/javers/javers/blob/a51511be7d8bcee3e1812db8b7e69a45330b4e14/javers-core/src/main/java/org/javers/guava/MultimapChangeAppender.java#L91-L105
train
javers/javers
javers-core/src/main/java/org/javers/repository/api/JaversExtendedRepository.java
JaversExtendedRepository.getHistoricals
public List<CdoSnapshot> getHistoricals(GlobalId globalId, CommitId timePoint, boolean withChildValueObjects, int limit) { argumentsAreNotNull(globalId, timePoint); return delegate.getStateHistory(globalId, QueryParamsBuilder .withLimit(limit) .withChildValueObjects(withChildValueObjects) .toCommitId(timePoint).build()); }
java
public List<CdoSnapshot> getHistoricals(GlobalId globalId, CommitId timePoint, boolean withChildValueObjects, int limit) { argumentsAreNotNull(globalId, timePoint); return delegate.getStateHistory(globalId, QueryParamsBuilder .withLimit(limit) .withChildValueObjects(withChildValueObjects) .toCommitId(timePoint).build()); }
[ "public", "List", "<", "CdoSnapshot", ">", "getHistoricals", "(", "GlobalId", "globalId", ",", "CommitId", "timePoint", ",", "boolean", "withChildValueObjects", ",", "int", "limit", ")", "{", "argumentsAreNotNull", "(", "globalId", ",", "timePoint", ")", ";", "return", "delegate", ".", "getStateHistory", "(", "globalId", ",", "QueryParamsBuilder", ".", "withLimit", "(", "limit", ")", ".", "withChildValueObjects", "(", "withChildValueObjects", ")", ".", "toCommitId", "(", "timePoint", ")", ".", "build", "(", ")", ")", ";", "}" ]
last snapshot with commitId <= given timePoint
[ "last", "snapshot", "with", "commitId", "<", "=", "given", "timePoint" ]
a51511be7d8bcee3e1812db8b7e69a45330b4e14
https://github.com/javers/javers/blob/a51511be7d8bcee3e1812db8b7e69a45330b4e14/javers-core/src/main/java/org/javers/repository/api/JaversExtendedRepository.java#L104-L111
train
javers/javers
javers-core/src/main/java/org/javers/repository/api/JaversExtendedRepository.java
JaversExtendedRepository.getHistorical
public Optional<CdoSnapshot> getHistorical(GlobalId globalId, LocalDateTime timePoint) { argumentsAreNotNull(globalId, timePoint); return delegate.getStateHistory(globalId, QueryParamsBuilder.withLimit(1).to(timePoint).build()) .stream().findFirst(); }
java
public Optional<CdoSnapshot> getHistorical(GlobalId globalId, LocalDateTime timePoint) { argumentsAreNotNull(globalId, timePoint); return delegate.getStateHistory(globalId, QueryParamsBuilder.withLimit(1).to(timePoint).build()) .stream().findFirst(); }
[ "public", "Optional", "<", "CdoSnapshot", ">", "getHistorical", "(", "GlobalId", "globalId", ",", "LocalDateTime", "timePoint", ")", "{", "argumentsAreNotNull", "(", "globalId", ",", "timePoint", ")", ";", "return", "delegate", ".", "getStateHistory", "(", "globalId", ",", "QueryParamsBuilder", ".", "withLimit", "(", "1", ")", ".", "to", "(", "timePoint", ")", ".", "build", "(", ")", ")", ".", "stream", "(", ")", ".", "findFirst", "(", ")", ";", "}" ]
last snapshot with commitId <= given date
[ "last", "snapshot", "with", "commitId", "<", "=", "given", "date" ]
a51511be7d8bcee3e1812db8b7e69a45330b4e14
https://github.com/javers/javers/blob/a51511be7d8bcee3e1812db8b7e69a45330b4e14/javers-core/src/main/java/org/javers/repository/api/JaversExtendedRepository.java#L116-L121
train
javers/javers
javers-core/src/main/java/org/javers/repository/api/JaversExtendedRepository.java
JaversExtendedRepository.loadMasterEntitySnapshotIfNecessary
private List<CdoSnapshot> loadMasterEntitySnapshotIfNecessary(InstanceId instanceId, List<CdoSnapshot> alreadyLoaded) { if (alreadyLoaded.isEmpty()) { return alreadyLoaded; } if (alreadyLoaded.stream().filter(s -> s.getGlobalId().equals(instanceId)).findFirst().isPresent()) { return alreadyLoaded; } return getLatest(instanceId).map(it -> { List<CdoSnapshot> enhanced = new ArrayList(alreadyLoaded); enhanced.add(it); return java.util.Collections.unmodifiableList(enhanced); }).orElse(alreadyLoaded); }
java
private List<CdoSnapshot> loadMasterEntitySnapshotIfNecessary(InstanceId instanceId, List<CdoSnapshot> alreadyLoaded) { if (alreadyLoaded.isEmpty()) { return alreadyLoaded; } if (alreadyLoaded.stream().filter(s -> s.getGlobalId().equals(instanceId)).findFirst().isPresent()) { return alreadyLoaded; } return getLatest(instanceId).map(it -> { List<CdoSnapshot> enhanced = new ArrayList(alreadyLoaded); enhanced.add(it); return java.util.Collections.unmodifiableList(enhanced); }).orElse(alreadyLoaded); }
[ "private", "List", "<", "CdoSnapshot", ">", "loadMasterEntitySnapshotIfNecessary", "(", "InstanceId", "instanceId", ",", "List", "<", "CdoSnapshot", ">", "alreadyLoaded", ")", "{", "if", "(", "alreadyLoaded", ".", "isEmpty", "(", ")", ")", "{", "return", "alreadyLoaded", ";", "}", "if", "(", "alreadyLoaded", ".", "stream", "(", ")", ".", "filter", "(", "s", "->", "s", ".", "getGlobalId", "(", ")", ".", "equals", "(", "instanceId", ")", ")", ".", "findFirst", "(", ")", ".", "isPresent", "(", ")", ")", "{", "return", "alreadyLoaded", ";", "}", "return", "getLatest", "(", "instanceId", ")", ".", "map", "(", "it", "->", "{", "List", "<", "CdoSnapshot", ">", "enhanced", "=", "new", "ArrayList", "(", "alreadyLoaded", ")", ";", "enhanced", ".", "add", "(", "it", ")", ";", "return", "java", ".", "util", ".", "Collections", ".", "unmodifiableList", "(", "enhanced", ")", ";", "}", ")", ".", "orElse", "(", "alreadyLoaded", ")", ";", "}" ]
required for the corner case, when valueObject snapshots consume all the limit
[ "required", "for", "the", "corner", "case", "when", "valueObject", "snapshots", "consume", "all", "the", "limit" ]
a51511be7d8bcee3e1812db8b7e69a45330b4e14
https://github.com/javers/javers/blob/a51511be7d8bcee3e1812db8b7e69a45330b4e14/javers-core/src/main/java/org/javers/repository/api/JaversExtendedRepository.java#L189-L203
train
javers/javers
javers-persistence-sql/src/main/java/org/javers/repository/sql/SqlRepositoryBuilder.java
SqlRepositoryBuilder.withSchema
public SqlRepositoryBuilder withSchema(String schemaName) { if (schemaName != null && !schemaName.isEmpty()) { this.schemaName = schemaName; } return this; }
java
public SqlRepositoryBuilder withSchema(String schemaName) { if (schemaName != null && !schemaName.isEmpty()) { this.schemaName = schemaName; } return this; }
[ "public", "SqlRepositoryBuilder", "withSchema", "(", "String", "schemaName", ")", "{", "if", "(", "schemaName", "!=", "null", "&&", "!", "schemaName", ".", "isEmpty", "(", ")", ")", "{", "this", ".", "schemaName", "=", "schemaName", ";", "}", "return", "this", ";", "}" ]
This function sets a schema to be used for creation and updating tables. When passing a schema name make sure that the schema has been created in the database before running JaVers. If schemaName is null or empty, the default schema is used instead. @since 2.4
[ "This", "function", "sets", "a", "schema", "to", "be", "used", "for", "creation", "and", "updating", "tables", ".", "When", "passing", "a", "schema", "name", "make", "sure", "that", "the", "schema", "has", "been", "created", "in", "the", "database", "before", "running", "JaVers", ".", "If", "schemaName", "is", "null", "or", "empty", "the", "default", "schema", "is", "used", "instead", "." ]
a51511be7d8bcee3e1812db8b7e69a45330b4e14
https://github.com/javers/javers/blob/a51511be7d8bcee3e1812db8b7e69a45330b4e14/javers-persistence-sql/src/main/java/org/javers/repository/sql/SqlRepositoryBuilder.java#L51-L56
train
javers/javers
javers-core/src/main/java/org/javers/core/metamodel/object/CdoSnapshotState.java
CdoSnapshotState.getPropertyValue
public Object getPropertyValue(Property property) { Validate.argumentIsNotNull(property); Object val = properties.get(property.getName()); if (val == null){ return Defaults.defaultValue(property.getGenericType()); } return val; }
java
public Object getPropertyValue(Property property) { Validate.argumentIsNotNull(property); Object val = properties.get(property.getName()); if (val == null){ return Defaults.defaultValue(property.getGenericType()); } return val; }
[ "public", "Object", "getPropertyValue", "(", "Property", "property", ")", "{", "Validate", ".", "argumentIsNotNull", "(", "property", ")", ";", "Object", "val", "=", "properties", ".", "get", "(", "property", ".", "getName", "(", ")", ")", ";", "if", "(", "val", "==", "null", ")", "{", "return", "Defaults", ".", "defaultValue", "(", "property", ".", "getGenericType", "(", ")", ")", ";", "}", "return", "val", ";", "}" ]
returns default values for null primitives
[ "returns", "default", "values", "for", "null", "primitives" ]
a51511be7d8bcee3e1812db8b7e69a45330b4e14
https://github.com/javers/javers/blob/a51511be7d8bcee3e1812db8b7e69a45330b4e14/javers-core/src/main/java/org/javers/core/metamodel/object/CdoSnapshotState.java#L32-L39
train
javers/javers
javers-core/src/main/java/org/javers/core/diff/Diff.java
Diff.getObjectsByChangeType
public <C extends Change> List getObjectsByChangeType(final Class<C> type) { argumentIsNotNull(type); return Lists.transform(getChangesByType(type), input -> input.getAffectedObject().<JaversException>orElseThrow(() -> new JaversException(AFFECTED_CDO_IS_NOT_AVAILABLE))); }
java
public <C extends Change> List getObjectsByChangeType(final Class<C> type) { argumentIsNotNull(type); return Lists.transform(getChangesByType(type), input -> input.getAffectedObject().<JaversException>orElseThrow(() -> new JaversException(AFFECTED_CDO_IS_NOT_AVAILABLE))); }
[ "public", "<", "C", "extends", "Change", ">", "List", "getObjectsByChangeType", "(", "final", "Class", "<", "C", ">", "type", ")", "{", "argumentIsNotNull", "(", "type", ")", ";", "return", "Lists", ".", "transform", "(", "getChangesByType", "(", "type", ")", ",", "input", "->", "input", ".", "getAffectedObject", "(", ")", ".", "<", "JaversException", ">", "orElseThrow", "(", "(", ")", "->", "new", "JaversException", "(", "AFFECTED_CDO_IS_NOT_AVAILABLE", ")", ")", ")", ";", "}" ]
Selects new, removed or changed objects @throws JaversException AFFECTED_CDO_IS_NOT_AVAILABLE if diff is restored from a repository
[ "Selects", "new", "removed", "or", "changed", "objects" ]
a51511be7d8bcee3e1812db8b7e69a45330b4e14
https://github.com/javers/javers/blob/a51511be7d8bcee3e1812db8b7e69a45330b4e14/javers-core/src/main/java/org/javers/core/diff/Diff.java#L53-L58
train
javers/javers
javers-core/src/main/java/org/javers/core/diff/Diff.java
Diff.getObjectsWithChangedProperty
public List getObjectsWithChangedProperty(String propertyName){ argumentIsNotNull(propertyName); return Lists.transform(getPropertyChanges(propertyName), input -> input.getAffectedObject().<JaversException>orElseThrow(() -> new JaversException(AFFECTED_CDO_IS_NOT_AVAILABLE))); }
java
public List getObjectsWithChangedProperty(String propertyName){ argumentIsNotNull(propertyName); return Lists.transform(getPropertyChanges(propertyName), input -> input.getAffectedObject().<JaversException>orElseThrow(() -> new JaversException(AFFECTED_CDO_IS_NOT_AVAILABLE))); }
[ "public", "List", "getObjectsWithChangedProperty", "(", "String", "propertyName", ")", "{", "argumentIsNotNull", "(", "propertyName", ")", ";", "return", "Lists", ".", "transform", "(", "getPropertyChanges", "(", "propertyName", ")", ",", "input", "->", "input", ".", "getAffectedObject", "(", ")", ".", "<", "JaversException", ">", "orElseThrow", "(", "(", ")", "->", "new", "JaversException", "(", "AFFECTED_CDO_IS_NOT_AVAILABLE", ")", ")", ")", ";", "}" ]
Selects objects with changed property for given property name @throws JaversException AFFECTED_CDO_IS_NOT_AVAILABLE if diff is restored from repository,
[ "Selects", "objects", "with", "changed", "property", "for", "given", "property", "name" ]
a51511be7d8bcee3e1812db8b7e69a45330b4e14
https://github.com/javers/javers/blob/a51511be7d8bcee3e1812db8b7e69a45330b4e14/javers-core/src/main/java/org/javers/core/diff/Diff.java#L66-L71
train
javers/javers
javers-core/src/main/java/org/javers/core/diff/Diff.java
Diff.getChanges
public List<Change> getChanges(Predicate<Change> predicate) { return Lists.positiveFilter(changes, predicate); }
java
public List<Change> getChanges(Predicate<Change> predicate) { return Lists.positiveFilter(changes, predicate); }
[ "public", "List", "<", "Change", ">", "getChanges", "(", "Predicate", "<", "Change", ">", "predicate", ")", "{", "return", "Lists", ".", "positiveFilter", "(", "changes", ",", "predicate", ")", ";", "}" ]
Changes that satisfies given filter
[ "Changes", "that", "satisfies", "given", "filter" ]
a51511be7d8bcee3e1812db8b7e69a45330b4e14
https://github.com/javers/javers/blob/a51511be7d8bcee3e1812db8b7e69a45330b4e14/javers-core/src/main/java/org/javers/core/diff/Diff.java#L94-L96
train
javers/javers
javers-core/src/main/java/org/javers/core/diff/Diff.java
Diff.getPropertyChanges
public List<PropertyChange> getPropertyChanges(final String propertyName) { argumentIsNotNull(propertyName); return (List)getChanges(input -> input instanceof PropertyChange && ((PropertyChange)input).getPropertyName().equals(propertyName)); }
java
public List<PropertyChange> getPropertyChanges(final String propertyName) { argumentIsNotNull(propertyName); return (List)getChanges(input -> input instanceof PropertyChange && ((PropertyChange)input).getPropertyName().equals(propertyName)); }
[ "public", "List", "<", "PropertyChange", ">", "getPropertyChanges", "(", "final", "String", "propertyName", ")", "{", "argumentIsNotNull", "(", "propertyName", ")", ";", "return", "(", "List", ")", "getChanges", "(", "input", "->", "input", "instanceof", "PropertyChange", "&&", "(", "(", "PropertyChange", ")", "input", ")", ".", "getPropertyName", "(", ")", ".", "equals", "(", "propertyName", ")", ")", ";", "}" ]
Selects property changes for given property name
[ "Selects", "property", "changes", "for", "given", "property", "name" ]
a51511be7d8bcee3e1812db8b7e69a45330b4e14
https://github.com/javers/javers/blob/a51511be7d8bcee3e1812db8b7e69a45330b4e14/javers-core/src/main/java/org/javers/core/diff/Diff.java#L106-L109
train
javers/javers
javers-core/src/main/java/org/javers/core/snapshot/SnapshotDiffer.java
SnapshotDiffer.calculateDiffs
public List<Change> calculateDiffs(List<CdoSnapshot> snapshots, Map<SnapshotIdentifier, CdoSnapshot> previousSnapshots) { Validate.argumentsAreNotNull(snapshots); Validate.argumentsAreNotNull(previousSnapshots); List<Change> changes = new ArrayList<>(); for (CdoSnapshot snapshot : snapshots) { if (snapshot.isInitial()) { addInitialChanges(changes, snapshot); } else if (snapshot.isTerminal()) { addTerminalChanges(changes, snapshot); } else { CdoSnapshot previousSnapshot = previousSnapshots.get(SnapshotIdentifier.from(snapshot).previous()); addChanges(changes, previousSnapshot, snapshot); } } return changes; }
java
public List<Change> calculateDiffs(List<CdoSnapshot> snapshots, Map<SnapshotIdentifier, CdoSnapshot> previousSnapshots) { Validate.argumentsAreNotNull(snapshots); Validate.argumentsAreNotNull(previousSnapshots); List<Change> changes = new ArrayList<>(); for (CdoSnapshot snapshot : snapshots) { if (snapshot.isInitial()) { addInitialChanges(changes, snapshot); } else if (snapshot.isTerminal()) { addTerminalChanges(changes, snapshot); } else { CdoSnapshot previousSnapshot = previousSnapshots.get(SnapshotIdentifier.from(snapshot).previous()); addChanges(changes, previousSnapshot, snapshot); } } return changes; }
[ "public", "List", "<", "Change", ">", "calculateDiffs", "(", "List", "<", "CdoSnapshot", ">", "snapshots", ",", "Map", "<", "SnapshotIdentifier", ",", "CdoSnapshot", ">", "previousSnapshots", ")", "{", "Validate", ".", "argumentsAreNotNull", "(", "snapshots", ")", ";", "Validate", ".", "argumentsAreNotNull", "(", "previousSnapshots", ")", ";", "List", "<", "Change", ">", "changes", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "CdoSnapshot", "snapshot", ":", "snapshots", ")", "{", "if", "(", "snapshot", ".", "isInitial", "(", ")", ")", "{", "addInitialChanges", "(", "changes", ",", "snapshot", ")", ";", "}", "else", "if", "(", "snapshot", ".", "isTerminal", "(", ")", ")", "{", "addTerminalChanges", "(", "changes", ",", "snapshot", ")", ";", "}", "else", "{", "CdoSnapshot", "previousSnapshot", "=", "previousSnapshots", ".", "get", "(", "SnapshotIdentifier", ".", "from", "(", "snapshot", ")", ".", "previous", "(", ")", ")", ";", "addChanges", "(", "changes", ",", "previousSnapshot", ",", "snapshot", ")", ";", "}", "}", "return", "changes", ";", "}" ]
Calculates changes introduced by a collection of snapshots. This method expects that the previousSnapshots map contains predecessors of all non-initial and non-terminal snapshots.
[ "Calculates", "changes", "introduced", "by", "a", "collection", "of", "snapshots", ".", "This", "method", "expects", "that", "the", "previousSnapshots", "map", "contains", "predecessors", "of", "all", "non", "-", "initial", "and", "non", "-", "terminal", "snapshots", "." ]
a51511be7d8bcee3e1812db8b7e69a45330b4e14
https://github.com/javers/javers/blob/a51511be7d8bcee3e1812db8b7e69a45330b4e14/javers-core/src/main/java/org/javers/core/snapshot/SnapshotDiffer.java#L33-L49
train
javers/javers
javers-core/src/main/java/org/javers/core/metamodel/type/EnumerableType.java
EnumerableType.filterToList
public <T> List<T> filterToList(Object source, Class<T> filter) { Validate.argumentsAreNotNull(filter); return (List) unmodifiableList( items(source).filter(item -> item!=null && filter.isAssignableFrom(item.getClass())) .collect(Collectors.toList())); }
java
public <T> List<T> filterToList(Object source, Class<T> filter) { Validate.argumentsAreNotNull(filter); return (List) unmodifiableList( items(source).filter(item -> item!=null && filter.isAssignableFrom(item.getClass())) .collect(Collectors.toList())); }
[ "public", "<", "T", ">", "List", "<", "T", ">", "filterToList", "(", "Object", "source", ",", "Class", "<", "T", ">", "filter", ")", "{", "Validate", ".", "argumentsAreNotNull", "(", "filter", ")", ";", "return", "(", "List", ")", "unmodifiableList", "(", "items", "(", "source", ")", ".", "filter", "(", "item", "->", "item", "!=", "null", "&&", "filter", ".", "isAssignableFrom", "(", "item", ".", "getClass", "(", ")", ")", ")", ".", "collect", "(", "Collectors", ".", "toList", "(", ")", ")", ")", ";", "}" ]
Returns a new, unmodifiable Enumerable with filtered items, nulls are omitted.
[ "Returns", "a", "new", "unmodifiable", "Enumerable", "with", "filtered", "items", "nulls", "are", "omitted", "." ]
a51511be7d8bcee3e1812db8b7e69a45330b4e14
https://github.com/javers/javers/blob/a51511be7d8bcee3e1812db8b7e69a45330b4e14/javers-core/src/main/java/org/javers/core/metamodel/type/EnumerableType.java#L50-L56
train
javers/javers
javers-core/src/main/java/org/javers/core/metamodel/type/ManagedClass.java
ManagedClass.getManagedProperties
List<JaversProperty> getManagedProperties(Predicate<JaversProperty> query) { return Lists.positiveFilter(managedProperties, query); }
java
List<JaversProperty> getManagedProperties(Predicate<JaversProperty> query) { return Lists.positiveFilter(managedProperties, query); }
[ "List", "<", "JaversProperty", ">", "getManagedProperties", "(", "Predicate", "<", "JaversProperty", ">", "query", ")", "{", "return", "Lists", ".", "positiveFilter", "(", "managedProperties", ",", "query", ")", ";", "}" ]
returns managed properties subset
[ "returns", "managed", "properties", "subset" ]
a51511be7d8bcee3e1812db8b7e69a45330b4e14
https://github.com/javers/javers/blob/a51511be7d8bcee3e1812db8b7e69a45330b4e14/javers-core/src/main/java/org/javers/core/metamodel/type/ManagedClass.java#L71-L73
train
javers/javers
javers-core/src/main/java/org/javers/core/metamodel/type/TypeMapper.java
TypeMapper.getMapContentType
public MapContentType getMapContentType(ContainerType containerType){ JaversType keyType = getJaversType(Integer.class); JaversType valueType = getJaversType(containerType.getItemType()); return new MapContentType(keyType, valueType); }
java
public MapContentType getMapContentType(ContainerType containerType){ JaversType keyType = getJaversType(Integer.class); JaversType valueType = getJaversType(containerType.getItemType()); return new MapContentType(keyType, valueType); }
[ "public", "MapContentType", "getMapContentType", "(", "ContainerType", "containerType", ")", "{", "JaversType", "keyType", "=", "getJaversType", "(", "Integer", ".", "class", ")", ";", "JaversType", "valueType", "=", "getJaversType", "(", "containerType", ".", "getItemType", "(", ")", ")", ";", "return", "new", "MapContentType", "(", "keyType", ",", "valueType", ")", ";", "}" ]
only for change appenders
[ "only", "for", "change", "appenders" ]
a51511be7d8bcee3e1812db8b7e69a45330b4e14
https://github.com/javers/javers/blob/a51511be7d8bcee3e1812db8b7e69a45330b4e14/javers-core/src/main/java/org/javers/core/metamodel/type/TypeMapper.java#L64-L68
train
javers/javers
javers-core/src/main/java/org/javers/core/metamodel/type/TypeMapper.java
TypeMapper.isContainerOfManagedTypes
public boolean isContainerOfManagedTypes(JaversType javersType){ if (! (javersType instanceof ContainerType)) { return false; } return getJaversType(((ContainerType)javersType).getItemType()) instanceof ManagedType; }
java
public boolean isContainerOfManagedTypes(JaversType javersType){ if (! (javersType instanceof ContainerType)) { return false; } return getJaversType(((ContainerType)javersType).getItemType()) instanceof ManagedType; }
[ "public", "boolean", "isContainerOfManagedTypes", "(", "JaversType", "javersType", ")", "{", "if", "(", "!", "(", "javersType", "instanceof", "ContainerType", ")", ")", "{", "return", "false", ";", "}", "return", "getJaversType", "(", "(", "(", "ContainerType", ")", "javersType", ")", ".", "getItemType", "(", ")", ")", "instanceof", "ManagedType", ";", "}" ]
is Set, List or Array of ManagedClasses
[ "is", "Set", "List", "or", "Array", "of", "ManagedClasses" ]
a51511be7d8bcee3e1812db8b7e69a45330b4e14
https://github.com/javers/javers/blob/a51511be7d8bcee3e1812db8b7e69a45330b4e14/javers-core/src/main/java/org/javers/core/metamodel/type/TypeMapper.java#L73-L79
train
javers/javers
javers-core/src/main/java/org/javers/core/metamodel/type/TypeMapper.java
TypeMapper.getJaversType
public JaversType getJaversType(Type javaType) { argumentIsNotNull(javaType); if (javaType == Object.class) { return OBJECT_TYPE; } return engine.computeIfAbsent(javaType, j -> typeFactory.infer(j, findPrototype(j))); }
java
public JaversType getJaversType(Type javaType) { argumentIsNotNull(javaType); if (javaType == Object.class) { return OBJECT_TYPE; } return engine.computeIfAbsent(javaType, j -> typeFactory.infer(j, findPrototype(j))); }
[ "public", "JaversType", "getJaversType", "(", "Type", "javaType", ")", "{", "argumentIsNotNull", "(", "javaType", ")", ";", "if", "(", "javaType", "==", "Object", ".", "class", ")", "{", "return", "OBJECT_TYPE", ";", "}", "return", "engine", ".", "computeIfAbsent", "(", "javaType", ",", "j", "->", "typeFactory", ".", "infer", "(", "j", ",", "findPrototype", "(", "j", ")", ")", ")", ";", "}" ]
Returns mapped type, spawns a new one from a prototype, or infers a new one using default mapping.
[ "Returns", "mapped", "type", "spawns", "a", "new", "one", "from", "a", "prototype", "or", "infers", "a", "new", "one", "using", "default", "mapping", "." ]
a51511be7d8bcee3e1812db8b7e69a45330b4e14
https://github.com/javers/javers/blob/a51511be7d8bcee3e1812db8b7e69a45330b4e14/javers-core/src/main/java/org/javers/core/metamodel/type/TypeMapper.java#L109-L117
train
javers/javers
javers-core/src/main/java/org/javers/core/metamodel/type/TypeMapper.java
TypeMapper.getJaversManagedType
public <T extends ManagedType> T getJaversManagedType(Class javaClass, Class<T> expectedType) { JaversType mType = getJaversType(javaClass); if (expectedType.isAssignableFrom(mType.getClass())) { return (T) mType; } else { throw new JaversException(JaversExceptionCode.MANAGED_CLASS_MAPPING_ERROR, javaClass, mType.getClass().getSimpleName(), expectedType.getSimpleName()); } }
java
public <T extends ManagedType> T getJaversManagedType(Class javaClass, Class<T> expectedType) { JaversType mType = getJaversType(javaClass); if (expectedType.isAssignableFrom(mType.getClass())) { return (T) mType; } else { throw new JaversException(JaversExceptionCode.MANAGED_CLASS_MAPPING_ERROR, javaClass, mType.getClass().getSimpleName(), expectedType.getSimpleName()); } }
[ "public", "<", "T", "extends", "ManagedType", ">", "T", "getJaversManagedType", "(", "Class", "javaClass", ",", "Class", "<", "T", ">", "expectedType", ")", "{", "JaversType", "mType", "=", "getJaversType", "(", "javaClass", ")", ";", "if", "(", "expectedType", ".", "isAssignableFrom", "(", "mType", ".", "getClass", "(", ")", ")", ")", "{", "return", "(", "T", ")", "mType", ";", "}", "else", "{", "throw", "new", "JaversException", "(", "JaversExceptionCode", ".", "MANAGED_CLASS_MAPPING_ERROR", ",", "javaClass", ",", "mType", ".", "getClass", "(", ")", ".", "getSimpleName", "(", ")", ",", "expectedType", ".", "getSimpleName", "(", ")", ")", ";", "}", "}" ]
If given javaClass is mapped to expected ManagedType, returns its JaversType @throws JaversException MANAGED_CLASS_MAPPING_ERROR
[ "If", "given", "javaClass", "is", "mapped", "to", "expected", "ManagedType", "returns", "its", "JaversType" ]
a51511be7d8bcee3e1812db8b7e69a45330b4e14
https://github.com/javers/javers/blob/a51511be7d8bcee3e1812db8b7e69a45330b4e14/javers-core/src/main/java/org/javers/core/metamodel/type/TypeMapper.java#L179-L190
train
javers/javers
javers-spring-boot-starter-mongo/src/main/java/org/javers/spring/boot/mongo/JaversMongoAutoConfiguration.java
JaversMongoAutoConfiguration.javers
@Bean(name = "JaversFromStarter") @ConditionalOnMissingBean public Javers javers() { logger.info("Starting javers-spring-boot-starter-mongo ..."); MongoDatabase mongoDatabase = mongoClient.getDatabase( mongoProperties.getMongoClientDatabase() ); logger.info("connecting to database: {}", mongoProperties.getMongoClientDatabase()); MongoRepository javersRepository = createMongoRepository(javersMongoProperties, mongoDatabase); return JaversBuilder.javers() .registerJaversRepository(javersRepository) .withProperties(javersMongoProperties) .withObjectAccessHook(new DBRefUnproxyObjectAccessHook()) .build(); }
java
@Bean(name = "JaversFromStarter") @ConditionalOnMissingBean public Javers javers() { logger.info("Starting javers-spring-boot-starter-mongo ..."); MongoDatabase mongoDatabase = mongoClient.getDatabase( mongoProperties.getMongoClientDatabase() ); logger.info("connecting to database: {}", mongoProperties.getMongoClientDatabase()); MongoRepository javersRepository = createMongoRepository(javersMongoProperties, mongoDatabase); return JaversBuilder.javers() .registerJaversRepository(javersRepository) .withProperties(javersMongoProperties) .withObjectAccessHook(new DBRefUnproxyObjectAccessHook()) .build(); }
[ "@", "Bean", "(", "name", "=", "\"JaversFromStarter\"", ")", "@", "ConditionalOnMissingBean", "public", "Javers", "javers", "(", ")", "{", "logger", ".", "info", "(", "\"Starting javers-spring-boot-starter-mongo ...\"", ")", ";", "MongoDatabase", "mongoDatabase", "=", "mongoClient", ".", "getDatabase", "(", "mongoProperties", ".", "getMongoClientDatabase", "(", ")", ")", ";", "logger", ".", "info", "(", "\"connecting to database: {}\"", ",", "mongoProperties", ".", "getMongoClientDatabase", "(", ")", ")", ";", "MongoRepository", "javersRepository", "=", "createMongoRepository", "(", "javersMongoProperties", ",", "mongoDatabase", ")", ";", "return", "JaversBuilder", ".", "javers", "(", ")", ".", "registerJaversRepository", "(", "javersRepository", ")", ".", "withProperties", "(", "javersMongoProperties", ")", ".", "withObjectAccessHook", "(", "new", "DBRefUnproxyObjectAccessHook", "(", ")", ")", ".", "build", "(", ")", ";", "}" ]
from spring-boot-starter-data-mongodb
[ "from", "spring", "-", "boot", "-", "starter", "-", "data", "-", "mongodb" ]
a51511be7d8bcee3e1812db8b7e69a45330b4e14
https://github.com/javers/javers/blob/a51511be7d8bcee3e1812db8b7e69a45330b4e14/javers-spring-boot-starter-mongo/src/main/java/org/javers/spring/boot/mongo/JaversMongoAutoConfiguration.java#L45-L61
train
javers/javers
javers-core/src/main/java/org/javers/core/diff/DiffFactory.java
DiffFactory.createAndAppendChanges
private Diff createAndAppendChanges(GraphPair graphPair, Optional<CommitMetadata> commitMetadata) { DiffBuilder diff = new DiffBuilder(javersCoreConfiguration.getPrettyValuePrinter()); //calculate node scope diff for (NodeChangeAppender appender : nodeChangeAppenders) { diff.addChanges(appender.getChangeSet(graphPair), commitMetadata); } //calculate snapshot of NewObjects if (javersCoreConfiguration.isNewObjectsSnapshot()) { for (ObjectNode node : graphPair.getOnlyOnRight()) { FakeNodePair pair = new FakeNodePair(node); appendPropertyChanges(diff, pair, commitMetadata); } } //calculate property-to-property diff for (NodePair pair : nodeMatcher.match(graphPair)) { appendPropertyChanges(diff, pair, commitMetadata); } return diff.build(); }
java
private Diff createAndAppendChanges(GraphPair graphPair, Optional<CommitMetadata> commitMetadata) { DiffBuilder diff = new DiffBuilder(javersCoreConfiguration.getPrettyValuePrinter()); //calculate node scope diff for (NodeChangeAppender appender : nodeChangeAppenders) { diff.addChanges(appender.getChangeSet(graphPair), commitMetadata); } //calculate snapshot of NewObjects if (javersCoreConfiguration.isNewObjectsSnapshot()) { for (ObjectNode node : graphPair.getOnlyOnRight()) { FakeNodePair pair = new FakeNodePair(node); appendPropertyChanges(diff, pair, commitMetadata); } } //calculate property-to-property diff for (NodePair pair : nodeMatcher.match(graphPair)) { appendPropertyChanges(diff, pair, commitMetadata); } return diff.build(); }
[ "private", "Diff", "createAndAppendChanges", "(", "GraphPair", "graphPair", ",", "Optional", "<", "CommitMetadata", ">", "commitMetadata", ")", "{", "DiffBuilder", "diff", "=", "new", "DiffBuilder", "(", "javersCoreConfiguration", ".", "getPrettyValuePrinter", "(", ")", ")", ";", "//calculate node scope diff", "for", "(", "NodeChangeAppender", "appender", ":", "nodeChangeAppenders", ")", "{", "diff", ".", "addChanges", "(", "appender", ".", "getChangeSet", "(", "graphPair", ")", ",", "commitMetadata", ")", ";", "}", "//calculate snapshot of NewObjects", "if", "(", "javersCoreConfiguration", ".", "isNewObjectsSnapshot", "(", ")", ")", "{", "for", "(", "ObjectNode", "node", ":", "graphPair", ".", "getOnlyOnRight", "(", ")", ")", "{", "FakeNodePair", "pair", "=", "new", "FakeNodePair", "(", "node", ")", ";", "appendPropertyChanges", "(", "diff", ",", "pair", ",", "commitMetadata", ")", ";", "}", "}", "//calculate property-to-property diff", "for", "(", "NodePair", "pair", ":", "nodeMatcher", ".", "match", "(", "graphPair", ")", ")", "{", "appendPropertyChanges", "(", "diff", ",", "pair", ",", "commitMetadata", ")", ";", "}", "return", "diff", ".", "build", "(", ")", ";", "}" ]
Graph scope appender
[ "Graph", "scope", "appender" ]
a51511be7d8bcee3e1812db8b7e69a45330b4e14
https://github.com/javers/javers/blob/a51511be7d8bcee3e1812db8b7e69a45330b4e14/javers-core/src/main/java/org/javers/core/diff/DiffFactory.java#L107-L129
train
javers/javers
javers-persistence-sql/src/main/java/org/javers/repository/sql/schema/JaversSchemaManager.java
JaversSchemaManager.addCommitDateInstantColumnIfNeeded
private void addCommitDateInstantColumnIfNeeded() { if (!columnExists(getCommitTableNameWithSchema(), COMMIT_COMMIT_DATE_INSTANT)){ addStringColumn(getCommitTableNameWithSchema(), COMMIT_COMMIT_DATE_INSTANT, 30); } else { extendStringColumnIfNeeded(getCommitTableNameWithSchema(), COMMIT_COMMIT_DATE_INSTANT, 30); } }
java
private void addCommitDateInstantColumnIfNeeded() { if (!columnExists(getCommitTableNameWithSchema(), COMMIT_COMMIT_DATE_INSTANT)){ addStringColumn(getCommitTableNameWithSchema(), COMMIT_COMMIT_DATE_INSTANT, 30); } else { extendStringColumnIfNeeded(getCommitTableNameWithSchema(), COMMIT_COMMIT_DATE_INSTANT, 30); } }
[ "private", "void", "addCommitDateInstantColumnIfNeeded", "(", ")", "{", "if", "(", "!", "columnExists", "(", "getCommitTableNameWithSchema", "(", ")", ",", "COMMIT_COMMIT_DATE_INSTANT", ")", ")", "{", "addStringColumn", "(", "getCommitTableNameWithSchema", "(", ")", ",", "COMMIT_COMMIT_DATE_INSTANT", ",", "30", ")", ";", "}", "else", "{", "extendStringColumnIfNeeded", "(", "getCommitTableNameWithSchema", "(", ")", ",", "COMMIT_COMMIT_DATE_INSTANT", ",", "30", ")", ";", "}", "}" ]
JaVers 5.0 to 5.1 schema migration
[ "JaVers", "5", ".", "0", "to", "5", ".", "1", "schema", "migration" ]
a51511be7d8bcee3e1812db8b7e69a45330b4e14
https://github.com/javers/javers/blob/a51511be7d8bcee3e1812db8b7e69a45330b4e14/javers-persistence-sql/src/main/java/org/javers/repository/sql/schema/JaversSchemaManager.java#L72-L78
train
javers/javers
javers-persistence-sql/src/main/java/org/javers/repository/sql/schema/JaversSchemaManager.java
JaversSchemaManager.alterCommitIdColumnIfNeeded
private void alterCommitIdColumnIfNeeded() { ColumnType commitIdColType = getTypeOf(getCommitTableNameWithSchema(), "commit_id"); if (commitIdColType.precision == 12) { logger.info("migrating db schema from JaVers 2.5 to 2.6 ..."); if (dialect instanceof PostgresDialect) { executeSQL("ALTER TABLE " + getCommitTableNameWithSchema() + " ALTER COLUMN commit_id TYPE numeric(22,2)"); } else if (dialect instanceof H2Dialect) { executeSQL("ALTER TABLE " + getCommitTableNameWithSchema() + " ALTER COLUMN commit_id numeric(22,2)"); } else if (dialect instanceof MysqlDialect) { executeSQL("ALTER TABLE " + getCommitTableNameWithSchema() + " MODIFY commit_id numeric(22,2)"); } else if (dialect instanceof OracleDialect) { executeSQL("ALTER TABLE " + getCommitTableNameWithSchema() + " MODIFY commit_id number(22,2)"); } else if (dialect instanceof MsSqlDialect) { executeSQL("drop index jv_commit_commit_id_idx on " + getCommitTableNameWithSchema()); executeSQL("ALTER TABLE " + getCommitTableNameWithSchema() + " ALTER COLUMN commit_id numeric(22,2)"); executeSQL("CREATE INDEX jv_commit_commit_id_idx ON " + getCommitTableNameWithSchema() + " (commit_id)"); } else { handleUnsupportedDialect(); } } }
java
private void alterCommitIdColumnIfNeeded() { ColumnType commitIdColType = getTypeOf(getCommitTableNameWithSchema(), "commit_id"); if (commitIdColType.precision == 12) { logger.info("migrating db schema from JaVers 2.5 to 2.6 ..."); if (dialect instanceof PostgresDialect) { executeSQL("ALTER TABLE " + getCommitTableNameWithSchema() + " ALTER COLUMN commit_id TYPE numeric(22,2)"); } else if (dialect instanceof H2Dialect) { executeSQL("ALTER TABLE " + getCommitTableNameWithSchema() + " ALTER COLUMN commit_id numeric(22,2)"); } else if (dialect instanceof MysqlDialect) { executeSQL("ALTER TABLE " + getCommitTableNameWithSchema() + " MODIFY commit_id numeric(22,2)"); } else if (dialect instanceof OracleDialect) { executeSQL("ALTER TABLE " + getCommitTableNameWithSchema() + " MODIFY commit_id number(22,2)"); } else if (dialect instanceof MsSqlDialect) { executeSQL("drop index jv_commit_commit_id_idx on " + getCommitTableNameWithSchema()); executeSQL("ALTER TABLE " + getCommitTableNameWithSchema() + " ALTER COLUMN commit_id numeric(22,2)"); executeSQL("CREATE INDEX jv_commit_commit_id_idx ON " + getCommitTableNameWithSchema() + " (commit_id)"); } else { handleUnsupportedDialect(); } } }
[ "private", "void", "alterCommitIdColumnIfNeeded", "(", ")", "{", "ColumnType", "commitIdColType", "=", "getTypeOf", "(", "getCommitTableNameWithSchema", "(", ")", ",", "\"commit_id\"", ")", ";", "if", "(", "commitIdColType", ".", "precision", "==", "12", ")", "{", "logger", ".", "info", "(", "\"migrating db schema from JaVers 2.5 to 2.6 ...\"", ")", ";", "if", "(", "dialect", "instanceof", "PostgresDialect", ")", "{", "executeSQL", "(", "\"ALTER TABLE \"", "+", "getCommitTableNameWithSchema", "(", ")", "+", "\" ALTER COLUMN commit_id TYPE numeric(22,2)\"", ")", ";", "}", "else", "if", "(", "dialect", "instanceof", "H2Dialect", ")", "{", "executeSQL", "(", "\"ALTER TABLE \"", "+", "getCommitTableNameWithSchema", "(", ")", "+", "\" ALTER COLUMN commit_id numeric(22,2)\"", ")", ";", "}", "else", "if", "(", "dialect", "instanceof", "MysqlDialect", ")", "{", "executeSQL", "(", "\"ALTER TABLE \"", "+", "getCommitTableNameWithSchema", "(", ")", "+", "\" MODIFY commit_id numeric(22,2)\"", ")", ";", "}", "else", "if", "(", "dialect", "instanceof", "OracleDialect", ")", "{", "executeSQL", "(", "\"ALTER TABLE \"", "+", "getCommitTableNameWithSchema", "(", ")", "+", "\" MODIFY commit_id number(22,2)\"", ")", ";", "}", "else", "if", "(", "dialect", "instanceof", "MsSqlDialect", ")", "{", "executeSQL", "(", "\"drop index jv_commit_commit_id_idx on \"", "+", "getCommitTableNameWithSchema", "(", ")", ")", ";", "executeSQL", "(", "\"ALTER TABLE \"", "+", "getCommitTableNameWithSchema", "(", ")", "+", "\" ALTER COLUMN commit_id numeric(22,2)\"", ")", ";", "executeSQL", "(", "\"CREATE INDEX jv_commit_commit_id_idx ON \"", "+", "getCommitTableNameWithSchema", "(", ")", "+", "\" (commit_id)\"", ")", ";", "}", "else", "{", "handleUnsupportedDialect", "(", ")", ";", "}", "}", "}" ]
JaVers 2.5 to 2.6 schema migration
[ "JaVers", "2", ".", "5", "to", "2", ".", "6", "schema", "migration" ]
a51511be7d8bcee3e1812db8b7e69a45330b4e14
https://github.com/javers/javers/blob/a51511be7d8bcee3e1812db8b7e69a45330b4e14/javers-persistence-sql/src/main/java/org/javers/repository/sql/schema/JaversSchemaManager.java#L103-L124
train
javers/javers
javers-persistence-sql/src/main/java/org/javers/repository/sql/schema/JaversSchemaManager.java
JaversSchemaManager.alterMssqlTextColumns
private void alterMssqlTextColumns() { ColumnType stateColType = getTypeOf(getSnapshotTableNameWithSchema(), "state"); ColumnType changedPropertiesColType = getTypeOf(getSnapshotTableNameWithSchema(), "state"); if(stateColType.typeName.equals("text")) { executeSQL("ALTER TABLE " + getSnapshotTableNameWithSchema() + " ALTER COLUMN state VARCHAR(MAX)"); } if(changedPropertiesColType.typeName.equals("text")) { executeSQL("ALTER TABLE " + getSnapshotTableNameWithSchema() + " ALTER COLUMN changed_properties VARCHAR(MAX)"); } }
java
private void alterMssqlTextColumns() { ColumnType stateColType = getTypeOf(getSnapshotTableNameWithSchema(), "state"); ColumnType changedPropertiesColType = getTypeOf(getSnapshotTableNameWithSchema(), "state"); if(stateColType.typeName.equals("text")) { executeSQL("ALTER TABLE " + getSnapshotTableNameWithSchema() + " ALTER COLUMN state VARCHAR(MAX)"); } if(changedPropertiesColType.typeName.equals("text")) { executeSQL("ALTER TABLE " + getSnapshotTableNameWithSchema() + " ALTER COLUMN changed_properties VARCHAR(MAX)"); } }
[ "private", "void", "alterMssqlTextColumns", "(", ")", "{", "ColumnType", "stateColType", "=", "getTypeOf", "(", "getSnapshotTableNameWithSchema", "(", ")", ",", "\"state\"", ")", ";", "ColumnType", "changedPropertiesColType", "=", "getTypeOf", "(", "getSnapshotTableNameWithSchema", "(", ")", ",", "\"state\"", ")", ";", "if", "(", "stateColType", ".", "typeName", ".", "equals", "(", "\"text\"", ")", ")", "{", "executeSQL", "(", "\"ALTER TABLE \"", "+", "getSnapshotTableNameWithSchema", "(", ")", "+", "\" ALTER COLUMN state VARCHAR(MAX)\"", ")", ";", "}", "if", "(", "changedPropertiesColType", ".", "typeName", ".", "equals", "(", "\"text\"", ")", ")", "{", "executeSQL", "(", "\"ALTER TABLE \"", "+", "getSnapshotTableNameWithSchema", "(", ")", "+", "\" ALTER COLUMN changed_properties VARCHAR(MAX)\"", ")", ";", "}", "}" ]
JaVers 3.3.0 to 3.3.1 MsSql schema migration This method is needed for upgrading TEXT columns to VARCHAR(MAX) since TEXT is deprecated.
[ "JaVers", "3", ".", "3", ".", "0", "to", "3", ".", "3", ".", "1", "MsSql", "schema", "migration" ]
a51511be7d8bcee3e1812db8b7e69a45330b4e14
https://github.com/javers/javers/blob/a51511be7d8bcee3e1812db8b7e69a45330b4e14/javers-persistence-sql/src/main/java/org/javers/repository/sql/schema/JaversSchemaManager.java#L131-L142
train
javers/javers
javers-core/src/main/java/org/javers/guava/MultimapType.java
MultimapType.map
@Override public Object map(Object sourceEnumerable, Function mapFunction, boolean filterNulls) { Validate.argumentIsNotNull(mapFunction); Multimap sourceMultimap = toNotNullMultimap(sourceEnumerable); Multimap targetMultimap = ArrayListMultimap.create(); MapType.mapEntrySet(sourceMultimap.entries(), mapFunction, (k,v) -> targetMultimap.put(k,v), filterNulls); return targetMultimap; }
java
@Override public Object map(Object sourceEnumerable, Function mapFunction, boolean filterNulls) { Validate.argumentIsNotNull(mapFunction); Multimap sourceMultimap = toNotNullMultimap(sourceEnumerable); Multimap targetMultimap = ArrayListMultimap.create(); MapType.mapEntrySet(sourceMultimap.entries(), mapFunction, (k,v) -> targetMultimap.put(k,v), filterNulls); return targetMultimap; }
[ "@", "Override", "public", "Object", "map", "(", "Object", "sourceEnumerable", ",", "Function", "mapFunction", ",", "boolean", "filterNulls", ")", "{", "Validate", ".", "argumentIsNotNull", "(", "mapFunction", ")", ";", "Multimap", "sourceMultimap", "=", "toNotNullMultimap", "(", "sourceEnumerable", ")", ";", "Multimap", "targetMultimap", "=", "ArrayListMultimap", ".", "create", "(", ")", ";", "MapType", ".", "mapEntrySet", "(", "sourceMultimap", ".", "entries", "(", ")", ",", "mapFunction", ",", "(", "k", ",", "v", ")", "->", "targetMultimap", ".", "put", "(", "k", ",", "v", ")", ",", "filterNulls", ")", ";", "return", "targetMultimap", ";", "}" ]
Nulls keys are filtered
[ "Nulls", "keys", "are", "filtered" ]
a51511be7d8bcee3e1812db8b7e69a45330b4e14
https://github.com/javers/javers/blob/a51511be7d8bcee3e1812db8b7e69a45330b4e14/javers-core/src/main/java/org/javers/guava/MultimapType.java#L59-L69
train
javers/javers
javers-core/src/main/java/org/javers/core/JaversBuilder.java
JaversBuilder.bootJsonConverter
private Collection<JaversType> bootJsonConverter() { JsonConverterBuilder jsonConverterBuilder = jsonConverterBuilder(); addModule(new ChangeTypeAdaptersModule(getContainer())); addModule(new CommitTypeAdaptersModule(getContainer())); if (new RequiredMongoSupportPredicate().test(repository)) { jsonConverterBuilder.registerNativeGsonDeserializer(Long.class, new MongoLong64JsonDeserializer()); } jsonConverterBuilder.registerJsonTypeAdapters(getComponents(JsonTypeAdapter.class)); jsonConverterBuilder.registerNativeGsonDeserializer(Diff.class, new DiffTypeDeserializer()); JsonConverter jsonConverter = jsonConverterBuilder.build(); addComponent(jsonConverter); return Lists.transform(jsonConverterBuilder.getValueTypes(), c -> new ValueType(c)); }
java
private Collection<JaversType> bootJsonConverter() { JsonConverterBuilder jsonConverterBuilder = jsonConverterBuilder(); addModule(new ChangeTypeAdaptersModule(getContainer())); addModule(new CommitTypeAdaptersModule(getContainer())); if (new RequiredMongoSupportPredicate().test(repository)) { jsonConverterBuilder.registerNativeGsonDeserializer(Long.class, new MongoLong64JsonDeserializer()); } jsonConverterBuilder.registerJsonTypeAdapters(getComponents(JsonTypeAdapter.class)); jsonConverterBuilder.registerNativeGsonDeserializer(Diff.class, new DiffTypeDeserializer()); JsonConverter jsonConverter = jsonConverterBuilder.build(); addComponent(jsonConverter); return Lists.transform(jsonConverterBuilder.getValueTypes(), c -> new ValueType(c)); }
[ "private", "Collection", "<", "JaversType", ">", "bootJsonConverter", "(", ")", "{", "JsonConverterBuilder", "jsonConverterBuilder", "=", "jsonConverterBuilder", "(", ")", ";", "addModule", "(", "new", "ChangeTypeAdaptersModule", "(", "getContainer", "(", ")", ")", ")", ";", "addModule", "(", "new", "CommitTypeAdaptersModule", "(", "getContainer", "(", ")", ")", ")", ";", "if", "(", "new", "RequiredMongoSupportPredicate", "(", ")", ".", "test", "(", "repository", ")", ")", "{", "jsonConverterBuilder", ".", "registerNativeGsonDeserializer", "(", "Long", ".", "class", ",", "new", "MongoLong64JsonDeserializer", "(", ")", ")", ";", "}", "jsonConverterBuilder", ".", "registerJsonTypeAdapters", "(", "getComponents", "(", "JsonTypeAdapter", ".", "class", ")", ")", ";", "jsonConverterBuilder", ".", "registerNativeGsonDeserializer", "(", "Diff", ".", "class", ",", "new", "DiffTypeDeserializer", "(", ")", ")", ";", "JsonConverter", "jsonConverter", "=", "jsonConverterBuilder", ".", "build", "(", ")", ";", "addComponent", "(", "jsonConverter", ")", ";", "return", "Lists", ".", "transform", "(", "jsonConverterBuilder", ".", "getValueTypes", "(", ")", ",", "c", "->", "new", "ValueType", "(", "c", ")", ")", ";", "}" ]
boots JsonConverter and registers domain aware typeAdapters
[ "boots", "JsonConverter", "and", "registers", "domain", "aware", "typeAdapters" ]
a51511be7d8bcee3e1812db8b7e69a45330b4e14
https://github.com/javers/javers/blob/a51511be7d8bcee3e1812db8b7e69a45330b4e14/javers-core/src/main/java/org/javers/core/JaversBuilder.java#L732-L748
train
javers/javers
javers-core/src/main/java/org/javers/core/graph/NodeReuser.java
NodeReuser.reverseCdoIdMapKey
private Object reverseCdoIdMapKey(Cdo cdo) { if (cdo.getGlobalId() instanceof InstanceId) { return cdo.getGlobalId(); } return new SystemIdentityWrapper(cdo.getWrappedCdo().get()); }
java
private Object reverseCdoIdMapKey(Cdo cdo) { if (cdo.getGlobalId() instanceof InstanceId) { return cdo.getGlobalId(); } return new SystemIdentityWrapper(cdo.getWrappedCdo().get()); }
[ "private", "Object", "reverseCdoIdMapKey", "(", "Cdo", "cdo", ")", "{", "if", "(", "cdo", ".", "getGlobalId", "(", ")", "instanceof", "InstanceId", ")", "{", "return", "cdo", ".", "getGlobalId", "(", ")", ";", "}", "return", "new", "SystemIdentityWrapper", "(", "cdo", ".", "getWrappedCdo", "(", ")", ".", "get", "(", ")", ")", ";", "}" ]
InstanceId for Entities, System.identityHashCode for ValueObjects
[ "InstanceId", "for", "Entities", "System", ".", "identityHashCode", "for", "ValueObjects" ]
a51511be7d8bcee3e1812db8b7e69a45330b4e14
https://github.com/javers/javers/blob/a51511be7d8bcee3e1812db8b7e69a45330b4e14/javers-core/src/main/java/org/javers/core/graph/NodeReuser.java#L78-L83
train
javers/javers
javers-persistence-mongo/src/main/java/org/javers/repository/mongo/MongoRepository.java
MongoRepository.prefixQuery
private static Bson prefixQuery(String fieldName, String prefix){ return Filters.regex(fieldName, "^" + RegexEscape.escape(prefix) + ".*"); }
java
private static Bson prefixQuery(String fieldName, String prefix){ return Filters.regex(fieldName, "^" + RegexEscape.escape(prefix) + ".*"); }
[ "private", "static", "Bson", "prefixQuery", "(", "String", "fieldName", ",", "String", "prefix", ")", "{", "return", "Filters", ".", "regex", "(", "fieldName", ",", "\"^\"", "+", "RegexEscape", ".", "escape", "(", "prefix", ")", "+", "\".*\"", ")", ";", "}" ]
enables index range scan
[ "enables", "index", "range", "scan" ]
a51511be7d8bcee3e1812db8b7e69a45330b4e14
https://github.com/javers/javers/blob/a51511be7d8bcee3e1812db8b7e69a45330b4e14/javers-persistence-mongo/src/main/java/org/javers/repository/mongo/MongoRepository.java#L354-L356
train
javers/javers
javers-core/src/main/java/org/javers/common/collections/Lists.java
Lists.positiveFilter
public static <T> List<T> positiveFilter(List<T> input, Predicate<T> filter) { argumentsAreNotNull(input, filter); return input.stream().filter(filter).collect(Collectors.toList()); }
java
public static <T> List<T> positiveFilter(List<T> input, Predicate<T> filter) { argumentsAreNotNull(input, filter); return input.stream().filter(filter).collect(Collectors.toList()); }
[ "public", "static", "<", "T", ">", "List", "<", "T", ">", "positiveFilter", "(", "List", "<", "T", ">", "input", ",", "Predicate", "<", "T", ">", "filter", ")", "{", "argumentsAreNotNull", "(", "input", ",", "filter", ")", ";", "return", "input", ".", "stream", "(", ")", ".", "filter", "(", "filter", ")", ".", "collect", "(", "Collectors", ".", "toList", "(", ")", ")", ";", "}" ]
returns new list with elements from input that satisfies given filter condition
[ "returns", "new", "list", "with", "elements", "from", "input", "that", "satisfies", "given", "filter", "condition" ]
a51511be7d8bcee3e1812db8b7e69a45330b4e14
https://github.com/javers/javers/blob/a51511be7d8bcee3e1812db8b7e69a45330b4e14/javers-core/src/main/java/org/javers/common/collections/Lists.java#L75-L78
train
javers/javers
javers-core/src/main/java/org/javers/common/collections/Lists.java
Lists.negativeFilter
public static <T> List<T> negativeFilter(List<T> input, final Predicate<T> filter) { argumentsAreNotNull(input, filter); return input.stream().filter(element -> !filter.test(element)).collect(Collectors.toList()); }
java
public static <T> List<T> negativeFilter(List<T> input, final Predicate<T> filter) { argumentsAreNotNull(input, filter); return input.stream().filter(element -> !filter.test(element)).collect(Collectors.toList()); }
[ "public", "static", "<", "T", ">", "List", "<", "T", ">", "negativeFilter", "(", "List", "<", "T", ">", "input", ",", "final", "Predicate", "<", "T", ">", "filter", ")", "{", "argumentsAreNotNull", "(", "input", ",", "filter", ")", ";", "return", "input", ".", "stream", "(", ")", ".", "filter", "(", "element", "->", "!", "filter", ".", "test", "(", "element", ")", ")", ".", "collect", "(", "Collectors", ".", "toList", "(", ")", ")", ";", "}" ]
returns new list with elements from input that don't satisfies given filter condition
[ "returns", "new", "list", "with", "elements", "from", "input", "that", "don", "t", "satisfies", "given", "filter", "condition" ]
a51511be7d8bcee3e1812db8b7e69a45330b4e14
https://github.com/javers/javers/blob/a51511be7d8bcee3e1812db8b7e69a45330b4e14/javers-core/src/main/java/org/javers/common/collections/Lists.java#L83-L86
train
javers/javers
javers-core/src/main/java/org/javers/repository/jql/QueryBuilder.java
QueryBuilder.withChangedProperty
public QueryBuilder withChangedProperty(String propertyName) { Validate.argumentIsNotNull(propertyName); queryParamsBuilder.changedProperty(propertyName); return this; }
java
public QueryBuilder withChangedProperty(String propertyName) { Validate.argumentIsNotNull(propertyName); queryParamsBuilder.changedProperty(propertyName); return this; }
[ "public", "QueryBuilder", "withChangedProperty", "(", "String", "propertyName", ")", "{", "Validate", ".", "argumentIsNotNull", "(", "propertyName", ")", ";", "queryParamsBuilder", ".", "changedProperty", "(", "propertyName", ")", ";", "return", "this", ";", "}" ]
Only snapshots which changed a given property. @see CdoSnapshot#getChanged()
[ "Only", "snapshots", "which", "changed", "a", "given", "property", "." ]
a51511be7d8bcee3e1812db8b7e69a45330b4e14
https://github.com/javers/javers/blob/a51511be7d8bcee3e1812db8b7e69a45330b4e14/javers-core/src/main/java/org/javers/repository/jql/QueryBuilder.java#L189-L193
train
javers/javers
javers-core/src/main/java/org/javers/repository/jql/QueryBuilder.java
QueryBuilder.withCommitId
public QueryBuilder withCommitId(CommitId commitId) { Validate.argumentIsNotNull(commitId); queryParamsBuilder.commitId(commitId); return this; }
java
public QueryBuilder withCommitId(CommitId commitId) { Validate.argumentIsNotNull(commitId); queryParamsBuilder.commitId(commitId); return this; }
[ "public", "QueryBuilder", "withCommitId", "(", "CommitId", "commitId", ")", "{", "Validate", ".", "argumentIsNotNull", "(", "commitId", ")", ";", "queryParamsBuilder", ".", "commitId", "(", "commitId", ")", ";", "return", "this", ";", "}" ]
Only snapshots created in a given commit.
[ "Only", "snapshots", "created", "in", "a", "given", "commit", "." ]
a51511be7d8bcee3e1812db8b7e69a45330b4e14
https://github.com/javers/javers/blob/a51511be7d8bcee3e1812db8b7e69a45330b4e14/javers-core/src/main/java/org/javers/repository/jql/QueryBuilder.java#L328-L332
train
javers/javers
javers-core/src/main/java/org/javers/repository/jql/QueryBuilder.java
QueryBuilder.withCommitIds
public QueryBuilder withCommitIds(Collection<BigDecimal> commitIds) { Validate.argumentIsNotNull(commitIds); queryParamsBuilder.commitIds(commitIds.stream().map(CommitId::valueOf).collect(Collectors.toSet())); return this; }
java
public QueryBuilder withCommitIds(Collection<BigDecimal> commitIds) { Validate.argumentIsNotNull(commitIds); queryParamsBuilder.commitIds(commitIds.stream().map(CommitId::valueOf).collect(Collectors.toSet())); return this; }
[ "public", "QueryBuilder", "withCommitIds", "(", "Collection", "<", "BigDecimal", ">", "commitIds", ")", "{", "Validate", ".", "argumentIsNotNull", "(", "commitIds", ")", ";", "queryParamsBuilder", ".", "commitIds", "(", "commitIds", ".", "stream", "(", ")", ".", "map", "(", "CommitId", "::", "valueOf", ")", ".", "collect", "(", "Collectors", ".", "toSet", "(", ")", ")", ")", ";", "return", "this", ";", "}" ]
Only snapshots created in given commits.
[ "Only", "snapshots", "created", "in", "given", "commits", "." ]
a51511be7d8bcee3e1812db8b7e69a45330b4e14
https://github.com/javers/javers/blob/a51511be7d8bcee3e1812db8b7e69a45330b4e14/javers-core/src/main/java/org/javers/repository/jql/QueryBuilder.java#L346-L350
train
javers/javers
javers-core/src/main/java/org/javers/repository/jql/QueryBuilder.java
QueryBuilder.toCommitId
public QueryBuilder toCommitId(CommitId commitId) { Validate.argumentIsNotNull(commitId); queryParamsBuilder.toCommitId(commitId); return this; }
java
public QueryBuilder toCommitId(CommitId commitId) { Validate.argumentIsNotNull(commitId); queryParamsBuilder.toCommitId(commitId); return this; }
[ "public", "QueryBuilder", "toCommitId", "(", "CommitId", "commitId", ")", "{", "Validate", ".", "argumentIsNotNull", "(", "commitId", ")", ";", "queryParamsBuilder", ".", "toCommitId", "(", "commitId", ")", ";", "return", "this", ";", "}" ]
Only snapshots created before this commit or exactly in this commit.
[ "Only", "snapshots", "created", "before", "this", "commit", "or", "exactly", "in", "this", "commit", "." ]
a51511be7d8bcee3e1812db8b7e69a45330b4e14
https://github.com/javers/javers/blob/a51511be7d8bcee3e1812db8b7e69a45330b4e14/javers-core/src/main/java/org/javers/repository/jql/QueryBuilder.java#L355-L359
train
javers/javers
javers-core/src/main/java/org/javers/repository/jql/QueryBuilder.java
QueryBuilder.byAuthor
public QueryBuilder byAuthor(String author) { Validate.argumentIsNotNull(author); queryParamsBuilder.author(author); return this; }
java
public QueryBuilder byAuthor(String author) { Validate.argumentIsNotNull(author); queryParamsBuilder.author(author); return this; }
[ "public", "QueryBuilder", "byAuthor", "(", "String", "author", ")", "{", "Validate", ".", "argumentIsNotNull", "(", "author", ")", ";", "queryParamsBuilder", ".", "author", "(", "author", ")", ";", "return", "this", ";", "}" ]
Only snapshots committed by a given author. @since 2.0
[ "Only", "snapshots", "committed", "by", "a", "given", "author", "." ]
a51511be7d8bcee3e1812db8b7e69a45330b4e14
https://github.com/javers/javers/blob/a51511be7d8bcee3e1812db8b7e69a45330b4e14/javers-core/src/main/java/org/javers/repository/jql/QueryBuilder.java#L496-L500
train
javers/javers
javers-core/src/main/java/org/javers/common/reflection/ReflectionUtil.java
ReflectionUtil.classForName
public static Class<?> classForName(String className) { try { return Class.forName(className, false, Javers.class.getClassLoader()); } catch (ClassNotFoundException ex) { throw new JaversException(ex); } }
java
public static Class<?> classForName(String className) { try { return Class.forName(className, false, Javers.class.getClassLoader()); } catch (ClassNotFoundException ex) { throw new JaversException(ex); } }
[ "public", "static", "Class", "<", "?", ">", "classForName", "(", "String", "className", ")", "{", "try", "{", "return", "Class", ".", "forName", "(", "className", ",", "false", ",", "Javers", ".", "class", ".", "getClassLoader", "(", ")", ")", ";", "}", "catch", "(", "ClassNotFoundException", "ex", ")", "{", "throw", "new", "JaversException", "(", "ex", ")", ";", "}", "}" ]
throws RuntimeException if class is not found
[ "throws", "RuntimeException", "if", "class", "is", "not", "found" ]
a51511be7d8bcee3e1812db8b7e69a45330b4e14
https://github.com/javers/javers/blob/a51511be7d8bcee3e1812db8b7e69a45330b4e14/javers-core/src/main/java/org/javers/common/reflection/ReflectionUtil.java#L41-L48
train
javers/javers
javers-core/src/main/java/org/javers/common/reflection/ReflectionUtil.java
ReflectionUtil.newInstance
public static Object newInstance(Class clazz, ArgumentResolver resolver){ Validate.argumentIsNotNull(clazz); for (Constructor constructor : clazz.getDeclaredConstructors()) { if (isPrivate(constructor) || isProtected(constructor)) { continue; } Class [] types = constructor.getParameterTypes(); Object[] params = new Object[types.length]; for (int i=0; i<types.length; i++){ try { params[i] = resolver.resolve(types[i]); } catch (JaversException e){ logger.error("failed to create new instance of "+clazz.getName()+", argument resolver for arg["+i+"] " + types[i].getName() + " thrown exception: "+e.getMessage()); throw e; } } try { constructor.setAccessible(true); return constructor.newInstance(params); } catch (Exception e) { throw new RuntimeException(e); } } throw new JaversException(JaversExceptionCode.NO_PUBLIC_CONSTRUCTOR,clazz.getName()); }
java
public static Object newInstance(Class clazz, ArgumentResolver resolver){ Validate.argumentIsNotNull(clazz); for (Constructor constructor : clazz.getDeclaredConstructors()) { if (isPrivate(constructor) || isProtected(constructor)) { continue; } Class [] types = constructor.getParameterTypes(); Object[] params = new Object[types.length]; for (int i=0; i<types.length; i++){ try { params[i] = resolver.resolve(types[i]); } catch (JaversException e){ logger.error("failed to create new instance of "+clazz.getName()+", argument resolver for arg["+i+"] " + types[i].getName() + " thrown exception: "+e.getMessage()); throw e; } } try { constructor.setAccessible(true); return constructor.newInstance(params); } catch (Exception e) { throw new RuntimeException(e); } } throw new JaversException(JaversExceptionCode.NO_PUBLIC_CONSTRUCTOR,clazz.getName()); }
[ "public", "static", "Object", "newInstance", "(", "Class", "clazz", ",", "ArgumentResolver", "resolver", ")", "{", "Validate", ".", "argumentIsNotNull", "(", "clazz", ")", ";", "for", "(", "Constructor", "constructor", ":", "clazz", ".", "getDeclaredConstructors", "(", ")", ")", "{", "if", "(", "isPrivate", "(", "constructor", ")", "||", "isProtected", "(", "constructor", ")", ")", "{", "continue", ";", "}", "Class", "[", "]", "types", "=", "constructor", ".", "getParameterTypes", "(", ")", ";", "Object", "[", "]", "params", "=", "new", "Object", "[", "types", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "types", ".", "length", ";", "i", "++", ")", "{", "try", "{", "params", "[", "i", "]", "=", "resolver", ".", "resolve", "(", "types", "[", "i", "]", ")", ";", "}", "catch", "(", "JaversException", "e", ")", "{", "logger", ".", "error", "(", "\"failed to create new instance of \"", "+", "clazz", ".", "getName", "(", ")", "+", "\", argument resolver for arg[\"", "+", "i", "+", "\"] \"", "+", "types", "[", "i", "]", ".", "getName", "(", ")", "+", "\" thrown exception: \"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "throw", "e", ";", "}", "}", "try", "{", "constructor", ".", "setAccessible", "(", "true", ")", ";", "return", "constructor", ".", "newInstance", "(", "params", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "}", "throw", "new", "JaversException", "(", "JaversExceptionCode", ".", "NO_PUBLIC_CONSTRUCTOR", ",", "clazz", ".", "getName", "(", ")", ")", ";", "}" ]
Creates new instance of public or package-private class. Calls first, not-private constructor
[ "Creates", "new", "instance", "of", "public", "or", "package", "-", "private", "class", ".", "Calls", "first", "not", "-", "private", "constructor" ]
a51511be7d8bcee3e1812db8b7e69a45330b4e14
https://github.com/javers/javers/blob/a51511be7d8bcee3e1812db8b7e69a45330b4e14/javers-core/src/main/java/org/javers/common/reflection/ReflectionUtil.java#L64-L90
train
javers/javers
javers-core/src/main/java/org/javers/core/metamodel/type/JaversType.java
JaversType.spawn
JaversType spawn(Type baseJavaType) { try { Constructor c = this.getClass().getConstructor(Type.class); return (JaversType)c.newInstance(new Object[]{baseJavaType}); } catch (ReflectiveOperationException exception) { throw new RuntimeException("error calling Constructor for " + this.getClass().getName(), exception); } }
java
JaversType spawn(Type baseJavaType) { try { Constructor c = this.getClass().getConstructor(Type.class); return (JaversType)c.newInstance(new Object[]{baseJavaType}); } catch (ReflectiveOperationException exception) { throw new RuntimeException("error calling Constructor for " + this.getClass().getName(), exception); } }
[ "JaversType", "spawn", "(", "Type", "baseJavaType", ")", "{", "try", "{", "Constructor", "c", "=", "this", ".", "getClass", "(", ")", ".", "getConstructor", "(", "Type", ".", "class", ")", ";", "return", "(", "JaversType", ")", "c", ".", "newInstance", "(", "new", "Object", "[", "]", "{", "baseJavaType", "}", ")", ";", "}", "catch", "(", "ReflectiveOperationException", "exception", ")", "{", "throw", "new", "RuntimeException", "(", "\"error calling Constructor for \"", "+", "this", ".", "getClass", "(", ")", ".", "getName", "(", ")", ",", "exception", ")", ";", "}", "}" ]
Factory method, delegates to self constructor
[ "Factory", "method", "delegates", "to", "self", "constructor" ]
a51511be7d8bcee3e1812db8b7e69a45330b4e14
https://github.com/javers/javers/blob/a51511be7d8bcee3e1812db8b7e69a45330b4e14/javers-core/src/main/java/org/javers/core/metamodel/type/JaversType.java#L45-L52
train
thorntail/thorntail
fractions/topology-webapp/src/main/java/org/wildfly/swarm/topology/webapp/runtime/TopologySSEServlet.java
TopologySSEServlet.formatMaybeIpv6
private String formatMaybeIpv6(String address) { String openBracket = "["; String closeBracket = "]"; if (address.contains(":") && !address.startsWith(openBracket) && !address.endsWith(closeBracket)) { return openBracket + address + closeBracket; } return address; }
java
private String formatMaybeIpv6(String address) { String openBracket = "["; String closeBracket = "]"; if (address.contains(":") && !address.startsWith(openBracket) && !address.endsWith(closeBracket)) { return openBracket + address + closeBracket; } return address; }
[ "private", "String", "formatMaybeIpv6", "(", "String", "address", ")", "{", "String", "openBracket", "=", "\"[\"", ";", "String", "closeBracket", "=", "\"]\"", ";", "if", "(", "address", ".", "contains", "(", "\":\"", ")", "&&", "!", "address", ".", "startsWith", "(", "openBracket", ")", "&&", "!", "address", ".", "endsWith", "(", "closeBracket", ")", ")", "{", "return", "openBracket", "+", "address", "+", "closeBracket", ";", "}", "return", "address", ";", "}" ]
This isn't very precise; org.jboss.as.network.NetworkUtils has better implementation, but that's in a private module.
[ "This", "isn", "t", "very", "precise", ";", "org", ".", "jboss", ".", "as", ".", "network", ".", "NetworkUtils", "has", "better", "implementation", "but", "that", "s", "in", "a", "private", "module", "." ]
4a391b68ffae98c6e66d30a3bfb99dadc9509f14
https://github.com/thorntail/thorntail/blob/4a391b68ffae98c6e66d30a3bfb99dadc9509f14/fractions/topology-webapp/src/main/java/org/wildfly/swarm/topology/webapp/runtime/TopologySSEServlet.java#L168-L177
train
thorntail/thorntail
fractions/microprofile/microprofile-jwt/src/main/java/org/wildfly/swarm/microprofile/jwtauth/deployment/auth/MpJwtPrincipalHandler.java
MpJwtPrincipalHandler.handleRequest
@Override public void handleRequest(HttpServerExchange exchange) throws Exception { Account account = exchange.getSecurityContext().getAuthenticatedAccount(); if (account != null && account.getPrincipal() instanceof JsonWebToken) { JsonWebToken token = (JsonWebToken)account.getPrincipal(); PrincipalProducer myInstance = CDI.current().select(PrincipalProducer.class).get(); myInstance.setJsonWebToken(token); } next.handleRequest(exchange); }
java
@Override public void handleRequest(HttpServerExchange exchange) throws Exception { Account account = exchange.getSecurityContext().getAuthenticatedAccount(); if (account != null && account.getPrincipal() instanceof JsonWebToken) { JsonWebToken token = (JsonWebToken)account.getPrincipal(); PrincipalProducer myInstance = CDI.current().select(PrincipalProducer.class).get(); myInstance.setJsonWebToken(token); } next.handleRequest(exchange); }
[ "@", "Override", "public", "void", "handleRequest", "(", "HttpServerExchange", "exchange", ")", "throws", "Exception", "{", "Account", "account", "=", "exchange", ".", "getSecurityContext", "(", ")", ".", "getAuthenticatedAccount", "(", ")", ";", "if", "(", "account", "!=", "null", "&&", "account", ".", "getPrincipal", "(", ")", "instanceof", "JsonWebToken", ")", "{", "JsonWebToken", "token", "=", "(", "JsonWebToken", ")", "account", ".", "getPrincipal", "(", ")", ";", "PrincipalProducer", "myInstance", "=", "CDI", ".", "current", "(", ")", ".", "select", "(", "PrincipalProducer", ".", "class", ")", ".", "get", "(", ")", ";", "myInstance", ".", "setJsonWebToken", "(", "token", ")", ";", "}", "next", ".", "handleRequest", "(", "exchange", ")", ";", "}" ]
If there is a JWTAccount installed in the exchange security context, create @param exchange - the request/response exchange @throws Exception on failure
[ "If", "there", "is", "a", "JWTAccount", "installed", "in", "the", "exchange", "security", "context", "create" ]
4a391b68ffae98c6e66d30a3bfb99dadc9509f14
https://github.com/thorntail/thorntail/blob/4a391b68ffae98c6e66d30a3bfb99dadc9509f14/fractions/microprofile/microprofile-jwt/src/main/java/org/wildfly/swarm/microprofile/jwtauth/deployment/auth/MpJwtPrincipalHandler.java#L46-L55
train
thorntail/thorntail
core/container/src/main/java/org/wildfly/swarm/cli/CommandLine.java
CommandLine.defaultOptions
public static Options defaultOptions() { return new Options( HELP, CONFIG_HELP, YAML_HELP, VERSION, PROPERTY, PROPERTIES_URL, SERVER_CONFIG, CONFIG, PROFILES, BIND ); }
java
public static Options defaultOptions() { return new Options( HELP, CONFIG_HELP, YAML_HELP, VERSION, PROPERTY, PROPERTIES_URL, SERVER_CONFIG, CONFIG, PROFILES, BIND ); }
[ "public", "static", "Options", "defaultOptions", "(", ")", "{", "return", "new", "Options", "(", "HELP", ",", "CONFIG_HELP", ",", "YAML_HELP", ",", "VERSION", ",", "PROPERTY", ",", "PROPERTIES_URL", ",", "SERVER_CONFIG", ",", "CONFIG", ",", "PROFILES", ",", "BIND", ")", ";", "}" ]
Default set of options
[ "Default", "set", "of", "options" ]
4a391b68ffae98c6e66d30a3bfb99dadc9509f14
https://github.com/thorntail/thorntail/blob/4a391b68ffae98c6e66d30a3bfb99dadc9509f14/core/container/src/main/java/org/wildfly/swarm/cli/CommandLine.java#L174-L187
train
thorntail/thorntail
core/container/src/main/java/org/wildfly/swarm/cli/CommandLine.java
CommandLine.put
public <T> void put(Option<T> key, T value) { this.values.put(key, value); }
java
public <T> void put(Option<T> key, T value) { this.values.put(key, value); }
[ "public", "<", "T", ">", "void", "put", "(", "Option", "<", "T", ">", "key", ",", "T", "value", ")", "{", "this", ".", "values", ".", "put", "(", "key", ",", "value", ")", ";", "}" ]
Put a value under a given key. @param key The key. @param value The value. @param <T> The type of the value.
[ "Put", "a", "value", "under", "a", "given", "key", "." ]
4a391b68ffae98c6e66d30a3bfb99dadc9509f14
https://github.com/thorntail/thorntail/blob/4a391b68ffae98c6e66d30a3bfb99dadc9509f14/core/container/src/main/java/org/wildfly/swarm/cli/CommandLine.java#L200-L202
train
thorntail/thorntail
core/container/src/main/java/org/wildfly/swarm/cli/CommandLine.java
CommandLine.get
@SuppressWarnings("unchecked") public <T> T get(Option<T> key) { T v = (T) this.values.get(key); if (v == null) { v = key.defaultValue(); this.values.put(key, v); } return v; }
java
@SuppressWarnings("unchecked") public <T> T get(Option<T> key) { T v = (T) this.values.get(key); if (v == null) { v = key.defaultValue(); this.values.put(key, v); } return v; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "T", ">", "T", "get", "(", "Option", "<", "T", ">", "key", ")", "{", "T", "v", "=", "(", "T", ")", "this", ".", "values", ".", "get", "(", "key", ")", ";", "if", "(", "v", "==", "null", ")", "{", "v", "=", "key", ".", "defaultValue", "(", ")", ";", "this", ".", "values", ".", "put", "(", "key", ",", "v", ")", ";", "}", "return", "v", ";", "}" ]
Retrieve a value under a given key. @param key The key. @param <T> The type of the value. @return The previously stored value, or the default provided by key if none has been previously stored. The default will then be stored.
[ "Retrieve", "a", "value", "under", "a", "given", "key", "." ]
4a391b68ffae98c6e66d30a3bfb99dadc9509f14
https://github.com/thorntail/thorntail/blob/4a391b68ffae98c6e66d30a3bfb99dadc9509f14/core/container/src/main/java/org/wildfly/swarm/cli/CommandLine.java#L211-L219
train
thorntail/thorntail
core/container/src/main/java/org/wildfly/swarm/cli/CommandLine.java
CommandLine.applyProperties
public void applyProperties(Swarm swarm) throws IOException { URL propsUrl = get(PROPERTIES_URL); if (propsUrl != null) { Properties urlProps = new Properties(); urlProps.load(propsUrl.openStream()); for (String name : urlProps.stringPropertyNames()) { swarm.withProperty(name, urlProps.getProperty(name)); } } Properties props = get(PROPERTY); for (String name : props.stringPropertyNames()) { swarm.withProperty(name, props.getProperty(name)); } if (get(BIND) != null) { swarm.withProperty(SwarmProperties.BIND_ADDRESS, get(BIND)); } }
java
public void applyProperties(Swarm swarm) throws IOException { URL propsUrl = get(PROPERTIES_URL); if (propsUrl != null) { Properties urlProps = new Properties(); urlProps.load(propsUrl.openStream()); for (String name : urlProps.stringPropertyNames()) { swarm.withProperty(name, urlProps.getProperty(name)); } } Properties props = get(PROPERTY); for (String name : props.stringPropertyNames()) { swarm.withProperty(name, props.getProperty(name)); } if (get(BIND) != null) { swarm.withProperty(SwarmProperties.BIND_ADDRESS, get(BIND)); } }
[ "public", "void", "applyProperties", "(", "Swarm", "swarm", ")", "throws", "IOException", "{", "URL", "propsUrl", "=", "get", "(", "PROPERTIES_URL", ")", ";", "if", "(", "propsUrl", "!=", "null", ")", "{", "Properties", "urlProps", "=", "new", "Properties", "(", ")", ";", "urlProps", ".", "load", "(", "propsUrl", ".", "openStream", "(", ")", ")", ";", "for", "(", "String", "name", ":", "urlProps", ".", "stringPropertyNames", "(", ")", ")", "{", "swarm", ".", "withProperty", "(", "name", ",", "urlProps", ".", "getProperty", "(", "name", ")", ")", ";", "}", "}", "Properties", "props", "=", "get", "(", "PROPERTY", ")", ";", "for", "(", "String", "name", ":", "props", ".", "stringPropertyNames", "(", ")", ")", "{", "swarm", ".", "withProperty", "(", "name", ",", "props", ".", "getProperty", "(", "name", ")", ")", ";", "}", "if", "(", "get", "(", "BIND", ")", "!=", "null", ")", "{", "swarm", ".", "withProperty", "(", "SwarmProperties", ".", "BIND_ADDRESS", ",", "get", "(", "BIND", ")", ")", ";", "}", "}" ]
Apply properties to the system properties. <p>Applies values stored through the <code>Key.PROPERTIES</code>, <code>Key.PROPERTIES_URL</code> or <code>Key.BIND</code> options. @throws IOException If a URL is attempted to be read and fails.
[ "Apply", "properties", "to", "the", "system", "properties", "." ]
4a391b68ffae98c6e66d30a3bfb99dadc9509f14
https://github.com/thorntail/thorntail/blob/4a391b68ffae98c6e66d30a3bfb99dadc9509f14/core/container/src/main/java/org/wildfly/swarm/cli/CommandLine.java#L325-L347
train
thorntail/thorntail
core/container/src/main/java/org/wildfly/swarm/cli/CommandLine.java
CommandLine.applyConfigurations
public void applyConfigurations(Swarm swarm) throws IOException { if (get(SERVER_CONFIG) != null) { swarm.withXmlConfig(get(SERVER_CONFIG)); } if (get(CONFIG) != null) { List<URL> configs = get(CONFIG); for (URL config : configs) { swarm.withConfig(config); } } if (get(PROFILES) != null) { List<String> profiles = get(PROFILES); for (String profile : profiles) { swarm.withProfile(profile); } } }
java
public void applyConfigurations(Swarm swarm) throws IOException { if (get(SERVER_CONFIG) != null) { swarm.withXmlConfig(get(SERVER_CONFIG)); } if (get(CONFIG) != null) { List<URL> configs = get(CONFIG); for (URL config : configs) { swarm.withConfig(config); } } if (get(PROFILES) != null) { List<String> profiles = get(PROFILES); for (String profile : profiles) { swarm.withProfile(profile); } } }
[ "public", "void", "applyConfigurations", "(", "Swarm", "swarm", ")", "throws", "IOException", "{", "if", "(", "get", "(", "SERVER_CONFIG", ")", "!=", "null", ")", "{", "swarm", ".", "withXmlConfig", "(", "get", "(", "SERVER_CONFIG", ")", ")", ";", "}", "if", "(", "get", "(", "CONFIG", ")", "!=", "null", ")", "{", "List", "<", "URL", ">", "configs", "=", "get", "(", "CONFIG", ")", ";", "for", "(", "URL", "config", ":", "configs", ")", "{", "swarm", ".", "withConfig", "(", "config", ")", ";", "}", "}", "if", "(", "get", "(", "PROFILES", ")", "!=", "null", ")", "{", "List", "<", "String", ">", "profiles", "=", "get", "(", "PROFILES", ")", ";", "for", "(", "String", "profile", ":", "profiles", ")", "{", "swarm", ".", "withProfile", "(", "profile", ")", ";", "}", "}", "}" ]
Apply configuration to the container. <p>Applies configuration from <code>Key.SERVER_CONFIG</code> and <code>Key.STAGE_CONFIG</code>.</p> @param swarm Swarm instance to configure. @throws MalformedURLException If a URL is attempted to be read and fails.
[ "Apply", "configuration", "to", "the", "container", "." ]
4a391b68ffae98c6e66d30a3bfb99dadc9509f14
https://github.com/thorntail/thorntail/blob/4a391b68ffae98c6e66d30a3bfb99dadc9509f14/core/container/src/main/java/org/wildfly/swarm/cli/CommandLine.java#L357-L373
train
thorntail/thorntail
core/container/src/main/java/org/wildfly/swarm/cli/CommandLine.java
CommandLine.apply
public void apply(Swarm swarm) throws IOException, ModuleLoadException { applyProperties(swarm); applyConfigurations(swarm); if (get(HELP)) { displayVersion(System.err); System.err.println(); displayHelp(System.err); System.exit(0); } if (get(CONFIG_HELP) != null) { displayConfigHelp(System.err, get(CONFIG_HELP)); System.exit(0); } if (get(YAML_HELP) != null) { dumpYaml(System.err, get(YAML_HELP)); System.exit(0); } if (get(VERSION)) { displayVersion(System.err); } }
java
public void apply(Swarm swarm) throws IOException, ModuleLoadException { applyProperties(swarm); applyConfigurations(swarm); if (get(HELP)) { displayVersion(System.err); System.err.println(); displayHelp(System.err); System.exit(0); } if (get(CONFIG_HELP) != null) { displayConfigHelp(System.err, get(CONFIG_HELP)); System.exit(0); } if (get(YAML_HELP) != null) { dumpYaml(System.err, get(YAML_HELP)); System.exit(0); } if (get(VERSION)) { displayVersion(System.err); } }
[ "public", "void", "apply", "(", "Swarm", "swarm", ")", "throws", "IOException", ",", "ModuleLoadException", "{", "applyProperties", "(", "swarm", ")", ";", "applyConfigurations", "(", "swarm", ")", ";", "if", "(", "get", "(", "HELP", ")", ")", "{", "displayVersion", "(", "System", ".", "err", ")", ";", "System", ".", "err", ".", "println", "(", ")", ";", "displayHelp", "(", "System", ".", "err", ")", ";", "System", ".", "exit", "(", "0", ")", ";", "}", "if", "(", "get", "(", "CONFIG_HELP", ")", "!=", "null", ")", "{", "displayConfigHelp", "(", "System", ".", "err", ",", "get", "(", "CONFIG_HELP", ")", ")", ";", "System", ".", "exit", "(", "0", ")", ";", "}", "if", "(", "get", "(", "YAML_HELP", ")", "!=", "null", ")", "{", "dumpYaml", "(", "System", ".", "err", ",", "get", "(", "YAML_HELP", ")", ")", ";", "System", ".", "exit", "(", "0", ")", ";", "}", "if", "(", "get", "(", "VERSION", ")", ")", "{", "displayVersion", "(", "System", ".", "err", ")", ";", "}", "}" ]
Apply properties and configuration from the parsed commandline to a container. @param swarm The Swarm instance to apply configuration to. @throws IOException If an error occurs resolving any URL.
[ "Apply", "properties", "and", "configuration", "from", "the", "parsed", "commandline", "to", "a", "container", "." ]
4a391b68ffae98c6e66d30a3bfb99dadc9509f14
https://github.com/thorntail/thorntail/blob/4a391b68ffae98c6e66d30a3bfb99dadc9509f14/core/container/src/main/java/org/wildfly/swarm/cli/CommandLine.java#L381-L405
train