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
auth0/Lock.Android
lib/src/main/java/com/auth0/android/lock/errors/AuthenticationError.java
AuthenticationError.getMessage
public String getMessage(Context context) { if (customMessage != null) { return customMessage; } return context.getResources().getString(message); }
java
public String getMessage(Context context) { if (customMessage != null) { return customMessage; } return context.getResources().getString(message); }
[ "public", "String", "getMessage", "(", "Context", "context", ")", "{", "if", "(", "customMessage", "!=", "null", ")", "{", "return", "customMessage", ";", "}", "return", "context", ".", "getResources", "(", ")", ".", "getString", "(", "message", ")", ";", ...
Getter for the error message. @param context a valid context. @return the user friendly message
[ "Getter", "for", "the", "error", "message", "." ]
8eb2a979048d2eb6cf0ec631e82e6c3fe6e7d220
https://github.com/auth0/Lock.Android/blob/8eb2a979048d2eb6cf0ec631e82e6c3fe6e7d220/lib/src/main/java/com/auth0/android/lock/errors/AuthenticationError.java#L52-L57
train
auth0/Lock.Android
app/src/main/java/com/auth0/android/lock/app/DemoActivity.java
DemoActivity.showResult
@SuppressWarnings("ConstantConditions") private void showResult(String message) { Snackbar.make(rootLayout, message, Snackbar.LENGTH_LONG).show(); }
java
@SuppressWarnings("ConstantConditions") private void showResult(String message) { Snackbar.make(rootLayout, message, Snackbar.LENGTH_LONG).show(); }
[ "@", "SuppressWarnings", "(", "\"ConstantConditions\"", ")", "private", "void", "showResult", "(", "String", "message", ")", "{", "Snackbar", ".", "make", "(", "rootLayout", ",", "message", ",", "Snackbar", ".", "LENGTH_LONG", ")", ".", "show", "(", ")", ";"...
Shows a Snackbar on the bottom of the layout @param message the text to show.
[ "Shows", "a", "Snackbar", "on", "the", "bottom", "of", "the", "layout" ]
8eb2a979048d2eb6cf0ec631e82e6c3fe6e7d220
https://github.com/auth0/Lock.Android/blob/8eb2a979048d2eb6cf0ec631e82e6c3fe6e7d220/app/src/main/java/com/auth0/android/lock/app/DemoActivity.java#L281-L284
train
auth0/Lock.Android
lib/src/main/java/com/auth0/android/lock/views/ViewUtils.java
ViewUtils.dipToPixels
static float dipToPixels(Resources resources, int dip) { return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dip, resources.getDisplayMetrics()); }
java
static float dipToPixels(Resources resources, int dip) { return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dip, resources.getDisplayMetrics()); }
[ "static", "float", "dipToPixels", "(", "Resources", "resources", ",", "int", "dip", ")", "{", "return", "TypedValue", ".", "applyDimension", "(", "TypedValue", ".", "COMPLEX_UNIT_DIP", ",", "dip", ",", "resources", ".", "getDisplayMetrics", "(", ")", ")", ";",...
Converts dp into px. @param resources the context's current resources. @param dip the dp value to convert to px. @return the result px value.
[ "Converts", "dp", "into", "px", "." ]
8eb2a979048d2eb6cf0ec631e82e6c3fe6e7d220
https://github.com/auth0/Lock.Android/blob/8eb2a979048d2eb6cf0ec631e82e6c3fe6e7d220/lib/src/main/java/com/auth0/android/lock/views/ViewUtils.java#L75-L77
train
auth0/Lock.Android
lib/src/main/java/com/auth0/android/lock/AuthenticationCallback.java
AuthenticationCallback.parseAuthentication
private void parseAuthentication(Intent data) { String idToken = data.getStringExtra(Constants.ID_TOKEN_EXTRA); String accessToken = data.getStringExtra(Constants.ACCESS_TOKEN_EXTRA); String tokenType = data.getStringExtra(Constants.TOKEN_TYPE_EXTRA); String refreshToken = data.getStringExtra(Constants.REFRESH_TOKEN_EXTRA); long expiresIn = data.getLongExtra(Constants.EXPIRES_IN_EXTRA, 0); Credentials credentials = new Credentials(idToken, accessToken, tokenType, refreshToken, expiresIn); Log.d(TAG, "User authenticated!"); onAuthentication(credentials); }
java
private void parseAuthentication(Intent data) { String idToken = data.getStringExtra(Constants.ID_TOKEN_EXTRA); String accessToken = data.getStringExtra(Constants.ACCESS_TOKEN_EXTRA); String tokenType = data.getStringExtra(Constants.TOKEN_TYPE_EXTRA); String refreshToken = data.getStringExtra(Constants.REFRESH_TOKEN_EXTRA); long expiresIn = data.getLongExtra(Constants.EXPIRES_IN_EXTRA, 0); Credentials credentials = new Credentials(idToken, accessToken, tokenType, refreshToken, expiresIn); Log.d(TAG, "User authenticated!"); onAuthentication(credentials); }
[ "private", "void", "parseAuthentication", "(", "Intent", "data", ")", "{", "String", "idToken", "=", "data", ".", "getStringExtra", "(", "Constants", ".", "ID_TOKEN_EXTRA", ")", ";", "String", "accessToken", "=", "data", ".", "getStringExtra", "(", "Constants", ...
Extracts the Authentication data from the intent data. @param data the intent received at the end of the login process.
[ "Extracts", "the", "Authentication", "data", "from", "the", "intent", "data", "." ]
8eb2a979048d2eb6cf0ec631e82e6c3fe6e7d220
https://github.com/auth0/Lock.Android/blob/8eb2a979048d2eb6cf0ec631e82e6c3fe6e7d220/lib/src/main/java/com/auth0/android/lock/AuthenticationCallback.java#L73-L83
train
auth0/Lock.Android
lib/src/main/java/com/auth0/android/lock/events/PasswordlessLoginEvent.java
PasswordlessLoginEvent.getCodeRequest
public ParameterizableRequest<Void, AuthenticationException> getCodeRequest(AuthenticationAPIClient apiClient, String connectionName) { Log.d(TAG, String.format("Generating Passwordless Code/Link request for connection %s", connectionName)); ParameterizableRequest<Void, AuthenticationException> request; if (getMode() == PasswordlessMode.EMAIL_CODE) { request = apiClient.passwordlessWithEmail(getEmailOrNumber(), PasswordlessType.CODE); } else if (getMode() == PasswordlessMode.EMAIL_LINK) { request = apiClient.passwordlessWithEmail(getEmailOrNumber(), PasswordlessType.ANDROID_LINK); } else if (getMode() == PasswordlessMode.SMS_CODE) { request = apiClient.passwordlessWithSMS(getEmailOrNumber(), PasswordlessType.CODE); } else { request = apiClient.passwordlessWithSMS(getEmailOrNumber(), PasswordlessType.ANDROID_LINK); } return request.addParameter(KEY_CONNECTION, connectionName); }
java
public ParameterizableRequest<Void, AuthenticationException> getCodeRequest(AuthenticationAPIClient apiClient, String connectionName) { Log.d(TAG, String.format("Generating Passwordless Code/Link request for connection %s", connectionName)); ParameterizableRequest<Void, AuthenticationException> request; if (getMode() == PasswordlessMode.EMAIL_CODE) { request = apiClient.passwordlessWithEmail(getEmailOrNumber(), PasswordlessType.CODE); } else if (getMode() == PasswordlessMode.EMAIL_LINK) { request = apiClient.passwordlessWithEmail(getEmailOrNumber(), PasswordlessType.ANDROID_LINK); } else if (getMode() == PasswordlessMode.SMS_CODE) { request = apiClient.passwordlessWithSMS(getEmailOrNumber(), PasswordlessType.CODE); } else { request = apiClient.passwordlessWithSMS(getEmailOrNumber(), PasswordlessType.ANDROID_LINK); } return request.addParameter(KEY_CONNECTION, connectionName); }
[ "public", "ParameterizableRequest", "<", "Void", ",", "AuthenticationException", ">", "getCodeRequest", "(", "AuthenticationAPIClient", "apiClient", ",", "String", "connectionName", ")", "{", "Log", ".", "d", "(", "TAG", ",", "String", ".", "format", "(", "\"Gener...
Creates the ParameterizableRequest that will initiate the Passwordless Authentication flow. @param apiClient the API Client instance @param connectionName the name of the passwordless connection to request the login with. Only 'sms' and 'email' connections are allowed here. @return the Passwordless code request request.
[ "Creates", "the", "ParameterizableRequest", "that", "will", "initiate", "the", "Passwordless", "Authentication", "flow", "." ]
8eb2a979048d2eb6cf0ec631e82e6c3fe6e7d220
https://github.com/auth0/Lock.Android/blob/8eb2a979048d2eb6cf0ec631e82e6c3fe6e7d220/lib/src/main/java/com/auth0/android/lock/events/PasswordlessLoginEvent.java#L96-L109
train
auth0/Lock.Android
lib/src/main/java/com/auth0/android/lock/events/PasswordlessLoginEvent.java
PasswordlessLoginEvent.getLoginRequest
public AuthenticationRequest getLoginRequest(AuthenticationAPIClient apiClient, String emailOrNumber) { Log.d(TAG, String.format("Generating Passwordless Login request for identity %s", emailOrNumber)); if (getMode() == PasswordlessMode.EMAIL_CODE || getMode() == PasswordlessMode.EMAIL_LINK) { return apiClient.loginWithEmail(emailOrNumber, getCode()); } else { return apiClient.loginWithPhoneNumber(emailOrNumber, getCode()); } }
java
public AuthenticationRequest getLoginRequest(AuthenticationAPIClient apiClient, String emailOrNumber) { Log.d(TAG, String.format("Generating Passwordless Login request for identity %s", emailOrNumber)); if (getMode() == PasswordlessMode.EMAIL_CODE || getMode() == PasswordlessMode.EMAIL_LINK) { return apiClient.loginWithEmail(emailOrNumber, getCode()); } else { return apiClient.loginWithPhoneNumber(emailOrNumber, getCode()); } }
[ "public", "AuthenticationRequest", "getLoginRequest", "(", "AuthenticationAPIClient", "apiClient", ",", "String", "emailOrNumber", ")", "{", "Log", ".", "d", "(", "TAG", ",", "String", ".", "format", "(", "\"Generating Passwordless Login request for identity %s\"", ",", ...
Creates the AuthenticationRequest that will finish the Passwordless Authentication flow. @param apiClient the API Client instance @param emailOrNumber the email or phone number used on the code request. @return the Passwordless login request.
[ "Creates", "the", "AuthenticationRequest", "that", "will", "finish", "the", "Passwordless", "Authentication", "flow", "." ]
8eb2a979048d2eb6cf0ec631e82e6c3fe6e7d220
https://github.com/auth0/Lock.Android/blob/8eb2a979048d2eb6cf0ec631e82e6c3fe6e7d220/lib/src/main/java/com/auth0/android/lock/events/PasswordlessLoginEvent.java#L118-L125
train
auth0/Lock.Android
lib/src/main/java/com/auth0/android/lock/views/PasswordStrengthView.java
PasswordStrengthView.isValid
public boolean isValid(String password) { if (password == null) { return false; } boolean length = hasMinimumLength(password, getMinimumLength()); boolean other = true; switch (complexity.getPasswordPolicy()) { case PasswordStrength.EXCELLENT: boolean atLeast = atLeastThree(hasLowercaseCharacters(password), hasUppercaseCharacters(password), hasNumericCharacters(password), hasSpecialCharacters(password)); other = hasIdenticalCharacters(password) && atLeast; break; case PasswordStrength.GOOD: other = atLeastThree(hasLowercaseCharacters(password), hasUppercaseCharacters(password), hasNumericCharacters(password), hasSpecialCharacters(password)); break; case PasswordStrength.FAIR: other = allThree(hasLowercaseCharacters(password), hasUppercaseCharacters(password), hasNumericCharacters(password)); break; case PasswordStrength.LOW: case PasswordStrength.NONE: } return length && other; }
java
public boolean isValid(String password) { if (password == null) { return false; } boolean length = hasMinimumLength(password, getMinimumLength()); boolean other = true; switch (complexity.getPasswordPolicy()) { case PasswordStrength.EXCELLENT: boolean atLeast = atLeastThree(hasLowercaseCharacters(password), hasUppercaseCharacters(password), hasNumericCharacters(password), hasSpecialCharacters(password)); other = hasIdenticalCharacters(password) && atLeast; break; case PasswordStrength.GOOD: other = atLeastThree(hasLowercaseCharacters(password), hasUppercaseCharacters(password), hasNumericCharacters(password), hasSpecialCharacters(password)); break; case PasswordStrength.FAIR: other = allThree(hasLowercaseCharacters(password), hasUppercaseCharacters(password), hasNumericCharacters(password)); break; case PasswordStrength.LOW: case PasswordStrength.NONE: } return length && other; }
[ "public", "boolean", "isValid", "(", "String", "password", ")", "{", "if", "(", "password", "==", "null", ")", "{", "return", "false", ";", "}", "boolean", "length", "=", "hasMinimumLength", "(", "password", ",", "getMinimumLength", "(", ")", ")", ";", "...
Checks that all the requirements are meet. @param password the current password to validate @return whether the given password complies with this password policy or not.
[ "Checks", "that", "all", "the", "requirements", "are", "meet", "." ]
8eb2a979048d2eb6cf0ec631e82e6c3fe6e7d220
https://github.com/auth0/Lock.Android/blob/8eb2a979048d2eb6cf0ec631e82e6c3fe6e7d220/lib/src/main/java/com/auth0/android/lock/views/PasswordStrengthView.java#L210-L232
train
auth0/Lock.Android
lib/src/main/java/com/auth0/android/lock/views/ClassicLockView.java
ClassicLockView.showProgress
public void showProgress(boolean show) { if (actionButton != null) { actionButton.showProgress(show); } if (formLayout != null) { formLayout.setEnabled(!show); } }
java
public void showProgress(boolean show) { if (actionButton != null) { actionButton.showProgress(show); } if (formLayout != null) { formLayout.setEnabled(!show); } }
[ "public", "void", "showProgress", "(", "boolean", "show", ")", "{", "if", "(", "actionButton", "!=", "null", ")", "{", "actionButton", ".", "showProgress", "(", "show", ")", ";", "}", "if", "(", "formLayout", "!=", "null", ")", "{", "formLayout", ".", ...
Displays a progress bar on top of the action button. This will also enable or disable the action button. @param show whether to show or hide the action bar.
[ "Displays", "a", "progress", "bar", "on", "top", "of", "the", "action", "button", ".", "This", "will", "also", "enable", "or", "disable", "the", "action", "button", "." ]
8eb2a979048d2eb6cf0ec631e82e6c3fe6e7d220
https://github.com/auth0/Lock.Android/blob/8eb2a979048d2eb6cf0ec631e82e6c3fe6e7d220/lib/src/main/java/com/auth0/android/lock/views/ClassicLockView.java#L294-L301
train
auth0/Lock.Android
lib/src/main/java/com/auth0/android/lock/views/ActionButton.java
ActionButton.showProgress
public void showProgress(boolean show) { Log.v(TAG, show ? "Disabling the button while showing progress" : "Enabling the button and hiding progress"); setEnabled(!show); progress.setVisibility(show ? VISIBLE : GONE); if (show) { icon.setVisibility(INVISIBLE); labeledLayout.setVisibility(INVISIBLE); return; } icon.setVisibility(shouldShowLabel ? GONE : VISIBLE); labeledLayout.setVisibility(!shouldShowLabel ? GONE : VISIBLE); }
java
public void showProgress(boolean show) { Log.v(TAG, show ? "Disabling the button while showing progress" : "Enabling the button and hiding progress"); setEnabled(!show); progress.setVisibility(show ? VISIBLE : GONE); if (show) { icon.setVisibility(INVISIBLE); labeledLayout.setVisibility(INVISIBLE); return; } icon.setVisibility(shouldShowLabel ? GONE : VISIBLE); labeledLayout.setVisibility(!shouldShowLabel ? GONE : VISIBLE); }
[ "public", "void", "showProgress", "(", "boolean", "show", ")", "{", "Log", ".", "v", "(", "TAG", ",", "show", "?", "\"Disabling the button while showing progress\"", ":", "\"Enabling the button and hiding progress\"", ")", ";", "setEnabled", "(", "!", "show", ")", ...
Used to display a progress bar and disable the button. @param show whether to show the progress bar or not.
[ "Used", "to", "display", "a", "progress", "bar", "and", "disable", "the", "button", "." ]
8eb2a979048d2eb6cf0ec631e82e6c3fe6e7d220
https://github.com/auth0/Lock.Android/blob/8eb2a979048d2eb6cf0ec631e82e6c3fe6e7d220/lib/src/main/java/com/auth0/android/lock/views/ActionButton.java#L109-L120
train
auth0/Lock.Android
lib/src/main/java/com/auth0/android/lock/views/ActionButton.java
ActionButton.showLabel
public void showLabel(boolean showLabel) { shouldShowLabel = showLabel; labeledLayout.setVisibility(showLabel ? VISIBLE : GONE); icon.setVisibility(!showLabel ? VISIBLE : GONE); }
java
public void showLabel(boolean showLabel) { shouldShowLabel = showLabel; labeledLayout.setVisibility(showLabel ? VISIBLE : GONE); icon.setVisibility(!showLabel ? VISIBLE : GONE); }
[ "public", "void", "showLabel", "(", "boolean", "showLabel", ")", "{", "shouldShowLabel", "=", "showLabel", ";", "labeledLayout", ".", "setVisibility", "(", "showLabel", "?", "VISIBLE", ":", "GONE", ")", ";", "icon", ".", "setVisibility", "(", "!", "showLabel",...
Whether to show an icon or a label with the current selected mode. By default, it will show the icon. @param showLabel whether to show an icon or a label.
[ "Whether", "to", "show", "an", "icon", "or", "a", "label", "with", "the", "current", "selected", "mode", ".", "By", "default", "it", "will", "show", "the", "icon", "." ]
8eb2a979048d2eb6cf0ec631e82e6c3fe6e7d220
https://github.com/auth0/Lock.Android/blob/8eb2a979048d2eb6cf0ec631e82e6c3fe6e7d220/lib/src/main/java/com/auth0/android/lock/views/ActionButton.java#L137-L141
train
auth0/Lock.Android
lib/src/main/java/com/auth0/android/lock/views/PasswordlessFormLayout.java
PasswordlessFormLayout.codeSent
public void codeSent(String emailOrNumber) { Log.d(TAG, "Now showing the Code Input Form"); if (passwordlessRequestCodeLayout != null) { removeView(passwordlessRequestCodeLayout); if (socialLayout != null) { socialLayout.setVisibility(GONE); } if (orSeparatorMessage != null) { orSeparatorMessage.setVisibility(GONE); } } addPasswordlessInputCodeLayout(emailOrNumber); lockWidget.updateHeaderTitle(R.string.com_auth0_lock_title_passwordless); }
java
public void codeSent(String emailOrNumber) { Log.d(TAG, "Now showing the Code Input Form"); if (passwordlessRequestCodeLayout != null) { removeView(passwordlessRequestCodeLayout); if (socialLayout != null) { socialLayout.setVisibility(GONE); } if (orSeparatorMessage != null) { orSeparatorMessage.setVisibility(GONE); } } addPasswordlessInputCodeLayout(emailOrNumber); lockWidget.updateHeaderTitle(R.string.com_auth0_lock_title_passwordless); }
[ "public", "void", "codeSent", "(", "String", "emailOrNumber", ")", "{", "Log", ".", "d", "(", "TAG", ",", "\"Now showing the Code Input Form\"", ")", ";", "if", "(", "passwordlessRequestCodeLayout", "!=", "null", ")", "{", "removeView", "(", "passwordlessRequestCo...
Notifies the form that the code was correctly sent and it should now wait for the user to input the valid code. @param emailOrNumber the email or phone number to which the code was sent.
[ "Notifies", "the", "form", "that", "the", "code", "was", "correctly", "sent", "and", "it", "should", "now", "wait", "for", "the", "user", "to", "input", "the", "valid", "code", "." ]
8eb2a979048d2eb6cf0ec631e82e6c3fe6e7d220
https://github.com/auth0/Lock.Android/blob/8eb2a979048d2eb6cf0ec631e82e6c3fe6e7d220/lib/src/main/java/com/auth0/android/lock/views/PasswordlessFormLayout.java#L156-L169
train
auth0/Lock.Android
lib/src/main/java/com/auth0/android/lock/WebProvider.java
WebProvider.resume
public boolean resume(int requestCode, int resultCode, Intent intent) { return WebAuthProvider.resume(requestCode, resultCode, intent); }
java
public boolean resume(int requestCode, int resultCode, Intent intent) { return WebAuthProvider.resume(requestCode, resultCode, intent); }
[ "public", "boolean", "resume", "(", "int", "requestCode", ",", "int", "resultCode", ",", "Intent", "intent", ")", "{", "return", "WebAuthProvider", ".", "resume", "(", "requestCode", ",", "resultCode", ",", "intent", ")", ";", "}" ]
Finishes the authentication flow in the WebAuthProvider @param requestCode the request code received on the onActivityResult method @param resultCode the result code received on the onActivityResult method @param intent the intent received in the onActivityResult method. @return true if a result was expected and has a valid format, or false if not
[ "Finishes", "the", "authentication", "flow", "in", "the", "WebAuthProvider" ]
8eb2a979048d2eb6cf0ec631e82e6c3fe6e7d220
https://github.com/auth0/Lock.Android/blob/8eb2a979048d2eb6cf0ec631e82e6c3fe6e7d220/lib/src/main/java/com/auth0/android/lock/WebProvider.java#L92-L94
train
auth0/Lock.Android
lib/src/main/java/com/auth0/android/lock/views/ValidatedInputView.java
ValidatedInputView.updateBorder
@CallSuper protected void updateBorder() { boolean isFocused = input.hasFocus() && !input.isInTouchMode(); ViewUtils.setBackground(outline, hasValidInput ? (isFocused ? focusedOutlineBackground : normalOutlineBackground) : errorOutlineBackground); errorDescription.setVisibility(hasValidInput ? GONE : VISIBLE); requestLayout(); }
java
@CallSuper protected void updateBorder() { boolean isFocused = input.hasFocus() && !input.isInTouchMode(); ViewUtils.setBackground(outline, hasValidInput ? (isFocused ? focusedOutlineBackground : normalOutlineBackground) : errorOutlineBackground); errorDescription.setVisibility(hasValidInput ? GONE : VISIBLE); requestLayout(); }
[ "@", "CallSuper", "protected", "void", "updateBorder", "(", ")", "{", "boolean", "isFocused", "=", "input", ".", "hasFocus", "(", ")", "&&", "!", "input", ".", "isInTouchMode", "(", ")", ";", "ViewUtils", ".", "setBackground", "(", "outline", ",", "hasVali...
Updates the view knowing if the input is valid or not.
[ "Updates", "the", "view", "knowing", "if", "the", "input", "is", "valid", "or", "not", "." ]
8eb2a979048d2eb6cf0ec631e82e6c3fe6e7d220
https://github.com/auth0/Lock.Android/blob/8eb2a979048d2eb6cf0ec631e82e6c3fe6e7d220/lib/src/main/java/com/auth0/android/lock/views/ValidatedInputView.java#L314-L320
train
auth0/Lock.Android
lib/src/main/java/com/auth0/android/lock/views/ValidatedInputView.java
ValidatedInputView.validate
protected boolean validate(boolean validateEmptyFields) { boolean isValid = false; String value = dataType == PASSWORD ? getText() : getText().trim(); if (!validateEmptyFields && value.isEmpty()) { return true; } switch (dataType) { case TEXT_NAME: case NUMBER: case PASSWORD: case NON_EMPTY_USERNAME: isValid = !value.isEmpty(); break; case EMAIL: isValid = value.matches(EMAIL_REGEX); break; case USERNAME: isValid = value.matches(USERNAME_REGEX) && value.length() >= 1 && value.length() <= 15; break; case USERNAME_OR_EMAIL: final boolean validEmail = value.matches(EMAIL_REGEX); final boolean validUsername = value.matches(USERNAME_REGEX) && value.length() >= 1 && value.length() <= 15; isValid = validEmail || validUsername; break; case MOBILE_PHONE: case PHONE_NUMBER: isValid = value.matches(PHONE_NUMBER_REGEX); break; case MFA_CODE: isValid = value.matches(CODE_REGEX); break; } Log.v(TAG, "Field validation results: Is valid? " + isValid); return isValid; }
java
protected boolean validate(boolean validateEmptyFields) { boolean isValid = false; String value = dataType == PASSWORD ? getText() : getText().trim(); if (!validateEmptyFields && value.isEmpty()) { return true; } switch (dataType) { case TEXT_NAME: case NUMBER: case PASSWORD: case NON_EMPTY_USERNAME: isValid = !value.isEmpty(); break; case EMAIL: isValid = value.matches(EMAIL_REGEX); break; case USERNAME: isValid = value.matches(USERNAME_REGEX) && value.length() >= 1 && value.length() <= 15; break; case USERNAME_OR_EMAIL: final boolean validEmail = value.matches(EMAIL_REGEX); final boolean validUsername = value.matches(USERNAME_REGEX) && value.length() >= 1 && value.length() <= 15; isValid = validEmail || validUsername; break; case MOBILE_PHONE: case PHONE_NUMBER: isValid = value.matches(PHONE_NUMBER_REGEX); break; case MFA_CODE: isValid = value.matches(CODE_REGEX); break; } Log.v(TAG, "Field validation results: Is valid? " + isValid); return isValid; }
[ "protected", "boolean", "validate", "(", "boolean", "validateEmptyFields", ")", "{", "boolean", "isValid", "=", "false", ";", "String", "value", "=", "dataType", "==", "PASSWORD", "?", "getText", "(", ")", ":", "getText", "(", ")", ".", "trim", "(", ")", ...
Validates the input data and updates the icon. DataType must be set. @param validateEmptyFields if an empty input should be considered invalid. @return whether the data is valid or not.
[ "Validates", "the", "input", "data", "and", "updates", "the", "icon", ".", "DataType", "must", "be", "set", "." ]
8eb2a979048d2eb6cf0ec631e82e6c3fe6e7d220
https://github.com/auth0/Lock.Android/blob/8eb2a979048d2eb6cf0ec631e82e6c3fe6e7d220/lib/src/main/java/com/auth0/android/lock/views/ValidatedInputView.java#L370-L406
train
auth0/Lock.Android
lib/src/main/java/com/auth0/android/lock/views/ValidatedInputView.java
ValidatedInputView.setText
public void setText(String text) { input.setText(""); if (text != null) { input.append(text); } }
java
public void setText(String text) { input.setText(""); if (text != null) { input.append(text); } }
[ "public", "void", "setText", "(", "String", "text", ")", "{", "input", ".", "setText", "(", "\"\"", ")", ";", "if", "(", "text", "!=", "null", ")", "{", "input", ".", "append", "(", "text", ")", ";", "}", "}" ]
Updates the input field text. @param text the new text to set.
[ "Updates", "the", "input", "field", "text", "." ]
8eb2a979048d2eb6cf0ec631e82e6c3fe6e7d220
https://github.com/auth0/Lock.Android/blob/8eb2a979048d2eb6cf0ec631e82e6c3fe6e7d220/lib/src/main/java/com/auth0/android/lock/views/ValidatedInputView.java#L422-L427
train
auth0/Lock.Android
lib/src/main/java/com/auth0/android/lock/views/ValidatedInputView.java
ValidatedInputView.clearInput
public void clearInput() { Log.v(TAG, "Input cleared and validation errors removed"); input.setText(""); hasValidInput = true; updateBorder(); showPasswordToggle.setChecked(false); }
java
public void clearInput() { Log.v(TAG, "Input cleared and validation errors removed"); input.setText(""); hasValidInput = true; updateBorder(); showPasswordToggle.setChecked(false); }
[ "public", "void", "clearInput", "(", ")", "{", "Log", ".", "v", "(", "TAG", ",", "\"Input cleared and validation errors removed\"", ")", ";", "input", ".", "setText", "(", "\"\"", ")", ";", "hasValidInput", "=", "true", ";", "updateBorder", "(", ")", ";", ...
Removes any text present on the input field and clears any validation error, if present.
[ "Removes", "any", "text", "present", "on", "the", "input", "field", "and", "clears", "any", "validation", "error", "if", "present", "." ]
8eb2a979048d2eb6cf0ec631e82e6c3fe6e7d220
https://github.com/auth0/Lock.Android/blob/8eb2a979048d2eb6cf0ec631e82e6c3fe6e7d220/lib/src/main/java/com/auth0/android/lock/views/ValidatedInputView.java#L483-L489
train
auth0/Lock.Android
lib/src/main/java/com/auth0/android/lock/views/AuthConfig.java
AuthConfig.styleForStrategy
@StyleRes public static int styleForStrategy(String strategyName) { int style = R.style.Lock_Theme_AuthStyle; switch (strategyName) { case "amazon": style = R.style.Lock_Theme_AuthStyle_Amazon; break; case "aol": style = R.style.Lock_Theme_AuthStyle_AOL; break; case "bitbucket": style = R.style.Lock_Theme_AuthStyle_BitBucket; break; case "dropbox": style = R.style.Lock_Theme_AuthStyle_Dropbox; break; case "yahoo": style = R.style.Lock_Theme_AuthStyle_Yahoo; break; case "linkedin": style = R.style.Lock_Theme_AuthStyle_LinkedIn; break; case "google-oauth2": style = R.style.Lock_Theme_AuthStyle_GoogleOAuth2; break; case "twitter": style = R.style.Lock_Theme_AuthStyle_Twitter; break; case "facebook": style = R.style.Lock_Theme_AuthStyle_Facebook; break; case "box": style = R.style.Lock_Theme_AuthStyle_Box; break; case "evernote": style = R.style.Lock_Theme_AuthStyle_Evernote; break; case "evernote-sandbox": style = R.style.Lock_Theme_AuthStyle_EvernoteSandbox; break; case "exact": style = R.style.Lock_Theme_AuthStyle_Exact; break; case "github": style = R.style.Lock_Theme_AuthStyle_GitHub; break; case "instagram": style = R.style.Lock_Theme_AuthStyle_Instagram; break; case "miicard": style = R.style.Lock_Theme_AuthStyle_MiiCard; break; case "paypal": style = R.style.Lock_Theme_AuthStyle_Paypal; break; case "paypal-sandbox": style = R.style.Lock_Theme_AuthStyle_PaypalSandbox; break; case "salesforce": style = R.style.Lock_Theme_AuthStyle_Salesforce; break; case "salesforce-community": style = R.style.Lock_Theme_AuthStyle_SalesforceCommunity; break; case "salesforce-sandbox": style = R.style.Lock_Theme_AuthStyle_SalesforceSandbox; break; case "soundcloud": style = R.style.Lock_Theme_AuthStyle_SoundCloud; break; case "windowslive": style = R.style.Lock_Theme_AuthStyle_WindowsLive; break; case "yammer": style = R.style.Lock_Theme_AuthStyle_Yammer; break; case "baidu": style = R.style.Lock_Theme_AuthStyle_Baidu; break; case "fitbit": style = R.style.Lock_Theme_AuthStyle_Fitbit; break; case "planningcenter": style = R.style.Lock_Theme_AuthStyle_PlanningCenter; break; case "renren": style = R.style.Lock_Theme_AuthStyle_RenRen; break; case "thecity": style = R.style.Lock_Theme_AuthStyle_TheCity; break; case "thecity-sandbox": style = R.style.Lock_Theme_AuthStyle_TheCitySandbox; break; case "thirtysevensignals": style = R.style.Lock_Theme_AuthStyle_ThirtySevenSignals; break; case "vkontakte": style = R.style.Lock_Theme_AuthStyle_Vkontakte; break; case "weibo": style = R.style.Lock_Theme_AuthStyle_Weibo; break; case "wordpress": style = R.style.Lock_Theme_AuthStyle_Wordpress; break; case "yandex": style = R.style.Lock_Theme_AuthStyle_Yandex; break; case "shopify": style = R.style.Lock_Theme_AuthStyle_Shopify; break; case "dwolla": style = R.style.Lock_Theme_AuthStyle_Dwolla; break; } return style; }
java
@StyleRes public static int styleForStrategy(String strategyName) { int style = R.style.Lock_Theme_AuthStyle; switch (strategyName) { case "amazon": style = R.style.Lock_Theme_AuthStyle_Amazon; break; case "aol": style = R.style.Lock_Theme_AuthStyle_AOL; break; case "bitbucket": style = R.style.Lock_Theme_AuthStyle_BitBucket; break; case "dropbox": style = R.style.Lock_Theme_AuthStyle_Dropbox; break; case "yahoo": style = R.style.Lock_Theme_AuthStyle_Yahoo; break; case "linkedin": style = R.style.Lock_Theme_AuthStyle_LinkedIn; break; case "google-oauth2": style = R.style.Lock_Theme_AuthStyle_GoogleOAuth2; break; case "twitter": style = R.style.Lock_Theme_AuthStyle_Twitter; break; case "facebook": style = R.style.Lock_Theme_AuthStyle_Facebook; break; case "box": style = R.style.Lock_Theme_AuthStyle_Box; break; case "evernote": style = R.style.Lock_Theme_AuthStyle_Evernote; break; case "evernote-sandbox": style = R.style.Lock_Theme_AuthStyle_EvernoteSandbox; break; case "exact": style = R.style.Lock_Theme_AuthStyle_Exact; break; case "github": style = R.style.Lock_Theme_AuthStyle_GitHub; break; case "instagram": style = R.style.Lock_Theme_AuthStyle_Instagram; break; case "miicard": style = R.style.Lock_Theme_AuthStyle_MiiCard; break; case "paypal": style = R.style.Lock_Theme_AuthStyle_Paypal; break; case "paypal-sandbox": style = R.style.Lock_Theme_AuthStyle_PaypalSandbox; break; case "salesforce": style = R.style.Lock_Theme_AuthStyle_Salesforce; break; case "salesforce-community": style = R.style.Lock_Theme_AuthStyle_SalesforceCommunity; break; case "salesforce-sandbox": style = R.style.Lock_Theme_AuthStyle_SalesforceSandbox; break; case "soundcloud": style = R.style.Lock_Theme_AuthStyle_SoundCloud; break; case "windowslive": style = R.style.Lock_Theme_AuthStyle_WindowsLive; break; case "yammer": style = R.style.Lock_Theme_AuthStyle_Yammer; break; case "baidu": style = R.style.Lock_Theme_AuthStyle_Baidu; break; case "fitbit": style = R.style.Lock_Theme_AuthStyle_Fitbit; break; case "planningcenter": style = R.style.Lock_Theme_AuthStyle_PlanningCenter; break; case "renren": style = R.style.Lock_Theme_AuthStyle_RenRen; break; case "thecity": style = R.style.Lock_Theme_AuthStyle_TheCity; break; case "thecity-sandbox": style = R.style.Lock_Theme_AuthStyle_TheCitySandbox; break; case "thirtysevensignals": style = R.style.Lock_Theme_AuthStyle_ThirtySevenSignals; break; case "vkontakte": style = R.style.Lock_Theme_AuthStyle_Vkontakte; break; case "weibo": style = R.style.Lock_Theme_AuthStyle_Weibo; break; case "wordpress": style = R.style.Lock_Theme_AuthStyle_Wordpress; break; case "yandex": style = R.style.Lock_Theme_AuthStyle_Yandex; break; case "shopify": style = R.style.Lock_Theme_AuthStyle_Shopify; break; case "dwolla": style = R.style.Lock_Theme_AuthStyle_Dwolla; break; } return style; }
[ "@", "StyleRes", "public", "static", "int", "styleForStrategy", "(", "String", "strategyName", ")", "{", "int", "style", "=", "R", ".", "style", ".", "Lock_Theme_AuthStyle", ";", "switch", "(", "strategyName", ")", "{", "case", "\"amazon\"", ":", "style", "=...
It will resolve the given Strategy Name to a valid Style. @param strategyName to search for. @return a valid Lock.Theme.AuthStyle
[ "It", "will", "resolve", "the", "given", "Strategy", "Name", "to", "a", "valid", "Style", "." ]
8eb2a979048d2eb6cf0ec631e82e6c3fe6e7d220
https://github.com/auth0/Lock.Android/blob/8eb2a979048d2eb6cf0ec631e82e6c3fe6e7d220/lib/src/main/java/com/auth0/android/lock/views/AuthConfig.java#L79-L197
train
auth0/Lock.Android
lib/src/main/java/com/auth0/android/lock/PasswordlessLock.java
PasswordlessLock.newIntent
@SuppressWarnings("unused") public Intent newIntent(Context context) { Intent lockIntent = new Intent(context, PasswordlessLockActivity.class); lockIntent.putExtra(Constants.OPTIONS_EXTRA, options); lockIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); return lockIntent; }
java
@SuppressWarnings("unused") public Intent newIntent(Context context) { Intent lockIntent = new Intent(context, PasswordlessLockActivity.class); lockIntent.putExtra(Constants.OPTIONS_EXTRA, options); lockIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); return lockIntent; }
[ "@", "SuppressWarnings", "(", "\"unused\"", ")", "public", "Intent", "newIntent", "(", "Context", "context", ")", "{", "Intent", "lockIntent", "=", "new", "Intent", "(", "context", ",", "PasswordlessLockActivity", ".", "class", ")", ";", "lockIntent", ".", "pu...
Builds a new intent to launch LockActivity with the previously configured options @param context a valid Context @return the intent to which the user has to call startActivity or startActivityForResult
[ "Builds", "a", "new", "intent", "to", "launch", "LockActivity", "with", "the", "previously", "configured", "options" ]
8eb2a979048d2eb6cf0ec631e82e6c3fe6e7d220
https://github.com/auth0/Lock.Android/blob/8eb2a979048d2eb6cf0ec631e82e6c3fe6e7d220/lib/src/main/java/com/auth0/android/lock/PasswordlessLock.java#L119-L125
train
auth0/Lock.Android
lib/src/main/java/com/auth0/android/lock/utils/EnterpriseConnectionMatcher.java
EnterpriseConnectionMatcher.parse
@Nullable public OAuthConnection parse(String email) { String domain = extractDomain(email); if (domain == null) { return null; } domain = domain.toLowerCase(); for (OAuthConnection c : connections) { String mainDomain = domainForConnection(c); if (domain.equalsIgnoreCase(mainDomain)) { return c; } List<String> aliases = c.valueForKey(DOMAIN_ALIASES_KEY, List.class); if (aliases != null) { for (String d : aliases) { if (d.equalsIgnoreCase(domain)) { return c; } } } } return null; }
java
@Nullable public OAuthConnection parse(String email) { String domain = extractDomain(email); if (domain == null) { return null; } domain = domain.toLowerCase(); for (OAuthConnection c : connections) { String mainDomain = domainForConnection(c); if (domain.equalsIgnoreCase(mainDomain)) { return c; } List<String> aliases = c.valueForKey(DOMAIN_ALIASES_KEY, List.class); if (aliases != null) { for (String d : aliases) { if (d.equalsIgnoreCase(domain)) { return c; } } } } return null; }
[ "@", "Nullable", "public", "OAuthConnection", "parse", "(", "String", "email", ")", "{", "String", "domain", "=", "extractDomain", "(", "email", ")", ";", "if", "(", "domain", "==", "null", ")", "{", "return", "null", ";", "}", "domain", "=", "domain", ...
Tries to find a valid domain with the given input. @param email to search the Domain for. @return a Connection if found, null otherwise.
[ "Tries", "to", "find", "a", "valid", "domain", "with", "the", "given", "input", "." ]
8eb2a979048d2eb6cf0ec631e82e6c3fe6e7d220
https://github.com/auth0/Lock.Android/blob/8eb2a979048d2eb6cf0ec631e82e6c3fe6e7d220/lib/src/main/java/com/auth0/android/lock/utils/EnterpriseConnectionMatcher.java#L59-L83
train
auth0/Lock.Android
lib/src/main/java/com/auth0/android/lock/utils/EnterpriseConnectionMatcher.java
EnterpriseConnectionMatcher.extractUsername
@Nullable public String extractUsername(String email) { int indexAt = email.indexOf(AT_SYMBOL); if (indexAt == -1) { return null; } return email.substring(0, indexAt); }
java
@Nullable public String extractUsername(String email) { int indexAt = email.indexOf(AT_SYMBOL); if (indexAt == -1) { return null; } return email.substring(0, indexAt); }
[ "@", "Nullable", "public", "String", "extractUsername", "(", "String", "email", ")", "{", "int", "indexAt", "=", "email", ".", "indexOf", "(", "AT_SYMBOL", ")", ";", "if", "(", "indexAt", "==", "-", "1", ")", "{", "return", "null", ";", "}", "return", ...
Extracts the username part from the email @param email to parse @return the username String if found, an empty String otherwise
[ "Extracts", "the", "username", "part", "from", "the", "email" ]
8eb2a979048d2eb6cf0ec631e82e6c3fe6e7d220
https://github.com/auth0/Lock.Android/blob/8eb2a979048d2eb6cf0ec631e82e6c3fe6e7d220/lib/src/main/java/com/auth0/android/lock/utils/EnterpriseConnectionMatcher.java#L91-L98
train
auth0/Lock.Android
lib/src/main/java/com/auth0/android/lock/utils/EnterpriseConnectionMatcher.java
EnterpriseConnectionMatcher.extractDomain
@Nullable private String extractDomain(String email) { int indexAt = email.indexOf(AT_SYMBOL) + 1; if (indexAt == 0) { return null; } String domain = email.substring(indexAt); if (domain.isEmpty()) { return null; } return domain; }
java
@Nullable private String extractDomain(String email) { int indexAt = email.indexOf(AT_SYMBOL) + 1; if (indexAt == 0) { return null; } String domain = email.substring(indexAt); if (domain.isEmpty()) { return null; } return domain; }
[ "@", "Nullable", "private", "String", "extractDomain", "(", "String", "email", ")", "{", "int", "indexAt", "=", "email", ".", "indexOf", "(", "AT_SYMBOL", ")", "+", "1", ";", "if", "(", "indexAt", "==", "0", ")", "{", "return", "null", ";", "}", "Str...
Extracts the domain part from the email @param email to parse @return the domain String if found, an empty String otherwise
[ "Extracts", "the", "domain", "part", "from", "the", "email" ]
8eb2a979048d2eb6cf0ec631e82e6c3fe6e7d220
https://github.com/auth0/Lock.Android/blob/8eb2a979048d2eb6cf0ec631e82e6c3fe6e7d220/lib/src/main/java/com/auth0/android/lock/utils/EnterpriseConnectionMatcher.java#L106-L117
train
apereo/person-directory
person-directory-impl/src/main/java/org/apereo/services/persondir/support/SAMLCredentialPersonAttributeDao.java
SAMLCredentialPersonAttributeDao.extractStringValue
private String extractStringValue(XMLObject xmlo) { if (xmlo instanceof XSString) { return ((XSString)xmlo).getValue(); } else if (xmlo instanceof XSAnyImpl) { return ((XSAnyImpl)xmlo).getTextContent(); } logger.warn("Unable to map attribute class {} to String. Unknown type. Enable TRACE logging to see attribute name", xmlo.getClass()); return null; }
java
private String extractStringValue(XMLObject xmlo) { if (xmlo instanceof XSString) { return ((XSString)xmlo).getValue(); } else if (xmlo instanceof XSAnyImpl) { return ((XSAnyImpl)xmlo).getTextContent(); } logger.warn("Unable to map attribute class {} to String. Unknown type. Enable TRACE logging to see attribute name", xmlo.getClass()); return null; }
[ "private", "String", "extractStringValue", "(", "XMLObject", "xmlo", ")", "{", "if", "(", "xmlo", "instanceof", "XSString", ")", "{", "return", "(", "(", "XSString", ")", "xmlo", ")", ".", "getValue", "(", ")", ";", "}", "else", "if", "(", "xmlo", "ins...
Extracts the string value of the XMLObject depending upon its type. @param xmlo XMLObject @return String value of object. Null if unable to convert object to string.
[ "Extracts", "the", "string", "value", "of", "the", "XMLObject", "depending", "upon", "its", "type", "." ]
331200c0878aec202b8aff12a732402d6ba7681f
https://github.com/apereo/person-directory/blob/331200c0878aec202b8aff12a732402d6ba7681f/person-directory-impl/src/main/java/org/apereo/services/persondir/support/SAMLCredentialPersonAttributeDao.java#L139-L148
train
apereo/person-directory
person-directory-impl/src/main/java/org/apereo/services/persondir/support/MultivaluedPersonAttributeUtils.java
MultivaluedPersonAttributeUtils.parseAttributeToAttributeMapping
public static Map<String, Set<String>> parseAttributeToAttributeMapping(final Map<String, ? extends Object> mapping) { //null is assumed to be an empty map if (mapping == null) { return new HashMap<>(); } final Map<String, Set<String>> mappedAttributesBuilder = new LinkedHashMap<>(); for (final Map.Entry<String, ? extends Object> mappingEntry : mapping.entrySet()) { final String sourceAttrName = mappingEntry.getKey(); Validate.notNull(sourceAttrName, "attribute name can not be null in Map"); final Object mappedAttribute = mappingEntry.getValue(); //Create a mapping to null if (mappedAttribute == null) { mappedAttributesBuilder.put(sourceAttrName, null); } //Create a single item set for the string mapping else if (mappedAttribute instanceof String) { final Set<String> mappedSet = new HashSet<>(); mappedSet.add(mappedAttribute.toString()); mappedAttributesBuilder.put(sourceAttrName, mappedSet); } //Create a defenisve copy of the mapped set & verify its contents are strings else if (mappedAttribute instanceof Collection) { final Collection<?> sourceSet = (Collection<?>) mappedAttribute; //Ensure the collection only contains strings. final Set<String> mappedSet = new LinkedHashSet<>(); for (final Object sourceObj : sourceSet) { if (sourceObj != null) { mappedSet.add(sourceObj.toString()); } else { mappedSet.add(null); } } mappedAttributesBuilder.put(sourceAttrName, mappedSet); } //Not a valid type for the mapping else { throw new IllegalArgumentException("Invalid mapped type. key='" + sourceAttrName + "', value type='" + mappedAttribute.getClass().getName() + "'"); } } return new HashMap<>(mappedAttributesBuilder); }
java
public static Map<String, Set<String>> parseAttributeToAttributeMapping(final Map<String, ? extends Object> mapping) { //null is assumed to be an empty map if (mapping == null) { return new HashMap<>(); } final Map<String, Set<String>> mappedAttributesBuilder = new LinkedHashMap<>(); for (final Map.Entry<String, ? extends Object> mappingEntry : mapping.entrySet()) { final String sourceAttrName = mappingEntry.getKey(); Validate.notNull(sourceAttrName, "attribute name can not be null in Map"); final Object mappedAttribute = mappingEntry.getValue(); //Create a mapping to null if (mappedAttribute == null) { mappedAttributesBuilder.put(sourceAttrName, null); } //Create a single item set for the string mapping else if (mappedAttribute instanceof String) { final Set<String> mappedSet = new HashSet<>(); mappedSet.add(mappedAttribute.toString()); mappedAttributesBuilder.put(sourceAttrName, mappedSet); } //Create a defenisve copy of the mapped set & verify its contents are strings else if (mappedAttribute instanceof Collection) { final Collection<?> sourceSet = (Collection<?>) mappedAttribute; //Ensure the collection only contains strings. final Set<String> mappedSet = new LinkedHashSet<>(); for (final Object sourceObj : sourceSet) { if (sourceObj != null) { mappedSet.add(sourceObj.toString()); } else { mappedSet.add(null); } } mappedAttributesBuilder.put(sourceAttrName, mappedSet); } //Not a valid type for the mapping else { throw new IllegalArgumentException("Invalid mapped type. key='" + sourceAttrName + "', value type='" + mappedAttribute.getClass().getName() + "'"); } } return new HashMap<>(mappedAttributesBuilder); }
[ "public", "static", "Map", "<", "String", ",", "Set", "<", "String", ">", ">", "parseAttributeToAttributeMapping", "(", "final", "Map", "<", "String", ",", "?", "extends", "Object", ">", "mapping", ")", "{", "//null is assumed to be an empty map", "if", "(", "...
Translate from a more flexible Attribute to Attribute mapping format to a Map from String to Set of Strings. The point of the map is to map from attribute names in the underlying data store (e.g., JDBC column names, LDAP attribute names) to uPortal attribute names. Any given underlying data store attribute might map to zero uPortal attributes (not appear in the map at all), map to exactly one uPortal attribute (appear in the Map as a mapping from a String to a String or as a mapping from a String to a Set containing just one String), or map to several uPortal attribute names (appear in the Map as a mapping from a String to a Set of Strings). This method takes as its argument a {@link Map} that must have keys of type {@link String} and values of type {@link String} or {@link Set} of {@link String}s. The argument must not be null and must have no null keys. It must contain no keys other than Strings and no values other than Strings or Sets of Strings. This method will convert any non-string values to a String using the object's toString() method. This method returns a Map equivalent to its argument except whereever there was a String value in the Map there will instead be an immutable Set containing the String value. That is, the return value is normalized to be a Map from String to Set (of String). @param mapping {@link Map} from String names of attributes in the underlying store to uP attribute names or Sets of such names. @return a Map from String to Set of Strings
[ "Translate", "from", "a", "more", "flexible", "Attribute", "to", "Attribute", "mapping", "format", "to", "a", "Map", "from", "String", "to", "Set", "of", "Strings", "." ]
331200c0878aec202b8aff12a732402d6ba7681f
https://github.com/apereo/person-directory/blob/331200c0878aec202b8aff12a732402d6ba7681f/person-directory-impl/src/main/java/org/apereo/services/persondir/support/MultivaluedPersonAttributeUtils.java#L71-L118
train
apereo/person-directory
person-directory-impl/src/main/java/org/apereo/services/persondir/support/ldap/LdaptivePersonAttributeDao.java
LdaptivePersonAttributeDao.initialize
@PostConstruct public void initialize() { for (final SearchScope scope : SearchScope.values()) { if (scope.ordinal() == this.searchControls.getSearchScope()) { this.searchScope = scope; } } }
java
@PostConstruct public void initialize() { for (final SearchScope scope : SearchScope.values()) { if (scope.ordinal() == this.searchControls.getSearchScope()) { this.searchScope = scope; } } }
[ "@", "PostConstruct", "public", "void", "initialize", "(", ")", "{", "for", "(", "final", "SearchScope", "scope", ":", "SearchScope", ".", "values", "(", ")", ")", "{", "if", "(", "scope", ".", "ordinal", "(", ")", "==", "this", ".", "searchControls", ...
Initializes the object after properties are set.
[ "Initializes", "the", "object", "after", "properties", "are", "set", "." ]
331200c0878aec202b8aff12a732402d6ba7681f
https://github.com/apereo/person-directory/blob/331200c0878aec202b8aff12a732402d6ba7681f/person-directory-impl/src/main/java/org/apereo/services/persondir/support/ldap/LdaptivePersonAttributeDao.java#L134-L141
train
apereo/person-directory
person-directory-impl/src/main/java/org/apereo/services/persondir/support/ldap/LdaptivePersonAttributeDao.java
LdaptivePersonAttributeDao.createRequest
private SearchRequest createRequest(final SearchFilter filter) { final SearchRequest request = new SearchRequest(); request.setBaseDn(this.baseDN); request.setSearchFilter(filter); /** LDAP attributes to fetch from search results. */ if (getResultAttributeMapping() != null && !getResultAttributeMapping().isEmpty()) { final String[] attributes = getResultAttributeMapping().keySet().toArray(new String[getResultAttributeMapping().size()]); request.setReturnAttributes(attributes); } else if (searchControls.getReturningAttributes() != null && searchControls.getReturningAttributes().length > 0) { request.setReturnAttributes(searchControls.getReturningAttributes()); } else { request.setReturnAttributes(ReturnAttributes.ALL_USER.value()); } request.setSearchScope(this.searchScope); request.setSizeLimit(this.searchControls.getCountLimit()); request.setTimeLimit(Duration.ofSeconds(searchControls.getTimeLimit())); return request; }
java
private SearchRequest createRequest(final SearchFilter filter) { final SearchRequest request = new SearchRequest(); request.setBaseDn(this.baseDN); request.setSearchFilter(filter); /** LDAP attributes to fetch from search results. */ if (getResultAttributeMapping() != null && !getResultAttributeMapping().isEmpty()) { final String[] attributes = getResultAttributeMapping().keySet().toArray(new String[getResultAttributeMapping().size()]); request.setReturnAttributes(attributes); } else if (searchControls.getReturningAttributes() != null && searchControls.getReturningAttributes().length > 0) { request.setReturnAttributes(searchControls.getReturningAttributes()); } else { request.setReturnAttributes(ReturnAttributes.ALL_USER.value()); } request.setSearchScope(this.searchScope); request.setSizeLimit(this.searchControls.getCountLimit()); request.setTimeLimit(Duration.ofSeconds(searchControls.getTimeLimit())); return request; }
[ "private", "SearchRequest", "createRequest", "(", "final", "SearchFilter", "filter", ")", "{", "final", "SearchRequest", "request", "=", "new", "SearchRequest", "(", ")", ";", "request", ".", "setBaseDn", "(", "this", ".", "baseDN", ")", ";", "request", ".", ...
Creates a search request from a search filter. @param filter LDAP search filter. @return ldaptive search request.
[ "Creates", "a", "search", "request", "from", "a", "search", "filter", "." ]
331200c0878aec202b8aff12a732402d6ba7681f
https://github.com/apereo/person-directory/blob/331200c0878aec202b8aff12a732402d6ba7681f/person-directory-impl/src/main/java/org/apereo/services/persondir/support/ldap/LdaptivePersonAttributeDao.java#L204-L223
train
apereo/person-directory
person-directory-impl/src/main/java/org/apereo/services/persondir/support/merger/BaseAdditiveAttributeMerger.java
BaseAdditiveAttributeMerger.buildMutableAttributeMap
protected Map<String, List<Object>> buildMutableAttributeMap(final Map<String, List<Object>> attributes) { final Map<String, List<Object>> mutableValuesBuilder = this.createMutableAttributeMap(attributes.size()); for (final Map.Entry<String, List<Object>> attrEntry : attributes.entrySet()) { final String key = attrEntry.getKey(); List<Object> value = attrEntry.getValue(); if (value != null) { value = new ArrayList<>(value); } mutableValuesBuilder.put(key, value); } return mutableValuesBuilder; }
java
protected Map<String, List<Object>> buildMutableAttributeMap(final Map<String, List<Object>> attributes) { final Map<String, List<Object>> mutableValuesBuilder = this.createMutableAttributeMap(attributes.size()); for (final Map.Entry<String, List<Object>> attrEntry : attributes.entrySet()) { final String key = attrEntry.getKey(); List<Object> value = attrEntry.getValue(); if (value != null) { value = new ArrayList<>(value); } mutableValuesBuilder.put(key, value); } return mutableValuesBuilder; }
[ "protected", "Map", "<", "String", ",", "List", "<", "Object", ">", ">", "buildMutableAttributeMap", "(", "final", "Map", "<", "String", ",", "List", "<", "Object", ">", ">", "attributes", ")", "{", "final", "Map", "<", "String", ",", "List", "<", "Obj...
Do a deep clone of an attribute Map to ensure it is completley mutable. @param attributes Attribute map @return Mutable attribute map
[ "Do", "a", "deep", "clone", "of", "an", "attribute", "Map", "to", "ensure", "it", "is", "completley", "mutable", "." ]
331200c0878aec202b8aff12a732402d6ba7681f
https://github.com/apereo/person-directory/blob/331200c0878aec202b8aff12a732402d6ba7681f/person-directory-impl/src/main/java/org/apereo/services/persondir/support/merger/BaseAdditiveAttributeMerger.java#L102-L117
train
apereo/person-directory
person-directory-impl/src/main/java/org/apereo/services/persondir/support/ScriptEnginePersonAttributeDao.java
ScriptEnginePersonAttributeDao.setScriptFile
public void setScriptFile(final String scriptFile) { this.scriptFile = scriptFile; this.scriptType = determineScriptType(scriptFile); if (scriptType != SCRIPT_TYPE.CONTENTS) { // assume that if adjusting the file, engine name should also be re-calc'd // if scriptType is CONTENTS then we can't determine engineName anyway this.engineName = getScriptEngineName(scriptFile); } }
java
public void setScriptFile(final String scriptFile) { this.scriptFile = scriptFile; this.scriptType = determineScriptType(scriptFile); if (scriptType != SCRIPT_TYPE.CONTENTS) { // assume that if adjusting the file, engine name should also be re-calc'd // if scriptType is CONTENTS then we can't determine engineName anyway this.engineName = getScriptEngineName(scriptFile); } }
[ "public", "void", "setScriptFile", "(", "final", "String", "scriptFile", ")", "{", "this", ".", "scriptFile", "=", "scriptFile", ";", "this", ".", "scriptType", "=", "determineScriptType", "(", "scriptFile", ")", ";", "if", "(", "scriptType", "!=", "SCRIPT_TYP...
this object would be better if engineName and scriptFile couldn't change
[ "this", "object", "would", "be", "better", "if", "engineName", "and", "scriptFile", "couldn", "t", "change" ]
331200c0878aec202b8aff12a732402d6ba7681f
https://github.com/apereo/person-directory/blob/331200c0878aec202b8aff12a732402d6ba7681f/person-directory-impl/src/main/java/org/apereo/services/persondir/support/ScriptEnginePersonAttributeDao.java#L70-L78
train
apereo/person-directory
person-directory-impl/src/main/java/org/apereo/services/persondir/support/ScriptEnginePersonAttributeDao.java
ScriptEnginePersonAttributeDao.getScriptEngineName
public static String getScriptEngineName(String filename) { String extension = FilenameUtils.getExtension(filename); if (StringUtils.isBlank(extension)) { logger.warn("Can't determine engine name based on filename without extension {}",filename); return null; } ScriptEngineManager manager = new ScriptEngineManager(); List<ScriptEngineFactory> engines = manager.getEngineFactories(); for (ScriptEngineFactory engineFactory : engines) { List<String> extensions = engineFactory.getExtensions(); for (String supportedExt : extensions) { if (extension.equals(supportedExt)) { // return first short name return engineFactory.getNames().get(0); } } } logger.warn("Can't determine engine name based on filename and available script engines {}",filename); return null; }
java
public static String getScriptEngineName(String filename) { String extension = FilenameUtils.getExtension(filename); if (StringUtils.isBlank(extension)) { logger.warn("Can't determine engine name based on filename without extension {}",filename); return null; } ScriptEngineManager manager = new ScriptEngineManager(); List<ScriptEngineFactory> engines = manager.getEngineFactories(); for (ScriptEngineFactory engineFactory : engines) { List<String> extensions = engineFactory.getExtensions(); for (String supportedExt : extensions) { if (extension.equals(supportedExt)) { // return first short name return engineFactory.getNames().get(0); } } } logger.warn("Can't determine engine name based on filename and available script engines {}",filename); return null; }
[ "public", "static", "String", "getScriptEngineName", "(", "String", "filename", ")", "{", "String", "extension", "=", "FilenameUtils", ".", "getExtension", "(", "filename", ")", ";", "if", "(", "StringUtils", ".", "isBlank", "(", "extension", ")", ")", "{", ...
This method is static is available as utility for users that are passing the contents of a script and want to set the engineName property based on a filename. @param filename the filename @return script engine name
[ "This", "method", "is", "static", "is", "available", "as", "utility", "for", "users", "that", "are", "passing", "the", "contents", "of", "a", "script", "and", "want", "to", "set", "the", "engineName", "property", "based", "on", "a", "filename", "." ]
331200c0878aec202b8aff12a732402d6ba7681f
https://github.com/apereo/person-directory/blob/331200c0878aec202b8aff12a732402d6ba7681f/person-directory-impl/src/main/java/org/apereo/services/persondir/support/ScriptEnginePersonAttributeDao.java#L277-L296
train
apereo/person-directory
person-directory-impl/src/main/java/org/apereo/services/persondir/support/CachingPersonAttributeDaoImpl.java
CachingPersonAttributeDaoImpl.setUserInfoCache
@JsonIgnore public void setUserInfoCache(final Map<Serializable, Set<IPersonAttributes>> userInfoCache) { if (userInfoCache == null) { throw new IllegalArgumentException("userInfoCache may not be null"); } this.userInfoCache = userInfoCache; }
java
@JsonIgnore public void setUserInfoCache(final Map<Serializable, Set<IPersonAttributes>> userInfoCache) { if (userInfoCache == null) { throw new IllegalArgumentException("userInfoCache may not be null"); } this.userInfoCache = userInfoCache; }
[ "@", "JsonIgnore", "public", "void", "setUserInfoCache", "(", "final", "Map", "<", "Serializable", ",", "Set", "<", "IPersonAttributes", ">", ">", "userInfoCache", ")", "{", "if", "(", "userInfoCache", "==", "null", ")", "{", "throw", "new", "IllegalArgumentEx...
The Map to use for caching results. Only get, put and remove are used so the Map may be backed by a real caching implementation. @param userInfoCache The userInfoCache to set.
[ "The", "Map", "to", "use", "for", "caching", "results", ".", "Only", "get", "put", "and", "remove", "are", "used", "so", "the", "Map", "may", "be", "backed", "by", "a", "real", "caching", "implementation", "." ]
331200c0878aec202b8aff12a732402d6ba7681f
https://github.com/apereo/person-directory/blob/331200c0878aec202b8aff12a732402d6ba7681f/person-directory-impl/src/main/java/org/apereo/services/persondir/support/CachingPersonAttributeDaoImpl.java#L210-L217
train
apereo/person-directory
person-directory-impl/src/main/java/org/apereo/services/persondir/support/CachingPersonAttributeDaoImpl.java
CachingPersonAttributeDaoImpl.setNullResultsObject
@JsonIgnore public void setNullResultsObject(final Set<IPersonAttributes> nullResultsObject) { if (nullResultsObject == null) { throw new IllegalArgumentException("nullResultsObject may not be null"); } this.nullResultsObject = nullResultsObject; }
java
@JsonIgnore public void setNullResultsObject(final Set<IPersonAttributes> nullResultsObject) { if (nullResultsObject == null) { throw new IllegalArgumentException("nullResultsObject may not be null"); } this.nullResultsObject = nullResultsObject; }
[ "@", "JsonIgnore", "public", "void", "setNullResultsObject", "(", "final", "Set", "<", "IPersonAttributes", ">", "nullResultsObject", ")", "{", "if", "(", "nullResultsObject", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"nullResultsObj...
Used to specify the placeholder object to put in the cache for null results. Defaults to a minimal Set. Most installations will not need to set this. @param nullResultsObject the nullResultsObject to set
[ "Used", "to", "specify", "the", "placeholder", "object", "to", "put", "in", "the", "cache", "for", "null", "results", ".", "Defaults", "to", "a", "minimal", "Set", ".", "Most", "installations", "will", "not", "need", "to", "set", "this", "." ]
331200c0878aec202b8aff12a732402d6ba7681f
https://github.com/apereo/person-directory/blob/331200c0878aec202b8aff12a732402d6ba7681f/person-directory-impl/src/main/java/org/apereo/services/persondir/support/CachingPersonAttributeDaoImpl.java#L248-L255
train
apereo/person-directory
person-directory-impl/src/main/java/org/apereo/services/persondir/support/ComplexStubPersonAttributeDao.java
ComplexStubPersonAttributeDao.setBackingMap
public void setBackingMap(final Map<String, Map<String, List<Object>>> backingMap) { if (backingMap == null) { this.backingMap = new HashMap<>(); this.possibleUserAttributeNames = new HashSet<>(); } else { this.backingMap = new LinkedHashMap<>(backingMap); this.initializePossibleAttributeNames(); } }
java
public void setBackingMap(final Map<String, Map<String, List<Object>>> backingMap) { if (backingMap == null) { this.backingMap = new HashMap<>(); this.possibleUserAttributeNames = new HashSet<>(); } else { this.backingMap = new LinkedHashMap<>(backingMap); this.initializePossibleAttributeNames(); } }
[ "public", "void", "setBackingMap", "(", "final", "Map", "<", "String", ",", "Map", "<", "String", ",", "List", "<", "Object", ">", ">", ">", "backingMap", ")", "{", "if", "(", "backingMap", "==", "null", ")", "{", "this", ".", "backingMap", "=", "new...
The backing Map to use for queries, the outer map is keyed on the query attribute. The inner Map is the set of user attributes to be returned for the query attribute. @param backingMap backing map
[ "The", "backing", "Map", "to", "use", "for", "queries", "the", "outer", "map", "is", "keyed", "on", "the", "query", "attribute", ".", "The", "inner", "Map", "is", "the", "set", "of", "user", "attributes", "to", "be", "returned", "for", "the", "query", ...
331200c0878aec202b8aff12a732402d6ba7681f
https://github.com/apereo/person-directory/blob/331200c0878aec202b8aff12a732402d6ba7681f/person-directory-impl/src/main/java/org/apereo/services/persondir/support/ComplexStubPersonAttributeDao.java#L124-L132
train
apereo/person-directory
person-directory-impl/src/main/java/org/apereo/services/persondir/support/ComplexStubPersonAttributeDao.java
ComplexStubPersonAttributeDao.initializePossibleAttributeNames
private void initializePossibleAttributeNames() { final Set<String> possibleAttribNames = new LinkedHashSet<>(); for (final Map<String, List<Object>> attributeMapForSomeUser : this.backingMap.values()) { final Set<String> keySet = attributeMapForSomeUser.keySet(); possibleAttribNames.addAll(keySet); } this.possibleUserAttributeNames = Collections.unmodifiableSet(possibleAttribNames); }
java
private void initializePossibleAttributeNames() { final Set<String> possibleAttribNames = new LinkedHashSet<>(); for (final Map<String, List<Object>> attributeMapForSomeUser : this.backingMap.values()) { final Set<String> keySet = attributeMapForSomeUser.keySet(); possibleAttribNames.addAll(keySet); } this.possibleUserAttributeNames = Collections.unmodifiableSet(possibleAttribNames); }
[ "private", "void", "initializePossibleAttributeNames", "(", ")", "{", "final", "Set", "<", "String", ">", "possibleAttribNames", "=", "new", "LinkedHashSet", "<>", "(", ")", ";", "for", "(", "final", "Map", "<", "String", ",", "List", "<", "Object", ">", "...
Compute the set of attribute names that map to a value for at least one user in our backing map and store it as the instance variable possibleUserAttributeNames.
[ "Compute", "the", "set", "of", "attribute", "names", "that", "map", "to", "a", "value", "for", "at", "least", "one", "user", "in", "our", "backing", "map", "and", "store", "it", "as", "the", "instance", "variable", "possibleUserAttributeNames", "." ]
331200c0878aec202b8aff12a732402d6ba7681f
https://github.com/apereo/person-directory/blob/331200c0878aec202b8aff12a732402d6ba7681f/person-directory-impl/src/main/java/org/apereo/services/persondir/support/ComplexStubPersonAttributeDao.java#L250-L259
train
apereo/person-directory
person-directory-impl/src/main/java/org/apereo/services/persondir/support/EchoPersonAttributeDaoImpl.java
EchoPersonAttributeDaoImpl.getPeopleWithMultivaluedAttributes
@Override public Set<IPersonAttributes> getPeopleWithMultivaluedAttributes(final Map<String, List<Object>> query, final IPersonAttributeDaoFilter filter) { if (query == null) { throw new IllegalArgumentException("seed may not be null"); } return Collections.singleton((IPersonAttributes) new AttributeNamedPersonImpl(getUsernameAttributeProvider().getUsernameAttribute(), query)); }
java
@Override public Set<IPersonAttributes> getPeopleWithMultivaluedAttributes(final Map<String, List<Object>> query, final IPersonAttributeDaoFilter filter) { if (query == null) { throw new IllegalArgumentException("seed may not be null"); } return Collections.singleton((IPersonAttributes) new AttributeNamedPersonImpl(getUsernameAttributeProvider().getUsernameAttribute(), query)); }
[ "@", "Override", "public", "Set", "<", "IPersonAttributes", ">", "getPeopleWithMultivaluedAttributes", "(", "final", "Map", "<", "String", ",", "List", "<", "Object", ">", ">", "query", ",", "final", "IPersonAttributeDaoFilter", "filter", ")", "{", "if", "(", ...
Returns a duplicate of the seed it is passed. @return a Map equal to but not the same reference as the seed. @see IPersonAttributeDao#getPeopleWithMultivaluedAttributes(java.util.Map, org.apereo.services.persondir.IPersonAttributeDaoFilter)
[ "Returns", "a", "duplicate", "of", "the", "seed", "it", "is", "passed", "." ]
331200c0878aec202b8aff12a732402d6ba7681f
https://github.com/apereo/person-directory/blob/331200c0878aec202b8aff12a732402d6ba7681f/person-directory-impl/src/main/java/org/apereo/services/persondir/support/EchoPersonAttributeDaoImpl.java#L45-L54
train
apereo/person-directory
person-directory-impl/src/main/java/org/apereo/services/persondir/support/jdbc/AbstractJdbcPersonAttributeDao.java
AbstractJdbcPersonAttributeDao.canonicalizeDataAttributeForSql
protected String canonicalizeDataAttributeForSql(final String dataAttribute) { if (this.caseInsensitiveDataAttributes == null || this.caseInsensitiveDataAttributes.isEmpty() || !(this.caseInsensitiveDataAttributes.containsKey(dataAttribute))) { return dataAttribute; } if (this.dataAttributeCaseCanonicalizationFunctions == null || this.dataAttributeCaseCanonicalizationFunctions.isEmpty()) { return dataAttribute; } CaseCanonicalizationMode canonicalizationMode = this.caseInsensitiveDataAttributes.get(dataAttribute); if (canonicalizationMode == null) { canonicalizationMode = getDefaultCaseCanonicalizationMode(); } final MessageFormat mf = this.dataAttributeCaseCanonicalizationFunctions.get(canonicalizationMode); if (mf == null) { return dataAttribute; } return mf.format(new String[]{dataAttribute}); }
java
protected String canonicalizeDataAttributeForSql(final String dataAttribute) { if (this.caseInsensitiveDataAttributes == null || this.caseInsensitiveDataAttributes.isEmpty() || !(this.caseInsensitiveDataAttributes.containsKey(dataAttribute))) { return dataAttribute; } if (this.dataAttributeCaseCanonicalizationFunctions == null || this.dataAttributeCaseCanonicalizationFunctions.isEmpty()) { return dataAttribute; } CaseCanonicalizationMode canonicalizationMode = this.caseInsensitiveDataAttributes.get(dataAttribute); if (canonicalizationMode == null) { canonicalizationMode = getDefaultCaseCanonicalizationMode(); } final MessageFormat mf = this.dataAttributeCaseCanonicalizationFunctions.get(canonicalizationMode); if (mf == null) { return dataAttribute; } return mf.format(new String[]{dataAttribute}); }
[ "protected", "String", "canonicalizeDataAttributeForSql", "(", "final", "String", "dataAttribute", ")", "{", "if", "(", "this", ".", "caseInsensitiveDataAttributes", "==", "null", "||", "this", ".", "caseInsensitiveDataAttributes", ".", "isEmpty", "(", ")", "||", "!...
Canonicalize the data-layer attribute column with the given name via SQL function. This is as opposed to canonicalizing query attributes or application attributes passed into or mapped out of the data layer. Canonicalization of a data-layer column should only be necessary if the data layer if you require case-insensitive searching on a mixed-case column in a case-sensitive data layer. Careful, though, as this can result in table scanning if the data layer does not support function-based indices. @param dataAttribute Name of the data attribute column @return Canonicalized data attribute column name
[ "Canonicalize", "the", "data", "-", "layer", "attribute", "column", "with", "the", "given", "name", "via", "SQL", "function", ".", "This", "is", "as", "opposed", "to", "canonicalizing", "query", "attributes", "or", "application", "attributes", "passed", "into", ...
331200c0878aec202b8aff12a732402d6ba7681f
https://github.com/apereo/person-directory/blob/331200c0878aec202b8aff12a732402d6ba7681f/person-directory-impl/src/main/java/org/apereo/services/persondir/support/jdbc/AbstractJdbcPersonAttributeDao.java#L192-L208
train
apereo/person-directory
person-directory-impl/src/main/java/org/apereo/services/persondir/support/BasePersonImpl.java
BasePersonImpl.buildImmutableAttributeMap
protected Map<String, List<Object>> buildImmutableAttributeMap(final Map<String, List<Object>> attributes) { final Map<String, List<Object>> immutableValuesBuilder = this.createImmutableAttributeMap(attributes.size()); final Pattern arrayPattern = Pattern.compile("\\{(.*)\\}"); for (final Map.Entry<String, List<Object>> attrEntry : attributes.entrySet()) { final String key = attrEntry.getKey(); List<Object> value = attrEntry.getValue(); if (value != null) { if (!value.isEmpty()) { final Object result = value.get(0); if (Array.class.isInstance(result)) { if (logger.isTraceEnabled()) { logger.trace("Column {} is classified as a SQL array", key); } final String values = result.toString(); if (logger.isTraceEnabled()) { logger.trace("Converting SQL array values {} using pattern {}", values, arrayPattern.pattern()); } final Matcher matcher = arrayPattern.matcher(values); if (matcher.matches()) { final String[] groups = matcher.group(1).split(","); value = Arrays.asList(groups); if (logger.isTraceEnabled()) { logger.trace("Converted SQL array values {}", values); } } } } value = Collections.unmodifiableList(value); } if (logger.isTraceEnabled()) { logger.trace("Collecting attribute {} with value(s) {}", key, value); } immutableValuesBuilder.put(key, value); } return immutableValuesBuilder; }
java
protected Map<String, List<Object>> buildImmutableAttributeMap(final Map<String, List<Object>> attributes) { final Map<String, List<Object>> immutableValuesBuilder = this.createImmutableAttributeMap(attributes.size()); final Pattern arrayPattern = Pattern.compile("\\{(.*)\\}"); for (final Map.Entry<String, List<Object>> attrEntry : attributes.entrySet()) { final String key = attrEntry.getKey(); List<Object> value = attrEntry.getValue(); if (value != null) { if (!value.isEmpty()) { final Object result = value.get(0); if (Array.class.isInstance(result)) { if (logger.isTraceEnabled()) { logger.trace("Column {} is classified as a SQL array", key); } final String values = result.toString(); if (logger.isTraceEnabled()) { logger.trace("Converting SQL array values {} using pattern {}", values, arrayPattern.pattern()); } final Matcher matcher = arrayPattern.matcher(values); if (matcher.matches()) { final String[] groups = matcher.group(1).split(","); value = Arrays.asList(groups); if (logger.isTraceEnabled()) { logger.trace("Converted SQL array values {}", values); } } } } value = Collections.unmodifiableList(value); } if (logger.isTraceEnabled()) { logger.trace("Collecting attribute {} with value(s) {}", key, value); } immutableValuesBuilder.put(key, value); } return immutableValuesBuilder; }
[ "protected", "Map", "<", "String", ",", "List", "<", "Object", ">", ">", "buildImmutableAttributeMap", "(", "final", "Map", "<", "String", ",", "List", "<", "Object", ">", ">", "attributes", ")", "{", "final", "Map", "<", "String", ",", "List", "<", "O...
Take the constructor argument and convert the Map and List values into read-only form. @param attributes Map of attributes @return Read-only map of attributes
[ "Take", "the", "constructor", "argument", "and", "convert", "the", "Map", "and", "List", "values", "into", "read", "-", "only", "form", "." ]
331200c0878aec202b8aff12a732402d6ba7681f
https://github.com/apereo/person-directory/blob/331200c0878aec202b8aff12a732402d6ba7681f/person-directory-impl/src/main/java/org/apereo/services/persondir/support/BasePersonImpl.java#L66-L103
train
apereo/person-directory
person-directory-impl/src/main/java/org/apereo/services/persondir/support/AbstractQueryPersonAttributeDao.java
AbstractQueryPersonAttributeDao.mapPersonAttributes
protected final IPersonAttributes mapPersonAttributes(final IPersonAttributes person) { final Map<String, List<Object>> personAttributes = person.getAttributes(); final Map<String, List<Object>> mappedAttributes; //If no mapping just use the attributes as-is if (this.resultAttributeMapping == null) { if (caseInsensitiveResultAttributes != null && !(caseInsensitiveResultAttributes.isEmpty())) { mappedAttributes = new LinkedHashMap<>(); for (final Map.Entry<String, List<Object>> attribute : personAttributes.entrySet()) { final String attributeName = attribute.getKey(); mappedAttributes.put(attributeName, canonicalizeAttribute(attributeName, attribute.getValue(), caseInsensitiveResultAttributes)); } } else { mappedAttributes = personAttributes; } } //Map the attribute names via the resultAttributeMapping else { mappedAttributes = new LinkedHashMap<>(); for (final Map.Entry<String, Set<String>> resultAttrEntry : this.resultAttributeMapping.entrySet()) { final String dataKey = resultAttrEntry.getKey(); // Only map found data attributes. // . See https://issues.jasig.org/browse/PERSONDIR-89 // Currently respects CaseInsensitive*NamedPersonImpl because BasePersonImpl's constructor if (personAttributes.containsKey(dataKey)) { Set<String> resultKeys = resultAttrEntry.getValue(); //If dataKey has no mapped resultKeys just use the dataKey if (resultKeys == null) { resultKeys = ImmutableSet.of(dataKey); } //Add the value to the mapped attributes for each mapped key, //possibly canonicalizing casing for each value List<Object> value = personAttributes.get(dataKey); for (final String resultKey : resultKeys) { value = canonicalizeAttribute(resultKey, value, caseInsensitiveResultAttributes); if (resultKey == null) { //TODO is this possible? mappedAttributes.put(dataKey, value); } else { mappedAttributes.put(resultKey, value); } } } } } final IPersonAttributes newPerson; final String name = person.getName(); if (name != null) { newPerson = new NamedPersonImpl(usernameCaseCanonicalizationMode.canonicalize(name), mappedAttributes); } else { final String userNameAttribute = this.getConfiguredUserNameAttribute(); final IPersonAttributes tmpNewPerson = new AttributeNamedPersonImpl(userNameAttribute, mappedAttributes); newPerson = new NamedPersonImpl(usernameCaseCanonicalizationMode.canonicalize(tmpNewPerson.getName()), mappedAttributes); } return newPerson; }
java
protected final IPersonAttributes mapPersonAttributes(final IPersonAttributes person) { final Map<String, List<Object>> personAttributes = person.getAttributes(); final Map<String, List<Object>> mappedAttributes; //If no mapping just use the attributes as-is if (this.resultAttributeMapping == null) { if (caseInsensitiveResultAttributes != null && !(caseInsensitiveResultAttributes.isEmpty())) { mappedAttributes = new LinkedHashMap<>(); for (final Map.Entry<String, List<Object>> attribute : personAttributes.entrySet()) { final String attributeName = attribute.getKey(); mappedAttributes.put(attributeName, canonicalizeAttribute(attributeName, attribute.getValue(), caseInsensitiveResultAttributes)); } } else { mappedAttributes = personAttributes; } } //Map the attribute names via the resultAttributeMapping else { mappedAttributes = new LinkedHashMap<>(); for (final Map.Entry<String, Set<String>> resultAttrEntry : this.resultAttributeMapping.entrySet()) { final String dataKey = resultAttrEntry.getKey(); // Only map found data attributes. // . See https://issues.jasig.org/browse/PERSONDIR-89 // Currently respects CaseInsensitive*NamedPersonImpl because BasePersonImpl's constructor if (personAttributes.containsKey(dataKey)) { Set<String> resultKeys = resultAttrEntry.getValue(); //If dataKey has no mapped resultKeys just use the dataKey if (resultKeys == null) { resultKeys = ImmutableSet.of(dataKey); } //Add the value to the mapped attributes for each mapped key, //possibly canonicalizing casing for each value List<Object> value = personAttributes.get(dataKey); for (final String resultKey : resultKeys) { value = canonicalizeAttribute(resultKey, value, caseInsensitiveResultAttributes); if (resultKey == null) { //TODO is this possible? mappedAttributes.put(dataKey, value); } else { mappedAttributes.put(resultKey, value); } } } } } final IPersonAttributes newPerson; final String name = person.getName(); if (name != null) { newPerson = new NamedPersonImpl(usernameCaseCanonicalizationMode.canonicalize(name), mappedAttributes); } else { final String userNameAttribute = this.getConfiguredUserNameAttribute(); final IPersonAttributes tmpNewPerson = new AttributeNamedPersonImpl(userNameAttribute, mappedAttributes); newPerson = new NamedPersonImpl(usernameCaseCanonicalizationMode.canonicalize(tmpNewPerson.getName()), mappedAttributes); } return newPerson; }
[ "protected", "final", "IPersonAttributes", "mapPersonAttributes", "(", "final", "IPersonAttributes", "person", ")", "{", "final", "Map", "<", "String", ",", "List", "<", "Object", ">", ">", "personAttributes", "=", "person", ".", "getAttributes", "(", ")", ";", ...
Uses resultAttributeMapping to return a copy of the IPersonAttributes with only the attributes specified in resultAttributeMapping mapped to their result attribute names. @param person The IPersonAttributes to map attributes for @return A copy of the IPersonAttributes with mapped attributes, the original IPersonAttributes if resultAttributeMapping is null.
[ "Uses", "resultAttributeMapping", "to", "return", "a", "copy", "of", "the", "IPersonAttributes", "with", "only", "the", "attributes", "specified", "in", "resultAttributeMapping", "mapped", "to", "their", "result", "attribute", "names", "." ]
331200c0878aec202b8aff12a732402d6ba7681f
https://github.com/apereo/person-directory/blob/331200c0878aec202b8aff12a732402d6ba7681f/person-directory-impl/src/main/java/org/apereo/services/persondir/support/AbstractQueryPersonAttributeDao.java#L406-L468
train
apereo/person-directory
person-directory-impl/src/main/java/org/apereo/services/persondir/support/AbstractQueryPersonAttributeDao.java
AbstractQueryPersonAttributeDao.canonicalizeAttribute
protected List<Object> canonicalizeAttribute(final String key, final List<Object> value, final Map<String, CaseCanonicalizationMode> config) { if (value == null || value.isEmpty() || config == null || !(config.containsKey(key))) { return value; } CaseCanonicalizationMode canonicalizationMode = config.get(key); if (canonicalizationMode == null) { // Intentionally late binding of the default to // avoid unexpected behavior if you wait to assign // the default until after you've injected the list // of case-insensitive fields canonicalizationMode = defaultCaseCanonicalizationMode; } final List<Object> canonicalizedValues = new ArrayList<>(value.size()); for (final Object origValue : value) { if (origValue instanceof String) { canonicalizedValues.add(canonicalizationMode.canonicalize((String) origValue, caseCanonicalizationLocale)); } else { canonicalizedValues.add(origValue); } } return canonicalizedValues; }
java
protected List<Object> canonicalizeAttribute(final String key, final List<Object> value, final Map<String, CaseCanonicalizationMode> config) { if (value == null || value.isEmpty() || config == null || !(config.containsKey(key))) { return value; } CaseCanonicalizationMode canonicalizationMode = config.get(key); if (canonicalizationMode == null) { // Intentionally late binding of the default to // avoid unexpected behavior if you wait to assign // the default until after you've injected the list // of case-insensitive fields canonicalizationMode = defaultCaseCanonicalizationMode; } final List<Object> canonicalizedValues = new ArrayList<>(value.size()); for (final Object origValue : value) { if (origValue instanceof String) { canonicalizedValues.add(canonicalizationMode.canonicalize((String) origValue, caseCanonicalizationLocale)); } else { canonicalizedValues.add(origValue); } } return canonicalizedValues; }
[ "protected", "List", "<", "Object", ">", "canonicalizeAttribute", "(", "final", "String", "key", ",", "final", "List", "<", "Object", ">", "value", ",", "final", "Map", "<", "String", ",", "CaseCanonicalizationMode", ">", "config", ")", "{", "if", "(", "va...
Canonicalize the attribute values if they are present in the config map. @param key attribute key @param value list of attribute values @param config map of attribute names to canonicalization key for the attribute @return if configured to do so, returns a canonicalized list of values.
[ "Canonicalize", "the", "attribute", "values", "if", "they", "are", "present", "in", "the", "config", "map", "." ]
331200c0878aec202b8aff12a732402d6ba7681f
https://github.com/apereo/person-directory/blob/331200c0878aec202b8aff12a732402d6ba7681f/person-directory-impl/src/main/java/org/apereo/services/persondir/support/AbstractQueryPersonAttributeDao.java#L477-L498
train
apereo/person-directory
person-directory-impl/src/main/java/org/apereo/services/persondir/support/CascadingPersonAttributeDao.java
CascadingPersonAttributeDao.getAttributesFromDao
@Override protected Set<IPersonAttributes> getAttributesFromDao(final Map<String, List<Object>> seed, final boolean isFirstQuery, final IPersonAttributeDao currentlyConsidering, final Set<IPersonAttributes> resultPeople, final IPersonAttributeDaoFilter filter) { if (isFirstQuery || (!stopIfFirstDaoReturnsNull && (resultPeople == null || resultPeople.size() == 0))) { return currentlyConsidering.getPeopleWithMultivaluedAttributes(seed, filter); } else if (stopIfFirstDaoReturnsNull && !isFirstQuery && (resultPeople == null || resultPeople.size() == 0)) { return null; } Set<IPersonAttributes> mergedPeopleResults = null; for (final IPersonAttributes person : resultPeople) { final Map<String, List<Object>> queryAttributes = new LinkedHashMap<>(); //Add the userName into the query map final String userName = person.getName(); if (userName != null) { final Map<String, List<Object>> userNameMap = this.toSeedMap(userName); queryAttributes.putAll(userNameMap); } //Add the rest of the attributes into the query map final Map<String, List<Object>> personAttributes = person.getAttributes(); queryAttributes.putAll(personAttributes); final Set<IPersonAttributes> newResults = currentlyConsidering.getPeopleWithMultivaluedAttributes(queryAttributes, filter); if (newResults != null) { if (mergedPeopleResults == null) { //If this is the first valid result set just use it. mergedPeopleResults = new LinkedHashSet<>(newResults); } else { //Merge the Sets of IPersons mergedPeopleResults = this.attrMerger.mergeResults(mergedPeopleResults, newResults); } } } return mergedPeopleResults; }
java
@Override protected Set<IPersonAttributes> getAttributesFromDao(final Map<String, List<Object>> seed, final boolean isFirstQuery, final IPersonAttributeDao currentlyConsidering, final Set<IPersonAttributes> resultPeople, final IPersonAttributeDaoFilter filter) { if (isFirstQuery || (!stopIfFirstDaoReturnsNull && (resultPeople == null || resultPeople.size() == 0))) { return currentlyConsidering.getPeopleWithMultivaluedAttributes(seed, filter); } else if (stopIfFirstDaoReturnsNull && !isFirstQuery && (resultPeople == null || resultPeople.size() == 0)) { return null; } Set<IPersonAttributes> mergedPeopleResults = null; for (final IPersonAttributes person : resultPeople) { final Map<String, List<Object>> queryAttributes = new LinkedHashMap<>(); //Add the userName into the query map final String userName = person.getName(); if (userName != null) { final Map<String, List<Object>> userNameMap = this.toSeedMap(userName); queryAttributes.putAll(userNameMap); } //Add the rest of the attributes into the query map final Map<String, List<Object>> personAttributes = person.getAttributes(); queryAttributes.putAll(personAttributes); final Set<IPersonAttributes> newResults = currentlyConsidering.getPeopleWithMultivaluedAttributes(queryAttributes, filter); if (newResults != null) { if (mergedPeopleResults == null) { //If this is the first valid result set just use it. mergedPeopleResults = new LinkedHashSet<>(newResults); } else { //Merge the Sets of IPersons mergedPeopleResults = this.attrMerger.mergeResults(mergedPeopleResults, newResults); } } } return mergedPeopleResults; }
[ "@", "Override", "protected", "Set", "<", "IPersonAttributes", ">", "getAttributesFromDao", "(", "final", "Map", "<", "String", ",", "List", "<", "Object", ">", ">", "seed", ",", "final", "boolean", "isFirstQuery", ",", "final", "IPersonAttributeDao", "currently...
If this is the first call, or there are no results in the resultPeople Set and stopIfFirstDaoReturnsNull=false, the seed map is used. If not the attributes of the first user in the resultPeople Set are used for each child dao. If stopIfFirstDaoReturnsNull=true and the first query returned no results in the resultPeopleSet, return null. @see AbstractAggregatingDefaultQueryPersonAttributeDao#getAttributesFromDao(java.util.Map, boolean, IPersonAttributeDao, java.util.Set, IPersonAttributeDaoFilter)
[ "If", "this", "is", "the", "first", "call", "or", "there", "are", "no", "results", "in", "the", "resultPeople", "Set", "and", "stopIfFirstDaoReturnsNull", "=", "false", "the", "seed", "map", "is", "used", ".", "If", "not", "the", "attributes", "of", "the",...
331200c0878aec202b8aff12a732402d6ba7681f
https://github.com/apereo/person-directory/blob/331200c0878aec202b8aff12a732402d6ba7681f/person-directory-impl/src/main/java/org/apereo/services/persondir/support/CascadingPersonAttributeDao.java#L96-L132
train
apereo/person-directory
person-directory-impl/src/main/java/org/apereo/services/persondir/support/MergingPersonAttributeDaoImpl.java
MergingPersonAttributeDaoImpl.getAttributesFromDao
@Override protected Set<IPersonAttributes> getAttributesFromDao(final Map<String, List<Object>> seed, final boolean isFirstQuery, final IPersonAttributeDao currentlyConsidering, final Set<IPersonAttributes> resultPeople, final IPersonAttributeDaoFilter filter) { return currentlyConsidering.getPeopleWithMultivaluedAttributes(seed, filter); }
java
@Override protected Set<IPersonAttributes> getAttributesFromDao(final Map<String, List<Object>> seed, final boolean isFirstQuery, final IPersonAttributeDao currentlyConsidering, final Set<IPersonAttributes> resultPeople, final IPersonAttributeDaoFilter filter) { return currentlyConsidering.getPeopleWithMultivaluedAttributes(seed, filter); }
[ "@", "Override", "protected", "Set", "<", "IPersonAttributes", ">", "getAttributesFromDao", "(", "final", "Map", "<", "String", ",", "List", "<", "Object", ">", ">", "seed", ",", "final", "boolean", "isFirstQuery", ",", "final", "IPersonAttributeDao", "currently...
Calls the current IPersonAttributeDao from using the seed. @see AbstractAggregatingDefaultQueryPersonAttributeDao#getAttributesFromDao(java.util.Map, boolean, IPersonAttributeDao, java.util.Set, IPersonAttributeDaoFilter)
[ "Calls", "the", "current", "IPersonAttributeDao", "from", "using", "the", "seed", "." ]
331200c0878aec202b8aff12a732402d6ba7681f
https://github.com/apereo/person-directory/blob/331200c0878aec202b8aff12a732402d6ba7681f/person-directory-impl/src/main/java/org/apereo/services/persondir/support/MergingPersonAttributeDaoImpl.java#L51-L54
train
apereo/person-directory
person-directory-impl/src/main/java/org/apereo/services/persondir/support/MediatingAdditionalDescriptors.java
MediatingAdditionalDescriptors.removeAttribute
@Override public List<Object> removeAttribute(final String name) { List<Object> removedValues = null; for (final IAdditionalDescriptors additionalDescriptors : this.delegateDescriptors) { final List<Object> values = additionalDescriptors.removeAttribute(name); if (values != null) { if (removedValues == null) { removedValues = new ArrayList<>(values); } else { removedValues.addAll(values); } } } return removedValues; }
java
@Override public List<Object> removeAttribute(final String name) { List<Object> removedValues = null; for (final IAdditionalDescriptors additionalDescriptors : this.delegateDescriptors) { final List<Object> values = additionalDescriptors.removeAttribute(name); if (values != null) { if (removedValues == null) { removedValues = new ArrayList<>(values); } else { removedValues.addAll(values); } } } return removedValues; }
[ "@", "Override", "public", "List", "<", "Object", ">", "removeAttribute", "(", "final", "String", "name", ")", "{", "List", "<", "Object", ">", "removedValues", "=", "null", ";", "for", "(", "final", "IAdditionalDescriptors", "additionalDescriptors", ":", "thi...
Returns list of all removed values @see IAdditionalDescriptors#removeAttribute(java.lang.String)
[ "Returns", "list", "of", "all", "removed", "values" ]
331200c0878aec202b8aff12a732402d6ba7681f
https://github.com/apereo/person-directory/blob/331200c0878aec202b8aff12a732402d6ba7681f/person-directory-impl/src/main/java/org/apereo/services/persondir/support/MediatingAdditionalDescriptors.java#L62-L78
train
apereo/person-directory
person-directory-impl/src/main/java/org/apereo/services/persondir/support/MediatingAdditionalDescriptors.java
MediatingAdditionalDescriptors.setAttributeValues
@Override public List<Object> setAttributeValues(final String name, final List<Object> values) { List<Object> replacedValues = null; for (final IAdditionalDescriptors additionalDescriptors : delegateDescriptors) { final List<Object> oldValues = additionalDescriptors.setAttributeValues(name, values); if (oldValues != null) { if (replacedValues == null) { replacedValues = new ArrayList<>(oldValues); } else { replacedValues.addAll(oldValues); } } } return replacedValues; }
java
@Override public List<Object> setAttributeValues(final String name, final List<Object> values) { List<Object> replacedValues = null; for (final IAdditionalDescriptors additionalDescriptors : delegateDescriptors) { final List<Object> oldValues = additionalDescriptors.setAttributeValues(name, values); if (oldValues != null) { if (replacedValues == null) { replacedValues = new ArrayList<>(oldValues); } else { replacedValues.addAll(oldValues); } } } return replacedValues; }
[ "@", "Override", "public", "List", "<", "Object", ">", "setAttributeValues", "(", "final", "String", "name", ",", "final", "List", "<", "Object", ">", "values", ")", "{", "List", "<", "Object", ">", "replacedValues", "=", "null", ";", "for", "(", "final"...
Returns list of all replaced values @see IAdditionalDescriptors#setAttributeValues(java.lang.String, java.util.List)
[ "Returns", "list", "of", "all", "replaced", "values" ]
331200c0878aec202b8aff12a732402d6ba7681f
https://github.com/apereo/person-directory/blob/331200c0878aec202b8aff12a732402d6ba7681f/person-directory-impl/src/main/java/org/apereo/services/persondir/support/MediatingAdditionalDescriptors.java#L85-L101
train
apereo/person-directory
person-directory-impl/src/main/java/org/apereo/services/persondir/support/web/RequestAttributeSourceFilter.java
RequestAttributeSourceFilter.addRequestProperties
protected void addRequestProperties(final HttpServletRequest httpServletRequest, final Map<String, List<Object>> attributes) { if (this.remoteUserAttribute != null) { final String remoteUser = httpServletRequest.getRemoteUser(); attributes.put(this.remoteUserAttribute, list(remoteUser)); } if (this.remoteAddrAttribute != null) { final String remoteAddr = httpServletRequest.getRemoteAddr(); attributes.put(this.remoteAddrAttribute, list(remoteAddr)); } if (this.remoteHostAttribute != null) { final String remoteHost = httpServletRequest.getRemoteHost(); attributes.put(this.remoteHostAttribute, list(remoteHost)); } if (this.serverNameAttribute != null) { final String serverName = httpServletRequest.getServerName(); attributes.put(this.serverNameAttribute, list(serverName)); } if (this.serverPortAttribute != null) { final int serverPort = httpServletRequest.getServerPort(); attributes.put(this.serverPortAttribute, list(serverPort)); } }
java
protected void addRequestProperties(final HttpServletRequest httpServletRequest, final Map<String, List<Object>> attributes) { if (this.remoteUserAttribute != null) { final String remoteUser = httpServletRequest.getRemoteUser(); attributes.put(this.remoteUserAttribute, list(remoteUser)); } if (this.remoteAddrAttribute != null) { final String remoteAddr = httpServletRequest.getRemoteAddr(); attributes.put(this.remoteAddrAttribute, list(remoteAddr)); } if (this.remoteHostAttribute != null) { final String remoteHost = httpServletRequest.getRemoteHost(); attributes.put(this.remoteHostAttribute, list(remoteHost)); } if (this.serverNameAttribute != null) { final String serverName = httpServletRequest.getServerName(); attributes.put(this.serverNameAttribute, list(serverName)); } if (this.serverPortAttribute != null) { final int serverPort = httpServletRequest.getServerPort(); attributes.put(this.serverPortAttribute, list(serverPort)); } }
[ "protected", "void", "addRequestProperties", "(", "final", "HttpServletRequest", "httpServletRequest", ",", "final", "Map", "<", "String", ",", "List", "<", "Object", ">", ">", "attributes", ")", "{", "if", "(", "this", ".", "remoteUserAttribute", "!=", "null", ...
Add other properties from the request to the attributes map. @param httpServletRequest Http Servlet Request @param attributes Map of attributes to add additional attributes to from the Http Request
[ "Add", "other", "properties", "from", "the", "request", "to", "the", "attributes", "map", "." ]
331200c0878aec202b8aff12a732402d6ba7681f
https://github.com/apereo/person-directory/blob/331200c0878aec202b8aff12a732402d6ba7681f/person-directory-impl/src/main/java/org/apereo/services/persondir/support/web/RequestAttributeSourceFilter.java#L407-L428
train
apereo/person-directory
person-directory-impl/src/main/java/org/apereo/services/persondir/support/web/RequestAttributeSourceFilter.java
RequestAttributeSourceFilter.addRequestCookies
protected void addRequestCookies(final HttpServletRequest httpServletRequest, final Map<String, List<Object>> attributes) { final Cookie[] cookies = httpServletRequest.getCookies(); if (cookies == null) { return; } for (final Cookie cookie : cookies) { final String cookieName = cookie.getName(); if (this.cookieAttributeMapping.containsKey(cookieName)) { for (final String attributeName : this.cookieAttributeMapping.get(cookieName)) { attributes.put(attributeName, list(cookie.getValue())); } } } }
java
protected void addRequestCookies(final HttpServletRequest httpServletRequest, final Map<String, List<Object>> attributes) { final Cookie[] cookies = httpServletRequest.getCookies(); if (cookies == null) { return; } for (final Cookie cookie : cookies) { final String cookieName = cookie.getName(); if (this.cookieAttributeMapping.containsKey(cookieName)) { for (final String attributeName : this.cookieAttributeMapping.get(cookieName)) { attributes.put(attributeName, list(cookie.getValue())); } } } }
[ "protected", "void", "addRequestCookies", "(", "final", "HttpServletRequest", "httpServletRequest", ",", "final", "Map", "<", "String", ",", "List", "<", "Object", ">", ">", "attributes", ")", "{", "final", "Cookie", "[", "]", "cookies", "=", "httpServletRequest...
Add request cookies to the attributes map @param httpServletRequest Http Servlet Request @param attributes Map of attributes to add additional attributes to from the Http Request
[ "Add", "request", "cookies", "to", "the", "attributes", "map" ]
331200c0878aec202b8aff12a732402d6ba7681f
https://github.com/apereo/person-directory/blob/331200c0878aec202b8aff12a732402d6ba7681f/person-directory-impl/src/main/java/org/apereo/services/persondir/support/web/RequestAttributeSourceFilter.java#L436-L450
train
apereo/person-directory
person-directory-impl/src/main/java/org/apereo/services/persondir/support/web/RequestAttributeSourceFilter.java
RequestAttributeSourceFilter.addRequestHeaders
protected void addRequestHeaders(final HttpServletRequest httpServletRequest, final Map<String, List<Object>> attributes) { for (final Map.Entry<String, Set<String>> headerAttributeEntry : this.headerAttributeMapping.entrySet()) { final String headerName = headerAttributeEntry.getKey(); final String value = httpServletRequest.getHeader(headerName); if (value != null) { for (final String attributeName : headerAttributeEntry.getValue()) { attributes.put(attributeName, headersToIgnoreSemicolons.contains(headerName) ? list(value) : splitOnSemiColonHandlingBackslashEscaping(value)); } } } }
java
protected void addRequestHeaders(final HttpServletRequest httpServletRequest, final Map<String, List<Object>> attributes) { for (final Map.Entry<String, Set<String>> headerAttributeEntry : this.headerAttributeMapping.entrySet()) { final String headerName = headerAttributeEntry.getKey(); final String value = httpServletRequest.getHeader(headerName); if (value != null) { for (final String attributeName : headerAttributeEntry.getValue()) { attributes.put(attributeName, headersToIgnoreSemicolons.contains(headerName) ? list(value) : splitOnSemiColonHandlingBackslashEscaping(value)); } } } }
[ "protected", "void", "addRequestHeaders", "(", "final", "HttpServletRequest", "httpServletRequest", ",", "final", "Map", "<", "String", ",", "List", "<", "Object", ">", ">", "attributes", ")", "{", "for", "(", "final", "Map", ".", "Entry", "<", "String", ","...
Add request headers to the attributes map @param httpServletRequest Http Servlet Request @param attributes Map of attributes to add additional attributes to from the Http Request
[ "Add", "request", "headers", "to", "the", "attributes", "map" ]
331200c0878aec202b8aff12a732402d6ba7681f
https://github.com/apereo/person-directory/blob/331200c0878aec202b8aff12a732402d6ba7681f/person-directory-impl/src/main/java/org/apereo/services/persondir/support/web/RequestAttributeSourceFilter.java#L458-L472
train
apereo/person-directory
person-directory-impl/src/main/java/org/apereo/services/persondir/support/ldap/LogicalFilterWrapper.java
LogicalFilterWrapper.append
public void append(final Filter query) { switch (this.queryType) { case OR: { this.orFilter.or(query); } break; default: case AND: { this.andFilter.and(query); } break; } }
java
public void append(final Filter query) { switch (this.queryType) { case OR: { this.orFilter.or(query); } break; default: case AND: { this.andFilter.and(query); } break; } }
[ "public", "void", "append", "(", "final", "Filter", "query", ")", "{", "switch", "(", "this", ".", "queryType", ")", "{", "case", "OR", ":", "{", "this", ".", "orFilter", ".", "or", "(", "query", ")", ";", "}", "break", ";", "default", ":", "case",...
Append the query Filter to the underlying logical Filter
[ "Append", "the", "query", "Filter", "to", "the", "underlying", "logical", "Filter" ]
331200c0878aec202b8aff12a732402d6ba7681f
https://github.com/apereo/person-directory/blob/331200c0878aec202b8aff12a732402d6ba7681f/person-directory-impl/src/main/java/org/apereo/services/persondir/support/ldap/LogicalFilterWrapper.java#L64-L77
train
apereo/person-directory
person-directory-impl/src/main/java/org/apereo/services/persondir/support/xml/CachingJaxbLoaderImpl.java
CachingJaxbLoaderImpl.isCacheValid
protected boolean isCacheValid(final Long lastModified) { return (lastModified != null && lastModified <= this.lastModifiedTime) || (lastModified == null && (this.lastModifiedTime + this.noLastModifiedReloadPeriod) <= System.currentTimeMillis()); }
java
protected boolean isCacheValid(final Long lastModified) { return (lastModified != null && lastModified <= this.lastModifiedTime) || (lastModified == null && (this.lastModifiedTime + this.noLastModifiedReloadPeriod) <= System.currentTimeMillis()); }
[ "protected", "boolean", "isCacheValid", "(", "final", "Long", "lastModified", ")", "{", "return", "(", "lastModified", "!=", "null", "&&", "lastModified", "<=", "this", ".", "lastModifiedTime", ")", "||", "(", "lastModified", "==", "null", "&&", "(", "this", ...
Determines if the cached unmarshalled object is still valid @param lastModified last modified timestamp of the resource, null if not known. @return true if the cached object should be used
[ "Determines", "if", "the", "cached", "unmarshalled", "object", "is", "still", "valid" ]
331200c0878aec202b8aff12a732402d6ba7681f
https://github.com/apereo/person-directory/blob/331200c0878aec202b8aff12a732402d6ba7681f/person-directory-impl/src/main/java/org/apereo/services/persondir/support/xml/CachingJaxbLoaderImpl.java#L143-L146
train
apereo/person-directory
person-directory-impl/src/main/java/org/apereo/services/persondir/support/BasePersonAttributeDao.java
BasePersonAttributeDao.flattenResults
@Deprecated protected Map<String, Object> flattenResults(final Map<String, List<Object>> multivaluedUserAttributes) { if (!this.enabled) { return null; } if (multivaluedUserAttributes == null) { return null; } //Convert the <String, List<Object> results map to a <String, Object> map using the first value of each List final Map<String, Object> userAttributes = new LinkedHashMap<>(multivaluedUserAttributes.size()); for (final Map.Entry<String, List<Object>> attrEntry : multivaluedUserAttributes.entrySet()) { final String attrName = attrEntry.getKey(); final List<Object> attrValues = attrEntry.getValue(); final Object value; if (attrValues == null || attrValues.size() == 0) { value = null; } else { value = attrValues.get(0); } userAttributes.put(attrName, value); } logger.debug("Flattened Map='{}' into Map='{}'", multivaluedUserAttributes, userAttributes); return userAttributes; }
java
@Deprecated protected Map<String, Object> flattenResults(final Map<String, List<Object>> multivaluedUserAttributes) { if (!this.enabled) { return null; } if (multivaluedUserAttributes == null) { return null; } //Convert the <String, List<Object> results map to a <String, Object> map using the first value of each List final Map<String, Object> userAttributes = new LinkedHashMap<>(multivaluedUserAttributes.size()); for (final Map.Entry<String, List<Object>> attrEntry : multivaluedUserAttributes.entrySet()) { final String attrName = attrEntry.getKey(); final List<Object> attrValues = attrEntry.getValue(); final Object value; if (attrValues == null || attrValues.size() == 0) { value = null; } else { value = attrValues.get(0); } userAttributes.put(attrName, value); } logger.debug("Flattened Map='{}' into Map='{}'", multivaluedUserAttributes, userAttributes); return userAttributes; }
[ "@", "Deprecated", "protected", "Map", "<", "String", ",", "Object", ">", "flattenResults", "(", "final", "Map", "<", "String", ",", "List", "<", "Object", ">", ">", "multivaluedUserAttributes", ")", "{", "if", "(", "!", "this", ".", "enabled", ")", "{",...
Takes a &lt;String, List&lt;Object&gt;&gt; Map and coverts it to a &lt;String, Object&gt; Map. This implementation takes the first value of each List to use as the value for the new Map. @param multivaluedUserAttributes The attribute map to flatten. @return A flattened version of the Map, null if the argument was null. @deprecated This method is just used internally and will be removed with this class in 1.6
[ "Takes", "a", "&lt", ";", "String", "List&lt", ";", "Object&gt", ";", "&gt", ";", "Map", "and", "coverts", "it", "to", "a", "&lt", ";", "String", "Object&gt", ";", "Map", ".", "This", "implementation", "takes", "the", "first", "value", "of", "each", "L...
331200c0878aec202b8aff12a732402d6ba7681f
https://github.com/apereo/person-directory/blob/331200c0878aec202b8aff12a732402d6ba7681f/person-directory-impl/src/main/java/org/apereo/services/persondir/support/BasePersonAttributeDao.java#L132-L162
train
scoverage/scoverage-maven-plugin
src/main/java/org/scoverage/plugin/SCoveragePackageMojo.java
SCoveragePackageMojo.execute
@Override public void execute() { if ( "pom".equals( project.getPackaging() ) ) { getLog().info( "Skipping SCoverage execution for project with packaging type 'pom'" ); return; } if ( skip ) { getLog().info( "Skipping Scoverage execution" ); return; } long ts = System.currentTimeMillis(); SCoverageForkedLifecycleConfigurator.afterForkedLifecycleExit( project, reactorProjects ); long te = System.currentTimeMillis(); getLog().debug( String.format( "Mojo execution time: %d ms", te - ts ) ); }
java
@Override public void execute() { if ( "pom".equals( project.getPackaging() ) ) { getLog().info( "Skipping SCoverage execution for project with packaging type 'pom'" ); return; } if ( skip ) { getLog().info( "Skipping Scoverage execution" ); return; } long ts = System.currentTimeMillis(); SCoverageForkedLifecycleConfigurator.afterForkedLifecycleExit( project, reactorProjects ); long te = System.currentTimeMillis(); getLog().debug( String.format( "Mojo execution time: %d ms", te - ts ) ); }
[ "@", "Override", "public", "void", "execute", "(", ")", "{", "if", "(", "\"pom\"", ".", "equals", "(", "project", ".", "getPackaging", "(", ")", ")", ")", "{", "getLog", "(", ")", ".", "info", "(", "\"Skipping SCoverage execution for project with packaging typ...
Creates artifact file containing instrumented classes.
[ "Creates", "artifact", "file", "containing", "instrumented", "classes", "." ]
b1c874aba521a65c85bcccfa8bff2213b5639c78
https://github.com/scoverage/scoverage-maven-plugin/blob/b1c874aba521a65c85bcccfa8bff2213b5639c78/src/main/java/org/scoverage/plugin/SCoveragePackageMojo.java#L69-L90
train
scoverage/scoverage-maven-plugin
src/main/java/org/scoverage/plugin/SCoveragePostCompileMojo.java
SCoveragePostCompileMojo.execute
@Override public void execute() { if ( "pom".equals( project.getPackaging() ) ) { return; } if ( skip ) { return; } long ts = System.currentTimeMillis(); Properties projectProperties = project.getProperties(); restoreProperty( projectProperties, "sbt._scalacOptions" ); restoreProperty( projectProperties, "sbt._scalacPlugins" ); restoreProperty( projectProperties, "addScalacArgs" ); restoreProperty( projectProperties, "analysisCacheFile" ); restoreProperty( projectProperties, "maven.test.failure.ignore" ); long te = System.currentTimeMillis(); getLog().debug( String.format( "Mojo execution time: %d ms", te - ts ) ); }
java
@Override public void execute() { if ( "pom".equals( project.getPackaging() ) ) { return; } if ( skip ) { return; } long ts = System.currentTimeMillis(); Properties projectProperties = project.getProperties(); restoreProperty( projectProperties, "sbt._scalacOptions" ); restoreProperty( projectProperties, "sbt._scalacPlugins" ); restoreProperty( projectProperties, "addScalacArgs" ); restoreProperty( projectProperties, "analysisCacheFile" ); restoreProperty( projectProperties, "maven.test.failure.ignore" ); long te = System.currentTimeMillis(); getLog().debug( String.format( "Mojo execution time: %d ms", te - ts ) ); }
[ "@", "Override", "public", "void", "execute", "(", ")", "{", "if", "(", "\"pom\"", ".", "equals", "(", "project", ".", "getPackaging", "(", ")", ")", ")", "{", "return", ";", "}", "if", "(", "skip", ")", "{", "return", ";", "}", "long", "ts", "="...
Restores project original configuration after compilation with SCoverage instrumentation.
[ "Restores", "project", "original", "configuration", "after", "compilation", "with", "SCoverage", "instrumentation", "." ]
b1c874aba521a65c85bcccfa8bff2213b5639c78
https://github.com/scoverage/scoverage-maven-plugin/blob/b1c874aba521a65c85bcccfa8bff2213b5639c78/src/main/java/org/scoverage/plugin/SCoveragePostCompileMojo.java#L66-L91
train
scoverage/scoverage-maven-plugin
src/main/java/org/scoverage/plugin/SCoveragePreCompileMojo.java
SCoveragePreCompileMojo.addScoverageDependenciesToClasspath
private void addScoverageDependenciesToClasspath( Artifact scalaScoveragePluginArtifact ) throws MojoExecutionException { @SuppressWarnings( "unchecked" ) Set<Artifact> set = new LinkedHashSet<Artifact>( project.getDependencyArtifacts() ); set.add( scalaScoveragePluginArtifact ); project.setDependencyArtifacts( set ); }
java
private void addScoverageDependenciesToClasspath( Artifact scalaScoveragePluginArtifact ) throws MojoExecutionException { @SuppressWarnings( "unchecked" ) Set<Artifact> set = new LinkedHashSet<Artifact>( project.getDependencyArtifacts() ); set.add( scalaScoveragePluginArtifact ); project.setDependencyArtifacts( set ); }
[ "private", "void", "addScoverageDependenciesToClasspath", "(", "Artifact", "scalaScoveragePluginArtifact", ")", "throws", "MojoExecutionException", "{", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "Set", "<", "Artifact", ">", "set", "=", "new", "LinkedHashSet", ...
We need to tweak our test classpath for Scoverage. @throws MojoExecutionException
[ "We", "need", "to", "tweak", "our", "test", "classpath", "for", "Scoverage", "." ]
b1c874aba521a65c85bcccfa8bff2213b5639c78
https://github.com/scoverage/scoverage-maven-plugin/blob/b1c874aba521a65c85bcccfa8bff2213b5639c78/src/main/java/org/scoverage/plugin/SCoveragePreCompileMojo.java#L496-L503
train
scoverage/scoverage-maven-plugin
src/main/java/org/scoverage/plugin/SCoverageReportMojo.java
SCoverageReportMojo.execute
@Override public void execute() throws MojoExecutionException { if ( !canGenerateReport() ) { getLog().info( "Skipping SCoverage report generation" ); return; } try { RenderingContext context = new RenderingContext( outputDirectory, getOutputName() + ".html" ); SiteRendererSink sink = new SiteRendererSink( context ); Locale locale = Locale.getDefault(); generate( sink, locale ); } catch ( MavenReportException e ) { String prefix = "An error has occurred in " + getName( Locale.ENGLISH ) + " report generation"; throw new MojoExecutionException( prefix + ": " + e.getMessage(), e ); } }
java
@Override public void execute() throws MojoExecutionException { if ( !canGenerateReport() ) { getLog().info( "Skipping SCoverage report generation" ); return; } try { RenderingContext context = new RenderingContext( outputDirectory, getOutputName() + ".html" ); SiteRendererSink sink = new SiteRendererSink( context ); Locale locale = Locale.getDefault(); generate( sink, locale ); } catch ( MavenReportException e ) { String prefix = "An error has occurred in " + getName( Locale.ENGLISH ) + " report generation"; throw new MojoExecutionException( prefix + ": " + e.getMessage(), e ); } }
[ "@", "Override", "public", "void", "execute", "(", ")", "throws", "MojoExecutionException", "{", "if", "(", "!", "canGenerateReport", "(", ")", ")", "{", "getLog", "(", ")", ".", "info", "(", "\"Skipping SCoverage report generation\"", ")", ";", "return", ";",...
Generates SCoverage report. @throws MojoExecutionException if unexpected problem occurs
[ "Generates", "SCoverage", "report", "." ]
b1c874aba521a65c85bcccfa8bff2213b5639c78
https://github.com/scoverage/scoverage-maven-plugin/blob/b1c874aba521a65c85bcccfa8bff2213b5639c78/src/main/java/org/scoverage/plugin/SCoverageReportMojo.java#L369-L391
train
nebula-plugins/nebula-dependency-recommender-plugin
src/main/groovy/netflix/nebula/dependency/recommender/DependencyRecommendationsPlugin.java
DependencyRecommendationsPlugin.getRecommendedVersionRecursive
protected String getRecommendedVersionRecursive(Project project, ModuleVersionSelector mvSelector) { String version = project.getExtensions().getByType(RecommendationProviderContainer.class) .getRecommendedVersion(mvSelector.getGroup(), mvSelector.getName()); if (version != null) return version; if (project.getParent() != null) return getRecommendedVersionRecursive(project.getParent(), mvSelector); return null; }
java
protected String getRecommendedVersionRecursive(Project project, ModuleVersionSelector mvSelector) { String version = project.getExtensions().getByType(RecommendationProviderContainer.class) .getRecommendedVersion(mvSelector.getGroup(), mvSelector.getName()); if (version != null) return version; if (project.getParent() != null) return getRecommendedVersionRecursive(project.getParent(), mvSelector); return null; }
[ "protected", "String", "getRecommendedVersionRecursive", "(", "Project", "project", ",", "ModuleVersionSelector", "mvSelector", ")", "{", "String", "version", "=", "project", ".", "getExtensions", "(", ")", ".", "getByType", "(", "RecommendationProviderContainer", ".", ...
Look for recommended versions in a project and each of its ancestors in order until one is found or the root is reached @param project the gradle <code>Project</code> @param mvSelector the module to lookup @return the recommended version or <code>null</code>
[ "Look", "for", "recommended", "versions", "in", "a", "project", "and", "each", "of", "its", "ancestors", "in", "order", "until", "one", "is", "found", "or", "the", "root", "is", "reached" ]
7cd008bd202641cf4abb0a7a470dbe5c8c3a67dc
https://github.com/nebula-plugins/nebula-dependency-recommender-plugin/blob/7cd008bd202641cf4abb0a7a470dbe5c8c3a67dc/src/main/groovy/netflix/nebula/dependency/recommender/DependencyRecommendationsPlugin.java#L217-L225
train
killbilling/recurly-java-library
src/main/java/com/ning/billing/recurly/RecurlyClient.java
RecurlyClient.getAccountsCount
public Integer getAccountsCount(final QueryParams params) { FluentCaseInsensitiveStringsMap map = doHEAD(Accounts.ACCOUNTS_RESOURCE, params); return Integer.parseInt(map.getFirstValue(X_RECORDS_HEADER_NAME)); }
java
public Integer getAccountsCount(final QueryParams params) { FluentCaseInsensitiveStringsMap map = doHEAD(Accounts.ACCOUNTS_RESOURCE, params); return Integer.parseInt(map.getFirstValue(X_RECORDS_HEADER_NAME)); }
[ "public", "Integer", "getAccountsCount", "(", "final", "QueryParams", "params", ")", "{", "FluentCaseInsensitiveStringsMap", "map", "=", "doHEAD", "(", "Accounts", ".", "ACCOUNTS_RESOURCE", ",", "params", ")", ";", "return", "Integer", ".", "parseInt", "(", "map",...
Get number of Accounts matching the query params @param params {@link QueryParams} @return Integer on success, null otherwise
[ "Get", "number", "of", "Accounts", "matching", "the", "query", "params" ]
5e05eedd91885a51e1aa8293bd41139d082cf7f4
https://github.com/killbilling/recurly-java-library/blob/5e05eedd91885a51e1aa8293bd41139d082cf7f4/src/main/java/com/ning/billing/recurly/RecurlyClient.java#L262-L265
train
killbilling/recurly-java-library
src/main/java/com/ning/billing/recurly/RecurlyClient.java
RecurlyClient.getCouponsCount
public Integer getCouponsCount(final QueryParams params) { FluentCaseInsensitiveStringsMap map = doHEAD(Coupons.COUPONS_RESOURCE, params); return Integer.parseInt(map.getFirstValue(X_RECORDS_HEADER_NAME)); }
java
public Integer getCouponsCount(final QueryParams params) { FluentCaseInsensitiveStringsMap map = doHEAD(Coupons.COUPONS_RESOURCE, params); return Integer.parseInt(map.getFirstValue(X_RECORDS_HEADER_NAME)); }
[ "public", "Integer", "getCouponsCount", "(", "final", "QueryParams", "params", ")", "{", "FluentCaseInsensitiveStringsMap", "map", "=", "doHEAD", "(", "Coupons", ".", "COUPONS_RESOURCE", ",", "params", ")", ";", "return", "Integer", ".", "parseInt", "(", "map", ...
Get number of Coupons matching the query params @param params {@link QueryParams} @return Integer on success, null otherwise
[ "Get", "number", "of", "Coupons", "matching", "the", "query", "params" ]
5e05eedd91885a51e1aa8293bd41139d082cf7f4
https://github.com/killbilling/recurly-java-library/blob/5e05eedd91885a51e1aa8293bd41139d082cf7f4/src/main/java/com/ning/billing/recurly/RecurlyClient.java#L296-L299
train
killbilling/recurly-java-library
src/main/java/com/ning/billing/recurly/RecurlyClient.java
RecurlyClient.getSubscriptionsCount
public Integer getSubscriptionsCount(final QueryParams params) { FluentCaseInsensitiveStringsMap map = doHEAD(Subscription.SUBSCRIPTION_RESOURCE, params); return Integer.parseInt(map.getFirstValue(X_RECORDS_HEADER_NAME)); }
java
public Integer getSubscriptionsCount(final QueryParams params) { FluentCaseInsensitiveStringsMap map = doHEAD(Subscription.SUBSCRIPTION_RESOURCE, params); return Integer.parseInt(map.getFirstValue(X_RECORDS_HEADER_NAME)); }
[ "public", "Integer", "getSubscriptionsCount", "(", "final", "QueryParams", "params", ")", "{", "FluentCaseInsensitiveStringsMap", "map", "=", "doHEAD", "(", "Subscription", ".", "SUBSCRIPTION_RESOURCE", ",", "params", ")", ";", "return", "Integer", ".", "parseInt", ...
Get number of Subscriptions matching the query params @param params {@link QueryParams} @return Integer on success, null otherwise
[ "Get", "number", "of", "Subscriptions", "matching", "the", "query", "params" ]
5e05eedd91885a51e1aa8293bd41139d082cf7f4
https://github.com/killbilling/recurly-java-library/blob/5e05eedd91885a51e1aa8293bd41139d082cf7f4/src/main/java/com/ning/billing/recurly/RecurlyClient.java#L675-L678
train
killbilling/recurly-java-library
src/main/java/com/ning/billing/recurly/RecurlyClient.java
RecurlyClient.getTransactionsCount
public Integer getTransactionsCount(final QueryParams params) { FluentCaseInsensitiveStringsMap map = doHEAD(Transactions.TRANSACTIONS_RESOURCE, params); return Integer.parseInt(map.getFirstValue(X_RECORDS_HEADER_NAME)); }
java
public Integer getTransactionsCount(final QueryParams params) { FluentCaseInsensitiveStringsMap map = doHEAD(Transactions.TRANSACTIONS_RESOURCE, params); return Integer.parseInt(map.getFirstValue(X_RECORDS_HEADER_NAME)); }
[ "public", "Integer", "getTransactionsCount", "(", "final", "QueryParams", "params", ")", "{", "FluentCaseInsensitiveStringsMap", "map", "=", "doHEAD", "(", "Transactions", ".", "TRANSACTIONS_RESOURCE", ",", "params", ")", ";", "return", "Integer", ".", "parseInt", "...
Get number of Transactions matching the query params @param params {@link QueryParams} @return Integer on success, null otherwise
[ "Get", "number", "of", "Transactions", "matching", "the", "query", "params" ]
5e05eedd91885a51e1aa8293bd41139d082cf7f4
https://github.com/killbilling/recurly-java-library/blob/5e05eedd91885a51e1aa8293bd41139d082cf7f4/src/main/java/com/ning/billing/recurly/RecurlyClient.java#L921-L924
train
killbilling/recurly-java-library
src/main/java/com/ning/billing/recurly/RecurlyClient.java
RecurlyClient.getTransaction
public Transaction getTransaction(final String transactionId) { if (transactionId == null || transactionId.isEmpty()) throw new RuntimeException("transactionId cannot be empty!"); return doGET(Transactions.TRANSACTIONS_RESOURCE + "/" + transactionId, Transaction.class); }
java
public Transaction getTransaction(final String transactionId) { if (transactionId == null || transactionId.isEmpty()) throw new RuntimeException("transactionId cannot be empty!"); return doGET(Transactions.TRANSACTIONS_RESOURCE + "/" + transactionId, Transaction.class); }
[ "public", "Transaction", "getTransaction", "(", "final", "String", "transactionId", ")", "{", "if", "(", "transactionId", "==", "null", "||", "transactionId", ".", "isEmpty", "(", ")", ")", "throw", "new", "RuntimeException", "(", "\"transactionId cannot be empty!\"...
Lookup a transaction @param transactionId recurly transaction id @return the transaction if found, null otherwise
[ "Lookup", "a", "transaction" ]
5e05eedd91885a51e1aa8293bd41139d082cf7f4
https://github.com/killbilling/recurly-java-library/blob/5e05eedd91885a51e1aa8293bd41139d082cf7f4/src/main/java/com/ning/billing/recurly/RecurlyClient.java#L932-L938
train
killbilling/recurly-java-library
src/main/java/com/ning/billing/recurly/RecurlyClient.java
RecurlyClient.refundTransaction
public void refundTransaction(final String transactionId, @Nullable final BigDecimal amount) { String url = Transactions.TRANSACTIONS_RESOURCE + "/" + transactionId; if (amount != null) { url = url + "?amount_in_cents=" + (amount.intValue() * 100); } doDELETE(url); }
java
public void refundTransaction(final String transactionId, @Nullable final BigDecimal amount) { String url = Transactions.TRANSACTIONS_RESOURCE + "/" + transactionId; if (amount != null) { url = url + "?amount_in_cents=" + (amount.intValue() * 100); } doDELETE(url); }
[ "public", "void", "refundTransaction", "(", "final", "String", "transactionId", ",", "@", "Nullable", "final", "BigDecimal", "amount", ")", "{", "String", "url", "=", "Transactions", ".", "TRANSACTIONS_RESOURCE", "+", "\"/\"", "+", "transactionId", ";", "if", "(...
Refund a transaction @param transactionId recurly transaction id @param amount amount to refund, null for full refund
[ "Refund", "a", "transaction" ]
5e05eedd91885a51e1aa8293bd41139d082cf7f4
https://github.com/killbilling/recurly-java-library/blob/5e05eedd91885a51e1aa8293bd41139d082cf7f4/src/main/java/com/ning/billing/recurly/RecurlyClient.java#L956-L962
train
killbilling/recurly-java-library
src/main/java/com/ning/billing/recurly/RecurlyClient.java
RecurlyClient.getInvoice
public Invoice getInvoice(final String invoiceId) { if (invoiceId == null || invoiceId.isEmpty()) throw new RuntimeException("invoiceId cannot be empty!"); return doGET(Invoices.INVOICES_RESOURCE + "/" + invoiceId, Invoice.class); }
java
public Invoice getInvoice(final String invoiceId) { if (invoiceId == null || invoiceId.isEmpty()) throw new RuntimeException("invoiceId cannot be empty!"); return doGET(Invoices.INVOICES_RESOURCE + "/" + invoiceId, Invoice.class); }
[ "public", "Invoice", "getInvoice", "(", "final", "String", "invoiceId", ")", "{", "if", "(", "invoiceId", "==", "null", "||", "invoiceId", ".", "isEmpty", "(", ")", ")", "throw", "new", "RuntimeException", "(", "\"invoiceId cannot be empty!\"", ")", ";", "retu...
Lookup an invoice given an invoice id <p> Returns the invoice given a string id. The invoice may or may not have acountry code prefix (ex: IE1023). For more information on invoicing and prefixes, see: https://docs.recurly.com/docs/site-settings#section-invoice-prefixing @param invoiceId String Recurly Invoice ID @return the invoice
[ "Lookup", "an", "invoice", "given", "an", "invoice", "id" ]
5e05eedd91885a51e1aa8293bd41139d082cf7f4
https://github.com/killbilling/recurly-java-library/blob/5e05eedd91885a51e1aa8293bd41139d082cf7f4/src/main/java/com/ning/billing/recurly/RecurlyClient.java#L994-L999
train
killbilling/recurly-java-library
src/main/java/com/ning/billing/recurly/RecurlyClient.java
RecurlyClient.markInvoiceSuccessful
public Invoice markInvoiceSuccessful(final String invoiceId) { return doPUT(Invoices.INVOICES_RESOURCE + "/" + invoiceId + "/mark_successful", null, Invoice.class); }
java
public Invoice markInvoiceSuccessful(final String invoiceId) { return doPUT(Invoices.INVOICES_RESOURCE + "/" + invoiceId + "/mark_successful", null, Invoice.class); }
[ "public", "Invoice", "markInvoiceSuccessful", "(", "final", "String", "invoiceId", ")", "{", "return", "doPUT", "(", "Invoices", ".", "INVOICES_RESOURCE", "+", "\"/\"", "+", "invoiceId", "+", "\"/mark_successful\"", ",", "null", ",", "Invoice", ".", "class", ")"...
Mark an invoice as paid successfully - Recurly Enterprise Feature @param invoiceId String Recurly Invoice ID
[ "Mark", "an", "invoice", "as", "paid", "successfully", "-", "Recurly", "Enterprise", "Feature" ]
5e05eedd91885a51e1aa8293bd41139d082cf7f4
https://github.com/killbilling/recurly-java-library/blob/5e05eedd91885a51e1aa8293bd41139d082cf7f4/src/main/java/com/ning/billing/recurly/RecurlyClient.java#L1280-L1282
train
killbilling/recurly-java-library
src/main/java/com/ning/billing/recurly/RecurlyClient.java
RecurlyClient.markInvoiceFailed
public InvoiceCollection markInvoiceFailed(final String invoiceId) { return doPUT(Invoices.INVOICES_RESOURCE + "/" + invoiceId + "/mark_failed", null, InvoiceCollection.class); }
java
public InvoiceCollection markInvoiceFailed(final String invoiceId) { return doPUT(Invoices.INVOICES_RESOURCE + "/" + invoiceId + "/mark_failed", null, InvoiceCollection.class); }
[ "public", "InvoiceCollection", "markInvoiceFailed", "(", "final", "String", "invoiceId", ")", "{", "return", "doPUT", "(", "Invoices", ".", "INVOICES_RESOURCE", "+", "\"/\"", "+", "invoiceId", "+", "\"/mark_failed\"", ",", "null", ",", "InvoiceCollection", ".", "c...
Mark an invoice as failed collection @param invoiceId String Recurly Invoice ID
[ "Mark", "an", "invoice", "as", "failed", "collection" ]
5e05eedd91885a51e1aa8293bd41139d082cf7f4
https://github.com/killbilling/recurly-java-library/blob/5e05eedd91885a51e1aa8293bd41139d082cf7f4/src/main/java/com/ning/billing/recurly/RecurlyClient.java#L1301-L1303
train
killbilling/recurly-java-library
src/main/java/com/ning/billing/recurly/RecurlyClient.java
RecurlyClient.forceCollectInvoice
public Invoice forceCollectInvoice(final String invoiceId) { return doPUT(Invoices.INVOICES_RESOURCE + "/" + invoiceId + "/collect", null, Invoice.class); }
java
public Invoice forceCollectInvoice(final String invoiceId) { return doPUT(Invoices.INVOICES_RESOURCE + "/" + invoiceId + "/collect", null, Invoice.class); }
[ "public", "Invoice", "forceCollectInvoice", "(", "final", "String", "invoiceId", ")", "{", "return", "doPUT", "(", "Invoices", ".", "INVOICES_RESOURCE", "+", "\"/\"", "+", "invoiceId", "+", "\"/collect\"", ",", "null", ",", "Invoice", ".", "class", ")", ";", ...
Force collect an invoice @param invoiceId String Recurly Invoice ID
[ "Force", "collect", "an", "invoice" ]
5e05eedd91885a51e1aa8293bd41139d082cf7f4
https://github.com/killbilling/recurly-java-library/blob/5e05eedd91885a51e1aa8293bd41139d082cf7f4/src/main/java/com/ning/billing/recurly/RecurlyClient.java#L1310-L1312
train
killbilling/recurly-java-library
src/main/java/com/ning/billing/recurly/RecurlyClient.java
RecurlyClient.getPlansCount
public Integer getPlansCount(final QueryParams params) { FluentCaseInsensitiveStringsMap map = doHEAD(Plans.PLANS_RESOURCE, params); return Integer.parseInt(map.getFirstValue(X_RECORDS_HEADER_NAME)); }
java
public Integer getPlansCount(final QueryParams params) { FluentCaseInsensitiveStringsMap map = doHEAD(Plans.PLANS_RESOURCE, params); return Integer.parseInt(map.getFirstValue(X_RECORDS_HEADER_NAME)); }
[ "public", "Integer", "getPlansCount", "(", "final", "QueryParams", "params", ")", "{", "FluentCaseInsensitiveStringsMap", "map", "=", "doHEAD", "(", "Plans", ".", "PLANS_RESOURCE", ",", "params", ")", ";", "return", "Integer", ".", "parseInt", "(", "map", ".", ...
Get number of Plans matching the query params @param params {@link QueryParams} @return Integer on success, null otherwise
[ "Get", "number", "of", "Plans", "matching", "the", "query", "params" ]
5e05eedd91885a51e1aa8293bd41139d082cf7f4
https://github.com/killbilling/recurly-java-library/blob/5e05eedd91885a51e1aa8293bd41139d082cf7f4/src/main/java/com/ning/billing/recurly/RecurlyClient.java#L1411-L1414
train
killbilling/recurly-java-library
src/main/java/com/ning/billing/recurly/RecurlyClient.java
RecurlyClient.getCouponRedemptionByAccount
public Redemption getCouponRedemptionByAccount(final String accountCode) { return doGET(Accounts.ACCOUNTS_RESOURCE + "/" + accountCode + Redemption.REDEMPTION_RESOURCE, Redemption.class); }
java
public Redemption getCouponRedemptionByAccount(final String accountCode) { return doGET(Accounts.ACCOUNTS_RESOURCE + "/" + accountCode + Redemption.REDEMPTION_RESOURCE, Redemption.class); }
[ "public", "Redemption", "getCouponRedemptionByAccount", "(", "final", "String", "accountCode", ")", "{", "return", "doGET", "(", "Accounts", ".", "ACCOUNTS_RESOURCE", "+", "\"/\"", "+", "accountCode", "+", "Redemption", ".", "REDEMPTION_RESOURCE", ",", "Redemption", ...
Lookup the first coupon redemption on an account. @param accountCode recurly account id @return the coupon redemption for this account on success, null otherwise
[ "Lookup", "the", "first", "coupon", "redemption", "on", "an", "account", "." ]
5e05eedd91885a51e1aa8293bd41139d082cf7f4
https://github.com/killbilling/recurly-java-library/blob/5e05eedd91885a51e1aa8293bd41139d082cf7f4/src/main/java/com/ning/billing/recurly/RecurlyClient.java#L1592-L1595
train
killbilling/recurly-java-library
src/main/java/com/ning/billing/recurly/RecurlyClient.java
RecurlyClient.getCouponRedemptionsByAccount
public Redemptions getCouponRedemptionsByAccount(final String accountCode) { return doGET(Accounts.ACCOUNTS_RESOURCE + "/" + accountCode + Redemption.REDEMPTIONS_RESOURCE, Redemptions.class, new QueryParams()); }
java
public Redemptions getCouponRedemptionsByAccount(final String accountCode) { return doGET(Accounts.ACCOUNTS_RESOURCE + "/" + accountCode + Redemption.REDEMPTIONS_RESOURCE, Redemptions.class, new QueryParams()); }
[ "public", "Redemptions", "getCouponRedemptionsByAccount", "(", "final", "String", "accountCode", ")", "{", "return", "doGET", "(", "Accounts", ".", "ACCOUNTS_RESOURCE", "+", "\"/\"", "+", "accountCode", "+", "Redemption", ".", "REDEMPTIONS_RESOURCE", ",", "Redemptions...
Lookup all coupon redemptions on an account. @param accountCode recurly account id @return the coupon redemptions for this account on success, null otherwise
[ "Lookup", "all", "coupon", "redemptions", "on", "an", "account", "." ]
5e05eedd91885a51e1aa8293bd41139d082cf7f4
https://github.com/killbilling/recurly-java-library/blob/5e05eedd91885a51e1aa8293bd41139d082cf7f4/src/main/java/com/ning/billing/recurly/RecurlyClient.java#L1603-L1606
train
killbilling/recurly-java-library
src/main/java/com/ning/billing/recurly/RecurlyClient.java
RecurlyClient.getCouponRedemptionByInvoice
public Redemption getCouponRedemptionByInvoice(final String invoiceId) { return doGET(Invoices.INVOICES_RESOURCE + "/" + invoiceId + Redemption.REDEMPTION_RESOURCE, Redemption.class); }
java
public Redemption getCouponRedemptionByInvoice(final String invoiceId) { return doGET(Invoices.INVOICES_RESOURCE + "/" + invoiceId + Redemption.REDEMPTION_RESOURCE, Redemption.class); }
[ "public", "Redemption", "getCouponRedemptionByInvoice", "(", "final", "String", "invoiceId", ")", "{", "return", "doGET", "(", "Invoices", ".", "INVOICES_RESOURCE", "+", "\"/\"", "+", "invoiceId", "+", "Redemption", ".", "REDEMPTION_RESOURCE", ",", "Redemption", "."...
Lookup the first coupon redemption on an invoice. @param invoiceId String invoice id @return the coupon redemption for this invoice on success, null otherwise
[ "Lookup", "the", "first", "coupon", "redemption", "on", "an", "invoice", "." ]
5e05eedd91885a51e1aa8293bd41139d082cf7f4
https://github.com/killbilling/recurly-java-library/blob/5e05eedd91885a51e1aa8293bd41139d082cf7f4/src/main/java/com/ning/billing/recurly/RecurlyClient.java#L1639-L1642
train
killbilling/recurly-java-library
src/main/java/com/ning/billing/recurly/RecurlyClient.java
RecurlyClient.getCouponRedemptionsBySubscription
public Redemptions getCouponRedemptionsBySubscription(final String subscriptionUuid, final QueryParams params) { return doGET(Subscription.SUBSCRIPTION_RESOURCE + "/" + subscriptionUuid + Redemptions.REDEMPTIONS_RESOURCE, Redemptions.class, params); }
java
public Redemptions getCouponRedemptionsBySubscription(final String subscriptionUuid, final QueryParams params) { return doGET(Subscription.SUBSCRIPTION_RESOURCE + "/" + subscriptionUuid + Redemptions.REDEMPTIONS_RESOURCE, Redemptions.class, params); }
[ "public", "Redemptions", "getCouponRedemptionsBySubscription", "(", "final", "String", "subscriptionUuid", ",", "final", "QueryParams", "params", ")", "{", "return", "doGET", "(", "Subscription", ".", "SUBSCRIPTION_RESOURCE", "+", "\"/\"", "+", "subscriptionUuid", "+", ...
Lookup all coupon redemptions on a subscription given query params. @param subscriptionUuid String subscription uuid @param params {@link QueryParams} @return the coupon redemptions for this subscription on success, null otherwise
[ "Lookup", "all", "coupon", "redemptions", "on", "a", "subscription", "given", "query", "params", "." ]
5e05eedd91885a51e1aa8293bd41139d082cf7f4
https://github.com/killbilling/recurly-java-library/blob/5e05eedd91885a51e1aa8293bd41139d082cf7f4/src/main/java/com/ning/billing/recurly/RecurlyClient.java#L1701-L1704
train
killbilling/recurly-java-library
src/main/java/com/ning/billing/recurly/RecurlyClient.java
RecurlyClient.deleteCouponRedemption
public void deleteCouponRedemption(final String accountCode, final String redemptionUuid) { doDELETE(Accounts.ACCOUNTS_RESOURCE + "/" + accountCode + Redemption.REDEMPTIONS_RESOURCE + "/" + redemptionUuid); }
java
public void deleteCouponRedemption(final String accountCode, final String redemptionUuid) { doDELETE(Accounts.ACCOUNTS_RESOURCE + "/" + accountCode + Redemption.REDEMPTIONS_RESOURCE + "/" + redemptionUuid); }
[ "public", "void", "deleteCouponRedemption", "(", "final", "String", "accountCode", ",", "final", "String", "redemptionUuid", ")", "{", "doDELETE", "(", "Accounts", ".", "ACCOUNTS_RESOURCE", "+", "\"/\"", "+", "accountCode", "+", "Redemption", ".", "REDEMPTIONS_RESOU...
Deletes a specific redemption. @param accountCode recurly account id @param redemptionUuid recurly coupon redemption uuid
[ "Deletes", "a", "specific", "redemption", "." ]
5e05eedd91885a51e1aa8293bd41139d082cf7f4
https://github.com/killbilling/recurly-java-library/blob/5e05eedd91885a51e1aa8293bd41139d082cf7f4/src/main/java/com/ning/billing/recurly/RecurlyClient.java#L1721-L1723
train
killbilling/recurly-java-library
src/main/java/com/ning/billing/recurly/RecurlyClient.java
RecurlyClient.generateUniqueCodes
public void generateUniqueCodes(final String couponCode, final Coupon coupon) { doPOST(Coupon.COUPON_RESOURCE + "/" + couponCode + Coupon.GENERATE_RESOURCE, coupon, null); }
java
public void generateUniqueCodes(final String couponCode, final Coupon coupon) { doPOST(Coupon.COUPON_RESOURCE + "/" + couponCode + Coupon.GENERATE_RESOURCE, coupon, null); }
[ "public", "void", "generateUniqueCodes", "(", "final", "String", "couponCode", ",", "final", "Coupon", "coupon", ")", "{", "doPOST", "(", "Coupon", ".", "COUPON_RESOURCE", "+", "\"/\"", "+", "couponCode", "+", "Coupon", ".", "GENERATE_RESOURCE", ",", "coupon", ...
Generates unique codes for a bulk coupon. @param couponCode recurly coupon code (must have been created as type: bulk) @param coupon A coupon with number of unique codes set
[ "Generates", "unique", "codes", "for", "a", "bulk", "coupon", "." ]
5e05eedd91885a51e1aa8293bd41139d082cf7f4
https://github.com/killbilling/recurly-java-library/blob/5e05eedd91885a51e1aa8293bd41139d082cf7f4/src/main/java/com/ning/billing/recurly/RecurlyClient.java#L1731-L1734
train
killbilling/recurly-java-library
src/main/java/com/ning/billing/recurly/RecurlyClient.java
RecurlyClient.getUniqueCouponCodes
public Coupons getUniqueCouponCodes(final String couponCode, final QueryParams params) { return doGET(Coupon.COUPON_RESOURCE + "/" + couponCode + Coupon.UNIQUE_CODES_RESOURCE, Coupons.class, params); }
java
public Coupons getUniqueCouponCodes(final String couponCode, final QueryParams params) { return doGET(Coupon.COUPON_RESOURCE + "/" + couponCode + Coupon.UNIQUE_CODES_RESOURCE, Coupons.class, params); }
[ "public", "Coupons", "getUniqueCouponCodes", "(", "final", "String", "couponCode", ",", "final", "QueryParams", "params", ")", "{", "return", "doGET", "(", "Coupon", ".", "COUPON_RESOURCE", "+", "\"/\"", "+", "couponCode", "+", "Coupon", ".", "UNIQUE_CODES_RESOURC...
Lookup all unique codes for a bulk coupon given query params. @param couponCode String coupon code @param params {@link QueryParams} @return the unique coupon codes for the coupon code on success, null otherwise
[ "Lookup", "all", "unique", "codes", "for", "a", "bulk", "coupon", "given", "query", "params", "." ]
5e05eedd91885a51e1aa8293bd41139d082cf7f4
https://github.com/killbilling/recurly-java-library/blob/5e05eedd91885a51e1aa8293bd41139d082cf7f4/src/main/java/com/ning/billing/recurly/RecurlyClient.java#L1743-L1746
train
killbilling/recurly-java-library
src/main/java/com/ning/billing/recurly/RecurlyClient.java
RecurlyClient.getGiftCardsCount
public Integer getGiftCardsCount(final QueryParams params) { FluentCaseInsensitiveStringsMap map = doHEAD(GiftCards.GIFT_CARDS_RESOURCE, params); return Integer.parseInt(map.getFirstValue(X_RECORDS_HEADER_NAME)); }
java
public Integer getGiftCardsCount(final QueryParams params) { FluentCaseInsensitiveStringsMap map = doHEAD(GiftCards.GIFT_CARDS_RESOURCE, params); return Integer.parseInt(map.getFirstValue(X_RECORDS_HEADER_NAME)); }
[ "public", "Integer", "getGiftCardsCount", "(", "final", "QueryParams", "params", ")", "{", "FluentCaseInsensitiveStringsMap", "map", "=", "doHEAD", "(", "GiftCards", ".", "GIFT_CARDS_RESOURCE", ",", "params", ")", ";", "return", "Integer", ".", "parseInt", "(", "m...
Get number of GiftCards matching the query params @param params {@link QueryParams} @return Integer on success, null otherwise
[ "Get", "number", "of", "GiftCards", "matching", "the", "query", "params" ]
5e05eedd91885a51e1aa8293bd41139d082cf7f4
https://github.com/killbilling/recurly-java-library/blob/5e05eedd91885a51e1aa8293bd41139d082cf7f4/src/main/java/com/ning/billing/recurly/RecurlyClient.java#L1819-L1822
train
killbilling/recurly-java-library
src/main/java/com/ning/billing/recurly/model/push/Notification.java
Notification.detect
public static Type detect(final String payload) { final Matcher m = ROOT_NAME.matcher(payload); if (m.find() && m.groupCount() >= 1) { final String root = m.group(1); try { return Type.valueOf(CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, root)); } catch (IllegalArgumentException e) { log.warn("Enable to detect notification type, no type for {}", root); return null; } } log.warn("Enable to detect notification type"); return null; }
java
public static Type detect(final String payload) { final Matcher m = ROOT_NAME.matcher(payload); if (m.find() && m.groupCount() >= 1) { final String root = m.group(1); try { return Type.valueOf(CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, root)); } catch (IllegalArgumentException e) { log.warn("Enable to detect notification type, no type for {}", root); return null; } } log.warn("Enable to detect notification type"); return null; }
[ "public", "static", "Type", "detect", "(", "final", "String", "payload", ")", "{", "final", "Matcher", "m", "=", "ROOT_NAME", ".", "matcher", "(", "payload", ")", ";", "if", "(", "m", ".", "find", "(", ")", "&&", "m", ".", "groupCount", "(", ")", "...
Detect notification type based on the xml root name. @param payload @return notification type or null if root name is not found or if there is no type corresponding to the root name
[ "Detect", "notification", "type", "based", "on", "the", "xml", "root", "name", "." ]
5e05eedd91885a51e1aa8293bd41139d082cf7f4
https://github.com/killbilling/recurly-java-library/blob/5e05eedd91885a51e1aa8293bd41139d082cf7f4/src/main/java/com/ning/billing/recurly/model/push/Notification.java#L127-L140
train
killbilling/recurly-java-library
src/main/java/com/ning/billing/recurly/model/GiftCard.java
GiftCard.createRedemption
public static GiftCard.Redemption createRedemption(String accountCode) { Redemption redemption = new Redemption(); redemption.setAccountCode(accountCode); return redemption; }
java
public static GiftCard.Redemption createRedemption(String accountCode) { Redemption redemption = new Redemption(); redemption.setAccountCode(accountCode); return redemption; }
[ "public", "static", "GiftCard", ".", "Redemption", "createRedemption", "(", "String", "accountCode", ")", "{", "Redemption", "redemption", "=", "new", "Redemption", "(", ")", ";", "redemption", ".", "setAccountCode", "(", "accountCode", ")", ";", "return", "rede...
Builds a redemption request @param accountCode Account code to redeem @return gift card redemption data for an account
[ "Builds", "a", "redemption", "request" ]
5e05eedd91885a51e1aa8293bd41139d082cf7f4
https://github.com/killbilling/recurly-java-library/blob/5e05eedd91885a51e1aa8293bd41139d082cf7f4/src/main/java/com/ning/billing/recurly/model/GiftCard.java#L171-L175
train
killbilling/recurly-java-library
src/main/java/com/ning/billing/recurly/model/Invoice.java
Invoice.getOriginalInvoice
public Invoice getOriginalInvoice() { if (originalInvoice != null && originalInvoice.getHref() != null && !originalInvoice.getHref().isEmpty()) { originalInvoice = fetch(originalInvoice, Invoice.class); } return originalInvoice; }
java
public Invoice getOriginalInvoice() { if (originalInvoice != null && originalInvoice.getHref() != null && !originalInvoice.getHref().isEmpty()) { originalInvoice = fetch(originalInvoice, Invoice.class); } return originalInvoice; }
[ "public", "Invoice", "getOriginalInvoice", "(", ")", "{", "if", "(", "originalInvoice", "!=", "null", "&&", "originalInvoice", ".", "getHref", "(", ")", "!=", "null", "&&", "!", "originalInvoice", ".", "getHref", "(", ")", ".", "isEmpty", "(", ")", ")", ...
Fetches the original invoice if the href is populated, otherwise return the current original invoice. @return fully loaded original invoice
[ "Fetches", "the", "original", "invoice", "if", "the", "href", "is", "populated", "otherwise", "return", "the", "current", "original", "invoice", "." ]
5e05eedd91885a51e1aa8293bd41139d082cf7f4
https://github.com/killbilling/recurly-java-library/blob/5e05eedd91885a51e1aa8293bd41139d082cf7f4/src/main/java/com/ning/billing/recurly/model/Invoice.java#L169-L174
train
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/spatial/convert/ST_AsWKT.java
ST_AsWKT.asWKT
public static String asWKT(Geometry geometry) { if(geometry==null) { return null; } WKTWriter wktWriter = new WKTWriter(); return wktWriter.write(geometry); }
java
public static String asWKT(Geometry geometry) { if(geometry==null) { return null; } WKTWriter wktWriter = new WKTWriter(); return wktWriter.write(geometry); }
[ "public", "static", "String", "asWKT", "(", "Geometry", "geometry", ")", "{", "if", "(", "geometry", "==", "null", ")", "{", "return", "null", ";", "}", "WKTWriter", "wktWriter", "=", "new", "WKTWriter", "(", ")", ";", "return", "wktWriter", ".", "write"...
Convert a Geometry value into a Well Known Text value. @param geometry Geometry instance @return The String representation
[ "Convert", "a", "Geometry", "value", "into", "a", "Well", "Known", "Text", "value", "." ]
9cd70b447e6469cecbc2fc64b16774b59491df3b
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/convert/ST_AsWKT.java#L49-L55
train
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/spatial/edit/ST_MultiplyZ.java
ST_MultiplyZ.multiplyZ
public static Geometry multiplyZ(Geometry geometry, double z) throws SQLException { if(geometry == null){ return null; } geometry.apply(new MultiplyZCoordinateSequenceFilter(z)); return geometry; }
java
public static Geometry multiplyZ(Geometry geometry, double z) throws SQLException { if(geometry == null){ return null; } geometry.apply(new MultiplyZCoordinateSequenceFilter(z)); return geometry; }
[ "public", "static", "Geometry", "multiplyZ", "(", "Geometry", "geometry", ",", "double", "z", ")", "throws", "SQLException", "{", "if", "(", "geometry", "==", "null", ")", "{", "return", "null", ";", "}", "geometry", ".", "apply", "(", "new", "MultiplyZCoo...
Multiply the z values of the geometry by another double value. NaN values are not updated. @param geometry @param z @return @throws java.sql.SQLException
[ "Multiply", "the", "z", "values", "of", "the", "geometry", "by", "another", "double", "value", ".", "NaN", "values", "are", "not", "updated", "." ]
9cd70b447e6469cecbc2fc64b16774b59491df3b
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/edit/ST_MultiplyZ.java#L56-L62
train
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/io/shp/internal/SHPDriver.java
SHPDriver.insertRow
@Override public void insertRow(Object[] values) throws IOException { if(!(values[geometryFieldIndex] instanceof Geometry)) { if(values[geometryFieldIndex]==null) { throw new IOException("Shape files do not support NULL Geometry values."); } else { throw new IllegalArgumentException("Field at "+geometryFieldIndex+" should be an instance of Geometry," + " found "+values[geometryFieldIndex].getClass()+" instead."); } } shapefileWriter.writeGeometry((Geometry)values[geometryFieldIndex]); // Extract the DBF part of the row Object[] dbfValues = new Object[values.length - 1]; // Copy DBF data before geometryFieldIndex if(geometryFieldIndex > 0) { System.arraycopy(values, 0, dbfValues, 0, geometryFieldIndex); } // Copy DBF data after geometryFieldIndex if(geometryFieldIndex + 1 < values.length) { System.arraycopy(values, geometryFieldIndex + 1, dbfValues, geometryFieldIndex, dbfValues.length - geometryFieldIndex); } dbfDriver.insertRow(dbfValues); }
java
@Override public void insertRow(Object[] values) throws IOException { if(!(values[geometryFieldIndex] instanceof Geometry)) { if(values[geometryFieldIndex]==null) { throw new IOException("Shape files do not support NULL Geometry values."); } else { throw new IllegalArgumentException("Field at "+geometryFieldIndex+" should be an instance of Geometry," + " found "+values[geometryFieldIndex].getClass()+" instead."); } } shapefileWriter.writeGeometry((Geometry)values[geometryFieldIndex]); // Extract the DBF part of the row Object[] dbfValues = new Object[values.length - 1]; // Copy DBF data before geometryFieldIndex if(geometryFieldIndex > 0) { System.arraycopy(values, 0, dbfValues, 0, geometryFieldIndex); } // Copy DBF data after geometryFieldIndex if(geometryFieldIndex + 1 < values.length) { System.arraycopy(values, geometryFieldIndex + 1, dbfValues, geometryFieldIndex, dbfValues.length - geometryFieldIndex); } dbfDriver.insertRow(dbfValues); }
[ "@", "Override", "public", "void", "insertRow", "(", "Object", "[", "]", "values", ")", "throws", "IOException", "{", "if", "(", "!", "(", "values", "[", "geometryFieldIndex", "]", "instanceof", "Geometry", ")", ")", "{", "if", "(", "values", "[", "geome...
Insert values in the row @param values @throws IOException
[ "Insert", "values", "in", "the", "row" ]
9cd70b447e6469cecbc2fc64b16774b59491df3b
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/shp/internal/SHPDriver.java#L71-L93
train
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/io/shp/internal/SHPDriver.java
SHPDriver.initDriver
public void initDriver(File shpFile, ShapeType shapeType, DbaseFileHeader dbaseHeader) throws IOException { String path = shpFile.getAbsolutePath(); String nameWithoutExt = path.substring(0,path.lastIndexOf('.')); this.shpFile = new File(nameWithoutExt+".shp"); this.shxFile = new File(nameWithoutExt+".shx"); this.dbfFile = new File(nameWithoutExt+".dbf"); FileOutputStream shpFos = new FileOutputStream(shpFile); FileOutputStream shxFos = new FileOutputStream(shxFile); shapefileWriter = new ShapefileWriter(shpFos.getChannel(), shxFos.getChannel()); this.shapeType = shapeType; shapefileWriter.writeHeaders(shapeType); dbfDriver.initDriver(dbfFile, dbaseHeader); }
java
public void initDriver(File shpFile, ShapeType shapeType, DbaseFileHeader dbaseHeader) throws IOException { String path = shpFile.getAbsolutePath(); String nameWithoutExt = path.substring(0,path.lastIndexOf('.')); this.shpFile = new File(nameWithoutExt+".shp"); this.shxFile = new File(nameWithoutExt+".shx"); this.dbfFile = new File(nameWithoutExt+".dbf"); FileOutputStream shpFos = new FileOutputStream(shpFile); FileOutputStream shxFos = new FileOutputStream(shxFile); shapefileWriter = new ShapefileWriter(shpFos.getChannel(), shxFos.getChannel()); this.shapeType = shapeType; shapefileWriter.writeHeaders(shapeType); dbfDriver.initDriver(dbfFile, dbaseHeader); }
[ "public", "void", "initDriver", "(", "File", "shpFile", ",", "ShapeType", "shapeType", ",", "DbaseFileHeader", "dbaseHeader", ")", "throws", "IOException", "{", "String", "path", "=", "shpFile", ".", "getAbsolutePath", "(", ")", ";", "String", "nameWithoutExt", ...
Init Driver for Write mode @param shpFile @param shapeType @param dbaseHeader @throws IOException
[ "Init", "Driver", "for", "Write", "mode" ]
9cd70b447e6469cecbc2fc64b16774b59491df3b
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/shp/internal/SHPDriver.java#L109-L121
train
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/spatial/edit/ST_CollectionExtract.java
ST_CollectionExtract.getPunctualGeometry
private static void getPunctualGeometry(ArrayList<Point> points, Geometry geometry) { for (int i = 0; i < geometry.getNumGeometries(); i++) { Geometry subGeom = geometry.getGeometryN(i); if(subGeom instanceof Point){ points.add((Point) subGeom); } else if (subGeom instanceof GeometryCollection){ getPunctualGeometry(points, subGeom); } } }
java
private static void getPunctualGeometry(ArrayList<Point> points, Geometry geometry) { for (int i = 0; i < geometry.getNumGeometries(); i++) { Geometry subGeom = geometry.getGeometryN(i); if(subGeom instanceof Point){ points.add((Point) subGeom); } else if (subGeom instanceof GeometryCollection){ getPunctualGeometry(points, subGeom); } } }
[ "private", "static", "void", "getPunctualGeometry", "(", "ArrayList", "<", "Point", ">", "points", ",", "Geometry", "geometry", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "geometry", ".", "getNumGeometries", "(", ")", ";", "i", "++", ")...
Filter point from a geometry @param points @param geometry
[ "Filter", "point", "from", "a", "geometry" ]
9cd70b447e6469cecbc2fc64b16774b59491df3b
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/edit/ST_CollectionExtract.java#L106-L116
train
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/spatial/edit/ST_CollectionExtract.java
ST_CollectionExtract.getLinealGeometry
private static void getLinealGeometry(ArrayList<LineString> lines, Geometry geometry) { for (int i = 0; i < geometry.getNumGeometries(); i++) { Geometry subGeom = geometry.getGeometryN(i); if(subGeom instanceof LineString){ lines.add((LineString) subGeom); } else if (subGeom instanceof GeometryCollection){ getLinealGeometry(lines, subGeom); } } }
java
private static void getLinealGeometry(ArrayList<LineString> lines, Geometry geometry) { for (int i = 0; i < geometry.getNumGeometries(); i++) { Geometry subGeom = geometry.getGeometryN(i); if(subGeom instanceof LineString){ lines.add((LineString) subGeom); } else if (subGeom instanceof GeometryCollection){ getLinealGeometry(lines, subGeom); } } }
[ "private", "static", "void", "getLinealGeometry", "(", "ArrayList", "<", "LineString", ">", "lines", ",", "Geometry", "geometry", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "geometry", ".", "getNumGeometries", "(", ")", ";", "i", "++", ...
Filter line from a geometry @param lines @param geometry
[ "Filter", "line", "from", "a", "geometry" ]
9cd70b447e6469cecbc2fc64b16774b59491df3b
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/edit/ST_CollectionExtract.java#L123-L133
train
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/spatial/edit/ST_CollectionExtract.java
ST_CollectionExtract.getArealGeometry
private static void getArealGeometry(ArrayList<Polygon> polygones, Geometry geometry) { for (int i = 0; i < geometry.getNumGeometries(); i++) { Geometry subGeom = geometry.getGeometryN(i); if(subGeom instanceof Polygon){ polygones.add((Polygon) subGeom); } else if (subGeom instanceof GeometryCollection){ getArealGeometry(polygones, subGeom); } } }
java
private static void getArealGeometry(ArrayList<Polygon> polygones, Geometry geometry) { for (int i = 0; i < geometry.getNumGeometries(); i++) { Geometry subGeom = geometry.getGeometryN(i); if(subGeom instanceof Polygon){ polygones.add((Polygon) subGeom); } else if (subGeom instanceof GeometryCollection){ getArealGeometry(polygones, subGeom); } } }
[ "private", "static", "void", "getArealGeometry", "(", "ArrayList", "<", "Polygon", ">", "polygones", ",", "Geometry", "geometry", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "geometry", ".", "getNumGeometries", "(", ")", ";", "i", "++", ...
Filter polygon from a geometry @param polygones @param geometry
[ "Filter", "polygon", "from", "a", "geometry" ]
9cd70b447e6469cecbc2fc64b16774b59491df3b
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/edit/ST_CollectionExtract.java#L140-L150
train
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/spatial/convert/ST_AsGML.java
ST_AsGML.toGML
public static String toGML(Geometry geom) { if (geom == null) { return null; } int srid = geom.getSRID(); GMLWriter gmlw = new GMLWriter(); if (srid != -1 || srid != 0) { gmlw.setSrsName("EPSG:" + geom.getSRID()); } return gmlw.write(geom); }
java
public static String toGML(Geometry geom) { if (geom == null) { return null; } int srid = geom.getSRID(); GMLWriter gmlw = new GMLWriter(); if (srid != -1 || srid != 0) { gmlw.setSrsName("EPSG:" + geom.getSRID()); } return gmlw.write(geom); }
[ "public", "static", "String", "toGML", "(", "Geometry", "geom", ")", "{", "if", "(", "geom", "==", "null", ")", "{", "return", "null", ";", "}", "int", "srid", "=", "geom", ".", "getSRID", "(", ")", ";", "GMLWriter", "gmlw", "=", "new", "GMLWriter", ...
Write the GML @param geom @return
[ "Write", "the", "GML" ]
9cd70b447e6469cecbc2fc64b16774b59491df3b
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/convert/ST_AsGML.java#L48-L58
train
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/spatial/distance/ST_ProjectPoint.java
ST_ProjectPoint.projectPoint
public static Point projectPoint(Geometry point, Geometry geometry) { if (point == null || geometry==null) { return null; } if (point.getDimension()==0 && geometry.getDimension() == 1) { LengthIndexedLine ll = new LengthIndexedLine(geometry); double index = ll.project(point.getCoordinate()); return geometry.getFactory().createPoint(ll.extractPoint(index)); } else { return null; } }
java
public static Point projectPoint(Geometry point, Geometry geometry) { if (point == null || geometry==null) { return null; } if (point.getDimension()==0 && geometry.getDimension() == 1) { LengthIndexedLine ll = new LengthIndexedLine(geometry); double index = ll.project(point.getCoordinate()); return geometry.getFactory().createPoint(ll.extractPoint(index)); } else { return null; } }
[ "public", "static", "Point", "projectPoint", "(", "Geometry", "point", ",", "Geometry", "geometry", ")", "{", "if", "(", "point", "==", "null", "||", "geometry", "==", "null", ")", "{", "return", "null", ";", "}", "if", "(", "point", ".", "getDimension",...
Project a point on a linestring or multilinestring @param point @param geometry @return
[ "Project", "a", "point", "on", "a", "linestring", "or", "multilinestring" ]
9cd70b447e6469cecbc2fc64b16774b59491df3b
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/distance/ST_ProjectPoint.java#L52-L63
train
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/spatial/topography/ST_TriangleContouring.java
ST_TriangleContouring.triangleContouring
public static ResultSet triangleContouring(Connection connection, String tableName, Value... varArgs) throws SQLException { if (connection.getMetaData().getURL().equals(HACK_URL)) { return new ExplodeResultSet(connection,tableName, Collections.singletonList(0.0)).getResultSet(); } ExplodeResultSet rowSource = null; if(varArgs.length > 3) { // First ones may be column names if(varArgs[0] instanceof ValueString && varArgs[1] instanceof ValueString && varArgs[2] instanceof ValueString) { // Use table columns for iso levels List<Double> isoLvls = new ArrayList<Double>(varArgs.length - 3); for(int idArg = 3; idArg < varArgs.length; idArg++) { isoLvls.add(varArgs[idArg].getDouble()); } rowSource = new ExplodeResultSet(connection,tableName,varArgs[0].getString(), varArgs[1].getString(), varArgs[2].getString(), isoLvls); } } if(rowSource == null) { // Use Z List<Double> isoLvls = new ArrayList<Double>(varArgs.length); for (Value value : varArgs) { if (value instanceof ValueArray) { for (Value arrVal : ((ValueArray) value).getList()) { isoLvls.add(arrVal.getDouble()); } } else { isoLvls.add(value.getDouble()); } } rowSource = new ExplodeResultSet(connection,tableName, isoLvls); } return rowSource.getResultSet(); }
java
public static ResultSet triangleContouring(Connection connection, String tableName, Value... varArgs) throws SQLException { if (connection.getMetaData().getURL().equals(HACK_URL)) { return new ExplodeResultSet(connection,tableName, Collections.singletonList(0.0)).getResultSet(); } ExplodeResultSet rowSource = null; if(varArgs.length > 3) { // First ones may be column names if(varArgs[0] instanceof ValueString && varArgs[1] instanceof ValueString && varArgs[2] instanceof ValueString) { // Use table columns for iso levels List<Double> isoLvls = new ArrayList<Double>(varArgs.length - 3); for(int idArg = 3; idArg < varArgs.length; idArg++) { isoLvls.add(varArgs[idArg].getDouble()); } rowSource = new ExplodeResultSet(connection,tableName,varArgs[0].getString(), varArgs[1].getString(), varArgs[2].getString(), isoLvls); } } if(rowSource == null) { // Use Z List<Double> isoLvls = new ArrayList<Double>(varArgs.length); for (Value value : varArgs) { if (value instanceof ValueArray) { for (Value arrVal : ((ValueArray) value).getList()) { isoLvls.add(arrVal.getDouble()); } } else { isoLvls.add(value.getDouble()); } } rowSource = new ExplodeResultSet(connection,tableName, isoLvls); } return rowSource.getResultSet(); }
[ "public", "static", "ResultSet", "triangleContouring", "(", "Connection", "connection", ",", "String", "tableName", ",", "Value", "...", "varArgs", ")", "throws", "SQLException", "{", "if", "(", "connection", ".", "getMetaData", "(", ")", ".", "getURL", "(", "...
Iso contouring using Z,M attributes of geometries @param connection Active connection @param tableName Table name @param varArgs Iso levels @return Result Set @throws SQLException
[ "Iso", "contouring", "using", "Z", "M", "attributes", "of", "geometries" ]
9cd70b447e6469cecbc2fc64b16774b59491df3b
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/topography/ST_TriangleContouring.java#L83-L117
train
orbisgis/h2gis
h2gis-network/src/main/java/org/h2gis/network/functions/ST_ConnectedComponents.java
ST_ConnectedComponents.getConnectedComponents
public static boolean getConnectedComponents(Connection connection, String inputTable, String orientation) throws SQLException { KeyedGraph graph = prepareGraph(connection, inputTable, orientation, null, VUCent.class, Edge.class); if (graph == null) { return false; } final List<Set<VUCent>> componentsList = getConnectedComponents(graph, orientation); final TableLocation tableName = TableUtilities.parseInputTable(connection, inputTable); final TableLocation nodesName = TableUtilities.suffixTableLocation(tableName, NODE_COMP_SUFFIX); final TableLocation edgesName = TableUtilities.suffixTableLocation(tableName, EDGE_COMP_SUFFIX); if (storeNodeConnectedComponents(connection, nodesName, edgesName, componentsList)) { if (storeEdgeConnectedComponents(connection, tableName, nodesName, edgesName)) { return true; } } return false; }
java
public static boolean getConnectedComponents(Connection connection, String inputTable, String orientation) throws SQLException { KeyedGraph graph = prepareGraph(connection, inputTable, orientation, null, VUCent.class, Edge.class); if (graph == null) { return false; } final List<Set<VUCent>> componentsList = getConnectedComponents(graph, orientation); final TableLocation tableName = TableUtilities.parseInputTable(connection, inputTable); final TableLocation nodesName = TableUtilities.suffixTableLocation(tableName, NODE_COMP_SUFFIX); final TableLocation edgesName = TableUtilities.suffixTableLocation(tableName, EDGE_COMP_SUFFIX); if (storeNodeConnectedComponents(connection, nodesName, edgesName, componentsList)) { if (storeEdgeConnectedComponents(connection, tableName, nodesName, edgesName)) { return true; } } return false; }
[ "public", "static", "boolean", "getConnectedComponents", "(", "Connection", "connection", ",", "String", "inputTable", ",", "String", "orientation", ")", "throws", "SQLException", "{", "KeyedGraph", "graph", "=", "prepareGraph", "(", "connection", ",", "inputTable", ...
Calculate the node and edge connected component tables. @param connection Connection @param inputTable Edges table produced by ST_Graph @param orientation Orientation string @return True if the calculation was successful @throws SQLException
[ "Calculate", "the", "node", "and", "edge", "connected", "component", "tables", "." ]
9cd70b447e6469cecbc2fc64b16774b59491df3b
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-network/src/main/java/org/h2gis/network/functions/ST_ConnectedComponents.java#L91-L111
train
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/spatial/create/ST_MakeLine.java
ST_MakeLine.createLine
public static LineString createLine(Geometry pointA, Geometry... optionalPoints) throws SQLException { if( pointA == null || optionalPoints.length > 0 && optionalPoints[0] == null) { return null; } if (pointA.getNumGeometries() == 1 && !atLeastTwoPoints(optionalPoints, countPoints(pointA))) { throw new SQLException("At least two points are required to make a line."); } List<Coordinate> coordinateList = new LinkedList<Coordinate>(); addCoordinatesToList(pointA, coordinateList); for (Geometry optionalPoint : optionalPoints) { addCoordinatesToList(optionalPoint, coordinateList); } return ((Geometry) pointA).getFactory().createLineString( coordinateList.toArray(new Coordinate[optionalPoints.length])); }
java
public static LineString createLine(Geometry pointA, Geometry... optionalPoints) throws SQLException { if( pointA == null || optionalPoints.length > 0 && optionalPoints[0] == null) { return null; } if (pointA.getNumGeometries() == 1 && !atLeastTwoPoints(optionalPoints, countPoints(pointA))) { throw new SQLException("At least two points are required to make a line."); } List<Coordinate> coordinateList = new LinkedList<Coordinate>(); addCoordinatesToList(pointA, coordinateList); for (Geometry optionalPoint : optionalPoints) { addCoordinatesToList(optionalPoint, coordinateList); } return ((Geometry) pointA).getFactory().createLineString( coordinateList.toArray(new Coordinate[optionalPoints.length])); }
[ "public", "static", "LineString", "createLine", "(", "Geometry", "pointA", ",", "Geometry", "...", "optionalPoints", ")", "throws", "SQLException", "{", "if", "(", "pointA", "==", "null", "||", "optionalPoints", ".", "length", ">", "0", "&&", "optionalPoints", ...
Constructs a LINESTRING from the given POINTs or MULTIPOINTs @param pointA The first POINT or MULTIPOINT @param optionalPoints Optional POINTs or MULTIPOINTs @return The LINESTRING constructed from the given POINTs or MULTIPOINTs @throws SQLException
[ "Constructs", "a", "LINESTRING", "from", "the", "given", "POINTs", "or", "MULTIPOINTs" ]
9cd70b447e6469cecbc2fc64b16774b59491df3b
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/create/ST_MakeLine.java#L57-L71
train
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/io/gpx/model/AbstractGpxParserRte.java
AbstractGpxParserRte.initialise
public void initialise(XMLReader reader, AbstractGpxParserDefault parent) { setReader(reader); setParent(parent); setContentBuffer(parent.getContentBuffer()); setRtePreparedStmt(parent.getRtePreparedStmt()); setRteptPreparedStmt(parent.getRteptPreparedStmt()); setElementNames(parent.getElementNames()); setCurrentLine(parent.getCurrentLine()); setRteList(new ArrayList<Coordinate>()); }
java
public void initialise(XMLReader reader, AbstractGpxParserDefault parent) { setReader(reader); setParent(parent); setContentBuffer(parent.getContentBuffer()); setRtePreparedStmt(parent.getRtePreparedStmt()); setRteptPreparedStmt(parent.getRteptPreparedStmt()); setElementNames(parent.getElementNames()); setCurrentLine(parent.getCurrentLine()); setRteList(new ArrayList<Coordinate>()); }
[ "public", "void", "initialise", "(", "XMLReader", "reader", ",", "AbstractGpxParserDefault", "parent", ")", "{", "setReader", "(", "reader", ")", ";", "setParent", "(", "parent", ")", ";", "setContentBuffer", "(", "parent", ".", "getContentBuffer", "(", ")", "...
Create a new specific parser. It has in memory the default parser, the contentBuffer, the elementNames, the currentLine and the rteID. @param reader The XMLReader used in the default class @param parent The parser used in the default class
[ "Create", "a", "new", "specific", "parser", ".", "It", "has", "in", "memory", "the", "default", "parser", "the", "contentBuffer", "the", "elementNames", "the", "currentLine", "and", "the", "rteID", "." ]
9cd70b447e6469cecbc2fc64b16774b59491df3b
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/gpx/model/AbstractGpxParserRte.java#L58-L67
train
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/io/gpx/model/GPXCoordinate.java
GPXCoordinate.createCoordinate
public static Coordinate createCoordinate(Attributes attributes) throws NumberFormatException { // Associate a latitude and a longitude to the point double lat; double lon; try { lat = Double.parseDouble(attributes.getValue(GPXTags.LAT)); } catch (NumberFormatException e) { throw new NumberFormatException("Cannot parse the latitude value"); } try { lon = Double.parseDouble(attributes.getValue(GPXTags.LON)); } catch (NumberFormatException e) { throw new NumberFormatException("Cannot parse the longitude value"); } String eleValue = attributes.getValue(GPXTags.ELE); double ele = Double.NaN; if (eleValue != null) { try { ele = Double.parseDouble(eleValue); } catch (NumberFormatException e) { throw new NumberFormatException("Cannot parse the elevation value"); } } return new Coordinate(lon, lat, ele); }
java
public static Coordinate createCoordinate(Attributes attributes) throws NumberFormatException { // Associate a latitude and a longitude to the point double lat; double lon; try { lat = Double.parseDouble(attributes.getValue(GPXTags.LAT)); } catch (NumberFormatException e) { throw new NumberFormatException("Cannot parse the latitude value"); } try { lon = Double.parseDouble(attributes.getValue(GPXTags.LON)); } catch (NumberFormatException e) { throw new NumberFormatException("Cannot parse the longitude value"); } String eleValue = attributes.getValue(GPXTags.ELE); double ele = Double.NaN; if (eleValue != null) { try { ele = Double.parseDouble(eleValue); } catch (NumberFormatException e) { throw new NumberFormatException("Cannot parse the elevation value"); } } return new Coordinate(lon, lat, ele); }
[ "public", "static", "Coordinate", "createCoordinate", "(", "Attributes", "attributes", ")", "throws", "NumberFormatException", "{", "// Associate a latitude and a longitude to the point", "double", "lat", ";", "double", "lon", ";", "try", "{", "lat", "=", "Double", ".",...
General method to create a coordinate from a gpx point. @param attributes Attributes of the point. Here it is latitude and longitude @throws NumberFormatException @return a coordinate
[ "General", "method", "to", "create", "a", "coordinate", "from", "a", "gpx", "point", "." ]
9cd70b447e6469cecbc2fc64b16774b59491df3b
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/gpx/model/GPXCoordinate.java#L40-L65
train
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/spatial/properties/ST_XMin.java
ST_XMin.getMinX
public static Double getMinX(Geometry geom) { if (geom != null) { return geom.getEnvelopeInternal().getMinX(); } else { return null; } }
java
public static Double getMinX(Geometry geom) { if (geom != null) { return geom.getEnvelopeInternal().getMinX(); } else { return null; } }
[ "public", "static", "Double", "getMinX", "(", "Geometry", "geom", ")", "{", "if", "(", "geom", "!=", "null", ")", "{", "return", "geom", ".", "getEnvelopeInternal", "(", ")", ".", "getMinX", "(", ")", ";", "}", "else", "{", "return", "null", ";", "}"...
Returns the minimal x-value of the given geometry. @param geom Geometry @return The minimal x-value of the given geometry, or null if the geometry is null.
[ "Returns", "the", "minimal", "x", "-", "value", "of", "the", "given", "geometry", "." ]
9cd70b447e6469cecbc2fc64b16774b59491df3b
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/properties/ST_XMin.java#L48-L54
train
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/spatial/create/ST_MakePoint.java
ST_MakePoint.createPoint
public static Point createPoint(double x, double y) throws SQLException { return createPoint(x, y, Coordinate.NULL_ORDINATE); }
java
public static Point createPoint(double x, double y) throws SQLException { return createPoint(x, y, Coordinate.NULL_ORDINATE); }
[ "public", "static", "Point", "createPoint", "(", "double", "x", ",", "double", "y", ")", "throws", "SQLException", "{", "return", "createPoint", "(", "x", ",", "y", ",", "Coordinate", ".", "NULL_ORDINATE", ")", ";", "}" ]
Constructs POINT from two doubles. @param x X-coordinate @param y Y-coordinate @return The POINT constructed from the given coordinatesk @throws java.sql.SQLException
[ "Constructs", "POINT", "from", "two", "doubles", "." ]
9cd70b447e6469cecbc2fc64b16774b59491df3b
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/create/ST_MakePoint.java#L56-L58
train
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/spatial/create/ST_MakePoint.java
ST_MakePoint.createPoint
public static Point createPoint(double x, double y, double z) throws SQLException { return GF.createPoint(new Coordinate(x, y, z)); }
java
public static Point createPoint(double x, double y, double z) throws SQLException { return GF.createPoint(new Coordinate(x, y, z)); }
[ "public", "static", "Point", "createPoint", "(", "double", "x", ",", "double", "y", ",", "double", "z", ")", "throws", "SQLException", "{", "return", "GF", ".", "createPoint", "(", "new", "Coordinate", "(", "x", ",", "y", ",", "z", ")", ")", ";", "}"...
Constructs POINT from three doubles. @param x X-coordinate @param y Y-coordinate @param z Z-coordinate @return The POINT constructed from the given coordinates @throws SQLException
[ "Constructs", "POINT", "from", "three", "doubles", "." ]
9cd70b447e6469cecbc2fc64b16774b59491df3b
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/create/ST_MakePoint.java#L69-L71
train
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/io/gpx/model/GPXPoint.java
GPXPoint.setAttribute
public final void setAttribute(String currentElement, StringBuilder contentBuffer) { if (currentElement.equalsIgnoreCase(GPXTags.TIME)) { setTime(contentBuffer); } else if (currentElement.equalsIgnoreCase(GPXTags.MAGVAR)) { setMagvar(contentBuffer); } else if (currentElement.equalsIgnoreCase(GPXTags.GEOIDHEIGHT)) { setGeoidheight(contentBuffer); } else if (currentElement.equalsIgnoreCase(GPXTags.NAME)) { setName(contentBuffer); } else if (currentElement.equalsIgnoreCase(GPXTags.CMT)) { setCmt(contentBuffer); } else if (currentElement.equalsIgnoreCase(GPXTags.DESC)) { setDesc(contentBuffer); } else if (currentElement.equalsIgnoreCase(GPXTags.SRC)) { setSrc(contentBuffer); } else if (currentElement.equalsIgnoreCase(GPXTags.SYM)) { setSym(contentBuffer); } else if (currentElement.equalsIgnoreCase(GPXTags.TYPE)) { setType(contentBuffer); } else if (currentElement.equalsIgnoreCase(GPXTags.FIX)) { setFix(contentBuffer); } else if (currentElement.equalsIgnoreCase(GPXTags.SAT)) { setSat(contentBuffer); } else if (currentElement.equalsIgnoreCase(GPXTags.HDOP)) { setHdop(contentBuffer); } else if (currentElement.equalsIgnoreCase(GPXTags.VDOP)) { setVdop(contentBuffer); } else if (currentElement.equalsIgnoreCase(GPXTags.PDOP)) { setPdop(contentBuffer); } else if (currentElement.equalsIgnoreCase(GPXTags.AGEOFDGPSDATA)) { setAgeofdgpsdata(contentBuffer); } else if (currentElement.equalsIgnoreCase(GPXTags.DGPSID)) { setDgpsid(contentBuffer); } else if (currentElement.equalsIgnoreCase(GPXTags.EXTENSIONS)) { setExtensions(); } }
java
public final void setAttribute(String currentElement, StringBuilder contentBuffer) { if (currentElement.equalsIgnoreCase(GPXTags.TIME)) { setTime(contentBuffer); } else if (currentElement.equalsIgnoreCase(GPXTags.MAGVAR)) { setMagvar(contentBuffer); } else if (currentElement.equalsIgnoreCase(GPXTags.GEOIDHEIGHT)) { setGeoidheight(contentBuffer); } else if (currentElement.equalsIgnoreCase(GPXTags.NAME)) { setName(contentBuffer); } else if (currentElement.equalsIgnoreCase(GPXTags.CMT)) { setCmt(contentBuffer); } else if (currentElement.equalsIgnoreCase(GPXTags.DESC)) { setDesc(contentBuffer); } else if (currentElement.equalsIgnoreCase(GPXTags.SRC)) { setSrc(contentBuffer); } else if (currentElement.equalsIgnoreCase(GPXTags.SYM)) { setSym(contentBuffer); } else if (currentElement.equalsIgnoreCase(GPXTags.TYPE)) { setType(contentBuffer); } else if (currentElement.equalsIgnoreCase(GPXTags.FIX)) { setFix(contentBuffer); } else if (currentElement.equalsIgnoreCase(GPXTags.SAT)) { setSat(contentBuffer); } else if (currentElement.equalsIgnoreCase(GPXTags.HDOP)) { setHdop(contentBuffer); } else if (currentElement.equalsIgnoreCase(GPXTags.VDOP)) { setVdop(contentBuffer); } else if (currentElement.equalsIgnoreCase(GPXTags.PDOP)) { setPdop(contentBuffer); } else if (currentElement.equalsIgnoreCase(GPXTags.AGEOFDGPSDATA)) { setAgeofdgpsdata(contentBuffer); } else if (currentElement.equalsIgnoreCase(GPXTags.DGPSID)) { setDgpsid(contentBuffer); } else if (currentElement.equalsIgnoreCase(GPXTags.EXTENSIONS)) { setExtensions(); } }
[ "public", "final", "void", "setAttribute", "(", "String", "currentElement", ",", "StringBuilder", "contentBuffer", ")", "{", "if", "(", "currentElement", ".", "equalsIgnoreCase", "(", "GPXTags", ".", "TIME", ")", ")", "{", "setTime", "(", "contentBuffer", ")", ...
Set an attribute for a point. The String currentElement gives the information of which attribute have to be setted. The attribute to set is given by the StringBuilder contentBuffer. @param currentElement a string presenting the text of the current markup. @param contentBuffer it contains all informations about the current element.
[ "Set", "an", "attribute", "for", "a", "point", ".", "The", "String", "currentElement", "gives", "the", "information", "of", "which", "attribute", "have", "to", "be", "setted", ".", "The", "attribute", "to", "set", "is", "given", "by", "the", "StringBuilder",...
9cd70b447e6469cecbc2fc64b16774b59491df3b
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/gpx/model/GPXPoint.java#L61-L97
train
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/io/gpx/model/GPXPoint.java
GPXPoint.setLink
public final void setLink(Attributes attributes) { ptValues[GpxMetadata.PTLINK] = attributes.getValue(GPXTags.HREF); }
java
public final void setLink(Attributes attributes) { ptValues[GpxMetadata.PTLINK] = attributes.getValue(GPXTags.HREF); }
[ "public", "final", "void", "setLink", "(", "Attributes", "attributes", ")", "{", "ptValues", "[", "GpxMetadata", ".", "PTLINK", "]", "=", "attributes", ".", "getValue", "(", "GPXTags", ".", "HREF", ")", ";", "}" ]
Set a link to additional information about the point. @param attributes The current attributes being parsed
[ "Set", "a", "link", "to", "additional", "information", "about", "the", "point", "." ]
9cd70b447e6469cecbc2fc64b16774b59491df3b
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/gpx/model/GPXPoint.java#L180-L182
train
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/io/gpx/model/GPXPoint.java
GPXPoint.setSat
public final void setSat(StringBuilder contentBuffer) { ptValues[GpxMetadata.PTSAT] = Integer.parseInt(contentBuffer.toString()); }
java
public final void setSat(StringBuilder contentBuffer) { ptValues[GpxMetadata.PTSAT] = Integer.parseInt(contentBuffer.toString()); }
[ "public", "final", "void", "setSat", "(", "StringBuilder", "contentBuffer", ")", "{", "ptValues", "[", "GpxMetadata", ".", "PTSAT", "]", "=", "Integer", ".", "parseInt", "(", "contentBuffer", ".", "toString", "(", ")", ")", ";", "}" ]
Set the number of satellites used to calculate the GPX fix for a point. @param contentBuffer Contains the information to put in the table
[ "Set", "the", "number", "of", "satellites", "used", "to", "calculate", "the", "GPX", "fix", "for", "a", "point", "." ]
9cd70b447e6469cecbc2fc64b16774b59491df3b
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/gpx/model/GPXPoint.java#L234-L236
train
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/io/gpx/model/GPXPoint.java
GPXPoint.setHdop
public final void setHdop(StringBuilder contentBuffer) { ptValues[GpxMetadata.PTHDOP] = Double.parseDouble(contentBuffer.toString()); }
java
public final void setHdop(StringBuilder contentBuffer) { ptValues[GpxMetadata.PTHDOP] = Double.parseDouble(contentBuffer.toString()); }
[ "public", "final", "void", "setHdop", "(", "StringBuilder", "contentBuffer", ")", "{", "ptValues", "[", "GpxMetadata", ".", "PTHDOP", "]", "=", "Double", ".", "parseDouble", "(", "contentBuffer", ".", "toString", "(", ")", ")", ";", "}" ]
Set the horizontal dilution of precision of a point. @param contentBuffer Contains the information to put in the table
[ "Set", "the", "horizontal", "dilution", "of", "precision", "of", "a", "point", "." ]
9cd70b447e6469cecbc2fc64b16774b59491df3b
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/gpx/model/GPXPoint.java#L243-L245
train
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/io/gpx/model/GPXPoint.java
GPXPoint.setVdop
public final void setVdop(StringBuilder contentBuffer) { ptValues[GpxMetadata.PTVDOP] = Double.parseDouble(contentBuffer.toString()); }
java
public final void setVdop(StringBuilder contentBuffer) { ptValues[GpxMetadata.PTVDOP] = Double.parseDouble(contentBuffer.toString()); }
[ "public", "final", "void", "setVdop", "(", "StringBuilder", "contentBuffer", ")", "{", "ptValues", "[", "GpxMetadata", ".", "PTVDOP", "]", "=", "Double", ".", "parseDouble", "(", "contentBuffer", ".", "toString", "(", ")", ")", ";", "}" ]
Set the vertical dilution of precision of a point. @param contentBuffer Contains the information to put in the table
[ "Set", "the", "vertical", "dilution", "of", "precision", "of", "a", "point", "." ]
9cd70b447e6469cecbc2fc64b16774b59491df3b
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/gpx/model/GPXPoint.java#L252-L254
train
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/io/gpx/model/GPXPoint.java
GPXPoint.setPdop
public final void setPdop(StringBuilder contentBuffer) { ptValues[GpxMetadata.PTPDOP] = Double.parseDouble(contentBuffer.toString()); }
java
public final void setPdop(StringBuilder contentBuffer) { ptValues[GpxMetadata.PTPDOP] = Double.parseDouble(contentBuffer.toString()); }
[ "public", "final", "void", "setPdop", "(", "StringBuilder", "contentBuffer", ")", "{", "ptValues", "[", "GpxMetadata", ".", "PTPDOP", "]", "=", "Double", ".", "parseDouble", "(", "contentBuffer", ".", "toString", "(", ")", ")", ";", "}" ]
Set the position dilution of precision of a point. @param contentBuffer Contains the information to put in the table
[ "Set", "the", "position", "dilution", "of", "precision", "of", "a", "point", "." ]
9cd70b447e6469cecbc2fc64b16774b59491df3b
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/gpx/model/GPXPoint.java#L261-L263
train
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/io/gpx/model/GPXPoint.java
GPXPoint.setAgeofdgpsdata
public final void setAgeofdgpsdata(StringBuilder contentBuffer) { ptValues[GpxMetadata.PTAGEOFDGPSDATA] = Double.parseDouble(contentBuffer.toString()); }
java
public final void setAgeofdgpsdata(StringBuilder contentBuffer) { ptValues[GpxMetadata.PTAGEOFDGPSDATA] = Double.parseDouble(contentBuffer.toString()); }
[ "public", "final", "void", "setAgeofdgpsdata", "(", "StringBuilder", "contentBuffer", ")", "{", "ptValues", "[", "GpxMetadata", ".", "PTAGEOFDGPSDATA", "]", "=", "Double", ".", "parseDouble", "(", "contentBuffer", ".", "toString", "(", ")", ")", ";", "}" ]
Set number of seconds since last DGPS update for a point. @param contentBuffer Contains the information to put in the table
[ "Set", "number", "of", "seconds", "since", "last", "DGPS", "update", "for", "a", "point", "." ]
9cd70b447e6469cecbc2fc64b16774b59491df3b
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/gpx/model/GPXPoint.java#L270-L272
train
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/io/gpx/model/GPXPoint.java
GPXPoint.setDgpsid
public final void setDgpsid(StringBuilder contentBuffer) { ptValues[GpxMetadata.PTDGPSID] = Integer.parseInt(contentBuffer.toString()); }
java
public final void setDgpsid(StringBuilder contentBuffer) { ptValues[GpxMetadata.PTDGPSID] = Integer.parseInt(contentBuffer.toString()); }
[ "public", "final", "void", "setDgpsid", "(", "StringBuilder", "contentBuffer", ")", "{", "ptValues", "[", "GpxMetadata", ".", "PTDGPSID", "]", "=", "Integer", ".", "parseInt", "(", "contentBuffer", ".", "toString", "(", ")", ")", ";", "}" ]
Set ID of DGPS station used in differential correction for a point. @param contentBuffer Contains the information to put in the table
[ "Set", "ID", "of", "DGPS", "station", "used", "in", "differential", "correction", "for", "a", "point", "." ]
9cd70b447e6469cecbc2fc64b16774b59491df3b
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/gpx/model/GPXPoint.java#L279-L281
train
orbisgis/h2gis
h2gis-network/src/main/java/org/h2gis/network/functions/GraphFunctionParser.java
GraphFunctionParser.parseGlobalOrientation
protected static Orientation parseGlobalOrientation(String v) { if (v == null) { return null; } if (isDirectedString(v)) { return Orientation.DIRECTED; } else if (isReversedString(v)) { return Orientation.REVERSED; } else if (isUndirectedString(v)) { return Orientation.UNDIRECTED; } else { throw new IllegalArgumentException(ORIENTATION_ERROR); } }
java
protected static Orientation parseGlobalOrientation(String v) { if (v == null) { return null; } if (isDirectedString(v)) { return Orientation.DIRECTED; } else if (isReversedString(v)) { return Orientation.REVERSED; } else if (isUndirectedString(v)) { return Orientation.UNDIRECTED; } else { throw new IllegalArgumentException(ORIENTATION_ERROR); } }
[ "protected", "static", "Orientation", "parseGlobalOrientation", "(", "String", "v", ")", "{", "if", "(", "v", "==", "null", ")", "{", "return", "null", ";", "}", "if", "(", "isDirectedString", "(", "v", ")", ")", "{", "return", "Orientation", ".", "DIREC...
Recovers the global orientation from a string. @param v String @return The global orientation
[ "Recovers", "the", "global", "orientation", "from", "a", "string", "." ]
9cd70b447e6469cecbc2fc64b16774b59491df3b
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-network/src/main/java/org/h2gis/network/functions/GraphFunctionParser.java#L71-L84
train