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
easymock/objenesis
main/src/main/java/org/objenesis/strategy/SingleInstantiatorStrategy.java
SingleInstantiatorStrategy.newInstantiatorOf
@SuppressWarnings("unchecked") public <T> ObjectInstantiator<T> newInstantiatorOf(Class<T> type) { try { return (ObjectInstantiator<T>) constructor.newInstance(type); } catch (InstantiationException | IllegalAccessException | InvocationTargetException e) { throw new ObjenesisException(e...
java
@SuppressWarnings("unchecked") public <T> ObjectInstantiator<T> newInstantiatorOf(Class<T> type) { try { return (ObjectInstantiator<T>) constructor.newInstance(type); } catch (InstantiationException | IllegalAccessException | InvocationTargetException e) { throw new ObjenesisException(e...
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "T", ">", "ObjectInstantiator", "<", "T", ">", "newInstantiatorOf", "(", "Class", "<", "T", ">", "type", ")", "{", "try", "{", "return", "(", "ObjectInstantiator", "<", "T", ">", ")", "co...
Return an instantiator for the wanted type and of the one and only type of instantiator returned by this class. @param <T> the type we want to instantiate @param type Class to instantiate @return The ObjectInstantiator for the class
[ "Return", "an", "instantiator", "for", "the", "wanted", "type", "and", "of", "the", "one", "and", "only", "type", "of", "instantiator", "returned", "by", "this", "class", "." ]
8f601c8ba1aa20bbc640e2c2bc48d55df52c489f
https://github.com/easymock/objenesis/blob/8f601c8ba1aa20bbc640e2c2bc48d55df52c489f/main/src/main/java/org/objenesis/strategy/SingleInstantiatorStrategy.java#L58-L65
train
easymock/objenesis
main/src/main/java/org/objenesis/instantiator/SerializationInstantiatorHelper.java
SerializationInstantiatorHelper.getNonSerializableSuperClass
public static <T> Class<? super T> getNonSerializableSuperClass(Class<T> type) { Class<? super T> result = type; while(Serializable.class.isAssignableFrom(result)) { result = result.getSuperclass(); if(result == null) { throw new Error("Bad class hierarchy: No non-serializable ...
java
public static <T> Class<? super T> getNonSerializableSuperClass(Class<T> type) { Class<? super T> result = type; while(Serializable.class.isAssignableFrom(result)) { result = result.getSuperclass(); if(result == null) { throw new Error("Bad class hierarchy: No non-serializable ...
[ "public", "static", "<", "T", ">", "Class", "<", "?", "super", "T", ">", "getNonSerializableSuperClass", "(", "Class", "<", "T", ">", "type", ")", "{", "Class", "<", "?", "super", "T", ">", "result", "=", "type", ";", "while", "(", "Serializable", "....
Returns the first non-serializable superclass of a given class. According to Java Object Serialization Specification, objects read from a stream are initialized by calling an accessible no-arg constructor from the first non-serializable superclass in the object's hierarchy, allowing the state of non-serializable fields...
[ "Returns", "the", "first", "non", "-", "serializable", "superclass", "of", "a", "given", "class", ".", "According", "to", "Java", "Object", "Serialization", "Specification", "objects", "read", "from", "a", "stream", "are", "initialized", "by", "calling", "an", ...
8f601c8ba1aa20bbc640e2c2bc48d55df52c489f
https://github.com/easymock/objenesis/blob/8f601c8ba1aa20bbc640e2c2bc48d55df52c489f/main/src/main/java/org/objenesis/instantiator/SerializationInstantiatorHelper.java#L38-L48
train
easymock/objenesis
main/src/main/java/org/objenesis/strategy/PlatformDescription.java
PlatformDescription.describePlatform
public static String describePlatform() { String desc = "Java " + SPECIFICATION_VERSION + " (" + "VM vendor name=\"" + VENDOR + "\", " + "VM vendor version=" + VENDOR_VERSION + ", " + "JVM name=\"" + JVM_NAME + "\", " + "JVM version=" + VM_VERSION + ", " ...
java
public static String describePlatform() { String desc = "Java " + SPECIFICATION_VERSION + " (" + "VM vendor name=\"" + VENDOR + "\", " + "VM vendor version=" + VENDOR_VERSION + ", " + "JVM name=\"" + JVM_NAME + "\", " + "JVM version=" + VM_VERSION + ", " ...
[ "public", "static", "String", "describePlatform", "(", ")", "{", "String", "desc", "=", "\"Java \"", "+", "SPECIFICATION_VERSION", "+", "\" (\"", "+", "\"VM vendor name=\\\"\"", "+", "VENDOR", "+", "\"\\\", \"", "+", "\"VM vendor version=\"", "+", "VENDOR_VERSION", ...
Describes the platform. Outputs Java version and vendor. @return Description of the current platform
[ "Describes", "the", "platform", ".", "Outputs", "Java", "version", "and", "vendor", "." ]
8f601c8ba1aa20bbc640e2c2bc48d55df52c489f
https://github.com/easymock/objenesis/blob/8f601c8ba1aa20bbc640e2c2bc48d55df52c489f/main/src/main/java/org/objenesis/strategy/PlatformDescription.java#L85-L100
train
rharter/auto-value-gson
auto-value-gson/src/main/java/com/ryanharter/auto/value/gson/AutoValueGsonExtension.java
AutoValueGsonExtension.convertPropertiesToTypes
private Map<String, TypeName> convertPropertiesToTypes(Map<String, ExecutableElement> properties) { Map<String, TypeName> types = new LinkedHashMap<>(); for (Map.Entry<String, ExecutableElement> entry : properties.entrySet()) { ExecutableElement el = entry.getValue(); types.put(entry.getKey(), TypeN...
java
private Map<String, TypeName> convertPropertiesToTypes(Map<String, ExecutableElement> properties) { Map<String, TypeName> types = new LinkedHashMap<>(); for (Map.Entry<String, ExecutableElement> entry : properties.entrySet()) { ExecutableElement el = entry.getValue(); types.put(entry.getKey(), TypeN...
[ "private", "Map", "<", "String", ",", "TypeName", ">", "convertPropertiesToTypes", "(", "Map", "<", "String", ",", "ExecutableElement", ">", "properties", ")", "{", "Map", "<", "String", ",", "TypeName", ">", "types", "=", "new", "LinkedHashMap", "<>", "(", ...
Converts the ExecutableElement properties to TypeName properties
[ "Converts", "the", "ExecutableElement", "properties", "to", "TypeName", "properties" ]
68be3b6a208d25ac0580164f6372a38c279cf4fc
https://github.com/rharter/auto-value-gson/blob/68be3b6a208d25ac0580164f6372a38c279cf4fc/auto-value-gson/src/main/java/com/ryanharter/auto/value/gson/AutoValueGsonExtension.java#L391-L398
train
rharter/auto-value-gson
auto-value-gson/src/main/java/com/ryanharter/auto/value/gson/AutoValueGsonAdapterFactoryProcessor.java
AutoValueGsonAdapterFactoryProcessor.classNameOf
private static String classNameOf(TypeElement type, String delimiter) { String name = type.getSimpleName().toString(); while (type.getEnclosingElement() instanceof TypeElement) { type = (TypeElement) type.getEnclosingElement(); name = type.getSimpleName() + delimiter + name; } return name; ...
java
private static String classNameOf(TypeElement type, String delimiter) { String name = type.getSimpleName().toString(); while (type.getEnclosingElement() instanceof TypeElement) { type = (TypeElement) type.getEnclosingElement(); name = type.getSimpleName() + delimiter + name; } return name; ...
[ "private", "static", "String", "classNameOf", "(", "TypeElement", "type", ",", "String", "delimiter", ")", "{", "String", "name", "=", "type", ".", "getSimpleName", "(", ")", ".", "toString", "(", ")", ";", "while", "(", "type", ".", "getEnclosingElement", ...
Returns the name of the given type, including any enclosing types but not the package, separated by a delimiter.
[ "Returns", "the", "name", "of", "the", "given", "type", "including", "any", "enclosing", "types", "but", "not", "the", "package", "separated", "by", "a", "delimiter", "." ]
68be3b6a208d25ac0580164f6372a38c279cf4fc
https://github.com/rharter/auto-value-gson/blob/68be3b6a208d25ac0580164f6372a38c279cf4fc/auto-value-gson/src/main/java/com/ryanharter/auto/value/gson/AutoValueGsonAdapterFactoryProcessor.java#L328-L335
train
evernote/evernote-sdk-android
library/src/main/java/com/evernote/client/android/helper/EvernotePreconditions.java
EvernotePreconditions.checkArrayElementsInRange
public static float[] checkArrayElementsInRange(float[] value, float lower, float upper, String valueName) { checkNotNull(value, valueName + " must not be null"); for (int i = 0; i < value.length; ++i) { float v = value[i]; if...
java
public static float[] checkArrayElementsInRange(float[] value, float lower, float upper, String valueName) { checkNotNull(value, valueName + " must not be null"); for (int i = 0; i < value.length; ++i) { float v = value[i]; if...
[ "public", "static", "float", "[", "]", "checkArrayElementsInRange", "(", "float", "[", "]", "value", ",", "float", "lower", ",", "float", "upper", ",", "String", "valueName", ")", "{", "checkNotNull", "(", "value", ",", "valueName", "+", "\" must not be null\"...
Ensures that all elements in the argument floating point array are within the inclusive range <p>While this can be used to range check against +/- infinity, note that all NaN numbers will always be out of range.</p> @param value a floating point array of values @param lower the lower endpoint of the inclusive range @...
[ "Ensures", "that", "all", "elements", "in", "the", "argument", "floating", "point", "array", "are", "within", "the", "inclusive", "range" ]
fc59be643e85c4f59d562d1bfe76563997aa73cf
https://github.com/evernote/evernote-sdk-android/blob/fc59be643e85c4f59d562d1bfe76563997aa73cf/library/src/main/java/com/evernote/client/android/helper/EvernotePreconditions.java#L320-L341
train
evernote/evernote-sdk-android
library/src/main/java/com/evernote/client/android/BootstrapManager.java
BootstrapManager.initializeUserStoreAndCheckVersion
private void initializeUserStoreAndCheckVersion() throws Exception { int i = 0; String version = com.evernote.edam.userstore.Constants.EDAM_VERSION_MAJOR + "." + com.evernote.edam.userstore.Constants.EDAM_VERSION_MINOR; for (String url : mBootstrapServerUrls) { i++; try { Evern...
java
private void initializeUserStoreAndCheckVersion() throws Exception { int i = 0; String version = com.evernote.edam.userstore.Constants.EDAM_VERSION_MAJOR + "." + com.evernote.edam.userstore.Constants.EDAM_VERSION_MINOR; for (String url : mBootstrapServerUrls) { i++; try { Evern...
[ "private", "void", "initializeUserStoreAndCheckVersion", "(", ")", "throws", "Exception", "{", "int", "i", "=", "0", ";", "String", "version", "=", "com", ".", "evernote", ".", "edam", ".", "userstore", ".", "Constants", ".", "EDAM_VERSION_MAJOR", "+", "\".\""...
Initialized the User Store to check for supported version of the API. @throws ClientUnsupportedException on unsupported version @throws Exception on generic errors
[ "Initialized", "the", "User", "Store", "to", "check", "for", "supported", "version", "of", "the", "API", "." ]
fc59be643e85c4f59d562d1bfe76563997aa73cf
https://github.com/evernote/evernote-sdk-android/blob/fc59be643e85c4f59d562d1bfe76563997aa73cf/library/src/main/java/com/evernote/client/android/BootstrapManager.java#L115-L146
train
evernote/evernote-sdk-android
library/src/main/java/com/evernote/client/android/BootstrapManager.java
BootstrapManager.getBootstrapInfo
BootstrapInfoWrapper getBootstrapInfo() throws Exception { Log.d(LOGTAG, "getBootstrapInfo()"); BootstrapInfo bsInfo = null; try { if (mBootstrapServerUsed == null) { initializeUserStoreAndCheckVersion(); } bsInfo = mEvernoteSession.getEvernoteClientFactory().getUserStoreClient(ge...
java
BootstrapInfoWrapper getBootstrapInfo() throws Exception { Log.d(LOGTAG, "getBootstrapInfo()"); BootstrapInfo bsInfo = null; try { if (mBootstrapServerUsed == null) { initializeUserStoreAndCheckVersion(); } bsInfo = mEvernoteSession.getEvernoteClientFactory().getUserStoreClient(ge...
[ "BootstrapInfoWrapper", "getBootstrapInfo", "(", ")", "throws", "Exception", "{", "Log", ".", "d", "(", "LOGTAG", ",", "\"getBootstrapInfo()\"", ")", ";", "BootstrapInfo", "bsInfo", "=", "null", ";", "try", "{", "if", "(", "mBootstrapServerUsed", "==", "null", ...
Makes a web request to get the latest bootstrap information. This is a requirement during the oauth process @return {@link BootstrapInfoWrapper} @throws Exception
[ "Makes", "a", "web", "request", "to", "get", "the", "latest", "bootstrap", "information", ".", "This", "is", "a", "requirement", "during", "the", "oauth", "process" ]
fc59be643e85c4f59d562d1bfe76563997aa73cf
https://github.com/evernote/evernote-sdk-android/blob/fc59be643e85c4f59d562d1bfe76563997aa73cf/library/src/main/java/com/evernote/client/android/BootstrapManager.java#L155-L171
train
evernote/evernote-sdk-android
library/src/main/java/com/evernote/client/android/asyncclient/EvernoteHtmlHelper.java
EvernoteHtmlHelper.fetchEvernoteUrl
public Response fetchEvernoteUrl(String url) throws IOException { Request.Builder requestBuilder = new Request.Builder() .url(url) .addHeader("Cookie", mAuthHeader) .get(); return mHttpClient.newCall(requestBuilder.build()).execute(); }
java
public Response fetchEvernoteUrl(String url) throws IOException { Request.Builder requestBuilder = new Request.Builder() .url(url) .addHeader("Cookie", mAuthHeader) .get(); return mHttpClient.newCall(requestBuilder.build()).execute(); }
[ "public", "Response", "fetchEvernoteUrl", "(", "String", "url", ")", "throws", "IOException", "{", "Request", ".", "Builder", "requestBuilder", "=", "new", "Request", ".", "Builder", "(", ")", ".", "url", "(", "url", ")", ".", "addHeader", "(", "\"Cookie\"",...
Fetches the URL with the current authentication token as cookie in the header. <br> <br> <b>Pay attention</b> to which URLs you are sending the authentication token. It's better to verify the host first. @param url The URL which should be opened. @return The raw response.
[ "Fetches", "the", "URL", "with", "the", "current", "authentication", "token", "as", "cookie", "in", "the", "header", "." ]
fc59be643e85c4f59d562d1bfe76563997aa73cf
https://github.com/evernote/evernote-sdk-android/blob/fc59be643e85c4f59d562d1bfe76563997aa73cf/library/src/main/java/com/evernote/client/android/asyncclient/EvernoteHtmlHelper.java#L109-L116
train
evernote/evernote-sdk-android
library/src/main/java/com/evernote/client/android/EvernoteUtil.java
EvernoteUtil.createEnMediaTag
public static String createEnMediaTag(Resource resource) { return "<en-media hash=\"" + bytesToHex(resource.getData().getBodyHash()) + "\" type=\"" + resource.getMime() + "\"/>"; }
java
public static String createEnMediaTag(Resource resource) { return "<en-media hash=\"" + bytesToHex(resource.getData().getBodyHash()) + "\" type=\"" + resource.getMime() + "\"/>"; }
[ "public", "static", "String", "createEnMediaTag", "(", "Resource", "resource", ")", "{", "return", "\"<en-media hash=\\\"\"", "+", "bytesToHex", "(", "resource", ".", "getData", "(", ")", ".", "getBodyHash", "(", ")", ")", "+", "\"\\\" type=\\\"\"", "+", "resour...
Create an ENML &lt;en-media&gt; tag for the specified Resource object.
[ "Create", "an", "ENML", "&lt", ";", "en", "-", "media&gt", ";", "tag", "for", "the", "specified", "Resource", "object", "." ]
fc59be643e85c4f59d562d1bfe76563997aa73cf
https://github.com/evernote/evernote-sdk-android/blob/fc59be643e85c4f59d562d1bfe76563997aa73cf/library/src/main/java/com/evernote/client/android/EvernoteUtil.java#L124-L126
train
evernote/evernote-sdk-android
library/src/main/java/com/evernote/client/android/EvernoteUtil.java
EvernoteUtil.hash
public static byte[] hash(byte[] body) { if (HASH_DIGEST != null) { return HASH_DIGEST.digest(body); } else { throw new EvernoteUtilException(EDAM_HASH_ALGORITHM + " not supported", new NoSuchAlgorithmException(EDAM_HASH_ALGORITHM)); } }
java
public static byte[] hash(byte[] body) { if (HASH_DIGEST != null) { return HASH_DIGEST.digest(body); } else { throw new EvernoteUtilException(EDAM_HASH_ALGORITHM + " not supported", new NoSuchAlgorithmException(EDAM_HASH_ALGORITHM)); } }
[ "public", "static", "byte", "[", "]", "hash", "(", "byte", "[", "]", "body", ")", "{", "if", "(", "HASH_DIGEST", "!=", "null", ")", "{", "return", "HASH_DIGEST", ".", "digest", "(", "body", ")", ";", "}", "else", "{", "throw", "new", "EvernoteUtilExc...
Returns an MD5 checksum of the provided array of bytes.
[ "Returns", "an", "MD5", "checksum", "of", "the", "provided", "array", "of", "bytes", "." ]
fc59be643e85c4f59d562d1bfe76563997aa73cf
https://github.com/evernote/evernote-sdk-android/blob/fc59be643e85c4f59d562d1bfe76563997aa73cf/library/src/main/java/com/evernote/client/android/EvernoteUtil.java#L131-L137
train
evernote/evernote-sdk-android
library/src/main/java/com/evernote/client/android/EvernoteUtil.java
EvernoteUtil.hash
public static byte[] hash(InputStream in) throws IOException { if (HASH_DIGEST == null) { throw new EvernoteUtilException(EDAM_HASH_ALGORITHM + " not supported", new NoSuchAlgorithmException(EDAM_HASH_ALGORITHM)); } byte[] buf = new byte[1024]; int n; while ((n = in....
java
public static byte[] hash(InputStream in) throws IOException { if (HASH_DIGEST == null) { throw new EvernoteUtilException(EDAM_HASH_ALGORITHM + " not supported", new NoSuchAlgorithmException(EDAM_HASH_ALGORITHM)); } byte[] buf = new byte[1024]; int n; while ((n = in....
[ "public", "static", "byte", "[", "]", "hash", "(", "InputStream", "in", ")", "throws", "IOException", "{", "if", "(", "HASH_DIGEST", "==", "null", ")", "{", "throw", "new", "EvernoteUtilException", "(", "EDAM_HASH_ALGORITHM", "+", "\" not supported\"", ",", "n...
Returns an MD5 checksum of the contents of the provided InputStream.
[ "Returns", "an", "MD5", "checksum", "of", "the", "contents", "of", "the", "provided", "InputStream", "." ]
fc59be643e85c4f59d562d1bfe76563997aa73cf
https://github.com/evernote/evernote-sdk-android/blob/fc59be643e85c4f59d562d1bfe76563997aa73cf/library/src/main/java/com/evernote/client/android/EvernoteUtil.java#L142-L153
train
evernote/evernote-sdk-android
library/src/main/java/com/evernote/client/android/EvernoteUtil.java
EvernoteUtil.bytesToHex
public static String bytesToHex(byte[] bytes, boolean withSpaces) { StringBuilder sb = new StringBuilder(); for (byte hashByte : bytes) { int intVal = 0xff & hashByte; if (intVal < 0x10) { sb.append('0'); } sb.append(Integer.toHexString(int...
java
public static String bytesToHex(byte[] bytes, boolean withSpaces) { StringBuilder sb = new StringBuilder(); for (byte hashByte : bytes) { int intVal = 0xff & hashByte; if (intVal < 0x10) { sb.append('0'); } sb.append(Integer.toHexString(int...
[ "public", "static", "String", "bytesToHex", "(", "byte", "[", "]", "bytes", ",", "boolean", "withSpaces", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "byte", "hashByte", ":", "bytes", ")", "{", "int", "intVal"...
Takes the provided byte array and converts it into a hexadecimal string with two characters per byte. @param withSpaces if true, include a space character between each hex-rendered byte for readability.
[ "Takes", "the", "provided", "byte", "array", "and", "converts", "it", "into", "a", "hexadecimal", "string", "with", "two", "characters", "per", "byte", "." ]
fc59be643e85c4f59d562d1bfe76563997aa73cf
https://github.com/evernote/evernote-sdk-android/blob/fc59be643e85c4f59d562d1bfe76563997aa73cf/library/src/main/java/com/evernote/client/android/EvernoteUtil.java#L170-L183
train
evernote/evernote-sdk-android
library/src/main/java/com/evernote/client/android/EvernoteUtil.java
EvernoteUtil.hexToBytes
public static byte[] hexToBytes(String hexString) { byte[] result = new byte[hexString.length() / 2]; for (int i = 0; i < result.length; ++i) { int offset = i * 2; result[i] = (byte) Integer.parseInt(hexString.substring(offset, offset + 2), 16); } ...
java
public static byte[] hexToBytes(String hexString) { byte[] result = new byte[hexString.length() / 2]; for (int i = 0; i < result.length; ++i) { int offset = i * 2; result[i] = (byte) Integer.parseInt(hexString.substring(offset, offset + 2), 16); } ...
[ "public", "static", "byte", "[", "]", "hexToBytes", "(", "String", "hexString", ")", "{", "byte", "[", "]", "result", "=", "new", "byte", "[", "hexString", ".", "length", "(", ")", "/", "2", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", ...
Takes a string in hexadecimal format and converts it to a binary byte array. This does no checking of the format of the input, so this should only be used after confirming the format or origin of the string. The input string should only contain the hex data, two characters per byte.
[ "Takes", "a", "string", "in", "hexadecimal", "format", "and", "converts", "it", "to", "a", "binary", "byte", "array", ".", "This", "does", "no", "checking", "of", "the", "format", "of", "the", "input", "so", "this", "should", "only", "be", "used", "after...
fc59be643e85c4f59d562d1bfe76563997aa73cf
https://github.com/evernote/evernote-sdk-android/blob/fc59be643e85c4f59d562d1bfe76563997aa73cf/library/src/main/java/com/evernote/client/android/EvernoteUtil.java#L191-L199
train
evernote/evernote-sdk-android
library/src/main/java/com/evernote/client/android/EvernoteUtil.java
EvernoteUtil.removeAllCookies
public static void removeAllCookies(Context context) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { removeAllCookiesV21(); } else { removeAllCookiesV14(context.getApplicationContext()); } }
java
public static void removeAllCookies(Context context) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { removeAllCookiesV21(); } else { removeAllCookiesV14(context.getApplicationContext()); } }
[ "public", "static", "void", "removeAllCookies", "(", "Context", "context", ")", "{", "if", "(", "Build", ".", "VERSION", ".", "SDK_INT", ">=", "Build", ".", "VERSION_CODES", ".", "LOLLIPOP", ")", "{", "removeAllCookiesV21", "(", ")", ";", "}", "else", "{",...
Removes all cookies for this application.
[ "Removes", "all", "cookies", "for", "this", "application", "." ]
fc59be643e85c4f59d562d1bfe76563997aa73cf
https://github.com/evernote/evernote-sdk-android/blob/fc59be643e85c4f59d562d1bfe76563997aa73cf/library/src/main/java/com/evernote/client/android/EvernoteUtil.java#L204-L210
train
evernote/evernote-sdk-android
library/src/main/java/com/evernote/client/android/EvernoteUtil.java
EvernoteUtil.getEvernoteInstallStatus
public static EvernoteInstallStatus getEvernoteInstallStatus(Context context, String action) { PackageManager packageManager = context.getPackageManager(); Intent intent = new Intent(action).setPackage(PACKAGE_NAME); List<ResolveInfo> resolveInfos = packageManager.queryIntentActivities(intent, ...
java
public static EvernoteInstallStatus getEvernoteInstallStatus(Context context, String action) { PackageManager packageManager = context.getPackageManager(); Intent intent = new Intent(action).setPackage(PACKAGE_NAME); List<ResolveInfo> resolveInfos = packageManager.queryIntentActivities(intent, ...
[ "public", "static", "EvernoteInstallStatus", "getEvernoteInstallStatus", "(", "Context", "context", ",", "String", "action", ")", "{", "PackageManager", "packageManager", "=", "context", ".", "getPackageManager", "(", ")", ";", "Intent", "intent", "=", "new", "Inten...
Checks if Evernote is installed and if the app can resolve this action.
[ "Checks", "if", "Evernote", "is", "installed", "and", "if", "the", "app", "can", "resolve", "this", "action", "." ]
fc59be643e85c4f59d562d1bfe76563997aa73cf
https://github.com/evernote/evernote-sdk-android/blob/fc59be643e85c4f59d562d1bfe76563997aa73cf/library/src/main/java/com/evernote/client/android/EvernoteUtil.java#L256-L273
train
evernote/evernote-sdk-android
library/src/main/java/com/evernote/client/android/EvernoteUtil.java
EvernoteUtil.createGetBootstrapProfileNameIntent
public static Intent createGetBootstrapProfileNameIntent(Context context, EvernoteSession evernoteSession) { if (evernoteSession.isForceAuthenticationInThirdPartyApp()) { // we don't want to use the main app, return null return null; } EvernoteUtil.EvernoteInstallStatus ...
java
public static Intent createGetBootstrapProfileNameIntent(Context context, EvernoteSession evernoteSession) { if (evernoteSession.isForceAuthenticationInThirdPartyApp()) { // we don't want to use the main app, return null return null; } EvernoteUtil.EvernoteInstallStatus ...
[ "public", "static", "Intent", "createGetBootstrapProfileNameIntent", "(", "Context", "context", ",", "EvernoteSession", "evernoteSession", ")", "{", "if", "(", "evernoteSession", ".", "isForceAuthenticationInThirdPartyApp", "(", ")", ")", "{", "// we don't want to use the m...
Returns an Intent to query the bootstrap profile name from the main Evernote app. This is useful if you want to use the main app to authenticate the user and he is already signed in. @param context The {@link Context} starting the {@link Intent}. @param evernoteSession The current session. @return An Intent to query t...
[ "Returns", "an", "Intent", "to", "query", "the", "bootstrap", "profile", "name", "from", "the", "main", "Evernote", "app", ".", "This", "is", "useful", "if", "you", "want", "to", "use", "the", "main", "app", "to", "authenticate", "the", "user", "and", "h...
fc59be643e85c4f59d562d1bfe76563997aa73cf
https://github.com/evernote/evernote-sdk-android/blob/fc59be643e85c4f59d562d1bfe76563997aa73cf/library/src/main/java/com/evernote/client/android/EvernoteUtil.java#L338-L350
train
evernote/evernote-sdk-android
library/src/main/java/com/evernote/client/android/EvernoteUtil.java
EvernoteUtil.generateUserAgentString
public static String generateUserAgentString(Context ctx) { String packageName = null; int packageVersion = 0; try { packageName = ctx.getPackageName(); packageVersion = ctx.getPackageManager().getPackageInfo(packageName, 0).versionCode; } catch (PackageManager.N...
java
public static String generateUserAgentString(Context ctx) { String packageName = null; int packageVersion = 0; try { packageName = ctx.getPackageName(); packageVersion = ctx.getPackageManager().getPackageInfo(packageName, 0).versionCode; } catch (PackageManager.N...
[ "public", "static", "String", "generateUserAgentString", "(", "Context", "ctx", ")", "{", "String", "packageName", "=", "null", ";", "int", "packageVersion", "=", "0", ";", "try", "{", "packageName", "=", "ctx", ".", "getPackageName", "(", ")", ";", "package...
Construct a user-agent string based on the running application and the device and operating system information. This information is included in HTTP requests made to the Evernote service and assists in measuring traffic and diagnosing problems.
[ "Construct", "a", "user", "-", "agent", "string", "based", "on", "the", "running", "application", "and", "the", "device", "and", "operating", "system", "information", ".", "This", "information", "is", "included", "in", "HTTP", "requests", "made", "to", "the", ...
fc59be643e85c4f59d562d1bfe76563997aa73cf
https://github.com/evernote/evernote-sdk-android/blob/fc59be643e85c4f59d562d1bfe76563997aa73cf/library/src/main/java/com/evernote/client/android/EvernoteUtil.java#L358-L380
train
evernote/evernote-sdk-android
library/src/main/java/com/evernote/client/android/asyncclient/EvernoteClientFactory.java
EvernoteClientFactory.getHtmlHelperDefault
public synchronized EvernoteHtmlHelper getHtmlHelperDefault() { checkLoggedIn(); if (mHtmlHelperDefault == null) { mHtmlHelperDefault = createHtmlHelper(mEvernoteSession.getAuthToken()); } return mHtmlHelperDefault; }
java
public synchronized EvernoteHtmlHelper getHtmlHelperDefault() { checkLoggedIn(); if (mHtmlHelperDefault == null) { mHtmlHelperDefault = createHtmlHelper(mEvernoteSession.getAuthToken()); } return mHtmlHelperDefault; }
[ "public", "synchronized", "EvernoteHtmlHelper", "getHtmlHelperDefault", "(", ")", "{", "checkLoggedIn", "(", ")", ";", "if", "(", "mHtmlHelperDefault", "==", "null", ")", "{", "mHtmlHelperDefault", "=", "createHtmlHelper", "(", "mEvernoteSession", ".", "getAuthToken",...
Use this method, if you want to download a personal note as HTML. @return An async wrapper to load a note as HTML from the Evernote service.
[ "Use", "this", "method", "if", "you", "want", "to", "download", "a", "personal", "note", "as", "HTML", "." ]
fc59be643e85c4f59d562d1bfe76563997aa73cf
https://github.com/evernote/evernote-sdk-android/blob/fc59be643e85c4f59d562d1bfe76563997aa73cf/library/src/main/java/com/evernote/client/android/asyncclient/EvernoteClientFactory.java#L246-L253
train
evernote/evernote-sdk-android
library/src/main/java/com/evernote/client/android/asyncclient/EvernoteClientFactory.java
EvernoteClientFactory.getHtmlHelperBusiness
public synchronized EvernoteHtmlHelper getHtmlHelperBusiness() throws TException, EDAMUserException, EDAMSystemException { if (mHtmlHelperBusiness == null) { authenticateToBusiness(); mHtmlHelperBusiness = createHtmlHelper(mBusinessAuthenticationResult.getAuthenticationToken()); ...
java
public synchronized EvernoteHtmlHelper getHtmlHelperBusiness() throws TException, EDAMUserException, EDAMSystemException { if (mHtmlHelperBusiness == null) { authenticateToBusiness(); mHtmlHelperBusiness = createHtmlHelper(mBusinessAuthenticationResult.getAuthenticationToken()); ...
[ "public", "synchronized", "EvernoteHtmlHelper", "getHtmlHelperBusiness", "(", ")", "throws", "TException", ",", "EDAMUserException", ",", "EDAMSystemException", "{", "if", "(", "mHtmlHelperBusiness", "==", "null", ")", "{", "authenticateToBusiness", "(", ")", ";", "mH...
Use this method, if you want to download a business note as HTML. @return An async wrapper to load a business note as HTML from the Evernote service.
[ "Use", "this", "method", "if", "you", "want", "to", "download", "a", "business", "note", "as", "HTML", "." ]
fc59be643e85c4f59d562d1bfe76563997aa73cf
https://github.com/evernote/evernote-sdk-android/blob/fc59be643e85c4f59d562d1bfe76563997aa73cf/library/src/main/java/com/evernote/client/android/asyncclient/EvernoteClientFactory.java#L297-L303
train
evernote/evernote-sdk-android
library/src/main/java/com/evernote/client/android/type/NoteRef.java
NoteRef.loadNote
public Note loadNote(boolean withContent, boolean withResourcesData, boolean withResourcesRecognition, boolean withResourcesAlternateData) throws TException, EDAMUserException, EDAMSystemException, EDAMNotFoundException { EvernoteNoteStoreClient noteStore = NoteRefHelper.getNoteStore(t...
java
public Note loadNote(boolean withContent, boolean withResourcesData, boolean withResourcesRecognition, boolean withResourcesAlternateData) throws TException, EDAMUserException, EDAMSystemException, EDAMNotFoundException { EvernoteNoteStoreClient noteStore = NoteRefHelper.getNoteStore(t...
[ "public", "Note", "loadNote", "(", "boolean", "withContent", ",", "boolean", "withResourcesData", ",", "boolean", "withResourcesRecognition", ",", "boolean", "withResourcesAlternateData", ")", "throws", "TException", ",", "EDAMUserException", ",", "EDAMSystemException", "...
Loads the concrete note from the server. @param withContent If {@code true} the returned note contains its content. @param withResourcesData If {@code true} the returned note contains its resources. @param withResourcesRecognition If {@code true} the returned note contains in its resources the recognition data. @param...
[ "Loads", "the", "concrete", "note", "from", "the", "server", "." ]
fc59be643e85c4f59d562d1bfe76563997aa73cf
https://github.com/evernote/evernote-sdk-android/blob/fc59be643e85c4f59d562d1bfe76563997aa73cf/library/src/main/java/com/evernote/client/android/type/NoteRef.java#L95-L104
train
evernote/evernote-sdk-android
library/src/main/java/com/evernote/client/android/EvernoteSession.java
EvernoteSession.getEvernoteClientFactory
public synchronized EvernoteClientFactory getEvernoteClientFactory() { if (mFactoryThreadLocal == null) { mFactoryThreadLocal = new ThreadLocal<>(); } if (mEvernoteClientFactoryBuilder == null) { mEvernoteClientFactoryBuilder = new EvernoteClientFactory.Builder(this); ...
java
public synchronized EvernoteClientFactory getEvernoteClientFactory() { if (mFactoryThreadLocal == null) { mFactoryThreadLocal = new ThreadLocal<>(); } if (mEvernoteClientFactoryBuilder == null) { mEvernoteClientFactoryBuilder = new EvernoteClientFactory.Builder(this); ...
[ "public", "synchronized", "EvernoteClientFactory", "getEvernoteClientFactory", "(", ")", "{", "if", "(", "mFactoryThreadLocal", "==", "null", ")", "{", "mFactoryThreadLocal", "=", "new", "ThreadLocal", "<>", "(", ")", ";", "}", "if", "(", "mEvernoteClientFactoryBuil...
Returns a factory to create various clients and helper objects to get access to the Evernote API. <br> <br> The returned factory is <b>not thread safe</b> itself, however, the cached factory is a thread local object. That means a new factory is created for each thread calling this method. The recommended approach is ...
[ "Returns", "a", "factory", "to", "create", "various", "clients", "and", "helper", "objects", "to", "get", "access", "to", "the", "Evernote", "API", "." ]
fc59be643e85c4f59d562d1bfe76563997aa73cf
https://github.com/evernote/evernote-sdk-android/blob/fc59be643e85c4f59d562d1bfe76563997aa73cf/library/src/main/java/com/evernote/client/android/EvernoteSession.java#L139-L153
train
evernote/evernote-sdk-android
library/src/main/java/com/evernote/client/android/EvernoteSession.java
EvernoteSession.authenticate
public void authenticate(FragmentActivity activity) { authenticate(activity, EvernoteLoginFragment.create(mConsumerKey, mConsumerSecret, mSupportAppLinkedNotebooks, mLocale)); }
java
public void authenticate(FragmentActivity activity) { authenticate(activity, EvernoteLoginFragment.create(mConsumerKey, mConsumerSecret, mSupportAppLinkedNotebooks, mLocale)); }
[ "public", "void", "authenticate", "(", "FragmentActivity", "activity", ")", "{", "authenticate", "(", "activity", ",", "EvernoteLoginFragment", ".", "create", "(", "mConsumerKey", ",", "mConsumerSecret", ",", "mSupportAppLinkedNotebooks", ",", "mLocale", ")", ")", "...
Recommended approach to authenticate the user. If the main Evernote app is installed and up to date, the app is launched and authenticates the user. Otherwise the old OAuth process is launched and the user needs to enter his credentials. <p/> Your {@link FragmentActivity} should implement {@link EvernoteLoginFragment...
[ "Recommended", "approach", "to", "authenticate", "the", "user", ".", "If", "the", "main", "Evernote", "app", "is", "installed", "and", "up", "to", "date", "the", "app", "is", "launched", "and", "authenticates", "the", "user", ".", "Otherwise", "the", "old", ...
fc59be643e85c4f59d562d1bfe76563997aa73cf
https://github.com/evernote/evernote-sdk-android/blob/fc59be643e85c4f59d562d1bfe76563997aa73cf/library/src/main/java/com/evernote/client/android/EvernoteSession.java#L206-L208
train
evernote/evernote-sdk-android
library/src/main/java/com/evernote/client/android/EvernoteSession.java
EvernoteSession.logOut
public synchronized boolean logOut() { if (!isLoggedIn()) { return false; } mAuthenticationResult.clear(); mAuthenticationResult = null; EvernoteUtil.removeAllCookies(getApplicationContext()); return true; }
java
public synchronized boolean logOut() { if (!isLoggedIn()) { return false; } mAuthenticationResult.clear(); mAuthenticationResult = null; EvernoteUtil.removeAllCookies(getApplicationContext()); return true; }
[ "public", "synchronized", "boolean", "logOut", "(", ")", "{", "if", "(", "!", "isLoggedIn", "(", ")", ")", "{", "return", "false", ";", "}", "mAuthenticationResult", ".", "clear", "(", ")", ";", "mAuthenticationResult", "=", "null", ";", "EvernoteUtil", "....
Clears all stored session information. If the user is not logged in, then this is a no-op. @return {@code true} if the user successfully logged out, {@code false} if the user wasn't logged in. @see #isLoggedIn()
[ "Clears", "all", "stored", "session", "information", ".", "If", "the", "user", "is", "not", "logged", "in", "then", "this", "is", "a", "no", "-", "op", "." ]
fc59be643e85c4f59d562d1bfe76563997aa73cf
https://github.com/evernote/evernote-sdk-android/blob/fc59be643e85c4f59d562d1bfe76563997aa73cf/library/src/main/java/com/evernote/client/android/EvernoteSession.java#L263-L273
train
camunda/camunda-xml-model
src/main/java/org/camunda/bpm/model/xml/impl/type/attribute/AttributeImpl.java
AttributeImpl.getValue
public T getValue(ModelElementInstance modelElement) { String value; if(namespaceUri == null) { value = modelElement.getAttributeValue(attributeName); } else { value = modelElement.getAttributeValueNs(namespaceUri, attributeName); if(value == null) { String alternativeNamespace = o...
java
public T getValue(ModelElementInstance modelElement) { String value; if(namespaceUri == null) { value = modelElement.getAttributeValue(attributeName); } else { value = modelElement.getAttributeValueNs(namespaceUri, attributeName); if(value == null) { String alternativeNamespace = o...
[ "public", "T", "getValue", "(", "ModelElementInstance", "modelElement", ")", "{", "String", "value", ";", "if", "(", "namespaceUri", "==", "null", ")", "{", "value", "=", "modelElement", ".", "getAttributeValue", "(", "attributeName", ")", ";", "}", "else", ...
returns the value of the attribute. @return the value of the attribute.
[ "returns", "the", "value", "of", "the", "attribute", "." ]
85b3f879e26d063f71c94cfd21ac17d9ff6baf4d
https://github.com/camunda/camunda-xml-model/blob/85b3f879e26d063f71c94cfd21ac17d9ff6baf4d/src/main/java/org/camunda/bpm/model/xml/impl/type/attribute/AttributeImpl.java#L87-L107
train
camunda/camunda-xml-model
src/main/java/org/camunda/bpm/model/xml/impl/type/child/ChildElementCollectionImpl.java
ChildElementCollectionImpl.getView
private Collection<DomElement> getView(ModelElementInstanceImpl modelElement) { return modelElement.getDomElement().getChildElementsByType(modelElement.getModelInstance(), childElementTypeClass); }
java
private Collection<DomElement> getView(ModelElementInstanceImpl modelElement) { return modelElement.getDomElement().getChildElementsByType(modelElement.getModelInstance(), childElementTypeClass); }
[ "private", "Collection", "<", "DomElement", ">", "getView", "(", "ModelElementInstanceImpl", "modelElement", ")", "{", "return", "modelElement", ".", "getDomElement", "(", ")", ".", "getChildElementsByType", "(", "modelElement", ".", "getModelInstance", "(", ")", ",...
Internal method providing access to the view represented by this collection. @return the view represented by this collection
[ "Internal", "method", "providing", "access", "to", "the", "view", "represented", "by", "this", "collection", "." ]
85b3f879e26d063f71c94cfd21ac17d9ff6baf4d
https://github.com/camunda/camunda-xml-model/blob/85b3f879e26d063f71c94cfd21ac17d9ff6baf4d/src/main/java/org/camunda/bpm/model/xml/impl/type/child/ChildElementCollectionImpl.java#L81-L83
train
camunda/camunda-xml-model
src/main/java/org/camunda/bpm/model/xml/impl/type/child/ChildElementCollectionImpl.java
ChildElementCollectionImpl.performClearOperation
private void performClearOperation(ModelElementInstanceImpl modelElement, Collection<DomElement> elementsToRemove) { Collection<ModelElementInstance> modelElements = ModelUtil.getModelElementCollection(elementsToRemove, modelElement.getModelInstance()); for (ModelElementInstance element : modelElements) { ...
java
private void performClearOperation(ModelElementInstanceImpl modelElement, Collection<DomElement> elementsToRemove) { Collection<ModelElementInstance> modelElements = ModelUtil.getModelElementCollection(elementsToRemove, modelElement.getModelInstance()); for (ModelElementInstance element : modelElements) { ...
[ "private", "void", "performClearOperation", "(", "ModelElementInstanceImpl", "modelElement", ",", "Collection", "<", "DomElement", ">", "elementsToRemove", ")", "{", "Collection", "<", "ModelElementInstance", ">", "modelElements", "=", "ModelUtil", ".", "getModelElementCo...
the "clear" operation used by this collection
[ "the", "clear", "operation", "used", "by", "this", "collection" ]
85b3f879e26d063f71c94cfd21ac17d9ff6baf4d
https://github.com/camunda/camunda-xml-model/blob/85b3f879e26d063f71c94cfd21ac17d9ff6baf4d/src/main/java/org/camunda/bpm/model/xml/impl/type/child/ChildElementCollectionImpl.java#L124-L129
train
camunda/camunda-xml-model
src/main/java/org/camunda/bpm/model/xml/impl/type/reference/ReferenceImpl.java
ReferenceImpl.getReferenceTargetElement
@SuppressWarnings("unchecked") public T getReferenceTargetElement(ModelElementInstance referenceSourceElement) { String identifier = getReferenceIdentifier(referenceSourceElement); ModelElementInstance referenceTargetElement = referenceSourceElement.getModelInstance().getModelElementById(identifier); if (...
java
@SuppressWarnings("unchecked") public T getReferenceTargetElement(ModelElementInstance referenceSourceElement) { String identifier = getReferenceIdentifier(referenceSourceElement); ModelElementInstance referenceTargetElement = referenceSourceElement.getModelInstance().getModelElementById(identifier); if (...
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "T", "getReferenceTargetElement", "(", "ModelElementInstance", "referenceSourceElement", ")", "{", "String", "identifier", "=", "getReferenceIdentifier", "(", "referenceSourceElement", ")", ";", "ModelElementInst...
Get the reference target model element instance @param referenceSourceElement the reference source model element instance @return the reference target model element instance or null if not set
[ "Get", "the", "reference", "target", "model", "element", "instance" ]
85b3f879e26d063f71c94cfd21ac17d9ff6baf4d
https://github.com/camunda/camunda-xml-model/blob/85b3f879e26d063f71c94cfd21ac17d9ff6baf4d/src/main/java/org/camunda/bpm/model/xml/impl/type/reference/ReferenceImpl.java#L57-L73
train
camunda/camunda-xml-model
src/main/java/org/camunda/bpm/model/xml/impl/type/reference/ReferenceImpl.java
ReferenceImpl.setReferenceTargetElement
public void setReferenceTargetElement(ModelElementInstance referenceSourceElement, T referenceTargetElement) { ModelInstance modelInstance = referenceSourceElement.getModelInstance(); String referenceTargetIdentifier = referenceTargetAttribute.getValue(referenceTargetElement); ModelElementInstance existingE...
java
public void setReferenceTargetElement(ModelElementInstance referenceSourceElement, T referenceTargetElement) { ModelInstance modelInstance = referenceSourceElement.getModelInstance(); String referenceTargetIdentifier = referenceTargetAttribute.getValue(referenceTargetElement); ModelElementInstance existingE...
[ "public", "void", "setReferenceTargetElement", "(", "ModelElementInstance", "referenceSourceElement", ",", "T", "referenceTargetElement", ")", "{", "ModelInstance", "modelInstance", "=", "referenceSourceElement", ".", "getModelInstance", "(", ")", ";", "String", "referenceT...
Set the reference target model element instance @param referenceSourceElement the reference source model element instance @param referenceTargetElement the reference target model element instance @throws ModelReferenceException if element is not already added to the model
[ "Set", "the", "reference", "target", "model", "element", "instance" ]
85b3f879e26d063f71c94cfd21ac17d9ff6baf4d
https://github.com/camunda/camunda-xml-model/blob/85b3f879e26d063f71c94cfd21ac17d9ff6baf4d/src/main/java/org/camunda/bpm/model/xml/impl/type/reference/ReferenceImpl.java#L82-L93
train
camunda/camunda-xml-model
src/main/java/org/camunda/bpm/model/xml/impl/type/reference/ReferenceImpl.java
ReferenceImpl.referencedElementUpdated
public void referencedElementUpdated(ModelElementInstance referenceTargetElement, String oldIdentifier, String newIdentifier) { for (ModelElementInstance referenceSourceElement : findReferenceSourceElements(referenceTargetElement)) { updateReference(referenceSourceElement, oldIdentifier, newIdentifier); }...
java
public void referencedElementUpdated(ModelElementInstance referenceTargetElement, String oldIdentifier, String newIdentifier) { for (ModelElementInstance referenceSourceElement : findReferenceSourceElements(referenceTargetElement)) { updateReference(referenceSourceElement, oldIdentifier, newIdentifier); }...
[ "public", "void", "referencedElementUpdated", "(", "ModelElementInstance", "referenceTargetElement", ",", "String", "oldIdentifier", ",", "String", "newIdentifier", ")", "{", "for", "(", "ModelElementInstance", "referenceSourceElement", ":", "findReferenceSourceElements", "("...
Update the reference identifier @param referenceTargetElement the reference target model element instance @param oldIdentifier the old reference identifier @param newIdentifier the new reference identifier
[ "Update", "the", "reference", "identifier" ]
85b3f879e26d063f71c94cfd21ac17d9ff6baf4d
https://github.com/camunda/camunda-xml-model/blob/85b3f879e26d063f71c94cfd21ac17d9ff6baf4d/src/main/java/org/camunda/bpm/model/xml/impl/type/reference/ReferenceImpl.java#L148-L152
train
camunda/camunda-xml-model
src/main/java/org/camunda/bpm/model/xml/impl/type/reference/ReferenceImpl.java
ReferenceImpl.referencedElementRemoved
public void referencedElementRemoved(ModelElementInstance referenceTargetElement, Object referenceIdentifier) { for (ModelElementInstance referenceSourceElement : findReferenceSourceElements(referenceTargetElement)) { if (referenceIdentifier.equals(getReferenceIdentifier(referenceSourceElement))) { re...
java
public void referencedElementRemoved(ModelElementInstance referenceTargetElement, Object referenceIdentifier) { for (ModelElementInstance referenceSourceElement : findReferenceSourceElements(referenceTargetElement)) { if (referenceIdentifier.equals(getReferenceIdentifier(referenceSourceElement))) { re...
[ "public", "void", "referencedElementRemoved", "(", "ModelElementInstance", "referenceTargetElement", ",", "Object", "referenceIdentifier", ")", "{", "for", "(", "ModelElementInstance", "referenceSourceElement", ":", "findReferenceSourceElements", "(", "referenceTargetElement", ...
Remove the reference if the target element is removed @param referenceTargetElement the reference target model element instance, which is removed @param referenceIdentifier the identifier of the reference to filter reference source elements
[ "Remove", "the", "reference", "if", "the", "target", "element", "is", "removed" ]
85b3f879e26d063f71c94cfd21ac17d9ff6baf4d
https://github.com/camunda/camunda-xml-model/blob/85b3f879e26d063f71c94cfd21ac17d9ff6baf4d/src/main/java/org/camunda/bpm/model/xml/impl/type/reference/ReferenceImpl.java#L167-L173
train
camunda/camunda-xml-model
src/main/java/org/camunda/bpm/model/xml/impl/util/StringUtil.java
StringUtil.splitCommaSeparatedList
public static List<String> splitCommaSeparatedList(String text) { if (text == null || text.isEmpty()) { return Collections.emptyList(); } Matcher matcher = pattern.matcher(text); List<String> parts = new ArrayList<String>(); while(matcher.find()) { parts.add(matcher.group().trim()); ...
java
public static List<String> splitCommaSeparatedList(String text) { if (text == null || text.isEmpty()) { return Collections.emptyList(); } Matcher matcher = pattern.matcher(text); List<String> parts = new ArrayList<String>(); while(matcher.find()) { parts.add(matcher.group().trim()); ...
[ "public", "static", "List", "<", "String", ">", "splitCommaSeparatedList", "(", "String", "text", ")", "{", "if", "(", "text", "==", "null", "||", "text", ".", "isEmpty", "(", ")", ")", "{", "return", "Collections", ".", "emptyList", "(", ")", ";", "}"...
Splits a comma separated list in to single Strings. The list can contain expressions with commas in it. @param text the comma separated list @return the Strings of the list or an empty List if text is empty or null
[ "Splits", "a", "comma", "separated", "list", "in", "to", "single", "Strings", ".", "The", "list", "can", "contain", "expressions", "with", "commas", "in", "it", "." ]
85b3f879e26d063f71c94cfd21ac17d9ff6baf4d
https://github.com/camunda/camunda-xml-model/blob/85b3f879e26d063f71c94cfd21ac17d9ff6baf4d/src/main/java/org/camunda/bpm/model/xml/impl/util/StringUtil.java#L40-L50
train
camunda/camunda-xml-model
src/main/java/org/camunda/bpm/model/xml/impl/instance/ModelElementInstanceImpl.java
ModelElementInstanceImpl.findElementToInsertAfter
private ModelElementInstance findElementToInsertAfter(ModelElementInstance elementToInsert) { List<ModelElementType> childElementTypes = elementType.getAllChildElementTypes(); List<DomElement> childDomElements = domElement.getChildElements(); Collection<ModelElementInstance> childElements = ModelUtil.getMod...
java
private ModelElementInstance findElementToInsertAfter(ModelElementInstance elementToInsert) { List<ModelElementType> childElementTypes = elementType.getAllChildElementTypes(); List<DomElement> childDomElements = domElement.getChildElements(); Collection<ModelElementInstance> childElements = ModelUtil.getMod...
[ "private", "ModelElementInstance", "findElementToInsertAfter", "(", "ModelElementInstance", "elementToInsert", ")", "{", "List", "<", "ModelElementType", ">", "childElementTypes", "=", "elementType", ".", "getAllChildElementTypes", "(", ")", ";", "List", "<", "DomElement"...
Returns the element after which the new element should be inserted in the DOM document. @param elementToInsert the new element to insert @return the element to insert after or null
[ "Returns", "the", "element", "after", "which", "the", "new", "element", "should", "be", "inserted", "in", "the", "DOM", "document", "." ]
85b3f879e26d063f71c94cfd21ac17d9ff6baf4d
https://github.com/camunda/camunda-xml-model/blob/85b3f879e26d063f71c94cfd21ac17d9ff6baf4d/src/main/java/org/camunda/bpm/model/xml/impl/instance/ModelElementInstanceImpl.java#L306-L323
train
camunda/camunda-xml-model
src/main/java/org/camunda/bpm/model/xml/impl/instance/ModelElementInstanceImpl.java
ModelElementInstanceImpl.unlinkAllReferences
private void unlinkAllReferences() { Collection<Attribute<?>> attributes = elementType.getAllAttributes(); for (Attribute<?> attribute : attributes) { Object identifier = attribute.getValue(this); if (identifier != null) { ((AttributeImpl<?>) attribute).unlinkReference(this, identifier); ...
java
private void unlinkAllReferences() { Collection<Attribute<?>> attributes = elementType.getAllAttributes(); for (Attribute<?> attribute : attributes) { Object identifier = attribute.getValue(this); if (identifier != null) { ((AttributeImpl<?>) attribute).unlinkReference(this, identifier); ...
[ "private", "void", "unlinkAllReferences", "(", ")", "{", "Collection", "<", "Attribute", "<", "?", ">", ">", "attributes", "=", "elementType", ".", "getAllAttributes", "(", ")", ";", "for", "(", "Attribute", "<", "?", ">", "attribute", ":", "attributes", "...
Removes all reference to this.
[ "Removes", "all", "reference", "to", "this", "." ]
85b3f879e26d063f71c94cfd21ac17d9ff6baf4d
https://github.com/camunda/camunda-xml-model/blob/85b3f879e26d063f71c94cfd21ac17d9ff6baf4d/src/main/java/org/camunda/bpm/model/xml/impl/instance/ModelElementInstanceImpl.java#L341-L349
train
camunda/camunda-xml-model
src/main/java/org/camunda/bpm/model/xml/impl/instance/ModelElementInstanceImpl.java
ModelElementInstanceImpl.unlinkAllChildReferences
private void unlinkAllChildReferences() { List<ModelElementType> childElementTypes = elementType.getAllChildElementTypes(); for (ModelElementType type : childElementTypes) { Collection<ModelElementInstance> childElementsForType = getChildElementsByType(type); for (ModelElementInstance childElement :...
java
private void unlinkAllChildReferences() { List<ModelElementType> childElementTypes = elementType.getAllChildElementTypes(); for (ModelElementType type : childElementTypes) { Collection<ModelElementInstance> childElementsForType = getChildElementsByType(type); for (ModelElementInstance childElement :...
[ "private", "void", "unlinkAllChildReferences", "(", ")", "{", "List", "<", "ModelElementType", ">", "childElementTypes", "=", "elementType", ".", "getAllChildElementTypes", "(", ")", ";", "for", "(", "ModelElementType", "type", ":", "childElementTypes", ")", "{", ...
Removes every reference to children of this.
[ "Removes", "every", "reference", "to", "children", "of", "this", "." ]
85b3f879e26d063f71c94cfd21ac17d9ff6baf4d
https://github.com/camunda/camunda-xml-model/blob/85b3f879e26d063f71c94cfd21ac17d9ff6baf4d/src/main/java/org/camunda/bpm/model/xml/impl/instance/ModelElementInstanceImpl.java#L354-L362
train
camunda/camunda-xml-model
src/main/java/org/camunda/bpm/model/xml/impl/util/DomUtil.java
DomUtil.getEmptyDocument
public static DomDocument getEmptyDocument(DocumentBuilderFactory documentBuilderFactory) { try { DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); return new DomDocumentImpl(documentBuilder.newDocument()); } catch (ParserConfigurationException e) { throw new Model...
java
public static DomDocument getEmptyDocument(DocumentBuilderFactory documentBuilderFactory) { try { DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); return new DomDocumentImpl(documentBuilder.newDocument()); } catch (ParserConfigurationException e) { throw new Model...
[ "public", "static", "DomDocument", "getEmptyDocument", "(", "DocumentBuilderFactory", "documentBuilderFactory", ")", "{", "try", "{", "DocumentBuilder", "documentBuilder", "=", "documentBuilderFactory", ".", "newDocumentBuilder", "(", ")", ";", "return", "new", "DomDocume...
Get an empty DOM document @param documentBuilderFactory the factory to build to DOM document @return the new empty document @throws ModelParseException if unable to create a new document
[ "Get", "an", "empty", "DOM", "document" ]
85b3f879e26d063f71c94cfd21ac17d9ff6baf4d
https://github.com/camunda/camunda-xml-model/blob/85b3f879e26d063f71c94cfd21ac17d9ff6baf4d/src/main/java/org/camunda/bpm/model/xml/impl/util/DomUtil.java#L218-L225
train
camunda/camunda-xml-model
src/main/java/org/camunda/bpm/model/xml/impl/util/DomUtil.java
DomUtil.parseInputStream
public static DomDocument parseInputStream(DocumentBuilderFactory documentBuilderFactory, InputStream inputStream) { try { DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); documentBuilder.setErrorHandler(new DomErrorHandler()); return new DomDocumentImpl(documentBuil...
java
public static DomDocument parseInputStream(DocumentBuilderFactory documentBuilderFactory, InputStream inputStream) { try { DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); documentBuilder.setErrorHandler(new DomErrorHandler()); return new DomDocumentImpl(documentBuil...
[ "public", "static", "DomDocument", "parseInputStream", "(", "DocumentBuilderFactory", "documentBuilderFactory", ",", "InputStream", "inputStream", ")", "{", "try", "{", "DocumentBuilder", "documentBuilder", "=", "documentBuilderFactory", ".", "newDocumentBuilder", "(", ")",...
Create a new DOM document from the input stream @param documentBuilderFactory the factory to build to DOM document @param inputStream the input stream to parse @return the new DOM document @throws ModelParseException if a parsing or IO error is triggered
[ "Create", "a", "new", "DOM", "document", "from", "the", "input", "stream" ]
85b3f879e26d063f71c94cfd21ac17d9ff6baf4d
https://github.com/camunda/camunda-xml-model/blob/85b3f879e26d063f71c94cfd21ac17d9ff6baf4d/src/main/java/org/camunda/bpm/model/xml/impl/util/DomUtil.java#L235-L251
train
camunda/camunda-xml-model
src/main/java/org/camunda/bpm/model/xml/impl/util/ModelUtil.java
ModelUtil.getModelElementCollection
@SuppressWarnings("unchecked") public static <T extends ModelElementInstance> Collection<T> getModelElementCollection(Collection<DomElement> view, ModelInstanceImpl model) { List<ModelElementInstance> resultList = new ArrayList<ModelElementInstance>(); for (DomElement element : view) { resultList.add(ge...
java
@SuppressWarnings("unchecked") public static <T extends ModelElementInstance> Collection<T> getModelElementCollection(Collection<DomElement> view, ModelInstanceImpl model) { List<ModelElementInstance> resultList = new ArrayList<ModelElementInstance>(); for (DomElement element : view) { resultList.add(ge...
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "T", "extends", "ModelElementInstance", ">", "Collection", "<", "T", ">", "getModelElementCollection", "(", "Collection", "<", "DomElement", ">", "view", ",", "ModelInstanceImpl", "model", ...
Get a collection of all model element instances in a view @param view the collection of DOM elements to find the model element instances for @param model the model of the elements @return the collection of model element instances of the view
[ "Get", "a", "collection", "of", "all", "model", "element", "instances", "in", "a", "view" ]
85b3f879e26d063f71c94cfd21ac17d9ff6baf4d
https://github.com/camunda/camunda-xml-model/blob/85b3f879e26d063f71c94cfd21ac17d9ff6baf4d/src/main/java/org/camunda/bpm/model/xml/impl/util/ModelUtil.java#L175-L182
train
camunda/camunda-xml-model
src/main/java/org/camunda/bpm/model/xml/impl/util/ModelUtil.java
ModelUtil.getIndexOfElementType
public static int getIndexOfElementType(ModelElementInstance modelElement, List<ModelElementType> childElementTypes) { for (int index = 0; index < childElementTypes.size(); index++) { ModelElementType childElementType = childElementTypes.get(index); Class<? extends ModelElementInstance> instanceType = c...
java
public static int getIndexOfElementType(ModelElementInstance modelElement, List<ModelElementType> childElementTypes) { for (int index = 0; index < childElementTypes.size(); index++) { ModelElementType childElementType = childElementTypes.get(index); Class<? extends ModelElementInstance> instanceType = c...
[ "public", "static", "int", "getIndexOfElementType", "(", "ModelElementInstance", "modelElement", ",", "List", "<", "ModelElementType", ">", "childElementTypes", ")", "{", "for", "(", "int", "index", "=", "0", ";", "index", "<", "childElementTypes", ".", "size", ...
Find the index of the type of a model element in a list of element types @param modelElement the model element which type is searched for @param childElementTypes the list to search the type @return the index of the model element type in the list or -1 if it is not found
[ "Find", "the", "index", "of", "the", "type", "of", "a", "model", "element", "in", "a", "list", "of", "element", "types" ]
85b3f879e26d063f71c94cfd21ac17d9ff6baf4d
https://github.com/camunda/camunda-xml-model/blob/85b3f879e26d063f71c94cfd21ac17d9ff6baf4d/src/main/java/org/camunda/bpm/model/xml/impl/util/ModelUtil.java#L191-L204
train
camunda/camunda-xml-model
src/main/java/org/camunda/bpm/model/xml/impl/util/ModelUtil.java
ModelUtil.calculateAllExtendingTypes
public static Collection<ModelElementType> calculateAllExtendingTypes(Model model, Collection<ModelElementType> baseTypes) { Set<ModelElementType> allExtendingTypes = new HashSet<ModelElementType>(); for (ModelElementType baseType : baseTypes) { ModelElementTypeImpl modelElementTypeImpl = (ModelElementTyp...
java
public static Collection<ModelElementType> calculateAllExtendingTypes(Model model, Collection<ModelElementType> baseTypes) { Set<ModelElementType> allExtendingTypes = new HashSet<ModelElementType>(); for (ModelElementType baseType : baseTypes) { ModelElementTypeImpl modelElementTypeImpl = (ModelElementTyp...
[ "public", "static", "Collection", "<", "ModelElementType", ">", "calculateAllExtendingTypes", "(", "Model", "model", ",", "Collection", "<", "ModelElementType", ">", "baseTypes", ")", "{", "Set", "<", "ModelElementType", ">", "allExtendingTypes", "=", "new", "HashSe...
Calculate a collection of all extending types for the given base types @param baseTypes the collection of types to calculate the union of all extending types
[ "Calculate", "a", "collection", "of", "all", "extending", "types", "for", "the", "given", "base", "types" ]
85b3f879e26d063f71c94cfd21ac17d9ff6baf4d
https://github.com/camunda/camunda-xml-model/blob/85b3f879e26d063f71c94cfd21ac17d9ff6baf4d/src/main/java/org/camunda/bpm/model/xml/impl/util/ModelUtil.java#L211-L218
train
camunda/camunda-xml-model
src/main/java/org/camunda/bpm/model/xml/impl/util/ModelUtil.java
ModelUtil.calculateAllBaseTypes
public static Collection<ModelElementType> calculateAllBaseTypes(ModelElementType type) { List<ModelElementType> baseTypes = new ArrayList<ModelElementType>(); ModelElementTypeImpl typeImpl = (ModelElementTypeImpl) type; typeImpl.resolveBaseTypes(baseTypes); return baseTypes; }
java
public static Collection<ModelElementType> calculateAllBaseTypes(ModelElementType type) { List<ModelElementType> baseTypes = new ArrayList<ModelElementType>(); ModelElementTypeImpl typeImpl = (ModelElementTypeImpl) type; typeImpl.resolveBaseTypes(baseTypes); return baseTypes; }
[ "public", "static", "Collection", "<", "ModelElementType", ">", "calculateAllBaseTypes", "(", "ModelElementType", "type", ")", "{", "List", "<", "ModelElementType", ">", "baseTypes", "=", "new", "ArrayList", "<", "ModelElementType", ">", "(", ")", ";", "ModelEleme...
Calculate a collection of all base types for the given type
[ "Calculate", "a", "collection", "of", "all", "base", "types", "for", "the", "given", "type" ]
85b3f879e26d063f71c94cfd21ac17d9ff6baf4d
https://github.com/camunda/camunda-xml-model/blob/85b3f879e26d063f71c94cfd21ac17d9ff6baf4d/src/main/java/org/camunda/bpm/model/xml/impl/util/ModelUtil.java#L223-L228
train
camunda/camunda-xml-model
src/main/java/org/camunda/bpm/model/xml/impl/util/ModelUtil.java
ModelUtil.setNewIdentifier
public static void setNewIdentifier(ModelElementType type, ModelElementInstance modelElementInstance, String newId, boolean withReferenceUpdate) { Attribute<?> id = type.getAttribute(ID_ATTRIBUTE_NAME); if (id != null && id instanceof StringAttribute && id.isIdAttribute()) { ...
java
public static void setNewIdentifier(ModelElementType type, ModelElementInstance modelElementInstance, String newId, boolean withReferenceUpdate) { Attribute<?> id = type.getAttribute(ID_ATTRIBUTE_NAME); if (id != null && id instanceof StringAttribute && id.isIdAttribute()) { ...
[ "public", "static", "void", "setNewIdentifier", "(", "ModelElementType", "type", ",", "ModelElementInstance", "modelElementInstance", ",", "String", "newId", ",", "boolean", "withReferenceUpdate", ")", "{", "Attribute", "<", "?", ">", "id", "=", "type", ".", "getA...
Set new identifier if the type has a String id attribute @param type the type of the model element @param modelElementInstance the model element instance to set the id @param newId new identifier @param withReferenceUpdate true to update id references in other elements, false otherwise
[ "Set", "new", "identifier", "if", "the", "type", "has", "a", "String", "id", "attribute" ]
85b3f879e26d063f71c94cfd21ac17d9ff6baf4d
https://github.com/camunda/camunda-xml-model/blob/85b3f879e26d063f71c94cfd21ac17d9ff6baf4d/src/main/java/org/camunda/bpm/model/xml/impl/util/ModelUtil.java#L238-L244
train
camunda/camunda-xml-model
src/main/java/org/camunda/bpm/model/xml/impl/util/ModelUtil.java
ModelUtil.setGeneratedUniqueIdentifier
public static void setGeneratedUniqueIdentifier(ModelElementType type, ModelElementInstance modelElementInstance, boolean withReferenceUpdate) { setNewIdentifier(type, modelElementInstance, ModelUtil.getUniqueIdentifier(type), withReferenceUpdate); }
java
public static void setGeneratedUniqueIdentifier(ModelElementType type, ModelElementInstance modelElementInstance, boolean withReferenceUpdate) { setNewIdentifier(type, modelElementInstance, ModelUtil.getUniqueIdentifier(type), withReferenceUpdate); }
[ "public", "static", "void", "setGeneratedUniqueIdentifier", "(", "ModelElementType", "type", ",", "ModelElementInstance", "modelElementInstance", ",", "boolean", "withReferenceUpdate", ")", "{", "setNewIdentifier", "(", "type", ",", "modelElementInstance", ",", "ModelUtil",...
Set unique identifier if the type has a String id attribute @param type the type of the model element @param modelElementInstance the model element instance to set the id @param withReferenceUpdate true to update id references in other elements, false otherwise
[ "Set", "unique", "identifier", "if", "the", "type", "has", "a", "String", "id", "attribute" ]
85b3f879e26d063f71c94cfd21ac17d9ff6baf4d
https://github.com/camunda/camunda-xml-model/blob/85b3f879e26d063f71c94cfd21ac17d9ff6baf4d/src/main/java/org/camunda/bpm/model/xml/impl/util/ModelUtil.java#L263-L265
train
camunda/camunda-xml-model
src/main/java/org/camunda/bpm/model/xml/impl/util/ReflectUtil.java
ReflectUtil.createInstance
public static <T> T createInstance(Class<T> type, Object... parameters) { // get types for parameters Class<?>[] parameterTypes = new Class<?>[parameters.length]; for (int i = 0; i < parameters.length; i++) { Object parameter = parameters[i]; parameterTypes[i] = parameter.getClass(); } ...
java
public static <T> T createInstance(Class<T> type, Object... parameters) { // get types for parameters Class<?>[] parameterTypes = new Class<?>[parameters.length]; for (int i = 0; i < parameters.length; i++) { Object parameter = parameters[i]; parameterTypes[i] = parameter.getClass(); } ...
[ "public", "static", "<", "T", ">", "T", "createInstance", "(", "Class", "<", "T", ">", "type", ",", "Object", "...", "parameters", ")", "{", "// get types for parameters", "Class", "<", "?", ">", "[", "]", "parameterTypes", "=", "new", "Class", "<", "?",...
Create a new instance of the provided type @param type the class to create a new instance of @param parameters the parameters to pass to the constructor @return the created instance
[ "Create", "a", "new", "instance", "of", "the", "provided", "type" ]
85b3f879e26d063f71c94cfd21ac17d9ff6baf4d
https://github.com/camunda/camunda-xml-model/blob/85b3f879e26d063f71c94cfd21ac17d9ff6baf4d/src/main/java/org/camunda/bpm/model/xml/impl/util/ReflectUtil.java#L81-L98
train
camunda/camunda-xml-model
src/main/java/org/camunda/bpm/model/xml/impl/type/ModelElementTypeImpl.java
ModelElementTypeImpl.resolveExtendingTypes
public void resolveExtendingTypes(Set<ModelElementType> allExtendingTypes) { for(ModelElementType modelElementType : extendingTypes) { ModelElementTypeImpl modelElementTypeImpl = (ModelElementTypeImpl) modelElementType; if (!allExtendingTypes.contains(modelElementTypeImpl)) { allExtendingTypes.a...
java
public void resolveExtendingTypes(Set<ModelElementType> allExtendingTypes) { for(ModelElementType modelElementType : extendingTypes) { ModelElementTypeImpl modelElementTypeImpl = (ModelElementTypeImpl) modelElementType; if (!allExtendingTypes.contains(modelElementTypeImpl)) { allExtendingTypes.a...
[ "public", "void", "resolveExtendingTypes", "(", "Set", "<", "ModelElementType", ">", "allExtendingTypes", ")", "{", "for", "(", "ModelElementType", "modelElementType", ":", "extendingTypes", ")", "{", "ModelElementTypeImpl", "modelElementTypeImpl", "=", "(", "ModelEleme...
Resolve all types recursively which are extending this type @param allExtendingTypes set of calculated extending types
[ "Resolve", "all", "types", "recursively", "which", "are", "extending", "this", "type" ]
85b3f879e26d063f71c94cfd21ac17d9ff6baf4d
https://github.com/camunda/camunda-xml-model/blob/85b3f879e26d063f71c94cfd21ac17d9ff6baf4d/src/main/java/org/camunda/bpm/model/xml/impl/type/ModelElementTypeImpl.java#L178-L186
train
camunda/camunda-xml-model
src/main/java/org/camunda/bpm/model/xml/impl/type/ModelElementTypeImpl.java
ModelElementTypeImpl.resolveBaseTypes
public void resolveBaseTypes(List<ModelElementType> baseTypes) { if (baseType != null) { baseTypes.add(baseType); baseType.resolveBaseTypes(baseTypes); } }
java
public void resolveBaseTypes(List<ModelElementType> baseTypes) { if (baseType != null) { baseTypes.add(baseType); baseType.resolveBaseTypes(baseTypes); } }
[ "public", "void", "resolveBaseTypes", "(", "List", "<", "ModelElementType", ">", "baseTypes", ")", "{", "if", "(", "baseType", "!=", "null", ")", "{", "baseTypes", ".", "add", "(", "baseType", ")", ";", "baseType", ".", "resolveBaseTypes", "(", "baseTypes", ...
Resolve all types which are base types of this type @param baseTypes list of calculated base types
[ "Resolve", "all", "types", "which", "are", "base", "types", "of", "this", "type" ]
85b3f879e26d063f71c94cfd21ac17d9ff6baf4d
https://github.com/camunda/camunda-xml-model/blob/85b3f879e26d063f71c94cfd21ac17d9ff6baf4d/src/main/java/org/camunda/bpm/model/xml/impl/type/ModelElementTypeImpl.java#L193-L198
train
camunda/camunda-xml-model
src/main/java/org/camunda/bpm/model/xml/impl/type/ModelElementTypeImpl.java
ModelElementTypeImpl.isBaseTypeOf
public boolean isBaseTypeOf(ModelElementType elementType) { if (this.equals(elementType)) { return true; } else { Collection<ModelElementType> baseTypes = ModelUtil.calculateAllBaseTypes(elementType); return baseTypes.contains(this); } }
java
public boolean isBaseTypeOf(ModelElementType elementType) { if (this.equals(elementType)) { return true; } else { Collection<ModelElementType> baseTypes = ModelUtil.calculateAllBaseTypes(elementType); return baseTypes.contains(this); } }
[ "public", "boolean", "isBaseTypeOf", "(", "ModelElementType", "elementType", ")", "{", "if", "(", "this", ".", "equals", "(", "elementType", ")", ")", "{", "return", "true", ";", "}", "else", "{", "Collection", "<", "ModelElementType", ">", "baseTypes", "=",...
Test if a element type is a base type of this type. So this type extends the given element type. @param elementType the element type to test @return true if {@code childElementTypeClass} is a base type of this type, else otherwise
[ "Test", "if", "a", "element", "type", "is", "a", "base", "type", "of", "this", "type", ".", "So", "this", "type", "extends", "the", "given", "element", "type", "." ]
85b3f879e26d063f71c94cfd21ac17d9ff6baf4d
https://github.com/camunda/camunda-xml-model/blob/85b3f879e26d063f71c94cfd21ac17d9ff6baf4d/src/main/java/org/camunda/bpm/model/xml/impl/type/ModelElementTypeImpl.java#L267-L275
train
camunda/camunda-xml-model
src/main/java/org/camunda/bpm/model/xml/impl/type/ModelElementTypeImpl.java
ModelElementTypeImpl.getAllAttributes
public Collection<Attribute<?>> getAllAttributes() { List<Attribute<?>> allAttributes = new ArrayList<Attribute<?>>(); allAttributes.addAll(getAttributes()); Collection<ModelElementType> baseTypes = ModelUtil.calculateAllBaseTypes(this); for (ModelElementType baseType : baseTypes) { allAttributes....
java
public Collection<Attribute<?>> getAllAttributes() { List<Attribute<?>> allAttributes = new ArrayList<Attribute<?>>(); allAttributes.addAll(getAttributes()); Collection<ModelElementType> baseTypes = ModelUtil.calculateAllBaseTypes(this); for (ModelElementType baseType : baseTypes) { allAttributes....
[ "public", "Collection", "<", "Attribute", "<", "?", ">", ">", "getAllAttributes", "(", ")", "{", "List", "<", "Attribute", "<", "?", ">", ">", "allAttributes", "=", "new", "ArrayList", "<", "Attribute", "<", "?", ">", ">", "(", ")", ";", "allAttributes...
Returns a list of all attributes, including the attributes of all base types. @return the list of all attributes
[ "Returns", "a", "list", "of", "all", "attributes", "including", "the", "attributes", "of", "all", "base", "types", "." ]
85b3f879e26d063f71c94cfd21ac17d9ff6baf4d
https://github.com/camunda/camunda-xml-model/blob/85b3f879e26d063f71c94cfd21ac17d9ff6baf4d/src/main/java/org/camunda/bpm/model/xml/impl/type/ModelElementTypeImpl.java#L282-L290
train
camunda/camunda-xml-model
src/main/java/org/camunda/bpm/model/xml/impl/type/ModelElementTypeImpl.java
ModelElementTypeImpl.getAttribute
public Attribute<?> getAttribute(String attributeName) { for (Attribute<?> attribute : getAllAttributes()) { if (attribute.getAttributeName().equals(attributeName)) { return attribute; } } return null; }
java
public Attribute<?> getAttribute(String attributeName) { for (Attribute<?> attribute : getAllAttributes()) { if (attribute.getAttributeName().equals(attributeName)) { return attribute; } } return null; }
[ "public", "Attribute", "<", "?", ">", "getAttribute", "(", "String", "attributeName", ")", "{", "for", "(", "Attribute", "<", "?", ">", "attribute", ":", "getAllAttributes", "(", ")", ")", "{", "if", "(", "attribute", ".", "getAttributeName", "(", ")", "...
Return the attribute for the attribute name @param attributeName the name of the attribute @return the attribute or null if it not exists
[ "Return", "the", "attribute", "for", "the", "attribute", "name" ]
85b3f879e26d063f71c94cfd21ac17d9ff6baf4d
https://github.com/camunda/camunda-xml-model/blob/85b3f879e26d063f71c94cfd21ac17d9ff6baf4d/src/main/java/org/camunda/bpm/model/xml/impl/type/ModelElementTypeImpl.java#L298-L305
train
camunda/camunda-xml-model
src/main/java/org/camunda/bpm/model/xml/impl/parser/AbstractModelParser.java
AbstractModelParser.protectAgainstXxeAttacks
private void protectAgainstXxeAttacks(final DocumentBuilderFactory dbf) { try { dbf.setFeature("http://xml.org/sax/features/external-general-entities", false); } catch (ParserConfigurationException ignored) { } try { dbf.setFeature("http://apache.org/xml/features/disallow-doctype-decl", tru...
java
private void protectAgainstXxeAttacks(final DocumentBuilderFactory dbf) { try { dbf.setFeature("http://xml.org/sax/features/external-general-entities", false); } catch (ParserConfigurationException ignored) { } try { dbf.setFeature("http://apache.org/xml/features/disallow-doctype-decl", tru...
[ "private", "void", "protectAgainstXxeAttacks", "(", "final", "DocumentBuilderFactory", "dbf", ")", "{", "try", "{", "dbf", ".", "setFeature", "(", "\"http://xml.org/sax/features/external-general-entities\"", ",", "false", ")", ";", "}", "catch", "(", "ParserConfiguratio...
Configures the DocumentBuilderFactory in a way, that it is protected against XML External Entity Attacks. If the implementing parser does not support one or multiple features, the failed feature is ignored. The parser might not protected, if the feature assignment fails. @see <a href="https://www.owasp.org/index.php/X...
[ "Configures", "the", "DocumentBuilderFactory", "in", "a", "way", "that", "it", "is", "protected", "against", "XML", "External", "Entity", "Attacks", ".", "If", "the", "implementing", "parser", "does", "not", "support", "one", "or", "multiple", "features", "the",...
85b3f879e26d063f71c94cfd21ac17d9ff6baf4d
https://github.com/camunda/camunda-xml-model/blob/85b3f879e26d063f71c94cfd21ac17d9ff6baf4d/src/main/java/org/camunda/bpm/model/xml/impl/parser/AbstractModelParser.java#L74-L92
train
camunda/camunda-xml-model
src/main/java/org/camunda/bpm/model/xml/impl/parser/AbstractModelParser.java
AbstractModelParser.validateModel
public void validateModel(DomDocument document) { Schema schema = getSchema(document); if (schema == null) { return; } Validator validator = schema.newValidator(); try { synchronized(document) { validator.validate(document.getDomSource()); } } catch (IOException e) {...
java
public void validateModel(DomDocument document) { Schema schema = getSchema(document); if (schema == null) { return; } Validator validator = schema.newValidator(); try { synchronized(document) { validator.validate(document.getDomSource()); } } catch (IOException e) {...
[ "public", "void", "validateModel", "(", "DomDocument", "document", ")", "{", "Schema", "schema", "=", "getSchema", "(", "document", ")", ";", "if", "(", "schema", "==", "null", ")", "{", "return", ";", "}", "Validator", "validator", "=", "schema", ".", "...
Validate DOM document @param document the DOM document to validate
[ "Validate", "DOM", "document" ]
85b3f879e26d063f71c94cfd21ac17d9ff6baf4d
https://github.com/camunda/camunda-xml-model/blob/85b3f879e26d063f71c94cfd21ac17d9ff6baf4d/src/main/java/org/camunda/bpm/model/xml/impl/parser/AbstractModelParser.java#L121-L139
train
sundrio/sundrio
codegen/src/main/java/io/sundr/codegen/model/ClassRef.java
ClassRef.requiresFullyQualifiedName
private boolean requiresFullyQualifiedName() { String currentPackage = PackageScope.get(); if (currentPackage != null) { if (definition != null && definition.getPackageName() != null && definition.getFullyQualifiedName() != null) { String conflictingFQCN = getDefinition().get...
java
private boolean requiresFullyQualifiedName() { String currentPackage = PackageScope.get(); if (currentPackage != null) { if (definition != null && definition.getPackageName() != null && definition.getFullyQualifiedName() != null) { String conflictingFQCN = getDefinition().get...
[ "private", "boolean", "requiresFullyQualifiedName", "(", ")", "{", "String", "currentPackage", "=", "PackageScope", ".", "get", "(", ")", ";", "if", "(", "currentPackage", "!=", "null", ")", "{", "if", "(", "definition", "!=", "null", "&&", "definition", "."...
Checks if the ref needs to be done by fully qualified name. Why? Because an other reference to a class with the same name but different package has been made already.
[ "Checks", "if", "the", "ref", "needs", "to", "be", "done", "by", "fully", "qualified", "name", ".", "Why?", "Because", "an", "other", "reference", "to", "a", "class", "with", "the", "same", "name", "but", "different", "package", "has", "been", "made", "a...
4e38368f4db0d950f7c41a8c75e15b0baff1f69a
https://github.com/sundrio/sundrio/blob/4e38368f4db0d950f7c41a8c75e15b0baff1f69a/codegen/src/main/java/io/sundr/codegen/model/ClassRef.java#L120-L139
train
sundrio/sundrio
components/swagger/src/main/java/io/sundr/swagger/language/JavaFluentCodegen.java
JavaFluentCodegen.addOperationToGroup
@SuppressWarnings("static-method") public void addOperationToGroup(String tag, String resourcePath, Operation operation, CodegenOperation co, Map<String, List<CodegenOperation>> operations) { String prefix = co.returnBaseType != null && co.returnBaseType.contains(".") ? co.returnBaseType.su...
java
@SuppressWarnings("static-method") public void addOperationToGroup(String tag, String resourcePath, Operation operation, CodegenOperation co, Map<String, List<CodegenOperation>> operations) { String prefix = co.returnBaseType != null && co.returnBaseType.contains(".") ? co.returnBaseType.su...
[ "@", "SuppressWarnings", "(", "\"static-method\"", ")", "public", "void", "addOperationToGroup", "(", "String", "tag", ",", "String", "resourcePath", ",", "Operation", "operation", ",", "CodegenOperation", "co", ",", "Map", "<", "String", ",", "List", "<", "Code...
Add operation to group @param tag name of the tag @param resourcePath path of the resource @param operation Swagger Operation object @param co Codegen Operation object @param operations map of Codegen operations
[ "Add", "operation", "to", "group" ]
4e38368f4db0d950f7c41a8c75e15b0baff1f69a
https://github.com/sundrio/sundrio/blob/4e38368f4db0d950f7c41a8c75e15b0baff1f69a/components/swagger/src/main/java/io/sundr/swagger/language/JavaFluentCodegen.java#L349-L360
train
sundrio/sundrio
annotations/builder/src/main/java/io/sundr/builder/internal/functions/Construct.java
Construct.checkConstructorArguments
private void checkConstructorArguments(int arguments) { if (arguments == 0 && (typeDef.getConstructors() == null || typeDef.getConstructors().isEmpty())) { return; } for (Method m : typeDef.getConstructors()) { int a = m.getArguments() != null ? m.getArguments().size() :...
java
private void checkConstructorArguments(int arguments) { if (arguments == 0 && (typeDef.getConstructors() == null || typeDef.getConstructors().isEmpty())) { return; } for (Method m : typeDef.getConstructors()) { int a = m.getArguments() != null ? m.getArguments().size() :...
[ "private", "void", "checkConstructorArguments", "(", "int", "arguments", ")", "{", "if", "(", "arguments", "==", "0", "&&", "(", "typeDef", ".", "getConstructors", "(", ")", "==", "null", "||", "typeDef", ".", "getConstructors", "(", ")", ".", "isEmpty", "...
Checks that a constructor with the required number of arguments is found. @param arguments
[ "Checks", "that", "a", "constructor", "with", "the", "required", "number", "of", "arguments", "is", "found", "." ]
4e38368f4db0d950f7c41a8c75e15b0baff1f69a
https://github.com/sundrio/sundrio/blob/4e38368f4db0d950f7c41a8c75e15b0baff1f69a/annotations/builder/src/main/java/io/sundr/builder/internal/functions/Construct.java#L94-L107
train
sundrio/sundrio
annotations/builder/src/main/java/io/sundr/builder/internal/functions/Construct.java
Construct.checkFactoryMethodArguments
private void checkFactoryMethodArguments(int arguments) { for (Method m : typeDef.getMethods()) { int a = m.getArguments() != null ? m.getArguments().size() : 0; if (m.getName().equals(staticFactoryMethod) && a == arguments && m.isStatic()) { return; } ...
java
private void checkFactoryMethodArguments(int arguments) { for (Method m : typeDef.getMethods()) { int a = m.getArguments() != null ? m.getArguments().size() : 0; if (m.getName().equals(staticFactoryMethod) && a == arguments && m.isStatic()) { return; } ...
[ "private", "void", "checkFactoryMethodArguments", "(", "int", "arguments", ")", "{", "for", "(", "Method", "m", ":", "typeDef", ".", "getMethods", "(", ")", ")", "{", "int", "a", "=", "m", ".", "getArguments", "(", ")", "!=", "null", "?", "m", ".", "...
Checks that a factory method with the required number of arguments is found. @param arguments
[ "Checks", "that", "a", "factory", "method", "with", "the", "required", "number", "of", "arguments", "is", "found", "." ]
4e38368f4db0d950f7c41a8c75e15b0baff1f69a
https://github.com/sundrio/sundrio/blob/4e38368f4db0d950f7c41a8c75e15b0baff1f69a/annotations/builder/src/main/java/io/sundr/builder/internal/functions/Construct.java#L113-L121
train
sundrio/sundrio
codegen/src/main/java/io/sundr/codegen/processor/JavaGeneratingProcessor.java
JavaGeneratingProcessor.classExists
private static boolean classExists(TypeDef typeDef) { try { Class.forName(typeDef.getFullyQualifiedName()); return true; } catch (ClassNotFoundException e) { return false; } }
java
private static boolean classExists(TypeDef typeDef) { try { Class.forName(typeDef.getFullyQualifiedName()); return true; } catch (ClassNotFoundException e) { return false; } }
[ "private", "static", "boolean", "classExists", "(", "TypeDef", "typeDef", ")", "{", "try", "{", "Class", ".", "forName", "(", "typeDef", ".", "getFullyQualifiedName", "(", ")", ")", ";", "return", "true", ";", "}", "catch", "(", "ClassNotFoundException", "e"...
Checks if class already exists. @param typeDef The type definition to check if exists. @return True if class can be found, false otherwise.
[ "Checks", "if", "class", "already", "exists", "." ]
4e38368f4db0d950f7c41a8c75e15b0baff1f69a
https://github.com/sundrio/sundrio/blob/4e38368f4db0d950f7c41a8c75e15b0baff1f69a/codegen/src/main/java/io/sundr/codegen/processor/JavaGeneratingProcessor.java#L190-L197
train
sundrio/sundrio
examples/codegen/src/main/java/io/sundr/examples/codegen/TypeDef.java
TypeDef.adaptConstructors
private static List<Method> adaptConstructors(List<Method> methods, TypeDef target) { List<Method> adapted = new ArrayList<Method>(); for (Method m : methods) { adapted.add(new MethodBuilder(m) .withName(null) .withReturnType(target.toUnboundedReferenc...
java
private static List<Method> adaptConstructors(List<Method> methods, TypeDef target) { List<Method> adapted = new ArrayList<Method>(); for (Method m : methods) { adapted.add(new MethodBuilder(m) .withName(null) .withReturnType(target.toUnboundedReferenc...
[ "private", "static", "List", "<", "Method", ">", "adaptConstructors", "(", "List", "<", "Method", ">", "methods", ",", "TypeDef", "target", ")", "{", "List", "<", "Method", ">", "adapted", "=", "new", "ArrayList", "<", "Method", ">", "(", ")", ";", "fo...
The method adapts constructor method to the current class. It unsets any name that may be presetn in the method. It also sets as a return type a reference to the current type.
[ "The", "method", "adapts", "constructor", "method", "to", "the", "current", "class", ".", "It", "unsets", "any", "name", "that", "may", "be", "presetn", "in", "the", "method", ".", "It", "also", "sets", "as", "a", "return", "type", "a", "reference", "to"...
4e38368f4db0d950f7c41a8c75e15b0baff1f69a
https://github.com/sundrio/sundrio/blob/4e38368f4db0d950f7c41a8c75e15b0baff1f69a/examples/codegen/src/main/java/io/sundr/examples/codegen/TypeDef.java#L85-L94
train
sundrio/sundrio
examples/codegen/src/main/java/io/sundr/examples/codegen/TypeDef.java
TypeDef.getFullyQualifiedName
public String getFullyQualifiedName() { StringBuilder sb = new StringBuilder(); if (packageName != null && !packageName.isEmpty()) { sb.append(getPackageName()).append("."); } if (outerType != null) { sb.append(outerType.getName()).append("."); } ...
java
public String getFullyQualifiedName() { StringBuilder sb = new StringBuilder(); if (packageName != null && !packageName.isEmpty()) { sb.append(getPackageName()).append("."); } if (outerType != null) { sb.append(outerType.getName()).append("."); } ...
[ "public", "String", "getFullyQualifiedName", "(", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "if", "(", "packageName", "!=", "null", "&&", "!", "packageName", ".", "isEmpty", "(", ")", ")", "{", "sb", ".", "append", "(",...
Returns the fully qualified name of the type.
[ "Returns", "the", "fully", "qualified", "name", "of", "the", "type", "." ]
4e38368f4db0d950f7c41a8c75e15b0baff1f69a
https://github.com/sundrio/sundrio/blob/4e38368f4db0d950f7c41a8c75e15b0baff1f69a/examples/codegen/src/main/java/io/sundr/examples/codegen/TypeDef.java#L111-L123
train
sundrio/sundrio
annotations/builder/src/main/java/io/sundr/builder/internal/functions/ToPojo.java
ToPojo.convertReference
private static String convertReference(String ref, TypeDef source, TypeDef target, TypeDef targetBuilder) { StringBuilder sb = new StringBuilder(); sb.append("new ").append(targetBuilder.getName()).append("(").append(convertReference(ref,source,target)).append(")"); return sb.toString(); }
java
private static String convertReference(String ref, TypeDef source, TypeDef target, TypeDef targetBuilder) { StringBuilder sb = new StringBuilder(); sb.append("new ").append(targetBuilder.getName()).append("(").append(convertReference(ref,source,target)).append(")"); return sb.toString(); }
[ "private", "static", "String", "convertReference", "(", "String", "ref", ",", "TypeDef", "source", ",", "TypeDef", "target", ",", "TypeDef", "targetBuilder", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "sb", ".", "append", "(...
Converts a reference from the source type, to the target type by using the builder. @param ref The ref. @param source The source type of the reference.. @param target The target type. @param targetBuilder The target type builder. @return
[ "Converts", "a", "reference", "from", "the", "source", "type", "to", "the", "target", "type", "by", "using", "the", "builder", "." ]
4e38368f4db0d950f7c41a8c75e15b0baff1f69a
https://github.com/sundrio/sundrio/blob/4e38368f4db0d950f7c41a8c75e15b0baff1f69a/annotations/builder/src/main/java/io/sundr/builder/internal/functions/ToPojo.java#L540-L544
train
sundrio/sundrio
annotations/builder/src/main/java/io/sundr/builder/internal/functions/ToPojo.java
ToPojo.convertMap
private static String convertMap(String ref, TypeDef source, TypeDef target) { Method ctor = BuilderUtils.findBuildableConstructor(target); String arguments = ctor.getArguments().stream() .map(p -> readMapValue(ref, source, p)) .collect(joining(",\n","\n", "")); ...
java
private static String convertMap(String ref, TypeDef source, TypeDef target) { Method ctor = BuilderUtils.findBuildableConstructor(target); String arguments = ctor.getArguments().stream() .map(p -> readMapValue(ref, source, p)) .collect(joining(",\n","\n", "")); ...
[ "private", "static", "String", "convertMap", "(", "String", "ref", ",", "TypeDef", "source", ",", "TypeDef", "target", ")", "{", "Method", "ctor", "=", "BuilderUtils", ".", "findBuildableConstructor", "(", "target", ")", ";", "String", "arguments", "=", "ctor"...
Converts a map describing the source type, to the target. @param ref The ref. @param source The source type of the reference.. @param target The target type. @return
[ "Converts", "a", "map", "describing", "the", "source", "type", "to", "the", "target", "." ]
4e38368f4db0d950f7c41a8c75e15b0baff1f69a
https://github.com/sundrio/sundrio/blob/4e38368f4db0d950f7c41a8c75e15b0baff1f69a/annotations/builder/src/main/java/io/sundr/builder/internal/functions/ToPojo.java#L710-L719
train
sundrio/sundrio
annotations/builder/src/main/java/io/sundr/builder/internal/functions/ToPojo.java
ToPojo.readObjectArrayValue
private static String readObjectArrayValue(String ref, TypeDef source, Property property) { StringBuilder sb = new StringBuilder(); Method getter = getterOf(source, property); TypeRef getterTypeRef = getter.getReturnType(); TypeRef propertyTypeRef = property.getTypeRef(); if (pr...
java
private static String readObjectArrayValue(String ref, TypeDef source, Property property) { StringBuilder sb = new StringBuilder(); Method getter = getterOf(source, property); TypeRef getterTypeRef = getter.getReturnType(); TypeRef propertyTypeRef = property.getTypeRef(); if (pr...
[ "private", "static", "String", "readObjectArrayValue", "(", "String", "ref", ",", "TypeDef", "source", ",", "Property", "property", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "Method", "getter", "=", "getterOf", "(", "source",...
Returns the string representation of the code that reads an object array property. @param ref The reference. @param source The type of the reference. @param property The property to read. @return The code.
[ "Returns", "the", "string", "representation", "of", "the", "code", "that", "reads", "an", "object", "array", "property", "." ]
4e38368f4db0d950f7c41a8c75e15b0baff1f69a
https://github.com/sundrio/sundrio/blob/4e38368f4db0d950f7c41a8c75e15b0baff1f69a/annotations/builder/src/main/java/io/sundr/builder/internal/functions/ToPojo.java#L788-L810
train
sundrio/sundrio
codegen/src/main/java/io/sundr/codegen/utils/TypeUtils.java
TypeUtils.hasMethod
public static boolean hasMethod(TypeDef typeDef, String method) { return unrollHierarchy(typeDef) .stream() .flatMap(h -> h.getMethods().stream()) .filter(m -> method.equals(m.getName())) .findAny() .isPresent(); }
java
public static boolean hasMethod(TypeDef typeDef, String method) { return unrollHierarchy(typeDef) .stream() .flatMap(h -> h.getMethods().stream()) .filter(m -> method.equals(m.getName())) .findAny() .isPresent(); }
[ "public", "static", "boolean", "hasMethod", "(", "TypeDef", "typeDef", ",", "String", "method", ")", "{", "return", "unrollHierarchy", "(", "typeDef", ")", ".", "stream", "(", ")", ".", "flatMap", "(", "h", "->", "h", ".", "getMethods", "(", ")", ".", ...
Check if method exists on the specified type. @param typeDef The type. @param method The method name. @return True if method is found, false otherwise.
[ "Check", "if", "method", "exists", "on", "the", "specified", "type", "." ]
4e38368f4db0d950f7c41a8c75e15b0baff1f69a
https://github.com/sundrio/sundrio/blob/4e38368f4db0d950f7c41a8c75e15b0baff1f69a/codegen/src/main/java/io/sundr/codegen/utils/TypeUtils.java#L398-L405
train
sundrio/sundrio
codegen/src/main/java/io/sundr/codegen/utils/TypeUtils.java
TypeUtils.hasProperty
public static boolean hasProperty(TypeDef typeDef, String property) { return unrollHierarchy(typeDef) .stream() .flatMap(h -> h.getProperties().stream()) .filter(p -> property.equals(p.getName())) .findAny() .isPresent(); }
java
public static boolean hasProperty(TypeDef typeDef, String property) { return unrollHierarchy(typeDef) .stream() .flatMap(h -> h.getProperties().stream()) .filter(p -> property.equals(p.getName())) .findAny() .isPresent(); }
[ "public", "static", "boolean", "hasProperty", "(", "TypeDef", "typeDef", ",", "String", "property", ")", "{", "return", "unrollHierarchy", "(", "typeDef", ")", ".", "stream", "(", ")", ".", "flatMap", "(", "h", "->", "h", ".", "getProperties", "(", ")", ...
Checks if property exists on the specified type. @param typeDef The type. @param property The property name. @return True if method is found, false otherwise.
[ "Checks", "if", "property", "exists", "on", "the", "specified", "type", "." ]
4e38368f4db0d950f7c41a8c75e15b0baff1f69a
https://github.com/sundrio/sundrio/blob/4e38368f4db0d950f7c41a8c75e15b0baff1f69a/codegen/src/main/java/io/sundr/codegen/utils/TypeUtils.java#L413-L420
train
sundrio/sundrio
codegen/src/main/java/io/sundr/codegen/utils/TypeUtils.java
TypeUtils.unrollHierarchy
public static Set<TypeDef> unrollHierarchy(TypeDef typeDef) { if (OBJECT.equals(typeDef)) { return new HashSet<>(); } Set<TypeDef> hierarchy = new HashSet<>(); hierarchy.add(typeDef); hierarchy.addAll(typeDef.getExtendsList().stream().flatMap(s -> unrollHierarchy(s.ge...
java
public static Set<TypeDef> unrollHierarchy(TypeDef typeDef) { if (OBJECT.equals(typeDef)) { return new HashSet<>(); } Set<TypeDef> hierarchy = new HashSet<>(); hierarchy.add(typeDef); hierarchy.addAll(typeDef.getExtendsList().stream().flatMap(s -> unrollHierarchy(s.ge...
[ "public", "static", "Set", "<", "TypeDef", ">", "unrollHierarchy", "(", "TypeDef", "typeDef", ")", "{", "if", "(", "OBJECT", ".", "equals", "(", "typeDef", ")", ")", "{", "return", "new", "HashSet", "<>", "(", ")", ";", "}", "Set", "<", "TypeDef", ">...
Unrolls the hierararchy of a specified type. @param typeDef The specified type. @return A set that contains all the hierarching (including the specified type).
[ "Unrolls", "the", "hierararchy", "of", "a", "specified", "type", "." ]
4e38368f4db0d950f7c41a8c75e15b0baff1f69a
https://github.com/sundrio/sundrio/blob/4e38368f4db0d950f7c41a8c75e15b0baff1f69a/codegen/src/main/java/io/sundr/codegen/utils/TypeUtils.java#L439-L447
train
sundrio/sundrio
maven-plugin/src/main/java/io/sundr/maven/ExternalBomResolver.java
ExternalBomResolver.resolve
public Map<Artifact, Dependency> resolve(BomConfig config) throws Exception { Map<Artifact, Dependency> dependencies = new LinkedHashMap<Artifact, Dependency>(); if (config != null && config.getImports() != null) { for (BomImport bom : config.getImports()) { Map<Artifact, Dep...
java
public Map<Artifact, Dependency> resolve(BomConfig config) throws Exception { Map<Artifact, Dependency> dependencies = new LinkedHashMap<Artifact, Dependency>(); if (config != null && config.getImports() != null) { for (BomImport bom : config.getImports()) { Map<Artifact, Dep...
[ "public", "Map", "<", "Artifact", ",", "Dependency", ">", "resolve", "(", "BomConfig", "config", ")", "throws", "Exception", "{", "Map", "<", "Artifact", ",", "Dependency", ">", "dependencies", "=", "new", "LinkedHashMap", "<", "Artifact", ",", "Dependency", ...
Resolve all imports contained in the given configuration. @param config the Bom configuration @return all artifacts and related dependencies imported from external Boms @throws Exception in case of resolution failure
[ "Resolve", "all", "imports", "contained", "in", "the", "given", "configuration", "." ]
4e38368f4db0d950f7c41a8c75e15b0baff1f69a
https://github.com/sundrio/sundrio/blob/4e38368f4db0d950f7c41a8c75e15b0baff1f69a/maven-plugin/src/main/java/io/sundr/maven/ExternalBomResolver.java#L74-L88
train
sundrio/sundrio
annotations/builder/src/main/java/io/sundr/builder/internal/functions/Descendants.java
Descendants.isDescendant
public static boolean isDescendant(TypeDef item, TypeDef candidate) { if (item == null || candidate == null) { return false; } else if (candidate.isAssignableFrom(item)) { return true; } return false; }
java
public static boolean isDescendant(TypeDef item, TypeDef candidate) { if (item == null || candidate == null) { return false; } else if (candidate.isAssignableFrom(item)) { return true; } return false; }
[ "public", "static", "boolean", "isDescendant", "(", "TypeDef", "item", ",", "TypeDef", "candidate", ")", "{", "if", "(", "item", "==", "null", "||", "candidate", "==", "null", ")", "{", "return", "false", ";", "}", "else", "if", "(", "candidate", ".", ...
Checks if a type is an descendant of an other type @param item The base type. @param candidate The candidate type. @return true if candidate is a descendant of base type.
[ "Checks", "if", "a", "type", "is", "an", "descendant", "of", "an", "other", "type" ]
4e38368f4db0d950f7c41a8c75e15b0baff1f69a
https://github.com/sundrio/sundrio/blob/4e38368f4db0d950f7c41a8c75e15b0baff1f69a/annotations/builder/src/main/java/io/sundr/builder/internal/functions/Descendants.java#L152-L159
train
sundrio/sundrio
codegen/src/main/java/io/sundr/codegen/utils/Getter.java
Getter.is
public static boolean is(Method method, boolean acceptPrefixless) { int length = method.getName().length(); if (method.isPrivate() || method.isStatic()) { return false; } if (!method.getArguments().isEmpty()) { return false; } if (method.getRetu...
java
public static boolean is(Method method, boolean acceptPrefixless) { int length = method.getName().length(); if (method.isPrivate() || method.isStatic()) { return false; } if (!method.getArguments().isEmpty()) { return false; } if (method.getRetu...
[ "public", "static", "boolean", "is", "(", "Method", "method", ",", "boolean", "acceptPrefixless", ")", "{", "int", "length", "=", "method", ".", "getName", "(", ")", ".", "length", "(", ")", ";", "if", "(", "method", ".", "isPrivate", "(", ")", "||", ...
Checks if the specified method is a getter. @param method The method. @param acceptPrefixless Flag to enable support of prefixless getters. @return
[ "Checks", "if", "the", "specified", "method", "is", "a", "getter", "." ]
4e38368f4db0d950f7c41a8c75e15b0baff1f69a
https://github.com/sundrio/sundrio/blob/4e38368f4db0d950f7c41a8c75e15b0baff1f69a/codegen/src/main/java/io/sundr/codegen/utils/Getter.java#L102-L133
train
sundrio/sundrio
maven-plugin/src/main/java/io/sundr/maven/Reflections.java
Reflections.readAnyField
static String readAnyField(Object obj, String ... names) { try { for (String name : names) { try { Field field = obj.getClass().getDeclaredField(name); field.setAccessible(true); return (String) field.get(obj); ...
java
static String readAnyField(Object obj, String ... names) { try { for (String name : names) { try { Field field = obj.getClass().getDeclaredField(name); field.setAccessible(true); return (String) field.get(obj); ...
[ "static", "String", "readAnyField", "(", "Object", "obj", ",", "String", "...", "names", ")", "{", "try", "{", "for", "(", "String", "name", ":", "names", ")", "{", "try", "{", "Field", "field", "=", "obj", ".", "getClass", "(", ")", ".", "getDeclare...
Read any field that matches the specified name. @param obj The obj to read from. @param names The var-arg of names. @return The value of the first field that matches or null if no match is found.
[ "Read", "any", "field", "that", "matches", "the", "specified", "name", "." ]
4e38368f4db0d950f7c41a8c75e15b0baff1f69a
https://github.com/sundrio/sundrio/blob/4e38368f4db0d950f7c41a8c75e15b0baff1f69a/maven-plugin/src/main/java/io/sundr/maven/Reflections.java#L54-L69
train
sundrio/sundrio
core/src/main/java/io/sundr/builder/BaseFluent.java
BaseFluent.hasCompatibleVisitMethod
private static <V,F> Boolean hasCompatibleVisitMethod(V visitor, F fluent) { for (Method method : visitor.getClass().getMethods()) { if (!method.getName().equals(VISIT) || method.getParameterTypes().length != 1) { continue; } Class visitorType = method.getPara...
java
private static <V,F> Boolean hasCompatibleVisitMethod(V visitor, F fluent) { for (Method method : visitor.getClass().getMethods()) { if (!method.getName().equals(VISIT) || method.getParameterTypes().length != 1) { continue; } Class visitorType = method.getPara...
[ "private", "static", "<", "V", ",", "F", ">", "Boolean", "hasCompatibleVisitMethod", "(", "V", "visitor", ",", "F", "fluent", ")", "{", "for", "(", "Method", "method", ":", "visitor", ".", "getClass", "(", ")", ".", "getMethods", "(", ")", ")", "{", ...
Checks if the specified visitor has a visit method compatible with the specified fluent. @param visitor @param fluent @param <V> @param <F> @return
[ "Checks", "if", "the", "specified", "visitor", "has", "a", "visit", "method", "compatible", "with", "the", "specified", "fluent", "." ]
4e38368f4db0d950f7c41a8c75e15b0baff1f69a
https://github.com/sundrio/sundrio/blob/4e38368f4db0d950f7c41a8c75e15b0baff1f69a/core/src/main/java/io/sundr/builder/BaseFluent.java#L120-L133
train
sundrio/sundrio
codegen/src/main/java/io/sundr/codegen/utils/StringUtils.java
StringUtils.toPojoName
public static final String toPojoName(String name, String prefix, String suffix) { LinkedList<String> parts = new LinkedList<>(Arrays.asList(name.split(SPLITTER_REGEX))); if (parts.isEmpty()) { return prefix + name + suffix; } if (parts.getFirst().equals("I")) { ...
java
public static final String toPojoName(String name, String prefix, String suffix) { LinkedList<String> parts = new LinkedList<>(Arrays.asList(name.split(SPLITTER_REGEX))); if (parts.isEmpty()) { return prefix + name + suffix; } if (parts.getFirst().equals("I")) { ...
[ "public", "static", "final", "String", "toPojoName", "(", "String", "name", ",", "String", "prefix", ",", "String", "suffix", ")", "{", "LinkedList", "<", "String", ">", "parts", "=", "new", "LinkedList", "<>", "(", "Arrays", ".", "asList", "(", "name", ...
Converts a name of an interface or abstract class to Pojo name. Remove leading "I" and "Abstract" or trailing "Interface". @param name The name to convert. @param prefix The prefix to use if needed. @param suffix The suffix to user if needed. @return The converted name, if a conversion actually happ...
[ "Converts", "a", "name", "of", "an", "interface", "or", "abstract", "class", "to", "Pojo", "name", ".", "Remove", "leading", "I", "and", "Abstract", "or", "trailing", "Interface", "." ]
4e38368f4db0d950f7c41a8c75e15b0baff1f69a
https://github.com/sundrio/sundrio/blob/4e38368f4db0d950f7c41a8c75e15b0baff1f69a/codegen/src/main/java/io/sundr/codegen/utils/StringUtils.java#L249-L273
train
sundrio/sundrio
annotations/builder/src/main/java/io/sundr/builder/internal/processor/AbstractBuilderProcessor.java
AbstractBuilderProcessor.generatePojos
public void generatePojos(BuilderContext builderContext, Set<TypeDef> buildables) { Set<TypeDef> additonalBuildables = new HashSet<>(); Set<TypeDef> additionalTypes = new HashSet<>(); for (TypeDef typeDef : buildables) { try { if (typeDef.isInterface() || typeDef.isAn...
java
public void generatePojos(BuilderContext builderContext, Set<TypeDef> buildables) { Set<TypeDef> additonalBuildables = new HashSet<>(); Set<TypeDef> additionalTypes = new HashSet<>(); for (TypeDef typeDef : buildables) { try { if (typeDef.isInterface() || typeDef.isAn...
[ "public", "void", "generatePojos", "(", "BuilderContext", "builderContext", ",", "Set", "<", "TypeDef", ">", "buildables", ")", "{", "Set", "<", "TypeDef", ">", "additonalBuildables", "=", "new", "HashSet", "<>", "(", ")", ";", "Set", "<", "TypeDef", ">", ...
Returns true if pojos where generated. @param builderContext The builder context. @param buildables The set of buildables.
[ "Returns", "true", "if", "pojos", "where", "generated", "." ]
4e38368f4db0d950f7c41a8c75e15b0baff1f69a
https://github.com/sundrio/sundrio/blob/4e38368f4db0d950f7c41a8c75e15b0baff1f69a/annotations/builder/src/main/java/io/sundr/builder/internal/processor/AbstractBuilderProcessor.java#L361-L396
train
sundrio/sundrio
annotations/builder/src/main/java/io/sundr/builder/internal/utils/BuilderUtils.java
BuilderUtils.methodHasArgument
public static boolean methodHasArgument(Method method, Property property) { for (Property candidate : method.getArguments()) { if (candidate.equals(property)) { return true; } } return false; }
java
public static boolean methodHasArgument(Method method, Property property) { for (Property candidate : method.getArguments()) { if (candidate.equals(property)) { return true; } } return false; }
[ "public", "static", "boolean", "methodHasArgument", "(", "Method", "method", ",", "Property", "property", ")", "{", "for", "(", "Property", "candidate", ":", "method", ".", "getArguments", "(", ")", ")", "{", "if", "(", "candidate", ".", "equals", "(", "pr...
Checks if method has a specific argument. @param method The method. @param property The argument. @return True if matching argument if found.
[ "Checks", "if", "method", "has", "a", "specific", "argument", "." ]
4e38368f4db0d950f7c41a8c75e15b0baff1f69a
https://github.com/sundrio/sundrio/blob/4e38368f4db0d950f7c41a8c75e15b0baff1f69a/annotations/builder/src/main/java/io/sundr/builder/internal/utils/BuilderUtils.java#L195-L202
train
square/mortar
mortar/src/main/java/mortar/MortarScope.java
MortarScope.getScope
public static MortarScope getScope(Context context) { //noinspection ResourceType Object scope = context.getSystemService(MORTAR_SERVICE); if (scope == null) { // Essentially a workaround for the lifecycle interval where an Activity's // base context is not yet set to the Application, but the Ap...
java
public static MortarScope getScope(Context context) { //noinspection ResourceType Object scope = context.getSystemService(MORTAR_SERVICE); if (scope == null) { // Essentially a workaround for the lifecycle interval where an Activity's // base context is not yet set to the Application, but the Ap...
[ "public", "static", "MortarScope", "getScope", "(", "Context", "context", ")", "{", "//noinspection ResourceType", "Object", "scope", "=", "context", ".", "getSystemService", "(", "MORTAR_SERVICE", ")", ";", "if", "(", "scope", "==", "null", ")", "{", "// Essent...
Retrieves a MortarScope from the given context. If none is found, retrieves a MortarScope from the application context. @return null if no scope is found in either the given context or the application context
[ "Retrieves", "a", "MortarScope", "from", "the", "given", "context", ".", "If", "none", "is", "found", "retrieves", "a", "MortarScope", "from", "the", "application", "context", "." ]
c968b99eb96ba56c47e29912c07841be8e2cf97a
https://github.com/square/mortar/blob/c968b99eb96ba56c47e29912c07841be8e2cf97a/mortar/src/main/java/mortar/MortarScope.java#L41-L54
train
square/mortar
mortar/src/main/java/mortar/MortarScope.java
MortarScope.hasService
public boolean hasService(String serviceName) { return serviceName.equals(MORTAR_SERVICE) || findService(serviceName, false) != null; }
java
public boolean hasService(String serviceName) { return serviceName.equals(MORTAR_SERVICE) || findService(serviceName, false) != null; }
[ "public", "boolean", "hasService", "(", "String", "serviceName", ")", "{", "return", "serviceName", ".", "equals", "(", "MORTAR_SERVICE", ")", "||", "findService", "(", "serviceName", ",", "false", ")", "!=", "null", ";", "}" ]
Returns true if the service associated with the given name is provided by mortar. It is safe to call this method on destroyed scopes.
[ "Returns", "true", "if", "the", "service", "associated", "with", "the", "given", "name", "is", "provided", "by", "mortar", ".", "It", "is", "safe", "to", "call", "this", "method", "on", "destroyed", "scopes", "." ]
c968b99eb96ba56c47e29912c07841be8e2cf97a
https://github.com/square/mortar/blob/c968b99eb96ba56c47e29912c07841be8e2cf97a/mortar/src/main/java/mortar/MortarScope.java#L104-L106
train
square/mortar
mortar/src/main/java/mortar/MortarScope.java
MortarScope.getService
public <T> T getService(String serviceName) { T service = findService(serviceName, true); if (service == null) { throw new IllegalArgumentException(format("No service found named \"%s\"", serviceName)); } return service; }
java
public <T> T getService(String serviceName) { T service = findService(serviceName, true); if (service == null) { throw new IllegalArgumentException(format("No service found named \"%s\"", serviceName)); } return service; }
[ "public", "<", "T", ">", "T", "getService", "(", "String", "serviceName", ")", "{", "T", "service", "=", "findService", "(", "serviceName", ",", "true", ")", ";", "if", "(", "service", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "...
Returns the service associated with the given name. @throws IllegalArgumentException if no such service can be found @throws IllegalStateException if this scope is dead @see #hasService
[ "Returns", "the", "service", "associated", "with", "the", "given", "name", "." ]
c968b99eb96ba56c47e29912c07841be8e2cf97a
https://github.com/square/mortar/blob/c968b99eb96ba56c47e29912c07841be8e2cf97a/mortar/src/main/java/mortar/MortarScope.java#L115-L122
train
square/mortar
mortar/src/main/java/mortar/MortarScope.java
MortarScope.searchFromRoot
private MortarScope searchFromRoot(Scoped scoped) { // Ascend to the root. MortarScope root = this; while (root.parent != null) { root = root.parent; } // Do the non-recursive search. List<MortarScope> scopes = new LinkedList<>(); scopes.add(root); while (!scopes.isEmpty()) { ...
java
private MortarScope searchFromRoot(Scoped scoped) { // Ascend to the root. MortarScope root = this; while (root.parent != null) { root = root.parent; } // Do the non-recursive search. List<MortarScope> scopes = new LinkedList<>(); scopes.add(root); while (!scopes.isEmpty()) { ...
[ "private", "MortarScope", "searchFromRoot", "(", "Scoped", "scoped", ")", "{", "// Ascend to the root.", "MortarScope", "root", "=", "this", ";", "while", "(", "root", ".", "parent", "!=", "null", ")", "{", "root", "=", "root", ".", "parent", ";", "}", "//...
Find the scope from the root of the hierarchy, in which the scoped object is registered.
[ "Find", "the", "scope", "from", "the", "root", "of", "the", "hierarchy", "in", "which", "the", "scoped", "object", "is", "registered", "." ]
c968b99eb96ba56c47e29912c07841be8e2cf97a
https://github.com/square/mortar/blob/c968b99eb96ba56c47e29912c07841be8e2cf97a/mortar/src/main/java/mortar/MortarScope.java#L147-L173
train
square/mortar
mortar-hellodagger2/src/main/java/com/example/hellodagger2/DaggerService.java
DaggerService.getDaggerComponent
@SuppressWarnings("unchecked") // public static <T> T getDaggerComponent(Context context) { //noinspection ResourceType return (T) context.getSystemService(SERVICE_NAME); }
java
@SuppressWarnings("unchecked") // public static <T> T getDaggerComponent(Context context) { //noinspection ResourceType return (T) context.getSystemService(SERVICE_NAME); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "//", "public", "static", "<", "T", ">", "T", "getDaggerComponent", "(", "Context", "context", ")", "{", "//noinspection ResourceType", "return", "(", "T", ")", "context", ".", "getSystemService", "(", "SERVICE...
Caller is required to know the type of the component for this context.
[ "Caller", "is", "required", "to", "know", "the", "type", "of", "the", "component", "for", "this", "context", "." ]
c968b99eb96ba56c47e29912c07841be8e2cf97a
https://github.com/square/mortar/blob/c968b99eb96ba56c47e29912c07841be8e2cf97a/mortar-hellodagger2/src/main/java/com/example/hellodagger2/DaggerService.java#L12-L16
train
square/mortar
mortar-hellodagger2/src/main/java/com/example/hellodagger2/DaggerService.java
DaggerService.createComponent
public static <T> T createComponent(Class<T> componentClass, Object... dependencies) { String fqn = componentClass.getName(); String packageName = componentClass.getPackage().getName(); // Accounts for inner classes, ie MyApplication$Component String simpleName = fqn.substring(packageName.length() + 1)...
java
public static <T> T createComponent(Class<T> componentClass, Object... dependencies) { String fqn = componentClass.getName(); String packageName = componentClass.getPackage().getName(); // Accounts for inner classes, ie MyApplication$Component String simpleName = fqn.substring(packageName.length() + 1)...
[ "public", "static", "<", "T", ">", "T", "createComponent", "(", "Class", "<", "T", ">", "componentClass", ",", "Object", "...", "dependencies", ")", "{", "String", "fqn", "=", "componentClass", ".", "getName", "(", ")", ";", "String", "packageName", "=", ...
Magic method that creates a component with its dependencies set, by reflection. Relies on Dagger2 naming conventions.
[ "Magic", "method", "that", "creates", "a", "component", "with", "its", "dependencies", "set", "by", "reflection", ".", "Relies", "on", "Dagger2", "naming", "conventions", "." ]
c968b99eb96ba56c47e29912c07841be8e2cf97a
https://github.com/square/mortar/blob/c968b99eb96ba56c47e29912c07841be8e2cf97a/mortar-hellodagger2/src/main/java/com/example/hellodagger2/DaggerService.java#L22-L51
train
jOOQ/jOOX
jOOX-java-6/src/main/java/org/joox/Util.java
Util.createContent
static final DocumentFragment createContent(Document doc, String text) { // [#150] Text might hold XML content, which can be leniently identified by the presence // of either < or & characters (other entities, like >, ", ' are not stricly XML content) if (text != null && (text.contains("...
java
static final DocumentFragment createContent(Document doc, String text) { // [#150] Text might hold XML content, which can be leniently identified by the presence // of either < or & characters (other entities, like >, ", ' are not stricly XML content) if (text != null && (text.contains("...
[ "static", "final", "DocumentFragment", "createContent", "(", "Document", "doc", ",", "String", "text", ")", "{", "// [#150] Text might hold XML content, which can be leniently identified by the presence", "// of either < or & characters (other entities, like >, \", ' are not stricly...
Create some content in the context of a given document @return <ul> <li>A {@link DocumentFragment} if <code>text</code> is well-formed.</li> <li><code>null</code>, if <code>text</code> is plain text or not well formed</li> </ul>
[ "Create", "some", "content", "in", "the", "context", "of", "a", "given", "document" ]
3793b96f0cee126f64074da4d7fad63f91d2440e
https://github.com/jOOQ/jOOX/blob/3793b96f0cee126f64074da4d7fad63f91d2440e/jOOX-java-6/src/main/java/org/joox/Util.java#L99-L148
train
jOOQ/jOOX
jOOX-java-6/src/main/java/org/joox/Util.java
Util.xpath
static final String xpath(Element element) { StringBuilder sb = new StringBuilder(); Node iterator = element; while (iterator.getNodeType() == Node.ELEMENT_NODE) { sb.insert(0, "]"); sb.insert(0, siblingIndex((Element) iterator) + 1); sb.insert(0, "["); ...
java
static final String xpath(Element element) { StringBuilder sb = new StringBuilder(); Node iterator = element; while (iterator.getNodeType() == Node.ELEMENT_NODE) { sb.insert(0, "]"); sb.insert(0, siblingIndex((Element) iterator) + 1); sb.insert(0, "["); ...
[ "static", "final", "String", "xpath", "(", "Element", "element", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "Node", "iterator", "=", "element", ";", "while", "(", "iterator", ".", "getNodeType", "(", ")", "==", "Node", "...
Return an XPath expression describing an element
[ "Return", "an", "XPath", "expression", "describing", "an", "element" ]
3793b96f0cee126f64074da4d7fad63f91d2440e
https://github.com/jOOQ/jOOX/blob/3793b96f0cee126f64074da4d7fad63f91d2440e/jOOX-java-6/src/main/java/org/joox/Util.java#L257-L272
train
jOOQ/jOOX
jOOX-java-6/src/main/java/org/joox/Util.java
Util.parseDate
static final java.util.Date parseDate(String formatted) { if (formatted == null || formatted.trim().equals("")) return null; try { DatatypeFactory factory = DatatypeFactory.newInstance(); XMLGregorianCalendar calendar = factory.newXMLGregorianCalendar(formatted); ...
java
static final java.util.Date parseDate(String formatted) { if (formatted == null || formatted.trim().equals("")) return null; try { DatatypeFactory factory = DatatypeFactory.newInstance(); XMLGregorianCalendar calendar = factory.newXMLGregorianCalendar(formatted); ...
[ "static", "final", "java", ".", "util", ".", "Date", "parseDate", "(", "String", "formatted", ")", "{", "if", "(", "formatted", "==", "null", "||", "formatted", ".", "trim", "(", ")", ".", "equals", "(", "\"\"", ")", ")", "return", "null", ";", "try"...
Parse any date format
[ "Parse", "any", "date", "format" ]
3793b96f0cee126f64074da4d7fad63f91d2440e
https://github.com/jOOQ/jOOX/blob/3793b96f0cee126f64074da4d7fad63f91d2440e/jOOX-java-6/src/main/java/org/joox/Util.java#L547-L610
train
molgenis/molgenis
molgenis-data-elasticsearch/src/main/java/org/molgenis/data/elasticsearch/client/ClientFactory.java
ClientFactory.createClient
Client createClient() throws InterruptedException { Client client = retryTemplate.execute(this::tryCreateClient); LOG.info("Connected to Elasticsearch cluster '{}'.", clusterName); return client; }
java
Client createClient() throws InterruptedException { Client client = retryTemplate.execute(this::tryCreateClient); LOG.info("Connected to Elasticsearch cluster '{}'.", clusterName); return client; }
[ "Client", "createClient", "(", ")", "throws", "InterruptedException", "{", "Client", "client", "=", "retryTemplate", ".", "execute", "(", "this", "::", "tryCreateClient", ")", ";", "LOG", ".", "info", "(", "\"Connected to Elasticsearch cluster '{}'.\"", ",", "cluste...
Tries to create a Client connecting to cluster on the given adresses. @throws InterruptedException if this thread gets interrupted while trying to connect @throws MolgenisDataException if maximum number of retries is exceeded
[ "Tries", "to", "create", "a", "Client", "connecting", "to", "cluster", "on", "the", "given", "adresses", "." ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-elasticsearch/src/main/java/org/molgenis/data/elasticsearch/client/ClientFactory.java#L53-L58
train
molgenis/molgenis
molgenis-ontology-core/src/main/java/org/molgenis/ontology/core/repository/OntologyRepository.java
OntologyRepository.getOntology
public Ontology getOntology(String iri) { org.molgenis.ontology.core.meta.Ontology ontology = dataService .query(ONTOLOGY, org.molgenis.ontology.core.meta.Ontology.class) .eq(ONTOLOGY_IRI, iri) .findOne(); return toOntology(ontology); }
java
public Ontology getOntology(String iri) { org.molgenis.ontology.core.meta.Ontology ontology = dataService .query(ONTOLOGY, org.molgenis.ontology.core.meta.Ontology.class) .eq(ONTOLOGY_IRI, iri) .findOne(); return toOntology(ontology); }
[ "public", "Ontology", "getOntology", "(", "String", "iri", ")", "{", "org", ".", "molgenis", ".", "ontology", ".", "core", ".", "meta", ".", "Ontology", "ontology", "=", "dataService", ".", "query", "(", "ONTOLOGY", ",", "org", ".", "molgenis", ".", "ont...
Retrieves an ontology with a specific IRI. @param iri the IRI of the ontology
[ "Retrieves", "an", "ontology", "with", "a", "specific", "IRI", "." ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-ontology-core/src/main/java/org/molgenis/ontology/core/repository/OntologyRepository.java#L40-L47
train
molgenis/molgenis
molgenis-core-ui/src/main/java/org/molgenis/core/ui/data/importer/wizard/ImportWizardController.java
ImportWizardController.importFileByUrl
@SuppressWarnings("squid:S2083") @PostMapping("/importByUrl") @ResponseBody public ResponseEntity<String> importFileByUrl( HttpServletRequest request, @RequestParam("url") String url, @RequestParam(value = "entityTypeId", required = false) String entityTypeId, @RequestParam(value = "packag...
java
@SuppressWarnings("squid:S2083") @PostMapping("/importByUrl") @ResponseBody public ResponseEntity<String> importFileByUrl( HttpServletRequest request, @RequestParam("url") String url, @RequestParam(value = "entityTypeId", required = false) String entityTypeId, @RequestParam(value = "packag...
[ "@", "SuppressWarnings", "(", "\"squid:S2083\"", ")", "@", "PostMapping", "(", "\"/importByUrl\"", ")", "@", "ResponseBody", "public", "ResponseEntity", "<", "String", ">", "importFileByUrl", "(", "HttpServletRequest", "request", ",", "@", "RequestParam", "(", "\"ur...
Imports entities present in a file from a URL @param url URL from which a file is downloaded
[ "Imports", "entities", "present", "in", "a", "file", "from", "a", "URL" ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-core-ui/src/main/java/org/molgenis/core/ui/data/importer/wizard/ImportWizardController.java#L146-L172
train
molgenis/molgenis
molgenis-core-ui/src/main/java/org/molgenis/core/ui/data/importer/wizard/ImportWizardController.java
ImportWizardController.importFile
@PostMapping("/importFile") public ResponseEntity<String> importFile( HttpServletRequest request, @RequestParam(value = "file") MultipartFile file, @RequestParam(value = "entityTypeId", required = false) String entityTypeId, @RequestParam(value = "packageId", required = false) String packageId...
java
@PostMapping("/importFile") public ResponseEntity<String> importFile( HttpServletRequest request, @RequestParam(value = "file") MultipartFile file, @RequestParam(value = "entityTypeId", required = false) String entityTypeId, @RequestParam(value = "packageId", required = false) String packageId...
[ "@", "PostMapping", "(", "\"/importFile\"", ")", "public", "ResponseEntity", "<", "String", ">", "importFile", "(", "HttpServletRequest", "request", ",", "@", "RequestParam", "(", "value", "=", "\"file\"", ")", "MultipartFile", "file", ",", "@", "RequestParam", ...
Imports entities present in the submitted file @param file File containing entities. Can be VCF, VCF.gz, or EMX @param entityTypeId Only for VCF and VCF.gz. If set, uses this ID for the table name. Is ignored when uploading EMX @param packageId Only for VCF and VCF.gz. If set, places the VCF under the provided package...
[ "Imports", "entities", "present", "in", "the", "submitted", "file" ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-core-ui/src/main/java/org/molgenis/core/ui/data/importer/wizard/ImportWizardController.java#L187-L218
train
molgenis/molgenis
molgenis-data/src/main/java/org/molgenis/data/populate/DefaultValuePopulator.java
DefaultValuePopulator.populate
public void populate(Entity entity) { stream(entity.getEntityType().getAllAttributes()) .filter(Attribute::hasDefaultValue) .forEach(attr -> populateDefaultValues(entity, attr)); }
java
public void populate(Entity entity) { stream(entity.getEntityType().getAllAttributes()) .filter(Attribute::hasDefaultValue) .forEach(attr -> populateDefaultValues(entity, attr)); }
[ "public", "void", "populate", "(", "Entity", "entity", ")", "{", "stream", "(", "entity", ".", "getEntityType", "(", ")", ".", "getAllAttributes", "(", ")", ")", ".", "filter", "(", "Attribute", "::", "hasDefaultValue", ")", ".", "forEach", "(", "attr", ...
Populates an entity with default values @param entity populated entity
[ "Populates", "an", "entity", "with", "default", "values" ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data/src/main/java/org/molgenis/data/populate/DefaultValuePopulator.java#L43-L47
train
molgenis/molgenis
molgenis-core-ui/src/main/java/org/molgenis/core/ui/MolgenisInterceptor.java
MolgenisInterceptor.getEnvironmentAttributes
private Map<String, String> getEnvironmentAttributes() { Map<String, String> environmentAttributes = new HashMap<>(); environmentAttributes.put(ATTRIBUTE_ENVIRONMENT_TYPE, environment); return environmentAttributes; }
java
private Map<String, String> getEnvironmentAttributes() { Map<String, String> environmentAttributes = new HashMap<>(); environmentAttributes.put(ATTRIBUTE_ENVIRONMENT_TYPE, environment); return environmentAttributes; }
[ "private", "Map", "<", "String", ",", "String", ">", "getEnvironmentAttributes", "(", ")", "{", "Map", "<", "String", ",", "String", ">", "environmentAttributes", "=", "new", "HashMap", "<>", "(", ")", ";", "environmentAttributes", ".", "put", "(", "ATTRIBUT...
Make sure Spring does not add the attributes as query parameters to the url when doing a redirect. You can do this by introducing an object instead of a string key value pair. <p>See <a href="https://github.com/molgenis/molgenis/issues/6515">https://github.com/molgenis/molgenis/issues/6515</a> @return environmentAttr...
[ "Make", "sure", "Spring", "does", "not", "add", "the", "attributes", "as", "query", "parameters", "to", "the", "url", "when", "doing", "a", "redirect", ".", "You", "can", "do", "this", "by", "introducing", "an", "object", "instead", "of", "a", "string", ...
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-core-ui/src/main/java/org/molgenis/core/ui/MolgenisInterceptor.java#L92-L96
train
molgenis/molgenis
molgenis-data-import/src/main/java/org/molgenis/data/importer/MyEntitiesValidationReport.java
MyEntitiesValidationReport.addEntity
public MyEntitiesValidationReport addEntity(String entityTypeId, boolean importable) { sheetsImportable.put(entityTypeId, importable); valid = valid && importable; if (importable) { fieldsImportable.put(entityTypeId, new ArrayList<>()); fieldsUnknown.put(entityTypeId, new ArrayList<>()); f...
java
public MyEntitiesValidationReport addEntity(String entityTypeId, boolean importable) { sheetsImportable.put(entityTypeId, importable); valid = valid && importable; if (importable) { fieldsImportable.put(entityTypeId, new ArrayList<>()); fieldsUnknown.put(entityTypeId, new ArrayList<>()); f...
[ "public", "MyEntitiesValidationReport", "addEntity", "(", "String", "entityTypeId", ",", "boolean", "importable", ")", "{", "sheetsImportable", ".", "put", "(", "entityTypeId", ",", "importable", ")", ";", "valid", "=", "valid", "&&", "importable", ";", "if", "(...
Creates a new report, with an entity added to it. @param entityTypeId name of the entity @param importable true if the entity is importable @return this report
[ "Creates", "a", "new", "report", "with", "an", "entity", "added", "to", "it", "." ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-import/src/main/java/org/molgenis/data/importer/MyEntitiesValidationReport.java#L54-L65
train
molgenis/molgenis
molgenis-data-import/src/main/java/org/molgenis/data/importer/MyEntitiesValidationReport.java
MyEntitiesValidationReport.addAttribute
public MyEntitiesValidationReport addAttribute(String attributeName, AttributeState state) { if (getImportOrder().isEmpty()) { throw new IllegalStateException("Must add entity first"); } String entityTypeId = getImportOrder().get(getImportOrder().size() - 1); valid = valid && state.isValid(); ...
java
public MyEntitiesValidationReport addAttribute(String attributeName, AttributeState state) { if (getImportOrder().isEmpty()) { throw new IllegalStateException("Must add entity first"); } String entityTypeId = getImportOrder().get(getImportOrder().size() - 1); valid = valid && state.isValid(); ...
[ "public", "MyEntitiesValidationReport", "addAttribute", "(", "String", "attributeName", ",", "AttributeState", "state", ")", "{", "if", "(", "getImportOrder", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Must add e...
Creates a new report, with an attribute added to the last added entity; @param attributeName name of the attribute to add @param state state of the attribute to add @return this report
[ "Creates", "a", "new", "report", "with", "an", "attribute", "added", "to", "the", "last", "added", "entity", ";" ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-import/src/main/java/org/molgenis/data/importer/MyEntitiesValidationReport.java#L90-L113
train
molgenis/molgenis
molgenis-data-index/src/main/java/org/molgenis/data/index/IndexedRepositoryDecorator.java
IndexedRepositoryDecorator.tryTwice
private <R> R tryTwice(Supplier<R> action) { try { return action.get(); } catch (UnknownIndexException e) { waitForIndexToBeStable(); try { return action.get(); } catch (UnknownIndexException e1) { throw new MolgenisDataException( format( "Erro...
java
private <R> R tryTwice(Supplier<R> action) { try { return action.get(); } catch (UnknownIndexException e) { waitForIndexToBeStable(); try { return action.get(); } catch (UnknownIndexException e1) { throw new MolgenisDataException( format( "Erro...
[ "private", "<", "R", ">", "R", "tryTwice", "(", "Supplier", "<", "R", ">", "action", ")", "{", "try", "{", "return", "action", ".", "get", "(", ")", ";", "}", "catch", "(", "UnknownIndexException", "e", ")", "{", "waitForIndexToBeStable", "(", ")", "...
Executes an action on an index that may be unstable. <p>If the Index was unknown, waits for the index to be stable and then tries again. @param action the action that gets executed @param <R> the result type of the action @return the result @throws MolgenisDataException if the action still failed when the index was s...
[ "Executes", "an", "action", "on", "an", "index", "that", "may", "be", "unstable", "." ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-index/src/main/java/org/molgenis/data/index/IndexedRepositoryDecorator.java#L155-L169
train
molgenis/molgenis
molgenis-data-index/src/main/java/org/molgenis/data/index/IndexedRepositoryDecorator.java
IndexedRepositoryDecorator.querySupported
private boolean querySupported(Query<Entity> q) { return !containsAnyOperator(q, unsupportedOperators) && !containsComputedAttribute(q, getEntityType()) && !containsNestedQueryRuleField(q); }
java
private boolean querySupported(Query<Entity> q) { return !containsAnyOperator(q, unsupportedOperators) && !containsComputedAttribute(q, getEntityType()) && !containsNestedQueryRuleField(q); }
[ "private", "boolean", "querySupported", "(", "Query", "<", "Entity", ">", "q", ")", "{", "return", "!", "containsAnyOperator", "(", "q", ",", "unsupportedOperators", ")", "&&", "!", "containsComputedAttribute", "(", "q", ",", "getEntityType", "(", ")", ")", ...
Checks if the underlying repository can handle this query. Queries with unsupported operators, queries that use attributes with computed values or queries with nested query rule field are delegated to the index.
[ "Checks", "if", "the", "underlying", "repository", "can", "handle", "this", "query", ".", "Queries", "with", "unsupported", "operators", "queries", "that", "use", "attributes", "with", "computed", "values", "or", "queries", "with", "nested", "query", "rule", "fi...
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-index/src/main/java/org/molgenis/data/index/IndexedRepositoryDecorator.java#L176-L180
train
molgenis/molgenis
molgenis-semantic-search/src/main/java/org/molgenis/semanticsearch/service/impl/OntologyTagServiceImpl.java
OntologyTagServiceImpl.updateEntityTypeEntityWithNewAttributeEntity
private void updateEntityTypeEntityWithNewAttributeEntity( String entity, String attribute, Entity attributeEntity) { EntityType entityEntity = dataService.getEntityType(entity); Iterable<Attribute> attributes = entityEntity.getOwnAllAttributes(); entityEntity.set( ATTRIBUTES, stream(a...
java
private void updateEntityTypeEntityWithNewAttributeEntity( String entity, String attribute, Entity attributeEntity) { EntityType entityEntity = dataService.getEntityType(entity); Iterable<Attribute> attributes = entityEntity.getOwnAllAttributes(); entityEntity.set( ATTRIBUTES, stream(a...
[ "private", "void", "updateEntityTypeEntityWithNewAttributeEntity", "(", "String", "entity", ",", "String", "attribute", ",", "Entity", "attributeEntity", ")", "{", "EntityType", "entityEntity", "=", "dataService", ".", "getEntityType", "(", "entity", ")", ";", "Iterab...
The attribute just got updated, but the entity does not know this yet. To reindex this document in elasticsearch, update it. @param entity name of the entity @param attribute the name of the attribute that got changed @param attributeEntity the entity of the attribute that got changed
[ "The", "attribute", "just", "got", "updated", "but", "the", "entity", "does", "not", "know", "this", "yet", ".", "To", "reindex", "this", "document", "in", "elasticsearch", "update", "it", "." ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-semantic-search/src/main/java/org/molgenis/semanticsearch/service/impl/OntologyTagServiceImpl.java#L242-L252
train
molgenis/molgenis
molgenis-file-ingester/src/main/java/org/molgenis/file/ingest/execution/FileIngester.java
FileIngester.ingest
public FileMeta ingest( String entityTypeId, String url, String loader, String jobExecutionID, Progress progress) { if (!"CSV".equals(loader)) { throw new FileIngestException("Unknown loader '" + loader + "'"); } progress.setProgressMax(2); progress.progress(0, "Downloading url '" + url + "...
java
public FileMeta ingest( String entityTypeId, String url, String loader, String jobExecutionID, Progress progress) { if (!"CSV".equals(loader)) { throw new FileIngestException("Unknown loader '" + loader + "'"); } progress.setProgressMax(2); progress.progress(0, "Downloading url '" + url + "...
[ "public", "FileMeta", "ingest", "(", "String", "entityTypeId", ",", "String", "url", ",", "String", "loader", ",", "String", "jobExecutionID", ",", "Progress", "progress", ")", "{", "if", "(", "!", "\"CSV\"", ".", "equals", "(", "loader", ")", ")", "{", ...
Imports a csv file defined in the fileIngest entity @see FileIngestJobExecutionMetadata
[ "Imports", "a", "csv", "file", "defined", "in", "the", "fileIngest", "entity" ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-file-ingester/src/main/java/org/molgenis/file/ingest/execution/FileIngester.java#L54-L83
train
molgenis/molgenis
molgenis-data-vcf/src/main/java/org/molgenis/data/vcf/utils/VcfUtils.java
VcfUtils.createId
public static String createId(Entity vcfEntity) { String idStr = StringUtils.strip(vcfEntity.get(CHROM).toString()) + "_" + StringUtils.strip(vcfEntity.get(POS).toString()) + "_" + StringUtils.strip(vcfEntity.get(REF).toString()) + "_" ...
java
public static String createId(Entity vcfEntity) { String idStr = StringUtils.strip(vcfEntity.get(CHROM).toString()) + "_" + StringUtils.strip(vcfEntity.get(POS).toString()) + "_" + StringUtils.strip(vcfEntity.get(REF).toString()) + "_" ...
[ "public", "static", "String", "createId", "(", "Entity", "vcfEntity", ")", "{", "String", "idStr", "=", "StringUtils", ".", "strip", "(", "vcfEntity", ".", "get", "(", "CHROM", ")", ".", "toString", "(", ")", ")", "+", "\"_\"", "+", "StringUtils", ".", ...
Creates a internal molgenis id from a vcf entity @return the id
[ "Creates", "a", "internal", "molgenis", "id", "from", "a", "vcf", "entity" ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-vcf/src/main/java/org/molgenis/data/vcf/utils/VcfUtils.java#L35-L63
train
molgenis/molgenis
molgenis-security/src/main/java/org/molgenis/security/twofactor/service/TwoFactorAuthenticationServiceImpl.java
TwoFactorAuthenticationServiceImpl.updateFailedLoginAttempts
private void updateFailedLoginAttempts(int numberOfAttempts) { UserSecret userSecret = getSecret(); userSecret.setFailedLoginAttempts(numberOfAttempts); if (userSecret.getFailedLoginAttempts() >= MAX_FAILED_LOGIN_ATTEMPTS) { if (!(userSecret.getLastFailedAuthentication() != null && (Instant....
java
private void updateFailedLoginAttempts(int numberOfAttempts) { UserSecret userSecret = getSecret(); userSecret.setFailedLoginAttempts(numberOfAttempts); if (userSecret.getFailedLoginAttempts() >= MAX_FAILED_LOGIN_ATTEMPTS) { if (!(userSecret.getLastFailedAuthentication() != null && (Instant....
[ "private", "void", "updateFailedLoginAttempts", "(", "int", "numberOfAttempts", ")", "{", "UserSecret", "userSecret", "=", "getSecret", "(", ")", ";", "userSecret", ".", "setFailedLoginAttempts", "(", "numberOfAttempts", ")", ";", "if", "(", "userSecret", ".", "ge...
Check if user has 3 or more failed login attempts -> then determine if the user is within the 30 seconds of the last failed login attempt -> if the user is not outside the timeframe than the failed login attempts are set to 1 because it is a failed login attempt When the user has less than 3 failed login attempts -> th...
[ "Check", "if", "user", "has", "3", "or", "more", "failed", "login", "attempts", "-", ">", "then", "determine", "if", "the", "user", "is", "within", "the", "30", "seconds", "of", "the", "last", "failed", "login", "attempt", "-", ">", "if", "the", "user"...
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-security/src/main/java/org/molgenis/security/twofactor/service/TwoFactorAuthenticationServiceImpl.java#L169-L185
train
molgenis/molgenis
molgenis-jobs/src/main/java/org/molgenis/jobs/JobExecutor.java
JobExecutor.submit
public CompletableFuture<Void> submit( JobExecution jobExecution, ExecutorService executorService) { overwriteJobExecutionUser(jobExecution); Job molgenisJob = saveExecutionAndCreateJob(jobExecution); Progress progress = jobExecutionRegistry.registerJobExecution(jobExecution); CompletableFuture<V...
java
public CompletableFuture<Void> submit( JobExecution jobExecution, ExecutorService executorService) { overwriteJobExecutionUser(jobExecution); Job molgenisJob = saveExecutionAndCreateJob(jobExecution); Progress progress = jobExecutionRegistry.registerJobExecution(jobExecution); CompletableFuture<V...
[ "public", "CompletableFuture", "<", "Void", ">", "submit", "(", "JobExecution", "jobExecution", ",", "ExecutorService", "executorService", ")", "{", "overwriteJobExecutionUser", "(", "jobExecution", ")", ";", "Job", "molgenisJob", "=", "saveExecutionAndCreateJob", "(", ...
Saves execution in the current thread, then creates a Job and submits that for asynchronous execution to a specific ExecutorService. @param jobExecution the {@link JobExecution} to save and submit. @param executorService the ExecutorService to run the submitted job on
[ "Saves", "execution", "in", "the", "current", "thread", "then", "creates", "a", "Job", "and", "submits", "that", "for", "asynchronous", "execution", "to", "a", "specific", "ExecutorService", "." ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-jobs/src/main/java/org/molgenis/jobs/JobExecutor.java#L116-L135
train
molgenis/molgenis
molgenis-js/src/main/java/org/molgenis/js/magma/JsMagmaScriptExecutor.java
JsMagmaScriptExecutor.executeScript
Object executeScript(String jsScript, Map<String, Object> parameters) { EntityType entityType = entityTypeFactory.create("entity"); Set<String> attributeNames = parameters.keySet(); attributeNames.forEach(key -> entityType.addAttribute(attributeFactory.create().setName(key))); if (attributeNames.iterato...
java
Object executeScript(String jsScript, Map<String, Object> parameters) { EntityType entityType = entityTypeFactory.create("entity"); Set<String> attributeNames = parameters.keySet(); attributeNames.forEach(key -> entityType.addAttribute(attributeFactory.create().setName(key))); if (attributeNames.iterato...
[ "Object", "executeScript", "(", "String", "jsScript", ",", "Map", "<", "String", ",", "Object", ">", "parameters", ")", "{", "EntityType", "entityType", "=", "entityTypeFactory", ".", "create", "(", "\"entity\"", ")", ";", "Set", "<", "String", ">", "attribu...
Execute a JavaScript using the Magma API
[ "Execute", "a", "JavaScript", "using", "the", "Magma", "API" ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-js/src/main/java/org/molgenis/js/magma/JsMagmaScriptExecutor.java#L31-L41
train
molgenis/molgenis
molgenis-data-csv/src/main/java/org/molgenis/data/csv/CsvWriter.java
CsvWriter.writeAttributes
public void writeAttributes(Iterable<Attribute> attributes) throws IOException { List<String> attributeNames = Lists.newArrayList(); List<String> attributeLabels = Lists.newArrayList(); for (Attribute attr : attributes) { attributeNames.add(attr.getName()); if (attr.getLabel() != null) { ...
java
public void writeAttributes(Iterable<Attribute> attributes) throws IOException { List<String> attributeNames = Lists.newArrayList(); List<String> attributeLabels = Lists.newArrayList(); for (Attribute attr : attributes) { attributeNames.add(attr.getName()); if (attr.getLabel() != null) { ...
[ "public", "void", "writeAttributes", "(", "Iterable", "<", "Attribute", ">", "attributes", ")", "throws", "IOException", "{", "List", "<", "String", ">", "attributeNames", "=", "Lists", ".", "newArrayList", "(", ")", ";", "List", "<", "String", ">", "attribu...
Use attribute labels as column names
[ "Use", "attribute", "labels", "as", "column", "names" ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-csv/src/main/java/org/molgenis/data/csv/CsvWriter.java#L103-L117
train
molgenis/molgenis
molgenis-semantic-mapper/src/main/java/org/molgenis/semanticmapper/controller/MappingServiceController.java
MappingServiceController.viewMappingProjects
@GetMapping public String viewMappingProjects(Model model) { model.addAttribute("mappingProjects", mappingService.getAllMappingProjects()); model.addAttribute("entityTypes", getWritableEntityTypes()); model.addAttribute("user", getCurrentUsername()); model.addAttribute("admin", currentUserIsSu()); ...
java
@GetMapping public String viewMappingProjects(Model model) { model.addAttribute("mappingProjects", mappingService.getAllMappingProjects()); model.addAttribute("entityTypes", getWritableEntityTypes()); model.addAttribute("user", getCurrentUsername()); model.addAttribute("admin", currentUserIsSu()); ...
[ "@", "GetMapping", "public", "String", "viewMappingProjects", "(", "Model", "model", ")", "{", "model", ".", "addAttribute", "(", "\"mappingProjects\"", ",", "mappingService", ".", "getAllMappingProjects", "(", ")", ")", ";", "model", ".", "addAttribute", "(", "...
Initializes the model with all mapping projects and all entities to the model. @param model the model to initialized @return view name of the mapping projects list
[ "Initializes", "the", "model", "with", "all", "mapping", "projects", "and", "all", "entities", "to", "the", "model", "." ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-semantic-mapper/src/main/java/org/molgenis/semanticmapper/controller/MappingServiceController.java#L154-L163
train
molgenis/molgenis
molgenis-semantic-mapper/src/main/java/org/molgenis/semanticmapper/controller/MappingServiceController.java
MappingServiceController.addMappingProject
@PostMapping("/addMappingProject") public String addMappingProject( @RequestParam("mapping-project-name") String name, @RequestParam("target-entity") String targetEntity, @RequestParam("depth") int depth) { MappingProject newMappingProject = mappingService.addMappingProject(name, targetEntity, d...
java
@PostMapping("/addMappingProject") public String addMappingProject( @RequestParam("mapping-project-name") String name, @RequestParam("target-entity") String targetEntity, @RequestParam("depth") int depth) { MappingProject newMappingProject = mappingService.addMappingProject(name, targetEntity, d...
[ "@", "PostMapping", "(", "\"/addMappingProject\"", ")", "public", "String", "addMappingProject", "(", "@", "RequestParam", "(", "\"mapping-project-name\"", ")", "String", "name", ",", "@", "RequestParam", "(", "\"target-entity\"", ")", "String", "targetEntity", ",", ...
Adds a new mapping project. @param name name of the mapping project @param targetEntity name of the project's first {@link MappingTarget}'s target entity @return redirect URL for the newly created mapping project
[ "Adds", "a", "new", "mapping", "project", "." ]
b4d0d6b27e6f6c8d7505a3863dc03b589601f987
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-semantic-mapper/src/main/java/org/molgenis/semanticmapper/controller/MappingServiceController.java#L172-L182
train