repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
peholmst/vaadin4spring | extensions/security/src/main/java/org/vaadin/spring/security/shared/VaadinUrlAuthenticationSuccessHandler.java | VaadinUrlAuthenticationSuccessHandler.clearAuthenticationAttributes | protected final void clearAuthenticationAttributes() {
HttpSession session = http.getCurrentRequest().getSession(false);
if (session == null) {
return;
}
session.removeAttribute(WebAttributes.AUTHENTICATION_EXCEPTION);
} | java | protected final void clearAuthenticationAttributes() {
HttpSession session = http.getCurrentRequest().getSession(false);
if (session == null) {
return;
}
session.removeAttribute(WebAttributes.AUTHENTICATION_EXCEPTION);
} | [
"protected",
"final",
"void",
"clearAuthenticationAttributes",
"(",
")",
"{",
"HttpSession",
"session",
"=",
"http",
".",
"getCurrentRequest",
"(",
")",
".",
"getSession",
"(",
"false",
")",
";",
"if",
"(",
"session",
"==",
"null",
")",
"{",
"return",
";",
... | Removes temporary authentication-related data which may have been stored in the session
during the authentication process. | [
"Removes",
"temporary",
"authentication",
"-",
"related",
"data",
"which",
"may",
"have",
"been",
"stored",
"in",
"the",
"session",
"during",
"the",
"authentication",
"process",
"."
] | ea896012f15d6abea6e6391def9a0001113a1f7a | https://github.com/peholmst/vaadin4spring/blob/ea896012f15d6abea6e6391def9a0001113a1f7a/extensions/security/src/main/java/org/vaadin/spring/security/shared/VaadinUrlAuthenticationSuccessHandler.java#L55-L63 | train |
peholmst/vaadin4spring | addons/sidebar/src/main/java/org/vaadin/spring/sidebar/components/ValoSideBar.java | ValoSideBar.setLargeIcons | public void setLargeIcons(boolean largeIcons) {
this.largeIcons = largeIcons;
if (getCompositionRoot() != null) {
if (largeIcons) {
getCompositionRoot().addStyleName(ValoTheme.MENU_PART_LARGE_ICONS);
} else {
getCompositionRoot().removeStyleName(Va... | java | public void setLargeIcons(boolean largeIcons) {
this.largeIcons = largeIcons;
if (getCompositionRoot() != null) {
if (largeIcons) {
getCompositionRoot().addStyleName(ValoTheme.MENU_PART_LARGE_ICONS);
} else {
getCompositionRoot().removeStyleName(Va... | [
"public",
"void",
"setLargeIcons",
"(",
"boolean",
"largeIcons",
")",
"{",
"this",
".",
"largeIcons",
"=",
"largeIcons",
";",
"if",
"(",
"getCompositionRoot",
"(",
")",
"!=",
"null",
")",
"{",
"if",
"(",
"largeIcons",
")",
"{",
"getCompositionRoot",
"(",
"... | Specifies whether the side bar should use large icons or not.
@see ValoTheme#MENU_PART_LARGE_ICONS | [
"Specifies",
"whether",
"the",
"side",
"bar",
"should",
"use",
"large",
"icons",
"or",
"not",
"."
] | ea896012f15d6abea6e6391def9a0001113a1f7a | https://github.com/peholmst/vaadin4spring/blob/ea896012f15d6abea6e6391def9a0001113a1f7a/addons/sidebar/src/main/java/org/vaadin/spring/sidebar/components/ValoSideBar.java#L95-L104 | train |
peholmst/vaadin4spring | addons/mvp/src/main/java/org/vaadin/spring/navigator/Presenter.java | Presenter.getView | @SuppressWarnings("unchecked")
public V getView() {
V result = null;
if (viewName != null) {
result = (V) viewProvider.getView(viewName);
}
return result;
} | java | @SuppressWarnings("unchecked")
public V getView() {
V result = null;
if (viewName != null) {
result = (V) viewProvider.getView(viewName);
}
return result;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"V",
"getView",
"(",
")",
"{",
"V",
"result",
"=",
"null",
";",
"if",
"(",
"viewName",
"!=",
"null",
")",
"{",
"result",
"=",
"(",
"V",
")",
"viewProvider",
".",
"getView",
"(",
"viewName",
... | Hands back the View that this Presenter works with
A match is made if the ViewProvider finds a VaadinView annotated View whose name matches Presenter's viewName
@return an implementor of {@link View} | [
"Hands",
"back",
"the",
"View",
"that",
"this",
"Presenter",
"works",
"with",
"A",
"match",
"is",
"made",
"if",
"the",
"ViewProvider",
"finds",
"a",
"VaadinView",
"annotated",
"View",
"whose",
"name",
"matches",
"Presenter",
"s",
"viewName"
] | ea896012f15d6abea6e6391def9a0001113a1f7a | https://github.com/peholmst/vaadin4spring/blob/ea896012f15d6abea6e6391def9a0001113a1f7a/addons/mvp/src/main/java/org/vaadin/spring/navigator/Presenter.java#L80-L87 | train |
peholmst/vaadin4spring | addons/i18n/src/main/java/org/vaadin/spring/i18n/I18N.java | I18N.getLocale | public Locale getLocale() {
UI currentUI = UI.getCurrent();
Locale locale = currentUI == null ? null : currentUI.getLocale();
if (locale == null) {
locale = Locale.getDefault();
}
return locale;
} | java | public Locale getLocale() {
UI currentUI = UI.getCurrent();
Locale locale = currentUI == null ? null : currentUI.getLocale();
if (locale == null) {
locale = Locale.getDefault();
}
return locale;
} | [
"public",
"Locale",
"getLocale",
"(",
")",
"{",
"UI",
"currentUI",
"=",
"UI",
".",
"getCurrent",
"(",
")",
";",
"Locale",
"locale",
"=",
"currentUI",
"==",
"null",
"?",
"null",
":",
"currentUI",
".",
"getLocale",
"(",
")",
";",
"if",
"(",
"locale",
"... | Gets the locale of the current Vaadin UI. If the locale can not be determinted, the default locale
is returned instead.
@return the current locale, never {@code null}.
@see com.vaadin.ui.UI#getLocale()
@see java.util.Locale#getDefault() | [
"Gets",
"the",
"locale",
"of",
"the",
"current",
"Vaadin",
"UI",
".",
"If",
"the",
"locale",
"can",
"not",
"be",
"determinted",
"the",
"default",
"locale",
"is",
"returned",
"instead",
"."
] | ea896012f15d6abea6e6391def9a0001113a1f7a | https://github.com/peholmst/vaadin4spring/blob/ea896012f15d6abea6e6391def9a0001113a1f7a/addons/i18n/src/main/java/org/vaadin/spring/i18n/I18N.java#L203-L210 | train |
peholmst/vaadin4spring | addons/sidebar/src/main/java/org/vaadin/spring/sidebar/SideBarUtils.java | SideBarUtils.getSideBarSections | public Collection<SideBarSectionDescriptor> getSideBarSections(Class<? extends UI> uiClass) {
List<SideBarSectionDescriptor> supportedSections = new ArrayList<SideBarSectionDescriptor>();
for (SideBarSectionDescriptor section : sections) {
if (section.isAvailableFor(uiClass)) {
... | java | public Collection<SideBarSectionDescriptor> getSideBarSections(Class<? extends UI> uiClass) {
List<SideBarSectionDescriptor> supportedSections = new ArrayList<SideBarSectionDescriptor>();
for (SideBarSectionDescriptor section : sections) {
if (section.isAvailableFor(uiClass)) {
... | [
"public",
"Collection",
"<",
"SideBarSectionDescriptor",
">",
"getSideBarSections",
"(",
"Class",
"<",
"?",
"extends",
"UI",
">",
"uiClass",
")",
"{",
"List",
"<",
"SideBarSectionDescriptor",
">",
"supportedSections",
"=",
"new",
"ArrayList",
"<",
"SideBarSectionDes... | Gets all side bar sections for the specified UI class.
@param uiClass the UI class, must not be {@code null}.
@return a collection of side bar section descriptors, never {@code null}.
@see SideBarSection#ui() | [
"Gets",
"all",
"side",
"bar",
"sections",
"for",
"the",
"specified",
"UI",
"class",
"."
] | ea896012f15d6abea6e6391def9a0001113a1f7a | https://github.com/peholmst/vaadin4spring/blob/ea896012f15d6abea6e6391def9a0001113a1f7a/addons/sidebar/src/main/java/org/vaadin/spring/sidebar/SideBarUtils.java#L106-L114 | train |
peholmst/vaadin4spring | addons/sidebar/src/main/java/org/vaadin/spring/sidebar/SideBarUtils.java | SideBarUtils.getSideBarItems | public Collection<SideBarItemDescriptor> getSideBarItems(SideBarSectionDescriptor descriptor) {
List<SideBarItemDescriptor> supportedItems = new ArrayList<SideBarItemDescriptor>();
for (SideBarItemDescriptor item : items) {
if (item.isMemberOfSection(descriptor)) {
supportedI... | java | public Collection<SideBarItemDescriptor> getSideBarItems(SideBarSectionDescriptor descriptor) {
List<SideBarItemDescriptor> supportedItems = new ArrayList<SideBarItemDescriptor>();
for (SideBarItemDescriptor item : items) {
if (item.isMemberOfSection(descriptor)) {
supportedI... | [
"public",
"Collection",
"<",
"SideBarItemDescriptor",
">",
"getSideBarItems",
"(",
"SideBarSectionDescriptor",
"descriptor",
")",
"{",
"List",
"<",
"SideBarItemDescriptor",
">",
"supportedItems",
"=",
"new",
"ArrayList",
"<",
"SideBarItemDescriptor",
">",
"(",
")",
";... | Gets all side bar items for the specified side bar section.
@param descriptor descriptor the side bar section descriptor, must not be {@code null}.
@return a collection of side bar item descriptors, never {@code null}. | [
"Gets",
"all",
"side",
"bar",
"items",
"for",
"the",
"specified",
"side",
"bar",
"section",
"."
] | ea896012f15d6abea6e6391def9a0001113a1f7a | https://github.com/peholmst/vaadin4spring/blob/ea896012f15d6abea6e6391def9a0001113a1f7a/addons/sidebar/src/main/java/org/vaadin/spring/sidebar/SideBarUtils.java#L122-L130 | train |
peholmst/vaadin4spring | extensions/security/src/main/java/org/vaadin/spring/security/managed/DefaultVaadinManagedSecurity.java | DefaultVaadinManagedSecurity.clearAndReinitializeSession | protected void clearAndReinitializeSession() {
final VaadinRequest currentRequest = VaadinService.getCurrentRequest();
final UI currentUI = UI.getCurrent();
if (currentUI != null) {
final Transport transport = currentUI.getPushConfiguration().getTransport();
if (Transport... | java | protected void clearAndReinitializeSession() {
final VaadinRequest currentRequest = VaadinService.getCurrentRequest();
final UI currentUI = UI.getCurrent();
if (currentUI != null) {
final Transport transport = currentUI.getPushConfiguration().getTransport();
if (Transport... | [
"protected",
"void",
"clearAndReinitializeSession",
"(",
")",
"{",
"final",
"VaadinRequest",
"currentRequest",
"=",
"VaadinService",
".",
"getCurrentRequest",
"(",
")",
";",
"final",
"UI",
"currentUI",
"=",
"UI",
".",
"getCurrent",
"(",
")",
";",
"if",
"(",
"c... | Clears the session of all attributes except some internal Vaadin attributes and reinitializes it. If Websocket
Push is used, the session will never be reinitialized since this throws errors on at least
Tomcat 8. | [
"Clears",
"the",
"session",
"of",
"all",
"attributes",
"except",
"some",
"internal",
"Vaadin",
"attributes",
"and",
"reinitializes",
"it",
".",
"If",
"Websocket",
"Push",
"is",
"used",
"the",
"session",
"will",
"never",
"be",
"reinitialized",
"since",
"this",
... | ea896012f15d6abea6e6391def9a0001113a1f7a | https://github.com/peholmst/vaadin4spring/blob/ea896012f15d6abea6e6391def9a0001113a1f7a/extensions/security/src/main/java/org/vaadin/spring/security/managed/DefaultVaadinManagedSecurity.java#L77-L109 | train |
peholmst/vaadin4spring | extensions/security/src/main/java/org/vaadin/spring/security/shared/DefaultVaadinSharedSecurity.java | DefaultVaadinSharedSecurity.getCurrentRequest | protected HttpServletRequest getCurrentRequest() {
final HttpServletRequest request = httpService.getCurrentRequest();
if (request == null) {
throw new IllegalStateException("No HttpServletRequest bound to current thread");
}
return request;
} | java | protected HttpServletRequest getCurrentRequest() {
final HttpServletRequest request = httpService.getCurrentRequest();
if (request == null) {
throw new IllegalStateException("No HttpServletRequest bound to current thread");
}
return request;
} | [
"protected",
"HttpServletRequest",
"getCurrentRequest",
"(",
")",
"{",
"final",
"HttpServletRequest",
"request",
"=",
"httpService",
".",
"getCurrentRequest",
"(",
")",
";",
"if",
"(",
"request",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"("... | Returns the HTTP request bound to the current thread. | [
"Returns",
"the",
"HTTP",
"request",
"bound",
"to",
"the",
"current",
"thread",
"."
] | ea896012f15d6abea6e6391def9a0001113a1f7a | https://github.com/peholmst/vaadin4spring/blob/ea896012f15d6abea6e6391def9a0001113a1f7a/extensions/security/src/main/java/org/vaadin/spring/security/shared/DefaultVaadinSharedSecurity.java#L143-L149 | train |
peholmst/vaadin4spring | extensions/security/src/main/java/org/vaadin/spring/security/shared/DefaultVaadinSharedSecurity.java | DefaultVaadinSharedSecurity.getCurrentResponse | protected HttpServletResponse getCurrentResponse() {
final HttpServletResponse response = httpService.getCurrentResponse();
if (response == null) {
throw new IllegalStateException("No HttpServletResponse bound to current thread");
}
return response;
} | java | protected HttpServletResponse getCurrentResponse() {
final HttpServletResponse response = httpService.getCurrentResponse();
if (response == null) {
throw new IllegalStateException("No HttpServletResponse bound to current thread");
}
return response;
} | [
"protected",
"HttpServletResponse",
"getCurrentResponse",
"(",
")",
"{",
"final",
"HttpServletResponse",
"response",
"=",
"httpService",
".",
"getCurrentResponse",
"(",
")",
";",
"if",
"(",
"response",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",... | Returns the HTTP response bound to the current thread. | [
"Returns",
"the",
"HTTP",
"response",
"bound",
"to",
"the",
"current",
"thread",
"."
] | ea896012f15d6abea6e6391def9a0001113a1f7a | https://github.com/peholmst/vaadin4spring/blob/ea896012f15d6abea6e6391def9a0001113a1f7a/extensions/security/src/main/java/org/vaadin/spring/security/shared/DefaultVaadinSharedSecurity.java#L154-L160 | train |
Azure/azure-functions-java-worker | src/main/java/com/microsoft/azure/functions/worker/description/FunctionMethodDescriptor.java | FunctionMethodDescriptor.getJarDirectory | public File getJarDirectory() {
if (jarDirectory == null) {
this.jarDirectory = new File(jarPath).getAbsoluteFile().getParentFile();
}
return jarDirectory;
} | java | public File getJarDirectory() {
if (jarDirectory == null) {
this.jarDirectory = new File(jarPath).getAbsoluteFile().getParentFile();
}
return jarDirectory;
} | [
"public",
"File",
"getJarDirectory",
"(",
")",
"{",
"if",
"(",
"jarDirectory",
"==",
"null",
")",
"{",
"this",
".",
"jarDirectory",
"=",
"new",
"File",
"(",
"jarPath",
")",
".",
"getAbsoluteFile",
"(",
")",
".",
"getParentFile",
"(",
")",
";",
"}",
"re... | Gets the directory of the jar-file | [
"Gets",
"the",
"directory",
"of",
"the",
"jar",
"-",
"file"
] | 12dcee7ca829a5f961a23cfd1b03a7eb7feae5e0 | https://github.com/Azure/azure-functions-java-worker/blob/12dcee7ca829a5f961a23cfd1b03a7eb7feae5e0/src/main/java/com/microsoft/azure/functions/worker/description/FunctionMethodDescriptor.java#L49-L54 | train |
fabiomaffioletti/jsondoc | jsondoc-springmvc/src/main/java/org/jsondoc/springmvc/scanner/builder/SpringResponseBuilder.java | SpringResponseBuilder.buildResponse | public static ApiResponseObjectDoc buildResponse(Method method) {
ApiResponseObjectDoc apiResponseObjectDoc = new ApiResponseObjectDoc(JSONDocTypeBuilder.build(new JSONDocType(), method.getReturnType(), method.getGenericReturnType()));
if(method.getReturnType().isAssignableFrom(ResponseEntity.class)) {
apiRes... | java | public static ApiResponseObjectDoc buildResponse(Method method) {
ApiResponseObjectDoc apiResponseObjectDoc = new ApiResponseObjectDoc(JSONDocTypeBuilder.build(new JSONDocType(), method.getReturnType(), method.getGenericReturnType()));
if(method.getReturnType().isAssignableFrom(ResponseEntity.class)) {
apiRes... | [
"public",
"static",
"ApiResponseObjectDoc",
"buildResponse",
"(",
"Method",
"method",
")",
"{",
"ApiResponseObjectDoc",
"apiResponseObjectDoc",
"=",
"new",
"ApiResponseObjectDoc",
"(",
"JSONDocTypeBuilder",
".",
"build",
"(",
"new",
"JSONDocType",
"(",
")",
",",
"meth... | Builds the ApiResponseObjectDoc from the method's return type and checks if the first type corresponds to a ResponseEntity class. In that case removes the "responseentity"
string from the final list because it's not important to the documentation user.
@param method
@return | [
"Builds",
"the",
"ApiResponseObjectDoc",
"from",
"the",
"method",
"s",
"return",
"type",
"and",
"checks",
"if",
"the",
"first",
"type",
"corresponds",
"to",
"a",
"ResponseEntity",
"class",
".",
"In",
"that",
"case",
"removes",
"the",
"responseentity",
"string",
... | 26bf413c236e7c3b66f534c2451b157783c1f45e | https://github.com/fabiomaffioletti/jsondoc/blob/26bf413c236e7c3b66f534c2451b157783c1f45e/jsondoc-springmvc/src/main/java/org/jsondoc/springmvc/scanner/builder/SpringResponseBuilder.java#L18-L26 | train |
fabiomaffioletti/jsondoc | jsondoc-springmvc/src/main/java/org/jsondoc/springmvc/scanner/AbstractSpringJSONDocScanner.java | AbstractSpringJSONDocScanner.initApiDoc | @Override
public ApiDoc initApiDoc(Class<?> controller) {
ApiDoc apiDoc = new ApiDoc();
apiDoc.setName(controller.getSimpleName());
apiDoc.setDescription(controller.getSimpleName());
return apiDoc;
} | java | @Override
public ApiDoc initApiDoc(Class<?> controller) {
ApiDoc apiDoc = new ApiDoc();
apiDoc.setName(controller.getSimpleName());
apiDoc.setDescription(controller.getSimpleName());
return apiDoc;
} | [
"@",
"Override",
"public",
"ApiDoc",
"initApiDoc",
"(",
"Class",
"<",
"?",
">",
"controller",
")",
"{",
"ApiDoc",
"apiDoc",
"=",
"new",
"ApiDoc",
"(",
")",
";",
"apiDoc",
".",
"setName",
"(",
"controller",
".",
"getSimpleName",
"(",
")",
")",
";",
"api... | ApiDoc is initialized with the Controller's simple class name. | [
"ApiDoc",
"is",
"initialized",
"with",
"the",
"Controller",
"s",
"simple",
"class",
"name",
"."
] | 26bf413c236e7c3b66f534c2451b157783c1f45e | https://github.com/fabiomaffioletti/jsondoc/blob/26bf413c236e7c3b66f534c2451b157783c1f45e/jsondoc-springmvc/src/main/java/org/jsondoc/springmvc/scanner/AbstractSpringJSONDocScanner.java#L206-L212 | train |
fabiomaffioletti/jsondoc | jsondoc-core/src/main/java/org/jsondoc/core/scanner/validator/JSONDocApiMethodDocValidator.java | JSONDocApiMethodDocValidator.validateApiMethodDoc | public static ApiMethodDoc validateApiMethodDoc(ApiMethodDoc apiMethodDoc, MethodDisplay displayMethodAs) {
final String ERROR_MISSING_METHOD_PATH = "Missing documentation data: path";
final String ERROR_MISSING_PATH_PARAM_NAME = "Missing documentation data: path parameter name";
final String ERROR_MISSING... | java | public static ApiMethodDoc validateApiMethodDoc(ApiMethodDoc apiMethodDoc, MethodDisplay displayMethodAs) {
final String ERROR_MISSING_METHOD_PATH = "Missing documentation data: path";
final String ERROR_MISSING_PATH_PARAM_NAME = "Missing documentation data: path parameter name";
final String ERROR_MISSING... | [
"public",
"static",
"ApiMethodDoc",
"validateApiMethodDoc",
"(",
"ApiMethodDoc",
"apiMethodDoc",
",",
"MethodDisplay",
"displayMethodAs",
")",
"{",
"final",
"String",
"ERROR_MISSING_METHOD_PATH",
"=",
"\"Missing documentation data: path\"",
";",
"final",
"String",
"ERROR_MISS... | This checks that some of the properties are correctly set to produce a meaningful documentation and a working playground. In case this does not happen
an error string is added to the jsondocerrors list in ApiMethodDoc.
It also checks that some properties are be set to produce a meaningful documentation. In case this do... | [
"This",
"checks",
"that",
"some",
"of",
"the",
"properties",
"are",
"correctly",
"set",
"to",
"produce",
"a",
"meaningful",
"documentation",
"and",
"a",
"working",
"playground",
".",
"In",
"case",
"this",
"does",
"not",
"happen",
"an",
"error",
"string",
"is... | 26bf413c236e7c3b66f534c2451b157783c1f45e | https://github.com/fabiomaffioletti/jsondoc/blob/26bf413c236e7c3b66f534c2451b157783c1f45e/jsondoc-core/src/main/java/org/jsondoc/core/scanner/validator/JSONDocApiMethodDocValidator.java#L21-L88 | train |
fabiomaffioletti/jsondoc | jsondoc-core/src/main/java/org/jsondoc/core/scanner/AbstractJSONDocScanner.java | AbstractJSONDocScanner.getApiDocs | public Set<ApiDoc> getApiDocs(Set<Class<?>> classes, MethodDisplay displayMethodAs) {
Set<ApiDoc> apiDocs = new TreeSet<ApiDoc>();
for (Class<?> controller : classes) {
ApiDoc apiDoc = getApiDoc(controller, displayMethodAs);
apiDocs.add(apiDoc);
}
return apiDocs;
} | java | public Set<ApiDoc> getApiDocs(Set<Class<?>> classes, MethodDisplay displayMethodAs) {
Set<ApiDoc> apiDocs = new TreeSet<ApiDoc>();
for (Class<?> controller : classes) {
ApiDoc apiDoc = getApiDoc(controller, displayMethodAs);
apiDocs.add(apiDoc);
}
return apiDocs;
} | [
"public",
"Set",
"<",
"ApiDoc",
">",
"getApiDocs",
"(",
"Set",
"<",
"Class",
"<",
"?",
">",
">",
"classes",
",",
"MethodDisplay",
"displayMethodAs",
")",
"{",
"Set",
"<",
"ApiDoc",
">",
"apiDocs",
"=",
"new",
"TreeSet",
"<",
"ApiDoc",
">",
"(",
")",
... | Gets the API documentation for the set of classes passed as argument | [
"Gets",
"the",
"API",
"documentation",
"for",
"the",
"set",
"of",
"classes",
"passed",
"as",
"argument"
] | 26bf413c236e7c3b66f534c2451b157783c1f45e | https://github.com/fabiomaffioletti/jsondoc/blob/26bf413c236e7c3b66f534c2451b157783c1f45e/jsondoc-core/src/main/java/org/jsondoc/core/scanner/AbstractJSONDocScanner.java#L121-L128 | train |
fabiomaffioletti/jsondoc | jsondoc-core/src/main/java/org/jsondoc/core/scanner/AbstractJSONDocScanner.java | AbstractJSONDocScanner.getApiDoc | private ApiDoc getApiDoc(Class<?> controller, MethodDisplay displayMethodAs) {
log.debug("Getting JSONDoc for class: " + controller.getName());
ApiDoc apiDoc = initApiDoc(controller);
apiDoc.setSupportedversions(JSONDocApiVersionDocBuilder.build(controller));
apiDoc.setAuth(JSONDocApiAuthDocBuilder.getApiAuthD... | java | private ApiDoc getApiDoc(Class<?> controller, MethodDisplay displayMethodAs) {
log.debug("Getting JSONDoc for class: " + controller.getName());
ApiDoc apiDoc = initApiDoc(controller);
apiDoc.setSupportedversions(JSONDocApiVersionDocBuilder.build(controller));
apiDoc.setAuth(JSONDocApiAuthDocBuilder.getApiAuthD... | [
"private",
"ApiDoc",
"getApiDoc",
"(",
"Class",
"<",
"?",
">",
"controller",
",",
"MethodDisplay",
"displayMethodAs",
")",
"{",
"log",
".",
"debug",
"(",
"\"Getting JSONDoc for class: \"",
"+",
"controller",
".",
"getName",
"(",
")",
")",
";",
"ApiDoc",
"apiDo... | Gets the API documentation for a single class annotated with @Api and for its methods, annotated with @ApiMethod
@param controller
@return | [
"Gets",
"the",
"API",
"documentation",
"for",
"a",
"single",
"class",
"annotated",
"with"
] | 26bf413c236e7c3b66f534c2451b157783c1f45e | https://github.com/fabiomaffioletti/jsondoc/blob/26bf413c236e7c3b66f534c2451b157783c1f45e/jsondoc-core/src/main/java/org/jsondoc/core/scanner/AbstractJSONDocScanner.java#L135-L148 | train |
fabiomaffioletti/jsondoc | jsondoc-core/src/main/java/org/jsondoc/core/scanner/AbstractJSONDocScanner.java | AbstractJSONDocScanner.getApiFlowDocs | public Set<ApiFlowDoc> getApiFlowDocs(Set<Class<?>> classes, List<ApiMethodDoc> apiMethodDocs) {
Set<ApiFlowDoc> apiFlowDocs = new TreeSet<ApiFlowDoc>();
for (Class<?> clazz : classes) {
log.debug("Getting JSONDoc for class: " + clazz.getName());
Method[] methods = clazz.getMethods();
for (Method method : ... | java | public Set<ApiFlowDoc> getApiFlowDocs(Set<Class<?>> classes, List<ApiMethodDoc> apiMethodDocs) {
Set<ApiFlowDoc> apiFlowDocs = new TreeSet<ApiFlowDoc>();
for (Class<?> clazz : classes) {
log.debug("Getting JSONDoc for class: " + clazz.getName());
Method[] methods = clazz.getMethods();
for (Method method : ... | [
"public",
"Set",
"<",
"ApiFlowDoc",
">",
"getApiFlowDocs",
"(",
"Set",
"<",
"Class",
"<",
"?",
">",
">",
"classes",
",",
"List",
"<",
"ApiMethodDoc",
">",
"apiMethodDocs",
")",
"{",
"Set",
"<",
"ApiFlowDoc",
">",
"apiFlowDocs",
"=",
"new",
"TreeSet",
"<"... | Gets the API flow documentation for the set of classes passed as argument | [
"Gets",
"the",
"API",
"flow",
"documentation",
"for",
"the",
"set",
"of",
"classes",
"passed",
"as",
"argument"
] | 26bf413c236e7c3b66f534c2451b157783c1f45e | https://github.com/fabiomaffioletti/jsondoc/blob/26bf413c236e7c3b66f534c2451b157783c1f45e/jsondoc-core/src/main/java/org/jsondoc/core/scanner/AbstractJSONDocScanner.java#L179-L192 | train |
fabiomaffioletti/jsondoc | jsondoc-springmvc/src/main/java/org/jsondoc/springmvc/scanner/builder/SpringQueryParamBuilder.java | SpringQueryParamBuilder.addRequestMappingParamDoc | private static void addRequestMappingParamDoc(Set<ApiParamDoc> apiParamDocs, RequestMapping requestMapping) {
if (requestMapping.params().length > 0) {
for (String param : requestMapping.params()) {
String[] splitParam = param.split("=");
if (splitParam.length > 1) {
... | java | private static void addRequestMappingParamDoc(Set<ApiParamDoc> apiParamDocs, RequestMapping requestMapping) {
if (requestMapping.params().length > 0) {
for (String param : requestMapping.params()) {
String[] splitParam = param.split("=");
if (splitParam.length > 1) {
... | [
"private",
"static",
"void",
"addRequestMappingParamDoc",
"(",
"Set",
"<",
"ApiParamDoc",
">",
"apiParamDocs",
",",
"RequestMapping",
"requestMapping",
")",
"{",
"if",
"(",
"requestMapping",
".",
"params",
"(",
")",
".",
"length",
">",
"0",
")",
"{",
"for",
... | Checks the request mapping annotation value and adds the resulting @ApiParamDoc to the documentation
@param apiParamDocs
@param requestMapping | [
"Checks",
"the",
"request",
"mapping",
"annotation",
"value",
"and",
"adds",
"the",
"resulting"
] | 26bf413c236e7c3b66f534c2451b157783c1f45e | https://github.com/fabiomaffioletti/jsondoc/blob/26bf413c236e7c3b66f534c2451b157783c1f45e/jsondoc-springmvc/src/main/java/org/jsondoc/springmvc/scanner/builder/SpringQueryParamBuilder.java#L86-L97 | train |
fabiomaffioletti/jsondoc | jsondoc-core/src/main/java/org/jsondoc/core/scanner/builder/JSONDocApiVersionDocBuilder.java | JSONDocApiVersionDocBuilder.build | public static ApiVersionDoc build(Method method) {
ApiVersionDoc apiVersionDoc = null;
ApiVersion methodAnnotation = method.getAnnotation(ApiVersion.class);
ApiVersion typeAnnotation = method.getDeclaringClass().getAnnotation(ApiVersion.class);
if(typeAnnotation != null) {
apiVersionDoc = buildFromAnnotat... | java | public static ApiVersionDoc build(Method method) {
ApiVersionDoc apiVersionDoc = null;
ApiVersion methodAnnotation = method.getAnnotation(ApiVersion.class);
ApiVersion typeAnnotation = method.getDeclaringClass().getAnnotation(ApiVersion.class);
if(typeAnnotation != null) {
apiVersionDoc = buildFromAnnotat... | [
"public",
"static",
"ApiVersionDoc",
"build",
"(",
"Method",
"method",
")",
"{",
"ApiVersionDoc",
"apiVersionDoc",
"=",
"null",
";",
"ApiVersion",
"methodAnnotation",
"=",
"method",
".",
"getAnnotation",
"(",
"ApiVersion",
".",
"class",
")",
";",
"ApiVersion",
"... | In case this annotation is present at type and method level, then the method annotation will override
the type one. | [
"In",
"case",
"this",
"annotation",
"is",
"present",
"at",
"type",
"and",
"method",
"level",
"then",
"the",
"method",
"annotation",
"will",
"override",
"the",
"type",
"one",
"."
] | 26bf413c236e7c3b66f534c2451b157783c1f45e | https://github.com/fabiomaffioletti/jsondoc/blob/26bf413c236e7c3b66f534c2451b157783c1f45e/jsondoc-core/src/main/java/org/jsondoc/core/scanner/builder/JSONDocApiVersionDocBuilder.java#L23-L37 | train |
RestComm/Restcomm-Connect | restcomm/restcomm.interpreter/src/main/java/org/restcomm/connect/interpreter/rcml/Verbs.java | Verbs.isThisVerbCallEnabler | public static boolean isThisVerbCallEnabler(Tag verb){
if(Verbs.play.equals(verb.name()) || Verbs.say.equals(verb.name()) || Verbs.gather.equals(verb.name()) || Verbs.record.equals(verb.name()) || Verbs.redirect.equals(verb.name()))
return true;
return false;
} | java | public static boolean isThisVerbCallEnabler(Tag verb){
if(Verbs.play.equals(verb.name()) || Verbs.say.equals(verb.name()) || Verbs.gather.equals(verb.name()) || Verbs.record.equals(verb.name()) || Verbs.redirect.equals(verb.name()))
return true;
return false;
} | [
"public",
"static",
"boolean",
"isThisVerbCallEnabler",
"(",
"Tag",
"verb",
")",
"{",
"if",
"(",
"Verbs",
".",
"play",
".",
"equals",
"(",
"verb",
".",
"name",
"(",
")",
")",
"||",
"Verbs",
".",
"say",
".",
"equals",
"(",
"verb",
".",
"name",
"(",
... | if 200 ok delay is enabled we need to answer only the calls
which are having any further call enabler verbs in their RCML.
@return | [
"if",
"200",
"ok",
"delay",
"is",
"enabled",
"we",
"need",
"to",
"answer",
"only",
"the",
"calls",
"which",
"are",
"having",
"any",
"further",
"call",
"enabler",
"verbs",
"in",
"their",
"RCML",
"."
] | 2194dee4fc524cdfd0af77a218ba5f212f97f7c5 | https://github.com/RestComm/Restcomm-Connect/blob/2194dee4fc524cdfd0af77a218ba5f212f97f7c5/restcomm/restcomm.interpreter/src/main/java/org/restcomm/connect/interpreter/rcml/Verbs.java#L95-L99 | train |
RestComm/Restcomm-Connect | restcomm/restcomm.telephony.api/src/main/java/org/restcomm/connect/telephony/api/util/B2BUAHelper.java | B2BUAHelper.addHeadersToMessage | private static void addHeadersToMessage(SipServletMessage message, Map<String, String> customHeaders) {
for (Map.Entry<String, String> entry: customHeaders.entrySet()) {
String headerName = entry.getKey();
String headerVal = entry.getValue();
message.addHeader(headerName,... | java | private static void addHeadersToMessage(SipServletMessage message, Map<String, String> customHeaders) {
for (Map.Entry<String, String> entry: customHeaders.entrySet()) {
String headerName = entry.getKey();
String headerVal = entry.getValue();
message.addHeader(headerName,... | [
"private",
"static",
"void",
"addHeadersToMessage",
"(",
"SipServletMessage",
"message",
",",
"Map",
"<",
"String",
",",
"String",
">",
"customHeaders",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"String",
">",
"entry",
":",
"customHeader... | Method adds custom headers to a SipServlet message
@param message
@param customHeaders | [
"Method",
"adds",
"custom",
"headers",
"to",
"a",
"SipServlet",
"message"
] | 2194dee4fc524cdfd0af77a218ba5f212f97f7c5 | https://github.com/RestComm/Restcomm-Connect/blob/2194dee4fc524cdfd0af77a218ba5f212f97f7c5/restcomm/restcomm.telephony.api/src/main/java/org/restcomm/connect/telephony/api/util/B2BUAHelper.java#L726-L732 | train |
RestComm/Restcomm-Connect | restcomm/restcomm.commons/src/main/java/org/restcomm/connect/commons/cache/DiskCacheFactory.java | DiskCacheFactory.getDiskCache | public DiskCache getDiskCache(final String cachePath, final String cacheUri) {
return new DiskCache(downloader, cachePath, cacheUri, true, cfg.isNoWavCache());
} | java | public DiskCache getDiskCache(final String cachePath, final String cacheUri) {
return new DiskCache(downloader, cachePath, cacheUri, true, cfg.isNoWavCache());
} | [
"public",
"DiskCache",
"getDiskCache",
"(",
"final",
"String",
"cachePath",
",",
"final",
"String",
"cacheUri",
")",
"{",
"return",
"new",
"DiskCache",
"(",
"downloader",
",",
"cachePath",
",",
"cacheUri",
",",
"true",
",",
"cfg",
".",
"isNoWavCache",
"(",
"... | constructor for compatibility with existing cache implementation | [
"constructor",
"for",
"compatibility",
"with",
"existing",
"cache",
"implementation"
] | 2194dee4fc524cdfd0af77a218ba5f212f97f7c5 | https://github.com/RestComm/Restcomm-Connect/blob/2194dee4fc524cdfd0af77a218ba5f212f97f7c5/restcomm/restcomm.commons/src/main/java/org/restcomm/connect/commons/cache/DiskCacheFactory.java#L27-L29 | train |
RestComm/Restcomm-Connect | restcomm/restcomm.http/src/main/java/org/restcomm/connect/http/AccountsEndpoint.java | AccountsEndpoint.removeAccoundDependencies | private void removeAccoundDependencies(Sid sid) {
logger.debug("removing accoutn dependencies");
DaoManager daoManager = (DaoManager) context.getAttribute(DaoManager.class.getName());
// remove dependency entities first and dependent entities last. Also, do safer operation first (as a secondary ... | java | private void removeAccoundDependencies(Sid sid) {
logger.debug("removing accoutn dependencies");
DaoManager daoManager = (DaoManager) context.getAttribute(DaoManager.class.getName());
// remove dependency entities first and dependent entities last. Also, do safer operation first (as a secondary ... | [
"private",
"void",
"removeAccoundDependencies",
"(",
"Sid",
"sid",
")",
"{",
"logger",
".",
"debug",
"(",
"\"removing accoutn dependencies\"",
")",
";",
"DaoManager",
"daoManager",
"=",
"(",
"DaoManager",
")",
"context",
".",
"getAttribute",
"(",
"DaoManager",
"."... | Removes all dependent resources of an account. Some resources like
CDRs are excluded.
@param sid | [
"Removes",
"all",
"dependent",
"resources",
"of",
"an",
"account",
".",
"Some",
"resources",
"like",
"CDRs",
"are",
"excluded",
"."
] | 2194dee4fc524cdfd0af77a218ba5f212f97f7c5 | https://github.com/RestComm/Restcomm-Connect/blob/2194dee4fc524cdfd0af77a218ba5f212f97f7c5/restcomm/restcomm.http/src/main/java/org/restcomm/connect/http/AccountsEndpoint.java#L313-L327 | train |
RestComm/Restcomm-Connect | restcomm/restcomm.http/src/main/java/org/restcomm/connect/http/AccountsEndpoint.java | AccountsEndpoint.removeIncomingPhoneNumbers | private void removeIncomingPhoneNumbers(Sid accountSid, IncomingPhoneNumbersDao dao) {
List<IncomingPhoneNumber> numbers = dao.getIncomingPhoneNumbers(accountSid);
if (numbers != null && numbers.size() > 0) {
// manager is retrieved in a lazy way. If any number needs it, it will be first ret... | java | private void removeIncomingPhoneNumbers(Sid accountSid, IncomingPhoneNumbersDao dao) {
List<IncomingPhoneNumber> numbers = dao.getIncomingPhoneNumbers(accountSid);
if (numbers != null && numbers.size() > 0) {
// manager is retrieved in a lazy way. If any number needs it, it will be first ret... | [
"private",
"void",
"removeIncomingPhoneNumbers",
"(",
"Sid",
"accountSid",
",",
"IncomingPhoneNumbersDao",
"dao",
")",
"{",
"List",
"<",
"IncomingPhoneNumber",
">",
"numbers",
"=",
"dao",
".",
"getIncomingPhoneNumbers",
"(",
"accountSid",
")",
";",
"if",
"(",
"num... | Removes incoming phone numbers that belong to an account from the database.
For provided numbers the provider is also contacted to get them released.
@param accountSid
@param dao | [
"Removes",
"incoming",
"phone",
"numbers",
"that",
"belong",
"to",
"an",
"account",
"from",
"the",
"database",
".",
"For",
"provided",
"numbers",
"the",
"provider",
"is",
"also",
"contacted",
"to",
"get",
"them",
"released",
"."
] | 2194dee4fc524cdfd0af77a218ba5f212f97f7c5 | https://github.com/RestComm/Restcomm-Connect/blob/2194dee4fc524cdfd0af77a218ba5f212f97f7c5/restcomm/restcomm.http/src/main/java/org/restcomm/connect/http/AccountsEndpoint.java#L336-L367 | train |
RestComm/Restcomm-Connect | restcomm/restcomm.http/src/main/java/org/restcomm/connect/http/AccountsEndpoint.java | AccountsEndpoint.prepareAccountForUpdate | private Account prepareAccountForUpdate(final Account account,
final MultivaluedMap<String, String> data,
UserIdentityContext userIdentityContext) {
Account.Builder accBuilder = Account.builder();
//copy full incoming account, and let override happen
//in a separate insta... | java | private Account prepareAccountForUpdate(final Account account,
final MultivaluedMap<String, String> data,
UserIdentityContext userIdentityContext) {
Account.Builder accBuilder = Account.builder();
//copy full incoming account, and let override happen
//in a separate insta... | [
"private",
"Account",
"prepareAccountForUpdate",
"(",
"final",
"Account",
"account",
",",
"final",
"MultivaluedMap",
"<",
"String",
",",
"String",
">",
"data",
",",
"UserIdentityContext",
"userIdentityContext",
")",
"{",
"Account",
".",
"Builder",
"accBuilder",
"=",... | Fills an account entity object with values supplied from an http request
@param account
@param data
@return a new instance with given account,and overriden fields from data | [
"Fills",
"an",
"account",
"entity",
"object",
"with",
"values",
"supplied",
"from",
"an",
"http",
"request"
] | 2194dee4fc524cdfd0af77a218ba5f212f97f7c5 | https://github.com/RestComm/Restcomm-Connect/blob/2194dee4fc524cdfd0af77a218ba5f212f97f7c5/restcomm/restcomm.http/src/main/java/org/restcomm/connect/http/AccountsEndpoint.java#L528-L571 | train |
RestComm/Restcomm-Connect | restcomm/restcomm.http/src/main/java/org/restcomm/connect/http/AccountsEndpoint.java | AccountsEndpoint.updateLinkedClient | private void updateLinkedClient(Account account, MultivaluedMap<String, String> data) {
logger.debug("checking linked client");
String email = account.getEmailAddress();
if (email != null && !email.equals("")) {
logger.debug("account email is valid");
String username = em... | java | private void updateLinkedClient(Account account, MultivaluedMap<String, String> data) {
logger.debug("checking linked client");
String email = account.getEmailAddress();
if (email != null && !email.equals("")) {
logger.debug("account email is valid");
String username = em... | [
"private",
"void",
"updateLinkedClient",
"(",
"Account",
"account",
",",
"MultivaluedMap",
"<",
"String",
",",
"String",
">",
"data",
")",
"{",
"logger",
".",
"debug",
"(",
"\"checking linked client\"",
")",
";",
"String",
"email",
"=",
"account",
".",
"getEma... | update SIP client of the corresponding Account.Password and FriendlyName fields are synched. | [
"update",
"SIP",
"client",
"of",
"the",
"corresponding",
"Account",
".",
"Password",
"and",
"FriendlyName",
"fields",
"are",
"synched",
"."
] | 2194dee4fc524cdfd0af77a218ba5f212f97f7c5 | https://github.com/RestComm/Restcomm-Connect/blob/2194dee4fc524cdfd0af77a218ba5f212f97f7c5/restcomm/restcomm.http/src/main/java/org/restcomm/connect/http/AccountsEndpoint.java#L576-L603 | train |
RestComm/Restcomm-Connect | restcomm/restcomm.http/src/main/java/org/restcomm/connect/http/AccountsEndpoint.java | AccountsEndpoint.switchAccountStatus | private void switchAccountStatus(Account account, Account.Status status,
UserIdentityContext userIdentityContext) {
if (logger.isDebugEnabled()) {
logger.debug("Switching status for account:" + account.getSid() + ",status:" + status);
}
switch (status) {
case ... | java | private void switchAccountStatus(Account account, Account.Status status,
UserIdentityContext userIdentityContext) {
if (logger.isDebugEnabled()) {
logger.debug("Switching status for account:" + account.getSid() + ",status:" + status);
}
switch (status) {
case ... | [
"private",
"void",
"switchAccountStatus",
"(",
"Account",
"account",
",",
"Account",
".",
"Status",
"status",
",",
"UserIdentityContext",
"userIdentityContext",
")",
"{",
"if",
"(",
"logger",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"logger",
".",
"debug",
"... | Switches an account status at dao level.
If status is CLSOED, Removes all resources belonging to an account.
If rcmlServerApi is not null it will
also send account-removal notifications to the rcmlserver
@param account | [
"Switches",
"an",
"account",
"status",
"at",
"dao",
"level",
"."
] | 2194dee4fc524cdfd0af77a218ba5f212f97f7c5 | https://github.com/RestComm/Restcomm-Connect/blob/2194dee4fc524cdfd0af77a218ba5f212f97f7c5/restcomm/restcomm.http/src/main/java/org/restcomm/connect/http/AccountsEndpoint.java#L781-L799 | train |
RestComm/Restcomm-Connect | restcomm/restcomm.http/src/main/java/org/restcomm/connect/http/ExtensionsConfigurationEndpoint.java | ExtensionsConfigurationEndpoint.getConfiguration | protected Response getConfiguration(final String extensionId, final Sid accountSid, final MediaType responseType) {
//Parameter "extensionId" could be the extension Sid or extension name.
ExtensionConfiguration extensionConfiguration = null;
ExtensionConfiguration extensionAccountConfiguration ... | java | protected Response getConfiguration(final String extensionId, final Sid accountSid, final MediaType responseType) {
//Parameter "extensionId" could be the extension Sid or extension name.
ExtensionConfiguration extensionConfiguration = null;
ExtensionConfiguration extensionAccountConfiguration ... | [
"protected",
"Response",
"getConfiguration",
"(",
"final",
"String",
"extensionId",
",",
"final",
"Sid",
"accountSid",
",",
"final",
"MediaType",
"responseType",
")",
"{",
"//Parameter \"extensionId\" could be the extension Sid or extension name.",
"ExtensionConfiguration",
"ex... | Will be used to get configuration for extension
@param extensionId
@param responseType
@return | [
"Will",
"be",
"used",
"to",
"get",
"configuration",
"for",
"extension"
] | 2194dee4fc524cdfd0af77a218ba5f212f97f7c5 | https://github.com/RestComm/Restcomm-Connect/blob/2194dee4fc524cdfd0af77a218ba5f212f97f7c5/restcomm/restcomm.http/src/main/java/org/restcomm/connect/http/ExtensionsConfigurationEndpoint.java#L102-L154 | train |
RestComm/Restcomm-Connect | restcomm/restcomm.telephony/src/main/java/org/restcomm/connect/telephony/CallManager.java | CallManager.redirectToClientVoiceApp | private boolean redirectToClientVoiceApp(final ActorRef self, final SipServletRequest request, final AccountsDao accounts,
final ApplicationsDao applications, final Client client) {
Sid applicationSid = client.getVoiceApplicationSid();
URI clientAppVoiceUrl =... | java | private boolean redirectToClientVoiceApp(final ActorRef self, final SipServletRequest request, final AccountsDao accounts,
final ApplicationsDao applications, final Client client) {
Sid applicationSid = client.getVoiceApplicationSid();
URI clientAppVoiceUrl =... | [
"private",
"boolean",
"redirectToClientVoiceApp",
"(",
"final",
"ActorRef",
"self",
",",
"final",
"SipServletRequest",
"request",
",",
"final",
"AccountsDao",
"accounts",
",",
"final",
"ApplicationsDao",
"applications",
",",
"final",
"Client",
"client",
")",
"{",
"S... | If there is VoiceUrl provided for a Client configuration, try to begin execution of the RCML app, otherwise return false.
@param self
@param request
@param accounts
@param applications
@param client | [
"If",
"there",
"is",
"VoiceUrl",
"provided",
"for",
"a",
"Client",
"configuration",
"try",
"to",
"begin",
"execution",
"of",
"the",
"RCML",
"app",
"otherwise",
"return",
"false",
"."
] | 2194dee4fc524cdfd0af77a218ba5f212f97f7c5 | https://github.com/RestComm/Restcomm-Connect/blob/2194dee4fc524cdfd0af77a218ba5f212f97f7c5/restcomm/restcomm.telephony/src/main/java/org/restcomm/connect/telephony/CallManager.java#L1446-L1492 | train |
RestComm/Restcomm-Connect | restcomm/restcomm.telephony/src/main/java/org/restcomm/connect/telephony/ua/UserAgentManager.java | UserAgentManager.isWebRTC | private boolean isWebRTC(String transport, String userAgent) {
return "ws".equalsIgnoreCase(transport) || "wss".equalsIgnoreCase(transport) || userAgent.toLowerCase().contains("restcomm");
} | java | private boolean isWebRTC(String transport, String userAgent) {
return "ws".equalsIgnoreCase(transport) || "wss".equalsIgnoreCase(transport) || userAgent.toLowerCase().contains("restcomm");
} | [
"private",
"boolean",
"isWebRTC",
"(",
"String",
"transport",
",",
"String",
"userAgent",
")",
"{",
"return",
"\"ws\"",
".",
"equalsIgnoreCase",
"(",
"transport",
")",
"||",
"\"wss\"",
".",
"equalsIgnoreCase",
"(",
"transport",
")",
"||",
"userAgent",
".",
"to... | Checks whether the client is WebRTC or not.
<p>
A client is considered WebRTC if one of the following statements is true:<br>
1. The chosen transport is WebSockets (transport=ws).<br>
2. The chosen transport is WebSockets Secured (transport=wss).<br>
3. The User-Agent corresponds to one of TeleStax mobile clients.
</p... | [
"Checks",
"whether",
"the",
"client",
"is",
"WebRTC",
"or",
"not",
"."
] | 2194dee4fc524cdfd0af77a218ba5f212f97f7c5 | https://github.com/RestComm/Restcomm-Connect/blob/2194dee4fc524cdfd0af77a218ba5f212f97f7c5/restcomm/restcomm.telephony/src/main/java/org/restcomm/connect/telephony/ua/UserAgentManager.java#L746-L748 | train |
RestComm/Restcomm-Connect | restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/common/Sorting.java | Sorting.parseUrl | public static Map<String, String> parseUrl(String url) throws Exception {
final String[] values = url.split(":", 2);
HashMap<String, String> sortParameters = new HashMap<String, String>();
sortParameters.put(SORT_BY_KEY, values[0]);
if (values.length > 1) {
sortParameters.put... | java | public static Map<String, String> parseUrl(String url) throws Exception {
final String[] values = url.split(":", 2);
HashMap<String, String> sortParameters = new HashMap<String, String>();
sortParameters.put(SORT_BY_KEY, values[0]);
if (values.length > 1) {
sortParameters.put... | [
"public",
"static",
"Map",
"<",
"String",
",",
"String",
">",
"parseUrl",
"(",
"String",
"url",
")",
"throws",
"Exception",
"{",
"final",
"String",
"[",
"]",
"values",
"=",
"url",
".",
"split",
"(",
"\":\"",
",",
"2",
")",
";",
"HashMap",
"<",
"Strin... | Parse the sorting part of the URI and return sortBy and sortDirection counterparts
@param url String representing the sorting part of the URI, which is of the form SortBy=<field>:<direction>', for example: '?SortBy=date_created:asc'
@return a map containing sortBy and sortDirection
@throws Exception if there is a pars... | [
"Parse",
"the",
"sorting",
"part",
"of",
"the",
"URI",
"and",
"return",
"sortBy",
"and",
"sortDirection",
"counterparts"
] | 2194dee4fc524cdfd0af77a218ba5f212f97f7c5 | https://github.com/RestComm/Restcomm-Connect/blob/2194dee4fc524cdfd0af77a218ba5f212f97f7c5/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/common/Sorting.java#L46-L64 | train |
RestComm/Restcomm-Connect | restcomm/restcomm.interpreter/src/main/java/org/restcomm/connect/http/client/rcmlserver/resolver/RcmlserverResolver.java | RcmlserverResolver.getInstance | public static RcmlserverResolver getInstance(String rvdOrigin, String apiPath, boolean reinit) {
if (singleton == null || reinit) {
singleton = new RcmlserverResolver(rvdOrigin, apiPath);
}
return singleton;
} | java | public static RcmlserverResolver getInstance(String rvdOrigin, String apiPath, boolean reinit) {
if (singleton == null || reinit) {
singleton = new RcmlserverResolver(rvdOrigin, apiPath);
}
return singleton;
} | [
"public",
"static",
"RcmlserverResolver",
"getInstance",
"(",
"String",
"rvdOrigin",
",",
"String",
"apiPath",
",",
"boolean",
"reinit",
")",
"{",
"if",
"(",
"singleton",
"==",
"null",
"||",
"reinit",
")",
"{",
"singleton",
"=",
"new",
"RcmlserverResolver",
"(... | not really a clean singleton pattern but a way to init once and use many. Only the first time this method is called the parameters are used in the initialization | [
"not",
"really",
"a",
"clean",
"singleton",
"pattern",
"but",
"a",
"way",
"to",
"init",
"once",
"and",
"use",
"many",
".",
"Only",
"the",
"first",
"time",
"this",
"method",
"is",
"called",
"the",
"parameters",
"are",
"used",
"in",
"the",
"initialization"
] | 2194dee4fc524cdfd0af77a218ba5f212f97f7c5 | https://github.com/RestComm/Restcomm-Connect/blob/2194dee4fc524cdfd0af77a218ba5f212f97f7c5/restcomm/restcomm.interpreter/src/main/java/org/restcomm/connect/http/client/rcmlserver/resolver/RcmlserverResolver.java#L52-L57 | train |
RestComm/Restcomm-Connect | restcomm/restcomm.interpreter/src/main/java/org/restcomm/connect/http/client/rcmlserver/resolver/RcmlserverResolver.java | RcmlserverResolver.resolveRelative | public URI resolveRelative(URI uri) {
if (uri != null && rvdOrigin != null && filterPrefix != null) {
if (uri.isAbsolute())
return uri;
try {
String uriString = uri.toString();
if (uriString.startsWith(filterPrefix))
ret... | java | public URI resolveRelative(URI uri) {
if (uri != null && rvdOrigin != null && filterPrefix != null) {
if (uri.isAbsolute())
return uri;
try {
String uriString = uri.toString();
if (uriString.startsWith(filterPrefix))
ret... | [
"public",
"URI",
"resolveRelative",
"(",
"URI",
"uri",
")",
"{",
"if",
"(",
"uri",
"!=",
"null",
"&&",
"rvdOrigin",
"!=",
"null",
"&&",
"filterPrefix",
"!=",
"null",
")",
"{",
"if",
"(",
"uri",
".",
"isAbsolute",
"(",
")",
")",
"return",
"uri",
";",
... | if rvdOrigin is null no point in trying to resolve RVD location. We will return passed uri instead | [
"if",
"rvdOrigin",
"is",
"null",
"no",
"point",
"in",
"trying",
"to",
"resolve",
"RVD",
"location",
".",
"We",
"will",
"return",
"passed",
"uri",
"instead"
] | 2194dee4fc524cdfd0af77a218ba5f212f97f7c5 | https://github.com/RestComm/Restcomm-Connect/blob/2194dee4fc524cdfd0af77a218ba5f212f97f7c5/restcomm/restcomm.interpreter/src/main/java/org/restcomm/connect/http/client/rcmlserver/resolver/RcmlserverResolver.java#L79-L92 | train |
RestComm/Restcomm-Connect | restcomm/restcomm.core/src/main/java/org/restcomm/connect/core/service/util/UriUtils.java | UriUtils.getHttpConnectors | private HttpConnectorList getHttpConnectors() throws Exception {
logger.info("Searching HTTP connectors.");
HttpConnectorList httpConnectorList = null;
//find Jboss first as is typical setup
httpConnectorList = jBossConnectorDiscover.findConnectors();
if (httpConnectorList == nul... | java | private HttpConnectorList getHttpConnectors() throws Exception {
logger.info("Searching HTTP connectors.");
HttpConnectorList httpConnectorList = null;
//find Jboss first as is typical setup
httpConnectorList = jBossConnectorDiscover.findConnectors();
if (httpConnectorList == nul... | [
"private",
"HttpConnectorList",
"getHttpConnectors",
"(",
")",
"throws",
"Exception",
"{",
"logger",
".",
"info",
"(",
"\"Searching HTTP connectors.\"",
")",
";",
"HttpConnectorList",
"httpConnectorList",
"=",
"null",
";",
"//find Jboss first as is typical setup",
"httpConn... | Will query different JMX MBeans for a list of runtime connectors.
JBoss discovery will be used first, then Tomcat.
@return the list of connectors found | [
"Will",
"query",
"different",
"JMX",
"MBeans",
"for",
"a",
"list",
"of",
"runtime",
"connectors",
"."
] | 2194dee4fc524cdfd0af77a218ba5f212f97f7c5 | https://github.com/RestComm/Restcomm-Connect/blob/2194dee4fc524cdfd0af77a218ba5f212f97f7c5/restcomm/restcomm.core/src/main/java/org/restcomm/connect/core/service/util/UriUtils.java#L93-L103 | train |
RestComm/Restcomm-Connect | restcomm/restcomm.core/src/main/java/org/restcomm/connect/core/service/util/UriUtils.java | UriUtils.resolve | public URI resolve(final URI uri, final Sid accountSid) {
getHttpConnector();
String restcommAddress = null;
if (accountSid != null && daoManager != null) {
Sid organizationSid = daoManager.getAccountsDao().getAccount(accountSid).getOrganizationSid();
restcommAddress = ... | java | public URI resolve(final URI uri, final Sid accountSid) {
getHttpConnector();
String restcommAddress = null;
if (accountSid != null && daoManager != null) {
Sid organizationSid = daoManager.getAccountsDao().getAccount(accountSid).getOrganizationSid();
restcommAddress = ... | [
"public",
"URI",
"resolve",
"(",
"final",
"URI",
"uri",
",",
"final",
"Sid",
"accountSid",
")",
"{",
"getHttpConnector",
"(",
")",
";",
"String",
"restcommAddress",
"=",
"null",
";",
"if",
"(",
"accountSid",
"!=",
"null",
"&&",
"daoManager",
"!=",
"null",
... | Use to resolve a relative URI
using the domain name of the Organization
that the provided AccountSid belongs
@param uri The relative URI
@param accountSid The accountSid to get the Org domain
@return The absolute URI | [
"Use",
"to",
"resolve",
"a",
"relative",
"URI",
"using",
"the",
"domain",
"name",
"of",
"the",
"Organization",
"that",
"the",
"provided",
"AccountSid",
"belongs"
] | 2194dee4fc524cdfd0af77a218ba5f212f97f7c5 | https://github.com/RestComm/Restcomm-Connect/blob/2194dee4fc524cdfd0af77a218ba5f212f97f7c5/restcomm/restcomm.core/src/main/java/org/restcomm/connect/core/service/util/UriUtils.java#L126-L159 | train |
RestComm/Restcomm-Connect | restcomm/restcomm.core/src/main/java/org/restcomm/connect/core/service/util/UriUtils.java | UriUtils.getHttpConnector | public HttpConnector getHttpConnector() throws RuntimeException {
if (selectedConnector == null) {
try {
HttpConnectorList httpConnectorList = getHttpConnectors();
if (httpConnectorList != null && !httpConnectorList.getConnectors().isEmpty()) {
L... | java | public HttpConnector getHttpConnector() throws RuntimeException {
if (selectedConnector == null) {
try {
HttpConnectorList httpConnectorList = getHttpConnectors();
if (httpConnectorList != null && !httpConnectorList.getConnectors().isEmpty()) {
L... | [
"public",
"HttpConnector",
"getHttpConnector",
"(",
")",
"throws",
"RuntimeException",
"{",
"if",
"(",
"selectedConnector",
"==",
"null",
")",
"{",
"try",
"{",
"HttpConnectorList",
"httpConnectorList",
"=",
"getHttpConnectors",
"(",
")",
";",
"if",
"(",
"httpConne... | For historical reasons this method never returns null, and instead
throws a RuntimeException.
TODO review all clients of this method to check for null instead of
throwing RuntimeException
@return The selected connector with Secure preference.
@throws RuntimeException if no connector is found for some reason | [
"For",
"historical",
"reasons",
"this",
"method",
"never",
"returns",
"null",
"and",
"instead",
"throws",
"a",
"RuntimeException",
"."
] | 2194dee4fc524cdfd0af77a218ba5f212f97f7c5 | https://github.com/RestComm/Restcomm-Connect/blob/2194dee4fc524cdfd0af77a218ba5f212f97f7c5/restcomm/restcomm.core/src/main/java/org/restcomm/connect/core/service/util/UriUtils.java#L171-L202 | train |
RestComm/Restcomm-Connect | restcomm/restcomm.sms/src/main/java/org/restcomm/connect/sms/smpp/RegexRemover.java | RegexRemover.removeRegexes | static void removeRegexes(List<IncomingPhoneNumber> numbers) {
//use a list to prevent conc access during iteration
List<IncomingPhoneNumber> toBeRemoved = new ArrayList();
if (numbers != null) {
for (IncomingPhoneNumber nAux : numbers) {
if (StringUtils.containsAny(n... | java | static void removeRegexes(List<IncomingPhoneNumber> numbers) {
//use a list to prevent conc access during iteration
List<IncomingPhoneNumber> toBeRemoved = new ArrayList();
if (numbers != null) {
for (IncomingPhoneNumber nAux : numbers) {
if (StringUtils.containsAny(n... | [
"static",
"void",
"removeRegexes",
"(",
"List",
"<",
"IncomingPhoneNumber",
">",
"numbers",
")",
"{",
"//use a list to prevent conc access during iteration",
"List",
"<",
"IncomingPhoneNumber",
">",
"toBeRemoved",
"=",
"new",
"ArrayList",
"(",
")",
";",
"if",
"(",
"... | SMPP is not supporting organizations at the moment, disable regexes to
prevent an organization to capture all cloud traffic with a single regex.
@param numbers | [
"SMPP",
"is",
"not",
"supporting",
"organizations",
"at",
"the",
"moment",
"disable",
"regexes",
"to",
"prevent",
"an",
"organization",
"to",
"capture",
"all",
"cloud",
"traffic",
"with",
"a",
"single",
"regex",
"."
] | 2194dee4fc524cdfd0af77a218ba5f212f97f7c5 | https://github.com/RestComm/Restcomm-Connect/blob/2194dee4fc524cdfd0af77a218ba5f212f97f7c5/restcomm/restcomm.sms/src/main/java/org/restcomm/connect/sms/smpp/RegexRemover.java#L37-L53 | train |
RestComm/Restcomm-Connect | restcomm/restcomm.commons/src/main/java/org/restcomm/connect/commons/util/JBossConnectorDiscover.java | JBossConnectorDiscover.findConnectors | @Override
public HttpConnectorList findConnectors() throws MalformedObjectNameException, NullPointerException, UnknownHostException, AttributeNotFoundException,
InstanceNotFoundException, MBeanException, ReflectionException {
LOG.info("Searching JBoss HTTP connectors.");
HttpConnectorLis... | java | @Override
public HttpConnectorList findConnectors() throws MalformedObjectNameException, NullPointerException, UnknownHostException, AttributeNotFoundException,
InstanceNotFoundException, MBeanException, ReflectionException {
LOG.info("Searching JBoss HTTP connectors.");
HttpConnectorLis... | [
"@",
"Override",
"public",
"HttpConnectorList",
"findConnectors",
"(",
")",
"throws",
"MalformedObjectNameException",
",",
"NullPointerException",
",",
"UnknownHostException",
",",
"AttributeNotFoundException",
",",
"InstanceNotFoundException",
",",
"MBeanException",
",",
"Re... | A list of connectors. Not bound connectors will be discarded.
@return
@throws MalformedObjectNameException
@throws NullPointerException
@throws UnknownHostException
@throws AttributeNotFoundException
@throws InstanceNotFoundException
@throws MBeanException
@throws ReflectionException | [
"A",
"list",
"of",
"connectors",
".",
"Not",
"bound",
"connectors",
"will",
"be",
"discarded",
"."
] | 2194dee4fc524cdfd0af77a218ba5f212f97f7c5 | https://github.com/RestComm/Restcomm-Connect/blob/2194dee4fc524cdfd0af77a218ba5f212f97f7c5/restcomm/restcomm.commons/src/main/java/org/restcomm/connect/commons/util/JBossConnectorDiscover.java#L53-L86 | train |
RestComm/Restcomm-Connect | restcomm/restcomm.http/src/main/java/org/restcomm/connect/http/security/PermissionEvaluator.java | PermissionEvaluator.isDirectChildOfAccount | public boolean isDirectChildOfAccount(final Account effectiveAccount,
final Account operatedAccount) {
return operatedAccount.getParentSid().equals(effectiveAccount.getSid());
} | java | public boolean isDirectChildOfAccount(final Account effectiveAccount,
final Account operatedAccount) {
return operatedAccount.getParentSid().equals(effectiveAccount.getSid());
} | [
"public",
"boolean",
"isDirectChildOfAccount",
"(",
"final",
"Account",
"effectiveAccount",
",",
"final",
"Account",
"operatedAccount",
")",
"{",
"return",
"operatedAccount",
".",
"getParentSid",
"(",
")",
".",
"equals",
"(",
"effectiveAccount",
".",
"getSid",
"(",
... | Checks if the operated account is a direct child of effective account
@param operatedAccount
@return | [
"Checks",
"if",
"the",
"operated",
"account",
"is",
"a",
"direct",
"child",
"of",
"effective",
"account"
] | 2194dee4fc524cdfd0af77a218ba5f212f97f7c5 | https://github.com/RestComm/Restcomm-Connect/blob/2194dee4fc524cdfd0af77a218ba5f212f97f7c5/restcomm/restcomm.http/src/main/java/org/restcomm/connect/http/security/PermissionEvaluator.java#L103-L106 | train |
RestComm/Restcomm-Connect | restcomm/restcomm.http/src/main/java/org/restcomm/connect/http/security/PermissionEvaluator.java | PermissionEvaluator.hasAccountRole | public boolean hasAccountRole(final String role,UserIdentityContext userIdentityContext) {
if (userIdentityContext.getEffectiveAccount() != null) {
return userIdentityContext.getEffectiveAccountRoles().contains(role);
}
return false;
} | java | public boolean hasAccountRole(final String role,UserIdentityContext userIdentityContext) {
if (userIdentityContext.getEffectiveAccount() != null) {
return userIdentityContext.getEffectiveAccountRoles().contains(role);
}
return false;
} | [
"public",
"boolean",
"hasAccountRole",
"(",
"final",
"String",
"role",
",",
"UserIdentityContext",
"userIdentityContext",
")",
"{",
"if",
"(",
"userIdentityContext",
".",
"getEffectiveAccount",
"(",
")",
"!=",
"null",
")",
"{",
"return",
"userIdentityContext",
".",
... | Checks is the effective account has the specified role. Only role values contained in the Restcomm Account
are take into account.
@param role
@return true if the role exists in the Account. Otherwise it returns false. | [
"Checks",
"is",
"the",
"effective",
"account",
"has",
"the",
"specified",
"role",
".",
"Only",
"role",
"values",
"contained",
"in",
"the",
"Restcomm",
"Account",
"are",
"take",
"into",
"account",
"."
] | 2194dee4fc524cdfd0af77a218ba5f212f97f7c5 | https://github.com/RestComm/Restcomm-Connect/blob/2194dee4fc524cdfd0af77a218ba5f212f97f7c5/restcomm/restcomm.http/src/main/java/org/restcomm/connect/http/security/PermissionEvaluator.java#L255-L260 | train |
RestComm/Restcomm-Connect | restcomm/restcomm.http/src/main/java/org/restcomm/connect/http/security/PermissionEvaluator.java | PermissionEvaluator.checkPermission | private AuthOutcome checkPermission(String neededPermissionString, Set<String> roleNames) {
// if this is an administrator ask no more questions
if ( roleNames.contains(getAdministratorRole()))
return AuthOutcome.OK;
// normalize the permission string
//neededPermissionStrin... | java | private AuthOutcome checkPermission(String neededPermissionString, Set<String> roleNames) {
// if this is an administrator ask no more questions
if ( roleNames.contains(getAdministratorRole()))
return AuthOutcome.OK;
// normalize the permission string
//neededPermissionStrin... | [
"private",
"AuthOutcome",
"checkPermission",
"(",
"String",
"neededPermissionString",
",",
"Set",
"<",
"String",
">",
"roleNames",
")",
"{",
"// if this is an administrator ask no more questions",
"if",
"(",
"roleNames",
".",
"contains",
"(",
"getAdministratorRole",
"(",
... | Low level permission checking. roleNames are checked for neededPermissionString permission using permission
mappings contained in restcomm.xml. The permission mappings are stored in RestcommRoles.
Note: Administrator is granted access with eyes closed
@param neededPermissionString
@param roleNames
@return | [
"Low",
"level",
"permission",
"checking",
".",
"roleNames",
"are",
"checked",
"for",
"neededPermissionString",
"permission",
"using",
"permission",
"mappings",
"contained",
"in",
"restcomm",
".",
"xml",
".",
"The",
"permission",
"mappings",
"are",
"stored",
"in",
... | 2194dee4fc524cdfd0af77a218ba5f212f97f7c5 | https://github.com/RestComm/Restcomm-Connect/blob/2194dee4fc524cdfd0af77a218ba5f212f97f7c5/restcomm/restcomm.http/src/main/java/org/restcomm/connect/http/security/PermissionEvaluator.java#L272-L307 | train |
RestComm/Restcomm-Connect | restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/mybatis/MybatisApplicationsDao.java | MybatisApplicationsDao.populateApplicationWithNumber | private void populateApplicationWithNumber(Application application, final Map<String, Object> map, String field_prefix) {
// first create the number
ApplicationNumberSummary number = new ApplicationNumberSummary(
readString(map.get(field_prefix + "sid")),
readString(map.g... | java | private void populateApplicationWithNumber(Application application, final Map<String, Object> map, String field_prefix) {
// first create the number
ApplicationNumberSummary number = new ApplicationNumberSummary(
readString(map.get(field_prefix + "sid")),
readString(map.g... | [
"private",
"void",
"populateApplicationWithNumber",
"(",
"Application",
"application",
",",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"map",
",",
"String",
"field_prefix",
")",
"{",
"// first create the number",
"ApplicationNumberSummary",
"number",
"=",
"new... | Populates application.numbers field with information of one or more numbers. The 'numbers' list is created if
already null and an IncomingPhoneNumber is added into it based on information from the map. Invoking the same method
several times to add more numbers to the same list is possible.
@param application
@param ma... | [
"Populates",
"application",
".",
"numbers",
"field",
"with",
"information",
"of",
"one",
"or",
"more",
"numbers",
".",
"The",
"numbers",
"list",
"is",
"created",
"if",
"already",
"null",
"and",
"an",
"IncomingPhoneNumber",
"is",
"added",
"into",
"it",
"based",... | 2194dee4fc524cdfd0af77a218ba5f212f97f7c5 | https://github.com/RestComm/Restcomm-Connect/blob/2194dee4fc524cdfd0af77a218ba5f212f97f7c5/restcomm/restcomm.dao/src/main/java/org/restcomm/connect/dao/mybatis/MybatisApplicationsDao.java#L200-L217 | train |
RestComm/Restcomm-Connect | restcomm/restcomm.commons/src/main/java/org/restcomm/connect/commons/util/SdpUtils.java | SdpUtils.endWithNewLine | public static String endWithNewLine(String sdpDescription) {
if (sdpDescription == null || sdpDescription.isEmpty()) {
throw new IllegalArgumentException("The SDP description cannot be null or empty");
}
return sdpDescription.trim().concat("\n");
} | java | public static String endWithNewLine(String sdpDescription) {
if (sdpDescription == null || sdpDescription.isEmpty()) {
throw new IllegalArgumentException("The SDP description cannot be null or empty");
}
return sdpDescription.trim().concat("\n");
} | [
"public",
"static",
"String",
"endWithNewLine",
"(",
"String",
"sdpDescription",
")",
"{",
"if",
"(",
"sdpDescription",
"==",
"null",
"||",
"sdpDescription",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"The SDP descriptio... | Patches an SDP description by trimming and making sure it ends with a new line.
@param sdpDescription The SDP description to be patched.
@return The patched SDP description
@author hrosa | [
"Patches",
"an",
"SDP",
"description",
"by",
"trimming",
"and",
"making",
"sure",
"it",
"ends",
"with",
"a",
"new",
"line",
"."
] | 2194dee4fc524cdfd0af77a218ba5f212f97f7c5 | https://github.com/RestComm/Restcomm-Connect/blob/2194dee4fc524cdfd0af77a218ba5f212f97f7c5/restcomm/restcomm.commons/src/main/java/org/restcomm/connect/commons/util/SdpUtils.java#L30-L35 | train |
RestComm/Restcomm-Connect | restcomm/restcomm.sms/src/main/java/org/restcomm/connect/sms/SmsService.java | SmsService.notifyStatus | private void notifyStatus(SmsMessage message) {
URI callback = message.getStatusCallback();
if (callback != null) {
String method = message.getStatusCallbackMethod();
if (method != null && !method.isEmpty()) {
if (!org.apache.http.client.methods.HttpGet.METHOD_NA... | java | private void notifyStatus(SmsMessage message) {
URI callback = message.getStatusCallback();
if (callback != null) {
String method = message.getStatusCallbackMethod();
if (method != null && !method.isEmpty()) {
if (!org.apache.http.client.methods.HttpGet.METHOD_NA... | [
"private",
"void",
"notifyStatus",
"(",
"SmsMessage",
"message",
")",
"{",
"URI",
"callback",
"=",
"message",
".",
"getStatusCallback",
"(",
")",
";",
"if",
"(",
"callback",
"!=",
"null",
")",
"{",
"String",
"method",
"=",
"message",
".",
"getStatusCallbackM... | The storage engine. | [
"The",
"storage",
"engine",
"."
] | 2194dee4fc524cdfd0af77a218ba5f212f97f7c5 | https://github.com/RestComm/Restcomm-Connect/blob/2194dee4fc524cdfd0af77a218ba5f212f97f7c5/restcomm/restcomm.sms/src/main/java/org/restcomm/connect/sms/SmsService.java#L697-L720 | train |
RestComm/Restcomm-Connect | restcomm/restcomm.commons/src/main/java/org/restcomm/connect/commons/util/DigestAuthentication.java | DigestAuthentication.HA1 | public static String HA1(String username, String realm, String password, String algorithm){
String ha1 = "";
ha1 = DigestAuthentication.H(username+":"+realm+":"+password, algorithm);
return ha1;
} | java | public static String HA1(String username, String realm, String password, String algorithm){
String ha1 = "";
ha1 = DigestAuthentication.H(username+":"+realm+":"+password, algorithm);
return ha1;
} | [
"public",
"static",
"String",
"HA1",
"(",
"String",
"username",
",",
"String",
"realm",
",",
"String",
"password",
",",
"String",
"algorithm",
")",
"{",
"String",
"ha1",
"=",
"\"\"",
";",
"ha1",
"=",
"DigestAuthentication",
".",
"H",
"(",
"username",
"+",
... | USed for unit testing | [
"USed",
"for",
"unit",
"testing"
] | 2194dee4fc524cdfd0af77a218ba5f212f97f7c5 | https://github.com/RestComm/Restcomm-Connect/blob/2194dee4fc524cdfd0af77a218ba5f212f97f7c5/restcomm/restcomm.commons/src/main/java/org/restcomm/connect/commons/util/DigestAuthentication.java#L148-L152 | train |
RestComm/Restcomm-Connect | restcomm/restcomm.http/src/main/java/org/restcomm/connect/http/AbstractEndpoint.java | AbstractEndpoint.isEmpty | protected boolean isEmpty(Object value) {
if (value == null)
return true;
if ( value.equals("") )
return true;
return false;
} | java | protected boolean isEmpty(Object value) {
if (value == null)
return true;
if ( value.equals("") )
return true;
return false;
} | [
"protected",
"boolean",
"isEmpty",
"(",
"Object",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"return",
"true",
";",
"if",
"(",
"value",
".",
"equals",
"(",
"\"\"",
")",
")",
"return",
"true",
";",
"return",
"false",
";",
"}"
] | A general purpose method to test incoming parameters for meaningful data | [
"A",
"general",
"purpose",
"method",
"to",
"test",
"incoming",
"parameters",
"for",
"meaningful",
"data"
] | 2194dee4fc524cdfd0af77a218ba5f212f97f7c5 | https://github.com/RestComm/Restcomm-Connect/blob/2194dee4fc524cdfd0af77a218ba5f212f97f7c5/restcomm/restcomm.http/src/main/java/org/restcomm/connect/http/AbstractEndpoint.java#L191-L197 | train |
RestComm/Restcomm-Connect | restcomm/restcomm.telephony.api/src/main/java/org/restcomm/connect/telephony/api/util/CallControlHelper.java | CallControlHelper.checkAuthentication | public static boolean checkAuthentication(SipServletRequest request, DaoManager storage, Sid organizationSid) throws IOException {
// Make sure we force clients to authenticate.
final String authorization = request.getHeader("Proxy-Authorization");
final String method = request.getMethod();
... | java | public static boolean checkAuthentication(SipServletRequest request, DaoManager storage, Sid organizationSid) throws IOException {
// Make sure we force clients to authenticate.
final String authorization = request.getHeader("Proxy-Authorization");
final String method = request.getMethod();
... | [
"public",
"static",
"boolean",
"checkAuthentication",
"(",
"SipServletRequest",
"request",
",",
"DaoManager",
"storage",
",",
"Sid",
"organizationSid",
")",
"throws",
"IOException",
"{",
"// Make sure we force clients to authenticate.",
"final",
"String",
"authorization",
"... | Check if a client is authenticated. If so, return true. Otherwise request authentication and return false;
@param request
@param storage
@param organizationSid
@return
@throws IOException | [
"Check",
"if",
"a",
"client",
"is",
"authenticated",
".",
"If",
"so",
"return",
"true",
".",
"Otherwise",
"request",
"authentication",
"and",
"return",
"false",
";"
] | 2194dee4fc524cdfd0af77a218ba5f212f97f7c5 | https://github.com/RestComm/Restcomm-Connect/blob/2194dee4fc524cdfd0af77a218ba5f212f97f7c5/restcomm/restcomm.telephony.api/src/main/java/org/restcomm/connect/telephony/api/util/CallControlHelper.java#L102-L116 | train |
RestComm/Restcomm-Connect | restcomm/restcomm.core/src/main/java/org/restcomm/connect/core/service/number/NumberSelectorServiceImpl.java | NumberSelectorServiceImpl.findSingleNumber | private NumberSelectionResult findSingleNumber(String number,
Sid sourceOrganizationSid, Sid destinationOrganizationSid, Set<SearchModifier> modifiers) {
NumberSelectionResult matchedNumber = new NumberSelectionResult(null, false, null);
IncomingPhoneNumberFilter.Builder filterBuilder = Inco... | java | private NumberSelectionResult findSingleNumber(String number,
Sid sourceOrganizationSid, Sid destinationOrganizationSid, Set<SearchModifier> modifiers) {
NumberSelectionResult matchedNumber = new NumberSelectionResult(null, false, null);
IncomingPhoneNumberFilter.Builder filterBuilder = Inco... | [
"private",
"NumberSelectionResult",
"findSingleNumber",
"(",
"String",
"number",
",",
"Sid",
"sourceOrganizationSid",
",",
"Sid",
"destinationOrganizationSid",
",",
"Set",
"<",
"SearchModifier",
">",
"modifiers",
")",
"{",
"NumberSelectionResult",
"matchedNumber",
"=",
... | Here we expect a perfect match in DB.
Several rules regarding organization scoping will be applied in the DAO
filter to ensure only applicable numbers in DB are retrieved.
@param number the number to match against IncomingPhoneNumbersDao
@param sourceOrganizationSid
@param destinationOrganizationSid
@return the match... | [
"Here",
"we",
"expect",
"a",
"perfect",
"match",
"in",
"DB",
"."
] | 2194dee4fc524cdfd0af77a218ba5f212f97f7c5 | https://github.com/RestComm/Restcomm-Connect/blob/2194dee4fc524cdfd0af77a218ba5f212f97f7c5/restcomm/restcomm.core/src/main/java/org/restcomm/connect/core/service/number/NumberSelectorServiceImpl.java#L130-L174 | train |
RestComm/Restcomm-Connect | restcomm/restcomm.core/src/main/java/org/restcomm/connect/core/service/number/NumberSelectorServiceImpl.java | NumberSelectorServiceImpl.findByNumber | private NumberSelectionResult findByNumber(List<String> numberQueries,
Sid sourceOrganizationSid, Sid destinationOrganizationSid, Set<SearchModifier> modifiers) {
Boolean orgFiltered = false;
NumberSelectionResult matchedNumber = new NumberSelectionResult(null, orgFiltered, null);
in... | java | private NumberSelectionResult findByNumber(List<String> numberQueries,
Sid sourceOrganizationSid, Sid destinationOrganizationSid, Set<SearchModifier> modifiers) {
Boolean orgFiltered = false;
NumberSelectionResult matchedNumber = new NumberSelectionResult(null, orgFiltered, null);
in... | [
"private",
"NumberSelectionResult",
"findByNumber",
"(",
"List",
"<",
"String",
">",
"numberQueries",
",",
"Sid",
"sourceOrganizationSid",
",",
"Sid",
"destinationOrganizationSid",
",",
"Set",
"<",
"SearchModifier",
">",
"modifiers",
")",
"{",
"Boolean",
"orgFiltered"... | Iterates over the list of given numbers, and returns the first matching.
@param numberQueries the list of numbers to attempt
@param sourceOrganizationSid
@param destinationOrganizationSid
@return the matched number, null if not matched. | [
"Iterates",
"over",
"the",
"list",
"of",
"given",
"numbers",
"and",
"returns",
"the",
"first",
"matching",
"."
] | 2194dee4fc524cdfd0af77a218ba5f212f97f7c5 | https://github.com/RestComm/Restcomm-Connect/blob/2194dee4fc524cdfd0af77a218ba5f212f97f7c5/restcomm/restcomm.core/src/main/java/org/restcomm/connect/core/service/number/NumberSelectorServiceImpl.java#L184-L200 | train |
RestComm/Restcomm-Connect | restcomm/restcomm.core/src/main/java/org/restcomm/connect/core/service/number/NumberSelectorServiceImpl.java | NumberSelectorServiceImpl.findByRegex | private NumberSelectionResult findByRegex(List<String> numberQueries,
Sid sourceOrganizationSid, Sid destOrg) {
NumberSelectionResult numberFound = new NumberSelectionResult(null, false, null);
IncomingPhoneNumberFilter.Builder filterBuilder = IncomingPhoneNumberFilter.Builder.builder();
... | java | private NumberSelectionResult findByRegex(List<String> numberQueries,
Sid sourceOrganizationSid, Sid destOrg) {
NumberSelectionResult numberFound = new NumberSelectionResult(null, false, null);
IncomingPhoneNumberFilter.Builder filterBuilder = IncomingPhoneNumberFilter.Builder.builder();
... | [
"private",
"NumberSelectionResult",
"findByRegex",
"(",
"List",
"<",
"String",
">",
"numberQueries",
",",
"Sid",
"sourceOrganizationSid",
",",
"Sid",
"destOrg",
")",
"{",
"NumberSelectionResult",
"numberFound",
"=",
"new",
"NumberSelectionResult",
"(",
"null",
",",
... | This will take the regexes available in given organization, and evalute
them agsint the given list of numbers, returning the first match.
The list of regexes will be ordered by length to ensure the longest
regexes matching any number in the list is returned first.
In this case, organization details are required.
@pa... | [
"This",
"will",
"take",
"the",
"regexes",
"available",
"in",
"given",
"organization",
"and",
"evalute",
"them",
"agsint",
"the",
"given",
"list",
"of",
"numbers",
"returning",
"the",
"first",
"match",
"."
] | 2194dee4fc524cdfd0af77a218ba5f212f97f7c5 | https://github.com/RestComm/Restcomm-Connect/blob/2194dee4fc524cdfd0af77a218ba5f212f97f7c5/restcomm/restcomm.core/src/main/java/org/restcomm/connect/core/service/number/NumberSelectorServiceImpl.java#L361-L383 | train |
RestComm/Restcomm-Connect | restcomm/restcomm.http/src/main/java/org/restcomm/connect/http/OrganizationsEndpoint.java | OrganizationsEndpoint.putOrganization | protected Response putOrganization(String domainName, final UriInfo info,
MediaType responseType) {
if(domainName == null){
return status(BAD_REQUEST).entity(MSG_EMPTY_DOMAIN_NAME ).build();
}else{
//Character verification
if(!pattern.matcher(domainName).... | java | protected Response putOrganization(String domainName, final UriInfo info,
MediaType responseType) {
if(domainName == null){
return status(BAD_REQUEST).entity(MSG_EMPTY_DOMAIN_NAME ).build();
}else{
//Character verification
if(!pattern.matcher(domainName).... | [
"protected",
"Response",
"putOrganization",
"(",
"String",
"domainName",
",",
"final",
"UriInfo",
"info",
",",
"MediaType",
"responseType",
")",
"{",
"if",
"(",
"domainName",
"==",
"null",
")",
"{",
"return",
"status",
"(",
"BAD_REQUEST",
")",
".",
"entity",
... | putOrganization create new organization
@param domainName
@param info
@param responseType
@return | [
"putOrganization",
"create",
"new",
"organization"
] | 2194dee4fc524cdfd0af77a218ba5f212f97f7c5 | https://github.com/RestComm/Restcomm-Connect/blob/2194dee4fc524cdfd0af77a218ba5f212f97f7c5/restcomm/restcomm.http/src/main/java/org/restcomm/connect/http/OrganizationsEndpoint.java#L247-L304 | train |
RestComm/Restcomm-Connect | restcomm/restcomm.http/src/main/java/org/restcomm/connect/http/OrganizationsEndpoint.java | OrganizationsEndpoint.migrateClientsOrganization | protected Response migrateClientsOrganization(final String organizationSid, UriInfo info, MediaType responseType, UserIdentityContext userIdentityContext) {
//First check if the account has the required permissions in general, this way we can fail fast and avoid expensive DAO operations
permissionEvalu... | java | protected Response migrateClientsOrganization(final String organizationSid, UriInfo info, MediaType responseType, UserIdentityContext userIdentityContext) {
//First check if the account has the required permissions in general, this way we can fail fast and avoid expensive DAO operations
permissionEvalu... | [
"protected",
"Response",
"migrateClientsOrganization",
"(",
"final",
"String",
"organizationSid",
",",
"UriInfo",
"info",
",",
"MediaType",
"responseType",
",",
"UserIdentityContext",
"userIdentityContext",
")",
"{",
"//First check if the account has the required permissions in g... | Hash password for clients of the given organization
@param organizationSid
@param info
@param responseType
@return Response with List<Client> for the Clients that hashed the password | [
"Hash",
"password",
"for",
"clients",
"of",
"the",
"given",
"organization"
] | 2194dee4fc524cdfd0af77a218ba5f212f97f7c5 | https://github.com/RestComm/Restcomm-Connect/blob/2194dee4fc524cdfd0af77a218ba5f212f97f7c5/restcomm/restcomm.http/src/main/java/org/restcomm/connect/http/OrganizationsEndpoint.java#L313-L351 | train |
RestComm/Restcomm-Connect | restcomm/restcomm.http/src/main/java/org/restcomm/connect/http/security/SecurityFilter.java | SecurityFilter.checkAuthenticatedAccount | protected void checkAuthenticatedAccount(UserIdentityContext userIdentityContext) {
if (userIdentityContext.getEffectiveAccount() == null) {
throw new WebApplicationException(Response.status(Response.Status.UNAUTHORIZED).header("WWW-Authenticate", "Basic realm=\"Restcomm realm\"").build());
... | java | protected void checkAuthenticatedAccount(UserIdentityContext userIdentityContext) {
if (userIdentityContext.getEffectiveAccount() == null) {
throw new WebApplicationException(Response.status(Response.Status.UNAUTHORIZED).header("WWW-Authenticate", "Basic realm=\"Restcomm realm\"").build());
... | [
"protected",
"void",
"checkAuthenticatedAccount",
"(",
"UserIdentityContext",
"userIdentityContext",
")",
"{",
"if",
"(",
"userIdentityContext",
".",
"getEffectiveAccount",
"(",
")",
"==",
"null",
")",
"{",
"throw",
"new",
"WebApplicationException",
"(",
"Response",
"... | Grants general purpose access if any valid token exists in the request | [
"Grants",
"general",
"purpose",
"access",
"if",
"any",
"valid",
"token",
"exists",
"in",
"the",
"request"
] | 2194dee4fc524cdfd0af77a218ba5f212f97f7c5 | https://github.com/RestComm/Restcomm-Connect/blob/2194dee4fc524cdfd0af77a218ba5f212f97f7c5/restcomm/restcomm.http/src/main/java/org/restcomm/connect/http/security/SecurityFilter.java#L94-L98 | train |
RestComm/Restcomm-Connect | restcomm/restcomm.http/src/main/java/org/restcomm/connect/http/security/SecurityFilter.java | SecurityFilter.filterClosedAccounts | protected void filterClosedAccounts(UserIdentityContext userIdentityContext, String path) {
if (userIdentityContext.getEffectiveAccount() != null && !userIdentityContext.getEffectiveAccount().getStatus().equals(Account.Status.ACTIVE)) {
if (userIdentityContext.getEffectiveAccount().getStatus().equal... | java | protected void filterClosedAccounts(UserIdentityContext userIdentityContext, String path) {
if (userIdentityContext.getEffectiveAccount() != null && !userIdentityContext.getEffectiveAccount().getStatus().equals(Account.Status.ACTIVE)) {
if (userIdentityContext.getEffectiveAccount().getStatus().equal... | [
"protected",
"void",
"filterClosedAccounts",
"(",
"UserIdentityContext",
"userIdentityContext",
",",
"String",
"path",
")",
"{",
"if",
"(",
"userIdentityContext",
".",
"getEffectiveAccount",
"(",
")",
"!=",
"null",
"&&",
"!",
"userIdentityContext",
".",
"getEffectiveA... | filter out accounts that are not active
@param userIdentityContext | [
"filter",
"out",
"accounts",
"that",
"are",
"not",
"active"
] | 2194dee4fc524cdfd0af77a218ba5f212f97f7c5 | https://github.com/RestComm/Restcomm-Connect/blob/2194dee4fc524cdfd0af77a218ba5f212f97f7c5/restcomm/restcomm.http/src/main/java/org/restcomm/connect/http/security/SecurityFilter.java#L105-L112 | train |
RestComm/Restcomm-Connect | restcomm/restcomm.telephony/src/main/java/org/restcomm/connect/telephony/Conference.java | Conference.getGlobalNoOfParticipants | private int getGlobalNoOfParticipants() throws Exception{
if(sid == null){
globalNoOfParticipants = calls.size();
}else{
CallDetailRecordsDao dao = storage.getCallDetailRecordsDao();
globalNoOfParticipants = dao.getTotalRunningCallDetailRecordsByConferenceSid(sid);
... | java | private int getGlobalNoOfParticipants() throws Exception{
if(sid == null){
globalNoOfParticipants = calls.size();
}else{
CallDetailRecordsDao dao = storage.getCallDetailRecordsDao();
globalNoOfParticipants = dao.getTotalRunningCallDetailRecordsByConferenceSid(sid);
... | [
"private",
"int",
"getGlobalNoOfParticipants",
"(",
")",
"throws",
"Exception",
"{",
"if",
"(",
"sid",
"==",
"null",
")",
"{",
"globalNoOfParticipants",
"=",
"calls",
".",
"size",
"(",
")",
";",
"}",
"else",
"{",
"CallDetailRecordsDao",
"dao",
"=",
"storage"... | get global total no of participants from db
@throws Exception | [
"get",
"global",
"total",
"no",
"of",
"participants",
"from",
"db"
] | 2194dee4fc524cdfd0af77a218ba5f212f97f7c5 | https://github.com/RestComm/Restcomm-Connect/blob/2194dee4fc524cdfd0af77a218ba5f212f97f7c5/restcomm/restcomm.telephony/src/main/java/org/restcomm/connect/telephony/Conference.java#L604-L614 | train |
RestComm/Restcomm-Connect | restcomm/restcomm.application/src/main/java/org/restcomm/connect/application/Bootstrapper.java | Bootstrapper.generateDefaultProfile | private void generateDefaultProfile(final DaoManager storage, final String profileSourcePath) throws SQLException, IOException{
Profile profile = storage.getProfilesDao().getProfile(DEFAULT_PROFILE_SID);
if (profile == null) {
if(logger.isDebugEnabled()) {
logger.debug("defa... | java | private void generateDefaultProfile(final DaoManager storage, final String profileSourcePath) throws SQLException, IOException{
Profile profile = storage.getProfilesDao().getProfile(DEFAULT_PROFILE_SID);
if (profile == null) {
if(logger.isDebugEnabled()) {
logger.debug("defa... | [
"private",
"void",
"generateDefaultProfile",
"(",
"final",
"DaoManager",
"storage",
",",
"final",
"String",
"profileSourcePath",
")",
"throws",
"SQLException",
",",
"IOException",
"{",
"Profile",
"profile",
"=",
"storage",
".",
"getProfilesDao",
"(",
")",
".",
"ge... | generateDefaultProfile if does not already exists
@throws SQLException
@throws IOException | [
"generateDefaultProfile",
"if",
"does",
"not",
"already",
"exists"
] | 2194dee4fc524cdfd0af77a218ba5f212f97f7c5 | https://github.com/RestComm/Restcomm-Connect/blob/2194dee4fc524cdfd0af77a218ba5f212f97f7c5/restcomm/restcomm.application/src/main/java/org/restcomm/connect/application/Bootstrapper.java#L323-L338 | train |
RestComm/Restcomm-Connect | restcomm/restcomm.http/src/main/java/org/restcomm/connect/http/filters/FileCacheServlet.java | FileCacheServlet.doHead | protected void doHead(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// Process request without content.
processRequest(request, response, false);
} | java | protected void doHead(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// Process request without content.
processRequest(request, response, false);
} | [
"protected",
"void",
"doHead",
"(",
"HttpServletRequest",
"request",
",",
"HttpServletResponse",
"response",
")",
"throws",
"ServletException",
",",
"IOException",
"{",
"// Process request without content.",
"processRequest",
"(",
"request",
",",
"response",
",",
"false",... | Process HEAD request. This returns the same headers as GET request, but
without content.
@see HttpServlet#doHead(HttpServletRequest, HttpServletResponse). | [
"Process",
"HEAD",
"request",
".",
"This",
"returns",
"the",
"same",
"headers",
"as",
"GET",
"request",
"but",
"without",
"content",
"."
] | 2194dee4fc524cdfd0af77a218ba5f212f97f7c5 | https://github.com/RestComm/Restcomm-Connect/blob/2194dee4fc524cdfd0af77a218ba5f212f97f7c5/restcomm/restcomm.http/src/main/java/org/restcomm/connect/http/filters/FileCacheServlet.java#L62-L66 | train |
RestComm/Restcomm-Connect | restcomm/restcomm.http/src/main/java/org/restcomm/connect/http/filters/FileCacheServlet.java | FileCacheServlet.accepts | private static boolean accepts(String acceptHeader, String toAccept) {
String[] acceptValues = acceptHeader.split("\\s*(,|;)\\s*");
Arrays.sort(acceptValues);
return Arrays.binarySearch(acceptValues, toAccept) > -1
|| Arrays.binarySearch(acceptValues, toAccept.replaceAll("/.*$", ... | java | private static boolean accepts(String acceptHeader, String toAccept) {
String[] acceptValues = acceptHeader.split("\\s*(,|;)\\s*");
Arrays.sort(acceptValues);
return Arrays.binarySearch(acceptValues, toAccept) > -1
|| Arrays.binarySearch(acceptValues, toAccept.replaceAll("/.*$", ... | [
"private",
"static",
"boolean",
"accepts",
"(",
"String",
"acceptHeader",
",",
"String",
"toAccept",
")",
"{",
"String",
"[",
"]",
"acceptValues",
"=",
"acceptHeader",
".",
"split",
"(",
"\"\\\\s*(,|;)\\\\s*\"",
")",
";",
"Arrays",
".",
"sort",
"(",
"acceptVal... | Returns true if the given accept header accepts the given value.
@param acceptHeader The accept header.
@param toAccept The value to be accepted.
@return True if the given accept header accepts the given value. | [
"Returns",
"true",
"if",
"the",
"given",
"accept",
"header",
"accepts",
"the",
"given",
"value",
"."
] | 2194dee4fc524cdfd0af77a218ba5f212f97f7c5 | https://github.com/RestComm/Restcomm-Connect/blob/2194dee4fc524cdfd0af77a218ba5f212f97f7c5/restcomm/restcomm.http/src/main/java/org/restcomm/connect/http/filters/FileCacheServlet.java#L230-L236 | train |
RestComm/Restcomm-Connect | restcomm/restcomm.http/src/main/java/org/restcomm/connect/http/filters/FileCacheServlet.java | FileCacheServlet.matches | private static boolean matches(String matchHeader, String toMatch) {
String[] matchValues = matchHeader.split("\\s*,\\s*");
Arrays.sort(matchValues);
return Arrays.binarySearch(matchValues, toMatch) > -1
|| Arrays.binarySearch(matchValues, "*") > -1;
} | java | private static boolean matches(String matchHeader, String toMatch) {
String[] matchValues = matchHeader.split("\\s*,\\s*");
Arrays.sort(matchValues);
return Arrays.binarySearch(matchValues, toMatch) > -1
|| Arrays.binarySearch(matchValues, "*") > -1;
} | [
"private",
"static",
"boolean",
"matches",
"(",
"String",
"matchHeader",
",",
"String",
"toMatch",
")",
"{",
"String",
"[",
"]",
"matchValues",
"=",
"matchHeader",
".",
"split",
"(",
"\"\\\\s*,\\\\s*\"",
")",
";",
"Arrays",
".",
"sort",
"(",
"matchValues",
"... | Returns true if the given match header matches the given value.
@param matchHeader The match header.
@param toMatch The value to be matched.
@return True if the given match header matches the given value. | [
"Returns",
"true",
"if",
"the",
"given",
"match",
"header",
"matches",
"the",
"given",
"value",
"."
] | 2194dee4fc524cdfd0af77a218ba5f212f97f7c5 | https://github.com/RestComm/Restcomm-Connect/blob/2194dee4fc524cdfd0af77a218ba5f212f97f7c5/restcomm/restcomm.http/src/main/java/org/restcomm/connect/http/filters/FileCacheServlet.java#L245-L250 | train |
ios-driver/ios-driver | server/src/main/java/org/uiautomation/ios/instruments/InstrumentsCommandLine.java | InstrumentsCommandLine.removeStaleSimulatorLaunchds | public void removeStaleSimulatorLaunchds() {
// The instruments crashes sometimes by throwing the following error in the logs
// The below logs were taken from Xcode5.1.1
// sim[2430:303] Multiple instances of launchd_sim detected, using com.apple.iphonesimulator.launchd.3bd855a
// instead of com.appl... | java | public void removeStaleSimulatorLaunchds() {
// The instruments crashes sometimes by throwing the following error in the logs
// The below logs were taken from Xcode5.1.1
// sim[2430:303] Multiple instances of launchd_sim detected, using com.apple.iphonesimulator.launchd.3bd855a
// instead of com.appl... | [
"public",
"void",
"removeStaleSimulatorLaunchds",
"(",
")",
"{",
"// The instruments crashes sometimes by throwing the following error in the logs",
"// The below logs were taken from Xcode5.1.1",
"// sim[2430:303] Multiple instances of launchd_sim detected, using com.apple.iphonesimulator.launchd.3... | Removes stale iphonesimulator launchds hanging in the system | [
"Removes",
"stale",
"iphonesimulator",
"launchds",
"hanging",
"in",
"the",
"system"
] | a9744419508d970fbb1ce18e4326cc624b237c8b | https://github.com/ios-driver/ios-driver/blob/a9744419508d970fbb1ce18e4326cc624b237c8b/server/src/main/java/org/uiautomation/ios/instruments/InstrumentsCommandLine.java#L276-L301 | train |
ios-driver/ios-driver | server/src/main/java/org/uiautomation/ios/wkrdp/internal/SimulatorProtocolImpl.java | SimulatorProtocolImpl.sendMessage | protected void sendMessage(String xml) {
byte[] bytes = null;
try {
bytes = xml.getBytes("UTF-8");
writeBytes(bytes);
} catch (SocketException se) {
// when we get a socket exception, let's try to re-establish
stop();
start();
try {
writeBytes(bytes);
} catc... | java | protected void sendMessage(String xml) {
byte[] bytes = null;
try {
bytes = xml.getBytes("UTF-8");
writeBytes(bytes);
} catch (SocketException se) {
// when we get a socket exception, let's try to re-establish
stop();
start();
try {
writeBytes(bytes);
} catc... | [
"protected",
"void",
"sendMessage",
"(",
"String",
"xml",
")",
"{",
"byte",
"[",
"]",
"bytes",
"=",
"null",
";",
"try",
"{",
"bytes",
"=",
"xml",
".",
"getBytes",
"(",
"\"UTF-8\"",
")",
";",
"writeBytes",
"(",
"bytes",
")",
";",
"}",
"catch",
"(",
... | sends the message to the AUT. | [
"sends",
"the",
"message",
"to",
"the",
"AUT",
"."
] | a9744419508d970fbb1ce18e4326cc624b237c8b | https://github.com/ios-driver/ios-driver/blob/a9744419508d970fbb1ce18e4326cc624b237c8b/server/src/main/java/org/uiautomation/ios/wkrdp/internal/SimulatorProtocolImpl.java#L68-L85 | train |
ios-driver/ios-driver | server/src/main/java/org/uiautomation/ios/wkrdp/internal/SimulatorProtocolImpl.java | SimulatorProtocolImpl.pushInput | private void pushInput(byte[] inputBytes) throws Exception {
buf.write(inputBytes);
while (buf.size() >= 4) {
byte[] bytes = buf.toByteArray();
int size = 0;
size = (size << 8) + byteToInt(bytes[0]);
size = (size << 8) + byteToInt(bytes[1]);
size = (size << 8) + byteToInt(bytes[2])... | java | private void pushInput(byte[] inputBytes) throws Exception {
buf.write(inputBytes);
while (buf.size() >= 4) {
byte[] bytes = buf.toByteArray();
int size = 0;
size = (size << 8) + byteToInt(bytes[0]);
size = (size << 8) + byteToInt(bytes[1]);
size = (size << 8) + byteToInt(bytes[2])... | [
"private",
"void",
"pushInput",
"(",
"byte",
"[",
"]",
"inputBytes",
")",
"throws",
"Exception",
"{",
"buf",
".",
"write",
"(",
"inputBytes",
")",
";",
"while",
"(",
"buf",
".",
"size",
"(",
")",
">=",
"4",
")",
"{",
"byte",
"[",
"]",
"bytes",
"=",... | reads the messages from the AUT. | [
"reads",
"the",
"messages",
"from",
"the",
"AUT",
"."
] | a9744419508d970fbb1ce18e4326cc624b237c8b | https://github.com/ios-driver/ios-driver/blob/a9744419508d970fbb1ce18e4326cc624b237c8b/server/src/main/java/org/uiautomation/ios/wkrdp/internal/SimulatorProtocolImpl.java#L99-L119 | train |
ios-driver/ios-driver | server/src/main/java/org/uiautomation/ios/wkrdp/internal/SimulatorProtocolImpl.java | SimulatorProtocolImpl.read | protected void read() throws Exception {
InputStream is = socket.getInputStream();
while (is.available() > 0) {
byte[] bytes = new byte[1024 * 1024];
int read = is.read(bytes);
byte[] actuallyRead = new byte[read];
System.arraycopy(bytes, 0, actuallyRead, 0, read);
pushInput(actual... | java | protected void read() throws Exception {
InputStream is = socket.getInputStream();
while (is.available() > 0) {
byte[] bytes = new byte[1024 * 1024];
int read = is.read(bytes);
byte[] actuallyRead = new byte[read];
System.arraycopy(bytes, 0, actuallyRead, 0, read);
pushInput(actual... | [
"protected",
"void",
"read",
"(",
")",
"throws",
"Exception",
"{",
"InputStream",
"is",
"=",
"socket",
".",
"getInputStream",
"(",
")",
";",
"while",
"(",
"is",
".",
"available",
"(",
")",
">",
"0",
")",
"{",
"byte",
"[",
"]",
"bytes",
"=",
"new",
... | listen for a complete message. | [
"listen",
"for",
"a",
"complete",
"message",
"."
] | a9744419508d970fbb1ce18e4326cc624b237c8b | https://github.com/ios-driver/ios-driver/blob/a9744419508d970fbb1ce18e4326cc624b237c8b/server/src/main/java/org/uiautomation/ios/wkrdp/internal/SimulatorProtocolImpl.java#L124-L133 | train |
ios-driver/ios-driver | common/src/main/java/org/uiautomation/ios/communication/Helper.java | Helper.extractMessage | public static String extractMessage(Throwable e) {
String msg = e.getMessage();
return msg == null ? "" : (e instanceof WebDriverException) ? msg.split("\n")[0] : msg;
} | java | public static String extractMessage(Throwable e) {
String msg = e.getMessage();
return msg == null ? "" : (e instanceof WebDriverException) ? msg.split("\n")[0] : msg;
} | [
"public",
"static",
"String",
"extractMessage",
"(",
"Throwable",
"e",
")",
"{",
"String",
"msg",
"=",
"e",
".",
"getMessage",
"(",
")",
";",
"return",
"msg",
"==",
"null",
"?",
"\"\"",
":",
"(",
"e",
"instanceof",
"WebDriverException",
")",
"?",
"msg",
... | Webdriver exception have debug info for the client. polluting server side. | [
"Webdriver",
"exception",
"have",
"debug",
"info",
"for",
"the",
"client",
".",
"polluting",
"server",
"side",
"."
] | a9744419508d970fbb1ce18e4326cc624b237c8b | https://github.com/ios-driver/ios-driver/blob/a9744419508d970fbb1ce18e4326cc624b237c8b/common/src/main/java/org/uiautomation/ios/communication/Helper.java#L29-L32 | train |
ios-driver/ios-driver | server/src/main/java/org/uiautomation/ios/utils/SimulatorSettings.java | SimulatorSettings.setKeyboardOptions | public void setKeyboardOptions() {
File folder = new File(contentAndSettingsFolder + "/Library/Preferences/");
File preferenceFile = new File(folder, "com.apple.Preferences.plist");
try {
JSONObject preferences = new JSONObject();
preferences.put("KeyboardAutocapitalization", false);
pref... | java | public void setKeyboardOptions() {
File folder = new File(contentAndSettingsFolder + "/Library/Preferences/");
File preferenceFile = new File(folder, "com.apple.Preferences.plist");
try {
JSONObject preferences = new JSONObject();
preferences.put("KeyboardAutocapitalization", false);
pref... | [
"public",
"void",
"setKeyboardOptions",
"(",
")",
"{",
"File",
"folder",
"=",
"new",
"File",
"(",
"contentAndSettingsFolder",
"+",
"\"/Library/Preferences/\"",
")",
";",
"File",
"preferenceFile",
"=",
"new",
"File",
"(",
"folder",
",",
"\"com.apple.Preferences.plist... | the default keyboard options aren't good for automation. For instance it automatically
capitalize the first letter of sentences etc. Getting rid of all that to have the keyboard
execute requests without changing them. | [
"the",
"default",
"keyboard",
"options",
"aren",
"t",
"good",
"for",
"automation",
".",
"For",
"instance",
"it",
"automatically",
"capitalize",
"the",
"first",
"letter",
"of",
"sentences",
"etc",
".",
"Getting",
"rid",
"of",
"all",
"that",
"to",
"have",
"the... | a9744419508d970fbb1ce18e4326cc624b237c8b | https://github.com/ios-driver/ios-driver/blob/a9744419508d970fbb1ce18e4326cc624b237c8b/server/src/main/java/org/uiautomation/ios/utils/SimulatorSettings.java#L97-L111 | train |
ios-driver/ios-driver | server/src/main/java/org/uiautomation/ios/utils/SimulatorSettings.java | SimulatorSettings.setAccessibilityOptions | public void setAccessibilityOptions() {
// Not enabling ApplicationAccessibility may cause intruments to fail with the error
// ScriptAgent[1170:2f07] Failed to enable accessiblity, kAXErrorServerNotFound
// The above error is more prominent in Xcode5.1.1 when tested under OSX 10.9.5
// Setting Ap... | java | public void setAccessibilityOptions() {
// Not enabling ApplicationAccessibility may cause intruments to fail with the error
// ScriptAgent[1170:2f07] Failed to enable accessiblity, kAXErrorServerNotFound
// The above error is more prominent in Xcode5.1.1 when tested under OSX 10.9.5
// Setting Ap... | [
"public",
"void",
"setAccessibilityOptions",
"(",
")",
"{",
"// Not enabling ApplicationAccessibility may cause intruments to fail with the error ",
"// ScriptAgent[1170:2f07] Failed to enable accessiblity, kAXErrorServerNotFound",
"// The above error is more prominent in Xcode5.1.1 when tested unde... | Set the Accessibility preferences. Overrides the values in 'com.apple.Accessibility.plist' file. | [
"Set",
"the",
"Accessibility",
"preferences",
".",
"Overrides",
"the",
"values",
"in",
"com",
".",
"apple",
".",
"Accessibility",
".",
"plist",
"file",
"."
] | a9744419508d970fbb1ce18e4326cc624b237c8b | https://github.com/ios-driver/ios-driver/blob/a9744419508d970fbb1ce18e4326cc624b237c8b/server/src/main/java/org/uiautomation/ios/utils/SimulatorSettings.java#L116-L140 | train |
ios-driver/ios-driver | server/src/main/java/org/uiautomation/ios/utils/SimulatorSettings.java | SimulatorSettings.resetContentAndSettings | public void resetContentAndSettings() {
if (instrumentsVersion.getMajor() < 6) {
if (hasContentAndSettingsFolder()) {
boolean ok = deleteRecursive(getContentAndSettingsFolder());
if (!ok) {
System.err.println("cannot delete content and settings folder " + contentAndSettingsFolder);
... | java | public void resetContentAndSettings() {
if (instrumentsVersion.getMajor() < 6) {
if (hasContentAndSettingsFolder()) {
boolean ok = deleteRecursive(getContentAndSettingsFolder());
if (!ok) {
System.err.println("cannot delete content and settings folder " + contentAndSettingsFolder);
... | [
"public",
"void",
"resetContentAndSettings",
"(",
")",
"{",
"if",
"(",
"instrumentsVersion",
".",
"getMajor",
"(",
")",
"<",
"6",
")",
"{",
"if",
"(",
"hasContentAndSettingsFolder",
"(",
")",
")",
"{",
"boolean",
"ok",
"=",
"deleteRecursive",
"(",
"getConten... | Does what IOS Simulator - Reset content and settings menu does, by deleting the files on disk.
The simulator shouldn't be running when that is done. | [
"Does",
"what",
"IOS",
"Simulator",
"-",
"Reset",
"content",
"and",
"settings",
"menu",
"does",
"by",
"deleting",
"the",
"files",
"on",
"disk",
".",
"The",
"simulator",
"shouldn",
"t",
"be",
"running",
"when",
"that",
"is",
"done",
"."
] | a9744419508d970fbb1ce18e4326cc624b237c8b | https://github.com/ios-driver/ios-driver/blob/a9744419508d970fbb1ce18e4326cc624b237c8b/server/src/main/java/org/uiautomation/ios/utils/SimulatorSettings.java#L267-L294 | train |
ios-driver/ios-driver | server/src/main/java/org/uiautomation/ios/instruments/InstrumentsNoDelayLoader.java | InstrumentsNoDelayLoader.extract | private File extract(InstrumentsVersion version) {
if (version.getBuild() == null) {
throw new WebDriverException("you are running a version of XCode that is too old " + version);
}
extractFromJar("instruments");
extractFromJar("InstrumentsShim.dylib");
extractFromJar("ScriptAgentShim.dylib")... | java | private File extract(InstrumentsVersion version) {
if (version.getBuild() == null) {
throw new WebDriverException("you are running a version of XCode that is too old " + version);
}
extractFromJar("instruments");
extractFromJar("InstrumentsShim.dylib");
extractFromJar("ScriptAgentShim.dylib")... | [
"private",
"File",
"extract",
"(",
"InstrumentsVersion",
"version",
")",
"{",
"if",
"(",
"version",
".",
"getBuild",
"(",
")",
"==",
"null",
")",
"{",
"throw",
"new",
"WebDriverException",
"(",
"\"you are running a version of XCode that is too old \"",
"+",
"version... | extract the binaries for the specified version of instruments. | [
"extract",
"the",
"binaries",
"for",
"the",
"specified",
"version",
"of",
"instruments",
"."
] | a9744419508d970fbb1ce18e4326cc624b237c8b | https://github.com/ios-driver/ios-driver/blob/a9744419508d970fbb1ce18e4326cc624b237c8b/server/src/main/java/org/uiautomation/ios/instruments/InstrumentsNoDelayLoader.java#L69-L85 | train |
ios-driver/ios-driver | server/src/main/java/org/uiautomation/ios/instruments/InstrumentsVersion.java | InstrumentsVersion.processVersionLine | private void processVersionLine(String log) {
log = log.replace(start, "");
String[] pieces = log.split(" \\(");
if (pieces.length == 2) {
version = pieces[0];
build = pieces[1].replace(")", "");
// old builds do not include build info. Xcode 4.3.2 return 1.0 without build info
} else ... | java | private void processVersionLine(String log) {
log = log.replace(start, "");
String[] pieces = log.split(" \\(");
if (pieces.length == 2) {
version = pieces[0];
build = pieces[1].replace(")", "");
// old builds do not include build info. Xcode 4.3.2 return 1.0 without build info
} else ... | [
"private",
"void",
"processVersionLine",
"(",
"String",
"log",
")",
"{",
"log",
"=",
"log",
".",
"replace",
"(",
"start",
",",
"\"\"",
")",
";",
"String",
"[",
"]",
"pieces",
"=",
"log",
".",
"split",
"(",
"\" \\\\(\"",
")",
";",
"if",
"(",
"pieces",... | string parsing to get the version out. | [
"string",
"parsing",
"to",
"get",
"the",
"version",
"out",
"."
] | a9744419508d970fbb1ce18e4326cc624b237c8b | https://github.com/ios-driver/ios-driver/blob/a9744419508d970fbb1ce18e4326cc624b237c8b/server/src/main/java/org/uiautomation/ios/instruments/InstrumentsVersion.java#L43-L54 | train |
ios-driver/ios-driver | client/src/main/java/org/uiautomation/ios/client/uiamodels/impl/augmenter/IOSDriverAugmenter.java | IOSDriverAugmenter.augment | public static <T> T augment(WebDriver driver) {
Augmenter augmenter = new Augmenter();
augmenter.addDriverAugmentation(IOSCapabilities.CONFIGURABLE, new AddConfigurable());
augmenter.addDriverAugmentation(IOSCapabilities.ELEMENT_TREE, new AddLogElementTree());
augmenter.addDriverAugmentation(IOSCapabili... | java | public static <T> T augment(WebDriver driver) {
Augmenter augmenter = new Augmenter();
augmenter.addDriverAugmentation(IOSCapabilities.CONFIGURABLE, new AddConfigurable());
augmenter.addDriverAugmentation(IOSCapabilities.ELEMENT_TREE, new AddLogElementTree());
augmenter.addDriverAugmentation(IOSCapabili... | [
"public",
"static",
"<",
"T",
">",
"T",
"augment",
"(",
"WebDriver",
"driver",
")",
"{",
"Augmenter",
"augmenter",
"=",
"new",
"Augmenter",
"(",
")",
";",
"augmenter",
".",
"addDriverAugmentation",
"(",
"IOSCapabilities",
".",
"CONFIGURABLE",
",",
"new",
"Ad... | Add all the IOS specific interfaces ios-driver supports. | [
"Add",
"all",
"the",
"IOS",
"specific",
"interfaces",
"ios",
"-",
"driver",
"supports",
"."
] | a9744419508d970fbb1ce18e4326cc624b237c8b | https://github.com/ios-driver/ios-driver/blob/a9744419508d970fbb1ce18e4326cc624b237c8b/client/src/main/java/org/uiautomation/ios/client/uiamodels/impl/augmenter/IOSDriverAugmenter.java#L32-L39 | train |
ios-driver/ios-driver | server/src/main/java/org/uiautomation/ios/utils/ZipUtils.java | ZipUtils.extractAppFromURL | public static File extractAppFromURL(URL url) throws IOException {
String fileName = url.toExternalForm().substring(url.toExternalForm().lastIndexOf('/') + 1);
File tmpDir = createTmpDir("iosd");
log.fine("tmpDir: " + tmpDir.getAbsolutePath());
File downloadedFile = new File(tmpDir, fileName);
Fil... | java | public static File extractAppFromURL(URL url) throws IOException {
String fileName = url.toExternalForm().substring(url.toExternalForm().lastIndexOf('/') + 1);
File tmpDir = createTmpDir("iosd");
log.fine("tmpDir: " + tmpDir.getAbsolutePath());
File downloadedFile = new File(tmpDir, fileName);
Fil... | [
"public",
"static",
"File",
"extractAppFromURL",
"(",
"URL",
"url",
")",
"throws",
"IOException",
"{",
"String",
"fileName",
"=",
"url",
".",
"toExternalForm",
"(",
")",
".",
"substring",
"(",
"url",
".",
"toExternalForm",
"(",
")",
".",
"lastIndexOf",
"(",
... | Downloads zip from from url, extracts it into tmp dir and returns path to
extracted directory
@param url
url to zipped .app or .ipa
@return .app or .ipa file | [
"Downloads",
"zip",
"from",
"from",
"url",
"extracts",
"it",
"into",
"tmp",
"dir",
"and",
"returns",
"path",
"to",
"extracted",
"directory"
] | a9744419508d970fbb1ce18e4326cc624b237c8b | https://github.com/ios-driver/ios-driver/blob/a9744419508d970fbb1ce18e4326cc624b237c8b/server/src/main/java/org/uiautomation/ios/utils/ZipUtils.java#L40-L61 | train |
ios-driver/ios-driver | server/src/main/java/org/uiautomation/ios/drivers/IOSDualDriver.java | IOSDualDriver.forceWebViewToReloadManually | private void forceWebViewToReloadManually(int retry) {
boolean ok = false;
setMode(WorkingMode.Native);
for (int i = 0; i < retry; i++) {
try {
// to get Safari out of his home page and become responsive we need to click
// on one of the home icons, click on the "about:blank" we adde... | java | private void forceWebViewToReloadManually(int retry) {
boolean ok = false;
setMode(WorkingMode.Native);
for (int i = 0; i < retry; i++) {
try {
// to get Safari out of his home page and become responsive we need to click
// on one of the home icons, click on the "about:blank" we adde... | [
"private",
"void",
"forceWebViewToReloadManually",
"(",
"int",
"retry",
")",
"{",
"boolean",
"ok",
"=",
"false",
";",
"setMode",
"(",
"WorkingMode",
".",
"Native",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"retry",
";",
"i",
"++",
")... | the webview doesn't refresh correctly if it hasn't been loaded at lease once. | [
"the",
"webview",
"doesn",
"t",
"refresh",
"correctly",
"if",
"it",
"hasn",
"t",
"been",
"loaded",
"at",
"lease",
"once",
"."
] | a9744419508d970fbb1ce18e4326cc624b237c8b | https://github.com/ios-driver/ios-driver/blob/a9744419508d970fbb1ce18e4326cc624b237c8b/server/src/main/java/org/uiautomation/ios/drivers/IOSDualDriver.java#L146-L180 | train |
ios-driver/ios-driver | client/src/main/java/org/uiautomation/ios/client/uiamodels/impl/RemoteIOSObject.java | RemoteIOSObject.createObject | public static WebElement createObject(RemoteWebDriver driver, Map<String, Object> ro) {
String ref = ro.get("ELEMENT").toString();
String type = (String) ro.get("type");
if (type != null) {
String remoteObjectName = "org.uiautomation.ios.client.uiamodels.impl.Remote" + type;
if ("UIAElementNil... | java | public static WebElement createObject(RemoteWebDriver driver, Map<String, Object> ro) {
String ref = ro.get("ELEMENT").toString();
String type = (String) ro.get("type");
if (type != null) {
String remoteObjectName = "org.uiautomation.ios.client.uiamodels.impl.Remote" + type;
if ("UIAElementNil... | [
"public",
"static",
"WebElement",
"createObject",
"(",
"RemoteWebDriver",
"driver",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"ro",
")",
"{",
"String",
"ref",
"=",
"ro",
".",
"get",
"(",
"\"ELEMENT\"",
")",
".",
"toString",
"(",
")",
";",
"String",
... | Uses reflection to instanciate a remote object implementing the correct interface.
@return the object. If the object is UIAElementNil, return null for a simple object, an empty
list for a UIAElementArray. | [
"Uses",
"reflection",
"to",
"instanciate",
"a",
"remote",
"object",
"implementing",
"the",
"correct",
"interface",
"."
] | a9744419508d970fbb1ce18e4326cc624b237c8b | https://github.com/ios-driver/ios-driver/blob/a9744419508d970fbb1ce18e4326cc624b237c8b/client/src/main/java/org/uiautomation/ios/client/uiamodels/impl/RemoteIOSObject.java#L55-L100 | train |
ios-driver/ios-driver | server/src/main/java/org/uiautomation/ios/command/web/SetFrameHandler.java | SetFrameHandler.handle | @Override
public Response handle() throws Exception {
Object p = getRequest().getPayload().get("id");
if (JSONObject.NULL.equals(p)) {
getWebDriver().getContext().setCurrentFrame(null, null, null);
} else {
RemoteWebElement iframe;
if (p instanceof String) {
iframe = getIframe((... | java | @Override
public Response handle() throws Exception {
Object p = getRequest().getPayload().get("id");
if (JSONObject.NULL.equals(p)) {
getWebDriver().getContext().setCurrentFrame(null, null, null);
} else {
RemoteWebElement iframe;
if (p instanceof String) {
iframe = getIframe((... | [
"@",
"Override",
"public",
"Response",
"handle",
"(",
")",
"throws",
"Exception",
"{",
"Object",
"p",
"=",
"getRequest",
"(",
")",
".",
"getPayload",
"(",
")",
".",
"get",
"(",
"\"id\"",
")",
";",
"if",
"(",
"JSONObject",
".",
"NULL",
".",
"equals",
... | NoSuchFrame - If the frame specified by id cannot be found. | [
"NoSuchFrame",
"-",
"If",
"the",
"frame",
"specified",
"by",
"id",
"cannot",
"be",
"found",
"."
] | a9744419508d970fbb1ce18e4326cc624b237c8b | https://github.com/ios-driver/ios-driver/blob/a9744419508d970fbb1ce18e4326cc624b237c8b/server/src/main/java/org/uiautomation/ios/command/web/SetFrameHandler.java#L37-L66 | train |
ios-driver/ios-driver | server/src/main/java/org/uiautomation/ios/application/APPIOSApplication.java | APPIOSApplication.loadDictionaries | private ImmutableList<LanguageDictionary> loadDictionaries() {
Map<String, LanguageDictionary> languageNameMap = new HashMap<>();
for (File f : LanguageDictionary.getL10NFiles(app)) {
String name = LanguageDictionary.extractLanguageName(f);
LanguageDictionary res = languageNameMap.get(name);
i... | java | private ImmutableList<LanguageDictionary> loadDictionaries() {
Map<String, LanguageDictionary> languageNameMap = new HashMap<>();
for (File f : LanguageDictionary.getL10NFiles(app)) {
String name = LanguageDictionary.extractLanguageName(f);
LanguageDictionary res = languageNameMap.get(name);
i... | [
"private",
"ImmutableList",
"<",
"LanguageDictionary",
">",
"loadDictionaries",
"(",
")",
"{",
"Map",
"<",
"String",
",",
"LanguageDictionary",
">",
"languageNameMap",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"for",
"(",
"File",
"f",
":",
"LanguageDictionar... | Load all the dictionaries for the application. | [
"Load",
"all",
"the",
"dictionaries",
"for",
"the",
"application",
"."
] | a9744419508d970fbb1ce18e4326cc624b237c8b | https://github.com/ios-driver/ios-driver/blob/a9744419508d970fbb1ce18e4326cc624b237c8b/server/src/main/java/org/uiautomation/ios/application/APPIOSApplication.java#L177-L204 | train |
ios-driver/ios-driver | server/src/main/java/org/uiautomation/ios/application/APPIOSApplication.java | APPIOSApplication.getResources | public Map<String, String> getResources() {
Map<String, String> resourceByResourceName = new HashMap<>();
String metadata = getMetadata(ICON);
if (metadata.equals("")) {
metadata = getFirstIconFile(BUNDLE_ICONS);
}
resourceByResourceName.put(ICON, metadata);
return resourceByResourceName;
... | java | public Map<String, String> getResources() {
Map<String, String> resourceByResourceName = new HashMap<>();
String metadata = getMetadata(ICON);
if (metadata.equals("")) {
metadata = getFirstIconFile(BUNDLE_ICONS);
}
resourceByResourceName.put(ICON, metadata);
return resourceByResourceName;
... | [
"public",
"Map",
"<",
"String",
",",
"String",
">",
"getResources",
"(",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"resourceByResourceName",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"String",
"metadata",
"=",
"getMetadata",
"(",
"ICON",
")",... | the list of resources to publish via http. | [
"the",
"list",
"of",
"resources",
"to",
"publish",
"via",
"http",
"."
] | a9744419508d970fbb1ce18e4326cc624b237c8b | https://github.com/ios-driver/ios-driver/blob/a9744419508d970fbb1ce18e4326cc624b237c8b/server/src/main/java/org/uiautomation/ios/application/APPIOSApplication.java#L230-L238 | train |
ios-driver/ios-driver | server/src/main/java/org/uiautomation/ios/application/LanguageDictionary.java | LanguageDictionary.readContentFromBinaryFile | public JSONObject readContentFromBinaryFile(File binaryFile) throws Exception {
PlistFileUtils util = new PlistFileUtils(binaryFile);
return util.toJSON();
} | java | public JSONObject readContentFromBinaryFile(File binaryFile) throws Exception {
PlistFileUtils util = new PlistFileUtils(binaryFile);
return util.toJSON();
} | [
"public",
"JSONObject",
"readContentFromBinaryFile",
"(",
"File",
"binaryFile",
")",
"throws",
"Exception",
"{",
"PlistFileUtils",
"util",
"=",
"new",
"PlistFileUtils",
"(",
"binaryFile",
")",
";",
"return",
"util",
".",
"toJSON",
"(",
")",
";",
"}"
] | load the content of the binary file and returns it as a json object. | [
"load",
"the",
"content",
"of",
"the",
"binary",
"file",
"and",
"returns",
"it",
"as",
"a",
"json",
"object",
"."
] | a9744419508d970fbb1ce18e4326cc624b237c8b | https://github.com/ios-driver/ios-driver/blob/a9744419508d970fbb1ce18e4326cc624b237c8b/server/src/main/java/org/uiautomation/ios/application/LanguageDictionary.java#L74-L77 | train |
ios-driver/ios-driver | server/src/main/java/org/uiautomation/ios/command/uiautomation/BaseFindElementNHandler.java | BaseFindElementNHandler.getCriteria | private JSONObject getCriteria(JSONObject payload) throws JSONException {
if (payload.has("criteria")) {
JSONObject json = payload.getJSONObject("criteria");
return json;
} else if (payload.has("using")) {
return getCriteriaFromWebDriverSelector(payload);
} else {
throw new InvalidSe... | java | private JSONObject getCriteria(JSONObject payload) throws JSONException {
if (payload.has("criteria")) {
JSONObject json = payload.getJSONObject("criteria");
return json;
} else if (payload.has("using")) {
return getCriteriaFromWebDriverSelector(payload);
} else {
throw new InvalidSe... | [
"private",
"JSONObject",
"getCriteria",
"(",
"JSONObject",
"payload",
")",
"throws",
"JSONException",
"{",
"if",
"(",
"payload",
".",
"has",
"(",
"\"criteria\"",
")",
")",
"{",
"JSONObject",
"json",
"=",
"payload",
".",
"getJSONObject",
"(",
"\"criteria\"",
")... | create the criteria for the request. If the request follows the webdriver protocol, maps it to
a criteria ios-driver understands. | [
"create",
"the",
"criteria",
"for",
"the",
"request",
".",
"If",
"the",
"request",
"follows",
"the",
"webdriver",
"protocol",
"maps",
"it",
"to",
"a",
"criteria",
"ios",
"-",
"driver",
"understands",
"."
] | a9744419508d970fbb1ce18e4326cc624b237c8b | https://github.com/ios-driver/ios-driver/blob/a9744419508d970fbb1ce18e4326cc624b237c8b/server/src/main/java/org/uiautomation/ios/command/uiautomation/BaseFindElementNHandler.java#L91-L100 | train |
ios-driver/ios-driver | server/src/main/java/org/uiautomation/ios/command/uiautomation/BaseFindElementNHandler.java | BaseFindElementNHandler.getCriteriaFromWebDriverSelector | private JSONObject getCriteriaFromWebDriverSelector(JSONObject payload) throws JSONException {
String using = payload.getString("using");
String value = payload.getString("value");
if ("tag name".equals(using) || "class name".equals(using)) {
try {
Package p = UIAElement.class.getPackage();
... | java | private JSONObject getCriteriaFromWebDriverSelector(JSONObject payload) throws JSONException {
String using = payload.getString("using");
String value = payload.getString("value");
if ("tag name".equals(using) || "class name".equals(using)) {
try {
Package p = UIAElement.class.getPackage();
... | [
"private",
"JSONObject",
"getCriteriaFromWebDriverSelector",
"(",
"JSONObject",
"payload",
")",
"throws",
"JSONException",
"{",
"String",
"using",
"=",
"payload",
".",
"getString",
"(",
"\"using\"",
")",
";",
"String",
"value",
"=",
"payload",
".",
"getString",
"(... | handles the mapping from the webdriver using to a criteria. | [
"handles",
"the",
"mapping",
"from",
"the",
"webdriver",
"using",
"to",
"a",
"criteria",
"."
] | a9744419508d970fbb1ce18e4326cc624b237c8b | https://github.com/ios-driver/ios-driver/blob/a9744419508d970fbb1ce18e4326cc624b237c8b/server/src/main/java/org/uiautomation/ios/command/uiautomation/BaseFindElementNHandler.java#L105-L126 | train |
ios-driver/ios-driver | server/src/main/java/org/uiautomation/ios/wkrdp/DOMContext.java | DOMContext.setCurrentFrame | public void setCurrentFrame(RemoteWebElement iframe, RemoteWebElement document,
RemoteWebElement window) {
this.iframe = iframe;
this.document = document;
this.window = window;
if (iframe != null) {
isOnMainFrame = false;
} else {
isOnMainFrame = true;
... | java | public void setCurrentFrame(RemoteWebElement iframe, RemoteWebElement document,
RemoteWebElement window) {
this.iframe = iframe;
this.document = document;
this.window = window;
if (iframe != null) {
isOnMainFrame = false;
} else {
isOnMainFrame = true;
... | [
"public",
"void",
"setCurrentFrame",
"(",
"RemoteWebElement",
"iframe",
",",
"RemoteWebElement",
"document",
",",
"RemoteWebElement",
"window",
")",
"{",
"this",
".",
"iframe",
"=",
"iframe",
";",
"this",
".",
"document",
"=",
"document",
";",
"this",
".",
"wi... | breaks the nodeId reference. | [
"breaks",
"the",
"nodeId",
"reference",
"."
] | a9744419508d970fbb1ce18e4326cc624b237c8b | https://github.com/ios-driver/ios-driver/blob/a9744419508d970fbb1ce18e4326cc624b237c8b/server/src/main/java/org/uiautomation/ios/wkrdp/DOMContext.java#L142-L167 | train |
ios-driver/ios-driver | server/src/main/java/org/uiautomation/ios/utils/Command.java | Command.start | public void start() {
if (log.isLoggable(Level.FINE)) {
log.fine(String.format("Starting command: %s", commandString()));
}
ProcessBuilder builder = new ProcessBuilder(args);
if (workingDir != null) {
builder.directory(workingDir);
}
if (!environment.isEmpty()) {
Map<String, St... | java | public void start() {
if (log.isLoggable(Level.FINE)) {
log.fine(String.format("Starting command: %s", commandString()));
}
ProcessBuilder builder = new ProcessBuilder(args);
if (workingDir != null) {
builder.directory(workingDir);
}
if (!environment.isEmpty()) {
Map<String, St... | [
"public",
"void",
"start",
"(",
")",
"{",
"if",
"(",
"log",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"{",
"log",
".",
"fine",
"(",
"String",
".",
"format",
"(",
"\"Starting command: %s\"",
",",
"commandString",
"(",
")",
")",
")",
";",... | Starts the command. Doesn't wait for it to finish. Doesn't wait for stdout and stderr either. | [
"Starts",
"the",
"command",
".",
"Doesn",
"t",
"wait",
"for",
"it",
"to",
"finish",
".",
"Doesn",
"t",
"wait",
"for",
"stdout",
"and",
"stderr",
"either",
"."
] | a9744419508d970fbb1ce18e4326cc624b237c8b | https://github.com/ios-driver/ios-driver/blob/a9744419508d970fbb1ce18e4326cc624b237c8b/server/src/main/java/org/uiautomation/ios/utils/Command.java#L83-L104 | train |
ios-driver/ios-driver | client/src/main/java/org/uiautomation/ios/client/uiamodels/impl/configuration/WebDriverLikeCommandExecutor.java | WebDriverLikeCommandExecutor.execute | public <T> T execute(WebDriverLikeRequest request) {
Response response = null;
long total = 0;
try {
HttpClient client = newHttpClientWithTimeout();
String url = remoteURL + request.getPath();
BasicHttpEntityEnclosingRequest
r =
new BasicHttpEntityEnclosingRequest(reque... | java | public <T> T execute(WebDriverLikeRequest request) {
Response response = null;
long total = 0;
try {
HttpClient client = newHttpClientWithTimeout();
String url = remoteURL + request.getPath();
BasicHttpEntityEnclosingRequest
r =
new BasicHttpEntityEnclosingRequest(reque... | [
"public",
"<",
"T",
">",
"T",
"execute",
"(",
"WebDriverLikeRequest",
"request",
")",
"{",
"Response",
"response",
"=",
"null",
";",
"long",
"total",
"=",
"0",
";",
"try",
"{",
"HttpClient",
"client",
"=",
"newHttpClientWithTimeout",
"(",
")",
";",
"String... | send the request to the remote server for execution. | [
"send",
"the",
"request",
"to",
"the",
"remote",
"server",
"for",
"execution",
"."
] | a9744419508d970fbb1ce18e4326cc624b237c8b | https://github.com/ios-driver/ios-driver/blob/a9744419508d970fbb1ce18e4326cc624b237c8b/client/src/main/java/org/uiautomation/ios/client/uiamodels/impl/configuration/WebDriverLikeCommandExecutor.java#L72-L101 | train |
zalando-nakadi/fahrschein | fahrschein/src/main/java/org/zalando/fahrschein/NakadiClient.java | NakadiClient.subscribe | @Deprecated
public Subscription subscribe(String applicationName, String eventName, String consumerGroup) throws IOException {
return subscription(applicationName, eventName).withConsumerGroup(consumerGroup).subscribe();
} | java | @Deprecated
public Subscription subscribe(String applicationName, String eventName, String consumerGroup) throws IOException {
return subscription(applicationName, eventName).withConsumerGroup(consumerGroup).subscribe();
} | [
"@",
"Deprecated",
"public",
"Subscription",
"subscribe",
"(",
"String",
"applicationName",
",",
"String",
"eventName",
",",
"String",
"consumerGroup",
")",
"throws",
"IOException",
"{",
"return",
"subscription",
"(",
"applicationName",
",",
"eventName",
")",
".",
... | Create a subscription for a single event type.
@deprecated Use the {@link SubscriptionBuilder} and {@link NakadiClient#subscription(String, String)} instead. | [
"Create",
"a",
"subscription",
"for",
"a",
"single",
"event",
"type",
"."
] | b55ae0ff79aacb300548a88f3969fd11a0904804 | https://github.com/zalando-nakadi/fahrschein/blob/b55ae0ff79aacb300548a88f3969fd11a0904804/fahrschein/src/main/java/org/zalando/fahrschein/NakadiClient.java#L82-L85 | train |
zalando-nakadi/fahrschein | fahrschein/src/main/java/org/zalando/fahrschein/NakadiClient.java | NakadiClient.subscription | public SubscriptionBuilder subscription(String applicationName, String eventName) throws IOException {
return new SubscriptionBuilder(this, applicationName, Collections.singleton(eventName));
} | java | public SubscriptionBuilder subscription(String applicationName, String eventName) throws IOException {
return new SubscriptionBuilder(this, applicationName, Collections.singleton(eventName));
} | [
"public",
"SubscriptionBuilder",
"subscription",
"(",
"String",
"applicationName",
",",
"String",
"eventName",
")",
"throws",
"IOException",
"{",
"return",
"new",
"SubscriptionBuilder",
"(",
"this",
",",
"applicationName",
",",
"Collections",
".",
"singleton",
"(",
... | Build a subscription for a single event type. | [
"Build",
"a",
"subscription",
"for",
"a",
"single",
"event",
"type",
"."
] | b55ae0ff79aacb300548a88f3969fd11a0904804 | https://github.com/zalando-nakadi/fahrschein/blob/b55ae0ff79aacb300548a88f3969fd11a0904804/fahrschein/src/main/java/org/zalando/fahrschein/NakadiClient.java#L90-L92 | train |
zalando-nakadi/fahrschein | fahrschein/src/main/java/org/zalando/fahrschein/NakadiClient.java | NakadiClient.subscription | public SubscriptionBuilder subscription(String applicationName, Set<String> eventNames) throws IOException {
return new SubscriptionBuilder(this, applicationName, eventNames);
} | java | public SubscriptionBuilder subscription(String applicationName, Set<String> eventNames) throws IOException {
return new SubscriptionBuilder(this, applicationName, eventNames);
} | [
"public",
"SubscriptionBuilder",
"subscription",
"(",
"String",
"applicationName",
",",
"Set",
"<",
"String",
">",
"eventNames",
")",
"throws",
"IOException",
"{",
"return",
"new",
"SubscriptionBuilder",
"(",
"this",
",",
"applicationName",
",",
"eventNames",
")",
... | Build a subscription for multiple event types. | [
"Build",
"a",
"subscription",
"for",
"multiple",
"event",
"types",
"."
] | b55ae0ff79aacb300548a88f3969fd11a0904804 | https://github.com/zalando-nakadi/fahrschein/blob/b55ae0ff79aacb300548a88f3969fd11a0904804/fahrschein/src/main/java/org/zalando/fahrschein/NakadiClient.java#L97-L99 | train |
zalando-nakadi/fahrschein | fahrschein/src/main/java/org/zalando/fahrschein/NakadiClient.java | NakadiClient.deleteSubscription | public void deleteSubscription(String subscriptionId) throws IOException {
checkArgument(!subscriptionId.isEmpty(), "Subscription ID cannot be empty.");
final URI uri = baseUri.resolve(String.format("/subscriptions/%s", subscriptionId));
final Request request = clientHttpRequestFactory.createRe... | java | public void deleteSubscription(String subscriptionId) throws IOException {
checkArgument(!subscriptionId.isEmpty(), "Subscription ID cannot be empty.");
final URI uri = baseUri.resolve(String.format("/subscriptions/%s", subscriptionId));
final Request request = clientHttpRequestFactory.createRe... | [
"public",
"void",
"deleteSubscription",
"(",
"String",
"subscriptionId",
")",
"throws",
"IOException",
"{",
"checkArgument",
"(",
"!",
"subscriptionId",
".",
"isEmpty",
"(",
")",
",",
"\"Subscription ID cannot be empty.\"",
")",
";",
"final",
"URI",
"uri",
"=",
"b... | Delete subscription based on subscription ID. | [
"Delete",
"subscription",
"based",
"on",
"subscription",
"ID",
"."
] | b55ae0ff79aacb300548a88f3969fd11a0904804 | https://github.com/zalando-nakadi/fahrschein/blob/b55ae0ff79aacb300548a88f3969fd11a0904804/fahrschein/src/main/java/org/zalando/fahrschein/NakadiClient.java#L104-L120 | train |
zalando-nakadi/fahrschein | fahrschein-http-simple/src/main/java/org/zalando/fahrschein/http/simple/SimpleRequestFactory.java | SimpleRequestFactory.openConnection | private HttpURLConnection openConnection(URL url) throws IOException {
URLConnection urlConnection = url.openConnection();
if (!(urlConnection instanceof HttpURLConnection)) {
throw new IllegalStateException("Connection should be an HttpURLConnection");
}
return (HttpURLConne... | java | private HttpURLConnection openConnection(URL url) throws IOException {
URLConnection urlConnection = url.openConnection();
if (!(urlConnection instanceof HttpURLConnection)) {
throw new IllegalStateException("Connection should be an HttpURLConnection");
}
return (HttpURLConne... | [
"private",
"HttpURLConnection",
"openConnection",
"(",
"URL",
"url",
")",
"throws",
"IOException",
"{",
"URLConnection",
"urlConnection",
"=",
"url",
".",
"openConnection",
"(",
")",
";",
"if",
"(",
"!",
"(",
"urlConnection",
"instanceof",
"HttpURLConnection",
")"... | Opens and returns a connection to the given URL.
@param url the URL to open a connection to
@return the opened connection
@throws IOException in case of I/O errors | [
"Opens",
"and",
"returns",
"a",
"connection",
"to",
"the",
"given",
"URL",
"."
] | b55ae0ff79aacb300548a88f3969fd11a0904804 | https://github.com/zalando-nakadi/fahrschein/blob/b55ae0ff79aacb300548a88f3969fd11a0904804/fahrschein-http-simple/src/main/java/org/zalando/fahrschein/http/simple/SimpleRequestFactory.java#L62-L68 | train |
zalando-nakadi/fahrschein | fahrschein/src/main/java/org/zalando/fahrschein/StreamParameters.java | StreamParameters.withCommitTimeout | public StreamParameters withCommitTimeout(int commitTimeout) {
return new StreamParameters(batchLimit, streamLimit, batchFlushTimeout, streamTimeout, streamKeepAliveLimit, maxUncommittedEvents, commitTimeout);
} | java | public StreamParameters withCommitTimeout(int commitTimeout) {
return new StreamParameters(batchLimit, streamLimit, batchFlushTimeout, streamTimeout, streamKeepAliveLimit, maxUncommittedEvents, commitTimeout);
} | [
"public",
"StreamParameters",
"withCommitTimeout",
"(",
"int",
"commitTimeout",
")",
"{",
"return",
"new",
"StreamParameters",
"(",
"batchLimit",
",",
"streamLimit",
",",
"batchFlushTimeout",
",",
"streamTimeout",
",",
"streamKeepAliveLimit",
",",
"maxUncommittedEvents",
... | Maximum amount of seconds that nakadi will be waiting for commit after sending a batch to a client.
If the commit does not come within this timeout, nakadi will initialize stream termination, no
new data will be sent. Partitions from this stream will be assigned to other streams.
@param commitTimeout | [
"Maximum",
"amount",
"of",
"seconds",
"that",
"nakadi",
"will",
"be",
"waiting",
"for",
"commit",
"after",
"sending",
"a",
"batch",
"to",
"a",
"client",
".",
"If",
"the",
"commit",
"does",
"not",
"come",
"within",
"this",
"timeout",
"nakadi",
"will",
"init... | b55ae0ff79aacb300548a88f3969fd11a0904804 | https://github.com/zalando-nakadi/fahrschein/blob/b55ae0ff79aacb300548a88f3969fd11a0904804/fahrschein/src/main/java/org/zalando/fahrschein/StreamParameters.java#L156-L158 | train |
sdl/odata | odata_renderer/src/main/java/com/sdl/odata/unmarshaller/json/ODataJsonParser.java | ODataJsonParser.initializeProcessor | private void initializeProcessor(JsonProcessor processor) throws ODataUnmarshallingException {
LOG.info("Trying to initialize processor: {}", processor.getClass().getSimpleName());
processor.initialize();
fields = processor.getValues();
odataValues = processor.getODataValues();
... | java | private void initializeProcessor(JsonProcessor processor) throws ODataUnmarshallingException {
LOG.info("Trying to initialize processor: {}", processor.getClass().getSimpleName());
processor.initialize();
fields = processor.getValues();
odataValues = processor.getODataValues();
... | [
"private",
"void",
"initializeProcessor",
"(",
"JsonProcessor",
"processor",
")",
"throws",
"ODataUnmarshallingException",
"{",
"LOG",
".",
"info",
"(",
"\"Trying to initialize processor: {}\"",
",",
"processor",
".",
"getClass",
"(",
")",
".",
"getSimpleName",
"(",
"... | Initialize processor ready for for unmarshalling entity.
@param processor the jsonProcessor
@throws ODataUnmarshallingException If unable to initialize processor | [
"Initialize",
"processor",
"ready",
"for",
"for",
"unmarshalling",
"entity",
"."
] | eb747d73e9af0f4e59a25b82ed656e526a7e2189 | https://github.com/sdl/odata/blob/eb747d73e9af0f4e59a25b82ed656e526a7e2189/odata_renderer/src/main/java/com/sdl/odata/unmarshaller/json/ODataJsonParser.java#L62-L69 | train |
sdl/odata | odata_renderer/src/main/java/com/sdl/odata/unmarshaller/json/ODataJsonParser.java | ODataJsonParser.getEntityName | private String getEntityName() throws ODataUnmarshallingException {
String odataType = odataValues.get(JsonConstants.TYPE);
if (isNullOrEmpty(odataType)) {
TargetType targetType = getTargetType();
if (targetType == null) {
throw new ODataUnmarshallingException("Co... | java | private String getEntityName() throws ODataUnmarshallingException {
String odataType = odataValues.get(JsonConstants.TYPE);
if (isNullOrEmpty(odataType)) {
TargetType targetType = getTargetType();
if (targetType == null) {
throw new ODataUnmarshallingException("Co... | [
"private",
"String",
"getEntityName",
"(",
")",
"throws",
"ODataUnmarshallingException",
"{",
"String",
"odataType",
"=",
"odataValues",
".",
"get",
"(",
"JsonConstants",
".",
"TYPE",
")",
";",
"if",
"(",
"isNullOrEmpty",
"(",
"odataType",
")",
")",
"{",
"Targ... | Gets the entity type name.
@return the entity type
@throws ODataUnmarshallingException | [
"Gets",
"the",
"entity",
"type",
"name",
"."
] | eb747d73e9af0f4e59a25b82ed656e526a7e2189 | https://github.com/sdl/odata/blob/eb747d73e9af0f4e59a25b82ed656e526a7e2189/odata_renderer/src/main/java/com/sdl/odata/unmarshaller/json/ODataJsonParser.java#L112-L126 | train |
sdl/odata | odata_renderer/src/main/java/com/sdl/odata/unmarshaller/json/ODataJsonParser.java | ODataJsonParser.setEntityNavigationProperties | protected void setEntityNavigationProperties(Object entity, StructuredType entityType) throws ODataException {
for (Map.Entry<String, Object> entry : links.entrySet()) {
String propertyName = entry.getKey();
Object entryLinks = entry.getValue();
LOG.debug("Found link for navi... | java | protected void setEntityNavigationProperties(Object entity, StructuredType entityType) throws ODataException {
for (Map.Entry<String, Object> entry : links.entrySet()) {
String propertyName = entry.getKey();
Object entryLinks = entry.getValue();
LOG.debug("Found link for navi... | [
"protected",
"void",
"setEntityNavigationProperties",
"(",
"Object",
"entity",
",",
"StructuredType",
"entityType",
")",
"throws",
"ODataException",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"Object",
">",
"entry",
":",
"links",
".",
"entrySet",
... | Sets the given entity with navigation links.
@param entity entity
@param entityType the entity type
@throws ODataException If unable to set navigation properties | [
"Sets",
"the",
"given",
"entity",
"with",
"navigation",
"links",
"."
] | eb747d73e9af0f4e59a25b82ed656e526a7e2189 | https://github.com/sdl/odata/blob/eb747d73e9af0f4e59a25b82ed656e526a7e2189/odata_renderer/src/main/java/com/sdl/odata/unmarshaller/json/ODataJsonParser.java#L136-L168 | train |
sdl/odata | odata_renderer/src/main/java/com/sdl/odata/renderer/atom/writer/AtomWriter.java | AtomWriter.writeStartFeed | public void writeStartFeed(String requestContextURL, Map<String, Object> meta) throws ODataRenderException {
this.contextURL = checkNotNull(requestContextURL);
try {
startFeed(false);
if (ODataUriUtil.hasCountOption(oDataUri) &&
meta != null && meta.containsK... | java | public void writeStartFeed(String requestContextURL, Map<String, Object> meta) throws ODataRenderException {
this.contextURL = checkNotNull(requestContextURL);
try {
startFeed(false);
if (ODataUriUtil.hasCountOption(oDataUri) &&
meta != null && meta.containsK... | [
"public",
"void",
"writeStartFeed",
"(",
"String",
"requestContextURL",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"meta",
")",
"throws",
"ODataRenderException",
"{",
"this",
".",
"contextURL",
"=",
"checkNotNull",
"(",
"requestContextURL",
")",
";",
"try",
... | Write start feed to the XML stream.
@param requestContextURL The 'Context URL' to write for the feed. It can not {@code null}.
@param meta Additional metadata to write.
@throws ODataRenderException In case it is not possible to write to the XML stream. | [
"Write",
"start",
"feed",
"to",
"the",
"XML",
"stream",
"."
] | eb747d73e9af0f4e59a25b82ed656e526a7e2189 | https://github.com/sdl/odata/blob/eb747d73e9af0f4e59a25b82ed656e526a7e2189/odata_renderer/src/main/java/com/sdl/odata/renderer/atom/writer/AtomWriter.java#L223-L241 | train |
sdl/odata | odata_renderer/src/main/java/com/sdl/odata/renderer/atom/writer/AtomWriter.java | AtomWriter.writeBodyFeed | public void writeBodyFeed(List<?> entities) throws ODataRenderException {
checkNotNull(entities);
try {
for (Object entity : entities) {
writeEntry(entity, true);
}
} catch (XMLStreamException | IllegalAccessException | NoSuchFieldException | ODataEdmExcep... | java | public void writeBodyFeed(List<?> entities) throws ODataRenderException {
checkNotNull(entities);
try {
for (Object entity : entities) {
writeEntry(entity, true);
}
} catch (XMLStreamException | IllegalAccessException | NoSuchFieldException | ODataEdmExcep... | [
"public",
"void",
"writeBodyFeed",
"(",
"List",
"<",
"?",
">",
"entities",
")",
"throws",
"ODataRenderException",
"{",
"checkNotNull",
"(",
"entities",
")",
";",
"try",
"{",
"for",
"(",
"Object",
"entity",
":",
"entities",
")",
"{",
"writeEntry",
"(",
"ent... | Write feed body.
@param entities The list of entities to fill in the XML stream. It can not {@code null}.
@throws ODataRenderException In case it is not possible to write to the XML stream. | [
"Write",
"feed",
"body",
"."
] | eb747d73e9af0f4e59a25b82ed656e526a7e2189 | https://github.com/sdl/odata/blob/eb747d73e9af0f4e59a25b82ed656e526a7e2189/odata_renderer/src/main/java/com/sdl/odata/renderer/atom/writer/AtomWriter.java#L249-L259 | train |
sdl/odata | odata_renderer/src/main/java/com/sdl/odata/renderer/atom/writer/AtomWriter.java | AtomWriter.getXml | public String getXml() {
try {
return ((ByteArrayOutputStream) outputStream).toString(StandardCharsets.UTF_8.name());
} catch (UnsupportedEncodingException e) {
return outputStream.toString();
}
} | java | public String getXml() {
try {
return ((ByteArrayOutputStream) outputStream).toString(StandardCharsets.UTF_8.name());
} catch (UnsupportedEncodingException e) {
return outputStream.toString();
}
} | [
"public",
"String",
"getXml",
"(",
")",
"{",
"try",
"{",
"return",
"(",
"(",
"ByteArrayOutputStream",
")",
"outputStream",
")",
".",
"toString",
"(",
"StandardCharsets",
".",
"UTF_8",
".",
"name",
"(",
")",
")",
";",
"}",
"catch",
"(",
"UnsupportedEncoding... | Get the generated XML.
@return The generated XML. | [
"Get",
"the",
"generated",
"XML",
"."
] | eb747d73e9af0f4e59a25b82ed656e526a7e2189 | https://github.com/sdl/odata/blob/eb747d73e9af0f4e59a25b82ed656e526a7e2189/odata_renderer/src/main/java/com/sdl/odata/renderer/atom/writer/AtomWriter.java#L303-L309 | train |
sdl/odata | odata_client_api/src/main/java/com/sdl/odata/client/util/ODataClientUtils.java | ODataClientUtils.closeIfNecessary | public static void closeIfNecessary(Closeable closeable) throws ODataClientException {
if (closeable != null) {
try {
closeable.close();
} catch (IOException e) {
throw new ODataClientException("Could not close '" + closeable.getClass().getSimpleName() + "... | java | public static void closeIfNecessary(Closeable closeable) throws ODataClientException {
if (closeable != null) {
try {
closeable.close();
} catch (IOException e) {
throw new ODataClientException("Could not close '" + closeable.getClass().getSimpleName() + "... | [
"public",
"static",
"void",
"closeIfNecessary",
"(",
"Closeable",
"closeable",
")",
"throws",
"ODataClientException",
"{",
"if",
"(",
"closeable",
"!=",
"null",
")",
"{",
"try",
"{",
"closeable",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",... | Close closable objects if it is necessary. Mostly used to close connections.
@param closeable closable object
@throws ODataClientException | [
"Close",
"closable",
"objects",
"if",
"it",
"is",
"necessary",
".",
"Mostly",
"used",
"to",
"close",
"connections",
"."
] | eb747d73e9af0f4e59a25b82ed656e526a7e2189 | https://github.com/sdl/odata/blob/eb747d73e9af0f4e59a25b82ed656e526a7e2189/odata_client_api/src/main/java/com/sdl/odata/client/util/ODataClientUtils.java#L46-L54 | train |
sdl/odata | odata_client_api/src/main/java/com/sdl/odata/client/util/ODataClientUtils.java | ODataClientUtils.populateRequestProperties | public static Map<String, String> populateRequestProperties(
Map<String, String> requestProperties, int bodyLength, MediaType contentType, MediaType acceptType) {
Map<String, String> properties;
// requestProperties
if (requestProperties == null || requestProperties.isEmpty()) {
... | java | public static Map<String, String> populateRequestProperties(
Map<String, String> requestProperties, int bodyLength, MediaType contentType, MediaType acceptType) {
Map<String, String> properties;
// requestProperties
if (requestProperties == null || requestProperties.isEmpty()) {
... | [
"public",
"static",
"Map",
"<",
"String",
",",
"String",
">",
"populateRequestProperties",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"requestProperties",
",",
"int",
"bodyLength",
",",
"MediaType",
"contentType",
",",
"MediaType",
"acceptType",
")",
"{",
... | Util method for first populating request properties before execution.
@param requestProperties request properties, may be immutable.
It can be null or empty, so copying will take place, if necessary.
@param bodyLength body length
@param contentType content type
@param acceptType access type
@return... | [
"Util",
"method",
"for",
"first",
"populating",
"request",
"properties",
"before",
"execution",
"."
] | eb747d73e9af0f4e59a25b82ed656e526a7e2189 | https://github.com/sdl/odata/blob/eb747d73e9af0f4e59a25b82ed656e526a7e2189/odata_client_api/src/main/java/com/sdl/odata/client/util/ODataClientUtils.java#L66-L85 | train |
sdl/odata | odata_renderer/src/main/java/com/sdl/odata/unmarshaller/AbstractActionParser.java | AbstractActionParser.getAction | public Object getAction() throws ODataException {
Option<String> actionNameOption = ODataUriUtil.getActionCallName(odataUri);
if (actionNameOption.isDefined()) {
LOG.debug("The operation is supposed to be an action");
String actionName = actionNameOption.get();
return... | java | public Object getAction() throws ODataException {
Option<String> actionNameOption = ODataUriUtil.getActionCallName(odataUri);
if (actionNameOption.isDefined()) {
LOG.debug("The operation is supposed to be an action");
String actionName = actionNameOption.get();
return... | [
"public",
"Object",
"getAction",
"(",
")",
"throws",
"ODataException",
"{",
"Option",
"<",
"String",
">",
"actionNameOption",
"=",
"ODataUriUtil",
".",
"getActionCallName",
"(",
"odataUri",
")",
";",
"if",
"(",
"actionNameOption",
".",
"isDefined",
"(",
")",
"... | Returns the instance of Action with all parameters provided by request.
@return The instance of Action with all parameters provided by request.
@throws ODataException If unable to get action | [
"Returns",
"the",
"instance",
"of",
"Action",
"with",
"all",
"parameters",
"provided",
"by",
"request",
"."
] | eb747d73e9af0f4e59a25b82ed656e526a7e2189 | https://github.com/sdl/odata/blob/eb747d73e9af0f4e59a25b82ed656e526a7e2189/odata_renderer/src/main/java/com/sdl/odata/unmarshaller/AbstractActionParser.java#L63-L79 | train |
sdl/odata | odata_edm/src/main/java/com/sdl/odata/edm/factory/annotations/AnnotationActionImportFactory.java | AnnotationActionImportFactory.addActionImport | public void addActionImport(Class<?> cls) {
EdmActionImport actionImportAnnotation = cls.getAnnotation(EdmActionImport.class);
ActionImportImpl.Builder actionImportBuilder = new ActionImportImpl.Builder()
.setEntitySetName(actionImportAnnotation.entitySet())
.setActionNam... | java | public void addActionImport(Class<?> cls) {
EdmActionImport actionImportAnnotation = cls.getAnnotation(EdmActionImport.class);
ActionImportImpl.Builder actionImportBuilder = new ActionImportImpl.Builder()
.setEntitySetName(actionImportAnnotation.entitySet())
.setActionNam... | [
"public",
"void",
"addActionImport",
"(",
"Class",
"<",
"?",
">",
"cls",
")",
"{",
"EdmActionImport",
"actionImportAnnotation",
"=",
"cls",
".",
"getAnnotation",
"(",
"EdmActionImport",
".",
"class",
")",
";",
"ActionImportImpl",
".",
"Builder",
"actionImportBuild... | Adds an action import to factory.
@param cls The action import class. | [
"Adds",
"an",
"action",
"import",
"to",
"factory",
"."
] | eb747d73e9af0f4e59a25b82ed656e526a7e2189 | https://github.com/sdl/odata/blob/eb747d73e9af0f4e59a25b82ed656e526a7e2189/odata_edm/src/main/java/com/sdl/odata/edm/factory/annotations/AnnotationActionImportFactory.java#L38-L47 | train |
sdl/odata | odata_edm/src/main/java/com/sdl/odata/edm/factory/annotations/AnnotationActionImportFactory.java | AnnotationActionImportFactory.build | public Iterable<ActionImport> build(FactoryLookup lookup) {
List<ActionImport> actionImports = new ArrayList<>();
for (ActionImportImpl.Builder actionImportBuilder : actionImportBuilders) {
actionImportBuilder.setEntitySet(
lookup.getEntitySet(actionImportBuilder.getEntit... | java | public Iterable<ActionImport> build(FactoryLookup lookup) {
List<ActionImport> actionImports = new ArrayList<>();
for (ActionImportImpl.Builder actionImportBuilder : actionImportBuilders) {
actionImportBuilder.setEntitySet(
lookup.getEntitySet(actionImportBuilder.getEntit... | [
"public",
"Iterable",
"<",
"ActionImport",
">",
"build",
"(",
"FactoryLookup",
"lookup",
")",
"{",
"List",
"<",
"ActionImport",
">",
"actionImports",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"ActionImportImpl",
".",
"Builder",
"actionImportBui... | Builds action import objects based on registered classes.
@param lookup The factory lookup.
@return The list of action import instances. | [
"Builds",
"action",
"import",
"objects",
"based",
"on",
"registered",
"classes",
"."
] | eb747d73e9af0f4e59a25b82ed656e526a7e2189 | https://github.com/sdl/odata/blob/eb747d73e9af0f4e59a25b82ed656e526a7e2189/odata_edm/src/main/java/com/sdl/odata/edm/factory/annotations/AnnotationActionImportFactory.java#L55-L66 | train |
sdl/odata | odata_renderer/src/main/java/com/sdl/odata/renderer/json/writer/JsonErrorResponseWriter.java | JsonErrorResponseWriter.getJsonError | public String getJsonError(ODataException exception) throws ODataRenderException {
checkNotNull(exception);
LOG.debug("Start building Json error document");
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
try {
JsonGenerator jsonGenerator = JSON_FACTORY.c... | java | public String getJsonError(ODataException exception) throws ODataRenderException {
checkNotNull(exception);
LOG.debug("Start building Json error document");
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
try {
JsonGenerator jsonGenerator = JSON_FACTORY.c... | [
"public",
"String",
"getJsonError",
"(",
"ODataException",
"exception",
")",
"throws",
"ODataRenderException",
"{",
"checkNotNull",
"(",
"exception",
")",
";",
"LOG",
".",
"debug",
"(",
"\"Start building Json error document\"",
")",
";",
"ByteArrayOutputStream",
"output... | Gets the json error output according to ODataException.
@param exception ODataException
@return errorJsonResponse
@throws ODataRenderException If unable to render the json error message | [
"Gets",
"the",
"json",
"error",
"output",
"according",
"to",
"ODataException",
"."
] | eb747d73e9af0f4e59a25b82ed656e526a7e2189 | https://github.com/sdl/odata/blob/eb747d73e9af0f4e59a25b82ed656e526a7e2189/odata_renderer/src/main/java/com/sdl/odata/renderer/json/writer/JsonErrorResponseWriter.java#L52-L79 | train |
sdl/odata | odata_renderer/src/main/java/com/sdl/odata/renderer/atom/writer/AtomDataWriter.java | AtomDataWriter.writeData | public void writeData(Object entity, EntityType entityType) throws XMLStreamException, ODataRenderException {
xmlWriter.writeStartElement(ODATA_CONTENT);
xmlWriter.writeAttribute(TYPE, XML.toString());
xmlWriter.writeStartElement(METADATA, ODATA_PROPERTIES, "");
marshall(entity, entity... | java | public void writeData(Object entity, EntityType entityType) throws XMLStreamException, ODataRenderException {
xmlWriter.writeStartElement(ODATA_CONTENT);
xmlWriter.writeAttribute(TYPE, XML.toString());
xmlWriter.writeStartElement(METADATA, ODATA_PROPERTIES, "");
marshall(entity, entity... | [
"public",
"void",
"writeData",
"(",
"Object",
"entity",
",",
"EntityType",
"entityType",
")",
"throws",
"XMLStreamException",
",",
"ODataRenderException",
"{",
"xmlWriter",
".",
"writeStartElement",
"(",
"ODATA_CONTENT",
")",
";",
"xmlWriter",
".",
"writeAttribute",
... | Write the data for a given entity.
@param entity The given entity.
@param entityType The entity type.
@throws XMLStreamException if unable to render the entity
@throws ODataRenderException if unable to render the entity | [
"Write",
"the",
"data",
"for",
"a",
"given",
"entity",
"."
] | eb747d73e9af0f4e59a25b82ed656e526a7e2189 | https://github.com/sdl/odata/blob/eb747d73e9af0f4e59a25b82ed656e526a7e2189/odata_renderer/src/main/java/com/sdl/odata/renderer/atom/writer/AtomDataWriter.java#L90-L100 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.