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
|
|---|---|---|---|---|---|---|---|---|---|---|---|
152,700
|
drewwills/cernunnos
|
cernunnos-core/src/main/java/org/danann/cernunnos/runtime/web/Settings.java
|
Settings.locateContextConfig
|
public static URL locateContextConfig(String webappRootContext, String userSpecifiedContextLocation, URL defaultLocation) {
// Assertions.
if (webappRootContext == null) {
String msg = "Argument 'webappRootContext' cannot be null.";
throw new IllegalArgumentException(msg);
}
// NB: Both 'userSpecifiedContextLocation' & 'defaultLocation' may be null
URL rslt = null;
if (userSpecifiedContextLocation != null) {
/*
* SPECIAL HANDLING: We remove a leaving slash ('/') here because, when
* no protocol is specified, the expectation is that the path is
* evaluated from the root of the webapp ('webappRootContext'). If we
* didn't, the ResourceHelper would incorrectly interpret these as the
* root of the protocol, which is likely 'file:/' or 'jndi:/'.
*/
if (userSpecifiedContextLocation.startsWith("/")) {
userSpecifiedContextLocation = userSpecifiedContextLocation.substring(1);
}
rslt = ResourceHelper.evaluate(webappRootContext, userSpecifiedContextLocation);
} else {
rslt = defaultLocation; // may be null...
}
return rslt;
}
|
java
|
public static URL locateContextConfig(String webappRootContext, String userSpecifiedContextLocation, URL defaultLocation) {
// Assertions.
if (webappRootContext == null) {
String msg = "Argument 'webappRootContext' cannot be null.";
throw new IllegalArgumentException(msg);
}
// NB: Both 'userSpecifiedContextLocation' & 'defaultLocation' may be null
URL rslt = null;
if (userSpecifiedContextLocation != null) {
/*
* SPECIAL HANDLING: We remove a leaving slash ('/') here because, when
* no protocol is specified, the expectation is that the path is
* evaluated from the root of the webapp ('webappRootContext'). If we
* didn't, the ResourceHelper would incorrectly interpret these as the
* root of the protocol, which is likely 'file:/' or 'jndi:/'.
*/
if (userSpecifiedContextLocation.startsWith("/")) {
userSpecifiedContextLocation = userSpecifiedContextLocation.substring(1);
}
rslt = ResourceHelper.evaluate(webappRootContext, userSpecifiedContextLocation);
} else {
rslt = defaultLocation; // may be null...
}
return rslt;
}
|
[
"public",
"static",
"URL",
"locateContextConfig",
"(",
"String",
"webappRootContext",
",",
"String",
"userSpecifiedContextLocation",
",",
"URL",
"defaultLocation",
")",
"{",
"// Assertions.",
"if",
"(",
"webappRootContext",
"==",
"null",
")",
"{",
"String",
"msg",
"=",
"\"Argument 'webappRootContext' cannot be null.\"",
";",
"throw",
"new",
"IllegalArgumentException",
"(",
"msg",
")",
";",
"}",
"// NB: Both 'userSpecifiedContextLocation' & 'defaultLocation' may be null",
"URL",
"rslt",
"=",
"null",
";",
"if",
"(",
"userSpecifiedContextLocation",
"!=",
"null",
")",
"{",
"/*\n * SPECIAL HANDLING: We remove a leaving slash ('/') here because, when \n * no protocol is specified, the expectation is that the path is \n * evaluated from the root of the webapp ('webappRootContext'). If we \n * didn't, the ResourceHelper would incorrectly interpret these as the \n * root of the protocol, which is likely 'file:/' or 'jndi:/'. \n */",
"if",
"(",
"userSpecifiedContextLocation",
".",
"startsWith",
"(",
"\"/\"",
")",
")",
"{",
"userSpecifiedContextLocation",
"=",
"userSpecifiedContextLocation",
".",
"substring",
"(",
"1",
")",
";",
"}",
"rslt",
"=",
"ResourceHelper",
".",
"evaluate",
"(",
"webappRootContext",
",",
"userSpecifiedContextLocation",
")",
";",
"}",
"else",
"{",
"rslt",
"=",
"defaultLocation",
";",
"// may be null...",
"}",
"return",
"rslt",
";",
"}"
] |
Locate the configuration file, if present, for a Portlet or Servlet.
@param webappRootContext Context URL (in String form) from which
<code>userSpecifiedContextLocation</code> will be evaluated by
<code>ResourceHelper</code>, if specified
@param userSpecifiedContextLocation Optional location specified in the
deployment descriptor
@param defaultLocation Optional default, which will be returned if
<code>userSpecifiedContextLocation</code> is not provided
@return The location of a configuration file, if present, or
<code>null</code>
|
[
"Locate",
"the",
"configuration",
"file",
"if",
"present",
"for",
"a",
"Portlet",
"or",
"Servlet",
"."
] |
dc6848e0253775e22b6c869fd06506d4ddb6d728
|
https://github.com/drewwills/cernunnos/blob/dc6848e0253775e22b6c869fd06506d4ddb6d728/cernunnos-core/src/main/java/org/danann/cernunnos/runtime/web/Settings.java#L64-L95
|
152,701
|
kirgor/enklib
|
compile/src/main/java/com/kirgor/enklib/compile/CompileUtils.java
|
CompileUtils.compileClass
|
public static Class compileClass(String name, String code, List<Class> classPath) throws Exception {
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
DiagnosticCollector<JavaFileObject> diagnostics = new DiagnosticCollector<JavaFileObject>();
MemoryJavaFileManager fileManager = new MemoryJavaFileManager(compiler.getStandardFileManager(null, null, null));
List<JavaFileObject> javaFileObjects = new ArrayList<JavaFileObject>();
javaFileObjects.add(new MemoryJavaFileObject(name, code));
File tempDir = new File(System.getProperty("java.io.tmpdir"), name);
List<String> options = new ArrayList<String>();
if (classPath.size() > 0) {
options.add("-classpath");
options.add(tempDir.getAbsolutePath());
for (Class c : classPath) {
String classRelativePath = c.getName().replace('.', '/') + ".class";
URL classInputLocation = c.getResource('/' + classRelativePath);
File outputFile = new File(tempDir, classRelativePath);
outputFile.getParentFile().mkdirs();
InputStream input = classInputLocation.openStream();
FileOutputStream output = new FileOutputStream(outputFile);
IOUtils.copy(input, output);
input.close();
output.close();
}
}
Boolean success = compiler.getTask(null, fileManager, diagnostics, options, null, javaFileObjects).call();
if (success) {
return fileManager.getClassLoader(null).loadClass(name);
} else {
StringBuilder stringBuilder = new StringBuilder();
for (Diagnostic diagnostic : diagnostics.getDiagnostics()) {
stringBuilder.append(diagnostic.getMessage(null)).append("\n");
}
throw new Exception(stringBuilder.toString());
}
}
|
java
|
public static Class compileClass(String name, String code, List<Class> classPath) throws Exception {
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
DiagnosticCollector<JavaFileObject> diagnostics = new DiagnosticCollector<JavaFileObject>();
MemoryJavaFileManager fileManager = new MemoryJavaFileManager(compiler.getStandardFileManager(null, null, null));
List<JavaFileObject> javaFileObjects = new ArrayList<JavaFileObject>();
javaFileObjects.add(new MemoryJavaFileObject(name, code));
File tempDir = new File(System.getProperty("java.io.tmpdir"), name);
List<String> options = new ArrayList<String>();
if (classPath.size() > 0) {
options.add("-classpath");
options.add(tempDir.getAbsolutePath());
for (Class c : classPath) {
String classRelativePath = c.getName().replace('.', '/') + ".class";
URL classInputLocation = c.getResource('/' + classRelativePath);
File outputFile = new File(tempDir, classRelativePath);
outputFile.getParentFile().mkdirs();
InputStream input = classInputLocation.openStream();
FileOutputStream output = new FileOutputStream(outputFile);
IOUtils.copy(input, output);
input.close();
output.close();
}
}
Boolean success = compiler.getTask(null, fileManager, diagnostics, options, null, javaFileObjects).call();
if (success) {
return fileManager.getClassLoader(null).loadClass(name);
} else {
StringBuilder stringBuilder = new StringBuilder();
for (Diagnostic diagnostic : diagnostics.getDiagnostics()) {
stringBuilder.append(diagnostic.getMessage(null)).append("\n");
}
throw new Exception(stringBuilder.toString());
}
}
|
[
"public",
"static",
"Class",
"compileClass",
"(",
"String",
"name",
",",
"String",
"code",
",",
"List",
"<",
"Class",
">",
"classPath",
")",
"throws",
"Exception",
"{",
"JavaCompiler",
"compiler",
"=",
"ToolProvider",
".",
"getSystemJavaCompiler",
"(",
")",
";",
"DiagnosticCollector",
"<",
"JavaFileObject",
">",
"diagnostics",
"=",
"new",
"DiagnosticCollector",
"<",
"JavaFileObject",
">",
"(",
")",
";",
"MemoryJavaFileManager",
"fileManager",
"=",
"new",
"MemoryJavaFileManager",
"(",
"compiler",
".",
"getStandardFileManager",
"(",
"null",
",",
"null",
",",
"null",
")",
")",
";",
"List",
"<",
"JavaFileObject",
">",
"javaFileObjects",
"=",
"new",
"ArrayList",
"<",
"JavaFileObject",
">",
"(",
")",
";",
"javaFileObjects",
".",
"add",
"(",
"new",
"MemoryJavaFileObject",
"(",
"name",
",",
"code",
")",
")",
";",
"File",
"tempDir",
"=",
"new",
"File",
"(",
"System",
".",
"getProperty",
"(",
"\"java.io.tmpdir\"",
")",
",",
"name",
")",
";",
"List",
"<",
"String",
">",
"options",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"if",
"(",
"classPath",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"options",
".",
"add",
"(",
"\"-classpath\"",
")",
";",
"options",
".",
"add",
"(",
"tempDir",
".",
"getAbsolutePath",
"(",
")",
")",
";",
"for",
"(",
"Class",
"c",
":",
"classPath",
")",
"{",
"String",
"classRelativePath",
"=",
"c",
".",
"getName",
"(",
")",
".",
"replace",
"(",
"'",
"'",
",",
"'",
"'",
")",
"+",
"\".class\"",
";",
"URL",
"classInputLocation",
"=",
"c",
".",
"getResource",
"(",
"'",
"'",
"+",
"classRelativePath",
")",
";",
"File",
"outputFile",
"=",
"new",
"File",
"(",
"tempDir",
",",
"classRelativePath",
")",
";",
"outputFile",
".",
"getParentFile",
"(",
")",
".",
"mkdirs",
"(",
")",
";",
"InputStream",
"input",
"=",
"classInputLocation",
".",
"openStream",
"(",
")",
";",
"FileOutputStream",
"output",
"=",
"new",
"FileOutputStream",
"(",
"outputFile",
")",
";",
"IOUtils",
".",
"copy",
"(",
"input",
",",
"output",
")",
";",
"input",
".",
"close",
"(",
")",
";",
"output",
".",
"close",
"(",
")",
";",
"}",
"}",
"Boolean",
"success",
"=",
"compiler",
".",
"getTask",
"(",
"null",
",",
"fileManager",
",",
"diagnostics",
",",
"options",
",",
"null",
",",
"javaFileObjects",
")",
".",
"call",
"(",
")",
";",
"if",
"(",
"success",
")",
"{",
"return",
"fileManager",
".",
"getClassLoader",
"(",
"null",
")",
".",
"loadClass",
"(",
"name",
")",
";",
"}",
"else",
"{",
"StringBuilder",
"stringBuilder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"Diagnostic",
"diagnostic",
":",
"diagnostics",
".",
"getDiagnostics",
"(",
")",
")",
"{",
"stringBuilder",
".",
"append",
"(",
"diagnostic",
".",
"getMessage",
"(",
"null",
")",
")",
".",
"append",
"(",
"\"\\n\"",
")",
";",
"}",
"throw",
"new",
"Exception",
"(",
"stringBuilder",
".",
"toString",
"(",
")",
")",
";",
"}",
"}"
] |
Compiles Java code and returns compiled class back.
|
[
"Compiles",
"Java",
"code",
"and",
"returns",
"compiled",
"class",
"back",
"."
] |
8a24db296dc43db5d8fe509cf64ace0a0c7be8f2
|
https://github.com/kirgor/enklib/blob/8a24db296dc43db5d8fe509cf64ace0a0c7be8f2/compile/src/main/java/com/kirgor/enklib/compile/CompileUtils.java#L20-L58
|
152,702
|
jbundle/jbundle
|
base/message/trx/src/main/java/org/jbundle/base/message/trx/message/external/ExternalTrxMessage.java
|
ExternalTrxMessage.init
|
public void init(BaseMessage message, Object objRawMessage)
{
m_message = message;
if (message != null)
message.setExternalMessage(this);
if (objRawMessage != null)
this.setRawData(objRawMessage);
}
|
java
|
public void init(BaseMessage message, Object objRawMessage)
{
m_message = message;
if (message != null)
message.setExternalMessage(this);
if (objRawMessage != null)
this.setRawData(objRawMessage);
}
|
[
"public",
"void",
"init",
"(",
"BaseMessage",
"message",
",",
"Object",
"objRawMessage",
")",
"{",
"m_message",
"=",
"message",
";",
"if",
"(",
"message",
"!=",
"null",
")",
"message",
".",
"setExternalMessage",
"(",
"this",
")",
";",
"if",
"(",
"objRawMessage",
"!=",
"null",
")",
"this",
".",
"setRawData",
"(",
"objRawMessage",
")",
";",
"}"
] |
Initialize new ExternalTrxMessage.
@param objRawMessage The (optional) raw data of the message.
|
[
"Initialize",
"new",
"ExternalTrxMessage",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/message/trx/src/main/java/org/jbundle/base/message/trx/message/external/ExternalTrxMessage.java#L88-L95
|
152,703
|
jbundle/jbundle
|
base/message/trx/src/main/java/org/jbundle/base/message/trx/message/external/ExternalTrxMessage.java
|
ExternalTrxMessage.moveHeaderParams
|
public void moveHeaderParams(Map<String,Object> mapMessage, Map<String,Object> mapHeader)
{
for (int i = 0; i < m_rgstrHeaderParams.length; i++)
{
if (mapMessage.get(m_rgstrHeaderParams[i]) != null)
if (mapHeader.get(m_rgstrHeaderParams[i]) == null)
{
Object objValue = mapMessage.get(m_rgstrHeaderParams[i]);
mapMessage.remove(m_rgstrHeaderParams[i]);
mapHeader.put(m_rgstrHeaderParams[i], objValue);
}
}
}
|
java
|
public void moveHeaderParams(Map<String,Object> mapMessage, Map<String,Object> mapHeader)
{
for (int i = 0; i < m_rgstrHeaderParams.length; i++)
{
if (mapMessage.get(m_rgstrHeaderParams[i]) != null)
if (mapHeader.get(m_rgstrHeaderParams[i]) == null)
{
Object objValue = mapMessage.get(m_rgstrHeaderParams[i]);
mapMessage.remove(m_rgstrHeaderParams[i]);
mapHeader.put(m_rgstrHeaderParams[i], objValue);
}
}
}
|
[
"public",
"void",
"moveHeaderParams",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"mapMessage",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"mapHeader",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"m_rgstrHeaderParams",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"mapMessage",
".",
"get",
"(",
"m_rgstrHeaderParams",
"[",
"i",
"]",
")",
"!=",
"null",
")",
"if",
"(",
"mapHeader",
".",
"get",
"(",
"m_rgstrHeaderParams",
"[",
"i",
"]",
")",
"==",
"null",
")",
"{",
"Object",
"objValue",
"=",
"mapMessage",
".",
"get",
"(",
"m_rgstrHeaderParams",
"[",
"i",
"]",
")",
";",
"mapMessage",
".",
"remove",
"(",
"m_rgstrHeaderParams",
"[",
"i",
"]",
")",
";",
"mapHeader",
".",
"put",
"(",
"m_rgstrHeaderParams",
"[",
"i",
"]",
",",
"objValue",
")",
";",
"}",
"}",
"}"
] |
Move the header params from the message map to the header map.
|
[
"Move",
"the",
"header",
"params",
"from",
"the",
"message",
"map",
"to",
"the",
"header",
"map",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/message/trx/src/main/java/org/jbundle/base/message/trx/message/external/ExternalTrxMessage.java#L225-L237
|
152,704
|
jbundle/jbundle
|
base/message/trx/src/main/java/org/jbundle/base/message/trx/message/external/ExternalTrxMessage.java
|
ExternalTrxMessage.getScratchDocument
|
public Document getScratchDocument(DocumentBuilder db)
{
if (m_doc == null)
{
m_doc = db.newDocument();
}
return m_doc;
}
|
java
|
public Document getScratchDocument(DocumentBuilder db)
{
if (m_doc == null)
{
m_doc = db.newDocument();
}
return m_doc;
}
|
[
"public",
"Document",
"getScratchDocument",
"(",
"DocumentBuilder",
"db",
")",
"{",
"if",
"(",
"m_doc",
"==",
"null",
")",
"{",
"m_doc",
"=",
"db",
".",
"newDocument",
"(",
")",
";",
"}",
"return",
"m_doc",
";",
"}"
] |
Get the scratch document for this message.
Creates a new document the first time.
@return The scratch document.
|
[
"Get",
"the",
"scratch",
"document",
"for",
"this",
"message",
".",
"Creates",
"a",
"new",
"document",
"the",
"first",
"time",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/message/trx/src/main/java/org/jbundle/base/message/trx/message/external/ExternalTrxMessage.java#L243-L250
|
152,705
|
jbundle/jbundle
|
base/message/trx/src/main/java/org/jbundle/base/message/trx/message/external/ExternalTrxMessage.java
|
ExternalTrxMessage.getXSLTDocument
|
public String getXSLTDocument()
{
TrxMessageHeader messageHeader = (TrxMessageHeader)this.getMessage().getMessageHeader();
String strDocument = null;
if (messageHeader != null)
strDocument = (String)messageHeader.get(TrxMessageHeader.XSLT_DOCUMENT);
return strDocument;
}
|
java
|
public String getXSLTDocument()
{
TrxMessageHeader messageHeader = (TrxMessageHeader)this.getMessage().getMessageHeader();
String strDocument = null;
if (messageHeader != null)
strDocument = (String)messageHeader.get(TrxMessageHeader.XSLT_DOCUMENT);
return strDocument;
}
|
[
"public",
"String",
"getXSLTDocument",
"(",
")",
"{",
"TrxMessageHeader",
"messageHeader",
"=",
"(",
"TrxMessageHeader",
")",
"this",
".",
"getMessage",
"(",
")",
".",
"getMessageHeader",
"(",
")",
";",
"String",
"strDocument",
"=",
"null",
";",
"if",
"(",
"messageHeader",
"!=",
"null",
")",
"strDocument",
"=",
"(",
"String",
")",
"messageHeader",
".",
"get",
"(",
"TrxMessageHeader",
".",
"XSLT_DOCUMENT",
")",
";",
"return",
"strDocument",
";",
"}"
] |
Get the XSLT Document to do the conversion.
Override this if you have a standard document to suppyl.
@param source The source XML document.
@return The XML tree that conforms to the ECXML format.
|
[
"Get",
"the",
"XSLT",
"Document",
"to",
"do",
"the",
"conversion",
".",
"Override",
"this",
"if",
"you",
"have",
"a",
"standard",
"document",
"to",
"suppyl",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/message/trx/src/main/java/org/jbundle/base/message/trx/message/external/ExternalTrxMessage.java#L307-L314
|
152,706
|
jbundle/jbundle
|
base/message/trx/src/main/java/org/jbundle/base/message/trx/message/external/ExternalTrxMessage.java
|
ExternalTrxMessage.getTransformerStream
|
public StreamSource getTransformerStream(String strDocument)
{
StreamSource source = null;
if (strDocument == null)
strDocument = this.getXSLTDocument();
if (strDocument == null)
{
Reader reader = new StringReader(XSL_CONVERT);
source = new StreamSource(reader);
return source;
}
if (strDocument.indexOf(':') == -1)
{ // See if it is a file name
try { // First try it as a filename
FileReader reader = new FileReader(strDocument);
if (reader != null)
source = new StreamSource(reader);
} catch (IOException ex) {
source = null;
}
if (source == null)
{ // Now, try it as a URL
Task task = null;//this.getTask();
//if (task == null)
// task = BaseApplet.getSharedInstance();
BaseAppletReference applet = null;
if (task instanceof BaseAppletReference)
applet = (BaseAppletReference)task;
App app = null;
if (task != null)
app = task.getApplication();
URL url = null;
if (app != null)
url = app.getResourceURL(strDocument, applet);
else
url = this.getClass().getClassLoader().getResource(strDocument);
if (url != null)
{
try {
InputStream is = url.openStream();
source = new StreamSource(is);
} catch (IOException ex) {
source = null;
}
}
}
}
if (source == null)
{
try {
URL url = new URL(strDocument);
InputStream is = url.openStream();
source = new StreamSource(is);
} catch (IOException ex) {
source = null;
}
}
return source;
}
|
java
|
public StreamSource getTransformerStream(String strDocument)
{
StreamSource source = null;
if (strDocument == null)
strDocument = this.getXSLTDocument();
if (strDocument == null)
{
Reader reader = new StringReader(XSL_CONVERT);
source = new StreamSource(reader);
return source;
}
if (strDocument.indexOf(':') == -1)
{ // See if it is a file name
try { // First try it as a filename
FileReader reader = new FileReader(strDocument);
if (reader != null)
source = new StreamSource(reader);
} catch (IOException ex) {
source = null;
}
if (source == null)
{ // Now, try it as a URL
Task task = null;//this.getTask();
//if (task == null)
// task = BaseApplet.getSharedInstance();
BaseAppletReference applet = null;
if (task instanceof BaseAppletReference)
applet = (BaseAppletReference)task;
App app = null;
if (task != null)
app = task.getApplication();
URL url = null;
if (app != null)
url = app.getResourceURL(strDocument, applet);
else
url = this.getClass().getClassLoader().getResource(strDocument);
if (url != null)
{
try {
InputStream is = url.openStream();
source = new StreamSource(is);
} catch (IOException ex) {
source = null;
}
}
}
}
if (source == null)
{
try {
URL url = new URL(strDocument);
InputStream is = url.openStream();
source = new StreamSource(is);
} catch (IOException ex) {
source = null;
}
}
return source;
}
|
[
"public",
"StreamSource",
"getTransformerStream",
"(",
"String",
"strDocument",
")",
"{",
"StreamSource",
"source",
"=",
"null",
";",
"if",
"(",
"strDocument",
"==",
"null",
")",
"strDocument",
"=",
"this",
".",
"getXSLTDocument",
"(",
")",
";",
"if",
"(",
"strDocument",
"==",
"null",
")",
"{",
"Reader",
"reader",
"=",
"new",
"StringReader",
"(",
"XSL_CONVERT",
")",
";",
"source",
"=",
"new",
"StreamSource",
"(",
"reader",
")",
";",
"return",
"source",
";",
"}",
"if",
"(",
"strDocument",
".",
"indexOf",
"(",
"'",
"'",
")",
"==",
"-",
"1",
")",
"{",
"// See if it is a file name",
"try",
"{",
"// First try it as a filename",
"FileReader",
"reader",
"=",
"new",
"FileReader",
"(",
"strDocument",
")",
";",
"if",
"(",
"reader",
"!=",
"null",
")",
"source",
"=",
"new",
"StreamSource",
"(",
"reader",
")",
";",
"}",
"catch",
"(",
"IOException",
"ex",
")",
"{",
"source",
"=",
"null",
";",
"}",
"if",
"(",
"source",
"==",
"null",
")",
"{",
"// Now, try it as a URL",
"Task",
"task",
"=",
"null",
";",
"//this.getTask();",
"//if (task == null)",
"// task = BaseApplet.getSharedInstance();",
"BaseAppletReference",
"applet",
"=",
"null",
";",
"if",
"(",
"task",
"instanceof",
"BaseAppletReference",
")",
"applet",
"=",
"(",
"BaseAppletReference",
")",
"task",
";",
"App",
"app",
"=",
"null",
";",
"if",
"(",
"task",
"!=",
"null",
")",
"app",
"=",
"task",
".",
"getApplication",
"(",
")",
";",
"URL",
"url",
"=",
"null",
";",
"if",
"(",
"app",
"!=",
"null",
")",
"url",
"=",
"app",
".",
"getResourceURL",
"(",
"strDocument",
",",
"applet",
")",
";",
"else",
"url",
"=",
"this",
".",
"getClass",
"(",
")",
".",
"getClassLoader",
"(",
")",
".",
"getResource",
"(",
"strDocument",
")",
";",
"if",
"(",
"url",
"!=",
"null",
")",
"{",
"try",
"{",
"InputStream",
"is",
"=",
"url",
".",
"openStream",
"(",
")",
";",
"source",
"=",
"new",
"StreamSource",
"(",
"is",
")",
";",
"}",
"catch",
"(",
"IOException",
"ex",
")",
"{",
"source",
"=",
"null",
";",
"}",
"}",
"}",
"}",
"if",
"(",
"source",
"==",
"null",
")",
"{",
"try",
"{",
"URL",
"url",
"=",
"new",
"URL",
"(",
"strDocument",
")",
";",
"InputStream",
"is",
"=",
"url",
".",
"openStream",
"(",
")",
";",
"source",
"=",
"new",
"StreamSource",
"(",
"is",
")",
";",
"}",
"catch",
"(",
"IOException",
"ex",
")",
"{",
"source",
"=",
"null",
";",
"}",
"}",
"return",
"source",
";",
"}"
] |
Get the XSLT transformer stream from this file or URL String.
@param strDocument a URL or file string for the XSL document.
@returns The transformer or default transformer if it doesn't exist.
|
[
"Get",
"the",
"XSLT",
"transformer",
"stream",
"from",
"this",
"file",
"or",
"URL",
"String",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/message/trx/src/main/java/org/jbundle/base/message/trx/message/external/ExternalTrxMessage.java#L320-L379
|
152,707
|
carewebframework/carewebframework-vista
|
org.carewebframework.vista.api-parent/org.carewebframework.vista.api.patientlist/src/main/java/org/carewebframework/vista/patientlist/PatientList.java
|
PatientList.getListItems
|
@Override
public Collection<PatientListItem> getListItems() {
if (!noCaching && patients != null) {
return patients;
}
patients = new ArrayList<>();
AbstractPatientListFilter filter = isFiltered() ? getActiveFilter() : null;
PatientListFilterEntity entity = filter == null ? null : (PatientListFilterEntity) filter.getEntity();
List<String> tempList = VistAUtil.getBrokerSession().callRPCList("RGCWPTPL LISTPTS", null, listId,
entity == null ? 0 : entity.getId(), formatDateRange());
addPatients(patients, tempList, 0);
return patients;
}
|
java
|
@Override
public Collection<PatientListItem> getListItems() {
if (!noCaching && patients != null) {
return patients;
}
patients = new ArrayList<>();
AbstractPatientListFilter filter = isFiltered() ? getActiveFilter() : null;
PatientListFilterEntity entity = filter == null ? null : (PatientListFilterEntity) filter.getEntity();
List<String> tempList = VistAUtil.getBrokerSession().callRPCList("RGCWPTPL LISTPTS", null, listId,
entity == null ? 0 : entity.getId(), formatDateRange());
addPatients(patients, tempList, 0);
return patients;
}
|
[
"@",
"Override",
"public",
"Collection",
"<",
"PatientListItem",
">",
"getListItems",
"(",
")",
"{",
"if",
"(",
"!",
"noCaching",
"&&",
"patients",
"!=",
"null",
")",
"{",
"return",
"patients",
";",
"}",
"patients",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"AbstractPatientListFilter",
"filter",
"=",
"isFiltered",
"(",
")",
"?",
"getActiveFilter",
"(",
")",
":",
"null",
";",
"PatientListFilterEntity",
"entity",
"=",
"filter",
"==",
"null",
"?",
"null",
":",
"(",
"PatientListFilterEntity",
")",
"filter",
".",
"getEntity",
"(",
")",
";",
"List",
"<",
"String",
">",
"tempList",
"=",
"VistAUtil",
".",
"getBrokerSession",
"(",
")",
".",
"callRPCList",
"(",
"\"RGCWPTPL LISTPTS\"",
",",
"null",
",",
"listId",
",",
"entity",
"==",
"null",
"?",
"0",
":",
"entity",
".",
"getId",
"(",
")",
",",
"formatDateRange",
"(",
")",
")",
";",
"addPatients",
"(",
"patients",
",",
"tempList",
",",
"0",
")",
";",
"return",
"patients",
";",
"}"
] |
Returns the patient list.
@return Patient list.
|
[
"Returns",
"the",
"patient",
"list",
"."
] |
883b2cbe395d9e8a21cd19db820f0876bda6b1c6
|
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.api-parent/org.carewebframework.vista.api.patientlist/src/main/java/org/carewebframework/vista/patientlist/PatientList.java#L120-L133
|
152,708
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/util/MapCollections.java
|
MapCollections.unmodifiableMapList
|
public static final <K,V> MapList<K,V> unmodifiableMapList(MapList<K,V> map)
{
return new UnmodifiableMapList(Collections.unmodifiableMap(map), map.getComparator());
}
|
java
|
public static final <K,V> MapList<K,V> unmodifiableMapList(MapList<K,V> map)
{
return new UnmodifiableMapList(Collections.unmodifiableMap(map), map.getComparator());
}
|
[
"public",
"static",
"final",
"<",
"K",
",",
"V",
">",
"MapList",
"<",
"K",
",",
"V",
">",
"unmodifiableMapList",
"(",
"MapList",
"<",
"K",
",",
"V",
">",
"map",
")",
"{",
"return",
"new",
"UnmodifiableMapList",
"(",
"Collections",
".",
"unmodifiableMap",
"(",
"map",
")",
",",
"map",
".",
"getComparator",
"(",
")",
")",
";",
"}"
] |
Returns unmodifiable MapList.
@param <K>
@param <V>
@param map
@return
|
[
"Returns",
"unmodifiable",
"MapList",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/MapCollections.java#L43-L46
|
152,709
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/util/MapCollections.java
|
MapCollections.unmodifiableMapSet
|
public static final <K,V> MapSet<K,V> unmodifiableMapSet(MapSet<K,V> set)
{
return new UnmodifiableMapSet(set);
}
|
java
|
public static final <K,V> MapSet<K,V> unmodifiableMapSet(MapSet<K,V> set)
{
return new UnmodifiableMapSet(set);
}
|
[
"public",
"static",
"final",
"<",
"K",
",",
"V",
">",
"MapSet",
"<",
"K",
",",
"V",
">",
"unmodifiableMapSet",
"(",
"MapSet",
"<",
"K",
",",
"V",
">",
"set",
")",
"{",
"return",
"new",
"UnmodifiableMapSet",
"(",
"set",
")",
";",
"}"
] |
Returns unmodifiable MapSet.
@param <K>
@param <V>
@param set
@return
|
[
"Returns",
"unmodifiable",
"MapSet",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/MapCollections.java#L220-L223
|
152,710
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/db/KeyField.java
|
KeyField.free
|
public void free()
{
m_keyArea.removeKeyField(this);
m_keyArea = null;
m_field = null;
if (m_fieldTempParam != null)
m_fieldTempParam.free();
m_fieldTempParam = null; // BaseField
if (m_fieldStartParam != null)
m_fieldStartParam.free();
m_fieldStartParam = null; // BaseField
if (m_fieldEndParam != null)
m_fieldEndParam.free();
m_fieldEndParam = null; // BaseField
}
|
java
|
public void free()
{
m_keyArea.removeKeyField(this);
m_keyArea = null;
m_field = null;
if (m_fieldTempParam != null)
m_fieldTempParam.free();
m_fieldTempParam = null; // BaseField
if (m_fieldStartParam != null)
m_fieldStartParam.free();
m_fieldStartParam = null; // BaseField
if (m_fieldEndParam != null)
m_fieldEndParam.free();
m_fieldEndParam = null; // BaseField
}
|
[
"public",
"void",
"free",
"(",
")",
"{",
"m_keyArea",
".",
"removeKeyField",
"(",
"this",
")",
";",
"m_keyArea",
"=",
"null",
";",
"m_field",
"=",
"null",
";",
"if",
"(",
"m_fieldTempParam",
"!=",
"null",
")",
"m_fieldTempParam",
".",
"free",
"(",
")",
";",
"m_fieldTempParam",
"=",
"null",
";",
"// BaseField",
"if",
"(",
"m_fieldStartParam",
"!=",
"null",
")",
"m_fieldStartParam",
".",
"free",
"(",
")",
";",
"m_fieldStartParam",
"=",
"null",
";",
"// BaseField",
"if",
"(",
"m_fieldEndParam",
"!=",
"null",
")",
"m_fieldEndParam",
".",
"free",
"(",
")",
";",
"m_fieldEndParam",
"=",
"null",
";",
"// BaseField",
"}"
] |
Free this key field.
|
[
"Free",
"this",
"key",
"field",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/KeyField.java#L87-L101
|
152,711
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/db/KeyField.java
|
KeyField.getField
|
public BaseField getField(int iAreaDesc)
{
switch (iAreaDesc)
{
default:
case DBConstants.FILE_KEY_AREA:
return m_field;
case DBConstants.TEMP_KEY_AREA:
if (m_fieldTempParam == null)
{
try {
m_fieldTempParam = (BaseField)m_field.clone(); // Buffer areas
m_fieldTempParam.setFieldName(new String(m_field.getFieldName(false, false) + "Temp"));
m_fieldTempParam.setNullable(true);
} catch (CloneNotSupportedException ex) {
m_fieldTempParam = null;
}
}
return m_fieldTempParam;
case DBConstants.START_SELECT_KEY:
if (m_fieldStartParam == null)
{
try {
m_fieldStartParam = (BaseField)m_field.clone(); // Buffer areas
m_fieldStartParam.setFieldName(new String(m_field.getFieldName(false, false) + "Start"));
m_fieldStartParam.setNullable(true);
} catch (CloneNotSupportedException ex) {
m_fieldStartParam = null;
}
}
return m_fieldStartParam;
case DBConstants.END_SELECT_KEY:
if (m_fieldEndParam == null)
{
try {
m_fieldEndParam = (BaseField)m_field.clone();
m_fieldEndParam.setFieldName(new String(m_field.getFieldName(false, false) + "End"));
m_fieldEndParam.setNullable(true);
} catch (CloneNotSupportedException ex) {
m_fieldEndParam = null;
}
}
return m_fieldEndParam;
}
}
|
java
|
public BaseField getField(int iAreaDesc)
{
switch (iAreaDesc)
{
default:
case DBConstants.FILE_KEY_AREA:
return m_field;
case DBConstants.TEMP_KEY_AREA:
if (m_fieldTempParam == null)
{
try {
m_fieldTempParam = (BaseField)m_field.clone(); // Buffer areas
m_fieldTempParam.setFieldName(new String(m_field.getFieldName(false, false) + "Temp"));
m_fieldTempParam.setNullable(true);
} catch (CloneNotSupportedException ex) {
m_fieldTempParam = null;
}
}
return m_fieldTempParam;
case DBConstants.START_SELECT_KEY:
if (m_fieldStartParam == null)
{
try {
m_fieldStartParam = (BaseField)m_field.clone(); // Buffer areas
m_fieldStartParam.setFieldName(new String(m_field.getFieldName(false, false) + "Start"));
m_fieldStartParam.setNullable(true);
} catch (CloneNotSupportedException ex) {
m_fieldStartParam = null;
}
}
return m_fieldStartParam;
case DBConstants.END_SELECT_KEY:
if (m_fieldEndParam == null)
{
try {
m_fieldEndParam = (BaseField)m_field.clone();
m_fieldEndParam.setFieldName(new String(m_field.getFieldName(false, false) + "End"));
m_fieldEndParam.setNullable(true);
} catch (CloneNotSupportedException ex) {
m_fieldEndParam = null;
}
}
return m_fieldEndParam;
}
}
|
[
"public",
"BaseField",
"getField",
"(",
"int",
"iAreaDesc",
")",
"{",
"switch",
"(",
"iAreaDesc",
")",
"{",
"default",
":",
"case",
"DBConstants",
".",
"FILE_KEY_AREA",
":",
"return",
"m_field",
";",
"case",
"DBConstants",
".",
"TEMP_KEY_AREA",
":",
"if",
"(",
"m_fieldTempParam",
"==",
"null",
")",
"{",
"try",
"{",
"m_fieldTempParam",
"=",
"(",
"BaseField",
")",
"m_field",
".",
"clone",
"(",
")",
";",
"// Buffer areas",
"m_fieldTempParam",
".",
"setFieldName",
"(",
"new",
"String",
"(",
"m_field",
".",
"getFieldName",
"(",
"false",
",",
"false",
")",
"+",
"\"Temp\"",
")",
")",
";",
"m_fieldTempParam",
".",
"setNullable",
"(",
"true",
")",
";",
"}",
"catch",
"(",
"CloneNotSupportedException",
"ex",
")",
"{",
"m_fieldTempParam",
"=",
"null",
";",
"}",
"}",
"return",
"m_fieldTempParam",
";",
"case",
"DBConstants",
".",
"START_SELECT_KEY",
":",
"if",
"(",
"m_fieldStartParam",
"==",
"null",
")",
"{",
"try",
"{",
"m_fieldStartParam",
"=",
"(",
"BaseField",
")",
"m_field",
".",
"clone",
"(",
")",
";",
"// Buffer areas",
"m_fieldStartParam",
".",
"setFieldName",
"(",
"new",
"String",
"(",
"m_field",
".",
"getFieldName",
"(",
"false",
",",
"false",
")",
"+",
"\"Start\"",
")",
")",
";",
"m_fieldStartParam",
".",
"setNullable",
"(",
"true",
")",
";",
"}",
"catch",
"(",
"CloneNotSupportedException",
"ex",
")",
"{",
"m_fieldStartParam",
"=",
"null",
";",
"}",
"}",
"return",
"m_fieldStartParam",
";",
"case",
"DBConstants",
".",
"END_SELECT_KEY",
":",
"if",
"(",
"m_fieldEndParam",
"==",
"null",
")",
"{",
"try",
"{",
"m_fieldEndParam",
"=",
"(",
"BaseField",
")",
"m_field",
".",
"clone",
"(",
")",
";",
"m_fieldEndParam",
".",
"setFieldName",
"(",
"new",
"String",
"(",
"m_field",
".",
"getFieldName",
"(",
"false",
",",
"false",
")",
"+",
"\"End\"",
")",
")",
";",
"m_fieldEndParam",
".",
"setNullable",
"(",
"true",
")",
";",
"}",
"catch",
"(",
"CloneNotSupportedException",
"ex",
")",
"{",
"m_fieldEndParam",
"=",
"null",
";",
"}",
"}",
"return",
"m_fieldEndParam",
";",
"}",
"}"
] |
Get the field that this KeyField points to.
@param areaDesc KeyArea type File/Temp/Start/End.
@return The field.
|
[
"Get",
"the",
"field",
"that",
"this",
"KeyField",
"points",
"to",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/KeyField.java#L107-L151
|
152,712
|
pressgang-ccms/PressGangCCMSContentSpec
|
src/main/java/org/jboss/pressgang/ccms/contentspec/entities/InjectionOptions.java
|
InjectionOptions.getInjectionSetting
|
private String getInjectionSetting(final String input, final char startDelim) {
return input == null || input.equals("") ? null : StringUtilities.split(input, startDelim)[0].trim();
}
|
java
|
private String getInjectionSetting(final String input, final char startDelim) {
return input == null || input.equals("") ? null : StringUtilities.split(input, startDelim)[0].trim();
}
|
[
"private",
"String",
"getInjectionSetting",
"(",
"final",
"String",
"input",
",",
"final",
"char",
"startDelim",
")",
"{",
"return",
"input",
"==",
"null",
"||",
"input",
".",
"equals",
"(",
"\"\"",
")",
"?",
"null",
":",
"StringUtilities",
".",
"split",
"(",
"input",
",",
"startDelim",
")",
"[",
"0",
"]",
".",
"trim",
"(",
")",
";",
"}"
] |
Gets the Injection Setting for these options when using the String Constructor.
@param input The input to be parsed to get the setting.
@param startDelim The delimiter that specifies that start of options (ie '[')
@return The title as a String or null if the title is blank.
|
[
"Gets",
"the",
"Injection",
"Setting",
"for",
"these",
"options",
"when",
"using",
"the",
"String",
"Constructor",
"."
] |
2bc02e2971e4522b47a130fb7ae5a0f5ad377df1
|
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/entities/InjectionOptions.java#L78-L80
|
152,713
|
eostermueller/headlessInTraceClient
|
src/main/java/org/headlessintrace/client/connection/DefaultConnection.java
|
DefaultConnection.removeCallback
|
public int removeCallback(IConnectionStateCallback criteria) {
List<IConnectionStateCallback> listCallbacks = getConnectionDetail().getConnCallbacks();
/**
* If this method is about to delete the last callback, then
* there are no windows left listening, so it is safe to
* do a hard disconnect.
*/
if (listCallbacks.size() <= 1) {
getConnectionDetail().unHappyDisconnect();
listCallbacks.remove(criteria);
DefaultConnectionList connList = (DefaultConnectionList) DefaultConnectionList.getSingleton();
connList.remove(this);
} else {
//utter a last dying gasp (DISCONNECTED status) before removing the callback.
//criteria.setConnectionState(ConnectState.DISCONNECTED);
//broadcastConnectionState(criteria);
listCallbacks.remove(criteria);
}
return listCallbacks.size();
}
|
java
|
public int removeCallback(IConnectionStateCallback criteria) {
List<IConnectionStateCallback> listCallbacks = getConnectionDetail().getConnCallbacks();
/**
* If this method is about to delete the last callback, then
* there are no windows left listening, so it is safe to
* do a hard disconnect.
*/
if (listCallbacks.size() <= 1) {
getConnectionDetail().unHappyDisconnect();
listCallbacks.remove(criteria);
DefaultConnectionList connList = (DefaultConnectionList) DefaultConnectionList.getSingleton();
connList.remove(this);
} else {
//utter a last dying gasp (DISCONNECTED status) before removing the callback.
//criteria.setConnectionState(ConnectState.DISCONNECTED);
//broadcastConnectionState(criteria);
listCallbacks.remove(criteria);
}
return listCallbacks.size();
}
|
[
"public",
"int",
"removeCallback",
"(",
"IConnectionStateCallback",
"criteria",
")",
"{",
"List",
"<",
"IConnectionStateCallback",
">",
"listCallbacks",
"=",
"getConnectionDetail",
"(",
")",
".",
"getConnCallbacks",
"(",
")",
";",
"/**\n\t\t * If this method is about to delete the last callback, then\n\t\t * there are no windows left listening, so it is safe to\n\t\t * do a hard disconnect.\n\t\t */",
"if",
"(",
"listCallbacks",
".",
"size",
"(",
")",
"<=",
"1",
")",
"{",
"getConnectionDetail",
"(",
")",
".",
"unHappyDisconnect",
"(",
")",
";",
"listCallbacks",
".",
"remove",
"(",
"criteria",
")",
";",
"DefaultConnectionList",
"connList",
"=",
"(",
"DefaultConnectionList",
")",
"DefaultConnectionList",
".",
"getSingleton",
"(",
")",
";",
"connList",
".",
"remove",
"(",
"this",
")",
";",
"}",
"else",
"{",
"//utter a last dying gasp (DISCONNECTED status) before removing the callback.",
"//criteria.setConnectionState(ConnectState.DISCONNECTED);",
"//broadcastConnectionState(criteria);",
"listCallbacks",
".",
"remove",
"(",
"criteria",
")",
";",
"}",
"return",
"listCallbacks",
".",
"size",
"(",
")",
";",
"}"
] |
Returns the count of callbacks still listening to 'this'.
This method will perform a hard disconnect if 0 is returned.
@param criteria
@return
|
[
"Returns",
"the",
"count",
"of",
"callbacks",
"still",
"listening",
"to",
"this",
".",
"This",
"method",
"will",
"perform",
"a",
"hard",
"disconnect",
"if",
"0",
"is",
"returned",
"."
] |
50b1dccc5ff9e342c7c1d06b5a382e8c0afc7604
|
https://github.com/eostermueller/headlessInTraceClient/blob/50b1dccc5ff9e342c7c1d06b5a382e8c0afc7604/src/main/java/org/headlessintrace/client/connection/DefaultConnection.java#L233-L255
|
152,714
|
attribyte/wpdb
|
src/main/java/org/attribyte/wp/model/Site.java
|
Site.overrideWith
|
public Site overrideWith(final Site other) {
return new Site(
other.id > 0L ? other.id : this.id,
other.baseURL != null ? other.baseURL : this.baseURL,
other.title != null ? other.title : this.title,
other.description != null ? other.description : this.description,
other.permalinkStructure != null ? other.permalinkStructure : this.permalinkStructure,
other.defaultCategory != null ? other.defaultCategory : this.defaultCategory
);
}
|
java
|
public Site overrideWith(final Site other) {
return new Site(
other.id > 0L ? other.id : this.id,
other.baseURL != null ? other.baseURL : this.baseURL,
other.title != null ? other.title : this.title,
other.description != null ? other.description : this.description,
other.permalinkStructure != null ? other.permalinkStructure : this.permalinkStructure,
other.defaultCategory != null ? other.defaultCategory : this.defaultCategory
);
}
|
[
"public",
"Site",
"overrideWith",
"(",
"final",
"Site",
"other",
")",
"{",
"return",
"new",
"Site",
"(",
"other",
".",
"id",
">",
"0L",
"?",
"other",
".",
"id",
":",
"this",
".",
"id",
",",
"other",
".",
"baseURL",
"!=",
"null",
"?",
"other",
".",
"baseURL",
":",
"this",
".",
"baseURL",
",",
"other",
".",
"title",
"!=",
"null",
"?",
"other",
".",
"title",
":",
"this",
".",
"title",
",",
"other",
".",
"description",
"!=",
"null",
"?",
"other",
".",
"description",
":",
"this",
".",
"description",
",",
"other",
".",
"permalinkStructure",
"!=",
"null",
"?",
"other",
".",
"permalinkStructure",
":",
"this",
".",
"permalinkStructure",
",",
"other",
".",
"defaultCategory",
"!=",
"null",
"?",
"other",
".",
"defaultCategory",
":",
"this",
".",
"defaultCategory",
")",
";",
"}"
] |
Overrides values in this site with those in another, if set.
@param other The other site meta.
@return The site meta with overrides applied.
|
[
"Overrides",
"values",
"in",
"this",
"site",
"with",
"those",
"in",
"another",
"if",
"set",
"."
] |
b9adf6131dfb67899ebff770c9bfeb001cc42f30
|
https://github.com/attribyte/wpdb/blob/b9adf6131dfb67899ebff770c9bfeb001cc42f30/src/main/java/org/attribyte/wp/model/Site.java#L72-L81
|
152,715
|
attribyte/wpdb
|
src/main/java/org/attribyte/wp/model/Site.java
|
Site.buildPermalink
|
public String buildPermalink(final Post post) {
final String authorSlug = post.author != null ? Strings.nullToEmpty(post.author.slug) : "";
final List<TaxonomyTerm> categories = post.categories();
final Term categoryTerm = categories.size() > 0 ? categories.get(0).term : defaultCategory;
final String category = Strings.nullToEmpty(categoryTerm.slug);
final String post_id = Long.toString(post.id);
final DateTime publishTime = new DateTime(post.publishTimestamp);
final String year = Integer.toString(publishTime.getYear());
final String monthnum = String.format("%02d", publishTime.getMonthOfYear());
final String day = String.format("%02d", publishTime.getDayOfMonth());
final String hour = String.format("%02d", publishTime.getHourOfDay());
final String minute = String.format("%02d", publishTime.getMinuteOfHour());
final String second = String.format("%02d", publishTime.getSecondOfMinute());
final String path = permalinkStructure
.replace("%year%", year)
.replace("%monthnum%", monthnum)
.replace("%day%", day)
.replace("%hour%", hour)
.replace("%minute%", minute)
.replace("%second%", second)
.replace("%post_id%", post_id)
.replace("%postname%", Strings.nullToEmpty(post.slug))
.replace("%category%", category)
.replace("%author%", authorSlug);
return baseURL + path;
}
|
java
|
public String buildPermalink(final Post post) {
final String authorSlug = post.author != null ? Strings.nullToEmpty(post.author.slug) : "";
final List<TaxonomyTerm> categories = post.categories();
final Term categoryTerm = categories.size() > 0 ? categories.get(0).term : defaultCategory;
final String category = Strings.nullToEmpty(categoryTerm.slug);
final String post_id = Long.toString(post.id);
final DateTime publishTime = new DateTime(post.publishTimestamp);
final String year = Integer.toString(publishTime.getYear());
final String monthnum = String.format("%02d", publishTime.getMonthOfYear());
final String day = String.format("%02d", publishTime.getDayOfMonth());
final String hour = String.format("%02d", publishTime.getHourOfDay());
final String minute = String.format("%02d", publishTime.getMinuteOfHour());
final String second = String.format("%02d", publishTime.getSecondOfMinute());
final String path = permalinkStructure
.replace("%year%", year)
.replace("%monthnum%", monthnum)
.replace("%day%", day)
.replace("%hour%", hour)
.replace("%minute%", minute)
.replace("%second%", second)
.replace("%post_id%", post_id)
.replace("%postname%", Strings.nullToEmpty(post.slug))
.replace("%category%", category)
.replace("%author%", authorSlug);
return baseURL + path;
}
|
[
"public",
"String",
"buildPermalink",
"(",
"final",
"Post",
"post",
")",
"{",
"final",
"String",
"authorSlug",
"=",
"post",
".",
"author",
"!=",
"null",
"?",
"Strings",
".",
"nullToEmpty",
"(",
"post",
".",
"author",
".",
"slug",
")",
":",
"\"\"",
";",
"final",
"List",
"<",
"TaxonomyTerm",
">",
"categories",
"=",
"post",
".",
"categories",
"(",
")",
";",
"final",
"Term",
"categoryTerm",
"=",
"categories",
".",
"size",
"(",
")",
">",
"0",
"?",
"categories",
".",
"get",
"(",
"0",
")",
".",
"term",
":",
"defaultCategory",
";",
"final",
"String",
"category",
"=",
"Strings",
".",
"nullToEmpty",
"(",
"categoryTerm",
".",
"slug",
")",
";",
"final",
"String",
"post_id",
"=",
"Long",
".",
"toString",
"(",
"post",
".",
"id",
")",
";",
"final",
"DateTime",
"publishTime",
"=",
"new",
"DateTime",
"(",
"post",
".",
"publishTimestamp",
")",
";",
"final",
"String",
"year",
"=",
"Integer",
".",
"toString",
"(",
"publishTime",
".",
"getYear",
"(",
")",
")",
";",
"final",
"String",
"monthnum",
"=",
"String",
".",
"format",
"(",
"\"%02d\"",
",",
"publishTime",
".",
"getMonthOfYear",
"(",
")",
")",
";",
"final",
"String",
"day",
"=",
"String",
".",
"format",
"(",
"\"%02d\"",
",",
"publishTime",
".",
"getDayOfMonth",
"(",
")",
")",
";",
"final",
"String",
"hour",
"=",
"String",
".",
"format",
"(",
"\"%02d\"",
",",
"publishTime",
".",
"getHourOfDay",
"(",
")",
")",
";",
"final",
"String",
"minute",
"=",
"String",
".",
"format",
"(",
"\"%02d\"",
",",
"publishTime",
".",
"getMinuteOfHour",
"(",
")",
")",
";",
"final",
"String",
"second",
"=",
"String",
".",
"format",
"(",
"\"%02d\"",
",",
"publishTime",
".",
"getSecondOfMinute",
"(",
")",
")",
";",
"final",
"String",
"path",
"=",
"permalinkStructure",
".",
"replace",
"(",
"\"%year%\"",
",",
"year",
")",
".",
"replace",
"(",
"\"%monthnum%\"",
",",
"monthnum",
")",
".",
"replace",
"(",
"\"%day%\"",
",",
"day",
")",
".",
"replace",
"(",
"\"%hour%\"",
",",
"hour",
")",
".",
"replace",
"(",
"\"%minute%\"",
",",
"minute",
")",
".",
"replace",
"(",
"\"%second%\"",
",",
"second",
")",
".",
"replace",
"(",
"\"%post_id%\"",
",",
"post_id",
")",
".",
"replace",
"(",
"\"%postname%\"",
",",
"Strings",
".",
"nullToEmpty",
"(",
"post",
".",
"slug",
")",
")",
".",
"replace",
"(",
"\"%category%\"",
",",
"category",
")",
".",
"replace",
"(",
"\"%author%\"",
",",
"authorSlug",
")",
";",
"return",
"baseURL",
"+",
"path",
";",
"}"
] |
Builds the permalink for a post from this site.
@param post The post.
@return The permalink string.
@see <a href="https://codex.wordpress.org/Using_Permalinks">https://codex.wordpress.org/Using_Permalinks</a>
|
[
"Builds",
"the",
"permalink",
"for",
"a",
"post",
"from",
"this",
"site",
"."
] |
b9adf6131dfb67899ebff770c9bfeb001cc42f30
|
https://github.com/attribyte/wpdb/blob/b9adf6131dfb67899ebff770c9bfeb001cc42f30/src/main/java/org/attribyte/wp/model/Site.java#L154-L180
|
152,716
|
jbundle/jbundle
|
thin/base/screen/util/src/main/java/org/jbundle/thin/base/screen/util/JBlinkLabel.java
|
JBlinkLabel.init
|
public void init(Object obj)
{
for (int i = 0; i < MAX_ICONS; i++)
{
ImageIcon icon = this.getImageIcon(i);
if (icon == null)
break;
this.addIcon(icon, i);
}
}
|
java
|
public void init(Object obj)
{
for (int i = 0; i < MAX_ICONS; i++)
{
ImageIcon icon = this.getImageIcon(i);
if (icon == null)
break;
this.addIcon(icon, i);
}
}
|
[
"public",
"void",
"init",
"(",
"Object",
"obj",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"MAX_ICONS",
";",
"i",
"++",
")",
"{",
"ImageIcon",
"icon",
"=",
"this",
".",
"getImageIcon",
"(",
"i",
")",
";",
"if",
"(",
"icon",
"==",
"null",
")",
"break",
";",
"this",
".",
"addIcon",
"(",
"icon",
",",
"i",
")",
";",
"}",
"}"
] |
Creates new JBlinkLabel.
@param obj Undefined.
|
[
"Creates",
"new",
"JBlinkLabel",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/util/src/main/java/org/jbundle/thin/base/screen/util/JBlinkLabel.java#L100-L109
|
152,717
|
jbundle/jbundle
|
thin/base/screen/util/src/main/java/org/jbundle/thin/base/screen/util/JBlinkLabel.java
|
JBlinkLabel.getTableCellRendererComponent
|
public java.awt.Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
{
if (m_table == null)
{ // Cache this for later.
m_table = table;
// The following code is here because the column of this component is sometimes different from the column in the model:
TableColumnModel columnModel = table.getColumnModel();
for (int iColumn = 0; iColumn < columnModel.getColumnCount(); iColumn++)
{
TableColumn tableColumn = columnModel.getColumn(iColumn);
TableCellRenderer renderer = tableColumn.getCellRenderer();
if (renderer == this)
m_iThisColumn = column;
}
}
m_iThisRow = row;
ImageIcon icon = this.getImageIcon(value);
this.setIcon(icon);
return this;
}
|
java
|
public java.awt.Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
{
if (m_table == null)
{ // Cache this for later.
m_table = table;
// The following code is here because the column of this component is sometimes different from the column in the model:
TableColumnModel columnModel = table.getColumnModel();
for (int iColumn = 0; iColumn < columnModel.getColumnCount(); iColumn++)
{
TableColumn tableColumn = columnModel.getColumn(iColumn);
TableCellRenderer renderer = tableColumn.getCellRenderer();
if (renderer == this)
m_iThisColumn = column;
}
}
m_iThisRow = row;
ImageIcon icon = this.getImageIcon(value);
this.setIcon(icon);
return this;
}
|
[
"public",
"java",
".",
"awt",
".",
"Component",
"getTableCellRendererComponent",
"(",
"JTable",
"table",
",",
"Object",
"value",
",",
"boolean",
"isSelected",
",",
"boolean",
"hasFocus",
",",
"int",
"row",
",",
"int",
"column",
")",
"{",
"if",
"(",
"m_table",
"==",
"null",
")",
"{",
"// Cache this for later.",
"m_table",
"=",
"table",
";",
"// The following code is here because the column of this component is sometimes different from the column in the model:",
"TableColumnModel",
"columnModel",
"=",
"table",
".",
"getColumnModel",
"(",
")",
";",
"for",
"(",
"int",
"iColumn",
"=",
"0",
";",
"iColumn",
"<",
"columnModel",
".",
"getColumnCount",
"(",
")",
";",
"iColumn",
"++",
")",
"{",
"TableColumn",
"tableColumn",
"=",
"columnModel",
".",
"getColumn",
"(",
"iColumn",
")",
";",
"TableCellRenderer",
"renderer",
"=",
"tableColumn",
".",
"getCellRenderer",
"(",
")",
";",
"if",
"(",
"renderer",
"==",
"this",
")",
"m_iThisColumn",
"=",
"column",
";",
"}",
"}",
"m_iThisRow",
"=",
"row",
";",
"ImageIcon",
"icon",
"=",
"this",
".",
"getImageIcon",
"(",
"value",
")",
";",
"this",
".",
"setIcon",
"(",
"icon",
")",
";",
"return",
"this",
";",
"}"
] |
If this control is in a JTable, this is how to render it.
@param table The table this component is in.
@param value The value of this cell.
@param isSelected True if selected.
@param hasFocus True if focused.
@param row The table row.
@param column The table column.
@return This component (after updating for blink).
|
[
"If",
"this",
"control",
"is",
"in",
"a",
"JTable",
"this",
"is",
"how",
"to",
"render",
"it",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/util/src/main/java/org/jbundle/thin/base/screen/util/JBlinkLabel.java#L128-L147
|
152,718
|
jbundle/jbundle
|
thin/base/screen/util/src/main/java/org/jbundle/thin/base/screen/util/JBlinkLabel.java
|
JBlinkLabel.getImageIcon
|
public ImageIcon getImageIcon(Object value)
{
if (value == null)
return m_rgIcons[0];
String strType = value.toString();
int iType = 0;
try {
iType = Integer.parseInt(strType);
} catch (NumberFormatException ex) {
}
if (m_rgIcons == null)
return null;
int iIconCount = 0;
for (int i = 1; i < MAX_ICONS; i++)
{
if (m_rgIcons[i] != null)
if (((1 << i) & iType) != 0) // Only count icons in this type
iIconCount++;
}
if (iIconCount == 0)
iIconCount = 1;
int iRelIndex;
if ((iType & 1) == 0)
{ // Cycle through all the icons
iRelIndex = m_iCurrentIcon % iIconCount; // Remainder of division
}
else
{ // Alternate from 0, next, 0, next, etc
if ((m_iCurrentIcon & 1) == 0)
iRelIndex = MAX_ICONS; // Icon 0
else
{
int iIconIndex = m_iCurrentIcon / 2 + 1;
iRelIndex = iIconIndex % iIconCount; // Remainder of division
}
}
int i;
for (i = 1; i < MAX_ICONS; i++)
{
if (m_rgIcons[i] != null)
if (((1 << i) & iType) != 0) // Only count icons in this type
iRelIndex--;
if (iRelIndex < 0)
break;
}
if (i >= MAX_ICONS)
i = 0;
return m_rgIcons[i];
}
|
java
|
public ImageIcon getImageIcon(Object value)
{
if (value == null)
return m_rgIcons[0];
String strType = value.toString();
int iType = 0;
try {
iType = Integer.parseInt(strType);
} catch (NumberFormatException ex) {
}
if (m_rgIcons == null)
return null;
int iIconCount = 0;
for (int i = 1; i < MAX_ICONS; i++)
{
if (m_rgIcons[i] != null)
if (((1 << i) & iType) != 0) // Only count icons in this type
iIconCount++;
}
if (iIconCount == 0)
iIconCount = 1;
int iRelIndex;
if ((iType & 1) == 0)
{ // Cycle through all the icons
iRelIndex = m_iCurrentIcon % iIconCount; // Remainder of division
}
else
{ // Alternate from 0, next, 0, next, etc
if ((m_iCurrentIcon & 1) == 0)
iRelIndex = MAX_ICONS; // Icon 0
else
{
int iIconIndex = m_iCurrentIcon / 2 + 1;
iRelIndex = iIconIndex % iIconCount; // Remainder of division
}
}
int i;
for (i = 1; i < MAX_ICONS; i++)
{
if (m_rgIcons[i] != null)
if (((1 << i) & iType) != 0) // Only count icons in this type
iRelIndex--;
if (iRelIndex < 0)
break;
}
if (i >= MAX_ICONS)
i = 0;
return m_rgIcons[i];
}
|
[
"public",
"ImageIcon",
"getImageIcon",
"(",
"Object",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"return",
"m_rgIcons",
"[",
"0",
"]",
";",
"String",
"strType",
"=",
"value",
".",
"toString",
"(",
")",
";",
"int",
"iType",
"=",
"0",
";",
"try",
"{",
"iType",
"=",
"Integer",
".",
"parseInt",
"(",
"strType",
")",
";",
"}",
"catch",
"(",
"NumberFormatException",
"ex",
")",
"{",
"}",
"if",
"(",
"m_rgIcons",
"==",
"null",
")",
"return",
"null",
";",
"int",
"iIconCount",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<",
"MAX_ICONS",
";",
"i",
"++",
")",
"{",
"if",
"(",
"m_rgIcons",
"[",
"i",
"]",
"!=",
"null",
")",
"if",
"(",
"(",
"(",
"1",
"<<",
"i",
")",
"&",
"iType",
")",
"!=",
"0",
")",
"// Only count icons in this type",
"iIconCount",
"++",
";",
"}",
"if",
"(",
"iIconCount",
"==",
"0",
")",
"iIconCount",
"=",
"1",
";",
"int",
"iRelIndex",
";",
"if",
"(",
"(",
"iType",
"&",
"1",
")",
"==",
"0",
")",
"{",
"// Cycle through all the icons",
"iRelIndex",
"=",
"m_iCurrentIcon",
"%",
"iIconCount",
";",
"// Remainder of division",
"}",
"else",
"{",
"// Alternate from 0, next, 0, next, etc",
"if",
"(",
"(",
"m_iCurrentIcon",
"&",
"1",
")",
"==",
"0",
")",
"iRelIndex",
"=",
"MAX_ICONS",
";",
"// Icon 0",
"else",
"{",
"int",
"iIconIndex",
"=",
"m_iCurrentIcon",
"/",
"2",
"+",
"1",
";",
"iRelIndex",
"=",
"iIconIndex",
"%",
"iIconCount",
";",
"// Remainder of division",
"}",
"}",
"int",
"i",
";",
"for",
"(",
"i",
"=",
"1",
";",
"i",
"<",
"MAX_ICONS",
";",
"i",
"++",
")",
"{",
"if",
"(",
"m_rgIcons",
"[",
"i",
"]",
"!=",
"null",
")",
"if",
"(",
"(",
"(",
"1",
"<<",
"i",
")",
"&",
"iType",
")",
"!=",
"0",
")",
"// Only count icons in this type",
"iRelIndex",
"--",
";",
"if",
"(",
"iRelIndex",
"<",
"0",
")",
"break",
";",
"}",
"if",
"(",
"i",
">=",
"MAX_ICONS",
")",
"i",
"=",
"0",
";",
"return",
"m_rgIcons",
"[",
"i",
"]",
";",
"}"
] |
Here is the value of this object, display the correct image.
@return The appropriate image.
|
[
"Here",
"is",
"the",
"value",
"of",
"this",
"object",
"display",
"the",
"correct",
"image",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/util/src/main/java/org/jbundle/thin/base/screen/util/JBlinkLabel.java#L152-L202
|
152,719
|
jbundle/jbundle
|
thin/base/screen/util/src/main/java/org/jbundle/thin/base/screen/util/JBlinkLabel.java
|
JBlinkLabel.addIcon
|
public void addIcon(Object icon, int iIndex)
{
if (m_rgIcons == null)
{
m_rgIcons = new ImageIcon[MAX_ICONS];
m_timer = new javax.swing.Timer(500, this); // Remind me to change graphics every 1/2 second
m_timer.start();
}
if (iIndex < MAX_ICONS)
if (icon instanceof ImageIcon) // Always
m_rgIcons[iIndex] = (ImageIcon)icon;
}
|
java
|
public void addIcon(Object icon, int iIndex)
{
if (m_rgIcons == null)
{
m_rgIcons = new ImageIcon[MAX_ICONS];
m_timer = new javax.swing.Timer(500, this); // Remind me to change graphics every 1/2 second
m_timer.start();
}
if (iIndex < MAX_ICONS)
if (icon instanceof ImageIcon) // Always
m_rgIcons[iIndex] = (ImageIcon)icon;
}
|
[
"public",
"void",
"addIcon",
"(",
"Object",
"icon",
",",
"int",
"iIndex",
")",
"{",
"if",
"(",
"m_rgIcons",
"==",
"null",
")",
"{",
"m_rgIcons",
"=",
"new",
"ImageIcon",
"[",
"MAX_ICONS",
"]",
";",
"m_timer",
"=",
"new",
"javax",
".",
"swing",
".",
"Timer",
"(",
"500",
",",
"this",
")",
";",
"// Remind me to change graphics every 1/2 second",
"m_timer",
".",
"start",
"(",
")",
";",
"}",
"if",
"(",
"iIndex",
"<",
"MAX_ICONS",
")",
"if",
"(",
"icon",
"instanceof",
"ImageIcon",
")",
"// Always",
"m_rgIcons",
"[",
"iIndex",
"]",
"=",
"(",
"ImageIcon",
")",
"icon",
";",
"}"
] |
Add this icon to the list of icons alternating for this label.
@param icon The icon to add.
@param iIndex The index for this icon.
|
[
"Add",
"this",
"icon",
"to",
"the",
"list",
"of",
"icons",
"alternating",
"for",
"this",
"label",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/util/src/main/java/org/jbundle/thin/base/screen/util/JBlinkLabel.java#L208-L219
|
152,720
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/bean/AbstractBeanField.java
|
AbstractBeanField.set
|
@Override
public void set(Object value)
{
try
{
Object v = ConvertUtility.convert(type, value);
if (field != null)
{
field.set(getBase(), v);
}
else
{
setter.invoke(getBase(), v);
}
}
catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException ex)
{
throw new IllegalArgumentException(ex);
}
}
|
java
|
@Override
public void set(Object value)
{
try
{
Object v = ConvertUtility.convert(type, value);
if (field != null)
{
field.set(getBase(), v);
}
else
{
setter.invoke(getBase(), v);
}
}
catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException ex)
{
throw new IllegalArgumentException(ex);
}
}
|
[
"@",
"Override",
"public",
"void",
"set",
"(",
"Object",
"value",
")",
"{",
"try",
"{",
"Object",
"v",
"=",
"ConvertUtility",
".",
"convert",
"(",
"type",
",",
"value",
")",
";",
"if",
"(",
"field",
"!=",
"null",
")",
"{",
"field",
".",
"set",
"(",
"getBase",
"(",
")",
",",
"v",
")",
";",
"}",
"else",
"{",
"setter",
".",
"invoke",
"(",
"getBase",
"(",
")",
",",
"v",
")",
";",
"}",
"}",
"catch",
"(",
"IllegalAccessException",
"|",
"IllegalArgumentException",
"|",
"InvocationTargetException",
"ex",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"ex",
")",
";",
"}",
"}"
] |
Set value using type conversions
@param value
@see org.vesalainen.util.ConvertUtility#convert(java.lang.Class, java.lang.Object)
|
[
"Set",
"value",
"using",
"type",
"conversions"
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/bean/AbstractBeanField.java#L93-L112
|
152,721
|
carewebframework/carewebframework-vista
|
org.carewebframework.vista.plugin-parent/org.carewebframework.vista.plugin.documents/src/main/java/org/carewebframework/vista/plugin/documents/DocumentDisplayComboRenderer.java
|
DocumentDisplayComboRenderer.renderItem
|
@Override
public void renderItem(final Comboitem item, final Document doc) {
item.setLabel(doc.getTitle());
}
|
java
|
@Override
public void renderItem(final Comboitem item, final Document doc) {
item.setLabel(doc.getTitle());
}
|
[
"@",
"Override",
"public",
"void",
"renderItem",
"(",
"final",
"Comboitem",
"item",
",",
"final",
"Document",
"doc",
")",
"{",
"item",
".",
"setLabel",
"(",
"doc",
".",
"getTitle",
"(",
")",
")",
";",
"}"
] |
Render the combo item for the specified document.
@param item Combo item to render.
@param doc The document associated with the list item.
|
[
"Render",
"the",
"combo",
"item",
"for",
"the",
"specified",
"document",
"."
] |
883b2cbe395d9e8a21cd19db820f0876bda6b1c6
|
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.plugin-parent/org.carewebframework.vista.plugin.documents/src/main/java/org/carewebframework/vista/plugin/documents/DocumentDisplayComboRenderer.java#L44-L47
|
152,722
|
jbundle/jbundle
|
app/program/script/src/main/java/org/jbundle/app/program/script/scan/XslRepositoryScanListener.java
|
XslRepositoryScanListener.readFile
|
public String readFile(String filename)
{
String path = m_fileSource.getParent();
String string = Utility.transferURLStream("file:" + path + '/' + filename, null, null, null);
if (string != null)
{
int start = string.indexOf("<repository");
if (start != -1)
start = string.indexOf(">", start);
int end = string.lastIndexOf("</repository>");
if ((start != -1) && (end != -1))
string = string.substring(start + 1, end);
}
return string;
}
|
java
|
public String readFile(String filename)
{
String path = m_fileSource.getParent();
String string = Utility.transferURLStream("file:" + path + '/' + filename, null, null, null);
if (string != null)
{
int start = string.indexOf("<repository");
if (start != -1)
start = string.indexOf(">", start);
int end = string.lastIndexOf("</repository>");
if ((start != -1) && (end != -1))
string = string.substring(start + 1, end);
}
return string;
}
|
[
"public",
"String",
"readFile",
"(",
"String",
"filename",
")",
"{",
"String",
"path",
"=",
"m_fileSource",
".",
"getParent",
"(",
")",
";",
"String",
"string",
"=",
"Utility",
".",
"transferURLStream",
"(",
"\"file:\"",
"+",
"path",
"+",
"'",
"'",
"+",
"filename",
",",
"null",
",",
"null",
",",
"null",
")",
";",
"if",
"(",
"string",
"!=",
"null",
")",
"{",
"int",
"start",
"=",
"string",
".",
"indexOf",
"(",
"\"<repository\"",
")",
";",
"if",
"(",
"start",
"!=",
"-",
"1",
")",
"start",
"=",
"string",
".",
"indexOf",
"(",
"\">\"",
",",
"start",
")",
";",
"int",
"end",
"=",
"string",
".",
"lastIndexOf",
"(",
"\"</repository>\"",
")",
";",
"if",
"(",
"(",
"start",
"!=",
"-",
"1",
")",
"&&",
"(",
"end",
"!=",
"-",
"1",
")",
")",
"string",
"=",
"string",
".",
"substring",
"(",
"start",
"+",
"1",
",",
"end",
")",
";",
"}",
"return",
"string",
";",
"}"
] |
ReadFile Method.
|
[
"ReadFile",
"Method",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/script/src/main/java/org/jbundle/app/program/script/scan/XslRepositoryScanListener.java#L78-L92
|
152,723
|
lightblueseas/file-worker
|
src/main/java/de/alpharogroup/file/compare/SimpleCompareFileExtensions.java
|
SimpleCompareFileExtensions.compareFilesByAbsolutePath
|
public static boolean compareFilesByAbsolutePath(final File sourceFile,
final File fileToCompare)
{
return CompareFileExtensions
.compareFiles(sourceFile, fileToCompare, false, true, true, true, true, true)
.getAbsolutePathEquality();
}
|
java
|
public static boolean compareFilesByAbsolutePath(final File sourceFile,
final File fileToCompare)
{
return CompareFileExtensions
.compareFiles(sourceFile, fileToCompare, false, true, true, true, true, true)
.getAbsolutePathEquality();
}
|
[
"public",
"static",
"boolean",
"compareFilesByAbsolutePath",
"(",
"final",
"File",
"sourceFile",
",",
"final",
"File",
"fileToCompare",
")",
"{",
"return",
"CompareFileExtensions",
".",
"compareFiles",
"(",
"sourceFile",
",",
"fileToCompare",
",",
"false",
",",
"true",
",",
"true",
",",
"true",
",",
"true",
",",
"true",
")",
".",
"getAbsolutePathEquality",
"(",
")",
";",
"}"
] |
Compare files by absolute path.
@param sourceFile
the source file
@param fileToCompare
the file to compare
@return true if the absolute path are equal, otherwise false.
|
[
"Compare",
"files",
"by",
"absolute",
"path",
"."
] |
2c81de10fb5d68de64c1abc3ed64ca681ce76da8
|
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/compare/SimpleCompareFileExtensions.java#L51-L57
|
152,724
|
lightblueseas/file-worker
|
src/main/java/de/alpharogroup/file/compare/SimpleCompareFileExtensions.java
|
SimpleCompareFileExtensions.compareFilesByChecksumCRC32
|
public static boolean compareFilesByChecksumCRC32(final File sourceFile,
final File fileToCompare) throws IOException
{
final long checksumSourceFile = ChecksumExtensions.getCheckSumCRC32(sourceFile);
final long checksumFileToCompare = ChecksumExtensions.getCheckSumCRC32(fileToCompare);
return checksumSourceFile == checksumFileToCompare;
}
|
java
|
public static boolean compareFilesByChecksumCRC32(final File sourceFile,
final File fileToCompare) throws IOException
{
final long checksumSourceFile = ChecksumExtensions.getCheckSumCRC32(sourceFile);
final long checksumFileToCompare = ChecksumExtensions.getCheckSumCRC32(fileToCompare);
return checksumSourceFile == checksumFileToCompare;
}
|
[
"public",
"static",
"boolean",
"compareFilesByChecksumCRC32",
"(",
"final",
"File",
"sourceFile",
",",
"final",
"File",
"fileToCompare",
")",
"throws",
"IOException",
"{",
"final",
"long",
"checksumSourceFile",
"=",
"ChecksumExtensions",
".",
"getCheckSumCRC32",
"(",
"sourceFile",
")",
";",
"final",
"long",
"checksumFileToCompare",
"=",
"ChecksumExtensions",
".",
"getCheckSumCRC32",
"(",
"fileToCompare",
")",
";",
"return",
"checksumSourceFile",
"==",
"checksumFileToCompare",
";",
"}"
] |
Compare files by checksum with the algorithm CRC32.
@param sourceFile
the source file
@param fileToCompare
the file to compare
@return true if the checksum with the algorithm CRC32 are equal, otherwise false.
@throws IOException
Signals that an I/O exception has occurred.
|
[
"Compare",
"files",
"by",
"checksum",
"with",
"the",
"algorithm",
"CRC32",
"."
] |
2c81de10fb5d68de64c1abc3ed64ca681ce76da8
|
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/compare/SimpleCompareFileExtensions.java#L113-L119
|
152,725
|
lightblueseas/file-worker
|
src/main/java/de/alpharogroup/file/compare/SimpleCompareFileExtensions.java
|
SimpleCompareFileExtensions.compareFilesByContent
|
public static boolean compareFilesByContent(final File sourceFile, final File fileToCompare)
{
return CompareFileExtensions
.compareFiles(sourceFile, fileToCompare, true, true, true, true, true, false)
.getContentEquality();
}
|
java
|
public static boolean compareFilesByContent(final File sourceFile, final File fileToCompare)
{
return CompareFileExtensions
.compareFiles(sourceFile, fileToCompare, true, true, true, true, true, false)
.getContentEquality();
}
|
[
"public",
"static",
"boolean",
"compareFilesByContent",
"(",
"final",
"File",
"sourceFile",
",",
"final",
"File",
"fileToCompare",
")",
"{",
"return",
"CompareFileExtensions",
".",
"compareFiles",
"(",
"sourceFile",
",",
"fileToCompare",
",",
"true",
",",
"true",
",",
"true",
",",
"true",
",",
"true",
",",
"false",
")",
".",
"getContentEquality",
"(",
")",
";",
"}"
] |
Compare files by content.
@param sourceFile
the source file
@param fileToCompare
the file to compare
@return true if the content are equal, otherwise false.
|
[
"Compare",
"files",
"by",
"content",
"."
] |
2c81de10fb5d68de64c1abc3ed64ca681ce76da8
|
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/compare/SimpleCompareFileExtensions.java#L131-L136
|
152,726
|
lightblueseas/file-worker
|
src/main/java/de/alpharogroup/file/compare/SimpleCompareFileExtensions.java
|
SimpleCompareFileExtensions.compareFilesByExtension
|
public static boolean compareFilesByExtension(final File sourceFile, final File fileToCompare)
{
return CompareFileExtensions
.compareFiles(sourceFile, fileToCompare, true, false, true, true, true, true)
.getFileExtensionEquality();
}
|
java
|
public static boolean compareFilesByExtension(final File sourceFile, final File fileToCompare)
{
return CompareFileExtensions
.compareFiles(sourceFile, fileToCompare, true, false, true, true, true, true)
.getFileExtensionEquality();
}
|
[
"public",
"static",
"boolean",
"compareFilesByExtension",
"(",
"final",
"File",
"sourceFile",
",",
"final",
"File",
"fileToCompare",
")",
"{",
"return",
"CompareFileExtensions",
".",
"compareFiles",
"(",
"sourceFile",
",",
"fileToCompare",
",",
"true",
",",
"false",
",",
"true",
",",
"true",
",",
"true",
",",
"true",
")",
".",
"getFileExtensionEquality",
"(",
")",
";",
"}"
] |
Compare files by extension.
@param sourceFile
the source file
@param fileToCompare
the file to compare
@return true if the extension are equal, otherwise false.
|
[
"Compare",
"files",
"by",
"extension",
"."
] |
2c81de10fb5d68de64c1abc3ed64ca681ce76da8
|
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/compare/SimpleCompareFileExtensions.java#L147-L152
|
152,727
|
lightblueseas/file-worker
|
src/main/java/de/alpharogroup/file/compare/SimpleCompareFileExtensions.java
|
SimpleCompareFileExtensions.compareFilesByLastModified
|
public static boolean compareFilesByLastModified(final File sourceFile,
final File fileToCompare)
{
return CompareFileExtensions
.compareFiles(sourceFile, fileToCompare, true, true, true, false, true, true)
.getLastModifiedEquality();
}
|
java
|
public static boolean compareFilesByLastModified(final File sourceFile,
final File fileToCompare)
{
return CompareFileExtensions
.compareFiles(sourceFile, fileToCompare, true, true, true, false, true, true)
.getLastModifiedEquality();
}
|
[
"public",
"static",
"boolean",
"compareFilesByLastModified",
"(",
"final",
"File",
"sourceFile",
",",
"final",
"File",
"fileToCompare",
")",
"{",
"return",
"CompareFileExtensions",
".",
"compareFiles",
"(",
"sourceFile",
",",
"fileToCompare",
",",
"true",
",",
"true",
",",
"true",
",",
"false",
",",
"true",
",",
"true",
")",
".",
"getLastModifiedEquality",
"(",
")",
";",
"}"
] |
Compare files by last modified.
@param sourceFile
the source file
@param fileToCompare
the file to compare
@return true if the last modified are equal, otherwise false.
|
[
"Compare",
"files",
"by",
"last",
"modified",
"."
] |
2c81de10fb5d68de64c1abc3ed64ca681ce76da8
|
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/compare/SimpleCompareFileExtensions.java#L163-L169
|
152,728
|
lightblueseas/file-worker
|
src/main/java/de/alpharogroup/file/compare/SimpleCompareFileExtensions.java
|
SimpleCompareFileExtensions.compareFilesByLength
|
public static boolean compareFilesByLength(final File sourceFile, final File fileToCompare)
{
return CompareFileExtensions
.compareFiles(sourceFile, fileToCompare, true, true, false, true, true, true)
.getLengthEquality();
}
|
java
|
public static boolean compareFilesByLength(final File sourceFile, final File fileToCompare)
{
return CompareFileExtensions
.compareFiles(sourceFile, fileToCompare, true, true, false, true, true, true)
.getLengthEquality();
}
|
[
"public",
"static",
"boolean",
"compareFilesByLength",
"(",
"final",
"File",
"sourceFile",
",",
"final",
"File",
"fileToCompare",
")",
"{",
"return",
"CompareFileExtensions",
".",
"compareFiles",
"(",
"sourceFile",
",",
"fileToCompare",
",",
"true",
",",
"true",
",",
"false",
",",
"true",
",",
"true",
",",
"true",
")",
".",
"getLengthEquality",
"(",
")",
";",
"}"
] |
Compare files by length.
@param sourceFile
the source file
@param fileToCompare
the file to compare
@return true if the length are equal, otherwise false.
|
[
"Compare",
"files",
"by",
"length",
"."
] |
2c81de10fb5d68de64c1abc3ed64ca681ce76da8
|
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/compare/SimpleCompareFileExtensions.java#L180-L185
|
152,729
|
lightblueseas/file-worker
|
src/main/java/de/alpharogroup/file/compare/SimpleCompareFileExtensions.java
|
SimpleCompareFileExtensions.compareFilesByName
|
public static boolean compareFilesByName(final File sourceFile, final File fileToCompare)
{
return CompareFileExtensions
.compareFiles(sourceFile, fileToCompare, true, true, true, true, false, true)
.getNameEquality();
}
|
java
|
public static boolean compareFilesByName(final File sourceFile, final File fileToCompare)
{
return CompareFileExtensions
.compareFiles(sourceFile, fileToCompare, true, true, true, true, false, true)
.getNameEquality();
}
|
[
"public",
"static",
"boolean",
"compareFilesByName",
"(",
"final",
"File",
"sourceFile",
",",
"final",
"File",
"fileToCompare",
")",
"{",
"return",
"CompareFileExtensions",
".",
"compareFiles",
"(",
"sourceFile",
",",
"fileToCompare",
",",
"true",
",",
"true",
",",
"true",
",",
"true",
",",
"false",
",",
"true",
")",
".",
"getNameEquality",
"(",
")",
";",
"}"
] |
Compare files by name.
@param sourceFile
the source file
@param fileToCompare
the file to compare
@return true if the name are equal, otherwise false.
|
[
"Compare",
"files",
"by",
"name",
"."
] |
2c81de10fb5d68de64c1abc3ed64ca681ce76da8
|
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/compare/SimpleCompareFileExtensions.java#L196-L201
|
152,730
|
hdecarne/java-default
|
src/main/java/de/carne/util/function/FunctionException.java
|
FunctionException.rethrow
|
public <T extends Exception> T rethrow(Class<T> exceptionType) {
return exceptionType.cast(getCause());
}
|
java
|
public <T extends Exception> T rethrow(Class<T> exceptionType) {
return exceptionType.cast(getCause());
}
|
[
"public",
"<",
"T",
"extends",
"Exception",
">",
"T",
"rethrow",
"(",
"Class",
"<",
"T",
">",
"exceptionType",
")",
"{",
"return",
"exceptionType",
".",
"cast",
"(",
"getCause",
"(",
")",
")",
";",
"}"
] |
Get the wrapped exception for re-throwing.
@param <T> The wrapped excption's type.
@param exceptionType The wrapped exception type.
@return The wrapped exception.
|
[
"Get",
"the",
"wrapped",
"exception",
"for",
"re",
"-",
"throwing",
"."
] |
ca16f6fdb0436e90e9e2df3106055e320bb3c9e3
|
https://github.com/hdecarne/java-default/blob/ca16f6fdb0436e90e9e2df3106055e320bb3c9e3/src/main/java/de/carne/util/function/FunctionException.java#L42-L44
|
152,731
|
jbundle/jbundle
|
thin/base/screen/util/src/main/java/org/jbundle/thin/base/screen/util/SwingPortableImageUtil.java
|
SwingPortableImageUtil.getTracker
|
private MediaTracker getTracker() {
// Opt: Only synchronize if trackerObj comes back null?
// If null, synchronize, re-check for null, and put new tracker
synchronized(this) {
if (tracker == null) {
@SuppressWarnings("serial")
Component comp = new Component() {};
tracker = new MediaTracker(comp);
}
}
return (MediaTracker) tracker;
}
|
java
|
private MediaTracker getTracker() {
// Opt: Only synchronize if trackerObj comes back null?
// If null, synchronize, re-check for null, and put new tracker
synchronized(this) {
if (tracker == null) {
@SuppressWarnings("serial")
Component comp = new Component() {};
tracker = new MediaTracker(comp);
}
}
return (MediaTracker) tracker;
}
|
[
"private",
"MediaTracker",
"getTracker",
"(",
")",
"{",
"// Opt: Only synchronize if trackerObj comes back null?",
"// If null, synchronize, re-check for null, and put new tracker",
"synchronized",
"(",
"this",
")",
"{",
"if",
"(",
"tracker",
"==",
"null",
")",
"{",
"@",
"SuppressWarnings",
"(",
"\"serial\"",
")",
"Component",
"comp",
"=",
"new",
"Component",
"(",
")",
"{",
"}",
";",
"tracker",
"=",
"new",
"MediaTracker",
"(",
"comp",
")",
";",
"}",
"}",
"return",
"(",
"MediaTracker",
")",
"tracker",
";",
"}"
] |
Returns the MediaTracker for the current AppContext, creating a new
MediaTracker if necessary.
|
[
"Returns",
"the",
"MediaTracker",
"for",
"the",
"current",
"AppContext",
"creating",
"a",
"new",
"MediaTracker",
"if",
"necessary",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/util/src/main/java/org/jbundle/thin/base/screen/util/SwingPortableImageUtil.java#L144-L155
|
152,732
|
the-fascinator/plugin-indexer-solr
|
src/main/java/com/googlecode/fascinator/indexer/rules/AddField.java
|
AddField.run
|
@Override
public void run(Reader in, Writer out) throws RuleException {
//log("Adding field [" + field + "]");
try {
AddDoc addDoc = AddDoc.read(in);
addDoc.getFields().add(field);
addDoc.write(out);
} catch (JAXBException jaxbe) {
throw new RuleException(jaxbe.getLinkedException());
}
}
|
java
|
@Override
public void run(Reader in, Writer out) throws RuleException {
//log("Adding field [" + field + "]");
try {
AddDoc addDoc = AddDoc.read(in);
addDoc.getFields().add(field);
addDoc.write(out);
} catch (JAXBException jaxbe) {
throw new RuleException(jaxbe.getLinkedException());
}
}
|
[
"@",
"Override",
"public",
"void",
"run",
"(",
"Reader",
"in",
",",
"Writer",
"out",
")",
"throws",
"RuleException",
"{",
"//log(\"Adding field [\" + field + \"]\");",
"try",
"{",
"AddDoc",
"addDoc",
"=",
"AddDoc",
".",
"read",
"(",
"in",
")",
";",
"addDoc",
".",
"getFields",
"(",
")",
".",
"add",
"(",
"field",
")",
";",
"addDoc",
".",
"write",
"(",
"out",
")",
";",
"}",
"catch",
"(",
"JAXBException",
"jaxbe",
")",
"{",
"throw",
"new",
"RuleException",
"(",
"jaxbe",
".",
"getLinkedException",
"(",
")",
")",
";",
"}",
"}"
] |
Adds a single field to a Solr document
@param in Solr document
@param out Solr document with added field
|
[
"Adds",
"a",
"single",
"field",
"to",
"a",
"Solr",
"document"
] |
001159b18b78a87daa5d8b2a17ced28694bae156
|
https://github.com/the-fascinator/plugin-indexer-solr/blob/001159b18b78a87daa5d8b2a17ced28694bae156/src/main/java/com/googlecode/fascinator/indexer/rules/AddField.java#L76-L86
|
152,733
|
js-lib-com/commons
|
src/main/java/js/io/FilesIterator.java
|
FilesIterator.getRelativeNamesIterator
|
public static FilesIterator<String> getRelativeNamesIterator(File baseDir) {
return new FilesIterator<String>(baseDir, Strategy.RELATIVE_NAMES);
}
|
java
|
public static FilesIterator<String> getRelativeNamesIterator(File baseDir) {
return new FilesIterator<String>(baseDir, Strategy.RELATIVE_NAMES);
}
|
[
"public",
"static",
"FilesIterator",
"<",
"String",
">",
"getRelativeNamesIterator",
"(",
"File",
"baseDir",
")",
"{",
"return",
"new",
"FilesIterator",
"<",
"String",
">",
"(",
"baseDir",
",",
"Strategy",
".",
"RELATIVE_NAMES",
")",
";",
"}"
] |
Create relative file names iterator.
@param baseDir base directory to scan for files.
@return files iterator.
|
[
"Create",
"relative",
"file",
"names",
"iterator",
"."
] |
f8c64482142b163487745da74feb106f0765c16b
|
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/io/FilesIterator.java#L95-L97
|
152,734
|
js-lib-com/commons
|
src/main/java/js/io/FilesIterator.java
|
FilesIterator.getAbsoluteIterator
|
public static FilesIterator<File> getAbsoluteIterator(String baseDir) {
return new FilesIterator<File>(new File(baseDir), Strategy.FILES);
}
|
java
|
public static FilesIterator<File> getAbsoluteIterator(String baseDir) {
return new FilesIterator<File>(new File(baseDir), Strategy.FILES);
}
|
[
"public",
"static",
"FilesIterator",
"<",
"File",
">",
"getAbsoluteIterator",
"(",
"String",
"baseDir",
")",
"{",
"return",
"new",
"FilesIterator",
"<",
"File",
">",
"(",
"new",
"File",
"(",
"baseDir",
")",
",",
"Strategy",
".",
"FILES",
")",
";",
"}"
] |
Create absolute path files iterator.
@param baseDir base directory path to scan for files.
@return files iterator.
|
[
"Create",
"absolute",
"path",
"files",
"iterator",
"."
] |
f8c64482142b163487745da74feb106f0765c16b
|
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/io/FilesIterator.java#L105-L107
|
152,735
|
js-lib-com/commons
|
src/main/java/js/io/FilesIterator.java
|
FilesIterator.getRelativeIterator
|
public static FilesIterator<File> getRelativeIterator(String baseDir) {
return new FilesIterator<File>(new File(baseDir), Strategy.RELATIVE_FILES);
}
|
java
|
public static FilesIterator<File> getRelativeIterator(String baseDir) {
return new FilesIterator<File>(new File(baseDir), Strategy.RELATIVE_FILES);
}
|
[
"public",
"static",
"FilesIterator",
"<",
"File",
">",
"getRelativeIterator",
"(",
"String",
"baseDir",
")",
"{",
"return",
"new",
"FilesIterator",
"<",
"File",
">",
"(",
"new",
"File",
"(",
"baseDir",
")",
",",
"Strategy",
".",
"RELATIVE_FILES",
")",
";",
"}"
] |
Create relative path files iterator.
@param baseDir base directory path to scan for files.
@return files iterator.
|
[
"Create",
"relative",
"path",
"files",
"iterator",
"."
] |
f8c64482142b163487745da74feb106f0765c16b
|
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/io/FilesIterator.java#L115-L117
|
152,736
|
js-lib-com/commons
|
src/main/java/js/io/FilesIterator.java
|
FilesIterator.getAbsoluteNamesIterator
|
public static FilesIterator<String> getAbsoluteNamesIterator(String baseDir) {
return new FilesIterator<String>(new File(baseDir), Strategy.NAMES);
}
|
java
|
public static FilesIterator<String> getAbsoluteNamesIterator(String baseDir) {
return new FilesIterator<String>(new File(baseDir), Strategy.NAMES);
}
|
[
"public",
"static",
"FilesIterator",
"<",
"String",
">",
"getAbsoluteNamesIterator",
"(",
"String",
"baseDir",
")",
"{",
"return",
"new",
"FilesIterator",
"<",
"String",
">",
"(",
"new",
"File",
"(",
"baseDir",
")",
",",
"Strategy",
".",
"NAMES",
")",
";",
"}"
] |
Create absolute file names iterator.
@param baseDir base directory name to scan for files.
@return files iterator.
|
[
"Create",
"absolute",
"file",
"names",
"iterator",
"."
] |
f8c64482142b163487745da74feb106f0765c16b
|
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/io/FilesIterator.java#L125-L127
|
152,737
|
js-lib-com/commons
|
src/main/java/js/io/FilesIterator.java
|
FilesIterator.isLoopExitCondition
|
private boolean isLoopExitCondition() {
while (workingDirectory.index == workingDirectory.files.length) {
if (stack.isEmpty()) {
return true;
}
pop();
}
return false;
}
|
java
|
private boolean isLoopExitCondition() {
while (workingDirectory.index == workingDirectory.files.length) {
if (stack.isEmpty()) {
return true;
}
pop();
}
return false;
}
|
[
"private",
"boolean",
"isLoopExitCondition",
"(",
")",
"{",
"while",
"(",
"workingDirectory",
".",
"index",
"==",
"workingDirectory",
".",
"files",
".",
"length",
")",
"{",
"if",
"(",
"stack",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"pop",
"(",
")",
";",
"}",
"return",
"false",
";",
"}"
] |
Test for iteration loop exit condition. Iteration loop is ended if current working directory index reaches its files
count and there is no more directories on stack.
@return true if iterator loop reach its end.
|
[
"Test",
"for",
"iteration",
"loop",
"exit",
"condition",
".",
"Iteration",
"loop",
"is",
"ended",
"if",
"current",
"working",
"directory",
"index",
"reaches",
"its",
"files",
"count",
"and",
"there",
"is",
"no",
"more",
"directories",
"on",
"stack",
"."
] |
f8c64482142b163487745da74feb106f0765c16b
|
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/io/FilesIterator.java#L247-L255
|
152,738
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/db/event/OnSelectHandler.java
|
OnSelectHandler.init
|
public void init(Record record, RecordOwner recordOwner, Record recordToSync, boolean bUpdateOnSelect, int iEventToTrigger)
{
super.init(record);
m_recordOwner = recordOwner;
m_recordToSync = recordToSync;
m_bUpdateOnSelect = bUpdateOnSelect;
m_iEventToTrigger = iEventToTrigger;
}
|
java
|
public void init(Record record, RecordOwner recordOwner, Record recordToSync, boolean bUpdateOnSelect, int iEventToTrigger)
{
super.init(record);
m_recordOwner = recordOwner;
m_recordToSync = recordToSync;
m_bUpdateOnSelect = bUpdateOnSelect;
m_iEventToTrigger = iEventToTrigger;
}
|
[
"public",
"void",
"init",
"(",
"Record",
"record",
",",
"RecordOwner",
"recordOwner",
",",
"Record",
"recordToSync",
",",
"boolean",
"bUpdateOnSelect",
",",
"int",
"iEventToTrigger",
")",
"{",
"super",
".",
"init",
"(",
"record",
")",
";",
"m_recordOwner",
"=",
"recordOwner",
";",
"m_recordToSync",
"=",
"recordToSync",
";",
"m_bUpdateOnSelect",
"=",
"bUpdateOnSelect",
";",
"m_iEventToTrigger",
"=",
"iEventToTrigger",
";",
"}"
] |
OnSelectHandler - Constructor.
@param record My owner (usually passed as null, and set on addListener in setOwner()).
@param recordToSync The record to synchronize with this one.
@param bUpdateOnSelect If true, update or add a record in progress before syncing this record.
|
[
"OnSelectHandler",
"-",
"Constructor",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/event/OnSelectHandler.java#L102-L109
|
152,739
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/db/event/OnSelectHandler.java
|
OnSelectHandler.setOwner
|
public void setOwner(ListenerOwner owner)
{
super.setOwner(owner);
if (owner != null) if (m_recordToSync != null)
{
if (!m_recordToSync.getBaseRecord().getTableNames(false).equals(this.getOwner().getBaseRecord().getTableNames(false)))
{ // Must be the same base tables!
m_recordToSync = null;
return;
}
m_recordToSync.addListener(new FileRemoveBOnCloseHandler(this));
}
}
|
java
|
public void setOwner(ListenerOwner owner)
{
super.setOwner(owner);
if (owner != null) if (m_recordToSync != null)
{
if (!m_recordToSync.getBaseRecord().getTableNames(false).equals(this.getOwner().getBaseRecord().getTableNames(false)))
{ // Must be the same base tables!
m_recordToSync = null;
return;
}
m_recordToSync.addListener(new FileRemoveBOnCloseHandler(this));
}
}
|
[
"public",
"void",
"setOwner",
"(",
"ListenerOwner",
"owner",
")",
"{",
"super",
".",
"setOwner",
"(",
"owner",
")",
";",
"if",
"(",
"owner",
"!=",
"null",
")",
"if",
"(",
"m_recordToSync",
"!=",
"null",
")",
"{",
"if",
"(",
"!",
"m_recordToSync",
".",
"getBaseRecord",
"(",
")",
".",
"getTableNames",
"(",
"false",
")",
".",
"equals",
"(",
"this",
".",
"getOwner",
"(",
")",
".",
"getBaseRecord",
"(",
")",
".",
"getTableNames",
"(",
"false",
")",
")",
")",
"{",
"// Must be the same base tables!",
"m_recordToSync",
"=",
"null",
";",
"return",
";",
"}",
"m_recordToSync",
".",
"addListener",
"(",
"new",
"FileRemoveBOnCloseHandler",
"(",
"this",
")",
")",
";",
"}",
"}"
] |
Set the field or file that owns this listener.
I Check to make sure that the base tables are the same first.
@param owner My owner.
|
[
"Set",
"the",
"field",
"or",
"file",
"that",
"owns",
"this",
"listener",
".",
"I",
"Check",
"to",
"make",
"sure",
"that",
"the",
"base",
"tables",
"are",
"the",
"same",
"first",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/event/OnSelectHandler.java#L115-L127
|
152,740
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/db/event/OnSelectHandler.java
|
OnSelectHandler.createMessage
|
public RecordMessage createMessage(Object bookmark)
{
int iRecordMessageType = DBConstants.SELECT_TYPE;
RecordMessageHeader messageHeader = new RecordMessageHeader(this.getOwner(), bookmark, null, iRecordMessageType, null);
RecordMessage message = new RecordMessage(messageHeader);
message.put(RecordMessageHeader.UPDATE_ON_SELECT, new Boolean(m_bUpdateOnSelect));
if (this.getRecordToSync() != null)
message.put(RecordMessageHeader.RECORD_TO_UPDATE, this.getRecordToSync());
return message;
}
|
java
|
public RecordMessage createMessage(Object bookmark)
{
int iRecordMessageType = DBConstants.SELECT_TYPE;
RecordMessageHeader messageHeader = new RecordMessageHeader(this.getOwner(), bookmark, null, iRecordMessageType, null);
RecordMessage message = new RecordMessage(messageHeader);
message.put(RecordMessageHeader.UPDATE_ON_SELECT, new Boolean(m_bUpdateOnSelect));
if (this.getRecordToSync() != null)
message.put(RecordMessageHeader.RECORD_TO_UPDATE, this.getRecordToSync());
return message;
}
|
[
"public",
"RecordMessage",
"createMessage",
"(",
"Object",
"bookmark",
")",
"{",
"int",
"iRecordMessageType",
"=",
"DBConstants",
".",
"SELECT_TYPE",
";",
"RecordMessageHeader",
"messageHeader",
"=",
"new",
"RecordMessageHeader",
"(",
"this",
".",
"getOwner",
"(",
")",
",",
"bookmark",
",",
"null",
",",
"iRecordMessageType",
",",
"null",
")",
";",
"RecordMessage",
"message",
"=",
"new",
"RecordMessage",
"(",
"messageHeader",
")",
";",
"message",
".",
"put",
"(",
"RecordMessageHeader",
".",
"UPDATE_ON_SELECT",
",",
"new",
"Boolean",
"(",
"m_bUpdateOnSelect",
")",
")",
";",
"if",
"(",
"this",
".",
"getRecordToSync",
"(",
")",
"!=",
"null",
")",
"message",
".",
"put",
"(",
"RecordMessageHeader",
".",
"RECORD_TO_UPDATE",
",",
"this",
".",
"getRecordToSync",
"(",
")",
")",
";",
"return",
"message",
";",
"}"
] |
Create the record message.
Override this to add information to the message.
@param bookmark The bookmark of the record that is selected.
@return The record message.
|
[
"Create",
"the",
"record",
"message",
".",
"Override",
"this",
"to",
"add",
"information",
"to",
"the",
"message",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/event/OnSelectHandler.java#L181-L190
|
152,741
|
jbundle/jbundle
|
base/message/service/src/main/java/org/jbundle/base/message/service/BaseMessageServiceActivator.java
|
BaseMessageServiceActivator.shutdownService
|
public boolean shutdownService(Object service, BundleContext context)
{
if (service instanceof BaseServiceMessageTransport) // Always
((BaseServiceMessageTransport)service).free();
return super.shutdownService(service, context);
}
|
java
|
public boolean shutdownService(Object service, BundleContext context)
{
if (service instanceof BaseServiceMessageTransport) // Always
((BaseServiceMessageTransport)service).free();
return super.shutdownService(service, context);
}
|
[
"public",
"boolean",
"shutdownService",
"(",
"Object",
"service",
",",
"BundleContext",
"context",
")",
"{",
"if",
"(",
"service",
"instanceof",
"BaseServiceMessageTransport",
")",
"// Always",
"(",
"(",
"BaseServiceMessageTransport",
")",
"service",
")",
".",
"free",
"(",
")",
";",
"return",
"super",
".",
"shutdownService",
"(",
"service",
",",
"context",
")",
";",
"}"
] |
Stop this service.
Override this to do all the startup.
@param bundleService
@param context bundle context
@return true if successful.
|
[
"Stop",
"this",
"service",
".",
"Override",
"this",
"to",
"do",
"all",
"the",
"startup",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/message/service/src/main/java/org/jbundle/base/message/service/BaseMessageServiceActivator.java#L113-L118
|
152,742
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/util/concurrent/SimpleWorkflow.java
|
SimpleWorkflow.fork
|
public void fork(K to, M msg)
{
if (maxParallelism == 0)
{
throw new IllegalArgumentException("maxParallelism == 0, fork() not allowed! Use switchTo.");
}
try
{
stopSemaphore.acquire();
parallelSet.add(getCurrentKey());
doFork(to, msg);
}
catch (InterruptedException ex)
{
throw new IllegalArgumentException(ex);
}
}
|
java
|
public void fork(K to, M msg)
{
if (maxParallelism == 0)
{
throw new IllegalArgumentException("maxParallelism == 0, fork() not allowed! Use switchTo.");
}
try
{
stopSemaphore.acquire();
parallelSet.add(getCurrentKey());
doFork(to, msg);
}
catch (InterruptedException ex)
{
throw new IllegalArgumentException(ex);
}
}
|
[
"public",
"void",
"fork",
"(",
"K",
"to",
",",
"M",
"msg",
")",
"{",
"if",
"(",
"maxParallelism",
"==",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"maxParallelism == 0, fork() not allowed! Use switchTo.\"",
")",
";",
"}",
"try",
"{",
"stopSemaphore",
".",
"acquire",
"(",
")",
";",
"parallelSet",
".",
"add",
"(",
"getCurrentKey",
"(",
")",
")",
";",
"doFork",
"(",
"to",
",",
"msg",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"ex",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"ex",
")",
";",
"}",
"}"
] |
Fork executing thread.
@param to Next executing
@param msg Message to
|
[
"Fork",
"executing",
"thread",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/concurrent/SimpleWorkflow.java#L118-L134
|
152,743
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/util/concurrent/SimpleWorkflow.java
|
SimpleWorkflow.join
|
public M join()
{
if (threadMap.isEmpty())
{
throw new IllegalStateException("threads are already interrupted");
}
Thread currentThread = Thread.currentThread();
Semaphore currentSemaphore = semaphoreMap.get(currentThread);
if (currentSemaphore == null)
{
throw new IllegalStateException("Current thread is not workflow thread");
}
stopSemaphore.release();
parallelSet.remove(getCurrentKey());
return doJoin();
}
|
java
|
public M join()
{
if (threadMap.isEmpty())
{
throw new IllegalStateException("threads are already interrupted");
}
Thread currentThread = Thread.currentThread();
Semaphore currentSemaphore = semaphoreMap.get(currentThread);
if (currentSemaphore == null)
{
throw new IllegalStateException("Current thread is not workflow thread");
}
stopSemaphore.release();
parallelSet.remove(getCurrentKey());
return doJoin();
}
|
[
"public",
"M",
"join",
"(",
")",
"{",
"if",
"(",
"threadMap",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"threads are already interrupted\"",
")",
";",
"}",
"Thread",
"currentThread",
"=",
"Thread",
".",
"currentThread",
"(",
")",
";",
"Semaphore",
"currentSemaphore",
"=",
"semaphoreMap",
".",
"get",
"(",
"currentThread",
")",
";",
"if",
"(",
"currentSemaphore",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Current thread is not workflow thread\"",
")",
";",
"}",
"stopSemaphore",
".",
"release",
"(",
")",
";",
"parallelSet",
".",
"remove",
"(",
"getCurrentKey",
"(",
")",
")",
";",
"return",
"doJoin",
"(",
")",
";",
"}"
] |
Thread waits until another thread calls fork, switchTo or endTo method
using threads key. Returns message from another thread.
@return
|
[
"Thread",
"waits",
"until",
"another",
"thread",
"calls",
"fork",
"switchTo",
"or",
"endTo",
"method",
"using",
"threads",
"key",
".",
"Returns",
"message",
"from",
"another",
"thread",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/concurrent/SimpleWorkflow.java#L172-L187
|
152,744
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/util/concurrent/SimpleWorkflow.java
|
SimpleWorkflow.switchTo
|
public M switchTo(K to, M msg)
{
doFork(to, msg);
return doJoin();
}
|
java
|
public M switchTo(K to, M msg)
{
doFork(to, msg);
return doJoin();
}
|
[
"public",
"M",
"switchTo",
"(",
"K",
"to",
",",
"M",
"msg",
")",
"{",
"doFork",
"(",
"to",
",",
"msg",
")",
";",
"return",
"doJoin",
"(",
")",
";",
"}"
] |
Switch executing thread.
@param to Next executing
@param msg
@return
|
[
"Switch",
"executing",
"thread",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/concurrent/SimpleWorkflow.java#L254-L258
|
152,745
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/util/concurrent/SimpleWorkflow.java
|
SimpleWorkflow.endTo
|
public void endTo(K to, M msg)
{
K key = getCurrentKey();
if (key.equals(to))
{
throw new IllegalArgumentException("current and to are equals");
}
if (key != null)
{
kill(key);
doFork(to, msg);
throw new ThreadStoppedException("suicide");
}
else
{
throw new IllegalArgumentException("called from wrong thread");
}
}
|
java
|
public void endTo(K to, M msg)
{
K key = getCurrentKey();
if (key.equals(to))
{
throw new IllegalArgumentException("current and to are equals");
}
if (key != null)
{
kill(key);
doFork(to, msg);
throw new ThreadStoppedException("suicide");
}
else
{
throw new IllegalArgumentException("called from wrong thread");
}
}
|
[
"public",
"void",
"endTo",
"(",
"K",
"to",
",",
"M",
"msg",
")",
"{",
"K",
"key",
"=",
"getCurrentKey",
"(",
")",
";",
"if",
"(",
"key",
".",
"equals",
"(",
"to",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"current and to are equals\"",
")",
";",
"}",
"if",
"(",
"key",
"!=",
"null",
")",
"{",
"kill",
"(",
"key",
")",
";",
"doFork",
"(",
"to",
",",
"msg",
")",
";",
"throw",
"new",
"ThreadStoppedException",
"(",
"\"suicide\"",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"called from wrong thread\"",
")",
";",
"}",
"}"
] |
Ends the current thread and switches to
@param to
@param msg
|
[
"Ends",
"the",
"current",
"thread",
"and",
"switches",
"to"
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/concurrent/SimpleWorkflow.java#L281-L298
|
152,746
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/util/concurrent/SimpleWorkflow.java
|
SimpleWorkflow.getCurrentKey
|
public K getCurrentKey()
{
lock.lock();
try
{
Thread currentThread = Thread.currentThread();
for (Entry<K,Thread> entry : threadMap.entrySet())
{
if (currentThread.equals(entry.getValue()))
{
return entry.getKey();
}
}
return null;
}
finally
{
lock.unlock();
}
}
|
java
|
public K getCurrentKey()
{
lock.lock();
try
{
Thread currentThread = Thread.currentThread();
for (Entry<K,Thread> entry : threadMap.entrySet())
{
if (currentThread.equals(entry.getValue()))
{
return entry.getKey();
}
}
return null;
}
finally
{
lock.unlock();
}
}
|
[
"public",
"K",
"getCurrentKey",
"(",
")",
"{",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"Thread",
"currentThread",
"=",
"Thread",
".",
"currentThread",
"(",
")",
";",
"for",
"(",
"Entry",
"<",
"K",
",",
"Thread",
">",
"entry",
":",
"threadMap",
".",
"entrySet",
"(",
")",
")",
"{",
"if",
"(",
"currentThread",
".",
"equals",
"(",
"entry",
".",
"getValue",
"(",
")",
")",
")",
"{",
"return",
"entry",
".",
"getKey",
"(",
")",
";",
"}",
"}",
"return",
"null",
";",
"}",
"finally",
"{",
"lock",
".",
"unlock",
"(",
")",
";",
"}",
"}"
] |
Returns key for current thread. Returns null if current thread is not
part of the workflow.
@return
|
[
"Returns",
"key",
"for",
"current",
"thread",
".",
"Returns",
"null",
"if",
"current",
"thread",
"is",
"not",
"part",
"of",
"the",
"workflow",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/concurrent/SimpleWorkflow.java#L304-L323
|
152,747
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/util/concurrent/SimpleWorkflow.java
|
SimpleWorkflow.waitAndStopThreads
|
public void waitAndStopThreads()
{
try
{
if (threadMap.isEmpty())
{
throw new IllegalStateException("threads are already interrupted");
}
stopSemaphore.acquire(maxParallelism);
stopThreads();
}
catch (InterruptedException ex)
{
throw new IllegalArgumentException(ex);
}
}
|
java
|
public void waitAndStopThreads()
{
try
{
if (threadMap.isEmpty())
{
throw new IllegalStateException("threads are already interrupted");
}
stopSemaphore.acquire(maxParallelism);
stopThreads();
}
catch (InterruptedException ex)
{
throw new IllegalArgumentException(ex);
}
}
|
[
"public",
"void",
"waitAndStopThreads",
"(",
")",
"{",
"try",
"{",
"if",
"(",
"threadMap",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"threads are already interrupted\"",
")",
";",
"}",
"stopSemaphore",
".",
"acquire",
"(",
"maxParallelism",
")",
";",
"stopThreads",
"(",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"ex",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"ex",
")",
";",
"}",
"}"
] |
Wait until parallel excecuting threads have joined. After that interrupt
all other than the calling thread.
|
[
"Wait",
"until",
"parallel",
"excecuting",
"threads",
"have",
"joined",
".",
"After",
"that",
"interrupt",
"all",
"other",
"than",
"the",
"calling",
"thread",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/concurrent/SimpleWorkflow.java#L352-L367
|
152,748
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/util/concurrent/SimpleWorkflow.java
|
SimpleWorkflow.stopThreads
|
public void stopThreads()
{
if (threadMap.isEmpty())
{
throw new IllegalStateException("threads are already interrupted");
}
lock.lock();
try
{
Thread currentThread = Thread.currentThread();
for (Thread thread : threadMap.values())
{
if (!currentThread.equals(thread))
{
thread.interrupt();
}
}
threadMap.clear();
semaphoreMap.clear();
}
finally
{
lock.unlock();
}
}
|
java
|
public void stopThreads()
{
if (threadMap.isEmpty())
{
throw new IllegalStateException("threads are already interrupted");
}
lock.lock();
try
{
Thread currentThread = Thread.currentThread();
for (Thread thread : threadMap.values())
{
if (!currentThread.equals(thread))
{
thread.interrupt();
}
}
threadMap.clear();
semaphoreMap.clear();
}
finally
{
lock.unlock();
}
}
|
[
"public",
"void",
"stopThreads",
"(",
")",
"{",
"if",
"(",
"threadMap",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"threads are already interrupted\"",
")",
";",
"}",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"Thread",
"currentThread",
"=",
"Thread",
".",
"currentThread",
"(",
")",
";",
"for",
"(",
"Thread",
"thread",
":",
"threadMap",
".",
"values",
"(",
")",
")",
"{",
"if",
"(",
"!",
"currentThread",
".",
"equals",
"(",
"thread",
")",
")",
"{",
"thread",
".",
"interrupt",
"(",
")",
";",
"}",
"}",
"threadMap",
".",
"clear",
"(",
")",
";",
"semaphoreMap",
".",
"clear",
"(",
")",
";",
"}",
"finally",
"{",
"lock",
".",
"unlock",
"(",
")",
";",
"}",
"}"
] |
Interrupt
all other than the calling thread.
|
[
"Interrupt",
"all",
"other",
"than",
"the",
"calling",
"thread",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/concurrent/SimpleWorkflow.java#L372-L396
|
152,749
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/util/concurrent/SimpleWorkflow.java
|
SimpleWorkflow.accessContext
|
public <R> R accessContext(ContextAccess<C,R> access)
{
contextLock.lock();
try
{
return access.access(context);
}
finally
{
contextLock.unlock();
}
}
|
java
|
public <R> R accessContext(ContextAccess<C,R> access)
{
contextLock.lock();
try
{
return access.access(context);
}
finally
{
contextLock.unlock();
}
}
|
[
"public",
"<",
"R",
">",
"R",
"accessContext",
"(",
"ContextAccess",
"<",
"C",
",",
"R",
">",
"access",
")",
"{",
"contextLock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"return",
"access",
".",
"access",
"(",
"context",
")",
";",
"}",
"finally",
"{",
"contextLock",
".",
"unlock",
"(",
")",
";",
"}",
"}"
] |
Provides thread save access to the context object. ContextAccess.access
method is called inside a lock to prevent concurrent modification to
the object.
@param <R> Return type
@param access
@return
|
[
"Provides",
"thread",
"save",
"access",
"to",
"the",
"context",
"object",
".",
"ContextAccess",
".",
"access",
"method",
"is",
"called",
"inside",
"a",
"lock",
"to",
"prevent",
"concurrent",
"modification",
"to",
"the",
"object",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/concurrent/SimpleWorkflow.java#L445-L456
|
152,750
|
marssa/footprint
|
src/main/java/org/marssa/footprint/datatypes/decimal/frequency/AFrequency.java
|
AFrequency.getHz
|
public MDecimal getHz() {
MDecimal result = new MDecimal(currentUnit.getConverterTo(HERTZ)
.convert(doubleValue()));
logger.trace(MMarker.GETTER, "Converting from {} to Hertz : {}",
currentUnit, result);
return result;
}
|
java
|
public MDecimal getHz() {
MDecimal result = new MDecimal(currentUnit.getConverterTo(HERTZ)
.convert(doubleValue()));
logger.trace(MMarker.GETTER, "Converting from {} to Hertz : {}",
currentUnit, result);
return result;
}
|
[
"public",
"MDecimal",
"getHz",
"(",
")",
"{",
"MDecimal",
"result",
"=",
"new",
"MDecimal",
"(",
"currentUnit",
".",
"getConverterTo",
"(",
"HERTZ",
")",
".",
"convert",
"(",
"doubleValue",
"(",
")",
")",
")",
";",
"logger",
".",
"trace",
"(",
"MMarker",
".",
"GETTER",
",",
"\"Converting from {} to Hertz : {}\"",
",",
"currentUnit",
",",
"result",
")",
";",
"return",
"result",
";",
"}"
] |
Hz is the SI unit
|
[
"Hz",
"is",
"the",
"SI",
"unit"
] |
2ca953c14f46adc320927c87c5ce1c36eb6c82de
|
https://github.com/marssa/footprint/blob/2ca953c14f46adc320927c87c5ce1c36eb6c82de/src/main/java/org/marssa/footprint/datatypes/decimal/frequency/AFrequency.java#L67-L73
|
152,751
|
jbundle/jbundle
|
thin/base/util/base64/src/main/java/org/jbundle/thin/base/util/base64/Base64.java
|
Base64.encodeSHA
|
public static byte[] encodeSHA(byte[] rgbValue)
throws NoSuchAlgorithmException
{
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(rgbValue);
rgbValue = md.digest();
return rgbValue;
}
|
java
|
public static byte[] encodeSHA(byte[] rgbValue)
throws NoSuchAlgorithmException
{
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(rgbValue);
rgbValue = md.digest();
return rgbValue;
}
|
[
"public",
"static",
"byte",
"[",
"]",
"encodeSHA",
"(",
"byte",
"[",
"]",
"rgbValue",
")",
"throws",
"NoSuchAlgorithmException",
"{",
"MessageDigest",
"md",
"=",
"MessageDigest",
".",
"getInstance",
"(",
"\"SHA\"",
")",
";",
"md",
".",
"update",
"(",
"rgbValue",
")",
";",
"rgbValue",
"=",
"md",
".",
"digest",
"(",
")",
";",
"return",
"rgbValue",
";",
"}"
] |
Returns the string run through the SHA hash.
@param unencoded the string to encode
@return the encoded form of the unencoded string
|
[
"Returns",
"the",
"string",
"run",
"through",
"the",
"SHA",
"hash",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/util/base64/src/main/java/org/jbundle/thin/base/util/base64/Base64.java#L29-L37
|
152,752
|
jbundle/jbundle
|
thin/base/util/base64/src/main/java/org/jbundle/thin/base/util/base64/Base64.java
|
Base64.encodeToBytes
|
@Deprecated
public static byte[] encodeToBytes(byte[] bytes)
{
try {
char[] chars = Base64.encode(bytes);
String string = new String(chars);
return string.getBytes(DEFAULT_ENCODING);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
return null;
}
}
|
java
|
@Deprecated
public static byte[] encodeToBytes(byte[] bytes)
{
try {
char[] chars = Base64.encode(bytes);
String string = new String(chars);
return string.getBytes(DEFAULT_ENCODING);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
return null;
}
}
|
[
"@",
"Deprecated",
"public",
"static",
"byte",
"[",
"]",
"encodeToBytes",
"(",
"byte",
"[",
"]",
"bytes",
")",
"{",
"try",
"{",
"char",
"[",
"]",
"chars",
"=",
"Base64",
".",
"encode",
"(",
"bytes",
")",
";",
"String",
"string",
"=",
"new",
"String",
"(",
"chars",
")",
";",
"return",
"string",
".",
"getBytes",
"(",
"DEFAULT_ENCODING",
")",
";",
"}",
"catch",
"(",
"UnsupportedEncodingException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"return",
"null",
";",
"}",
"}"
] |
Encode this string as base64.
@param string
@return
|
[
"Encode",
"this",
"string",
"as",
"base64",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/util/base64/src/main/java/org/jbundle/thin/base/util/base64/Base64.java#L52-L63
|
152,753
|
jbundle/jbundle
|
thin/base/util/base64/src/main/java/org/jbundle/thin/base/util/base64/Base64.java
|
Base64.decode
|
@Deprecated
public static String decode(String string)
{
try {
byte[] bytes = Base64.decode(string.toCharArray());
return new String(bytes, DEFAULT_ENCODING);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
return null;
}
}
|
java
|
@Deprecated
public static String decode(String string)
{
try {
byte[] bytes = Base64.decode(string.toCharArray());
return new String(bytes, DEFAULT_ENCODING);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
return null;
}
}
|
[
"@",
"Deprecated",
"public",
"static",
"String",
"decode",
"(",
"String",
"string",
")",
"{",
"try",
"{",
"byte",
"[",
"]",
"bytes",
"=",
"Base64",
".",
"decode",
"(",
"string",
".",
"toCharArray",
"(",
")",
")",
";",
"return",
"new",
"String",
"(",
"bytes",
",",
"DEFAULT_ENCODING",
")",
";",
"}",
"catch",
"(",
"UnsupportedEncodingException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"return",
"null",
";",
"}",
"}"
] |
Decode this base64 string to a regular string.
@param string
@return
|
[
"Decode",
"this",
"base64",
"string",
"to",
"a",
"regular",
"string",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/util/base64/src/main/java/org/jbundle/thin/base/util/base64/Base64.java#L95-L105
|
152,754
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/math/matrix/Matrix.java
|
Matrix.set
|
public void set(int i, int j, T v)
{
consumer.set(i, j, v);
}
|
java
|
public void set(int i, int j, T v)
{
consumer.set(i, j, v);
}
|
[
"public",
"void",
"set",
"(",
"int",
"i",
",",
"int",
"j",
",",
"T",
"v",
")",
"{",
"consumer",
".",
"set",
"(",
"i",
",",
"j",
",",
"v",
")",
";",
"}"
] |
Sets item at i,j
@param i
@param j
@param v
|
[
"Sets",
"item",
"at",
"i",
"j"
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/matrix/Matrix.java#L92-L95
|
152,755
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/thread/ProcessRunnerTask.java
|
ProcessRunnerTask.runTask
|
public void runTask()
{
String strProcess = this.getProperty(DBParams.PROCESS);
BaseProcess job = (BaseProcess)ClassServiceUtility.getClassService().makeObjectFromClassName(strProcess);
if (job != null)
{
this.runProcess(job, m_properties);
}
else
{ // NOTE: It is not recommended to start a standalone process, since they can wreak havoc with this jvm
// (since standalones assume complete control and often will exit(0))
String strClass = this.getProperty("standalone"); // Applets are also run as tasks
if ((strClass != null) && (strClass.length() > 0))
{
try
{
if (strClass.indexOf('.') == 0)
strClass = Constants.ROOT_PACKAGE + strClass.substring(1);
Class<?> c = Class.forName(strClass);
// Don't instatiate the class, since I'm calling static main
if (c != null)
{
Class<?>[] parameterTypes = {String[].class};
Method method = c.getMethod("main", parameterTypes);
Object[] args = new Object[1];
Map<String,Object> properties = m_properties; // Only passed in properties
String[] rgArgs = Utility.propertiesToArgs(properties);
args[0] = rgArgs;
method.invoke(null, args);
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
}
|
java
|
public void runTask()
{
String strProcess = this.getProperty(DBParams.PROCESS);
BaseProcess job = (BaseProcess)ClassServiceUtility.getClassService().makeObjectFromClassName(strProcess);
if (job != null)
{
this.runProcess(job, m_properties);
}
else
{ // NOTE: It is not recommended to start a standalone process, since they can wreak havoc with this jvm
// (since standalones assume complete control and often will exit(0))
String strClass = this.getProperty("standalone"); // Applets are also run as tasks
if ((strClass != null) && (strClass.length() > 0))
{
try
{
if (strClass.indexOf('.') == 0)
strClass = Constants.ROOT_PACKAGE + strClass.substring(1);
Class<?> c = Class.forName(strClass);
// Don't instatiate the class, since I'm calling static main
if (c != null)
{
Class<?>[] parameterTypes = {String[].class};
Method method = c.getMethod("main", parameterTypes);
Object[] args = new Object[1];
Map<String,Object> properties = m_properties; // Only passed in properties
String[] rgArgs = Utility.propertiesToArgs(properties);
args[0] = rgArgs;
method.invoke(null, args);
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
}
|
[
"public",
"void",
"runTask",
"(",
")",
"{",
"String",
"strProcess",
"=",
"this",
".",
"getProperty",
"(",
"DBParams",
".",
"PROCESS",
")",
";",
"BaseProcess",
"job",
"=",
"(",
"BaseProcess",
")",
"ClassServiceUtility",
".",
"getClassService",
"(",
")",
".",
"makeObjectFromClassName",
"(",
"strProcess",
")",
";",
"if",
"(",
"job",
"!=",
"null",
")",
"{",
"this",
".",
"runProcess",
"(",
"job",
",",
"m_properties",
")",
";",
"}",
"else",
"{",
"// NOTE: It is not recommended to start a standalone process, since they can wreak havoc with this jvm",
"// (since standalones assume complete control and often will exit(0))",
"String",
"strClass",
"=",
"this",
".",
"getProperty",
"(",
"\"standalone\"",
")",
";",
"// Applets are also run as tasks",
"if",
"(",
"(",
"strClass",
"!=",
"null",
")",
"&&",
"(",
"strClass",
".",
"length",
"(",
")",
">",
"0",
")",
")",
"{",
"try",
"{",
"if",
"(",
"strClass",
".",
"indexOf",
"(",
"'",
"'",
")",
"==",
"0",
")",
"strClass",
"=",
"Constants",
".",
"ROOT_PACKAGE",
"+",
"strClass",
".",
"substring",
"(",
"1",
")",
";",
"Class",
"<",
"?",
">",
"c",
"=",
"Class",
".",
"forName",
"(",
"strClass",
")",
";",
"// Don't instatiate the class, since I'm calling static main",
"if",
"(",
"c",
"!=",
"null",
")",
"{",
"Class",
"<",
"?",
">",
"[",
"]",
"parameterTypes",
"=",
"{",
"String",
"[",
"]",
".",
"class",
"}",
";",
"Method",
"method",
"=",
"c",
".",
"getMethod",
"(",
"\"main\"",
",",
"parameterTypes",
")",
";",
"Object",
"[",
"]",
"args",
"=",
"new",
"Object",
"[",
"1",
"]",
";",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
"=",
"m_properties",
";",
"// Only passed in properties",
"String",
"[",
"]",
"rgArgs",
"=",
"Utility",
".",
"propertiesToArgs",
"(",
"properties",
")",
";",
"args",
"[",
"0",
"]",
"=",
"rgArgs",
";",
"method",
".",
"invoke",
"(",
"null",
",",
"args",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"ex",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}",
"}",
"}"
] |
Get the name of this process and run it.
|
[
"Get",
"the",
"name",
"of",
"this",
"process",
"and",
"run",
"it",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/thread/ProcessRunnerTask.java#L108-L143
|
152,756
|
jbundle/jbundle
|
app/program/db/src/main/java/org/jbundle/app/program/db/PropertiesStringField.java
|
PropertiesStringField.doGetData
|
public Object doGetData()
{
String data = (String)super.doGetData();
FileListener listener = this.getRecord().getListener(PropertiesStringFileListener.class);
if (this.getComponent(0) == null) // Don't convert if this is linked to a screen
if (enableConversion)
if (listener != null)
if (listener.isEnabled())
data = Utility.replaceResources(data, null, null, this.getRecord().getRecordOwner(), true);
return data;
}
|
java
|
public Object doGetData()
{
String data = (String)super.doGetData();
FileListener listener = this.getRecord().getListener(PropertiesStringFileListener.class);
if (this.getComponent(0) == null) // Don't convert if this is linked to a screen
if (enableConversion)
if (listener != null)
if (listener.isEnabled())
data = Utility.replaceResources(data, null, null, this.getRecord().getRecordOwner(), true);
return data;
}
|
[
"public",
"Object",
"doGetData",
"(",
")",
"{",
"String",
"data",
"=",
"(",
"String",
")",
"super",
".",
"doGetData",
"(",
")",
";",
"FileListener",
"listener",
"=",
"this",
".",
"getRecord",
"(",
")",
".",
"getListener",
"(",
"PropertiesStringFileListener",
".",
"class",
")",
";",
"if",
"(",
"this",
".",
"getComponent",
"(",
"0",
")",
"==",
"null",
")",
"// Don't convert if this is linked to a screen",
"if",
"(",
"enableConversion",
")",
"if",
"(",
"listener",
"!=",
"null",
")",
"if",
"(",
"listener",
".",
"isEnabled",
"(",
")",
")",
"data",
"=",
"Utility",
".",
"replaceResources",
"(",
"data",
",",
"null",
",",
"null",
",",
"this",
".",
"getRecord",
"(",
")",
".",
"getRecordOwner",
"(",
")",
",",
"true",
")",
";",
"return",
"data",
";",
"}"
] |
DoGetData Method.
|
[
"DoGetData",
"Method",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/db/src/main/java/org/jbundle/app/program/db/PropertiesStringField.java#L74-L84
|
152,757
|
jbundle/jbundle
|
app/program/screen/src/main/java/org/jbundle/app/program/screen/SwitchClassSub.java
|
SwitchClassSub.getSubScreen
|
public BasePanel getSubScreen(BasePanel parentScreen, ScreenLocation screenLocation, Map<String,Object> properties, int screenNo)
{
switch (screenNo)
{
case 0:
return new LogicFileGridScreen(null, screenLocation, parentScreen, null, ScreenConstants.DONT_DISPLAY_FIELD_DESC, properties);
case 1:
return new FieldDataGridScreen(null, screenLocation, parentScreen, null, ScreenConstants.DONT_DISPLAY_FIELD_DESC, properties);
case 2:
return new KeyInfoGridScreen(null, screenLocation, parentScreen, null, ScreenConstants.DONT_DISPLAY_FIELD_DESC, properties);
case 3:
return new ClassFieldsGridScreen(null, screenLocation, parentScreen, null, ScreenConstants.DONT_DISPLAY_FIELD_DESC, properties);
case 4:
return new ScreenInGridScreen(null, screenLocation, parentScreen, null, ScreenConstants.DONT_DISPLAY_FIELD_DESC, properties);
case 5:
return new ClassInfoDescScreen(null, screenLocation, parentScreen, null, ScreenConstants.DONT_DISPLAY_FIELD_DESC, properties);
case 6:
return new ClassInfoHelpScreen(null, screenLocation, parentScreen, null, ScreenConstants.DONT_DISPLAY_FIELD_DESC, properties);
case 7:
return new ClassResourceGridScreen(null, screenLocation, parentScreen, null, ScreenConstants.DONT_DISPLAY_FIELD_DESC, properties);
case 8:
return new ClassIssueGridScreen(null, screenLocation, parentScreen, null, ScreenConstants.DONT_DISPLAY_FIELD_DESC, properties);
case 9:
return new FileHdrScreen(null, screenLocation, parentScreen, null, ScreenConstants.DONT_DISPLAY_FIELD_DESC, properties);
case 10:
return new ExportRecordsScreen(null, screenLocation, parentScreen, null, ScreenConstants.DONT_DISPLAY_FIELD_DESC, properties);
}
return null;
}
|
java
|
public BasePanel getSubScreen(BasePanel parentScreen, ScreenLocation screenLocation, Map<String,Object> properties, int screenNo)
{
switch (screenNo)
{
case 0:
return new LogicFileGridScreen(null, screenLocation, parentScreen, null, ScreenConstants.DONT_DISPLAY_FIELD_DESC, properties);
case 1:
return new FieldDataGridScreen(null, screenLocation, parentScreen, null, ScreenConstants.DONT_DISPLAY_FIELD_DESC, properties);
case 2:
return new KeyInfoGridScreen(null, screenLocation, parentScreen, null, ScreenConstants.DONT_DISPLAY_FIELD_DESC, properties);
case 3:
return new ClassFieldsGridScreen(null, screenLocation, parentScreen, null, ScreenConstants.DONT_DISPLAY_FIELD_DESC, properties);
case 4:
return new ScreenInGridScreen(null, screenLocation, parentScreen, null, ScreenConstants.DONT_DISPLAY_FIELD_DESC, properties);
case 5:
return new ClassInfoDescScreen(null, screenLocation, parentScreen, null, ScreenConstants.DONT_DISPLAY_FIELD_DESC, properties);
case 6:
return new ClassInfoHelpScreen(null, screenLocation, parentScreen, null, ScreenConstants.DONT_DISPLAY_FIELD_DESC, properties);
case 7:
return new ClassResourceGridScreen(null, screenLocation, parentScreen, null, ScreenConstants.DONT_DISPLAY_FIELD_DESC, properties);
case 8:
return new ClassIssueGridScreen(null, screenLocation, parentScreen, null, ScreenConstants.DONT_DISPLAY_FIELD_DESC, properties);
case 9:
return new FileHdrScreen(null, screenLocation, parentScreen, null, ScreenConstants.DONT_DISPLAY_FIELD_DESC, properties);
case 10:
return new ExportRecordsScreen(null, screenLocation, parentScreen, null, ScreenConstants.DONT_DISPLAY_FIELD_DESC, properties);
}
return null;
}
|
[
"public",
"BasePanel",
"getSubScreen",
"(",
"BasePanel",
"parentScreen",
",",
"ScreenLocation",
"screenLocation",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
",",
"int",
"screenNo",
")",
"{",
"switch",
"(",
"screenNo",
")",
"{",
"case",
"0",
":",
"return",
"new",
"LogicFileGridScreen",
"(",
"null",
",",
"screenLocation",
",",
"parentScreen",
",",
"null",
",",
"ScreenConstants",
".",
"DONT_DISPLAY_FIELD_DESC",
",",
"properties",
")",
";",
"case",
"1",
":",
"return",
"new",
"FieldDataGridScreen",
"(",
"null",
",",
"screenLocation",
",",
"parentScreen",
",",
"null",
",",
"ScreenConstants",
".",
"DONT_DISPLAY_FIELD_DESC",
",",
"properties",
")",
";",
"case",
"2",
":",
"return",
"new",
"KeyInfoGridScreen",
"(",
"null",
",",
"screenLocation",
",",
"parentScreen",
",",
"null",
",",
"ScreenConstants",
".",
"DONT_DISPLAY_FIELD_DESC",
",",
"properties",
")",
";",
"case",
"3",
":",
"return",
"new",
"ClassFieldsGridScreen",
"(",
"null",
",",
"screenLocation",
",",
"parentScreen",
",",
"null",
",",
"ScreenConstants",
".",
"DONT_DISPLAY_FIELD_DESC",
",",
"properties",
")",
";",
"case",
"4",
":",
"return",
"new",
"ScreenInGridScreen",
"(",
"null",
",",
"screenLocation",
",",
"parentScreen",
",",
"null",
",",
"ScreenConstants",
".",
"DONT_DISPLAY_FIELD_DESC",
",",
"properties",
")",
";",
"case",
"5",
":",
"return",
"new",
"ClassInfoDescScreen",
"(",
"null",
",",
"screenLocation",
",",
"parentScreen",
",",
"null",
",",
"ScreenConstants",
".",
"DONT_DISPLAY_FIELD_DESC",
",",
"properties",
")",
";",
"case",
"6",
":",
"return",
"new",
"ClassInfoHelpScreen",
"(",
"null",
",",
"screenLocation",
",",
"parentScreen",
",",
"null",
",",
"ScreenConstants",
".",
"DONT_DISPLAY_FIELD_DESC",
",",
"properties",
")",
";",
"case",
"7",
":",
"return",
"new",
"ClassResourceGridScreen",
"(",
"null",
",",
"screenLocation",
",",
"parentScreen",
",",
"null",
",",
"ScreenConstants",
".",
"DONT_DISPLAY_FIELD_DESC",
",",
"properties",
")",
";",
"case",
"8",
":",
"return",
"new",
"ClassIssueGridScreen",
"(",
"null",
",",
"screenLocation",
",",
"parentScreen",
",",
"null",
",",
"ScreenConstants",
".",
"DONT_DISPLAY_FIELD_DESC",
",",
"properties",
")",
";",
"case",
"9",
":",
"return",
"new",
"FileHdrScreen",
"(",
"null",
",",
"screenLocation",
",",
"parentScreen",
",",
"null",
",",
"ScreenConstants",
".",
"DONT_DISPLAY_FIELD_DESC",
",",
"properties",
")",
";",
"case",
"10",
":",
"return",
"new",
"ExportRecordsScreen",
"(",
"null",
",",
"screenLocation",
",",
"parentScreen",
",",
"null",
",",
"ScreenConstants",
".",
"DONT_DISPLAY_FIELD_DESC",
",",
"properties",
")",
";",
"}",
"return",
"null",
";",
"}"
] |
GetSubScreen Method.
|
[
"GetSubScreen",
"Method",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/screen/src/main/java/org/jbundle/app/program/screen/SwitchClassSub.java#L56-L84
|
152,758
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/nio/channels/vc/SelectableVirtualCircuit.java
|
SelectableVirtualCircuit.start
|
@Override
public void start(Supplier<ExecutorService> executorFactory) throws IOException
{
future = executorFactory.get().submit(this);
}
|
java
|
@Override
public void start(Supplier<ExecutorService> executorFactory) throws IOException
{
future = executorFactory.get().submit(this);
}
|
[
"@",
"Override",
"public",
"void",
"start",
"(",
"Supplier",
"<",
"ExecutorService",
">",
"executorFactory",
")",
"throws",
"IOException",
"{",
"future",
"=",
"executorFactory",
".",
"get",
"(",
")",
".",
"submit",
"(",
"this",
")",
";",
"}"
] |
Start virtual circuit
@param executorFactory
@throws IOException
|
[
"Start",
"virtual",
"circuit"
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/channels/vc/SelectableVirtualCircuit.java#L91-L95
|
152,759
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/nio/channels/vc/SelectableVirtualCircuit.java
|
SelectableVirtualCircuit.waitForFinish
|
@Override
public void waitForFinish() throws IOException
{
if (future == null)
{
throw new IllegalStateException("not started");
}
try
{
future.get();
}
catch (InterruptedException | ExecutionException ex)
{
throw new IOException(ex);
}
}
|
java
|
@Override
public void waitForFinish() throws IOException
{
if (future == null)
{
throw new IllegalStateException("not started");
}
try
{
future.get();
}
catch (InterruptedException | ExecutionException ex)
{
throw new IOException(ex);
}
}
|
[
"@",
"Override",
"public",
"void",
"waitForFinish",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"future",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"not started\"",
")",
";",
"}",
"try",
"{",
"future",
".",
"get",
"(",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"|",
"ExecutionException",
"ex",
")",
"{",
"throw",
"new",
"IOException",
"(",
"ex",
")",
";",
"}",
"}"
] |
Wait until other peer has closed connection or virtual circuit is closed
by interrupt.
@throws IOException
|
[
"Wait",
"until",
"other",
"peer",
"has",
"closed",
"connection",
"or",
"virtual",
"circuit",
"is",
"closed",
"by",
"interrupt",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/channels/vc/SelectableVirtualCircuit.java#L101-L116
|
152,760
|
eostermueller/headlessInTraceClient
|
src/main/java/org/headlessintrace/client/request/RequestConnection.java
|
RequestConnection.setRequestCompletionFilter
|
public void setRequestCompletionFilter(ITraceFilterExt val) {
RequestWriter requestWriter = (RequestWriter) m_connection.getTraceWriter();
requestWriter.getRequestSeparator().setRequestCompletionFilter(val);
}
|
java
|
public void setRequestCompletionFilter(ITraceFilterExt val) {
RequestWriter requestWriter = (RequestWriter) m_connection.getTraceWriter();
requestWriter.getRequestSeparator().setRequestCompletionFilter(val);
}
|
[
"public",
"void",
"setRequestCompletionFilter",
"(",
"ITraceFilterExt",
"val",
")",
"{",
"RequestWriter",
"requestWriter",
"=",
"(",
"RequestWriter",
")",
"m_connection",
".",
"getTraceWriter",
"(",
")",
";",
"requestWriter",
".",
"getRequestSeparator",
"(",
")",
".",
"setRequestCompletionFilter",
"(",
"val",
")",
";",
"}"
] |
The request api will consider a thread is completed processing when a particular
method fires an exit event. Which method? The one indicated on the parameters of this method.
As you'd expect, this needs to be called before events start firing.
This the inTrace client will not be running in the same JVM as the system being monitored,
it would not be possible to type these parameters with java.lang.Class and java.reflect.Method.
@param string
@param string2
|
[
"The",
"request",
"api",
"will",
"consider",
"a",
"thread",
"is",
"completed",
"processing",
"when",
"a",
"particular",
"method",
"fires",
"an",
"exit",
"event",
".",
"Which",
"method?",
"The",
"one",
"indicated",
"on",
"the",
"parameters",
"of",
"this",
"method",
".",
"As",
"you",
"d",
"expect",
"this",
"needs",
"to",
"be",
"called",
"before",
"events",
"start",
"firing",
".",
"This",
"the",
"inTrace",
"client",
"will",
"not",
"be",
"running",
"in",
"the",
"same",
"JVM",
"as",
"the",
"system",
"being",
"monitored",
"it",
"would",
"not",
"be",
"possible",
"to",
"type",
"these",
"parameters",
"with",
"java",
".",
"lang",
".",
"Class",
"and",
"java",
".",
"reflect",
".",
"Method",
"."
] |
50b1dccc5ff9e342c7c1d06b5a382e8c0afc7604
|
https://github.com/eostermueller/headlessInTraceClient/blob/50b1dccc5ff9e342c7c1d06b5a382e8c0afc7604/src/main/java/org/headlessintrace/client/request/RequestConnection.java#L106-L109
|
152,761
|
microfocus-idol/java-logging
|
src/main/java/com/hp/autonomy/frontend/logging/ApplicationStartLogger.java
|
ApplicationStartLogger.onApplicationEvent
|
@Override
public void onApplicationEvent(final ContextRefreshedEvent event) {
if (!hasStarted) {
hasStarted = true;
log.info(Markers.AUDIT, message);
}
}
|
java
|
@Override
public void onApplicationEvent(final ContextRefreshedEvent event) {
if (!hasStarted) {
hasStarted = true;
log.info(Markers.AUDIT, message);
}
}
|
[
"@",
"Override",
"public",
"void",
"onApplicationEvent",
"(",
"final",
"ContextRefreshedEvent",
"event",
")",
"{",
"if",
"(",
"!",
"hasStarted",
")",
"{",
"hasStarted",
"=",
"true",
";",
"log",
".",
"info",
"(",
"Markers",
".",
"AUDIT",
",",
"message",
")",
";",
"}",
"}"
] |
Logs the provided message at log level info when it first receives an event
|
[
"Logs",
"the",
"provided",
"message",
"at",
"log",
"level",
"info",
"when",
"it",
"first",
"receives",
"an",
"event"
] |
f06f8547928897d07d41e046f53abcbbc3725271
|
https://github.com/microfocus-idol/java-logging/blob/f06f8547928897d07d41e046f53abcbbc3725271/src/main/java/com/hp/autonomy/frontend/logging/ApplicationStartLogger.java#L40-L46
|
152,762
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/math/BezierCurve.java
|
BezierCurve.operator
|
public ParameterizedOperator operator(Point2D.Double... controlPoints)
{
if (controlPoints.length != length)
{
throw new IllegalArgumentException("control-points length not "+length);
}
double[] cp = convert(controlPoints);
return operator(cp);
}
|
java
|
public ParameterizedOperator operator(Point2D.Double... controlPoints)
{
if (controlPoints.length != length)
{
throw new IllegalArgumentException("control-points length not "+length);
}
double[] cp = convert(controlPoints);
return operator(cp);
}
|
[
"public",
"ParameterizedOperator",
"operator",
"(",
"Point2D",
".",
"Double",
"...",
"controlPoints",
")",
"{",
"if",
"(",
"controlPoints",
".",
"length",
"!=",
"length",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"control-points length not \"",
"+",
"length",
")",
";",
"}",
"double",
"[",
"]",
"cp",
"=",
"convert",
"(",
"controlPoints",
")",
";",
"return",
"operator",
"(",
"cp",
")",
";",
"}"
] |
Creates Bezier function for fixed control points.
@param controlPoints
@return
|
[
"Creates",
"Bezier",
"function",
"for",
"fixed",
"control",
"points",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/BezierCurve.java#L71-L79
|
152,763
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/math/BezierCurve.java
|
BezierCurve.operator
|
public ParameterizedOperator operator(double... controlPoints)
{
if (controlPoints.length != 2*length)
{
throw new IllegalArgumentException("control-points length not "+length);
}
return operator(controlPoints, 0);
}
|
java
|
public ParameterizedOperator operator(double... controlPoints)
{
if (controlPoints.length != 2*length)
{
throw new IllegalArgumentException("control-points length not "+length);
}
return operator(controlPoints, 0);
}
|
[
"public",
"ParameterizedOperator",
"operator",
"(",
"double",
"...",
"controlPoints",
")",
"{",
"if",
"(",
"controlPoints",
".",
"length",
"!=",
"2",
"*",
"length",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"control-points length not \"",
"+",
"length",
")",
";",
"}",
"return",
"operator",
"(",
"controlPoints",
",",
"0",
")",
";",
"}"
] |
Creates Bezier function for fixed control points. Note that it is not same
if you pass an array or separate parameters. Array is not copied, so if
you modify it it will make change. If you want to have function with
immutable control points, use separate parameters or copy the array.
@param controlPoints
@return
|
[
"Creates",
"Bezier",
"function",
"for",
"fixed",
"control",
"points",
".",
"Note",
"that",
"it",
"is",
"not",
"same",
"if",
"you",
"pass",
"an",
"array",
"or",
"separate",
"parameters",
".",
"Array",
"is",
"not",
"copied",
"so",
"if",
"you",
"modify",
"it",
"it",
"will",
"make",
"change",
".",
"If",
"you",
"want",
"to",
"have",
"function",
"with",
"immutable",
"control",
"points",
"use",
"separate",
"parameters",
"or",
"copy",
"the",
"array",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/BezierCurve.java#L88-L95
|
152,764
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/math/BezierCurve.java
|
BezierCurve.derivative
|
private ParameterizedOperator derivative(double... controlPoints)
{
if (controlPoints.length != 2*length)
{
throw new IllegalArgumentException("control-points length not "+length);
}
return derivative(controlPoints, 0);
}
|
java
|
private ParameterizedOperator derivative(double... controlPoints)
{
if (controlPoints.length != 2*length)
{
throw new IllegalArgumentException("control-points length not "+length);
}
return derivative(controlPoints, 0);
}
|
[
"private",
"ParameterizedOperator",
"derivative",
"(",
"double",
"...",
"controlPoints",
")",
"{",
"if",
"(",
"controlPoints",
".",
"length",
"!=",
"2",
"*",
"length",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"control-points length not \"",
"+",
"length",
")",
";",
"}",
"return",
"derivative",
"(",
"controlPoints",
",",
"0",
")",
";",
"}"
] |
Create first derivative function for fixed control points.
@param controlPoints
@return
|
[
"Create",
"first",
"derivative",
"function",
"for",
"fixed",
"control",
"points",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/BezierCurve.java#L105-L112
|
152,765
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/math/BezierCurve.java
|
BezierCurve.secondDerivative
|
private ParameterizedOperator secondDerivative(double... controlPoints)
{
if (controlPoints.length != 2*length)
{
throw new IllegalArgumentException("control-points length not "+length);
}
return secondDerivative(controlPoints, 0);
}
|
java
|
private ParameterizedOperator secondDerivative(double... controlPoints)
{
if (controlPoints.length != 2*length)
{
throw new IllegalArgumentException("control-points length not "+length);
}
return secondDerivative(controlPoints, 0);
}
|
[
"private",
"ParameterizedOperator",
"secondDerivative",
"(",
"double",
"...",
"controlPoints",
")",
"{",
"if",
"(",
"controlPoints",
".",
"length",
"!=",
"2",
"*",
"length",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"control-points length not \"",
"+",
"length",
")",
";",
"}",
"return",
"secondDerivative",
"(",
"controlPoints",
",",
"0",
")",
";",
"}"
] |
Create second derivative function for fixed control points.
@param controlPoints
@return
|
[
"Create",
"second",
"derivative",
"function",
"for",
"fixed",
"control",
"points",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/BezierCurve.java#L143-L150
|
152,766
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/math/BezierCurve.java
|
BezierCurve.getInstance
|
public static BezierCurve getInstance(int degree)
{
if (degree < 1)
{
throw new IllegalArgumentException("illegal degree");
}
switch (degree)
{
case 1:
return LINE;
case 2:
return QUAD;
case 3:
return CUBIC;
default:
return new BezierCurve(degree);
}
}
|
java
|
public static BezierCurve getInstance(int degree)
{
if (degree < 1)
{
throw new IllegalArgumentException("illegal degree");
}
switch (degree)
{
case 1:
return LINE;
case 2:
return QUAD;
case 3:
return CUBIC;
default:
return new BezierCurve(degree);
}
}
|
[
"public",
"static",
"BezierCurve",
"getInstance",
"(",
"int",
"degree",
")",
"{",
"if",
"(",
"degree",
"<",
"1",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"illegal degree\"",
")",
";",
"}",
"switch",
"(",
"degree",
")",
"{",
"case",
"1",
":",
"return",
"LINE",
";",
"case",
"2",
":",
"return",
"QUAD",
";",
"case",
"3",
":",
"return",
"CUBIC",
";",
"default",
":",
"return",
"new",
"BezierCurve",
"(",
"degree",
")",
";",
"}",
"}"
] |
Creates or gets BezierCurve instance
@param degree
@return
|
[
"Creates",
"or",
"gets",
"BezierCurve",
"instance"
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/BezierCurve.java#L171-L188
|
152,767
|
jbundle/jbundle
|
base/message/trx/src/main/java/org/jbundle/base/message/trx/transport/email/MessageReceivingPopClient.java
|
MessageReceivingPopClient.main
|
public static void main(String args[])
{
Map<String,Object> properties = null;
if (args != null)
{
properties = new Hashtable<String,Object>();
Util.parseArgs(properties, args);
}
BaseApplication app = new MainApplication(null, properties, null);
app.getTaskScheduler().addTask(new MessageReceivingPopClient());
}
|
java
|
public static void main(String args[])
{
Map<String,Object> properties = null;
if (args != null)
{
properties = new Hashtable<String,Object>();
Util.parseArgs(properties, args);
}
BaseApplication app = new MainApplication(null, properties, null);
app.getTaskScheduler().addTask(new MessageReceivingPopClient());
}
|
[
"public",
"static",
"void",
"main",
"(",
"String",
"args",
"[",
"]",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
"=",
"null",
";",
"if",
"(",
"args",
"!=",
"null",
")",
"{",
"properties",
"=",
"new",
"Hashtable",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"Util",
".",
"parseArgs",
"(",
"properties",
",",
"args",
")",
";",
"}",
"BaseApplication",
"app",
"=",
"new",
"MainApplication",
"(",
"null",
",",
"properties",
",",
"null",
")",
";",
"app",
".",
"getTaskScheduler",
"(",
")",
".",
"addTask",
"(",
"new",
"MessageReceivingPopClient",
"(",
")",
")",
";",
"}"
] |
Run this stand-alone.
|
[
"Run",
"this",
"stand",
"-",
"alone",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/message/trx/src/main/java/org/jbundle/base/message/trx/transport/email/MessageReceivingPopClient.java#L63-L73
|
152,768
|
jbundle/jbundle
|
thin/base/db/misc/src/main/java/org/jbundle/thin/base/db/client/memory/MemoryRemoteTable.java
|
MemoryRemoteTable.doRemoteAction
|
public Object doRemoteAction(String strCommand, Map<String, Object> properties) throws DBException, RemoteException
{
return null; // Not supported
}
|
java
|
public Object doRemoteAction(String strCommand, Map<String, Object> properties) throws DBException, RemoteException
{
return null; // Not supported
}
|
[
"public",
"Object",
"doRemoteAction",
"(",
"String",
"strCommand",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
")",
"throws",
"DBException",
",",
"RemoteException",
"{",
"return",
"null",
";",
"// Not supported",
"}"
] |
Do a remote action.
Not implemented.
@param strCommand Command to perform remotely.
@param properties Properties for this command (optional).
@return boolean success.
|
[
"Do",
"a",
"remote",
"action",
".",
"Not",
"implemented",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/misc/src/main/java/org/jbundle/thin/base/db/client/memory/MemoryRemoteTable.java#L304-L307
|
152,769
|
carewebframework/carewebframework-vista
|
org.carewebframework.vista.api-parent/org.carewebframework.vista.api.notification/src/main/java/org/carewebframework/vista/api/notification/Notification.java
|
Notification.setDfn
|
@Override
public void setDfn(String dfn) {
this.dfn = VistAUtil.validateIEN(dfn) ? dfn : null;
}
|
java
|
@Override
public void setDfn(String dfn) {
this.dfn = VistAUtil.validateIEN(dfn) ? dfn : null;
}
|
[
"@",
"Override",
"public",
"void",
"setDfn",
"(",
"String",
"dfn",
")",
"{",
"this",
".",
"dfn",
"=",
"VistAUtil",
".",
"validateIEN",
"(",
"dfn",
")",
"?",
"dfn",
":",
"null",
";",
"}"
] |
Sets the DFN of the associated patient, if any.
|
[
"Sets",
"the",
"DFN",
"of",
"the",
"associated",
"patient",
"if",
"any",
"."
] |
883b2cbe395d9e8a21cd19db820f0876bda6b1c6
|
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.api-parent/org.carewebframework.vista.api.notification/src/main/java/org/carewebframework/vista/api/notification/Notification.java#L129-L132
|
152,770
|
huangp/entityunit
|
src/main/java/com/github/huangp/entityunit/maker/PreferredValueMakersRegistry.java
|
PreferredValueMakersRegistry.add
|
public PreferredValueMakersRegistry add(Matcher<?> settableMatcher, Maker<?> maker) {
Preconditions.checkNotNull(settableMatcher);
Preconditions.checkNotNull(maker);
makers.put(settableMatcher, maker);
return this;
}
|
java
|
public PreferredValueMakersRegistry add(Matcher<?> settableMatcher, Maker<?> maker) {
Preconditions.checkNotNull(settableMatcher);
Preconditions.checkNotNull(maker);
makers.put(settableMatcher, maker);
return this;
}
|
[
"public",
"PreferredValueMakersRegistry",
"add",
"(",
"Matcher",
"<",
"?",
">",
"settableMatcher",
",",
"Maker",
"<",
"?",
">",
"maker",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"settableMatcher",
")",
";",
"Preconditions",
".",
"checkNotNull",
"(",
"maker",
")",
";",
"makers",
".",
"put",
"(",
"settableMatcher",
",",
"maker",
")",
";",
"return",
"this",
";",
"}"
] |
Add a maker with custom matcher.
@param settableMatcher
a matcher to match on com.github.huangp.entityunit.util.Settable#fullyQualifiedName()
@param maker
custom maker
@return this
|
[
"Add",
"a",
"maker",
"with",
"custom",
"matcher",
"."
] |
1a09b530149d707dbff7ff46f5428d9db709a4b4
|
https://github.com/huangp/entityunit/blob/1a09b530149d707dbff7ff46f5428d9db709a4b4/src/main/java/com/github/huangp/entityunit/maker/PreferredValueMakersRegistry.java#L34-L39
|
152,771
|
jmeetsma/Iglu-Util
|
src/main/java/org/ijsberg/iglu/util/formatting/PatternMatchingSupport.java
|
PatternMatchingSupport.valueMatchesRegularExpression
|
public static boolean valueMatchesRegularExpression(String val, String regexp) {
Pattern p = cache.get(regexp);
if(p == null) {
p = Pattern.compile(regexp);
cache.put(regexp, p);
}
return valueMatchesRegularExpression(val, p);
}
|
java
|
public static boolean valueMatchesRegularExpression(String val, String regexp) {
Pattern p = cache.get(regexp);
if(p == null) {
p = Pattern.compile(regexp);
cache.put(regexp, p);
}
return valueMatchesRegularExpression(val, p);
}
|
[
"public",
"static",
"boolean",
"valueMatchesRegularExpression",
"(",
"String",
"val",
",",
"String",
"regexp",
")",
"{",
"Pattern",
"p",
"=",
"cache",
".",
"get",
"(",
"regexp",
")",
";",
"if",
"(",
"p",
"==",
"null",
")",
"{",
"p",
"=",
"Pattern",
".",
"compile",
"(",
"regexp",
")",
";",
"cache",
".",
"put",
"(",
"regexp",
",",
"p",
")",
";",
"}",
"return",
"valueMatchesRegularExpression",
"(",
"val",
",",
"p",
")",
";",
"}"
] |
Returns true only if the value matches the regular expression
only once and exactly.
@param val string value that may match the expression
@param regexp regular expression
@return true if val matches regular expression regexp
|
[
"Returns",
"true",
"only",
"if",
"the",
"value",
"matches",
"the",
"regular",
"expression",
"only",
"once",
"and",
"exactly",
"."
] |
971eb022115247b1e34dc26dd02e7e621e29e910
|
https://github.com/jmeetsma/Iglu-Util/blob/971eb022115247b1e34dc26dd02e7e621e29e910/src/main/java/org/ijsberg/iglu/util/formatting/PatternMatchingSupport.java#L46-L53
|
152,772
|
jmeetsma/Iglu-Util
|
src/main/java/org/ijsberg/iglu/util/formatting/PatternMatchingSupport.java
|
PatternMatchingSupport.valueMatchesRegularExpression
|
public static boolean valueMatchesRegularExpression(String val, Pattern regexp) {
Matcher m = regexp.matcher(val);
try {
return m.matches();
} catch (StackOverflowError e) {
e.printStackTrace();
System.out.println("-> [" + val + "][" + regexp + "]");
System.out.println("-> " + val.length());
System.exit(0);
}
return false;
}
|
java
|
public static boolean valueMatchesRegularExpression(String val, Pattern regexp) {
Matcher m = regexp.matcher(val);
try {
return m.matches();
} catch (StackOverflowError e) {
e.printStackTrace();
System.out.println("-> [" + val + "][" + regexp + "]");
System.out.println("-> " + val.length());
System.exit(0);
}
return false;
}
|
[
"public",
"static",
"boolean",
"valueMatchesRegularExpression",
"(",
"String",
"val",
",",
"Pattern",
"regexp",
")",
"{",
"Matcher",
"m",
"=",
"regexp",
".",
"matcher",
"(",
"val",
")",
";",
"try",
"{",
"return",
"m",
".",
"matches",
"(",
")",
";",
"}",
"catch",
"(",
"StackOverflowError",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"-> [\"",
"+",
"val",
"+",
"\"][\"",
"+",
"regexp",
"+",
"\"]\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"-> \"",
"+",
"val",
".",
"length",
"(",
")",
")",
";",
"System",
".",
"exit",
"(",
"0",
")",
";",
"}",
"return",
"false",
";",
"}"
] |
Returns true only if the value matches the regular expression
at least once.
@param val string value that may match the expression
@param regexp regular expression
@return true if val matches regular expression regexp
|
[
"Returns",
"true",
"only",
"if",
"the",
"value",
"matches",
"the",
"regular",
"expression",
"at",
"least",
"once",
"."
] |
971eb022115247b1e34dc26dd02e7e621e29e910
|
https://github.com/jmeetsma/Iglu-Util/blob/971eb022115247b1e34dc26dd02e7e621e29e910/src/main/java/org/ijsberg/iglu/util/formatting/PatternMatchingSupport.java#L63-L75
|
152,773
|
simter/simter-jwt
|
src/main/java/tech/simter/jwt/Payload.java
|
Payload.decode
|
public static Payload decode(String base64) {
JsonObject json = decodeToJson(base64);
Payload payload = new Payload();
json.keySet().forEach(key -> {
switch (key) {
case "iss":
payload.issuer = json.getString(key);
break;
case "sub":
payload.subject = json.getString(key);
break;
case "aud":
payload.audience = json.getString(key);
break;
case "exp":
payload.expires = new Long(json.get(key).toString());
break;
case "nbf":
payload.notBefore = new Long(json.get(key).toString());
break;
case "iat":
payload.issuedAt = new Long(json.get(key).toString());
break;
case "jti":
payload.jwtId = json.getString(key);
break;
default:
payload.add(key, json.getString(key));
}
});
return payload;
}
|
java
|
public static Payload decode(String base64) {
JsonObject json = decodeToJson(base64);
Payload payload = new Payload();
json.keySet().forEach(key -> {
switch (key) {
case "iss":
payload.issuer = json.getString(key);
break;
case "sub":
payload.subject = json.getString(key);
break;
case "aud":
payload.audience = json.getString(key);
break;
case "exp":
payload.expires = new Long(json.get(key).toString());
break;
case "nbf":
payload.notBefore = new Long(json.get(key).toString());
break;
case "iat":
payload.issuedAt = new Long(json.get(key).toString());
break;
case "jti":
payload.jwtId = json.getString(key);
break;
default:
payload.add(key, json.getString(key));
}
});
return payload;
}
|
[
"public",
"static",
"Payload",
"decode",
"(",
"String",
"base64",
")",
"{",
"JsonObject",
"json",
"=",
"decodeToJson",
"(",
"base64",
")",
";",
"Payload",
"payload",
"=",
"new",
"Payload",
"(",
")",
";",
"json",
".",
"keySet",
"(",
")",
".",
"forEach",
"(",
"key",
"->",
"{",
"switch",
"(",
"key",
")",
"{",
"case",
"\"iss\"",
":",
"payload",
".",
"issuer",
"=",
"json",
".",
"getString",
"(",
"key",
")",
";",
"break",
";",
"case",
"\"sub\"",
":",
"payload",
".",
"subject",
"=",
"json",
".",
"getString",
"(",
"key",
")",
";",
"break",
";",
"case",
"\"aud\"",
":",
"payload",
".",
"audience",
"=",
"json",
".",
"getString",
"(",
"key",
")",
";",
"break",
";",
"case",
"\"exp\"",
":",
"payload",
".",
"expires",
"=",
"new",
"Long",
"(",
"json",
".",
"get",
"(",
"key",
")",
".",
"toString",
"(",
")",
")",
";",
"break",
";",
"case",
"\"nbf\"",
":",
"payload",
".",
"notBefore",
"=",
"new",
"Long",
"(",
"json",
".",
"get",
"(",
"key",
")",
".",
"toString",
"(",
")",
")",
";",
"break",
";",
"case",
"\"iat\"",
":",
"payload",
".",
"issuedAt",
"=",
"new",
"Long",
"(",
"json",
".",
"get",
"(",
"key",
")",
".",
"toString",
"(",
")",
")",
";",
"break",
";",
"case",
"\"jti\"",
":",
"payload",
".",
"jwtId",
"=",
"json",
".",
"getString",
"(",
"key",
")",
";",
"break",
";",
"default",
":",
"payload",
".",
"add",
"(",
"key",
",",
"json",
".",
"getString",
"(",
"key",
")",
")",
";",
"}",
"}",
")",
";",
"return",
"payload",
";",
"}"
] |
Decode the base64-string to Payload.
@param base64 the base64-string to be decoded
@return the payload instance
|
[
"Decode",
"the",
"base64",
"-",
"string",
"to",
"Payload",
"."
] |
fea8d520e8eeb26c2ab9f5eeb2bd3f5a6c0e4433
|
https://github.com/simter/simter-jwt/blob/fea8d520e8eeb26c2ab9f5eeb2bd3f5a6c0e4433/src/main/java/tech/simter/jwt/Payload.java#L117-L148
|
152,774
|
mbenson/therian
|
core/src/main/java/therian/operator/convert/DefaultCopyingConverter.java
|
DefaultCopyingConverter.perform
|
@Override
@SuppressWarnings({ "unchecked" })
public boolean perform(TherianContext context, final Convert<?, ?> convert) {
return new Delegate(convert).perform(context, convert);
}
|
java
|
@Override
@SuppressWarnings({ "unchecked" })
public boolean perform(TherianContext context, final Convert<?, ?> convert) {
return new Delegate(convert).perform(context, convert);
}
|
[
"@",
"Override",
"@",
"SuppressWarnings",
"(",
"{",
"\"unchecked\"",
"}",
")",
"public",
"boolean",
"perform",
"(",
"TherianContext",
"context",
",",
"final",
"Convert",
"<",
"?",
",",
"?",
">",
"convert",
")",
"{",
"return",
"new",
"Delegate",
"(",
"convert",
")",
".",
"perform",
"(",
"context",
",",
"convert",
")",
";",
"}"
] |
specifically avoid doing typed ops as we want to catch stuff that slips through the cracks
|
[
"specifically",
"avoid",
"doing",
"typed",
"ops",
"as",
"we",
"want",
"to",
"catch",
"stuff",
"that",
"slips",
"through",
"the",
"cracks"
] |
0653505f73e2a6f5b0abc394ea6d83af03408254
|
https://github.com/mbenson/therian/blob/0653505f73e2a6f5b0abc394ea6d83af03408254/core/src/main/java/therian/operator/convert/DefaultCopyingConverter.java#L95-L99
|
152,775
|
huangp/entityunit
|
src/main/java/com/github/huangp/entityunit/entity/EntityCleaner.java
|
EntityCleaner.getAssociationTables
|
private static Iterable<String> getAssociationTables(EntityClass entityClass) {
Iterable<Settable> association = filter(entityClass.getElements(),
and(or(has(ManyToMany.class), has(ElementCollection.class)), has(JoinTable.class)));
return transform(association, new Function<Settable, String>() {
@Override
public String apply(Settable input) {
JoinTable annotation = input.getAnnotation(JoinTable.class);
return annotation.name();
}
});
}
|
java
|
private static Iterable<String> getAssociationTables(EntityClass entityClass) {
Iterable<Settable> association = filter(entityClass.getElements(),
and(or(has(ManyToMany.class), has(ElementCollection.class)), has(JoinTable.class)));
return transform(association, new Function<Settable, String>() {
@Override
public String apply(Settable input) {
JoinTable annotation = input.getAnnotation(JoinTable.class);
return annotation.name();
}
});
}
|
[
"private",
"static",
"Iterable",
"<",
"String",
">",
"getAssociationTables",
"(",
"EntityClass",
"entityClass",
")",
"{",
"Iterable",
"<",
"Settable",
">",
"association",
"=",
"filter",
"(",
"entityClass",
".",
"getElements",
"(",
")",
",",
"and",
"(",
"or",
"(",
"has",
"(",
"ManyToMany",
".",
"class",
")",
",",
"has",
"(",
"ElementCollection",
".",
"class",
")",
")",
",",
"has",
"(",
"JoinTable",
".",
"class",
")",
")",
")",
";",
"return",
"transform",
"(",
"association",
",",
"new",
"Function",
"<",
"Settable",
",",
"String",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"String",
"apply",
"(",
"Settable",
"input",
")",
"{",
"JoinTable",
"annotation",
"=",
"input",
".",
"getAnnotation",
"(",
"JoinTable",
".",
"class",
")",
";",
"return",
"annotation",
".",
"name",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] |
This will find all ManyToMany and ElementCollection annotated tables.
|
[
"This",
"will",
"find",
"all",
"ManyToMany",
"and",
"ElementCollection",
"annotated",
"tables",
"."
] |
1a09b530149d707dbff7ff46f5428d9db709a4b4
|
https://github.com/huangp/entityunit/blob/1a09b530149d707dbff7ff46f5428d9db709a4b4/src/main/java/com/github/huangp/entityunit/entity/EntityCleaner.java#L140-L150
|
152,776
|
Stratio/stratio-connector-commons
|
connector-commons/src/main/java/com/stratio/connector/commons/engine/CommonsMetadataEngine.java
|
CommonsMetadataEngine.createCatalog
|
@Override
public final void createCatalog(ClusterName targetCluster, CatalogMetadata catalogMetadata)
throws ExecutionException, UnsupportedException {
try {
connectionHandler.startJob(targetCluster.getName());
if (logger.isDebugEnabled()) {
logger.debug(
"Creating catalog [" + catalogMetadata.getName().getName() + "] in cluster [" + targetCluster
.getName() + "]");
}
createCatalog(catalogMetadata, connectionHandler.getConnection(targetCluster.getName()));
if (logger.isDebugEnabled()) {
logger.debug("Catalog [" + catalogMetadata.getName().getName()
+ "] has been created successfully in cluster [" + targetCluster.getName() + "]");
}
} finally {
connectionHandler.endJob(targetCluster.getName());
}
}
|
java
|
@Override
public final void createCatalog(ClusterName targetCluster, CatalogMetadata catalogMetadata)
throws ExecutionException, UnsupportedException {
try {
connectionHandler.startJob(targetCluster.getName());
if (logger.isDebugEnabled()) {
logger.debug(
"Creating catalog [" + catalogMetadata.getName().getName() + "] in cluster [" + targetCluster
.getName() + "]");
}
createCatalog(catalogMetadata, connectionHandler.getConnection(targetCluster.getName()));
if (logger.isDebugEnabled()) {
logger.debug("Catalog [" + catalogMetadata.getName().getName()
+ "] has been created successfully in cluster [" + targetCluster.getName() + "]");
}
} finally {
connectionHandler.endJob(targetCluster.getName());
}
}
|
[
"@",
"Override",
"public",
"final",
"void",
"createCatalog",
"(",
"ClusterName",
"targetCluster",
",",
"CatalogMetadata",
"catalogMetadata",
")",
"throws",
"ExecutionException",
",",
"UnsupportedException",
"{",
"try",
"{",
"connectionHandler",
".",
"startJob",
"(",
"targetCluster",
".",
"getName",
"(",
")",
")",
";",
"if",
"(",
"logger",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Creating catalog [\"",
"+",
"catalogMetadata",
".",
"getName",
"(",
")",
".",
"getName",
"(",
")",
"+",
"\"] in cluster [\"",
"+",
"targetCluster",
".",
"getName",
"(",
")",
"+",
"\"]\"",
")",
";",
"}",
"createCatalog",
"(",
"catalogMetadata",
",",
"connectionHandler",
".",
"getConnection",
"(",
"targetCluster",
".",
"getName",
"(",
")",
")",
")",
";",
"if",
"(",
"logger",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Catalog [\"",
"+",
"catalogMetadata",
".",
"getName",
"(",
")",
".",
"getName",
"(",
")",
"+",
"\"] has been created successfully in cluster [\"",
"+",
"targetCluster",
".",
"getName",
"(",
")",
"+",
"\"]\"",
")",
";",
"}",
"}",
"finally",
"{",
"connectionHandler",
".",
"endJob",
"(",
"targetCluster",
".",
"getName",
"(",
")",
")",
";",
"}",
"}"
] |
This method creates a catalog.
@param targetCluster the target cluster where the catalog will be created.
@param catalogMetadata the catalog metadata info.
@throws UnsupportedException if an operation is not supported.
@throws ExecutionException if an error happens.
|
[
"This",
"method",
"creates",
"a",
"catalog",
"."
] |
d7cc66cb9591344a13055962e87a91f01c3707d1
|
https://github.com/Stratio/stratio-connector-commons/blob/d7cc66cb9591344a13055962e87a91f01c3707d1/connector-commons/src/main/java/com/stratio/connector/commons/engine/CommonsMetadataEngine.java#L78-L99
|
152,777
|
Stratio/stratio-connector-commons
|
connector-commons/src/main/java/com/stratio/connector/commons/engine/CommonsMetadataEngine.java
|
CommonsMetadataEngine.createTable
|
@Override
public final void createTable(ClusterName targetCluster, TableMetadata tableMetadata) throws UnsupportedException,
ExecutionException {
try {
connectionHandler.startJob(targetCluster.getName());
if (logger.isDebugEnabled()) {
logger.debug("Creating table [" + tableMetadata.getName().getName() + "] in cluster [" + targetCluster
.getName() + "]");
}
createTable(tableMetadata, connectionHandler.getConnection(targetCluster.getName()));
if (logger.isDebugEnabled()) {
logger.debug(
"Catalog [" + tableMetadata.getName().getName() + "] has been created successfully in cluster ["
+ targetCluster.getName() + "]");
}
} finally {
connectionHandler.endJob(targetCluster.getName());
}
}
|
java
|
@Override
public final void createTable(ClusterName targetCluster, TableMetadata tableMetadata) throws UnsupportedException,
ExecutionException {
try {
connectionHandler.startJob(targetCluster.getName());
if (logger.isDebugEnabled()) {
logger.debug("Creating table [" + tableMetadata.getName().getName() + "] in cluster [" + targetCluster
.getName() + "]");
}
createTable(tableMetadata, connectionHandler.getConnection(targetCluster.getName()));
if (logger.isDebugEnabled()) {
logger.debug(
"Catalog [" + tableMetadata.getName().getName() + "] has been created successfully in cluster ["
+ targetCluster.getName() + "]");
}
} finally {
connectionHandler.endJob(targetCluster.getName());
}
}
|
[
"@",
"Override",
"public",
"final",
"void",
"createTable",
"(",
"ClusterName",
"targetCluster",
",",
"TableMetadata",
"tableMetadata",
")",
"throws",
"UnsupportedException",
",",
"ExecutionException",
"{",
"try",
"{",
"connectionHandler",
".",
"startJob",
"(",
"targetCluster",
".",
"getName",
"(",
")",
")",
";",
"if",
"(",
"logger",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Creating table [\"",
"+",
"tableMetadata",
".",
"getName",
"(",
")",
".",
"getName",
"(",
")",
"+",
"\"] in cluster [\"",
"+",
"targetCluster",
".",
"getName",
"(",
")",
"+",
"\"]\"",
")",
";",
"}",
"createTable",
"(",
"tableMetadata",
",",
"connectionHandler",
".",
"getConnection",
"(",
"targetCluster",
".",
"getName",
"(",
")",
")",
")",
";",
"if",
"(",
"logger",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Catalog [\"",
"+",
"tableMetadata",
".",
"getName",
"(",
")",
".",
"getName",
"(",
")",
"+",
"\"] has been created successfully in cluster [\"",
"+",
"targetCluster",
".",
"getName",
"(",
")",
"+",
"\"]\"",
")",
";",
"}",
"}",
"finally",
"{",
"connectionHandler",
".",
"endJob",
"(",
"targetCluster",
".",
"getName",
"(",
")",
")",
";",
"}",
"}"
] |
This method creates a table.
@param targetCluster the target cluster where the table will be created.
@param tableMetadata the table metadata.
@throws UnsupportedException if an operation is not supported.
@throws ExecutionException if an error happens.
|
[
"This",
"method",
"creates",
"a",
"table",
"."
] |
d7cc66cb9591344a13055962e87a91f01c3707d1
|
https://github.com/Stratio/stratio-connector-commons/blob/d7cc66cb9591344a13055962e87a91f01c3707d1/connector-commons/src/main/java/com/stratio/connector/commons/engine/CommonsMetadataEngine.java#L109-L132
|
152,778
|
Stratio/stratio-connector-commons
|
connector-commons/src/main/java/com/stratio/connector/commons/engine/CommonsMetadataEngine.java
|
CommonsMetadataEngine.dropCatalog
|
@Override
public final void dropCatalog(ClusterName targetCluster, CatalogName name) throws UnsupportedException,
ExecutionException {
try {
connectionHandler.startJob(targetCluster.getName());
if (logger.isDebugEnabled()) {
logger.debug("Dropping catalog [" + name.getName() + "] in cluster [" + targetCluster.getName() + "]");
}
dropCatalog(name, connectionHandler.getConnection(targetCluster.getName()));
if (logger.isDebugEnabled()) {
logger.debug(
"Catalog [" + name.getName() + "] has been drepped successfully in cluster [" + targetCluster
.getName() + "]");
}
} finally {
connectionHandler.endJob(targetCluster.getName());
}
}
|
java
|
@Override
public final void dropCatalog(ClusterName targetCluster, CatalogName name) throws UnsupportedException,
ExecutionException {
try {
connectionHandler.startJob(targetCluster.getName());
if (logger.isDebugEnabled()) {
logger.debug("Dropping catalog [" + name.getName() + "] in cluster [" + targetCluster.getName() + "]");
}
dropCatalog(name, connectionHandler.getConnection(targetCluster.getName()));
if (logger.isDebugEnabled()) {
logger.debug(
"Catalog [" + name.getName() + "] has been drepped successfully in cluster [" + targetCluster
.getName() + "]");
}
} finally {
connectionHandler.endJob(targetCluster.getName());
}
}
|
[
"@",
"Override",
"public",
"final",
"void",
"dropCatalog",
"(",
"ClusterName",
"targetCluster",
",",
"CatalogName",
"name",
")",
"throws",
"UnsupportedException",
",",
"ExecutionException",
"{",
"try",
"{",
"connectionHandler",
".",
"startJob",
"(",
"targetCluster",
".",
"getName",
"(",
")",
")",
";",
"if",
"(",
"logger",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Dropping catalog [\"",
"+",
"name",
".",
"getName",
"(",
")",
"+",
"\"] in cluster [\"",
"+",
"targetCluster",
".",
"getName",
"(",
")",
"+",
"\"]\"",
")",
";",
"}",
"dropCatalog",
"(",
"name",
",",
"connectionHandler",
".",
"getConnection",
"(",
"targetCluster",
".",
"getName",
"(",
")",
")",
")",
";",
"if",
"(",
"logger",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Catalog [\"",
"+",
"name",
".",
"getName",
"(",
")",
"+",
"\"] has been drepped successfully in cluster [\"",
"+",
"targetCluster",
".",
"getName",
"(",
")",
"+",
"\"]\"",
")",
";",
"}",
"}",
"finally",
"{",
"connectionHandler",
".",
"endJob",
"(",
"targetCluster",
".",
"getName",
"(",
")",
")",
";",
"}",
"}"
] |
This method drop a catalog.
@param targetCluster the target cluster where the catalog will be dropped.
@param name the catalog name.
@throws UnsupportedException if an operation is not supported.
@throws ExecutionException if an error happens.
|
[
"This",
"method",
"drop",
"a",
"catalog",
"."
] |
d7cc66cb9591344a13055962e87a91f01c3707d1
|
https://github.com/Stratio/stratio-connector-commons/blob/d7cc66cb9591344a13055962e87a91f01c3707d1/connector-commons/src/main/java/com/stratio/connector/commons/engine/CommonsMetadataEngine.java#L142-L164
|
152,779
|
Stratio/stratio-connector-commons
|
connector-commons/src/main/java/com/stratio/connector/commons/engine/CommonsMetadataEngine.java
|
CommonsMetadataEngine.dropTable
|
@Override
public final void dropTable(ClusterName targetCluster, TableName name) throws UnsupportedException,
ExecutionException {
try {
connectionHandler.startJob(targetCluster.getName());
if (logger.isDebugEnabled()) {
logger.debug("Dropping table [" + name.getName() + "] in cluster [" + targetCluster.getName() + "]");
}
dropTable(name, connectionHandler.getConnection(targetCluster.getName()));
if (logger.isDebugEnabled()) {
logger.debug("Table [" + name.getName() + "] has been drepped successfully in cluster [" + targetCluster
.getName() + "]");
}
} finally {
connectionHandler.endJob(targetCluster.getName());
}
}
|
java
|
@Override
public final void dropTable(ClusterName targetCluster, TableName name) throws UnsupportedException,
ExecutionException {
try {
connectionHandler.startJob(targetCluster.getName());
if (logger.isDebugEnabled()) {
logger.debug("Dropping table [" + name.getName() + "] in cluster [" + targetCluster.getName() + "]");
}
dropTable(name, connectionHandler.getConnection(targetCluster.getName()));
if (logger.isDebugEnabled()) {
logger.debug("Table [" + name.getName() + "] has been drepped successfully in cluster [" + targetCluster
.getName() + "]");
}
} finally {
connectionHandler.endJob(targetCluster.getName());
}
}
|
[
"@",
"Override",
"public",
"final",
"void",
"dropTable",
"(",
"ClusterName",
"targetCluster",
",",
"TableName",
"name",
")",
"throws",
"UnsupportedException",
",",
"ExecutionException",
"{",
"try",
"{",
"connectionHandler",
".",
"startJob",
"(",
"targetCluster",
".",
"getName",
"(",
")",
")",
";",
"if",
"(",
"logger",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Dropping table [\"",
"+",
"name",
".",
"getName",
"(",
")",
"+",
"\"] in cluster [\"",
"+",
"targetCluster",
".",
"getName",
"(",
")",
"+",
"\"]\"",
")",
";",
"}",
"dropTable",
"(",
"name",
",",
"connectionHandler",
".",
"getConnection",
"(",
"targetCluster",
".",
"getName",
"(",
")",
")",
")",
";",
"if",
"(",
"logger",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Table [\"",
"+",
"name",
".",
"getName",
"(",
")",
"+",
"\"] has been drepped successfully in cluster [\"",
"+",
"targetCluster",
".",
"getName",
"(",
")",
"+",
"\"]\"",
")",
";",
"}",
"}",
"finally",
"{",
"connectionHandler",
".",
"endJob",
"(",
"targetCluster",
".",
"getName",
"(",
")",
")",
";",
"}",
"}"
] |
This method drop a table.
@param targetCluster the target cluster where the table will be dropped.
@param name the table name.
@throws UnsupportedException if an operation is not supported.
@throws ExecutionException if an error happens.
|
[
"This",
"method",
"drop",
"a",
"table",
"."
] |
d7cc66cb9591344a13055962e87a91f01c3707d1
|
https://github.com/Stratio/stratio-connector-commons/blob/d7cc66cb9591344a13055962e87a91f01c3707d1/connector-commons/src/main/java/com/stratio/connector/commons/engine/CommonsMetadataEngine.java#L174-L196
|
152,780
|
Stratio/stratio-connector-commons
|
connector-commons/src/main/java/com/stratio/connector/commons/engine/CommonsMetadataEngine.java
|
CommonsMetadataEngine.createIndex
|
@Override
public final void createIndex(ClusterName targetCluster, IndexMetadata indexMetadata) throws UnsupportedException,
ExecutionException {
try {
connectionHandler.startJob(targetCluster.getName());
if (logger.isDebugEnabled()) {
logger.debug("Creating index [" + indexMetadata.getName().getName() + "] in cluster [" + targetCluster
.getName() + "]");
}
createIndex(indexMetadata, connectionHandler.getConnection(targetCluster.getName()));
if (logger.isDebugEnabled()) {
logger.debug(
"Index [" + indexMetadata.getName().getName() + "] has been created successfully in cluster ["
+ targetCluster.getName() + "]");
}
} finally {
connectionHandler.endJob(targetCluster.getName());
}
}
|
java
|
@Override
public final void createIndex(ClusterName targetCluster, IndexMetadata indexMetadata) throws UnsupportedException,
ExecutionException {
try {
connectionHandler.startJob(targetCluster.getName());
if (logger.isDebugEnabled()) {
logger.debug("Creating index [" + indexMetadata.getName().getName() + "] in cluster [" + targetCluster
.getName() + "]");
}
createIndex(indexMetadata, connectionHandler.getConnection(targetCluster.getName()));
if (logger.isDebugEnabled()) {
logger.debug(
"Index [" + indexMetadata.getName().getName() + "] has been created successfully in cluster ["
+ targetCluster.getName() + "]");
}
} finally {
connectionHandler.endJob(targetCluster.getName());
}
}
|
[
"@",
"Override",
"public",
"final",
"void",
"createIndex",
"(",
"ClusterName",
"targetCluster",
",",
"IndexMetadata",
"indexMetadata",
")",
"throws",
"UnsupportedException",
",",
"ExecutionException",
"{",
"try",
"{",
"connectionHandler",
".",
"startJob",
"(",
"targetCluster",
".",
"getName",
"(",
")",
")",
";",
"if",
"(",
"logger",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Creating index [\"",
"+",
"indexMetadata",
".",
"getName",
"(",
")",
".",
"getName",
"(",
")",
"+",
"\"] in cluster [\"",
"+",
"targetCluster",
".",
"getName",
"(",
")",
"+",
"\"]\"",
")",
";",
"}",
"createIndex",
"(",
"indexMetadata",
",",
"connectionHandler",
".",
"getConnection",
"(",
"targetCluster",
".",
"getName",
"(",
")",
")",
")",
";",
"if",
"(",
"logger",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Index [\"",
"+",
"indexMetadata",
".",
"getName",
"(",
")",
".",
"getName",
"(",
")",
"+",
"\"] has been created successfully in cluster [\"",
"+",
"targetCluster",
".",
"getName",
"(",
")",
"+",
"\"]\"",
")",
";",
"}",
"}",
"finally",
"{",
"connectionHandler",
".",
"endJob",
"(",
"targetCluster",
".",
"getName",
"(",
")",
")",
";",
"}",
"}"
] |
This method creates an index.
@param targetCluster the target cluster where the index will be created.
@param indexMetadata the index metainformation.
@throws UnsupportedException if an operation is not supported.
@throws ExecutionException if an error happens.
|
[
"This",
"method",
"creates",
"an",
"index",
"."
] |
d7cc66cb9591344a13055962e87a91f01c3707d1
|
https://github.com/Stratio/stratio-connector-commons/blob/d7cc66cb9591344a13055962e87a91f01c3707d1/connector-commons/src/main/java/com/stratio/connector/commons/engine/CommonsMetadataEngine.java#L206-L230
|
152,781
|
Stratio/stratio-connector-commons
|
connector-commons/src/main/java/com/stratio/connector/commons/engine/CommonsMetadataEngine.java
|
CommonsMetadataEngine.alterTable
|
@Override
public final void alterTable(ClusterName targetCluster, TableName name, AlterOptions alterOptions)
throws UnsupportedException, ExecutionException {
try {
connectionHandler.startJob(targetCluster.getName());
if (logger.isDebugEnabled()) {
logger.debug("Altering table[" + name.getName() + "] in cluster [" + targetCluster.getName() + "]");
}
alterTable(name, alterOptions, connectionHandler.getConnection(targetCluster.getName()));
if (logger.isDebugEnabled()) {
logger.debug("Table [" + name.getName() + "] has been altered successfully in cluster [" + targetCluster
.getName() + "]");
}
} finally {
connectionHandler.endJob(targetCluster.getName());
}
}
|
java
|
@Override
public final void alterTable(ClusterName targetCluster, TableName name, AlterOptions alterOptions)
throws UnsupportedException, ExecutionException {
try {
connectionHandler.startJob(targetCluster.getName());
if (logger.isDebugEnabled()) {
logger.debug("Altering table[" + name.getName() + "] in cluster [" + targetCluster.getName() + "]");
}
alterTable(name, alterOptions, connectionHandler.getConnection(targetCluster.getName()));
if (logger.isDebugEnabled()) {
logger.debug("Table [" + name.getName() + "] has been altered successfully in cluster [" + targetCluster
.getName() + "]");
}
} finally {
connectionHandler.endJob(targetCluster.getName());
}
}
|
[
"@",
"Override",
"public",
"final",
"void",
"alterTable",
"(",
"ClusterName",
"targetCluster",
",",
"TableName",
"name",
",",
"AlterOptions",
"alterOptions",
")",
"throws",
"UnsupportedException",
",",
"ExecutionException",
"{",
"try",
"{",
"connectionHandler",
".",
"startJob",
"(",
"targetCluster",
".",
"getName",
"(",
")",
")",
";",
"if",
"(",
"logger",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Altering table[\"",
"+",
"name",
".",
"getName",
"(",
")",
"+",
"\"] in cluster [\"",
"+",
"targetCluster",
".",
"getName",
"(",
")",
"+",
"\"]\"",
")",
";",
"}",
"alterTable",
"(",
"name",
",",
"alterOptions",
",",
"connectionHandler",
".",
"getConnection",
"(",
"targetCluster",
".",
"getName",
"(",
")",
")",
")",
";",
"if",
"(",
"logger",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Table [\"",
"+",
"name",
".",
"getName",
"(",
")",
"+",
"\"] has been altered successfully in cluster [\"",
"+",
"targetCluster",
".",
"getName",
"(",
")",
"+",
"\"]\"",
")",
";",
"}",
"}",
"finally",
"{",
"connectionHandler",
".",
"endJob",
"(",
"targetCluster",
".",
"getName",
"(",
")",
")",
";",
"}",
"}"
] |
This method add, delete, or modify columns in an existing table.
@param targetCluster the target cluster where the table will be altered.
@param name the table name.
@param alterOptions the alter options.
@throws UnsupportedException the unsupported exception
@throws ExecutionException the execution exception
|
[
"This",
"method",
"add",
"delete",
"or",
"modify",
"columns",
"in",
"an",
"existing",
"table",
"."
] |
d7cc66cb9591344a13055962e87a91f01c3707d1
|
https://github.com/Stratio/stratio-connector-commons/blob/d7cc66cb9591344a13055962e87a91f01c3707d1/connector-commons/src/main/java/com/stratio/connector/commons/engine/CommonsMetadataEngine.java#L270-L290
|
152,782
|
Stratio/stratio-connector-commons
|
connector-commons/src/main/java/com/stratio/connector/commons/engine/CommonsMetadataEngine.java
|
CommonsMetadataEngine.alterCatalog
|
@Override
public final void alterCatalog(ClusterName targetCluster, CatalogName catalogName, Map<Selector, Selector> options)
throws UnsupportedException, ExecutionException {
try {
connectionHandler.startJob(targetCluster.getName());
if (logger.isDebugEnabled()) {
logger.debug(
"Altering catalog[" + catalogName.getName() + "] in cluster [" + targetCluster.getName() + "]");
}
alterCatalog(catalogName, options, connectionHandler.getConnection(targetCluster.getName()));
if (logger.isDebugEnabled()) {
logger.debug("Catalog [" + catalogName.getName() + "] has been altered successfully in cluster ["
+ targetCluster.getName() + "]");
}
} finally {
connectionHandler.endJob(targetCluster.getName());
}
}
|
java
|
@Override
public final void alterCatalog(ClusterName targetCluster, CatalogName catalogName, Map<Selector, Selector> options)
throws UnsupportedException, ExecutionException {
try {
connectionHandler.startJob(targetCluster.getName());
if (logger.isDebugEnabled()) {
logger.debug(
"Altering catalog[" + catalogName.getName() + "] in cluster [" + targetCluster.getName() + "]");
}
alterCatalog(catalogName, options, connectionHandler.getConnection(targetCluster.getName()));
if (logger.isDebugEnabled()) {
logger.debug("Catalog [" + catalogName.getName() + "] has been altered successfully in cluster ["
+ targetCluster.getName() + "]");
}
} finally {
connectionHandler.endJob(targetCluster.getName());
}
}
|
[
"@",
"Override",
"public",
"final",
"void",
"alterCatalog",
"(",
"ClusterName",
"targetCluster",
",",
"CatalogName",
"catalogName",
",",
"Map",
"<",
"Selector",
",",
"Selector",
">",
"options",
")",
"throws",
"UnsupportedException",
",",
"ExecutionException",
"{",
"try",
"{",
"connectionHandler",
".",
"startJob",
"(",
"targetCluster",
".",
"getName",
"(",
")",
")",
";",
"if",
"(",
"logger",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Altering catalog[\"",
"+",
"catalogName",
".",
"getName",
"(",
")",
"+",
"\"] in cluster [\"",
"+",
"targetCluster",
".",
"getName",
"(",
")",
"+",
"\"]\"",
")",
";",
"}",
"alterCatalog",
"(",
"catalogName",
",",
"options",
",",
"connectionHandler",
".",
"getConnection",
"(",
"targetCluster",
".",
"getName",
"(",
")",
")",
")",
";",
"if",
"(",
"logger",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Catalog [\"",
"+",
"catalogName",
".",
"getName",
"(",
")",
"+",
"\"] has been altered successfully in cluster [\"",
"+",
"targetCluster",
".",
"getName",
"(",
")",
"+",
"\"]\"",
")",
";",
"}",
"}",
"finally",
"{",
"connectionHandler",
".",
"endJob",
"(",
"targetCluster",
".",
"getName",
"(",
")",
")",
";",
"}",
"}"
] |
Alter options in an existing table.
@param targetCluster the target cluster where the catalog will be altered.
@param catalogName the catalog name
@param options the options
@throws UnsupportedException if the operation is not supported
@throws ExecutionException if any error happen during the execution
|
[
"Alter",
"options",
"in",
"an",
"existing",
"table",
"."
] |
d7cc66cb9591344a13055962e87a91f01c3707d1
|
https://github.com/Stratio/stratio-connector-commons/blob/d7cc66cb9591344a13055962e87a91f01c3707d1/connector-commons/src/main/java/com/stratio/connector/commons/engine/CommonsMetadataEngine.java#L301-L321
|
152,783
|
probedock/probedock-rt-java
|
src/main/java/io/probedock/rt/client/Connector.java
|
Connector.notifyStart
|
public void notifyStart(String projectApiId, String projectVersion, String category) {
try {
if (isStarted()) {
JSONObject startNotification = new JSONObject().
put("project", new JSONObject().
put("apiId", projectApiId).
put("version", projectVersion)
).
put("category", category);
socket.emit("run:start", startNotification);
}
else {
LOGGER.log(Level.WARNING, "Probe Dock RT is not available to send the start notification");
}
}
catch (Exception e) {
LOGGER.log(Level.INFO, "Unable to send the start notification to the agent. Cause: " + e.getMessage());
if (LOGGER.getLevel() == Level.FINEST) {
LOGGER.log(Level.FINEST, "Exception: ", e);
}
}
}
|
java
|
public void notifyStart(String projectApiId, String projectVersion, String category) {
try {
if (isStarted()) {
JSONObject startNotification = new JSONObject().
put("project", new JSONObject().
put("apiId", projectApiId).
put("version", projectVersion)
).
put("category", category);
socket.emit("run:start", startNotification);
}
else {
LOGGER.log(Level.WARNING, "Probe Dock RT is not available to send the start notification");
}
}
catch (Exception e) {
LOGGER.log(Level.INFO, "Unable to send the start notification to the agent. Cause: " + e.getMessage());
if (LOGGER.getLevel() == Level.FINEST) {
LOGGER.log(Level.FINEST, "Exception: ", e);
}
}
}
|
[
"public",
"void",
"notifyStart",
"(",
"String",
"projectApiId",
",",
"String",
"projectVersion",
",",
"String",
"category",
")",
"{",
"try",
"{",
"if",
"(",
"isStarted",
"(",
")",
")",
"{",
"JSONObject",
"startNotification",
"=",
"new",
"JSONObject",
"(",
")",
".",
"put",
"(",
"\"project\"",
",",
"new",
"JSONObject",
"(",
")",
".",
"put",
"(",
"\"apiId\"",
",",
"projectApiId",
")",
".",
"put",
"(",
"\"version\"",
",",
"projectVersion",
")",
")",
".",
"put",
"(",
"\"category\"",
",",
"category",
")",
";",
"socket",
".",
"emit",
"(",
"\"run:start\"",
",",
"startNotification",
")",
";",
"}",
"else",
"{",
"LOGGER",
".",
"log",
"(",
"Level",
".",
"WARNING",
",",
"\"Probe Dock RT is not available to send the start notification\"",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"LOGGER",
".",
"log",
"(",
"Level",
".",
"INFO",
",",
"\"Unable to send the start notification to the agent. Cause: \"",
"+",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"if",
"(",
"LOGGER",
".",
"getLevel",
"(",
")",
"==",
"Level",
".",
"FINEST",
")",
"{",
"LOGGER",
".",
"log",
"(",
"Level",
".",
"FINEST",
",",
"\"Exception: \"",
",",
"e",
")",
";",
"}",
"}",
"}"
] |
Send a starting notification to the agent
@param projectApiId The project API ID
@param projectVersion The project version
@param category The category
|
[
"Send",
"a",
"starting",
"notification",
"to",
"the",
"agent"
] |
67b44b64303b15eb2d4808f9560a1c9554ccf3ba
|
https://github.com/probedock/probedock-rt-java/blob/67b44b64303b15eb2d4808f9560a1c9554ccf3ba/src/main/java/io/probedock/rt/client/Connector.java#L62-L85
|
152,784
|
probedock/probedock-rt-java
|
src/main/java/io/probedock/rt/client/Connector.java
|
Connector.notifyEnd
|
public void notifyEnd(String projectApiId, String projectVersion, String category, long duration) {
try {
if (isStarted()) {
JSONObject endNotification = new JSONObject().
put("project", new JSONObject().
put("apiId", projectApiId).
put("version", projectVersion)
).
put("category", category).
put("duration", duration);
socket.emit("run:end", endNotification);
}
else {
LOGGER.log(Level.WARNING, "Probe Dock RT is not available to send the end notification");
}
}
catch (Exception e) {
LOGGER.log(Level.INFO, "Unable to send the end notification to the agent. Cause: " + e.getMessage());
if (LOGGER.getLevel() == Level.FINEST) {
LOGGER.log(Level.FINEST, "Exception:", e);
}
}
}
|
java
|
public void notifyEnd(String projectApiId, String projectVersion, String category, long duration) {
try {
if (isStarted()) {
JSONObject endNotification = new JSONObject().
put("project", new JSONObject().
put("apiId", projectApiId).
put("version", projectVersion)
).
put("category", category).
put("duration", duration);
socket.emit("run:end", endNotification);
}
else {
LOGGER.log(Level.WARNING, "Probe Dock RT is not available to send the end notification");
}
}
catch (Exception e) {
LOGGER.log(Level.INFO, "Unable to send the end notification to the agent. Cause: " + e.getMessage());
if (LOGGER.getLevel() == Level.FINEST) {
LOGGER.log(Level.FINEST, "Exception:", e);
}
}
}
|
[
"public",
"void",
"notifyEnd",
"(",
"String",
"projectApiId",
",",
"String",
"projectVersion",
",",
"String",
"category",
",",
"long",
"duration",
")",
"{",
"try",
"{",
"if",
"(",
"isStarted",
"(",
")",
")",
"{",
"JSONObject",
"endNotification",
"=",
"new",
"JSONObject",
"(",
")",
".",
"put",
"(",
"\"project\"",
",",
"new",
"JSONObject",
"(",
")",
".",
"put",
"(",
"\"apiId\"",
",",
"projectApiId",
")",
".",
"put",
"(",
"\"version\"",
",",
"projectVersion",
")",
")",
".",
"put",
"(",
"\"category\"",
",",
"category",
")",
".",
"put",
"(",
"\"duration\"",
",",
"duration",
")",
";",
"socket",
".",
"emit",
"(",
"\"run:end\"",
",",
"endNotification",
")",
";",
"}",
"else",
"{",
"LOGGER",
".",
"log",
"(",
"Level",
".",
"WARNING",
",",
"\"Probe Dock RT is not available to send the end notification\"",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"LOGGER",
".",
"log",
"(",
"Level",
".",
"INFO",
",",
"\"Unable to send the end notification to the agent. Cause: \"",
"+",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"if",
"(",
"LOGGER",
".",
"getLevel",
"(",
")",
"==",
"Level",
".",
"FINEST",
")",
"{",
"LOGGER",
".",
"log",
"(",
"Level",
".",
"FINEST",
",",
"\"Exception:\"",
",",
"e",
")",
";",
"}",
"}",
"}"
] |
Send a ending notification to the agent
@param projectApiId The project API ID
@param projectVersion The project version
@param category The category
@param duration The duration of the test run
|
[
"Send",
"a",
"ending",
"notification",
"to",
"the",
"agent"
] |
67b44b64303b15eb2d4808f9560a1c9554ccf3ba
|
https://github.com/probedock/probedock-rt-java/blob/67b44b64303b15eb2d4808f9560a1c9554ccf3ba/src/main/java/io/probedock/rt/client/Connector.java#L132-L156
|
152,785
|
probedock/probedock-rt-java
|
src/main/java/io/probedock/rt/client/Connector.java
|
Connector.send
|
public void send(TestRun testRun) {
try {
if (isStarted()) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
new JsonSerializer().serializePayload(new OutputStreamWriter(baos), testRun, false);
socket.emit("payload", new String(baos.toByteArray()));
}
else {
LOGGER.log(Level.WARNING, "Probe Dock RT is not available to send the test results");
}
}
catch (Exception e) {
LOGGER.log(Level.WARNING, "Unable to send the result to the agent. Cause: " + e.getMessage());
if (LOGGER.getLevel() == Level.FINEST) {
LOGGER.log(Level.FINEST, "Exception: ", e);
}
}
}
|
java
|
public void send(TestRun testRun) {
try {
if (isStarted()) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
new JsonSerializer().serializePayload(new OutputStreamWriter(baos), testRun, false);
socket.emit("payload", new String(baos.toByteArray()));
}
else {
LOGGER.log(Level.WARNING, "Probe Dock RT is not available to send the test results");
}
}
catch (Exception e) {
LOGGER.log(Level.WARNING, "Unable to send the result to the agent. Cause: " + e.getMessage());
if (LOGGER.getLevel() == Level.FINEST) {
LOGGER.log(Level.FINEST, "Exception: ", e);
}
}
}
|
[
"public",
"void",
"send",
"(",
"TestRun",
"testRun",
")",
"{",
"try",
"{",
"if",
"(",
"isStarted",
"(",
")",
")",
"{",
"ByteArrayOutputStream",
"baos",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"new",
"JsonSerializer",
"(",
")",
".",
"serializePayload",
"(",
"new",
"OutputStreamWriter",
"(",
"baos",
")",
",",
"testRun",
",",
"false",
")",
";",
"socket",
".",
"emit",
"(",
"\"payload\"",
",",
"new",
"String",
"(",
"baos",
".",
"toByteArray",
"(",
")",
")",
")",
";",
"}",
"else",
"{",
"LOGGER",
".",
"log",
"(",
"Level",
".",
"WARNING",
",",
"\"Probe Dock RT is not available to send the test results\"",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"LOGGER",
".",
"log",
"(",
"Level",
".",
"WARNING",
",",
"\"Unable to send the result to the agent. Cause: \"",
"+",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"if",
"(",
"LOGGER",
".",
"getLevel",
"(",
")",
"==",
"Level",
".",
"FINEST",
")",
"{",
"LOGGER",
".",
"log",
"(",
"Level",
".",
"FINEST",
",",
"\"Exception: \"",
",",
"e",
")",
";",
"}",
"}",
"}"
] |
Send a test result to the agent. This is a best effort and when the request failed, there is no crash
@param testRun The result to send
|
[
"Send",
"a",
"test",
"result",
"to",
"the",
"agent",
".",
"This",
"is",
"a",
"best",
"effort",
"and",
"when",
"the",
"request",
"failed",
"there",
"is",
"no",
"crash"
] |
67b44b64303b15eb2d4808f9560a1c9554ccf3ba
|
https://github.com/probedock/probedock-rt-java/blob/67b44b64303b15eb2d4808f9560a1c9554ccf3ba/src/main/java/io/probedock/rt/client/Connector.java#L163-L183
|
152,786
|
probedock/probedock-rt-java
|
src/main/java/io/probedock/rt/client/Connector.java
|
Connector.getFilters
|
public List<FilterDefinition> getFilters() {
try {
if (isStarted()) {
final FilterAcknowledger acknowledger = new FilterAcknowledger();
// Be sure that the emit/ack is synchronous to get the filters before the test are run
new Thread(new Runnable() {
@Override
public void run() {
try {
LOGGER.finest("Retrieve filters");
socket.emit("filters:get", acknowledger);
}
catch (Exception e) {
LOGGER.finest("Unable to get the filters: " + e.getMessage());
synchronized (acknowledger) {
acknowledger.notify();
}
}
}
}).start();
synchronized (acknowledger) {
acknowledger.wait();
}
if (!acknowledger.hasFilters()) {
for (FilterDefinition filter : acknowledger.getFilters()) {
LOGGER.info("Filter element: " + filter);
}
}
return acknowledger.getFilters();
}
}
catch (Exception e) {
LOGGER.warning("Unable to retrieve the filters from the agent. Cause: " + e.getMessage());
e.printStackTrace();
if (LOGGER.getLevel() == Level.FINEST) {
LOGGER.log(Level.FINEST, "Exception: ", e);
}
}
return null;
}
|
java
|
public List<FilterDefinition> getFilters() {
try {
if (isStarted()) {
final FilterAcknowledger acknowledger = new FilterAcknowledger();
// Be sure that the emit/ack is synchronous to get the filters before the test are run
new Thread(new Runnable() {
@Override
public void run() {
try {
LOGGER.finest("Retrieve filters");
socket.emit("filters:get", acknowledger);
}
catch (Exception e) {
LOGGER.finest("Unable to get the filters: " + e.getMessage());
synchronized (acknowledger) {
acknowledger.notify();
}
}
}
}).start();
synchronized (acknowledger) {
acknowledger.wait();
}
if (!acknowledger.hasFilters()) {
for (FilterDefinition filter : acknowledger.getFilters()) {
LOGGER.info("Filter element: " + filter);
}
}
return acknowledger.getFilters();
}
}
catch (Exception e) {
LOGGER.warning("Unable to retrieve the filters from the agent. Cause: " + e.getMessage());
e.printStackTrace();
if (LOGGER.getLevel() == Level.FINEST) {
LOGGER.log(Level.FINEST, "Exception: ", e);
}
}
return null;
}
|
[
"public",
"List",
"<",
"FilterDefinition",
">",
"getFilters",
"(",
")",
"{",
"try",
"{",
"if",
"(",
"isStarted",
"(",
")",
")",
"{",
"final",
"FilterAcknowledger",
"acknowledger",
"=",
"new",
"FilterAcknowledger",
"(",
")",
";",
"// Be sure that the emit/ack is synchronous to get the filters before the test are run",
"new",
"Thread",
"(",
"new",
"Runnable",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"run",
"(",
")",
"{",
"try",
"{",
"LOGGER",
".",
"finest",
"(",
"\"Retrieve filters\"",
")",
";",
"socket",
".",
"emit",
"(",
"\"filters:get\"",
",",
"acknowledger",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"LOGGER",
".",
"finest",
"(",
"\"Unable to get the filters: \"",
"+",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"synchronized",
"(",
"acknowledger",
")",
"{",
"acknowledger",
".",
"notify",
"(",
")",
";",
"}",
"}",
"}",
"}",
")",
".",
"start",
"(",
")",
";",
"synchronized",
"(",
"acknowledger",
")",
"{",
"acknowledger",
".",
"wait",
"(",
")",
";",
"}",
"if",
"(",
"!",
"acknowledger",
".",
"hasFilters",
"(",
")",
")",
"{",
"for",
"(",
"FilterDefinition",
"filter",
":",
"acknowledger",
".",
"getFilters",
"(",
")",
")",
"{",
"LOGGER",
".",
"info",
"(",
"\"Filter element: \"",
"+",
"filter",
")",
";",
"}",
"}",
"return",
"acknowledger",
".",
"getFilters",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"LOGGER",
".",
"warning",
"(",
"\"Unable to retrieve the filters from the agent. Cause: \"",
"+",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"e",
".",
"printStackTrace",
"(",
")",
";",
"if",
"(",
"LOGGER",
".",
"getLevel",
"(",
")",
"==",
"Level",
".",
"FINEST",
")",
"{",
"LOGGER",
".",
"log",
"(",
"Level",
".",
"FINEST",
",",
"\"Exception: \"",
",",
"e",
")",
";",
"}",
"}",
"return",
"null",
";",
"}"
] |
Try to get a filter list from the agent
@return The list of filters or null if there is none or the agent is not accessible
|
[
"Try",
"to",
"get",
"a",
"filter",
"list",
"from",
"the",
"agent"
] |
67b44b64303b15eb2d4808f9560a1c9554ccf3ba
|
https://github.com/probedock/probedock-rt-java/blob/67b44b64303b15eb2d4808f9560a1c9554ccf3ba/src/main/java/io/probedock/rt/client/Connector.java#L190-L234
|
152,787
|
probedock/probedock-rt-java
|
src/main/java/io/probedock/rt/client/Connector.java
|
Connector.createConnectedSocket
|
private Socket createConnectedSocket(final String url) {
try {
final Socket initSocket = IO.socket(url);
final Callback callback = new Callback();
initSocket.on(Socket.EVENT_CONNECT, callback);
initSocket.on(Socket.EVENT_CONNECT_ERROR, callback);
initSocket.on(Socket.EVENT_CONNECT_TIMEOUT, callback);
initSocket.on(Socket.EVENT_CONNECT_ERROR, callback);
initSocket.on(Socket.EVENT_DISCONNECT, callback);
initSocket.on(Socket.EVENT_ERROR, callback);
// Be sure that the emit/ack is synchronous to get the filters before the test are run
LOGGER.finest("Connection to Probe Dock RT"); // Unable to use the logger into the run method
new Thread(new Runnable() {
@Override
public void run() {
initSocket.connect();
}
}).start();
synchronized (callback) {
callback.wait();
}
if (!initSocket.connected()) {
LOGGER.warning("Probe Dock RT is not available");
return null;
}
return initSocket;
}
catch (URISyntaxException | InterruptedException e) {
LOGGER.log(Level.WARNING, "Unknown error", e);
}
return null;
}
|
java
|
private Socket createConnectedSocket(final String url) {
try {
final Socket initSocket = IO.socket(url);
final Callback callback = new Callback();
initSocket.on(Socket.EVENT_CONNECT, callback);
initSocket.on(Socket.EVENT_CONNECT_ERROR, callback);
initSocket.on(Socket.EVENT_CONNECT_TIMEOUT, callback);
initSocket.on(Socket.EVENT_CONNECT_ERROR, callback);
initSocket.on(Socket.EVENT_DISCONNECT, callback);
initSocket.on(Socket.EVENT_ERROR, callback);
// Be sure that the emit/ack is synchronous to get the filters before the test are run
LOGGER.finest("Connection to Probe Dock RT"); // Unable to use the logger into the run method
new Thread(new Runnable() {
@Override
public void run() {
initSocket.connect();
}
}).start();
synchronized (callback) {
callback.wait();
}
if (!initSocket.connected()) {
LOGGER.warning("Probe Dock RT is not available");
return null;
}
return initSocket;
}
catch (URISyntaxException | InterruptedException e) {
LOGGER.log(Level.WARNING, "Unknown error", e);
}
return null;
}
|
[
"private",
"Socket",
"createConnectedSocket",
"(",
"final",
"String",
"url",
")",
"{",
"try",
"{",
"final",
"Socket",
"initSocket",
"=",
"IO",
".",
"socket",
"(",
"url",
")",
";",
"final",
"Callback",
"callback",
"=",
"new",
"Callback",
"(",
")",
";",
"initSocket",
".",
"on",
"(",
"Socket",
".",
"EVENT_CONNECT",
",",
"callback",
")",
";",
"initSocket",
".",
"on",
"(",
"Socket",
".",
"EVENT_CONNECT_ERROR",
",",
"callback",
")",
";",
"initSocket",
".",
"on",
"(",
"Socket",
".",
"EVENT_CONNECT_TIMEOUT",
",",
"callback",
")",
";",
"initSocket",
".",
"on",
"(",
"Socket",
".",
"EVENT_CONNECT_ERROR",
",",
"callback",
")",
";",
"initSocket",
".",
"on",
"(",
"Socket",
".",
"EVENT_DISCONNECT",
",",
"callback",
")",
";",
"initSocket",
".",
"on",
"(",
"Socket",
".",
"EVENT_ERROR",
",",
"callback",
")",
";",
"// Be sure that the emit/ack is synchronous to get the filters before the test are run",
"LOGGER",
".",
"finest",
"(",
"\"Connection to Probe Dock RT\"",
")",
";",
"// Unable to use the logger into the run method",
"new",
"Thread",
"(",
"new",
"Runnable",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"run",
"(",
")",
"{",
"initSocket",
".",
"connect",
"(",
")",
";",
"}",
"}",
")",
".",
"start",
"(",
")",
";",
"synchronized",
"(",
"callback",
")",
"{",
"callback",
".",
"wait",
"(",
")",
";",
"}",
"if",
"(",
"!",
"initSocket",
".",
"connected",
"(",
")",
")",
"{",
"LOGGER",
".",
"warning",
"(",
"\"Probe Dock RT is not available\"",
")",
";",
"return",
"null",
";",
"}",
"return",
"initSocket",
";",
"}",
"catch",
"(",
"URISyntaxException",
"|",
"InterruptedException",
"e",
")",
"{",
"LOGGER",
".",
"log",
"(",
"Level",
".",
"WARNING",
",",
"\"Unknown error\"",
",",
"e",
")",
";",
"}",
"return",
"null",
";",
"}"
] |
Create a new connection to the agent
@param url The URL
@return The socket connected to the agent or null if the connection is not possible
|
[
"Create",
"a",
"new",
"connection",
"to",
"the",
"agent"
] |
67b44b64303b15eb2d4808f9560a1c9554ccf3ba
|
https://github.com/probedock/probedock-rt-java/blob/67b44b64303b15eb2d4808f9560a1c9554ccf3ba/src/main/java/io/probedock/rt/client/Connector.java#L242-L280
|
152,788
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/util/DoubleStack.java
|
DoubleStack.push
|
public void push(double value)
{
if (top >= stack.length)
{
stack = Arrays.copyOf(stack, (int) (stack.length*growFactor));
}
stack[top++] = value;
}
|
java
|
public void push(double value)
{
if (top >= stack.length)
{
stack = Arrays.copyOf(stack, (int) (stack.length*growFactor));
}
stack[top++] = value;
}
|
[
"public",
"void",
"push",
"(",
"double",
"value",
")",
"{",
"if",
"(",
"top",
">=",
"stack",
".",
"length",
")",
"{",
"stack",
"=",
"Arrays",
".",
"copyOf",
"(",
"stack",
",",
"(",
"int",
")",
"(",
"stack",
".",
"length",
"*",
"growFactor",
")",
")",
";",
"}",
"stack",
"[",
"top",
"++",
"]",
"=",
"value",
";",
"}"
] |
Adds value to the top.
@param value
|
[
"Adds",
"value",
"to",
"the",
"top",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/DoubleStack.java#L63-L70
|
152,789
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/util/DoubleStack.java
|
DoubleStack.dup
|
@Override
public void dup()
{
if (top < 1)
{
throw new EmptyStackException();
}
if (top >= stack.length)
{
stack = Arrays.copyOf(stack, (int) (stack.length*growFactor));
}
top++;
stack[top-1] = stack[top-2];
}
|
java
|
@Override
public void dup()
{
if (top < 1)
{
throw new EmptyStackException();
}
if (top >= stack.length)
{
stack = Arrays.copyOf(stack, (int) (stack.length*growFactor));
}
top++;
stack[top-1] = stack[top-2];
}
|
[
"@",
"Override",
"public",
"void",
"dup",
"(",
")",
"{",
"if",
"(",
"top",
"<",
"1",
")",
"{",
"throw",
"new",
"EmptyStackException",
"(",
")",
";",
"}",
"if",
"(",
"top",
">=",
"stack",
".",
"length",
")",
"{",
"stack",
"=",
"Arrays",
".",
"copyOf",
"(",
"stack",
",",
"(",
"int",
")",
"(",
"stack",
".",
"length",
"*",
"growFactor",
")",
")",
";",
"}",
"top",
"++",
";",
"stack",
"[",
"top",
"-",
"1",
"]",
"=",
"stack",
"[",
"top",
"-",
"2",
"]",
";",
"}"
] |
Top element is pushed.
|
[
"Top",
"element",
"is",
"pushed",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/DoubleStack.java#L131-L144
|
152,790
|
jbundle/jbundle
|
app/program/script/src/main/java/org/jbundle/app/program/script/data/importfix/base/FixCapitalization.java
|
FixCapitalization.fixRecord
|
public void fixRecord(Record record)
{
super.fixRecord(record);
if (this.getProperty("field") != null)
{
BaseField field = this.getMainRecord().getField(this.getProperty("field").toString());
if (field != null)
this.fixCapitalization(field);
}
}
|
java
|
public void fixRecord(Record record)
{
super.fixRecord(record);
if (this.getProperty("field") != null)
{
BaseField field = this.getMainRecord().getField(this.getProperty("field").toString());
if (field != null)
this.fixCapitalization(field);
}
}
|
[
"public",
"void",
"fixRecord",
"(",
"Record",
"record",
")",
"{",
"super",
".",
"fixRecord",
"(",
"record",
")",
";",
"if",
"(",
"this",
".",
"getProperty",
"(",
"\"field\"",
")",
"!=",
"null",
")",
"{",
"BaseField",
"field",
"=",
"this",
".",
"getMainRecord",
"(",
")",
".",
"getField",
"(",
"this",
".",
"getProperty",
"(",
"\"field\"",
")",
".",
"toString",
"(",
")",
")",
";",
"if",
"(",
"field",
"!=",
"null",
")",
"this",
".",
"fixCapitalization",
"(",
"field",
")",
";",
"}",
"}"
] |
FixRecord Method.
|
[
"FixRecord",
"Method",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/script/src/main/java/org/jbundle/app/program/script/data/importfix/base/FixCapitalization.java#L54-L63
|
152,791
|
krotscheck/jersey2-toolkit
|
jersey2-hibernate/src/main/java/net/krotscheck/jersey2/hibernate/factory/FulltextSessionFactory.java
|
FulltextSessionFactory.dispose
|
@Override
public void dispose(final FullTextSession session) {
if (session != null && session.isOpen()) {
logger.trace("Disposing of hibernate fulltext session.");
session.close();
}
}
|
java
|
@Override
public void dispose(final FullTextSession session) {
if (session != null && session.isOpen()) {
logger.trace("Disposing of hibernate fulltext session.");
session.close();
}
}
|
[
"@",
"Override",
"public",
"void",
"dispose",
"(",
"final",
"FullTextSession",
"session",
")",
"{",
"if",
"(",
"session",
"!=",
"null",
"&&",
"session",
".",
"isOpen",
"(",
")",
")",
"{",
"logger",
".",
"trace",
"(",
"\"Disposing of hibernate fulltext session.\"",
")",
";",
"session",
".",
"close",
"(",
")",
";",
"}",
"}"
] |
Dispose of the fulltext session if it hasn't already been closed.
@param session The fulltext session to dispose of.
|
[
"Dispose",
"of",
"the",
"fulltext",
"session",
"if",
"it",
"hasn",
"t",
"already",
"been",
"closed",
"."
] |
11d757bd222dc82ada462caf6730ba4ff85dae04
|
https://github.com/krotscheck/jersey2-toolkit/blob/11d757bd222dc82ada462caf6730ba4ff85dae04/jersey2-hibernate/src/main/java/net/krotscheck/jersey2/hibernate/factory/FulltextSessionFactory.java#L76-L82
|
152,792
|
pressgang-ccms/PressGangCCMSContentSpec
|
src/main/java/org/jboss/pressgang/ccms/contentspec/utils/EntityUtilities.java
|
EntityUtilities.getTranslatedContentSpecById
|
public static TranslatedContentSpecWrapper getTranslatedContentSpecById(final DataProviderFactory providerFactory, final Integer id,
final Integer rev) {
final CollectionWrapper<TranslatedContentSpecWrapper> translatedContentSpecs = providerFactory.getProvider(
ContentSpecProvider.class).getContentSpecTranslations(id, rev);
if (translatedContentSpecs != null) {
final List<TranslatedContentSpecWrapper> translatedContentSpecItems = translatedContentSpecs.getItems();
for (final TranslatedContentSpecWrapper translatedContentSpec : translatedContentSpecItems) {
if (rev != null && translatedContentSpec.getContentSpecRevision().equals(rev)) {
return translatedContentSpec;
} else if (rev == null) {
return translatedContentSpec;
}
}
}
return null;
}
|
java
|
public static TranslatedContentSpecWrapper getTranslatedContentSpecById(final DataProviderFactory providerFactory, final Integer id,
final Integer rev) {
final CollectionWrapper<TranslatedContentSpecWrapper> translatedContentSpecs = providerFactory.getProvider(
ContentSpecProvider.class).getContentSpecTranslations(id, rev);
if (translatedContentSpecs != null) {
final List<TranslatedContentSpecWrapper> translatedContentSpecItems = translatedContentSpecs.getItems();
for (final TranslatedContentSpecWrapper translatedContentSpec : translatedContentSpecItems) {
if (rev != null && translatedContentSpec.getContentSpecRevision().equals(rev)) {
return translatedContentSpec;
} else if (rev == null) {
return translatedContentSpec;
}
}
}
return null;
}
|
[
"public",
"static",
"TranslatedContentSpecWrapper",
"getTranslatedContentSpecById",
"(",
"final",
"DataProviderFactory",
"providerFactory",
",",
"final",
"Integer",
"id",
",",
"final",
"Integer",
"rev",
")",
"{",
"final",
"CollectionWrapper",
"<",
"TranslatedContentSpecWrapper",
">",
"translatedContentSpecs",
"=",
"providerFactory",
".",
"getProvider",
"(",
"ContentSpecProvider",
".",
"class",
")",
".",
"getContentSpecTranslations",
"(",
"id",
",",
"rev",
")",
";",
"if",
"(",
"translatedContentSpecs",
"!=",
"null",
")",
"{",
"final",
"List",
"<",
"TranslatedContentSpecWrapper",
">",
"translatedContentSpecItems",
"=",
"translatedContentSpecs",
".",
"getItems",
"(",
")",
";",
"for",
"(",
"final",
"TranslatedContentSpecWrapper",
"translatedContentSpec",
":",
"translatedContentSpecItems",
")",
"{",
"if",
"(",
"rev",
"!=",
"null",
"&&",
"translatedContentSpec",
".",
"getContentSpecRevision",
"(",
")",
".",
"equals",
"(",
"rev",
")",
")",
"{",
"return",
"translatedContentSpec",
";",
"}",
"else",
"if",
"(",
"rev",
"==",
"null",
")",
"{",
"return",
"translatedContentSpec",
";",
"}",
"}",
"}",
"return",
"null",
";",
"}"
] |
Gets a translated content spec based on a content spec id and revision
|
[
"Gets",
"a",
"translated",
"content",
"spec",
"based",
"on",
"a",
"content",
"spec",
"id",
"and",
"revision"
] |
2bc02e2971e4522b47a130fb7ae5a0f5ad377df1
|
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/utils/EntityUtilities.java#L97-L114
|
152,793
|
pressgang-ccms/PressGangCCMSContentSpec
|
src/main/java/org/jboss/pressgang/ccms/contentspec/utils/EntityUtilities.java
|
EntityUtilities.getClosestTranslatedContentSpecById
|
public static TranslatedContentSpecWrapper getClosestTranslatedContentSpecById(final DataProviderFactory providerFactory,
final Integer id, final Integer rev) {
final CollectionWrapper<TranslatedContentSpecWrapper> translatedContentSpecs = providerFactory.getProvider(ContentSpecProvider
.class).getContentSpec(id, rev).getTranslatedContentSpecs();
TranslatedContentSpecWrapper closestTranslation = null;
if (translatedContentSpecs != null && translatedContentSpecs.getItems() != null) {
final List<TranslatedContentSpecWrapper> entities = translatedContentSpecs.getItems();
for (final TranslatedContentSpecWrapper translatedContentSpec : entities) {
if (
// Ensure that the translation is the newest translation possible
(closestTranslation == null || closestTranslation.getContentSpecRevision() < translatedContentSpec
.getContentSpecRevision())
// Ensure that the translation revision is less than or equal to the revision specified
&& (rev == null || translatedContentSpec.getContentSpecRevision() <= rev)) {
closestTranslation = translatedContentSpec;
}
}
}
return closestTranslation;
}
|
java
|
public static TranslatedContentSpecWrapper getClosestTranslatedContentSpecById(final DataProviderFactory providerFactory,
final Integer id, final Integer rev) {
final CollectionWrapper<TranslatedContentSpecWrapper> translatedContentSpecs = providerFactory.getProvider(ContentSpecProvider
.class).getContentSpec(id, rev).getTranslatedContentSpecs();
TranslatedContentSpecWrapper closestTranslation = null;
if (translatedContentSpecs != null && translatedContentSpecs.getItems() != null) {
final List<TranslatedContentSpecWrapper> entities = translatedContentSpecs.getItems();
for (final TranslatedContentSpecWrapper translatedContentSpec : entities) {
if (
// Ensure that the translation is the newest translation possible
(closestTranslation == null || closestTranslation.getContentSpecRevision() < translatedContentSpec
.getContentSpecRevision())
// Ensure that the translation revision is less than or equal to the revision specified
&& (rev == null || translatedContentSpec.getContentSpecRevision() <= rev)) {
closestTranslation = translatedContentSpec;
}
}
}
return closestTranslation;
}
|
[
"public",
"static",
"TranslatedContentSpecWrapper",
"getClosestTranslatedContentSpecById",
"(",
"final",
"DataProviderFactory",
"providerFactory",
",",
"final",
"Integer",
"id",
",",
"final",
"Integer",
"rev",
")",
"{",
"final",
"CollectionWrapper",
"<",
"TranslatedContentSpecWrapper",
">",
"translatedContentSpecs",
"=",
"providerFactory",
".",
"getProvider",
"(",
"ContentSpecProvider",
".",
"class",
")",
".",
"getContentSpec",
"(",
"id",
",",
"rev",
")",
".",
"getTranslatedContentSpecs",
"(",
")",
";",
"TranslatedContentSpecWrapper",
"closestTranslation",
"=",
"null",
";",
"if",
"(",
"translatedContentSpecs",
"!=",
"null",
"&&",
"translatedContentSpecs",
".",
"getItems",
"(",
")",
"!=",
"null",
")",
"{",
"final",
"List",
"<",
"TranslatedContentSpecWrapper",
">",
"entities",
"=",
"translatedContentSpecs",
".",
"getItems",
"(",
")",
";",
"for",
"(",
"final",
"TranslatedContentSpecWrapper",
"translatedContentSpec",
":",
"entities",
")",
"{",
"if",
"(",
"// Ensure that the translation is the newest translation possible",
"(",
"closestTranslation",
"==",
"null",
"||",
"closestTranslation",
".",
"getContentSpecRevision",
"(",
")",
"<",
"translatedContentSpec",
".",
"getContentSpecRevision",
"(",
")",
")",
"// Ensure that the translation revision is less than or equal to the revision specified",
"&&",
"(",
"rev",
"==",
"null",
"||",
"translatedContentSpec",
".",
"getContentSpecRevision",
"(",
")",
"<=",
"rev",
")",
")",
"{",
"closestTranslation",
"=",
"translatedContentSpec",
";",
"}",
"}",
"}",
"return",
"closestTranslation",
";",
"}"
] |
Gets a translated content spec based on a id and revision. The translated content spec that is returned will be less then
or equal to the revision that is passed. If the revision is null then the latest translated content spec will be returned.
@param providerFactory
@param id The Content Spec ID to find the translation for.
@param rev The Content Spec Revision to find the translation for.
@return The closest matching translated content spec otherwise null if none exist.
|
[
"Gets",
"a",
"translated",
"content",
"spec",
"based",
"on",
"a",
"id",
"and",
"revision",
".",
"The",
"translated",
"content",
"spec",
"that",
"is",
"returned",
"will",
"be",
"less",
"then",
"or",
"equal",
"to",
"the",
"revision",
"that",
"is",
"passed",
".",
"If",
"the",
"revision",
"is",
"null",
"then",
"the",
"latest",
"translated",
"content",
"spec",
"will",
"be",
"returned",
"."
] |
2bc02e2971e4522b47a130fb7ae5a0f5ad377df1
|
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/utils/EntityUtilities.java#L125-L147
|
152,794
|
pressgang-ccms/PressGangCCMSContentSpec
|
src/main/java/org/jboss/pressgang/ccms/contentspec/utils/EntityUtilities.java
|
EntityUtilities.getCategoryMappingFromTagList
|
public static Map<Integer, List<TagWrapper>> getCategoryMappingFromTagList(final Collection<TagWrapper> tags) {
final HashMap<Integer, List<TagWrapper>> mapping = new HashMap<Integer, List<TagWrapper>>();
for (final TagWrapper tag : tags) {
final List<CategoryInTagWrapper> catList = tag.getCategories().getItems();
if (catList != null) {
for (final CategoryInTagWrapper cat : catList) {
if (!mapping.containsKey(cat.getId())) {
mapping.put(cat.getId(), new ArrayList<TagWrapper>());
}
mapping.get(cat.getId()).add(tag);
}
}
}
return mapping;
}
|
java
|
public static Map<Integer, List<TagWrapper>> getCategoryMappingFromTagList(final Collection<TagWrapper> tags) {
final HashMap<Integer, List<TagWrapper>> mapping = new HashMap<Integer, List<TagWrapper>>();
for (final TagWrapper tag : tags) {
final List<CategoryInTagWrapper> catList = tag.getCategories().getItems();
if (catList != null) {
for (final CategoryInTagWrapper cat : catList) {
if (!mapping.containsKey(cat.getId())) {
mapping.put(cat.getId(), new ArrayList<TagWrapper>());
}
mapping.get(cat.getId()).add(tag);
}
}
}
return mapping;
}
|
[
"public",
"static",
"Map",
"<",
"Integer",
",",
"List",
"<",
"TagWrapper",
">",
">",
"getCategoryMappingFromTagList",
"(",
"final",
"Collection",
"<",
"TagWrapper",
">",
"tags",
")",
"{",
"final",
"HashMap",
"<",
"Integer",
",",
"List",
"<",
"TagWrapper",
">",
">",
"mapping",
"=",
"new",
"HashMap",
"<",
"Integer",
",",
"List",
"<",
"TagWrapper",
">",
">",
"(",
")",
";",
"for",
"(",
"final",
"TagWrapper",
"tag",
":",
"tags",
")",
"{",
"final",
"List",
"<",
"CategoryInTagWrapper",
">",
"catList",
"=",
"tag",
".",
"getCategories",
"(",
")",
".",
"getItems",
"(",
")",
";",
"if",
"(",
"catList",
"!=",
"null",
")",
"{",
"for",
"(",
"final",
"CategoryInTagWrapper",
"cat",
":",
"catList",
")",
"{",
"if",
"(",
"!",
"mapping",
".",
"containsKey",
"(",
"cat",
".",
"getId",
"(",
")",
")",
")",
"{",
"mapping",
".",
"put",
"(",
"cat",
".",
"getId",
"(",
")",
",",
"new",
"ArrayList",
"<",
"TagWrapper",
">",
"(",
")",
")",
";",
"}",
"mapping",
".",
"get",
"(",
"cat",
".",
"getId",
"(",
")",
")",
".",
"add",
"(",
"tag",
")",
";",
"}",
"}",
"}",
"return",
"mapping",
";",
"}"
] |
Converts a list of tags into a mapping of categories to tags. The key is the Category and the value is a List
of Tags for that category.
@param tags The List of tags to be converted.
@return The mapping of Categories to Tags.
|
[
"Converts",
"a",
"list",
"of",
"tags",
"into",
"a",
"mapping",
"of",
"categories",
"to",
"tags",
".",
"The",
"key",
"is",
"the",
"Category",
"and",
"the",
"value",
"is",
"a",
"List",
"of",
"Tags",
"for",
"that",
"category",
"."
] |
2bc02e2971e4522b47a130fb7ae5a0f5ad377df1
|
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/utils/EntityUtilities.java#L348-L362
|
152,795
|
pressgang-ccms/PressGangCCMSContentSpec
|
src/main/java/org/jboss/pressgang/ccms/contentspec/utils/EntityUtilities.java
|
EntityUtilities.getCSNodeTopicEntity
|
public static TopicWrapper getCSNodeTopicEntity(final CSNodeWrapper node, final TopicProvider topicProvider) {
if (!isNodeATopic(node)) return null;
return topicProvider.getTopic(node.getEntityId(), node.getEntityRevision());
}
|
java
|
public static TopicWrapper getCSNodeTopicEntity(final CSNodeWrapper node, final TopicProvider topicProvider) {
if (!isNodeATopic(node)) return null;
return topicProvider.getTopic(node.getEntityId(), node.getEntityRevision());
}
|
[
"public",
"static",
"TopicWrapper",
"getCSNodeTopicEntity",
"(",
"final",
"CSNodeWrapper",
"node",
",",
"final",
"TopicProvider",
"topicProvider",
")",
"{",
"if",
"(",
"!",
"isNodeATopic",
"(",
"node",
")",
")",
"return",
"null",
";",
"return",
"topicProvider",
".",
"getTopic",
"(",
"node",
".",
"getEntityId",
"(",
")",
",",
"node",
".",
"getEntityRevision",
"(",
")",
")",
";",
"}"
] |
Gets the CSNode Topic entity that is represented by the node.
@param node The node that represents a topic entry.
@param topicProvider The topic provider to lookup the topic entity from.
@return The topic entity represented by the node, or null if there isn't one that matches.
|
[
"Gets",
"the",
"CSNode",
"Topic",
"entity",
"that",
"is",
"represented",
"by",
"the",
"node",
"."
] |
2bc02e2971e4522b47a130fb7ae5a0f5ad377df1
|
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/utils/EntityUtilities.java#L371-L375
|
152,796
|
pressgang-ccms/PressGangCCMSContentSpec
|
src/main/java/org/jboss/pressgang/ccms/contentspec/utils/EntityUtilities.java
|
EntityUtilities.isNodeATopic
|
public static boolean isNodeATopic(final BaseCSNodeWrapper<?> node) {
switch (node.getNodeType()) {
case CommonConstants.CS_NODE_TOPIC:
case CommonConstants.CS_NODE_INITIAL_CONTENT_TOPIC:
case CommonConstants.CS_NODE_META_DATA_TOPIC:
return true;
default:
return false;
}
}
|
java
|
public static boolean isNodeATopic(final BaseCSNodeWrapper<?> node) {
switch (node.getNodeType()) {
case CommonConstants.CS_NODE_TOPIC:
case CommonConstants.CS_NODE_INITIAL_CONTENT_TOPIC:
case CommonConstants.CS_NODE_META_DATA_TOPIC:
return true;
default:
return false;
}
}
|
[
"public",
"static",
"boolean",
"isNodeATopic",
"(",
"final",
"BaseCSNodeWrapper",
"<",
"?",
">",
"node",
")",
"{",
"switch",
"(",
"node",
".",
"getNodeType",
"(",
")",
")",
"{",
"case",
"CommonConstants",
".",
"CS_NODE_TOPIC",
":",
"case",
"CommonConstants",
".",
"CS_NODE_INITIAL_CONTENT_TOPIC",
":",
"case",
"CommonConstants",
".",
"CS_NODE_META_DATA_TOPIC",
":",
"return",
"true",
";",
"default",
":",
"return",
"false",
";",
"}",
"}"
] |
Checks to see if the node is some representation of a Topic entity.
@param node The node to be checked.
@return
|
[
"Checks",
"to",
"see",
"if",
"the",
"node",
"is",
"some",
"representation",
"of",
"a",
"Topic",
"entity",
"."
] |
2bc02e2971e4522b47a130fb7ae5a0f5ad377df1
|
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/utils/EntityUtilities.java#L383-L392
|
152,797
|
pressgang-ccms/PressGangCCMSContentSpec
|
src/main/java/org/jboss/pressgang/ccms/contentspec/utils/EntityUtilities.java
|
EntityUtilities.isNodeALevel
|
public static boolean isNodeALevel(final BaseCSNodeWrapper<?> node) {
switch (node.getNodeType()) {
case CommonConstants.CS_NODE_APPENDIX:
case CommonConstants.CS_NODE_CHAPTER:
case CommonConstants.CS_NODE_PART:
case CommonConstants.CS_NODE_PREFACE:
case CommonConstants.CS_NODE_PROCESS:
case CommonConstants.CS_NODE_SECTION:
case CommonConstants.CS_NODE_INITIAL_CONTENT:
return true;
default:
return false;
}
}
|
java
|
public static boolean isNodeALevel(final BaseCSNodeWrapper<?> node) {
switch (node.getNodeType()) {
case CommonConstants.CS_NODE_APPENDIX:
case CommonConstants.CS_NODE_CHAPTER:
case CommonConstants.CS_NODE_PART:
case CommonConstants.CS_NODE_PREFACE:
case CommonConstants.CS_NODE_PROCESS:
case CommonConstants.CS_NODE_SECTION:
case CommonConstants.CS_NODE_INITIAL_CONTENT:
return true;
default:
return false;
}
}
|
[
"public",
"static",
"boolean",
"isNodeALevel",
"(",
"final",
"BaseCSNodeWrapper",
"<",
"?",
">",
"node",
")",
"{",
"switch",
"(",
"node",
".",
"getNodeType",
"(",
")",
")",
"{",
"case",
"CommonConstants",
".",
"CS_NODE_APPENDIX",
":",
"case",
"CommonConstants",
".",
"CS_NODE_CHAPTER",
":",
"case",
"CommonConstants",
".",
"CS_NODE_PART",
":",
"case",
"CommonConstants",
".",
"CS_NODE_PREFACE",
":",
"case",
"CommonConstants",
".",
"CS_NODE_PROCESS",
":",
"case",
"CommonConstants",
".",
"CS_NODE_SECTION",
":",
"case",
"CommonConstants",
".",
"CS_NODE_INITIAL_CONTENT",
":",
"return",
"true",
";",
"default",
":",
"return",
"false",
";",
"}",
"}"
] |
Checks to see if an entity node is a level representation.
@param node
@return
|
[
"Checks",
"to",
"see",
"if",
"an",
"entity",
"node",
"is",
"a",
"level",
"representation",
"."
] |
2bc02e2971e4522b47a130fb7ae5a0f5ad377df1
|
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/utils/EntityUtilities.java#L400-L413
|
152,798
|
pressgang-ccms/PressGangCCMSContentSpec
|
src/main/java/org/jboss/pressgang/ccms/contentspec/utils/EntityUtilities.java
|
EntityUtilities.hasContentSpecMetaDataChanged
|
public static boolean hasContentSpecMetaDataChanged(final String metaDataName, final String currentValue,
final ContentSpecWrapper contentSpecEntity) {
final CSNodeWrapper metaData = contentSpecEntity.getMetaData(metaDataName);
if (metaData != null && metaData.getAdditionalText() != null && !metaData.getAdditionalText().equals(currentValue)) {
// The values no longer match
return true;
} else if ((metaData == null || metaData.getAdditionalText() == null) && currentValue != null) {
// The meta data node doesn't exist but it exists now
return true;
} else {
return false;
}
}
|
java
|
public static boolean hasContentSpecMetaDataChanged(final String metaDataName, final String currentValue,
final ContentSpecWrapper contentSpecEntity) {
final CSNodeWrapper metaData = contentSpecEntity.getMetaData(metaDataName);
if (metaData != null && metaData.getAdditionalText() != null && !metaData.getAdditionalText().equals(currentValue)) {
// The values no longer match
return true;
} else if ((metaData == null || metaData.getAdditionalText() == null) && currentValue != null) {
// The meta data node doesn't exist but it exists now
return true;
} else {
return false;
}
}
|
[
"public",
"static",
"boolean",
"hasContentSpecMetaDataChanged",
"(",
"final",
"String",
"metaDataName",
",",
"final",
"String",
"currentValue",
",",
"final",
"ContentSpecWrapper",
"contentSpecEntity",
")",
"{",
"final",
"CSNodeWrapper",
"metaData",
"=",
"contentSpecEntity",
".",
"getMetaData",
"(",
"metaDataName",
")",
";",
"if",
"(",
"metaData",
"!=",
"null",
"&&",
"metaData",
".",
"getAdditionalText",
"(",
")",
"!=",
"null",
"&&",
"!",
"metaData",
".",
"getAdditionalText",
"(",
")",
".",
"equals",
"(",
"currentValue",
")",
")",
"{",
"// The values no longer match",
"return",
"true",
";",
"}",
"else",
"if",
"(",
"(",
"metaData",
"==",
"null",
"||",
"metaData",
".",
"getAdditionalText",
"(",
")",
"==",
"null",
")",
"&&",
"currentValue",
"!=",
"null",
")",
"{",
"// The meta data node doesn't exist but it exists now",
"return",
"true",
";",
"}",
"else",
"{",
"return",
"false",
";",
"}",
"}"
] |
Checks to see if a Content Spec Meta Data element has changed.
@param metaDataName The Content Spec Meta Data name.
@param currentValue The expected current value of the Meta Data node.
@param contentSpecEntity The Content Spec Entity to check against.
@return True if the meta data node has changed, otherwise false.
|
[
"Checks",
"to",
"see",
"if",
"a",
"Content",
"Spec",
"Meta",
"Data",
"element",
"has",
"changed",
"."
] |
2bc02e2971e4522b47a130fb7ae5a0f5ad377df1
|
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/utils/EntityUtilities.java#L423-L435
|
152,799
|
pressgang-ccms/PressGangCCMSContentSpec
|
src/main/java/org/jboss/pressgang/ccms/contentspec/utils/EntityUtilities.java
|
EntityUtilities.findLocaleFromString
|
public static LocaleWrapper findLocaleFromString(final CollectionWrapper<LocaleWrapper> locales, final String localeString) {
if (localeString == null) return null;
for (final LocaleWrapper locale : locales.getItems()) {
if (localeString.equals(locale.getValue())) {
return locale;
}
}
return null;
}
|
java
|
public static LocaleWrapper findLocaleFromString(final CollectionWrapper<LocaleWrapper> locales, final String localeString) {
if (localeString == null) return null;
for (final LocaleWrapper locale : locales.getItems()) {
if (localeString.equals(locale.getValue())) {
return locale;
}
}
return null;
}
|
[
"public",
"static",
"LocaleWrapper",
"findLocaleFromString",
"(",
"final",
"CollectionWrapper",
"<",
"LocaleWrapper",
">",
"locales",
",",
"final",
"String",
"localeString",
")",
"{",
"if",
"(",
"localeString",
"==",
"null",
")",
"return",
"null",
";",
"for",
"(",
"final",
"LocaleWrapper",
"locale",
":",
"locales",
".",
"getItems",
"(",
")",
")",
"{",
"if",
"(",
"localeString",
".",
"equals",
"(",
"locale",
".",
"getValue",
"(",
")",
")",
")",
"{",
"return",
"locale",
";",
"}",
"}",
"return",
"null",
";",
"}"
] |
Finds the matching locale entity from a locale string.
@param localeProvider
@param localeString
@return
|
[
"Finds",
"the",
"matching",
"locale",
"entity",
"from",
"a",
"locale",
"string",
"."
] |
2bc02e2971e4522b47a130fb7ae5a0f5ad377df1
|
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/utils/EntityUtilities.java#L452-L462
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.