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
stevespringett/Alpine
alpine/src/main/java/alpine/crypto/DataEncryption.java
DataEncryption.encryptAsBytes
public static byte[] encryptAsBytes(final String plainText) throws Exception { final SecretKey secretKey = KeyManager.getInstance().getSecretKey(); return encryptAsBytes(secretKey, plainText); }
java
public static byte[] encryptAsBytes(final String plainText) throws Exception { final SecretKey secretKey = KeyManager.getInstance().getSecretKey(); return encryptAsBytes(secretKey, plainText); }
[ "public", "static", "byte", "[", "]", "encryptAsBytes", "(", "final", "String", "plainText", ")", "throws", "Exception", "{", "final", "SecretKey", "secretKey", "=", "KeyManager", ".", "getInstance", "(", ")", ".", "getSecretKey", "(", ")", ";", "return", "e...
Encrypts the specified plainText using AES-256. This method uses the default secret key. @param plainText the text to encrypt @return the encrypted bytes @throws Exception a number of exceptions may be thrown @since 1.3.0
[ "Encrypts", "the", "specified", "plainText", "using", "AES", "-", "256", ".", "This", "method", "uses", "the", "default", "secret", "key", "." ]
6c5ef5e1ba4f38922096f1307d3950c09edb3093
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/crypto/DataEncryption.java#L81-L84
train
stevespringett/Alpine
alpine/src/main/java/alpine/crypto/DataEncryption.java
DataEncryption.encryptAsString
public static String encryptAsString(final SecretKey secretKey, final String plainText) throws Exception { return Base64.getEncoder().encodeToString(encryptAsBytes(secretKey, plainText)); }
java
public static String encryptAsString(final SecretKey secretKey, final String plainText) throws Exception { return Base64.getEncoder().encodeToString(encryptAsBytes(secretKey, plainText)); }
[ "public", "static", "String", "encryptAsString", "(", "final", "SecretKey", "secretKey", ",", "final", "String", "plainText", ")", "throws", "Exception", "{", "return", "Base64", ".", "getEncoder", "(", ")", ".", "encodeToString", "(", "encryptAsBytes", "(", "se...
Encrypts the specified plainText using AES-256 and returns a Base64 encoded representation of the encrypted bytes. @param secretKey the secret key to use to encrypt with @param plainText the text to encrypt @return a Base64 encoded representation of the encrypted bytes @throws Exception a number of exceptions may be th...
[ "Encrypts", "the", "specified", "plainText", "using", "AES", "-", "256", "and", "returns", "a", "Base64", "encoded", "representation", "of", "the", "encrypted", "bytes", "." ]
6c5ef5e1ba4f38922096f1307d3950c09edb3093
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/crypto/DataEncryption.java#L95-L97
train
stevespringett/Alpine
alpine/src/main/java/alpine/crypto/DataEncryption.java
DataEncryption.decryptAsBytes
public static byte[] decryptAsBytes(final SecretKey secretKey, final byte[] encryptedIvTextBytes) throws Exception { int ivSize = 16; // Extract IV final byte[] iv = new byte[ivSize]; System.arraycopy(encryptedIvTextBytes, 0, iv, 0, iv.length); final IvParameterSpec ivParameterS...
java
public static byte[] decryptAsBytes(final SecretKey secretKey, final byte[] encryptedIvTextBytes) throws Exception { int ivSize = 16; // Extract IV final byte[] iv = new byte[ivSize]; System.arraycopy(encryptedIvTextBytes, 0, iv, 0, iv.length); final IvParameterSpec ivParameterS...
[ "public", "static", "byte", "[", "]", "decryptAsBytes", "(", "final", "SecretKey", "secretKey", ",", "final", "byte", "[", "]", "encryptedIvTextBytes", ")", "throws", "Exception", "{", "int", "ivSize", "=", "16", ";", "// Extract IV", "final", "byte", "[", "...
Decrypts the specified bytes using AES-256. @param secretKey the secret key to decrypt with @param encryptedIvTextBytes the text to decrypt @return the decrypted bytes @throws Exception a number of exceptions may be thrown @since 1.3.0
[ "Decrypts", "the", "specified", "bytes", "using", "AES", "-", "256", "." ]
6c5ef5e1ba4f38922096f1307d3950c09edb3093
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/crypto/DataEncryption.java#L119-L136
train
stevespringett/Alpine
alpine/src/main/java/alpine/crypto/DataEncryption.java
DataEncryption.decryptAsBytes
public static byte[] decryptAsBytes(final byte[] encryptedIvTextBytes) throws Exception { final SecretKey secretKey = KeyManager.getInstance().getSecretKey(); return decryptAsBytes(secretKey, encryptedIvTextBytes); }
java
public static byte[] decryptAsBytes(final byte[] encryptedIvTextBytes) throws Exception { final SecretKey secretKey = KeyManager.getInstance().getSecretKey(); return decryptAsBytes(secretKey, encryptedIvTextBytes); }
[ "public", "static", "byte", "[", "]", "decryptAsBytes", "(", "final", "byte", "[", "]", "encryptedIvTextBytes", ")", "throws", "Exception", "{", "final", "SecretKey", "secretKey", "=", "KeyManager", ".", "getInstance", "(", ")", ".", "getSecretKey", "(", ")", ...
Decrypts the specified bytes using AES-256. This method uses the default secret key. @param encryptedIvTextBytes the text to decrypt @return the decrypted bytes @throws Exception a number of exceptions may be thrown @since 1.3.0
[ "Decrypts", "the", "specified", "bytes", "using", "AES", "-", "256", ".", "This", "method", "uses", "the", "default", "secret", "key", "." ]
6c5ef5e1ba4f38922096f1307d3950c09edb3093
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/crypto/DataEncryption.java#L145-L148
train
stevespringett/Alpine
alpine/src/main/java/alpine/util/Pageable.java
Pageable.setCurrentPage
private void setCurrentPage(int page) { if (page >= totalPages) { this.currentPage = totalPages; } else if (page <= 1) { this.currentPage = 1; } else { this.currentPage = page; } // now work out where the sub-list should start and end ...
java
private void setCurrentPage(int page) { if (page >= totalPages) { this.currentPage = totalPages; } else if (page <= 1) { this.currentPage = 1; } else { this.currentPage = page; } // now work out where the sub-list should start and end ...
[ "private", "void", "setCurrentPage", "(", "int", "page", ")", "{", "if", "(", "page", ">=", "totalPages", ")", "{", "this", ".", "currentPage", "=", "totalPages", ";", "}", "else", "if", "(", "page", "<=", "1", ")", "{", "this", ".", "currentPage", "...
Specifies a specific page to jump to. @param page the page to jump to
[ "Specifies", "a", "specific", "page", "to", "jump", "to", "." ]
6c5ef5e1ba4f38922096f1307d3950c09edb3093
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/util/Pageable.java#L133-L151
train
stevespringett/Alpine
alpine/src/main/java/alpine/util/HttpUtil.java
HttpUtil.getSessionAttribute
@SuppressWarnings("unchecked") public static <T> T getSessionAttribute(final HttpSession session, final String key) { if (session != null) { return (T) session.getAttribute(key); } return null; }
java
@SuppressWarnings("unchecked") public static <T> T getSessionAttribute(final HttpSession session, final String key) { if (session != null) { return (T) session.getAttribute(key); } return null; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "T", ">", "T", "getSessionAttribute", "(", "final", "HttpSession", "session", ",", "final", "String", "key", ")", "{", "if", "(", "session", "!=", "null", ")", "{", "return", "(",...
Returns a session attribute as the type of object stored. @param session session where the attribute is stored @param key the attributes key @param <T> the type of object expected @return the requested object @since 1.0.0
[ "Returns", "a", "session", "attribute", "as", "the", "type", "of", "object", "stored", "." ]
6c5ef5e1ba4f38922096f1307d3950c09edb3093
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/util/HttpUtil.java#L41-L47
train
stevespringett/Alpine
alpine/src/main/java/alpine/util/HttpUtil.java
HttpUtil.getRequestAttribute
@SuppressWarnings("unchecked") public static <T> T getRequestAttribute(final HttpServletRequest request, final String key) { if (request != null) { return (T) request.getAttribute(key); } return null; }
java
@SuppressWarnings("unchecked") public static <T> T getRequestAttribute(final HttpServletRequest request, final String key) { if (request != null) { return (T) request.getAttribute(key); } return null; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "T", ">", "T", "getRequestAttribute", "(", "final", "HttpServletRequest", "request", ",", "final", "String", "key", ")", "{", "if", "(", "request", "!=", "null", ")", "{", "return",...
Returns a request attribute as the type of object stored. @param request request of the attribute @param key the attributes key @param <T> the type of the object expected @return the requested object @since 1.0.0
[ "Returns", "a", "request", "attribute", "as", "the", "type", "of", "object", "stored", "." ]
6c5ef5e1ba4f38922096f1307d3950c09edb3093
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/util/HttpUtil.java#L58-L64
train
stevespringett/Alpine
alpine/src/main/java/alpine/util/MapperUtil.java
MapperUtil.readAsObjectOf
public static <T> T readAsObjectOf(Class<T> clazz, String value) { final ObjectMapper mapper = new ObjectMapper(); try { return mapper.readValue(value, clazz); } catch (IOException e) { LOGGER.error(e.getMessage(), e.fillInStackTrace()); } return null; ...
java
public static <T> T readAsObjectOf(Class<T> clazz, String value) { final ObjectMapper mapper = new ObjectMapper(); try { return mapper.readValue(value, clazz); } catch (IOException e) { LOGGER.error(e.getMessage(), e.fillInStackTrace()); } return null; ...
[ "public", "static", "<", "T", ">", "T", "readAsObjectOf", "(", "Class", "<", "T", ">", "clazz", ",", "String", "value", ")", "{", "final", "ObjectMapper", "mapper", "=", "new", "ObjectMapper", "(", ")", ";", "try", "{", "return", "mapper", ".", "readVa...
Reads in a String value and returns the object for which it represents. @param clazz The expected class of the value @param value the value to parse @param <T> The expected type to return @return the mapped object
[ "Reads", "in", "a", "String", "value", "and", "returns", "the", "object", "for", "which", "it", "represents", "." ]
6c5ef5e1ba4f38922096f1307d3950c09edb3093
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/util/MapperUtil.java#L46-L54
train
stevespringett/Alpine
alpine/src/main/java/alpine/auth/JsonWebToken.java
JsonWebToken.validateToken
public boolean validateToken(final String token) { try { final JwtParser jwtParser = Jwts.parser().setSigningKey(key); jwtParser.parse(token); this.subject = jwtParser.parseClaimsJws(token).getBody().getSubject(); this.expiration = jwtParser.parseClaimsJws(token)....
java
public boolean validateToken(final String token) { try { final JwtParser jwtParser = Jwts.parser().setSigningKey(key); jwtParser.parse(token); this.subject = jwtParser.parseClaimsJws(token).getBody().getSubject(); this.expiration = jwtParser.parseClaimsJws(token)....
[ "public", "boolean", "validateToken", "(", "final", "String", "token", ")", "{", "try", "{", "final", "JwtParser", "jwtParser", "=", "Jwts", ".", "parser", "(", ")", ".", "setSigningKey", "(", "key", ")", ";", "jwtParser", ".", "parse", "(", "token", ")"...
Validates a JWT by ensuring the signature matches and validates against the SecretKey and checks the expiration date. @param token the token to validate @return true if validation successful, false if not @since 1.0.0
[ "Validates", "a", "JWT", "by", "ensuring", "the", "signature", "matches", "and", "validates", "against", "the", "SecretKey", "and", "checks", "the", "expiration", "date", "." ]
6c5ef5e1ba4f38922096f1307d3950c09edb3093
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/auth/JsonWebToken.java#L149-L167
train
stevespringett/Alpine
alpine/src/main/java/alpine/auth/JsonWebToken.java
JsonWebToken.addDays
private Date addDays(final Date date, final int days) { final Calendar cal = Calendar.getInstance(); cal.setTime(date); cal.add(Calendar.DATE, days); //minus number would decrement the days return cal.getTime(); }
java
private Date addDays(final Date date, final int days) { final Calendar cal = Calendar.getInstance(); cal.setTime(date); cal.add(Calendar.DATE, days); //minus number would decrement the days return cal.getTime(); }
[ "private", "Date", "addDays", "(", "final", "Date", "date", ",", "final", "int", "days", ")", "{", "final", "Calendar", "cal", "=", "Calendar", ".", "getInstance", "(", ")", ";", "cal", ".", "setTime", "(", "date", ")", ";", "cal", ".", "add", "(", ...
Create a new future Date from the specified Date. @param date The date to base the future date from @param days The number of dates to + offset @return a future date
[ "Create", "a", "new", "future", "Date", "from", "the", "specified", "Date", "." ]
6c5ef5e1ba4f38922096f1307d3950c09edb3093
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/auth/JsonWebToken.java#L176-L181
train
stevespringett/Alpine
alpine/src/main/java/alpine/event/framework/AbstractChainableEvent.java
AbstractChainableEvent.linkChainIdentifier
private Event linkChainIdentifier(Event event) { if (event instanceof ChainableEvent) { ChainableEvent chainableEvent = (ChainableEvent)event; chainableEvent.setChainIdentifier(this.getChainIdentifier()); return chainableEvent; } return event; }
java
private Event linkChainIdentifier(Event event) { if (event instanceof ChainableEvent) { ChainableEvent chainableEvent = (ChainableEvent)event; chainableEvent.setChainIdentifier(this.getChainIdentifier()); return chainableEvent; } return event; }
[ "private", "Event", "linkChainIdentifier", "(", "Event", "event", ")", "{", "if", "(", "event", "instanceof", "ChainableEvent", ")", "{", "ChainableEvent", "chainableEvent", "=", "(", "ChainableEvent", ")", "event", ";", "chainableEvent", ".", "setChainIdentifier", ...
Assigns the chain identifier for the specified event to the chain identifier value of this instance. This requires the specified event to be an instance of ChainableEvent. @param event the event to chain @return a chained event
[ "Assigns", "the", "chain", "identifier", "for", "the", "specified", "event", "to", "the", "chain", "identifier", "value", "of", "this", "instance", ".", "This", "requires", "the", "specified", "event", "to", "be", "an", "instance", "of", "ChainableEvent", "." ...
6c5ef5e1ba4f38922096f1307d3950c09edb3093
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/event/framework/AbstractChainableEvent.java#L135-L142
train
stevespringett/Alpine
alpine/src/main/java/alpine/upgrade/UpgradeExecutor.java
UpgradeExecutor.executeUpgrades
public void executeUpgrades(final List<Class<? extends UpgradeItem>> classes) throws UpgradeException { final Connection connection = getConnection(qm); final UpgradeMetaProcessor installedUpgrades = new UpgradeMetaProcessor(connection); DbUtil.initPlatformName(connection); // Initialize DbUtil ...
java
public void executeUpgrades(final List<Class<? extends UpgradeItem>> classes) throws UpgradeException { final Connection connection = getConnection(qm); final UpgradeMetaProcessor installedUpgrades = new UpgradeMetaProcessor(connection); DbUtil.initPlatformName(connection); // Initialize DbUtil ...
[ "public", "void", "executeUpgrades", "(", "final", "List", "<", "Class", "<", "?", "extends", "UpgradeItem", ">", ">", "classes", ")", "throws", "UpgradeException", "{", "final", "Connection", "connection", "=", "getConnection", "(", "qm", ")", ";", "final", ...
Performs the execution of upgrades in the order defined by the specified array. @param classes the upgrade classes @throws UpgradeException if errors are encountered @since 1.2.0
[ "Performs", "the", "execution", "of", "upgrades", "in", "the", "order", "defined", "by", "the", "specified", "array", "." ]
6c5ef5e1ba4f38922096f1307d3950c09edb3093
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/upgrade/UpgradeExecutor.java#L62-L103
train
stevespringett/Alpine
alpine/src/main/java/alpine/upgrade/UpgradeExecutor.java
UpgradeExecutor.getConnection
private Connection getConnection(AlpineQueryManager aqm) { final JDOConnection jdoConnection = aqm.getPersistenceManager().getDataStoreConnection(); if (jdoConnection != null) { if (jdoConnection.getNativeConnection() instanceof Connection) { return (Connection)jdoConnection....
java
private Connection getConnection(AlpineQueryManager aqm) { final JDOConnection jdoConnection = aqm.getPersistenceManager().getDataStoreConnection(); if (jdoConnection != null) { if (jdoConnection.getNativeConnection() instanceof Connection) { return (Connection)jdoConnection....
[ "private", "Connection", "getConnection", "(", "AlpineQueryManager", "aqm", ")", "{", "final", "JDOConnection", "jdoConnection", "=", "aqm", ".", "getPersistenceManager", "(", ")", ".", "getDataStoreConnection", "(", ")", ";", "if", "(", "jdoConnection", "!=", "nu...
This connection should never be closed.
[ "This", "connection", "should", "never", "be", "closed", "." ]
6c5ef5e1ba4f38922096f1307d3950c09edb3093
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/upgrade/UpgradeExecutor.java#L108-L116
train
stevespringett/Alpine
alpine/src/main/java/alpine/util/UuidUtil.java
UuidUtil.isValidUUID
public static boolean isValidUUID(String uuid) { return !StringUtils.isEmpty(uuid) && UUID_PATTERN.matcher(uuid).matches(); }
java
public static boolean isValidUUID(String uuid) { return !StringUtils.isEmpty(uuid) && UUID_PATTERN.matcher(uuid).matches(); }
[ "public", "static", "boolean", "isValidUUID", "(", "String", "uuid", ")", "{", "return", "!", "StringUtils", ".", "isEmpty", "(", "uuid", ")", "&&", "UUID_PATTERN", ".", "matcher", "(", "uuid", ")", ".", "matches", "(", ")", ";", "}" ]
Determines if the specified string is a valid UUID. @param uuid the UUID to evaluate @return true if UUID is valid, false if invalid @since 1.0.0
[ "Determines", "if", "the", "specified", "string", "is", "a", "valid", "UUID", "." ]
6c5ef5e1ba4f38922096f1307d3950c09edb3093
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/util/UuidUtil.java#L65-L67
train
stevespringett/Alpine
alpine/src/main/java/alpine/auth/LdapAuthenticationService.java
LdapAuthenticationService.autoProvision
private LdapUser autoProvision(final AlpineQueryManager qm) throws AlpineAuthenticationException { LOGGER.debug("Provisioning: " + username); LdapUser user = null; final LdapConnectionWrapper ldap = new LdapConnectionWrapper(); DirContext dirContext = null; try { dirC...
java
private LdapUser autoProvision(final AlpineQueryManager qm) throws AlpineAuthenticationException { LOGGER.debug("Provisioning: " + username); LdapUser user = null; final LdapConnectionWrapper ldap = new LdapConnectionWrapper(); DirContext dirContext = null; try { dirC...
[ "private", "LdapUser", "autoProvision", "(", "final", "AlpineQueryManager", "qm", ")", "throws", "AlpineAuthenticationException", "{", "LOGGER", ".", "debug", "(", "\"Provisioning: \"", "+", "username", ")", ";", "LdapUser", "user", "=", "null", ";", "final", "Lda...
Automatically creates an LdapUser, sets the value of various LDAP attributes, and persists the user to the database. @param qm the query manager to use @return the persisted LdapUser object @throws AlpineAuthenticationException if an exception occurs @since 1.4.0
[ "Automatically", "creates", "an", "LdapUser", "sets", "the", "value", "of", "various", "LDAP", "attributes", "and", "persists", "the", "user", "to", "the", "database", "." ]
6c5ef5e1ba4f38922096f1307d3950c09edb3093
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/auth/LdapAuthenticationService.java#L106-L136
train
stevespringett/Alpine
alpine/src/main/java/alpine/auth/LdapAuthenticationService.java
LdapAuthenticationService.validateCredentials
private boolean validateCredentials() { LOGGER.debug("Validating credentials for: " + username); final LdapConnectionWrapper ldap = new LdapConnectionWrapper(); DirContext dirContext = null; LdapContext ldapContext = null; try (AlpineQueryManager qm = new AlpineQueryManager()) { ...
java
private boolean validateCredentials() { LOGGER.debug("Validating credentials for: " + username); final LdapConnectionWrapper ldap = new LdapConnectionWrapper(); DirContext dirContext = null; LdapContext ldapContext = null; try (AlpineQueryManager qm = new AlpineQueryManager()) { ...
[ "private", "boolean", "validateCredentials", "(", ")", "{", "LOGGER", ".", "debug", "(", "\"Validating credentials for: \"", "+", "username", ")", ";", "final", "LdapConnectionWrapper", "ldap", "=", "new", "LdapConnectionWrapper", "(", ")", ";", "DirContext", "dirCo...
Asserts a users credentials. Returns a boolean value indicating if assertion was successful or not. @return true if assertion was successful, false if not @since 1.0.0
[ "Asserts", "a", "users", "credentials", ".", "Returns", "a", "boolean", "value", "indicating", "if", "assertion", "was", "successful", "or", "not", "." ]
6c5ef5e1ba4f38922096f1307d3950c09edb3093
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/auth/LdapAuthenticationService.java#L145-L172
train
stevespringett/Alpine
alpine/src/main/java/alpine/persistence/PersistenceManagerFactory.java
PersistenceManagerFactory.createPersistenceManager
public static PersistenceManager createPersistenceManager() { if (Config.isUnitTestsEnabled()) { pmf = (JDOPersistenceManagerFactory)JDOHelper.getPersistenceManagerFactory(JdoProperties.unit(), "Alpine"); } if (pmf == null) { throw new IllegalStateException("Context is no...
java
public static PersistenceManager createPersistenceManager() { if (Config.isUnitTestsEnabled()) { pmf = (JDOPersistenceManagerFactory)JDOHelper.getPersistenceManagerFactory(JdoProperties.unit(), "Alpine"); } if (pmf == null) { throw new IllegalStateException("Context is no...
[ "public", "static", "PersistenceManager", "createPersistenceManager", "(", ")", "{", "if", "(", "Config", ".", "isUnitTestsEnabled", "(", ")", ")", "{", "pmf", "=", "(", "JDOPersistenceManagerFactory", ")", "JDOHelper", ".", "getPersistenceManagerFactory", "(", "Jdo...
Creates a new JDO PersistenceManager. @return a PersistenceManager
[ "Creates", "a", "new", "JDO", "PersistenceManager", "." ]
6c5ef5e1ba4f38922096f1307d3950c09edb3093
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/persistence/PersistenceManagerFactory.java#L76-L84
train
stevespringett/Alpine
alpine/src/main/java/alpine/auth/LdapConnectionWrapper.java
LdapConnectionWrapper.createLdapContext
public LdapContext createLdapContext(final String userDn, final String password) throws NamingException { LOGGER.debug("Creating LDAP context for: " +userDn); if (StringUtils.isEmpty(userDn) || StringUtils.isEmpty(password)) { throw new NamingException("Username or password cannot be empty o...
java
public LdapContext createLdapContext(final String userDn, final String password) throws NamingException { LOGGER.debug("Creating LDAP context for: " +userDn); if (StringUtils.isEmpty(userDn) || StringUtils.isEmpty(password)) { throw new NamingException("Username or password cannot be empty o...
[ "public", "LdapContext", "createLdapContext", "(", "final", "String", "userDn", ",", "final", "String", "password", ")", "throws", "NamingException", "{", "LOGGER", ".", "debug", "(", "\"Creating LDAP context for: \"", "+", "userDn", ")", ";", "if", "(", "StringUt...
Asserts a users credentials. Returns an LdapContext if assertion is successful or an exception for any other reason. @param userDn the users DN to assert @param password the password to assert @return the LdapContext upon a successful connection @throws NamingException when unable to establish a connection @since 1.4....
[ "Asserts", "a", "users", "credentials", ".", "Returns", "an", "LdapContext", "if", "assertion", "is", "successful", "or", "an", "exception", "for", "any", "other", "reason", "." ]
6c5ef5e1ba4f38922096f1307d3950c09edb3093
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/auth/LdapConnectionWrapper.java#L82-L106
train
stevespringett/Alpine
alpine/src/main/java/alpine/auth/LdapConnectionWrapper.java
LdapConnectionWrapper.createDirContext
public DirContext createDirContext() throws NamingException { LOGGER.debug("Creating directory service context (DirContext)"); final Hashtable<String, String> env = new Hashtable<>(); env.put(Context.SECURITY_PRINCIPAL, BIND_USERNAME); env.put(Context.SECURITY_CREDENTIALS, BIND_PASSWORD)...
java
public DirContext createDirContext() throws NamingException { LOGGER.debug("Creating directory service context (DirContext)"); final Hashtable<String, String> env = new Hashtable<>(); env.put(Context.SECURITY_PRINCIPAL, BIND_USERNAME); env.put(Context.SECURITY_CREDENTIALS, BIND_PASSWORD)...
[ "public", "DirContext", "createDirContext", "(", ")", "throws", "NamingException", "{", "LOGGER", ".", "debug", "(", "\"Creating directory service context (DirContext)\"", ")", ";", "final", "Hashtable", "<", "String", ",", "String", ">", "env", "=", "new", "Hashtab...
Creates a DirContext with the applications configuration settings. @return a DirContext @throws NamingException if an exception is thrown @since 1.4.0
[ "Creates", "a", "DirContext", "with", "the", "applications", "configuration", "settings", "." ]
6c5ef5e1ba4f38922096f1307d3950c09edb3093
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/auth/LdapConnectionWrapper.java#L114-L125
train
stevespringett/Alpine
alpine/src/main/java/alpine/auth/LdapConnectionWrapper.java
LdapConnectionWrapper.getGroups
public List<String> getGroups(final DirContext dirContext, final LdapUser ldapUser) throws NamingException { LOGGER.debug("Retrieving groups for: " + ldapUser.getDN()); final List<String> groupDns = new ArrayList<>(); final String searchFilter = variableSubstitution(USER_GROUPS_FILTER, ldapUser)...
java
public List<String> getGroups(final DirContext dirContext, final LdapUser ldapUser) throws NamingException { LOGGER.debug("Retrieving groups for: " + ldapUser.getDN()); final List<String> groupDns = new ArrayList<>(); final String searchFilter = variableSubstitution(USER_GROUPS_FILTER, ldapUser)...
[ "public", "List", "<", "String", ">", "getGroups", "(", "final", "DirContext", "dirContext", ",", "final", "LdapUser", "ldapUser", ")", "throws", "NamingException", "{", "LOGGER", ".", "debug", "(", "\"Retrieving groups for: \"", "+", "ldapUser", ".", "getDN", "...
Retrieves a list of all groups the user is a member of. @param dirContext a DirContext @param ldapUser the LdapUser to retrieve group membership for @return A list of Strings representing the fully qualified DN of each group @throws NamingException if an exception is thrown @since 1.4.0
[ "Retrieves", "a", "list", "of", "all", "groups", "the", "user", "is", "a", "member", "of", "." ]
6c5ef5e1ba4f38922096f1307d3950c09edb3093
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/auth/LdapConnectionWrapper.java#L135-L149
train
stevespringett/Alpine
alpine/src/main/java/alpine/auth/LdapConnectionWrapper.java
LdapConnectionWrapper.getGroups
public List<String> getGroups(final DirContext dirContext) throws NamingException { LOGGER.debug("Retrieving all groups"); final List<String> groupDns = new ArrayList<>(); final SearchControls sc = new SearchControls(); sc.setSearchScope(SearchControls.SUBTREE_SCOPE); final Namin...
java
public List<String> getGroups(final DirContext dirContext) throws NamingException { LOGGER.debug("Retrieving all groups"); final List<String> groupDns = new ArrayList<>(); final SearchControls sc = new SearchControls(); sc.setSearchScope(SearchControls.SUBTREE_SCOPE); final Namin...
[ "public", "List", "<", "String", ">", "getGroups", "(", "final", "DirContext", "dirContext", ")", "throws", "NamingException", "{", "LOGGER", ".", "debug", "(", "\"Retrieving all groups\"", ")", ";", "final", "List", "<", "String", ">", "groupDns", "=", "new",...
Retrieves a list of all the groups in the directory. @param dirContext a DirContext @return A list of Strings representing the fully qualified DN of each group @throws NamingException if an exception if thrown @since 1.4.0
[ "Retrieves", "a", "list", "of", "all", "the", "groups", "in", "the", "directory", "." ]
6c5ef5e1ba4f38922096f1307d3950c09edb3093
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/auth/LdapConnectionWrapper.java#L158-L171
train
stevespringett/Alpine
alpine/src/main/java/alpine/auth/LdapConnectionWrapper.java
LdapConnectionWrapper.getAttribute
public String getAttribute(final DirContext ctx, final String dn, final String attributeName) throws NamingException { final Attributes attributes = ctx.getAttributes(dn); return getAttribute(attributes, attributeName); }
java
public String getAttribute(final DirContext ctx, final String dn, final String attributeName) throws NamingException { final Attributes attributes = ctx.getAttributes(dn); return getAttribute(attributes, attributeName); }
[ "public", "String", "getAttribute", "(", "final", "DirContext", "ctx", ",", "final", "String", "dn", ",", "final", "String", "attributeName", ")", "throws", "NamingException", "{", "final", "Attributes", "attributes", "=", "ctx", ".", "getAttributes", "(", "dn",...
Retrieves an attribute by its name for the specified dn. @param ctx the DirContext to use @param dn the distinguished name of the entry to obtain the attribute value for @param attributeName the name of the attribute to return @return the value of the attribute, or null if not found @throws NamingException if an except...
[ "Retrieves", "an", "attribute", "by", "its", "name", "for", "the", "specified", "dn", "." ]
6c5ef5e1ba4f38922096f1307d3950c09edb3093
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/auth/LdapConnectionWrapper.java#L225-L228
train
stevespringett/Alpine
alpine/src/main/java/alpine/auth/LdapConnectionWrapper.java
LdapConnectionWrapper.getAttribute
public String getAttribute(final SearchResult result, final String attributeName) throws NamingException { return getAttribute(result.getAttributes(), attributeName); }
java
public String getAttribute(final SearchResult result, final String attributeName) throws NamingException { return getAttribute(result.getAttributes(), attributeName); }
[ "public", "String", "getAttribute", "(", "final", "SearchResult", "result", ",", "final", "String", "attributeName", ")", "throws", "NamingException", "{", "return", "getAttribute", "(", "result", ".", "getAttributes", "(", ")", ",", "attributeName", ")", ";", "...
Retrieves an attribute by its name for the specified search result. @param result the search result of the entry to obtain the attribute value for @param attributeName the name of the attribute to return @return the value of the attribute, or null if not found @throws NamingException if an exception is thrown @since 1....
[ "Retrieves", "an", "attribute", "by", "its", "name", "for", "the", "specified", "search", "result", "." ]
6c5ef5e1ba4f38922096f1307d3950c09edb3093
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/auth/LdapConnectionWrapper.java#L238-L240
train
stevespringett/Alpine
alpine/src/main/java/alpine/auth/LdapConnectionWrapper.java
LdapConnectionWrapper.getAttribute
public String getAttribute(final Attributes attributes, final String attributeName) throws NamingException { if (attributes == null || attributes.size() == 0) { return null; } else { final Attribute attribute = attributes.get(attributeName); if (attribute != null) { ...
java
public String getAttribute(final Attributes attributes, final String attributeName) throws NamingException { if (attributes == null || attributes.size() == 0) { return null; } else { final Attribute attribute = attributes.get(attributeName); if (attribute != null) { ...
[ "public", "String", "getAttribute", "(", "final", "Attributes", "attributes", ",", "final", "String", "attributeName", ")", "throws", "NamingException", "{", "if", "(", "attributes", "==", "null", "||", "attributes", ".", "size", "(", ")", "==", "0", ")", "{...
Retrieves an attribute by its name. @param attributes the list of attributes to query on @param attributeName the name of the attribute to return @return the value of the attribute, or null if not found @throws NamingException if an exception is thrown @since 1.4.0
[ "Retrieves", "an", "attribute", "by", "its", "name", "." ]
6c5ef5e1ba4f38922096f1307d3950c09edb3093
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/auth/LdapConnectionWrapper.java#L250-L263
train
stevespringett/Alpine
alpine/src/main/java/alpine/auth/LdapConnectionWrapper.java
LdapConnectionWrapper.formatPrincipal
private static String formatPrincipal(final String username) { if (StringUtils.isNotBlank(LDAP_AUTH_USERNAME_FMT)) { return String.format(LDAP_AUTH_USERNAME_FMT, username); } return username; }
java
private static String formatPrincipal(final String username) { if (StringUtils.isNotBlank(LDAP_AUTH_USERNAME_FMT)) { return String.format(LDAP_AUTH_USERNAME_FMT, username); } return username; }
[ "private", "static", "String", "formatPrincipal", "(", "final", "String", "username", ")", "{", "if", "(", "StringUtils", ".", "isNotBlank", "(", "LDAP_AUTH_USERNAME_FMT", ")", ")", "{", "return", "String", ".", "format", "(", "LDAP_AUTH_USERNAME_FMT", ",", "use...
Formats the principal in username@domain format or in a custom format if is specified in the config file. If LDAP_AUTH_USERNAME_FMT is configured to a non-empty value, the substring %s in this value will be replaced with the entered username. The recommended format of this value depends on your LDAP server(Active Direc...
[ "Formats", "the", "principal", "in", "username" ]
6c5ef5e1ba4f38922096f1307d3950c09edb3093
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/auth/LdapConnectionWrapper.java#L276-L281
train
stevespringett/Alpine
alpine/src/main/java/alpine/util/GravatarUtil.java
GravatarUtil.generateHash
public static String generateHash(String emailAddress) { if (StringUtils.isBlank(emailAddress)) { return null; } return DigestUtils.md5Hex(emailAddress.trim().toLowerCase()).toLowerCase(); }
java
public static String generateHash(String emailAddress) { if (StringUtils.isBlank(emailAddress)) { return null; } return DigestUtils.md5Hex(emailAddress.trim().toLowerCase()).toLowerCase(); }
[ "public", "static", "String", "generateHash", "(", "String", "emailAddress", ")", "{", "if", "(", "StringUtils", ".", "isBlank", "(", "emailAddress", ")", ")", "{", "return", "null", ";", "}", "return", "DigestUtils", ".", "md5Hex", "(", "emailAddress", ".",...
Generates a hash value from the specified email address. Returns null if emailAddress is empty or null. @param emailAddress the email address to generate a hash from @return a hash value of the specified email address @since 1.0.0
[ "Generates", "a", "hash", "value", "from", "the", "specified", "email", "address", ".", "Returns", "null", "if", "emailAddress", "is", "empty", "or", "null", "." ]
6c5ef5e1ba4f38922096f1307d3950c09edb3093
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/util/GravatarUtil.java#L44-L49
train
stevespringett/Alpine
alpine/src/main/java/alpine/util/GravatarUtil.java
GravatarUtil.getGravatarUrl
public static String getGravatarUrl(String emailAddress) { String hash = generateHash(emailAddress); if (hash == null) { return "https://www.gravatar.com/avatar/00000000000000000000000000000000" + ".jpg?d=mm"; } else { return "https://www.gravatar.com/avatar/" + hash + "....
java
public static String getGravatarUrl(String emailAddress) { String hash = generateHash(emailAddress); if (hash == null) { return "https://www.gravatar.com/avatar/00000000000000000000000000000000" + ".jpg?d=mm"; } else { return "https://www.gravatar.com/avatar/" + hash + "....
[ "public", "static", "String", "getGravatarUrl", "(", "String", "emailAddress", ")", "{", "String", "hash", "=", "generateHash", "(", "emailAddress", ")", ";", "if", "(", "hash", "==", "null", ")", "{", "return", "\"https://www.gravatar.com/avatar/0000000000000000000...
Generates a Gravatar URL for the specified email address. If the email address is blank or does not have a Gravatar, will fallback to usingthe mystery-man image. @param emailAddress the email address to generate the Gravatar URL from @return a Gravatar URL for the specified email address @since 1.0.0
[ "Generates", "a", "Gravatar", "URL", "for", "the", "specified", "email", "address", ".", "If", "the", "email", "address", "is", "blank", "or", "does", "not", "have", "a", "Gravatar", "will", "fallback", "to", "usingthe", "mystery", "-", "man", "image", "."...
6c5ef5e1ba4f38922096f1307d3950c09edb3093
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/util/GravatarUtil.java#L86-L93
train
stevespringett/Alpine
alpine/src/main/java/alpine/persistence/AlpineQueryManager.java
AlpineQueryManager.getApiKey
@SuppressWarnings("unchecked") public ApiKey getApiKey(final String key) { final Query query = pm.newQuery(ApiKey.class, "key == :key"); final List<ApiKey> result = (List<ApiKey>) query.execute(key); return Collections.isEmpty(result) ? null : result.get(0); }
java
@SuppressWarnings("unchecked") public ApiKey getApiKey(final String key) { final Query query = pm.newQuery(ApiKey.class, "key == :key"); final List<ApiKey> result = (List<ApiKey>) query.execute(key); return Collections.isEmpty(result) ? null : result.get(0); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "ApiKey", "getApiKey", "(", "final", "String", "key", ")", "{", "final", "Query", "query", "=", "pm", ".", "newQuery", "(", "ApiKey", ".", "class", ",", "\"key == :key\"", ")", ";", "final", "Li...
Returns an API key. @param key the key to return @return an ApiKey @since 1.0.0
[ "Returns", "an", "API", "key", "." ]
6c5ef5e1ba4f38922096f1307d3950c09edb3093
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/persistence/AlpineQueryManager.java#L85-L90
train
stevespringett/Alpine
alpine/src/main/java/alpine/persistence/AlpineQueryManager.java
AlpineQueryManager.regenerateApiKey
public ApiKey regenerateApiKey(final ApiKey apiKey) { pm.currentTransaction().begin(); apiKey.setKey(ApiKeyGenerator.generate()); pm.currentTransaction().commit(); return pm.getObjectById(ApiKey.class, apiKey.getId()); }
java
public ApiKey regenerateApiKey(final ApiKey apiKey) { pm.currentTransaction().begin(); apiKey.setKey(ApiKeyGenerator.generate()); pm.currentTransaction().commit(); return pm.getObjectById(ApiKey.class, apiKey.getId()); }
[ "public", "ApiKey", "regenerateApiKey", "(", "final", "ApiKey", "apiKey", ")", "{", "pm", ".", "currentTransaction", "(", ")", ".", "begin", "(", ")", ";", "apiKey", ".", "setKey", "(", "ApiKeyGenerator", ".", "generate", "(", ")", ")", ";", "pm", ".", ...
Regenerates an API key. This method does not create a new ApiKey object, rather it uses the existing ApiKey object and simply creates a new key string. @param apiKey the ApiKey object to regenerate the key of. @return an ApiKey @since 1.0.0
[ "Regenerates", "an", "API", "key", ".", "This", "method", "does", "not", "create", "a", "new", "ApiKey", "object", "rather", "it", "uses", "the", "existing", "ApiKey", "object", "and", "simply", "creates", "a", "new", "key", "string", "." ]
6c5ef5e1ba4f38922096f1307d3950c09edb3093
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/persistence/AlpineQueryManager.java#L100-L105
train
stevespringett/Alpine
alpine/src/main/java/alpine/persistence/AlpineQueryManager.java
AlpineQueryManager.createApiKey
public ApiKey createApiKey(final Team team) { final List<Team> teams = new ArrayList<>(); teams.add(team); pm.currentTransaction().begin(); final ApiKey apiKey = new ApiKey(); apiKey.setKey(ApiKeyGenerator.generate()); apiKey.setTeams(teams); pm.makePersistent(api...
java
public ApiKey createApiKey(final Team team) { final List<Team> teams = new ArrayList<>(); teams.add(team); pm.currentTransaction().begin(); final ApiKey apiKey = new ApiKey(); apiKey.setKey(ApiKeyGenerator.generate()); apiKey.setTeams(teams); pm.makePersistent(api...
[ "public", "ApiKey", "createApiKey", "(", "final", "Team", "team", ")", "{", "final", "List", "<", "Team", ">", "teams", "=", "new", "ArrayList", "<>", "(", ")", ";", "teams", ".", "add", "(", "team", ")", ";", "pm", ".", "currentTransaction", "(", ")...
Creates a new ApiKey object, including a cryptographically secure API key string. @param team The team to create the key for @return an ApiKey
[ "Creates", "a", "new", "ApiKey", "object", "including", "a", "cryptographically", "secure", "API", "key", "string", "." ]
6c5ef5e1ba4f38922096f1307d3950c09edb3093
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/persistence/AlpineQueryManager.java#L113-L123
train
stevespringett/Alpine
alpine/src/main/java/alpine/persistence/AlpineQueryManager.java
AlpineQueryManager.getLdapUser
@SuppressWarnings("unchecked") public LdapUser getLdapUser(final String username) { final Query query = pm.newQuery(LdapUser.class, "username == :username"); final List<LdapUser> result = (List<LdapUser>) query.execute(username); return Collections.isEmpty(result) ? null : result.get(0); ...
java
@SuppressWarnings("unchecked") public LdapUser getLdapUser(final String username) { final Query query = pm.newQuery(LdapUser.class, "username == :username"); final List<LdapUser> result = (List<LdapUser>) query.execute(username); return Collections.isEmpty(result) ? null : result.get(0); ...
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "LdapUser", "getLdapUser", "(", "final", "String", "username", ")", "{", "final", "Query", "query", "=", "pm", ".", "newQuery", "(", "LdapUser", ".", "class", ",", "\"username == :username\"", ")", ...
Retrieves an LdapUser containing the specified username. If the username does not exist, returns null. @param username The username to retrieve @return an LdapUser @since 1.0.0
[ "Retrieves", "an", "LdapUser", "containing", "the", "specified", "username", ".", "If", "the", "username", "does", "not", "exist", "returns", "null", "." ]
6c5ef5e1ba4f38922096f1307d3950c09edb3093
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/persistence/AlpineQueryManager.java#L132-L137
train
stevespringett/Alpine
alpine/src/main/java/alpine/persistence/AlpineQueryManager.java
AlpineQueryManager.getLdapUsers
@SuppressWarnings("unchecked") public List<LdapUser> getLdapUsers() { final Query query = pm.newQuery(LdapUser.class); query.setOrdering("username asc"); return (List<LdapUser>) query.execute(); }
java
@SuppressWarnings("unchecked") public List<LdapUser> getLdapUsers() { final Query query = pm.newQuery(LdapUser.class); query.setOrdering("username asc"); return (List<LdapUser>) query.execute(); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "List", "<", "LdapUser", ">", "getLdapUsers", "(", ")", "{", "final", "Query", "query", "=", "pm", ".", "newQuery", "(", "LdapUser", ".", "class", ")", ";", "query", ".", "setOrdering", "(", "...
Returns a complete list of all LdapUser objects, in ascending order by username. @return a list of LdapUsers @since 1.0.0
[ "Returns", "a", "complete", "list", "of", "all", "LdapUser", "objects", "in", "ascending", "order", "by", "username", "." ]
6c5ef5e1ba4f38922096f1307d3950c09edb3093
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/persistence/AlpineQueryManager.java#L144-L149
train
stevespringett/Alpine
alpine/src/main/java/alpine/persistence/AlpineQueryManager.java
AlpineQueryManager.createLdapUser
public LdapUser createLdapUser(final String username) { pm.currentTransaction().begin(); final LdapUser user = new LdapUser(); user.setUsername(username); user.setDN("Syncing..."); pm.makePersistent(user); pm.currentTransaction().commit(); EventService.getInstance...
java
public LdapUser createLdapUser(final String username) { pm.currentTransaction().begin(); final LdapUser user = new LdapUser(); user.setUsername(username); user.setDN("Syncing..."); pm.makePersistent(user); pm.currentTransaction().commit(); EventService.getInstance...
[ "public", "LdapUser", "createLdapUser", "(", "final", "String", "username", ")", "{", "pm", ".", "currentTransaction", "(", ")", ".", "begin", "(", ")", ";", "final", "LdapUser", "user", "=", "new", "LdapUser", "(", ")", ";", "user", ".", "setUsername", ...
Creates a new LdapUser object with the specified username. @param username The username of the new LdapUser. This must reference an existing username in the directory service @return an LdapUser @since 1.0.0
[ "Creates", "a", "new", "LdapUser", "object", "with", "the", "specified", "username", "." ]
6c5ef5e1ba4f38922096f1307d3950c09edb3093
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/persistence/AlpineQueryManager.java#L157-L166
train
stevespringett/Alpine
alpine/src/main/java/alpine/persistence/AlpineQueryManager.java
AlpineQueryManager.updateLdapUser
public LdapUser updateLdapUser(final LdapUser transientUser) { final LdapUser user = getObjectById(LdapUser.class, transientUser.getId()); pm.currentTransaction().begin(); user.setDN(transientUser.getDN()); pm.currentTransaction().commit(); return pm.getObjectById(LdapUser.class,...
java
public LdapUser updateLdapUser(final LdapUser transientUser) { final LdapUser user = getObjectById(LdapUser.class, transientUser.getId()); pm.currentTransaction().begin(); user.setDN(transientUser.getDN()); pm.currentTransaction().commit(); return pm.getObjectById(LdapUser.class,...
[ "public", "LdapUser", "updateLdapUser", "(", "final", "LdapUser", "transientUser", ")", "{", "final", "LdapUser", "user", "=", "getObjectById", "(", "LdapUser", ".", "class", ",", "transientUser", ".", "getId", "(", ")", ")", ";", "pm", ".", "currentTransactio...
Updates the specified LdapUser. @param transientUser the optionally detached LdapUser object to update. @return an LdapUser @since 1.0.0
[ "Updates", "the", "specified", "LdapUser", "." ]
6c5ef5e1ba4f38922096f1307d3950c09edb3093
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/persistence/AlpineQueryManager.java#L174-L180
train
stevespringett/Alpine
alpine/src/main/java/alpine/persistence/AlpineQueryManager.java
AlpineQueryManager.updateManagedUser
public ManagedUser updateManagedUser(final ManagedUser transientUser) { final ManagedUser user = getObjectById(ManagedUser.class, transientUser.getId()); pm.currentTransaction().begin(); user.setFullname(transientUser.getFullname()); user.setEmail(transientUser.getEmail()); user....
java
public ManagedUser updateManagedUser(final ManagedUser transientUser) { final ManagedUser user = getObjectById(ManagedUser.class, transientUser.getId()); pm.currentTransaction().begin(); user.setFullname(transientUser.getFullname()); user.setEmail(transientUser.getEmail()); user....
[ "public", "ManagedUser", "updateManagedUser", "(", "final", "ManagedUser", "transientUser", ")", "{", "final", "ManagedUser", "user", "=", "getObjectById", "(", "ManagedUser", ".", "class", ",", "transientUser", ".", "getId", "(", ")", ")", ";", "pm", ".", "cu...
Updates the specified ManagedUser. @param transientUser the optionally detached ManagedUser object to update. @return an ManagedUser @since 1.0.0
[ "Updates", "the", "specified", "ManagedUser", "." ]
6c5ef5e1ba4f38922096f1307d3950c09edb3093
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/persistence/AlpineQueryManager.java#L274-L290
train
stevespringett/Alpine
alpine/src/main/java/alpine/persistence/AlpineQueryManager.java
AlpineQueryManager.getManagedUser
@SuppressWarnings("unchecked") public ManagedUser getManagedUser(final String username) { final Query query = pm.newQuery(ManagedUser.class, "username == :username"); final List<ManagedUser> result = (List<ManagedUser>) query.execute(username); return Collections.isEmpty(result) ? null : res...
java
@SuppressWarnings("unchecked") public ManagedUser getManagedUser(final String username) { final Query query = pm.newQuery(ManagedUser.class, "username == :username"); final List<ManagedUser> result = (List<ManagedUser>) query.execute(username); return Collections.isEmpty(result) ? null : res...
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "ManagedUser", "getManagedUser", "(", "final", "String", "username", ")", "{", "final", "Query", "query", "=", "pm", ".", "newQuery", "(", "ManagedUser", ".", "class", ",", "\"username == :username\"", ...
Returns a ManagedUser with the specified username. If the username does not exist, returns null. @param username The username to retrieve @return a ManagedUser @since 1.0.0
[ "Returns", "a", "ManagedUser", "with", "the", "specified", "username", ".", "If", "the", "username", "does", "not", "exist", "returns", "null", "." ]
6c5ef5e1ba4f38922096f1307d3950c09edb3093
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/persistence/AlpineQueryManager.java#L299-L304
train
stevespringett/Alpine
alpine/src/main/java/alpine/persistence/AlpineQueryManager.java
AlpineQueryManager.getManagedUsers
@SuppressWarnings("unchecked") public List<ManagedUser> getManagedUsers() { final Query query = pm.newQuery(ManagedUser.class); query.setOrdering("username asc"); return (List<ManagedUser>) query.execute(); }
java
@SuppressWarnings("unchecked") public List<ManagedUser> getManagedUsers() { final Query query = pm.newQuery(ManagedUser.class); query.setOrdering("username asc"); return (List<ManagedUser>) query.execute(); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "List", "<", "ManagedUser", ">", "getManagedUsers", "(", ")", "{", "final", "Query", "query", "=", "pm", ".", "newQuery", "(", "ManagedUser", ".", "class", ")", ";", "query", ".", "setOrdering", ...
Returns a complete list of all ManagedUser objects, in ascending order by username. @return a List of ManagedUsers @since 1.0.0
[ "Returns", "a", "complete", "list", "of", "all", "ManagedUser", "objects", "in", "ascending", "order", "by", "username", "." ]
6c5ef5e1ba4f38922096f1307d3950c09edb3093
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/persistence/AlpineQueryManager.java#L311-L316
train
stevespringett/Alpine
alpine/src/main/java/alpine/persistence/AlpineQueryManager.java
AlpineQueryManager.getUserPrincipal
public UserPrincipal getUserPrincipal(String username) { final UserPrincipal principal = getManagedUser(username); if (principal != null) { return principal; } return getLdapUser(username); }
java
public UserPrincipal getUserPrincipal(String username) { final UserPrincipal principal = getManagedUser(username); if (principal != null) { return principal; } return getLdapUser(username); }
[ "public", "UserPrincipal", "getUserPrincipal", "(", "String", "username", ")", "{", "final", "UserPrincipal", "principal", "=", "getManagedUser", "(", "username", ")", ";", "if", "(", "principal", "!=", "null", ")", "{", "return", "principal", ";", "}", "retur...
Resolves a UserPrincipal. Default order resolution is to first match on ManagedUser then on LdapUser. This may be configurable in a future release. @param username the username of the principal to retrieve @return a UserPrincipal if found, null if not found @since 1.0.0
[ "Resolves", "a", "UserPrincipal", ".", "Default", "order", "resolution", "is", "to", "first", "match", "on", "ManagedUser", "then", "on", "LdapUser", ".", "This", "may", "be", "configurable", "in", "a", "future", "release", "." ]
6c5ef5e1ba4f38922096f1307d3950c09edb3093
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/persistence/AlpineQueryManager.java#L326-L332
train
stevespringett/Alpine
alpine/src/main/java/alpine/persistence/AlpineQueryManager.java
AlpineQueryManager.getTeams
@SuppressWarnings("unchecked") public List<Team> getTeams() { pm.getFetchPlan().addGroup(Team.FetchGroup.ALL.name()); final Query query = pm.newQuery(Team.class); query.setOrdering("name asc"); return (List<Team>) query.execute(); }
java
@SuppressWarnings("unchecked") public List<Team> getTeams() { pm.getFetchPlan().addGroup(Team.FetchGroup.ALL.name()); final Query query = pm.newQuery(Team.class); query.setOrdering("name asc"); return (List<Team>) query.execute(); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "List", "<", "Team", ">", "getTeams", "(", ")", "{", "pm", ".", "getFetchPlan", "(", ")", ".", "addGroup", "(", "Team", ".", "FetchGroup", ".", "ALL", ".", "name", "(", ")", ")", ";", "fin...
Returns a complete list of all Team objects, in ascending order by name. @return a List of Teams @since 1.0.0
[ "Returns", "a", "complete", "list", "of", "all", "Team", "objects", "in", "ascending", "order", "by", "name", "." ]
6c5ef5e1ba4f38922096f1307d3950c09edb3093
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/persistence/AlpineQueryManager.java#L361-L367
train
stevespringett/Alpine
alpine/src/main/java/alpine/persistence/AlpineQueryManager.java
AlpineQueryManager.updateTeam
public Team updateTeam(final Team transientTeam) { final Team team = getObjectByUuid(Team.class, transientTeam.getUuid()); pm.currentTransaction().begin(); team.setName(transientTeam.getName()); //todo assign permissions pm.currentTransaction().commit(); return pm.getObje...
java
public Team updateTeam(final Team transientTeam) { final Team team = getObjectByUuid(Team.class, transientTeam.getUuid()); pm.currentTransaction().begin(); team.setName(transientTeam.getName()); //todo assign permissions pm.currentTransaction().commit(); return pm.getObje...
[ "public", "Team", "updateTeam", "(", "final", "Team", "transientTeam", ")", "{", "final", "Team", "team", "=", "getObjectByUuid", "(", "Team", ".", "class", ",", "transientTeam", ".", "getUuid", "(", ")", ")", ";", "pm", ".", "currentTransaction", "(", ")"...
Updates the specified Team. @param transientTeam the optionally detached Team object to update @return a Team @since 1.0.0
[ "Updates", "the", "specified", "Team", "." ]
6c5ef5e1ba4f38922096f1307d3950c09edb3093
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/persistence/AlpineQueryManager.java#L375-L382
train
stevespringett/Alpine
alpine/src/main/java/alpine/persistence/AlpineQueryManager.java
AlpineQueryManager.addUserToTeam
public boolean addUserToTeam(final UserPrincipal user, final Team team) { List<Team> teams = user.getTeams(); boolean found = false; if (teams == null) { teams = new ArrayList<>(); } for (final Team t: teams) { if (team.getUuid().equals(t.getUuid())) { ...
java
public boolean addUserToTeam(final UserPrincipal user, final Team team) { List<Team> teams = user.getTeams(); boolean found = false; if (teams == null) { teams = new ArrayList<>(); } for (final Team t: teams) { if (team.getUuid().equals(t.getUuid())) { ...
[ "public", "boolean", "addUserToTeam", "(", "final", "UserPrincipal", "user", ",", "final", "Team", "team", ")", "{", "List", "<", "Team", ">", "teams", "=", "user", ".", "getTeams", "(", ")", ";", "boolean", "found", "=", "false", ";", "if", "(", "team...
Associates a UserPrincipal to a Team. @param user The user to bind @param team The team to bind @return true if operation was successful, false if not. This is not an indication of team association, an unsuccessful return value may be due to the team or user not existing, or a binding that already exists between the tw...
[ "Associates", "a", "UserPrincipal", "to", "a", "Team", "." ]
6c5ef5e1ba4f38922096f1307d3950c09edb3093
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/persistence/AlpineQueryManager.java#L393-L412
train
stevespringett/Alpine
alpine/src/main/java/alpine/persistence/AlpineQueryManager.java
AlpineQueryManager.removeUserFromTeam
public boolean removeUserFromTeam(final UserPrincipal user, final Team team) { final List<Team> teams = user.getTeams(); if (teams == null) { return false; } boolean found = false; for (final Team t: teams) { if (team.getUuid().equals(t.getUuid())) { ...
java
public boolean removeUserFromTeam(final UserPrincipal user, final Team team) { final List<Team> teams = user.getTeams(); if (teams == null) { return false; } boolean found = false; for (final Team t: teams) { if (team.getUuid().equals(t.getUuid())) { ...
[ "public", "boolean", "removeUserFromTeam", "(", "final", "UserPrincipal", "user", ",", "final", "Team", "team", ")", "{", "final", "List", "<", "Team", ">", "teams", "=", "user", ".", "getTeams", "(", ")", ";", "if", "(", "teams", "==", "null", ")", "{...
Removes the association of a UserPrincipal to a Team. @param user The user to unbind @param team The team to unbind @return true if operation was successful, false if not. This is not an indication of team disassociation, an unsuccessful return value may be due to the team or user not existing, or a binding that may no...
[ "Removes", "the", "association", "of", "a", "UserPrincipal", "to", "a", "Team", "." ]
6c5ef5e1ba4f38922096f1307d3950c09edb3093
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/persistence/AlpineQueryManager.java#L422-L441
train
stevespringett/Alpine
alpine/src/main/java/alpine/persistence/AlpineQueryManager.java
AlpineQueryManager.createPermission
public Permission createPermission(final String name, final String description) { pm.currentTransaction().begin(); final Permission permission = new Permission(); permission.setName(name); permission.setDescription(description); pm.makePersistent(permission); pm.currentTr...
java
public Permission createPermission(final String name, final String description) { pm.currentTransaction().begin(); final Permission permission = new Permission(); permission.setName(name); permission.setDescription(description); pm.makePersistent(permission); pm.currentTr...
[ "public", "Permission", "createPermission", "(", "final", "String", "name", ",", "final", "String", "description", ")", "{", "pm", ".", "currentTransaction", "(", ")", ".", "begin", "(", ")", ";", "final", "Permission", "permission", "=", "new", "Permission", ...
Creates a Permission object. @param name The name of the permission @param description the permissions description @return a Permission @since 1.1.0
[ "Creates", "a", "Permission", "object", "." ]
6c5ef5e1ba4f38922096f1307d3950c09edb3093
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/persistence/AlpineQueryManager.java#L450-L458
train
stevespringett/Alpine
alpine/src/main/java/alpine/persistence/AlpineQueryManager.java
AlpineQueryManager.getPermission
@SuppressWarnings("unchecked") public Permission getPermission(final String name) { final Query query = pm.newQuery(Permission.class, "name == :name"); final List<Permission> result = (List<Permission>) query.execute(name); return Collections.isEmpty(result) ? null : result.get(0); }
java
@SuppressWarnings("unchecked") public Permission getPermission(final String name) { final Query query = pm.newQuery(Permission.class, "name == :name"); final List<Permission> result = (List<Permission>) query.execute(name); return Collections.isEmpty(result) ? null : result.get(0); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "Permission", "getPermission", "(", "final", "String", "name", ")", "{", "final", "Query", "query", "=", "pm", ".", "newQuery", "(", "Permission", ".", "class", ",", "\"name == :name\"", ")", ";", ...
Retrieves a Permission by its name. @param name The name of the permission @return a Permission @since 1.1.0
[ "Retrieves", "a", "Permission", "by", "its", "name", "." ]
6c5ef5e1ba4f38922096f1307d3950c09edb3093
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/persistence/AlpineQueryManager.java#L466-L471
train
stevespringett/Alpine
alpine/src/main/java/alpine/persistence/AlpineQueryManager.java
AlpineQueryManager.getPermissions
@SuppressWarnings("unchecked") public List<Permission> getPermissions() { final Query query = pm.newQuery(Permission.class); query.setOrdering("name asc"); return (List<Permission>) query.execute(); }
java
@SuppressWarnings("unchecked") public List<Permission> getPermissions() { final Query query = pm.newQuery(Permission.class); query.setOrdering("name asc"); return (List<Permission>) query.execute(); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "List", "<", "Permission", ">", "getPermissions", "(", ")", "{", "final", "Query", "query", "=", "pm", ".", "newQuery", "(", "Permission", ".", "class", ")", ";", "query", ".", "setOrdering", "(...
Returns a list of all Permissions defined in the system. @return a List of Permission objects @since 1.1.0
[ "Returns", "a", "list", "of", "all", "Permissions", "defined", "in", "the", "system", "." ]
6c5ef5e1ba4f38922096f1307d3950c09edb3093
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/persistence/AlpineQueryManager.java#L478-L483
train
stevespringett/Alpine
alpine/src/main/java/alpine/persistence/AlpineQueryManager.java
AlpineQueryManager.getEffectivePermissions
public List<Permission> getEffectivePermissions(UserPrincipal user) { final LinkedHashSet<Permission> permissions = new LinkedHashSet<>(); if (user.getPermissions() != null) { permissions.addAll(user.getPermissions()); } if (user.getTeams() != null) { for (final T...
java
public List<Permission> getEffectivePermissions(UserPrincipal user) { final LinkedHashSet<Permission> permissions = new LinkedHashSet<>(); if (user.getPermissions() != null) { permissions.addAll(user.getPermissions()); } if (user.getTeams() != null) { for (final T...
[ "public", "List", "<", "Permission", ">", "getEffectivePermissions", "(", "UserPrincipal", "user", ")", "{", "final", "LinkedHashSet", "<", "Permission", ">", "permissions", "=", "new", "LinkedHashSet", "<>", "(", ")", ";", "if", "(", "user", ".", "getPermissi...
Determines the effective permissions for the specified user by collecting a List of all permissions assigned to the user either directly, or through team membership. @param user the user to retrieve permissions for @return a List of Permission objects @since 1.1.0
[ "Determines", "the", "effective", "permissions", "for", "the", "specified", "user", "by", "collecting", "a", "List", "of", "all", "permissions", "assigned", "to", "the", "user", "either", "directly", "or", "through", "team", "membership", "." ]
6c5ef5e1ba4f38922096f1307d3950c09edb3093
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/persistence/AlpineQueryManager.java#L493-L507
train
stevespringett/Alpine
alpine/src/main/java/alpine/persistence/AlpineQueryManager.java
AlpineQueryManager.hasPermission
public boolean hasPermission(final UserPrincipal user, String permissionName, boolean includeTeams) { Query query; if (user instanceof ManagedUser) { query = pm.newQuery(Permission.class, "name == :permissionName && managedUsers.contains(:user)"); } else { query = pm.newQ...
java
public boolean hasPermission(final UserPrincipal user, String permissionName, boolean includeTeams) { Query query; if (user instanceof ManagedUser) { query = pm.newQuery(Permission.class, "name == :permissionName && managedUsers.contains(:user)"); } else { query = pm.newQ...
[ "public", "boolean", "hasPermission", "(", "final", "UserPrincipal", "user", ",", "String", "permissionName", ",", "boolean", "includeTeams", ")", "{", "Query", "query", ";", "if", "(", "user", "instanceof", "ManagedUser", ")", "{", "query", "=", "pm", ".", ...
Determines if the specified UserPrincipal has been assigned the specified permission. @param user the UserPrincipal to query @param permissionName the name of the permission @param includeTeams if true, will query all Team membership assigned to the user for the specified permission @return true if the user has the per...
[ "Determines", "if", "the", "specified", "UserPrincipal", "has", "been", "assigned", "the", "specified", "permission", "." ]
6c5ef5e1ba4f38922096f1307d3950c09edb3093
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/persistence/AlpineQueryManager.java#L528-L548
train
stevespringett/Alpine
alpine/src/main/java/alpine/persistence/AlpineQueryManager.java
AlpineQueryManager.hasPermission
public boolean hasPermission(final Team team, String permissionName) { final Query query = pm.newQuery(Permission.class, "name == :permissionName && teams.contains(:team)"); query.setResult("count(id)"); return (Long) query.execute(permissionName, team) > 0; }
java
public boolean hasPermission(final Team team, String permissionName) { final Query query = pm.newQuery(Permission.class, "name == :permissionName && teams.contains(:team)"); query.setResult("count(id)"); return (Long) query.execute(permissionName, team) > 0; }
[ "public", "boolean", "hasPermission", "(", "final", "Team", "team", ",", "String", "permissionName", ")", "{", "final", "Query", "query", "=", "pm", ".", "newQuery", "(", "Permission", ".", "class", ",", "\"name == :permissionName && teams.contains(:team)\"", ")", ...
Determines if the specified Team has been assigned the specified permission. @param team the Team to query @param permissionName the name of the permission @return true if the team has the permission assigned, false if not @since 1.0.0
[ "Determines", "if", "the", "specified", "Team", "has", "been", "assigned", "the", "specified", "permission", "." ]
6c5ef5e1ba4f38922096f1307d3950c09edb3093
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/persistence/AlpineQueryManager.java#L557-L561
train
stevespringett/Alpine
alpine/src/main/java/alpine/persistence/AlpineQueryManager.java
AlpineQueryManager.hasPermission
public boolean hasPermission(final ApiKey apiKey, String permissionName) { if (apiKey.getTeams() == null) { return false; } for (final Team team: apiKey.getTeams()) { final List<Permission> teamPermissions = getObjectById(Team.class, team.getId()).getPermissions(); ...
java
public boolean hasPermission(final ApiKey apiKey, String permissionName) { if (apiKey.getTeams() == null) { return false; } for (final Team team: apiKey.getTeams()) { final List<Permission> teamPermissions = getObjectById(Team.class, team.getId()).getPermissions(); ...
[ "public", "boolean", "hasPermission", "(", "final", "ApiKey", "apiKey", ",", "String", "permissionName", ")", "{", "if", "(", "apiKey", ".", "getTeams", "(", ")", "==", "null", ")", "{", "return", "false", ";", "}", "for", "(", "final", "Team", "team", ...
Determines if the specified ApiKey has been assigned the specified permission. @param apiKey the ApiKey to query @param permissionName the name of the permission @return true if the apiKey has the permission assigned, false if not @since 1.1.1
[ "Determines", "if", "the", "specified", "ApiKey", "has", "been", "assigned", "the", "specified", "permission", "." ]
6c5ef5e1ba4f38922096f1307d3950c09edb3093
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/persistence/AlpineQueryManager.java#L570-L583
train
stevespringett/Alpine
alpine/src/main/java/alpine/persistence/AlpineQueryManager.java
AlpineQueryManager.getMappedLdapGroup
@SuppressWarnings("unchecked") public MappedLdapGroup getMappedLdapGroup(final Team team, final String dn) { final Query query = pm.newQuery(MappedLdapGroup.class, "team == :team && dn == :dn"); final List<MappedLdapGroup> result = (List<MappedLdapGroup>) query.execute(team, dn); return Coll...
java
@SuppressWarnings("unchecked") public MappedLdapGroup getMappedLdapGroup(final Team team, final String dn) { final Query query = pm.newQuery(MappedLdapGroup.class, "team == :team && dn == :dn"); final List<MappedLdapGroup> result = (List<MappedLdapGroup>) query.execute(team, dn); return Coll...
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "MappedLdapGroup", "getMappedLdapGroup", "(", "final", "Team", "team", ",", "final", "String", "dn", ")", "{", "final", "Query", "query", "=", "pm", ".", "newQuery", "(", "MappedLdapGroup", ".", "cl...
Retrieves a MappedLdapGroup object for the specified Team and LDAP group. @param team a Team object @param dn a String representation of Distinguished Name @return a MappedLdapGroup if found, or null if no mapping exists @since 1.4.0
[ "Retrieves", "a", "MappedLdapGroup", "object", "for", "the", "specified", "Team", "and", "LDAP", "group", "." ]
6c5ef5e1ba4f38922096f1307d3950c09edb3093
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/persistence/AlpineQueryManager.java#L592-L597
train
stevespringett/Alpine
alpine/src/main/java/alpine/persistence/AlpineQueryManager.java
AlpineQueryManager.getMappedLdapGroups
@SuppressWarnings("unchecked") public List<MappedLdapGroup> getMappedLdapGroups(final Team team) { final Query query = pm.newQuery(MappedLdapGroup.class, "team == :team"); return (List<MappedLdapGroup>) query.execute(team); }
java
@SuppressWarnings("unchecked") public List<MappedLdapGroup> getMappedLdapGroups(final Team team) { final Query query = pm.newQuery(MappedLdapGroup.class, "team == :team"); return (List<MappedLdapGroup>) query.execute(team); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "List", "<", "MappedLdapGroup", ">", "getMappedLdapGroups", "(", "final", "Team", "team", ")", "{", "final", "Query", "query", "=", "pm", ".", "newQuery", "(", "MappedLdapGroup", ".", "class", ",", ...
Retrieves a List of MappedLdapGroup objects for the specified Team. @param team a Team object @return a List of MappedLdapGroup objects @since 1.4.0
[ "Retrieves", "a", "List", "of", "MappedLdapGroup", "objects", "for", "the", "specified", "Team", "." ]
6c5ef5e1ba4f38922096f1307d3950c09edb3093
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/persistence/AlpineQueryManager.java#L605-L609
train
stevespringett/Alpine
alpine/src/main/java/alpine/persistence/AlpineQueryManager.java
AlpineQueryManager.getMappedLdapGroups
@SuppressWarnings("unchecked") public List<MappedLdapGroup> getMappedLdapGroups(final String dn) { final Query query = pm.newQuery(MappedLdapGroup.class, "dn == :dn"); return (List<MappedLdapGroup>) query.execute(dn); }
java
@SuppressWarnings("unchecked") public List<MappedLdapGroup> getMappedLdapGroups(final String dn) { final Query query = pm.newQuery(MappedLdapGroup.class, "dn == :dn"); return (List<MappedLdapGroup>) query.execute(dn); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "List", "<", "MappedLdapGroup", ">", "getMappedLdapGroups", "(", "final", "String", "dn", ")", "{", "final", "Query", "query", "=", "pm", ".", "newQuery", "(", "MappedLdapGroup", ".", "class", ",", ...
Retrieves a List of MappedLdapGroup objects for the specified DN. @param dn a String representation of Distinguished Name @return a List of MappedLdapGroup objects @since 1.4.0
[ "Retrieves", "a", "List", "of", "MappedLdapGroup", "objects", "for", "the", "specified", "DN", "." ]
6c5ef5e1ba4f38922096f1307d3950c09edb3093
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/persistence/AlpineQueryManager.java#L617-L621
train
stevespringett/Alpine
alpine/src/main/java/alpine/persistence/AlpineQueryManager.java
AlpineQueryManager.createMappedLdapGroup
public MappedLdapGroup createMappedLdapGroup(final Team team, final String dn) { pm.currentTransaction().begin(); final MappedLdapGroup mapping = new MappedLdapGroup(); mapping.setTeam(team); mapping.setDn(dn); pm.makePersistent(mapping); pm.currentTransaction().commit();...
java
public MappedLdapGroup createMappedLdapGroup(final Team team, final String dn) { pm.currentTransaction().begin(); final MappedLdapGroup mapping = new MappedLdapGroup(); mapping.setTeam(team); mapping.setDn(dn); pm.makePersistent(mapping); pm.currentTransaction().commit();...
[ "public", "MappedLdapGroup", "createMappedLdapGroup", "(", "final", "Team", "team", ",", "final", "String", "dn", ")", "{", "pm", ".", "currentTransaction", "(", ")", ".", "begin", "(", ")", ";", "final", "MappedLdapGroup", "mapping", "=", "new", "MappedLdapGr...
Creates a MappedLdapGroup object. @param team The team to map @param dn the distinguished name of the LDAP group to map @return a MappedLdapGroup @since 1.4.0
[ "Creates", "a", "MappedLdapGroup", "object", "." ]
6c5ef5e1ba4f38922096f1307d3950c09edb3093
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/persistence/AlpineQueryManager.java#L641-L649
train
stevespringett/Alpine
alpine/src/main/java/alpine/persistence/AlpineQueryManager.java
AlpineQueryManager.updateEventServiceLog
public EventServiceLog updateEventServiceLog(EventServiceLog eventServiceLog) { if (eventServiceLog != null) { final EventServiceLog log = getObjectById(EventServiceLog.class, eventServiceLog.getId()); if (log != null) { pm.currentTransaction().begin(); lo...
java
public EventServiceLog updateEventServiceLog(EventServiceLog eventServiceLog) { if (eventServiceLog != null) { final EventServiceLog log = getObjectById(EventServiceLog.class, eventServiceLog.getId()); if (log != null) { pm.currentTransaction().begin(); lo...
[ "public", "EventServiceLog", "updateEventServiceLog", "(", "EventServiceLog", "eventServiceLog", ")", "{", "if", "(", "eventServiceLog", "!=", "null", ")", "{", "final", "EventServiceLog", "log", "=", "getObjectById", "(", "EventServiceLog", ".", "class", ",", "even...
Updates a EventServiceLog. @param eventServiceLog the EventServiceLog to update @return an updated EventServiceLog
[ "Updates", "a", "EventServiceLog", "." ]
6c5ef5e1ba4f38922096f1307d3950c09edb3093
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/persistence/AlpineQueryManager.java#L677-L688
train
stevespringett/Alpine
alpine/src/main/java/alpine/persistence/AlpineQueryManager.java
AlpineQueryManager.getConfigProperty
@SuppressWarnings("unchecked") public ConfigProperty getConfigProperty(final String groupName, final String propertyName) { final Query query = pm.newQuery(ConfigProperty.class, "groupName == :groupName && propertyName == :propertyName"); final List<ConfigProperty> result = (List<ConfigProperty>) qu...
java
@SuppressWarnings("unchecked") public ConfigProperty getConfigProperty(final String groupName, final String propertyName) { final Query query = pm.newQuery(ConfigProperty.class, "groupName == :groupName && propertyName == :propertyName"); final List<ConfigProperty> result = (List<ConfigProperty>) qu...
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "ConfigProperty", "getConfigProperty", "(", "final", "String", "groupName", ",", "final", "String", "propertyName", ")", "{", "final", "Query", "query", "=", "pm", ".", "newQuery", "(", "ConfigProperty"...
Returns a ConfigProperty with the specified groupName and propertyName. @param groupName the group name of the config property @param propertyName the name of the property @return a ConfigProperty object @since 1.3.0
[ "Returns", "a", "ConfigProperty", "with", "the", "specified", "groupName", "and", "propertyName", "." ]
6c5ef5e1ba4f38922096f1307d3950c09edb3093
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/persistence/AlpineQueryManager.java#L712-L717
train
stevespringett/Alpine
alpine/src/main/java/alpine/persistence/AlpineQueryManager.java
AlpineQueryManager.getConfigProperties
@SuppressWarnings("unchecked") public List<ConfigProperty> getConfigProperties() { final Query query = pm.newQuery(ConfigProperty.class); query.setOrdering("groupName asc, propertyName asc"); return (List<ConfigProperty>) query.execute(); }
java
@SuppressWarnings("unchecked") public List<ConfigProperty> getConfigProperties() { final Query query = pm.newQuery(ConfigProperty.class); query.setOrdering("groupName asc, propertyName asc"); return (List<ConfigProperty>) query.execute(); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "List", "<", "ConfigProperty", ">", "getConfigProperties", "(", ")", "{", "final", "Query", "query", "=", "pm", ".", "newQuery", "(", "ConfigProperty", ".", "class", ")", ";", "query", ".", "setOr...
Returns a list of ConfigProperty objects. @return a List of ConfigProperty objects @since 1.3.0
[ "Returns", "a", "list", "of", "ConfigProperty", "objects", "." ]
6c5ef5e1ba4f38922096f1307d3950c09edb3093
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/persistence/AlpineQueryManager.java#L737-L742
train
stevespringett/Alpine
alpine/src/main/java/alpine/persistence/AlpineQueryManager.java
AlpineQueryManager.createConfigProperty
public ConfigProperty createConfigProperty(final String groupName, final String propertyName, final String propertyValue, final ConfigProperty.PropertyType propertyType, final String description) { pm.currentTransactio...
java
public ConfigProperty createConfigProperty(final String groupName, final String propertyName, final String propertyValue, final ConfigProperty.PropertyType propertyType, final String description) { pm.currentTransactio...
[ "public", "ConfigProperty", "createConfigProperty", "(", "final", "String", "groupName", ",", "final", "String", "propertyName", ",", "final", "String", "propertyValue", ",", "final", "ConfigProperty", ".", "PropertyType", "propertyType", ",", "final", "String", "desc...
Creates a ConfigProperty object. @param groupName the group name of the property @param propertyName the name of the property @param propertyValue the value of the property @param propertyType the type of property @param description a description of the property @return a ConfigProperty object @since 1.3.0
[ "Creates", "a", "ConfigProperty", "object", "." ]
6c5ef5e1ba4f38922096f1307d3950c09edb3093
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/persistence/AlpineQueryManager.java#L754-L767
train
stevespringett/Alpine
alpine/src/main/java/alpine/filters/HpkpFilter.java
HpkpFilter.formatPolicy
private String formatPolicy() { final StringBuilder sb = new StringBuilder(); sb.append("pin-sha256").append("=\"").append(primaryHash).append("\"; "); sb.append("pin-sha256").append("=\"").append(backupHash).append("\"; "); sb.append("max-age").append("=").append(maxAge); if (i...
java
private String formatPolicy() { final StringBuilder sb = new StringBuilder(); sb.append("pin-sha256").append("=\"").append(primaryHash).append("\"; "); sb.append("pin-sha256").append("=\"").append(backupHash).append("\"; "); sb.append("max-age").append("=").append(maxAge); if (i...
[ "private", "String", "formatPolicy", "(", ")", "{", "final", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "sb", ".", "append", "(", "\"pin-sha256\"", ")", ".", "append", "(", "\"=\\\"\"", ")", ".", "append", "(", "primaryHash", ")", ...
Formats the HPKP policy header. @return a properly formatted HPKP header
[ "Formats", "the", "HPKP", "policy", "header", "." ]
6c5ef5e1ba4f38922096f1307d3950c09edb3093
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/filters/HpkpFilter.java#L134-L148
train
stevespringett/Alpine
alpine/src/main/java/alpine/persistence/PaginatedResult.java
PaginatedResult.getList
@SuppressWarnings("unchecked") public <T> List<T> getList(Class<T> clazz) { return (List<T>) objects; }
java
@SuppressWarnings("unchecked") public <T> List<T> getList(Class<T> clazz) { return (List<T>) objects; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "T", ">", "List", "<", "T", ">", "getList", "(", "Class", "<", "T", ">", "clazz", ")", "{", "return", "(", "List", "<", "T", ">", ")", "objects", ";", "}" ]
Retrieves a List of objects from the result. @param <T> the type defined in the List @param clazz the type defined in the List @return a Collection of objects from the result. @since 1.0.0
[ "Retrieves", "a", "List", "of", "objects", "from", "the", "result", "." ]
6c5ef5e1ba4f38922096f1307d3950c09edb3093
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/persistence/PaginatedResult.java#L86-L89
train
stevespringett/Alpine
alpine/src/main/java/alpine/persistence/PaginatedResult.java
PaginatedResult.getSet
@SuppressWarnings("unchecked") public <T> Set<T> getSet(Class<T> clazz) { return (Set<T>) objects; }
java
@SuppressWarnings("unchecked") public <T> Set<T> getSet(Class<T> clazz) { return (Set<T>) objects; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "T", ">", "Set", "<", "T", ">", "getSet", "(", "Class", "<", "T", ">", "clazz", ")", "{", "return", "(", "Set", "<", "T", ">", ")", "objects", ";", "}" ]
Retrieves a Set of objects from the result. @param <T> the type defined in the Set @param clazz the type defined in the Set @return a Collection of objects from the result. @since 1.0.0
[ "Retrieves", "a", "Set", "of", "objects", "from", "the", "result", "." ]
6c5ef5e1ba4f38922096f1307d3950c09edb3093
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/persistence/PaginatedResult.java#L98-L101
train
stevespringett/Alpine
alpine/src/main/java/alpine/persistence/PaginatedResult.java
PaginatedResult.setObjects
public void setObjects(Object object) { if (Collection.class.isAssignableFrom(object.getClass())) { this.objects = (Collection) object; } }
java
public void setObjects(Object object) { if (Collection.class.isAssignableFrom(object.getClass())) { this.objects = (Collection) object; } }
[ "public", "void", "setObjects", "(", "Object", "object", ")", "{", "if", "(", "Collection", ".", "class", ".", "isAssignableFrom", "(", "object", ".", "getClass", "(", ")", ")", ")", "{", "this", ".", "objects", "=", "(", "Collection", ")", "object", "...
Specifies a Collection of objects from the result. @param object a Collection of objects from the result. @since 1.0.0
[ "Specifies", "a", "Collection", "of", "objects", "from", "the", "result", "." ]
6c5ef5e1ba4f38922096f1307d3950c09edb3093
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/persistence/PaginatedResult.java#L128-L132
train
republicofgavin/PauseResumeAudioRecorder
library/src/main/java/com/github/republicofgavin/pauseresumeaudiorecorder/PauseResumeAudioRecorder.java
PauseResumeAudioRecorder.setAudioEncoding
public void setAudioEncoding(final int audioEncoding){ if (audioEncoding !=AudioFormat.ENCODING_PCM_8BIT && audioEncoding !=AudioFormat.ENCODING_PCM_16BIT){ throw new IllegalArgumentException("Invalid encoding"); } else if (currentAudioState.get()!=PREPARED_STATE && currentAudioState...
java
public void setAudioEncoding(final int audioEncoding){ if (audioEncoding !=AudioFormat.ENCODING_PCM_8BIT && audioEncoding !=AudioFormat.ENCODING_PCM_16BIT){ throw new IllegalArgumentException("Invalid encoding"); } else if (currentAudioState.get()!=PREPARED_STATE && currentAudioState...
[ "public", "void", "setAudioEncoding", "(", "final", "int", "audioEncoding", ")", "{", "if", "(", "audioEncoding", "!=", "AudioFormat", ".", "ENCODING_PCM_8BIT", "&&", "audioEncoding", "!=", "AudioFormat", ".", "ENCODING_PCM_16BIT", ")", "{", "throw", "new", "Illeg...
Sets the encoding for the audio file. @param audioEncoding Must be {@link AudioFormat}.ENCODING_PCM_8BIT or {@link AudioFormat}.ENCODING_PCM_16BIT. @throws IllegalArgumentException If the encoding is not {@link AudioFormat}.ENCODING_PCM_8BIT or {@link AudioFormat}.ENCODING_PCM_16BIT @throws IllegalStateException If it ...
[ "Sets", "the", "encoding", "for", "the", "audio", "file", "." ]
938128a6266fb5bd7b60f844b5d7e56e1899d4e2
https://github.com/republicofgavin/PauseResumeAudioRecorder/blob/938128a6266fb5bd7b60f844b5d7e56e1899d4e2/library/src/main/java/com/github/republicofgavin/pauseresumeaudiorecorder/PauseResumeAudioRecorder.java#L143-L151
train
republicofgavin/PauseResumeAudioRecorder
library/src/main/java/com/github/republicofgavin/pauseresumeaudiorecorder/PauseResumeAudioRecorder.java
PauseResumeAudioRecorder.setSampleRate
public void setSampleRate(final int sampleRateInHertz){ if (sampleRateInHertz!=DEFAULT_AUDIO_SAMPLE_RATE_HERTZ && sampleRateInHertz !=22050 && sampleRateInHertz != 16000 && sampleRateInHertz !=11025){ throw new IllegalArgumentException("Invalid sample rate given"); } ...
java
public void setSampleRate(final int sampleRateInHertz){ if (sampleRateInHertz!=DEFAULT_AUDIO_SAMPLE_RATE_HERTZ && sampleRateInHertz !=22050 && sampleRateInHertz != 16000 && sampleRateInHertz !=11025){ throw new IllegalArgumentException("Invalid sample rate given"); } ...
[ "public", "void", "setSampleRate", "(", "final", "int", "sampleRateInHertz", ")", "{", "if", "(", "sampleRateInHertz", "!=", "DEFAULT_AUDIO_SAMPLE_RATE_HERTZ", "&&", "sampleRateInHertz", "!=", "22050", "&&", "sampleRateInHertz", "!=", "16000", "&&", "sampleRateInHertz",...
Sets the sample rate for the recording. @param sampleRateInHertz The sample rate to record the audio with. @throws IllegalArgumentException If the sample rate is not: 44100,22050,16000, or 11025 @throws IllegalStateException If the API is called while the recorder is not initialized or prepared.
[ "Sets", "the", "sample", "rate", "for", "the", "recording", "." ]
938128a6266fb5bd7b60f844b5d7e56e1899d4e2
https://github.com/republicofgavin/PauseResumeAudioRecorder/blob/938128a6266fb5bd7b60f844b5d7e56e1899d4e2/library/src/main/java/com/github/republicofgavin/pauseresumeaudiorecorder/PauseResumeAudioRecorder.java#L184-L193
train
republicofgavin/PauseResumeAudioRecorder
library/src/main/java/com/github/republicofgavin/pauseresumeaudiorecorder/PauseResumeAudioRecorder.java
PauseResumeAudioRecorder.setChannel
public void setChannel(final int channelConfig){ if(channelConfig != AudioFormat.CHANNEL_IN_MONO && channelConfig !=AudioFormat.CHANNEL_IN_STEREO && channelConfig != AudioFormat.CHANNEL_IN_DEFAULT){ throw new IllegalArgumentException("Invalid channel given."); } else if (currentAudio...
java
public void setChannel(final int channelConfig){ if(channelConfig != AudioFormat.CHANNEL_IN_MONO && channelConfig !=AudioFormat.CHANNEL_IN_STEREO && channelConfig != AudioFormat.CHANNEL_IN_DEFAULT){ throw new IllegalArgumentException("Invalid channel given."); } else if (currentAudio...
[ "public", "void", "setChannel", "(", "final", "int", "channelConfig", ")", "{", "if", "(", "channelConfig", "!=", "AudioFormat", ".", "CHANNEL_IN_MONO", "&&", "channelConfig", "!=", "AudioFormat", ".", "CHANNEL_IN_STEREO", "&&", "channelConfig", "!=", "AudioFormat",...
Sets the channel. @param channelConfig {@link AudioFormat}.CHANNEL_IN_MONO, {@link AudioFormat}.CHANNEL_IN_DEFAULT, or {@link AudioFormat}.CHANNEL_IN_STEREO @throws IllegalArgumentException if it is not Mono or Stereo. @throws IllegalStateException If the channel is changed when it is not in a prepared or initialized s...
[ "Sets", "the", "channel", "." ]
938128a6266fb5bd7b60f844b5d7e56e1899d4e2
https://github.com/republicofgavin/PauseResumeAudioRecorder/blob/938128a6266fb5bd7b60f844b5d7e56e1899d4e2/library/src/main/java/com/github/republicofgavin/pauseresumeaudiorecorder/PauseResumeAudioRecorder.java#L201-L209
train
republicofgavin/PauseResumeAudioRecorder
library/src/main/java/com/github/republicofgavin/pauseresumeaudiorecorder/PauseResumeAudioRecorder.java
PauseResumeAudioRecorder.pauseRecording
public void pauseRecording(){ if (currentAudioState.get()==RECORDING_STATE){ currentAudioState.getAndSet(PAUSED_STATE); onTimeCompletedTimer.cancel(); remainingMaxTimeInMillis=remainingMaxTimeInMillis-(System.currentTimeMillis()-recordingStartTimeMillis); } el...
java
public void pauseRecording(){ if (currentAudioState.get()==RECORDING_STATE){ currentAudioState.getAndSet(PAUSED_STATE); onTimeCompletedTimer.cancel(); remainingMaxTimeInMillis=remainingMaxTimeInMillis-(System.currentTimeMillis()-recordingStartTimeMillis); } el...
[ "public", "void", "pauseRecording", "(", ")", "{", "if", "(", "currentAudioState", ".", "get", "(", ")", "==", "RECORDING_STATE", ")", "{", "currentAudioState", ".", "getAndSet", "(", "PAUSED_STATE", ")", ";", "onTimeCompletedTimer", ".", "cancel", "(", ")", ...
Pauses the recording if the recorder is in a recording state. Does nothing if in another state. Paused media recorder halts the max time countdown.
[ "Pauses", "the", "recording", "if", "the", "recorder", "is", "in", "a", "recording", "state", ".", "Does", "nothing", "if", "in", "another", "state", ".", "Paused", "media", "recorder", "halts", "the", "max", "time", "countdown", "." ]
938128a6266fb5bd7b60f844b5d7e56e1899d4e2
https://github.com/republicofgavin/PauseResumeAudioRecorder/blob/938128a6266fb5bd7b60f844b5d7e56e1899d4e2/library/src/main/java/com/github/republicofgavin/pauseresumeaudiorecorder/PauseResumeAudioRecorder.java#L242-L251
train
republicofgavin/PauseResumeAudioRecorder
library/src/main/java/com/github/republicofgavin/pauseresumeaudiorecorder/PauseResumeAudioRecorder.java
PauseResumeAudioRecorder.resumeRecording
public void resumeRecording(){ if (currentAudioState.get()==PAUSED_STATE){ recordingStartTimeMillis=System.currentTimeMillis(); currentAudioState.getAndSet(RECORDING_STATE); onTimeCompletedTimer=new Timer(true); onTimeCompletionTimerTask=new MaxTimeTimerTask(); ...
java
public void resumeRecording(){ if (currentAudioState.get()==PAUSED_STATE){ recordingStartTimeMillis=System.currentTimeMillis(); currentAudioState.getAndSet(RECORDING_STATE); onTimeCompletedTimer=new Timer(true); onTimeCompletionTimerTask=new MaxTimeTimerTask(); ...
[ "public", "void", "resumeRecording", "(", ")", "{", "if", "(", "currentAudioState", ".", "get", "(", ")", "==", "PAUSED_STATE", ")", "{", "recordingStartTimeMillis", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "currentAudioState", ".", "getAndSet", ...
Resumes the audio recording. Does nothing if the recorder is in a non-recording state.
[ "Resumes", "the", "audio", "recording", ".", "Does", "nothing", "if", "the", "recorder", "is", "in", "a", "non", "-", "recording", "state", "." ]
938128a6266fb5bd7b60f844b5d7e56e1899d4e2
https://github.com/republicofgavin/PauseResumeAudioRecorder/blob/938128a6266fb5bd7b60f844b5d7e56e1899d4e2/library/src/main/java/com/github/republicofgavin/pauseresumeaudiorecorder/PauseResumeAudioRecorder.java#L256-L267
train
republicofgavin/PauseResumeAudioRecorder
library/src/main/java/com/github/republicofgavin/pauseresumeaudiorecorder/PauseResumeAudioRecorder.java
PauseResumeAudioRecorder.stopRecording
public void stopRecording(){ if (currentAudioState.get()== PAUSED_STATE || currentAudioState.get()==RECORDING_STATE){ currentAudioState.getAndSet(STOPPED_STATE); onTimeCompletedTimer.cancel(); onTimeCompletedTimer=null; onTimeCompletionTimerTask=null; } ...
java
public void stopRecording(){ if (currentAudioState.get()== PAUSED_STATE || currentAudioState.get()==RECORDING_STATE){ currentAudioState.getAndSet(STOPPED_STATE); onTimeCompletedTimer.cancel(); onTimeCompletedTimer=null; onTimeCompletionTimerTask=null; } ...
[ "public", "void", "stopRecording", "(", ")", "{", "if", "(", "currentAudioState", ".", "get", "(", ")", "==", "PAUSED_STATE", "||", "currentAudioState", ".", "get", "(", ")", "==", "RECORDING_STATE", ")", "{", "currentAudioState", ".", "getAndSet", "(", "STO...
Stops the audio recording if it is in a paused or recording state. Does nothing if the recorder is already stopped. @throws IllegalStateException If the recorder is not in a paused, recording, or stopped state.
[ "Stops", "the", "audio", "recording", "if", "it", "is", "in", "a", "paused", "or", "recording", "state", ".", "Does", "nothing", "if", "the", "recorder", "is", "already", "stopped", "." ]
938128a6266fb5bd7b60f844b5d7e56e1899d4e2
https://github.com/republicofgavin/PauseResumeAudioRecorder/blob/938128a6266fb5bd7b60f844b5d7e56e1899d4e2/library/src/main/java/com/github/republicofgavin/pauseresumeaudiorecorder/PauseResumeAudioRecorder.java#L273-L284
train
buschmais/jqa-java-plugin
src/main/java/com/buschmais/jqassistant/plugin/java/impl/scanner/visitor/AbstractAnnotationVisitor.java
AbstractAnnotationVisitor.createValue
private <T extends ValueDescriptor<?>> T createValue(Class<T> type, String name) { if (name != null) { this.arrayValueDescriptor = null; } String valueName; if (arrayValueDescriptor != null) { valueName = "[" + getArrayValue().size() + "]"; } else { ...
java
private <T extends ValueDescriptor<?>> T createValue(Class<T> type, String name) { if (name != null) { this.arrayValueDescriptor = null; } String valueName; if (arrayValueDescriptor != null) { valueName = "[" + getArrayValue().size() + "]"; } else { ...
[ "private", "<", "T", "extends", "ValueDescriptor", "<", "?", ">", ">", "T", "createValue", "(", "Class", "<", "T", ">", "type", ",", "String", "name", ")", "{", "if", "(", "name", "!=", "null", ")", "{", "this", ".", "arrayValueDescriptor", "=", "nul...
Create a value descriptor of given type and name and initializes it. @param type The class type. @param name The name @param <T> The type. @return The initialized descriptor.
[ "Create", "a", "value", "descriptor", "of", "given", "type", "and", "name", "and", "initializes", "it", "." ]
4c050943e9c28cf1c4a08aa962d5b5bf03c4fe54
https://github.com/buschmais/jqa-java-plugin/blob/4c050943e9c28cf1c4a08aa962d5b5bf03c4fe54/src/main/java/com/buschmais/jqassistant/plugin/java/impl/scanner/visitor/AbstractAnnotationVisitor.java#L98-L111
train
buschmais/jqa-java-plugin
src/main/java/com/buschmais/jqassistant/plugin/java/impl/scanner/visitor/AbstractAnnotationVisitor.java
AbstractAnnotationVisitor.addValue
private void addValue(String name, ValueDescriptor<?> value) { if (arrayValueDescriptor != null && name == null) { getArrayValue().add(value); } else { setValue(descriptor, value); } }
java
private void addValue(String name, ValueDescriptor<?> value) { if (arrayValueDescriptor != null && name == null) { getArrayValue().add(value); } else { setValue(descriptor, value); } }
[ "private", "void", "addValue", "(", "String", "name", ",", "ValueDescriptor", "<", "?", ">", "value", ")", "{", "if", "(", "arrayValueDescriptor", "!=", "null", "&&", "name", "==", "null", ")", "{", "getArrayValue", "(", ")", ".", "add", "(", "value", ...
Add the descriptor as value to the current annotation or array value. @param name The name. @param value The value.
[ "Add", "the", "descriptor", "as", "value", "to", "the", "current", "annotation", "or", "array", "value", "." ]
4c050943e9c28cf1c4a08aa962d5b5bf03c4fe54
https://github.com/buschmais/jqa-java-plugin/blob/4c050943e9c28cf1c4a08aa962d5b5bf03c4fe54/src/main/java/com/buschmais/jqassistant/plugin/java/impl/scanner/visitor/AbstractAnnotationVisitor.java#L121-L127
train
buschmais/jqa-java-plugin
src/main/java/com/buschmais/jqassistant/plugin/java/impl/scanner/visitor/AbstractAnnotationVisitor.java
AbstractAnnotationVisitor.getArrayValue
private List<ValueDescriptor<?>> getArrayValue() { List<ValueDescriptor<?>> values = arrayValueDescriptor.getValue(); if (values == null) { values = new LinkedList<>(); arrayValueDescriptor.setValue(values); } return values; }
java
private List<ValueDescriptor<?>> getArrayValue() { List<ValueDescriptor<?>> values = arrayValueDescriptor.getValue(); if (values == null) { values = new LinkedList<>(); arrayValueDescriptor.setValue(values); } return values; }
[ "private", "List", "<", "ValueDescriptor", "<", "?", ">", ">", "getArrayValue", "(", ")", "{", "List", "<", "ValueDescriptor", "<", "?", ">", ">", "values", "=", "arrayValueDescriptor", ".", "getValue", "(", ")", ";", "if", "(", "values", "==", "null", ...
Get the array of referenced values. @return The array of referenced values.
[ "Get", "the", "array", "of", "referenced", "values", "." ]
4c050943e9c28cf1c4a08aa962d5b5bf03c4fe54
https://github.com/buschmais/jqa-java-plugin/blob/4c050943e9c28cf1c4a08aa962d5b5bf03c4fe54/src/main/java/com/buschmais/jqassistant/plugin/java/impl/scanner/visitor/AbstractAnnotationVisitor.java#L134-L141
train
buschmais/jqa-java-plugin
src/main/java/com/buschmais/jqassistant/plugin/java/api/scanner/SignatureHelper.java
SignatureHelper.getType
public static String getType(final Type t) { switch (t.getSort()) { case Type.ARRAY: return getType(t.getElementType()); default: return t.getClassName(); } }
java
public static String getType(final Type t) { switch (t.getSort()) { case Type.ARRAY: return getType(t.getElementType()); default: return t.getClassName(); } }
[ "public", "static", "String", "getType", "(", "final", "Type", "t", ")", "{", "switch", "(", "t", ".", "getSort", "(", ")", ")", "{", "case", "Type", ".", "ARRAY", ":", "return", "getType", "(", "t", ".", "getElementType", "(", ")", ")", ";", "defa...
Return the type name of the given ASM type. @param t The ASM type. @return The type name.
[ "Return", "the", "type", "name", "of", "the", "given", "ASM", "type", "." ]
4c050943e9c28cf1c4a08aa962d5b5bf03c4fe54
https://github.com/buschmais/jqa-java-plugin/blob/4c050943e9c28cf1c4a08aa962d5b5bf03c4fe54/src/main/java/com/buschmais/jqassistant/plugin/java/api/scanner/SignatureHelper.java#L46-L53
train
buschmais/jqa-java-plugin
src/main/java/com/buschmais/jqassistant/plugin/java/api/scanner/SignatureHelper.java
SignatureHelper.getMethodSignature
public static String getMethodSignature(String name, String rawSignature) { StringBuilder signature = new StringBuilder(); String returnType = org.objectweb.asm.Type.getReturnType(rawSignature).getClassName(); if (returnType != null) { signature.append(returnType); signat...
java
public static String getMethodSignature(String name, String rawSignature) { StringBuilder signature = new StringBuilder(); String returnType = org.objectweb.asm.Type.getReturnType(rawSignature).getClassName(); if (returnType != null) { signature.append(returnType); signat...
[ "public", "static", "String", "getMethodSignature", "(", "String", "name", ",", "String", "rawSignature", ")", "{", "StringBuilder", "signature", "=", "new", "StringBuilder", "(", ")", ";", "String", "returnType", "=", "org", ".", "objectweb", ".", "asm", ".",...
Return a method signature. @param name The method name. @param rawSignature The signature containing parameter, return and exception values. @return The method signature.
[ "Return", "a", "method", "signature", "." ]
4c050943e9c28cf1c4a08aa962d5b5bf03c4fe54
https://github.com/buschmais/jqa-java-plugin/blob/4c050943e9c28cf1c4a08aa962d5b5bf03c4fe54/src/main/java/com/buschmais/jqassistant/plugin/java/api/scanner/SignatureHelper.java#L65-L83
train
buschmais/jqa-java-plugin
src/main/java/com/buschmais/jqassistant/plugin/java/api/scanner/SignatureHelper.java
SignatureHelper.getFieldSignature
public static String getFieldSignature(String name, String rawSignature) { StringBuilder signature = new StringBuilder(); String returnType = org.objectweb.asm.Type.getType(rawSignature).getClassName(); signature.append(returnType); signature.append(' '); signature.append(name); ...
java
public static String getFieldSignature(String name, String rawSignature) { StringBuilder signature = new StringBuilder(); String returnType = org.objectweb.asm.Type.getType(rawSignature).getClassName(); signature.append(returnType); signature.append(' '); signature.append(name); ...
[ "public", "static", "String", "getFieldSignature", "(", "String", "name", ",", "String", "rawSignature", ")", "{", "StringBuilder", "signature", "=", "new", "StringBuilder", "(", ")", ";", "String", "returnType", "=", "org", ".", "objectweb", ".", "asm", ".", ...
Return a field signature. @param name The field name. @param rawSignature The signature containing the type value. @return The field signature.
[ "Return", "a", "field", "signature", "." ]
4c050943e9c28cf1c4a08aa962d5b5bf03c4fe54
https://github.com/buschmais/jqa-java-plugin/blob/4c050943e9c28cf1c4a08aa962d5b5bf03c4fe54/src/main/java/com/buschmais/jqassistant/plugin/java/api/scanner/SignatureHelper.java#L94-L101
train
buschmais/jqa-java-plugin
src/main/java/com/buschmais/jqassistant/plugin/java/impl/scanner/visitor/VisitorHelper.java
VisitorHelper.getMethodDescriptor
MethodDescriptor getMethodDescriptor(TypeCache.CachedType<?> cachedType, String signature) { MethodDescriptor methodDescriptor = cachedType.getMethod(signature); if (methodDescriptor == null) { if (signature.startsWith(CONSTRUCTOR_METHOD)) { methodDescriptor = scannerContext....
java
MethodDescriptor getMethodDescriptor(TypeCache.CachedType<?> cachedType, String signature) { MethodDescriptor methodDescriptor = cachedType.getMethod(signature); if (methodDescriptor == null) { if (signature.startsWith(CONSTRUCTOR_METHOD)) { methodDescriptor = scannerContext....
[ "MethodDescriptor", "getMethodDescriptor", "(", "TypeCache", ".", "CachedType", "<", "?", ">", "cachedType", ",", "String", "signature", ")", "{", "MethodDescriptor", "methodDescriptor", "=", "cachedType", ".", "getMethod", "(", "signature", ")", ";", "if", "(", ...
Return the method descriptor for the given type and method signature. @param cachedType The containing type. @param signature The method signature. @return The method descriptor.
[ "Return", "the", "method", "descriptor", "for", "the", "given", "type", "and", "method", "signature", "." ]
4c050943e9c28cf1c4a08aa962d5b5bf03c4fe54
https://github.com/buschmais/jqa-java-plugin/blob/4c050943e9c28cf1c4a08aa962d5b5bf03c4fe54/src/main/java/com/buschmais/jqassistant/plugin/java/impl/scanner/visitor/VisitorHelper.java#L96-L108
train
buschmais/jqa-java-plugin
src/main/java/com/buschmais/jqassistant/plugin/java/impl/scanner/visitor/VisitorHelper.java
VisitorHelper.addInvokes
void addInvokes(MethodDescriptor methodDescriptor, final Integer lineNumber, MethodDescriptor invokedMethodDescriptor) { InvokesDescriptor invokesDescriptor = scannerContext.getStore().create(methodDescriptor, InvokesDescriptor.class, invokedMethodDescriptor); invokesDescriptor.setLineNumber(lineNumber)...
java
void addInvokes(MethodDescriptor methodDescriptor, final Integer lineNumber, MethodDescriptor invokedMethodDescriptor) { InvokesDescriptor invokesDescriptor = scannerContext.getStore().create(methodDescriptor, InvokesDescriptor.class, invokedMethodDescriptor); invokesDescriptor.setLineNumber(lineNumber)...
[ "void", "addInvokes", "(", "MethodDescriptor", "methodDescriptor", ",", "final", "Integer", "lineNumber", ",", "MethodDescriptor", "invokedMethodDescriptor", ")", "{", "InvokesDescriptor", "invokesDescriptor", "=", "scannerContext", ".", "getStore", "(", ")", ".", "crea...
Add a invokes relation between two methods. @param methodDescriptor The invoking method. @param lineNumber The line number. @param invokedMethodDescriptor The invoked method.
[ "Add", "a", "invokes", "relation", "between", "two", "methods", "." ]
4c050943e9c28cf1c4a08aa962d5b5bf03c4fe54
https://github.com/buschmais/jqa-java-plugin/blob/4c050943e9c28cf1c4a08aa962d5b5bf03c4fe54/src/main/java/com/buschmais/jqassistant/plugin/java/impl/scanner/visitor/VisitorHelper.java#L136-L139
train
buschmais/jqa-java-plugin
src/main/java/com/buschmais/jqassistant/plugin/java/impl/scanner/visitor/VisitorHelper.java
VisitorHelper.addReads
void addReads(MethodDescriptor methodDescriptor, final Integer lineNumber, FieldDescriptor fieldDescriptor) { ReadsDescriptor readsDescriptor = scannerContext.getStore().create(methodDescriptor, ReadsDescriptor.class, fieldDescriptor); readsDescriptor.setLineNumber(lineNumber); }
java
void addReads(MethodDescriptor methodDescriptor, final Integer lineNumber, FieldDescriptor fieldDescriptor) { ReadsDescriptor readsDescriptor = scannerContext.getStore().create(methodDescriptor, ReadsDescriptor.class, fieldDescriptor); readsDescriptor.setLineNumber(lineNumber); }
[ "void", "addReads", "(", "MethodDescriptor", "methodDescriptor", ",", "final", "Integer", "lineNumber", ",", "FieldDescriptor", "fieldDescriptor", ")", "{", "ReadsDescriptor", "readsDescriptor", "=", "scannerContext", ".", "getStore", "(", ")", ".", "create", "(", "...
Add a reads relation between a method and a field. @param methodDescriptor The method. @param lineNumber The line number. @param fieldDescriptor The field.
[ "Add", "a", "reads", "relation", "between", "a", "method", "and", "a", "field", "." ]
4c050943e9c28cf1c4a08aa962d5b5bf03c4fe54
https://github.com/buschmais/jqa-java-plugin/blob/4c050943e9c28cf1c4a08aa962d5b5bf03c4fe54/src/main/java/com/buschmais/jqassistant/plugin/java/impl/scanner/visitor/VisitorHelper.java#L151-L154
train
buschmais/jqa-java-plugin
src/main/java/com/buschmais/jqassistant/plugin/java/impl/scanner/visitor/VisitorHelper.java
VisitorHelper.addWrites
void addWrites(MethodDescriptor methodDescriptor, final Integer lineNumber, FieldDescriptor fieldDescriptor) { WritesDescriptor writesDescriptor = scannerContext.getStore().create(methodDescriptor, WritesDescriptor.class, fieldDescriptor); writesDescriptor.setLineNumber(lineNumber); }
java
void addWrites(MethodDescriptor methodDescriptor, final Integer lineNumber, FieldDescriptor fieldDescriptor) { WritesDescriptor writesDescriptor = scannerContext.getStore().create(methodDescriptor, WritesDescriptor.class, fieldDescriptor); writesDescriptor.setLineNumber(lineNumber); }
[ "void", "addWrites", "(", "MethodDescriptor", "methodDescriptor", ",", "final", "Integer", "lineNumber", ",", "FieldDescriptor", "fieldDescriptor", ")", "{", "WritesDescriptor", "writesDescriptor", "=", "scannerContext", ".", "getStore", "(", ")", ".", "create", "(", ...
Add a writes relation between a method and a field. @param methodDescriptor The method. @param lineNumber The line number. @param fieldDescriptor The field.
[ "Add", "a", "writes", "relation", "between", "a", "method", "and", "a", "field", "." ]
4c050943e9c28cf1c4a08aa962d5b5bf03c4fe54
https://github.com/buschmais/jqa-java-plugin/blob/4c050943e9c28cf1c4a08aa962d5b5bf03c4fe54/src/main/java/com/buschmais/jqassistant/plugin/java/impl/scanner/visitor/VisitorHelper.java#L166-L169
train
buschmais/jqa-java-plugin
src/main/java/com/buschmais/jqassistant/plugin/java/impl/scanner/visitor/VisitorHelper.java
VisitorHelper.addAnnotation
AnnotationVisitor addAnnotation(TypeCache.CachedType containingDescriptor, AnnotatedDescriptor annotatedDescriptor, String typeName) { if (typeName == null) { return null; } if (jQASuppress.class.getName().equals(typeName)) { JavaSuppressDescriptor javaSuppressDescriptor ...
java
AnnotationVisitor addAnnotation(TypeCache.CachedType containingDescriptor, AnnotatedDescriptor annotatedDescriptor, String typeName) { if (typeName == null) { return null; } if (jQASuppress.class.getName().equals(typeName)) { JavaSuppressDescriptor javaSuppressDescriptor ...
[ "AnnotationVisitor", "addAnnotation", "(", "TypeCache", ".", "CachedType", "containingDescriptor", ",", "AnnotatedDescriptor", "annotatedDescriptor", ",", "String", "typeName", ")", "{", "if", "(", "typeName", "==", "null", ")", "{", "return", "null", ";", "}", "i...
Add an annotation descriptor of the given type name to an annotated descriptor. @param annotatedDescriptor The annotated descriptor. @param typeName The type name of the annotation. @return The annotation descriptor.
[ "Add", "an", "annotation", "descriptor", "of", "the", "given", "type", "name", "to", "an", "annotated", "descriptor", "." ]
4c050943e9c28cf1c4a08aa962d5b5bf03c4fe54
https://github.com/buschmais/jqa-java-plugin/blob/4c050943e9c28cf1c4a08aa962d5b5bf03c4fe54/src/main/java/com/buschmais/jqassistant/plugin/java/impl/scanner/visitor/VisitorHelper.java#L229-L242
train
buschmais/jqa-java-plugin
src/main/java/com/buschmais/jqassistant/plugin/java/api/scanner/TypeCache.java
TypeCache.get
public CachedType get(String fullQualifiedName) { CachedType cachedType = lruCache.getIfPresent(fullQualifiedName); if (cachedType != null) { return cachedType; } cachedType = softCache.getIfPresent(fullQualifiedName); if (cachedType != null) { lruCache.pu...
java
public CachedType get(String fullQualifiedName) { CachedType cachedType = lruCache.getIfPresent(fullQualifiedName); if (cachedType != null) { return cachedType; } cachedType = softCache.getIfPresent(fullQualifiedName); if (cachedType != null) { lruCache.pu...
[ "public", "CachedType", "get", "(", "String", "fullQualifiedName", ")", "{", "CachedType", "cachedType", "=", "lruCache", ".", "getIfPresent", "(", "fullQualifiedName", ")", ";", "if", "(", "cachedType", "!=", "null", ")", "{", "return", "cachedType", ";", "}"...
Find a type by its fully qualified named. @param fullQualifiedName The fqn. @return The cached type or <code>null</code>.
[ "Find", "a", "type", "by", "its", "fully", "qualified", "named", "." ]
4c050943e9c28cf1c4a08aa962d5b5bf03c4fe54
https://github.com/buschmais/jqa-java-plugin/blob/4c050943e9c28cf1c4a08aa962d5b5bf03c4fe54/src/main/java/com/buschmais/jqassistant/plugin/java/api/scanner/TypeCache.java#L41-L51
train
buschmais/jqa-java-plugin
src/main/java/com/buschmais/jqassistant/plugin/java/impl/scanner/visitor/ClassVisitor.java
ClassVisitor.getVisibility
private VisibilityModifier getVisibility(int flags) { if (hasFlag(flags, Opcodes.ACC_PRIVATE)) { return VisibilityModifier.PRIVATE; } else if (hasFlag(flags, Opcodes.ACC_PROTECTED)) { return VisibilityModifier.PROTECTED; } else if (hasFlag(flags, Opcodes.ACC_PUBLIC)) { ...
java
private VisibilityModifier getVisibility(int flags) { if (hasFlag(flags, Opcodes.ACC_PRIVATE)) { return VisibilityModifier.PRIVATE; } else if (hasFlag(flags, Opcodes.ACC_PROTECTED)) { return VisibilityModifier.PROTECTED; } else if (hasFlag(flags, Opcodes.ACC_PUBLIC)) { ...
[ "private", "VisibilityModifier", "getVisibility", "(", "int", "flags", ")", "{", "if", "(", "hasFlag", "(", "flags", ",", "Opcodes", ".", "ACC_PRIVATE", ")", ")", "{", "return", "VisibilityModifier", ".", "PRIVATE", ";", "}", "else", "if", "(", "hasFlag", ...
Returns the AccessModifier for the flag pattern. @param flags the flags @return the AccessModifier
[ "Returns", "the", "AccessModifier", "for", "the", "flag", "pattern", "." ]
4c050943e9c28cf1c4a08aa962d5b5bf03c4fe54
https://github.com/buschmais/jqa-java-plugin/blob/4c050943e9c28cf1c4a08aa962d5b5bf03c4fe54/src/main/java/com/buschmais/jqassistant/plugin/java/impl/scanner/visitor/ClassVisitor.java#L243-L253
train
buschmais/jqa-java-plugin
src/main/java/com/buschmais/jqassistant/plugin/java/impl/scanner/visitor/ClassVisitor.java
ClassVisitor.getJavaType
private Class<? extends ClassFileDescriptor> getJavaType(int flags) { if (hasFlag(flags, Opcodes.ACC_ANNOTATION)) { return AnnotationTypeDescriptor.class; } else if (hasFlag(flags, Opcodes.ACC_ENUM)) { return EnumTypeDescriptor.class; } else if (hasFlag(flags, Opcodes.ACC...
java
private Class<? extends ClassFileDescriptor> getJavaType(int flags) { if (hasFlag(flags, Opcodes.ACC_ANNOTATION)) { return AnnotationTypeDescriptor.class; } else if (hasFlag(flags, Opcodes.ACC_ENUM)) { return EnumTypeDescriptor.class; } else if (hasFlag(flags, Opcodes.ACC...
[ "private", "Class", "<", "?", "extends", "ClassFileDescriptor", ">", "getJavaType", "(", "int", "flags", ")", "{", "if", "(", "hasFlag", "(", "flags", ",", "Opcodes", ".", "ACC_ANNOTATION", ")", ")", "{", "return", "AnnotationTypeDescriptor", ".", "class", "...
Determine the types label to be applied to a class node. @param flags The access flags. @return The types label.
[ "Determine", "the", "types", "label", "to", "be", "applied", "to", "a", "class", "node", "." ]
4c050943e9c28cf1c4a08aa962d5b5bf03c4fe54
https://github.com/buschmais/jqa-java-plugin/blob/4c050943e9c28cf1c4a08aa962d5b5bf03c4fe54/src/main/java/com/buschmais/jqassistant/plugin/java/impl/scanner/visitor/ClassVisitor.java#L262-L271
train
jankroken/commandline
src/main/java/com/github/jankroken/commandline/domain/internal/LongOrCompactTokenizer.java
LongOrCompactTokenizer.peek
public Token peek() { if (!splitTokens.isEmpty()) { return splitTokens.peek(); } final var value = stringIterator.peek(); if (argumentEscapeEncountered) { return new ArgumentToken(value); } if (Objects.equals(value, argumentTerminator)) { ...
java
public Token peek() { if (!splitTokens.isEmpty()) { return splitTokens.peek(); } final var value = stringIterator.peek(); if (argumentEscapeEncountered) { return new ArgumentToken(value); } if (Objects.equals(value, argumentTerminator)) { ...
[ "public", "Token", "peek", "(", ")", "{", "if", "(", "!", "splitTokens", ".", "isEmpty", "(", ")", ")", "{", "return", "splitTokens", ".", "peek", "(", ")", ";", "}", "final", "var", "value", "=", "stringIterator", ".", "peek", "(", ")", ";", "if",...
this is a mess - need to be cleaned up
[ "this", "is", "a", "mess", "-", "need", "to", "be", "cleaned", "up" ]
6c0c11dbd102974f05f175ddfe1cba7fbb0cf341
https://github.com/jankroken/commandline/blob/6c0c11dbd102974f05f175ddfe1cba7fbb0cf341/src/main/java/com/github/jankroken/commandline/domain/internal/LongOrCompactTokenizer.java#L35-L65
train
jankroken/commandline
src/main/java/com/github/jankroken/commandline/domain/internal/LongOrCompactTokenizer.java
LongOrCompactTokenizer.next
public Token next() { if (!splitTokens.isEmpty()) { return splitTokens.remove(); } var value = stringIterator.next(); if (argumentEscapeEncountered) { return new ArgumentToken(value); } if (Objects.equals(value, argumentTerminator)) { ...
java
public Token next() { if (!splitTokens.isEmpty()) { return splitTokens.remove(); } var value = stringIterator.next(); if (argumentEscapeEncountered) { return new ArgumentToken(value); } if (Objects.equals(value, argumentTerminator)) { ...
[ "public", "Token", "next", "(", ")", "{", "if", "(", "!", "splitTokens", ".", "isEmpty", "(", ")", ")", "{", "return", "splitTokens", ".", "remove", "(", ")", ";", "}", "var", "value", "=", "stringIterator", ".", "next", "(", ")", ";", "if", "(", ...
this is a mess - needs to be cleaned up
[ "this", "is", "a", "mess", "-", "needs", "to", "be", "cleaned", "up" ]
6c0c11dbd102974f05f175ddfe1cba7fbb0cf341
https://github.com/jankroken/commandline/blob/6c0c11dbd102974f05f175ddfe1cba7fbb0cf341/src/main/java/com/github/jankroken/commandline/domain/internal/LongOrCompactTokenizer.java#L68-L99
train
jankroken/commandline
src/main/java/com/github/jankroken/commandline/CommandLineParser.java
CommandLineParser.parse
public static <T> T parse(Class<T> optionClass, String[] args, OptionStyle style) throws IllegalAccessException, InstantiationException, InvocationTargetException { T spec; try { spec = optionClass.getConstructor().newInstance(); } catch (NoSuchMethodException noSuchMetho...
java
public static <T> T parse(Class<T> optionClass, String[] args, OptionStyle style) throws IllegalAccessException, InstantiationException, InvocationTargetException { T spec; try { spec = optionClass.getConstructor().newInstance(); } catch (NoSuchMethodException noSuchMetho...
[ "public", "static", "<", "T", ">", "T", "parse", "(", "Class", "<", "T", ">", "optionClass", ",", "String", "[", "]", "args", ",", "OptionStyle", "style", ")", "throws", "IllegalAccessException", ",", "InstantiationException", ",", "InvocationTargetException", ...
A command line parser. It takes two arguments, a class and an argument list, and returns an instance of the class, populated from the argument list based on the annotations in the class. The class must have a no argument constructor. @param <T> The type of the provided class @param optionClass A class that con...
[ "A", "command", "line", "parser", ".", "It", "takes", "two", "arguments", "a", "class", "and", "an", "argument", "list", "and", "returns", "an", "instance", "of", "the", "class", "populated", "from", "the", "argument", "list", "based", "on", "the", "annota...
6c0c11dbd102974f05f175ddfe1cba7fbb0cf341
https://github.com/jankroken/commandline/blob/6c0c11dbd102974f05f175ddfe1cba7fbb0cf341/src/main/java/com/github/jankroken/commandline/CommandLineParser.java#L36-L53
train
ibm-bluemix-mobile-services/bms-clientsdk-android-push
lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/push/api/MFPPushNotificationDismissHandler.java
MFPPushNotificationDismissHandler.onReceive
@Override public void onReceive(Context context, Intent intent) { String messageId = intent.getStringExtra(ID); MFPPush.getInstance().changeStatus(messageId, MFPPushNotificationStatus.DISMISSED); }
java
@Override public void onReceive(Context context, Intent intent) { String messageId = intent.getStringExtra(ID); MFPPush.getInstance().changeStatus(messageId, MFPPushNotificationStatus.DISMISSED); }
[ "@", "Override", "public", "void", "onReceive", "(", "Context", "context", ",", "Intent", "intent", ")", "{", "String", "messageId", "=", "intent", ".", "getStringExtra", "(", "ID", ")", ";", "MFPPush", ".", "getInstance", "(", ")", ".", "changeStatus", "(...
This method is called when a notification is dimissed or cleared from the notification tray. @param context This is the context of the application @param intent Intent which invoked this receiver
[ "This", "method", "is", "called", "when", "a", "notification", "is", "dimissed", "or", "cleared", "from", "the", "notification", "tray", "." ]
26c048637e81a6942004693919558f3d9aa8c674
https://github.com/ibm-bluemix-mobile-services/bms-clientsdk-android-push/blob/26c048637e81a6942004693919558f3d9aa8c674/lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/push/api/MFPPushNotificationDismissHandler.java#L35-L39
train
ibm-bluemix-mobile-services/bms-clientsdk-android-push
lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/push/api/MFPPush.java
MFPPush.isPushSupported
public boolean isPushSupported() { String version = android.os.Build.VERSION.RELEASE.substring(0, 3); return (Double.valueOf(version) >= MIN_SUPPORTED_ANDRIOD_VERSION); }
java
public boolean isPushSupported() { String version = android.os.Build.VERSION.RELEASE.substring(0, 3); return (Double.valueOf(version) >= MIN_SUPPORTED_ANDRIOD_VERSION); }
[ "public", "boolean", "isPushSupported", "(", ")", "{", "String", "version", "=", "android", ".", "os", ".", "Build", ".", "VERSION", ".", "RELEASE", ".", "substring", "(", "0", ",", "3", ")", ";", "return", "(", "Double", ".", "valueOf", "(", "version"...
Checks whether push notification is supported. @return true if push is supported, false otherwise.
[ "Checks", "whether", "push", "notification", "is", "supported", "." ]
26c048637e81a6942004693919558f3d9aa8c674
https://github.com/ibm-bluemix-mobile-services/bms-clientsdk-android-push/blob/26c048637e81a6942004693919558f3d9aa8c674/lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/push/api/MFPPush.java#L364-L367
train
ibm-bluemix-mobile-services/bms-clientsdk-android-push
lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/push/api/MFPPush.java
MFPPush.registerDeviceWithUserId
public void registerDeviceWithUserId(String userId, MFPPushResponseListener<String> listener) { if (isInitialized) { this.registerResponseListener = listener; setAppForeground(true); logger.info("MFPPush:register() - Retrieving senderId from MFPPush server."); getSenderIdFromServerAnd...
java
public void registerDeviceWithUserId(String userId, MFPPushResponseListener<String> listener) { if (isInitialized) { this.registerResponseListener = listener; setAppForeground(true); logger.info("MFPPush:register() - Retrieving senderId from MFPPush server."); getSenderIdFromServerAnd...
[ "public", "void", "registerDeviceWithUserId", "(", "String", "userId", ",", "MFPPushResponseListener", "<", "String", ">", "listener", ")", "{", "if", "(", "isInitialized", ")", "{", "this", ".", "registerResponseListener", "=", "listener", ";", "setAppForeground", ...
Registers the device for Push notifications with the given alias and consumerId @param listener - Mandatory listener class. When the device is successfully registered with Push service the {@link MFPPushResponseListener}.onSuccess method is called with the deviceId. {@link MFPPushResponseListener}.onFailure method is ...
[ "Registers", "the", "device", "for", "Push", "notifications", "with", "the", "given", "alias", "and", "consumerId" ]
26c048637e81a6942004693919558f3d9aa8c674
https://github.com/ibm-bluemix-mobile-services/bms-clientsdk-android-push/blob/26c048637e81a6942004693919558f3d9aa8c674/lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/push/api/MFPPush.java#L380-L391
train
ibm-bluemix-mobile-services/bms-clientsdk-android-push
lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/push/api/MFPPush.java
MFPPush.subscribe
public void subscribe(final String tagName, final MFPPushResponseListener<String> listener) { if (isAbleToSubscribe()) { MFPPushUrlBuilder builder = new MFPPushUrlBuilder(applicationId); String path = builder.getSubscriptionsUrl(); logger.debug("MFPPush:subscribe() - The tag subscription path is...
java
public void subscribe(final String tagName, final MFPPushResponseListener<String> listener) { if (isAbleToSubscribe()) { MFPPushUrlBuilder builder = new MFPPushUrlBuilder(applicationId); String path = builder.getSubscriptionsUrl(); logger.debug("MFPPush:subscribe() - The tag subscription path is...
[ "public", "void", "subscribe", "(", "final", "String", "tagName", ",", "final", "MFPPushResponseListener", "<", "String", ">", "listener", ")", "{", "if", "(", "isAbleToSubscribe", "(", ")", ")", "{", "MFPPushUrlBuilder", "builder", "=", "new", "MFPPushUrlBuilde...
Subscribes to the given tag @param tagName name of the tag @param listener Mandatory listener class. When the subscription is created successfully the {@link MFPPushResponseListener}.onSuccess method is called with the tagName for which subscription is created. {@link MFPPushResponseListener}.onFailure method is call...
[ "Subscribes", "to", "the", "given", "tag" ]
26c048637e81a6942004693919558f3d9aa8c674
https://github.com/ibm-bluemix-mobile-services/bms-clientsdk-android-push/blob/26c048637e81a6942004693919558f3d9aa8c674/lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/push/api/MFPPush.java#L433-L459
train
ibm-bluemix-mobile-services/bms-clientsdk-android-push
lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/push/api/MFPPush.java
MFPPush.unsubscribe
public void unsubscribe(final String tagName, final MFPPushResponseListener<String> listener) { if (isAbleToSubscribe()) { MFPPushUrlBuilder builder = new MFPPushUrlBuilder(applicationId); String path = builder.getSubscriptionsUrl(deviceId, tagName); if (path == DEVICE_ID_NULL) { listen...
java
public void unsubscribe(final String tagName, final MFPPushResponseListener<String> listener) { if (isAbleToSubscribe()) { MFPPushUrlBuilder builder = new MFPPushUrlBuilder(applicationId); String path = builder.getSubscriptionsUrl(deviceId, tagName); if (path == DEVICE_ID_NULL) { listen...
[ "public", "void", "unsubscribe", "(", "final", "String", "tagName", ",", "final", "MFPPushResponseListener", "<", "String", ">", "listener", ")", "{", "if", "(", "isAbleToSubscribe", "(", ")", ")", "{", "MFPPushUrlBuilder", "builder", "=", "new", "MFPPushUrlBuil...
Unsubscribes to the given tag @param tagName name of the tag @param listener Mandatory listener class. When the subscription is deleted successfully the {@link MFPPushResponseListener}.onSuccess method is called with the tagName for which subscription is deleted. {@link MFPPushResponseListener}.onFailure method is ca...
[ "Unsubscribes", "to", "the", "given", "tag" ]
26c048637e81a6942004693919558f3d9aa8c674
https://github.com/ibm-bluemix-mobile-services/bms-clientsdk-android-push/blob/26c048637e81a6942004693919558f3d9aa8c674/lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/push/api/MFPPush.java#L471-L501
train
ibm-bluemix-mobile-services/bms-clientsdk-android-push
lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/push/api/MFPPush.java
MFPPush.unregister
public void unregister(final MFPPushResponseListener<String> listener) { MFPPushUrlBuilder builder = new MFPPushUrlBuilder(applicationId); if (this.deviceId == null) { this.deviceId = MFPPushUtils.getContentFromSharedPreferences(appContext, applicationId + DEVICE_ID); } String path = builder.getUn...
java
public void unregister(final MFPPushResponseListener<String> listener) { MFPPushUrlBuilder builder = new MFPPushUrlBuilder(applicationId); if (this.deviceId == null) { this.deviceId = MFPPushUtils.getContentFromSharedPreferences(appContext, applicationId + DEVICE_ID); } String path = builder.getUn...
[ "public", "void", "unregister", "(", "final", "MFPPushResponseListener", "<", "String", ">", "listener", ")", "{", "MFPPushUrlBuilder", "builder", "=", "new", "MFPPushUrlBuilder", "(", "applicationId", ")", ";", "if", "(", "this", ".", "deviceId", "==", "null", ...
Unregister the device from Push Server @param listener Mandatory listener class. When the subscription is deleted successfully the {@link MFPPushResponseListener}.onSuccess method is called with the tagName for which subscription is deleted. {@link MFPPushResponseListener}.onFailure method is called otherwise
[ "Unregister", "the", "device", "from", "Push", "Server" ]
26c048637e81a6942004693919558f3d9aa8c674
https://github.com/ibm-bluemix-mobile-services/bms-clientsdk-android-push/blob/26c048637e81a6942004693919558f3d9aa8c674/lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/push/api/MFPPush.java#L512-L538
train
ibm-bluemix-mobile-services/bms-clientsdk-android-push
lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/push/api/MFPPush.java
MFPPush.getTags
public void getTags(final MFPPushResponseListener<List<String>> listener) { MFPPushUrlBuilder builder = new MFPPushUrlBuilder(applicationId); String path = builder.getTagsUrl(); MFPPushInvoker invoker = MFPPushInvoker.newInstance(appContext, path, Request.GET, clientSecret); invoker.setResponseListener...
java
public void getTags(final MFPPushResponseListener<List<String>> listener) { MFPPushUrlBuilder builder = new MFPPushUrlBuilder(applicationId); String path = builder.getTagsUrl(); MFPPushInvoker invoker = MFPPushInvoker.newInstance(appContext, path, Request.GET, clientSecret); invoker.setResponseListener...
[ "public", "void", "getTags", "(", "final", "MFPPushResponseListener", "<", "List", "<", "String", ">", ">", "listener", ")", "{", "MFPPushUrlBuilder", "builder", "=", "new", "MFPPushUrlBuilder", "(", "applicationId", ")", ";", "String", "path", "=", "builder", ...
Get the list of tags @param listener Mandatory listener class. When the list of tags are successfully retrieved the {@link MFPPushResponseListener} .onSuccess method is called with the list of tagNames {@link MFPPushResponseListener}.onFailure method is called otherwise
[ "Get", "the", "list", "of", "tags" ]
26c048637e81a6942004693919558f3d9aa8c674
https://github.com/ibm-bluemix-mobile-services/bms-clientsdk-android-push/blob/26c048637e81a6942004693919558f3d9aa8c674/lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/push/api/MFPPush.java#L549-L585
train
ibm-bluemix-mobile-services/bms-clientsdk-android-push
lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/push/api/MFPPush.java
MFPPush.getSubscriptions
public void getSubscriptions( final MFPPushResponseListener<List<String>> listener) { MFPPushUrlBuilder builder = new MFPPushUrlBuilder(applicationId); String path = builder.getSubscriptionsUrl(deviceId, null); if (path == DEVICE_ID_NULL) { listener.onFailure(new MFPPushException("The device is no...
java
public void getSubscriptions( final MFPPushResponseListener<List<String>> listener) { MFPPushUrlBuilder builder = new MFPPushUrlBuilder(applicationId); String path = builder.getSubscriptionsUrl(deviceId, null); if (path == DEVICE_ID_NULL) { listener.onFailure(new MFPPushException("The device is no...
[ "public", "void", "getSubscriptions", "(", "final", "MFPPushResponseListener", "<", "List", "<", "String", ">", ">", "listener", ")", "{", "MFPPushUrlBuilder", "builder", "=", "new", "MFPPushUrlBuilder", "(", "applicationId", ")", ";", "String", "path", "=", "bu...
Get the list of tags subscribed to @param listener Mandatory listener class. When the list of tags subscribed to are successfully retrieved the {@link MFPPushResponseListener} .onSuccess method is called with the list of tagNames {@link MFPPushResponseListener}.onFailure method is called otherwise
[ "Get", "the", "list", "of", "tags", "subscribed", "to" ]
26c048637e81a6942004693919558f3d9aa8c674
https://github.com/ibm-bluemix-mobile-services/bms-clientsdk-android-push/blob/26c048637e81a6942004693919558f3d9aa8c674/lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/push/api/MFPPush.java#L596-L637
train
ibm-bluemix-mobile-services/bms-clientsdk-android-push
lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/push/api/MFPPush.java
MFPPush.setNotificationOptions
private void setNotificationOptions(Context context,MFPPushNotificationOptions options) { if (this.appContext == null) { this.appContext = context.getApplicationContext(); } this.options = options; Gson gson = new Gson(); String json = gson.toJson(options); SharedPreferences sharedPrefere...
java
private void setNotificationOptions(Context context,MFPPushNotificationOptions options) { if (this.appContext == null) { this.appContext = context.getApplicationContext(); } this.options = options; Gson gson = new Gson(); String json = gson.toJson(options); SharedPreferences sharedPrefere...
[ "private", "void", "setNotificationOptions", "(", "Context", "context", ",", "MFPPushNotificationOptions", "options", ")", "{", "if", "(", "this", ".", "appContext", "==", "null", ")", "{", "this", ".", "appContext", "=", "context", ".", "getApplicationContext", ...
Set the default push notification options for notifications. @param context - this is the Context of the application from getApplicationContext() @param options - The MFPPushNotificationOptions with the default parameters
[ "Set", "the", "default", "push", "notification", "options", "for", "notifications", "." ]
26c048637e81a6942004693919558f3d9aa8c674
https://github.com/ibm-bluemix-mobile-services/bms-clientsdk-android-push/blob/26c048637e81a6942004693919558f3d9aa8c674/lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/push/api/MFPPush.java#L656-L666
train
ibm-bluemix-mobile-services/bms-clientsdk-android-push
lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/push/api/MFPPush.java
MFPPush.setNotificationStatusListener
public void setNotificationStatusListener(MFPPushNotificationStatusListener statusListener) { this.statusListener = statusListener; synchronized (pendingStatus) { if(!pendingStatus.isEmpty()) { for(Map.Entry<String, MFPPushNotificationStatus> entry : pendingStatus.entrySet()) { changeSta...
java
public void setNotificationStatusListener(MFPPushNotificationStatusListener statusListener) { this.statusListener = statusListener; synchronized (pendingStatus) { if(!pendingStatus.isEmpty()) { for(Map.Entry<String, MFPPushNotificationStatus> entry : pendingStatus.entrySet()) { changeSta...
[ "public", "void", "setNotificationStatusListener", "(", "MFPPushNotificationStatusListener", "statusListener", ")", "{", "this", ".", "statusListener", "=", "statusListener", ";", "synchronized", "(", "pendingStatus", ")", "{", "if", "(", "!", "pendingStatus", ".", "i...
Set the listener class to receive the notification status changes. @param statusListener - Mandatory listener class. When the notification status changes {@link MFPPushNotificationStatusListener}.onStatusChange method is called
[ "Set", "the", "listener", "class", "to", "receive", "the", "notification", "status", "changes", "." ]
26c048637e81a6942004693919558f3d9aa8c674
https://github.com/ibm-bluemix-mobile-services/bms-clientsdk-android-push/blob/26c048637e81a6942004693919558f3d9aa8c674/lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/push/api/MFPPush.java#L673-L683
train
ibm-bluemix-mobile-services/bms-clientsdk-android-push
lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/push/api/MFPPush.java
MFPPush.getMessagesFromSharedPreferences
public boolean getMessagesFromSharedPreferences(int notificationId) { boolean gotMessages = false; SharedPreferences sharedPreferences = appContext.getSharedPreferences( PREFS_NAME, Context.MODE_PRIVATE); int countOfStoredMessages = sharedPreferences.getInt(MFPPush.PREFS_NOTIFICATION_COUNT, 0); if...
java
public boolean getMessagesFromSharedPreferences(int notificationId) { boolean gotMessages = false; SharedPreferences sharedPreferences = appContext.getSharedPreferences( PREFS_NAME, Context.MODE_PRIVATE); int countOfStoredMessages = sharedPreferences.getInt(MFPPush.PREFS_NOTIFICATION_COUNT, 0); if...
[ "public", "boolean", "getMessagesFromSharedPreferences", "(", "int", "notificationId", ")", "{", "boolean", "gotMessages", "=", "false", ";", "SharedPreferences", "sharedPreferences", "=", "appContext", ".", "getSharedPreferences", "(", "PREFS_NAME", ",", "Context", "."...
Based on the PREFS_NOTIFICATION_COUNT value, fetch all the stored notifications in the same order from the shared preferences and save it onto the list. This method will ensure that the notifications are sent to the Application in the same order in which they arrived.
[ "Based", "on", "the", "PREFS_NOTIFICATION_COUNT", "value", "fetch", "all", "the", "stored", "notifications", "in", "the", "same", "order", "from", "the", "shared", "preferences", "and", "save", "it", "onto", "the", "list", ".", "This", "method", "will", "ensur...
26c048637e81a6942004693919558f3d9aa8c674
https://github.com/ibm-bluemix-mobile-services/bms-clientsdk-android-push/blob/26c048637e81a6942004693919558f3d9aa8c674/lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/push/api/MFPPush.java#L1237-L1294
train
ibm-bluemix-mobile-services/bms-clientsdk-android-push
lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/push/internal/MFPPushUtils.java
MFPPushUtils.removeContentFromSharedPreferences
public static void removeContentFromSharedPreferences(SharedPreferences sharedPreferences, String key ) { Editor editor = sharedPreferences.edit(); String msg = sharedPreferences.getString(key, null); editor.remove(key); editor.commit(); }
java
public static void removeContentFromSharedPreferences(SharedPreferences sharedPreferences, String key ) { Editor editor = sharedPreferences.edit(); String msg = sharedPreferences.getString(key, null); editor.remove(key); editor.commit(); }
[ "public", "static", "void", "removeContentFromSharedPreferences", "(", "SharedPreferences", "sharedPreferences", ",", "String", "key", ")", "{", "Editor", "editor", "=", "sharedPreferences", ".", "edit", "(", ")", ";", "String", "msg", "=", "sharedPreferences", ".",...
Remove the key from SharedPreferences
[ "Remove", "the", "key", "from", "SharedPreferences" ]
26c048637e81a6942004693919558f3d9aa8c674
https://github.com/ibm-bluemix-mobile-services/bms-clientsdk-android-push/blob/26c048637e81a6942004693919558f3d9aa8c674/lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/push/internal/MFPPushUtils.java#L97-L103
train
ibm-bluemix-mobile-services/bms-clientsdk-android-push
lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/push/internal/MFPPushUtils.java
MFPPushUtils.storeContentInSharedPreferences
public static void storeContentInSharedPreferences(SharedPreferences sharedPreferences, String key, String value ) { Editor editor = sharedPreferences.edit(); editor.putString(key, value); editor.commit(); }
java
public static void storeContentInSharedPreferences(SharedPreferences sharedPreferences, String key, String value ) { Editor editor = sharedPreferences.edit(); editor.putString(key, value); editor.commit(); }
[ "public", "static", "void", "storeContentInSharedPreferences", "(", "SharedPreferences", "sharedPreferences", ",", "String", "key", ",", "String", "value", ")", "{", "Editor", "editor", "=", "sharedPreferences", ".", "edit", "(", ")", ";", "editor", ".", "putStrin...
Store the key, value in SharedPreferences
[ "Store", "the", "key", "value", "in", "SharedPreferences" ]
26c048637e81a6942004693919558f3d9aa8c674
https://github.com/ibm-bluemix-mobile-services/bms-clientsdk-android-push/blob/26c048637e81a6942004693919558f3d9aa8c674/lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/push/internal/MFPPushUtils.java#L106-L110
train
IanGClifton/AndroidFloatLabel
FloatLabel/src/com/iangclifton/android/floatlabel/FloatLabel.java
FloatLabel.setText
public void setText(CharSequence text, TextView.BufferType type) { mEditText.setText(text, type); }
java
public void setText(CharSequence text, TextView.BufferType type) { mEditText.setText(text, type); }
[ "public", "void", "setText", "(", "CharSequence", "text", ",", "TextView", ".", "BufferType", "type", ")", "{", "mEditText", ".", "setText", "(", "text", ",", "type", ")", ";", "}" ]
Sets the EditText's text with label animation @param text CharSequence to set @param type TextView.BufferType
[ "Sets", "the", "EditText", "s", "text", "with", "label", "animation" ]
b0a39c26f010f17d5f3648331e9784a41e025c0d
https://github.com/IanGClifton/AndroidFloatLabel/blob/b0a39c26f010f17d5f3648331e9784a41e025c0d/FloatLabel/src/com/iangclifton/android/floatlabel/FloatLabel.java#L270-L272
train
recombee/java-api-client
src/main/java/com/recombee/api_client/bindings/RecommendationResponse.java
RecommendationResponse.getIds
public String[] getIds() { String[] ids = new String[recomms.length]; for(int i = 0; i< recomms.length; i++) ids[i] = recomms[i].getId(); return ids; }
java
public String[] getIds() { String[] ids = new String[recomms.length]; for(int i = 0; i< recomms.length; i++) ids[i] = recomms[i].getId(); return ids; }
[ "public", "String", "[", "]", "getIds", "(", ")", "{", "String", "[", "]", "ids", "=", "new", "String", "[", "recomms", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "recomms", ".", "length", ";", "i", "++", ")", "...
Get ids of recommended entities
[ "Get", "ids", "of", "recommended", "entities" ]
a00389554a419410ac0bdd8c4d0f1d3ea514f120
https://github.com/recombee/java-api-client/blob/a00389554a419410ac0bdd8c4d0f1d3ea514f120/src/main/java/com/recombee/api_client/bindings/RecommendationResponse.java#L61-L66
train
ribot/easy-adapter
library/src/main/java/uk/co/ribot/easyadapter/ItemViewHolder.java
ItemViewHolder.getListener
@Nullable public <P> P getListener(Class<P> type) { if (mListener != null) { return type.cast(mListener); } return null; }
java
@Nullable public <P> P getListener(Class<P> type) { if (mListener != null) { return type.cast(mListener); } return null; }
[ "@", "Nullable", "public", "<", "P", ">", "P", "getListener", "(", "Class", "<", "P", ">", "type", ")", "{", "if", "(", "mListener", "!=", "null", ")", "{", "return", "type", ".", "cast", "(", "mListener", ")", ";", "}", "return", "null", ";", "}...
Gets the listener object that was passed into the Adapter through its constructor and cast it to a given type. @param type the type of the listener @return the listener casted to the given type or null if not listener was set into the Adapter.
[ "Gets", "the", "listener", "object", "that", "was", "passed", "into", "the", "Adapter", "through", "its", "constructor", "and", "cast", "it", "to", "a", "given", "type", "." ]
8cf85023a79c781aa2013e9dc39fd66734fb2019
https://github.com/ribot/easy-adapter/blob/8cf85023a79c781aa2013e9dc39fd66734fb2019/library/src/main/java/uk/co/ribot/easyadapter/ItemViewHolder.java#L108-L114
train