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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
molgenis/molgenis | molgenis-semantic-mapper/src/main/java/org/molgenis/semanticmapper/controller/TagWizardController.java | TagWizardController.viewTagWizard | @GetMapping
public String viewTagWizard(
@RequestParam(required = false, value = "selectedTarget") String target, Model model) {
List<String> entityTypeIds =
dataService
.findAll(ENTITY_TYPE_META_DATA, EntityType.class)
.filter(entityType -> !EntityTypeUtils.isSystemEntity(en... | java | @GetMapping
public String viewTagWizard(
@RequestParam(required = false, value = "selectedTarget") String target, Model model) {
List<String> entityTypeIds =
dataService
.findAll(ENTITY_TYPE_META_DATA, EntityType.class)
.filter(entityType -> !EntityTypeUtils.isSystemEntity(en... | [
"@",
"GetMapping",
"public",
"String",
"viewTagWizard",
"(",
"@",
"RequestParam",
"(",
"required",
"=",
"false",
",",
"value",
"=",
"\"selectedTarget\"",
")",
"String",
"target",
",",
"Model",
"model",
")",
"{",
"List",
"<",
"String",
">",
"entityTypeIds",
"... | Displays on tag wizard button press
@param target The target entity name
@param model the model
@return name of the tag wizard view | [
"Displays",
"on",
"tag",
"wizard",
"button",
"press"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-semantic-mapper/src/main/java/org/molgenis/semanticmapper/controller/TagWizardController.java#L87-L125 | train |
molgenis/molgenis | molgenis-data-i18n/src/main/java/org/molgenis/data/i18n/model/LanguageFactory.java | LanguageFactory.create | public Language create(String code, String name, boolean active) {
Language language = super.create(code);
language.setName(name);
language.setActive(active);
return language;
} | java | public Language create(String code, String name, boolean active) {
Language language = super.create(code);
language.setName(name);
language.setActive(active);
return language;
} | [
"public",
"Language",
"create",
"(",
"String",
"code",
",",
"String",
"name",
",",
"boolean",
"active",
")",
"{",
"Language",
"language",
"=",
"super",
".",
"create",
"(",
"code",
")",
";",
"language",
".",
"setName",
"(",
"name",
")",
";",
"language",
... | Creates a language with the given code and name
@param code language code, e.g. "en"
@param name language name, e.g. "English"
@param active language active, e.g "true"
@return new language | [
"Creates",
"a",
"language",
"with",
"the",
"given",
"code",
"and",
"name"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-i18n/src/main/java/org/molgenis/data/i18n/model/LanguageFactory.java#L22-L27 | train |
molgenis/molgenis | molgenis-data-postgresql/src/main/java/org/molgenis/data/postgresql/PostgreSqlQueryGenerator.java | PostgreSqlQueryGenerator.getSqlAddColumn | static String getSqlAddColumn(EntityType entityType, Attribute attr, ColumnMode columnMode) {
StringBuilder sql = new StringBuilder("ALTER TABLE ");
String columnSql = getSqlColumn(entityType, attr, columnMode);
sql.append(getTableName(entityType)).append(" ADD ").append(columnSql);
List<String> sqlTa... | java | static String getSqlAddColumn(EntityType entityType, Attribute attr, ColumnMode columnMode) {
StringBuilder sql = new StringBuilder("ALTER TABLE ");
String columnSql = getSqlColumn(entityType, attr, columnMode);
sql.append(getTableName(entityType)).append(" ADD ").append(columnSql);
List<String> sqlTa... | [
"static",
"String",
"getSqlAddColumn",
"(",
"EntityType",
"entityType",
",",
"Attribute",
"attr",
",",
"ColumnMode",
"columnMode",
")",
"{",
"StringBuilder",
"sql",
"=",
"new",
"StringBuilder",
"(",
"\"ALTER TABLE \"",
")",
";",
"String",
"columnSql",
"=",
"getSql... | Returns SQL string to add a column to an existing table.
@param entityType entity meta data
@param attr attribute
@param columnMode column mode
@return SQL string | [
"Returns",
"SQL",
"string",
"to",
"add",
"a",
"column",
"to",
"an",
"existing",
"table",
"."
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-postgresql/src/main/java/org/molgenis/data/postgresql/PostgreSqlQueryGenerator.java#L212-L224 | train |
molgenis/molgenis | molgenis-data-postgresql/src/main/java/org/molgenis/data/postgresql/PostgreSqlQueryGenerator.java | PostgreSqlQueryGenerator.getSqlDropColumnDefault | static String getSqlDropColumnDefault(EntityType entityType, Attribute attr) {
return "ALTER TABLE "
+ getTableName(entityType)
+ " ALTER COLUMN "
+ getColumnName(attr)
+ " DROP DEFAULT";
} | java | static String getSqlDropColumnDefault(EntityType entityType, Attribute attr) {
return "ALTER TABLE "
+ getTableName(entityType)
+ " ALTER COLUMN "
+ getColumnName(attr)
+ " DROP DEFAULT";
} | [
"static",
"String",
"getSqlDropColumnDefault",
"(",
"EntityType",
"entityType",
",",
"Attribute",
"attr",
")",
"{",
"return",
"\"ALTER TABLE \"",
"+",
"getTableName",
"(",
"entityType",
")",
"+",
"\" ALTER COLUMN \"",
"+",
"getColumnName",
"(",
"attr",
")",
"+",
"... | Returns SQL string to remove the default value from an existing column.
@param entityType entity meta data
@param attr attribute
@return SQL string | [
"Returns",
"SQL",
"string",
"to",
"remove",
"the",
"default",
"value",
"from",
"an",
"existing",
"column",
"."
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-postgresql/src/main/java/org/molgenis/data/postgresql/PostgreSqlQueryGenerator.java#L233-L239 | train |
molgenis/molgenis | molgenis-data-postgresql/src/main/java/org/molgenis/data/postgresql/PostgreSqlQueryGenerator.java | PostgreSqlQueryGenerator.isPersistedInOtherTable | private static boolean isPersistedInOtherTable(Attribute attr) {
boolean bidirectionalOneToMany = attr.getDataType() == ONE_TO_MANY && attr.isMappedBy();
return isMultipleReferenceType(attr) || bidirectionalOneToMany;
} | java | private static boolean isPersistedInOtherTable(Attribute attr) {
boolean bidirectionalOneToMany = attr.getDataType() == ONE_TO_MANY && attr.isMappedBy();
return isMultipleReferenceType(attr) || bidirectionalOneToMany;
} | [
"private",
"static",
"boolean",
"isPersistedInOtherTable",
"(",
"Attribute",
"attr",
")",
"{",
"boolean",
"bidirectionalOneToMany",
"=",
"attr",
".",
"getDataType",
"(",
")",
"==",
"ONE_TO_MANY",
"&&",
"attr",
".",
"isMappedBy",
"(",
")",
";",
"return",
"isMulti... | Returns whether this attribute is stored in the entity table or another table such as a
junction table or referenced entity table.
@param attr attribute
@return whether this attribute is stored in another table than the entity table | [
"Returns",
"whether",
"this",
"attribute",
"is",
"stored",
"in",
"the",
"entity",
"table",
"or",
"another",
"table",
"such",
"as",
"a",
"junction",
"table",
"or",
"referenced",
"entity",
"table",
"."
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-postgresql/src/main/java/org/molgenis/data/postgresql/PostgreSqlQueryGenerator.java#L473-L476 | train |
molgenis/molgenis | molgenis-data-postgresql/src/main/java/org/molgenis/data/postgresql/PostgreSqlQueryGenerator.java | PostgreSqlQueryGenerator.isDistinctSelectRequired | private static <E extends Entity> boolean isDistinctSelectRequired(
EntityType entityType, Query<E> q) {
return isDistinctSelectRequiredRec(entityType, q.getRules());
} | java | private static <E extends Entity> boolean isDistinctSelectRequired(
EntityType entityType, Query<E> q) {
return isDistinctSelectRequiredRec(entityType, q.getRules());
} | [
"private",
"static",
"<",
"E",
"extends",
"Entity",
">",
"boolean",
"isDistinctSelectRequired",
"(",
"EntityType",
"entityType",
",",
"Query",
"<",
"E",
">",
"q",
")",
"{",
"return",
"isDistinctSelectRequiredRec",
"(",
"entityType",
",",
"q",
".",
"getRules",
... | Determines whether a distinct select is required based on a given query.
@param entityType entity meta data
@param q query
@param <E> entity type
@return <code>true</code> if a distinct select is required for SQL queries based on the given
query
@throws UnknownAttributeException if query field refers to an attribute t... | [
"Determines",
"whether",
"a",
"distinct",
"select",
"is",
"required",
"based",
"on",
"a",
"given",
"query",
"."
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-postgresql/src/main/java/org/molgenis/data/postgresql/PostgreSqlQueryGenerator.java#L511-L514 | train |
molgenis/molgenis | molgenis-data-postgresql/src/main/java/org/molgenis/data/postgresql/PostgreSqlQueryGenerator.java | PostgreSqlQueryGenerator.getSqlCount | static <E extends Entity> String getSqlCount(
EntityType entityType, Query<E> q, List<Object> parameters) {
StringBuilder sqlBuilder = new StringBuilder("SELECT COUNT");
String idAttribute = getColumnName(entityType.getIdAttribute());
List<QueryRule> queryRules = q.getRules();
if (queryRules == n... | java | static <E extends Entity> String getSqlCount(
EntityType entityType, Query<E> q, List<Object> parameters) {
StringBuilder sqlBuilder = new StringBuilder("SELECT COUNT");
String idAttribute = getColumnName(entityType.getIdAttribute());
List<QueryRule> queryRules = q.getRules();
if (queryRules == n... | [
"static",
"<",
"E",
"extends",
"Entity",
">",
"String",
"getSqlCount",
"(",
"EntityType",
"entityType",
",",
"Query",
"<",
"E",
">",
"q",
",",
"List",
"<",
"Object",
">",
"parameters",
")",
"{",
"StringBuilder",
"sqlBuilder",
"=",
"new",
"StringBuilder",
"... | Produces SQL to count the number of entities that match the given query. Ignores query offset
and pagesize.
@param q query
@param parameters prepared statement parameters
@return SQL string | [
"Produces",
"SQL",
"to",
"count",
"the",
"number",
"of",
"entities",
"that",
"match",
"the",
"given",
"query",
".",
"Ignores",
"query",
"offset",
"and",
"pagesize",
"."
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-postgresql/src/main/java/org/molgenis/data/postgresql/PostgreSqlQueryGenerator.java#L667-L689 | train |
molgenis/molgenis | molgenis-data-security/src/main/java/org/molgenis/data/security/auth/GroupService.java | GroupService.getGroup | @RunAsSystem
public Group getGroup(String groupName) {
Fetch roleFetch = new Fetch().field(RoleMetadata.NAME).field(RoleMetadata.LABEL);
Fetch fetch =
new Fetch()
.field(GroupMetadata.ROLES, roleFetch)
.field(GroupMetadata.NAME)
.field(GroupMetadata.LABEL)
... | java | @RunAsSystem
public Group getGroup(String groupName) {
Fetch roleFetch = new Fetch().field(RoleMetadata.NAME).field(RoleMetadata.LABEL);
Fetch fetch =
new Fetch()
.field(GroupMetadata.ROLES, roleFetch)
.field(GroupMetadata.NAME)
.field(GroupMetadata.LABEL)
... | [
"@",
"RunAsSystem",
"public",
"Group",
"getGroup",
"(",
"String",
"groupName",
")",
"{",
"Fetch",
"roleFetch",
"=",
"new",
"Fetch",
"(",
")",
".",
"field",
"(",
"RoleMetadata",
".",
"NAME",
")",
".",
"field",
"(",
"RoleMetadata",
".",
"LABEL",
")",
";",
... | Get the group entity by its unique name.
@param groupName unique group name
@return group with given name
@throws UnknownEntityException in case no group with given name can be retrieved | [
"Get",
"the",
"group",
"entity",
"by",
"its",
"unique",
"name",
"."
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-security/src/main/java/org/molgenis/data/security/auth/GroupService.java#L119-L143 | train |
molgenis/molgenis | molgenis-data-security/src/main/java/org/molgenis/data/security/auth/GroupService.java | GroupService.addMember | @RunAsSystem
public void addMember(final Group group, final User user, final Role role) {
ArrayList<Role> groupRoles = newArrayList(group.getRoles());
Collection<RoleMembership> memberships = roleMembershipService.getMemberships(groupRoles);
boolean isGroupRole = groupRoles.stream().anyMatch(gr -> gr.getN... | java | @RunAsSystem
public void addMember(final Group group, final User user, final Role role) {
ArrayList<Role> groupRoles = newArrayList(group.getRoles());
Collection<RoleMembership> memberships = roleMembershipService.getMemberships(groupRoles);
boolean isGroupRole = groupRoles.stream().anyMatch(gr -> gr.getN... | [
"@",
"RunAsSystem",
"public",
"void",
"addMember",
"(",
"final",
"Group",
"group",
",",
"final",
"User",
"user",
",",
"final",
"Role",
"role",
")",
"{",
"ArrayList",
"<",
"Role",
">",
"groupRoles",
"=",
"newArrayList",
"(",
"group",
".",
"getRoles",
"(",
... | Add member to group. User can only be added to a role that belongs to the group. The user can
only have a single role within the group
@param group group to add the user to in the given role
@param user user to be added in the given role to the given group
@param role role in which the given user is to be added to giv... | [
"Add",
"member",
"to",
"group",
".",
"User",
"can",
"only",
"be",
"added",
"to",
"a",
"role",
"that",
"belongs",
"to",
"the",
"group",
".",
"The",
"user",
"can",
"only",
"have",
"a",
"single",
"role",
"within",
"the",
"group"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-security/src/main/java/org/molgenis/data/security/auth/GroupService.java#L153-L170 | train |
molgenis/molgenis | molgenis-core-ui/src/main/java/org/molgenis/core/ui/LogoController.java | LogoController.getLogo | @GetMapping("/logo/{name}.{extension}")
public void getLogo(
OutputStream out,
@PathVariable("name") String name,
@PathVariable("extension") String extension,
HttpServletResponse response)
throws IOException {
File f = fileStore.getFileUnchecked("/logo/" + name + "." + extension);
... | java | @GetMapping("/logo/{name}.{extension}")
public void getLogo(
OutputStream out,
@PathVariable("name") String name,
@PathVariable("extension") String extension,
HttpServletResponse response)
throws IOException {
File f = fileStore.getFileUnchecked("/logo/" + name + "." + extension);
... | [
"@",
"GetMapping",
"(",
"\"/logo/{name}.{extension}\"",
")",
"public",
"void",
"getLogo",
"(",
"OutputStream",
"out",
",",
"@",
"PathVariable",
"(",
"\"name\"",
")",
"String",
"name",
",",
"@",
"PathVariable",
"(",
"\"extension\"",
")",
"String",
"extension",
",... | Get a file from the logo subdirectory of the filestore | [
"Get",
"a",
"file",
"from",
"the",
"logo",
"subdirectory",
"of",
"the",
"filestore"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-core-ui/src/main/java/org/molgenis/core/ui/LogoController.java#L24-L44 | train |
molgenis/molgenis | molgenis-data-postgresql/src/main/java/org/molgenis/data/postgresql/PostgreSqlQueryUtils.java | PostgreSqlQueryUtils.isPersistedInPostgreSql | static boolean isPersistedInPostgreSql(EntityType entityType) {
String backend = entityType.getBackend();
if (backend == null) {
// TODO remove this check after getBackend always returns the backend
if (null != getApplicationContext()) {
DataService dataService = getApplicationContext().getB... | java | static boolean isPersistedInPostgreSql(EntityType entityType) {
String backend = entityType.getBackend();
if (backend == null) {
// TODO remove this check after getBackend always returns the backend
if (null != getApplicationContext()) {
DataService dataService = getApplicationContext().getB... | [
"static",
"boolean",
"isPersistedInPostgreSql",
"(",
"EntityType",
"entityType",
")",
"{",
"String",
"backend",
"=",
"entityType",
".",
"getBackend",
"(",
")",
";",
"if",
"(",
"backend",
"==",
"null",
")",
"{",
"// TODO remove this check after getBackend always return... | Returns whether the given entity is persisted in PostgreSQL
@param entityType entity meta data
@return true is the entity is persisted in PostgreSQL | [
"Returns",
"whether",
"the",
"given",
"entity",
"is",
"persisted",
"in",
"PostgreSQL"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-postgresql/src/main/java/org/molgenis/data/postgresql/PostgreSqlQueryUtils.java#L70-L83 | train |
molgenis/molgenis | molgenis-data-elasticsearch/src/main/java/org/molgenis/data/elasticsearch/generator/DocumentIdGenerator.java | DocumentIdGenerator.generateId | @Override
public String generateId(Attribute attribute) {
String idPart = generateHashcode(attribute.getEntity().getId() + attribute.getIdentifier());
String namePart = truncateName(cleanName(attribute.getName()));
return namePart + SEPARATOR + idPart;
} | java | @Override
public String generateId(Attribute attribute) {
String idPart = generateHashcode(attribute.getEntity().getId() + attribute.getIdentifier());
String namePart = truncateName(cleanName(attribute.getName()));
return namePart + SEPARATOR + idPart;
} | [
"@",
"Override",
"public",
"String",
"generateId",
"(",
"Attribute",
"attribute",
")",
"{",
"String",
"idPart",
"=",
"generateHashcode",
"(",
"attribute",
".",
"getEntity",
"(",
")",
".",
"getId",
"(",
")",
"+",
"attribute",
".",
"getIdentifier",
"(",
")",
... | Generates a field name for the given entity type
@param attribute attribute
@return human readable field name (unique within the system) | [
"Generates",
"a",
"field",
"name",
"for",
"the",
"given",
"entity",
"type"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-elasticsearch/src/main/java/org/molgenis/data/elasticsearch/generator/DocumentIdGenerator.java#L46-L51 | train |
molgenis/molgenis | molgenis-web/src/main/java/org/molgenis/web/PluginController.java | PluginController.getPluginSettings | @SuppressWarnings("WeakerAccess")
public Entity getPluginSettings() {
String entityTypeId = DefaultSettingsEntityType.getSettingsEntityName(getId());
return RunAsSystemAspect.runAsSystem(() -> getPluginSettings(entityTypeId));
} | java | @SuppressWarnings("WeakerAccess")
public Entity getPluginSettings() {
String entityTypeId = DefaultSettingsEntityType.getSettingsEntityName(getId());
return RunAsSystemAspect.runAsSystem(() -> getPluginSettings(entityTypeId));
} | [
"@",
"SuppressWarnings",
"(",
"\"WeakerAccess\"",
")",
"public",
"Entity",
"getPluginSettings",
"(",
")",
"{",
"String",
"entityTypeId",
"=",
"DefaultSettingsEntityType",
".",
"getSettingsEntityName",
"(",
"getId",
"(",
")",
")",
";",
"return",
"RunAsSystemAspect",
... | Returns an entity containing settings for a plugin or null if no settings exist.
@return entity or null | [
"Returns",
"an",
"entity",
"containing",
"settings",
"for",
"a",
"plugin",
"or",
"null",
"if",
"no",
"settings",
"exist",
"."
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-web/src/main/java/org/molgenis/web/PluginController.java#L41-L45 | train |
molgenis/molgenis | molgenis-data/src/main/java/org/molgenis/data/decorator/meta/DynamicDecoratorPopulator.java | DynamicDecoratorPopulator.removeReferencesOrDeleteIfEmpty | DecoratorConfiguration removeReferencesOrDeleteIfEmpty(
List<Object> decoratorParametersToRemove, DecoratorConfiguration configuration) {
List<DecoratorParameters> decoratorParameters =
stream(
configuration.getEntities(PARAMETERS, DecoratorParameters.class).spliterator(),
... | java | DecoratorConfiguration removeReferencesOrDeleteIfEmpty(
List<Object> decoratorParametersToRemove, DecoratorConfiguration configuration) {
List<DecoratorParameters> decoratorParameters =
stream(
configuration.getEntities(PARAMETERS, DecoratorParameters.class).spliterator(),
... | [
"DecoratorConfiguration",
"removeReferencesOrDeleteIfEmpty",
"(",
"List",
"<",
"Object",
">",
"decoratorParametersToRemove",
",",
"DecoratorConfiguration",
"configuration",
")",
"{",
"List",
"<",
"DecoratorParameters",
">",
"decoratorParameters",
"=",
"stream",
"(",
"config... | Removes references to DecoratorParameters that will be deleted. If this results in a
DecoratorConfiguration without any parameters, then the row is deleted.
@return DecoratorConfiguration without references to DecoratorParameters that will be deleted,
null if the row was deleted | [
"Removes",
"references",
"to",
"DecoratorParameters",
"that",
"will",
"be",
"deleted",
".",
"If",
"this",
"results",
"in",
"a",
"DecoratorConfiguration",
"without",
"any",
"parameters",
"then",
"the",
"row",
"is",
"deleted",
"."
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data/src/main/java/org/molgenis/data/decorator/meta/DynamicDecoratorPopulator.java#L99-L115 | train |
molgenis/molgenis | molgenis-data-cache/src/main/java/org/molgenis/data/cache/l3/L3Cache.java | L3Cache.logStatistics | @Scheduled(fixedRate = 60000)
public void logStatistics() {
// TODO: do we want to log diff with last log instead?
if (LOG.isDebugEnabled()) {
LOG.debug("Cache stats:");
for (Map.Entry<String, LoadingCache<Query<Entity>, List<Object>>> cacheEntry :
caches.entrySet()) {
LOG.debug(... | java | @Scheduled(fixedRate = 60000)
public void logStatistics() {
// TODO: do we want to log diff with last log instead?
if (LOG.isDebugEnabled()) {
LOG.debug("Cache stats:");
for (Map.Entry<String, LoadingCache<Query<Entity>, List<Object>>> cacheEntry :
caches.entrySet()) {
LOG.debug(... | [
"@",
"Scheduled",
"(",
"fixedRate",
"=",
"60000",
")",
"public",
"void",
"logStatistics",
"(",
")",
"{",
"// TODO: do we want to log diff with last log instead?",
"if",
"(",
"LOG",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"LOG",
".",
"debug",
"(",
"\"Cache sta... | Logs cumulative cache statistics for all known caches. | [
"Logs",
"cumulative",
"cache",
"statistics",
"for",
"all",
"known",
"caches",
"."
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-cache/src/main/java/org/molgenis/data/cache/l3/L3Cache.java#L120-L130 | train |
molgenis/molgenis | molgenis-data-postgresql/src/main/java/org/molgenis/data/postgresql/PostgreSqlUtils.java | PostgreSqlUtils.getPostgreSqlValue | static Object getPostgreSqlValue(Entity entity, Attribute attr) {
String attrName = attr.getName();
AttributeType attrType = attr.getDataType();
switch (attrType) {
case BOOL:
return entity.getBoolean(attrName);
case CATEGORICAL:
case XREF:
Entity xrefEntity = entity.getEn... | java | static Object getPostgreSqlValue(Entity entity, Attribute attr) {
String attrName = attr.getName();
AttributeType attrType = attr.getDataType();
switch (attrType) {
case BOOL:
return entity.getBoolean(attrName);
case CATEGORICAL:
case XREF:
Entity xrefEntity = entity.getEn... | [
"static",
"Object",
"getPostgreSqlValue",
"(",
"Entity",
"entity",
",",
"Attribute",
"attr",
")",
"{",
"String",
"attrName",
"=",
"attr",
".",
"getName",
"(",
")",
";",
"AttributeType",
"attrType",
"=",
"attr",
".",
"getDataType",
"(",
")",
";",
"switch",
... | Returns the PostgreSQL value for the given entity attribute
@param entity entity
@param attr attribute
@return PostgreSQL value | [
"Returns",
"the",
"PostgreSQL",
"value",
"for",
"the",
"given",
"entity",
"attribute"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-postgresql/src/main/java/org/molgenis/data/postgresql/PostgreSqlUtils.java#L30-L82 | train |
molgenis/molgenis | molgenis-data-index/src/main/java/org/molgenis/data/index/job/IndexJobService.java | IndexJobService.performIndexActions | private void performIndexActions(Progress progress, String transactionId) {
List<IndexAction> indexActions =
dataService
.findAll(INDEX_ACTION, createQueryGetAllIndexActions(transactionId), IndexAction.class)
.collect(toList());
try {
boolean success = true;
int count... | java | private void performIndexActions(Progress progress, String transactionId) {
List<IndexAction> indexActions =
dataService
.findAll(INDEX_ACTION, createQueryGetAllIndexActions(transactionId), IndexAction.class)
.collect(toList());
try {
boolean success = true;
int count... | [
"private",
"void",
"performIndexActions",
"(",
"Progress",
"progress",
",",
"String",
"transactionId",
")",
"{",
"List",
"<",
"IndexAction",
">",
"indexActions",
"=",
"dataService",
".",
"findAll",
"(",
"INDEX_ACTION",
",",
"createQueryGetAllIndexActions",
"(",
"tra... | Performs the IndexActions.
@param progress {@link Progress} instance to log progress information to | [
"Performs",
"the",
"IndexActions",
"."
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-index/src/main/java/org/molgenis/data/index/job/IndexJobService.java#L72-L97 | train |
molgenis/molgenis | molgenis-data-index/src/main/java/org/molgenis/data/index/job/IndexJobService.java | IndexJobService.performAction | private boolean performAction(Progress progress, int progressCount, IndexAction indexAction) {
requireNonNull(indexAction);
String entityTypeId = indexAction.getEntityTypeId();
updateIndexActionStatus(indexAction, IndexActionMetadata.IndexStatus.STARTED);
try {
if (dataService.hasEntityType(entity... | java | private boolean performAction(Progress progress, int progressCount, IndexAction indexAction) {
requireNonNull(indexAction);
String entityTypeId = indexAction.getEntityTypeId();
updateIndexActionStatus(indexAction, IndexActionMetadata.IndexStatus.STARTED);
try {
if (dataService.hasEntityType(entity... | [
"private",
"boolean",
"performAction",
"(",
"Progress",
"progress",
",",
"int",
"progressCount",
",",
"IndexAction",
"indexAction",
")",
"{",
"requireNonNull",
"(",
"indexAction",
")",
";",
"String",
"entityTypeId",
"=",
"indexAction",
".",
"getEntityTypeId",
"(",
... | Performs a single IndexAction
@param progress {@link Progress} to report progress to
@param progressCount the progress count for this IndexAction
@param indexAction Entity of type IndexActionMetaData
@return boolean indicating success or failure | [
"Performs",
"a",
"single",
"IndexAction"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-index/src/main/java/org/molgenis/data/index/job/IndexJobService.java#L107-L145 | train |
molgenis/molgenis | molgenis-data-index/src/main/java/org/molgenis/data/index/job/IndexJobService.java | IndexJobService.rebuildIndexOneEntity | private void rebuildIndexOneEntity(String entityTypeId, String untypedEntityId) {
LOG.trace("Indexing [{}].[{}]... ", entityTypeId, untypedEntityId);
// convert entity id string to typed entity id
EntityType entityType = dataService.getEntityType(entityTypeId);
if (null != entityType) {
Object en... | java | private void rebuildIndexOneEntity(String entityTypeId, String untypedEntityId) {
LOG.trace("Indexing [{}].[{}]... ", entityTypeId, untypedEntityId);
// convert entity id string to typed entity id
EntityType entityType = dataService.getEntityType(entityTypeId);
if (null != entityType) {
Object en... | [
"private",
"void",
"rebuildIndexOneEntity",
"(",
"String",
"entityTypeId",
",",
"String",
"untypedEntityId",
")",
"{",
"LOG",
".",
"trace",
"(",
"\"Indexing [{}].[{}]... \"",
",",
"entityTypeId",
",",
"untypedEntityId",
")",
";",
"// convert entity id string to typed enti... | Indexes one single entity instance.
@param entityTypeId the id of the entity's repository
@param untypedEntityId the identifier of the entity to update | [
"Indexes",
"one",
"single",
"entity",
"instance",
"."
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-index/src/main/java/org/molgenis/data/index/job/IndexJobService.java#L165-L194 | train |
molgenis/molgenis | molgenis-data-index/src/main/java/org/molgenis/data/index/job/IndexJobService.java | IndexJobService.createQueryGetAllIndexActions | static Query<IndexAction> createQueryGetAllIndexActions(String transactionId) {
QueryRule rule = new QueryRule(INDEX_ACTION_GROUP_ATTR, EQUALS, transactionId);
QueryImpl<IndexAction> q = new QueryImpl<>(rule);
q.setSort(new Sort(ACTION_ORDER));
return q;
} | java | static Query<IndexAction> createQueryGetAllIndexActions(String transactionId) {
QueryRule rule = new QueryRule(INDEX_ACTION_GROUP_ATTR, EQUALS, transactionId);
QueryImpl<IndexAction> q = new QueryImpl<>(rule);
q.setSort(new Sort(ACTION_ORDER));
return q;
} | [
"static",
"Query",
"<",
"IndexAction",
">",
"createQueryGetAllIndexActions",
"(",
"String",
"transactionId",
")",
"{",
"QueryRule",
"rule",
"=",
"new",
"QueryRule",
"(",
"INDEX_ACTION_GROUP_ATTR",
",",
"EQUALS",
",",
"transactionId",
")",
";",
"QueryImpl",
"<",
"I... | Retrieves the query to get all index actions sorted | [
"Retrieves",
"the",
"query",
"to",
"get",
"all",
"index",
"actions",
"sorted"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-index/src/main/java/org/molgenis/data/index/job/IndexJobService.java#L197-L202 | train |
molgenis/molgenis | molgenis-data-import/src/main/java/org/molgenis/data/importer/emx/EmxMetadataParser.java | EmxMetadataParser.getEntityTypeFromSource | private IntermediateParseResults getEntityTypeFromSource(RepositoryCollection source) {
IntermediateParseResults intermediateResults = parseTagsSheet(source.getRepository(EMX_TAGS));
parsePackagesSheet(source.getRepository(EMX_PACKAGES), intermediateResults);
parseEntitiesSheet(source.getRepository(EMX_ENT... | java | private IntermediateParseResults getEntityTypeFromSource(RepositoryCollection source) {
IntermediateParseResults intermediateResults = parseTagsSheet(source.getRepository(EMX_TAGS));
parsePackagesSheet(source.getRepository(EMX_PACKAGES), intermediateResults);
parseEntitiesSheet(source.getRepository(EMX_ENT... | [
"private",
"IntermediateParseResults",
"getEntityTypeFromSource",
"(",
"RepositoryCollection",
"source",
")",
"{",
"IntermediateParseResults",
"intermediateResults",
"=",
"parseTagsSheet",
"(",
"source",
".",
"getRepository",
"(",
"EMX_TAGS",
")",
")",
";",
"parsePackagesSh... | Parses metadata from a collection of repositories.
@param source the {@link RepositoryCollection} containing the metadata to parse
@return {@link IntermediateParseResults} containing the parsed metadata | [
"Parses",
"metadata",
"from",
"a",
"collection",
"of",
"repositories",
"."
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-import/src/main/java/org/molgenis/data/importer/emx/EmxMetadataParser.java#L385-L404 | train |
molgenis/molgenis | molgenis-data-import/src/main/java/org/molgenis/data/importer/emx/EmxMetadataParser.java | EmxMetadataParser.parseTagsSheet | IntermediateParseResults parseTagsSheet(Repository<Entity> tagRepository) {
IntermediateParseResults intermediateParseResults =
new IntermediateParseResults(entityTypeFactory);
if (tagRepository != null) {
for (Entity tagEntity : tagRepository) {
String id = tagEntity.getString(EMX_TAG_IDE... | java | IntermediateParseResults parseTagsSheet(Repository<Entity> tagRepository) {
IntermediateParseResults intermediateParseResults =
new IntermediateParseResults(entityTypeFactory);
if (tagRepository != null) {
for (Entity tagEntity : tagRepository) {
String id = tagEntity.getString(EMX_TAG_IDE... | [
"IntermediateParseResults",
"parseTagsSheet",
"(",
"Repository",
"<",
"Entity",
">",
"tagRepository",
")",
"{",
"IntermediateParseResults",
"intermediateParseResults",
"=",
"new",
"IntermediateParseResults",
"(",
"entityTypeFactory",
")",
";",
"if",
"(",
"tagRepository",
... | Parses all tags defined in the tags repository.
@param tagRepository the {@link Repository} that contains the tags entity
@return Map mapping tag Identifier to tag {@link Entity}, will be empty if no tags repository
was found | [
"Parses",
"all",
"tags",
"defined",
"in",
"the",
"tags",
"repository",
"."
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-import/src/main/java/org/molgenis/data/importer/emx/EmxMetadataParser.java#L456-L468 | train |
molgenis/molgenis | molgenis-data-import/src/main/java/org/molgenis/data/importer/emx/EmxMetadataParser.java | EmxMetadataParser.parsePackagesSheet | private void parsePackagesSheet(
Repository<Entity> repo, IntermediateParseResults intermediateResults) {
if (repo == null) return;
// Collect packages
int rowIndex = 1;
for (Entity packageEntity : resolvePackages(repo)) {
rowIndex++;
parseSinglePackage(intermediateResults, rowIndex, ... | java | private void parsePackagesSheet(
Repository<Entity> repo, IntermediateParseResults intermediateResults) {
if (repo == null) return;
// Collect packages
int rowIndex = 1;
for (Entity packageEntity : resolvePackages(repo)) {
rowIndex++;
parseSinglePackage(intermediateResults, rowIndex, ... | [
"private",
"void",
"parsePackagesSheet",
"(",
"Repository",
"<",
"Entity",
">",
"repo",
",",
"IntermediateParseResults",
"intermediateResults",
")",
"{",
"if",
"(",
"repo",
"==",
"null",
")",
"return",
";",
"// Collect packages",
"int",
"rowIndex",
"=",
"1",
";"... | Parses the packages sheet
@param repo {@link Repository} for the packages
@param intermediateResults {@link IntermediateParseResults} containing the parsed tag entities | [
"Parses",
"the",
"packages",
"sheet"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-import/src/main/java/org/molgenis/data/importer/emx/EmxMetadataParser.java#L476-L486 | train |
molgenis/molgenis | molgenis-data-import/src/main/java/org/molgenis/data/importer/emx/EmxMetadataParser.java | EmxMetadataParser.toTags | private static List<Tag> toTags(
IntermediateParseResults intermediateResults, List<String> tagIdentifiers) {
if (tagIdentifiers.isEmpty()) {
return emptyList();
}
List<Tag> tags = new ArrayList<>(tagIdentifiers.size());
for (String tagIdentifier : tagIdentifiers) {
Tag tag = intermed... | java | private static List<Tag> toTags(
IntermediateParseResults intermediateResults, List<String> tagIdentifiers) {
if (tagIdentifiers.isEmpty()) {
return emptyList();
}
List<Tag> tags = new ArrayList<>(tagIdentifiers.size());
for (String tagIdentifier : tagIdentifiers) {
Tag tag = intermed... | [
"private",
"static",
"List",
"<",
"Tag",
">",
"toTags",
"(",
"IntermediateParseResults",
"intermediateResults",
",",
"List",
"<",
"String",
">",
"tagIdentifiers",
")",
"{",
"if",
"(",
"tagIdentifiers",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"emptyList",... | Convert tag identifiers to tags | [
"Convert",
"tag",
"identifiers",
"to",
"tags"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-import/src/main/java/org/molgenis/data/importer/emx/EmxMetadataParser.java#L527-L542 | train |
molgenis/molgenis | molgenis-data-import/src/main/java/org/molgenis/data/importer/emx/EmxMetadataParser.java | EmxMetadataParser.putEntitiesInDefaultPackage | List<EntityType> putEntitiesInDefaultPackage(
IntermediateParseResults intermediateResults, String defaultPackageId) {
Package p = getPackage(intermediateResults, defaultPackageId);
if (p == null) {
throw new UnknownPackageException(defaultPackageId);
}
List<EntityType> entities = newArrayL... | java | List<EntityType> putEntitiesInDefaultPackage(
IntermediateParseResults intermediateResults, String defaultPackageId) {
Package p = getPackage(intermediateResults, defaultPackageId);
if (p == null) {
throw new UnknownPackageException(defaultPackageId);
}
List<EntityType> entities = newArrayL... | [
"List",
"<",
"EntityType",
">",
"putEntitiesInDefaultPackage",
"(",
"IntermediateParseResults",
"intermediateResults",
",",
"String",
"defaultPackageId",
")",
"{",
"Package",
"p",
"=",
"getPackage",
"(",
"intermediateResults",
",",
"defaultPackageId",
")",
";",
"if",
... | Put the entities that are not in a package in the selected package | [
"Put",
"the",
"entities",
"that",
"are",
"not",
"in",
"a",
"package",
"in",
"the",
"selected",
"package"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-import/src/main/java/org/molgenis/data/importer/emx/EmxMetadataParser.java#L1220-L1236 | train |
molgenis/molgenis | molgenis-data-import/src/main/java/org/molgenis/data/importer/emx/EmxMetadataParser.java | EmxMetadataParser.parseBoolean | static boolean parseBoolean(String booleanString, int rowIndex, String columnName) {
if (booleanString.equalsIgnoreCase(TRUE.toString())) return true;
else if (booleanString.equalsIgnoreCase(FALSE.toString())) return false;
else
throw new InvalidValueException(
booleanString, columnName, "TR... | java | static boolean parseBoolean(String booleanString, int rowIndex, String columnName) {
if (booleanString.equalsIgnoreCase(TRUE.toString())) return true;
else if (booleanString.equalsIgnoreCase(FALSE.toString())) return false;
else
throw new InvalidValueException(
booleanString, columnName, "TR... | [
"static",
"boolean",
"parseBoolean",
"(",
"String",
"booleanString",
",",
"int",
"rowIndex",
",",
"String",
"columnName",
")",
"{",
"if",
"(",
"booleanString",
".",
"equalsIgnoreCase",
"(",
"TRUE",
".",
"toString",
"(",
")",
")",
")",
"return",
"true",
";",
... | Validates whether an EMX value for a boolean attribute is valid and returns the parsed boolean
value.
@param booleanString boolean string
@param rowIndex row index
@param columnName column name
@return true or false
@throws InvalidValueException if the given boolean string value is not one of [true, false]
(case insen... | [
"Validates",
"whether",
"an",
"EMX",
"value",
"for",
"a",
"boolean",
"attribute",
"is",
"valid",
"and",
"returns",
"the",
"parsed",
"boolean",
"value",
"."
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-import/src/main/java/org/molgenis/data/importer/emx/EmxMetadataParser.java#L1277-L1283 | train |
molgenis/molgenis | molgenis-data-import/src/main/java/org/molgenis/data/importer/emx/EmxMetadataParser.java | EmxMetadataParser.toLanguage | private Language toLanguage(Entity emxLanguageEntity) {
Language language = languageFactory.create();
language.setCode(emxLanguageEntity.getString(EMX_LANGUAGE_CODE));
language.setName(emxLanguageEntity.getString(EMX_LANGUAGE_NAME));
return language;
} | java | private Language toLanguage(Entity emxLanguageEntity) {
Language language = languageFactory.create();
language.setCode(emxLanguageEntity.getString(EMX_LANGUAGE_CODE));
language.setName(emxLanguageEntity.getString(EMX_LANGUAGE_NAME));
return language;
} | [
"private",
"Language",
"toLanguage",
"(",
"Entity",
"emxLanguageEntity",
")",
"{",
"Language",
"language",
"=",
"languageFactory",
".",
"create",
"(",
")",
";",
"language",
".",
"setCode",
"(",
"emxLanguageEntity",
".",
"getString",
"(",
"EMX_LANGUAGE_CODE",
")",
... | Creates a language entity from a EMX entity describing a language
@param emxLanguageEntity EMX language entity
@return language entity | [
"Creates",
"a",
"language",
"entity",
"from",
"a",
"EMX",
"entity",
"describing",
"a",
"language"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-import/src/main/java/org/molgenis/data/importer/emx/EmxMetadataParser.java#L1300-L1305 | train |
molgenis/molgenis | molgenis-data/src/main/java/org/molgenis/data/util/GenericDependencyResolver.java | GenericDependencyResolver.getAllDependants | public <A> Set<A> getAllDependants(
A item, Function<A, Integer> getDepth, Function<A, Set<A>> getDependants) {
Set<A> currentGeneration = singleton(item);
Set<A> result = newHashSet();
Set<A> visited = newHashSet();
for (int depth = 0; !currentGeneration.isEmpty(); depth++) {
currentGenera... | java | public <A> Set<A> getAllDependants(
A item, Function<A, Integer> getDepth, Function<A, Set<A>> getDependants) {
Set<A> currentGeneration = singleton(item);
Set<A> result = newHashSet();
Set<A> visited = newHashSet();
for (int depth = 0; !currentGeneration.isEmpty(); depth++) {
currentGenera... | [
"public",
"<",
"A",
">",
"Set",
"<",
"A",
">",
"getAllDependants",
"(",
"A",
"item",
",",
"Function",
"<",
"A",
",",
"Integer",
">",
"getDepth",
",",
"Function",
"<",
"A",
",",
"Set",
"<",
"A",
">",
">",
"getDependants",
")",
"{",
"Set",
"<",
"A"... | Retrieves all items that depend on a given item.
@param item the item that the other items depend on
@param getDepth function that returns the depth up to which a specific item's dependencies are
resolved
@param getDependants function that returns the items that depend on a specific item
@param <A> the type of the ite... | [
"Retrieves",
"all",
"items",
"that",
"depend",
"on",
"a",
"given",
"item",
"."
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data/src/main/java/org/molgenis/data/util/GenericDependencyResolver.java#L55-L70 | train |
molgenis/molgenis | molgenis-metadata-manager/src/main/java/org/molgenis/metadata/manager/mapper/AttributeMapper.java | AttributeMapper.getLookupAttributeIndex | private Integer getLookupAttributeIndex(
EditorAttribute editorAttribute, EditorEntityType editorEntityType) {
String editorAttributeId = editorAttribute.getId();
int index =
editorEntityType
.getLookupAttributes()
.stream()
.map(EditorAttributeIdentifier::get... | java | private Integer getLookupAttributeIndex(
EditorAttribute editorAttribute, EditorEntityType editorEntityType) {
String editorAttributeId = editorAttribute.getId();
int index =
editorEntityType
.getLookupAttributes()
.stream()
.map(EditorAttributeIdentifier::get... | [
"private",
"Integer",
"getLookupAttributeIndex",
"(",
"EditorAttribute",
"editorAttribute",
",",
"EditorEntityType",
"editorEntityType",
")",
"{",
"String",
"editorAttributeId",
"=",
"editorAttribute",
".",
"getId",
"(",
")",
";",
"int",
"index",
"=",
"editorEntityType"... | Find index of editorAttribute in editorEntityType lookupAttributes or return null | [
"Find",
"index",
"of",
"editorAttribute",
"in",
"editorEntityType",
"lookupAttributes",
"or",
"return",
"null"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-metadata-manager/src/main/java/org/molgenis/metadata/manager/mapper/AttributeMapper.java#L242-L255 | train |
molgenis/molgenis | molgenis-semantic-mapper/src/main/java/org/molgenis/semanticmapper/mapping/model/EntityMapping.java | EntityMapping.addAttributeMapping | public AttributeMapping addAttributeMapping(String targetAttributeName) {
if (attributeMappings.containsKey(targetAttributeName)) {
throw new IllegalStateException(
"AttributeMapping already exists for target attribute " + targetAttributeName);
}
Attribute targetAttribute = targetEntityType.... | java | public AttributeMapping addAttributeMapping(String targetAttributeName) {
if (attributeMappings.containsKey(targetAttributeName)) {
throw new IllegalStateException(
"AttributeMapping already exists for target attribute " + targetAttributeName);
}
Attribute targetAttribute = targetEntityType.... | [
"public",
"AttributeMapping",
"addAttributeMapping",
"(",
"String",
"targetAttributeName",
")",
"{",
"if",
"(",
"attributeMappings",
".",
"containsKey",
"(",
"targetAttributeName",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"AttributeMapping already ex... | Adds a new empty attribute mapping to a target attribute
@return the newly created attribute mapping. | [
"Adds",
"a",
"new",
"empty",
"attribute",
"mapping",
"to",
"a",
"target",
"attribute"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-semantic-mapper/src/main/java/org/molgenis/semanticmapper/mapping/model/EntityMapping.java#L103-L112 | train |
molgenis/molgenis | molgenis-data-validation/src/main/java/org/molgenis/data/validation/EntityAttributesValidator.java | EntityAttributesValidator.getDataValuesForType | Object getDataValuesForType(Entity entity, Attribute attribute) {
String attributeName = attribute.getName();
switch (attribute.getDataType()) {
case DATE:
return entity.getLocalDate(attributeName);
case DATE_TIME:
return entity.getInstant(attributeName);
case BOOL:
ret... | java | Object getDataValuesForType(Entity entity, Attribute attribute) {
String attributeName = attribute.getName();
switch (attribute.getDataType()) {
case DATE:
return entity.getLocalDate(attributeName);
case DATE_TIME:
return entity.getInstant(attributeName);
case BOOL:
ret... | [
"Object",
"getDataValuesForType",
"(",
"Entity",
"entity",
",",
"Attribute",
"attribute",
")",
"{",
"String",
"attributeName",
"=",
"attribute",
".",
"getName",
"(",
")",
";",
"switch",
"(",
"attribute",
".",
"getDataType",
"(",
")",
")",
"{",
"case",
"DATE"... | Package-private for testability. | [
"Package",
"-",
"private",
"for",
"testability",
"."
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-validation/src/main/java/org/molgenis/data/validation/EntityAttributesValidator.java#L440-L483 | train |
molgenis/molgenis | molgenis-settings/src/main/java/org/molgenis/settings/mail/MailSettingsRepositoryDecorator.java | MailSettingsRepositoryDecorator.validate | private void validate(Entity entity) {
MailSettingsImpl mailSettings = new MailSettingsImpl(entity);
if (mailSettings.isTestConnection()
&& mailSettings.getUsername() != null
&& mailSettings.getPassword() != null) {
mailSenderFactory.validateConnection(mailSettings);
}
} | java | private void validate(Entity entity) {
MailSettingsImpl mailSettings = new MailSettingsImpl(entity);
if (mailSettings.isTestConnection()
&& mailSettings.getUsername() != null
&& mailSettings.getPassword() != null) {
mailSenderFactory.validateConnection(mailSettings);
}
} | [
"private",
"void",
"validate",
"(",
"Entity",
"entity",
")",
"{",
"MailSettingsImpl",
"mailSettings",
"=",
"new",
"MailSettingsImpl",
"(",
"entity",
")",
";",
"if",
"(",
"mailSettings",
".",
"isTestConnection",
"(",
")",
"&&",
"mailSettings",
".",
"getUsername",... | Validates MailSettings.
@param entity the MailSettings to validate | [
"Validates",
"MailSettings",
"."
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-settings/src/main/java/org/molgenis/settings/mail/MailSettingsRepositoryDecorator.java#L36-L43 | train |
molgenis/molgenis | molgenis-data-migrate/src/main/java/org/molgenis/data/migrate/version/MolgenisUpgradeServiceImpl.java | MolgenisUpgradeServiceImpl.upgrade | @Override
public boolean upgrade() {
int schemaVersion = versionService.getSchemaVersion();
if (schemaVersion < 31) {
throw new UnsupportedOperationException(
"Upgrading from schema version below 31 is not supported");
}
if (schemaVersion < versionService.getAppVersion()) {
LOG.i... | java | @Override
public boolean upgrade() {
int schemaVersion = versionService.getSchemaVersion();
if (schemaVersion < 31) {
throw new UnsupportedOperationException(
"Upgrading from schema version below 31 is not supported");
}
if (schemaVersion < versionService.getAppVersion()) {
LOG.i... | [
"@",
"Override",
"public",
"boolean",
"upgrade",
"(",
")",
"{",
"int",
"schemaVersion",
"=",
"versionService",
".",
"getSchemaVersion",
"(",
")",
";",
"if",
"(",
"schemaVersion",
"<",
"31",
")",
"{",
"throw",
"new",
"UnsupportedOperationException",
"(",
"\"Upg... | Executes MOLGENIS MetaData version upgrades.
@return true if an upgrade was necessary, false if not | [
"Executes",
"MOLGENIS",
"MetaData",
"version",
"upgrades",
"."
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-migrate/src/main/java/org/molgenis/data/migrate/version/MolgenisUpgradeServiceImpl.java#L38-L67 | train |
molgenis/molgenis | molgenis-core-ui/src/main/java/org/molgenis/core/ui/MolgenisWebAppInitializer.java | MolgenisWebAppInitializer.onStartup | protected void onStartup(ServletContext servletContext, Class<?> appConfig, int maxFileSize) {
// Create the 'root' Spring application context
AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext();
rootContext.setAllowBeanDefinitionOverriding(false);
rootContext... | java | protected void onStartup(ServletContext servletContext, Class<?> appConfig, int maxFileSize) {
// Create the 'root' Spring application context
AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext();
rootContext.setAllowBeanDefinitionOverriding(false);
rootContext... | [
"protected",
"void",
"onStartup",
"(",
"ServletContext",
"servletContext",
",",
"Class",
"<",
"?",
">",
"appConfig",
",",
"int",
"maxFileSize",
")",
"{",
"// Create the 'root' Spring application context",
"AnnotationConfigWebApplicationContext",
"rootContext",
"=",
"new",
... | A Molgenis common web application initializer | [
"A",
"Molgenis",
"common",
"web",
"application",
"initializer"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-core-ui/src/main/java/org/molgenis/core/ui/MolgenisWebAppInitializer.java#L32-L76 | train |
molgenis/molgenis | molgenis-data-elasticsearch/src/main/java/org/molgenis/data/elasticsearch/generator/DocumentContentBuilder.java | DocumentContentBuilder.createDocument | Document createDocument(Entity entity) {
int maxIndexingDepth = entity.getEntityType().getIndexingDepth();
XContentBuilder contentBuilder;
try {
contentBuilder = XContentFactory.contentBuilder(JSON);
XContentGenerator generator = contentBuilder.generator();
generator.writeStartObject();
... | java | Document createDocument(Entity entity) {
int maxIndexingDepth = entity.getEntityType().getIndexingDepth();
XContentBuilder contentBuilder;
try {
contentBuilder = XContentFactory.contentBuilder(JSON);
XContentGenerator generator = contentBuilder.generator();
generator.writeStartObject();
... | [
"Document",
"createDocument",
"(",
"Entity",
"entity",
")",
"{",
"int",
"maxIndexingDepth",
"=",
"entity",
".",
"getEntityType",
"(",
")",
".",
"getIndexingDepth",
"(",
")",
";",
"XContentBuilder",
"contentBuilder",
";",
"try",
"{",
"contentBuilder",
"=",
"XCont... | Create Elasticsearch document source content from entity
@param entity the entity to convert to document source content
@return Elasticsearch document source content | [
"Create",
"Elasticsearch",
"document",
"source",
"content",
"from",
"entity"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-elasticsearch/src/main/java/org/molgenis/data/elasticsearch/generator/DocumentContentBuilder.java#L41-L55 | train |
molgenis/molgenis | molgenis-questionnaires/src/main/java/org/molgenis/questionnaires/controller/QuestionnaireController.java | QuestionnaireController.initView | @GetMapping("/**")
public String initView(Model model) {
super.init(model, ID);
model.addAttribute("username", super.userAccountService.getCurrentUser().getUsername());
return QUESTIONNAIRE_VIEW;
} | java | @GetMapping("/**")
public String initView(Model model) {
super.init(model, ID);
model.addAttribute("username", super.userAccountService.getCurrentUser().getUsername());
return QUESTIONNAIRE_VIEW;
} | [
"@",
"GetMapping",
"(",
"\"/**\"",
")",
"public",
"String",
"initView",
"(",
"Model",
"model",
")",
"{",
"super",
".",
"init",
"(",
"model",
",",
"ID",
")",
";",
"model",
".",
"addAttribute",
"(",
"\"username\"",
",",
"super",
".",
"userAccountService",
... | Loads the questionnaire view | [
"Loads",
"the",
"questionnaire",
"view"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-questionnaires/src/main/java/org/molgenis/questionnaires/controller/QuestionnaireController.java#L45-L50 | train |
molgenis/molgenis | molgenis-data/src/main/java/org/molgenis/data/meta/model/Package.java | Package.getRootPackage | @SuppressWarnings("squid:S2259") // potential multi-threading NPE
public Package getRootPackage() {
Package aPackage = this;
while (aPackage.getParent() != null) {
aPackage = aPackage.getParent();
}
return aPackage;
} | java | @SuppressWarnings("squid:S2259") // potential multi-threading NPE
public Package getRootPackage() {
Package aPackage = this;
while (aPackage.getParent() != null) {
aPackage = aPackage.getParent();
}
return aPackage;
} | [
"@",
"SuppressWarnings",
"(",
"\"squid:S2259\"",
")",
"// potential multi-threading NPE",
"public",
"Package",
"getRootPackage",
"(",
")",
"{",
"Package",
"aPackage",
"=",
"this",
";",
"while",
"(",
"aPackage",
".",
"getParent",
"(",
")",
"!=",
"null",
")",
"{",... | Get the root of this package, or itself if this is a root package
@return root package of this package or <tt>null</tt> | [
"Get",
"the",
"root",
"of",
"this",
"package",
"or",
"itself",
"if",
"this",
"is",
"a",
"root",
"package"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data/src/main/java/org/molgenis/data/meta/model/Package.java#L181-L188 | train |
molgenis/molgenis | molgenis-data-validation/src/main/java/org/molgenis/data/validation/MolgenisValidationException.java | MolgenisValidationException.renumberViolationRowIndices | public void renumberViolationRowIndices(List<Integer> actualIndices) {
violations.forEach(v -> v.renumberRowIndex(actualIndices));
} | java | public void renumberViolationRowIndices(List<Integer> actualIndices) {
violations.forEach(v -> v.renumberRowIndex(actualIndices));
} | [
"public",
"void",
"renumberViolationRowIndices",
"(",
"List",
"<",
"Integer",
">",
"actualIndices",
")",
"{",
"violations",
".",
"forEach",
"(",
"v",
"->",
"v",
".",
"renumberRowIndex",
"(",
"actualIndices",
")",
")",
";",
"}"
] | renumber the violation row indices with the actual row numbers | [
"renumber",
"the",
"violation",
"row",
"indices",
"with",
"the",
"actual",
"row",
"numbers"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-validation/src/main/java/org/molgenis/data/validation/MolgenisValidationException.java#L38-L40 | train |
molgenis/molgenis | molgenis-core-ui/src/main/java/org/molgenis/core/ui/style/Style.java | Style.createLocal | public static Style createLocal(String location) {
String name = location.replaceFirst("bootstrap-", "");
name = name.replaceFirst(".min", "");
name = name.replaceFirst(".css", "");
return new AutoValue_Style(name, false, location);
} | java | public static Style createLocal(String location) {
String name = location.replaceFirst("bootstrap-", "");
name = name.replaceFirst(".min", "");
name = name.replaceFirst(".css", "");
return new AutoValue_Style(name, false, location);
} | [
"public",
"static",
"Style",
"createLocal",
"(",
"String",
"location",
")",
"{",
"String",
"name",
"=",
"location",
".",
"replaceFirst",
"(",
"\"bootstrap-\"",
",",
"\"\"",
")",
";",
"name",
"=",
"name",
".",
"replaceFirst",
"(",
"\".min\"",
",",
"\"\"",
"... | Create new style. The name of the style is based off of the location string, the optional
'boostrap-' prefix and '.min' and '.css' affixes are removed from the name. | [
"Create",
"new",
"style",
".",
"The",
"name",
"of",
"the",
"style",
"is",
"based",
"off",
"of",
"the",
"location",
"string",
"the",
"optional",
"boostrap",
"-",
"prefix",
"and",
".",
"min",
"and",
".",
"css",
"affixes",
"are",
"removed",
"from",
"the",
... | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-core-ui/src/main/java/org/molgenis/core/ui/style/Style.java#L21-L26 | train |
molgenis/molgenis | molgenis-core-ui/src/main/java/org/molgenis/core/ui/style/BootstrapThemePopulator.java | BootstrapThemePopulator.populate | public void populate() {
PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
try {
Resource[] bootstrap3Themes = resolver.getResources(LOCAL_CSS_BOOTSTRAP_3_THEME_LOCATION);
Resource[] bootstrap4Themes = resolver.getResources(LOCAL_CSS_BOOTSTRAP_4_THEME_LOCATION... | java | public void populate() {
PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
try {
Resource[] bootstrap3Themes = resolver.getResources(LOCAL_CSS_BOOTSTRAP_3_THEME_LOCATION);
Resource[] bootstrap4Themes = resolver.getResources(LOCAL_CSS_BOOTSTRAP_4_THEME_LOCATION... | [
"public",
"void",
"populate",
"(",
")",
"{",
"PathMatchingResourcePatternResolver",
"resolver",
"=",
"new",
"PathMatchingResourcePatternResolver",
"(",
")",
";",
"try",
"{",
"Resource",
"[",
"]",
"bootstrap3Themes",
"=",
"resolver",
".",
"getResources",
"(",
"LOCAL_... | Populate the database with the available bootstrap themes found in the jar. This enables the
release of the application with a set of predefined bootstrap themes.
<p>If a given bootstrap 3 theme is located a matching bootstrap 4 theme is added the the
styleSheet row is present. | [
"Populate",
"the",
"database",
"with",
"the",
"available",
"bootstrap",
"themes",
"found",
"in",
"the",
"jar",
".",
"This",
"enables",
"the",
"release",
"of",
"the",
"application",
"with",
"a",
"set",
"of",
"predefined",
"bootstrap",
"themes",
"."
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-core-ui/src/main/java/org/molgenis/core/ui/style/BootstrapThemePopulator.java#L44-L71 | train |
molgenis/molgenis | molgenis-api-data/src/main/java/org/molgenis/api/data/v2/AttributeFilterToFetchConverter.java | AttributeFilterToFetchConverter.createDefaultEntityFetch | public static Fetch createDefaultEntityFetch(EntityType entityType, String languageCode) {
boolean hasRefAttr = false;
Fetch fetch = new Fetch();
for (Attribute attr : entityType.getAtomicAttributes()) {
Fetch subFetch = createDefaultAttributeFetch(attr, languageCode);
if (subFetch != null) {
... | java | public static Fetch createDefaultEntityFetch(EntityType entityType, String languageCode) {
boolean hasRefAttr = false;
Fetch fetch = new Fetch();
for (Attribute attr : entityType.getAtomicAttributes()) {
Fetch subFetch = createDefaultAttributeFetch(attr, languageCode);
if (subFetch != null) {
... | [
"public",
"static",
"Fetch",
"createDefaultEntityFetch",
"(",
"EntityType",
"entityType",
",",
"String",
"languageCode",
")",
"{",
"boolean",
"hasRefAttr",
"=",
"false",
";",
"Fetch",
"fetch",
"=",
"new",
"Fetch",
"(",
")",
";",
"for",
"(",
"Attribute",
"attr"... | Create default entity fetch that fetches all attributes.
@return default entity fetch or null | [
"Create",
"default",
"entity",
"fetch",
"that",
"fetches",
"all",
"attributes",
"."
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-api-data/src/main/java/org/molgenis/api/data/v2/AttributeFilterToFetchConverter.java#L157-L168 | train |
molgenis/molgenis | molgenis-api-data/src/main/java/org/molgenis/api/data/v2/AttributeFilterToFetchConverter.java | AttributeFilterToFetchConverter.createDefaultAttributeFetch | public static Fetch createDefaultAttributeFetch(Attribute attr, String languageCode) {
Fetch fetch;
if (isReferenceType(attr)) {
fetch = new Fetch();
EntityType refEntityType = attr.getRefEntity();
String idAttrName = refEntityType.getIdAttribute().getName();
fetch.field(idAttrName);
... | java | public static Fetch createDefaultAttributeFetch(Attribute attr, String languageCode) {
Fetch fetch;
if (isReferenceType(attr)) {
fetch = new Fetch();
EntityType refEntityType = attr.getRefEntity();
String idAttrName = refEntityType.getIdAttribute().getName();
fetch.field(idAttrName);
... | [
"public",
"static",
"Fetch",
"createDefaultAttributeFetch",
"(",
"Attribute",
"attr",
",",
"String",
"languageCode",
")",
"{",
"Fetch",
"fetch",
";",
"if",
"(",
"isReferenceType",
"(",
"attr",
")",
")",
"{",
"fetch",
"=",
"new",
"Fetch",
"(",
")",
";",
"En... | Create default fetch for the given attribute. For attributes referencing entities the id and
label value are fetched. Additionally for file entities the URL is fetched. For other
attributes the default fetch is null;
@return default attribute fetch or null | [
"Create",
"default",
"fetch",
"for",
"the",
"given",
"attribute",
".",
"For",
"attributes",
"referencing",
"entities",
"the",
"id",
"and",
"label",
"value",
"are",
"fetched",
".",
"Additionally",
"for",
"file",
"entities",
"the",
"URL",
"is",
"fetched",
".",
... | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-api-data/src/main/java/org/molgenis/api/data/v2/AttributeFilterToFetchConverter.java#L177-L197 | train |
molgenis/molgenis | molgenis-validation/src/main/java/org/molgenis/validation/ConstraintViolation.java | ConstraintViolation.renumberRowIndex | public void renumberRowIndex(List<Integer> indices) {
this.rowNr = this.rowNr != null ? Long.valueOf(indices.get(toIntExact(this.rowNr - 1))) : null;
} | java | public void renumberRowIndex(List<Integer> indices) {
this.rowNr = this.rowNr != null ? Long.valueOf(indices.get(toIntExact(this.rowNr - 1))) : null;
} | [
"public",
"void",
"renumberRowIndex",
"(",
"List",
"<",
"Integer",
">",
"indices",
")",
"{",
"this",
".",
"rowNr",
"=",
"this",
".",
"rowNr",
"!=",
"null",
"?",
"Long",
".",
"valueOf",
"(",
"indices",
".",
"get",
"(",
"toIntExact",
"(",
"this",
".",
... | Renumber the violation row number from a list of actual row numbers The list of indices is
0-indexed and the rownnr are 1-indexed | [
"Renumber",
"the",
"violation",
"row",
"number",
"from",
"a",
"list",
"of",
"actual",
"row",
"numbers",
"The",
"list",
"of",
"indices",
"is",
"0",
"-",
"indexed",
"and",
"the",
"rownnr",
"are",
"1",
"-",
"indexed"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-validation/src/main/java/org/molgenis/validation/ConstraintViolation.java#L26-L28 | train |
molgenis/molgenis | molgenis-scripts-core/src/main/java/org/molgenis/script/core/ScriptUtils.java | ScriptUtils.generateScript | public static String generateScript(Script script, Map<String, Object> parameterValues) {
StringWriter stringWriter = new StringWriter();
try {
Template template =
new Template(null, new StringReader(script.getContent()), new Configuration(VERSION));
template.process(parameterValues, strin... | java | public static String generateScript(Script script, Map<String, Object> parameterValues) {
StringWriter stringWriter = new StringWriter();
try {
Template template =
new Template(null, new StringReader(script.getContent()), new Configuration(VERSION));
template.process(parameterValues, strin... | [
"public",
"static",
"String",
"generateScript",
"(",
"Script",
"script",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"parameterValues",
")",
"{",
"StringWriter",
"stringWriter",
"=",
"new",
"StringWriter",
"(",
")",
";",
"try",
"{",
"Template",
"template",
... | Render a script using the given parameter values | [
"Render",
"a",
"script",
"using",
"the",
"given",
"parameter",
"values"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-scripts-core/src/main/java/org/molgenis/script/core/ScriptUtils.java#L23-L34 | train |
molgenis/molgenis | molgenis-security/src/main/java/org/molgenis/security/token/DataServiceTokenService.java | DataServiceTokenService.findUserByToken | @Override
@Transactional(readOnly = true)
@RunAsSystem
public UserDetails findUserByToken(String token) {
Token molgenisToken = getMolgenisToken(token);
return userDetailsService.loadUserByUsername(molgenisToken.getUser().getUsername());
} | java | @Override
@Transactional(readOnly = true)
@RunAsSystem
public UserDetails findUserByToken(String token) {
Token molgenisToken = getMolgenisToken(token);
return userDetailsService.loadUserByUsername(molgenisToken.getUser().getUsername());
} | [
"@",
"Override",
"@",
"Transactional",
"(",
"readOnly",
"=",
"true",
")",
"@",
"RunAsSystem",
"public",
"UserDetails",
"findUserByToken",
"(",
"String",
"token",
")",
"{",
"Token",
"molgenisToken",
"=",
"getMolgenisToken",
"(",
"token",
")",
";",
"return",
"us... | Find a user by a security token
@param token security token
@return the user or null if not found or token is expired | [
"Find",
"a",
"user",
"by",
"a",
"security",
"token"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-security/src/main/java/org/molgenis/security/token/DataServiceTokenService.java#L47-L53 | train |
molgenis/molgenis | molgenis-security/src/main/java/org/molgenis/security/token/DataServiceTokenService.java | DataServiceTokenService.generateAndStoreToken | @Override
@Transactional
@RunAsSystem
public String generateAndStoreToken(String username, String description) {
User user = dataService.query(USER, User.class).eq(USERNAME, username).findOne();
if (user == null) {
throw new IllegalArgumentException(format("Unknown username [%s]", username));
}
... | java | @Override
@Transactional
@RunAsSystem
public String generateAndStoreToken(String username, String description) {
User user = dataService.query(USER, User.class).eq(USERNAME, username).findOne();
if (user == null) {
throw new IllegalArgumentException(format("Unknown username [%s]", username));
}
... | [
"@",
"Override",
"@",
"Transactional",
"@",
"RunAsSystem",
"public",
"String",
"generateAndStoreToken",
"(",
"String",
"username",
",",
"String",
"description",
")",
"{",
"User",
"user",
"=",
"dataService",
".",
"query",
"(",
"USER",
",",
"User",
".",
"class",... | Generates a token and associates it with a user.
<p>Token expires in 2 hours
@param username username
@param description token description
@return token | [
"Generates",
"a",
"token",
"and",
"associates",
"it",
"with",
"a",
"user",
"."
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-security/src/main/java/org/molgenis/security/token/DataServiceTokenService.java#L64-L83 | train |
molgenis/molgenis | molgenis-navigator/src/main/java/org/molgenis/navigator/copy/service/LabelGenerator.java | LabelGenerator.generateUniqueLabel | static String generateUniqueLabel(String label, Set<String> existingLabels) {
StringBuilder newLabel = new StringBuilder(label);
while (existingLabels.contains(newLabel.toString())) {
newLabel.append(POSTFIX);
}
return newLabel.toString();
} | java | static String generateUniqueLabel(String label, Set<String> existingLabels) {
StringBuilder newLabel = new StringBuilder(label);
while (existingLabels.contains(newLabel.toString())) {
newLabel.append(POSTFIX);
}
return newLabel.toString();
} | [
"static",
"String",
"generateUniqueLabel",
"(",
"String",
"label",
",",
"Set",
"<",
"String",
">",
"existingLabels",
")",
"{",
"StringBuilder",
"newLabel",
"=",
"new",
"StringBuilder",
"(",
"label",
")",
";",
"while",
"(",
"existingLabels",
".",
"contains",
"(... | Makes sure that a given label will be unique amongst a set of other labels. | [
"Makes",
"sure",
"that",
"a",
"given",
"label",
"will",
"be",
"unique",
"amongst",
"a",
"set",
"of",
"other",
"labels",
"."
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-navigator/src/main/java/org/molgenis/navigator/copy/service/LabelGenerator.java#L11-L17 | train |
molgenis/molgenis | molgenis-data-i18n/src/main/java/org/molgenis/data/i18n/LocalizationService.java | LocalizationService.resolveCodeWithoutArguments | @Override
@RunAsSystem
public String resolveCodeWithoutArguments(String code, Locale locale) {
return Optional.ofNullable(
dataService.query(L10N_STRING, L10nString.class).eq(MSGID, code).findOne())
.map(l10nString -> l10nString.getString(locale))
.orElse(null);
} | java | @Override
@RunAsSystem
public String resolveCodeWithoutArguments(String code, Locale locale) {
return Optional.ofNullable(
dataService.query(L10N_STRING, L10nString.class).eq(MSGID, code).findOne())
.map(l10nString -> l10nString.getString(locale))
.orElse(null);
} | [
"@",
"Override",
"@",
"RunAsSystem",
"public",
"String",
"resolveCodeWithoutArguments",
"(",
"String",
"code",
",",
"Locale",
"locale",
")",
"{",
"return",
"Optional",
".",
"ofNullable",
"(",
"dataService",
".",
"query",
"(",
"L10N_STRING",
",",
"L10nString",
".... | Looks up a single localized message.
@param code messageID
@param locale the Locale for the language
@return String containing the message or null if not specified | [
"Looks",
"up",
"a",
"single",
"localized",
"message",
"."
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-i18n/src/main/java/org/molgenis/data/i18n/LocalizationService.java#L51-L58 | train |
molgenis/molgenis | molgenis-data-i18n/src/main/java/org/molgenis/data/i18n/LocalizationService.java | LocalizationService.getMessages | @RunAsSystem
public Map<String, String> getMessages(String namespace, Locale locale) {
return getL10nStrings(namespace)
.stream()
.filter(e -> e.getString(locale) != null)
.collect(toMap(L10nString::getMessageID, e -> e.getString(locale)));
} | java | @RunAsSystem
public Map<String, String> getMessages(String namespace, Locale locale) {
return getL10nStrings(namespace)
.stream()
.filter(e -> e.getString(locale) != null)
.collect(toMap(L10nString::getMessageID, e -> e.getString(locale)));
} | [
"@",
"RunAsSystem",
"public",
"Map",
"<",
"String",
",",
"String",
">",
"getMessages",
"(",
"String",
"namespace",
",",
"Locale",
"locale",
")",
"{",
"return",
"getL10nStrings",
"(",
"namespace",
")",
".",
"stream",
"(",
")",
".",
"filter",
"(",
"e",
"->... | Gets all messages for a certain namespace and languageCode. Returns exactly those messages that
are explicitly specified for this namespace and languageCode. Does not fall back to the default
language.
@param namespace the namespace for the messages
@param locale the Locale for the messages
@return Map mapping message... | [
"Gets",
"all",
"messages",
"for",
"a",
"certain",
"namespace",
"and",
"languageCode",
".",
"Returns",
"exactly",
"those",
"messages",
"that",
"are",
"explicitly",
"specified",
"for",
"this",
"namespace",
"and",
"languageCode",
".",
"Does",
"not",
"fall",
"back",... | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-i18n/src/main/java/org/molgenis/data/i18n/LocalizationService.java#L69-L75 | train |
molgenis/molgenis | molgenis-data-i18n/src/main/java/org/molgenis/data/i18n/LocalizationService.java | LocalizationService.deleteNamespace | @Transactional
public void deleteNamespace(String namespace) {
List<L10nString> namespaceEntities = getL10nStrings(namespace);
dataService.delete(L10N_STRING, namespaceEntities.stream());
} | java | @Transactional
public void deleteNamespace(String namespace) {
List<L10nString> namespaceEntities = getL10nStrings(namespace);
dataService.delete(L10N_STRING, namespaceEntities.stream());
} | [
"@",
"Transactional",
"public",
"void",
"deleteNamespace",
"(",
"String",
"namespace",
")",
"{",
"List",
"<",
"L10nString",
">",
"namespaceEntities",
"=",
"getL10nStrings",
"(",
"namespace",
")",
";",
"dataService",
".",
"delete",
"(",
"L10N_STRING",
",",
"names... | Deletes all localization strings for a given namespace | [
"Deletes",
"all",
"localization",
"strings",
"for",
"a",
"given",
"namespace"
] | b4d0d6b27e6f6c8d7505a3863dc03b589601f987 | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-i18n/src/main/java/org/molgenis/data/i18n/LocalizationService.java#L127-L131 | train |
chrisvest/stormpot | src/main/java/stormpot/Pool.java | Pool.apply | @SuppressWarnings("WeakerAccess")
public final <R> Optional<R> apply(Timeout timeout, Function<T, R> function)
throws InterruptedException {
T obj = claim(timeout);
if (obj == null) {
return Optional.empty();
}
try {
return Optional.ofNullable(function.apply(obj));
} finally {
... | java | @SuppressWarnings("WeakerAccess")
public final <R> Optional<R> apply(Timeout timeout, Function<T, R> function)
throws InterruptedException {
T obj = claim(timeout);
if (obj == null) {
return Optional.empty();
}
try {
return Optional.ofNullable(function.apply(obj));
} finally {
... | [
"@",
"SuppressWarnings",
"(",
"\"WeakerAccess\"",
")",
"public",
"final",
"<",
"R",
">",
"Optional",
"<",
"R",
">",
"apply",
"(",
"Timeout",
"timeout",
",",
"Function",
"<",
"T",
",",
"R",
">",
"function",
")",
"throws",
"InterruptedException",
"{",
"T",
... | Claim an object from the pool and apply the given function to it, returning
the result and releasing the object back to the pool.
If an object cannot be claimed within the given timeout, then
{@link Optional#empty()} is returned instead. The `empty()` value is also
returned if the function returns `null`.
@param time... | [
"Claim",
"an",
"object",
"from",
"the",
"pool",
"and",
"apply",
"the",
"given",
"function",
"to",
"it",
"returning",
"the",
"result",
"and",
"releasing",
"the",
"object",
"back",
"to",
"the",
"pool",
"."
] | 3123e2c4e895647ab6b783d0e75ba1d04bc091d6 | https://github.com/chrisvest/stormpot/blob/3123e2c4e895647ab6b783d0e75ba1d04bc091d6/src/main/java/stormpot/Pool.java#L224-L236 | train |
chrisvest/stormpot | src/main/java/stormpot/Pool.java | Pool.supply | @SuppressWarnings("WeakerAccess")
public final boolean supply(Timeout timeout, Consumer<T> consumer)
throws InterruptedException {
T obj = claim(timeout);
if (obj == null) {
return false;
}
try {
consumer.accept(obj);
return true;
} finally {
obj.release();
}
} | java | @SuppressWarnings("WeakerAccess")
public final boolean supply(Timeout timeout, Consumer<T> consumer)
throws InterruptedException {
T obj = claim(timeout);
if (obj == null) {
return false;
}
try {
consumer.accept(obj);
return true;
} finally {
obj.release();
}
} | [
"@",
"SuppressWarnings",
"(",
"\"WeakerAccess\"",
")",
"public",
"final",
"boolean",
"supply",
"(",
"Timeout",
"timeout",
",",
"Consumer",
"<",
"T",
">",
"consumer",
")",
"throws",
"InterruptedException",
"{",
"T",
"obj",
"=",
"claim",
"(",
"timeout",
")",
"... | Claim an object from the pool and supply it to the given consumer, and then
release it back to the pool.
If an object cannot be claimed within the given timeout, then this method
returns `false`. Otherwise, if an object was claimed and supplied to the
consumer, the method returns `true`.
@param timeout The timeout of ... | [
"Claim",
"an",
"object",
"from",
"the",
"pool",
"and",
"supply",
"it",
"to",
"the",
"given",
"consumer",
"and",
"then",
"release",
"it",
"back",
"to",
"the",
"pool",
"."
] | 3123e2c4e895647ab6b783d0e75ba1d04bc091d6 | https://github.com/chrisvest/stormpot/blob/3123e2c4e895647ab6b783d0e75ba1d04bc091d6/src/main/java/stormpot/Pool.java#L258-L271 | train |
chrisvest/stormpot | src/main/java/stormpot/Config.java | Config.getAdaptedReallocator | Reallocator<T> getAdaptedReallocator() {
if (allocator == null) {
return null;
}
if (metricsRecorder == null) {
if (allocator instanceof Reallocator) {
return (Reallocator<T>) allocator;
}
return new ReallocatingAdaptor<>((Allocator<T>) allocator);
} else {
if (allo... | java | Reallocator<T> getAdaptedReallocator() {
if (allocator == null) {
return null;
}
if (metricsRecorder == null) {
if (allocator instanceof Reallocator) {
return (Reallocator<T>) allocator;
}
return new ReallocatingAdaptor<>((Allocator<T>) allocator);
} else {
if (allo... | [
"Reallocator",
"<",
"T",
">",
"getAdaptedReallocator",
"(",
")",
"{",
"if",
"(",
"allocator",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"metricsRecorder",
"==",
"null",
")",
"{",
"if",
"(",
"allocator",
"instanceof",
"Reallocator",
"... | Returns `null` if no allocator has been configured.
Otherwise returns a `Reallocator`, possibly by adapting the configured
`Allocator` if need be.
If a `MetricsRecorder` has been configured, the return `Reallocator` will
automatically record allocation, reallocation and deallocation latencies. | [
"Returns",
"null",
"if",
"no",
"allocator",
"has",
"been",
"configured",
".",
"Otherwise",
"returns",
"a",
"Reallocator",
"possibly",
"by",
"adapting",
"the",
"configured",
"Allocator",
"if",
"need",
"be",
".",
"If",
"a",
"MetricsRecorder",
"has",
"been",
"con... | 3123e2c4e895647ab6b783d0e75ba1d04bc091d6 | https://github.com/chrisvest/stormpot/blob/3123e2c4e895647ab6b783d0e75ba1d04bc091d6/src/main/java/stormpot/Config.java#L328-L345 | train |
WASdev/ci.maven | liberty-maven-plugin/src/it/ear-project-it/helloworld-impl/src/main/java/wasdev/sample/adapter/helloworld/HelloWorldInteractionSpecImpl.java | HelloWorldInteractionSpecImpl.setFunctionName | public void setFunctionName(String functionName) {
String oldFunctionName = functionName;
this.functionName = functionName;
firePropertyChange("FunctionName", oldFunctionName, functionName);
} | java | public void setFunctionName(String functionName) {
String oldFunctionName = functionName;
this.functionName = functionName;
firePropertyChange("FunctionName", oldFunctionName, functionName);
} | [
"public",
"void",
"setFunctionName",
"(",
"String",
"functionName",
")",
"{",
"String",
"oldFunctionName",
"=",
"functionName",
";",
"this",
".",
"functionName",
"=",
"functionName",
";",
"firePropertyChange",
"(",
"\"FunctionName\"",
",",
"oldFunctionName",
",",
"f... | Sets the functionName
@param functionName The functionName to set
@see HelloWorldInteractionSpec#setFunctionName(String) | [
"Sets",
"the",
"functionName"
] | 4fcf2d314299a4c02e2c740e4fc99a4f6aba6918 | https://github.com/WASdev/ci.maven/blob/4fcf2d314299a4c02e2c740e4fc99a4f6aba6918/liberty-maven-plugin/src/it/ear-project-it/helloworld-impl/src/main/java/wasdev/sample/adapter/helloworld/HelloWorldInteractionSpecImpl.java#L51-L56 | train |
WASdev/ci.maven | liberty-maven-plugin/src/main/java/net/wasdev/wlp/maven/plugins/utils/SpringBootUtil.java | SpringBootUtil.getSpringBootMavenPluginClassifier | public static String getSpringBootMavenPluginClassifier(MavenProject project, Log log) {
String classifier = null;
try {
classifier = MavenProjectUtil.getPluginGoalConfigurationString(project,
"org.springframework.boot:spring-boot-maven-plugin", "repackage", "classifier")... | java | public static String getSpringBootMavenPluginClassifier(MavenProject project, Log log) {
String classifier = null;
try {
classifier = MavenProjectUtil.getPluginGoalConfigurationString(project,
"org.springframework.boot:spring-boot-maven-plugin", "repackage", "classifier")... | [
"public",
"static",
"String",
"getSpringBootMavenPluginClassifier",
"(",
"MavenProject",
"project",
",",
"Log",
"log",
")",
"{",
"String",
"classifier",
"=",
"null",
";",
"try",
"{",
"classifier",
"=",
"MavenProjectUtil",
".",
"getPluginGoalConfigurationString",
"(",
... | Read the value of the classifier configuration parameter from the
spring-boot-maven-plugin
@param project
@param log
@return the value if it was found, null otherwise | [
"Read",
"the",
"value",
"of",
"the",
"classifier",
"configuration",
"parameter",
"from",
"the",
"spring",
"-",
"boot",
"-",
"maven",
"-",
"plugin"
] | 4fcf2d314299a4c02e2c740e4fc99a4f6aba6918 | https://github.com/WASdev/ci.maven/blob/4fcf2d314299a4c02e2c740e4fc99a4f6aba6918/liberty-maven-plugin/src/main/java/net/wasdev/wlp/maven/plugins/utils/SpringBootUtil.java#L35-L44 | train |
WASdev/ci.maven | liberty-maven-plugin/src/main/java/net/wasdev/wlp/maven/plugins/utils/SpringBootUtil.java | SpringBootUtil.getSpringBootUberJAR | public static File getSpringBootUberJAR(MavenProject project, Log log) {
File fatArchive = getSpringBootUberJARLocation(project, log);
if (net.wasdev.wlp.common.plugins.util.SpringBootUtil.isSpringBootUberJar(fatArchive)) {
log.info("Found Spring Boot Uber JAR: " + fatArchive.getAbsolutePa... | java | public static File getSpringBootUberJAR(MavenProject project, Log log) {
File fatArchive = getSpringBootUberJARLocation(project, log);
if (net.wasdev.wlp.common.plugins.util.SpringBootUtil.isSpringBootUberJar(fatArchive)) {
log.info("Found Spring Boot Uber JAR: " + fatArchive.getAbsolutePa... | [
"public",
"static",
"File",
"getSpringBootUberJAR",
"(",
"MavenProject",
"project",
",",
"Log",
"log",
")",
"{",
"File",
"fatArchive",
"=",
"getSpringBootUberJARLocation",
"(",
"project",
",",
"log",
")",
";",
"if",
"(",
"net",
".",
"wasdev",
".",
"wlp",
"."... | Get the Spring Boot Uber JAR in its expected location, validating the JAR
contents and handling spring-boot-maven-plugin classifier configuration as
well. If the JAR was not found in its expected location, then return null.
@param outputDirectory
@param project
@param log
@return the JAR File if it was found, false ot... | [
"Get",
"the",
"Spring",
"Boot",
"Uber",
"JAR",
"in",
"its",
"expected",
"location",
"validating",
"the",
"JAR",
"contents",
"and",
"handling",
"spring",
"-",
"boot",
"-",
"maven",
"-",
"plugin",
"classifier",
"configuration",
"as",
"well",
".",
"If",
"the",
... | 4fcf2d314299a4c02e2c740e4fc99a4f6aba6918 | https://github.com/WASdev/ci.maven/blob/4fcf2d314299a4c02e2c740e4fc99a4f6aba6918/liberty-maven-plugin/src/main/java/net/wasdev/wlp/maven/plugins/utils/SpringBootUtil.java#L56-L67 | train |
WASdev/ci.maven | liberty-maven-plugin/src/main/java/net/wasdev/wlp/maven/plugins/utils/SpringBootUtil.java | SpringBootUtil.getSpringBootUberJARLocation | public static File getSpringBootUberJARLocation(MavenProject project, Log log) {
String classifier = getSpringBootMavenPluginClassifier(project, log);
if (classifier == null) {
classifier = "";
}
if (!classifier.isEmpty() && !classifier.startsWith("-")) {
classif... | java | public static File getSpringBootUberJARLocation(MavenProject project, Log log) {
String classifier = getSpringBootMavenPluginClassifier(project, log);
if (classifier == null) {
classifier = "";
}
if (!classifier.isEmpty() && !classifier.startsWith("-")) {
classif... | [
"public",
"static",
"File",
"getSpringBootUberJARLocation",
"(",
"MavenProject",
"project",
",",
"Log",
"log",
")",
"{",
"String",
"classifier",
"=",
"getSpringBootMavenPluginClassifier",
"(",
"project",
",",
"log",
")",
";",
"if",
"(",
"classifier",
"==",
"null",... | Get the Spring Boot Uber JAR in its expected location, taking into account the
spring-boot-maven-plugin classifier configuration as well. No validation is done,
that is, there is no guarantee the JAR file actually exists at the returned location.
@param outputDirectory
@param project
@param log
@return the File repre... | [
"Get",
"the",
"Spring",
"Boot",
"Uber",
"JAR",
"in",
"its",
"expected",
"location",
"taking",
"into",
"account",
"the",
"spring",
"-",
"boot",
"-",
"maven",
"-",
"plugin",
"classifier",
"configuration",
"as",
"well",
".",
"No",
"validation",
"is",
"done",
... | 4fcf2d314299a4c02e2c740e4fc99a4f6aba6918 | https://github.com/WASdev/ci.maven/blob/4fcf2d314299a4c02e2c740e4fc99a4f6aba6918/liberty-maven-plugin/src/main/java/net/wasdev/wlp/maven/plugins/utils/SpringBootUtil.java#L79-L92 | train |
WASdev/ci.maven | liberty-maven-plugin/src/main/java/net/wasdev/wlp/maven/plugins/BasicSupport.java | BasicSupport.installServerAssembly | protected void installServerAssembly() throws Exception {
if (installType == InstallType.ALREADY_EXISTS) {
log.info(MessageFormat.format(messages.getString("info.install.type.preexisting"), ""));
} else {
if (installType == InstallType.FROM_ARCHIVE) {
installFromA... | java | protected void installServerAssembly() throws Exception {
if (installType == InstallType.ALREADY_EXISTS) {
log.info(MessageFormat.format(messages.getString("info.install.type.preexisting"), ""));
} else {
if (installType == InstallType.FROM_ARCHIVE) {
installFromA... | [
"protected",
"void",
"installServerAssembly",
"(",
")",
"throws",
"Exception",
"{",
"if",
"(",
"installType",
"==",
"InstallType",
".",
"ALREADY_EXISTS",
")",
"{",
"log",
".",
"info",
"(",
"MessageFormat",
".",
"format",
"(",
"messages",
".",
"getString",
"(",... | Performs assembly installation unless the install type is pre-existing.
@throws Exception | [
"Performs",
"assembly",
"installation",
"unless",
"the",
"install",
"type",
"is",
"pre",
"-",
"existing",
"."
] | 4fcf2d314299a4c02e2c740e4fc99a4f6aba6918 | https://github.com/WASdev/ci.maven/blob/4fcf2d314299a4c02e2c740e4fc99a4f6aba6918/liberty-maven-plugin/src/main/java/net/wasdev/wlp/maven/plugins/BasicSupport.java#L299-L310 | train |
WASdev/ci.maven | liberty-maven-plugin/src/main/java/net/wasdev/wlp/maven/plugins/BasicSupport.java | BasicSupport.stripVersionFromName | protected String stripVersionFromName(String name, String version) {
int versionBeginIndex = name.lastIndexOf("-" + version);
if ( versionBeginIndex != -1) {
return name.substring(0, versionBeginIndex) + name.substring(versionBeginIndex + version.length() + 1);
} else {
r... | java | protected String stripVersionFromName(String name, String version) {
int versionBeginIndex = name.lastIndexOf("-" + version);
if ( versionBeginIndex != -1) {
return name.substring(0, versionBeginIndex) + name.substring(versionBeginIndex + version.length() + 1);
} else {
r... | [
"protected",
"String",
"stripVersionFromName",
"(",
"String",
"name",
",",
"String",
"version",
")",
"{",
"int",
"versionBeginIndex",
"=",
"name",
".",
"lastIndexOf",
"(",
"\"-\"",
"+",
"version",
")",
";",
"if",
"(",
"versionBeginIndex",
"!=",
"-",
"1",
")"... | Strip version string from name | [
"Strip",
"version",
"string",
"from",
"name"
] | 4fcf2d314299a4c02e2c740e4fc99a4f6aba6918 | https://github.com/WASdev/ci.maven/blob/4fcf2d314299a4c02e2c740e4fc99a4f6aba6918/liberty-maven-plugin/src/main/java/net/wasdev/wlp/maven/plugins/BasicSupport.java#L401-L408 | train |
WASdev/ci.maven | liberty-maven-plugin/src/main/java/net/wasdev/wlp/maven/plugins/BasicSupport.java | BasicSupport.getWlpOutputDir | private String getWlpOutputDir() throws IOException {
Properties envvars = new Properties();
File serverEnvFile = new File(installDirectory, "etc/server.env");
if (serverEnvFile.exists()) {
envvars.load(new FileInputStream(serverEnvFile));
}
serverEn... | java | private String getWlpOutputDir() throws IOException {
Properties envvars = new Properties();
File serverEnvFile = new File(installDirectory, "etc/server.env");
if (serverEnvFile.exists()) {
envvars.load(new FileInputStream(serverEnvFile));
}
serverEn... | [
"private",
"String",
"getWlpOutputDir",
"(",
")",
"throws",
"IOException",
"{",
"Properties",
"envvars",
"=",
"new",
"Properties",
"(",
")",
";",
"File",
"serverEnvFile",
"=",
"new",
"File",
"(",
"installDirectory",
",",
"\"etc/server.env\"",
")",
";",
"if",
"... | exist or variable is not in server.env | [
"exist",
"or",
"variable",
"is",
"not",
"in",
"server",
".",
"env"
] | 4fcf2d314299a4c02e2c740e4fc99a4f6aba6918 | https://github.com/WASdev/ci.maven/blob/4fcf2d314299a4c02e2c740e4fc99a4f6aba6918/liberty-maven-plugin/src/main/java/net/wasdev/wlp/maven/plugins/BasicSupport.java#L482-L498 | train |
WASdev/ci.maven | liberty-maven-plugin/src/main/java/net/wasdev/wlp/maven/plugins/AbstractLibertySupport.java | AbstractLibertySupport.createArtifact | @Override
protected Artifact createArtifact(final ArtifactItem item) throws MojoExecutionException {
assert item != null;
if (item.getVersion() == null) {
throw new MojoExecutionException("Unable to find artifact without version specified: " + item.getGroupId()
+... | java | @Override
protected Artifact createArtifact(final ArtifactItem item) throws MojoExecutionException {
assert item != null;
if (item.getVersion() == null) {
throw new MojoExecutionException("Unable to find artifact without version specified: " + item.getGroupId()
+... | [
"@",
"Override",
"protected",
"Artifact",
"createArtifact",
"(",
"final",
"ArtifactItem",
"item",
")",
"throws",
"MojoExecutionException",
"{",
"assert",
"item",
"!=",
"null",
";",
"if",
"(",
"item",
".",
"getVersion",
"(",
")",
"==",
"null",
")",
"{",
"thro... | Create a new artifact.
@param item The item to create an artifact for
@return A resolved artifact for the given item.
@throws MojoExecutionException Failed to create artifact | [
"Create",
"a",
"new",
"artifact",
"."
] | 4fcf2d314299a4c02e2c740e4fc99a4f6aba6918 | https://github.com/WASdev/ci.maven/blob/4fcf2d314299a4c02e2c740e4fc99a4f6aba6918/liberty-maven-plugin/src/main/java/net/wasdev/wlp/maven/plugins/AbstractLibertySupport.java#L220-L239 | train |
WASdev/ci.maven | liberty-maven-plugin/src/main/java/net/wasdev/wlp/maven/plugins/server/types/Features.java | Features.addFeature | public void addFeature(String feature) {
if (feature == null) {
throw new IllegalArgumentException("Invalid null argument passed for addFeature");
}
feature = feature.trim();
if (!feature.isEmpty()) {
Feature newFeature = new Feature();
newFeature.add... | java | public void addFeature(String feature) {
if (feature == null) {
throw new IllegalArgumentException("Invalid null argument passed for addFeature");
}
feature = feature.trim();
if (!feature.isEmpty()) {
Feature newFeature = new Feature();
newFeature.add... | [
"public",
"void",
"addFeature",
"(",
"String",
"feature",
")",
"{",
"if",
"(",
"feature",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Invalid null argument passed for addFeature\"",
")",
";",
"}",
"feature",
"=",
"feature",
".",
"... | Add a feature into a list.
@param feature A feature name. | [
"Add",
"a",
"feature",
"into",
"a",
"list",
"."
] | 4fcf2d314299a4c02e2c740e4fc99a4f6aba6918 | https://github.com/WASdev/ci.maven/blob/4fcf2d314299a4c02e2c740e4fc99a4f6aba6918/liberty-maven-plugin/src/main/java/net/wasdev/wlp/maven/plugins/server/types/Features.java#L115-L125 | train |
WASdev/ci.maven | liberty-maven-plugin/src/main/java/net/wasdev/wlp/maven/plugins/utils/MavenProjectUtil.java | MavenProjectUtil.getPluginConfiguration | public static String getPluginConfiguration(MavenProject proj, String pluginGroupId, String pluginArtifactId, String key) {
Xpp3Dom dom = proj.getGoalConfiguration(pluginGroupId, pluginArtifactId, null, null);
if (dom != null) {
Xpp3Dom val = dom.getChild(key);
if (val != null) {... | java | public static String getPluginConfiguration(MavenProject proj, String pluginGroupId, String pluginArtifactId, String key) {
Xpp3Dom dom = proj.getGoalConfiguration(pluginGroupId, pluginArtifactId, null, null);
if (dom != null) {
Xpp3Dom val = dom.getChild(key);
if (val != null) {... | [
"public",
"static",
"String",
"getPluginConfiguration",
"(",
"MavenProject",
"proj",
",",
"String",
"pluginGroupId",
",",
"String",
"pluginArtifactId",
",",
"String",
"key",
")",
"{",
"Xpp3Dom",
"dom",
"=",
"proj",
".",
"getGoalConfiguration",
"(",
"pluginGroupId",
... | Get a configuration value from a plugin
@param proj
@param pluginGroupId
@param pluginArtifactId
@param key
@return | [
"Get",
"a",
"configuration",
"value",
"from",
"a",
"plugin"
] | 4fcf2d314299a4c02e2c740e4fc99a4f6aba6918 | https://github.com/WASdev/ci.maven/blob/4fcf2d314299a4c02e2c740e4fc99a4f6aba6918/liberty-maven-plugin/src/main/java/net/wasdev/wlp/maven/plugins/utils/MavenProjectUtil.java#L39-L48 | train |
WASdev/ci.maven | liberty-maven-plugin/src/main/java/net/wasdev/wlp/maven/plugins/utils/MavenProjectUtil.java | MavenProjectUtil.getPluginGoalConfigurationString | public static String getPluginGoalConfigurationString(MavenProject project, String pluginKey, String goal, String configName) throws PluginScenarioException {
PluginExecution execution = getPluginGoalExecution(project, pluginKey, goal);
final Xpp3Dom config = (Xpp3Dom)execution.getConfiguration... | java | public static String getPluginGoalConfigurationString(MavenProject project, String pluginKey, String goal, String configName) throws PluginScenarioException {
PluginExecution execution = getPluginGoalExecution(project, pluginKey, goal);
final Xpp3Dom config = (Xpp3Dom)execution.getConfiguration... | [
"public",
"static",
"String",
"getPluginGoalConfigurationString",
"(",
"MavenProject",
"project",
",",
"String",
"pluginKey",
",",
"String",
"goal",
",",
"String",
"configName",
")",
"throws",
"PluginScenarioException",
"{",
"PluginExecution",
"execution",
"=",
"getPlug... | Get a configuration value from a goal from a plugin
@param project
@param pluginKey
@param goal
@param configName
@return the value of the configuration parameter
@throws PluginScenarioException | [
"Get",
"a",
"configuration",
"value",
"from",
"a",
"goal",
"from",
"a",
"plugin"
] | 4fcf2d314299a4c02e2c740e4fc99a4f6aba6918 | https://github.com/WASdev/ci.maven/blob/4fcf2d314299a4c02e2c740e4fc99a4f6aba6918/liberty-maven-plugin/src/main/java/net/wasdev/wlp/maven/plugins/utils/MavenProjectUtil.java#L59-L71 | train |
WASdev/ci.maven | liberty-maven-plugin/src/main/java/net/wasdev/wlp/maven/plugins/utils/MavenProjectUtil.java | MavenProjectUtil.getManifestFile | public static File getManifestFile(MavenProject proj, String pluginArtifactId) {
Xpp3Dom dom = proj.getGoalConfiguration("org.apache.maven.plugins", pluginArtifactId, null, null);
if (dom != null) {
Xpp3Dom archive = dom.getChild("archive");
if (archive != null) {
... | java | public static File getManifestFile(MavenProject proj, String pluginArtifactId) {
Xpp3Dom dom = proj.getGoalConfiguration("org.apache.maven.plugins", pluginArtifactId, null, null);
if (dom != null) {
Xpp3Dom archive = dom.getChild("archive");
if (archive != null) {
... | [
"public",
"static",
"File",
"getManifestFile",
"(",
"MavenProject",
"proj",
",",
"String",
"pluginArtifactId",
")",
"{",
"Xpp3Dom",
"dom",
"=",
"proj",
".",
"getGoalConfiguration",
"(",
"\"org.apache.maven.plugins\"",
",",
"pluginArtifactId",
",",
"null",
",",
"null... | Get manifest file from plugin configuration
@param proj
@param pluginArtifactId
@return the manifest file | [
"Get",
"manifest",
"file",
"from",
"plugin",
"configuration"
] | 4fcf2d314299a4c02e2c740e4fc99a4f6aba6918 | https://github.com/WASdev/ci.maven/blob/4fcf2d314299a4c02e2c740e4fc99a4f6aba6918/liberty-maven-plugin/src/main/java/net/wasdev/wlp/maven/plugins/utils/MavenProjectUtil.java#L111-L123 | train |
WASdev/ci.maven | liberty-maven-plugin/src/main/java/net/wasdev/wlp/maven/plugins/applications/InstallAppMojoSupport.java | InstallAppMojoSupport.installLooseConfigWar | protected void installLooseConfigWar(MavenProject proj, LooseConfigData config) throws Exception {
// return error if webapp contains java source but it is not compiled yet.
File dir = new File(proj.getBuild().getOutputDirectory());
if (!dir.exists() && containsJavaSource(proj)) {
th... | java | protected void installLooseConfigWar(MavenProject proj, LooseConfigData config) throws Exception {
// return error if webapp contains java source but it is not compiled yet.
File dir = new File(proj.getBuild().getOutputDirectory());
if (!dir.exists() && containsJavaSource(proj)) {
th... | [
"protected",
"void",
"installLooseConfigWar",
"(",
"MavenProject",
"proj",
",",
"LooseConfigData",
"config",
")",
"throws",
"Exception",
"{",
"// return error if webapp contains java source but it is not compiled yet.",
"File",
"dir",
"=",
"new",
"File",
"(",
"proj",
".",
... | install war project artifact using loose application configuration file | [
"install",
"war",
"project",
"artifact",
"using",
"loose",
"application",
"configuration",
"file"
] | 4fcf2d314299a4c02e2c740e4fc99a4f6aba6918 | https://github.com/WASdev/ci.maven/blob/4fcf2d314299a4c02e2c740e4fc99a4f6aba6918/liberty-maven-plugin/src/main/java/net/wasdev/wlp/maven/plugins/applications/InstallAppMojoSupport.java#L83-L102 | train |
WASdev/ci.maven | liberty-maven-plugin/src/main/java/net/wasdev/wlp/maven/plugins/applications/InstallAppMojoSupport.java | InstallAppMojoSupport.installLooseConfigEar | protected void installLooseConfigEar(MavenProject proj, LooseConfigData config) throws Exception {
LooseEarApplication looseEar = new LooseEarApplication(proj, config);
looseEar.addSourceDir();
looseEar.addApplicationXmlFile();
Set<Artifact> artifacts = proj.getArtifacts();
log.... | java | protected void installLooseConfigEar(MavenProject proj, LooseConfigData config) throws Exception {
LooseEarApplication looseEar = new LooseEarApplication(proj, config);
looseEar.addSourceDir();
looseEar.addApplicationXmlFile();
Set<Artifact> artifacts = proj.getArtifacts();
log.... | [
"protected",
"void",
"installLooseConfigEar",
"(",
"MavenProject",
"proj",
",",
"LooseConfigData",
"config",
")",
"throws",
"Exception",
"{",
"LooseEarApplication",
"looseEar",
"=",
"new",
"LooseEarApplication",
"(",
"proj",
",",
"config",
")",
";",
"looseEar",
".",... | install ear project artifact using loose application configuration file | [
"install",
"ear",
"project",
"artifact",
"using",
"loose",
"application",
"configuration",
"file"
] | 4fcf2d314299a4c02e2c740e4fc99a4f6aba6918 | https://github.com/WASdev/ci.maven/blob/4fcf2d314299a4c02e2c740e4fc99a4f6aba6918/liberty-maven-plugin/src/main/java/net/wasdev/wlp/maven/plugins/applications/InstallAppMojoSupport.java#L105-L160 | train |
WASdev/ci.maven | liberty-maven-plugin/src/main/java/net/wasdev/wlp/maven/plugins/applications/InstallAppMojoSupport.java | InstallAppMojoSupport.getAppFileName | private String getAppFileName(MavenProject project) {
String name = project.getBuild().getFinalName() + "." + project.getPackaging();
if (project.getPackaging().equals("liberty-assembly")) {
name = project.getBuild().getFinalName() + ".war";
}
if (stripVersion) {
... | java | private String getAppFileName(MavenProject project) {
String name = project.getBuild().getFinalName() + "." + project.getPackaging();
if (project.getPackaging().equals("liberty-assembly")) {
name = project.getBuild().getFinalName() + ".war";
}
if (stripVersion) {
... | [
"private",
"String",
"getAppFileName",
"(",
"MavenProject",
"project",
")",
"{",
"String",
"name",
"=",
"project",
".",
"getBuild",
"(",
")",
".",
"getFinalName",
"(",
")",
"+",
"\".\"",
"+",
"project",
".",
"getPackaging",
"(",
")",
";",
"if",
"(",
"pro... | get loose application configuration file name for project artifact | [
"get",
"loose",
"application",
"configuration",
"file",
"name",
"for",
"project",
"artifact"
] | 4fcf2d314299a4c02e2c740e4fc99a4f6aba6918 | https://github.com/WASdev/ci.maven/blob/4fcf2d314299a4c02e2c740e4fc99a4f6aba6918/liberty-maven-plugin/src/main/java/net/wasdev/wlp/maven/plugins/applications/InstallAppMojoSupport.java#L234-L243 | train |
WASdev/ci.maven | liberty-maven-plugin/src/main/java/net/wasdev/wlp/maven/plugins/applications/InstallAppMojoSupport.java | InstallAppMojoSupport.invokeSpringBootUtilCommand | protected void invokeSpringBootUtilCommand(File installDirectory, String fatArchiveSrcLocation,
String thinArchiveTargetLocation, String libIndexCacheTargetLocation) throws Exception {
SpringBootUtilTask springBootUtilTask = (SpringBootUtilTask) ant
.createTask("antlib:net/wasdev/wlp... | java | protected void invokeSpringBootUtilCommand(File installDirectory, String fatArchiveSrcLocation,
String thinArchiveTargetLocation, String libIndexCacheTargetLocation) throws Exception {
SpringBootUtilTask springBootUtilTask = (SpringBootUtilTask) ant
.createTask("antlib:net/wasdev/wlp... | [
"protected",
"void",
"invokeSpringBootUtilCommand",
"(",
"File",
"installDirectory",
",",
"String",
"fatArchiveSrcLocation",
",",
"String",
"thinArchiveTargetLocation",
",",
"String",
"libIndexCacheTargetLocation",
")",
"throws",
"Exception",
"{",
"SpringBootUtilTask",
"sprin... | Executes the SpringBootUtilTask to thin the Spring Boot application
executable archive and place the thin archive and lib.index.cache in the
specified location.
@param installDirectory
: Installation directory of Liberty profile.
@param fatArchiveSrcLocation
: Source Spring Boot FAT executable archive location.
@param... | [
"Executes",
"the",
"SpringBootUtilTask",
"to",
"thin",
"the",
"Spring",
"Boot",
"application",
"executable",
"archive",
"and",
"place",
"the",
"thin",
"archive",
"and",
"lib",
".",
"index",
".",
"cache",
"in",
"the",
"specified",
"location",
"."
] | 4fcf2d314299a4c02e2c740e4fc99a4f6aba6918 | https://github.com/WASdev/ci.maven/blob/4fcf2d314299a4c02e2c740e4fc99a4f6aba6918/liberty-maven-plugin/src/main/java/net/wasdev/wlp/maven/plugins/applications/InstallAppMojoSupport.java#L272-L290 | train |
wealthfront/magellan | magellan-library/src/main/java/com/wealthfront/magellan/Navigator.java | Navigator.onCreate | public void onCreate(Activity activity, Bundle savedInstanceState) {
this.activity = activity;
container = (ScreenContainer) activity.findViewById(R.id.magellan_container);
checkState(container != null, "There must be a ScreenContainer whose id is R.id.magellan_container in the view hierarchy");
for (Sc... | java | public void onCreate(Activity activity, Bundle savedInstanceState) {
this.activity = activity;
container = (ScreenContainer) activity.findViewById(R.id.magellan_container);
checkState(container != null, "There must be a ScreenContainer whose id is R.id.magellan_container in the view hierarchy");
for (Sc... | [
"public",
"void",
"onCreate",
"(",
"Activity",
"activity",
",",
"Bundle",
"savedInstanceState",
")",
"{",
"this",
".",
"activity",
"=",
"activity",
";",
"container",
"=",
"(",
"ScreenContainer",
")",
"activity",
".",
"findViewById",
"(",
"R",
".",
"id",
".",... | Initializes the Navigator with Activity instance and Bundle for saved instance state.
Call this method from {@link Activity#onCreate(Bundle) onCreate} of the Activity associated with this Navigator.
@param activity Activity associated with application
@param savedInstanceState state to restore from previously destr... | [
"Initializes",
"the",
"Navigator",
"with",
"Activity",
"instance",
"and",
"Bundle",
"for",
"saved",
"instance",
"state",
"."
] | f690979161a97e40fb9d11dc9d7e3c8cf85ba312 | https://github.com/wealthfront/magellan/blob/f690979161a97e40fb9d11dc9d7e3c8cf85ba312/magellan-library/src/main/java/com/wealthfront/magellan/Navigator.java#L86-L95 | train |
wealthfront/magellan | magellan-library/src/main/java/com/wealthfront/magellan/Navigator.java | Navigator.onSaveInstanceState | public void onSaveInstanceState(Bundle outState) {
for (Screen screen : backStack) {
screen.save(outState);
screen.onSave(outState);
}
} | java | public void onSaveInstanceState(Bundle outState) {
for (Screen screen : backStack) {
screen.save(outState);
screen.onSave(outState);
}
} | [
"public",
"void",
"onSaveInstanceState",
"(",
"Bundle",
"outState",
")",
"{",
"for",
"(",
"Screen",
"screen",
":",
"backStack",
")",
"{",
"screen",
".",
"save",
"(",
"outState",
")",
";",
"screen",
".",
"onSave",
"(",
"outState",
")",
";",
"}",
"}"
] | Notifies all screens to save instance state in input Bundle.
Call this method from {@link Activity#onSaveInstanceState(Bundle) onSaveInstanceState} in the Activity associated
with this Navigator
@param outState Bundle in which to store screen state information | [
"Notifies",
"all",
"screens",
"to",
"save",
"instance",
"state",
"in",
"input",
"Bundle",
"."
] | f690979161a97e40fb9d11dc9d7e3c8cf85ba312 | https://github.com/wealthfront/magellan/blob/f690979161a97e40fb9d11dc9d7e3c8cf85ba312/magellan-library/src/main/java/com/wealthfront/magellan/Navigator.java#L105-L110 | train |
wealthfront/magellan | magellan-library/src/main/java/com/wealthfront/magellan/Navigator.java | Navigator.resetWithRoot | public void resetWithRoot(Activity activity, final Screen root) {
checkOnCreateNotYetCalled(activity, "resetWithRoot() must be called before onCreate()");
backStack.clear();
backStack.push(root);
} | java | public void resetWithRoot(Activity activity, final Screen root) {
checkOnCreateNotYetCalled(activity, "resetWithRoot() must be called before onCreate()");
backStack.clear();
backStack.push(root);
} | [
"public",
"void",
"resetWithRoot",
"(",
"Activity",
"activity",
",",
"final",
"Screen",
"root",
")",
"{",
"checkOnCreateNotYetCalled",
"(",
"activity",
",",
"\"resetWithRoot() must be called before onCreate()\"",
")",
";",
"backStack",
".",
"clear",
"(",
")",
";",
"... | Clears the back stack of this Navigator and adds the input Screen as the new root of the back stack.
@param activity activity used to verify this Navigator is in an acceptable state when resetWithRoot is called
@param root new root screen for this Navigator
@throws IllegalStateException if {@link #onCreate(Activity,... | [
"Clears",
"the",
"back",
"stack",
"of",
"this",
"Navigator",
"and",
"adds",
"the",
"input",
"Screen",
"as",
"the",
"new",
"root",
"of",
"the",
"back",
"stack",
"."
] | f690979161a97e40fb9d11dc9d7e3c8cf85ba312 | https://github.com/wealthfront/magellan/blob/f690979161a97e40fb9d11dc9d7e3c8cf85ba312/magellan-library/src/main/java/com/wealthfront/magellan/Navigator.java#L253-L257 | train |
wealthfront/magellan | magellan-library/src/main/java/com/wealthfront/magellan/Navigator.java | Navigator.goBackToRoot | public void goBackToRoot(NavigationType navigationType) {
navigate(new HistoryRewriter() {
@Override
public void rewriteHistory(Deque<Screen> history) {
while (history.size() > 1) {
history.pop();
}
}
}, navigationType, BACKWARD);
} | java | public void goBackToRoot(NavigationType navigationType) {
navigate(new HistoryRewriter() {
@Override
public void rewriteHistory(Deque<Screen> history) {
while (history.size() > 1) {
history.pop();
}
}
}, navigationType, BACKWARD);
} | [
"public",
"void",
"goBackToRoot",
"(",
"NavigationType",
"navigationType",
")",
"{",
"navigate",
"(",
"new",
"HistoryRewriter",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"rewriteHistory",
"(",
"Deque",
"<",
"Screen",
">",
"history",
")",
"{",
"while",
... | Navigates from current screen all the way to the root screen in this Navigator's back stack, removing all
intermediate screen in this Navigator's back stack along the way. The current screen animates out of the view
according to the animation specified by the NavigationType parameter.
@param navigationType determines... | [
"Navigates",
"from",
"current",
"screen",
"all",
"the",
"way",
"to",
"the",
"root",
"screen",
"in",
"this",
"Navigator",
"s",
"back",
"stack",
"removing",
"all",
"intermediate",
"screen",
"in",
"this",
"Navigator",
"s",
"back",
"stack",
"along",
"the",
"way"... | f690979161a97e40fb9d11dc9d7e3c8cf85ba312 | https://github.com/wealthfront/magellan/blob/f690979161a97e40fb9d11dc9d7e3c8cf85ba312/magellan-library/src/main/java/com/wealthfront/magellan/Navigator.java#L426-L435 | train |
wealthfront/magellan | magellan-library/src/main/java/com/wealthfront/magellan/Navigator.java | Navigator.getBackStackDescription | public String getBackStackDescription() {
ArrayList<Screen> backStackCopy = new ArrayList<>(backStack);
Collections.reverse(backStackCopy);
String currentScreen = "";
if (!backStackCopy.isEmpty()) {
currentScreen = backStackCopy.remove(backStackCopy.size() - 1).toString();
}
return TextUti... | java | public String getBackStackDescription() {
ArrayList<Screen> backStackCopy = new ArrayList<>(backStack);
Collections.reverse(backStackCopy);
String currentScreen = "";
if (!backStackCopy.isEmpty()) {
currentScreen = backStackCopy.remove(backStackCopy.size() - 1).toString();
}
return TextUti... | [
"public",
"String",
"getBackStackDescription",
"(",
")",
"{",
"ArrayList",
"<",
"Screen",
">",
"backStackCopy",
"=",
"new",
"ArrayList",
"<>",
"(",
"backStack",
")",
";",
"Collections",
".",
"reverse",
"(",
"backStackCopy",
")",
";",
"String",
"currentScreen",
... | Returns a human-readable string describing the screens in this Navigator's back stack.
@return a human-readable description of the back stack. | [
"Returns",
"a",
"human",
"-",
"readable",
"string",
"describing",
"the",
"screens",
"in",
"this",
"Navigator",
"s",
"back",
"stack",
"."
] | f690979161a97e40fb9d11dc9d7e3c8cf85ba312 | https://github.com/wealthfront/magellan/blob/f690979161a97e40fb9d11dc9d7e3c8cf85ba312/magellan-library/src/main/java/com/wealthfront/magellan/Navigator.java#L663-L671 | train |
opentelecoms-org/jsmpp | jsmpp/src/main/java/org/jsmpp/util/StrictBufferedInputStream.java | StrictBufferedInputStream.read | @Override
public int read(final byte[] buffer, final int bufPos, final int length)
throws IOException {
int i = super.read(buffer, bufPos, length);
if ((i == length) || (i == -1))
return i;
int j = super.read(buffer, bufPos + i, length - i);
if (j == -1... | java | @Override
public int read(final byte[] buffer, final int bufPos, final int length)
throws IOException {
int i = super.read(buffer, bufPos, length);
if ((i == length) || (i == -1))
return i;
int j = super.read(buffer, bufPos + i, length - i);
if (j == -1... | [
"@",
"Override",
"public",
"int",
"read",
"(",
"final",
"byte",
"[",
"]",
"buffer",
",",
"final",
"int",
"bufPos",
",",
"final",
"int",
"length",
")",
"throws",
"IOException",
"{",
"int",
"i",
"=",
"super",
".",
"read",
"(",
"buffer",
",",
"bufPos",
... | Workaround for an unexpected behavior of 'BufferedInputStream'! | [
"Workaround",
"for",
"an",
"unexpected",
"behavior",
"of",
"BufferedInputStream",
"!"
] | acc15e73e7431deabc803731971b15323315baaf | https://github.com/opentelecoms-org/jsmpp/blob/acc15e73e7431deabc803731971b15323315baaf/jsmpp/src/main/java/org/jsmpp/util/StrictBufferedInputStream.java#L37-L47 | train |
opentelecoms-org/jsmpp | jsmpp/src/main/java/org/jsmpp/session/SMPPOutboundServerSession.java | SMPPOutboundServerSession.sendBind | private String sendBind(BindType bindType, String systemId,
String password, String systemType,
InterfaceVersion interfaceVersion, TypeOfNumber addrTon,
NumberingPlanIndicator addrNpi, String addressRange, long timeout)
throws PDUExcept... | java | private String sendBind(BindType bindType, String systemId,
String password, String systemType,
InterfaceVersion interfaceVersion, TypeOfNumber addrTon,
NumberingPlanIndicator addrNpi, String addressRange, long timeout)
throws PDUExcept... | [
"private",
"String",
"sendBind",
"(",
"BindType",
"bindType",
",",
"String",
"systemId",
",",
"String",
"password",
",",
"String",
"systemType",
",",
"InterfaceVersion",
"interfaceVersion",
",",
"TypeOfNumber",
"addrTon",
",",
"NumberingPlanIndicator",
"addrNpi",
",",... | Sending bind.
@param bindType is the bind type.
@param systemId is the system id.
@param password is the password.
@param systemType is the system type.
@param interfaceVersion is the interface version.
@param addrTon is the address TON.
@param addrNpi is the address NPI.
@param addressRange is the address range.
@par... | [
"Sending",
"bind",
"."
] | acc15e73e7431deabc803731971b15323315baaf | https://github.com/opentelecoms-org/jsmpp/blob/acc15e73e7431deabc803731971b15323315baaf/jsmpp/src/main/java/org/jsmpp/session/SMPPOutboundServerSession.java#L132-L151 | train |
opentelecoms-org/jsmpp | jsmpp/src/main/java/org/jsmpp/session/SMPPOutboundServerSession.java | SMPPOutboundServerSession.waitForOutbind | public OutbindRequest waitForOutbind(long timeout)
throws IllegalStateException, TimeoutException {
SessionState currentSessionState = getSessionState();
if (currentSessionState.equals(SessionState.OPEN)) {
new SMPPOutboundServerSession.PDUReaderWorker().start();
try {
return outbindRe... | java | public OutbindRequest waitForOutbind(long timeout)
throws IllegalStateException, TimeoutException {
SessionState currentSessionState = getSessionState();
if (currentSessionState.equals(SessionState.OPEN)) {
new SMPPOutboundServerSession.PDUReaderWorker().start();
try {
return outbindRe... | [
"public",
"OutbindRequest",
"waitForOutbind",
"(",
"long",
"timeout",
")",
"throws",
"IllegalStateException",
",",
"TimeoutException",
"{",
"SessionState",
"currentSessionState",
"=",
"getSessionState",
"(",
")",
";",
"if",
"(",
"currentSessionState",
".",
"equals",
"... | Wait for outbind request.
@param timeout is the timeout.
@return the {@link OutbindRequest}.
@throws IllegalStateException if this invocation of this method has been made or invoke when state is not OPEN.
@throws TimeoutException if the timeout has been reach and {@link SMPPOutboundServerSession} are no more vali... | [
"Wait",
"for",
"outbind",
"request",
"."
] | acc15e73e7431deabc803731971b15323315baaf | https://github.com/opentelecoms-org/jsmpp/blob/acc15e73e7431deabc803731971b15323315baaf/jsmpp/src/main/java/org/jsmpp/session/SMPPOutboundServerSession.java#L162-L184 | train |
opentelecoms-org/jsmpp | jsmpp/src/main/java/org/jsmpp/session/SMPPOutboundServerSession.java | SMPPOutboundServerSession.bind | public String bind(BindParameter bindParam, long timeout)
throws IOException {
try {
String smscSystemId = sendBind(bindParam.getBindType(), bindParam.getSystemId(), bindParam.getPassword(), bindParam.getSystemType(),
bindParam.getInterfaceVersion(), bindParam.getAddrTon(), bindParam.getAddrNp... | java | public String bind(BindParameter bindParam, long timeout)
throws IOException {
try {
String smscSystemId = sendBind(bindParam.getBindType(), bindParam.getSystemId(), bindParam.getPassword(), bindParam.getSystemType(),
bindParam.getInterfaceVersion(), bindParam.getAddrTon(), bindParam.getAddrNp... | [
"public",
"String",
"bind",
"(",
"BindParameter",
"bindParam",
",",
"long",
"timeout",
")",
"throws",
"IOException",
"{",
"try",
"{",
"String",
"smscSystemId",
"=",
"sendBind",
"(",
"bindParam",
".",
"getBindType",
"(",
")",
",",
"bindParam",
".",
"getSystemId... | Bind immediately.
@param bindParam is the bind parameters.
@param timeout is the timeout.
@return the SMSC system id.
@throws IOException if there is an IO error found. | [
"Bind",
"immediately",
"."
] | acc15e73e7431deabc803731971b15323315baaf | https://github.com/opentelecoms-org/jsmpp/blob/acc15e73e7431deabc803731971b15323315baaf/jsmpp/src/main/java/org/jsmpp/session/SMPPOutboundServerSession.java#L240-L275 | train |
opentelecoms-org/jsmpp | jsmpp/src/main/java/org/jsmpp/util/HexUtil.java | HexUtil.convertHexStringToString | public static String convertHexStringToString(String hexString) {
String uHexString = hexString.toLowerCase();
StringBuilder sBld = new StringBuilder();
for (int i = 0; i < uHexString.length(); i = i + 2) {
char c = (char)Integer.parseInt(uHexString.substring(i, i + 2), 16);
... | java | public static String convertHexStringToString(String hexString) {
String uHexString = hexString.toLowerCase();
StringBuilder sBld = new StringBuilder();
for (int i = 0; i < uHexString.length(); i = i + 2) {
char c = (char)Integer.parseInt(uHexString.substring(i, i + 2), 16);
... | [
"public",
"static",
"String",
"convertHexStringToString",
"(",
"String",
"hexString",
")",
"{",
"String",
"uHexString",
"=",
"hexString",
".",
"toLowerCase",
"(",
")",
";",
"StringBuilder",
"sBld",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"int",... | Convert the hex string to string.
@param hexString is the hex string.
@return the string value that converted from hex string. | [
"Convert",
"the",
"hex",
"string",
"to",
"string",
"."
] | acc15e73e7431deabc803731971b15323315baaf | https://github.com/opentelecoms-org/jsmpp/blob/acc15e73e7431deabc803731971b15323315baaf/jsmpp/src/main/java/org/jsmpp/util/HexUtil.java#L84-L92 | train |
opentelecoms-org/jsmpp | jsmpp/src/main/java/org/jsmpp/util/HexUtil.java | HexUtil.convertHexStringToBytes | public static byte[] convertHexStringToBytes(String hexString, int offset,
int endIndex) {
byte[] data;
String realHexString = hexString.substring(offset, endIndex)
.toLowerCase();
if ((realHexString.length() % 2) == 0)
data = new byte[realHexString.length... | java | public static byte[] convertHexStringToBytes(String hexString, int offset,
int endIndex) {
byte[] data;
String realHexString = hexString.substring(offset, endIndex)
.toLowerCase();
if ((realHexString.length() % 2) == 0)
data = new byte[realHexString.length... | [
"public",
"static",
"byte",
"[",
"]",
"convertHexStringToBytes",
"(",
"String",
"hexString",
",",
"int",
"offset",
",",
"int",
"endIndex",
")",
"{",
"byte",
"[",
"]",
"data",
";",
"String",
"realHexString",
"=",
"hexString",
".",
"substring",
"(",
"offset",
... | Convert the hex string to bytes.
@param hexString is the hex string.
@param offset is the offset.
@param endIndex is the end index.
@return the bytes value that converted from the hex string. | [
"Convert",
"the",
"hex",
"string",
"to",
"bytes",
"."
] | acc15e73e7431deabc803731971b15323315baaf | https://github.com/opentelecoms-org/jsmpp/blob/acc15e73e7431deabc803731971b15323315baaf/jsmpp/src/main/java/org/jsmpp/util/HexUtil.java#L112-L139 | train |
opentelecoms-org/jsmpp | jsmpp/src/main/java/org/jsmpp/bean/DeliveryReceipt.java | DeliveryReceipt.intToString | private static String intToString(int value, int digit) {
StringBuilder stringBuilder = new StringBuilder(digit);
stringBuilder.append(Integer.toString(value));
while (stringBuilder.length() < digit) {
stringBuilder.insert(0, "0");
}
return stringBuilder.toString();
... | java | private static String intToString(int value, int digit) {
StringBuilder stringBuilder = new StringBuilder(digit);
stringBuilder.append(Integer.toString(value));
while (stringBuilder.length() < digit) {
stringBuilder.insert(0, "0");
}
return stringBuilder.toString();
... | [
"private",
"static",
"String",
"intToString",
"(",
"int",
"value",
",",
"int",
"digit",
")",
"{",
"StringBuilder",
"stringBuilder",
"=",
"new",
"StringBuilder",
"(",
"digit",
")",
";",
"stringBuilder",
".",
"append",
"(",
"Integer",
".",
"toString",
"(",
"va... | Create String representation of integer. Preceding 0 will be add as
needed.
@param value is the value.
@param digit is the digit should be shown.
@return the String representation of int value. | [
"Create",
"String",
"representation",
"of",
"integer",
".",
"Preceding",
"0",
"will",
"be",
"add",
"as",
"needed",
"."
] | acc15e73e7431deabc803731971b15323315baaf | https://github.com/opentelecoms-org/jsmpp/blob/acc15e73e7431deabc803731971b15323315baaf/jsmpp/src/main/java/org/jsmpp/bean/DeliveryReceipt.java#L305-L312 | train |
opentelecoms-org/jsmpp | jsmpp/src/main/java/org/jsmpp/bean/DeliveryReceipt.java | DeliveryReceipt.getDeliveryReceiptValue | private static String getDeliveryReceiptValue(String attrName, String source)
throws IndexOutOfBoundsException {
String tmpAttr = attrName + ":";
int startIndex = source.indexOf(tmpAttr);
if (startIndex < 0) {
return null;
}
startIndex = startIndex + tmpAt... | java | private static String getDeliveryReceiptValue(String attrName, String source)
throws IndexOutOfBoundsException {
String tmpAttr = attrName + ":";
int startIndex = source.indexOf(tmpAttr);
if (startIndex < 0) {
return null;
}
startIndex = startIndex + tmpAt... | [
"private",
"static",
"String",
"getDeliveryReceiptValue",
"(",
"String",
"attrName",
",",
"String",
"source",
")",
"throws",
"IndexOutOfBoundsException",
"{",
"String",
"tmpAttr",
"=",
"attrName",
"+",
"\":\"",
";",
"int",
"startIndex",
"=",
"source",
".",
"indexO... | Get the delivery receipt attribute value.
@param attrName is the attribute name.
@param source the original source id:IIIIIIIIII sub:SSS dlvrd:DDD submit
date:YYMMDDhhmm done date:YYMMDDhhmm stat:DDDDDDD err:E
Text:....................
@return the value of specified attribute.
@throws IndexOutOfBoundsException | [
"Get",
"the",
"delivery",
"receipt",
"attribute",
"value",
"."
] | acc15e73e7431deabc803731971b15323315baaf | https://github.com/opentelecoms-org/jsmpp/blob/acc15e73e7431deabc803731971b15323315baaf/jsmpp/src/main/java/org/jsmpp/bean/DeliveryReceipt.java#L378-L391 | train |
opentelecoms-org/jsmpp | jsmpp-examples/src/main/java/org/jsmpp/examples/gateway/AutoReconnectGateway.java | AutoReconnectGateway.getSession | private SMPPSession getSession() throws IOException {
if (session == null) {
LOGGER.info("Initiate session for the first time to {}:{}", remoteIpAddress, remotePort);
session = newSession();
}
else if (!session.getSessionState().isBound()) {
throw new IOException("We have no valid session ... | java | private SMPPSession getSession() throws IOException {
if (session == null) {
LOGGER.info("Initiate session for the first time to {}:{}", remoteIpAddress, remotePort);
session = newSession();
}
else if (!session.getSessionState().isBound()) {
throw new IOException("We have no valid session ... | [
"private",
"SMPPSession",
"getSession",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"session",
"==",
"null",
")",
"{",
"LOGGER",
".",
"info",
"(",
"\"Initiate session for the first time to {}:{}\"",
",",
"remoteIpAddress",
",",
"remotePort",
")",
";",
"sess... | Get the session. If the session still null or not in bound state, then IO exception will be thrown.
@return the valid session.
@throws IOException if there is no valid session or session creation is invalid. | [
"Get",
"the",
"session",
".",
"If",
"the",
"session",
"still",
"null",
"or",
"not",
"in",
"bound",
"state",
"then",
"IO",
"exception",
"will",
"be",
"thrown",
"."
] | acc15e73e7431deabc803731971b15323315baaf | https://github.com/opentelecoms-org/jsmpp/blob/acc15e73e7431deabc803731971b15323315baaf/jsmpp-examples/src/main/java/org/jsmpp/examples/gateway/AutoReconnectGateway.java#L122-L131 | train |
opentelecoms-org/jsmpp | jsmpp-examples/src/main/java/org/jsmpp/examples/gateway/AutoReconnectGateway.java | AutoReconnectGateway.reconnectAfter | private void reconnectAfter(final long timeInMillis) {
new Thread() {
@Override
public void run() {
LOGGER.info("Schedule reconnect after {} millis", timeInMillis);
try {
Thread.sleep(timeInMillis);
}
catch (InterruptedException e) {
}
int attem... | java | private void reconnectAfter(final long timeInMillis) {
new Thread() {
@Override
public void run() {
LOGGER.info("Schedule reconnect after {} millis", timeInMillis);
try {
Thread.sleep(timeInMillis);
}
catch (InterruptedException e) {
}
int attem... | [
"private",
"void",
"reconnectAfter",
"(",
"final",
"long",
"timeInMillis",
")",
"{",
"new",
"Thread",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"run",
"(",
")",
"{",
"LOGGER",
".",
"info",
"(",
"\"Schedule reconnect after {} millis\"",
",",
"timeInMill... | Reconnect session after specified interval.
@param timeInMillis is the interval. | [
"Reconnect",
"session",
"after",
"specified",
"interval",
"."
] | acc15e73e7431deabc803731971b15323315baaf | https://github.com/opentelecoms-org/jsmpp/blob/acc15e73e7431deabc803731971b15323315baaf/jsmpp-examples/src/main/java/org/jsmpp/examples/gateway/AutoReconnectGateway.java#L138-L167 | train |
opentelecoms-org/jsmpp | jsmpp/src/main/java/org/jsmpp/session/BindRequest.java | BindRequest.accept | public void accept(String systemId, InterfaceVersion interfaceVersion) throws PDUStringException, IllegalStateException, IOException {
StringValidator.validateString(systemId, StringParameter.SYSTEM_ID);
lock.lock();
try {
if (!done) {
done = true;
try... | java | public void accept(String systemId, InterfaceVersion interfaceVersion) throws PDUStringException, IllegalStateException, IOException {
StringValidator.validateString(systemId, StringParameter.SYSTEM_ID);
lock.lock();
try {
if (!done) {
done = true;
try... | [
"public",
"void",
"accept",
"(",
"String",
"systemId",
",",
"InterfaceVersion",
"interfaceVersion",
")",
"throws",
"PDUStringException",
",",
"IllegalStateException",
",",
"IOException",
"{",
"StringValidator",
".",
"validateString",
"(",
"systemId",
",",
"StringParamet... | Accept the bind request. The provided interface version will be put into the optional parameter
sc_interface_version in the bind response message.
@param systemId is the system identifier that will be send to ESME.
@param interfaceVersion is the interface version that will be sent to the ESME
@throws PDUStringExceptio... | [
"Accept",
"the",
"bind",
"request",
".",
"The",
"provided",
"interface",
"version",
"will",
"be",
"put",
"into",
"the",
"optional",
"parameter",
"sc_interface_version",
"in",
"the",
"bind",
"response",
"message",
"."
] | acc15e73e7431deabc803731971b15323315baaf | https://github.com/opentelecoms-org/jsmpp/blob/acc15e73e7431deabc803731971b15323315baaf/jsmpp/src/main/java/org/jsmpp/session/BindRequest.java#L138-L156 | train |
opentelecoms-org/jsmpp | jsmpp/src/main/java/org/jsmpp/session/BindRequest.java | BindRequest.reject | public void reject(int errorCode) throws IllegalStateException, IOException {
lock.lock();
try {
if (done) {
throw new IllegalStateException("Response already initiated");
} else {
done = true;
try {
responseHand... | java | public void reject(int errorCode) throws IllegalStateException, IOException {
lock.lock();
try {
if (done) {
throw new IllegalStateException("Response already initiated");
} else {
done = true;
try {
responseHand... | [
"public",
"void",
"reject",
"(",
"int",
"errorCode",
")",
"throws",
"IllegalStateException",
",",
"IOException",
"{",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"if",
"(",
"done",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Response alrea... | Reject the bind request.
@param errorCode is the reason of rejection.
@throws IllegalStateException if the acceptance or rejection has been made.
@throws IOException if the connection already closed.
@see {@link #accept(String systemId, InterfaceVersion interfaceVersion)} | [
"Reject",
"the",
"bind",
"request",
"."
] | acc15e73e7431deabc803731971b15323315baaf | https://github.com/opentelecoms-org/jsmpp/blob/acc15e73e7431deabc803731971b15323315baaf/jsmpp/src/main/java/org/jsmpp/session/BindRequest.java#L166-L182 | train |
opentelecoms-org/jsmpp | jsmpp/src/main/java/org/jsmpp/extra/PendingResponse.java | PendingResponse.done | public void done(T response) throws IllegalArgumentException {
lock.lock();
try {
if (response != null) {
this.response = response;
condition.signal();
} else {
throw new IllegalArgumentException("response cannot be null");
... | java | public void done(T response) throws IllegalArgumentException {
lock.lock();
try {
if (response != null) {
this.response = response;
condition.signal();
} else {
throw new IllegalArgumentException("response cannot be null");
... | [
"public",
"void",
"done",
"(",
"T",
"response",
")",
"throws",
"IllegalArgumentException",
"{",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"if",
"(",
"response",
"!=",
"null",
")",
"{",
"this",
".",
"response",
"=",
"response",
";",
"condition",
"... | Done with valid response and notify that response already received.
@param response is the response.
@throws IllegalArgumentException thrown if response is null. | [
"Done",
"with",
"valid",
"response",
"and",
"notify",
"that",
"response",
"already",
"received",
"."
] | acc15e73e7431deabc803731971b15323315baaf | https://github.com/opentelecoms-org/jsmpp/blob/acc15e73e7431deabc803731971b15323315baaf/jsmpp/src/main/java/org/jsmpp/extra/PendingResponse.java#L52-L64 | train |
opentelecoms-org/jsmpp | jsmpp/src/main/java/org/jsmpp/extra/PendingResponse.java | PendingResponse.waitDone | public void waitDone() throws ResponseTimeoutException,
InvalidResponseException {
lock.lock();
try {
if (!isDoneResponse()) {
try {
condition.await(timeout, TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
... | java | public void waitDone() throws ResponseTimeoutException,
InvalidResponseException {
lock.lock();
try {
if (!isDoneResponse()) {
try {
condition.await(timeout, TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
... | [
"public",
"void",
"waitDone",
"(",
")",
"throws",
"ResponseTimeoutException",
",",
"InvalidResponseException",
"{",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"if",
"(",
"!",
"isDoneResponse",
"(",
")",
")",
"{",
"try",
"{",
"condition",
".",
"await",... | Wait until response received or timeout already reached.
@throws ResponseTimeoutException if timeout reached.
@throws InvalidResponseException if received invalid response. | [
"Wait",
"until",
"response",
"received",
"or",
"timeout",
"already",
"reached",
"."
] | acc15e73e7431deabc803731971b15323315baaf | https://github.com/opentelecoms-org/jsmpp/blob/acc15e73e7431deabc803731971b15323315baaf/jsmpp/src/main/java/org/jsmpp/extra/PendingResponse.java#L101-L125 | train |
opentelecoms-org/jsmpp | jsmpp/src/main/java/org/jsmpp/bean/OptionalParameter.java | OptionalParameter.serialize | public byte[] serialize() {
byte[] value = serializeValue();
ByteBuffer buffer = ByteBuffer.allocate(value.length + 4);
buffer.putShort(tag);
buffer.putShort((short)value.length);
buffer.put(value);
return buffer.array();
} | java | public byte[] serialize() {
byte[] value = serializeValue();
ByteBuffer buffer = ByteBuffer.allocate(value.length + 4);
buffer.putShort(tag);
buffer.putShort((short)value.length);
buffer.put(value);
return buffer.array();
} | [
"public",
"byte",
"[",
"]",
"serialize",
"(",
")",
"{",
"byte",
"[",
"]",
"value",
"=",
"serializeValue",
"(",
")",
";",
"ByteBuffer",
"buffer",
"=",
"ByteBuffer",
".",
"allocate",
"(",
"value",
".",
"length",
"+",
"4",
")",
";",
"buffer",
".",
"putS... | Convert the optional parameter into a byte serialized form conforming to the SMPP specification.
@return A byte array according to the SMPP specification | [
"Convert",
"the",
"optional",
"parameter",
"into",
"a",
"byte",
"serialized",
"form",
"conforming",
"to",
"the",
"SMPP",
"specification",
"."
] | acc15e73e7431deabc803731971b15323315baaf | https://github.com/opentelecoms-org/jsmpp/blob/acc15e73e7431deabc803731971b15323315baaf/jsmpp/src/main/java/org/jsmpp/bean/OptionalParameter.java#L43-L50 | train |
opentelecoms-org/jsmpp | jsmpp/src/main/java/org/jsmpp/session/SMPPOutboundSession.java | SMPPOutboundSession.connectAndOutbind | @Override
public BindRequest connectAndOutbind(String host, int port,
String systemId, String password) throws IOException {
return connectAndOutbind(host, port, new OutbindParameter(systemId, password), 60000);
} | java | @Override
public BindRequest connectAndOutbind(String host, int port,
String systemId, String password) throws IOException {
return connectAndOutbind(host, port, new OutbindParameter(systemId, password), 60000);
} | [
"@",
"Override",
"public",
"BindRequest",
"connectAndOutbind",
"(",
"String",
"host",
",",
"int",
"port",
",",
"String",
"systemId",
",",
"String",
"password",
")",
"throws",
"IOException",
"{",
"return",
"connectAndOutbind",
"(",
"host",
",",
"port",
",",
"ne... | Open connection and outbind immediately. The default timeout is 60 seconds.
@param host is the ESME host address.
@param port is the ESME listen port.
@param systemId is the system id.
@param password is the password.
@throws IOException if there is an IO error found. | [
"Open",
"connection",
"and",
"outbind",
"immediately",
".",
"The",
"default",
"timeout",
"is",
"60",
"seconds",
"."
] | acc15e73e7431deabc803731971b15323315baaf | https://github.com/opentelecoms-org/jsmpp/blob/acc15e73e7431deabc803731971b15323315baaf/jsmpp/src/main/java/org/jsmpp/session/SMPPOutboundSession.java#L142-L146 | train |
opentelecoms-org/jsmpp | jsmpp/src/main/java/org/jsmpp/session/SMPPOutboundSession.java | SMPPOutboundSession.connectAndOutbind | public BindRequest connectAndOutbind(String host, int port, OutbindParameter outbindParameter, long timeout)
throws IOException {
logger.debug("Connect and bind to {} port {}", host, port);
if (getSessionState() != SessionState.CLOSED) {
throw new IOException("Session state is not closed");
}
... | java | public BindRequest connectAndOutbind(String host, int port, OutbindParameter outbindParameter, long timeout)
throws IOException {
logger.debug("Connect and bind to {} port {}", host, port);
if (getSessionState() != SessionState.CLOSED) {
throw new IOException("Session state is not closed");
}
... | [
"public",
"BindRequest",
"connectAndOutbind",
"(",
"String",
"host",
",",
"int",
"port",
",",
"OutbindParameter",
"outbindParameter",
",",
"long",
"timeout",
")",
"throws",
"IOException",
"{",
"logger",
".",
"debug",
"(",
"\"Connect and bind to {} port {}\"",
",",
"... | Open connection and outbind immediately.
@param host is the ESME host address.
@param port is the ESME listen port.
@param outbindParameter is the bind parameters.
@param timeout is the timeout.
@return the SMSC system id.
@throws IOException if there is an IO error found. | [
"Open",
"connection",
"and",
"outbind",
"immediately",
"."
] | acc15e73e7431deabc803731971b15323315baaf | https://github.com/opentelecoms-org/jsmpp/blob/acc15e73e7431deabc803731971b15323315baaf/jsmpp/src/main/java/org/jsmpp/session/SMPPOutboundSession.java#L174-L221 | train |
opentelecoms-org/jsmpp | jsmpp/src/main/java/org/jsmpp/session/SMPPOutboundSession.java | SMPPOutboundSession.waitForBind | private BindRequest waitForBind(long timeout)
throws IllegalStateException, TimeoutException {
SessionState currentSessionState = getSessionState();
if (currentSessionState.equals(SessionState.OPEN)) {
try {
return bindRequestReceiver.waitForRequest(timeout);
}
catch (IllegalStat... | java | private BindRequest waitForBind(long timeout)
throws IllegalStateException, TimeoutException {
SessionState currentSessionState = getSessionState();
if (currentSessionState.equals(SessionState.OPEN)) {
try {
return bindRequestReceiver.waitForRequest(timeout);
}
catch (IllegalStat... | [
"private",
"BindRequest",
"waitForBind",
"(",
"long",
"timeout",
")",
"throws",
"IllegalStateException",
",",
"TimeoutException",
"{",
"SessionState",
"currentSessionState",
"=",
"getSessionState",
"(",
")",
";",
"if",
"(",
"currentSessionState",
".",
"equals",
"(",
... | Wait for bind request.
@param timeout is the timeout.
@return the {@link BindRequest}.
@throws IllegalStateException if this invocation of this method has been made or invoke when state is not OPEN.
@throws TimeoutException if the timeout has been reach and {@link SMPPServerSession} are no more valid because
the ... | [
"Wait",
"for",
"bind",
"request",
"."
] | acc15e73e7431deabc803731971b15323315baaf | https://github.com/opentelecoms-org/jsmpp/blob/acc15e73e7431deabc803731971b15323315baaf/jsmpp/src/main/java/org/jsmpp/session/SMPPOutboundSession.java#L232-L253 | train |
opentelecoms-org/jsmpp | jsmpp/src/main/java/org/jsmpp/util/OctetUtil.java | OctetUtil.bytesToInt | public static int bytesToInt(byte[] bytes, int offset) {
//
int result = 0x00000000;
int length;
if (bytes.length - offset < 4) // maximum byte size for int data type
// is 4
length = bytes.length - offset;
else
le... | java | public static int bytesToInt(byte[] bytes, int offset) {
//
int result = 0x00000000;
int length;
if (bytes.length - offset < 4) // maximum byte size for int data type
// is 4
length = bytes.length - offset;
else
le... | [
"public",
"static",
"int",
"bytesToInt",
"(",
"byte",
"[",
"]",
"bytes",
",",
"int",
"offset",
")",
"{",
"// ",
"int",
"result",
"=",
"0x00000000",
";",
"int",
"length",
";",
"if",
"(",
"bytes",
".",
"length",
"-",
"offset",
"<",
"4",
")",
"// maximu... | 32 bit.
@param bytes
@param offset
@return | [
"32",
"bit",
"."
] | acc15e73e7431deabc803731971b15323315baaf | https://github.com/opentelecoms-org/jsmpp/blob/acc15e73e7431deabc803731971b15323315baaf/jsmpp/src/main/java/org/jsmpp/util/OctetUtil.java#L76-L92 | train |
opentelecoms-org/jsmpp | jsmpp/src/main/java/org/jsmpp/util/OctetUtil.java | OctetUtil.bytesToShort | public static short bytesToShort(byte[] bytes, int offset) {
short result = 0x0000;
int end = offset + 2;
for (int i = 0; i < 2; i++) {
result |= (bytes[end - i - 1] & 0xff) << (8 * i);
}
return result;
} | java | public static short bytesToShort(byte[] bytes, int offset) {
short result = 0x0000;
int end = offset + 2;
for (int i = 0; i < 2; i++) {
result |= (bytes[end - i - 1] & 0xff) << (8 * i);
}
return result;
} | [
"public",
"static",
"short",
"bytesToShort",
"(",
"byte",
"[",
"]",
"bytes",
",",
"int",
"offset",
")",
"{",
"short",
"result",
"=",
"0x0000",
";",
"int",
"end",
"=",
"offset",
"+",
"2",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"2",
... | 16 bit.
@param bytes
@param offset
@return | [
"16",
"bit",
"."
] | acc15e73e7431deabc803731971b15323315baaf | https://github.com/opentelecoms-org/jsmpp/blob/acc15e73e7431deabc803731971b15323315baaf/jsmpp/src/main/java/org/jsmpp/util/OctetUtil.java#L111-L118 | train |
opentelecoms-org/jsmpp | jsmpp/src/main/java/org/jsmpp/session/OutbindRequestReceiver.java | OutbindRequestReceiver.waitForRequest | OutbindRequest waitForRequest(long timeout) throws IllegalStateException, TimeoutException {
this.lock.lock();
try {
if (this.alreadyWaitForRequest) {
throw new IllegalStateException("waitForRequest(long) method already invoked");
}
else if (this.request == null) {
try {
... | java | OutbindRequest waitForRequest(long timeout) throws IllegalStateException, TimeoutException {
this.lock.lock();
try {
if (this.alreadyWaitForRequest) {
throw new IllegalStateException("waitForRequest(long) method already invoked");
}
else if (this.request == null) {
try {
... | [
"OutbindRequest",
"waitForRequest",
"(",
"long",
"timeout",
")",
"throws",
"IllegalStateException",
",",
"TimeoutException",
"{",
"this",
".",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"if",
"(",
"this",
".",
"alreadyWaitForRequest",
")",
"{",
"throw",
... | Wait until the outbind request received for specified timeout.
@param timeout is the timeout.
@return the {@link OutbindRequest}.
@throws IllegalStateException if this method already called before.
@throws TimeoutException if the timeout has been reach. | [
"Wait",
"until",
"the",
"outbind",
"request",
"received",
"for",
"specified",
"timeout",
"."
] | acc15e73e7431deabc803731971b15323315baaf | https://github.com/opentelecoms-org/jsmpp/blob/acc15e73e7431deabc803731971b15323315baaf/jsmpp/src/main/java/org/jsmpp/session/OutbindRequestReceiver.java#L43-L70 | train |
opentelecoms-org/jsmpp | jsmpp/src/main/java/org/jsmpp/session/OutbindRequestReceiver.java | OutbindRequestReceiver.notifyAcceptOutbind | void notifyAcceptOutbind(Outbind outbind) throws IllegalStateException {
this.lock.lock();
try {
if (this.request == null) {
this.request = new OutbindRequest(outbind);
this.requestCondition.signal();
}
else {
throw new IllegalStateException("Already waiting for accepta... | java | void notifyAcceptOutbind(Outbind outbind) throws IllegalStateException {
this.lock.lock();
try {
if (this.request == null) {
this.request = new OutbindRequest(outbind);
this.requestCondition.signal();
}
else {
throw new IllegalStateException("Already waiting for accepta... | [
"void",
"notifyAcceptOutbind",
"(",
"Outbind",
"outbind",
")",
"throws",
"IllegalStateException",
"{",
"this",
".",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"if",
"(",
"this",
".",
"request",
"==",
"null",
")",
"{",
"this",
".",
"request",
"=",
... | Notify that the outbind was accepted.
@param outbind is the {@link Outbind} command.
@throws IllegalStateException if this method already called before. | [
"Notify",
"that",
"the",
"outbind",
"was",
"accepted",
"."
] | acc15e73e7431deabc803731971b15323315baaf | https://github.com/opentelecoms-org/jsmpp/blob/acc15e73e7431deabc803731971b15323315baaf/jsmpp/src/main/java/org/jsmpp/session/OutbindRequestReceiver.java#L78-L92 | train |
opentelecoms-org/jsmpp | jsmpp/src/main/java/org/jsmpp/session/AbstractSession.java | AbstractSession.setPduProcessorDegree | public void setPduProcessorDegree(int pduProcessorDegree) throws IllegalStateException {
if (!getSessionState().equals(SessionState.CLOSED)) {
throw new IllegalStateException(
"Cannot set PDU processor degree since the PDU dispatcher thread already created");
}
th... | java | public void setPduProcessorDegree(int pduProcessorDegree) throws IllegalStateException {
if (!getSessionState().equals(SessionState.CLOSED)) {
throw new IllegalStateException(
"Cannot set PDU processor degree since the PDU dispatcher thread already created");
}
th... | [
"public",
"void",
"setPduProcessorDegree",
"(",
"int",
"pduProcessorDegree",
")",
"throws",
"IllegalStateException",
"{",
"if",
"(",
"!",
"getSessionState",
"(",
")",
".",
"equals",
"(",
"SessionState",
".",
"CLOSED",
")",
")",
"{",
"throw",
"new",
"IllegalState... | Set total thread can read PDU and process it in parallel. It's defaulted to
3.
@param pduProcessorDegree is the total thread can handle read and process
PDU in parallel.
@throws IllegalStateException if the PDU Reader has been started. | [
"Set",
"total",
"thread",
"can",
"read",
"PDU",
"and",
"process",
"it",
"in",
"parallel",
".",
"It",
"s",
"defaulted",
"to",
"3",
"."
] | acc15e73e7431deabc803731971b15323315baaf | https://github.com/opentelecoms-org/jsmpp/blob/acc15e73e7431deabc803731971b15323315baaf/jsmpp/src/main/java/org/jsmpp/session/AbstractSession.java#L144-L150 | train |
opentelecoms-org/jsmpp | jsmpp/src/main/java/org/jsmpp/session/AbstractSession.java | AbstractSession.ensureReceivable | protected void ensureReceivable(String activityName) throws IOException {
// TODO uudashr: do we have to use another exception for this checking?
SessionState currentState = getSessionState();
if (!currentState.isReceivable()) {
throw new IOException("Cannot " + activityName + " whil... | java | protected void ensureReceivable(String activityName) throws IOException {
// TODO uudashr: do we have to use another exception for this checking?
SessionState currentState = getSessionState();
if (!currentState.isReceivable()) {
throw new IOException("Cannot " + activityName + " whil... | [
"protected",
"void",
"ensureReceivable",
"(",
"String",
"activityName",
")",
"throws",
"IOException",
"{",
"// TODO uudashr: do we have to use another exception for this checking?",
"SessionState",
"currentState",
"=",
"getSessionState",
"(",
")",
";",
"if",
"(",
"!",
"curr... | Ensure the session is receivable. If the session not receivable then an
exception thrown.
@param activityName is the activity name.
@throws IOException if the session not receivable. | [
"Ensure",
"the",
"session",
"is",
"receivable",
".",
"If",
"the",
"session",
"not",
"receivable",
"then",
"an",
"exception",
"thrown",
"."
] | acc15e73e7431deabc803731971b15323315baaf | https://github.com/opentelecoms-org/jsmpp/blob/acc15e73e7431deabc803731971b15323315baaf/jsmpp/src/main/java/org/jsmpp/session/AbstractSession.java#L410-L416 | train |
opentelecoms-org/jsmpp | jsmpp/src/main/java/org/jsmpp/session/AbstractSession.java | AbstractSession.ensureTransmittable | protected void ensureTransmittable(String activityName, boolean only) throws IOException {
// TODO uudashr: do we have to use another exception for this checking?
SessionState currentState = getSessionState();
if (!currentState.isTransmittable() || (only && currentState.isReceivable())) {
... | java | protected void ensureTransmittable(String activityName, boolean only) throws IOException {
// TODO uudashr: do we have to use another exception for this checking?
SessionState currentState = getSessionState();
if (!currentState.isTransmittable() || (only && currentState.isReceivable())) {
... | [
"protected",
"void",
"ensureTransmittable",
"(",
"String",
"activityName",
",",
"boolean",
"only",
")",
"throws",
"IOException",
"{",
"// TODO uudashr: do we have to use another exception for this checking?",
"SessionState",
"currentState",
"=",
"getSessionState",
"(",
")",
"... | Ensure the session is transmittable. If the session not transmittable
then an exception thrown.
@param activityName is the activity name.
@param only set to <tt>true</tt> if you want to ensure transmittable only
(transceive will not pass), otherwise set to <tt>false</tt>.
@throws IOException if the session not transmi... | [
"Ensure",
"the",
"session",
"is",
"transmittable",
".",
"If",
"the",
"session",
"not",
"transmittable",
"then",
"an",
"exception",
"thrown",
"."
] | acc15e73e7431deabc803731971b15323315baaf | https://github.com/opentelecoms-org/jsmpp/blob/acc15e73e7431deabc803731971b15323315baaf/jsmpp/src/main/java/org/jsmpp/session/AbstractSession.java#L439-L445 | train |
opentelecoms-org/jsmpp | jsmpp/src/main/java/org/jsmpp/session/BindRequestReceiver.java | BindRequestReceiver.notifyAcceptBind | void notifyAcceptBind(Bind bindParameter) throws IllegalStateException {
lock.lock();
try {
if (request == null) {
request = new BindRequest(bindParameter, responseHandler);
requestCondition.signal();
} else {
throw new IllegalState... | java | void notifyAcceptBind(Bind bindParameter) throws IllegalStateException {
lock.lock();
try {
if (request == null) {
request = new BindRequest(bindParameter, responseHandler);
requestCondition.signal();
} else {
throw new IllegalState... | [
"void",
"notifyAcceptBind",
"(",
"Bind",
"bindParameter",
")",
"throws",
"IllegalStateException",
"{",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"if",
"(",
"request",
"==",
"null",
")",
"{",
"request",
"=",
"new",
"BindRequest",
"(",
"bindParameter",
... | Notify that the bind has accepted.
@param bindParameter is the {@link Bind} command.
@throws IllegalStateException if this method is already called before. | [
"Notify",
"that",
"the",
"bind",
"has",
"accepted",
"."
] | acc15e73e7431deabc803731971b15323315baaf | https://github.com/opentelecoms-org/jsmpp/blob/acc15e73e7431deabc803731971b15323315baaf/jsmpp/src/main/java/org/jsmpp/session/BindRequestReceiver.java#L79-L91 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.