id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
160,600
GwtMaterialDesign/gwt-material
gwt-material/src/main/java/gwt/material/design/client/ui/MaterialCollapsibleItem.java
MaterialCollapsibleItem.setActive
@Override public void setActive(boolean active) { this.active = active; if (parent != null) { fireCollapsibleHandler(); removeStyleName(CssName.ACTIVE); if (header != null) { header.removeStyleName(CssName.ACTIVE); } if (active) { if (parent != null && parent.isAccordion()) { parent.clearActive(); } addStyleName(CssName.ACTIVE); if (header != null) { header.addStyleName(CssName.ACTIVE); } } if (body != null) { body.setDisplay(active ? Display.BLOCK : Display.NONE); } } else { GWT.log("Please make sure that the Collapsible parent is attached or existed.", new IllegalStateException()); } }
java
@Override public void setActive(boolean active) { this.active = active; if (parent != null) { fireCollapsibleHandler(); removeStyleName(CssName.ACTIVE); if (header != null) { header.removeStyleName(CssName.ACTIVE); } if (active) { if (parent != null && parent.isAccordion()) { parent.clearActive(); } addStyleName(CssName.ACTIVE); if (header != null) { header.addStyleName(CssName.ACTIVE); } } if (body != null) { body.setDisplay(active ? Display.BLOCK : Display.NONE); } } else { GWT.log("Please make sure that the Collapsible parent is attached or existed.", new IllegalStateException()); } }
[ "@", "Override", "public", "void", "setActive", "(", "boolean", "active", ")", "{", "this", ".", "active", "=", "active", ";", "if", "(", "parent", "!=", "null", ")", "{", "fireCollapsibleHandler", "(", ")", ";", "removeStyleName", "(", "CssName", ".", "ACTIVE", ")", ";", "if", "(", "header", "!=", "null", ")", "{", "header", ".", "removeStyleName", "(", "CssName", ".", "ACTIVE", ")", ";", "}", "if", "(", "active", ")", "{", "if", "(", "parent", "!=", "null", "&&", "parent", ".", "isAccordion", "(", ")", ")", "{", "parent", ".", "clearActive", "(", ")", ";", "}", "addStyleName", "(", "CssName", ".", "ACTIVE", ")", ";", "if", "(", "header", "!=", "null", ")", "{", "header", ".", "addStyleName", "(", "CssName", ".", "ACTIVE", ")", ";", "}", "}", "if", "(", "body", "!=", "null", ")", "{", "body", ".", "setDisplay", "(", "active", "?", "Display", ".", "BLOCK", ":", "Display", ".", "NONE", ")", ";", "}", "}", "else", "{", "GWT", ".", "log", "(", "\"Please make sure that the Collapsible parent is attached or existed.\"", ",", "new", "IllegalStateException", "(", ")", ")", ";", "}", "}" ]
Make this item active.
[ "Make", "this", "item", "active", "." ]
86feefb282b007c0a44784c09e651a50f257138e
https://github.com/GwtMaterialDesign/gwt-material/blob/86feefb282b007c0a44784c09e651a50f257138e/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialCollapsibleItem.java#L148-L175
160,601
GwtMaterialDesign/gwt-material
gwt-material/src/main/java/gwt/material/design/client/ui/MaterialDatePicker.java
MaterialDatePicker.setDateMin
public void setDateMin(Date dateMin) { this.dateMin = dateMin; if (isAttached() && dateMin != null) { getPicker().set("min", JsDate.create((double) dateMin.getTime())); } }
java
public void setDateMin(Date dateMin) { this.dateMin = dateMin; if (isAttached() && dateMin != null) { getPicker().set("min", JsDate.create((double) dateMin.getTime())); } }
[ "public", "void", "setDateMin", "(", "Date", "dateMin", ")", "{", "this", ".", "dateMin", "=", "dateMin", ";", "if", "(", "isAttached", "(", ")", "&&", "dateMin", "!=", "null", ")", "{", "getPicker", "(", ")", ".", "set", "(", "\"min\"", ",", "JsDate", ".", "create", "(", "(", "double", ")", "dateMin", ".", "getTime", "(", ")", ")", ")", ";", "}", "}" ]
Set the minimum date limit.
[ "Set", "the", "minimum", "date", "limit", "." ]
86feefb282b007c0a44784c09e651a50f257138e
https://github.com/GwtMaterialDesign/gwt-material/blob/86feefb282b007c0a44784c09e651a50f257138e/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialDatePicker.java#L228-L234
160,602
GwtMaterialDesign/gwt-material
gwt-material/src/main/java/gwt/material/design/client/ui/MaterialDatePicker.java
MaterialDatePicker.setDateMax
public void setDateMax(Date dateMax) { this.dateMax = dateMax; if (isAttached() && dateMax != null) { getPicker().set("max", JsDate.create((double) dateMax.getTime())); } }
java
public void setDateMax(Date dateMax) { this.dateMax = dateMax; if (isAttached() && dateMax != null) { getPicker().set("max", JsDate.create((double) dateMax.getTime())); } }
[ "public", "void", "setDateMax", "(", "Date", "dateMax", ")", "{", "this", ".", "dateMax", "=", "dateMax", ";", "if", "(", "isAttached", "(", ")", "&&", "dateMax", "!=", "null", ")", "{", "getPicker", "(", ")", ".", "set", "(", "\"max\"", ",", "JsDate", ".", "create", "(", "(", "double", ")", "dateMax", ".", "getTime", "(", ")", ")", ")", ";", "}", "}" ]
Set the maximum date limit.
[ "Set", "the", "maximum", "date", "limit", "." ]
86feefb282b007c0a44784c09e651a50f257138e
https://github.com/GwtMaterialDesign/gwt-material/blob/86feefb282b007c0a44784c09e651a50f257138e/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialDatePicker.java#L246-L252
160,603
GwtMaterialDesign/gwt-material
gwt-material/src/main/java/gwt/material/design/client/ui/MaterialDatePicker.java
MaterialDatePicker.getPickerDate
protected Date getPickerDate() { try { JsDate pickerDate = getPicker().get("select").obj; return new Date((long) pickerDate.getTime()); } catch (Exception e) { e.printStackTrace(); return null; } }
java
protected Date getPickerDate() { try { JsDate pickerDate = getPicker().get("select").obj; return new Date((long) pickerDate.getTime()); } catch (Exception e) { e.printStackTrace(); return null; } }
[ "protected", "Date", "getPickerDate", "(", ")", "{", "try", "{", "JsDate", "pickerDate", "=", "getPicker", "(", ")", ".", "get", "(", "\"select\"", ")", ".", "obj", ";", "return", "new", "Date", "(", "(", "long", ")", "pickerDate", ".", "getTime", "(", ")", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "return", "null", ";", "}", "}" ]
Get the pickers date.
[ "Get", "the", "pickers", "date", "." ]
86feefb282b007c0a44784c09e651a50f257138e
https://github.com/GwtMaterialDesign/gwt-material/blob/86feefb282b007c0a44784c09e651a50f257138e/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialDatePicker.java#L270-L278
160,604
GwtMaterialDesign/gwt-material
gwt-material/src/main/java/gwt/material/design/client/ui/MaterialDatePicker.java
MaterialDatePicker.setSelectionType
public void setSelectionType(MaterialDatePickerType selectionType) { this.selectionType = selectionType; switch (selectionType) { case MONTH_DAY: options.selectMonths = true; break; case YEAR_MONTH_DAY: options.selectYears = yearsToDisplay; options.selectMonths = true; break; case YEAR: options.selectYears = yearsToDisplay; options.selectMonths = false; break; } }
java
public void setSelectionType(MaterialDatePickerType selectionType) { this.selectionType = selectionType; switch (selectionType) { case MONTH_DAY: options.selectMonths = true; break; case YEAR_MONTH_DAY: options.selectYears = yearsToDisplay; options.selectMonths = true; break; case YEAR: options.selectYears = yearsToDisplay; options.selectMonths = false; break; } }
[ "public", "void", "setSelectionType", "(", "MaterialDatePickerType", "selectionType", ")", "{", "this", ".", "selectionType", "=", "selectionType", ";", "switch", "(", "selectionType", ")", "{", "case", "MONTH_DAY", ":", "options", ".", "selectMonths", "=", "true", ";", "break", ";", "case", "YEAR_MONTH_DAY", ":", "options", ".", "selectYears", "=", "yearsToDisplay", ";", "options", ".", "selectMonths", "=", "true", ";", "break", ";", "case", "YEAR", ":", "options", ".", "selectYears", "=", "yearsToDisplay", ";", "options", ".", "selectMonths", "=", "false", ";", "break", ";", "}", "}" ]
Set the pickers selection type.
[ "Set", "the", "pickers", "selection", "type", "." ]
86feefb282b007c0a44784c09e651a50f257138e
https://github.com/GwtMaterialDesign/gwt-material/blob/86feefb282b007c0a44784c09e651a50f257138e/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialDatePicker.java#L312-L327
160,605
GwtMaterialDesign/gwt-material
gwt-material/src/main/java/gwt/material/design/client/ui/MaterialDatePicker.java
MaterialDatePicker.setAutoClose
public void setAutoClose(boolean autoClose) { this.autoClose = autoClose; if (autoCloseHandlerRegistration != null) { autoCloseHandlerRegistration.removeHandler(); autoCloseHandlerRegistration = null; } if (autoClose) { autoCloseHandlerRegistration = registerHandler(addValueChangeHandler(event -> close())); } }
java
public void setAutoClose(boolean autoClose) { this.autoClose = autoClose; if (autoCloseHandlerRegistration != null) { autoCloseHandlerRegistration.removeHandler(); autoCloseHandlerRegistration = null; } if (autoClose) { autoCloseHandlerRegistration = registerHandler(addValueChangeHandler(event -> close())); } }
[ "public", "void", "setAutoClose", "(", "boolean", "autoClose", ")", "{", "this", ".", "autoClose", "=", "autoClose", ";", "if", "(", "autoCloseHandlerRegistration", "!=", "null", ")", "{", "autoCloseHandlerRegistration", ".", "removeHandler", "(", ")", ";", "autoCloseHandlerRegistration", "=", "null", ";", "}", "if", "(", "autoClose", ")", "{", "autoCloseHandlerRegistration", "=", "registerHandler", "(", "addValueChangeHandler", "(", "event", "->", "close", "(", ")", ")", ")", ";", "}", "}" ]
Enables or disables auto closing when selecting a date.
[ "Enables", "or", "disables", "auto", "closing", "when", "selecting", "a", "date", "." ]
86feefb282b007c0a44784c09e651a50f257138e
https://github.com/GwtMaterialDesign/gwt-material/blob/86feefb282b007c0a44784c09e651a50f257138e/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialDatePicker.java#L555-L566
160,606
GwtMaterialDesign/gwt-material
gwt-material/src/main/java/gwt/material/design/client/base/AbstractValueWidget.java
AbstractValueWidget.setAllowBlank
public void setAllowBlank(boolean allowBlank) { this.allowBlank = allowBlank; // Setup the allow blank validation if (!allowBlank) { if (blankValidator == null) { blankValidator = createBlankValidator(); } setupBlurValidation(); addValidator(blankValidator); } else { removeValidator(blankValidator); } }
java
public void setAllowBlank(boolean allowBlank) { this.allowBlank = allowBlank; // Setup the allow blank validation if (!allowBlank) { if (blankValidator == null) { blankValidator = createBlankValidator(); } setupBlurValidation(); addValidator(blankValidator); } else { removeValidator(blankValidator); } }
[ "public", "void", "setAllowBlank", "(", "boolean", "allowBlank", ")", "{", "this", ".", "allowBlank", "=", "allowBlank", ";", "// Setup the allow blank validation", "if", "(", "!", "allowBlank", ")", "{", "if", "(", "blankValidator", "==", "null", ")", "{", "blankValidator", "=", "createBlankValidator", "(", ")", ";", "}", "setupBlurValidation", "(", ")", ";", "addValidator", "(", "blankValidator", ")", ";", "}", "else", "{", "removeValidator", "(", "blankValidator", ")", ";", "}", "}" ]
Enable or disable the default blank validator.
[ "Enable", "or", "disable", "the", "default", "blank", "validator", "." ]
86feefb282b007c0a44784c09e651a50f257138e
https://github.com/GwtMaterialDesign/gwt-material/blob/86feefb282b007c0a44784c09e651a50f257138e/gwt-material/src/main/java/gwt/material/design/client/base/AbstractValueWidget.java#L206-L219
160,607
GwtMaterialDesign/gwt-material
gwt-material/src/main/java/gwt/material/design/client/base/mixin/ColorsMixin.java
ColorsMixin.ensureTextColorFormat
protected String ensureTextColorFormat(String textColor) { String formatted = ""; boolean mainColor = true; for (String style : textColor.split(" ")) { if (mainColor) { // the main color if (!style.endsWith("-text")) { style += "-text"; } mainColor = false; } else { // the shading type if (!style.startsWith("text-")) { style = " text-" + style; } } formatted += style; } return formatted; }
java
protected String ensureTextColorFormat(String textColor) { String formatted = ""; boolean mainColor = true; for (String style : textColor.split(" ")) { if (mainColor) { // the main color if (!style.endsWith("-text")) { style += "-text"; } mainColor = false; } else { // the shading type if (!style.startsWith("text-")) { style = " text-" + style; } } formatted += style; } return formatted; }
[ "protected", "String", "ensureTextColorFormat", "(", "String", "textColor", ")", "{", "String", "formatted", "=", "\"\"", ";", "boolean", "mainColor", "=", "true", ";", "for", "(", "String", "style", ":", "textColor", ".", "split", "(", "\" \"", ")", ")", "{", "if", "(", "mainColor", ")", "{", "// the main color", "if", "(", "!", "style", ".", "endsWith", "(", "\"-text\"", ")", ")", "{", "style", "+=", "\"-text\"", ";", "}", "mainColor", "=", "false", ";", "}", "else", "{", "// the shading type", "if", "(", "!", "style", ".", "startsWith", "(", "\"text-\"", ")", ")", "{", "style", "=", "\" text-\"", "+", "style", ";", "}", "}", "formatted", "+=", "style", ";", "}", "return", "formatted", ";", "}" ]
Allow for the use of text shading and auto formatting.
[ "Allow", "for", "the", "use", "of", "text", "shading", "and", "auto", "formatting", "." ]
86feefb282b007c0a44784c09e651a50f257138e
https://github.com/GwtMaterialDesign/gwt-material/blob/86feefb282b007c0a44784c09e651a50f257138e/gwt-material/src/main/java/gwt/material/design/client/base/mixin/ColorsMixin.java#L76-L95
160,608
GwtMaterialDesign/gwt-material
gwt-material/src/main/java/gwt/material/design/client/ui/MaterialTabItem.java
MaterialTabItem.selectTab
public void selectTab() { for (Widget child : getChildren()) { if (child instanceof HasHref) { String href = ((HasHref) child).getHref(); if (parent != null && !href.isEmpty()) { parent.selectTab(href.replaceAll("[^a-zA-Z\\d\\s:]", "")); parent.reload(); break; } } } }
java
public void selectTab() { for (Widget child : getChildren()) { if (child instanceof HasHref) { String href = ((HasHref) child).getHref(); if (parent != null && !href.isEmpty()) { parent.selectTab(href.replaceAll("[^a-zA-Z\\d\\s:]", "")); parent.reload(); break; } } } }
[ "public", "void", "selectTab", "(", ")", "{", "for", "(", "Widget", "child", ":", "getChildren", "(", ")", ")", "{", "if", "(", "child", "instanceof", "HasHref", ")", "{", "String", "href", "=", "(", "(", "HasHref", ")", "child", ")", ".", "getHref", "(", ")", ";", "if", "(", "parent", "!=", "null", "&&", "!", "href", ".", "isEmpty", "(", ")", ")", "{", "parent", ".", "selectTab", "(", "href", ".", "replaceAll", "(", "\"[^a-zA-Z\\\\d\\\\s:]\"", ",", "\"\"", ")", ")", ";", "parent", ".", "reload", "(", ")", ";", "break", ";", "}", "}", "}", "}" ]
Select this tab item.
[ "Select", "this", "tab", "item", "." ]
86feefb282b007c0a44784c09e651a50f257138e
https://github.com/GwtMaterialDesign/gwt-material/blob/86feefb282b007c0a44784c09e651a50f257138e/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialTabItem.java#L64-L75
160,609
GwtMaterialDesign/gwt-material
gwt-material/src/main/java/gwt/material/design/client/base/validator/MessageFormat.java
MessageFormat.format
public static String format(String pattern, Object... arguments) { String msg = pattern; if (arguments != null) { for (int index = 0; index < arguments.length; index++) { msg = msg.replaceAll("\\{" + (index + 1) + "\\}", String.valueOf(arguments[index])); } } return msg; }
java
public static String format(String pattern, Object... arguments) { String msg = pattern; if (arguments != null) { for (int index = 0; index < arguments.length; index++) { msg = msg.replaceAll("\\{" + (index + 1) + "\\}", String.valueOf(arguments[index])); } } return msg; }
[ "public", "static", "String", "format", "(", "String", "pattern", ",", "Object", "...", "arguments", ")", "{", "String", "msg", "=", "pattern", ";", "if", "(", "arguments", "!=", "null", ")", "{", "for", "(", "int", "index", "=", "0", ";", "index", "<", "arguments", ".", "length", ";", "index", "++", ")", "{", "msg", "=", "msg", ".", "replaceAll", "(", "\"\\\\{\"", "+", "(", "index", "+", "1", ")", "+", "\"\\\\}\"", ",", "String", ".", "valueOf", "(", "arguments", "[", "index", "]", ")", ")", ";", "}", "}", "return", "msg", ";", "}" ]
Format the message using the pattern and the arguments. @param pattern the pattern in the format of "{1} this is a {2}" @param arguments the arguments. @return the formatted result.
[ "Format", "the", "message", "using", "the", "pattern", "and", "the", "arguments", "." ]
86feefb282b007c0a44784c09e651a50f257138e
https://github.com/GwtMaterialDesign/gwt-material/blob/86feefb282b007c0a44784c09e651a50f257138e/gwt-material/src/main/java/gwt/material/design/client/base/validator/MessageFormat.java#L36-L44
160,610
GwtMaterialDesign/gwt-material
gwt-material/src/main/java/gwt/material/design/client/ui/MaterialSwitch.java
MaterialSwitch.setValue
@Override public void setValue(Boolean value, boolean fireEvents) { boolean oldValue = getValue(); if (value) { input.getElement().setAttribute("checked", "true"); } else { input.getElement().removeAttribute("checked"); } if (fireEvents && oldValue != value) { ValueChangeEvent.fire(this, getValue()); } }
java
@Override public void setValue(Boolean value, boolean fireEvents) { boolean oldValue = getValue(); if (value) { input.getElement().setAttribute("checked", "true"); } else { input.getElement().removeAttribute("checked"); } if (fireEvents && oldValue != value) { ValueChangeEvent.fire(this, getValue()); } }
[ "@", "Override", "public", "void", "setValue", "(", "Boolean", "value", ",", "boolean", "fireEvents", ")", "{", "boolean", "oldValue", "=", "getValue", "(", ")", ";", "if", "(", "value", ")", "{", "input", ".", "getElement", "(", ")", ".", "setAttribute", "(", "\"checked\"", ",", "\"true\"", ")", ";", "}", "else", "{", "input", ".", "getElement", "(", ")", ".", "removeAttribute", "(", "\"checked\"", ")", ";", "}", "if", "(", "fireEvents", "&&", "oldValue", "!=", "value", ")", "{", "ValueChangeEvent", ".", "fire", "(", "this", ",", "getValue", "(", ")", ")", ";", "}", "}" ]
Set the value of switch component.
[ "Set", "the", "value", "of", "switch", "component", "." ]
86feefb282b007c0a44784c09e651a50f257138e
https://github.com/GwtMaterialDesign/gwt-material/blob/86feefb282b007c0a44784c09e651a50f257138e/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialSwitch.java#L124-L136
160,611
GwtMaterialDesign/gwt-material
gwt-material/src/main/java/gwt/material/design/client/base/helper/StyleHelper.java
StyleHelper.addUniqueEnumStyleName
public static <E extends Style.HasCssName, F extends Enum<? extends Style.HasCssName>> void addUniqueEnumStyleName(final UIObject uiObject, final Class<F> enumClass, final E style) { removeEnumStyleNames(uiObject, enumClass); addEnumStyleName(uiObject, style); }
java
public static <E extends Style.HasCssName, F extends Enum<? extends Style.HasCssName>> void addUniqueEnumStyleName(final UIObject uiObject, final Class<F> enumClass, final E style) { removeEnumStyleNames(uiObject, enumClass); addEnumStyleName(uiObject, style); }
[ "public", "static", "<", "E", "extends", "Style", ".", "HasCssName", ",", "F", "extends", "Enum", "<", "?", "extends", "Style", ".", "HasCssName", ">", ">", "void", "addUniqueEnumStyleName", "(", "final", "UIObject", "uiObject", ",", "final", "Class", "<", "F", ">", "enumClass", ",", "final", "E", "style", ")", "{", "removeEnumStyleNames", "(", "uiObject", ",", "enumClass", ")", ";", "addEnumStyleName", "(", "uiObject", ",", "style", ")", ";", "}" ]
Convenience method for first removing all enum style constants and then adding the single one. @see #removeEnumStyleNames(UIObject, Class) @see #addEnumStyleName(UIObject, Style.HasCssName)
[ "Convenience", "method", "for", "first", "removing", "all", "enum", "style", "constants", "and", "then", "adding", "the", "single", "one", "." ]
86feefb282b007c0a44784c09e651a50f257138e
https://github.com/GwtMaterialDesign/gwt-material/blob/86feefb282b007c0a44784c09e651a50f257138e/gwt-material/src/main/java/gwt/material/design/client/base/helper/StyleHelper.java#L45-L50
160,612
GwtMaterialDesign/gwt-material
gwt-material/src/main/java/gwt/material/design/client/base/helper/StyleHelper.java
StyleHelper.toggleStyleName
public static void toggleStyleName(final UIObject uiObject, final boolean toggleStyle, final String styleName) { if (toggleStyle) { uiObject.addStyleName(styleName); } else { uiObject.removeStyleName(styleName); } }
java
public static void toggleStyleName(final UIObject uiObject, final boolean toggleStyle, final String styleName) { if (toggleStyle) { uiObject.addStyleName(styleName); } else { uiObject.removeStyleName(styleName); } }
[ "public", "static", "void", "toggleStyleName", "(", "final", "UIObject", "uiObject", ",", "final", "boolean", "toggleStyle", ",", "final", "String", "styleName", ")", "{", "if", "(", "toggleStyle", ")", "{", "uiObject", ".", "addStyleName", "(", "styleName", ")", ";", "}", "else", "{", "uiObject", ".", "removeStyleName", "(", "styleName", ")", ";", "}", "}" ]
Toggles a style name on a ui object @param uiObject Object to toggle style on @param toggleStyle whether or not to toggle the style name on the object @param styleName Style name
[ "Toggles", "a", "style", "name", "on", "a", "ui", "object" ]
86feefb282b007c0a44784c09e651a50f257138e
https://github.com/GwtMaterialDesign/gwt-material/blob/86feefb282b007c0a44784c09e651a50f257138e/gwt-material/src/main/java/gwt/material/design/client/base/helper/StyleHelper.java#L130-L138
160,613
GwtMaterialDesign/gwt-material
gwt-material/src/main/java/gwt/material/design/client/pwa/serviceworker/ServiceWorkerManager.java
ServiceWorkerManager.setupRegistration
protected void setupRegistration() { if (isServiceWorkerSupported()) { Navigator.serviceWorker.register(getResource()).then(object -> { logger.info("Service worker has been successfully registered"); registration = (ServiceWorkerRegistration) object; onRegistered(new ServiceEvent(), registration); // Observe service worker lifecycle observeLifecycle(registration); // Setup Service Worker events events setupOnControllerChangeEvent(); setupOnMessageEvent(); setupOnErrorEvent(); return null; }, error -> { logger.info("ServiceWorker registration failed: " + error); return null; }); } else { logger.info("Service worker is not supported by this browser."); } }
java
protected void setupRegistration() { if (isServiceWorkerSupported()) { Navigator.serviceWorker.register(getResource()).then(object -> { logger.info("Service worker has been successfully registered"); registration = (ServiceWorkerRegistration) object; onRegistered(new ServiceEvent(), registration); // Observe service worker lifecycle observeLifecycle(registration); // Setup Service Worker events events setupOnControllerChangeEvent(); setupOnMessageEvent(); setupOnErrorEvent(); return null; }, error -> { logger.info("ServiceWorker registration failed: " + error); return null; }); } else { logger.info("Service worker is not supported by this browser."); } }
[ "protected", "void", "setupRegistration", "(", ")", "{", "if", "(", "isServiceWorkerSupported", "(", ")", ")", "{", "Navigator", ".", "serviceWorker", ".", "register", "(", "getResource", "(", ")", ")", ".", "then", "(", "object", "->", "{", "logger", ".", "info", "(", "\"Service worker has been successfully registered\"", ")", ";", "registration", "=", "(", "ServiceWorkerRegistration", ")", "object", ";", "onRegistered", "(", "new", "ServiceEvent", "(", ")", ",", "registration", ")", ";", "// Observe service worker lifecycle", "observeLifecycle", "(", "registration", ")", ";", "// Setup Service Worker events events", "setupOnControllerChangeEvent", "(", ")", ";", "setupOnMessageEvent", "(", ")", ";", "setupOnErrorEvent", "(", ")", ";", "return", "null", ";", "}", ",", "error", "->", "{", "logger", ".", "info", "(", "\"ServiceWorker registration failed: \"", "+", "error", ")", ";", "return", "null", ";", "}", ")", ";", "}", "else", "{", "logger", ".", "info", "(", "\"Service worker is not supported by this browser.\"", ")", ";", "}", "}" ]
Initial setup of the service worker registration.
[ "Initial", "setup", "of", "the", "service", "worker", "registration", "." ]
86feefb282b007c0a44784c09e651a50f257138e
https://github.com/GwtMaterialDesign/gwt-material/blob/86feefb282b007c0a44784c09e651a50f257138e/gwt-material/src/main/java/gwt/material/design/client/pwa/serviceworker/ServiceWorkerManager.java#L103-L126
160,614
GwtMaterialDesign/gwt-material
gwt-material/src/main/java/gwt/material/design/client/ui/MaterialRange.java
MaterialRange.addChangeHandler
@Override public HandlerRegistration addChangeHandler(final ChangeHandler handler) { return getRangeInputElement().addDomHandler(handler, ChangeEvent.getType()); }
java
@Override public HandlerRegistration addChangeHandler(final ChangeHandler handler) { return getRangeInputElement().addDomHandler(handler, ChangeEvent.getType()); }
[ "@", "Override", "public", "HandlerRegistration", "addChangeHandler", "(", "final", "ChangeHandler", "handler", ")", "{", "return", "getRangeInputElement", "(", ")", ".", "addDomHandler", "(", "handler", ",", "ChangeEvent", ".", "getType", "(", ")", ")", ";", "}" ]
Register the ChangeHandler to become notified if the user changes the slider. The Handler is called when the user releases the mouse only at the end of the slide operation.
[ "Register", "the", "ChangeHandler", "to", "become", "notified", "if", "the", "user", "changes", "the", "slider", ".", "The", "Handler", "is", "called", "when", "the", "user", "releases", "the", "mouse", "only", "at", "the", "end", "of", "the", "slide", "operation", "." ]
86feefb282b007c0a44784c09e651a50f257138e
https://github.com/GwtMaterialDesign/gwt-material/blob/86feefb282b007c0a44784c09e651a50f257138e/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialRange.java#L221-L224
160,615
GwtMaterialDesign/gwt-material
gwt-material/src/main/java/gwt/material/design/client/base/viewport/ViewPortHandler.java
ViewPortHandler.then
public ViewPort then(Functions.Func1<ViewPortChange> then, ViewPortFallback fallback) { assert then != null : "'then' callback cannot be null"; this.then = then; this.fallback = fallback; return load(); }
java
public ViewPort then(Functions.Func1<ViewPortChange> then, ViewPortFallback fallback) { assert then != null : "'then' callback cannot be null"; this.then = then; this.fallback = fallback; return load(); }
[ "public", "ViewPort", "then", "(", "Functions", ".", "Func1", "<", "ViewPortChange", ">", "then", ",", "ViewPortFallback", "fallback", ")", "{", "assert", "then", "!=", "null", ":", "\"'then' callback cannot be null\"", ";", "this", ".", "then", "=", "then", ";", "this", ".", "fallback", "=", "fallback", ";", "return", "load", "(", ")", ";", "}" ]
Load the view port execution. @param then callback when the view port is detected. @param fallback fallback when no view port detected or failure to detect the given {@link Boundary} (using {@link #propagateFallback(boolean)})
[ "Load", "the", "view", "port", "execution", "." ]
86feefb282b007c0a44784c09e651a50f257138e
https://github.com/GwtMaterialDesign/gwt-material/blob/86feefb282b007c0a44784c09e651a50f257138e/gwt-material/src/main/java/gwt/material/design/client/base/viewport/ViewPortHandler.java#L83-L88
160,616
GwtMaterialDesign/gwt-material
gwt-material/src/main/java/gwt/material/design/client/base/viewport/ViewPortHandler.java
ViewPortHandler.load
protected ViewPort load() { resize = Window.addResizeHandler(event -> { execute(event.getWidth(), event.getHeight()); }); execute(window().width(), (int)window().height()); return viewPort; }
java
protected ViewPort load() { resize = Window.addResizeHandler(event -> { execute(event.getWidth(), event.getHeight()); }); execute(window().width(), (int)window().height()); return viewPort; }
[ "protected", "ViewPort", "load", "(", ")", "{", "resize", "=", "Window", ".", "addResizeHandler", "(", "event", "->", "{", "execute", "(", "event", ".", "getWidth", "(", ")", ",", "event", ".", "getHeight", "(", ")", ")", ";", "}", ")", ";", "execute", "(", "window", "(", ")", ".", "width", "(", ")", ",", "(", "int", ")", "window", "(", ")", ".", "height", "(", ")", ")", ";", "return", "viewPort", ";", "}" ]
Load the windows resize handler with initial view port detection.
[ "Load", "the", "windows", "resize", "handler", "with", "initial", "view", "port", "detection", "." ]
86feefb282b007c0a44784c09e651a50f257138e
https://github.com/GwtMaterialDesign/gwt-material/blob/86feefb282b007c0a44784c09e651a50f257138e/gwt-material/src/main/java/gwt/material/design/client/base/viewport/ViewPortHandler.java#L112-L119
160,617
GwtMaterialDesign/gwt-material
gwt-material/src/main/java/gwt/material/design/client/base/helper/DateFormatHelper.java
DateFormatHelper.format
public static String format(String format) { if (format == null) { format = DEFAULT_FORMAT; } else { if (format.contains("M")) { format = format.replace("M", "m"); } if (format.contains("Y")) { format = format.replace("Y", "y"); } if (format.contains("D")) { format = format.replace("D", "d"); } } return format; }
java
public static String format(String format) { if (format == null) { format = DEFAULT_FORMAT; } else { if (format.contains("M")) { format = format.replace("M", "m"); } if (format.contains("Y")) { format = format.replace("Y", "y"); } if (format.contains("D")) { format = format.replace("D", "d"); } } return format; }
[ "public", "static", "String", "format", "(", "String", "format", ")", "{", "if", "(", "format", "==", "null", ")", "{", "format", "=", "DEFAULT_FORMAT", ";", "}", "else", "{", "if", "(", "format", ".", "contains", "(", "\"M\"", ")", ")", "{", "format", "=", "format", ".", "replace", "(", "\"M\"", ",", "\"m\"", ")", ";", "}", "if", "(", "format", ".", "contains", "(", "\"Y\"", ")", ")", "{", "format", "=", "format", ".", "replace", "(", "\"Y\"", ",", "\"y\"", ")", ";", "}", "if", "(", "format", ".", "contains", "(", "\"D\"", ")", ")", "{", "format", "=", "format", ".", "replace", "(", "\"D\"", ",", "\"d\"", ")", ";", "}", "}", "return", "format", ";", "}" ]
Will auto format the given string to provide support for pickadate.js formats.
[ "Will", "auto", "format", "the", "given", "string", "to", "provide", "support", "for", "pickadate", ".", "js", "formats", "." ]
86feefb282b007c0a44784c09e651a50f257138e
https://github.com/GwtMaterialDesign/gwt-material/blob/86feefb282b007c0a44784c09e651a50f257138e/gwt-material/src/main/java/gwt/material/design/client/base/helper/DateFormatHelper.java#L36-L54
160,618
GwtMaterialDesign/gwt-material
gwt-material/src/main/java/gwt/material/design/client/base/AbstractSideNav.java
AbstractSideNav.setWidth
public void setWidth(int width) { this.width = width; getElement().getStyle().setWidth(width, Style.Unit.PX); }
java
public void setWidth(int width) { this.width = width; getElement().getStyle().setWidth(width, Style.Unit.PX); }
[ "public", "void", "setWidth", "(", "int", "width", ")", "{", "this", ".", "width", "=", "width", ";", "getElement", "(", ")", ".", "getStyle", "(", ")", ".", "setWidth", "(", "width", ",", "Style", ".", "Unit", ".", "PX", ")", ";", "}" ]
Set the menu's width in pixels.
[ "Set", "the", "menu", "s", "width", "in", "pixels", "." ]
86feefb282b007c0a44784c09e651a50f257138e
https://github.com/GwtMaterialDesign/gwt-material/blob/86feefb282b007c0a44784c09e651a50f257138e/gwt-material/src/main/java/gwt/material/design/client/base/AbstractSideNav.java#L354-L357
160,619
GwtMaterialDesign/gwt-material
gwt-material/src/main/java/gwt/material/design/client/ui/MaterialCollapsible.java
MaterialCollapsible.setAccordion
public void setAccordion(boolean accordion) { getElement().setAttribute("data-collapsible", accordion ? CssName.ACCORDION : CssName.EXPANDABLE); reload(); }
java
public void setAccordion(boolean accordion) { getElement().setAttribute("data-collapsible", accordion ? CssName.ACCORDION : CssName.EXPANDABLE); reload(); }
[ "public", "void", "setAccordion", "(", "boolean", "accordion", ")", "{", "getElement", "(", ")", ".", "setAttribute", "(", "\"data-collapsible\"", ",", "accordion", "?", "CssName", ".", "ACCORDION", ":", "CssName", ".", "EXPANDABLE", ")", ";", "reload", "(", ")", ";", "}" ]
Configure if you want this collapsible container to accordion its child elements or use expandable.
[ "Configure", "if", "you", "want", "this", "collapsible", "container", "to", "accordion", "its", "child", "elements", "or", "use", "expandable", "." ]
86feefb282b007c0a44784c09e651a50f257138e
https://github.com/GwtMaterialDesign/gwt-material/blob/86feefb282b007c0a44784c09e651a50f257138e/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialCollapsible.java#L237-L240
160,620
GwtMaterialDesign/gwt-material
gwt-material/src/main/java/gwt/material/design/client/base/validator/AbstractValidator.java
AbstractValidator.getInvalidMessage
public String getInvalidMessage(String key) { return invalidMessageOverride == null ? messageMixin.lookup(key, messageValueArgs) : MessageFormat.format( invalidMessageOverride, messageValueArgs); }
java
public String getInvalidMessage(String key) { return invalidMessageOverride == null ? messageMixin.lookup(key, messageValueArgs) : MessageFormat.format( invalidMessageOverride, messageValueArgs); }
[ "public", "String", "getInvalidMessage", "(", "String", "key", ")", "{", "return", "invalidMessageOverride", "==", "null", "?", "messageMixin", ".", "lookup", "(", "key", ",", "messageValueArgs", ")", ":", "MessageFormat", ".", "format", "(", "invalidMessageOverride", ",", "messageValueArgs", ")", ";", "}" ]
Gets the invalid message. @param key the key @return the invalid message
[ "Gets", "the", "invalid", "message", "." ]
86feefb282b007c0a44784c09e651a50f257138e
https://github.com/GwtMaterialDesign/gwt-material/blob/86feefb282b007c0a44784c09e651a50f257138e/gwt-material/src/main/java/gwt/material/design/client/base/validator/AbstractValidator.java#L90-L93
160,621
GwtMaterialDesign/gwt-material
gwt-material/src/main/java/gwt/material/design/client/pwa/PwaManager.java
PwaManager.installApp
public void installApp(Functions.Func callback) { if (isPwaSupported()) { appInstaller = new AppInstaller(callback); appInstaller.prompt(); } }
java
public void installApp(Functions.Func callback) { if (isPwaSupported()) { appInstaller = new AppInstaller(callback); appInstaller.prompt(); } }
[ "public", "void", "installApp", "(", "Functions", ".", "Func", "callback", ")", "{", "if", "(", "isPwaSupported", "(", ")", ")", "{", "appInstaller", "=", "new", "AppInstaller", "(", "callback", ")", ";", "appInstaller", ".", "prompt", "(", ")", ";", "}", "}" ]
Will prompt a user the "Add to Homescreen" feature @param callback A callback function after the method has been executed.
[ "Will", "prompt", "a", "user", "the", "Add", "to", "Homescreen", "feature" ]
86feefb282b007c0a44784c09e651a50f257138e
https://github.com/GwtMaterialDesign/gwt-material/blob/86feefb282b007c0a44784c09e651a50f257138e/gwt-material/src/main/java/gwt/material/design/client/pwa/PwaManager.java#L133-L138
160,622
GwtMaterialDesign/gwt-material
gwt-material/src/main/java/gwt/material/design/client/ui/MaterialLoader.java
MaterialLoader.show
public void show() { if (!(container instanceof RootPanel)) { if (!(container instanceof MaterialDialog)) { container.getElement().getStyle().setPosition(Style.Position.RELATIVE); } div.getElement().getStyle().setPosition(Style.Position.ABSOLUTE); } if (scrollDisabled) { RootPanel.get().getElement().getStyle().setOverflow(Style.Overflow.HIDDEN); } if (type == LoaderType.CIRCULAR) { div.setStyleName(CssName.VALIGN_WRAPPER + " " + CssName.LOADER_WRAPPER); div.add(preLoader); } else if (type == LoaderType.PROGRESS) { div.setStyleName(CssName.VALIGN_WRAPPER + " " + CssName.PROGRESS_WRAPPER); progress.getElement().getStyle().setProperty("margin", "auto"); div.add(progress); } container.add(div); }
java
public void show() { if (!(container instanceof RootPanel)) { if (!(container instanceof MaterialDialog)) { container.getElement().getStyle().setPosition(Style.Position.RELATIVE); } div.getElement().getStyle().setPosition(Style.Position.ABSOLUTE); } if (scrollDisabled) { RootPanel.get().getElement().getStyle().setOverflow(Style.Overflow.HIDDEN); } if (type == LoaderType.CIRCULAR) { div.setStyleName(CssName.VALIGN_WRAPPER + " " + CssName.LOADER_WRAPPER); div.add(preLoader); } else if (type == LoaderType.PROGRESS) { div.setStyleName(CssName.VALIGN_WRAPPER + " " + CssName.PROGRESS_WRAPPER); progress.getElement().getStyle().setProperty("margin", "auto"); div.add(progress); } container.add(div); }
[ "public", "void", "show", "(", ")", "{", "if", "(", "!", "(", "container", "instanceof", "RootPanel", ")", ")", "{", "if", "(", "!", "(", "container", "instanceof", "MaterialDialog", ")", ")", "{", "container", ".", "getElement", "(", ")", ".", "getStyle", "(", ")", ".", "setPosition", "(", "Style", ".", "Position", ".", "RELATIVE", ")", ";", "}", "div", ".", "getElement", "(", ")", ".", "getStyle", "(", ")", ".", "setPosition", "(", "Style", ".", "Position", ".", "ABSOLUTE", ")", ";", "}", "if", "(", "scrollDisabled", ")", "{", "RootPanel", ".", "get", "(", ")", ".", "getElement", "(", ")", ".", "getStyle", "(", ")", ".", "setOverflow", "(", "Style", ".", "Overflow", ".", "HIDDEN", ")", ";", "}", "if", "(", "type", "==", "LoaderType", ".", "CIRCULAR", ")", "{", "div", ".", "setStyleName", "(", "CssName", ".", "VALIGN_WRAPPER", "+", "\" \"", "+", "CssName", ".", "LOADER_WRAPPER", ")", ";", "div", ".", "add", "(", "preLoader", ")", ";", "}", "else", "if", "(", "type", "==", "LoaderType", ".", "PROGRESS", ")", "{", "div", ".", "setStyleName", "(", "CssName", ".", "VALIGN_WRAPPER", "+", "\" \"", "+", "CssName", ".", "PROGRESS_WRAPPER", ")", ";", "progress", ".", "getElement", "(", ")", ".", "getStyle", "(", ")", ".", "setProperty", "(", "\"margin\"", ",", "\"auto\"", ")", ";", "div", ".", "add", "(", "progress", ")", ";", "}", "container", ".", "add", "(", "div", ")", ";", "}" ]
Shows the Loader component
[ "Shows", "the", "Loader", "component" ]
86feefb282b007c0a44784c09e651a50f257138e
https://github.com/GwtMaterialDesign/gwt-material/blob/86feefb282b007c0a44784c09e651a50f257138e/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialLoader.java#L100-L119
160,623
GwtMaterialDesign/gwt-material
gwt-material/src/main/java/gwt/material/design/client/ui/MaterialLoader.java
MaterialLoader.hide
public void hide() { div.removeFromParent(); if (scrollDisabled) { RootPanel.get().getElement().getStyle().setOverflow(Style.Overflow.AUTO); } if (type == LoaderType.CIRCULAR) { preLoader.removeFromParent(); } else if (type == LoaderType.PROGRESS) { progress.removeFromParent(); } }
java
public void hide() { div.removeFromParent(); if (scrollDisabled) { RootPanel.get().getElement().getStyle().setOverflow(Style.Overflow.AUTO); } if (type == LoaderType.CIRCULAR) { preLoader.removeFromParent(); } else if (type == LoaderType.PROGRESS) { progress.removeFromParent(); } }
[ "public", "void", "hide", "(", ")", "{", "div", ".", "removeFromParent", "(", ")", ";", "if", "(", "scrollDisabled", ")", "{", "RootPanel", ".", "get", "(", ")", ".", "getElement", "(", ")", ".", "getStyle", "(", ")", ".", "setOverflow", "(", "Style", ".", "Overflow", ".", "AUTO", ")", ";", "}", "if", "(", "type", "==", "LoaderType", ".", "CIRCULAR", ")", "{", "preLoader", ".", "removeFromParent", "(", ")", ";", "}", "else", "if", "(", "type", "==", "LoaderType", ".", "PROGRESS", ")", "{", "progress", ".", "removeFromParent", "(", ")", ";", "}", "}" ]
Hides the Loader component
[ "Hides", "the", "Loader", "component" ]
86feefb282b007c0a44784c09e651a50f257138e
https://github.com/GwtMaterialDesign/gwt-material/blob/86feefb282b007c0a44784c09e651a50f257138e/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialLoader.java#L124-L134
160,624
GwtMaterialDesign/gwt-material
gwt-material/src/main/java/gwt/material/design/client/base/Waves.java
Waves.detectAndApply
public static void detectAndApply(Widget widget) { if (!widget.isAttached()) { widget.addAttachHandler(event -> { if (event.isAttached()) { detectAndApply(); } }); } else { detectAndApply(); } }
java
public static void detectAndApply(Widget widget) { if (!widget.isAttached()) { widget.addAttachHandler(event -> { if (event.isAttached()) { detectAndApply(); } }); } else { detectAndApply(); } }
[ "public", "static", "void", "detectAndApply", "(", "Widget", "widget", ")", "{", "if", "(", "!", "widget", ".", "isAttached", "(", ")", ")", "{", "widget", ".", "addAttachHandler", "(", "event", "->", "{", "if", "(", "event", ".", "isAttached", "(", ")", ")", "{", "detectAndApply", "(", ")", ";", "}", "}", ")", ";", "}", "else", "{", "detectAndApply", "(", ")", ";", "}", "}" ]
Detect and apply waves, now or when the widget is attached. @param widget target widget to ensure is attached first
[ "Detect", "and", "apply", "waves", "now", "or", "when", "the", "widget", "is", "attached", "." ]
86feefb282b007c0a44784c09e651a50f257138e
https://github.com/GwtMaterialDesign/gwt-material/blob/86feefb282b007c0a44784c09e651a50f257138e/gwt-material/src/main/java/gwt/material/design/client/base/Waves.java#L42-L52
160,625
GwtMaterialDesign/gwt-material
gwt-material/src/main/java/gwt/material/design/client/ui/MaterialCheckBox.java
MaterialCheckBox.setType
public void setType(CheckBoxType type) { this.type = type; switch (type) { case FILLED: Element input = DOM.getChild(getElement(), 0); input.setAttribute("class", CssName.FILLED_IN); break; case INTERMEDIATE: addStyleName(type.getCssName() + "-checkbox"); break; default: addStyleName(type.getCssName()); break; } }
java
public void setType(CheckBoxType type) { this.type = type; switch (type) { case FILLED: Element input = DOM.getChild(getElement(), 0); input.setAttribute("class", CssName.FILLED_IN); break; case INTERMEDIATE: addStyleName(type.getCssName() + "-checkbox"); break; default: addStyleName(type.getCssName()); break; } }
[ "public", "void", "setType", "(", "CheckBoxType", "type", ")", "{", "this", ".", "type", "=", "type", ";", "switch", "(", "type", ")", "{", "case", "FILLED", ":", "Element", "input", "=", "DOM", ".", "getChild", "(", "getElement", "(", ")", ",", "0", ")", ";", "input", ".", "setAttribute", "(", "\"class\"", ",", "CssName", ".", "FILLED_IN", ")", ";", "break", ";", "case", "INTERMEDIATE", ":", "addStyleName", "(", "type", ".", "getCssName", "(", ")", "+", "\"-checkbox\"", ")", ";", "break", ";", "default", ":", "addStyleName", "(", "type", ".", "getCssName", "(", ")", ")", ";", "break", ";", "}", "}" ]
Setting the type of Checkbox.
[ "Setting", "the", "type", "of", "Checkbox", "." ]
86feefb282b007c0a44784c09e651a50f257138e
https://github.com/GwtMaterialDesign/gwt-material/blob/86feefb282b007c0a44784c09e651a50f257138e/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialCheckBox.java#L148-L162
160,626
eed3si9n/scalaxb
mvn-scalaxb/src/main/java/org/scalaxb/maven/ArgumentsBuilder.java
ArgumentsBuilder.param
ArgumentsBuilder param(String param, Integer value) { if (value != null) { args.add(param); args.add(value.toString()); } return this; }
java
ArgumentsBuilder param(String param, Integer value) { if (value != null) { args.add(param); args.add(value.toString()); } return this; }
[ "ArgumentsBuilder", "param", "(", "String", "param", ",", "Integer", "value", ")", "{", "if", "(", "value", "!=", "null", ")", "{", "args", ".", "add", "(", "param", ")", ";", "args", ".", "add", "(", "value", ".", "toString", "(", ")", ")", ";", "}", "return", "this", ";", "}" ]
Adds a parameter to the argument list if the given integer is non-null. If the value is null, then the argument list remains unchanged.
[ "Adds", "a", "parameter", "to", "the", "argument", "list", "if", "the", "given", "integer", "is", "non", "-", "null", ".", "If", "the", "value", "is", "null", "then", "the", "argument", "list", "remains", "unchanged", "." ]
92e8a5127e48ba594caca34685dda6dafcd21dd9
https://github.com/eed3si9n/scalaxb/blob/92e8a5127e48ba594caca34685dda6dafcd21dd9/mvn-scalaxb/src/main/java/org/scalaxb/maven/ArgumentsBuilder.java#L68-L74
160,627
eed3si9n/scalaxb
mvn-scalaxb/src/main/java/org/scalaxb/maven/ArgumentsBuilder.java
ArgumentsBuilder.param
ArgumentsBuilder param(String param, String value) { if (value != null) { args.add(param); args.add(value); } return this; }
java
ArgumentsBuilder param(String param, String value) { if (value != null) { args.add(param); args.add(value); } return this; }
[ "ArgumentsBuilder", "param", "(", "String", "param", ",", "String", "value", ")", "{", "if", "(", "value", "!=", "null", ")", "{", "args", ".", "add", "(", "param", ")", ";", "args", ".", "add", "(", "value", ")", ";", "}", "return", "this", ";", "}" ]
Adds a parameter that requires a string argument to the argument list. If the given argument is null, then the argument list remains unchanged.
[ "Adds", "a", "parameter", "that", "requires", "a", "string", "argument", "to", "the", "argument", "list", ".", "If", "the", "given", "argument", "is", "null", "then", "the", "argument", "list", "remains", "unchanged", "." ]
92e8a5127e48ba594caca34685dda6dafcd21dd9
https://github.com/eed3si9n/scalaxb/blob/92e8a5127e48ba594caca34685dda6dafcd21dd9/mvn-scalaxb/src/main/java/org/scalaxb/maven/ArgumentsBuilder.java#L80-L86
160,628
eed3si9n/scalaxb
mvn-scalaxb/src/main/java/org/scalaxb/maven/AbstractScalaxbMojo.java
AbstractScalaxbMojo.arguments
protected List<String> arguments() { List<String> args = new ArgumentsBuilder() .flag("-v", verbose) .flag("--package-dir", packageDir) .param("-d", outputDirectory.getPath()) .param("-p", packageName) .map("--package:", packageNameMap()) .param("--class-prefix", classPrefix) .param("--param-prefix", parameterPrefix) .param("--chunk-size", chunkSize) .flag("--no-dispatch-client", !generateDispatchClient) .flag("--dispatch-as", generateDispatchAs) .param("--dispatch-version", dispatchVersion) .flag("--no-runtime", !generateRuntime) .intersperse("--wrap-contents", wrapContents) .param("--protocol-file", protocolFile) .param("--protocol-package", protocolPackage) .param("--attribute-prefix", attributePrefix) .flag("--prepend-family", prependFamily) .flag("--blocking", !async) .flag("--lax-any", laxAny) .flag("--no-varargs", !varArgs) .flag("--ignore-unknown", ignoreUnknown) .flag("--autopackages", autoPackages) .flag("--mutable", mutable) .flag("--visitor", visitor) .getArguments(); return unmodifiableList(args); }
java
protected List<String> arguments() { List<String> args = new ArgumentsBuilder() .flag("-v", verbose) .flag("--package-dir", packageDir) .param("-d", outputDirectory.getPath()) .param("-p", packageName) .map("--package:", packageNameMap()) .param("--class-prefix", classPrefix) .param("--param-prefix", parameterPrefix) .param("--chunk-size", chunkSize) .flag("--no-dispatch-client", !generateDispatchClient) .flag("--dispatch-as", generateDispatchAs) .param("--dispatch-version", dispatchVersion) .flag("--no-runtime", !generateRuntime) .intersperse("--wrap-contents", wrapContents) .param("--protocol-file", protocolFile) .param("--protocol-package", protocolPackage) .param("--attribute-prefix", attributePrefix) .flag("--prepend-family", prependFamily) .flag("--blocking", !async) .flag("--lax-any", laxAny) .flag("--no-varargs", !varArgs) .flag("--ignore-unknown", ignoreUnknown) .flag("--autopackages", autoPackages) .flag("--mutable", mutable) .flag("--visitor", visitor) .getArguments(); return unmodifiableList(args); }
[ "protected", "List", "<", "String", ">", "arguments", "(", ")", "{", "List", "<", "String", ">", "args", "=", "new", "ArgumentsBuilder", "(", ")", ".", "flag", "(", "\"-v\"", ",", "verbose", ")", ".", "flag", "(", "\"--package-dir\"", ",", "packageDir", ")", ".", "param", "(", "\"-d\"", ",", "outputDirectory", ".", "getPath", "(", ")", ")", ".", "param", "(", "\"-p\"", ",", "packageName", ")", ".", "map", "(", "\"--package:\"", ",", "packageNameMap", "(", ")", ")", ".", "param", "(", "\"--class-prefix\"", ",", "classPrefix", ")", ".", "param", "(", "\"--param-prefix\"", ",", "parameterPrefix", ")", ".", "param", "(", "\"--chunk-size\"", ",", "chunkSize", ")", ".", "flag", "(", "\"--no-dispatch-client\"", ",", "!", "generateDispatchClient", ")", ".", "flag", "(", "\"--dispatch-as\"", ",", "generateDispatchAs", ")", ".", "param", "(", "\"--dispatch-version\"", ",", "dispatchVersion", ")", ".", "flag", "(", "\"--no-runtime\"", ",", "!", "generateRuntime", ")", ".", "intersperse", "(", "\"--wrap-contents\"", ",", "wrapContents", ")", ".", "param", "(", "\"--protocol-file\"", ",", "protocolFile", ")", ".", "param", "(", "\"--protocol-package\"", ",", "protocolPackage", ")", ".", "param", "(", "\"--attribute-prefix\"", ",", "attributePrefix", ")", ".", "flag", "(", "\"--prepend-family\"", ",", "prependFamily", ")", ".", "flag", "(", "\"--blocking\"", ",", "!", "async", ")", ".", "flag", "(", "\"--lax-any\"", ",", "laxAny", ")", ".", "flag", "(", "\"--no-varargs\"", ",", "!", "varArgs", ")", ".", "flag", "(", "\"--ignore-unknown\"", ",", "ignoreUnknown", ")", ".", "flag", "(", "\"--autopackages\"", ",", "autoPackages", ")", ".", "flag", "(", "\"--mutable\"", ",", "mutable", ")", ".", "flag", "(", "\"--visitor\"", ",", "visitor", ")", ".", "getArguments", "(", ")", ";", "return", "unmodifiableList", "(", "args", ")", ";", "}" ]
Returns the command line options to be used for scalaxb, excluding the input file names.
[ "Returns", "the", "command", "line", "options", "to", "be", "used", "for", "scalaxb", "excluding", "the", "input", "file", "names", "." ]
92e8a5127e48ba594caca34685dda6dafcd21dd9
https://github.com/eed3si9n/scalaxb/blob/92e8a5127e48ba594caca34685dda6dafcd21dd9/mvn-scalaxb/src/main/java/org/scalaxb/maven/AbstractScalaxbMojo.java#L313-L342
160,629
eed3si9n/scalaxb
mvn-scalaxb/src/main/java/org/scalaxb/maven/AbstractScalaxbMojo.java
AbstractScalaxbMojo.packageNameMap
Map<String, String> packageNameMap() { if (packageNames == null) { return emptyMap(); } Map<String, String> names = new LinkedHashMap<String, String>(); for (PackageName name : packageNames) { names.put(name.getUri(), name.getPackage()); } return names; }
java
Map<String, String> packageNameMap() { if (packageNames == null) { return emptyMap(); } Map<String, String> names = new LinkedHashMap<String, String>(); for (PackageName name : packageNames) { names.put(name.getUri(), name.getPackage()); } return names; }
[ "Map", "<", "String", ",", "String", ">", "packageNameMap", "(", ")", "{", "if", "(", "packageNames", "==", "null", ")", "{", "return", "emptyMap", "(", ")", ";", "}", "Map", "<", "String", ",", "String", ">", "names", "=", "new", "LinkedHashMap", "<", "String", ",", "String", ">", "(", ")", ";", "for", "(", "PackageName", "name", ":", "packageNames", ")", "{", "names", ".", "put", "(", "name", ".", "getUri", "(", ")", ",", "name", ".", "getPackage", "(", ")", ")", ";", "}", "return", "names", ";", "}" ]
Returns a map of URIs to package name, as specified by the packageNames parameter.
[ "Returns", "a", "map", "of", "URIs", "to", "package", "name", "as", "specified", "by", "the", "packageNames", "parameter", "." ]
92e8a5127e48ba594caca34685dda6dafcd21dd9
https://github.com/eed3si9n/scalaxb/blob/92e8a5127e48ba594caca34685dda6dafcd21dd9/mvn-scalaxb/src/main/java/org/scalaxb/maven/AbstractScalaxbMojo.java#L348-L358
160,630
pushtorefresh/storio
storio-common/src/main/java/com/pushtorefresh/storio3/Queries.java
Queries.placeholders
@NonNull public static String placeholders(final int numberOfPlaceholders) { if (numberOfPlaceholders == 1) { return "?"; // fffast } else if (numberOfPlaceholders == 0) { return ""; } else if (numberOfPlaceholders < 0) { throw new IllegalArgumentException("numberOfPlaceholders must be >= 0, but was = " + numberOfPlaceholders); } final StringBuilder stringBuilder = new StringBuilder((numberOfPlaceholders * 2) - 1); for (int i = 0; i < numberOfPlaceholders; i++) { stringBuilder.append('?'); if (i != numberOfPlaceholders - 1) { stringBuilder.append(','); } } return stringBuilder.toString(); }
java
@NonNull public static String placeholders(final int numberOfPlaceholders) { if (numberOfPlaceholders == 1) { return "?"; // fffast } else if (numberOfPlaceholders == 0) { return ""; } else if (numberOfPlaceholders < 0) { throw new IllegalArgumentException("numberOfPlaceholders must be >= 0, but was = " + numberOfPlaceholders); } final StringBuilder stringBuilder = new StringBuilder((numberOfPlaceholders * 2) - 1); for (int i = 0; i < numberOfPlaceholders; i++) { stringBuilder.append('?'); if (i != numberOfPlaceholders - 1) { stringBuilder.append(','); } } return stringBuilder.toString(); }
[ "@", "NonNull", "public", "static", "String", "placeholders", "(", "final", "int", "numberOfPlaceholders", ")", "{", "if", "(", "numberOfPlaceholders", "==", "1", ")", "{", "return", "\"?\"", ";", "// fffast", "}", "else", "if", "(", "numberOfPlaceholders", "==", "0", ")", "{", "return", "\"\"", ";", "}", "else", "if", "(", "numberOfPlaceholders", "<", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"numberOfPlaceholders must be >= 0, but was = \"", "+", "numberOfPlaceholders", ")", ";", "}", "final", "StringBuilder", "stringBuilder", "=", "new", "StringBuilder", "(", "(", "numberOfPlaceholders", "*", "2", ")", "-", "1", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "numberOfPlaceholders", ";", "i", "++", ")", "{", "stringBuilder", ".", "append", "(", "'", "'", ")", ";", "if", "(", "i", "!=", "numberOfPlaceholders", "-", "1", ")", "{", "stringBuilder", ".", "append", "(", "'", "'", ")", ";", "}", "}", "return", "stringBuilder", ".", "toString", "(", ")", ";", "}" ]
Generates required number of placeholders as string. Example: {@code numberOfPlaceholders == 1, result == "?"}, {@code numberOfPlaceholders == 2, result == "?,?"}. @param numberOfPlaceholders required amount of placeholders, should be {@code > 0}. @return string with placeholders.
[ "Generates", "required", "number", "of", "placeholders", "as", "string", "." ]
58f53d81bcc7b069c8bb271c46a90e37775abe8d
https://github.com/pushtorefresh/storio/blob/58f53d81bcc7b069c8bb271c46a90e37775abe8d/storio-common/src/main/java/com/pushtorefresh/storio3/Queries.java#L23-L44
160,631
hibernate/hibernate-ogm
core/src/main/java/org/hibernate/ogm/model/spi/Association.java
Association.get
public Tuple get(RowKey key) { AssociationOperation result = currentState.get( key ); if ( result == null ) { return cleared ? null : snapshot.get( key ); } else if ( result.getType() == REMOVE ) { return null; } return result.getValue(); }
java
public Tuple get(RowKey key) { AssociationOperation result = currentState.get( key ); if ( result == null ) { return cleared ? null : snapshot.get( key ); } else if ( result.getType() == REMOVE ) { return null; } return result.getValue(); }
[ "public", "Tuple", "get", "(", "RowKey", "key", ")", "{", "AssociationOperation", "result", "=", "currentState", ".", "get", "(", "key", ")", ";", "if", "(", "result", "==", "null", ")", "{", "return", "cleared", "?", "null", ":", "snapshot", ".", "get", "(", "key", ")", ";", "}", "else", "if", "(", "result", ".", "getType", "(", ")", "==", "REMOVE", ")", "{", "return", "null", ";", "}", "return", "result", ".", "getValue", "(", ")", ";", "}" ]
Returns the association row with the given key. @param key the key of the row to return. @return the association row with the given key or {@code null} if no row with that key is contained in this association
[ "Returns", "the", "association", "row", "with", "the", "given", "key", "." ]
9ea971df7c27277029006a6f748d8272fb1d69d2
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/model/spi/Association.java#L66-L75
160,632
hibernate/hibernate-ogm
core/src/main/java/org/hibernate/ogm/model/spi/Association.java
Association.remove
public void remove(RowKey key) { currentState.put( key, new AssociationOperation( key, null, REMOVE ) ); }
java
public void remove(RowKey key) { currentState.put( key, new AssociationOperation( key, null, REMOVE ) ); }
[ "public", "void", "remove", "(", "RowKey", "key", ")", "{", "currentState", ".", "put", "(", "key", ",", "new", "AssociationOperation", "(", "key", ",", "null", ",", "REMOVE", ")", ")", ";", "}" ]
Removes the row with the specified key from this association. @param key the key of the association row to remove
[ "Removes", "the", "row", "with", "the", "specified", "key", "from", "this", "association", "." ]
9ea971df7c27277029006a6f748d8272fb1d69d2
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/model/spi/Association.java#L96-L98
160,633
hibernate/hibernate-ogm
core/src/main/java/org/hibernate/ogm/model/spi/Association.java
Association.isEmpty
public boolean isEmpty() { int snapshotSize = cleared ? 0 : snapshot.size(); //nothing in both if ( snapshotSize == 0 && currentState.isEmpty() ) { return true; } //snapshot bigger than changeset if ( snapshotSize > currentState.size() ) { return false; } return size() == 0; }
java
public boolean isEmpty() { int snapshotSize = cleared ? 0 : snapshot.size(); //nothing in both if ( snapshotSize == 0 && currentState.isEmpty() ) { return true; } //snapshot bigger than changeset if ( snapshotSize > currentState.size() ) { return false; } return size() == 0; }
[ "public", "boolean", "isEmpty", "(", ")", "{", "int", "snapshotSize", "=", "cleared", "?", "0", ":", "snapshot", ".", "size", "(", ")", ";", "//nothing in both", "if", "(", "snapshotSize", "==", "0", "&&", "currentState", ".", "isEmpty", "(", ")", ")", "{", "return", "true", ";", "}", "//snapshot bigger than changeset", "if", "(", "snapshotSize", ">", "currentState", ".", "size", "(", ")", ")", "{", "return", "false", ";", "}", "return", "size", "(", ")", "==", "0", ";", "}" ]
Whether this association contains no rows. @return {@code true} if this association contains no rows, {@code false} otherwise
[ "Whether", "this", "association", "contains", "no", "rows", "." ]
9ea971df7c27277029006a6f748d8272fb1d69d2
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/model/spi/Association.java#L132-L143
160,634
hibernate/hibernate-ogm
core/src/main/java/org/hibernate/ogm/model/spi/Association.java
Association.size
public int size() { int size = cleared ? 0 : snapshot.size(); for ( Map.Entry<RowKey,AssociationOperation> op : currentState.entrySet() ) { switch ( op.getValue().getType() ) { case PUT: if ( cleared || !snapshot.containsKey( op.getKey() ) ) { size++; } break; case REMOVE: if ( !cleared && snapshot.containsKey( op.getKey() ) ) { size--; } break; } } return size; }
java
public int size() { int size = cleared ? 0 : snapshot.size(); for ( Map.Entry<RowKey,AssociationOperation> op : currentState.entrySet() ) { switch ( op.getValue().getType() ) { case PUT: if ( cleared || !snapshot.containsKey( op.getKey() ) ) { size++; } break; case REMOVE: if ( !cleared && snapshot.containsKey( op.getKey() ) ) { size--; } break; } } return size; }
[ "public", "int", "size", "(", ")", "{", "int", "size", "=", "cleared", "?", "0", ":", "snapshot", ".", "size", "(", ")", ";", "for", "(", "Map", ".", "Entry", "<", "RowKey", ",", "AssociationOperation", ">", "op", ":", "currentState", ".", "entrySet", "(", ")", ")", "{", "switch", "(", "op", ".", "getValue", "(", ")", ".", "getType", "(", ")", ")", "{", "case", "PUT", ":", "if", "(", "cleared", "||", "!", "snapshot", ".", "containsKey", "(", "op", ".", "getKey", "(", ")", ")", ")", "{", "size", "++", ";", "}", "break", ";", "case", "REMOVE", ":", "if", "(", "!", "cleared", "&&", "snapshot", ".", "containsKey", "(", "op", ".", "getKey", "(", ")", ")", ")", "{", "size", "--", ";", "}", "break", ";", "}", "}", "return", "size", ";", "}" ]
Returns the number of rows within this association. @return the number of rows within this association
[ "Returns", "the", "number", "of", "rows", "within", "this", "association", "." ]
9ea971df7c27277029006a6f748d8272fb1d69d2
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/model/spi/Association.java#L150-L167
160,635
hibernate/hibernate-ogm
core/src/main/java/org/hibernate/ogm/model/spi/Association.java
Association.getKeys
public Iterable<RowKey> getKeys() { if ( currentState.isEmpty() ) { if ( cleared ) { // if the association has been cleared and the currentState is empty, we consider that there are no rows. return Collections.emptyList(); } else { // otherwise, the snapshot rows are the current ones return snapshot.getRowKeys(); } } else { // It may be a bit too large in case of removals, but that's fine for now Set<RowKey> keys = CollectionHelper.newLinkedHashSet( cleared ? currentState.size() : snapshot.size() + currentState.size() ); if ( !cleared ) { // we add the snapshot RowKeys only if the association has not been cleared for ( RowKey rowKey : snapshot.getRowKeys() ) { keys.add( rowKey ); } } for ( Map.Entry<RowKey,AssociationOperation> op : currentState.entrySet() ) { switch ( op.getValue().getType() ) { case PUT: keys.add( op.getKey() ); break; case REMOVE: keys.remove( op.getKey() ); break; } } return keys; } }
java
public Iterable<RowKey> getKeys() { if ( currentState.isEmpty() ) { if ( cleared ) { // if the association has been cleared and the currentState is empty, we consider that there are no rows. return Collections.emptyList(); } else { // otherwise, the snapshot rows are the current ones return snapshot.getRowKeys(); } } else { // It may be a bit too large in case of removals, but that's fine for now Set<RowKey> keys = CollectionHelper.newLinkedHashSet( cleared ? currentState.size() : snapshot.size() + currentState.size() ); if ( !cleared ) { // we add the snapshot RowKeys only if the association has not been cleared for ( RowKey rowKey : snapshot.getRowKeys() ) { keys.add( rowKey ); } } for ( Map.Entry<RowKey,AssociationOperation> op : currentState.entrySet() ) { switch ( op.getValue().getType() ) { case PUT: keys.add( op.getKey() ); break; case REMOVE: keys.remove( op.getKey() ); break; } } return keys; } }
[ "public", "Iterable", "<", "RowKey", ">", "getKeys", "(", ")", "{", "if", "(", "currentState", ".", "isEmpty", "(", ")", ")", "{", "if", "(", "cleared", ")", "{", "// if the association has been cleared and the currentState is empty, we consider that there are no rows.", "return", "Collections", ".", "emptyList", "(", ")", ";", "}", "else", "{", "// otherwise, the snapshot rows are the current ones", "return", "snapshot", ".", "getRowKeys", "(", ")", ";", "}", "}", "else", "{", "// It may be a bit too large in case of removals, but that's fine for now", "Set", "<", "RowKey", ">", "keys", "=", "CollectionHelper", ".", "newLinkedHashSet", "(", "cleared", "?", "currentState", ".", "size", "(", ")", ":", "snapshot", ".", "size", "(", ")", "+", "currentState", ".", "size", "(", ")", ")", ";", "if", "(", "!", "cleared", ")", "{", "// we add the snapshot RowKeys only if the association has not been cleared", "for", "(", "RowKey", "rowKey", ":", "snapshot", ".", "getRowKeys", "(", ")", ")", "{", "keys", ".", "add", "(", "rowKey", ")", ";", "}", "}", "for", "(", "Map", ".", "Entry", "<", "RowKey", ",", "AssociationOperation", ">", "op", ":", "currentState", ".", "entrySet", "(", ")", ")", "{", "switch", "(", "op", ".", "getValue", "(", ")", ".", "getType", "(", ")", ")", "{", "case", "PUT", ":", "keys", ".", "add", "(", "op", ".", "getKey", "(", ")", ")", ";", "break", ";", "case", "REMOVE", ":", "keys", ".", "remove", "(", "op", ".", "getKey", "(", ")", ")", ";", "break", ";", "}", "}", "return", "keys", ";", "}", "}" ]
Returns all keys of all rows contained within this association. @return all keys of all rows contained within this association
[ "Returns", "all", "keys", "of", "all", "rows", "contained", "within", "this", "association", "." ]
9ea971df7c27277029006a6f748d8272fb1d69d2
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/model/spi/Association.java#L174-L209
160,636
hibernate/hibernate-ogm
core/src/main/java/org/hibernate/ogm/model/key/spi/RowKey.java
RowKey.getColumnValue
public Object getColumnValue(String columnName) { for ( int j = 0; j < columnNames.length; j++ ) { if ( columnNames[j].equals( columnName ) ) { return columnValues[j]; } } return null; }
java
public Object getColumnValue(String columnName) { for ( int j = 0; j < columnNames.length; j++ ) { if ( columnNames[j].equals( columnName ) ) { return columnValues[j]; } } return null; }
[ "public", "Object", "getColumnValue", "(", "String", "columnName", ")", "{", "for", "(", "int", "j", "=", "0", ";", "j", "<", "columnNames", ".", "length", ";", "j", "++", ")", "{", "if", "(", "columnNames", "[", "j", "]", ".", "equals", "(", "columnName", ")", ")", "{", "return", "columnValues", "[", "j", "]", ";", "}", "}", "return", "null", ";", "}" ]
Get the value of the specified column. @param columnName the name of the column @return the corresponding value of the column, {@code null} if the column does not exist in the row key
[ "Get", "the", "value", "of", "the", "specified", "column", "." ]
9ea971df7c27277029006a6f748d8272fb1d69d2
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/model/key/spi/RowKey.java#L57-L64
160,637
hibernate/hibernate-ogm
core/src/main/java/org/hibernate/ogm/model/key/spi/RowKey.java
RowKey.contains
public boolean contains(String column) { for ( String columnName : columnNames ) { if ( columnName.equals( column ) ) { return true; } } return false; }
java
public boolean contains(String column) { for ( String columnName : columnNames ) { if ( columnName.equals( column ) ) { return true; } } return false; }
[ "public", "boolean", "contains", "(", "String", "column", ")", "{", "for", "(", "String", "columnName", ":", "columnNames", ")", "{", "if", "(", "columnName", ".", "equals", "(", "column", ")", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}" ]
Check if a column is part of the row key columns. @param column the name of the column to check @return true if the column is one of the row key columns, false otherwise
[ "Check", "if", "a", "column", "is", "part", "of", "the", "row", "key", "columns", "." ]
9ea971df7c27277029006a6f748d8272fb1d69d2
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/model/key/spi/RowKey.java#L72-L79
160,638
hibernate/hibernate-ogm
infinispan-remote/src/main/java/org/hibernate/ogm/datastore/infinispanremote/configuration/impl/InfinispanRemoteConfiguration.java
InfinispanRemoteConfiguration.loadResourceFile
private void loadResourceFile(URL configurationResourceUrl, Properties hotRodConfiguration) { if ( configurationResourceUrl != null ) { try ( InputStream openStream = configurationResourceUrl.openStream() ) { hotRodConfiguration.load( openStream ); } catch (IOException e) { throw log.failedLoadingHotRodConfigurationProperties( e ); } } }
java
private void loadResourceFile(URL configurationResourceUrl, Properties hotRodConfiguration) { if ( configurationResourceUrl != null ) { try ( InputStream openStream = configurationResourceUrl.openStream() ) { hotRodConfiguration.load( openStream ); } catch (IOException e) { throw log.failedLoadingHotRodConfigurationProperties( e ); } } }
[ "private", "void", "loadResourceFile", "(", "URL", "configurationResourceUrl", ",", "Properties", "hotRodConfiguration", ")", "{", "if", "(", "configurationResourceUrl", "!=", "null", ")", "{", "try", "(", "InputStream", "openStream", "=", "configurationResourceUrl", ".", "openStream", "(", ")", ")", "{", "hotRodConfiguration", ".", "load", "(", "openStream", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "log", ".", "failedLoadingHotRodConfigurationProperties", "(", "e", ")", ";", "}", "}", "}" ]
Load the properties from the resource file if one is specified
[ "Load", "the", "properties", "from", "the", "resource", "file", "if", "one", "is", "specified" ]
9ea971df7c27277029006a6f748d8272fb1d69d2
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/infinispan-remote/src/main/java/org/hibernate/ogm/datastore/infinispanremote/configuration/impl/InfinispanRemoteConfiguration.java#L276-L285
160,639
hibernate/hibernate-ogm
core/src/main/java/org/hibernate/ogm/options/navigation/source/impl/OptionValueSources.java
OptionValueSources.invokeOptionConfigurator
private static <D extends DatastoreConfiguration<G>, G extends GlobalContext<?, ?>> AppendableConfigurationContext invokeOptionConfigurator( OptionConfigurator configurator) { ConfigurableImpl configurable = new ConfigurableImpl(); configurator.configure( configurable ); return configurable.getContext(); }
java
private static <D extends DatastoreConfiguration<G>, G extends GlobalContext<?, ?>> AppendableConfigurationContext invokeOptionConfigurator( OptionConfigurator configurator) { ConfigurableImpl configurable = new ConfigurableImpl(); configurator.configure( configurable ); return configurable.getContext(); }
[ "private", "static", "<", "D", "extends", "DatastoreConfiguration", "<", "G", ">", ",", "G", "extends", "GlobalContext", "<", "?", ",", "?", ">", ">", "AppendableConfigurationContext", "invokeOptionConfigurator", "(", "OptionConfigurator", "configurator", ")", "{", "ConfigurableImpl", "configurable", "=", "new", "ConfigurableImpl", "(", ")", ";", "configurator", ".", "configure", "(", "configurable", ")", ";", "return", "configurable", ".", "getContext", "(", ")", ";", "}" ]
Invokes the given configurator, obtaining the correct global context type via the datastore configuration type of the current datastore provider. @param configurator the configurator to invoke @return a context object containing the options set via the given configurator
[ "Invokes", "the", "given", "configurator", "obtaining", "the", "correct", "global", "context", "type", "via", "the", "datastore", "configuration", "type", "of", "the", "current", "datastore", "provider", "." ]
9ea971df7c27277029006a6f748d8272fb1d69d2
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/options/navigation/source/impl/OptionValueSources.java#L66-L72
160,640
hibernate/hibernate-ogm
core/src/main/java/org/hibernate/ogm/model/impl/DefaultEntityKeyMetadata.java
DefaultEntityKeyMetadata.isKeyColumn
@Override public boolean isKeyColumn(String columnName) { for ( String keyColumName : getColumnNames() ) { if ( keyColumName.equals( columnName ) ) { return true; } } return false; }
java
@Override public boolean isKeyColumn(String columnName) { for ( String keyColumName : getColumnNames() ) { if ( keyColumName.equals( columnName ) ) { return true; } } return false; }
[ "@", "Override", "public", "boolean", "isKeyColumn", "(", "String", "columnName", ")", "{", "for", "(", "String", "keyColumName", ":", "getColumnNames", "(", ")", ")", "{", "if", "(", "keyColumName", ".", "equals", "(", "columnName", ")", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}" ]
Whether the given column is part of this key family or not. @return {@code true} if the given column is part of this key, {@code false} otherwise.
[ "Whether", "the", "given", "column", "is", "part", "of", "this", "key", "family", "or", "not", "." ]
9ea971df7c27277029006a6f748d8272fb1d69d2
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/model/impl/DefaultEntityKeyMetadata.java#L49-L58
160,641
hibernate/hibernate-ogm
core/src/main/java/org/hibernate/ogm/loader/impl/OgmLoader.java
OgmLoader.loadEntitiesFromTuples
@Override public List<Object> loadEntitiesFromTuples(SharedSessionContractImplementor session, LockOptions lockOptions, OgmLoadingContext ogmContext) { return loadEntity( null, null, session, lockOptions, ogmContext ); }
java
@Override public List<Object> loadEntitiesFromTuples(SharedSessionContractImplementor session, LockOptions lockOptions, OgmLoadingContext ogmContext) { return loadEntity( null, null, session, lockOptions, ogmContext ); }
[ "@", "Override", "public", "List", "<", "Object", ">", "loadEntitiesFromTuples", "(", "SharedSessionContractImplementor", "session", ",", "LockOptions", "lockOptions", ",", "OgmLoadingContext", "ogmContext", ")", "{", "return", "loadEntity", "(", "null", ",", "null", ",", "session", ",", "lockOptions", ",", "ogmContext", ")", ";", "}" ]
Load a list of entities using the information in the context @param session The session @param lockOptions The locking details @param ogmContext The context with the information to load the entities @return the list of entities corresponding to the given context
[ "Load", "a", "list", "of", "entities", "using", "the", "information", "in", "the", "context" ]
9ea971df7c27277029006a6f748d8272fb1d69d2
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/loader/impl/OgmLoader.java#L219-L222
160,642
hibernate/hibernate-ogm
core/src/main/java/org/hibernate/ogm/loader/impl/OgmLoader.java
OgmLoader.loadCollection
public final void loadCollection( final SharedSessionContractImplementor session, final Serializable id, final Type type) throws HibernateException { if ( log.isDebugEnabled() ) { log.debug( "loading collection: " + MessageHelper.collectionInfoString( getCollectionPersisters()[0], id, getFactory() ) ); } Serializable[] ids = new Serializable[]{id}; QueryParameters qp = new QueryParameters( new Type[]{type}, ids, ids ); doQueryAndInitializeNonLazyCollections( session, qp, OgmLoadingContext.EMPTY_CONTEXT, true ); log.debug( "done loading collection" ); }
java
public final void loadCollection( final SharedSessionContractImplementor session, final Serializable id, final Type type) throws HibernateException { if ( log.isDebugEnabled() ) { log.debug( "loading collection: " + MessageHelper.collectionInfoString( getCollectionPersisters()[0], id, getFactory() ) ); } Serializable[] ids = new Serializable[]{id}; QueryParameters qp = new QueryParameters( new Type[]{type}, ids, ids ); doQueryAndInitializeNonLazyCollections( session, qp, OgmLoadingContext.EMPTY_CONTEXT, true ); log.debug( "done loading collection" ); }
[ "public", "final", "void", "loadCollection", "(", "final", "SharedSessionContractImplementor", "session", ",", "final", "Serializable", "id", ",", "final", "Type", "type", ")", "throws", "HibernateException", "{", "if", "(", "log", ".", "isDebugEnabled", "(", ")", ")", "{", "log", ".", "debug", "(", "\"loading collection: \"", "+", "MessageHelper", ".", "collectionInfoString", "(", "getCollectionPersisters", "(", ")", "[", "0", "]", ",", "id", ",", "getFactory", "(", ")", ")", ")", ";", "}", "Serializable", "[", "]", "ids", "=", "new", "Serializable", "[", "]", "{", "id", "}", ";", "QueryParameters", "qp", "=", "new", "QueryParameters", "(", "new", "Type", "[", "]", "{", "type", "}", ",", "ids", ",", "ids", ")", ";", "doQueryAndInitializeNonLazyCollections", "(", "session", ",", "qp", ",", "OgmLoadingContext", ".", "EMPTY_CONTEXT", ",", "true", ")", ";", "log", ".", "debug", "(", "\"done loading collection\"", ")", ";", "}" ]
Called by subclasses that initialize collections @param session the session @param id the collection identifier @param type collection type @throws HibernateException if an error occurs
[ "Called", "by", "subclasses", "that", "initialize", "collections" ]
9ea971df7c27277029006a6f748d8272fb1d69d2
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/loader/impl/OgmLoader.java#L232-L255
160,643
hibernate/hibernate-ogm
core/src/main/java/org/hibernate/ogm/loader/impl/OgmLoader.java
OgmLoader.doQueryAndInitializeNonLazyCollections
private List<Object> doQueryAndInitializeNonLazyCollections( SharedSessionContractImplementor session, QueryParameters qp, OgmLoadingContext ogmLoadingContext, boolean returnProxies) { //TODO handles the read only final PersistenceContext persistenceContext = session.getPersistenceContext(); boolean defaultReadOnlyOrig = persistenceContext.isDefaultReadOnly(); persistenceContext.beforeLoad(); List<Object> result; try { try { result = doQuery( session, qp, ogmLoadingContext, returnProxies ); } finally { persistenceContext.afterLoad(); } persistenceContext.initializeNonLazyCollections(); } finally { // Restore the original default persistenceContext.setDefaultReadOnly( defaultReadOnlyOrig ); } log.debug( "done entity load" ); return result; }
java
private List<Object> doQueryAndInitializeNonLazyCollections( SharedSessionContractImplementor session, QueryParameters qp, OgmLoadingContext ogmLoadingContext, boolean returnProxies) { //TODO handles the read only final PersistenceContext persistenceContext = session.getPersistenceContext(); boolean defaultReadOnlyOrig = persistenceContext.isDefaultReadOnly(); persistenceContext.beforeLoad(); List<Object> result; try { try { result = doQuery( session, qp, ogmLoadingContext, returnProxies ); } finally { persistenceContext.afterLoad(); } persistenceContext.initializeNonLazyCollections(); } finally { // Restore the original default persistenceContext.setDefaultReadOnly( defaultReadOnlyOrig ); } log.debug( "done entity load" ); return result; }
[ "private", "List", "<", "Object", ">", "doQueryAndInitializeNonLazyCollections", "(", "SharedSessionContractImplementor", "session", ",", "QueryParameters", "qp", ",", "OgmLoadingContext", "ogmLoadingContext", ",", "boolean", "returnProxies", ")", "{", "//TODO handles the read only", "final", "PersistenceContext", "persistenceContext", "=", "session", ".", "getPersistenceContext", "(", ")", ";", "boolean", "defaultReadOnlyOrig", "=", "persistenceContext", ".", "isDefaultReadOnly", "(", ")", ";", "persistenceContext", ".", "beforeLoad", "(", ")", ";", "List", "<", "Object", ">", "result", ";", "try", "{", "try", "{", "result", "=", "doQuery", "(", "session", ",", "qp", ",", "ogmLoadingContext", ",", "returnProxies", ")", ";", "}", "finally", "{", "persistenceContext", ".", "afterLoad", "(", ")", ";", "}", "persistenceContext", ".", "initializeNonLazyCollections", "(", ")", ";", "}", "finally", "{", "// Restore the original default", "persistenceContext", ".", "setDefaultReadOnly", "(", "defaultReadOnlyOrig", ")", ";", "}", "log", ".", "debug", "(", "\"done entity load\"", ")", ";", "return", "result", ";", "}" ]
Load the entity activating the persistence context execution boundaries @param session the session @param qp the query parameters @param ogmLoadingContext the loading context @param returnProxies when {@code true}, get an existing proxy for each collection element (if there is one) @return the result of the query
[ "Load", "the", "entity", "activating", "the", "persistence", "context", "execution", "boundaries" ]
9ea971df7c27277029006a6f748d8272fb1d69d2
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/loader/impl/OgmLoader.java#L270-L303
160,644
hibernate/hibernate-ogm
core/src/main/java/org/hibernate/ogm/loader/impl/OgmLoader.java
OgmLoader.doQuery
private List<Object> doQuery( SharedSessionContractImplementor session, QueryParameters qp, OgmLoadingContext ogmLoadingContext, boolean returnProxies) { //TODO support lock timeout int entitySpan = entityPersisters.length; final List<Object> hydratedObjects = entitySpan == 0 ? null : new ArrayList<Object>( entitySpan * 10 ); //TODO yuk! Is there a cleaner way to access the id? final Serializable id; // see if we use batching first // then look for direct id // then for a tuple based result set we could extract the id // otherwise that's a collection so we use the collection key boolean loadSeveralIds = loadSeveralIds( qp ); boolean isCollectionLoader; if ( loadSeveralIds ) { // need to be set to null otherwise the optionalId has precedence // and is used for all tuples regardless of their actual ids id = null; isCollectionLoader = false; } else if ( qp.getOptionalId() != null ) { id = qp.getOptionalId(); isCollectionLoader = false; } else if ( ogmLoadingContext.hasResultSet() ) { // extract the ids from the tuples directly id = null; isCollectionLoader = false; } else { id = qp.getCollectionKeys()[0]; isCollectionLoader = true; } TupleAsMapResultSet resultset = getResultSet( id, qp, ogmLoadingContext, session ); //Todo implement lockmode //final LockMode[] lockModesArray = getLockModes( queryParameters.getLockOptions() ); //FIXME should we use subselects as it's closer to this process?? //TODO is resultset a good marker, or should it be an ad-hoc marker?? //It likely all depends on what resultset ends up being handleEmptyCollections( qp.getCollectionKeys(), resultset, session ); final org.hibernate.engine.spi.EntityKey[] keys = new org.hibernate.engine.spi.EntityKey[entitySpan]; //for each element in resultset //TODO should we collect List<Object> as result? Not necessary today Object result = null; List<Object> results = new ArrayList<Object>(); if ( isCollectionLoader ) { preLoadBatchFetchingQueue( session, resultset ); } try { while ( resultset.next() ) { result = getRowFromResultSet( resultset, session, qp, ogmLoadingContext, //lockmodeArray, id, hydratedObjects, keys, returnProxies ); results.add( result ); } //TODO collect subselect result key } catch ( SQLException e ) { //never happens this is not a regular ResultSet } //end of for each element in resultset initializeEntitiesAndCollections( hydratedObjects, resultset, session, qp.isReadOnly( session ) ); //TODO create subselects return results; }
java
private List<Object> doQuery( SharedSessionContractImplementor session, QueryParameters qp, OgmLoadingContext ogmLoadingContext, boolean returnProxies) { //TODO support lock timeout int entitySpan = entityPersisters.length; final List<Object> hydratedObjects = entitySpan == 0 ? null : new ArrayList<Object>( entitySpan * 10 ); //TODO yuk! Is there a cleaner way to access the id? final Serializable id; // see if we use batching first // then look for direct id // then for a tuple based result set we could extract the id // otherwise that's a collection so we use the collection key boolean loadSeveralIds = loadSeveralIds( qp ); boolean isCollectionLoader; if ( loadSeveralIds ) { // need to be set to null otherwise the optionalId has precedence // and is used for all tuples regardless of their actual ids id = null; isCollectionLoader = false; } else if ( qp.getOptionalId() != null ) { id = qp.getOptionalId(); isCollectionLoader = false; } else if ( ogmLoadingContext.hasResultSet() ) { // extract the ids from the tuples directly id = null; isCollectionLoader = false; } else { id = qp.getCollectionKeys()[0]; isCollectionLoader = true; } TupleAsMapResultSet resultset = getResultSet( id, qp, ogmLoadingContext, session ); //Todo implement lockmode //final LockMode[] lockModesArray = getLockModes( queryParameters.getLockOptions() ); //FIXME should we use subselects as it's closer to this process?? //TODO is resultset a good marker, or should it be an ad-hoc marker?? //It likely all depends on what resultset ends up being handleEmptyCollections( qp.getCollectionKeys(), resultset, session ); final org.hibernate.engine.spi.EntityKey[] keys = new org.hibernate.engine.spi.EntityKey[entitySpan]; //for each element in resultset //TODO should we collect List<Object> as result? Not necessary today Object result = null; List<Object> results = new ArrayList<Object>(); if ( isCollectionLoader ) { preLoadBatchFetchingQueue( session, resultset ); } try { while ( resultset.next() ) { result = getRowFromResultSet( resultset, session, qp, ogmLoadingContext, //lockmodeArray, id, hydratedObjects, keys, returnProxies ); results.add( result ); } //TODO collect subselect result key } catch ( SQLException e ) { //never happens this is not a regular ResultSet } //end of for each element in resultset initializeEntitiesAndCollections( hydratedObjects, resultset, session, qp.isReadOnly( session ) ); //TODO create subselects return results; }
[ "private", "List", "<", "Object", ">", "doQuery", "(", "SharedSessionContractImplementor", "session", ",", "QueryParameters", "qp", ",", "OgmLoadingContext", "ogmLoadingContext", ",", "boolean", "returnProxies", ")", "{", "//TODO support lock timeout", "int", "entitySpan", "=", "entityPersisters", ".", "length", ";", "final", "List", "<", "Object", ">", "hydratedObjects", "=", "entitySpan", "==", "0", "?", "null", ":", "new", "ArrayList", "<", "Object", ">", "(", "entitySpan", "*", "10", ")", ";", "//TODO yuk! Is there a cleaner way to access the id?", "final", "Serializable", "id", ";", "// see if we use batching first", "// then look for direct id", "// then for a tuple based result set we could extract the id", "// otherwise that's a collection so we use the collection key", "boolean", "loadSeveralIds", "=", "loadSeveralIds", "(", "qp", ")", ";", "boolean", "isCollectionLoader", ";", "if", "(", "loadSeveralIds", ")", "{", "// need to be set to null otherwise the optionalId has precedence", "// and is used for all tuples regardless of their actual ids", "id", "=", "null", ";", "isCollectionLoader", "=", "false", ";", "}", "else", "if", "(", "qp", ".", "getOptionalId", "(", ")", "!=", "null", ")", "{", "id", "=", "qp", ".", "getOptionalId", "(", ")", ";", "isCollectionLoader", "=", "false", ";", "}", "else", "if", "(", "ogmLoadingContext", ".", "hasResultSet", "(", ")", ")", "{", "// extract the ids from the tuples directly", "id", "=", "null", ";", "isCollectionLoader", "=", "false", ";", "}", "else", "{", "id", "=", "qp", ".", "getCollectionKeys", "(", ")", "[", "0", "]", ";", "isCollectionLoader", "=", "true", ";", "}", "TupleAsMapResultSet", "resultset", "=", "getResultSet", "(", "id", ",", "qp", ",", "ogmLoadingContext", ",", "session", ")", ";", "//Todo implement lockmode", "//final LockMode[] lockModesArray = getLockModes( queryParameters.getLockOptions() );", "//FIXME should we use subselects as it's closer to this process??", "//TODO is resultset a good marker, or should it be an ad-hoc marker??", "//It likely all depends on what resultset ends up being", "handleEmptyCollections", "(", "qp", ".", "getCollectionKeys", "(", ")", ",", "resultset", ",", "session", ")", ";", "final", "org", ".", "hibernate", ".", "engine", ".", "spi", ".", "EntityKey", "[", "]", "keys", "=", "new", "org", ".", "hibernate", ".", "engine", ".", "spi", ".", "EntityKey", "[", "entitySpan", "]", ";", "//for each element in resultset", "//TODO should we collect List<Object> as result? Not necessary today", "Object", "result", "=", "null", ";", "List", "<", "Object", ">", "results", "=", "new", "ArrayList", "<", "Object", ">", "(", ")", ";", "if", "(", "isCollectionLoader", ")", "{", "preLoadBatchFetchingQueue", "(", "session", ",", "resultset", ")", ";", "}", "try", "{", "while", "(", "resultset", ".", "next", "(", ")", ")", "{", "result", "=", "getRowFromResultSet", "(", "resultset", ",", "session", ",", "qp", ",", "ogmLoadingContext", ",", "//lockmodeArray,", "id", ",", "hydratedObjects", ",", "keys", ",", "returnProxies", ")", ";", "results", ".", "add", "(", "result", ")", ";", "}", "//TODO collect subselect result key", "}", "catch", "(", "SQLException", "e", ")", "{", "//never happens this is not a regular ResultSet", "}", "//end of for each element in resultset", "initializeEntitiesAndCollections", "(", "hydratedObjects", ",", "resultset", ",", "session", ",", "qp", ".", "isReadOnly", "(", "session", ")", ")", ";", "//TODO create subselects", "return", "results", ";", "}" ]
Execute the physical query and initialize the various entities and collections @param session the session @param qp the query parameters @param ogmLoadingContext the loading context @param returnProxies when {@code true}, get an existing proxy for each collection element (if there is one) @return the result of the query
[ "Execute", "the", "physical", "query", "and", "initialize", "the", "various", "entities", "and", "collections" ]
9ea971df7c27277029006a6f748d8272fb1d69d2
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/loader/impl/OgmLoader.java#L314-L397
160,645
hibernate/hibernate-ogm
core/src/main/java/org/hibernate/ogm/loader/impl/OgmLoader.java
OgmLoader.readCollectionElement
private void readCollectionElement( final Object optionalOwner, final Serializable optionalKey, final CollectionPersister persister, final CollectionAliases descriptor, final ResultSet rs, final SharedSessionContractImplementor session) throws HibernateException, SQLException { final PersistenceContext persistenceContext = session.getPersistenceContext(); //implement persister.readKey using the grid type (later) final Serializable collectionRowKey = (Serializable) persister.readKey( rs, descriptor.getSuffixedKeyAliases(), session ); if ( collectionRowKey != null ) { // we found a collection element in the result set if ( log.isDebugEnabled() ) { log.debug( "found row of collection: " + MessageHelper.collectionInfoString( persister, collectionRowKey, getFactory() ) ); } Object owner = optionalOwner; if ( owner == null ) { owner = persistenceContext.getCollectionOwner( collectionRowKey, persister ); if ( owner == null ) { //TODO: This is assertion is disabled because there is a bug that means the // original owner of a transient, uninitialized collection is not known // if the collection is re-referenced by a different object associated // with the current Session //throw new AssertionFailure("bug loading unowned collection"); } } PersistentCollection rowCollection = persistenceContext.getLoadContexts() .getCollectionLoadContext( rs ) .getLoadingCollection( persister, collectionRowKey ); if ( rowCollection != null ) { hydrateRowCollection( persister, descriptor, rs, owner, rowCollection ); } } else if ( optionalKey != null ) { // we did not find a collection element in the result set, so we // ensure that a collection is created with the owner's identifier, // since what we have is an empty collection if ( log.isDebugEnabled() ) { log.debug( "result set contains (possibly empty) collection: " + MessageHelper.collectionInfoString( persister, optionalKey, getFactory() ) ); } persistenceContext.getLoadContexts() .getCollectionLoadContext( rs ) .getLoadingCollection( persister, optionalKey ); // handle empty collection } // else no collection element, but also no owner }
java
private void readCollectionElement( final Object optionalOwner, final Serializable optionalKey, final CollectionPersister persister, final CollectionAliases descriptor, final ResultSet rs, final SharedSessionContractImplementor session) throws HibernateException, SQLException { final PersistenceContext persistenceContext = session.getPersistenceContext(); //implement persister.readKey using the grid type (later) final Serializable collectionRowKey = (Serializable) persister.readKey( rs, descriptor.getSuffixedKeyAliases(), session ); if ( collectionRowKey != null ) { // we found a collection element in the result set if ( log.isDebugEnabled() ) { log.debug( "found row of collection: " + MessageHelper.collectionInfoString( persister, collectionRowKey, getFactory() ) ); } Object owner = optionalOwner; if ( owner == null ) { owner = persistenceContext.getCollectionOwner( collectionRowKey, persister ); if ( owner == null ) { //TODO: This is assertion is disabled because there is a bug that means the // original owner of a transient, uninitialized collection is not known // if the collection is re-referenced by a different object associated // with the current Session //throw new AssertionFailure("bug loading unowned collection"); } } PersistentCollection rowCollection = persistenceContext.getLoadContexts() .getCollectionLoadContext( rs ) .getLoadingCollection( persister, collectionRowKey ); if ( rowCollection != null ) { hydrateRowCollection( persister, descriptor, rs, owner, rowCollection ); } } else if ( optionalKey != null ) { // we did not find a collection element in the result set, so we // ensure that a collection is created with the owner's identifier, // since what we have is an empty collection if ( log.isDebugEnabled() ) { log.debug( "result set contains (possibly empty) collection: " + MessageHelper.collectionInfoString( persister, optionalKey, getFactory() ) ); } persistenceContext.getLoadContexts() .getCollectionLoadContext( rs ) .getLoadingCollection( persister, optionalKey ); // handle empty collection } // else no collection element, but also no owner }
[ "private", "void", "readCollectionElement", "(", "final", "Object", "optionalOwner", ",", "final", "Serializable", "optionalKey", ",", "final", "CollectionPersister", "persister", ",", "final", "CollectionAliases", "descriptor", ",", "final", "ResultSet", "rs", ",", "final", "SharedSessionContractImplementor", "session", ")", "throws", "HibernateException", ",", "SQLException", "{", "final", "PersistenceContext", "persistenceContext", "=", "session", ".", "getPersistenceContext", "(", ")", ";", "//implement persister.readKey using the grid type (later)", "final", "Serializable", "collectionRowKey", "=", "(", "Serializable", ")", "persister", ".", "readKey", "(", "rs", ",", "descriptor", ".", "getSuffixedKeyAliases", "(", ")", ",", "session", ")", ";", "if", "(", "collectionRowKey", "!=", "null", ")", "{", "// we found a collection element in the result set", "if", "(", "log", ".", "isDebugEnabled", "(", ")", ")", "{", "log", ".", "debug", "(", "\"found row of collection: \"", "+", "MessageHelper", ".", "collectionInfoString", "(", "persister", ",", "collectionRowKey", ",", "getFactory", "(", ")", ")", ")", ";", "}", "Object", "owner", "=", "optionalOwner", ";", "if", "(", "owner", "==", "null", ")", "{", "owner", "=", "persistenceContext", ".", "getCollectionOwner", "(", "collectionRowKey", ",", "persister", ")", ";", "if", "(", "owner", "==", "null", ")", "{", "//TODO: This is assertion is disabled because there is a bug that means the", "//\t original owner of a transient, uninitialized collection is not known", "//\t if the collection is re-referenced by a different object associated", "//\t with the current Session", "//throw new AssertionFailure(\"bug loading unowned collection\");", "}", "}", "PersistentCollection", "rowCollection", "=", "persistenceContext", ".", "getLoadContexts", "(", ")", ".", "getCollectionLoadContext", "(", "rs", ")", ".", "getLoadingCollection", "(", "persister", ",", "collectionRowKey", ")", ";", "if", "(", "rowCollection", "!=", "null", ")", "{", "hydrateRowCollection", "(", "persister", ",", "descriptor", ",", "rs", ",", "owner", ",", "rowCollection", ")", ";", "}", "}", "else", "if", "(", "optionalKey", "!=", "null", ")", "{", "// we did not find a collection element in the result set, so we", "// ensure that a collection is created with the owner's identifier,", "// since what we have is an empty collection", "if", "(", "log", ".", "isDebugEnabled", "(", ")", ")", "{", "log", ".", "debug", "(", "\"result set contains (possibly empty) collection: \"", "+", "MessageHelper", ".", "collectionInfoString", "(", "persister", ",", "optionalKey", ",", "getFactory", "(", ")", ")", ")", ";", "}", "persistenceContext", ".", "getLoadContexts", "(", ")", ".", "getCollectionLoadContext", "(", "rs", ")", ".", "getLoadingCollection", "(", "persister", ",", "optionalKey", ")", ";", "// handle empty collection", "}", "// else no collection element, but also no owner", "}" ]
Read one collection element from the current row of the JDBC result set @param optionalOwner the collection owner @param optionalKey the collection key @param persister the collection persister @param descriptor the collection aliases @param rs the result set @param session the session @throws HibernateException if an error occurs @throws SQLException if an error occurs during the query execution
[ "Read", "one", "collection", "element", "from", "the", "current", "row", "of", "the", "JDBC", "result", "set" ]
9ea971df7c27277029006a6f748d8272fb1d69d2
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/loader/impl/OgmLoader.java#L686-L755
160,646
hibernate/hibernate-ogm
core/src/main/java/org/hibernate/ogm/loader/impl/OgmLoader.java
OgmLoader.instanceAlreadyLoaded
private void instanceAlreadyLoaded( final Tuple resultset, final int i, //TODO create an interface for this usage final OgmEntityPersister persister, final org.hibernate.engine.spi.EntityKey key, final Object object, final LockMode lockMode, final SharedSessionContractImplementor session) throws HibernateException { if ( !persister.isInstance( object ) ) { throw new WrongClassException( "loaded object was of wrong class " + object.getClass(), key.getIdentifier(), persister.getEntityName() ); } if ( LockMode.NONE != lockMode && upgradeLocks() ) { // no point doing this if NONE was requested final boolean isVersionCheckNeeded = persister.isVersioned() && session.getPersistenceContext().getEntry( object ) .getLockMode().lessThan( lockMode ); // we don't need to worry about existing version being uninitialized // because this block isn't called by a re-entrant load (re-entrant // loads _always_ have lock mode NONE) if ( isVersionCheckNeeded ) { //we only check the version when _upgrading_ lock modes Object oldVersion = session.getPersistenceContext().getEntry( object ).getVersion(); persister.checkVersionAndRaiseSOSE( key.getIdentifier(), oldVersion, session, resultset ); //we need to upgrade the lock mode to the mode requested session.getPersistenceContext().getEntry( object ) .setLockMode( lockMode ); } } }
java
private void instanceAlreadyLoaded( final Tuple resultset, final int i, //TODO create an interface for this usage final OgmEntityPersister persister, final org.hibernate.engine.spi.EntityKey key, final Object object, final LockMode lockMode, final SharedSessionContractImplementor session) throws HibernateException { if ( !persister.isInstance( object ) ) { throw new WrongClassException( "loaded object was of wrong class " + object.getClass(), key.getIdentifier(), persister.getEntityName() ); } if ( LockMode.NONE != lockMode && upgradeLocks() ) { // no point doing this if NONE was requested final boolean isVersionCheckNeeded = persister.isVersioned() && session.getPersistenceContext().getEntry( object ) .getLockMode().lessThan( lockMode ); // we don't need to worry about existing version being uninitialized // because this block isn't called by a re-entrant load (re-entrant // loads _always_ have lock mode NONE) if ( isVersionCheckNeeded ) { //we only check the version when _upgrading_ lock modes Object oldVersion = session.getPersistenceContext().getEntry( object ).getVersion(); persister.checkVersionAndRaiseSOSE( key.getIdentifier(), oldVersion, session, resultset ); //we need to upgrade the lock mode to the mode requested session.getPersistenceContext().getEntry( object ) .setLockMode( lockMode ); } } }
[ "private", "void", "instanceAlreadyLoaded", "(", "final", "Tuple", "resultset", ",", "final", "int", "i", ",", "//TODO create an interface for this usage", "final", "OgmEntityPersister", "persister", ",", "final", "org", ".", "hibernate", ".", "engine", ".", "spi", ".", "EntityKey", "key", ",", "final", "Object", "object", ",", "final", "LockMode", "lockMode", ",", "final", "SharedSessionContractImplementor", "session", ")", "throws", "HibernateException", "{", "if", "(", "!", "persister", ".", "isInstance", "(", "object", ")", ")", "{", "throw", "new", "WrongClassException", "(", "\"loaded object was of wrong class \"", "+", "object", ".", "getClass", "(", ")", ",", "key", ".", "getIdentifier", "(", ")", ",", "persister", ".", "getEntityName", "(", ")", ")", ";", "}", "if", "(", "LockMode", ".", "NONE", "!=", "lockMode", "&&", "upgradeLocks", "(", ")", ")", "{", "// no point doing this if NONE was requested", "final", "boolean", "isVersionCheckNeeded", "=", "persister", ".", "isVersioned", "(", ")", "&&", "session", ".", "getPersistenceContext", "(", ")", ".", "getEntry", "(", "object", ")", ".", "getLockMode", "(", ")", ".", "lessThan", "(", "lockMode", ")", ";", "// we don't need to worry about existing version being uninitialized", "// because this block isn't called by a re-entrant load (re-entrant", "// loads _always_ have lock mode NONE)", "if", "(", "isVersionCheckNeeded", ")", "{", "//we only check the version when _upgrading_ lock modes", "Object", "oldVersion", "=", "session", ".", "getPersistenceContext", "(", ")", ".", "getEntry", "(", "object", ")", ".", "getVersion", "(", ")", ";", "persister", ".", "checkVersionAndRaiseSOSE", "(", "key", ".", "getIdentifier", "(", ")", ",", "oldVersion", ",", "session", ",", "resultset", ")", ";", "//we need to upgrade the lock mode to the mode requested", "session", ".", "getPersistenceContext", "(", ")", ".", "getEntry", "(", "object", ")", ".", "setLockMode", "(", "lockMode", ")", ";", "}", "}", "}" ]
The entity instance is already in the session cache Copied from Loader#instanceAlreadyLoaded
[ "The", "entity", "instance", "is", "already", "in", "the", "session", "cache" ]
9ea971df7c27277029006a6f748d8272fb1d69d2
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/loader/impl/OgmLoader.java#L985-L1020
160,647
hibernate/hibernate-ogm
core/src/main/java/org/hibernate/ogm/loader/impl/OgmLoader.java
OgmLoader.instanceNotYetLoaded
private Object instanceNotYetLoaded( final Tuple resultset, final int i, final Loadable persister, final String rowIdAlias, final org.hibernate.engine.spi.EntityKey key, final LockMode lockMode, final org.hibernate.engine.spi.EntityKey optionalObjectKey, final Object optionalObject, final List hydratedObjects, final SharedSessionContractImplementor session) throws HibernateException { final String instanceClass = getInstanceClass( resultset, i, persister, key.getIdentifier(), session ); final Object object; if ( optionalObjectKey != null && key.equals( optionalObjectKey ) ) { //its the given optional object object = optionalObject; } else { // instantiate a new instance object = session.instantiate( instanceClass, key.getIdentifier() ); } //need to hydrate it. // grab its state from the ResultSet and keep it in the Session // (but don't yet initialize the object itself) // note that we acquire LockMode.READ even if it was not requested LockMode acquiredLockMode = lockMode == LockMode.NONE ? LockMode.READ : lockMode; loadFromResultSet( resultset, i, object, instanceClass, key, rowIdAlias, acquiredLockMode, persister, session ); //materialize associations (and initialize the object) later hydratedObjects.add( object ); return object; }
java
private Object instanceNotYetLoaded( final Tuple resultset, final int i, final Loadable persister, final String rowIdAlias, final org.hibernate.engine.spi.EntityKey key, final LockMode lockMode, final org.hibernate.engine.spi.EntityKey optionalObjectKey, final Object optionalObject, final List hydratedObjects, final SharedSessionContractImplementor session) throws HibernateException { final String instanceClass = getInstanceClass( resultset, i, persister, key.getIdentifier(), session ); final Object object; if ( optionalObjectKey != null && key.equals( optionalObjectKey ) ) { //its the given optional object object = optionalObject; } else { // instantiate a new instance object = session.instantiate( instanceClass, key.getIdentifier() ); } //need to hydrate it. // grab its state from the ResultSet and keep it in the Session // (but don't yet initialize the object itself) // note that we acquire LockMode.READ even if it was not requested LockMode acquiredLockMode = lockMode == LockMode.NONE ? LockMode.READ : lockMode; loadFromResultSet( resultset, i, object, instanceClass, key, rowIdAlias, acquiredLockMode, persister, session ); //materialize associations (and initialize the object) later hydratedObjects.add( object ); return object; }
[ "private", "Object", "instanceNotYetLoaded", "(", "final", "Tuple", "resultset", ",", "final", "int", "i", ",", "final", "Loadable", "persister", ",", "final", "String", "rowIdAlias", ",", "final", "org", ".", "hibernate", ".", "engine", ".", "spi", ".", "EntityKey", "key", ",", "final", "LockMode", "lockMode", ",", "final", "org", ".", "hibernate", ".", "engine", ".", "spi", ".", "EntityKey", "optionalObjectKey", ",", "final", "Object", "optionalObject", ",", "final", "List", "hydratedObjects", ",", "final", "SharedSessionContractImplementor", "session", ")", "throws", "HibernateException", "{", "final", "String", "instanceClass", "=", "getInstanceClass", "(", "resultset", ",", "i", ",", "persister", ",", "key", ".", "getIdentifier", "(", ")", ",", "session", ")", ";", "final", "Object", "object", ";", "if", "(", "optionalObjectKey", "!=", "null", "&&", "key", ".", "equals", "(", "optionalObjectKey", ")", ")", "{", "//its the given optional object", "object", "=", "optionalObject", ";", "}", "else", "{", "// instantiate a new instance", "object", "=", "session", ".", "instantiate", "(", "instanceClass", ",", "key", ".", "getIdentifier", "(", ")", ")", ";", "}", "//need to hydrate it.", "// grab its state from the ResultSet and keep it in the Session", "// (but don't yet initialize the object itself)", "// note that we acquire LockMode.READ even if it was not requested", "LockMode", "acquiredLockMode", "=", "lockMode", "==", "LockMode", ".", "NONE", "?", "LockMode", ".", "READ", ":", "lockMode", ";", "loadFromResultSet", "(", "resultset", ",", "i", ",", "object", ",", "instanceClass", ",", "key", ",", "rowIdAlias", ",", "acquiredLockMode", ",", "persister", ",", "session", ")", ";", "//materialize associations (and initialize the object) later", "hydratedObjects", ".", "add", "(", "object", ")", ";", "return", "object", ";", "}" ]
The entity instance is not in the session cache Copied from Loader#instanceNotYetLoaded
[ "The", "entity", "instance", "is", "not", "in", "the", "session", "cache" ]
9ea971df7c27277029006a6f748d8272fb1d69d2
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/loader/impl/OgmLoader.java#L1027-L1079
160,648
hibernate/hibernate-ogm
core/src/main/java/org/hibernate/ogm/loader/impl/OgmLoader.java
OgmLoader.registerNonExists
private void registerNonExists( final org.hibernate.engine.spi.EntityKey[] keys, final Loadable[] persisters, final SharedSessionContractImplementor session) { final int[] owners = getOwners(); if ( owners != null ) { EntityType[] ownerAssociationTypes = getOwnerAssociationTypes(); for ( int i = 0; i < keys.length; i++ ) { int owner = owners[i]; if ( owner > -1 ) { org.hibernate.engine.spi.EntityKey ownerKey = keys[owner]; if ( keys[i] == null && ownerKey != null ) { final PersistenceContext persistenceContext = session.getPersistenceContext(); /*final boolean isPrimaryKey; final boolean isSpecialOneToOne; if ( ownerAssociationTypes == null || ownerAssociationTypes[i] == null ) { isPrimaryKey = true; isSpecialOneToOne = false; } else { isPrimaryKey = ownerAssociationTypes[i].getRHSUniqueKeyPropertyName()==null; isSpecialOneToOne = ownerAssociationTypes[i].getLHSPropertyName()!=null; }*/ //TODO: can we *always* use the "null property" approach for everything? /*if ( isPrimaryKey && !isSpecialOneToOne ) { persistenceContext.addNonExistantEntityKey( new EntityKey( ownerKey.getIdentifier(), persisters[i], session.getEntityMode() ) ); } else if ( isSpecialOneToOne ) {*/ boolean isOneToOneAssociation = ownerAssociationTypes != null && ownerAssociationTypes[i] != null && ownerAssociationTypes[i].isOneToOne(); if ( isOneToOneAssociation ) { persistenceContext.addNullProperty( ownerKey, ownerAssociationTypes[i].getPropertyName() ); } /*} else { persistenceContext.addNonExistantEntityUniqueKey( new EntityUniqueKey( persisters[i].getEntityName(), ownerAssociationTypes[i].getRHSUniqueKeyPropertyName(), ownerKey.getIdentifier(), persisters[owner].getIdentifierType(), session.getEntityMode() ) ); }*/ } } } } }
java
private void registerNonExists( final org.hibernate.engine.spi.EntityKey[] keys, final Loadable[] persisters, final SharedSessionContractImplementor session) { final int[] owners = getOwners(); if ( owners != null ) { EntityType[] ownerAssociationTypes = getOwnerAssociationTypes(); for ( int i = 0; i < keys.length; i++ ) { int owner = owners[i]; if ( owner > -1 ) { org.hibernate.engine.spi.EntityKey ownerKey = keys[owner]; if ( keys[i] == null && ownerKey != null ) { final PersistenceContext persistenceContext = session.getPersistenceContext(); /*final boolean isPrimaryKey; final boolean isSpecialOneToOne; if ( ownerAssociationTypes == null || ownerAssociationTypes[i] == null ) { isPrimaryKey = true; isSpecialOneToOne = false; } else { isPrimaryKey = ownerAssociationTypes[i].getRHSUniqueKeyPropertyName()==null; isSpecialOneToOne = ownerAssociationTypes[i].getLHSPropertyName()!=null; }*/ //TODO: can we *always* use the "null property" approach for everything? /*if ( isPrimaryKey && !isSpecialOneToOne ) { persistenceContext.addNonExistantEntityKey( new EntityKey( ownerKey.getIdentifier(), persisters[i], session.getEntityMode() ) ); } else if ( isSpecialOneToOne ) {*/ boolean isOneToOneAssociation = ownerAssociationTypes != null && ownerAssociationTypes[i] != null && ownerAssociationTypes[i].isOneToOne(); if ( isOneToOneAssociation ) { persistenceContext.addNullProperty( ownerKey, ownerAssociationTypes[i].getPropertyName() ); } /*} else { persistenceContext.addNonExistantEntityUniqueKey( new EntityUniqueKey( persisters[i].getEntityName(), ownerAssociationTypes[i].getRHSUniqueKeyPropertyName(), ownerKey.getIdentifier(), persisters[owner].getIdentifierType(), session.getEntityMode() ) ); }*/ } } } } }
[ "private", "void", "registerNonExists", "(", "final", "org", ".", "hibernate", ".", "engine", ".", "spi", ".", "EntityKey", "[", "]", "keys", ",", "final", "Loadable", "[", "]", "persisters", ",", "final", "SharedSessionContractImplementor", "session", ")", "{", "final", "int", "[", "]", "owners", "=", "getOwners", "(", ")", ";", "if", "(", "owners", "!=", "null", ")", "{", "EntityType", "[", "]", "ownerAssociationTypes", "=", "getOwnerAssociationTypes", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "keys", ".", "length", ";", "i", "++", ")", "{", "int", "owner", "=", "owners", "[", "i", "]", ";", "if", "(", "owner", ">", "-", "1", ")", "{", "org", ".", "hibernate", ".", "engine", ".", "spi", ".", "EntityKey", "ownerKey", "=", "keys", "[", "owner", "]", ";", "if", "(", "keys", "[", "i", "]", "==", "null", "&&", "ownerKey", "!=", "null", ")", "{", "final", "PersistenceContext", "persistenceContext", "=", "session", ".", "getPersistenceContext", "(", ")", ";", "/*final boolean isPrimaryKey;\n\t\t\t\t\t\tfinal boolean isSpecialOneToOne;\n\t\t\t\t\t\tif ( ownerAssociationTypes == null || ownerAssociationTypes[i] == null ) {\n\t\t\t\t\t\t\tisPrimaryKey = true;\n\t\t\t\t\t\t\tisSpecialOneToOne = false;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tisPrimaryKey = ownerAssociationTypes[i].getRHSUniqueKeyPropertyName()==null;\n\t\t\t\t\t\t\tisSpecialOneToOne = ownerAssociationTypes[i].getLHSPropertyName()!=null;\n\t\t\t\t\t\t}*/", "//TODO: can we *always* use the \"null property\" approach for everything?", "/*if ( isPrimaryKey && !isSpecialOneToOne ) {\n\t\t\t\t\t\t\tpersistenceContext.addNonExistantEntityKey(\n\t\t\t\t\t\t\t\t\tnew EntityKey( ownerKey.getIdentifier(), persisters[i], session.getEntityMode() )\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if ( isSpecialOneToOne ) {*/", "boolean", "isOneToOneAssociation", "=", "ownerAssociationTypes", "!=", "null", "&&", "ownerAssociationTypes", "[", "i", "]", "!=", "null", "&&", "ownerAssociationTypes", "[", "i", "]", ".", "isOneToOne", "(", ")", ";", "if", "(", "isOneToOneAssociation", ")", "{", "persistenceContext", ".", "addNullProperty", "(", "ownerKey", ",", "ownerAssociationTypes", "[", "i", "]", ".", "getPropertyName", "(", ")", ")", ";", "}", "/*}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tpersistenceContext.addNonExistantEntityUniqueKey( new EntityUniqueKey(\n\t\t\t\t\t\t\t\t\tpersisters[i].getEntityName(),\n\t\t\t\t\t\t\t\t\townerAssociationTypes[i].getRHSUniqueKeyPropertyName(),\n\t\t\t\t\t\t\t\t\townerKey.getIdentifier(),\n\t\t\t\t\t\t\t\t\tpersisters[owner].getIdentifierType(),\n\t\t\t\t\t\t\t\t\tsession.getEntityMode()\n\t\t\t\t\t\t\t) );\n\t\t\t\t\t\t}*/", "}", "}", "}", "}", "}" ]
For missing objects associated by one-to-one with another object in the result set, register the fact that the object is missing with the session. copied form Loader#registerNonExists
[ "For", "missing", "objects", "associated", "by", "one", "-", "to", "-", "one", "with", "another", "object", "in", "the", "result", "set", "register", "the", "fact", "that", "the", "object", "is", "missing", "with", "the", "session", "." ]
9ea971df7c27277029006a6f748d8272fb1d69d2
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/loader/impl/OgmLoader.java#L1222-L1279
160,649
hibernate/hibernate-ogm
mongodb/src/main/java/org/hibernate/ogm/datastore/mongodb/query/parsing/nativequery/impl/NativeQueryParser.java
NativeQueryParser.CriteriaOnlyFindQuery
public Rule CriteriaOnlyFindQuery() { return Sequence( !peek().isCliQuery(), JsonParameter( JsonObject() ) , peek().setOperation( Operation.FIND ), peek().setCriteria( match() ) ); }
java
public Rule CriteriaOnlyFindQuery() { return Sequence( !peek().isCliQuery(), JsonParameter( JsonObject() ) , peek().setOperation( Operation.FIND ), peek().setCriteria( match() ) ); }
[ "public", "Rule", "CriteriaOnlyFindQuery", "(", ")", "{", "return", "Sequence", "(", "!", "peek", "(", ")", ".", "isCliQuery", "(", ")", ",", "JsonParameter", "(", "JsonObject", "(", ")", ")", ",", "peek", "(", ")", ".", "setOperation", "(", "Operation", ".", "FIND", ")", ",", "peek", "(", ")", ".", "setCriteria", "(", "match", "(", ")", ")", ")", ";", "}" ]
A find query only given as criterion. Leave it to MongoDB's own parser to handle it. @return the {@link Rule} to identify a find query only
[ "A", "find", "query", "only", "given", "as", "criterion", ".", "Leave", "it", "to", "MongoDB", "s", "own", "parser", "to", "handle", "it", "." ]
9ea971df7c27277029006a6f748d8272fb1d69d2
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/mongodb/src/main/java/org/hibernate/ogm/datastore/mongodb/query/parsing/nativequery/impl/NativeQueryParser.java#L79-L81
160,650
hibernate/hibernate-ogm
core/src/main/java/org/hibernate/ogm/util/impl/ReflectionHelper.java
ReflectionHelper.introspect
public static Map<String, Object> introspect(Object obj) throws IntrospectionException, InvocationTargetException, IllegalAccessException { Map<String, Object> result = new HashMap<>(); BeanInfo info = Introspector.getBeanInfo( obj.getClass() ); for ( PropertyDescriptor pd : info.getPropertyDescriptors() ) { Method reader = pd.getReadMethod(); String name = pd.getName(); if ( reader != null && !"class".equals( name ) ) { result.put( name, reader.invoke( obj ) ); } } return result; }
java
public static Map<String, Object> introspect(Object obj) throws IntrospectionException, InvocationTargetException, IllegalAccessException { Map<String, Object> result = new HashMap<>(); BeanInfo info = Introspector.getBeanInfo( obj.getClass() ); for ( PropertyDescriptor pd : info.getPropertyDescriptors() ) { Method reader = pd.getReadMethod(); String name = pd.getName(); if ( reader != null && !"class".equals( name ) ) { result.put( name, reader.invoke( obj ) ); } } return result; }
[ "public", "static", "Map", "<", "String", ",", "Object", ">", "introspect", "(", "Object", "obj", ")", "throws", "IntrospectionException", ",", "InvocationTargetException", ",", "IllegalAccessException", "{", "Map", "<", "String", ",", "Object", ">", "result", "=", "new", "HashMap", "<>", "(", ")", ";", "BeanInfo", "info", "=", "Introspector", ".", "getBeanInfo", "(", "obj", ".", "getClass", "(", ")", ")", ";", "for", "(", "PropertyDescriptor", "pd", ":", "info", ".", "getPropertyDescriptors", "(", ")", ")", "{", "Method", "reader", "=", "pd", ".", "getReadMethod", "(", ")", ";", "String", "name", "=", "pd", ".", "getName", "(", ")", ";", "if", "(", "reader", "!=", "null", "&&", "!", "\"class\"", ".", "equals", "(", "name", ")", ")", "{", "result", ".", "put", "(", "name", ",", "reader", ".", "invoke", "(", "obj", ")", ")", ";", "}", "}", "return", "result", ";", "}" ]
Introspect the given object. @param obj object for introspection. @return a map containing object's field values. @throws IntrospectionException if an exception occurs during introspection @throws InvocationTargetException if property getter throws an exception @throws IllegalAccessException if property getter is inaccessible
[ "Introspect", "the", "given", "object", "." ]
9ea971df7c27277029006a6f748d8272fb1d69d2
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/util/impl/ReflectionHelper.java#L43-L54
160,651
hibernate/hibernate-ogm
core/src/main/java/org/hibernate/ogm/util/impl/ReflectionHelper.java
ReflectionHelper.propertyExists
public static boolean propertyExists(Class<?> clazz, String property, ElementType elementType) { if ( ElementType.FIELD.equals( elementType ) ) { return getDeclaredField( clazz, property ) != null; } else { String capitalizedPropertyName = capitalize( property ); Method method = getMethod( clazz, PROPERTY_ACCESSOR_PREFIX_GET + capitalizedPropertyName ); if ( method != null && method.getReturnType() != void.class ) { return true; } method = getMethod( clazz, PROPERTY_ACCESSOR_PREFIX_IS + capitalizedPropertyName ); if ( method != null && method.getReturnType() == boolean.class ) { return true; } } return false; }
java
public static boolean propertyExists(Class<?> clazz, String property, ElementType elementType) { if ( ElementType.FIELD.equals( elementType ) ) { return getDeclaredField( clazz, property ) != null; } else { String capitalizedPropertyName = capitalize( property ); Method method = getMethod( clazz, PROPERTY_ACCESSOR_PREFIX_GET + capitalizedPropertyName ); if ( method != null && method.getReturnType() != void.class ) { return true; } method = getMethod( clazz, PROPERTY_ACCESSOR_PREFIX_IS + capitalizedPropertyName ); if ( method != null && method.getReturnType() == boolean.class ) { return true; } } return false; }
[ "public", "static", "boolean", "propertyExists", "(", "Class", "<", "?", ">", "clazz", ",", "String", "property", ",", "ElementType", "elementType", ")", "{", "if", "(", "ElementType", ".", "FIELD", ".", "equals", "(", "elementType", ")", ")", "{", "return", "getDeclaredField", "(", "clazz", ",", "property", ")", "!=", "null", ";", "}", "else", "{", "String", "capitalizedPropertyName", "=", "capitalize", "(", "property", ")", ";", "Method", "method", "=", "getMethod", "(", "clazz", ",", "PROPERTY_ACCESSOR_PREFIX_GET", "+", "capitalizedPropertyName", ")", ";", "if", "(", "method", "!=", "null", "&&", "method", ".", "getReturnType", "(", ")", "!=", "void", ".", "class", ")", "{", "return", "true", ";", "}", "method", "=", "getMethod", "(", "clazz", ",", "PROPERTY_ACCESSOR_PREFIX_IS", "+", "capitalizedPropertyName", ")", ";", "if", "(", "method", "!=", "null", "&&", "method", ".", "getReturnType", "(", ")", "==", "boolean", ".", "class", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}" ]
Whether the specified JavaBeans property exists on the given type or not. @param clazz the type of interest @param property the JavaBeans property name @param elementType the element type to check, must be either {@link ElementType#FIELD} or {@link ElementType#METHOD}. @return {@code true} if the specified property exists, {@code false} otherwise
[ "Whether", "the", "specified", "JavaBeans", "property", "exists", "on", "the", "given", "type", "or", "not", "." ]
9ea971df7c27277029006a6f748d8272fb1d69d2
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/util/impl/ReflectionHelper.java#L65-L84
160,652
hibernate/hibernate-ogm
core/src/main/java/org/hibernate/ogm/util/impl/ReflectionHelper.java
ReflectionHelper.setField
public static void setField(Object object, String field, Object value) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException { Class<?> clazz = object.getClass(); Method m = clazz.getMethod( PROPERTY_ACCESSOR_PREFIX_SET + capitalize( field ), value.getClass() ); m.invoke( object, value ); }
java
public static void setField(Object object, String field, Object value) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException { Class<?> clazz = object.getClass(); Method m = clazz.getMethod( PROPERTY_ACCESSOR_PREFIX_SET + capitalize( field ), value.getClass() ); m.invoke( object, value ); }
[ "public", "static", "void", "setField", "(", "Object", "object", ",", "String", "field", ",", "Object", "value", ")", "throws", "NoSuchMethodException", ",", "InvocationTargetException", ",", "IllegalAccessException", "{", "Class", "<", "?", ">", "clazz", "=", "object", ".", "getClass", "(", ")", ";", "Method", "m", "=", "clazz", ".", "getMethod", "(", "PROPERTY_ACCESSOR_PREFIX_SET", "+", "capitalize", "(", "field", ")", ",", "value", ".", "getClass", "(", ")", ")", ";", "m", ".", "invoke", "(", "object", ",", "value", ")", ";", "}" ]
Set value for given object field. @param object object to be updated @param field field name @param value field value @throws NoSuchMethodException if property writer is not available @throws InvocationTargetException if property writer throws an exception @throws IllegalAccessException if property writer is inaccessible
[ "Set", "value", "for", "given", "object", "field", "." ]
9ea971df7c27277029006a6f748d8272fb1d69d2
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/util/impl/ReflectionHelper.java#L127-L131
160,653
hibernate/hibernate-ogm
core/src/main/java/org/hibernate/ogm/query/parsing/impl/ParserPropertyHelper.java
ParserPropertyHelper.isEmbeddedProperty
public boolean isEmbeddedProperty(String targetTypeName, List<String> namesWithoutAlias) { OgmEntityPersister persister = getPersister( targetTypeName ); Type propertyType = persister.getPropertyType( namesWithoutAlias.get( 0 ) ); if ( propertyType.isComponentType() ) { // Embedded return true; } else if ( propertyType.isAssociationType() ) { Joinable associatedJoinable = ( (AssociationType) propertyType ).getAssociatedJoinable( persister.getFactory() ); if ( associatedJoinable.isCollection() ) { OgmCollectionPersister collectionPersister = (OgmCollectionPersister) associatedJoinable; return collectionPersister.getType().isComponentType(); } } return false; }
java
public boolean isEmbeddedProperty(String targetTypeName, List<String> namesWithoutAlias) { OgmEntityPersister persister = getPersister( targetTypeName ); Type propertyType = persister.getPropertyType( namesWithoutAlias.get( 0 ) ); if ( propertyType.isComponentType() ) { // Embedded return true; } else if ( propertyType.isAssociationType() ) { Joinable associatedJoinable = ( (AssociationType) propertyType ).getAssociatedJoinable( persister.getFactory() ); if ( associatedJoinable.isCollection() ) { OgmCollectionPersister collectionPersister = (OgmCollectionPersister) associatedJoinable; return collectionPersister.getType().isComponentType(); } } return false; }
[ "public", "boolean", "isEmbeddedProperty", "(", "String", "targetTypeName", ",", "List", "<", "String", ">", "namesWithoutAlias", ")", "{", "OgmEntityPersister", "persister", "=", "getPersister", "(", "targetTypeName", ")", ";", "Type", "propertyType", "=", "persister", ".", "getPropertyType", "(", "namesWithoutAlias", ".", "get", "(", "0", ")", ")", ";", "if", "(", "propertyType", ".", "isComponentType", "(", ")", ")", "{", "// Embedded", "return", "true", ";", "}", "else", "if", "(", "propertyType", ".", "isAssociationType", "(", ")", ")", "{", "Joinable", "associatedJoinable", "=", "(", "(", "AssociationType", ")", "propertyType", ")", ".", "getAssociatedJoinable", "(", "persister", ".", "getFactory", "(", ")", ")", ";", "if", "(", "associatedJoinable", ".", "isCollection", "(", ")", ")", "{", "OgmCollectionPersister", "collectionPersister", "=", "(", "OgmCollectionPersister", ")", "associatedJoinable", ";", "return", "collectionPersister", ".", "getType", "(", ")", ".", "isComponentType", "(", ")", ";", "}", "}", "return", "false", ";", "}" ]
Checks if the path leads to an embedded property or association. @param targetTypeName the entity with the property @param namesWithoutAlias the path to the property with all the aliases resolved @return {@code true} if the property is an embedded, {@code false} otherwise.
[ "Checks", "if", "the", "path", "leads", "to", "an", "embedded", "property", "or", "association", "." ]
9ea971df7c27277029006a6f748d8272fb1d69d2
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/query/parsing/impl/ParserPropertyHelper.java#L158-L173
160,654
hibernate/hibernate-ogm
core/src/main/java/org/hibernate/ogm/query/parsing/impl/ParserPropertyHelper.java
ParserPropertyHelper.isAssociation
public boolean isAssociation(String targetTypeName, List<String> pathWithoutAlias) { OgmEntityPersister persister = getPersister( targetTypeName ); Type propertyType = persister.getPropertyType( pathWithoutAlias.get( 0 ) ); return propertyType.isAssociationType(); }
java
public boolean isAssociation(String targetTypeName, List<String> pathWithoutAlias) { OgmEntityPersister persister = getPersister( targetTypeName ); Type propertyType = persister.getPropertyType( pathWithoutAlias.get( 0 ) ); return propertyType.isAssociationType(); }
[ "public", "boolean", "isAssociation", "(", "String", "targetTypeName", ",", "List", "<", "String", ">", "pathWithoutAlias", ")", "{", "OgmEntityPersister", "persister", "=", "getPersister", "(", "targetTypeName", ")", ";", "Type", "propertyType", "=", "persister", ".", "getPropertyType", "(", "pathWithoutAlias", ".", "get", "(", "0", ")", ")", ";", "return", "propertyType", ".", "isAssociationType", "(", ")", ";", "}" ]
Check if the path to the property correspond to an association. @param targetTypeName the name of the entity containing the property @param pathWithoutAlias the path to the property WITHOUT aliases @return {@code true} if the property is an association or {@code false} otherwise
[ "Check", "if", "the", "path", "to", "the", "property", "correspond", "to", "an", "association", "." ]
9ea971df7c27277029006a6f748d8272fb1d69d2
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/query/parsing/impl/ParserPropertyHelper.java#L182-L186
160,655
hibernate/hibernate-ogm
core/src/main/java/org/hibernate/ogm/query/parsing/impl/ParserPropertyHelper.java
ParserPropertyHelper.findAssociationPath
public List<String> findAssociationPath(String targetTypeName, List<String> pathWithoutAlias) { List<String> subPath = new ArrayList<String>( pathWithoutAlias.size() ); for ( String name : pathWithoutAlias ) { subPath.add( name ); if ( isAssociation( targetTypeName, subPath ) ) { return subPath; } } return null; }
java
public List<String> findAssociationPath(String targetTypeName, List<String> pathWithoutAlias) { List<String> subPath = new ArrayList<String>( pathWithoutAlias.size() ); for ( String name : pathWithoutAlias ) { subPath.add( name ); if ( isAssociation( targetTypeName, subPath ) ) { return subPath; } } return null; }
[ "public", "List", "<", "String", ">", "findAssociationPath", "(", "String", "targetTypeName", ",", "List", "<", "String", ">", "pathWithoutAlias", ")", "{", "List", "<", "String", ">", "subPath", "=", "new", "ArrayList", "<", "String", ">", "(", "pathWithoutAlias", ".", "size", "(", ")", ")", ";", "for", "(", "String", "name", ":", "pathWithoutAlias", ")", "{", "subPath", ".", "add", "(", "name", ")", ";", "if", "(", "isAssociation", "(", "targetTypeName", ",", "subPath", ")", ")", "{", "return", "subPath", ";", "}", "}", "return", "null", ";", "}" ]
Find the path to the first association in the property path. @param targetTypeName the entity with the property @param pathWithoutAlias the path to the property WITHOUT the alias @return the path to the first association or {@code null} if there isn't an association in the property path
[ "Find", "the", "path", "to", "the", "first", "association", "in", "the", "property", "path", "." ]
9ea971df7c27277029006a6f748d8272fb1d69d2
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/query/parsing/impl/ParserPropertyHelper.java#L195-L204
160,656
hibernate/hibernate-ogm
core/src/main/java/org/hibernate/ogm/datastore/document/association/spi/AssociationRow.java
AssociationRow.buildRowKey
private static <R> RowKey buildRowKey(AssociationKey associationKey, R row, AssociationRowAccessor<R> accessor) { String[] columnNames = associationKey.getMetadata().getRowKeyColumnNames(); Object[] columnValues = new Object[columnNames.length]; for ( int i = 0; i < columnNames.length; i++ ) { String columnName = columnNames[i]; columnValues[i] = associationKey.getMetadata().isKeyColumn( columnName ) ? associationKey.getColumnValue( columnName ) : accessor.get( row, columnName ); } return new RowKey( columnNames, columnValues ); }
java
private static <R> RowKey buildRowKey(AssociationKey associationKey, R row, AssociationRowAccessor<R> accessor) { String[] columnNames = associationKey.getMetadata().getRowKeyColumnNames(); Object[] columnValues = new Object[columnNames.length]; for ( int i = 0; i < columnNames.length; i++ ) { String columnName = columnNames[i]; columnValues[i] = associationKey.getMetadata().isKeyColumn( columnName ) ? associationKey.getColumnValue( columnName ) : accessor.get( row, columnName ); } return new RowKey( columnNames, columnValues ); }
[ "private", "static", "<", "R", ">", "RowKey", "buildRowKey", "(", "AssociationKey", "associationKey", ",", "R", "row", ",", "AssociationRowAccessor", "<", "R", ">", "accessor", ")", "{", "String", "[", "]", "columnNames", "=", "associationKey", ".", "getMetadata", "(", ")", ".", "getRowKeyColumnNames", "(", ")", ";", "Object", "[", "]", "columnValues", "=", "new", "Object", "[", "columnNames", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "columnNames", ".", "length", ";", "i", "++", ")", "{", "String", "columnName", "=", "columnNames", "[", "i", "]", ";", "columnValues", "[", "i", "]", "=", "associationKey", ".", "getMetadata", "(", ")", ".", "isKeyColumn", "(", "columnName", ")", "?", "associationKey", ".", "getColumnValue", "(", "columnName", ")", ":", "accessor", ".", "get", "(", "row", ",", "columnName", ")", ";", "}", "return", "new", "RowKey", "(", "columnNames", ",", "columnValues", ")", ";", "}" ]
Creates the row key of the given association row; columns present in the given association key will be obtained from there, all other columns from the given native association row.
[ "Creates", "the", "row", "key", "of", "the", "given", "association", "row", ";", "columns", "present", "in", "the", "given", "association", "key", "will", "be", "obtained", "from", "there", "all", "other", "columns", "from", "the", "given", "native", "association", "row", "." ]
9ea971df7c27277029006a6f748d8272fb1d69d2
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/datastore/document/association/spi/AssociationRow.java#L74-L84
160,657
hibernate/hibernate-ogm
neo4j/src/main/java/org/hibernate/ogm/datastore/neo4j/BaseNeo4jDialect.java
BaseNeo4jDialect.getEntityKey
protected EntityKey getEntityKey(Tuple tuple, AssociatedEntityKeyMetadata associatedEntityKeyMetadata) { Object[] columnValues = new Object[ associatedEntityKeyMetadata.getAssociationKeyColumns().length]; int i = 0; for ( String associationKeyColumn : associatedEntityKeyMetadata.getAssociationKeyColumns() ) { columnValues[i] = tuple.get( associationKeyColumn ); i++; } return new EntityKey( associatedEntityKeyMetadata.getEntityKeyMetadata(), columnValues ); }
java
protected EntityKey getEntityKey(Tuple tuple, AssociatedEntityKeyMetadata associatedEntityKeyMetadata) { Object[] columnValues = new Object[ associatedEntityKeyMetadata.getAssociationKeyColumns().length]; int i = 0; for ( String associationKeyColumn : associatedEntityKeyMetadata.getAssociationKeyColumns() ) { columnValues[i] = tuple.get( associationKeyColumn ); i++; } return new EntityKey( associatedEntityKeyMetadata.getEntityKeyMetadata(), columnValues ); }
[ "protected", "EntityKey", "getEntityKey", "(", "Tuple", "tuple", ",", "AssociatedEntityKeyMetadata", "associatedEntityKeyMetadata", ")", "{", "Object", "[", "]", "columnValues", "=", "new", "Object", "[", "associatedEntityKeyMetadata", ".", "getAssociationKeyColumns", "(", ")", ".", "length", "]", ";", "int", "i", "=", "0", ";", "for", "(", "String", "associationKeyColumn", ":", "associatedEntityKeyMetadata", ".", "getAssociationKeyColumns", "(", ")", ")", "{", "columnValues", "[", "i", "]", "=", "tuple", ".", "get", "(", "associationKeyColumn", ")", ";", "i", "++", ";", "}", "return", "new", "EntityKey", "(", "associatedEntityKeyMetadata", ".", "getEntityKeyMetadata", "(", ")", ",", "columnValues", ")", ";", "}" ]
Returns the key of the entity targeted by the represented association, retrieved from the given tuple. @param tuple the tuple from which to retrieve the referenced entity key @return the key of the entity targeted by the represented association
[ "Returns", "the", "key", "of", "the", "entity", "targeted", "by", "the", "represented", "association", "retrieved", "from", "the", "given", "tuple", "." ]
9ea971df7c27277029006a6f748d8272fb1d69d2
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/neo4j/src/main/java/org/hibernate/ogm/datastore/neo4j/BaseNeo4jDialect.java#L191-L201
160,658
hibernate/hibernate-ogm
neo4j/src/main/java/org/hibernate/ogm/datastore/neo4j/BaseNeo4jDialect.java
BaseNeo4jDialect.isPartOfRegularEmbedded
public static boolean isPartOfRegularEmbedded(String[] keyColumnNames, String column) { return isPartOfEmbedded( column ) && !ArrayHelper.contains( keyColumnNames, column ); }
java
public static boolean isPartOfRegularEmbedded(String[] keyColumnNames, String column) { return isPartOfEmbedded( column ) && !ArrayHelper.contains( keyColumnNames, column ); }
[ "public", "static", "boolean", "isPartOfRegularEmbedded", "(", "String", "[", "]", "keyColumnNames", ",", "String", "column", ")", "{", "return", "isPartOfEmbedded", "(", "column", ")", "&&", "!", "ArrayHelper", ".", "contains", "(", "keyColumnNames", ",", "column", ")", ";", "}" ]
A regular embedded is an element that it is embedded but it is not a key or a collection. @param keyColumnNames the column names representing the identifier of the entity @param column the column we want to check @return {@code true} if the column represent an attribute of a regular embedded element, {@code false} otherwise
[ "A", "regular", "embedded", "is", "an", "element", "that", "it", "is", "embedded", "but", "it", "is", "not", "a", "key", "or", "a", "collection", "." ]
9ea971df7c27277029006a6f748d8272fb1d69d2
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/neo4j/src/main/java/org/hibernate/ogm/datastore/neo4j/BaseNeo4jDialect.java#L219-L221
160,659
hibernate/hibernate-ogm
core/src/main/java/org/hibernate/ogm/datastore/document/impl/EmbeddableStateFinder.java
EmbeddableStateFinder.getOuterMostNullEmbeddableIfAny
public String getOuterMostNullEmbeddableIfAny(String column) { String[] path = column.split( "\\." ); if ( !isEmbeddableColumn( path ) ) { return null; } // the cached value may be null hence the explicit key lookup if ( columnToOuterMostNullEmbeddableCache.containsKey( column ) ) { return columnToOuterMostNullEmbeddableCache.get( column ); } return determineAndCacheOuterMostNullEmbeddable( column, path ); }
java
public String getOuterMostNullEmbeddableIfAny(String column) { String[] path = column.split( "\\." ); if ( !isEmbeddableColumn( path ) ) { return null; } // the cached value may be null hence the explicit key lookup if ( columnToOuterMostNullEmbeddableCache.containsKey( column ) ) { return columnToOuterMostNullEmbeddableCache.get( column ); } return determineAndCacheOuterMostNullEmbeddable( column, path ); }
[ "public", "String", "getOuterMostNullEmbeddableIfAny", "(", "String", "column", ")", "{", "String", "[", "]", "path", "=", "column", ".", "split", "(", "\"\\\\.\"", ")", ";", "if", "(", "!", "isEmbeddableColumn", "(", "path", ")", ")", "{", "return", "null", ";", "}", "// the cached value may be null hence the explicit key lookup", "if", "(", "columnToOuterMostNullEmbeddableCache", ".", "containsKey", "(", "column", ")", ")", "{", "return", "columnToOuterMostNullEmbeddableCache", ".", "get", "(", "column", ")", ";", "}", "return", "determineAndCacheOuterMostNullEmbeddable", "(", "column", ",", "path", ")", ";", "}" ]
Should only called on a column that is being set to null. Returns the most outer embeddable containing {@code column} that is entirely null. Return null otherwise i.e. not embeddable. The implementation lazily compute the embeddable state and caches it. The idea behind the lazy computation is that only some columns will be set to null and only in some situations. The idea behind caching is that an embeddable contains several columns, no need to recompute its state.
[ "Should", "only", "called", "on", "a", "column", "that", "is", "being", "set", "to", "null", "." ]
9ea971df7c27277029006a6f748d8272fb1d69d2
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/datastore/document/impl/EmbeddableStateFinder.java#L48-L58
160,660
hibernate/hibernate-ogm
core/src/main/java/org/hibernate/ogm/datastore/document/impl/EmbeddableStateFinder.java
EmbeddableStateFinder.determineAndCacheOuterMostNullEmbeddable
private String determineAndCacheOuterMostNullEmbeddable(String column, String[] path) { String embeddable = path[0]; // process each embeddable from less specific to most specific // exclude path leaves as it's a column and not an embeddable for ( int index = 0; index < path.length - 1; index++ ) { Set<String> columnsOfEmbeddable = getColumnsOfEmbeddableAndComputeEmbeddableNullness( embeddable ); if ( nullEmbeddables.contains( embeddable ) ) { // the current embeddable only has null columns; cache that info for all the columns for ( String columnOfEmbeddable : columnsOfEmbeddable ) { columnToOuterMostNullEmbeddableCache.put( columnOfEmbeddable, embeddable ); } break; } else { maybeCacheOnNonNullEmbeddable( path, index, columnsOfEmbeddable ); } // a more specific null embeddable might be present, carry on embeddable += "." + path[index + 1]; } return columnToOuterMostNullEmbeddableCache.get( column ); }
java
private String determineAndCacheOuterMostNullEmbeddable(String column, String[] path) { String embeddable = path[0]; // process each embeddable from less specific to most specific // exclude path leaves as it's a column and not an embeddable for ( int index = 0; index < path.length - 1; index++ ) { Set<String> columnsOfEmbeddable = getColumnsOfEmbeddableAndComputeEmbeddableNullness( embeddable ); if ( nullEmbeddables.contains( embeddable ) ) { // the current embeddable only has null columns; cache that info for all the columns for ( String columnOfEmbeddable : columnsOfEmbeddable ) { columnToOuterMostNullEmbeddableCache.put( columnOfEmbeddable, embeddable ); } break; } else { maybeCacheOnNonNullEmbeddable( path, index, columnsOfEmbeddable ); } // a more specific null embeddable might be present, carry on embeddable += "." + path[index + 1]; } return columnToOuterMostNullEmbeddableCache.get( column ); }
[ "private", "String", "determineAndCacheOuterMostNullEmbeddable", "(", "String", "column", ",", "String", "[", "]", "path", ")", "{", "String", "embeddable", "=", "path", "[", "0", "]", ";", "// process each embeddable from less specific to most specific", "// exclude path leaves as it's a column and not an embeddable", "for", "(", "int", "index", "=", "0", ";", "index", "<", "path", ".", "length", "-", "1", ";", "index", "++", ")", "{", "Set", "<", "String", ">", "columnsOfEmbeddable", "=", "getColumnsOfEmbeddableAndComputeEmbeddableNullness", "(", "embeddable", ")", ";", "if", "(", "nullEmbeddables", ".", "contains", "(", "embeddable", ")", ")", "{", "// the current embeddable only has null columns; cache that info for all the columns", "for", "(", "String", "columnOfEmbeddable", ":", "columnsOfEmbeddable", ")", "{", "columnToOuterMostNullEmbeddableCache", ".", "put", "(", "columnOfEmbeddable", ",", "embeddable", ")", ";", "}", "break", ";", "}", "else", "{", "maybeCacheOnNonNullEmbeddable", "(", "path", ",", "index", ",", "columnsOfEmbeddable", ")", ";", "}", "// a more specific null embeddable might be present, carry on", "embeddable", "+=", "\".\"", "+", "path", "[", "index", "+", "1", "]", ";", "}", "return", "columnToOuterMostNullEmbeddableCache", ".", "get", "(", "column", ")", ";", "}" ]
Walks from the most outer embeddable to the most inner one look for all columns contained in these embeddables and exclude the embeddables that have a non null column because of caching, the algorithm is only run once per column parameter
[ "Walks", "from", "the", "most", "outer", "embeddable", "to", "the", "most", "inner", "one", "look", "for", "all", "columns", "contained", "in", "these", "embeddables", "and", "exclude", "the", "embeddables", "that", "have", "a", "non", "null", "column", "because", "of", "caching", "the", "algorithm", "is", "only", "run", "once", "per", "column", "parameter" ]
9ea971df7c27277029006a6f748d8272fb1d69d2
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/datastore/document/impl/EmbeddableStateFinder.java#L66-L87
160,661
hibernate/hibernate-ogm
core/src/main/java/org/hibernate/ogm/persister/impl/EntityAssociationUpdater.java
EntityAssociationUpdater.addNavigationalInformationForInverseSide
public void addNavigationalInformationForInverseSide() { if ( log.isTraceEnabled() ) { log.trace( "Adding inverse navigational information for entity: " + MessageHelper.infoString( persister, id, persister.getFactory() ) ); } for ( int propertyIndex = 0; propertyIndex < persister.getEntityMetamodel().getPropertySpan(); propertyIndex++ ) { if ( persister.isPropertyOfTable( propertyIndex, tableIndex ) ) { AssociationKeyMetadata associationKeyMetadata = getInverseAssociationKeyMetadata( propertyIndex ); // there is no inverse association for the given property if ( associationKeyMetadata == null ) { continue; } Object[] newColumnValues = LogicalPhysicalConverterHelper.getColumnValuesFromResultset( resultset, persister.getPropertyColumnNames( propertyIndex ) ); //don't index null columns, this means no association if ( ! CollectionHelper.isEmptyOrContainsOnlyNull( ( newColumnValues ) ) ) { addNavigationalInformationForInverseSide( propertyIndex, associationKeyMetadata, newColumnValues ); } } } }
java
public void addNavigationalInformationForInverseSide() { if ( log.isTraceEnabled() ) { log.trace( "Adding inverse navigational information for entity: " + MessageHelper.infoString( persister, id, persister.getFactory() ) ); } for ( int propertyIndex = 0; propertyIndex < persister.getEntityMetamodel().getPropertySpan(); propertyIndex++ ) { if ( persister.isPropertyOfTable( propertyIndex, tableIndex ) ) { AssociationKeyMetadata associationKeyMetadata = getInverseAssociationKeyMetadata( propertyIndex ); // there is no inverse association for the given property if ( associationKeyMetadata == null ) { continue; } Object[] newColumnValues = LogicalPhysicalConverterHelper.getColumnValuesFromResultset( resultset, persister.getPropertyColumnNames( propertyIndex ) ); //don't index null columns, this means no association if ( ! CollectionHelper.isEmptyOrContainsOnlyNull( ( newColumnValues ) ) ) { addNavigationalInformationForInverseSide( propertyIndex, associationKeyMetadata, newColumnValues ); } } } }
[ "public", "void", "addNavigationalInformationForInverseSide", "(", ")", "{", "if", "(", "log", ".", "isTraceEnabled", "(", ")", ")", "{", "log", ".", "trace", "(", "\"Adding inverse navigational information for entity: \"", "+", "MessageHelper", ".", "infoString", "(", "persister", ",", "id", ",", "persister", ".", "getFactory", "(", ")", ")", ")", ";", "}", "for", "(", "int", "propertyIndex", "=", "0", ";", "propertyIndex", "<", "persister", ".", "getEntityMetamodel", "(", ")", ".", "getPropertySpan", "(", ")", ";", "propertyIndex", "++", ")", "{", "if", "(", "persister", ".", "isPropertyOfTable", "(", "propertyIndex", ",", "tableIndex", ")", ")", "{", "AssociationKeyMetadata", "associationKeyMetadata", "=", "getInverseAssociationKeyMetadata", "(", "propertyIndex", ")", ";", "// there is no inverse association for the given property", "if", "(", "associationKeyMetadata", "==", "null", ")", "{", "continue", ";", "}", "Object", "[", "]", "newColumnValues", "=", "LogicalPhysicalConverterHelper", ".", "getColumnValuesFromResultset", "(", "resultset", ",", "persister", ".", "getPropertyColumnNames", "(", "propertyIndex", ")", ")", ";", "//don't index null columns, this means no association", "if", "(", "!", "CollectionHelper", ".", "isEmptyOrContainsOnlyNull", "(", "(", "newColumnValues", ")", ")", ")", "{", "addNavigationalInformationForInverseSide", "(", "propertyIndex", ",", "associationKeyMetadata", ",", "newColumnValues", ")", ";", "}", "}", "}", "}" ]
Updates all inverse associations managed by a given entity.
[ "Updates", "all", "inverse", "associations", "managed", "by", "a", "given", "entity", "." ]
9ea971df7c27277029006a6f748d8272fb1d69d2
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/persister/impl/EntityAssociationUpdater.java#L97-L122
160,662
hibernate/hibernate-ogm
core/src/main/java/org/hibernate/ogm/util/impl/StringHelper.java
StringHelper.escapeDoubleQuotesForJson
public static String escapeDoubleQuotesForJson(String text) { if ( text == null ) { return null; } StringBuilder builder = new StringBuilder( text.length() ); for ( int i = 0; i < text.length(); i++ ) { char c = text.charAt( i ); switch ( c ) { case '"': case '\\': builder.append( "\\" ); default: builder.append( c ); } } return builder.toString(); }
java
public static String escapeDoubleQuotesForJson(String text) { if ( text == null ) { return null; } StringBuilder builder = new StringBuilder( text.length() ); for ( int i = 0; i < text.length(); i++ ) { char c = text.charAt( i ); switch ( c ) { case '"': case '\\': builder.append( "\\" ); default: builder.append( c ); } } return builder.toString(); }
[ "public", "static", "String", "escapeDoubleQuotesForJson", "(", "String", "text", ")", "{", "if", "(", "text", "==", "null", ")", "{", "return", "null", ";", "}", "StringBuilder", "builder", "=", "new", "StringBuilder", "(", "text", ".", "length", "(", ")", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "text", ".", "length", "(", ")", ";", "i", "++", ")", "{", "char", "c", "=", "text", ".", "charAt", "(", "i", ")", ";", "switch", "(", "c", ")", "{", "case", "'", "'", ":", "case", "'", "'", ":", "builder", ".", "append", "(", "\"\\\\\"", ")", ";", "default", ":", "builder", ".", "append", "(", "c", ")", ";", "}", "}", "return", "builder", ".", "toString", "(", ")", ";", "}" ]
If a text contains double quotes, escape them. @param text the text to escape @return Escaped text or {@code null} if the text is null
[ "If", "a", "text", "contains", "double", "quotes", "escape", "them", "." ]
9ea971df7c27277029006a6f748d8272fb1d69d2
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/util/impl/StringHelper.java#L89-L105
160,663
hibernate/hibernate-ogm
neo4j/src/main/java/org/hibernate/ogm/datastore/neo4j/remote/http/dialect/impl/HttpNeo4jEntityQueries.java
HttpNeo4jEntityQueries.row
private static Row row(List<StatementResult> results) { Row row = results.get( 0 ).getData().get( 0 ); return row; }
java
private static Row row(List<StatementResult> results) { Row row = results.get( 0 ).getData().get( 0 ); return row; }
[ "private", "static", "Row", "row", "(", "List", "<", "StatementResult", ">", "results", ")", "{", "Row", "row", "=", "results", ".", "get", "(", "0", ")", ".", "getData", "(", ")", ".", "get", "(", "0", ")", ";", "return", "row", ";", "}" ]
When we execute a single statement we only need the corresponding Row with the result. @param results a list of {@link StatementResult} @return the result of a single query
[ "When", "we", "execute", "a", "single", "statement", "we", "only", "need", "the", "corresponding", "Row", "with", "the", "result", "." ]
9ea971df7c27277029006a6f748d8272fb1d69d2
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/neo4j/src/main/java/org/hibernate/ogm/datastore/neo4j/remote/http/dialect/impl/HttpNeo4jEntityQueries.java#L342-L345
160,664
hibernate/hibernate-ogm
core/src/main/java/org/hibernate/ogm/dialect/impl/GridDialects.java
GridDialects.getDialectFacetOrNull
static <T extends GridDialect> T getDialectFacetOrNull(GridDialect gridDialect, Class<T> facetType) { if ( hasFacet( gridDialect, facetType ) ) { @SuppressWarnings("unchecked") T asFacet = (T) gridDialect; return asFacet; } return null; }
java
static <T extends GridDialect> T getDialectFacetOrNull(GridDialect gridDialect, Class<T> facetType) { if ( hasFacet( gridDialect, facetType ) ) { @SuppressWarnings("unchecked") T asFacet = (T) gridDialect; return asFacet; } return null; }
[ "static", "<", "T", "extends", "GridDialect", ">", "T", "getDialectFacetOrNull", "(", "GridDialect", "gridDialect", ",", "Class", "<", "T", ">", "facetType", ")", "{", "if", "(", "hasFacet", "(", "gridDialect", ",", "facetType", ")", ")", "{", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "T", "asFacet", "=", "(", "T", ")", "gridDialect", ";", "return", "asFacet", ";", "}", "return", "null", ";", "}" ]
Returns the given dialect, narrowed down to the given dialect facet in case it is implemented by the dialect. @param gridDialect the dialect of interest @param facetType the dialect facet type of interest @return the given dialect, narrowed down to the given dialect facet or {@code null} in case the given dialect does not implement the given facet
[ "Returns", "the", "given", "dialect", "narrowed", "down", "to", "the", "given", "dialect", "facet", "in", "case", "it", "is", "implemented", "by", "the", "dialect", "." ]
9ea971df7c27277029006a6f748d8272fb1d69d2
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/dialect/impl/GridDialects.java#L37-L45
160,665
hibernate/hibernate-ogm
core/src/main/java/org/hibernate/ogm/dialect/impl/GridDialects.java
GridDialects.hasFacet
public static boolean hasFacet(GridDialect gridDialect, Class<? extends GridDialect> facetType) { if ( gridDialect instanceof ForwardingGridDialect ) { return hasFacet( ( (ForwardingGridDialect<?>) gridDialect ).getGridDialect(), facetType ); } else { return facetType.isAssignableFrom( gridDialect.getClass() ); } }
java
public static boolean hasFacet(GridDialect gridDialect, Class<? extends GridDialect> facetType) { if ( gridDialect instanceof ForwardingGridDialect ) { return hasFacet( ( (ForwardingGridDialect<?>) gridDialect ).getGridDialect(), facetType ); } else { return facetType.isAssignableFrom( gridDialect.getClass() ); } }
[ "public", "static", "boolean", "hasFacet", "(", "GridDialect", "gridDialect", ",", "Class", "<", "?", "extends", "GridDialect", ">", "facetType", ")", "{", "if", "(", "gridDialect", "instanceof", "ForwardingGridDialect", ")", "{", "return", "hasFacet", "(", "(", "(", "ForwardingGridDialect", "<", "?", ">", ")", "gridDialect", ")", ".", "getGridDialect", "(", ")", ",", "facetType", ")", ";", "}", "else", "{", "return", "facetType", ".", "isAssignableFrom", "(", "gridDialect", ".", "getClass", "(", ")", ")", ";", "}", "}" ]
Whether the given grid dialect implements the specified facet or not. @param gridDialect the dialect of interest @param facetType the dialect facet type of interest @return {@code true} in case the given dialect implements the specified facet, {@code false} otherwise
[ "Whether", "the", "given", "grid", "dialect", "implements", "the", "specified", "facet", "or", "not", "." ]
9ea971df7c27277029006a6f748d8272fb1d69d2
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/dialect/impl/GridDialects.java#L54-L61
160,666
hibernate/hibernate-ogm
infinispan-embedded/src/main/java/org/hibernate/ogm/datastore/infinispan/impl/InfinispanEmbeddedDatastoreProvider.java
InfinispanEmbeddedDatastoreProvider.initializePersistenceStrategy
public void initializePersistenceStrategy(CacheMappingType cacheMappingType, Set<EntityKeyMetadata> entityTypes, Set<AssociationKeyMetadata> associationTypes, Set<IdSourceKeyMetadata> idSourceTypes, Iterable<Namespace> namespaces) { persistenceStrategy = PersistenceStrategy.getInstance( cacheMappingType, externalCacheManager, config.getConfigurationUrl(), jtaPlatform, entityTypes, associationTypes, idSourceTypes ); // creates handler for TableGenerator Id sources boolean requiresCounter = hasIdGeneration( idSourceTypes ); if ( requiresCounter ) { this.tableClusterHandler = new TableClusteredCounterHandler( persistenceStrategy.getCacheManager().getCacheManager() ); } // creates handlers for SequenceGenerator Id sources for ( Namespace namespace : namespaces ) { for ( Sequence seq : namespace.getSequences() ) { this.sequenceCounterHandlers.put( seq.getExportIdentifier(), new SequenceClusteredCounterHandler( persistenceStrategy.getCacheManager().getCacheManager(), seq ) ); } } // clear resources this.externalCacheManager = null; this.jtaPlatform = null; }
java
public void initializePersistenceStrategy(CacheMappingType cacheMappingType, Set<EntityKeyMetadata> entityTypes, Set<AssociationKeyMetadata> associationTypes, Set<IdSourceKeyMetadata> idSourceTypes, Iterable<Namespace> namespaces) { persistenceStrategy = PersistenceStrategy.getInstance( cacheMappingType, externalCacheManager, config.getConfigurationUrl(), jtaPlatform, entityTypes, associationTypes, idSourceTypes ); // creates handler for TableGenerator Id sources boolean requiresCounter = hasIdGeneration( idSourceTypes ); if ( requiresCounter ) { this.tableClusterHandler = new TableClusteredCounterHandler( persistenceStrategy.getCacheManager().getCacheManager() ); } // creates handlers for SequenceGenerator Id sources for ( Namespace namespace : namespaces ) { for ( Sequence seq : namespace.getSequences() ) { this.sequenceCounterHandlers.put( seq.getExportIdentifier(), new SequenceClusteredCounterHandler( persistenceStrategy.getCacheManager().getCacheManager(), seq ) ); } } // clear resources this.externalCacheManager = null; this.jtaPlatform = null; }
[ "public", "void", "initializePersistenceStrategy", "(", "CacheMappingType", "cacheMappingType", ",", "Set", "<", "EntityKeyMetadata", ">", "entityTypes", ",", "Set", "<", "AssociationKeyMetadata", ">", "associationTypes", ",", "Set", "<", "IdSourceKeyMetadata", ">", "idSourceTypes", ",", "Iterable", "<", "Namespace", ">", "namespaces", ")", "{", "persistenceStrategy", "=", "PersistenceStrategy", ".", "getInstance", "(", "cacheMappingType", ",", "externalCacheManager", ",", "config", ".", "getConfigurationUrl", "(", ")", ",", "jtaPlatform", ",", "entityTypes", ",", "associationTypes", ",", "idSourceTypes", ")", ";", "// creates handler for TableGenerator Id sources", "boolean", "requiresCounter", "=", "hasIdGeneration", "(", "idSourceTypes", ")", ";", "if", "(", "requiresCounter", ")", "{", "this", ".", "tableClusterHandler", "=", "new", "TableClusteredCounterHandler", "(", "persistenceStrategy", ".", "getCacheManager", "(", ")", ".", "getCacheManager", "(", ")", ")", ";", "}", "// creates handlers for SequenceGenerator Id sources", "for", "(", "Namespace", "namespace", ":", "namespaces", ")", "{", "for", "(", "Sequence", "seq", ":", "namespace", ".", "getSequences", "(", ")", ")", "{", "this", ".", "sequenceCounterHandlers", ".", "put", "(", "seq", ".", "getExportIdentifier", "(", ")", ",", "new", "SequenceClusteredCounterHandler", "(", "persistenceStrategy", ".", "getCacheManager", "(", ")", ".", "getCacheManager", "(", ")", ",", "seq", ")", ")", ";", "}", "}", "// clear resources", "this", ".", "externalCacheManager", "=", "null", ";", "this", ".", "jtaPlatform", "=", "null", ";", "}" ]
Initializes the persistence strategy to be used when accessing the datastore. In particular, all the required caches will be configured and initialized. @param cacheMappingType the {@link org.hibernate.ogm.datastore.keyvalue.options.CacheMappingType} to be used @param entityTypes meta-data of all the entity types registered with the current session factory @param associationTypes meta-data of all the association types registered with the current session factory @param idSourceTypes meta-data of all the id source types registered with the current session factory @param namespaces from the database currently in use
[ "Initializes", "the", "persistence", "strategy", "to", "be", "used", "when", "accessing", "the", "datastore", ".", "In", "particular", "all", "the", "required", "caches", "will", "be", "configured", "and", "initialized", "." ]
9ea971df7c27277029006a6f748d8272fb1d69d2
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/infinispan-embedded/src/main/java/org/hibernate/ogm/datastore/infinispan/impl/InfinispanEmbeddedDatastoreProvider.java#L108-L136
160,667
hibernate/hibernate-ogm
mongodb/src/main/java/org/hibernate/ogm/datastore/mongodb/MongoDBDialect.java
MongoDBDialect.getProjection
private static Document getProjection(List<String> fieldNames) { Document projection = new Document(); for ( String column : fieldNames ) { projection.put( column, 1 ); } return projection; }
java
private static Document getProjection(List<String> fieldNames) { Document projection = new Document(); for ( String column : fieldNames ) { projection.put( column, 1 ); } return projection; }
[ "private", "static", "Document", "getProjection", "(", "List", "<", "String", ">", "fieldNames", ")", "{", "Document", "projection", "=", "new", "Document", "(", ")", ";", "for", "(", "String", "column", ":", "fieldNames", ")", "{", "projection", ".", "put", "(", "column", ",", "1", ")", ";", "}", "return", "projection", ";", "}" ]
Returns a projection object for specifying the fields to retrieve during a specific find operation.
[ "Returns", "a", "projection", "object", "for", "specifying", "the", "fields", "to", "retrieve", "during", "a", "specific", "find", "operation", "." ]
9ea971df7c27277029006a6f748d8272fb1d69d2
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/mongodb/src/main/java/org/hibernate/ogm/datastore/mongodb/MongoDBDialect.java#L365-L372
160,668
hibernate/hibernate-ogm
mongodb/src/main/java/org/hibernate/ogm/datastore/mongodb/MongoDBDialect.java
MongoDBDialect.objectForInsert
private static Document objectForInsert(Tuple tuple, Document dbObject) { MongoDBTupleSnapshot snapshot = (MongoDBTupleSnapshot) tuple.getSnapshot(); for ( TupleOperation operation : tuple.getOperations() ) { String column = operation.getColumn(); if ( notInIdField( snapshot, column ) ) { switch ( operation.getType() ) { case PUT: MongoHelpers.setValue( dbObject, column, operation.getValue() ); break; case PUT_NULL: case REMOVE: MongoHelpers.resetValue( dbObject, column ); break; } } } return dbObject; }
java
private static Document objectForInsert(Tuple tuple, Document dbObject) { MongoDBTupleSnapshot snapshot = (MongoDBTupleSnapshot) tuple.getSnapshot(); for ( TupleOperation operation : tuple.getOperations() ) { String column = operation.getColumn(); if ( notInIdField( snapshot, column ) ) { switch ( operation.getType() ) { case PUT: MongoHelpers.setValue( dbObject, column, operation.getValue() ); break; case PUT_NULL: case REMOVE: MongoHelpers.resetValue( dbObject, column ); break; } } } return dbObject; }
[ "private", "static", "Document", "objectForInsert", "(", "Tuple", "tuple", ",", "Document", "dbObject", ")", "{", "MongoDBTupleSnapshot", "snapshot", "=", "(", "MongoDBTupleSnapshot", ")", "tuple", ".", "getSnapshot", "(", ")", ";", "for", "(", "TupleOperation", "operation", ":", "tuple", ".", "getOperations", "(", ")", ")", "{", "String", "column", "=", "operation", ".", "getColumn", "(", ")", ";", "if", "(", "notInIdField", "(", "snapshot", ",", "column", ")", ")", "{", "switch", "(", "operation", ".", "getType", "(", ")", ")", "{", "case", "PUT", ":", "MongoHelpers", ".", "setValue", "(", "dbObject", ",", "column", ",", "operation", ".", "getValue", "(", ")", ")", ";", "break", ";", "case", "PUT_NULL", ":", "case", "REMOVE", ":", "MongoHelpers", ".", "resetValue", "(", "dbObject", ",", "column", ")", ";", "break", ";", "}", "}", "}", "return", "dbObject", ";", "}" ]
Creates a Document that can be passed to the MongoDB batch insert function
[ "Creates", "a", "Document", "that", "can", "be", "passed", "to", "the", "MongoDB", "batch", "insert", "function" ]
9ea971df7c27277029006a6f748d8272fb1d69d2
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/mongodb/src/main/java/org/hibernate/ogm/datastore/mongodb/MongoDBDialect.java#L554-L571
160,669
hibernate/hibernate-ogm
mongodb/src/main/java/org/hibernate/ogm/datastore/mongodb/MongoDBDialect.java
MongoDBDialect.doDistinct
private static ClosableIterator<Tuple> doDistinct(final MongoDBQueryDescriptor queryDescriptor, final MongoCollection<Document> collection) { DistinctIterable<?> distinctFieldValues = collection.distinct( queryDescriptor.getDistinctFieldName(), queryDescriptor.getCriteria(), String.class ); Collation collation = getCollation( queryDescriptor.getOptions() ); distinctFieldValues = collation != null ? distinctFieldValues.collation( collation ) : distinctFieldValues; MongoCursor<?> cursor = distinctFieldValues.iterator(); List<Object> documents = new ArrayList<>(); while ( cursor.hasNext() ) { documents.add( cursor.next() ); } MapTupleSnapshot snapshot = new MapTupleSnapshot( Collections.<String, Object>singletonMap( "n", documents ) ); return CollectionHelper.newClosableIterator( Collections.singletonList( new Tuple( snapshot, SnapshotType.UNKNOWN ) ) ); }
java
private static ClosableIterator<Tuple> doDistinct(final MongoDBQueryDescriptor queryDescriptor, final MongoCollection<Document> collection) { DistinctIterable<?> distinctFieldValues = collection.distinct( queryDescriptor.getDistinctFieldName(), queryDescriptor.getCriteria(), String.class ); Collation collation = getCollation( queryDescriptor.getOptions() ); distinctFieldValues = collation != null ? distinctFieldValues.collation( collation ) : distinctFieldValues; MongoCursor<?> cursor = distinctFieldValues.iterator(); List<Object> documents = new ArrayList<>(); while ( cursor.hasNext() ) { documents.add( cursor.next() ); } MapTupleSnapshot snapshot = new MapTupleSnapshot( Collections.<String, Object>singletonMap( "n", documents ) ); return CollectionHelper.newClosableIterator( Collections.singletonList( new Tuple( snapshot, SnapshotType.UNKNOWN ) ) ); }
[ "private", "static", "ClosableIterator", "<", "Tuple", ">", "doDistinct", "(", "final", "MongoDBQueryDescriptor", "queryDescriptor", ",", "final", "MongoCollection", "<", "Document", ">", "collection", ")", "{", "DistinctIterable", "<", "?", ">", "distinctFieldValues", "=", "collection", ".", "distinct", "(", "queryDescriptor", ".", "getDistinctFieldName", "(", ")", ",", "queryDescriptor", ".", "getCriteria", "(", ")", ",", "String", ".", "class", ")", ";", "Collation", "collation", "=", "getCollation", "(", "queryDescriptor", ".", "getOptions", "(", ")", ")", ";", "distinctFieldValues", "=", "collation", "!=", "null", "?", "distinctFieldValues", ".", "collation", "(", "collation", ")", ":", "distinctFieldValues", ";", "MongoCursor", "<", "?", ">", "cursor", "=", "distinctFieldValues", ".", "iterator", "(", ")", ";", "List", "<", "Object", ">", "documents", "=", "new", "ArrayList", "<>", "(", ")", ";", "while", "(", "cursor", ".", "hasNext", "(", ")", ")", "{", "documents", ".", "add", "(", "cursor", ".", "next", "(", ")", ")", ";", "}", "MapTupleSnapshot", "snapshot", "=", "new", "MapTupleSnapshot", "(", "Collections", ".", "<", "String", ",", "Object", ">", "singletonMap", "(", "\"n\"", ",", "documents", ")", ")", ";", "return", "CollectionHelper", ".", "newClosableIterator", "(", "Collections", ".", "singletonList", "(", "new", "Tuple", "(", "snapshot", ",", "SnapshotType", ".", "UNKNOWN", ")", ")", ")", ";", "}" ]
do 'Distinct' operation @param queryDescriptor descriptor of MongoDB query @param collection collection for execute the operation @return result iterator @see <a href ="https://docs.mongodb.com/manual/reference/method/db.collection.distinct/">distinct</a>
[ "do", "Distinct", "operation" ]
9ea971df7c27277029006a6f748d8272fb1d69d2
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/mongodb/src/main/java/org/hibernate/ogm/datastore/mongodb/MongoDBDialect.java#L1106-L1119
160,670
hibernate/hibernate-ogm
mongodb/src/main/java/org/hibernate/ogm/datastore/mongodb/MongoDBDialect.java
MongoDBDialect.mergeWriteConcern
@SuppressWarnings("deprecation") private static WriteConcern mergeWriteConcern(WriteConcern original, WriteConcern writeConcern) { if ( original == null ) { return writeConcern; } else if ( writeConcern == null ) { return original; } else if ( original.equals( writeConcern ) ) { return original; } Object wObject; int wTimeoutMS; boolean fsync; Boolean journal; if ( original.getWObject() instanceof String ) { wObject = original.getWString(); } else if ( writeConcern.getWObject() instanceof String ) { wObject = writeConcern.getWString(); } else { wObject = Math.max( original.getW(), writeConcern.getW() ); } wTimeoutMS = Math.min( original.getWtimeout(), writeConcern.getWtimeout() ); fsync = original.getFsync() || writeConcern.getFsync(); if ( original.getJournal() == null ) { journal = writeConcern.getJournal(); } else if ( writeConcern.getJournal() == null ) { journal = original.getJournal(); } else { journal = original.getJournal() || writeConcern.getJournal(); } if ( wObject instanceof String ) { return new WriteConcern( (String) wObject, wTimeoutMS, fsync, journal ); } else { return new WriteConcern( (int) wObject, wTimeoutMS, fsync, journal ); } }
java
@SuppressWarnings("deprecation") private static WriteConcern mergeWriteConcern(WriteConcern original, WriteConcern writeConcern) { if ( original == null ) { return writeConcern; } else if ( writeConcern == null ) { return original; } else if ( original.equals( writeConcern ) ) { return original; } Object wObject; int wTimeoutMS; boolean fsync; Boolean journal; if ( original.getWObject() instanceof String ) { wObject = original.getWString(); } else if ( writeConcern.getWObject() instanceof String ) { wObject = writeConcern.getWString(); } else { wObject = Math.max( original.getW(), writeConcern.getW() ); } wTimeoutMS = Math.min( original.getWtimeout(), writeConcern.getWtimeout() ); fsync = original.getFsync() || writeConcern.getFsync(); if ( original.getJournal() == null ) { journal = writeConcern.getJournal(); } else if ( writeConcern.getJournal() == null ) { journal = original.getJournal(); } else { journal = original.getJournal() || writeConcern.getJournal(); } if ( wObject instanceof String ) { return new WriteConcern( (String) wObject, wTimeoutMS, fsync, journal ); } else { return new WriteConcern( (int) wObject, wTimeoutMS, fsync, journal ); } }
[ "@", "SuppressWarnings", "(", "\"deprecation\"", ")", "private", "static", "WriteConcern", "mergeWriteConcern", "(", "WriteConcern", "original", ",", "WriteConcern", "writeConcern", ")", "{", "if", "(", "original", "==", "null", ")", "{", "return", "writeConcern", ";", "}", "else", "if", "(", "writeConcern", "==", "null", ")", "{", "return", "original", ";", "}", "else", "if", "(", "original", ".", "equals", "(", "writeConcern", ")", ")", "{", "return", "original", ";", "}", "Object", "wObject", ";", "int", "wTimeoutMS", ";", "boolean", "fsync", ";", "Boolean", "journal", ";", "if", "(", "original", ".", "getWObject", "(", ")", "instanceof", "String", ")", "{", "wObject", "=", "original", ".", "getWString", "(", ")", ";", "}", "else", "if", "(", "writeConcern", ".", "getWObject", "(", ")", "instanceof", "String", ")", "{", "wObject", "=", "writeConcern", ".", "getWString", "(", ")", ";", "}", "else", "{", "wObject", "=", "Math", ".", "max", "(", "original", ".", "getW", "(", ")", ",", "writeConcern", ".", "getW", "(", ")", ")", ";", "}", "wTimeoutMS", "=", "Math", ".", "min", "(", "original", ".", "getWtimeout", "(", ")", ",", "writeConcern", ".", "getWtimeout", "(", ")", ")", ";", "fsync", "=", "original", ".", "getFsync", "(", ")", "||", "writeConcern", ".", "getFsync", "(", ")", ";", "if", "(", "original", ".", "getJournal", "(", ")", "==", "null", ")", "{", "journal", "=", "writeConcern", ".", "getJournal", "(", ")", ";", "}", "else", "if", "(", "writeConcern", ".", "getJournal", "(", ")", "==", "null", ")", "{", "journal", "=", "original", ".", "getJournal", "(", ")", ";", "}", "else", "{", "journal", "=", "original", ".", "getJournal", "(", ")", "||", "writeConcern", ".", "getJournal", "(", ")", ";", "}", "if", "(", "wObject", "instanceof", "String", ")", "{", "return", "new", "WriteConcern", "(", "(", "String", ")", "wObject", ",", "wTimeoutMS", ",", "fsync", ",", "journal", ")", ";", "}", "else", "{", "return", "new", "WriteConcern", "(", "(", "int", ")", "wObject", ",", "wTimeoutMS", ",", "fsync", ",", "journal", ")", ";", "}", "}" ]
As we merge several operations into one operation, we need to be sure the write concern applied to the aggregated operation respects all the requirements expressed for each separate operation. Thus, for each parameter of the write concern, we keep the stricter one for the resulting merged write concern.
[ "As", "we", "merge", "several", "operations", "into", "one", "operation", "we", "need", "to", "be", "sure", "the", "write", "concern", "applied", "to", "the", "aggregated", "operation", "respects", "all", "the", "requirements", "expressed", "for", "each", "separate", "operation", "." ]
9ea971df7c27277029006a6f748d8272fb1d69d2
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/mongodb/src/main/java/org/hibernate/ogm/datastore/mongodb/MongoDBDialect.java#L1807-L1854
160,671
hibernate/hibernate-ogm
mongodb/src/main/java/org/hibernate/ogm/datastore/mongodb/MongoDBDialect.java
MongoDBDialect.callStoredProcedure
@Override public ClosableIterator<Tuple> callStoredProcedure(String storedProcedureName, ProcedureQueryParameters params, TupleContext tupleContext) { validate( params ); StringBuilder commandLine = createCallStoreProcedureCommand( storedProcedureName, params ); Document result = callStoredProcedure( commandLine ); Object resultValue = result.get( "retval" ); List<Tuple> resultTuples = extractTuples( storedProcedureName, resultValue ); return CollectionHelper.newClosableIterator( resultTuples ); }
java
@Override public ClosableIterator<Tuple> callStoredProcedure(String storedProcedureName, ProcedureQueryParameters params, TupleContext tupleContext) { validate( params ); StringBuilder commandLine = createCallStoreProcedureCommand( storedProcedureName, params ); Document result = callStoredProcedure( commandLine ); Object resultValue = result.get( "retval" ); List<Tuple> resultTuples = extractTuples( storedProcedureName, resultValue ); return CollectionHelper.newClosableIterator( resultTuples ); }
[ "@", "Override", "public", "ClosableIterator", "<", "Tuple", ">", "callStoredProcedure", "(", "String", "storedProcedureName", ",", "ProcedureQueryParameters", "params", ",", "TupleContext", "tupleContext", ")", "{", "validate", "(", "params", ")", ";", "StringBuilder", "commandLine", "=", "createCallStoreProcedureCommand", "(", "storedProcedureName", ",", "params", ")", ";", "Document", "result", "=", "callStoredProcedure", "(", "commandLine", ")", ";", "Object", "resultValue", "=", "result", ".", "get", "(", "\"retval\"", ")", ";", "List", "<", "Tuple", ">", "resultTuples", "=", "extractTuples", "(", "storedProcedureName", ",", "resultValue", ")", ";", "return", "CollectionHelper", ".", "newClosableIterator", "(", "resultTuples", ")", ";", "}" ]
In MongoDB the equivalent of a stored procedure is a stored Javascript. @param storedProcedureName name of stored procedure @param params query parameters @param tupleContext the tuple context @return the result as a {@link ClosableIterator}
[ "In", "MongoDB", "the", "equivalent", "of", "a", "stored", "procedure", "is", "a", "stored", "Javascript", "." ]
9ea971df7c27277029006a6f748d8272fb1d69d2
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/mongodb/src/main/java/org/hibernate/ogm/datastore/mongodb/MongoDBDialect.java#L1865-L1873
160,672
hibernate/hibernate-ogm
core/src/main/java/org/hibernate/ogm/loader/entity/impl/BatchingEntityLoaderBuilder.java
BatchingEntityLoaderBuilder.buildLoader
public UniqueEntityLoader buildLoader( OuterJoinLoadable persister, int batchSize, LockMode lockMode, SessionFactoryImplementor factory, LoadQueryInfluencers influencers, BatchableEntityLoaderBuilder innerEntityLoaderBuilder) { if ( batchSize <= 1 ) { // no batching return buildNonBatchingLoader( persister, lockMode, factory, influencers, innerEntityLoaderBuilder ); } return buildBatchingLoader( persister, batchSize, lockMode, factory, influencers, innerEntityLoaderBuilder ); }
java
public UniqueEntityLoader buildLoader( OuterJoinLoadable persister, int batchSize, LockMode lockMode, SessionFactoryImplementor factory, LoadQueryInfluencers influencers, BatchableEntityLoaderBuilder innerEntityLoaderBuilder) { if ( batchSize <= 1 ) { // no batching return buildNonBatchingLoader( persister, lockMode, factory, influencers, innerEntityLoaderBuilder ); } return buildBatchingLoader( persister, batchSize, lockMode, factory, influencers, innerEntityLoaderBuilder ); }
[ "public", "UniqueEntityLoader", "buildLoader", "(", "OuterJoinLoadable", "persister", ",", "int", "batchSize", ",", "LockMode", "lockMode", ",", "SessionFactoryImplementor", "factory", ",", "LoadQueryInfluencers", "influencers", ",", "BatchableEntityLoaderBuilder", "innerEntityLoaderBuilder", ")", "{", "if", "(", "batchSize", "<=", "1", ")", "{", "// no batching", "return", "buildNonBatchingLoader", "(", "persister", ",", "lockMode", ",", "factory", ",", "influencers", ",", "innerEntityLoaderBuilder", ")", ";", "}", "return", "buildBatchingLoader", "(", "persister", ",", "batchSize", ",", "lockMode", ",", "factory", ",", "influencers", ",", "innerEntityLoaderBuilder", ")", ";", "}" ]
Builds a batch-fetch capable loader based on the given persister, lock-mode, etc. @param persister The entity persister @param batchSize The maximum number of ids to batch-fetch at once @param lockMode The lock mode @param factory The SessionFactory @param influencers Any influencers that should affect the built query @param innerEntityLoaderBuilder Builder of the entity loader receiving the subset of batches @return The loader.
[ "Builds", "a", "batch", "-", "fetch", "capable", "loader", "based", "on", "the", "given", "persister", "lock", "-", "mode", "etc", "." ]
9ea971df7c27277029006a6f748d8272fb1d69d2
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/loader/entity/impl/BatchingEntityLoaderBuilder.java#L89-L101
160,673
hibernate/hibernate-ogm
core/src/main/java/org/hibernate/ogm/loader/entity/impl/BatchingEntityLoaderBuilder.java
BatchingEntityLoaderBuilder.buildLoader
public UniqueEntityLoader buildLoader( OuterJoinLoadable persister, int batchSize, LockOptions lockOptions, SessionFactoryImplementor factory, LoadQueryInfluencers influencers, BatchableEntityLoaderBuilder innerEntityLoaderBuilder) { if ( batchSize <= 1 ) { // no batching return buildNonBatchingLoader( persister, lockOptions, factory, influencers, innerEntityLoaderBuilder ); } return buildBatchingLoader( persister, batchSize, lockOptions, factory, influencers, innerEntityLoaderBuilder ); }
java
public UniqueEntityLoader buildLoader( OuterJoinLoadable persister, int batchSize, LockOptions lockOptions, SessionFactoryImplementor factory, LoadQueryInfluencers influencers, BatchableEntityLoaderBuilder innerEntityLoaderBuilder) { if ( batchSize <= 1 ) { // no batching return buildNonBatchingLoader( persister, lockOptions, factory, influencers, innerEntityLoaderBuilder ); } return buildBatchingLoader( persister, batchSize, lockOptions, factory, influencers, innerEntityLoaderBuilder ); }
[ "public", "UniqueEntityLoader", "buildLoader", "(", "OuterJoinLoadable", "persister", ",", "int", "batchSize", ",", "LockOptions", "lockOptions", ",", "SessionFactoryImplementor", "factory", ",", "LoadQueryInfluencers", "influencers", ",", "BatchableEntityLoaderBuilder", "innerEntityLoaderBuilder", ")", "{", "if", "(", "batchSize", "<=", "1", ")", "{", "// no batching", "return", "buildNonBatchingLoader", "(", "persister", ",", "lockOptions", ",", "factory", ",", "influencers", ",", "innerEntityLoaderBuilder", ")", ";", "}", "return", "buildBatchingLoader", "(", "persister", ",", "batchSize", ",", "lockOptions", ",", "factory", ",", "influencers", ",", "innerEntityLoaderBuilder", ")", ";", "}" ]
Builds a batch-fetch capable loader based on the given persister, lock-options, etc. @param persister The entity persister @param batchSize The maximum number of ids to batch-fetch at once @param lockOptions The lock options @param factory The SessionFactory @param influencers Any influencers that should affect the built query @param innerEntityLoaderBuilder Builder of the entity loader receiving the subset of batches @return The loader.
[ "Builds", "a", "batch", "-", "fetch", "capable", "loader", "based", "on", "the", "given", "persister", "lock", "-", "options", "etc", "." ]
9ea971df7c27277029006a6f748d8272fb1d69d2
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/loader/entity/impl/BatchingEntityLoaderBuilder.java#L141-L153
160,674
hibernate/hibernate-ogm
neo4j/src/main/java/org/hibernate/ogm/datastore/neo4j/EmbeddedNeo4jDialect.java
EmbeddedNeo4jDialect.applyProperties
private void applyProperties(AssociationKey associationKey, Tuple associationRow, Relationship relationship) { String[] indexColumns = associationKey.getMetadata().getRowKeyIndexColumnNames(); for ( int i = 0; i < indexColumns.length; i++ ) { String propertyName = indexColumns[i]; Object propertyValue = associationRow.get( propertyName ); relationship.setProperty( propertyName, propertyValue ); } }
java
private void applyProperties(AssociationKey associationKey, Tuple associationRow, Relationship relationship) { String[] indexColumns = associationKey.getMetadata().getRowKeyIndexColumnNames(); for ( int i = 0; i < indexColumns.length; i++ ) { String propertyName = indexColumns[i]; Object propertyValue = associationRow.get( propertyName ); relationship.setProperty( propertyName, propertyValue ); } }
[ "private", "void", "applyProperties", "(", "AssociationKey", "associationKey", ",", "Tuple", "associationRow", ",", "Relationship", "relationship", ")", "{", "String", "[", "]", "indexColumns", "=", "associationKey", ".", "getMetadata", "(", ")", ".", "getRowKeyIndexColumnNames", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "indexColumns", ".", "length", ";", "i", "++", ")", "{", "String", "propertyName", "=", "indexColumns", "[", "i", "]", ";", "Object", "propertyValue", "=", "associationRow", ".", "get", "(", "propertyName", ")", ";", "relationship", ".", "setProperty", "(", "propertyName", ",", "propertyValue", ")", ";", "}", "}" ]
The only properties added to a relationship are the columns representing the index of the association.
[ "The", "only", "properties", "added", "to", "a", "relationship", "are", "the", "columns", "representing", "the", "index", "of", "the", "association", "." ]
9ea971df7c27277029006a6f748d8272fb1d69d2
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/neo4j/src/main/java/org/hibernate/ogm/datastore/neo4j/EmbeddedNeo4jDialect.java#L276-L283
160,675
hibernate/hibernate-ogm
core/src/main/java/org/hibernate/ogm/entityentry/impl/OgmEntityEntryState.java
OgmEntityEntryState.getAssociation
public Association getAssociation(String collectionRole) { if ( associations == null ) { return null; } return associations.get( collectionRole ); }
java
public Association getAssociation(String collectionRole) { if ( associations == null ) { return null; } return associations.get( collectionRole ); }
[ "public", "Association", "getAssociation", "(", "String", "collectionRole", ")", "{", "if", "(", "associations", "==", "null", ")", "{", "return", "null", ";", "}", "return", "associations", ".", "get", "(", "collectionRole", ")", ";", "}" ]
Return the association as cached in the entry state. @param collectionRole the role of the association @return the cached association
[ "Return", "the", "association", "as", "cached", "in", "the", "entry", "state", "." ]
9ea971df7c27277029006a6f748d8272fb1d69d2
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/entityentry/impl/OgmEntityEntryState.java#L50-L55
160,676
hibernate/hibernate-ogm
core/src/main/java/org/hibernate/ogm/entityentry/impl/OgmEntityEntryState.java
OgmEntityEntryState.setAssociation
public void setAssociation(String collectionRole, Association association) { if ( associations == null ) { associations = new HashMap<>(); } associations.put( collectionRole, association ); }
java
public void setAssociation(String collectionRole, Association association) { if ( associations == null ) { associations = new HashMap<>(); } associations.put( collectionRole, association ); }
[ "public", "void", "setAssociation", "(", "String", "collectionRole", ",", "Association", "association", ")", "{", "if", "(", "associations", "==", "null", ")", "{", "associations", "=", "new", "HashMap", "<>", "(", ")", ";", "}", "associations", ".", "put", "(", "collectionRole", ",", "association", ")", ";", "}" ]
Set the association in the entry state. @param collectionRole the role of the association @param association the association
[ "Set", "the", "association", "in", "the", "entry", "state", "." ]
9ea971df7c27277029006a6f748d8272fb1d69d2
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/entityentry/impl/OgmEntityEntryState.java#L76-L81
160,677
hibernate/hibernate-ogm
core/src/main/java/org/hibernate/ogm/entityentry/impl/OgmEntityEntryState.java
OgmEntityEntryState.addExtraState
@Override public void addExtraState(EntityEntryExtraState extraState) { if ( next == null ) { next = extraState; } else { next.addExtraState( extraState ); } }
java
@Override public void addExtraState(EntityEntryExtraState extraState) { if ( next == null ) { next = extraState; } else { next.addExtraState( extraState ); } }
[ "@", "Override", "public", "void", "addExtraState", "(", "EntityEntryExtraState", "extraState", ")", "{", "if", "(", "next", "==", "null", ")", "{", "next", "=", "extraState", ";", "}", "else", "{", "next", ".", "addExtraState", "(", "extraState", ")", ";", "}", "}" ]
state chain management ops below
[ "state", "chain", "management", "ops", "below" ]
9ea971df7c27277029006a6f748d8272fb1d69d2
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/entityentry/impl/OgmEntityEntryState.java#L100-L108
160,678
hibernate/hibernate-ogm
infinispan-embedded/src/main/java/org/hibernate/ogm/datastore/infinispan/persistencestrategy/counter/ClusteredCounterHandler.java
ClusteredCounterHandler.getCounterOrCreateIt
protected StrongCounter getCounterOrCreateIt(String counterName, int initialValue) { CounterManager counterManager = EmbeddedCounterManagerFactory.asCounterManager( cacheManager ); if ( !counterManager.isDefined( counterName ) ) { LOG.tracef( "Counter %s is not defined, creating it", counterName ); // global configuration is mandatory in order to define // a new clustered counter with persistent storage validateGlobalConfiguration(); counterManager.defineCounter( counterName, CounterConfiguration.builder( CounterType.UNBOUNDED_STRONG ) .initialValue( initialValue ) .storage( Storage.PERSISTENT ) .build() ); } StrongCounter strongCounter = counterManager.getStrongCounter( counterName ); return strongCounter; }
java
protected StrongCounter getCounterOrCreateIt(String counterName, int initialValue) { CounterManager counterManager = EmbeddedCounterManagerFactory.asCounterManager( cacheManager ); if ( !counterManager.isDefined( counterName ) ) { LOG.tracef( "Counter %s is not defined, creating it", counterName ); // global configuration is mandatory in order to define // a new clustered counter with persistent storage validateGlobalConfiguration(); counterManager.defineCounter( counterName, CounterConfiguration.builder( CounterType.UNBOUNDED_STRONG ) .initialValue( initialValue ) .storage( Storage.PERSISTENT ) .build() ); } StrongCounter strongCounter = counterManager.getStrongCounter( counterName ); return strongCounter; }
[ "protected", "StrongCounter", "getCounterOrCreateIt", "(", "String", "counterName", ",", "int", "initialValue", ")", "{", "CounterManager", "counterManager", "=", "EmbeddedCounterManagerFactory", ".", "asCounterManager", "(", "cacheManager", ")", ";", "if", "(", "!", "counterManager", ".", "isDefined", "(", "counterName", ")", ")", "{", "LOG", ".", "tracef", "(", "\"Counter %s is not defined, creating it\"", ",", "counterName", ")", ";", "// global configuration is mandatory in order to define", "// a new clustered counter with persistent storage", "validateGlobalConfiguration", "(", ")", ";", "counterManager", ".", "defineCounter", "(", "counterName", ",", "CounterConfiguration", ".", "builder", "(", "CounterType", ".", "UNBOUNDED_STRONG", ")", ".", "initialValue", "(", "initialValue", ")", ".", "storage", "(", "Storage", ".", "PERSISTENT", ")", ".", "build", "(", ")", ")", ";", "}", "StrongCounter", "strongCounter", "=", "counterManager", ".", "getStrongCounter", "(", "counterName", ")", ";", "return", "strongCounter", ";", "}" ]
Create a counter if one is not defined already, otherwise return the existing one. @param counterName unique name for the counter @param initialValue initial value for the counter @return a {@link StrongCounter}
[ "Create", "a", "counter", "if", "one", "is", "not", "defined", "already", "otherwise", "return", "the", "existing", "one", "." ]
9ea971df7c27277029006a6f748d8272fb1d69d2
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/infinispan-embedded/src/main/java/org/hibernate/ogm/datastore/infinispan/persistencestrategy/counter/ClusteredCounterHandler.java#L47-L66
160,679
hibernate/hibernate-ogm
core/src/main/java/org/hibernate/ogm/model/spi/Tuple.java
Tuple.getOperations
public Set<TupleOperation> getOperations() { if ( currentState == null ) { return Collections.emptySet(); } else { return new SetFromCollection<TupleOperation>( currentState.values() ); } }
java
public Set<TupleOperation> getOperations() { if ( currentState == null ) { return Collections.emptySet(); } else { return new SetFromCollection<TupleOperation>( currentState.values() ); } }
[ "public", "Set", "<", "TupleOperation", ">", "getOperations", "(", ")", "{", "if", "(", "currentState", "==", "null", ")", "{", "return", "Collections", ".", "emptySet", "(", ")", ";", "}", "else", "{", "return", "new", "SetFromCollection", "<", "TupleOperation", ">", "(", "currentState", ".", "values", "(", ")", ")", ";", "}", "}" ]
Return the list of actions on the tuple. Inherently deduplicated operations @return the operations to execute on the Tuple
[ "Return", "the", "list", "of", "actions", "on", "the", "tuple", ".", "Inherently", "deduplicated", "operations" ]
9ea971df7c27277029006a6f748d8272fb1d69d2
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/model/spi/Tuple.java#L104-L111
160,680
hibernate/hibernate-ogm
core/src/main/java/org/hibernate/ogm/options/navigation/source/impl/AnnotationOptionValueSource.java
AnnotationOptionValueSource.getConverter
private <A extends Annotation> AnnotationConverter<A> getConverter(Annotation annotation) { MappingOption mappingOption = annotation.annotationType().getAnnotation( MappingOption.class ); if ( mappingOption == null ) { return null; } // wrong type would be a programming error of the annotation developer @SuppressWarnings("unchecked") Class<? extends AnnotationConverter<A>> converterClass = (Class<? extends AnnotationConverter<A>>) mappingOption.value(); try { return converterClass.newInstance(); } catch (Exception e) { throw log.cannotConvertAnnotation( converterClass, e ); } }
java
private <A extends Annotation> AnnotationConverter<A> getConverter(Annotation annotation) { MappingOption mappingOption = annotation.annotationType().getAnnotation( MappingOption.class ); if ( mappingOption == null ) { return null; } // wrong type would be a programming error of the annotation developer @SuppressWarnings("unchecked") Class<? extends AnnotationConverter<A>> converterClass = (Class<? extends AnnotationConverter<A>>) mappingOption.value(); try { return converterClass.newInstance(); } catch (Exception e) { throw log.cannotConvertAnnotation( converterClass, e ); } }
[ "private", "<", "A", "extends", "Annotation", ">", "AnnotationConverter", "<", "A", ">", "getConverter", "(", "Annotation", "annotation", ")", "{", "MappingOption", "mappingOption", "=", "annotation", ".", "annotationType", "(", ")", ".", "getAnnotation", "(", "MappingOption", ".", "class", ")", ";", "if", "(", "mappingOption", "==", "null", ")", "{", "return", "null", ";", "}", "// wrong type would be a programming error of the annotation developer", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "Class", "<", "?", "extends", "AnnotationConverter", "<", "A", ">", ">", "converterClass", "=", "(", "Class", "<", "?", "extends", "AnnotationConverter", "<", "A", ">", ">", ")", "mappingOption", ".", "value", "(", ")", ";", "try", "{", "return", "converterClass", ".", "newInstance", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "log", ".", "cannotConvertAnnotation", "(", "converterClass", ",", "e", ")", ";", "}", "}" ]
Returns a converter instance for the given annotation. @param annotation the annotation @return a converter instance or {@code null} if the given annotation is no option annotation
[ "Returns", "a", "converter", "instance", "for", "the", "given", "annotation", "." ]
9ea971df7c27277029006a6f748d8272fb1d69d2
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/options/navigation/source/impl/AnnotationOptionValueSource.java#L115-L131
160,681
hibernate/hibernate-ogm
core/src/main/java/org/hibernate/ogm/util/impl/ArrayHelper.java
ArrayHelper.slice
public static String[] slice(String[] strings, int begin, int length) { String[] result = new String[length]; System.arraycopy( strings, begin, result, 0, length ); return result; }
java
public static String[] slice(String[] strings, int begin, int length) { String[] result = new String[length]; System.arraycopy( strings, begin, result, 0, length ); return result; }
[ "public", "static", "String", "[", "]", "slice", "(", "String", "[", "]", "strings", ",", "int", "begin", ",", "int", "length", ")", "{", "String", "[", "]", "result", "=", "new", "String", "[", "length", "]", ";", "System", ".", "arraycopy", "(", "strings", ",", "begin", ",", "result", ",", "0", ",", "length", ")", ";", "return", "result", ";", "}" ]
Create a smaller array from an existing one. @param strings an array containing element of type {@link String} @param begin the starting position of the sub-array @param length the number of element to consider @return a new array continaining only the selected elements
[ "Create", "a", "smaller", "array", "from", "an", "existing", "one", "." ]
9ea971df7c27277029006a6f748d8272fb1d69d2
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/util/impl/ArrayHelper.java#L37-L41
160,682
hibernate/hibernate-ogm
core/src/main/java/org/hibernate/ogm/util/impl/ArrayHelper.java
ArrayHelper.indexOf
public static <T> int indexOf(T[] array, T element) { for ( int i = 0; i < array.length; i++ ) { if ( array[i].equals( element ) ) { return i; } } return -1; }
java
public static <T> int indexOf(T[] array, T element) { for ( int i = 0; i < array.length; i++ ) { if ( array[i].equals( element ) ) { return i; } } return -1; }
[ "public", "static", "<", "T", ">", "int", "indexOf", "(", "T", "[", "]", "array", ",", "T", "element", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "array", ".", "length", ";", "i", "++", ")", "{", "if", "(", "array", "[", "i", "]", ".", "equals", "(", "element", ")", ")", "{", "return", "i", ";", "}", "}", "return", "-", "1", ";", "}" ]
Return the position of an element inside an array @param array the array where it looks for an element @param element the element to find in the array @param <T> the type of elements in the array @return the position of the element if it's found in the array, -1 otherwise
[ "Return", "the", "position", "of", "an", "element", "inside", "an", "array" ]
9ea971df7c27277029006a6f748d8272fb1d69d2
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/util/impl/ArrayHelper.java#L51-L58
160,683
hibernate/hibernate-ogm
core/src/main/java/org/hibernate/ogm/util/impl/ArrayHelper.java
ArrayHelper.concat
public static <T> T[] concat(T[] first, T... second) { int firstLength = first.length; int secondLength = second.length; @SuppressWarnings("unchecked") T[] result = (T[]) Array.newInstance( first.getClass().getComponentType(), firstLength + secondLength ); System.arraycopy( first, 0, result, 0, firstLength ); System.arraycopy( second, 0, result, firstLength, secondLength ); return result; }
java
public static <T> T[] concat(T[] first, T... second) { int firstLength = first.length; int secondLength = second.length; @SuppressWarnings("unchecked") T[] result = (T[]) Array.newInstance( first.getClass().getComponentType(), firstLength + secondLength ); System.arraycopy( first, 0, result, 0, firstLength ); System.arraycopy( second, 0, result, firstLength, secondLength ); return result; }
[ "public", "static", "<", "T", ">", "T", "[", "]", "concat", "(", "T", "[", "]", "first", ",", "T", "...", "second", ")", "{", "int", "firstLength", "=", "first", ".", "length", ";", "int", "secondLength", "=", "second", ".", "length", ";", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "T", "[", "]", "result", "=", "(", "T", "[", "]", ")", "Array", ".", "newInstance", "(", "first", ".", "getClass", "(", ")", ".", "getComponentType", "(", ")", ",", "firstLength", "+", "secondLength", ")", ";", "System", ".", "arraycopy", "(", "first", ",", "0", ",", "result", ",", "0", ",", "firstLength", ")", ";", "System", ".", "arraycopy", "(", "second", ",", "0", ",", "result", ",", "firstLength", ",", "secondLength", ")", ";", "return", "result", ";", "}" ]
Concats two arrays. @param first the first array @param second the second array @param <T> the type of the element in the array @return a new array created adding the element in the second array after the first one
[ "Concats", "two", "arrays", "." ]
9ea971df7c27277029006a6f748d8272fb1d69d2
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/util/impl/ArrayHelper.java#L79-L89
160,684
hibernate/hibernate-ogm
core/src/main/java/org/hibernate/ogm/util/impl/ArrayHelper.java
ArrayHelper.concat
public static <T> T[] concat(T firstElement, T... array) { @SuppressWarnings("unchecked") T[] result = (T[]) Array.newInstance( firstElement.getClass(), 1 + array.length ); result[0] = firstElement; System.arraycopy( array, 0, result, 1, array.length ); return result; }
java
public static <T> T[] concat(T firstElement, T... array) { @SuppressWarnings("unchecked") T[] result = (T[]) Array.newInstance( firstElement.getClass(), 1 + array.length ); result[0] = firstElement; System.arraycopy( array, 0, result, 1, array.length ); return result; }
[ "public", "static", "<", "T", ">", "T", "[", "]", "concat", "(", "T", "firstElement", ",", "T", "...", "array", ")", "{", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "T", "[", "]", "result", "=", "(", "T", "[", "]", ")", "Array", ".", "newInstance", "(", "firstElement", ".", "getClass", "(", ")", ",", "1", "+", "array", ".", "length", ")", ";", "result", "[", "0", "]", "=", "firstElement", ";", "System", ".", "arraycopy", "(", "array", ",", "0", ",", "result", ",", "1", ",", "array", ".", "length", ")", ";", "return", "result", ";", "}" ]
Concats an element and an array. @param firstElement the first element @param array the array @param <T> the type of the element in the array @return a new array created adding the element in the second array after the first element
[ "Concats", "an", "element", "and", "an", "array", "." ]
9ea971df7c27277029006a6f748d8272fb1d69d2
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/util/impl/ArrayHelper.java#L123-L130
160,685
hibernate/hibernate-ogm
core/src/main/java/org/hibernate/ogm/id/impl/OgmGeneratorBase.java
OgmGeneratorBase.doWorkInIsolationTransaction
private Serializable doWorkInIsolationTransaction(final SharedSessionContractImplementor session) throws HibernateException { class Work extends AbstractReturningWork<IntegralDataTypeHolder> { private final SharedSessionContractImplementor localSession = session; @Override public IntegralDataTypeHolder execute(Connection connection) throws SQLException { try { return doWorkInCurrentTransactionIfAny( localSession ); } catch ( RuntimeException sqle ) { throw new HibernateException( "Could not get or update next value", sqle ); } } } //we want to work out of transaction boolean workInTransaction = false; Work work = new Work(); Serializable generatedValue = session.getTransactionCoordinator().createIsolationDelegate().delegateWork( work, workInTransaction ); return generatedValue; }
java
private Serializable doWorkInIsolationTransaction(final SharedSessionContractImplementor session) throws HibernateException { class Work extends AbstractReturningWork<IntegralDataTypeHolder> { private final SharedSessionContractImplementor localSession = session; @Override public IntegralDataTypeHolder execute(Connection connection) throws SQLException { try { return doWorkInCurrentTransactionIfAny( localSession ); } catch ( RuntimeException sqle ) { throw new HibernateException( "Could not get or update next value", sqle ); } } } //we want to work out of transaction boolean workInTransaction = false; Work work = new Work(); Serializable generatedValue = session.getTransactionCoordinator().createIsolationDelegate().delegateWork( work, workInTransaction ); return generatedValue; }
[ "private", "Serializable", "doWorkInIsolationTransaction", "(", "final", "SharedSessionContractImplementor", "session", ")", "throws", "HibernateException", "{", "class", "Work", "extends", "AbstractReturningWork", "<", "IntegralDataTypeHolder", ">", "{", "private", "final", "SharedSessionContractImplementor", "localSession", "=", "session", ";", "@", "Override", "public", "IntegralDataTypeHolder", "execute", "(", "Connection", "connection", ")", "throws", "SQLException", "{", "try", "{", "return", "doWorkInCurrentTransactionIfAny", "(", "localSession", ")", ";", "}", "catch", "(", "RuntimeException", "sqle", ")", "{", "throw", "new", "HibernateException", "(", "\"Could not get or update next value\"", ",", "sqle", ")", ";", "}", "}", "}", "//we want to work out of transaction", "boolean", "workInTransaction", "=", "false", ";", "Work", "work", "=", "new", "Work", "(", ")", ";", "Serializable", "generatedValue", "=", "session", ".", "getTransactionCoordinator", "(", ")", ".", "createIsolationDelegate", "(", ")", ".", "delegateWork", "(", "work", ",", "workInTransaction", ")", ";", "return", "generatedValue", ";", "}" ]
copied and altered from TransactionHelper
[ "copied", "and", "altered", "from", "TransactionHelper" ]
9ea971df7c27277029006a6f748d8272fb1d69d2
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/id/impl/OgmGeneratorBase.java#L132-L152
160,686
hibernate/hibernate-ogm
infinispan-embedded/src/main/java/org/hibernate/ogm/datastore/infinispan/persistencestrategy/impl/ExternalizersIntegration.java
ExternalizersIntegration.registerOgmExternalizers
public static void registerOgmExternalizers(SerializationConfigurationBuilder cfg) { for ( AdvancedExternalizer<?> advancedExternalizer : ogmExternalizers.values() ) { cfg.addAdvancedExternalizer( advancedExternalizer ); } }
java
public static void registerOgmExternalizers(SerializationConfigurationBuilder cfg) { for ( AdvancedExternalizer<?> advancedExternalizer : ogmExternalizers.values() ) { cfg.addAdvancedExternalizer( advancedExternalizer ); } }
[ "public", "static", "void", "registerOgmExternalizers", "(", "SerializationConfigurationBuilder", "cfg", ")", "{", "for", "(", "AdvancedExternalizer", "<", "?", ">", "advancedExternalizer", ":", "ogmExternalizers", ".", "values", "(", ")", ")", "{", "cfg", ".", "addAdvancedExternalizer", "(", "advancedExternalizer", ")", ";", "}", "}" ]
Registers all custom Externalizer implementations that Hibernate OGM needs into an Infinispan CacheManager configuration. @see ExternalizerIds @param cfg the Serialization section of a GlobalConfiguration builder
[ "Registers", "all", "custom", "Externalizer", "implementations", "that", "Hibernate", "OGM", "needs", "into", "an", "Infinispan", "CacheManager", "configuration", "." ]
9ea971df7c27277029006a6f748d8272fb1d69d2
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/infinispan-embedded/src/main/java/org/hibernate/ogm/datastore/infinispan/persistencestrategy/impl/ExternalizersIntegration.java#L76-L80
160,687
hibernate/hibernate-ogm
infinispan-embedded/src/main/java/org/hibernate/ogm/datastore/infinispan/persistencestrategy/impl/ExternalizersIntegration.java
ExternalizersIntegration.registerOgmExternalizers
public static void registerOgmExternalizers(GlobalConfiguration globalCfg) { Map<Integer, AdvancedExternalizer<?>> externalizerMap = globalCfg.serialization().advancedExternalizers(); externalizerMap.putAll( ogmExternalizers ); }
java
public static void registerOgmExternalizers(GlobalConfiguration globalCfg) { Map<Integer, AdvancedExternalizer<?>> externalizerMap = globalCfg.serialization().advancedExternalizers(); externalizerMap.putAll( ogmExternalizers ); }
[ "public", "static", "void", "registerOgmExternalizers", "(", "GlobalConfiguration", "globalCfg", ")", "{", "Map", "<", "Integer", ",", "AdvancedExternalizer", "<", "?", ">", ">", "externalizerMap", "=", "globalCfg", ".", "serialization", "(", ")", ".", "advancedExternalizers", "(", ")", ";", "externalizerMap", ".", "putAll", "(", "ogmExternalizers", ")", ";", "}" ]
Registers all custom Externalizer implementations that Hibernate OGM needs into a running Infinispan CacheManager configuration. This is only safe to do when Caches from this CacheManager haven't been started yet, or the ones already started do not contain any data needing these. @see ExternalizerIds @param globalCfg the Serialization section of a GlobalConfiguration builder
[ "Registers", "all", "custom", "Externalizer", "implementations", "that", "Hibernate", "OGM", "needs", "into", "a", "running", "Infinispan", "CacheManager", "configuration", ".", "This", "is", "only", "safe", "to", "do", "when", "Caches", "from", "this", "CacheManager", "haven", "t", "been", "started", "yet", "or", "the", "ones", "already", "started", "do", "not", "contain", "any", "data", "needing", "these", "." ]
9ea971df7c27277029006a6f748d8272fb1d69d2
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/infinispan-embedded/src/main/java/org/hibernate/ogm/datastore/infinispan/persistencestrategy/impl/ExternalizersIntegration.java#L91-L94
160,688
hibernate/hibernate-ogm
infinispan-embedded/src/main/java/org/hibernate/ogm/datastore/infinispan/persistencestrategy/impl/ExternalizersIntegration.java
ExternalizersIntegration.validateExternalizersPresent
public static void validateExternalizersPresent(EmbeddedCacheManager externalCacheManager) { Map<Integer, AdvancedExternalizer<?>> externalizerMap = externalCacheManager .getCacheManagerConfiguration() .serialization() .advancedExternalizers(); for ( AdvancedExternalizer<?> ogmExternalizer : ogmExternalizers.values() ) { final Integer externalizerId = ogmExternalizer.getId(); AdvancedExternalizer<?> registeredExternalizer = externalizerMap.get( externalizerId ); if ( registeredExternalizer == null ) { throw log.externalizersNotRegistered( externalizerId, ogmExternalizer.getClass() ); } else if ( !registeredExternalizer.getClass().equals( ogmExternalizer ) ) { if ( registeredExternalizer.getClass().toString().equals( ogmExternalizer.getClass().toString() ) ) { // same class name, yet different Class definition! throw log.registeredExternalizerNotLoadedFromOGMClassloader( registeredExternalizer.getClass() ); } else { throw log.externalizerIdNotMatchingType( externalizerId, registeredExternalizer, ogmExternalizer ); } } } }
java
public static void validateExternalizersPresent(EmbeddedCacheManager externalCacheManager) { Map<Integer, AdvancedExternalizer<?>> externalizerMap = externalCacheManager .getCacheManagerConfiguration() .serialization() .advancedExternalizers(); for ( AdvancedExternalizer<?> ogmExternalizer : ogmExternalizers.values() ) { final Integer externalizerId = ogmExternalizer.getId(); AdvancedExternalizer<?> registeredExternalizer = externalizerMap.get( externalizerId ); if ( registeredExternalizer == null ) { throw log.externalizersNotRegistered( externalizerId, ogmExternalizer.getClass() ); } else if ( !registeredExternalizer.getClass().equals( ogmExternalizer ) ) { if ( registeredExternalizer.getClass().toString().equals( ogmExternalizer.getClass().toString() ) ) { // same class name, yet different Class definition! throw log.registeredExternalizerNotLoadedFromOGMClassloader( registeredExternalizer.getClass() ); } else { throw log.externalizerIdNotMatchingType( externalizerId, registeredExternalizer, ogmExternalizer ); } } } }
[ "public", "static", "void", "validateExternalizersPresent", "(", "EmbeddedCacheManager", "externalCacheManager", ")", "{", "Map", "<", "Integer", ",", "AdvancedExternalizer", "<", "?", ">", ">", "externalizerMap", "=", "externalCacheManager", ".", "getCacheManagerConfiguration", "(", ")", ".", "serialization", "(", ")", ".", "advancedExternalizers", "(", ")", ";", "for", "(", "AdvancedExternalizer", "<", "?", ">", "ogmExternalizer", ":", "ogmExternalizers", ".", "values", "(", ")", ")", "{", "final", "Integer", "externalizerId", "=", "ogmExternalizer", ".", "getId", "(", ")", ";", "AdvancedExternalizer", "<", "?", ">", "registeredExternalizer", "=", "externalizerMap", ".", "get", "(", "externalizerId", ")", ";", "if", "(", "registeredExternalizer", "==", "null", ")", "{", "throw", "log", ".", "externalizersNotRegistered", "(", "externalizerId", ",", "ogmExternalizer", ".", "getClass", "(", ")", ")", ";", "}", "else", "if", "(", "!", "registeredExternalizer", ".", "getClass", "(", ")", ".", "equals", "(", "ogmExternalizer", ")", ")", "{", "if", "(", "registeredExternalizer", ".", "getClass", "(", ")", ".", "toString", "(", ")", ".", "equals", "(", "ogmExternalizer", ".", "getClass", "(", ")", ".", "toString", "(", ")", ")", ")", "{", "// same class name, yet different Class definition!", "throw", "log", ".", "registeredExternalizerNotLoadedFromOGMClassloader", "(", "registeredExternalizer", ".", "getClass", "(", ")", ")", ";", "}", "else", "{", "throw", "log", ".", "externalizerIdNotMatchingType", "(", "externalizerId", ",", "registeredExternalizer", ",", "ogmExternalizer", ")", ";", "}", "}", "}", "}" ]
Verify that all OGM custom externalizers are present. N.B. even if some Externalizer is only needed in specific configuration, it is not safe to start a CacheManager without one as the same CacheManager might be used, or have been used in the past, to store data using a different configuration. @see ExternalizerIds @see AdvancedExternalizer @param externalCacheManager the provided CacheManager to validate
[ "Verify", "that", "all", "OGM", "custom", "externalizers", "are", "present", ".", "N", ".", "B", ".", "even", "if", "some", "Externalizer", "is", "only", "needed", "in", "specific", "configuration", "it", "is", "not", "safe", "to", "start", "a", "CacheManager", "without", "one", "as", "the", "same", "CacheManager", "might", "be", "used", "or", "have", "been", "used", "in", "the", "past", "to", "store", "data", "using", "a", "different", "configuration", "." ]
9ea971df7c27277029006a6f748d8272fb1d69d2
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/infinispan-embedded/src/main/java/org/hibernate/ogm/datastore/infinispan/persistencestrategy/impl/ExternalizersIntegration.java#L107-L128
160,689
hibernate/hibernate-ogm
core/src/main/java/org/hibernate/ogm/datastore/map/impl/MapDatastoreProvider.java
MapDatastoreProvider.writeLock
public void writeLock(EntityKey key, int timeout) { ReadWriteLock lock = getLock( key ); Lock writeLock = lock.writeLock(); acquireLock( key, timeout, writeLock ); }
java
public void writeLock(EntityKey key, int timeout) { ReadWriteLock lock = getLock( key ); Lock writeLock = lock.writeLock(); acquireLock( key, timeout, writeLock ); }
[ "public", "void", "writeLock", "(", "EntityKey", "key", ",", "int", "timeout", ")", "{", "ReadWriteLock", "lock", "=", "getLock", "(", "key", ")", ";", "Lock", "writeLock", "=", "lock", ".", "writeLock", "(", ")", ";", "acquireLock", "(", "key", ",", "timeout", ",", "writeLock", ")", ";", "}" ]
Acquires a write lock on a specific key. @param key The key to lock @param timeout in milliseconds; -1 means wait indefinitely, 0 means no wait.
[ "Acquires", "a", "write", "lock", "on", "a", "specific", "key", "." ]
9ea971df7c27277029006a6f748d8272fb1d69d2
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/datastore/map/impl/MapDatastoreProvider.java#L94-L98
160,690
hibernate/hibernate-ogm
core/src/main/java/org/hibernate/ogm/datastore/map/impl/MapDatastoreProvider.java
MapDatastoreProvider.readLock
public void readLock(EntityKey key, int timeout) { ReadWriteLock lock = getLock( key ); Lock readLock = lock.readLock(); acquireLock( key, timeout, readLock ); }
java
public void readLock(EntityKey key, int timeout) { ReadWriteLock lock = getLock( key ); Lock readLock = lock.readLock(); acquireLock( key, timeout, readLock ); }
[ "public", "void", "readLock", "(", "EntityKey", "key", ",", "int", "timeout", ")", "{", "ReadWriteLock", "lock", "=", "getLock", "(", "key", ")", ";", "Lock", "readLock", "=", "lock", ".", "readLock", "(", ")", ";", "acquireLock", "(", "key", ",", "timeout", ",", "readLock", ")", ";", "}" ]
Acquires a read lock on a specific key. @param key The key to lock @param timeout in milliseconds; -1 means wait indefinitely, 0 means no wait.
[ "Acquires", "a", "read", "lock", "on", "a", "specific", "key", "." ]
9ea971df7c27277029006a6f748d8272fb1d69d2
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/datastore/map/impl/MapDatastoreProvider.java#L105-L109
160,691
hibernate/hibernate-ogm
core/src/main/java/org/hibernate/ogm/datastore/map/impl/MapDatastoreProvider.java
MapDatastoreProvider.getAssociationsMap
public Map<AssociationKey, Map<RowKey, Map<String, Object>>> getAssociationsMap() { return Collections.unmodifiableMap( associationsKeyValueStorage ); }
java
public Map<AssociationKey, Map<RowKey, Map<String, Object>>> getAssociationsMap() { return Collections.unmodifiableMap( associationsKeyValueStorage ); }
[ "public", "Map", "<", "AssociationKey", ",", "Map", "<", "RowKey", ",", "Map", "<", "String", ",", "Object", ">", ">", ">", "getAssociationsMap", "(", ")", "{", "return", "Collections", ".", "unmodifiableMap", "(", "associationsKeyValueStorage", ")", ";", "}" ]
Meant to execute assertions in tests only @return a read-only view of the map containing the relations between entities
[ "Meant", "to", "execute", "assertions", "in", "tests", "only" ]
9ea971df7c27277029006a6f748d8272fb1d69d2
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/datastore/map/impl/MapDatastoreProvider.java#L188-L190
160,692
hibernate/hibernate-ogm
core/src/main/java/org/hibernate/ogm/datastore/document/impl/DotPatternMapHelpers.java
DotPatternMapHelpers.flatten
public static String flatten(String left, String right) { return left == null || left.isEmpty() ? right : left + "." + right; }
java
public static String flatten(String left, String right) { return left == null || left.isEmpty() ? right : left + "." + right; }
[ "public", "static", "String", "flatten", "(", "String", "left", ",", "String", "right", ")", "{", "return", "left", "==", "null", "||", "left", ".", "isEmpty", "(", ")", "?", "right", ":", "left", "+", "\".\"", "+", "right", ";", "}" ]
Links the two field names into a single left.right field name. If the left field is empty, right is returned @param left one field name @param right the other field name @return left.right or right if left is an empty string
[ "Links", "the", "two", "field", "names", "into", "a", "single", "left", ".", "right", "field", "name", ".", "If", "the", "left", "field", "is", "empty", "right", "is", "returned" ]
9ea971df7c27277029006a6f748d8272fb1d69d2
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/datastore/document/impl/DotPatternMapHelpers.java#L100-L102
160,693
hibernate/hibernate-ogm
core/src/main/java/org/hibernate/ogm/datastore/document/impl/DotPatternMapHelpers.java
DotPatternMapHelpers.organizeAssociationMapByRowKey
public static boolean organizeAssociationMapByRowKey( org.hibernate.ogm.model.spi.Association association, AssociationKey key, AssociationContext associationContext) { if ( association.isEmpty() ) { return false; } if ( key.getMetadata().getRowKeyIndexColumnNames().length != 1 ) { return false; } Object valueOfFirstRow = association.get( association.getKeys().iterator().next() ) .get( key.getMetadata().getRowKeyIndexColumnNames()[0] ); if ( !( valueOfFirstRow instanceof String ) ) { return false; } // The list style may be explicitly enforced for compatibility reasons return getMapStorage( associationContext ) == MapStorageType.BY_KEY; }
java
public static boolean organizeAssociationMapByRowKey( org.hibernate.ogm.model.spi.Association association, AssociationKey key, AssociationContext associationContext) { if ( association.isEmpty() ) { return false; } if ( key.getMetadata().getRowKeyIndexColumnNames().length != 1 ) { return false; } Object valueOfFirstRow = association.get( association.getKeys().iterator().next() ) .get( key.getMetadata().getRowKeyIndexColumnNames()[0] ); if ( !( valueOfFirstRow instanceof String ) ) { return false; } // The list style may be explicitly enforced for compatibility reasons return getMapStorage( associationContext ) == MapStorageType.BY_KEY; }
[ "public", "static", "boolean", "organizeAssociationMapByRowKey", "(", "org", ".", "hibernate", ".", "ogm", ".", "model", ".", "spi", ".", "Association", "association", ",", "AssociationKey", "key", ",", "AssociationContext", "associationContext", ")", "{", "if", "(", "association", ".", "isEmpty", "(", ")", ")", "{", "return", "false", ";", "}", "if", "(", "key", ".", "getMetadata", "(", ")", ".", "getRowKeyIndexColumnNames", "(", ")", ".", "length", "!=", "1", ")", "{", "return", "false", ";", "}", "Object", "valueOfFirstRow", "=", "association", ".", "get", "(", "association", ".", "getKeys", "(", ")", ".", "iterator", "(", ")", ".", "next", "(", ")", ")", ".", "get", "(", "key", ".", "getMetadata", "(", ")", ".", "getRowKeyIndexColumnNames", "(", ")", "[", "0", "]", ")", ";", "if", "(", "!", "(", "valueOfFirstRow", "instanceof", "String", ")", ")", "{", "return", "false", ";", "}", "// The list style may be explicitly enforced for compatibility reasons", "return", "getMapStorage", "(", "associationContext", ")", "==", "MapStorageType", ".", "BY_KEY", ";", "}" ]
Whether the rows of the given association should be stored in a hash using the single row key column as key or not.
[ "Whether", "the", "rows", "of", "the", "given", "association", "should", "be", "stored", "in", "a", "hash", "using", "the", "single", "row", "key", "column", "as", "key", "or", "not", "." ]
9ea971df7c27277029006a6f748d8272fb1d69d2
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/datastore/document/impl/DotPatternMapHelpers.java#L108-L130
160,694
hibernate/hibernate-ogm
core/src/main/java/org/hibernate/ogm/type/impl/ManyToOneType.java
ManyToOneType.scheduleBatchLoadIfNeeded
private void scheduleBatchLoadIfNeeded(Serializable id, SharedSessionContractImplementor session) throws MappingException { //cannot batch fetch by unique key (property-ref associations) if ( StringHelper.isEmpty( delegate.getRHSUniqueKeyPropertyName() ) && id != null ) { EntityPersister persister = session.getFactory().getMetamodel().entityPersister( delegate.getAssociatedEntityName() ); EntityKey entityKey = session.generateEntityKey( id, persister ); if ( !session.getPersistenceContext().containsEntity( entityKey ) ) { session.getPersistenceContext().getBatchFetchQueue().addBatchLoadableEntityKey( entityKey ); } } }
java
private void scheduleBatchLoadIfNeeded(Serializable id, SharedSessionContractImplementor session) throws MappingException { //cannot batch fetch by unique key (property-ref associations) if ( StringHelper.isEmpty( delegate.getRHSUniqueKeyPropertyName() ) && id != null ) { EntityPersister persister = session.getFactory().getMetamodel().entityPersister( delegate.getAssociatedEntityName() ); EntityKey entityKey = session.generateEntityKey( id, persister ); if ( !session.getPersistenceContext().containsEntity( entityKey ) ) { session.getPersistenceContext().getBatchFetchQueue().addBatchLoadableEntityKey( entityKey ); } } }
[ "private", "void", "scheduleBatchLoadIfNeeded", "(", "Serializable", "id", ",", "SharedSessionContractImplementor", "session", ")", "throws", "MappingException", "{", "//cannot batch fetch by unique key (property-ref associations)", "if", "(", "StringHelper", ".", "isEmpty", "(", "delegate", ".", "getRHSUniqueKeyPropertyName", "(", ")", ")", "&&", "id", "!=", "null", ")", "{", "EntityPersister", "persister", "=", "session", ".", "getFactory", "(", ")", ".", "getMetamodel", "(", ")", ".", "entityPersister", "(", "delegate", ".", "getAssociatedEntityName", "(", ")", ")", ";", "EntityKey", "entityKey", "=", "session", ".", "generateEntityKey", "(", "id", ",", "persister", ")", ";", "if", "(", "!", "session", ".", "getPersistenceContext", "(", ")", ".", "containsEntity", "(", "entityKey", ")", ")", "{", "session", ".", "getPersistenceContext", "(", ")", ".", "getBatchFetchQueue", "(", ")", ".", "addBatchLoadableEntityKey", "(", "entityKey", ")", ";", "}", "}", "}" ]
Register the entity as batch loadable, if enabled Copied from {@link org.hibernate.type.ManyToOneType#scheduleBatchLoadIfNeeded}
[ "Register", "the", "entity", "as", "batch", "loadable", "if", "enabled" ]
9ea971df7c27277029006a6f748d8272fb1d69d2
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/type/impl/ManyToOneType.java#L80-L89
160,695
hibernate/hibernate-ogm
mongodb/src/main/java/org/hibernate/ogm/datastore/mongodb/type/GeoMultiPoint.java
GeoMultiPoint.addPoint
public GeoMultiPoint addPoint(GeoPoint point) { Contracts.assertNotNull( point, "point" ); this.points.add( point ); return this; }
java
public GeoMultiPoint addPoint(GeoPoint point) { Contracts.assertNotNull( point, "point" ); this.points.add( point ); return this; }
[ "public", "GeoMultiPoint", "addPoint", "(", "GeoPoint", "point", ")", "{", "Contracts", ".", "assertNotNull", "(", "point", ",", "\"point\"", ")", ";", "this", ".", "points", ".", "add", "(", "point", ")", ";", "return", "this", ";", "}" ]
Adds a new point. @param point a point @return this for chaining
[ "Adds", "a", "new", "point", "." ]
9ea971df7c27277029006a6f748d8272fb1d69d2
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/mongodb/src/main/java/org/hibernate/ogm/datastore/mongodb/type/GeoMultiPoint.java#L76-L80
160,696
hibernate/hibernate-ogm
neo4j/src/main/java/org/hibernate/ogm/datastore/neo4j/query/parsing/impl/Neo4jAliasResolver.java
Neo4jAliasResolver.findAlias
public String findAlias(String entityAlias, List<String> propertyPathWithoutAlias) { RelationshipAliasTree aliasTree = relationshipAliases.get( entityAlias ); if ( aliasTree == null ) { return null; } RelationshipAliasTree associationAlias = aliasTree; for ( int i = 0; i < propertyPathWithoutAlias.size(); i++ ) { associationAlias = associationAlias.findChild( propertyPathWithoutAlias.get( i ) ); if ( associationAlias == null ) { return null; } } return associationAlias.getAlias(); }
java
public String findAlias(String entityAlias, List<String> propertyPathWithoutAlias) { RelationshipAliasTree aliasTree = relationshipAliases.get( entityAlias ); if ( aliasTree == null ) { return null; } RelationshipAliasTree associationAlias = aliasTree; for ( int i = 0; i < propertyPathWithoutAlias.size(); i++ ) { associationAlias = associationAlias.findChild( propertyPathWithoutAlias.get( i ) ); if ( associationAlias == null ) { return null; } } return associationAlias.getAlias(); }
[ "public", "String", "findAlias", "(", "String", "entityAlias", ",", "List", "<", "String", ">", "propertyPathWithoutAlias", ")", "{", "RelationshipAliasTree", "aliasTree", "=", "relationshipAliases", ".", "get", "(", "entityAlias", ")", ";", "if", "(", "aliasTree", "==", "null", ")", "{", "return", "null", ";", "}", "RelationshipAliasTree", "associationAlias", "=", "aliasTree", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "propertyPathWithoutAlias", ".", "size", "(", ")", ";", "i", "++", ")", "{", "associationAlias", "=", "associationAlias", ".", "findChild", "(", "propertyPathWithoutAlias", ".", "get", "(", "i", ")", ")", ";", "if", "(", "associationAlias", "==", "null", ")", "{", "return", "null", ";", "}", "}", "return", "associationAlias", ".", "getAlias", "(", ")", ";", "}" ]
Given the alias of the entity and the path to the relationship it will return the alias of the component. @param entityAlias the alias of the entity @param propertyPathWithoutAlias the path to the property without the alias @return the alias the relationship or null
[ "Given", "the", "alias", "of", "the", "entity", "and", "the", "path", "to", "the", "relationship", "it", "will", "return", "the", "alias", "of", "the", "component", "." ]
9ea971df7c27277029006a6f748d8272fb1d69d2
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/neo4j/src/main/java/org/hibernate/ogm/datastore/neo4j/query/parsing/impl/Neo4jAliasResolver.java#L130-L143
160,697
hibernate/hibernate-ogm
neo4j/src/main/java/org/hibernate/ogm/datastore/neo4j/embedded/dialect/impl/EmbeddedNeo4jEntityQueries.java
EmbeddedNeo4jEntityQueries.createEmbedded
public Node createEmbedded(GraphDatabaseService executionEngine, Object[] columnValues) { Map<String, Object> params = params( columnValues ); Result result = executionEngine.execute( getCreateEmbeddedNodeQuery(), params ); return singleResult( result ); }
java
public Node createEmbedded(GraphDatabaseService executionEngine, Object[] columnValues) { Map<String, Object> params = params( columnValues ); Result result = executionEngine.execute( getCreateEmbeddedNodeQuery(), params ); return singleResult( result ); }
[ "public", "Node", "createEmbedded", "(", "GraphDatabaseService", "executionEngine", ",", "Object", "[", "]", "columnValues", ")", "{", "Map", "<", "String", ",", "Object", ">", "params", "=", "params", "(", "columnValues", ")", ";", "Result", "result", "=", "executionEngine", ".", "execute", "(", "getCreateEmbeddedNodeQuery", "(", ")", ",", "params", ")", ";", "return", "singleResult", "(", "result", ")", ";", "}" ]
Create a single node representing an embedded element. @param executionEngine the {@link GraphDatabaseService} used to run the query @param columnValues the values in {@link org.hibernate.ogm.model.key.spi.EntityKey#getColumnValues()} @return the corresponding node;
[ "Create", "a", "single", "node", "representing", "an", "embedded", "element", "." ]
9ea971df7c27277029006a6f748d8272fb1d69d2
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/neo4j/src/main/java/org/hibernate/ogm/datastore/neo4j/embedded/dialect/impl/EmbeddedNeo4jEntityQueries.java#L66-L70
160,698
hibernate/hibernate-ogm
neo4j/src/main/java/org/hibernate/ogm/datastore/neo4j/embedded/dialect/impl/EmbeddedNeo4jEntityQueries.java
EmbeddedNeo4jEntityQueries.findEntity
public Node findEntity(GraphDatabaseService executionEngine, Object[] columnValues) { Map<String, Object> params = params( columnValues ); Result result = executionEngine.execute( getFindEntityQuery(), params ); return singleResult( result ); }
java
public Node findEntity(GraphDatabaseService executionEngine, Object[] columnValues) { Map<String, Object> params = params( columnValues ); Result result = executionEngine.execute( getFindEntityQuery(), params ); return singleResult( result ); }
[ "public", "Node", "findEntity", "(", "GraphDatabaseService", "executionEngine", ",", "Object", "[", "]", "columnValues", ")", "{", "Map", "<", "String", ",", "Object", ">", "params", "=", "params", "(", "columnValues", ")", ";", "Result", "result", "=", "executionEngine", ".", "execute", "(", "getFindEntityQuery", "(", ")", ",", "params", ")", ";", "return", "singleResult", "(", "result", ")", ";", "}" ]
Find the node corresponding to an entity. @param executionEngine the {@link GraphDatabaseService} used to run the query @param columnValues the values in {@link org.hibernate.ogm.model.key.spi.EntityKey#getColumnValues()} @return the corresponding node
[ "Find", "the", "node", "corresponding", "to", "an", "entity", "." ]
9ea971df7c27277029006a6f748d8272fb1d69d2
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/neo4j/src/main/java/org/hibernate/ogm/datastore/neo4j/embedded/dialect/impl/EmbeddedNeo4jEntityQueries.java#L79-L83
160,699
hibernate/hibernate-ogm
neo4j/src/main/java/org/hibernate/ogm/datastore/neo4j/embedded/dialect/impl/EmbeddedNeo4jEntityQueries.java
EmbeddedNeo4jEntityQueries.insertEntity
public Node insertEntity(GraphDatabaseService executionEngine, Object[] columnValues) { Map<String, Object> params = params( columnValues ); Result result = executionEngine.execute( getCreateEntityQuery(), params ); return singleResult( result ); }
java
public Node insertEntity(GraphDatabaseService executionEngine, Object[] columnValues) { Map<String, Object> params = params( columnValues ); Result result = executionEngine.execute( getCreateEntityQuery(), params ); return singleResult( result ); }
[ "public", "Node", "insertEntity", "(", "GraphDatabaseService", "executionEngine", ",", "Object", "[", "]", "columnValues", ")", "{", "Map", "<", "String", ",", "Object", ">", "params", "=", "params", "(", "columnValues", ")", ";", "Result", "result", "=", "executionEngine", ".", "execute", "(", "getCreateEntityQuery", "(", ")", ",", "params", ")", ";", "return", "singleResult", "(", "result", ")", ";", "}" ]
Creates the node corresponding to an entity. @param executionEngine the {@link GraphDatabaseService} used to run the query @param columnValues the values in {@link org.hibernate.ogm.model.key.spi.EntityKey#getColumnValues()} @return the corresponding node
[ "Creates", "the", "node", "corresponding", "to", "an", "entity", "." ]
9ea971df7c27277029006a6f748d8272fb1d69d2
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/neo4j/src/main/java/org/hibernate/ogm/datastore/neo4j/embedded/dialect/impl/EmbeddedNeo4jEntityQueries.java#L131-L135