id int32 0 165k | repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 |
|---|---|---|---|---|---|---|---|---|---|---|---|
120,900 | structr/structr | structr-core/src/main/java/org/structr/core/entity/LinkedTreeNodeImpl.java | LinkedTreeNodeImpl.ensureCorrectChildPositions | private void ensureCorrectChildPositions() throws FrameworkException {
final List<Relation<T, T, OneStartpoint<T>, ManyEndpoint<T>>> childRels = treeGetChildRelationships();
int position = 0;
for (Relation<T, T, OneStartpoint<T>, ManyEndpoint<T>> childRel : childRels) {
childRel.setProperty(getPositionProper... | java | private void ensureCorrectChildPositions() throws FrameworkException {
final List<Relation<T, T, OneStartpoint<T>, ManyEndpoint<T>>> childRels = treeGetChildRelationships();
int position = 0;
for (Relation<T, T, OneStartpoint<T>, ManyEndpoint<T>> childRel : childRels) {
childRel.setProperty(getPositionProper... | [
"private",
"void",
"ensureCorrectChildPositions",
"(",
")",
"throws",
"FrameworkException",
"{",
"final",
"List",
"<",
"Relation",
"<",
"T",
",",
"T",
",",
"OneStartpoint",
"<",
"T",
">",
",",
"ManyEndpoint",
"<",
"T",
">",
">",
">",
"childRels",
"=",
"tre... | Ensures that the position attributes of the AbstractChildren of this
node are correct. Please note that this method needs to run in the
same transaction as any modifiying operation that changes the order
of child nodes, and therefore this method does _not_ create its own
transaction. However, it will not raise a NotInT... | [
"Ensures",
"that",
"the",
"position",
"attributes",
"of",
"the",
"AbstractChildren",
"of",
"this",
"node",
"are",
"correct",
".",
"Please",
"note",
"that",
"this",
"method",
"needs",
"to",
"run",
"in",
"the",
"same",
"transaction",
"as",
"any",
"modifiying",
... | c111a1d0c0201c7fea5574ed69aa5a5053185a97 | https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-core/src/main/java/org/structr/core/entity/LinkedTreeNodeImpl.java#L300-L308 |
120,901 | structr/structr | structr-core/src/main/java/org/structr/core/entity/LinkedTreeNodeImpl.java | LinkedTreeNodeImpl.getAllChildNodes | @Override
public Set<T> getAllChildNodes() {
Set<T> allChildNodes = new HashSet();
List<T> childNodes = treeGetChildren();
for (final T child : childNodes) {
allChildNodes.add(child);
if (child instanceof LinkedTreeNode) {
final LinkedTreeNode treeNode = (LinkedTreeNode)child;
allChildNodes.a... | java | @Override
public Set<T> getAllChildNodes() {
Set<T> allChildNodes = new HashSet();
List<T> childNodes = treeGetChildren();
for (final T child : childNodes) {
allChildNodes.add(child);
if (child instanceof LinkedTreeNode) {
final LinkedTreeNode treeNode = (LinkedTreeNode)child;
allChildNodes.a... | [
"@",
"Override",
"public",
"Set",
"<",
"T",
">",
"getAllChildNodes",
"(",
")",
"{",
"Set",
"<",
"T",
">",
"allChildNodes",
"=",
"new",
"HashSet",
"(",
")",
";",
"List",
"<",
"T",
">",
"childNodes",
"=",
"treeGetChildren",
"(",
")",
";",
"for",
"(",
... | Return a set containing all child nodes of this node.
This node is not included.
There are no duplicates.
@return child nodes | [
"Return",
"a",
"set",
"containing",
"all",
"child",
"nodes",
"of",
"this",
"node",
"."
] | c111a1d0c0201c7fea5574ed69aa5a5053185a97 | https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-core/src/main/java/org/structr/core/entity/LinkedTreeNodeImpl.java#L330-L349 |
120,902 | structr/structr | structr-core/src/main/java/org/structr/core/entity/AbstractEndpoint.java | AbstractEndpoint.getNotionProperties | protected PropertyMap getNotionProperties(final SecurityContext securityContext, final Class type, final String storageKey) {
final Map<String, PropertyMap> notionPropertyMap = (Map<String, PropertyMap>)securityContext.getAttribute("notionProperties");
if (notionPropertyMap != null) {
final Set<PropertyKey> ke... | java | protected PropertyMap getNotionProperties(final SecurityContext securityContext, final Class type, final String storageKey) {
final Map<String, PropertyMap> notionPropertyMap = (Map<String, PropertyMap>)securityContext.getAttribute("notionProperties");
if (notionPropertyMap != null) {
final Set<PropertyKey> ke... | [
"protected",
"PropertyMap",
"getNotionProperties",
"(",
"final",
"SecurityContext",
"securityContext",
",",
"final",
"Class",
"type",
",",
"final",
"String",
"storageKey",
")",
"{",
"final",
"Map",
"<",
"String",
",",
"PropertyMap",
">",
"notionPropertyMap",
"=",
... | Loads a PropertyMap from the current security context that was previously stored
there by one of the Notions that was executed before this relationship creation.
@param securityContext the security context
@param type the entity type
@param storageKey the key for which the PropertyMap was stored
@return a PropertyMap... | [
"Loads",
"a",
"PropertyMap",
"from",
"the",
"current",
"security",
"context",
"that",
"was",
"previously",
"stored",
"there",
"by",
"one",
"of",
"the",
"Notions",
"that",
"was",
"executed",
"before",
"this",
"relationship",
"creation",
"."
] | c111a1d0c0201c7fea5574ed69aa5a5053185a97 | https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-core/src/main/java/org/structr/core/entity/AbstractEndpoint.java#L73-L97 |
120,903 | structr/structr | structr-core/src/main/java/org/structr/core/graph/NodeFactory.java | NodeFactory.getNodesAt | protected List<NodeInterface> getNodesAt(final NodeInterface locationNode) {
final List<NodeInterface> nodes = new LinkedList<>();
for(RelationshipInterface rel : locationNode.getIncomingRelationships(NodeHasLocation.class)) {
NodeInterface startNode = rel.getSourceNode();
nodes.add(startNode);
// add... | java | protected List<NodeInterface> getNodesAt(final NodeInterface locationNode) {
final List<NodeInterface> nodes = new LinkedList<>();
for(RelationshipInterface rel : locationNode.getIncomingRelationships(NodeHasLocation.class)) {
NodeInterface startNode = rel.getSourceNode();
nodes.add(startNode);
// add... | [
"protected",
"List",
"<",
"NodeInterface",
">",
"getNodesAt",
"(",
"final",
"NodeInterface",
"locationNode",
")",
"{",
"final",
"List",
"<",
"NodeInterface",
">",
"nodes",
"=",
"new",
"LinkedList",
"<>",
"(",
")",
";",
"for",
"(",
"RelationshipInterface",
"rel... | Return all nodes which are connected by an incoming IS_AT relationships
@param locationNode
@return connected nodes | [
"Return",
"all",
"nodes",
"which",
"are",
"connected",
"by",
"an",
"incoming",
"IS_AT",
"relationships"
] | c111a1d0c0201c7fea5574ed69aa5a5053185a97 | https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-core/src/main/java/org/structr/core/graph/NodeFactory.java#L127-L143 |
120,904 | structr/structr | structr-ui/src/main/java/org/structr/web/importer/Importer.java | Importer.fileExists | private File fileExists(final String path, final long checksum) throws FrameworkException {
final PropertyKey<Long> checksumKey = StructrApp.key(File.class, "checksum");
final PropertyKey<String> pathKey = StructrApp.key(File.class, "path");
return app.nodeQuery(File.class).and(pathKey, path).and(checksumKey,... | java | private File fileExists(final String path, final long checksum) throws FrameworkException {
final PropertyKey<Long> checksumKey = StructrApp.key(File.class, "checksum");
final PropertyKey<String> pathKey = StructrApp.key(File.class, "path");
return app.nodeQuery(File.class).and(pathKey, path).and(checksumKey,... | [
"private",
"File",
"fileExists",
"(",
"final",
"String",
"path",
",",
"final",
"long",
"checksum",
")",
"throws",
"FrameworkException",
"{",
"final",
"PropertyKey",
"<",
"Long",
">",
"checksumKey",
"=",
"StructrApp",
".",
"key",
"(",
"File",
".",
"class",
",... | Check whether a file with given path and checksum already exists | [
"Check",
"whether",
"a",
"file",
"with",
"given",
"path",
"and",
"checksum",
"already",
"exists"
] | c111a1d0c0201c7fea5574ed69aa5a5053185a97 | https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-ui/src/main/java/org/structr/web/importer/Importer.java#L1071-L1077 |
120,905 | structr/structr | structr-core/src/main/java/org/structr/common/PagingHelper.java | PagingHelper.subList | public static <T> List<T> subList(final List<T> list, int pageSize, int page) {
if (pageSize <= 0 || page == 0) {
return Collections.EMPTY_LIST;
}
int size = list.size();
int fromIndex = page > 0
? (page - 1) * pageSize
: size + (page * pageSize);
int toIndex = fromIndex + pageS... | java | public static <T> List<T> subList(final List<T> list, int pageSize, int page) {
if (pageSize <= 0 || page == 0) {
return Collections.EMPTY_LIST;
}
int size = list.size();
int fromIndex = page > 0
? (page - 1) * pageSize
: size + (page * pageSize);
int toIndex = fromIndex + pageS... | [
"public",
"static",
"<",
"T",
">",
"List",
"<",
"T",
">",
"subList",
"(",
"final",
"List",
"<",
"T",
">",
"list",
",",
"int",
"pageSize",
",",
"int",
"page",
")",
"{",
"if",
"(",
"pageSize",
"<=",
"0",
"||",
"page",
"==",
"0",
")",
"{",
"return... | Return a single page of the list with the given paging parameters.
@param list
@param pageSize
@param page
@return subList | [
"Return",
"a",
"single",
"page",
"of",
"the",
"list",
"with",
"the",
"given",
"paging",
"parameters",
"."
] | c111a1d0c0201c7fea5574ed69aa5a5053185a97 | https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-core/src/main/java/org/structr/common/PagingHelper.java#L41-L78 |
120,906 | structr/structr | structr-core/src/main/java/org/structr/common/PathHelper.java | PathHelper.getRelativeNodePath | public static String getRelativeNodePath(String basePath, String targetPath) {
// Both paths are equal
if (basePath.equals(targetPath)) {
return ".";
}
if (basePath.equals(PATH_SEP) && (targetPath.length() > 1)) {
// Base path is root path
return targetPath.substring(1);
}
String[] baseAncest... | java | public static String getRelativeNodePath(String basePath, String targetPath) {
// Both paths are equal
if (basePath.equals(targetPath)) {
return ".";
}
if (basePath.equals(PATH_SEP) && (targetPath.length() > 1)) {
// Base path is root path
return targetPath.substring(1);
}
String[] baseAncest... | [
"public",
"static",
"String",
"getRelativeNodePath",
"(",
"String",
"basePath",
",",
"String",
"targetPath",
")",
"{",
"// Both paths are equal",
"if",
"(",
"basePath",
".",
"equals",
"(",
"targetPath",
")",
")",
"{",
"return",
"\".\"",
";",
"}",
"if",
"(",
... | Assemble a relative path for the given absolute paths
@param basePath
@param targetPath
@return relative node path | [
"Assemble",
"a",
"relative",
"path",
"for",
"the",
"given",
"absolute",
"paths"
] | c111a1d0c0201c7fea5574ed69aa5a5053185a97 | https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-core/src/main/java/org/structr/common/PathHelper.java#L72-L147 |
120,907 | structr/structr | structr-core/src/main/java/org/structr/common/PathHelper.java | PathHelper.getName | public static String getName(final String path) {
String cleanedPath = clean(path);
if (cleanedPath != null && cleanedPath.contains(PATH_SEP)) {
return StringUtils.substringAfterLast(cleanedPath, PATH_SEP);
} else {
return cleanedPath;
}
} | java | public static String getName(final String path) {
String cleanedPath = clean(path);
if (cleanedPath != null && cleanedPath.contains(PATH_SEP)) {
return StringUtils.substringAfterLast(cleanedPath, PATH_SEP);
} else {
return cleanedPath;
}
} | [
"public",
"static",
"String",
"getName",
"(",
"final",
"String",
"path",
")",
"{",
"String",
"cleanedPath",
"=",
"clean",
"(",
"path",
")",
";",
"if",
"(",
"cleanedPath",
"!=",
"null",
"&&",
"cleanedPath",
".",
"contains",
"(",
"PATH_SEP",
")",
")",
"{",... | Return last part of the given path after separator or the path if no path separator was found.
@param path
@return name | [
"Return",
"last",
"part",
"of",
"the",
"given",
"path",
"after",
"separator",
"or",
"the",
"path",
"if",
"no",
"path",
"separator",
"was",
"found",
"."
] | c111a1d0c0201c7fea5574ed69aa5a5053185a97 | https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-core/src/main/java/org/structr/common/PathHelper.java#L155-L168 |
120,908 | structr/structr | structr-core/src/main/java/org/structr/common/PathHelper.java | PathHelper.getParts | public static String[] getParts(final String path) {
String cleanedPath = clean(path);
return StringUtils.splitByWholeSeparator(cleanedPath, PATH_SEP);
} | java | public static String[] getParts(final String path) {
String cleanedPath = clean(path);
return StringUtils.splitByWholeSeparator(cleanedPath, PATH_SEP);
} | [
"public",
"static",
"String",
"[",
"]",
"getParts",
"(",
"final",
"String",
"path",
")",
"{",
"String",
"cleanedPath",
"=",
"clean",
"(",
"path",
")",
";",
"return",
"StringUtils",
".",
"splitByWholeSeparator",
"(",
"cleanedPath",
",",
"PATH_SEP",
")",
";",
... | Return array of path parts.
@param path
@return path parts | [
"Return",
"array",
"of",
"path",
"parts",
"."
] | c111a1d0c0201c7fea5574ed69aa5a5053185a97 | https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-core/src/main/java/org/structr/common/PathHelper.java#L197-L202 |
120,909 | structr/structr | structr-ui/src/main/java/org/structr/websocket/command/FileUploadHandler.java | FileUploadHandler.finish | public void finish() {
try {
FileChannel channel = getChannel(false);
if (channel != null && channel.isOpen()) {
channel.force(true);
channel.close();
this.privateFileChannel = null;
//file.increaseVersion();
file.notifyUploadCompletion();
}
} catch (IOException e) {
logger.w... | java | public void finish() {
try {
FileChannel channel = getChannel(false);
if (channel != null && channel.isOpen()) {
channel.force(true);
channel.close();
this.privateFileChannel = null;
//file.increaseVersion();
file.notifyUploadCompletion();
}
} catch (IOException e) {
logger.w... | [
"public",
"void",
"finish",
"(",
")",
"{",
"try",
"{",
"FileChannel",
"channel",
"=",
"getChannel",
"(",
"false",
")",
";",
"if",
"(",
"channel",
"!=",
"null",
"&&",
"channel",
".",
"isOpen",
"(",
")",
")",
"{",
"channel",
".",
"force",
"(",
"true",
... | Called when the WebSocket connection is closed | [
"Called",
"when",
"the",
"WebSocket",
"connection",
"is",
"closed"
] | c111a1d0c0201c7fea5574ed69aa5a5053185a97 | https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-ui/src/main/java/org/structr/websocket/command/FileUploadHandler.java#L107-L128 |
120,910 | structr/structr | structr-core/src/main/java/javatools/datatypes/FinalSet.java | FinalSet.indexOf | public int indexOf(T x) {
int r=Arrays.binarySearch(data,x);
return(r>=0?r:-1);
} | java | public int indexOf(T x) {
int r=Arrays.binarySearch(data,x);
return(r>=0?r:-1);
} | [
"public",
"int",
"indexOf",
"(",
"T",
"x",
")",
"{",
"int",
"r",
"=",
"Arrays",
".",
"binarySearch",
"(",
"data",
",",
"x",
")",
";",
"return",
"(",
"r",
">=",
"0",
"?",
"r",
":",
"-",
"1",
")",
";",
"}"
] | Returns the position in the array or -1 | [
"Returns",
"the",
"position",
"in",
"the",
"array",
"or",
"-",
"1"
] | c111a1d0c0201c7fea5574ed69aa5a5053185a97 | https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-core/src/main/java/javatools/datatypes/FinalSet.java#L73-L76 |
120,911 | structr/structr | structr-ui/src/main/java/org/structr/web/maintenance/DeployCommand.java | DeployCommand.endsWithUuid | public static boolean endsWithUuid(final String name) {
if (name.length() > 32) {
return pattern.matcher(name.substring(name.length() - 32)).matches();
} else {
return false;
}
} | java | public static boolean endsWithUuid(final String name) {
if (name.length() > 32) {
return pattern.matcher(name.substring(name.length() - 32)).matches();
} else {
return false;
}
} | [
"public",
"static",
"boolean",
"endsWithUuid",
"(",
"final",
"String",
"name",
")",
"{",
"if",
"(",
"name",
".",
"length",
"(",
")",
">",
"32",
")",
"{",
"return",
"pattern",
".",
"matcher",
"(",
"name",
".",
"substring",
"(",
"name",
".",
"length",
... | Checks if the given string ends with a uuid | [
"Checks",
"if",
"the",
"given",
"string",
"ends",
"with",
"a",
"uuid"
] | c111a1d0c0201c7fea5574ed69aa5a5053185a97 | https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-ui/src/main/java/org/structr/web/maintenance/DeployCommand.java#L199-L208 |
120,912 | structr/structr | structr-core/src/main/java/org/structr/core/property/PropertyMap.java | PropertyMap.contentHashCode | public int contentHashCode(Set<PropertyKey> comparableKeys, boolean includeSystemProperties) {
Map<PropertyKey, Object> sortedMap = new TreeMap<>(new PropertyKeyComparator());
int hashCode = 42;
sortedMap.putAll(properties);
if (comparableKeys == null) {
// calculate hash code for a... | java | public int contentHashCode(Set<PropertyKey> comparableKeys, boolean includeSystemProperties) {
Map<PropertyKey, Object> sortedMap = new TreeMap<>(new PropertyKeyComparator());
int hashCode = 42;
sortedMap.putAll(properties);
if (comparableKeys == null) {
// calculate hash code for a... | [
"public",
"int",
"contentHashCode",
"(",
"Set",
"<",
"PropertyKey",
">",
"comparableKeys",
",",
"boolean",
"includeSystemProperties",
")",
"{",
"Map",
"<",
"PropertyKey",
",",
"Object",
">",
"sortedMap",
"=",
"new",
"TreeMap",
"<>",
"(",
"new",
"PropertyKeyCompa... | Calculates a hash code for the contents of this PropertyMap.
@param comparableKeys the set of property keys to use for hash code calculation, or null to use the whole keySet
@param includeSystemProperties whether to include system properties in the calculation
@return hash code | [
"Calculates",
"a",
"hash",
"code",
"for",
"the",
"contents",
"of",
"this",
"PropertyMap",
"."
] | c111a1d0c0201c7fea5574ed69aa5a5053185a97 | https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-core/src/main/java/org/structr/core/property/PropertyMap.java#L150-L186 |
120,913 | structr/structr | structr-core/src/main/java/org/structr/core/graph/NodeRelationshipsCommand.java | NodeRelationshipsCommand.execute | public List<RelationshipInterface> execute(NodeInterface sourceNode, RelationshipType relType, Direction dir) throws FrameworkException {
RelationshipFactory factory = new RelationshipFactory(securityContext);
List<RelationshipInterface> result = new LinkedList<>();
Node node = so... | java | public List<RelationshipInterface> execute(NodeInterface sourceNode, RelationshipType relType, Direction dir) throws FrameworkException {
RelationshipFactory factory = new RelationshipFactory(securityContext);
List<RelationshipInterface> result = new LinkedList<>();
Node node = so... | [
"public",
"List",
"<",
"RelationshipInterface",
">",
"execute",
"(",
"NodeInterface",
"sourceNode",
",",
"RelationshipType",
"relType",
",",
"Direction",
"dir",
")",
"throws",
"FrameworkException",
"{",
"RelationshipFactory",
"factory",
"=",
"new",
"RelationshipFactory"... | Fetch relationships for the given source node.
@param sourceNode
@param relType can be null
@param dir
@return a list of relationships
@throws FrameworkException | [
"Fetch",
"relationships",
"for",
"the",
"given",
"source",
"node",
"."
] | c111a1d0c0201c7fea5574ed69aa5a5053185a97 | https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-core/src/main/java/org/structr/core/graph/NodeRelationshipsCommand.java#L54-L105 |
120,914 | structr/structr | structr-core/src/main/java/org/structr/schema/parser/DatePropertyParser.java | DatePropertyParser.parse | public static Date parse(String source, final String pattern) {
if (StringUtils.isBlank(pattern)) {
return parseISO8601DateString(source);
} else {
try {
// SimpleDateFormat is not fully ISO8601 compatible, so we replace 'Z' by +0000
if (StringUtils.contains(source, "Z")) {
source = StringUt... | java | public static Date parse(String source, final String pattern) {
if (StringUtils.isBlank(pattern)) {
return parseISO8601DateString(source);
} else {
try {
// SimpleDateFormat is not fully ISO8601 compatible, so we replace 'Z' by +0000
if (StringUtils.contains(source, "Z")) {
source = StringUt... | [
"public",
"static",
"Date",
"parse",
"(",
"String",
"source",
",",
"final",
"String",
"pattern",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isBlank",
"(",
"pattern",
")",
")",
"{",
"return",
"parseISO8601DateString",
"(",
"source",
")",
";",
"}",
"else",
... | Static method to catch parse exception
@param source
@param pattern optional SimpleDateFormat pattern
@return | [
"Static",
"method",
"to",
"catch",
"parse",
"exception"
] | c111a1d0c0201c7fea5574ed69aa5a5053185a97 | https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-core/src/main/java/org/structr/schema/parser/DatePropertyParser.java#L91-L115 |
120,915 | structr/structr | structr-core/src/main/java/org/structr/schema/parser/DatePropertyParser.java | DatePropertyParser.parseISO8601DateString | public static Date parseISO8601DateString(String source) {
final String[] supportedFormats = new String[] { "yyyy-MM-dd'T'HH:mm:ss.SSSXXX", "yyyy-MM-dd'T'HH:mm:ssXXX", "yyyy-MM-dd'T'HH:mm:ssZ", "yyyy-MM-dd'T'HH:mm:ss.SSSZ" };
// SimpleDateFormat is not fully ISO8601 compatible, so we replace 'Z' by +0000
if (St... | java | public static Date parseISO8601DateString(String source) {
final String[] supportedFormats = new String[] { "yyyy-MM-dd'T'HH:mm:ss.SSSXXX", "yyyy-MM-dd'T'HH:mm:ssXXX", "yyyy-MM-dd'T'HH:mm:ssZ", "yyyy-MM-dd'T'HH:mm:ss.SSSZ" };
// SimpleDateFormat is not fully ISO8601 compatible, so we replace 'Z' by +0000
if (St... | [
"public",
"static",
"Date",
"parseISO8601DateString",
"(",
"String",
"source",
")",
"{",
"final",
"String",
"[",
"]",
"supportedFormats",
"=",
"new",
"String",
"[",
"]",
"{",
"\"yyyy-MM-dd'T'HH:mm:ss.SSSXXX\"",
",",
"\"yyyy-MM-dd'T'HH:mm:ssXXX\"",
",",
"\"yyyy-MM-dd'T... | Try to parse source string as a ISO8601 date.
@param source
@return null if unable to parse | [
"Try",
"to",
"parse",
"source",
"string",
"as",
"a",
"ISO8601",
"date",
"."
] | c111a1d0c0201c7fea5574ed69aa5a5053185a97 | https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-core/src/main/java/org/structr/schema/parser/DatePropertyParser.java#L123-L151 |
120,916 | structr/structr | structr-core/src/main/java/org/structr/schema/parser/DatePropertyParser.java | DatePropertyParser.format | public static String format(final Date date, String format) {
if (date != null) {
if (StringUtils.isBlank(format)) {
format = DateProperty.getDefaultFormat();
}
return new SimpleDateFormat(format).format(date);
}
return null;
} | java | public static String format(final Date date, String format) {
if (date != null) {
if (StringUtils.isBlank(format)) {
format = DateProperty.getDefaultFormat();
}
return new SimpleDateFormat(format).format(date);
}
return null;
} | [
"public",
"static",
"String",
"format",
"(",
"final",
"Date",
"date",
",",
"String",
"format",
")",
"{",
"if",
"(",
"date",
"!=",
"null",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isBlank",
"(",
"format",
")",
")",
"{",
"format",
"=",
"DateProperty",
... | Central method to format a date into a string.
If no format is given, use the (old) default format.
@param date
@param format optional SimpleDateFormat pattern
@return | [
"Central",
"method",
"to",
"format",
"a",
"date",
"into",
"a",
"string",
"."
] | c111a1d0c0201c7fea5574ed69aa5a5053185a97 | https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-core/src/main/java/org/structr/schema/parser/DatePropertyParser.java#L162-L177 |
120,917 | structr/structr | structr-ui/src/main/java/org/structr/websocket/command/AbstractCommand.java | AbstractCommand.getGraphObject | public GraphObject getGraphObject(final String id, final String nodeId) {
if (isValidUuid(id)) {
final AbstractNode node = getNode(id);
if (node != null) {
return node;
} else {
if (nodeId == null) {
logger.warn("Relationship access by UUID is deprecated and not supported by Neo4j, this can... | java | public GraphObject getGraphObject(final String id, final String nodeId) {
if (isValidUuid(id)) {
final AbstractNode node = getNode(id);
if (node != null) {
return node;
} else {
if (nodeId == null) {
logger.warn("Relationship access by UUID is deprecated and not supported by Neo4j, this can... | [
"public",
"GraphObject",
"getGraphObject",
"(",
"final",
"String",
"id",
",",
"final",
"String",
"nodeId",
")",
"{",
"if",
"(",
"isValidUuid",
"(",
"id",
")",
")",
"{",
"final",
"AbstractNode",
"node",
"=",
"getNode",
"(",
"id",
")",
";",
"if",
"(",
"n... | Returns the graph object with the given id.
If no node with the given id is found and nodeId is not null,
this method will search for a relationship in the list of relationships
of the node with the given nodeId.
@param id
@param nodeId
@return the graph object | [
"Returns",
"the",
"graph",
"object",
"with",
"the",
"given",
"id",
"."
] | c111a1d0c0201c7fea5574ed69aa5a5053185a97 | https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-ui/src/main/java/org/structr/websocket/command/AbstractCommand.java#L125-L153 |
120,918 | structr/structr | structr-ui/src/main/java/org/structr/websocket/command/AbstractCommand.java | AbstractCommand.getNode | public AbstractNode getNode(final String id) {
final SecurityContext securityContext = getWebSocket().getSecurityContext();
final App app = StructrApp.getInstance(securityContext);
try (final Tx tx = app.tx()) {
final AbstractNode node = (AbstractNode) app.getNodeById(id);
tx.success();
return node;... | java | public AbstractNode getNode(final String id) {
final SecurityContext securityContext = getWebSocket().getSecurityContext();
final App app = StructrApp.getInstance(securityContext);
try (final Tx tx = app.tx()) {
final AbstractNode node = (AbstractNode) app.getNodeById(id);
tx.success();
return node;... | [
"public",
"AbstractNode",
"getNode",
"(",
"final",
"String",
"id",
")",
"{",
"final",
"SecurityContext",
"securityContext",
"=",
"getWebSocket",
"(",
")",
".",
"getSecurityContext",
"(",
")",
";",
"final",
"App",
"app",
"=",
"StructrApp",
".",
"getInstance",
"... | Returns the node with the given id.
@param id
@return the node | [
"Returns",
"the",
"node",
"with",
"the",
"given",
"id",
"."
] | c111a1d0c0201c7fea5574ed69aa5a5053185a97 | https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-ui/src/main/java/org/structr/websocket/command/AbstractCommand.java#L161-L179 |
120,919 | structr/structr | structr-ui/src/main/java/org/structr/websocket/command/AbstractCommand.java | AbstractCommand.getRelationship | public AbstractRelationship getRelationship(final String id, final String nodeId) {
if (id == null) {
return null;
}
if (nodeId == null) {
return getRelationship(id);
}
final SecurityContext securityContext = getWebSocket().getSecurityContext();
final App app = StructrApp.getInstance(securityContex... | java | public AbstractRelationship getRelationship(final String id, final String nodeId) {
if (id == null) {
return null;
}
if (nodeId == null) {
return getRelationship(id);
}
final SecurityContext securityContext = getWebSocket().getSecurityContext();
final App app = StructrApp.getInstance(securityContex... | [
"public",
"AbstractRelationship",
"getRelationship",
"(",
"final",
"String",
"id",
",",
"final",
"String",
"nodeId",
")",
"{",
"if",
"(",
"id",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"nodeId",
"==",
"null",
")",
"{",
"return",
"... | Returns the relationship with the given id by looking up a node
with the given nodeId and filtering the relationships.
This avoids the performance issues of getRelationshipById due to missing index support.
If nodeId is null, the method falls back to {@link getRelationship(id)}.
@param id
@param nodeId
@return the ... | [
"Returns",
"the",
"relationship",
"with",
"the",
"given",
"id",
"by",
"looking",
"up",
"a",
"node",
"with",
"the",
"given",
"nodeId",
"and",
"filtering",
"the",
"relationships",
"."
] | c111a1d0c0201c7fea5574ed69aa5a5053185a97 | https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-ui/src/main/java/org/structr/websocket/command/AbstractCommand.java#L194-L226 |
120,920 | structr/structr | structr-ui/src/main/java/org/structr/websocket/command/AbstractCommand.java | AbstractCommand.getRelationship | public AbstractRelationship getRelationship(final String id) {
if (id == null) {
return null;
}
final SecurityContext securityContext = getWebSocket().getSecurityContext();
final App app = StructrApp.getInstance(securityContext);
try (final Tx tx = app.tx()) {
final AbstractRelationship rel = (Abstr... | java | public AbstractRelationship getRelationship(final String id) {
if (id == null) {
return null;
}
final SecurityContext securityContext = getWebSocket().getSecurityContext();
final App app = StructrApp.getInstance(securityContext);
try (final Tx tx = app.tx()) {
final AbstractRelationship rel = (Abstr... | [
"public",
"AbstractRelationship",
"getRelationship",
"(",
"final",
"String",
"id",
")",
"{",
"if",
"(",
"id",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"final",
"SecurityContext",
"securityContext",
"=",
"getWebSocket",
"(",
")",
".",
"getSecurityCon... | Returns the relationship to which the uuid parameter
of this command refers to.
@param id
@return the node | [
"Returns",
"the",
"relationship",
"to",
"which",
"the",
"uuid",
"parameter",
"of",
"this",
"command",
"refers",
"to",
"."
] | c111a1d0c0201c7fea5574ed69aa5a5053185a97 | https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-ui/src/main/java/org/structr/websocket/command/AbstractCommand.java#L235-L257 |
120,921 | structr/structr | structr-ui/src/main/java/org/structr/websocket/command/AbstractCommand.java | AbstractCommand.moveChildNodes | protected void moveChildNodes(final DOMNode sourceNode, final DOMNode targetNode) {
DOMNode child = (DOMNode) sourceNode.getFirstChild();
while (child != null) {
DOMNode next = (DOMNode) child.getNextSibling();
targetNode.appendChild(child);
child = next;
}
} | java | protected void moveChildNodes(final DOMNode sourceNode, final DOMNode targetNode) {
DOMNode child = (DOMNode) sourceNode.getFirstChild();
while (child != null) {
DOMNode next = (DOMNode) child.getNextSibling();
targetNode.appendChild(child);
child = next;
}
} | [
"protected",
"void",
"moveChildNodes",
"(",
"final",
"DOMNode",
"sourceNode",
",",
"final",
"DOMNode",
"targetNode",
")",
"{",
"DOMNode",
"child",
"=",
"(",
"DOMNode",
")",
"sourceNode",
".",
"getFirstChild",
"(",
")",
";",
"while",
"(",
"child",
"!=",
"null... | Make child nodes of the source nodes child nodes of the target node.
@param sourceNode
@param targetNode | [
"Make",
"child",
"nodes",
"of",
"the",
"source",
"nodes",
"child",
"nodes",
"of",
"the",
"target",
"node",
"."
] | c111a1d0c0201c7fea5574ed69aa5a5053185a97 | https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-ui/src/main/java/org/structr/websocket/command/AbstractCommand.java#L275-L289 |
120,922 | structr/structr | structr-ui/src/main/java/org/structr/web/maintenance/deploy/PageImportVisitor.java | PageImportVisitor.fixDocumentElements | private void fixDocumentElements(final Page page) {
final NodeList heads = page.getElementsByTagName("head");
if (heads.getLength() > 1) {
final Node head1 = heads.item(0);
final Node head2 = heads.item(1);
final Node parent = head1.getParentNode();
final boolean h1 = head1.hasChildNodes();
f... | java | private void fixDocumentElements(final Page page) {
final NodeList heads = page.getElementsByTagName("head");
if (heads.getLength() > 1) {
final Node head1 = heads.item(0);
final Node head2 = heads.item(1);
final Node parent = head1.getParentNode();
final boolean h1 = head1.hasChildNodes();
f... | [
"private",
"void",
"fixDocumentElements",
"(",
"final",
"Page",
"page",
")",
"{",
"final",
"NodeList",
"heads",
"=",
"page",
".",
"getElementsByTagName",
"(",
"\"head\"",
")",
";",
"if",
"(",
"heads",
".",
"getLength",
"(",
")",
">",
"1",
")",
"{",
"fina... | Remove duplicate Head element from import process.
@param page | [
"Remove",
"duplicate",
"Head",
"element",
"from",
"import",
"process",
"."
] | c111a1d0c0201c7fea5574ed69aa5a5053185a97 | https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-ui/src/main/java/org/structr/web/maintenance/deploy/PageImportVisitor.java#L270-L309 |
120,923 | structr/structr | structr-ui/src/main/java/org/structr/files/cmis/AbstractStructrCmisService.java | AbstractStructrCmisService.getCMISInfo | public CMISInfo getCMISInfo(final Class<? extends GraphObject> type) {
try { return type.newInstance().getCMISInfo(); } catch (Throwable t) {}
return null;
} | java | public CMISInfo getCMISInfo(final Class<? extends GraphObject> type) {
try { return type.newInstance().getCMISInfo(); } catch (Throwable t) {}
return null;
} | [
"public",
"CMISInfo",
"getCMISInfo",
"(",
"final",
"Class",
"<",
"?",
"extends",
"GraphObject",
">",
"type",
")",
"{",
"try",
"{",
"return",
"type",
".",
"newInstance",
"(",
")",
".",
"getCMISInfo",
"(",
")",
";",
"}",
"catch",
"(",
"Throwable",
"t",
"... | Returns the CMIS info that is defined in the given Structr type, or null.
@param type
@return | [
"Returns",
"the",
"CMIS",
"info",
"that",
"is",
"defined",
"in",
"the",
"given",
"Structr",
"type",
"or",
"null",
"."
] | c111a1d0c0201c7fea5574ed69aa5a5053185a97 | https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-ui/src/main/java/org/structr/files/cmis/AbstractStructrCmisService.java#L89-L94 |
120,924 | structr/structr | structr-ui/src/main/java/org/structr/files/cmis/AbstractStructrCmisService.java | AbstractStructrCmisService.getBaseTypeId | public BaseTypeId getBaseTypeId(final Class<? extends GraphObject> type) {
final CMISInfo info = getCMISInfo(type);
if (info != null) {
return info.getBaseTypeId();
}
return null;
} | java | public BaseTypeId getBaseTypeId(final Class<? extends GraphObject> type) {
final CMISInfo info = getCMISInfo(type);
if (info != null) {
return info.getBaseTypeId();
}
return null;
} | [
"public",
"BaseTypeId",
"getBaseTypeId",
"(",
"final",
"Class",
"<",
"?",
"extends",
"GraphObject",
">",
"type",
")",
"{",
"final",
"CMISInfo",
"info",
"=",
"getCMISInfo",
"(",
"type",
")",
";",
"if",
"(",
"info",
"!=",
"null",
")",
"{",
"return",
"info"... | Returns the baseTypeId that is defined in the given Structr type, or null.
@param type
@return | [
"Returns",
"the",
"baseTypeId",
"that",
"is",
"defined",
"in",
"the",
"given",
"Structr",
"type",
"or",
"null",
"."
] | c111a1d0c0201c7fea5574ed69aa5a5053185a97 | https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-ui/src/main/java/org/structr/files/cmis/AbstractStructrCmisService.java#L101-L110 |
120,925 | structr/structr | structr-ui/src/main/java/org/structr/files/cmis/AbstractStructrCmisService.java | AbstractStructrCmisService.getBaseTypeId | public BaseTypeId getBaseTypeId(final String typeId) {
try { return BaseTypeId.fromValue(typeId); } catch (IllegalArgumentException iex) {}
return null;
} | java | public BaseTypeId getBaseTypeId(final String typeId) {
try { return BaseTypeId.fromValue(typeId); } catch (IllegalArgumentException iex) {}
return null;
} | [
"public",
"BaseTypeId",
"getBaseTypeId",
"(",
"final",
"String",
"typeId",
")",
"{",
"try",
"{",
"return",
"BaseTypeId",
".",
"fromValue",
"(",
"typeId",
")",
";",
"}",
"catch",
"(",
"IllegalArgumentException",
"iex",
")",
"{",
"}",
"return",
"null",
";",
... | Returns the enum value for the given typeId, or null if no such value exists.
@param typeId
@return | [
"Returns",
"the",
"enum",
"value",
"for",
"the",
"given",
"typeId",
"or",
"null",
"if",
"no",
"such",
"value",
"exists",
"."
] | c111a1d0c0201c7fea5574ed69aa5a5053185a97 | https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-ui/src/main/java/org/structr/files/cmis/AbstractStructrCmisService.java#L118-L123 |
120,926 | structr/structr | structr-ui/src/main/java/org/structr/files/cmis/AbstractStructrCmisService.java | AbstractStructrCmisService.typeFromObjectTypeId | public Class typeFromObjectTypeId(final String objectTypeId, final BaseTypeId defaultType, final Class defaultClass) {
// default for cmuis:folder
if (defaultType.value().equals(objectTypeId)) {
return defaultClass;
}
return StructrApp.getConfiguration().getNodeEntityClass(objectTypeId);
} | java | public Class typeFromObjectTypeId(final String objectTypeId, final BaseTypeId defaultType, final Class defaultClass) {
// default for cmuis:folder
if (defaultType.value().equals(objectTypeId)) {
return defaultClass;
}
return StructrApp.getConfiguration().getNodeEntityClass(objectTypeId);
} | [
"public",
"Class",
"typeFromObjectTypeId",
"(",
"final",
"String",
"objectTypeId",
",",
"final",
"BaseTypeId",
"defaultType",
",",
"final",
"Class",
"defaultClass",
")",
"{",
"// default for cmuis:folder",
"if",
"(",
"defaultType",
".",
"value",
"(",
")",
".",
"eq... | Returns the Structr type for the given objectTypeId, or the defaultClass of the objectTypeId
matches the given baseTypeId.
@param objectTypeId
@param defaultType
@param defaultClass
@return a Structr type | [
"Returns",
"the",
"Structr",
"type",
"for",
"the",
"given",
"objectTypeId",
"or",
"the",
"defaultClass",
"of",
"the",
"objectTypeId",
"matches",
"the",
"given",
"baseTypeId",
"."
] | c111a1d0c0201c7fea5574ed69aa5a5053185a97 | https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-ui/src/main/java/org/structr/files/cmis/AbstractStructrCmisService.java#L135-L143 |
120,927 | structr/structr | structr-core/src/main/java/org/structr/core/Services.java | Services.registerServiceClass | public void registerServiceClass(Class serviceClass) {
registeredServiceClasses.put(serviceClass.getSimpleName(), serviceClass);
// make it possible to select options in configuration editor
Settings.Services.addAvailableOption(serviceClass.getSimpleName());
} | java | public void registerServiceClass(Class serviceClass) {
registeredServiceClasses.put(serviceClass.getSimpleName(), serviceClass);
// make it possible to select options in configuration editor
Settings.Services.addAvailableOption(serviceClass.getSimpleName());
} | [
"public",
"void",
"registerServiceClass",
"(",
"Class",
"serviceClass",
")",
"{",
"registeredServiceClasses",
".",
"put",
"(",
"serviceClass",
".",
"getSimpleName",
"(",
")",
",",
"serviceClass",
")",
";",
"// make it possible to select options in configuration editor",
"... | Registers a service, enabling the service layer to automatically start
autorun servies.
@param serviceClass the service class to register | [
"Registers",
"a",
"service",
"enabling",
"the",
"service",
"layer",
"to",
"automatically",
"start",
"autorun",
"servies",
"."
] | c111a1d0c0201c7fea5574ed69aa5a5053185a97 | https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-core/src/main/java/org/structr/core/Services.java#L395-L401 |
120,928 | structr/structr | structr-core/src/main/java/org/structr/core/Services.java | Services.isReady | public boolean isReady(final Class serviceClass) {
Service service = serviceCache.get(serviceClass);
return (service != null && service.isRunning());
} | java | public boolean isReady(final Class serviceClass) {
Service service = serviceCache.get(serviceClass);
return (service != null && service.isRunning());
} | [
"public",
"boolean",
"isReady",
"(",
"final",
"Class",
"serviceClass",
")",
"{",
"Service",
"service",
"=",
"serviceCache",
".",
"get",
"(",
"serviceClass",
")",
";",
"return",
"(",
"service",
"!=",
"null",
"&&",
"service",
".",
"isRunning",
"(",
")",
")",... | Return true if the given service is ready to be used,
means initialized and running.
@param serviceClass
@return isReady | [
"Return",
"true",
"if",
"the",
"given",
"service",
"is",
"ready",
"to",
"be",
"used",
"means",
"initialized",
"and",
"running",
"."
] | c111a1d0c0201c7fea5574ed69aa5a5053185a97 | https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-core/src/main/java/org/structr/core/Services.java#L656-L660 |
120,929 | structr/structr | structr-core/src/main/java/org/structr/common/MailHelper.java | MailHelper.replacePlaceHoldersInTemplate | public static String replacePlaceHoldersInTemplate(final String template, final Map<String, String> replacementMap) {
List<String> toReplace = new ArrayList<>();
List<String> replaceBy = new ArrayList<>();
for (Entry<String, String> property : replacementMap.entrySet()) {
toReplace.add(property.getKey());
... | java | public static String replacePlaceHoldersInTemplate(final String template, final Map<String, String> replacementMap) {
List<String> toReplace = new ArrayList<>();
List<String> replaceBy = new ArrayList<>();
for (Entry<String, String> property : replacementMap.entrySet()) {
toReplace.add(property.getKey());
... | [
"public",
"static",
"String",
"replacePlaceHoldersInTemplate",
"(",
"final",
"String",
"template",
",",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"replacementMap",
")",
"{",
"List",
"<",
"String",
">",
"toReplace",
"=",
"new",
"ArrayList",
"<>",
"(",
... | Parse the template and replace any of the keys in the replacement map by
the given values
@param template
@param replacementMap
@return template string with included replacements | [
"Parse",
"the",
"template",
"and",
"replace",
"any",
"of",
"the",
"keys",
"in",
"the",
"replacement",
"map",
"by",
"the",
"given",
"values"
] | c111a1d0c0201c7fea5574ed69aa5a5053185a97 | https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-core/src/main/java/org/structr/common/MailHelper.java#L208-L222 |
120,930 | structr/structr | structr-modules/structr-java-parser-module/src/main/java/org/structr/javaparser/JavaParserModule.java | JavaParserModule.indexSourceTree | public void indexSourceTree(final Folder rootFolder) {
logger.info("Starting indexing of source tree " + rootFolder.getPath());
final SecurityContext securityContext = rootFolder.getSecurityContext();
app = StructrApp.getInstance(securityContext);
structrTypeSolver.parseRoot(rootFolder);
final CombinedTyp... | java | public void indexSourceTree(final Folder rootFolder) {
logger.info("Starting indexing of source tree " + rootFolder.getPath());
final SecurityContext securityContext = rootFolder.getSecurityContext();
app = StructrApp.getInstance(securityContext);
structrTypeSolver.parseRoot(rootFolder);
final CombinedTyp... | [
"public",
"void",
"indexSourceTree",
"(",
"final",
"Folder",
"rootFolder",
")",
"{",
"logger",
".",
"info",
"(",
"\"Starting indexing of source tree \"",
"+",
"rootFolder",
".",
"getPath",
"(",
")",
")",
";",
"final",
"SecurityContext",
"securityContext",
"=",
"ro... | Create an index containing all compilation units of Java files from
the source tree under the given root folder.
@param rootFolder | [
"Create",
"an",
"index",
"containing",
"all",
"compilation",
"units",
"of",
"Java",
"files",
"from",
"the",
"source",
"tree",
"under",
"the",
"given",
"root",
"folder",
"."
] | c111a1d0c0201c7fea5574ed69aa5a5053185a97 | https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-modules/structr-java-parser-module/src/main/java/org/structr/javaparser/JavaParserModule.java#L140-L156 |
120,931 | structr/structr | structr-core/src/main/java/org/structr/core/graph/Factory.java | Factory.bulkInstantiate | public Iterable<T> bulkInstantiate(final Iterable<S> input) throws FrameworkException {
return Iterables.map(this, input);
} | java | public Iterable<T> bulkInstantiate(final Iterable<S> input) throws FrameworkException {
return Iterables.map(this, input);
} | [
"public",
"Iterable",
"<",
"T",
">",
"bulkInstantiate",
"(",
"final",
"Iterable",
"<",
"S",
">",
"input",
")",
"throws",
"FrameworkException",
"{",
"return",
"Iterables",
".",
"map",
"(",
"this",
",",
"input",
")",
";",
"}"
] | Create structr nodes from all given underlying database nodes
No paging, but security check
@param input
@return nodes
@throws org.structr.common.error.FrameworkException | [
"Create",
"structr",
"nodes",
"from",
"all",
"given",
"underlying",
"database",
"nodes",
"No",
"paging",
"but",
"security",
"check"
] | c111a1d0c0201c7fea5574ed69aa5a5053185a97 | https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-core/src/main/java/org/structr/core/graph/Factory.java#L83-L85 |
120,932 | structr/structr | structr-core/src/main/java/org/structr/core/graph/SyncCommand.java | SyncCommand.exportToFile | public static void exportToFile(final DatabaseService graphDb, final String fileName, final String query, final boolean includeFiles) throws FrameworkException {
final App app = StructrApp.getInstance();
try (final Tx tx = app.tx()) {
final NodeFactory nodeFactory = new NodeFactory(SecurityContext.get... | java | public static void exportToFile(final DatabaseService graphDb, final String fileName, final String query, final boolean includeFiles) throws FrameworkException {
final App app = StructrApp.getInstance();
try (final Tx tx = app.tx()) {
final NodeFactory nodeFactory = new NodeFactory(SecurityContext.get... | [
"public",
"static",
"void",
"exportToFile",
"(",
"final",
"DatabaseService",
"graphDb",
",",
"final",
"String",
"fileName",
",",
"final",
"String",
"query",
",",
"final",
"boolean",
"includeFiles",
")",
"throws",
"FrameworkException",
"{",
"final",
"App",
"app",
... | Exports the whole structr database to a file with the given name.
@param graphDb
@param fileName
@param includeFiles
@throws FrameworkException | [
"Exports",
"the",
"whole",
"structr",
"database",
"to",
"a",
"file",
"with",
"the",
"given",
"name",
"."
] | c111a1d0c0201c7fea5574ed69aa5a5053185a97 | https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-core/src/main/java/org/structr/core/graph/SyncCommand.java#L175-L223 |
120,933 | structr/structr | structr-core/src/main/java/org/structr/core/graph/SyncCommand.java | SyncCommand.exportToFile | public static void exportToFile(final String fileName, final Iterable<? extends NodeInterface> nodes, final Iterable<? extends RelationshipInterface> relationships, final Iterable<String> filePaths, final boolean includeFiles) throws FrameworkException {
try (final Tx tx = StructrApp.getInstance().tx()) {
try (f... | java | public static void exportToFile(final String fileName, final Iterable<? extends NodeInterface> nodes, final Iterable<? extends RelationshipInterface> relationships, final Iterable<String> filePaths, final boolean includeFiles) throws FrameworkException {
try (final Tx tx = StructrApp.getInstance().tx()) {
try (f... | [
"public",
"static",
"void",
"exportToFile",
"(",
"final",
"String",
"fileName",
",",
"final",
"Iterable",
"<",
"?",
"extends",
"NodeInterface",
">",
"nodes",
",",
"final",
"Iterable",
"<",
"?",
"extends",
"RelationshipInterface",
">",
"relationships",
",",
"fina... | Exports the given part of the structr database to a file with the given name.
@param fileName
@param nodes
@param relationships
@param filePaths
@param includeFiles
@throws FrameworkException | [
"Exports",
"the",
"given",
"part",
"of",
"the",
"structr",
"database",
"to",
"a",
"file",
"with",
"the",
"given",
"name",
"."
] | c111a1d0c0201c7fea5574ed69aa5a5053185a97 | https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-core/src/main/java/org/structr/core/graph/SyncCommand.java#L235-L250 |
120,934 | structr/structr | structr-core/src/main/java/org/structr/core/graph/SyncCommand.java | SyncCommand.exportToStream | public static void exportToStream(final OutputStream outputStream, final Iterable<? extends NodeInterface> nodes, final Iterable<? extends RelationshipInterface> relationships, final Iterable<String> filePaths, final boolean includeFiles) throws FrameworkException {
try (final ZipOutputStream zos = new ZipOutputStre... | java | public static void exportToStream(final OutputStream outputStream, final Iterable<? extends NodeInterface> nodes, final Iterable<? extends RelationshipInterface> relationships, final Iterable<String> filePaths, final boolean includeFiles) throws FrameworkException {
try (final ZipOutputStream zos = new ZipOutputStre... | [
"public",
"static",
"void",
"exportToStream",
"(",
"final",
"OutputStream",
"outputStream",
",",
"final",
"Iterable",
"<",
"?",
"extends",
"NodeInterface",
">",
"nodes",
",",
"final",
"Iterable",
"<",
"?",
"extends",
"RelationshipInterface",
">",
"relationships",
... | Exports the given part of the structr database to the given output stream.
@param outputStream
@param nodes
@param relationships
@param filePaths
@param includeFiles
@throws FrameworkException | [
"Exports",
"the",
"given",
"part",
"of",
"the",
"structr",
"database",
"to",
"the",
"given",
"output",
"stream",
"."
] | c111a1d0c0201c7fea5574ed69aa5a5053185a97 | https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-core/src/main/java/org/structr/core/graph/SyncCommand.java#L262-L302 |
120,935 | structr/structr | structr-core/src/main/java/org/structr/core/graph/SyncCommand.java | SyncCommand.serializeData | public static void serializeData(DataOutputStream outputStream, byte[] data) throws IOException {
outputStream.writeInt(data.length);
outputStream.write(data);
outputStream.flush();
} | java | public static void serializeData(DataOutputStream outputStream, byte[] data) throws IOException {
outputStream.writeInt(data.length);
outputStream.write(data);
outputStream.flush();
} | [
"public",
"static",
"void",
"serializeData",
"(",
"DataOutputStream",
"outputStream",
",",
"byte",
"[",
"]",
"data",
")",
"throws",
"IOException",
"{",
"outputStream",
".",
"writeInt",
"(",
"data",
".",
"length",
")",
";",
"outputStream",
".",
"write",
"(",
... | Serializes the given object into the given writer. The following format will
be used to serialize objects. The first two characters are the type index, see
typeMap above. After that, a single digit that indicates the length of the following
length field follows. After that, the length field is serialized, followed by t... | [
"Serializes",
"the",
"given",
"object",
"into",
"the",
"given",
"writer",
".",
"The",
"following",
"format",
"will",
"be",
"used",
"to",
"serialize",
"objects",
".",
"The",
"first",
"two",
"characters",
"are",
"the",
"type",
"index",
"see",
"typeMap",
"above... | c111a1d0c0201c7fea5574ed69aa5a5053185a97 | https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-core/src/main/java/org/structr/core/graph/SyncCommand.java#L359-L365 |
120,936 | structr/structr | structr-rest/src/main/java/org/structr/rest/resource/Resource.java | Resource.getFirstPartOfString | private String getFirstPartOfString(final String source) {
final int pos = source.indexOf(".");
if (pos > -1) {
return source.substring(0, pos);
}
return source;
} | java | private String getFirstPartOfString(final String source) {
final int pos = source.indexOf(".");
if (pos > -1) {
return source.substring(0, pos);
}
return source;
} | [
"private",
"String",
"getFirstPartOfString",
"(",
"final",
"String",
"source",
")",
"{",
"final",
"int",
"pos",
"=",
"source",
".",
"indexOf",
"(",
"\".\"",
")",
";",
"if",
"(",
"pos",
">",
"-",
"1",
")",
"{",
"return",
"source",
".",
"substring",
"(",... | Returns the first part of the given source string when it contains a "."
@return source | [
"Returns",
"the",
"first",
"part",
"of",
"the",
"given",
"source",
"string",
"when",
"it",
"contains",
"a",
"."
] | c111a1d0c0201c7fea5574ed69aa5a5053185a97 | https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-rest/src/main/java/org/structr/rest/resource/Resource.java#L379-L388 |
120,937 | structr/structr | structr-rest/src/main/java/org/structr/rest/auth/RestAuthenticator.java | RestAuthenticator.initializeAndExamineRequest | @Override
public SecurityContext initializeAndExamineRequest(final HttpServletRequest request, final HttpServletResponse response) throws FrameworkException {
logger.warn("KAI: RestAuthenticator.initializeAndExamineRequest");
SecurityContext securityContext;
Principal user = SessionHelper.checkSessionAuthenti... | java | @Override
public SecurityContext initializeAndExamineRequest(final HttpServletRequest request, final HttpServletResponse response) throws FrameworkException {
logger.warn("KAI: RestAuthenticator.initializeAndExamineRequest");
SecurityContext securityContext;
Principal user = SessionHelper.checkSessionAuthenti... | [
"@",
"Override",
"public",
"SecurityContext",
"initializeAndExamineRequest",
"(",
"final",
"HttpServletRequest",
"request",
",",
"final",
"HttpServletResponse",
"response",
")",
"throws",
"FrameworkException",
"{",
"logger",
".",
"warn",
"(",
"\"KAI: RestAuthenticator.initi... | Examine request and try to find a user.
First, check session id, then try external (OAuth) authentication,
finally, check standard login by credentials.
@param request
@param response
@return security context
@throws FrameworkException | [
"Examine",
"request",
"and",
"try",
"to",
"find",
"a",
"user",
"."
] | c111a1d0c0201c7fea5574ed69aa5a5053185a97 | https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-rest/src/main/java/org/structr/rest/auth/RestAuthenticator.java#L99-L176 |
120,938 | Devskiller/jfairy | src/main/java/com/devskiller/jfairy/producer/person/locale/pl/PlNationalIdentificationNumberProvider.java | PlNationalIdentificationNumberProvider.calculateSexCode | private int calculateSexCode(Person.Sex sex) {
return SEX_FIELDS[baseProducer.randomInt(SEX_FIELDS.length - 1)] + (sex == Person.Sex.MALE ? 1 : 0);
} | java | private int calculateSexCode(Person.Sex sex) {
return SEX_FIELDS[baseProducer.randomInt(SEX_FIELDS.length - 1)] + (sex == Person.Sex.MALE ? 1 : 0);
} | [
"private",
"int",
"calculateSexCode",
"(",
"Person",
".",
"Sex",
"sex",
")",
"{",
"return",
"SEX_FIELDS",
"[",
"baseProducer",
".",
"randomInt",
"(",
"SEX_FIELDS",
".",
"length",
"-",
"1",
")",
"]",
"+",
"(",
"sex",
"==",
"Person",
".",
"Sex",
".",
"MA... | This should be tested | [
"This",
"should",
"be",
"tested"
] | 126d1c8b1545f725afd10f969b9d27005ac520b7 | https://github.com/Devskiller/jfairy/blob/126d1c8b1545f725afd10f969b9d27005ac520b7/src/main/java/com/devskiller/jfairy/producer/person/locale/pl/PlNationalIdentificationNumberProvider.java#L117-L119 |
120,939 | Devskiller/jfairy | src/main/java/com/devskiller/jfairy/producer/util/ZhFairyUtil.java | ZhFairyUtil.getRandomNumStr | public static String getRandomNumStr(BaseProducer baseProducer, int max, int paddingSize) {
int rndNum = baseProducer.randomBetween(1, max);
String numStr = "" + rndNum;
while (numStr.length() < paddingSize) {
numStr = "0" + numStr;
}
return numStr;
} | java | public static String getRandomNumStr(BaseProducer baseProducer, int max, int paddingSize) {
int rndNum = baseProducer.randomBetween(1, max);
String numStr = "" + rndNum;
while (numStr.length() < paddingSize) {
numStr = "0" + numStr;
}
return numStr;
} | [
"public",
"static",
"String",
"getRandomNumStr",
"(",
"BaseProducer",
"baseProducer",
",",
"int",
"max",
",",
"int",
"paddingSize",
")",
"{",
"int",
"rndNum",
"=",
"baseProducer",
".",
"randomBetween",
"(",
"1",
",",
"max",
")",
";",
"String",
"numStr",
"=",... | Get random number from 1 to max in 0 leading string format.
@param baseProducer BaseProducer
@param max upper bound of number
@param paddingSize padding size
@return A number smaller than #max with #paddingSize digits in string format | [
"Get",
"random",
"number",
"from",
"1",
"to",
"max",
"in",
"0",
"leading",
"string",
"format",
"."
] | 126d1c8b1545f725afd10f969b9d27005ac520b7 | https://github.com/Devskiller/jfairy/blob/126d1c8b1545f725afd10f969b9d27005ac520b7/src/main/java/com/devskiller/jfairy/producer/util/ZhFairyUtil.java#L71-L78 |
120,940 | Devskiller/jfairy | src/main/java/com/devskiller/jfairy/Bootstrap.java | Bootstrap.create | public static Fairy create(Locale locale, String dataFilePrefix) {
return builder().withLocale(locale)
.withFilePrefix(dataFilePrefix)
.build();
} | java | public static Fairy create(Locale locale, String dataFilePrefix) {
return builder().withLocale(locale)
.withFilePrefix(dataFilePrefix)
.build();
} | [
"public",
"static",
"Fairy",
"create",
"(",
"Locale",
"locale",
",",
"String",
"dataFilePrefix",
")",
"{",
"return",
"builder",
"(",
")",
".",
"withLocale",
"(",
"locale",
")",
".",
"withFilePrefix",
"(",
"dataFilePrefix",
")",
".",
"build",
"(",
")",
";",... | Use this factory method to create your own dataset overriding bundled one
@param locale will be used to assess langCode for data file
@param dataFilePrefix prefix of the data file - final pattern will be jfairy.yml and dataFilePrefix_{langCode}.yml
@return Fairy instance | [
"Use",
"this",
"factory",
"method",
"to",
"create",
"your",
"own",
"dataset",
"overriding",
"bundled",
"one"
] | 126d1c8b1545f725afd10f969b9d27005ac520b7 | https://github.com/Devskiller/jfairy/blob/126d1c8b1545f725afd10f969b9d27005ac520b7/src/main/java/com/devskiller/jfairy/Bootstrap.java#L103-L107 |
120,941 | Devskiller/jfairy | src/main/java/com/devskiller/jfairy/Bootstrap.java | Bootstrap.getFairyModuleForLocale | private static FairyModule getFairyModuleForLocale(DataMaster dataMaster, Locale locale, RandomGenerator randomGenerator) {
LanguageCode code;
try {
code = LanguageCode.valueOf(locale.getLanguage().toUpperCase());
} catch (IllegalArgumentException e) {
LOG.warn("Uknown locale " + locale);
code = Languag... | java | private static FairyModule getFairyModuleForLocale(DataMaster dataMaster, Locale locale, RandomGenerator randomGenerator) {
LanguageCode code;
try {
code = LanguageCode.valueOf(locale.getLanguage().toUpperCase());
} catch (IllegalArgumentException e) {
LOG.warn("Uknown locale " + locale);
code = Languag... | [
"private",
"static",
"FairyModule",
"getFairyModuleForLocale",
"(",
"DataMaster",
"dataMaster",
",",
"Locale",
"locale",
",",
"RandomGenerator",
"randomGenerator",
")",
"{",
"LanguageCode",
"code",
";",
"try",
"{",
"code",
"=",
"LanguageCode",
".",
"valueOf",
"(",
... | Support customized language config
@param dataMaster master of the config
@param locale The Locale to set.
@param randomGenerator specific random generator
@return FariyModule instance in accordance with locale | [
"Support",
"customized",
"language",
"config"
] | 126d1c8b1545f725afd10f969b9d27005ac520b7 | https://github.com/Devskiller/jfairy/blob/126d1c8b1545f725afd10f969b9d27005ac520b7/src/main/java/com/devskiller/jfairy/Bootstrap.java#L121-L152 |
120,942 | Devskiller/jfairy | src/main/java/com/devskiller/jfairy/data/MapBasedDataMaster.java | MapBasedDataMaster.readResources | public void readResources(String path) throws IOException {
Enumeration<URL> resources =
getClass().getClassLoader().getResources(path);
if (!resources.hasMoreElements()) {
throw new IllegalArgumentException(String.format("File %s was not found on classpath", path));
}
Yaml yaml = new Yaml();
while (... | java | public void readResources(String path) throws IOException {
Enumeration<URL> resources =
getClass().getClassLoader().getResources(path);
if (!resources.hasMoreElements()) {
throw new IllegalArgumentException(String.format("File %s was not found on classpath", path));
}
Yaml yaml = new Yaml();
while (... | [
"public",
"void",
"readResources",
"(",
"String",
"path",
")",
"throws",
"IOException",
"{",
"Enumeration",
"<",
"URL",
">",
"resources",
"=",
"getClass",
"(",
")",
".",
"getClassLoader",
"(",
")",
".",
"getResources",
"(",
"path",
")",
";",
"if",
"(",
"... | fixme - should be package-private | [
"fixme",
"-",
"should",
"be",
"package",
"-",
"private"
] | 126d1c8b1545f725afd10f969b9d27005ac520b7 | https://github.com/Devskiller/jfairy/blob/126d1c8b1545f725afd10f969b9d27005ac520b7/src/main/java/com/devskiller/jfairy/data/MapBasedDataMaster.java#L93-L105 |
120,943 | Devskiller/jfairy | src/main/java/com/devskiller/jfairy/producer/BaseProducer.java | BaseProducer.randomElement | public <T> T randomElement(List<T> elements) {
return elements.get(randomBetween(0, elements.size() - 1));
} | java | public <T> T randomElement(List<T> elements) {
return elements.get(randomBetween(0, elements.size() - 1));
} | [
"public",
"<",
"T",
">",
"T",
"randomElement",
"(",
"List",
"<",
"T",
">",
"elements",
")",
"{",
"return",
"elements",
".",
"get",
"(",
"randomBetween",
"(",
"0",
",",
"elements",
".",
"size",
"(",
")",
"-",
"1",
")",
")",
";",
"}"
] | Returns random element from passed List
@param <T> element generic type
@param elements list to process
@return random list element | [
"Returns",
"random",
"element",
"from",
"passed",
"List"
] | 126d1c8b1545f725afd10f969b9d27005ac520b7 | https://github.com/Devskiller/jfairy/blob/126d1c8b1545f725afd10f969b9d27005ac520b7/src/main/java/com/devskiller/jfairy/producer/BaseProducer.java#L35-L37 |
120,944 | Devskiller/jfairy | src/main/java/com/devskiller/jfairy/producer/BaseProducer.java | BaseProducer.randomElement | public <T extends Enum<?>> T randomElement(Class<T> enumType) {
return enumType.getEnumConstants()[randomBetween(0, enumType.getEnumConstants().length - 1)];
} | java | public <T extends Enum<?>> T randomElement(Class<T> enumType) {
return enumType.getEnumConstants()[randomBetween(0, enumType.getEnumConstants().length - 1)];
} | [
"public",
"<",
"T",
"extends",
"Enum",
"<",
"?",
">",
">",
"T",
"randomElement",
"(",
"Class",
"<",
"T",
">",
"enumType",
")",
"{",
"return",
"enumType",
".",
"getEnumConstants",
"(",
")",
"[",
"randomBetween",
"(",
"0",
",",
"enumType",
".",
"getEnumC... | Returns random enum value
@param <T> element generic type
@param enumType enum class
@return random enum value | [
"Returns",
"random",
"enum",
"value"
] | 126d1c8b1545f725afd10f969b9d27005ac520b7 | https://github.com/Devskiller/jfairy/blob/126d1c8b1545f725afd10f969b9d27005ac520b7/src/main/java/com/devskiller/jfairy/producer/BaseProducer.java#L56-L58 |
120,945 | Devskiller/jfairy | src/main/java/com/devskiller/jfairy/producer/BaseProducer.java | BaseProducer.randomElements | public <T> List<T> randomElements(List<T> elements, int count) {
if (elements.size() >= count) {
return extractRandomList(elements, count);
} else {
List<T> randomElements = new ArrayList<T>();
randomElements.addAll(extractRandomList(elements, count % elements.size()));
do {
randomElements.addAll(ex... | java | public <T> List<T> randomElements(List<T> elements, int count) {
if (elements.size() >= count) {
return extractRandomList(elements, count);
} else {
List<T> randomElements = new ArrayList<T>();
randomElements.addAll(extractRandomList(elements, count % elements.size()));
do {
randomElements.addAll(ex... | [
"public",
"<",
"T",
">",
"List",
"<",
"T",
">",
"randomElements",
"(",
"List",
"<",
"T",
">",
"elements",
",",
"int",
"count",
")",
"{",
"if",
"(",
"elements",
".",
"size",
"(",
")",
">=",
"count",
")",
"{",
"return",
"extractRandomList",
"(",
"ele... | Creates new list being random subset of the passed list
@param <T> element generic type
@param elements list to process
@param count returned list size
@return sublist of the elements list | [
"Creates",
"new",
"list",
"being",
"random",
"subset",
"of",
"the",
"passed",
"list"
] | 126d1c8b1545f725afd10f969b9d27005ac520b7 | https://github.com/Devskiller/jfairy/blob/126d1c8b1545f725afd10f969b9d27005ac520b7/src/main/java/com/devskiller/jfairy/producer/BaseProducer.java#L68-L79 |
120,946 | Pragmatists/JUnitParams | src/main/java/junitparams/naming/MacroSubstitutionNamingStrategy.java | MacroSubstitutionNamingStrategy.split | private static String[] split(String input) {
char macroStart = MACRO_START.charAt(0);
char macroEnd = MACRO_END.charAt(0);
int startIndex = 0;
boolean inMacro = false;
List<String> list = new ArrayList<String>();
for (int endIndex = 0; endIndex < input.length(); endIn... | java | private static String[] split(String input) {
char macroStart = MACRO_START.charAt(0);
char macroEnd = MACRO_END.charAt(0);
int startIndex = 0;
boolean inMacro = false;
List<String> list = new ArrayList<String>();
for (int endIndex = 0; endIndex < input.length(); endIn... | [
"private",
"static",
"String",
"[",
"]",
"split",
"(",
"String",
"input",
")",
"{",
"char",
"macroStart",
"=",
"MACRO_START",
".",
"charAt",
"(",
"0",
")",
";",
"char",
"macroEnd",
"=",
"MACRO_END",
".",
"charAt",
"(",
"0",
")",
";",
"int",
"startIndex... | Split keeping delimiters in split result | [
"Split",
"keeping",
"delimiters",
"in",
"split",
"result"
] | b8647f177a2be1f37a252ec11687b0ea606b1a70 | https://github.com/Pragmatists/JUnitParams/blob/b8647f177a2be1f37a252ec11687b0ea606b1a70/src/main/java/junitparams/naming/MacroSubstitutionNamingStrategy.java#L123-L162 |
120,947 | bennidi/mbassador | src/main/java/net/engio/mbassy/bus/AbstractSyncAsyncMessageBus.java | AbstractSyncAsyncMessageBus.initDispatcherThreads | private void initDispatcherThreads(Feature.AsynchronousMessageDispatch configuration) {
for (int i = 0; i < configuration.getNumberOfMessageDispatchers(); i++) {
// each thread will run forever and process incoming
// message publication requests
Thread dispatcher = configura... | java | private void initDispatcherThreads(Feature.AsynchronousMessageDispatch configuration) {
for (int i = 0; i < configuration.getNumberOfMessageDispatchers(); i++) {
// each thread will run forever and process incoming
// message publication requests
Thread dispatcher = configura... | [
"private",
"void",
"initDispatcherThreads",
"(",
"Feature",
".",
"AsynchronousMessageDispatch",
"configuration",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"configuration",
".",
"getNumberOfMessageDispatchers",
"(",
")",
";",
"i",
"++",
")",
"{... | initialize the dispatch workers | [
"initialize",
"the",
"dispatch",
"workers"
] | 60c153fb72868fc31e535852cf0c420022d26c2b | https://github.com/bennidi/mbassador/blob/60c153fb72868fc31e535852cf0c420022d26c2b/src/main/java/net/engio/mbassy/bus/AbstractSyncAsyncMessageBus.java#L57-L81 |
120,948 | bennidi/mbassador | src/main/java/net/engio/mbassy/listener/MetadataReader.java | MetadataReader.getFilter | private IMessageFilter[] getFilter(Method method, Handler subscription) {
Filter[] filterDefinitions = collectFilters(method, subscription);
if (filterDefinitions.length == 0) {
return null;
}
IMessageFilter[] filters = new IMessageFilter[filterDefinitions.length];
in... | java | private IMessageFilter[] getFilter(Method method, Handler subscription) {
Filter[] filterDefinitions = collectFilters(method, subscription);
if (filterDefinitions.length == 0) {
return null;
}
IMessageFilter[] filters = new IMessageFilter[filterDefinitions.length];
in... | [
"private",
"IMessageFilter",
"[",
"]",
"getFilter",
"(",
"Method",
"method",
",",
"Handler",
"subscription",
")",
"{",
"Filter",
"[",
"]",
"filterDefinitions",
"=",
"collectFilters",
"(",
"method",
",",
"subscription",
")",
";",
"if",
"(",
"filterDefinitions",
... | retrieve all instances of filters associated with the given subscription | [
"retrieve",
"all",
"instances",
"of",
"filters",
"associated",
"with",
"the",
"given",
"subscription"
] | 60c153fb72868fc31e535852cf0c420022d26c2b | https://github.com/bennidi/mbassador/blob/60c153fb72868fc31e535852cf0c420022d26c2b/src/main/java/net/engio/mbassy/listener/MetadataReader.java#L35-L56 |
120,949 | bennidi/mbassador | src/main/java/net/engio/mbassy/listener/MetadataReader.java | MetadataReader.getMessageListener | public MessageListener getMessageListener(Class target) {
MessageListener listenerMetadata = new MessageListener(target);
// get all handlers (this will include all (inherited) methods directly annotated using @Handler)
Method[] allHandlers = ReflectionUtils.getMethods(AllMessageHandlers, target... | java | public MessageListener getMessageListener(Class target) {
MessageListener listenerMetadata = new MessageListener(target);
// get all handlers (this will include all (inherited) methods directly annotated using @Handler)
Method[] allHandlers = ReflectionUtils.getMethods(AllMessageHandlers, target... | [
"public",
"MessageListener",
"getMessageListener",
"(",
"Class",
"target",
")",
"{",
"MessageListener",
"listenerMetadata",
"=",
"new",
"MessageListener",
"(",
"target",
")",
";",
"// get all handlers (this will include all (inherited) methods directly annotated using @Handler)",
... | listeners defined in super classes) | [
"listeners",
"defined",
"in",
"super",
"classes",
")"
] | 60c153fb72868fc31e535852cf0c420022d26c2b | https://github.com/bennidi/mbassador/blob/60c153fb72868fc31e535852cf0c420022d26c2b/src/main/java/net/engio/mbassy/listener/MetadataReader.java#L78-L115 |
120,950 | bennidi/mbassador | src/main/java/net/engio/mbassy/common/ReflectionUtils.java | ReflectionUtils.getOverridingMethod | public static Method getOverridingMethod( final Method overridingMethod, final Class subclass ) {
Class current = subclass;
while ( !current.equals( overridingMethod.getDeclaringClass() ) ) {
try {
return current.getDeclaredMethod( overridingMethod.getName(), overridingMethod... | java | public static Method getOverridingMethod( final Method overridingMethod, final Class subclass ) {
Class current = subclass;
while ( !current.equals( overridingMethod.getDeclaringClass() ) ) {
try {
return current.getDeclaredMethod( overridingMethod.getName(), overridingMethod... | [
"public",
"static",
"Method",
"getOverridingMethod",
"(",
"final",
"Method",
"overridingMethod",
",",
"final",
"Class",
"subclass",
")",
"{",
"Class",
"current",
"=",
"subclass",
";",
"while",
"(",
"!",
"current",
".",
"equals",
"(",
"overridingMethod",
".",
"... | Traverses the class hierarchy upwards, starting at the given subclass, looking
for an override of the given methods -> finds the bottom most override of the given
method if any exists
@param overridingMethod
@param subclass | [
"Traverses",
"the",
"class",
"hierarchy",
"upwards",
"starting",
"at",
"the",
"given",
"subclass",
"looking",
"for",
"an",
"override",
"of",
"the",
"given",
"methods",
"-",
">",
"finds",
"the",
"bottom",
"most",
"override",
"of",
"the",
"given",
"method",
"i... | 60c153fb72868fc31e535852cf0c420022d26c2b | https://github.com/bennidi/mbassador/blob/60c153fb72868fc31e535852cf0c420022d26c2b/src/main/java/net/engio/mbassy/common/ReflectionUtils.java#L61-L72 |
120,951 | bennidi/mbassador | src/main/java/net/engio/mbassy/common/ReflectionUtils.java | ReflectionUtils.getAnnotation | private static <A extends Annotation> A getAnnotation( AnnotatedElement from, Class<A> annotationType, Set<AnnotatedElement> visited) {
if( visited.contains(from) ) return null;
visited.add(from);
A ann = from.getAnnotation( annotationType );
if( ann != null) return ann;
for ( An... | java | private static <A extends Annotation> A getAnnotation( AnnotatedElement from, Class<A> annotationType, Set<AnnotatedElement> visited) {
if( visited.contains(from) ) return null;
visited.add(from);
A ann = from.getAnnotation( annotationType );
if( ann != null) return ann;
for ( An... | [
"private",
"static",
"<",
"A",
"extends",
"Annotation",
">",
"A",
"getAnnotation",
"(",
"AnnotatedElement",
"from",
",",
"Class",
"<",
"A",
">",
"annotationType",
",",
"Set",
"<",
"AnnotatedElement",
">",
"visited",
")",
"{",
"if",
"(",
"visited",
".",
"co... | Searches for an Annotation of the given type on the class. Supports meta annotations.
@param from AnnotatedElement (class, method...)
@param annotationType Annotation class to look for.
@param <A> Class of annotation type
@return Annotation instance or null | [
"Searches",
"for",
"an",
"Annotation",
"of",
"the",
"given",
"type",
"on",
"the",
"class",
".",
"Supports",
"meta",
"annotations",
"."
] | 60c153fb72868fc31e535852cf0c420022d26c2b | https://github.com/bennidi/mbassador/blob/60c153fb72868fc31e535852cf0c420022d26c2b/src/main/java/net/engio/mbassy/common/ReflectionUtils.java#L126-L138 |
120,952 | bennidi/mbassador | src/main/java/net/engio/mbassy/listener/MessageListener.java | MessageListener.getHandlers | public List<MessageHandler> getHandlers(IPredicate<MessageHandler> filter) {
List<MessageHandler> matching = new ArrayList<MessageHandler>();
for (MessageHandler handler : handlers) {
if (filter.apply(handler)) {
matching.add(handler);
}
}
return m... | java | public List<MessageHandler> getHandlers(IPredicate<MessageHandler> filter) {
List<MessageHandler> matching = new ArrayList<MessageHandler>();
for (MessageHandler handler : handlers) {
if (filter.apply(handler)) {
matching.add(handler);
}
}
return m... | [
"public",
"List",
"<",
"MessageHandler",
">",
"getHandlers",
"(",
"IPredicate",
"<",
"MessageHandler",
">",
"filter",
")",
"{",
"List",
"<",
"MessageHandler",
">",
"matching",
"=",
"new",
"ArrayList",
"<",
"MessageHandler",
">",
"(",
")",
";",
"for",
"(",
... | used by unit tests | [
"used",
"by",
"unit",
"tests"
] | 60c153fb72868fc31e535852cf0c420022d26c2b | https://github.com/bennidi/mbassador/blob/60c153fb72868fc31e535852cf0c420022d26c2b/src/main/java/net/engio/mbassy/listener/MessageListener.java#L73-L81 |
120,953 | salesforce/Argus | ArgusCore/src/main/java/com/salesforce/dva/argus/service/callback/Pool.java | Pool.borrowObject | public T borrowObject() {
T object;
if ((object = pool.poll()) == null) {
object = createObject();
}
return object;
} | java | public T borrowObject() {
T object;
if ((object = pool.poll()) == null) {
object = createObject();
}
return object;
} | [
"public",
"T",
"borrowObject",
"(",
")",
"{",
"T",
"object",
";",
"if",
"(",
"(",
"object",
"=",
"pool",
".",
"poll",
"(",
")",
")",
"==",
"null",
")",
"{",
"object",
"=",
"createObject",
"(",
")",
";",
"}",
"return",
"object",
";",
"}"
] | Gets the next free object from the pool. If the pool doesn't contain any objects,
a new object will be created and given to the caller of this method back.
@return T borrowed object | [
"Gets",
"the",
"next",
"free",
"object",
"from",
"the",
"pool",
".",
"If",
"the",
"pool",
"doesn",
"t",
"contain",
"any",
"objects",
"a",
"new",
"object",
"will",
"be",
"created",
"and",
"given",
"to",
"the",
"caller",
"of",
"this",
"method",
"back",
"... | 121b59a268da264316cded6a3e9271366a23cd86 | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusCore/src/main/java/com/salesforce/dva/argus/service/callback/Pool.java#L84-L91 |
120,954 | salesforce/Argus | ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/business/oauth/AuthRequestHelper.java | AuthRequestHelper.validateAuthorizationRequest | public static boolean validateAuthorizationRequest(AuthRequestDto authRequestDto, OAuthApplicationDto oAuthApplicationDto) throws OAuthException {
if (StringUtils.isNotBlank(oAuthApplicationDto.getClientId()) && oAuthApplicationDto.getClientId().equals(authRequestDto.getClientId())) {
try {
... | java | public static boolean validateAuthorizationRequest(AuthRequestDto authRequestDto, OAuthApplicationDto oAuthApplicationDto) throws OAuthException {
if (StringUtils.isNotBlank(oAuthApplicationDto.getClientId()) && oAuthApplicationDto.getClientId().equals(authRequestDto.getClientId())) {
try {
... | [
"public",
"static",
"boolean",
"validateAuthorizationRequest",
"(",
"AuthRequestDto",
"authRequestDto",
",",
"OAuthApplicationDto",
"oAuthApplicationDto",
")",
"throws",
"OAuthException",
"{",
"if",
"(",
"StringUtils",
".",
"isNotBlank",
"(",
"oAuthApplicationDto",
".",
"... | Validates Authorization Request
@param authRequestDto Given Application DTO properties
@param oAuthApplicationDto Expected Application DTO properties
@return Boolean or Exception based on Validation
@throws OAuthException Exception related to OAuth | [
"Validates",
"Authorization",
"Request"
] | 121b59a268da264316cded6a3e9271366a23cd86 | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/business/oauth/AuthRequestHelper.java#L69-L87 |
120,955 | salesforce/Argus | ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/business/oauth/AuthRequestHelper.java | AuthRequestHelper.generateAuthorizationCode | public static String generateAuthorizationCode() {
StringBuilder buf = new StringBuilder(AUTHORIZATION_CODE_LENGTH);
SecureRandom rand = new SecureRandom();
for (int i = 0; i < AUTHORIZATION_CODE_LENGTH; i++) {
buf.append(allowedCharacters[rand.nextInt(allowedCharacters.length)]);
... | java | public static String generateAuthorizationCode() {
StringBuilder buf = new StringBuilder(AUTHORIZATION_CODE_LENGTH);
SecureRandom rand = new SecureRandom();
for (int i = 0; i < AUTHORIZATION_CODE_LENGTH; i++) {
buf.append(allowedCharacters[rand.nextInt(allowedCharacters.length)]);
... | [
"public",
"static",
"String",
"generateAuthorizationCode",
"(",
")",
"{",
"StringBuilder",
"buf",
"=",
"new",
"StringBuilder",
"(",
"AUTHORIZATION_CODE_LENGTH",
")",
";",
"SecureRandom",
"rand",
"=",
"new",
"SecureRandom",
"(",
")",
";",
"for",
"(",
"int",
"i",
... | Generated Unique Authorization Code
@return Generated Authorization Code | [
"Generated",
"Unique",
"Authorization",
"Code"
] | 121b59a268da264316cded6a3e9271366a23cd86 | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/business/oauth/AuthRequestHelper.java#L93-L100 |
120,956 | salesforce/Argus | ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/business/oauth/AuthRequestHelper.java | AuthRequestHelper.validateTokenRequest | public static boolean validateTokenRequest(TokenRequestDto tokenRequestDto, OAuthApplicationDto oAuthApplicationDto) {
// basic check
try {
String decodedRedirectUri = java.net.URLDecoder.decode(tokenRequestDto.getRedirectUri(), "UTF-8");
if (StringUtils.isNotBlank(oAuthApplicati... | java | public static boolean validateTokenRequest(TokenRequestDto tokenRequestDto, OAuthApplicationDto oAuthApplicationDto) {
// basic check
try {
String decodedRedirectUri = java.net.URLDecoder.decode(tokenRequestDto.getRedirectUri(), "UTF-8");
if (StringUtils.isNotBlank(oAuthApplicati... | [
"public",
"static",
"boolean",
"validateTokenRequest",
"(",
"TokenRequestDto",
"tokenRequestDto",
",",
"OAuthApplicationDto",
"oAuthApplicationDto",
")",
"{",
"// basic check",
"try",
"{",
"String",
"decodedRedirectUri",
"=",
"java",
".",
"net",
".",
"URLDecoder",
".",
... | Validates Token Request
@param tokenRequestDto Given Application DTO properties
@param oAuthApplicationDto Expected Application DTO properties
@return Returns boolean or OAuth Exception | [
"Validates",
"Token",
"Request"
] | 121b59a268da264316cded6a3e9271366a23cd86 | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/business/oauth/AuthRequestHelper.java#L109-L134 |
120,957 | salesforce/Argus | ArgusCore/src/main/java/com/salesforce/dva/argus/service/metric/transform/MetricZipperTransform.java | MetricZipperTransform.zip | public List<Metric> zip(List<Metric> metrics, Metric baseMetric) {
SystemAssert.requireArgument(baseMetric != null, "Zipper transform requires base metric as second param!");
List<Metric> zippedMetrics = new ArrayList<Metric>();
Map<Long, Double> baseDatapoints = baseMetric.getDatapoints();
... | java | public List<Metric> zip(List<Metric> metrics, Metric baseMetric) {
SystemAssert.requireArgument(baseMetric != null, "Zipper transform requires base metric as second param!");
List<Metric> zippedMetrics = new ArrayList<Metric>();
Map<Long, Double> baseDatapoints = baseMetric.getDatapoints();
... | [
"public",
"List",
"<",
"Metric",
">",
"zip",
"(",
"List",
"<",
"Metric",
">",
"metrics",
",",
"Metric",
"baseMetric",
")",
"{",
"SystemAssert",
".",
"requireArgument",
"(",
"baseMetric",
"!=",
"null",
",",
"\"Zipper transform requires base metric as second param!\""... | Merges a list of metrics.
@param metrics The metrics to merge.
@param baseMetric The base metric.
@return The merged metrics. | [
"Merges",
"a",
"list",
"of",
"metrics",
"."
] | 121b59a268da264316cded6a3e9271366a23cd86 | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusCore/src/main/java/com/salesforce/dva/argus/service/metric/transform/MetricZipperTransform.java#L107-L121 |
120,958 | salesforce/Argus | ArgusCore/src/main/java/com/salesforce/dva/argus/service/metric/transform/MetricZipperTransform.java | MetricZipperTransform.zip | public Map<Long, Double> zip(Map<Long, Double> originalDatapoints, Map<Long, Double> baseDatapoints) {
SystemAssert.requireArgument(baseDatapoints != null && !baseDatapoints.isEmpty(),
"Zipper transform requires valid baseDatapoints from base metric!");
Map<Long, Double> zippedDP = new Hash... | java | public Map<Long, Double> zip(Map<Long, Double> originalDatapoints, Map<Long, Double> baseDatapoints) {
SystemAssert.requireArgument(baseDatapoints != null && !baseDatapoints.isEmpty(),
"Zipper transform requires valid baseDatapoints from base metric!");
Map<Long, Double> zippedDP = new Hash... | [
"public",
"Map",
"<",
"Long",
",",
"Double",
">",
"zip",
"(",
"Map",
"<",
"Long",
",",
"Double",
">",
"originalDatapoints",
",",
"Map",
"<",
"Long",
",",
"Double",
">",
"baseDatapoints",
")",
"{",
"SystemAssert",
".",
"requireArgument",
"(",
"baseDatapoint... | Merges data points.
@param originalDatapoints The original data points.
@param baseDatapoints The base data points.
@return The merged data points. | [
"Merges",
"data",
"points",
"."
] | 121b59a268da264316cded6a3e9271366a23cd86 | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusCore/src/main/java/com/salesforce/dva/argus/service/metric/transform/MetricZipperTransform.java#L131-L160 |
120,959 | salesforce/Argus | ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/dto/MethodHelpDto.java | MethodHelpDto.fromMethodClass | public static MethodHelpDto fromMethodClass(String parentPath, Method method) {
String methodName = _getHttpMethod(method);
Path path = method.getAnnotation(Path.class);
Description description = method.getAnnotation(Description.class);
Produces produces = method.getAnnotation(Produces.c... | java | public static MethodHelpDto fromMethodClass(String parentPath, Method method) {
String methodName = _getHttpMethod(method);
Path path = method.getAnnotation(Path.class);
Description description = method.getAnnotation(Description.class);
Produces produces = method.getAnnotation(Produces.c... | [
"public",
"static",
"MethodHelpDto",
"fromMethodClass",
"(",
"String",
"parentPath",
",",
"Method",
"method",
")",
"{",
"String",
"methodName",
"=",
"_getHttpMethod",
"(",
"method",
")",
";",
"Path",
"path",
"=",
"method",
".",
"getAnnotation",
"(",
"Path",
".... | Creates a method help DTO from a method object.
@param parentPath The parent method path.
@param method The method to convert.
@return The method help DTO. | [
"Creates",
"a",
"method",
"help",
"DTO",
"from",
"a",
"method",
"object",
"."
] | 121b59a268da264316cded6a3e9271366a23cd86 | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/dto/MethodHelpDto.java#L168-L197 |
120,960 | salesforce/Argus | ArgusCore/src/main/java/com/salesforce/dva/argus/service/metric/transform/InterpolateTransform.java | InterpolateTransform.putDataPoint | private void putDataPoint(int i, Entry<Long, Double> datapoint) {
timestamps[i] = datapoint.getKey();
values[i] = datapoint.getValue();
} | java | private void putDataPoint(int i, Entry<Long, Double> datapoint) {
timestamps[i] = datapoint.getKey();
values[i] = datapoint.getValue();
} | [
"private",
"void",
"putDataPoint",
"(",
"int",
"i",
",",
"Entry",
"<",
"Long",
",",
"Double",
">",
"datapoint",
")",
"{",
"timestamps",
"[",
"i",
"]",
"=",
"datapoint",
".",
"getKey",
"(",
")",
";",
"values",
"[",
"i",
"]",
"=",
"datapoint",
".",
"... | Puts the next data point of an iterator in the next section of internal buffer.
@param i The index of the iterator.
@param datapoint The last data point returned by that iterator. | [
"Puts",
"the",
"next",
"data",
"point",
"of",
"an",
"iterator",
"in",
"the",
"next",
"section",
"of",
"internal",
"buffer",
"."
] | 121b59a268da264316cded6a3e9271366a23cd86 | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusCore/src/main/java/com/salesforce/dva/argus/service/metric/transform/InterpolateTransform.java#L226-L229 |
120,961 | salesforce/Argus | ArgusCore/src/main/java/com/salesforce/dva/argus/service/metric/transform/InterpolateTransform.java | InterpolateTransform.doesAnyTimeSeriesHaveData | private boolean doesAnyTimeSeriesHaveData() {
for (int i = 0; i < iterators.length; i++) {
if ((timestamps[iterators.length + i]) != MARK_END_TIME_SERIES) {
return true;
}
}
return false;
} | java | private boolean doesAnyTimeSeriesHaveData() {
for (int i = 0; i < iterators.length; i++) {
if ((timestamps[iterators.length + i]) != MARK_END_TIME_SERIES) {
return true;
}
}
return false;
} | [
"private",
"boolean",
"doesAnyTimeSeriesHaveData",
"(",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"iterators",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"(",
"timestamps",
"[",
"iterators",
".",
"length",
"+",
"i",
"]",
"... | Indicates if there are values still to be read from any time series, by inspecting the internal timestamp buffer | [
"Indicates",
"if",
"there",
"are",
"values",
"still",
"to",
"be",
"read",
"from",
"any",
"time",
"series",
"by",
"inspecting",
"the",
"internal",
"timestamp",
"buffer"
] | 121b59a268da264316cded6a3e9271366a23cd86 | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusCore/src/main/java/com/salesforce/dva/argus/service/metric/transform/InterpolateTransform.java#L234-L241 |
120,962 | salesforce/Argus | ArgusCore/src/main/java/com/salesforce/dva/argus/service/metric/transform/InterpolateTransform.java | InterpolateTransform.updateBufferChronologically | private long updateBufferChronologically() {
long minTimestamp = Long.MAX_VALUE;
long timestamp = 0;
// Mark the internal timestamp buffer as done, when we have reached the end of that time series
for (int i = current; i < iterators.length; i++) {
if (timestamps[i] != 0L && timestamps[i + iterators.length] ... | java | private long updateBufferChronologically() {
long minTimestamp = Long.MAX_VALUE;
long timestamp = 0;
// Mark the internal timestamp buffer as done, when we have reached the end of that time series
for (int i = current; i < iterators.length; i++) {
if (timestamps[i] != 0L && timestamps[i + iterators.length] ... | [
"private",
"long",
"updateBufferChronologically",
"(",
")",
"{",
"long",
"minTimestamp",
"=",
"Long",
".",
"MAX_VALUE",
";",
"long",
"timestamp",
"=",
"0",
";",
"// Mark the internal timestamp buffer as done, when we have reached the end of that time series",
"for",
"(",
"i... | Choose smallest timestamp timeseries from the next section, and update the current and next section of that time series | [
"Choose",
"smallest",
"timestamp",
"timeseries",
"from",
"the",
"next",
"section",
"and",
"update",
"the",
"current",
"and",
"next",
"section",
"of",
"that",
"time",
"series"
] | 121b59a268da264316cded6a3e9271366a23cd86 | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusCore/src/main/java/com/salesforce/dva/argus/service/metric/transform/InterpolateTransform.java#L246-L281 |
120,963 | salesforce/Argus | ArgusCore/src/main/java/com/salesforce/dva/argus/service/metric/transform/InterpolateTransform.java | InterpolateTransform.updateCurrentAndNextSectionOfBuffer | private void updateCurrentAndNextSectionOfBuffer(int i) {
int next = iterators.length + i;
timestamps[i] = timestamps[next];
values[i] = values[next];
if (iterators[i].hasNext()) {
putDataPoint(next, (Entry<Long, Double>) iterators[i].next());
} else {
markEndTimeSeries(i);
}
} | java | private void updateCurrentAndNextSectionOfBuffer(int i) {
int next = iterators.length + i;
timestamps[i] = timestamps[next];
values[i] = values[next];
if (iterators[i].hasNext()) {
putDataPoint(next, (Entry<Long, Double>) iterators[i].next());
} else {
markEndTimeSeries(i);
}
} | [
"private",
"void",
"updateCurrentAndNextSectionOfBuffer",
"(",
"int",
"i",
")",
"{",
"int",
"next",
"=",
"iterators",
".",
"length",
"+",
"i",
";",
"timestamps",
"[",
"i",
"]",
"=",
"timestamps",
"[",
"next",
"]",
";",
"values",
"[",
"i",
"]",
"=",
"va... | Makes iterator number i move forward to the next data point in internal buffer
Copies the next datapoint to current datapoint, and uses the iterator to populate the next section
@param i The index of the iterator. | [
"Makes",
"iterator",
"number",
"i",
"move",
"forward",
"to",
"the",
"next",
"data",
"point",
"in",
"internal",
"buffer",
"Copies",
"the",
"next",
"datapoint",
"to",
"current",
"datapoint",
"and",
"uses",
"the",
"iterator",
"to",
"populate",
"the",
"next",
"s... | 121b59a268da264316cded6a3e9271366a23cd86 | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusCore/src/main/java/com/salesforce/dva/argus/service/metric/transform/InterpolateTransform.java#L288-L297 |
120,964 | salesforce/Argus | ArgusCore/src/main/java/com/salesforce/dva/argus/service/metric/transform/InterpolateTransform.java | InterpolateTransform.markEndTimeSeries | private void markEndTimeSeries(int i) {
timestamps[iterators.length + i] = MARK_END_TIME_SERIES;
iterators[i] = null;
} | java | private void markEndTimeSeries(int i) {
timestamps[iterators.length + i] = MARK_END_TIME_SERIES;
iterators[i] = null;
} | [
"private",
"void",
"markEndTimeSeries",
"(",
"int",
"i",
")",
"{",
"timestamps",
"[",
"iterators",
".",
"length",
"+",
"i",
"]",
"=",
"MARK_END_TIME_SERIES",
";",
"iterators",
"[",
"i",
"]",
"=",
"null",
";",
"}"
] | Mark the timestamp buffer as reached the end, if the iterator has reached the end.
@param i The index of the iterator. | [
"Mark",
"the",
"timestamp",
"buffer",
"as",
"reached",
"the",
"end",
"if",
"the",
"iterator",
"has",
"reached",
"the",
"end",
"."
] | 121b59a268da264316cded6a3e9271366a23cd86 | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusCore/src/main/java/com/salesforce/dva/argus/service/metric/transform/InterpolateTransform.java#L303-L306 |
120,965 | salesforce/Argus | ArgusCore/src/main/java/com/salesforce/dva/argus/service/metric/transform/AnomalyDetectionGaussianZScoreTransform.java | AnomalyDetectionGaussianZScoreTransform.calculateAnomalyScore | @Override
public double calculateAnomalyScore(double value) {
double zScore = (value - mean) / Math.sqrt(variance);
//Taking absolute value for a more human-readable anomaly score
return Math.abs(zScore);
} | java | @Override
public double calculateAnomalyScore(double value) {
double zScore = (value - mean) / Math.sqrt(variance);
//Taking absolute value for a more human-readable anomaly score
return Math.abs(zScore);
} | [
"@",
"Override",
"public",
"double",
"calculateAnomalyScore",
"(",
"double",
"value",
")",
"{",
"double",
"zScore",
"=",
"(",
"value",
"-",
"mean",
")",
"/",
"Math",
".",
"sqrt",
"(",
"variance",
")",
";",
"//Taking absolute value for a more human-readable anomaly... | Calculates the z-score of the data point, which measures how many
standard deviations the data point is away from the mean.
@param value the value of the data point
@return the absolute value of the z-score of the data point | [
"Calculates",
"the",
"z",
"-",
"score",
"of",
"the",
"data",
"point",
"which",
"measures",
"how",
"many",
"standard",
"deviations",
"the",
"data",
"point",
"is",
"away",
"from",
"the",
"mean",
"."
] | 121b59a268da264316cded6a3e9271366a23cd86 | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusCore/src/main/java/com/salesforce/dva/argus/service/metric/transform/AnomalyDetectionGaussianZScoreTransform.java#L61-L66 |
120,966 | salesforce/Argus | ArgusSDK/src/main/java/com/salesforce/dva/argus/sdk/ArgusService.java | ArgusService.getInstance | public static ArgusService getInstance(String endpoint, int maxConn, int connTimeout, int connRequestTimeout) throws IOException {
ArgusHttpClient client = new ArgusHttpClient(endpoint, maxConn, connTimeout, connRequestTimeout);
return new ArgusService(client);
} | java | public static ArgusService getInstance(String endpoint, int maxConn, int connTimeout, int connRequestTimeout) throws IOException {
ArgusHttpClient client = new ArgusHttpClient(endpoint, maxConn, connTimeout, connRequestTimeout);
return new ArgusService(client);
} | [
"public",
"static",
"ArgusService",
"getInstance",
"(",
"String",
"endpoint",
",",
"int",
"maxConn",
",",
"int",
"connTimeout",
",",
"int",
"connRequestTimeout",
")",
"throws",
"IOException",
"{",
"ArgusHttpClient",
"client",
"=",
"new",
"ArgusHttpClient",
"(",
"e... | Returns a new instance of the Argus service.
@param endpoint The HTTP endpoint for Argus.
@param maxConn The number of maximum connections. Must be greater than 0.
@param connTimeout The connection timeout in milliseconds. Must be greater than 0.
@param connRequestTimeout The co... | [
"Returns",
"a",
"new",
"instance",
"of",
"the",
"Argus",
"service",
"."
] | 121b59a268da264316cded6a3e9271366a23cd86 | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusSDK/src/main/java/com/salesforce/dva/argus/sdk/ArgusService.java#L103-L107 |
120,967 | salesforce/Argus | ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/AbstractResource.java | AbstractResource.describeEndpoints | protected static List<EndpointHelpDto> describeEndpoints(List<Class<? extends AbstractResource>> resourceClasses) {
List<EndpointHelpDto> result = new LinkedList<>();
if (resourceClasses != null && !resourceClasses.isEmpty()) {
for (Class<? extends AbstractResource> resourceClass : resource... | java | protected static List<EndpointHelpDto> describeEndpoints(List<Class<? extends AbstractResource>> resourceClasses) {
List<EndpointHelpDto> result = new LinkedList<>();
if (resourceClasses != null && !resourceClasses.isEmpty()) {
for (Class<? extends AbstractResource> resourceClass : resource... | [
"protected",
"static",
"List",
"<",
"EndpointHelpDto",
">",
"describeEndpoints",
"(",
"List",
"<",
"Class",
"<",
"?",
"extends",
"AbstractResource",
">",
">",
"resourceClasses",
")",
"{",
"List",
"<",
"EndpointHelpDto",
">",
"result",
"=",
"new",
"LinkedList",
... | Generates a list of endpoint help DTOs used to describe the major service endpoints.
@param resourceClasses The resource classes to describe.
@return The list of endpoint help DTOs. | [
"Generates",
"a",
"list",
"of",
"endpoint",
"help",
"DTOs",
"used",
"to",
"describe",
"the",
"major",
"service",
"endpoints",
"."
] | 121b59a268da264316cded6a3e9271366a23cd86 | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/AbstractResource.java#L85-L98 |
120,968 | salesforce/Argus | ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/AbstractResource.java | AbstractResource.getRemoteUser | public PrincipalUser getRemoteUser(HttpServletRequest req) {
requireArgument(req != null, "Request cannot be null.");
if(req.getHeader(HttpHeaders.AUTHORIZATION) != null) {
PrincipalUser result = null;
Object username = req.getAttribute(AuthFilter.USER_ATTRIBUTE_NAME);
... | java | public PrincipalUser getRemoteUser(HttpServletRequest req) {
requireArgument(req != null, "Request cannot be null.");
if(req.getHeader(HttpHeaders.AUTHORIZATION) != null) {
PrincipalUser result = null;
Object username = req.getAttribute(AuthFilter.USER_ATTRIBUTE_NAME);
... | [
"public",
"PrincipalUser",
"getRemoteUser",
"(",
"HttpServletRequest",
"req",
")",
"{",
"requireArgument",
"(",
"req",
"!=",
"null",
",",
"\"Request cannot be null.\"",
")",
";",
"if",
"(",
"req",
".",
"getHeader",
"(",
"HttpHeaders",
".",
"AUTHORIZATION",
")",
... | Returns the logged in user object.
@param req The HTTP request.
@return The logged in user object. | [
"Returns",
"the",
"logged",
"in",
"user",
"object",
"."
] | 121b59a268da264316cded6a3e9271366a23cd86 | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/AbstractResource.java#L109-L123 |
120,969 | salesforce/Argus | ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/AbstractResource.java | AbstractResource.help | @GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/help")
public Map<String, List<? extends Object>> help() {
Map<String, List<?>> result = new LinkedHashMap<>();
List<EndpointHelpDto> endpoints = describeEndpoints(getEndpoints());
if (endpoints != null && !endpoints.isEmpty()) {
... | java | @GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/help")
public Map<String, List<? extends Object>> help() {
Map<String, List<?>> result = new LinkedHashMap<>();
List<EndpointHelpDto> endpoints = describeEndpoints(getEndpoints());
if (endpoints != null && !endpoints.isEmpty()) {
... | [
"@",
"GET",
"@",
"Produces",
"(",
"MediaType",
".",
"APPLICATION_JSON",
")",
"@",
"Path",
"(",
"\"/help\"",
")",
"public",
"Map",
"<",
"String",
",",
"List",
"<",
"?",
"extends",
"Object",
">",
">",
"help",
"(",
")",
"{",
"Map",
"<",
"String",
",",
... | Returns the help for the endpoint. For the context root, it will return the endpoint help for all major endpoints. For a specific endpoint
it will return the method help for the endpoint.
@return Help object describing the service in JSON format. | [
"Returns",
"the",
"help",
"for",
"the",
"endpoint",
".",
"For",
"the",
"context",
"root",
"it",
"will",
"return",
"the",
"endpoint",
"help",
"for",
"all",
"major",
"endpoints",
".",
"For",
"a",
"specific",
"endpoint",
"it",
"will",
"return",
"the",
"method... | 121b59a268da264316cded6a3e9271366a23cd86 | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/AbstractResource.java#L131-L148 |
120,970 | salesforce/Argus | ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/AbstractResource.java | AbstractResource.describeMethods | protected List<MethodHelpDto> describeMethods() {
List<MethodHelpDto> result = new LinkedList<>();
Path endpointPath = getClass().getAnnotation(Path.class);
for (Method method : getClass().getDeclaredMethods()) {
String parentPath = endpointPath == null ? null : endpointPath.value()... | java | protected List<MethodHelpDto> describeMethods() {
List<MethodHelpDto> result = new LinkedList<>();
Path endpointPath = getClass().getAnnotation(Path.class);
for (Method method : getClass().getDeclaredMethods()) {
String parentPath = endpointPath == null ? null : endpointPath.value()... | [
"protected",
"List",
"<",
"MethodHelpDto",
">",
"describeMethods",
"(",
")",
"{",
"List",
"<",
"MethodHelpDto",
">",
"result",
"=",
"new",
"LinkedList",
"<>",
"(",
")",
";",
"Path",
"endpointPath",
"=",
"getClass",
"(",
")",
".",
"getAnnotation",
"(",
"Pat... | Generates help DTOs for each method on the service interface. The root context shall return a null list. All other endpoints will re-use
this implementation.
@return The service endpoint method help objects. | [
"Generates",
"help",
"DTOs",
"for",
"each",
"method",
"on",
"the",
"service",
"interface",
".",
"The",
"root",
"context",
"shall",
"return",
"a",
"null",
"list",
".",
"All",
"other",
"endpoints",
"will",
"re",
"-",
"use",
"this",
"implementation",
"."
] | 121b59a268da264316cded6a3e9271366a23cd86 | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/AbstractResource.java#L166-L180 |
120,971 | salesforce/Argus | ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/AbstractResource.java | AbstractResource.validateAndGetOwner | protected PrincipalUser validateAndGetOwner(HttpServletRequest req, String ownerName) {
PrincipalUser remoteUser = getRemoteUser(req);
if (ownerName == null || ownerName.isEmpty() || ownerName.equalsIgnoreCase(remoteUser.getUserName())) {
//If ownerName is not present or if it is pres... | java | protected PrincipalUser validateAndGetOwner(HttpServletRequest req, String ownerName) {
PrincipalUser remoteUser = getRemoteUser(req);
if (ownerName == null || ownerName.isEmpty() || ownerName.equalsIgnoreCase(remoteUser.getUserName())) {
//If ownerName is not present or if it is pres... | [
"protected",
"PrincipalUser",
"validateAndGetOwner",
"(",
"HttpServletRequest",
"req",
",",
"String",
"ownerName",
")",
"{",
"PrincipalUser",
"remoteUser",
"=",
"getRemoteUser",
"(",
"req",
")",
";",
"if",
"(",
"ownerName",
"==",
"null",
"||",
"ownerName",
".",
... | Validates the owner name and returns the owner object.
@param req The HTTP request.
@param ownerName Name of the owner. It is optional.
@return The owner object
@throws WebApplicationException Throws exception if owner name does not exist. | [
"Validates",
"the",
"owner",
"name",
"and",
"returns",
"the",
"owner",
"object",
"."
] | 121b59a268da264316cded6a3e9271366a23cd86 | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/AbstractResource.java#L192-L210 |
120,972 | salesforce/Argus | ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/AbstractResource.java | AbstractResource.validateResourceAuthorization | protected void validateResourceAuthorization(HttpServletRequest req, PrincipalUser actualOwner, PrincipalUser currentOwner) {
if (!getRemoteUser(req).isPrivileged() && !actualOwner.equals(currentOwner)) {
throw new WebApplicationException(Status.FORBIDDEN.getReasonPhrase(), Status.FORBIDDEN);
... | java | protected void validateResourceAuthorization(HttpServletRequest req, PrincipalUser actualOwner, PrincipalUser currentOwner) {
if (!getRemoteUser(req).isPrivileged() && !actualOwner.equals(currentOwner)) {
throw new WebApplicationException(Status.FORBIDDEN.getReasonPhrase(), Status.FORBIDDEN);
... | [
"protected",
"void",
"validateResourceAuthorization",
"(",
"HttpServletRequest",
"req",
",",
"PrincipalUser",
"actualOwner",
",",
"PrincipalUser",
"currentOwner",
")",
"{",
"if",
"(",
"!",
"getRemoteUser",
"(",
"req",
")",
".",
"isPrivileged",
"(",
")",
"&&",
"!",... | Validates the resource authorization. Throws exception if the user is not authorized to access the resource.
@param req The HTTP request.
@param actualOwner The owner of the resource.
@param currentOwner The logged in user.
@throws WebApplicationException Throws exception if user is not authorize... | [
"Validates",
"the",
"resource",
"authorization",
".",
"Throws",
"exception",
"if",
"the",
"user",
"is",
"not",
"authorized",
"to",
"access",
"the",
"resource",
"."
] | 121b59a268da264316cded6a3e9271366a23cd86 | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/AbstractResource.java#L221-L225 |
120,973 | salesforce/Argus | ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/AbstractResource.java | AbstractResource.validatePrivilegedUser | protected void validatePrivilegedUser(HttpServletRequest req) {
if (!getRemoteUser(req).isPrivileged()) {
throw new WebApplicationException(Status.FORBIDDEN.getReasonPhrase(), Status.FORBIDDEN);
}
} | java | protected void validatePrivilegedUser(HttpServletRequest req) {
if (!getRemoteUser(req).isPrivileged()) {
throw new WebApplicationException(Status.FORBIDDEN.getReasonPhrase(), Status.FORBIDDEN);
}
} | [
"protected",
"void",
"validatePrivilegedUser",
"(",
"HttpServletRequest",
"req",
")",
"{",
"if",
"(",
"!",
"getRemoteUser",
"(",
"req",
")",
".",
"isPrivileged",
"(",
")",
")",
"{",
"throw",
"new",
"WebApplicationException",
"(",
"Status",
".",
"FORBIDDEN",
".... | Validates that the user making the request is a privileged user.
@param req - Http Request
@throws WebApplicationException Throws exception if user is not a privileged user. | [
"Validates",
"that",
"the",
"user",
"making",
"the",
"request",
"is",
"a",
"privileged",
"user",
"."
] | 121b59a268da264316cded6a3e9271366a23cd86 | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/AbstractResource.java#L234-L238 |
120,974 | salesforce/Argus | ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/AbstractResource.java | AbstractResource.copyProperties | protected void copyProperties(Object dest, Object source) {
try {
BeanUtils.copyProperties(dest, source);
} catch (Exception e) {
String errorMessage = MessageFormat.format("M:{0};;E:{1}",
e.getCause().getMessage(), e.toString());
throw new WebAppl... | java | protected void copyProperties(Object dest, Object source) {
try {
BeanUtils.copyProperties(dest, source);
} catch (Exception e) {
String errorMessage = MessageFormat.format("M:{0};;E:{1}",
e.getCause().getMessage(), e.toString());
throw new WebAppl... | [
"protected",
"void",
"copyProperties",
"(",
"Object",
"dest",
",",
"Object",
"source",
")",
"{",
"try",
"{",
"BeanUtils",
".",
"copyProperties",
"(",
"dest",
",",
"source",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"String",
"errorMessage",
... | Copies properties.
@param dest The object to which the properties will be copied.
@param source The object whose properties are copied
@throws WebApplicationException Throws exception if beanutils encounter a problem. | [
"Copies",
"properties",
"."
] | 121b59a268da264316cded6a3e9271366a23cd86 | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/AbstractResource.java#L248-L256 |
120,975 | salesforce/Argus | ArgusCore/src/main/java/com/salesforce/dva/argus/entity/Metric.java | Metric.setDatapoints | public void setDatapoints(Map<Long, Double> datapoints) {
_datapoints.clear();
if (datapoints != null) {
_datapoints.putAll(datapoints);
}
} | java | public void setDatapoints(Map<Long, Double> datapoints) {
_datapoints.clear();
if (datapoints != null) {
_datapoints.putAll(datapoints);
}
} | [
"public",
"void",
"setDatapoints",
"(",
"Map",
"<",
"Long",
",",
"Double",
">",
"datapoints",
")",
"{",
"_datapoints",
".",
"clear",
"(",
")",
";",
"if",
"(",
"datapoints",
"!=",
"null",
")",
"{",
"_datapoints",
".",
"putAll",
"(",
"datapoints",
")",
"... | Deletes the current set of data points and replaces them with a new set.
@param datapoints The new set of data points. If null or empty, only the deletion of the current set of data points is performed. | [
"Deletes",
"the",
"current",
"set",
"of",
"data",
"points",
"and",
"replaces",
"them",
"with",
"a",
"new",
"set",
"."
] | 121b59a268da264316cded6a3e9271366a23cd86 | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusCore/src/main/java/com/salesforce/dva/argus/entity/Metric.java#L157-L162 |
120,976 | salesforce/Argus | ArgusCore/src/main/java/com/salesforce/dva/argus/entity/Metric.java | Metric.addDatapoints | public void addDatapoints(Map<Long, Double> datapoints) {
if (datapoints != null) {
_datapoints.putAll(datapoints);
}
} | java | public void addDatapoints(Map<Long, Double> datapoints) {
if (datapoints != null) {
_datapoints.putAll(datapoints);
}
} | [
"public",
"void",
"addDatapoints",
"(",
"Map",
"<",
"Long",
",",
"Double",
">",
"datapoints",
")",
"{",
"if",
"(",
"datapoints",
"!=",
"null",
")",
"{",
"_datapoints",
".",
"putAll",
"(",
"datapoints",
")",
";",
"}",
"}"
] | Adds the current set of data points to the current set.
@param datapoints The set of data points to add. If null or empty, only the deletion of the current set of data points is performed. | [
"Adds",
"the",
"current",
"set",
"of",
"data",
"points",
"to",
"the",
"current",
"set",
"."
] | 121b59a268da264316cded6a3e9271366a23cd86 | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusCore/src/main/java/com/salesforce/dva/argus/entity/Metric.java#L173-L177 |
120,977 | salesforce/Argus | ArgusCore/src/main/java/com/salesforce/dva/argus/entity/Metric.java | Metric.minimumExistingDatapoints | public void minimumExistingDatapoints(Map<Long, Double> datapoints) {
if (datapoints != null) {
for(Entry<Long, Double> entry : datapoints.entrySet()){
Double existingValue = _datapoints.get(entry.getKey());
if(existingValue == null){
_datapoints.put(entry.getKey(), entry.getValue());
} else if (... | java | public void minimumExistingDatapoints(Map<Long, Double> datapoints) {
if (datapoints != null) {
for(Entry<Long, Double> entry : datapoints.entrySet()){
Double existingValue = _datapoints.get(entry.getKey());
if(existingValue == null){
_datapoints.put(entry.getKey(), entry.getValue());
} else if (... | [
"public",
"void",
"minimumExistingDatapoints",
"(",
"Map",
"<",
"Long",
",",
"Double",
">",
"datapoints",
")",
"{",
"if",
"(",
"datapoints",
"!=",
"null",
")",
"{",
"for",
"(",
"Entry",
"<",
"Long",
",",
"Double",
">",
"entry",
":",
"datapoints",
".",
... | If current set already has a value at that timestamp then sets the minimum of the two values for that timestamp at coinciding cutoff boundary,
else adds the new data points to the current set.
@param datapoints The set of data points to add. If null or empty, no operation is performed. | [
"If",
"current",
"set",
"already",
"has",
"a",
"value",
"at",
"that",
"timestamp",
"then",
"sets",
"the",
"minimum",
"of",
"the",
"two",
"values",
"for",
"that",
"timestamp",
"at",
"coinciding",
"cutoff",
"boundary",
"else",
"adds",
"the",
"new",
"data",
"... | 121b59a268da264316cded6a3e9271366a23cd86 | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusCore/src/main/java/com/salesforce/dva/argus/entity/Metric.java#L207-L219 |
120,978 | salesforce/Argus | ArgusCore/src/main/java/com/salesforce/dva/argus/entity/Metric.java | Metric.averageExistingDatapoints | public void averageExistingDatapoints(Map<Long, Double> datapoints) {
if (datapoints != null) {
for(Entry<Long, Double> entry : datapoints.entrySet()){
_datapoints.put(entry.getKey(), entry.getValue());
}
}
} | java | public void averageExistingDatapoints(Map<Long, Double> datapoints) {
if (datapoints != null) {
for(Entry<Long, Double> entry : datapoints.entrySet()){
_datapoints.put(entry.getKey(), entry.getValue());
}
}
} | [
"public",
"void",
"averageExistingDatapoints",
"(",
"Map",
"<",
"Long",
",",
"Double",
">",
"datapoints",
")",
"{",
"if",
"(",
"datapoints",
"!=",
"null",
")",
"{",
"for",
"(",
"Entry",
"<",
"Long",
",",
"Double",
">",
"entry",
":",
"datapoints",
".",
... | If current set already has a value at that timestamp then replace the latest average value for that timestamp at coinciding cutoff boundary,
else adds the new data points to the current set.
@param datapoints The set of data points to add. If null or empty, no operation is performed. | [
"If",
"current",
"set",
"already",
"has",
"a",
"value",
"at",
"that",
"timestamp",
"then",
"replace",
"the",
"latest",
"average",
"value",
"for",
"that",
"timestamp",
"at",
"coinciding",
"cutoff",
"boundary",
"else",
"adds",
"the",
"new",
"data",
"points",
"... | 121b59a268da264316cded6a3e9271366a23cd86 | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusCore/src/main/java/com/salesforce/dva/argus/entity/Metric.java#L248-L255 |
120,979 | salesforce/Argus | ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/listeners/ArgusWebServletListener.java | ArgusWebServletListener.getSystem | public static SystemMain getSystem() {
try {
_gate.await();
return _system;
} catch (InterruptedException ex) {
_logger.warn("Interrupted while waiting for startup to complete.");
return null;
}
} | java | public static SystemMain getSystem() {
try {
_gate.await();
return _system;
} catch (InterruptedException ex) {
_logger.warn("Interrupted while waiting for startup to complete.");
return null;
}
} | [
"public",
"static",
"SystemMain",
"getSystem",
"(",
")",
"{",
"try",
"{",
"_gate",
".",
"await",
"(",
")",
";",
"return",
"_system",
";",
"}",
"catch",
"(",
"InterruptedException",
"ex",
")",
"{",
"_logger",
".",
"warn",
"(",
"\"Interrupted while waiting for... | Returns the system main instance.
@return The system main instance or null if the system was interrupted during initialization. | [
"Returns",
"the",
"system",
"main",
"instance",
"."
] | 121b59a268da264316cded6a3e9271366a23cd86 | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/listeners/ArgusWebServletListener.java#L61-L69 |
120,980 | salesforce/Argus | ArgusCore/src/main/java/com/salesforce/dva/argus/service/metric/transform/AnomalyDetectionKMeansTransform.java | AnomalyDetectionKMeansTransform.setMeanDistancesToCentroids | private void setMeanDistancesToCentroids() {
meanDistancesToCentroids = new HashMap<>();
for (int i = 0; i < clusterCentroids.numInstances(); i++) { //For each centroid
int countAssignedInstances = 0;
double sumDistancesToCentroid = 0.0;
Instance centroidInstance =... | java | private void setMeanDistancesToCentroids() {
meanDistancesToCentroids = new HashMap<>();
for (int i = 0; i < clusterCentroids.numInstances(); i++) { //For each centroid
int countAssignedInstances = 0;
double sumDistancesToCentroid = 0.0;
Instance centroidInstance =... | [
"private",
"void",
"setMeanDistancesToCentroids",
"(",
")",
"{",
"meanDistancesToCentroids",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"clusterCentroids",
".",
"numInstances",
"(",
")",
";",
"i",
"++",
"... | For each cluster, caches the mean distance from data points in the
cluster to the cluster centroid. Mean distances are used later in
anomaly score calculations. | [
"For",
"each",
"cluster",
"caches",
"the",
"mean",
"distance",
"from",
"data",
"points",
"in",
"the",
"cluster",
"to",
"the",
"cluster",
"centroid",
".",
"Mean",
"distances",
"are",
"used",
"later",
"in",
"anomaly",
"score",
"calculations",
"."
] | 121b59a268da264316cded6a3e9271366a23cd86 | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusCore/src/main/java/com/salesforce/dva/argus/service/metric/transform/AnomalyDetectionKMeansTransform.java#L137-L155 |
120,981 | salesforce/Argus | ArgusCore/src/main/java/com/salesforce/dva/argus/service/metric/transform/AnomalyDetectionKMeansTransform.java | AnomalyDetectionKMeansTransform.calculateAnomalyScore | @Override
public double calculateAnomalyScore(double value) {
int instanceIndex = metricDataValues.indexOf(value);
Instance valueInstance = trainingData.instance(instanceIndex);
//Centroid that is assigned to valueInstance
Instance centroidInstance = clusterCentroids.instance(centroi... | java | @Override
public double calculateAnomalyScore(double value) {
int instanceIndex = metricDataValues.indexOf(value);
Instance valueInstance = trainingData.instance(instanceIndex);
//Centroid that is assigned to valueInstance
Instance centroidInstance = clusterCentroids.instance(centroi... | [
"@",
"Override",
"public",
"double",
"calculateAnomalyScore",
"(",
"double",
"value",
")",
"{",
"int",
"instanceIndex",
"=",
"metricDataValues",
".",
"indexOf",
"(",
"value",
")",
";",
"Instance",
"valueInstance",
"=",
"trainingData",
".",
"instance",
"(",
"inst... | Calculates the relative distance of the data point to the centroid,
which is the ratio of the distance of the point to the centroid to
the mean distance of all points in that cluster to the centroid.
Anomaly score here is defined as how "far" a data point is from its
assigned centroid. Relative distance is used to ens... | [
"Calculates",
"the",
"relative",
"distance",
"of",
"the",
"data",
"point",
"to",
"the",
"centroid",
"which",
"is",
"the",
"ratio",
"of",
"the",
"distance",
"of",
"the",
"point",
"to",
"the",
"centroid",
"to",
"the",
"mean",
"distance",
"of",
"all",
"points... | 121b59a268da264316cded6a3e9271366a23cd86 | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusCore/src/main/java/com/salesforce/dva/argus/service/metric/transform/AnomalyDetectionKMeansTransform.java#L202-L216 |
120,982 | salesforce/Argus | ArgusCore/src/main/java/com/salesforce/dva/argus/service/tsdb/CachedTSDBService.java | CachedTSDBService.fractureMetricIntoDayBoundary | private Map<String, List<Metric>> fractureMetricIntoDayBoundary(List<Metric> metrics, MetricQuery query) {
Map<String, List<Metric>> cacheMap = new TreeMap<String, List<Metric>>();
String cacheKey;
Long nextTimeStampDay;
Long previousTimeStampDay;
Long startTimeStampDay = query.g... | java | private Map<String, List<Metric>> fractureMetricIntoDayBoundary(List<Metric> metrics, MetricQuery query) {
Map<String, List<Metric>> cacheMap = new TreeMap<String, List<Metric>>();
String cacheKey;
Long nextTimeStampDay;
Long previousTimeStampDay;
Long startTimeStampDay = query.g... | [
"private",
"Map",
"<",
"String",
",",
"List",
"<",
"Metric",
">",
">",
"fractureMetricIntoDayBoundary",
"(",
"List",
"<",
"Metric",
">",
"metrics",
",",
"MetricQuery",
"query",
")",
"{",
"Map",
"<",
"String",
",",
"List",
"<",
"Metric",
">",
">",
"cacheM... | From metric query and metric tag generate the cache keys. Fracture the metric data points into each key which stores one day worth of data.
@param metrics The metrics to generate cache keys for.
@param query The query to generate cache keys for.
@return The mapping of fractured metrics to their corresponding... | [
"From",
"metric",
"query",
"and",
"metric",
"tag",
"generate",
"the",
"cache",
"keys",
".",
"Fracture",
"the",
"metric",
"data",
"points",
"into",
"each",
"key",
"which",
"stores",
"one",
"day",
"worth",
"of",
"data",
"."
] | 121b59a268da264316cded6a3e9271366a23cd86 | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusCore/src/main/java/com/salesforce/dva/argus/service/tsdb/CachedTSDBService.java#L215-L269 |
120,983 | salesforce/Argus | ArgusCore/src/main/java/com/salesforce/dva/argus/service/tsdb/CachedTSDBService.java | CachedTSDBService.constructMetricQueryKey | private String constructMetricQueryKey(Long startTimeStampBoundary, Metric metric, MetricQuery query) {
StringBuilder sb = new StringBuilder();
sb.append(startTimeStampBoundary).append(":");
sb.append(query.getNamespace()).append(":");
sb.append(query.getScope()).append(":");
sb... | java | private String constructMetricQueryKey(Long startTimeStampBoundary, Metric metric, MetricQuery query) {
StringBuilder sb = new StringBuilder();
sb.append(startTimeStampBoundary).append(":");
sb.append(query.getNamespace()).append(":");
sb.append(query.getScope()).append(":");
sb... | [
"private",
"String",
"constructMetricQueryKey",
"(",
"Long",
"startTimeStampBoundary",
",",
"Metric",
"metric",
",",
"MetricQuery",
"query",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"sb",
".",
"append",
"(",
"startTimeStampBound... | Constructs a cache key from start time stamp boundary, returned metric tags and metric query.
@param startTimeStampBoundary The start time stamp boundary.
@param metric The metric to construct the cache key for.
@param query The query to use to construct the cache key.
@retur... | [
"Constructs",
"a",
"cache",
"key",
"from",
"start",
"time",
"stamp",
"boundary",
"returned",
"metric",
"tags",
"and",
"metric",
"query",
"."
] | 121b59a268da264316cded6a3e9271366a23cd86 | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusCore/src/main/java/com/salesforce/dva/argus/service/tsdb/CachedTSDBService.java#L280-L296 |
120,984 | salesforce/Argus | ArgusSDK/src/main/java/com/salesforce/dva/argus/sdk/AlertService.java | AlertService.getAlertsMeta | public List<Alert> getAlertsMeta(boolean includeSharedAlerts) throws IOException, TokenExpiredException {
String requestUrl = RESOURCE + "/meta?shared=" + includeSharedAlerts;
ArgusResponse response = getClient().executeHttpRequest(ArgusHttpClient.RequestType.GET, requestUrl, null);
assertValidRes... | java | public List<Alert> getAlertsMeta(boolean includeSharedAlerts) throws IOException, TokenExpiredException {
String requestUrl = RESOURCE + "/meta?shared=" + includeSharedAlerts;
ArgusResponse response = getClient().executeHttpRequest(ArgusHttpClient.RequestType.GET, requestUrl, null);
assertValidRes... | [
"public",
"List",
"<",
"Alert",
">",
"getAlertsMeta",
"(",
"boolean",
"includeSharedAlerts",
")",
"throws",
"IOException",
",",
"TokenExpiredException",
"{",
"String",
"requestUrl",
"=",
"RESOURCE",
"+",
"\"/meta?shared=\"",
"+",
"includeSharedAlerts",
";",
"ArgusResp... | Returns all alerts via the meta endpoint.
@param includeSharedAlerts flag for shared alerts
@return The list of alerts. Will never be null, but may be empty.
@throws IOException If the server cannot be reached.
@throws TokenExpiredException If the token sent along with the request has expired | [
"Returns",
"all",
"alerts",
"via",
"the",
"meta",
"endpoint",
"."
] | 121b59a268da264316cded6a3e9271366a23cd86 | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusSDK/src/main/java/com/salesforce/dva/argus/sdk/AlertService.java#L109-L115 |
120,985 | salesforce/Argus | ArgusSDK/src/main/java/com/salesforce/dva/argus/sdk/AlertService.java | AlertService.getAlert | public Alert getAlert(BigInteger alertId) throws IOException, TokenExpiredException {
String requestUrl = RESOURCE + "/" + alertId.toString();
ArgusResponse response = getClient().executeHttpRequest(ArgusHttpClient.RequestType.GET, requestUrl, null);
assertValidResponse(response, requestUrl);
... | java | public Alert getAlert(BigInteger alertId) throws IOException, TokenExpiredException {
String requestUrl = RESOURCE + "/" + alertId.toString();
ArgusResponse response = getClient().executeHttpRequest(ArgusHttpClient.RequestType.GET, requestUrl, null);
assertValidResponse(response, requestUrl);
... | [
"public",
"Alert",
"getAlert",
"(",
"BigInteger",
"alertId",
")",
"throws",
"IOException",
",",
"TokenExpiredException",
"{",
"String",
"requestUrl",
"=",
"RESOURCE",
"+",
"\"/\"",
"+",
"alertId",
".",
"toString",
"(",
")",
";",
"ArgusResponse",
"response",
"=",... | Returns the alert for the given ID.
@param alertId The alert ID.
@return The alert for the given ID. May be null.
@throws IOException If the server cannot be reached.
@throws TokenExpiredException If the token sent along with the request has expired | [
"Returns",
"the",
"alert",
"for",
"the",
"given",
"ID",
"."
] | 121b59a268da264316cded6a3e9271366a23cd86 | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusSDK/src/main/java/com/salesforce/dva/argus/sdk/AlertService.java#L127-L133 |
120,986 | salesforce/Argus | ArgusSDK/src/main/java/com/salesforce/dva/argus/sdk/AlertService.java | AlertService.getNotifications | public List<Notification> getNotifications(BigInteger alertId) throws IOException, TokenExpiredException {
String requestUrl = RESOURCE + "/" + alertId.toString() + "/notifications";
ArgusResponse response = getClient().executeHttpRequest(ArgusHttpClient.RequestType.GET, requestUrl, null);
asse... | java | public List<Notification> getNotifications(BigInteger alertId) throws IOException, TokenExpiredException {
String requestUrl = RESOURCE + "/" + alertId.toString() + "/notifications";
ArgusResponse response = getClient().executeHttpRequest(ArgusHttpClient.RequestType.GET, requestUrl, null);
asse... | [
"public",
"List",
"<",
"Notification",
">",
"getNotifications",
"(",
"BigInteger",
"alertId",
")",
"throws",
"IOException",
",",
"TokenExpiredException",
"{",
"String",
"requestUrl",
"=",
"RESOURCE",
"+",
"\"/\"",
"+",
"alertId",
".",
"toString",
"(",
")",
"+",
... | Returns all notifications for the given alert ID.
@param alertId The alert ID.
@return The list of notifications for the alert. Will never be null, but may be empty.
@throws IOException If the server cannot be reached.
@throws TokenExpiredException If the token sent along with the request has expired | [
"Returns",
"all",
"notifications",
"for",
"the",
"given",
"alert",
"ID",
"."
] | 121b59a268da264316cded6a3e9271366a23cd86 | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusSDK/src/main/java/com/salesforce/dva/argus/sdk/AlertService.java#L145-L151 |
120,987 | salesforce/Argus | ArgusSDK/src/main/java/com/salesforce/dva/argus/sdk/AlertService.java | AlertService.updateAlert | public Alert updateAlert(BigInteger alertId, Alert alert) throws IOException, TokenExpiredException {
String requestUrl = RESOURCE + "/" + alertId.toString();
ArgusResponse response = getClient().executeHttpRequest(ArgusHttpClient.RequestType.PUT, requestUrl, alert);
assertValidResponse(respons... | java | public Alert updateAlert(BigInteger alertId, Alert alert) throws IOException, TokenExpiredException {
String requestUrl = RESOURCE + "/" + alertId.toString();
ArgusResponse response = getClient().executeHttpRequest(ArgusHttpClient.RequestType.PUT, requestUrl, alert);
assertValidResponse(respons... | [
"public",
"Alert",
"updateAlert",
"(",
"BigInteger",
"alertId",
",",
"Alert",
"alert",
")",
"throws",
"IOException",
",",
"TokenExpiredException",
"{",
"String",
"requestUrl",
"=",
"RESOURCE",
"+",
"\"/\"",
"+",
"alertId",
".",
"toString",
"(",
")",
";",
"Argu... | Updates an existing alert.
@param alertId The alert ID.
@param alert The updated alert information.
@return The updated alert.
@throws IOException If the server cannot be reached.
@throws TokenExpiredException If the token sent along with the request has expired | [
"Updates",
"an",
"existing",
"alert",
"."
] | 121b59a268da264316cded6a3e9271366a23cd86 | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusSDK/src/main/java/com/salesforce/dva/argus/sdk/AlertService.java#L277-L283 |
120,988 | salesforce/Argus | ArgusSDK/src/main/java/com/salesforce/dva/argus/sdk/AlertService.java | AlertService.updateNotification | public Notification updateNotification(BigInteger alertId, BigInteger notificationId, Notification notification) throws IOException, TokenExpiredException {
String requestUrl = RESOURCE + "/" + alertId.toString() + "/notifications/" + notificationId.toString();
ArgusResponse response = getClient().execu... | java | public Notification updateNotification(BigInteger alertId, BigInteger notificationId, Notification notification) throws IOException, TokenExpiredException {
String requestUrl = RESOURCE + "/" + alertId.toString() + "/notifications/" + notificationId.toString();
ArgusResponse response = getClient().execu... | [
"public",
"Notification",
"updateNotification",
"(",
"BigInteger",
"alertId",
",",
"BigInteger",
"notificationId",
",",
"Notification",
"notification",
")",
"throws",
"IOException",
",",
"TokenExpiredException",
"{",
"String",
"requestUrl",
"=",
"RESOURCE",
"+",
"\"/\""... | Updates an existing notification.
@param alertId The ID of the alert that owns the notification.
@param notificationId The ID of the notification to update.
@param notification The updated notification information.
@return The updated notification.
@throws IOException If the server cannot be rea... | [
"Updates",
"an",
"existing",
"notification",
"."
] | 121b59a268da264316cded6a3e9271366a23cd86 | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusSDK/src/main/java/com/salesforce/dva/argus/sdk/AlertService.java#L297-L303 |
120,989 | salesforce/Argus | ArgusSDK/src/main/java/com/salesforce/dva/argus/sdk/AlertService.java | AlertService.updateTrigger | public Trigger updateTrigger(BigInteger alertId, BigInteger triggerId, Trigger trigger) throws IOException, TokenExpiredException {
String requestUrl = RESOURCE + "/" + alertId.toString() + "/triggers/" + triggerId.toString();
ArgusResponse response = getClient().executeHttpRequest(ArgusHttpClient.Reque... | java | public Trigger updateTrigger(BigInteger alertId, BigInteger triggerId, Trigger trigger) throws IOException, TokenExpiredException {
String requestUrl = RESOURCE + "/" + alertId.toString() + "/triggers/" + triggerId.toString();
ArgusResponse response = getClient().executeHttpRequest(ArgusHttpClient.Reque... | [
"public",
"Trigger",
"updateTrigger",
"(",
"BigInteger",
"alertId",
",",
"BigInteger",
"triggerId",
",",
"Trigger",
"trigger",
")",
"throws",
"IOException",
",",
"TokenExpiredException",
"{",
"String",
"requestUrl",
"=",
"RESOURCE",
"+",
"\"/\"",
"+",
"alertId",
"... | Updates an existing trigger.
@param alertId The ID of the alert owning the trigger.
@param triggerId The ID of the trigger to update.
@param trigger The updated trigger information.
@return The updated trigger.
@throws IOException If the server cannot be reached.
@throws TokenExpiredException If t... | [
"Updates",
"an",
"existing",
"trigger",
"."
] | 121b59a268da264316cded6a3e9271366a23cd86 | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusSDK/src/main/java/com/salesforce/dva/argus/sdk/AlertService.java#L317-L323 |
120,990 | salesforce/Argus | ArgusSDK/src/main/java/com/salesforce/dva/argus/sdk/AlertService.java | AlertService.createNotification | public List<Notification> createNotification(BigInteger alertId, Notification notification) throws IOException, TokenExpiredException {
String requestUrl = RESOURCE + "/" + alertId.toString() + "/notifications";
ArgusResponse response = getClient().executeHttpRequest(ArgusHttpClient.RequestType.POST, re... | java | public List<Notification> createNotification(BigInteger alertId, Notification notification) throws IOException, TokenExpiredException {
String requestUrl = RESOURCE + "/" + alertId.toString() + "/notifications";
ArgusResponse response = getClient().executeHttpRequest(ArgusHttpClient.RequestType.POST, re... | [
"public",
"List",
"<",
"Notification",
">",
"createNotification",
"(",
"BigInteger",
"alertId",
",",
"Notification",
"notification",
")",
"throws",
"IOException",
",",
"TokenExpiredException",
"{",
"String",
"requestUrl",
"=",
"RESOURCE",
"+",
"\"/\"",
"+",
"alertId... | Creates a new notification.
@param alertId The ID of the alert that will own the notification.
@param notification The notification to create having an un-populated ID field.
@return The notification having a populated ID field.
@throws IOException If the server cannot be reached.
@throws TokenExpired... | [
"Creates",
"a",
"new",
"notification",
"."
] | 121b59a268da264316cded6a3e9271366a23cd86 | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusSDK/src/main/java/com/salesforce/dva/argus/sdk/AlertService.java#L336-L342 |
120,991 | salesforce/Argus | ArgusSDK/src/main/java/com/salesforce/dva/argus/sdk/AlertService.java | AlertService.createTrigger | public List<Trigger> createTrigger(BigInteger alertId, Trigger trigger) throws IOException, TokenExpiredException {
String requestUrl = RESOURCE + "/" + alertId.toString() + "/triggers";
ArgusResponse response = getClient().executeHttpRequest(ArgusHttpClient.RequestType.POST, requestUrl, trigger);
... | java | public List<Trigger> createTrigger(BigInteger alertId, Trigger trigger) throws IOException, TokenExpiredException {
String requestUrl = RESOURCE + "/" + alertId.toString() + "/triggers";
ArgusResponse response = getClient().executeHttpRequest(ArgusHttpClient.RequestType.POST, requestUrl, trigger);
... | [
"public",
"List",
"<",
"Trigger",
">",
"createTrigger",
"(",
"BigInteger",
"alertId",
",",
"Trigger",
"trigger",
")",
"throws",
"IOException",
",",
"TokenExpiredException",
"{",
"String",
"requestUrl",
"=",
"RESOURCE",
"+",
"\"/\"",
"+",
"alertId",
".",
"toStrin... | Creates a new trigger.
@param alertId The ID of the alert that will own the trigger.
@param trigger The trigger to create having an un-populated ID field.
@return The trigger having a populated ID field.
@throws IOException If the server cannot be reached.
@throws TokenExpiredException If the token sent ... | [
"Creates",
"a",
"new",
"trigger",
"."
] | 121b59a268da264316cded6a3e9271366a23cd86 | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusSDK/src/main/java/com/salesforce/dva/argus/sdk/AlertService.java#L355-L361 |
120,992 | salesforce/Argus | ArgusSDK/src/main/java/com/salesforce/dva/argus/sdk/AlertService.java | AlertService.deleteAlert | public void deleteAlert(BigInteger alertId) throws IOException, TokenExpiredException {
String requestUrl = RESOURCE + "/" + alertId.toString();
ArgusResponse response = getClient().executeHttpRequest(ArgusHttpClient.RequestType.DELETE, requestUrl, null);
assertValidResponse(response, requestUr... | java | public void deleteAlert(BigInteger alertId) throws IOException, TokenExpiredException {
String requestUrl = RESOURCE + "/" + alertId.toString();
ArgusResponse response = getClient().executeHttpRequest(ArgusHttpClient.RequestType.DELETE, requestUrl, null);
assertValidResponse(response, requestUr... | [
"public",
"void",
"deleteAlert",
"(",
"BigInteger",
"alertId",
")",
"throws",
"IOException",
",",
"TokenExpiredException",
"{",
"String",
"requestUrl",
"=",
"RESOURCE",
"+",
"\"/\"",
"+",
"alertId",
".",
"toString",
"(",
")",
";",
"ArgusResponse",
"response",
"=... | Deletes an alert including its notifications and triggers.
@param alertId The ID of the alert to delete.
@throws IOException If the server cannot be reached.
@throws TokenExpiredException If the token sent along with the request has expired | [
"Deletes",
"an",
"alert",
"including",
"its",
"notifications",
"and",
"triggers",
"."
] | 121b59a268da264316cded6a3e9271366a23cd86 | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusSDK/src/main/java/com/salesforce/dva/argus/sdk/AlertService.java#L391-L396 |
120,993 | salesforce/Argus | ArgusCore/src/main/java/com/salesforce/dva/argus/service/tsdb/QueryFederation.java | QueryFederation.join | public Map<MetricQuery, List<Metric>> join(Map<MetricQuery, List<MetricQuery>> mapQuerySubQueries, Map<MetricQuery, List<Metric>> subQueryMetricsMap) {
Map<MetricQuery, List<Metric>> queryMetricsMap = new HashMap<>();
String metricIdentifier = null;
for (Map.Entry<MetricQuery, List<MetricQuery>> entry : mapQuery... | java | public Map<MetricQuery, List<Metric>> join(Map<MetricQuery, List<MetricQuery>> mapQuerySubQueries, Map<MetricQuery, List<Metric>> subQueryMetricsMap) {
Map<MetricQuery, List<Metric>> queryMetricsMap = new HashMap<>();
String metricIdentifier = null;
for (Map.Entry<MetricQuery, List<MetricQuery>> entry : mapQuery... | [
"public",
"Map",
"<",
"MetricQuery",
",",
"List",
"<",
"Metric",
">",
">",
"join",
"(",
"Map",
"<",
"MetricQuery",
",",
"List",
"<",
"MetricQuery",
">",
">",
"mapQuerySubQueries",
",",
"Map",
"<",
"MetricQuery",
",",
"List",
"<",
"Metric",
">",
">",
"s... | Merge metrics from smaller sub queries
@param mapQuerySubQueries Mapping from original query to list of sub queries
@param subQueryMetricsMap Result map of sub queries to metric
@return Map from original query to merged metrics | [
"Merge",
"metrics",
"from",
"smaller",
"sub",
"queries"
] | 121b59a268da264316cded6a3e9271366a23cd86 | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusCore/src/main/java/com/salesforce/dva/argus/service/tsdb/QueryFederation.java#L31-L87 |
120,994 | salesforce/Argus | ArgusCore/src/main/java/com/salesforce/dva/argus/service/alert/notifier/AuditNotifier.java | AuditNotifier.getTriggerDetails | protected String getTriggerDetails(Trigger trigger, NotificationContext context) {
if (trigger != null) {
String triggerString = trigger.toString();
triggerString = TemplateReplacer.applyTemplateChanges(context, triggerString);
return triggerString.substring(triggerString.indexOf("{") + 1, triggerString.ind... | java | protected String getTriggerDetails(Trigger trigger, NotificationContext context) {
if (trigger != null) {
String triggerString = trigger.toString();
triggerString = TemplateReplacer.applyTemplateChanges(context, triggerString);
return triggerString.substring(triggerString.indexOf("{") + 1, triggerString.ind... | [
"protected",
"String",
"getTriggerDetails",
"(",
"Trigger",
"trigger",
",",
"NotificationContext",
"context",
")",
"{",
"if",
"(",
"trigger",
"!=",
"null",
")",
"{",
"String",
"triggerString",
"=",
"trigger",
".",
"toString",
"(",
")",
";",
"triggerString",
"=... | Returns the trigger detail information.
@param trigger The source trigger.
@return The trigger detail information. | [
"Returns",
"the",
"trigger",
"detail",
"information",
"."
] | 121b59a268da264316cded6a3e9271366a23cd86 | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusCore/src/main/java/com/salesforce/dva/argus/service/alert/notifier/AuditNotifier.java#L198-L207 |
120,995 | salesforce/Argus | ArgusCore/src/main/java/com/salesforce/dva/argus/service/alert/notifier/AuditNotifier.java | AuditNotifier.getMetricUrl | protected String getMetricUrl(String metricToAnnotate, long triggerFiredTime) {
long start = triggerFiredTime - (6L * DateTimeConstants.MILLIS_PER_HOUR);
long end = Math.min(System.currentTimeMillis(), triggerFiredTime + (6L * DateTimeConstants.MILLIS_PER_HOUR));
String expression = MessageFormat.format("{0,numbe... | java | protected String getMetricUrl(String metricToAnnotate, long triggerFiredTime) {
long start = triggerFiredTime - (6L * DateTimeConstants.MILLIS_PER_HOUR);
long end = Math.min(System.currentTimeMillis(), triggerFiredTime + (6L * DateTimeConstants.MILLIS_PER_HOUR));
String expression = MessageFormat.format("{0,numbe... | [
"protected",
"String",
"getMetricUrl",
"(",
"String",
"metricToAnnotate",
",",
"long",
"triggerFiredTime",
")",
"{",
"long",
"start",
"=",
"triggerFiredTime",
"-",
"(",
"6L",
"*",
"DateTimeConstants",
".",
"MILLIS_PER_HOUR",
")",
";",
"long",
"end",
"=",
"Math",... | Returns the URL linking back to the metric for use in alert notification.
@param metricToAnnotate The metric to annotate.
@param triggerFiredTime The epoch timestamp when the corresponding trigger fired.
@return The fully constructed URL for the metric. | [
"Returns",
"the",
"URL",
"linking",
"back",
"to",
"the",
"metric",
"for",
"use",
"in",
"alert",
"notification",
"."
] | 121b59a268da264316cded6a3e9271366a23cd86 | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusCore/src/main/java/com/salesforce/dva/argus/service/alert/notifier/AuditNotifier.java#L217-L222 |
120,996 | salesforce/Argus | ArgusCore/src/main/java/com/salesforce/dva/argus/service/alert/notifier/AuditNotifier.java | AuditNotifier.getExpressionUrl | @SuppressWarnings("deprecation")
protected String getExpressionUrl(String expression) {
String template = _config.getValue(Property.AUDIT_METRIC_URL_TEMPLATE.getName(), Property.AUDIT_METRIC_URL_TEMPLATE.getDefaultValue());
try {
expression = URLEncoder.encode(expression, "UTF-8");
} catch (Exception ex) {
... | java | @SuppressWarnings("deprecation")
protected String getExpressionUrl(String expression) {
String template = _config.getValue(Property.AUDIT_METRIC_URL_TEMPLATE.getName(), Property.AUDIT_METRIC_URL_TEMPLATE.getDefaultValue());
try {
expression = URLEncoder.encode(expression, "UTF-8");
} catch (Exception ex) {
... | [
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"protected",
"String",
"getExpressionUrl",
"(",
"String",
"expression",
")",
"{",
"String",
"template",
"=",
"_config",
".",
"getValue",
"(",
"Property",
".",
"AUDIT_METRIC_URL_TEMPLATE",
".",
"getName",
"(",
"... | Returns the URL linking back to the expression for use in alert notification.
@param expression The expression for which the URL has to be created.
@return The fully constructed URL for the expression. | [
"Returns",
"the",
"URL",
"linking",
"back",
"to",
"the",
"expression",
"for",
"use",
"in",
"alert",
"notification",
"."
] | 121b59a268da264316cded6a3e9271366a23cd86 | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusCore/src/main/java/com/salesforce/dva/argus/service/alert/notifier/AuditNotifier.java#L231-L240 |
120,997 | salesforce/Argus | ArgusCore/src/main/java/com/salesforce/dva/argus/service/alert/notifier/AuditNotifier.java | AuditNotifier.getAlertUrl | protected String getAlertUrl(BigInteger id) {
String template = _config.getValue(Property.AUDIT_ALERT_URL_TEMPLATE.getName(), Property.AUDIT_ALERT_URL_TEMPLATE.getDefaultValue());
return template.replaceAll("\\$alertid\\$", String.valueOf(id));
} | java | protected String getAlertUrl(BigInteger id) {
String template = _config.getValue(Property.AUDIT_ALERT_URL_TEMPLATE.getName(), Property.AUDIT_ALERT_URL_TEMPLATE.getDefaultValue());
return template.replaceAll("\\$alertid\\$", String.valueOf(id));
} | [
"protected",
"String",
"getAlertUrl",
"(",
"BigInteger",
"id",
")",
"{",
"String",
"template",
"=",
"_config",
".",
"getValue",
"(",
"Property",
".",
"AUDIT_ALERT_URL_TEMPLATE",
".",
"getName",
"(",
")",
",",
"Property",
".",
"AUDIT_ALERT_URL_TEMPLATE",
".",
"ge... | Returns the URL linking back to the alert for which notification is being sent.
@param id The ID of the alert.
@return The fully constructed URL for the alert. | [
"Returns",
"the",
"URL",
"linking",
"back",
"to",
"the",
"alert",
"for",
"which",
"notification",
"is",
"being",
"sent",
"."
] | 121b59a268da264316cded6a3e9271366a23cd86 | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusCore/src/main/java/com/salesforce/dva/argus/service/alert/notifier/AuditNotifier.java#L249-L253 |
120,998 | salesforce/Argus | ArgusCore/src/main/java/com/salesforce/dva/argus/service/alert/notifier/AuditNotifier.java | AuditNotifier.getAllNotifications | public List<Audit> getAllNotifications(JPAEntity entity) {
return _auditService.findByEntityHostnameMessage(entity.getId(), null, "Triggering event value:");
} | java | public List<Audit> getAllNotifications(JPAEntity entity) {
return _auditService.findByEntityHostnameMessage(entity.getId(), null, "Triggering event value:");
} | [
"public",
"List",
"<",
"Audit",
">",
"getAllNotifications",
"(",
"JPAEntity",
"entity",
")",
"{",
"return",
"_auditService",
".",
"findByEntityHostnameMessage",
"(",
"entity",
".",
"getId",
"(",
")",
",",
"null",
",",
"\"Triggering event value:\"",
")",
";",
"}"... | Returns all audit entries for a notification.
@param entity The object to retrieve alert audits for.
@return A list of notification audits for the object. | [
"Returns",
"all",
"audit",
"entries",
"for",
"a",
"notification",
"."
] | 121b59a268da264316cded6a3e9271366a23cd86 | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusCore/src/main/java/com/salesforce/dva/argus/service/alert/notifier/AuditNotifier.java#L262-L264 |
120,999 | salesforce/Argus | ArgusSDK/src/main/java/com/salesforce/dva/argus/sdk/NamespaceService.java | NamespaceService.updateNamespace | public Namespace updateNamespace(BigInteger id, Namespace namespace) throws IOException, TokenExpiredException {
String requestUrl = RESOURCE + "/" + id.toString();
ArgusResponse response = getClient().executeHttpRequest(ArgusHttpClient.RequestType.PUT, requestUrl, namespace);
assertValidRespon... | java | public Namespace updateNamespace(BigInteger id, Namespace namespace) throws IOException, TokenExpiredException {
String requestUrl = RESOURCE + "/" + id.toString();
ArgusResponse response = getClient().executeHttpRequest(ArgusHttpClient.RequestType.PUT, requestUrl, namespace);
assertValidRespon... | [
"public",
"Namespace",
"updateNamespace",
"(",
"BigInteger",
"id",
",",
"Namespace",
"namespace",
")",
"throws",
"IOException",
",",
"TokenExpiredException",
"{",
"String",
"requestUrl",
"=",
"RESOURCE",
"+",
"\"/\"",
"+",
"id",
".",
"toString",
"(",
")",
";",
... | Updates a new namespace.
@param id The ID of the namespace to update.
@param namespace The namespace to update.
@return The updated namespace.
@throws IOException If the server cannot be reached.
@throws TokenExpiredException If the token sent along with the request has expired | [
"Updates",
"a",
"new",
"namespace",
"."
] | 121b59a268da264316cded6a3e9271366a23cd86 | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusSDK/src/main/java/com/salesforce/dva/argus/sdk/NamespaceService.java#L113-L119 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.