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
|
|---|---|---|---|---|---|---|---|---|---|---|---|
146,800
|
moparisthebest/beehive
|
beehive-jdbc-control/src/main/java/org/apache/beehive/controls/system/jdbc/parser/ParameterChecker.java
|
ParameterChecker.doCheck
|
private static void doCheck(SqlFragmentContainer statement, HashMap<String, ParameterDeclaration> paramMap,
final MethodDeclaration method)
{
SqlFragment[] fragments = statement.getChildren();
for (SqlFragment fragment : fragments) {
// if the fragment is a container check all of its children.
if (fragment instanceof SqlFragmentContainer) {
doCheck((SqlFragmentContainer) fragment, paramMap, method);
// reflection fragment - make sure it can be mapped using the method's param values.
} else if (fragment instanceof ReflectionFragment) {
checkReflectionFragment((ReflectionFragment) fragment, paramMap, method);
}
}
}
|
java
|
private static void doCheck(SqlFragmentContainer statement, HashMap<String, ParameterDeclaration> paramMap,
final MethodDeclaration method)
{
SqlFragment[] fragments = statement.getChildren();
for (SqlFragment fragment : fragments) {
// if the fragment is a container check all of its children.
if (fragment instanceof SqlFragmentContainer) {
doCheck((SqlFragmentContainer) fragment, paramMap, method);
// reflection fragment - make sure it can be mapped using the method's param values.
} else if (fragment instanceof ReflectionFragment) {
checkReflectionFragment((ReflectionFragment) fragment, paramMap, method);
}
}
}
|
[
"private",
"static",
"void",
"doCheck",
"(",
"SqlFragmentContainer",
"statement",
",",
"HashMap",
"<",
"String",
",",
"ParameterDeclaration",
">",
"paramMap",
",",
"final",
"MethodDeclaration",
"method",
")",
"{",
"SqlFragment",
"[",
"]",
"fragments",
"=",
"statement",
".",
"getChildren",
"(",
")",
";",
"for",
"(",
"SqlFragment",
"fragment",
":",
"fragments",
")",
"{",
"// if the fragment is a container check all of its children.",
"if",
"(",
"fragment",
"instanceof",
"SqlFragmentContainer",
")",
"{",
"doCheck",
"(",
"(",
"SqlFragmentContainer",
")",
"fragment",
",",
"paramMap",
",",
"method",
")",
";",
"// reflection fragment - make sure it can be mapped using the method's param values.",
"}",
"else",
"if",
"(",
"fragment",
"instanceof",
"ReflectionFragment",
")",
"{",
"checkReflectionFragment",
"(",
"(",
"ReflectionFragment",
")",
"fragment",
",",
"paramMap",
",",
"method",
")",
";",
"}",
"}",
"}"
] |
Walk the tree of children of the statement, process all children of type ReflectionFragment.
@param statement The parsed statement element.
@param paramMap The method parameters, keyed by name.
@param method The method declaration which was annotated.
|
[
"Walk",
"the",
"tree",
"of",
"children",
"of",
"the",
"statement",
"process",
"all",
"children",
"of",
"type",
"ReflectionFragment",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-jdbc-control/src/main/java/org/apache/beehive/controls/system/jdbc/parser/ParameterChecker.java#L75-L91
|
146,801
|
moparisthebest/beehive
|
beehive-jdbc-control/src/main/java/org/apache/beehive/controls/system/jdbc/parser/ParameterChecker.java
|
ParameterChecker.buildMessage
|
private static String buildMessage(String parameterName, String methodName) {
ResourceBundle rb = ResourceBundle.getBundle("org.apache.beehive.controls.system.jdbc.parser.strings", Locale.getDefault() );
String pattern = rb.getString("jdbccontrol.invalid.param");
return MessageFormat.format(pattern, parameterName, methodName);
}
|
java
|
private static String buildMessage(String parameterName, String methodName) {
ResourceBundle rb = ResourceBundle.getBundle("org.apache.beehive.controls.system.jdbc.parser.strings", Locale.getDefault() );
String pattern = rb.getString("jdbccontrol.invalid.param");
return MessageFormat.format(pattern, parameterName, methodName);
}
|
[
"private",
"static",
"String",
"buildMessage",
"(",
"String",
"parameterName",
",",
"String",
"methodName",
")",
"{",
"ResourceBundle",
"rb",
"=",
"ResourceBundle",
".",
"getBundle",
"(",
"\"org.apache.beehive.controls.system.jdbc.parser.strings\"",
",",
"Locale",
".",
"getDefault",
"(",
")",
")",
";",
"String",
"pattern",
"=",
"rb",
".",
"getString",
"(",
"\"jdbccontrol.invalid.param\"",
")",
";",
"return",
"MessageFormat",
".",
"format",
"(",
"pattern",
",",
"parameterName",
",",
"methodName",
")",
";",
"}"
] |
Build the error message for this module.
@param parameterName
@param methodName
@return The generated messge.
|
[
"Build",
"the",
"error",
"message",
"for",
"this",
"module",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-jdbc-control/src/main/java/org/apache/beehive/controls/system/jdbc/parser/ParameterChecker.java#L190-L195
|
146,802
|
moparisthebest/beehive
|
beehive-netui-core/src/main/java/org/apache/beehive/netui/core/urls/MutableURI.java
|
MutableURI.setUserInfo
|
public void setUserInfo( String userInfo )
{
_userInfo = null;
if ( userInfo != null && userInfo.length() > 0 )
{
_userInfo = userInfo;
}
}
|
java
|
public void setUserInfo( String userInfo )
{
_userInfo = null;
if ( userInfo != null && userInfo.length() > 0 )
{
_userInfo = userInfo;
}
}
|
[
"public",
"void",
"setUserInfo",
"(",
"String",
"userInfo",
")",
"{",
"_userInfo",
"=",
"null",
";",
"if",
"(",
"userInfo",
"!=",
"null",
"&&",
"userInfo",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"_userInfo",
"=",
"userInfo",
";",
"}",
"}"
] |
Sets the userInfo. Assumes this component is already escaped.
@param userInfo userInfo
|
[
"Sets",
"the",
"userInfo",
".",
"Assumes",
"this",
"component",
"is",
"already",
"escaped",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/core/urls/MutableURI.java#L348-L355
|
146,803
|
moparisthebest/beehive
|
beehive-netui-core/src/main/java/org/apache/beehive/netui/core/urls/MutableURI.java
|
MutableURI.setHost
|
public void setHost( String host )
{
_host = null;
if ( host != null && host.length() > 0 )
{
//
// Here's some very minimal support for IPv6 addresses.
// If the literal IPv6 address is not enclosed in square brackets
// then add them.
//
boolean needBrackets = ( ( host.indexOf( ':' ) >= 0 )
&& !host.startsWith( "[" )
&& !host.endsWith( "]" ) );
if ( needBrackets )
{
_host = '[' + host + ']';
}
else
{
_host = host;
}
_opaque = false;
setSchemeSpecificPart( null );
}
if ( _host == null )
{
setUserInfo( null );
setPort( UNDEFINED_PORT );
}
}
|
java
|
public void setHost( String host )
{
_host = null;
if ( host != null && host.length() > 0 )
{
//
// Here's some very minimal support for IPv6 addresses.
// If the literal IPv6 address is not enclosed in square brackets
// then add them.
//
boolean needBrackets = ( ( host.indexOf( ':' ) >= 0 )
&& !host.startsWith( "[" )
&& !host.endsWith( "]" ) );
if ( needBrackets )
{
_host = '[' + host + ']';
}
else
{
_host = host;
}
_opaque = false;
setSchemeSpecificPart( null );
}
if ( _host == null )
{
setUserInfo( null );
setPort( UNDEFINED_PORT );
}
}
|
[
"public",
"void",
"setHost",
"(",
"String",
"host",
")",
"{",
"_host",
"=",
"null",
";",
"if",
"(",
"host",
"!=",
"null",
"&&",
"host",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"//",
"// Here's some very minimal support for IPv6 addresses.",
"// If the literal IPv6 address is not enclosed in square brackets",
"// then add them.",
"//",
"boolean",
"needBrackets",
"=",
"(",
"(",
"host",
".",
"indexOf",
"(",
"'",
"'",
")",
">=",
"0",
")",
"&&",
"!",
"host",
".",
"startsWith",
"(",
"\"[\"",
")",
"&&",
"!",
"host",
".",
"endsWith",
"(",
"\"]\"",
")",
")",
";",
"if",
"(",
"needBrackets",
")",
"{",
"_host",
"=",
"'",
"'",
"+",
"host",
"+",
"'",
"'",
";",
"}",
"else",
"{",
"_host",
"=",
"host",
";",
"}",
"_opaque",
"=",
"false",
";",
"setSchemeSpecificPart",
"(",
"null",
")",
";",
"}",
"if",
"(",
"_host",
"==",
"null",
")",
"{",
"setUserInfo",
"(",
"null",
")",
";",
"setPort",
"(",
"UNDEFINED_PORT",
")",
";",
"}",
"}"
] |
Sets the host.
@param host host
|
[
"Sets",
"the",
"host",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/core/urls/MutableURI.java#L373-L405
|
146,804
|
moparisthebest/beehive
|
beehive-netui-core/src/main/java/org/apache/beehive/netui/core/urls/MutableURI.java
|
MutableURI.setPort
|
public void setPort( int port )
{
assert ( port >= 0 && port <= 65535 ) || ( port == UNDEFINED_PORT )
: "Invalid port" ;
if ( ( port > 65535 ) || ( port < 0 && port != UNDEFINED_PORT ) )
{
throw new IllegalArgumentException( "A port must be between 0 and 65535 or equal to "
+ UNDEFINED_PORT + ".");
}
_port = port;
}
|
java
|
public void setPort( int port )
{
assert ( port >= 0 && port <= 65535 ) || ( port == UNDEFINED_PORT )
: "Invalid port" ;
if ( ( port > 65535 ) || ( port < 0 && port != UNDEFINED_PORT ) )
{
throw new IllegalArgumentException( "A port must be between 0 and 65535 or equal to "
+ UNDEFINED_PORT + ".");
}
_port = port;
}
|
[
"public",
"void",
"setPort",
"(",
"int",
"port",
")",
"{",
"assert",
"(",
"port",
">=",
"0",
"&&",
"port",
"<=",
"65535",
")",
"||",
"(",
"port",
"==",
"UNDEFINED_PORT",
")",
":",
"\"Invalid port\"",
";",
"if",
"(",
"(",
"port",
">",
"65535",
")",
"||",
"(",
"port",
"<",
"0",
"&&",
"port",
"!=",
"UNDEFINED_PORT",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"A port must be between 0 and 65535 or equal to \"",
"+",
"UNDEFINED_PORT",
"+",
"\".\"",
")",
";",
"}",
"_port",
"=",
"port",
";",
"}"
] |
Sets the port.
@param port port
|
[
"Sets",
"the",
"port",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/core/urls/MutableURI.java#L423-L435
|
146,805
|
moparisthebest/beehive
|
beehive-netui-core/src/main/java/org/apache/beehive/netui/core/urls/MutableURI.java
|
MutableURI.setPath
|
public void setPath( String path )
{
// Note that an empty path is OK
if ( path == null )
{
_path = null;
setQuery( null );
setFragment( null );
}
else
{
_path = path;
_opaque = false;
setSchemeSpecificPart( null );
}
}
|
java
|
public void setPath( String path )
{
// Note that an empty path is OK
if ( path == null )
{
_path = null;
setQuery( null );
setFragment( null );
}
else
{
_path = path;
_opaque = false;
setSchemeSpecificPart( null );
}
}
|
[
"public",
"void",
"setPath",
"(",
"String",
"path",
")",
"{",
"// Note that an empty path is OK",
"if",
"(",
"path",
"==",
"null",
")",
"{",
"_path",
"=",
"null",
";",
"setQuery",
"(",
"null",
")",
";",
"setFragment",
"(",
"null",
")",
";",
"}",
"else",
"{",
"_path",
"=",
"path",
";",
"_opaque",
"=",
"false",
";",
"setSchemeSpecificPart",
"(",
"null",
")",
";",
"}",
"}"
] |
Sets the path. Assumes this component is already escaped.
@param path path
|
[
"Sets",
"the",
"path",
".",
"Assumes",
"this",
"component",
"is",
"already",
"escaped",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/core/urls/MutableURI.java#L453-L468
|
146,806
|
moparisthebest/beehive
|
beehive-netui-core/src/main/java/org/apache/beehive/netui/core/urls/MutableURI.java
|
MutableURI.getParameter
|
public String getParameter( String name )
{
if (_parameters == null || !_parameters.hasParameters())
return null;
List parameters = _parameters.getParameterValues(name);
if(parameters != null && parameters.size() > 0)
return (String)parameters.get(0);
else return null;
}
|
java
|
public String getParameter( String name )
{
if (_parameters == null || !_parameters.hasParameters())
return null;
List parameters = _parameters.getParameterValues(name);
if(parameters != null && parameters.size() > 0)
return (String)parameters.get(0);
else return null;
}
|
[
"public",
"String",
"getParameter",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"_parameters",
"==",
"null",
"||",
"!",
"_parameters",
".",
"hasParameters",
"(",
")",
")",
"return",
"null",
";",
"List",
"parameters",
"=",
"_parameters",
".",
"getParameterValues",
"(",
"name",
")",
";",
"if",
"(",
"parameters",
"!=",
"null",
"&&",
"parameters",
".",
"size",
"(",
")",
">",
"0",
")",
"return",
"(",
"String",
")",
"parameters",
".",
"get",
"(",
"0",
")",
";",
"else",
"return",
"null",
";",
"}"
] |
Returns the value of the parameter. If several values are associated with the given
parameter name, the first value is returned.
@param name a name of the parameter
@return value associated with the given parameter name
|
[
"Returns",
"the",
"value",
"of",
"the",
"parameter",
".",
"If",
"several",
"values",
"are",
"associated",
"with",
"the",
"given",
"parameter",
"name",
"the",
"first",
"value",
"is",
"returned",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/core/urls/MutableURI.java#L687-L696
|
146,807
|
moparisthebest/beehive
|
beehive-netui-core/src/main/java/org/apache/beehive/netui/core/urls/MutableURI.java
|
MutableURI.getParameters
|
public List/*< String >*/ getParameters( String name )
{
if ( _parameters == null || !_parameters.hasParameters())
return Collections.EMPTY_LIST;
else {
List parameters = _parameters.getParameterValues(name);
if(parameters == null)
return Collections.EMPTY_LIST;
else return Collections.unmodifiableList(parameters);
}
}
|
java
|
public List/*< String >*/ getParameters( String name )
{
if ( _parameters == null || !_parameters.hasParameters())
return Collections.EMPTY_LIST;
else {
List parameters = _parameters.getParameterValues(name);
if(parameters == null)
return Collections.EMPTY_LIST;
else return Collections.unmodifiableList(parameters);
}
}
|
[
"public",
"List",
"/*< String >*/",
"getParameters",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"_parameters",
"==",
"null",
"||",
"!",
"_parameters",
".",
"hasParameters",
"(",
")",
")",
"return",
"Collections",
".",
"EMPTY_LIST",
";",
"else",
"{",
"List",
"parameters",
"=",
"_parameters",
".",
"getParameterValues",
"(",
"name",
")",
";",
"if",
"(",
"parameters",
"==",
"null",
")",
"return",
"Collections",
".",
"EMPTY_LIST",
";",
"else",
"return",
"Collections",
".",
"unmodifiableList",
"(",
"parameters",
")",
";",
"}",
"}"
] |
Returns the values of the given parameter.
@param name name of the parameter
@return an unmodifable {@link java.util.List} of values for the given parameter name
|
[
"Returns",
"the",
"values",
"of",
"the",
"given",
"parameter",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/core/urls/MutableURI.java#L704-L715
|
146,808
|
moparisthebest/beehive
|
beehive-netui-core/src/main/java/org/apache/beehive/netui/core/urls/MutableURI.java
|
MutableURI.removeParameter
|
public void removeParameter( String name )
{
if (_parameters == null || !_parameters.hasParameters())
return;
_parameters.removeParameter(name);
}
|
java
|
public void removeParameter( String name )
{
if (_parameters == null || !_parameters.hasParameters())
return;
_parameters.removeParameter(name);
}
|
[
"public",
"void",
"removeParameter",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"_parameters",
"==",
"null",
"||",
"!",
"_parameters",
".",
"hasParameters",
"(",
")",
")",
"return",
";",
"_parameters",
".",
"removeParameter",
"(",
"name",
")",
";",
"}"
] |
Removes the given parameter.
@param name name
|
[
"Removes",
"the",
"given",
"parameter",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/core/urls/MutableURI.java#L734-L740
|
146,809
|
moparisthebest/beehive
|
beehive-netui-core/src/main/java/org/apache/beehive/netui/core/urls/MutableURI.java
|
MutableURI.setFragment
|
public void setFragment( String fragment )
{
_fragment = null;
if ( fragment != null && fragment.length() > 0 )
{
_fragment = fragment;
}
}
|
java
|
public void setFragment( String fragment )
{
_fragment = null;
if ( fragment != null && fragment.length() > 0 )
{
_fragment = fragment;
}
}
|
[
"public",
"void",
"setFragment",
"(",
"String",
"fragment",
")",
"{",
"_fragment",
"=",
"null",
";",
"if",
"(",
"fragment",
"!=",
"null",
"&&",
"fragment",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"_fragment",
"=",
"fragment",
";",
"}",
"}"
] |
Sets the fragment.
@param fragment fragment
|
[
"Sets",
"the",
"fragment",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/core/urls/MutableURI.java#L747-L754
|
146,810
|
moparisthebest/beehive
|
beehive-netui-core/src/main/java/org/apache/beehive/netui/core/urls/MutableURI.java
|
MutableURI.encode
|
public static String encode( String url, String encoding )
{
String encodedURL = null;
try
{
encodedURL = URLCodec.encode( url, encoding );
}
catch ( java.io.UnsupportedEncodingException e )
{
// try utf-8 as a default encoding
try
{
encodedURL = URLCodec.encode( url, DEFAULT_ENCODING );
}
catch ( java.io.UnsupportedEncodingException ignore )
{
}
}
return encodedURL;
}
|
java
|
public static String encode( String url, String encoding )
{
String encodedURL = null;
try
{
encodedURL = URLCodec.encode( url, encoding );
}
catch ( java.io.UnsupportedEncodingException e )
{
// try utf-8 as a default encoding
try
{
encodedURL = URLCodec.encode( url, DEFAULT_ENCODING );
}
catch ( java.io.UnsupportedEncodingException ignore )
{
}
}
return encodedURL;
}
|
[
"public",
"static",
"String",
"encode",
"(",
"String",
"url",
",",
"String",
"encoding",
")",
"{",
"String",
"encodedURL",
"=",
"null",
";",
"try",
"{",
"encodedURL",
"=",
"URLCodec",
".",
"encode",
"(",
"url",
",",
"encoding",
")",
";",
"}",
"catch",
"(",
"java",
".",
"io",
".",
"UnsupportedEncodingException",
"e",
")",
"{",
"// try utf-8 as a default encoding",
"try",
"{",
"encodedURL",
"=",
"URLCodec",
".",
"encode",
"(",
"url",
",",
"DEFAULT_ENCODING",
")",
";",
"}",
"catch",
"(",
"java",
".",
"io",
".",
"UnsupportedEncodingException",
"ignore",
")",
"{",
"}",
"}",
"return",
"encodedURL",
";",
"}"
] |
Convenience method to encode unencoded components of a URI.
@param url the string to be encoded by {@link URLCodec}
@param encoding the character encoding to use
@return the encoded string
|
[
"Convenience",
"method",
"to",
"encode",
"unencoded",
"components",
"of",
"a",
"URI",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/core/urls/MutableURI.java#L952-L971
|
146,811
|
moparisthebest/beehive
|
beehive-netui-core/src/main/java/org/apache/beehive/netui/core/urls/MutableURI.java
|
MutableURI.indexFirstOf
|
protected static int indexFirstOf( String s, String delims, int offset )
{
if ( s == null || s.length() == 0 )
{
return -1;
}
if ( delims == null || delims.length() == 0 )
{
return -1;
}
// check boundaries
if ( offset < 0 )
{
offset = 0;
}
else if ( offset > s.length() )
{
return -1;
}
// s is never null
int min = s.length();
char[] delim = delims.toCharArray();
for ( int i = 0; i < delim.length; i++ )
{
int at = s.indexOf( delim[i], offset );
if ( at >= 0 && at < min )
{
min = at;
}
}
return ( min == s.length() ) ? -1 : min;
}
|
java
|
protected static int indexFirstOf( String s, String delims, int offset )
{
if ( s == null || s.length() == 0 )
{
return -1;
}
if ( delims == null || delims.length() == 0 )
{
return -1;
}
// check boundaries
if ( offset < 0 )
{
offset = 0;
}
else if ( offset > s.length() )
{
return -1;
}
// s is never null
int min = s.length();
char[] delim = delims.toCharArray();
for ( int i = 0; i < delim.length; i++ )
{
int at = s.indexOf( delim[i], offset );
if ( at >= 0 && at < min )
{
min = at;
}
}
return ( min == s.length() ) ? -1 : min;
}
|
[
"protected",
"static",
"int",
"indexFirstOf",
"(",
"String",
"s",
",",
"String",
"delims",
",",
"int",
"offset",
")",
"{",
"if",
"(",
"s",
"==",
"null",
"||",
"s",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"return",
"-",
"1",
";",
"}",
"if",
"(",
"delims",
"==",
"null",
"||",
"delims",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"return",
"-",
"1",
";",
"}",
"// check boundaries",
"if",
"(",
"offset",
"<",
"0",
")",
"{",
"offset",
"=",
"0",
";",
"}",
"else",
"if",
"(",
"offset",
">",
"s",
".",
"length",
"(",
")",
")",
"{",
"return",
"-",
"1",
";",
"}",
"// s is never null",
"int",
"min",
"=",
"s",
".",
"length",
"(",
")",
";",
"char",
"[",
"]",
"delim",
"=",
"delims",
".",
"toCharArray",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"delim",
".",
"length",
";",
"i",
"++",
")",
"{",
"int",
"at",
"=",
"s",
".",
"indexOf",
"(",
"delim",
"[",
"i",
"]",
",",
"offset",
")",
";",
"if",
"(",
"at",
">=",
"0",
"&&",
"at",
"<",
"min",
")",
"{",
"min",
"=",
"at",
";",
"}",
"}",
"return",
"(",
"min",
"==",
"s",
".",
"length",
"(",
")",
")",
"?",
"-",
"1",
":",
"min",
";",
"}"
] |
Get the earliest index, searching for the first occurrance of
any one of the given delimiters.
@param s the string to be indexed
@param delims the delimiters used to index
@param offset the from index
@return the earlier index if there are delimiters
|
[
"Get",
"the",
"earliest",
"index",
"searching",
"for",
"the",
"first",
"occurrance",
"of",
"any",
"one",
"of",
"the",
"given",
"delimiters",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/core/urls/MutableURI.java#L1185-L1219
|
146,812
|
iig-uni-freiburg/SEWOL
|
ext/org/deckfour/xes/in/XUniversalParser.java
|
XUniversalParser.canParse
|
public boolean canParse(File file) {
for(XParser parser : XParserRegistry.instance().getAvailable()) {
if(parser.canParse(file)) {
return true;
}
}
return false;
}
|
java
|
public boolean canParse(File file) {
for(XParser parser : XParserRegistry.instance().getAvailable()) {
if(parser.canParse(file)) {
return true;
}
}
return false;
}
|
[
"public",
"boolean",
"canParse",
"(",
"File",
"file",
")",
"{",
"for",
"(",
"XParser",
"parser",
":",
"XParserRegistry",
".",
"instance",
"(",
")",
".",
"getAvailable",
"(",
")",
")",
"{",
"if",
"(",
"parser",
".",
"canParse",
"(",
"file",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}"
] |
Checks whether the given file can be parsed by any parser.
|
[
"Checks",
"whether",
"the",
"given",
"file",
"can",
"be",
"parsed",
"by",
"any",
"parser",
"."
] |
e791cb07a6e62ecf837d760d58a25f32fbf6bbca
|
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/ext/org/deckfour/xes/in/XUniversalParser.java#L59-L66
|
146,813
|
iig-uni-freiburg/SEWOL
|
ext/org/deckfour/xes/in/XUniversalParser.java
|
XUniversalParser.parse
|
public Collection<XLog> parse(File file) throws Exception {
Collection<XLog> result = null;
for(XParser parser : XParserRegistry.instance().getAvailable()) {
if(parser.canParse(file)) {
try {
result = parser.parse(file);
return result;
} catch(Exception e) {
// ignore and move on
}
}
}
throw new Exception("No suitable parser could be found!");
}
|
java
|
public Collection<XLog> parse(File file) throws Exception {
Collection<XLog> result = null;
for(XParser parser : XParserRegistry.instance().getAvailable()) {
if(parser.canParse(file)) {
try {
result = parser.parse(file);
return result;
} catch(Exception e) {
// ignore and move on
}
}
}
throw new Exception("No suitable parser could be found!");
}
|
[
"public",
"Collection",
"<",
"XLog",
">",
"parse",
"(",
"File",
"file",
")",
"throws",
"Exception",
"{",
"Collection",
"<",
"XLog",
">",
"result",
"=",
"null",
";",
"for",
"(",
"XParser",
"parser",
":",
"XParserRegistry",
".",
"instance",
"(",
")",
".",
"getAvailable",
"(",
")",
")",
"{",
"if",
"(",
"parser",
".",
"canParse",
"(",
"file",
")",
")",
"{",
"try",
"{",
"result",
"=",
"parser",
".",
"parse",
"(",
"file",
")",
";",
"return",
"result",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"// ignore and move on",
"}",
"}",
"}",
"throw",
"new",
"Exception",
"(",
"\"No suitable parser could be found!\"",
")",
";",
"}"
] |
Attempts to parse a collection of XES models
from the given file, using all available parsers.
|
[
"Attempts",
"to",
"parse",
"a",
"collection",
"of",
"XES",
"models",
"from",
"the",
"given",
"file",
"using",
"all",
"available",
"parsers",
"."
] |
e791cb07a6e62ecf837d760d58a25f32fbf6bbca
|
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/ext/org/deckfour/xes/in/XUniversalParser.java#L72-L85
|
146,814
|
moparisthebest/beehive
|
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/template/IncludeSection.java
|
IncludeSection.doStartTag
|
public int doStartTag()
throws JspException {
ServletRequest req = pageContext.getRequest();
Template.TemplateContext tc = (Template.TemplateContext)
req.getAttribute(TEMPLATE_SECTIONS);
if (tc == null) {
String s = Bundle.getString("Tags_TemplateContextMissing");
// report the error. If this returns a value then we throw an
// exception
logger.warn(stripBold(s));
registerTagError(s,null);
reportErrors();
localRelease();
return SKIP_BODY;
}
if (tc.secs == null) {
if (_default != null) {
return callDefault(req);
}
String s = Bundle.getString("Tags_TemplateSectionMissing",
new Object[]{_name});
// report the error. If this returns a value then we throw an
// exception
logger.warn(stripBold(s));
registerTagError(s,null);
reportErrors();
localRelease();
return SKIP_BODY;
}
String val = (String) tc.secs.get(_name);
if (val == null) {
if (_default == null) {
String s = Bundle.getString("Tags_TemplateSectionMissing",
new Object[]{_name});
logger.warn(stripBold(s));
// report the error. If this returns a value then we throw an
// exception
registerTagError(s,null);
reportErrors();
localRelease();
return SKIP_BODY;
}
return callDefault(req);
}
try {
Writer out = pageContext.getOut();
out.write(val);
}
catch (IOException e) {
String reason = Bundle.getString("TempExcp_WritingContent");
String s = Bundle.getString("TempExcp_Except",
new Object[]{"IOException",
reason});
logger.error(s);
JspException jspException = new JspException(s, e);
// todo: future cleanup
// The 2.5 Servlet api will set the initCause in the Throwable superclass during construction,
// this will cause an IllegalStateException on the following call.
if (jspException.getCause() == null) {
jspException.initCause(e);
}
throw jspException;
}
// continue to evalue the page...(This should be a template)
localRelease();
return SKIP_BODY;
}
|
java
|
public int doStartTag()
throws JspException {
ServletRequest req = pageContext.getRequest();
Template.TemplateContext tc = (Template.TemplateContext)
req.getAttribute(TEMPLATE_SECTIONS);
if (tc == null) {
String s = Bundle.getString("Tags_TemplateContextMissing");
// report the error. If this returns a value then we throw an
// exception
logger.warn(stripBold(s));
registerTagError(s,null);
reportErrors();
localRelease();
return SKIP_BODY;
}
if (tc.secs == null) {
if (_default != null) {
return callDefault(req);
}
String s = Bundle.getString("Tags_TemplateSectionMissing",
new Object[]{_name});
// report the error. If this returns a value then we throw an
// exception
logger.warn(stripBold(s));
registerTagError(s,null);
reportErrors();
localRelease();
return SKIP_BODY;
}
String val = (String) tc.secs.get(_name);
if (val == null) {
if (_default == null) {
String s = Bundle.getString("Tags_TemplateSectionMissing",
new Object[]{_name});
logger.warn(stripBold(s));
// report the error. If this returns a value then we throw an
// exception
registerTagError(s,null);
reportErrors();
localRelease();
return SKIP_BODY;
}
return callDefault(req);
}
try {
Writer out = pageContext.getOut();
out.write(val);
}
catch (IOException e) {
String reason = Bundle.getString("TempExcp_WritingContent");
String s = Bundle.getString("TempExcp_Except",
new Object[]{"IOException",
reason});
logger.error(s);
JspException jspException = new JspException(s, e);
// todo: future cleanup
// The 2.5 Servlet api will set the initCause in the Throwable superclass during construction,
// this will cause an IllegalStateException on the following call.
if (jspException.getCause() == null) {
jspException.initCause(e);
}
throw jspException;
}
// continue to evalue the page...(This should be a template)
localRelease();
return SKIP_BODY;
}
|
[
"public",
"int",
"doStartTag",
"(",
")",
"throws",
"JspException",
"{",
"ServletRequest",
"req",
"=",
"pageContext",
".",
"getRequest",
"(",
")",
";",
"Template",
".",
"TemplateContext",
"tc",
"=",
"(",
"Template",
".",
"TemplateContext",
")",
"req",
".",
"getAttribute",
"(",
"TEMPLATE_SECTIONS",
")",
";",
"if",
"(",
"tc",
"==",
"null",
")",
"{",
"String",
"s",
"=",
"Bundle",
".",
"getString",
"(",
"\"Tags_TemplateContextMissing\"",
")",
";",
"// report the error. If this returns a value then we throw an",
"// exception",
"logger",
".",
"warn",
"(",
"stripBold",
"(",
"s",
")",
")",
";",
"registerTagError",
"(",
"s",
",",
"null",
")",
";",
"reportErrors",
"(",
")",
";",
"localRelease",
"(",
")",
";",
"return",
"SKIP_BODY",
";",
"}",
"if",
"(",
"tc",
".",
"secs",
"==",
"null",
")",
"{",
"if",
"(",
"_default",
"!=",
"null",
")",
"{",
"return",
"callDefault",
"(",
"req",
")",
";",
"}",
"String",
"s",
"=",
"Bundle",
".",
"getString",
"(",
"\"Tags_TemplateSectionMissing\"",
",",
"new",
"Object",
"[",
"]",
"{",
"_name",
"}",
")",
";",
"// report the error. If this returns a value then we throw an",
"// exception",
"logger",
".",
"warn",
"(",
"stripBold",
"(",
"s",
")",
")",
";",
"registerTagError",
"(",
"s",
",",
"null",
")",
";",
"reportErrors",
"(",
")",
";",
"localRelease",
"(",
")",
";",
"return",
"SKIP_BODY",
";",
"}",
"String",
"val",
"=",
"(",
"String",
")",
"tc",
".",
"secs",
".",
"get",
"(",
"_name",
")",
";",
"if",
"(",
"val",
"==",
"null",
")",
"{",
"if",
"(",
"_default",
"==",
"null",
")",
"{",
"String",
"s",
"=",
"Bundle",
".",
"getString",
"(",
"\"Tags_TemplateSectionMissing\"",
",",
"new",
"Object",
"[",
"]",
"{",
"_name",
"}",
")",
";",
"logger",
".",
"warn",
"(",
"stripBold",
"(",
"s",
")",
")",
";",
"// report the error. If this returns a value then we throw an",
"// exception",
"registerTagError",
"(",
"s",
",",
"null",
")",
";",
"reportErrors",
"(",
")",
";",
"localRelease",
"(",
")",
";",
"return",
"SKIP_BODY",
";",
"}",
"return",
"callDefault",
"(",
"req",
")",
";",
"}",
"try",
"{",
"Writer",
"out",
"=",
"pageContext",
".",
"getOut",
"(",
")",
";",
"out",
".",
"write",
"(",
"val",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"String",
"reason",
"=",
"Bundle",
".",
"getString",
"(",
"\"TempExcp_WritingContent\"",
")",
";",
"String",
"s",
"=",
"Bundle",
".",
"getString",
"(",
"\"TempExcp_Except\"",
",",
"new",
"Object",
"[",
"]",
"{",
"\"IOException\"",
",",
"reason",
"}",
")",
";",
"logger",
".",
"error",
"(",
"s",
")",
";",
"JspException",
"jspException",
"=",
"new",
"JspException",
"(",
"s",
",",
"e",
")",
";",
"// todo: future cleanup",
"// The 2.5 Servlet api will set the initCause in the Throwable superclass during construction,",
"// this will cause an IllegalStateException on the following call.",
"if",
"(",
"jspException",
".",
"getCause",
"(",
")",
"==",
"null",
")",
"{",
"jspException",
".",
"initCause",
"(",
"e",
")",
";",
"}",
"throw",
"jspException",
";",
"}",
"// continue to evalue the page...(This should be a template)",
"localRelease",
"(",
")",
";",
"return",
"SKIP_BODY",
";",
"}"
] |
Renders the content of the section into the template. Errors
are reported inline within the template in development
mode. If no sections are defined an error is reported. If
a section is not defined and no default URL is provided an
error is reported.
@return SKIP_BODY to skip any content found in the tag.
@throws JspException on Errors.
|
[
"Renders",
"the",
"content",
"of",
"the",
"section",
"into",
"the",
"template",
".",
"Errors",
"are",
"reported",
"inline",
"within",
"the",
"template",
"in",
"development",
"mode",
".",
"If",
"no",
"sections",
"are",
"defined",
"an",
"error",
"is",
"reported",
".",
"If",
"a",
"section",
"is",
"not",
"defined",
"and",
"no",
"default",
"URL",
"is",
"provided",
"an",
"error",
"is",
"reported",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/template/IncludeSection.java#L188-L261
|
146,815
|
moparisthebest/beehive
|
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/template/IncludeSection.java
|
IncludeSection.stripBold
|
static String stripBold(String in) {
String boldStart = "<b>";
String boldEnd = "</b>";
int pos = in.indexOf(boldStart);
if (pos == -1)
return in;
InternalStringBuilder sb = new InternalStringBuilder(in.substring(0,pos));
int fill = pos+boldStart.length();
pos = in.indexOf(boldEnd,fill);
if (pos == -1)
return in;
sb.append(in.substring(fill,pos));
pos += boldEnd.length();
sb.append(in.substring(pos));
return sb.toString();
}
|
java
|
static String stripBold(String in) {
String boldStart = "<b>";
String boldEnd = "</b>";
int pos = in.indexOf(boldStart);
if (pos == -1)
return in;
InternalStringBuilder sb = new InternalStringBuilder(in.substring(0,pos));
int fill = pos+boldStart.length();
pos = in.indexOf(boldEnd,fill);
if (pos == -1)
return in;
sb.append(in.substring(fill,pos));
pos += boldEnd.length();
sb.append(in.substring(pos));
return sb.toString();
}
|
[
"static",
"String",
"stripBold",
"(",
"String",
"in",
")",
"{",
"String",
"boldStart",
"=",
"\"<b>\"",
";",
"String",
"boldEnd",
"=",
"\"</b>\"",
";",
"int",
"pos",
"=",
"in",
".",
"indexOf",
"(",
"boldStart",
")",
";",
"if",
"(",
"pos",
"==",
"-",
"1",
")",
"return",
"in",
";",
"InternalStringBuilder",
"sb",
"=",
"new",
"InternalStringBuilder",
"(",
"in",
".",
"substring",
"(",
"0",
",",
"pos",
")",
")",
";",
"int",
"fill",
"=",
"pos",
"+",
"boldStart",
".",
"length",
"(",
")",
";",
"pos",
"=",
"in",
".",
"indexOf",
"(",
"boldEnd",
",",
"fill",
")",
";",
"if",
"(",
"pos",
"==",
"-",
"1",
")",
"return",
"in",
";",
"sb",
".",
"append",
"(",
"in",
".",
"substring",
"(",
"fill",
",",
"pos",
")",
")",
";",
"pos",
"+=",
"boldEnd",
".",
"length",
"(",
")",
";",
"sb",
".",
"append",
"(",
"in",
".",
"substring",
"(",
"pos",
")",
")",
";",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}"
] |
This will strip any html out of a warning
|
[
"This",
"will",
"strip",
"any",
"html",
"out",
"of",
"a",
"warning"
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/template/IncludeSection.java#L359-L374
|
146,816
|
moparisthebest/beehive
|
beehive-controls/src/main/java/org/apache/beehive/controls/api/properties/PropertySetProxy.java
|
PropertySetProxy.getProxy
|
public static <T extends Annotation> T getProxy(Class<T> propertySet, PropertyMap propertyMap)
{
assert propertySet != null && propertyMap != null;
if (!propertySet.isAnnotation())
throw new IllegalArgumentException(propertySet + " is not an annotation type");
return (T)Proxy.newProxyInstance(propertySet.getClassLoader(),
new Class [] {propertySet },
new PropertySetProxy(propertySet, propertyMap));
}
|
java
|
public static <T extends Annotation> T getProxy(Class<T> propertySet, PropertyMap propertyMap)
{
assert propertySet != null && propertyMap != null;
if (!propertySet.isAnnotation())
throw new IllegalArgumentException(propertySet + " is not an annotation type");
return (T)Proxy.newProxyInstance(propertySet.getClassLoader(),
new Class [] {propertySet },
new PropertySetProxy(propertySet, propertyMap));
}
|
[
"public",
"static",
"<",
"T",
"extends",
"Annotation",
">",
"T",
"getProxy",
"(",
"Class",
"<",
"T",
">",
"propertySet",
",",
"PropertyMap",
"propertyMap",
")",
"{",
"assert",
"propertySet",
"!=",
"null",
"&&",
"propertyMap",
"!=",
"null",
";",
"if",
"(",
"!",
"propertySet",
".",
"isAnnotation",
"(",
")",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"propertySet",
"+",
"\" is not an annotation type\"",
")",
";",
"return",
"(",
"T",
")",
"Proxy",
".",
"newProxyInstance",
"(",
"propertySet",
".",
"getClassLoader",
"(",
")",
",",
"new",
"Class",
"[",
"]",
"{",
"propertySet",
"}",
",",
"new",
"PropertySetProxy",
"(",
"propertySet",
",",
"propertyMap",
")",
")",
";",
"}"
] |
Creates a new proxy instance implementing the PropertySet interface and backed
by the data from the property map.
@param propertySet an annotation type that has the PropertySet meta-annotation
@param propertyMap the PropertyMap containing property values backing the proxy
@return proxy that implements the PropertySet interface
|
[
"Creates",
"a",
"new",
"proxy",
"instance",
"implementing",
"the",
"PropertySet",
"interface",
"and",
"backed",
"by",
"the",
"data",
"from",
"the",
"property",
"map",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/api/properties/PropertySetProxy.java#L52-L62
|
146,817
|
moparisthebest/beehive
|
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptControlClient.java
|
AptControlClient.needsUniqueID
|
protected boolean needsUniqueID()
{
//
// BUGBUG:
// Pageflows need to have a more unique ID generated for fields, because multiple pageflows
// may be shared within a single ControlContainerContext, and just using the field name could
// result in collisions. A better (and less hard-wired) approach is needed than searching for
// specific annotations. Perhaps a model that enables particular client types to subclass
// AptControlClient and override getID() would be much better.
//
for (AnnotationMirror annotMirror : _clientDecl.getAnnotationMirrors())
{
String annotType = annotMirror.getAnnotationType().toString();
if (annotType.equals("org.apache.beehive.netui.pageflow.annotations.Jpf.Controller") ||
annotType.equals("org.apache.beehive.netui.pageflow.annotations.Jpf.Backing"))
return true;
}
return false;
}
|
java
|
protected boolean needsUniqueID()
{
//
// BUGBUG:
// Pageflows need to have a more unique ID generated for fields, because multiple pageflows
// may be shared within a single ControlContainerContext, and just using the field name could
// result in collisions. A better (and less hard-wired) approach is needed than searching for
// specific annotations. Perhaps a model that enables particular client types to subclass
// AptControlClient and override getID() would be much better.
//
for (AnnotationMirror annotMirror : _clientDecl.getAnnotationMirrors())
{
String annotType = annotMirror.getAnnotationType().toString();
if (annotType.equals("org.apache.beehive.netui.pageflow.annotations.Jpf.Controller") ||
annotType.equals("org.apache.beehive.netui.pageflow.annotations.Jpf.Backing"))
return true;
}
return false;
}
|
[
"protected",
"boolean",
"needsUniqueID",
"(",
")",
"{",
"//",
"// BUGBUG:",
"// Pageflows need to have a more unique ID generated for fields, because multiple pageflows",
"// may be shared within a single ControlContainerContext, and just using the field name could",
"// result in collisions. A better (and less hard-wired) approach is needed than searching for",
"// specific annotations. Perhaps a model that enables particular client types to subclass",
"// AptControlClient and override getID() would be much better.",
"//",
"for",
"(",
"AnnotationMirror",
"annotMirror",
":",
"_clientDecl",
".",
"getAnnotationMirrors",
"(",
")",
")",
"{",
"String",
"annotType",
"=",
"annotMirror",
".",
"getAnnotationType",
"(",
")",
".",
"toString",
"(",
")",
";",
"if",
"(",
"annotType",
".",
"equals",
"(",
"\"org.apache.beehive.netui.pageflow.annotations.Jpf.Controller\"",
")",
"||",
"annotType",
".",
"equals",
"(",
"\"org.apache.beehive.netui.pageflow.annotations.Jpf.Backing\"",
")",
")",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] |
Returns true if this type of client requires that nested controls have unique identifiers
|
[
"Returns",
"true",
"if",
"this",
"type",
"of",
"client",
"requires",
"that",
"nested",
"controls",
"have",
"unique",
"identifiers"
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptControlClient.java#L71-L89
|
146,818
|
moparisthebest/beehive
|
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptControlClient.java
|
AptControlClient.getID
|
public String getID(AptControlField control)
{
if (!needsUniqueID())
return "\"" + control.getName() + "\"";
return "client.getClass() + \"@\" + client.hashCode() + \"." + control.getClassName() + "." + control.getName() + "\"";
}
|
java
|
public String getID(AptControlField control)
{
if (!needsUniqueID())
return "\"" + control.getName() + "\"";
return "client.getClass() + \"@\" + client.hashCode() + \"." + control.getClassName() + "." + control.getName() + "\"";
}
|
[
"public",
"String",
"getID",
"(",
"AptControlField",
"control",
")",
"{",
"if",
"(",
"!",
"needsUniqueID",
"(",
")",
")",
"return",
"\"\\\"\"",
"+",
"control",
".",
"getName",
"(",
")",
"+",
"\"\\\"\"",
";",
"return",
"\"client.getClass() + \\\"@\\\" + client.hashCode() + \\\".\"",
"+",
"control",
".",
"getClassName",
"(",
")",
"+",
"\".\"",
"+",
"control",
".",
"getName",
"(",
")",
"+",
"\"\\\"\"",
";",
"}"
] |
Returns a unique ID for a control field
|
[
"Returns",
"a",
"unique",
"ID",
"for",
"a",
"control",
"field"
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptControlClient.java#L94-L100
|
146,819
|
moparisthebest/beehive
|
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptControlClient.java
|
AptControlClient.initControls
|
protected ArrayList<AptControlField> initControls()
{
ArrayList<AptControlField> controls = new ArrayList<AptControlField>();
if ( _clientDecl == null || _clientDecl.getFields() == null )
return controls;
Collection<FieldDeclaration> declaredFields = _clientDecl.getFields();
for (FieldDeclaration fieldDecl : declaredFields)
{
if (fieldDecl.getAnnotation(org.apache.beehive.controls.api.bean.Control.class) != null)
controls.add(new AptControlField(this, fieldDecl, _ap));
}
return controls;
}
|
java
|
protected ArrayList<AptControlField> initControls()
{
ArrayList<AptControlField> controls = new ArrayList<AptControlField>();
if ( _clientDecl == null || _clientDecl.getFields() == null )
return controls;
Collection<FieldDeclaration> declaredFields = _clientDecl.getFields();
for (FieldDeclaration fieldDecl : declaredFields)
{
if (fieldDecl.getAnnotation(org.apache.beehive.controls.api.bean.Control.class) != null)
controls.add(new AptControlField(this, fieldDecl, _ap));
}
return controls;
}
|
[
"protected",
"ArrayList",
"<",
"AptControlField",
">",
"initControls",
"(",
")",
"{",
"ArrayList",
"<",
"AptControlField",
">",
"controls",
"=",
"new",
"ArrayList",
"<",
"AptControlField",
">",
"(",
")",
";",
"if",
"(",
"_clientDecl",
"==",
"null",
"||",
"_clientDecl",
".",
"getFields",
"(",
")",
"==",
"null",
")",
"return",
"controls",
";",
"Collection",
"<",
"FieldDeclaration",
">",
"declaredFields",
"=",
"_clientDecl",
".",
"getFields",
"(",
")",
";",
"for",
"(",
"FieldDeclaration",
"fieldDecl",
":",
"declaredFields",
")",
"{",
"if",
"(",
"fieldDecl",
".",
"getAnnotation",
"(",
"org",
".",
"apache",
".",
"beehive",
".",
"controls",
".",
"api",
".",
"bean",
".",
"Control",
".",
"class",
")",
"!=",
"null",
")",
"controls",
".",
"add",
"(",
"new",
"AptControlField",
"(",
"this",
",",
"fieldDecl",
",",
"_ap",
")",
")",
";",
"}",
"return",
"controls",
";",
"}"
] |
Initializes the list of ControlFields declared directly by this ControlClient
|
[
"Initializes",
"the",
"list",
"of",
"ControlFields",
"declared",
"directly",
"by",
"this",
"ControlClient"
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptControlClient.java#L171-L185
|
146,820
|
moparisthebest/beehive
|
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptControlClient.java
|
AptControlClient.getSuperClientName
|
public String getSuperClientName()
{
ClassType superType = _clientDecl.getSuperclass();
while ( superType != null )
{
ClassDeclaration superDecl = superType.getDeclaration();
Collection<FieldDeclaration> declaredFields = superDecl.getFields();
for (FieldDeclaration fieldDecl : declaredFields)
{
if (fieldDecl.getAnnotation(org.apache.beehive.controls.api.bean.Control.class) != null)
{
// Found an @control annotated field, so return this class name
return superDecl.getQualifiedName();
}
}
superType = superType.getSuperclass();
}
return null;
}
|
java
|
public String getSuperClientName()
{
ClassType superType = _clientDecl.getSuperclass();
while ( superType != null )
{
ClassDeclaration superDecl = superType.getDeclaration();
Collection<FieldDeclaration> declaredFields = superDecl.getFields();
for (FieldDeclaration fieldDecl : declaredFields)
{
if (fieldDecl.getAnnotation(org.apache.beehive.controls.api.bean.Control.class) != null)
{
// Found an @control annotated field, so return this class name
return superDecl.getQualifiedName();
}
}
superType = superType.getSuperclass();
}
return null;
}
|
[
"public",
"String",
"getSuperClientName",
"(",
")",
"{",
"ClassType",
"superType",
"=",
"_clientDecl",
".",
"getSuperclass",
"(",
")",
";",
"while",
"(",
"superType",
"!=",
"null",
")",
"{",
"ClassDeclaration",
"superDecl",
"=",
"superType",
".",
"getDeclaration",
"(",
")",
";",
"Collection",
"<",
"FieldDeclaration",
">",
"declaredFields",
"=",
"superDecl",
".",
"getFields",
"(",
")",
";",
"for",
"(",
"FieldDeclaration",
"fieldDecl",
":",
"declaredFields",
")",
"{",
"if",
"(",
"fieldDecl",
".",
"getAnnotation",
"(",
"org",
".",
"apache",
".",
"beehive",
".",
"controls",
".",
"api",
".",
"bean",
".",
"Control",
".",
"class",
")",
"!=",
"null",
")",
"{",
"// Found an @control annotated field, so return this class name",
"return",
"superDecl",
".",
"getQualifiedName",
"(",
")",
";",
"}",
"}",
"superType",
"=",
"superType",
".",
"getSuperclass",
"(",
")",
";",
"}",
"return",
"null",
";",
"}"
] |
Returns the fully qualified classname of the closest control client in the inheritance chain.
@return class name of the closest control client
|
[
"Returns",
"the",
"fully",
"qualified",
"classname",
"of",
"the",
"closest",
"control",
"client",
"in",
"the",
"inheritance",
"chain",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptControlClient.java#L196-L218
|
146,821
|
moparisthebest/beehive
|
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/apt/ControlClientAnnotationProcessor.java
|
ControlClientAnnotationProcessor.enforceVersionRequired
|
private void enforceVersionRequired( FieldDeclaration f, InterfaceDeclaration controlIntf )
{
VersionRequired versionRequired = f.getAnnotation(VersionRequired.class);
Version versionPresent = controlIntf.getAnnotation(Version.class);
if (versionRequired != null) {
int majorRequired = -1;
try {
majorRequired = versionRequired.major();
}
catch(NullPointerException ignore) {
/*
the major version annotation is required and if unspecified, will
throw an NPE when it is quereid but not provided. this error will
be caught during syntactic validation perfoemed by javac, so ignore
it if an NPE is caught here
*/
return;
}
int minorRequired = versionRequired.minor();
/* no version requirement, so return */
if(majorRequired < 0)
return;
int majorPresent = -1;
int minorPresent = -1;
if ( versionPresent != null )
{
try {
majorPresent = versionPresent.major();
}
catch(NullPointerException ignore) {
/*
the major version annotation is required and if unspecified, will
throw an NPE when it is quereid but not provided. this error will
be caught during syntactic validation perfoemed by javac, so ignore
it if an NPE is caught here
*/
}
minorPresent = versionPresent.minor();
if ( majorRequired <= majorPresent &&
(minorRequired < 0 || minorRequired <= minorPresent) )
{
// Version requirement is satisfied
return;
}
}
//
// Version requirement failed
//
printError( f, "control.field.bad.version", f.getSimpleName(), majorRequired, minorRequired,
majorPresent, minorPresent );
}
}
|
java
|
private void enforceVersionRequired( FieldDeclaration f, InterfaceDeclaration controlIntf )
{
VersionRequired versionRequired = f.getAnnotation(VersionRequired.class);
Version versionPresent = controlIntf.getAnnotation(Version.class);
if (versionRequired != null) {
int majorRequired = -1;
try {
majorRequired = versionRequired.major();
}
catch(NullPointerException ignore) {
/*
the major version annotation is required and if unspecified, will
throw an NPE when it is quereid but not provided. this error will
be caught during syntactic validation perfoemed by javac, so ignore
it if an NPE is caught here
*/
return;
}
int minorRequired = versionRequired.minor();
/* no version requirement, so return */
if(majorRequired < 0)
return;
int majorPresent = -1;
int minorPresent = -1;
if ( versionPresent != null )
{
try {
majorPresent = versionPresent.major();
}
catch(NullPointerException ignore) {
/*
the major version annotation is required and if unspecified, will
throw an NPE when it is quereid but not provided. this error will
be caught during syntactic validation perfoemed by javac, so ignore
it if an NPE is caught here
*/
}
minorPresent = versionPresent.minor();
if ( majorRequired <= majorPresent &&
(minorRequired < 0 || minorRequired <= minorPresent) )
{
// Version requirement is satisfied
return;
}
}
//
// Version requirement failed
//
printError( f, "control.field.bad.version", f.getSimpleName(), majorRequired, minorRequired,
majorPresent, minorPresent );
}
}
|
[
"private",
"void",
"enforceVersionRequired",
"(",
"FieldDeclaration",
"f",
",",
"InterfaceDeclaration",
"controlIntf",
")",
"{",
"VersionRequired",
"versionRequired",
"=",
"f",
".",
"getAnnotation",
"(",
"VersionRequired",
".",
"class",
")",
";",
"Version",
"versionPresent",
"=",
"controlIntf",
".",
"getAnnotation",
"(",
"Version",
".",
"class",
")",
";",
"if",
"(",
"versionRequired",
"!=",
"null",
")",
"{",
"int",
"majorRequired",
"=",
"-",
"1",
";",
"try",
"{",
"majorRequired",
"=",
"versionRequired",
".",
"major",
"(",
")",
";",
"}",
"catch",
"(",
"NullPointerException",
"ignore",
")",
"{",
"/*\n the major version annotation is required and if unspecified, will\n throw an NPE when it is quereid but not provided. this error will\n be caught during syntactic validation perfoemed by javac, so ignore\n it if an NPE is caught here\n */",
"return",
";",
"}",
"int",
"minorRequired",
"=",
"versionRequired",
".",
"minor",
"(",
")",
";",
"/* no version requirement, so return */",
"if",
"(",
"majorRequired",
"<",
"0",
")",
"return",
";",
"int",
"majorPresent",
"=",
"-",
"1",
";",
"int",
"minorPresent",
"=",
"-",
"1",
";",
"if",
"(",
"versionPresent",
"!=",
"null",
")",
"{",
"try",
"{",
"majorPresent",
"=",
"versionPresent",
".",
"major",
"(",
")",
";",
"}",
"catch",
"(",
"NullPointerException",
"ignore",
")",
"{",
"/*\n the major version annotation is required and if unspecified, will\n throw an NPE when it is quereid but not provided. this error will\n be caught during syntactic validation perfoemed by javac, so ignore\n it if an NPE is caught here\n */",
"}",
"minorPresent",
"=",
"versionPresent",
".",
"minor",
"(",
")",
";",
"if",
"(",
"majorRequired",
"<=",
"majorPresent",
"&&",
"(",
"minorRequired",
"<",
"0",
"||",
"minorRequired",
"<=",
"minorPresent",
")",
")",
"{",
"// Version requirement is satisfied",
"return",
";",
"}",
"}",
"//",
"// Version requirement failed",
"//",
"printError",
"(",
"f",
",",
"\"control.field.bad.version\"",
",",
"f",
".",
"getSimpleName",
"(",
")",
",",
"majorRequired",
",",
"minorRequired",
",",
"majorPresent",
",",
"minorPresent",
")",
";",
"}",
"}"
] |
Enforces the VersionRequired annotation for control fields.
|
[
"Enforces",
"the",
"VersionRequired",
"annotation",
"for",
"control",
"fields",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/apt/ControlClientAnnotationProcessor.java#L581-L639
|
146,822
|
moparisthebest/beehive
|
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/DefaultExceptionsHandler.java
|
DefaultExceptionsHandler.getExceptionHandlerMethod
|
protected Method getExceptionHandlerMethod( FlowControllerHandlerContext context, String methodName, Throwable ex,
Object formBean )
{
FlowController flowController = context.getFlowController();
String cacheKey = methodName + '/' + ex.getClass().getName();
ClassLevelCache cache = ClassLevelCache.getCache( flowController.getClass() );
Method method = ( Method ) cache.get( CACHEID_EXCEPTION_HANDLER_METHODS, cacheKey );
if ( method != null )
{
return method;
}
Class flowControllerClass = flowController.getClass();
for ( Class exClass = ex.getClass(); exClass != null; exClass = exClass.getSuperclass() )
{
Class[] args = new Class[]{ exClass, String.class, String.class, Object.class };
Method foundMethod = InternalUtils.lookupMethod( flowControllerClass, methodName, args );
//
// If we didn't find an exception-handler with the right signature, look for the deprecated signature with
// FormData as the last argument.
//
if ( foundMethod == null && ( formBean == null || formBean instanceof FormData ) )
{
args = new Class[]{ exClass, String.class, String.class, FormData.class };
foundMethod = InternalUtils.lookupMethod( flowControllerClass, methodName, args );
}
//
// If we didn't find an exception-handler with the right signature, look for the deprecated signature with
// ActionForm as the last argument.
//
if ( foundMethod == null && ( formBean == null || formBean instanceof ActionForm ) )
{
args = new Class[]{ exClass, String.class, String.class, ActionForm.class };
foundMethod = InternalUtils.lookupMethod( flowControllerClass, methodName, args );
}
if ( foundMethod != null )
{
if ( _log.isDebugEnabled() )
{
_log.debug( "Found exception handler for " + exClass.getName() );
}
if ( ! Modifier.isPublic( foundMethod.getModifiers() ) ) foundMethod.setAccessible( true );
cache.put( CACHEID_EXCEPTION_HANDLER_METHODS, cacheKey, foundMethod );
return foundMethod;
}
else
{
if ( _log.isErrorEnabled() )
{
InternalStringBuilder msg = new InternalStringBuilder( "Could not find exception handler method " );
msg.append( methodName ).append( " for " ).append( exClass.getName() ).append( '.' );
_log.error( msg.toString() );
}
}
}
return null;
}
|
java
|
protected Method getExceptionHandlerMethod( FlowControllerHandlerContext context, String methodName, Throwable ex,
Object formBean )
{
FlowController flowController = context.getFlowController();
String cacheKey = methodName + '/' + ex.getClass().getName();
ClassLevelCache cache = ClassLevelCache.getCache( flowController.getClass() );
Method method = ( Method ) cache.get( CACHEID_EXCEPTION_HANDLER_METHODS, cacheKey );
if ( method != null )
{
return method;
}
Class flowControllerClass = flowController.getClass();
for ( Class exClass = ex.getClass(); exClass != null; exClass = exClass.getSuperclass() )
{
Class[] args = new Class[]{ exClass, String.class, String.class, Object.class };
Method foundMethod = InternalUtils.lookupMethod( flowControllerClass, methodName, args );
//
// If we didn't find an exception-handler with the right signature, look for the deprecated signature with
// FormData as the last argument.
//
if ( foundMethod == null && ( formBean == null || formBean instanceof FormData ) )
{
args = new Class[]{ exClass, String.class, String.class, FormData.class };
foundMethod = InternalUtils.lookupMethod( flowControllerClass, methodName, args );
}
//
// If we didn't find an exception-handler with the right signature, look for the deprecated signature with
// ActionForm as the last argument.
//
if ( foundMethod == null && ( formBean == null || formBean instanceof ActionForm ) )
{
args = new Class[]{ exClass, String.class, String.class, ActionForm.class };
foundMethod = InternalUtils.lookupMethod( flowControllerClass, methodName, args );
}
if ( foundMethod != null )
{
if ( _log.isDebugEnabled() )
{
_log.debug( "Found exception handler for " + exClass.getName() );
}
if ( ! Modifier.isPublic( foundMethod.getModifiers() ) ) foundMethod.setAccessible( true );
cache.put( CACHEID_EXCEPTION_HANDLER_METHODS, cacheKey, foundMethod );
return foundMethod;
}
else
{
if ( _log.isErrorEnabled() )
{
InternalStringBuilder msg = new InternalStringBuilder( "Could not find exception handler method " );
msg.append( methodName ).append( " for " ).append( exClass.getName() ).append( '.' );
_log.error( msg.toString() );
}
}
}
return null;
}
|
[
"protected",
"Method",
"getExceptionHandlerMethod",
"(",
"FlowControllerHandlerContext",
"context",
",",
"String",
"methodName",
",",
"Throwable",
"ex",
",",
"Object",
"formBean",
")",
"{",
"FlowController",
"flowController",
"=",
"context",
".",
"getFlowController",
"(",
")",
";",
"String",
"cacheKey",
"=",
"methodName",
"+",
"'",
"'",
"+",
"ex",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
";",
"ClassLevelCache",
"cache",
"=",
"ClassLevelCache",
".",
"getCache",
"(",
"flowController",
".",
"getClass",
"(",
")",
")",
";",
"Method",
"method",
"=",
"(",
"Method",
")",
"cache",
".",
"get",
"(",
"CACHEID_EXCEPTION_HANDLER_METHODS",
",",
"cacheKey",
")",
";",
"if",
"(",
"method",
"!=",
"null",
")",
"{",
"return",
"method",
";",
"}",
"Class",
"flowControllerClass",
"=",
"flowController",
".",
"getClass",
"(",
")",
";",
"for",
"(",
"Class",
"exClass",
"=",
"ex",
".",
"getClass",
"(",
")",
";",
"exClass",
"!=",
"null",
";",
"exClass",
"=",
"exClass",
".",
"getSuperclass",
"(",
")",
")",
"{",
"Class",
"[",
"]",
"args",
"=",
"new",
"Class",
"[",
"]",
"{",
"exClass",
",",
"String",
".",
"class",
",",
"String",
".",
"class",
",",
"Object",
".",
"class",
"}",
";",
"Method",
"foundMethod",
"=",
"InternalUtils",
".",
"lookupMethod",
"(",
"flowControllerClass",
",",
"methodName",
",",
"args",
")",
";",
"//",
"// If we didn't find an exception-handler with the right signature, look for the deprecated signature with",
"// FormData as the last argument.",
"//",
"if",
"(",
"foundMethod",
"==",
"null",
"&&",
"(",
"formBean",
"==",
"null",
"||",
"formBean",
"instanceof",
"FormData",
")",
")",
"{",
"args",
"=",
"new",
"Class",
"[",
"]",
"{",
"exClass",
",",
"String",
".",
"class",
",",
"String",
".",
"class",
",",
"FormData",
".",
"class",
"}",
";",
"foundMethod",
"=",
"InternalUtils",
".",
"lookupMethod",
"(",
"flowControllerClass",
",",
"methodName",
",",
"args",
")",
";",
"}",
"//",
"// If we didn't find an exception-handler with the right signature, look for the deprecated signature with",
"// ActionForm as the last argument.",
"//",
"if",
"(",
"foundMethod",
"==",
"null",
"&&",
"(",
"formBean",
"==",
"null",
"||",
"formBean",
"instanceof",
"ActionForm",
")",
")",
"{",
"args",
"=",
"new",
"Class",
"[",
"]",
"{",
"exClass",
",",
"String",
".",
"class",
",",
"String",
".",
"class",
",",
"ActionForm",
".",
"class",
"}",
";",
"foundMethod",
"=",
"InternalUtils",
".",
"lookupMethod",
"(",
"flowControllerClass",
",",
"methodName",
",",
"args",
")",
";",
"}",
"if",
"(",
"foundMethod",
"!=",
"null",
")",
"{",
"if",
"(",
"_log",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"_log",
".",
"debug",
"(",
"\"Found exception handler for \"",
"+",
"exClass",
".",
"getName",
"(",
")",
")",
";",
"}",
"if",
"(",
"!",
"Modifier",
".",
"isPublic",
"(",
"foundMethod",
".",
"getModifiers",
"(",
")",
")",
")",
"foundMethod",
".",
"setAccessible",
"(",
"true",
")",
";",
"cache",
".",
"put",
"(",
"CACHEID_EXCEPTION_HANDLER_METHODS",
",",
"cacheKey",
",",
"foundMethod",
")",
";",
"return",
"foundMethod",
";",
"}",
"else",
"{",
"if",
"(",
"_log",
".",
"isErrorEnabled",
"(",
")",
")",
"{",
"InternalStringBuilder",
"msg",
"=",
"new",
"InternalStringBuilder",
"(",
"\"Could not find exception handler method \"",
")",
";",
"msg",
".",
"append",
"(",
"methodName",
")",
".",
"append",
"(",
"\" for \"",
")",
".",
"append",
"(",
"exClass",
".",
"getName",
"(",
")",
")",
".",
"append",
"(",
"'",
"'",
")",
";",
"_log",
".",
"error",
"(",
"msg",
".",
"toString",
"(",
")",
")",
";",
"}",
"}",
"}",
"return",
"null",
";",
"}"
] |
Get an Exception handler method.
@param methodName the name of the method to get.
@param ex the Exception that is to be handled.
@return the Method with the given name that handles the given Exception, or <code>null</code>
if none matches.
|
[
"Get",
"an",
"Exception",
"handler",
"method",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/DefaultExceptionsHandler.java#L545-L607
|
146,823
|
iig-uni-freiburg/SEWOL
|
ext/org/deckfour/xes/nikefs2/NikeFS2LazyRandomAccessStorageImpl.java
|
NikeFS2LazyRandomAccessStorageImpl.alertSoftCopies
|
public synchronized void alertSoftCopies() throws IOException {
// make a copy of the list of soft copies, as they will deregister
// within the loop (removing themselves from our internal list)
NikeFS2LazyRandomAccessStorageImpl[] copies = softCopies
.toArray(new NikeFS2LazyRandomAccessStorageImpl[softCopies
.size()]);
for (NikeFS2LazyRandomAccessStorageImpl copy : copies) {
if (copy.isSoftCopy) {
copy.consolidateSoftCopy();
copy.alertSoftCopies(); // HV
}
}
}
|
java
|
public synchronized void alertSoftCopies() throws IOException {
// make a copy of the list of soft copies, as they will deregister
// within the loop (removing themselves from our internal list)
NikeFS2LazyRandomAccessStorageImpl[] copies = softCopies
.toArray(new NikeFS2LazyRandomAccessStorageImpl[softCopies
.size()]);
for (NikeFS2LazyRandomAccessStorageImpl copy : copies) {
if (copy.isSoftCopy) {
copy.consolidateSoftCopy();
copy.alertSoftCopies(); // HV
}
}
}
|
[
"public",
"synchronized",
"void",
"alertSoftCopies",
"(",
")",
"throws",
"IOException",
"{",
"// make a copy of the list of soft copies, as they will deregister",
"// within the loop (removing themselves from our internal list)",
"NikeFS2LazyRandomAccessStorageImpl",
"[",
"]",
"copies",
"=",
"softCopies",
".",
"toArray",
"(",
"new",
"NikeFS2LazyRandomAccessStorageImpl",
"[",
"softCopies",
".",
"size",
"(",
")",
"]",
")",
";",
"for",
"(",
"NikeFS2LazyRandomAccessStorageImpl",
"copy",
":",
"copies",
")",
"{",
"if",
"(",
"copy",
".",
"isSoftCopy",
")",
"{",
"copy",
".",
"consolidateSoftCopy",
"(",
")",
";",
"copy",
".",
"alertSoftCopies",
"(",
")",
";",
"// HV",
"}",
"}",
"}"
] |
This method alerts all child soft copies of this storage to consolidate;
called prior to modification of this instance. The child soft copies so
alerted will detach from this instance consequently.
|
[
"This",
"method",
"alerts",
"all",
"child",
"soft",
"copies",
"of",
"this",
"storage",
"to",
"consolidate",
";",
"called",
"prior",
"to",
"modification",
"of",
"this",
"instance",
".",
"The",
"child",
"soft",
"copies",
"so",
"alerted",
"will",
"detach",
"from",
"this",
"instance",
"consequently",
"."
] |
e791cb07a6e62ecf837d760d58a25f32fbf6bbca
|
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/ext/org/deckfour/xes/nikefs2/NikeFS2LazyRandomAccessStorageImpl.java#L131-L143
|
146,824
|
iig-uni-freiburg/SEWOL
|
ext/org/deckfour/xes/nikefs2/NikeFS2LazyRandomAccessStorageImpl.java
|
NikeFS2LazyRandomAccessStorageImpl.consolidateSoftCopy
|
public synchronized void consolidateSoftCopy() throws IOException {
if (isSoftCopy == true) {
ArrayList<NikeFS2Block> copyBlocks = new ArrayList<NikeFS2Block>();
if (blocks.size() > 0) {
// make copies of all contained blocks
byte[] buffer = new byte[blocks.get(0).size()];
for (NikeFS2Block block : blocks) {
NikeFS2Block copyBlock = vfs.allocateBlock();
block.read(0, buffer);
copyBlock.write(0, buffer);
copyBlocks.add(copyBlock);
}
}
// replace blocks list
blocks = copyBlocks;
isSoftCopy = false;
// deregister from template
parent.deregisterSoftCopy(this);
parent = null;
}
}
|
java
|
public synchronized void consolidateSoftCopy() throws IOException {
if (isSoftCopy == true) {
ArrayList<NikeFS2Block> copyBlocks = new ArrayList<NikeFS2Block>();
if (blocks.size() > 0) {
// make copies of all contained blocks
byte[] buffer = new byte[blocks.get(0).size()];
for (NikeFS2Block block : blocks) {
NikeFS2Block copyBlock = vfs.allocateBlock();
block.read(0, buffer);
copyBlock.write(0, buffer);
copyBlocks.add(copyBlock);
}
}
// replace blocks list
blocks = copyBlocks;
isSoftCopy = false;
// deregister from template
parent.deregisterSoftCopy(this);
parent = null;
}
}
|
[
"public",
"synchronized",
"void",
"consolidateSoftCopy",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"isSoftCopy",
"==",
"true",
")",
"{",
"ArrayList",
"<",
"NikeFS2Block",
">",
"copyBlocks",
"=",
"new",
"ArrayList",
"<",
"NikeFS2Block",
">",
"(",
")",
";",
"if",
"(",
"blocks",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"// make copies of all contained blocks",
"byte",
"[",
"]",
"buffer",
"=",
"new",
"byte",
"[",
"blocks",
".",
"get",
"(",
"0",
")",
".",
"size",
"(",
")",
"]",
";",
"for",
"(",
"NikeFS2Block",
"block",
":",
"blocks",
")",
"{",
"NikeFS2Block",
"copyBlock",
"=",
"vfs",
".",
"allocateBlock",
"(",
")",
";",
"block",
".",
"read",
"(",
"0",
",",
"buffer",
")",
";",
"copyBlock",
".",
"write",
"(",
"0",
",",
"buffer",
")",
";",
"copyBlocks",
".",
"add",
"(",
"copyBlock",
")",
";",
"}",
"}",
"// replace blocks list",
"blocks",
"=",
"copyBlocks",
";",
"isSoftCopy",
"=",
"false",
";",
"// deregister from template",
"parent",
".",
"deregisterSoftCopy",
"(",
"this",
")",
";",
"parent",
"=",
"null",
";",
"}",
"}"
] |
Consolidates this soft copy prior to modification. This will detach this
instance from its parent, creating a true copy of its current data.
|
[
"Consolidates",
"this",
"soft",
"copy",
"prior",
"to",
"modification",
".",
"This",
"will",
"detach",
"this",
"instance",
"from",
"its",
"parent",
"creating",
"a",
"true",
"copy",
"of",
"its",
"current",
"data",
"."
] |
e791cb07a6e62ecf837d760d58a25f32fbf6bbca
|
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/ext/org/deckfour/xes/nikefs2/NikeFS2LazyRandomAccessStorageImpl.java#L149-L169
|
146,825
|
moparisthebest/beehive
|
beehive-jdbc-control/src/main/java/org/apache/beehive/controls/system/jdbc/ResultSetIterator.java
|
ResultSetIterator.hasNext
|
public boolean hasNext() {
if (_primed) {
return true;
}
try {
_primed = _rs.next();
} catch (SQLException sqle) {
return false;
}
return _primed;
}
|
java
|
public boolean hasNext() {
if (_primed) {
return true;
}
try {
_primed = _rs.next();
} catch (SQLException sqle) {
return false;
}
return _primed;
}
|
[
"public",
"boolean",
"hasNext",
"(",
")",
"{",
"if",
"(",
"_primed",
")",
"{",
"return",
"true",
";",
"}",
"try",
"{",
"_primed",
"=",
"_rs",
".",
"next",
"(",
")",
";",
"}",
"catch",
"(",
"SQLException",
"sqle",
")",
"{",
"return",
"false",
";",
"}",
"return",
"_primed",
";",
"}"
] |
Does this iterater have more elements?
@return true if there is another element
|
[
"Does",
"this",
"iterater",
"have",
"more",
"elements?"
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-jdbc-control/src/main/java/org/apache/beehive/controls/system/jdbc/ResultSetIterator.java#L65-L76
|
146,826
|
moparisthebest/beehive
|
beehive-jdbc-control/src/main/java/org/apache/beehive/controls/system/jdbc/ResultSetIterator.java
|
ResultSetIterator.next
|
public Object next() {
try {
if (!_primed) {
_primed = _rs.next();
if (!_primed) {
throw new NoSuchElementException();
}
}
// reset upon consumption
_primed = false;
return _rowMapper.mapRowToReturnType();
} catch (SQLException e) {
// Since Iterator interface is locked, all we can do
// is put the real exception inside an expected one.
NoSuchElementException xNoSuch = new NoSuchElementException("ResultSet exception: " + e);
xNoSuch.initCause(e);
throw xNoSuch;
}
}
|
java
|
public Object next() {
try {
if (!_primed) {
_primed = _rs.next();
if (!_primed) {
throw new NoSuchElementException();
}
}
// reset upon consumption
_primed = false;
return _rowMapper.mapRowToReturnType();
} catch (SQLException e) {
// Since Iterator interface is locked, all we can do
// is put the real exception inside an expected one.
NoSuchElementException xNoSuch = new NoSuchElementException("ResultSet exception: " + e);
xNoSuch.initCause(e);
throw xNoSuch;
}
}
|
[
"public",
"Object",
"next",
"(",
")",
"{",
"try",
"{",
"if",
"(",
"!",
"_primed",
")",
"{",
"_primed",
"=",
"_rs",
".",
"next",
"(",
")",
";",
"if",
"(",
"!",
"_primed",
")",
"{",
"throw",
"new",
"NoSuchElementException",
"(",
")",
";",
"}",
"}",
"// reset upon consumption",
"_primed",
"=",
"false",
";",
"return",
"_rowMapper",
".",
"mapRowToReturnType",
"(",
")",
";",
"}",
"catch",
"(",
"SQLException",
"e",
")",
"{",
"// Since Iterator interface is locked, all we can do",
"// is put the real exception inside an expected one.",
"NoSuchElementException",
"xNoSuch",
"=",
"new",
"NoSuchElementException",
"(",
"\"ResultSet exception: \"",
"+",
"e",
")",
";",
"xNoSuch",
".",
"initCause",
"(",
"e",
")",
";",
"throw",
"xNoSuch",
";",
"}",
"}"
] |
Get the next element in the iteration.
@return The next element in the iteration.
|
[
"Get",
"the",
"next",
"element",
"in",
"the",
"iteration",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-jdbc-control/src/main/java/org/apache/beehive/controls/system/jdbc/ResultSetIterator.java#L82-L100
|
146,827
|
moparisthebest/beehive
|
beehive-controls/src/main/java/org/apache/beehive/controls/api/context/ControlThreadContext.java
|
ControlThreadContext.getContext
|
public static ControlContainerContext getContext()
{
Stack<ControlContainerContext> contextStack = _threadContexts.get();
if (contextStack == null || contextStack.size() == 0)
return null;
return contextStack.peek();
}
|
java
|
public static ControlContainerContext getContext()
{
Stack<ControlContainerContext> contextStack = _threadContexts.get();
if (contextStack == null || contextStack.size() == 0)
return null;
return contextStack.peek();
}
|
[
"public",
"static",
"ControlContainerContext",
"getContext",
"(",
")",
"{",
"Stack",
"<",
"ControlContainerContext",
">",
"contextStack",
"=",
"_threadContexts",
".",
"get",
"(",
")",
";",
"if",
"(",
"contextStack",
"==",
"null",
"||",
"contextStack",
".",
"size",
"(",
")",
"==",
"0",
")",
"return",
"null",
";",
"return",
"contextStack",
".",
"peek",
"(",
")",
";",
"}"
] |
Returns the active ControlContainerContext for the current thread, or null if no
context is currently active.
@return the current active ControlContainerContext
|
[
"Returns",
"the",
"active",
"ControlContainerContext",
"for",
"the",
"current",
"thread",
"or",
"null",
"if",
"no",
"context",
"is",
"currently",
"active",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/api/context/ControlThreadContext.java#L43-L50
|
146,828
|
moparisthebest/beehive
|
beehive-controls/src/main/java/org/apache/beehive/controls/api/context/ControlThreadContext.java
|
ControlThreadContext.beginContext
|
public static void beginContext(ControlContainerContext context)
{
Stack<ControlContainerContext> contextStack = _threadContexts.get();
if (contextStack == null)
{
contextStack = new Stack<ControlContainerContext>();
_threadContexts.set(contextStack);
}
contextStack.push(context);
}
|
java
|
public static void beginContext(ControlContainerContext context)
{
Stack<ControlContainerContext> contextStack = _threadContexts.get();
if (contextStack == null)
{
contextStack = new Stack<ControlContainerContext>();
_threadContexts.set(contextStack);
}
contextStack.push(context);
}
|
[
"public",
"static",
"void",
"beginContext",
"(",
"ControlContainerContext",
"context",
")",
"{",
"Stack",
"<",
"ControlContainerContext",
">",
"contextStack",
"=",
"_threadContexts",
".",
"get",
"(",
")",
";",
"if",
"(",
"contextStack",
"==",
"null",
")",
"{",
"contextStack",
"=",
"new",
"Stack",
"<",
"ControlContainerContext",
">",
"(",
")",
";",
"_threadContexts",
".",
"set",
"(",
"contextStack",
")",
";",
"}",
"contextStack",
".",
"push",
"(",
"context",
")",
";",
"}"
] |
Defines the beginning of a new control container execution context.
|
[
"Defines",
"the",
"beginning",
"of",
"a",
"new",
"control",
"container",
"execution",
"context",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/api/context/ControlThreadContext.java#L55-L64
|
146,829
|
moparisthebest/beehive
|
beehive-controls/src/main/java/org/apache/beehive/controls/api/context/ControlThreadContext.java
|
ControlThreadContext.endContext
|
public static void endContext(ControlContainerContext context)
{
Stack<ControlContainerContext> contextStack = _threadContexts.get();
if (contextStack == null || contextStack.size() == 0)
throw new IllegalStateException("No context started for current thread");
if (contextStack.peek() != context)
throw new IllegalStateException("Context is not the current active context");
contextStack.pop();
}
|
java
|
public static void endContext(ControlContainerContext context)
{
Stack<ControlContainerContext> contextStack = _threadContexts.get();
if (contextStack == null || contextStack.size() == 0)
throw new IllegalStateException("No context started for current thread");
if (contextStack.peek() != context)
throw new IllegalStateException("Context is not the current active context");
contextStack.pop();
}
|
[
"public",
"static",
"void",
"endContext",
"(",
"ControlContainerContext",
"context",
")",
"{",
"Stack",
"<",
"ControlContainerContext",
">",
"contextStack",
"=",
"_threadContexts",
".",
"get",
"(",
")",
";",
"if",
"(",
"contextStack",
"==",
"null",
"||",
"contextStack",
".",
"size",
"(",
")",
"==",
"0",
")",
"throw",
"new",
"IllegalStateException",
"(",
"\"No context started for current thread\"",
")",
";",
"if",
"(",
"contextStack",
".",
"peek",
"(",
")",
"!=",
"context",
")",
"throw",
"new",
"IllegalStateException",
"(",
"\"Context is not the current active context\"",
")",
";",
"contextStack",
".",
"pop",
"(",
")",
";",
"}"
] |
Ends the current control container execution context
@throws IllegalStateException if there is not current active context or it is not
the requested context.
|
[
"Ends",
"the",
"current",
"control",
"container",
"execution",
"context"
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/api/context/ControlThreadContext.java#L71-L81
|
146,830
|
iig-uni-freiburg/SEWOL
|
src/de/uni/freiburg/iig/telematik/sewol/parser/xes/DataUsageExtension.java
|
DataUsageExtension.instance
|
public static synchronized DataUsageExtension instance() {
if (SINGLETON == null) {
SINGLETON = new DataUsageExtension();
XFactory factory = XFactoryRegistry.instance().currentDefault();
ATTR_DATA = factory.createAttributeLiteral(KEY_DATA, "", SINGLETON);
SINGLETON.eventAttributes.add((XAttribute) ATTR_DATA.clone());
// register mapping aliases
for (Map.Entry<String, String> mapping : EXTENSION_DESCRIPTIONS.entrySet()) {
XGlobalAttributeNameMap.instance().registerMapping(mapping.getKey(), KEY_DATA, mapping.getValue());
}
}
return SINGLETON;
}
|
java
|
public static synchronized DataUsageExtension instance() {
if (SINGLETON == null) {
SINGLETON = new DataUsageExtension();
XFactory factory = XFactoryRegistry.instance().currentDefault();
ATTR_DATA = factory.createAttributeLiteral(KEY_DATA, "", SINGLETON);
SINGLETON.eventAttributes.add((XAttribute) ATTR_DATA.clone());
// register mapping aliases
for (Map.Entry<String, String> mapping : EXTENSION_DESCRIPTIONS.entrySet()) {
XGlobalAttributeNameMap.instance().registerMapping(mapping.getKey(), KEY_DATA, mapping.getValue());
}
}
return SINGLETON;
}
|
[
"public",
"static",
"synchronized",
"DataUsageExtension",
"instance",
"(",
")",
"{",
"if",
"(",
"SINGLETON",
"==",
"null",
")",
"{",
"SINGLETON",
"=",
"new",
"DataUsageExtension",
"(",
")",
";",
"XFactory",
"factory",
"=",
"XFactoryRegistry",
".",
"instance",
"(",
")",
".",
"currentDefault",
"(",
")",
";",
"ATTR_DATA",
"=",
"factory",
".",
"createAttributeLiteral",
"(",
"KEY_DATA",
",",
"\"\"",
",",
"SINGLETON",
")",
";",
"SINGLETON",
".",
"eventAttributes",
".",
"add",
"(",
"(",
"XAttribute",
")",
"ATTR_DATA",
".",
"clone",
"(",
")",
")",
";",
"// register mapping aliases\r",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"String",
">",
"mapping",
":",
"EXTENSION_DESCRIPTIONS",
".",
"entrySet",
"(",
")",
")",
"{",
"XGlobalAttributeNameMap",
".",
"instance",
"(",
")",
".",
"registerMapping",
"(",
"mapping",
".",
"getKey",
"(",
")",
",",
"KEY_DATA",
",",
"mapping",
".",
"getValue",
"(",
")",
")",
";",
"}",
"}",
"return",
"SINGLETON",
";",
"}"
] |
Provides access to the singleton instance of this extension.
@return The AttributeDataUsage extension singleton.
|
[
"Provides",
"access",
"to",
"the",
"singleton",
"instance",
"of",
"this",
"extension",
"."
] |
e791cb07a6e62ecf837d760d58a25f32fbf6bbca
|
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/src/de/uni/freiburg/iig/telematik/sewol/parser/xes/DataUsageExtension.java#L70-L82
|
146,831
|
iig-uni-freiburg/SEWOL
|
src/de/uni/freiburg/iig/telematik/sewol/parser/xes/DataUsageExtension.java
|
DataUsageExtension.extractData
|
public String extractData(XEvent event) {
XAttribute attribute = event.getAttributes().get(KEY_DATA);
if (attribute == null) {
return null;
} else {
return ((XAttributeLiteral) attribute).getValue();
}
}
|
java
|
public String extractData(XEvent event) {
XAttribute attribute = event.getAttributes().get(KEY_DATA);
if (attribute == null) {
return null;
} else {
return ((XAttributeLiteral) attribute).getValue();
}
}
|
[
"public",
"String",
"extractData",
"(",
"XEvent",
"event",
")",
"{",
"XAttribute",
"attribute",
"=",
"event",
".",
"getAttributes",
"(",
")",
".",
"get",
"(",
"KEY_DATA",
")",
";",
"if",
"(",
"attribute",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"else",
"{",
"return",
"(",
"(",
"XAttributeLiteral",
")",
"attribute",
")",
".",
"getValue",
"(",
")",
";",
"}",
"}"
] |
Extracts the data attribute string from an event.
@param event Event to be queried.
@return Data string for the given event (may be <code>null</code> if
not defined)
|
[
"Extracts",
"the",
"data",
"attribute",
"string",
"from",
"an",
"event",
"."
] |
e791cb07a6e62ecf837d760d58a25f32fbf6bbca
|
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/src/de/uni/freiburg/iig/telematik/sewol/parser/xes/DataUsageExtension.java#L95-L102
|
146,832
|
iig-uni-freiburg/SEWOL
|
src/de/uni/freiburg/iig/telematik/sewol/parser/xes/DataUsageExtension.java
|
DataUsageExtension.assignData
|
public void assignData(XEvent event, String data) {
if (data != null && data.trim().length() > 0) {
XAttributeLiteral attr = (XAttributeLiteral) ATTR_DATA.clone();
attr.setValue(data.trim());
event.getAttributes().put(KEY_DATA, attr);
}
}
|
java
|
public void assignData(XEvent event, String data) {
if (data != null && data.trim().length() > 0) {
XAttributeLiteral attr = (XAttributeLiteral) ATTR_DATA.clone();
attr.setValue(data.trim());
event.getAttributes().put(KEY_DATA, attr);
}
}
|
[
"public",
"void",
"assignData",
"(",
"XEvent",
"event",
",",
"String",
"data",
")",
"{",
"if",
"(",
"data",
"!=",
"null",
"&&",
"data",
".",
"trim",
"(",
")",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"XAttributeLiteral",
"attr",
"=",
"(",
"XAttributeLiteral",
")",
"ATTR_DATA",
".",
"clone",
"(",
")",
";",
"attr",
".",
"setValue",
"(",
"data",
".",
"trim",
"(",
")",
")",
";",
"event",
".",
"getAttributes",
"(",
")",
".",
"put",
"(",
"KEY_DATA",
",",
"attr",
")",
";",
"}",
"}"
] |
Assigns the data attribute value for a given event.
@param event Event to be modified.
@param data Data string to be assigned.
|
[
"Assigns",
"the",
"data",
"attribute",
"value",
"for",
"a",
"given",
"event",
"."
] |
e791cb07a6e62ecf837d760d58a25f32fbf6bbca
|
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/src/de/uni/freiburg/iig/telematik/sewol/parser/xes/DataUsageExtension.java#L110-L116
|
146,833
|
moparisthebest/beehive
|
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptContextField.java
|
AptContextField.initControlInterface
|
protected AptControlInterface initControlInterface()
{
TypeMirror fieldType = _fieldDecl.getType();
if (! (fieldType instanceof InterfaceType))
{
_ap.printError( _fieldDecl, "context.field.badinterface" );
return null;
}
//
// For contextual services, the declared type of the field is always the public
// interface for the contextual service.
//
return new AptControlInterface(((InterfaceType)_fieldDecl.getType()).getDeclaration(),
_ap);
}
|
java
|
protected AptControlInterface initControlInterface()
{
TypeMirror fieldType = _fieldDecl.getType();
if (! (fieldType instanceof InterfaceType))
{
_ap.printError( _fieldDecl, "context.field.badinterface" );
return null;
}
//
// For contextual services, the declared type of the field is always the public
// interface for the contextual service.
//
return new AptControlInterface(((InterfaceType)_fieldDecl.getType()).getDeclaration(),
_ap);
}
|
[
"protected",
"AptControlInterface",
"initControlInterface",
"(",
")",
"{",
"TypeMirror",
"fieldType",
"=",
"_fieldDecl",
".",
"getType",
"(",
")",
";",
"if",
"(",
"!",
"(",
"fieldType",
"instanceof",
"InterfaceType",
")",
")",
"{",
"_ap",
".",
"printError",
"(",
"_fieldDecl",
",",
"\"context.field.badinterface\"",
")",
";",
"return",
"null",
";",
"}",
"//",
"// For contextual services, the declared type of the field is always the public",
"// interface for the contextual service.",
"//",
"return",
"new",
"AptControlInterface",
"(",
"(",
"(",
"InterfaceType",
")",
"_fieldDecl",
".",
"getType",
"(",
")",
")",
".",
"getDeclaration",
"(",
")",
",",
"_ap",
")",
";",
"}"
] |
Initializes a ControlInterface associated with this context field. Because
contextual services can expose both APIs and events, they are similar to controls.
|
[
"Initializes",
"a",
"ControlInterface",
"associated",
"with",
"this",
"context",
"field",
".",
"Because",
"contextual",
"services",
"can",
"expose",
"both",
"APIs",
"and",
"events",
"they",
"are",
"similar",
"to",
"controls",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptContextField.java#L48-L63
|
146,834
|
moparisthebest/beehive
|
beehive-netui-core/src/main/java/org/apache/beehive/netui/core/URLCodec.java
|
URLCodec.encode
|
public static String encode(final String decoded, final String charset)
throws UnsupportedEncodingException {
return s_codec.encode(decoded, charset);
}
|
java
|
public static String encode(final String decoded, final String charset)
throws UnsupportedEncodingException {
return s_codec.encode(decoded, charset);
}
|
[
"public",
"static",
"String",
"encode",
"(",
"final",
"String",
"decoded",
",",
"final",
"String",
"charset",
")",
"throws",
"UnsupportedEncodingException",
"{",
"return",
"s_codec",
".",
"encode",
"(",
"decoded",
",",
"charset",
")",
";",
"}"
] |
URL encodes a string.
@param decoded the string to encode
@param charset the character set to use
@return the encoded string
|
[
"URL",
"encodes",
"a",
"string",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/core/URLCodec.java#L42-L45
|
146,835
|
moparisthebest/beehive
|
beehive-netui-core/src/main/java/org/apache/beehive/netui/core/URLCodec.java
|
URLCodec.encode
|
public static String encode(final String decoded) {
try {
return s_codec.encode(decoded);
} catch (EncoderException e) {
throw new IllegalStateException(Bundle.getErrorString("URLCodec_encodeException", new String[] {e.getMessage()}), e);
}
}
|
java
|
public static String encode(final String decoded) {
try {
return s_codec.encode(decoded);
} catch (EncoderException e) {
throw new IllegalStateException(Bundle.getErrorString("URLCodec_encodeException", new String[] {e.getMessage()}), e);
}
}
|
[
"public",
"static",
"String",
"encode",
"(",
"final",
"String",
"decoded",
")",
"{",
"try",
"{",
"return",
"s_codec",
".",
"encode",
"(",
"decoded",
")",
";",
"}",
"catch",
"(",
"EncoderException",
"e",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"Bundle",
".",
"getErrorString",
"(",
"\"URLCodec_encodeException\"",
",",
"new",
"String",
"[",
"]",
"{",
"e",
".",
"getMessage",
"(",
")",
"}",
")",
",",
"e",
")",
";",
"}",
"}"
] |
URL encodes a string using the default character set
@param decoded the string to encode
@return the encoded string
|
[
"URL",
"encodes",
"a",
"string",
"using",
"the",
"default",
"character",
"set"
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/core/URLCodec.java#L52-L58
|
146,836
|
moparisthebest/beehive
|
beehive-netui-core/src/main/java/org/apache/beehive/netui/core/URLCodec.java
|
URLCodec.decode
|
public static String decode(final String encoded, final String charset)
throws UnsupportedEncodingException {
try {
return s_codec.decode(encoded, charset);
} catch (DecoderException e) {
throw new IllegalStateException(Bundle.getErrorString("URLCodec_decodeException", new String[] {e.getMessage()}), e);
}
}
|
java
|
public static String decode(final String encoded, final String charset)
throws UnsupportedEncodingException {
try {
return s_codec.decode(encoded, charset);
} catch (DecoderException e) {
throw new IllegalStateException(Bundle.getErrorString("URLCodec_decodeException", new String[] {e.getMessage()}), e);
}
}
|
[
"public",
"static",
"String",
"decode",
"(",
"final",
"String",
"encoded",
",",
"final",
"String",
"charset",
")",
"throws",
"UnsupportedEncodingException",
"{",
"try",
"{",
"return",
"s_codec",
".",
"decode",
"(",
"encoded",
",",
"charset",
")",
";",
"}",
"catch",
"(",
"DecoderException",
"e",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"Bundle",
".",
"getErrorString",
"(",
"\"URLCodec_decodeException\"",
",",
"new",
"String",
"[",
"]",
"{",
"e",
".",
"getMessage",
"(",
")",
"}",
")",
",",
"e",
")",
";",
"}",
"}"
] |
URL decodes a string.
@param encoded the string to decode
@param charset the character set to use
@return the decoded string
|
[
"URL",
"decodes",
"a",
"string",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/core/URLCodec.java#L66-L73
|
146,837
|
moparisthebest/beehive
|
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/bean/ControlBeanContext.java
|
ControlBeanContext.getNameGenerator
|
private NameGenerator getNameGenerator(String namePrefix)
{
synchronized(this)
{
if (_nameGenerators == null)
_nameGenerators = new HashMap<String,NameGenerator>();
NameGenerator nameGenerator = _nameGenerators.get(namePrefix);
if (nameGenerator == null)
{
nameGenerator = new NameGenerator(namePrefix);
_nameGenerators.put(namePrefix, nameGenerator);
}
return nameGenerator;
}
}
|
java
|
private NameGenerator getNameGenerator(String namePrefix)
{
synchronized(this)
{
if (_nameGenerators == null)
_nameGenerators = new HashMap<String,NameGenerator>();
NameGenerator nameGenerator = _nameGenerators.get(namePrefix);
if (nameGenerator == null)
{
nameGenerator = new NameGenerator(namePrefix);
_nameGenerators.put(namePrefix, nameGenerator);
}
return nameGenerator;
}
}
|
[
"private",
"NameGenerator",
"getNameGenerator",
"(",
"String",
"namePrefix",
")",
"{",
"synchronized",
"(",
"this",
")",
"{",
"if",
"(",
"_nameGenerators",
"==",
"null",
")",
"_nameGenerators",
"=",
"new",
"HashMap",
"<",
"String",
",",
"NameGenerator",
">",
"(",
")",
";",
"NameGenerator",
"nameGenerator",
"=",
"_nameGenerators",
".",
"get",
"(",
"namePrefix",
")",
";",
"if",
"(",
"nameGenerator",
"==",
"null",
")",
"{",
"nameGenerator",
"=",
"new",
"NameGenerator",
"(",
"namePrefix",
")",
";",
"_nameGenerators",
".",
"put",
"(",
"namePrefix",
",",
"nameGenerator",
")",
";",
"}",
"return",
"nameGenerator",
";",
"}",
"}"
] |
Returns a new NameGenerator instance based upon a particular naming
prefix.
|
[
"Returns",
"a",
"new",
"NameGenerator",
"instance",
"based",
"upon",
"a",
"particular",
"naming",
"prefix",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/bean/ControlBeanContext.java#L207-L222
|
146,838
|
moparisthebest/beehive
|
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/bean/ControlBeanContext.java
|
ControlBeanContext.generateUniqueID
|
public String generateUniqueID(Class clazz)
{
String namePrefix = clazz.getName();
int dotIndex = namePrefix.lastIndexOf('.');
if (dotIndex > 0)
namePrefix = namePrefix.substring(dotIndex+1);
NameGenerator nameGenerator = getNameGenerator(namePrefix);
return nameGenerator.next();
}
|
java
|
public String generateUniqueID(Class clazz)
{
String namePrefix = clazz.getName();
int dotIndex = namePrefix.lastIndexOf('.');
if (dotIndex > 0)
namePrefix = namePrefix.substring(dotIndex+1);
NameGenerator nameGenerator = getNameGenerator(namePrefix);
return nameGenerator.next();
}
|
[
"public",
"String",
"generateUniqueID",
"(",
"Class",
"clazz",
")",
"{",
"String",
"namePrefix",
"=",
"clazz",
".",
"getName",
"(",
")",
";",
"int",
"dotIndex",
"=",
"namePrefix",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"dotIndex",
">",
"0",
")",
"namePrefix",
"=",
"namePrefix",
".",
"substring",
"(",
"dotIndex",
"+",
"1",
")",
";",
"NameGenerator",
"nameGenerator",
"=",
"getNameGenerator",
"(",
"namePrefix",
")",
";",
"return",
"nameGenerator",
".",
"next",
"(",
")",
";",
"}"
] |
Generates a new unique control ID for an instance of the target class
|
[
"Generates",
"a",
"new",
"unique",
"control",
"ID",
"for",
"an",
"instance",
"of",
"the",
"target",
"class"
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/bean/ControlBeanContext.java#L227-L235
|
146,839
|
moparisthebest/beehive
|
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/bean/ControlBeanContext.java
|
ControlBeanContext.getBean
|
public ControlBean getBean(String id)
{
// If no control id separator found, the bean is a direct child of this context
int delim = id.indexOf(org.apache.beehive.controls.api.bean.ControlBean.IDSeparator);
if (delim < 0) // child is a direct descendent
return (ControlBean)_childMap.get(id);
// Find the child referenced by the first element in the path
ControlBean bean = (ControlBean)_childMap.get(id.substring(0, delim));
if (bean == null)
return bean;
// Get the BeanContext associated with the found child, and then ask it
// to resolve the rest of the path
return bean.getBeanContextProxy().getBean(id.substring(delim+1));
}
|
java
|
public ControlBean getBean(String id)
{
// If no control id separator found, the bean is a direct child of this context
int delim = id.indexOf(org.apache.beehive.controls.api.bean.ControlBean.IDSeparator);
if (delim < 0) // child is a direct descendent
return (ControlBean)_childMap.get(id);
// Find the child referenced by the first element in the path
ControlBean bean = (ControlBean)_childMap.get(id.substring(0, delim));
if (bean == null)
return bean;
// Get the BeanContext associated with the found child, and then ask it
// to resolve the rest of the path
return bean.getBeanContextProxy().getBean(id.substring(delim+1));
}
|
[
"public",
"ControlBean",
"getBean",
"(",
"String",
"id",
")",
"{",
"// If no control id separator found, the bean is a direct child of this context",
"int",
"delim",
"=",
"id",
".",
"indexOf",
"(",
"org",
".",
"apache",
".",
"beehive",
".",
"controls",
".",
"api",
".",
"bean",
".",
"ControlBean",
".",
"IDSeparator",
")",
";",
"if",
"(",
"delim",
"<",
"0",
")",
"// child is a direct descendent",
"return",
"(",
"ControlBean",
")",
"_childMap",
".",
"get",
"(",
"id",
")",
";",
"// Find the child referenced by the first element in the path",
"ControlBean",
"bean",
"=",
"(",
"ControlBean",
")",
"_childMap",
".",
"get",
"(",
"id",
".",
"substring",
"(",
"0",
",",
"delim",
")",
")",
";",
"if",
"(",
"bean",
"==",
"null",
")",
"return",
"bean",
";",
"// Get the BeanContext associated with the found child, and then ask it",
"// to resolve the rest of the path",
"return",
"bean",
".",
"getBeanContextProxy",
"(",
")",
".",
"getBean",
"(",
"id",
".",
"substring",
"(",
"delim",
"+",
"1",
")",
")",
";",
"}"
] |
Returns a ControlBean instance nested the current BeanContext.
@param id the identifier for the target control, relative to the current
context.
|
[
"Returns",
"a",
"ControlBean",
"instance",
"nested",
"the",
"current",
"BeanContext",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/bean/ControlBeanContext.java#L303-L318
|
146,840
|
moparisthebest/beehive
|
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/bean/ControlBeanContext.java
|
ControlBeanContext.getBeanAnnotationMap
|
protected PropertyMap getBeanAnnotationMap(ControlBean bean, AnnotatedElement annotElem)
{
PropertyMap map = new AnnotatedElementMap(annotElem);
// REVIEW: is this the right place to handle the general control client case?
if ( bean != null )
setDelegateMap( map, bean, annotElem );
return map;
}
|
java
|
protected PropertyMap getBeanAnnotationMap(ControlBean bean, AnnotatedElement annotElem)
{
PropertyMap map = new AnnotatedElementMap(annotElem);
// REVIEW: is this the right place to handle the general control client case?
if ( bean != null )
setDelegateMap( map, bean, annotElem );
return map;
}
|
[
"protected",
"PropertyMap",
"getBeanAnnotationMap",
"(",
"ControlBean",
"bean",
",",
"AnnotatedElement",
"annotElem",
")",
"{",
"PropertyMap",
"map",
"=",
"new",
"AnnotatedElementMap",
"(",
"annotElem",
")",
";",
"// REVIEW: is this the right place to handle the general control client case?",
"if",
"(",
"bean",
"!=",
"null",
")",
"setDelegateMap",
"(",
"map",
",",
"bean",
",",
"annotElem",
")",
";",
"return",
"map",
";",
"}"
] |
The default implementation of getBeanAnnotationMap. This returns a map based purely
upon annotation reflection
|
[
"The",
"default",
"implementation",
"of",
"getBeanAnnotationMap",
".",
"This",
"returns",
"a",
"map",
"based",
"purely",
"upon",
"annotation",
"reflection"
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/bean/ControlBeanContext.java#L391-L400
|
146,841
|
moparisthebest/beehive
|
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/RewriteURL.java
|
RewriteURL.doEndTag
|
public int doEndTag() throws JspException
{
HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
HttpServletResponse response = (HttpServletResponse) pageContext.getResponse();
ServletContext context = pageContext.getServletContext();
try {
boolean encoded = false;
UrlConfig urlConfig = ConfigUtil.getConfig().getUrlConfig();
if (urlConfig != null) {
encoded = !urlConfig.isUrlEncodeUrls();
}
FreezableMutableURI uri = new FreezableMutableURI();
uri.setEncoding(response.getCharacterEncoding());
uri.setURI(url, encoded);
boolean needsToBeSecure = false;
if (_params != null) {
uri.addParameters(_params, false );
}
if (!uri.isAbsolute() && PageFlowUtils.needsToBeSecure(context, request, url, true)) {
needsToBeSecure = true;
}
URLRewriterService.rewriteURL(context, request, response, uri, URLType.ACTION, needsToBeSecure);
String key = PageFlowUtils.getURLTemplateKey(URLType.ACTION, needsToBeSecure);
boolean forXML = TagRenderingBase.Factory.isXHTML(request);
URIContext uriContext = URIContextFactory.getInstance(forXML);
String uriString = URLRewriterService.getTemplatedURL(context, request, uri, key, uriContext);
write(response.encodeURL(uriString));
}
catch (URISyntaxException e) {
// report the error...
String s = Bundle.getString("Tags_RewriteURL_URLException",
new Object[]{url, e.getMessage()});
registerTagError(s, e);
reportErrors();
}
localRelease();
return EVAL_PAGE;
}
|
java
|
public int doEndTag() throws JspException
{
HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
HttpServletResponse response = (HttpServletResponse) pageContext.getResponse();
ServletContext context = pageContext.getServletContext();
try {
boolean encoded = false;
UrlConfig urlConfig = ConfigUtil.getConfig().getUrlConfig();
if (urlConfig != null) {
encoded = !urlConfig.isUrlEncodeUrls();
}
FreezableMutableURI uri = new FreezableMutableURI();
uri.setEncoding(response.getCharacterEncoding());
uri.setURI(url, encoded);
boolean needsToBeSecure = false;
if (_params != null) {
uri.addParameters(_params, false );
}
if (!uri.isAbsolute() && PageFlowUtils.needsToBeSecure(context, request, url, true)) {
needsToBeSecure = true;
}
URLRewriterService.rewriteURL(context, request, response, uri, URLType.ACTION, needsToBeSecure);
String key = PageFlowUtils.getURLTemplateKey(URLType.ACTION, needsToBeSecure);
boolean forXML = TagRenderingBase.Factory.isXHTML(request);
URIContext uriContext = URIContextFactory.getInstance(forXML);
String uriString = URLRewriterService.getTemplatedURL(context, request, uri, key, uriContext);
write(response.encodeURL(uriString));
}
catch (URISyntaxException e) {
// report the error...
String s = Bundle.getString("Tags_RewriteURL_URLException",
new Object[]{url, e.getMessage()});
registerTagError(s, e);
reportErrors();
}
localRelease();
return EVAL_PAGE;
}
|
[
"public",
"int",
"doEndTag",
"(",
")",
"throws",
"JspException",
"{",
"HttpServletRequest",
"request",
"=",
"(",
"HttpServletRequest",
")",
"pageContext",
".",
"getRequest",
"(",
")",
";",
"HttpServletResponse",
"response",
"=",
"(",
"HttpServletResponse",
")",
"pageContext",
".",
"getResponse",
"(",
")",
";",
"ServletContext",
"context",
"=",
"pageContext",
".",
"getServletContext",
"(",
")",
";",
"try",
"{",
"boolean",
"encoded",
"=",
"false",
";",
"UrlConfig",
"urlConfig",
"=",
"ConfigUtil",
".",
"getConfig",
"(",
")",
".",
"getUrlConfig",
"(",
")",
";",
"if",
"(",
"urlConfig",
"!=",
"null",
")",
"{",
"encoded",
"=",
"!",
"urlConfig",
".",
"isUrlEncodeUrls",
"(",
")",
";",
"}",
"FreezableMutableURI",
"uri",
"=",
"new",
"FreezableMutableURI",
"(",
")",
";",
"uri",
".",
"setEncoding",
"(",
"response",
".",
"getCharacterEncoding",
"(",
")",
")",
";",
"uri",
".",
"setURI",
"(",
"url",
",",
"encoded",
")",
";",
"boolean",
"needsToBeSecure",
"=",
"false",
";",
"if",
"(",
"_params",
"!=",
"null",
")",
"{",
"uri",
".",
"addParameters",
"(",
"_params",
",",
"false",
")",
";",
"}",
"if",
"(",
"!",
"uri",
".",
"isAbsolute",
"(",
")",
"&&",
"PageFlowUtils",
".",
"needsToBeSecure",
"(",
"context",
",",
"request",
",",
"url",
",",
"true",
")",
")",
"{",
"needsToBeSecure",
"=",
"true",
";",
"}",
"URLRewriterService",
".",
"rewriteURL",
"(",
"context",
",",
"request",
",",
"response",
",",
"uri",
",",
"URLType",
".",
"ACTION",
",",
"needsToBeSecure",
")",
";",
"String",
"key",
"=",
"PageFlowUtils",
".",
"getURLTemplateKey",
"(",
"URLType",
".",
"ACTION",
",",
"needsToBeSecure",
")",
";",
"boolean",
"forXML",
"=",
"TagRenderingBase",
".",
"Factory",
".",
"isXHTML",
"(",
"request",
")",
";",
"URIContext",
"uriContext",
"=",
"URIContextFactory",
".",
"getInstance",
"(",
"forXML",
")",
";",
"String",
"uriString",
"=",
"URLRewriterService",
".",
"getTemplatedURL",
"(",
"context",
",",
"request",
",",
"uri",
",",
"key",
",",
"uriContext",
")",
";",
"write",
"(",
"response",
".",
"encodeURL",
"(",
"uriString",
")",
")",
";",
"}",
"catch",
"(",
"URISyntaxException",
"e",
")",
"{",
"// report the error...",
"String",
"s",
"=",
"Bundle",
".",
"getString",
"(",
"\"Tags_RewriteURL_URLException\"",
",",
"new",
"Object",
"[",
"]",
"{",
"url",
",",
"e",
".",
"getMessage",
"(",
")",
"}",
")",
";",
"registerTagError",
"(",
"s",
",",
"e",
")",
";",
"reportErrors",
"(",
")",
";",
"}",
"localRelease",
"(",
")",
";",
"return",
"EVAL_PAGE",
";",
"}"
] |
Render the end of the rewriteURL tag.
@throws JspException if a JSP exception has occurred
|
[
"Render",
"the",
"end",
"of",
"the",
"rewriteURL",
"tag",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/RewriteURL.java#L114-L155
|
146,842
|
moparisthebest/beehive
|
beehive-netui-compiler/src/main/java/org/apache/beehive/netui/compiler/genmodel/GenValidationModel.java
|
GenValidationModel.getFormBeanNames
|
private List getFormBeanNames(TypeDeclaration beanType)
{
List formBeans = _strutsApp.getMatchingFormBeans(beanType, null);
List formBeanNames = new ArrayList();
for ( Iterator i = formBeans.iterator(); i.hasNext(); )
{
FormBeanModel formBeanModel = ( FormBeanModel ) i.next();
formBeanNames.add( formBeanModel.getName() );
}
return formBeanNames;
}
|
java
|
private List getFormBeanNames(TypeDeclaration beanType)
{
List formBeans = _strutsApp.getMatchingFormBeans(beanType, null);
List formBeanNames = new ArrayList();
for ( Iterator i = formBeans.iterator(); i.hasNext(); )
{
FormBeanModel formBeanModel = ( FormBeanModel ) i.next();
formBeanNames.add( formBeanModel.getName() );
}
return formBeanNames;
}
|
[
"private",
"List",
"getFormBeanNames",
"(",
"TypeDeclaration",
"beanType",
")",
"{",
"List",
"formBeans",
"=",
"_strutsApp",
".",
"getMatchingFormBeans",
"(",
"beanType",
",",
"null",
")",
";",
"List",
"formBeanNames",
"=",
"new",
"ArrayList",
"(",
")",
";",
"for",
"(",
"Iterator",
"i",
"=",
"formBeans",
".",
"iterator",
"(",
")",
";",
"i",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"FormBeanModel",
"formBeanModel",
"=",
"(",
"FormBeanModel",
")",
"i",
".",
"next",
"(",
")",
";",
"formBeanNames",
".",
"add",
"(",
"formBeanModel",
".",
"getName",
"(",
")",
")",
";",
"}",
"return",
"formBeanNames",
";",
"}"
] |
Returns a list of String names.
|
[
"Returns",
"a",
"list",
"of",
"String",
"names",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-compiler/src/main/java/org/apache/beehive/netui/compiler/genmodel/GenValidationModel.java#L236-L248
|
146,843
|
moparisthebest/beehive
|
beehive-netui-compiler/src/main/java/org/apache/beehive/netui/compiler/genmodel/GenValidationModel.java
|
GenValidationModel.addFieldRules
|
private void addFieldRules( AnnotationInstance rulesContainerAnnotation, RuleInfo ruleInfo,
boolean applyToAllLocales )
{
//
// First parse the locale from the wrapper annotation. This will apply to all rules inside.
//
Locale locale = null;
if ( ! applyToAllLocales )
{
String language = CompilerUtils.getString( rulesContainerAnnotation, LANGUAGE_ATTR, true );
//
// If there's no language specified, then this rule will only apply for the default ruleset
// (i.e., if there are explicit rules for the requested locale, this rule will not be run).
//
if ( language != null )
{
String country = CompilerUtils.getString( rulesContainerAnnotation, COUNTRY_ATTR, true );
String variant = CompilerUtils.getString( rulesContainerAnnotation, VARIANT_ATTR, true );
language = language.trim();
if ( country != null ) country = country.trim();
if ( variant != null ) variant = variant.trim();
if ( country != null && variant != null ) locale = new Locale( language, country, variant );
else if ( country != null ) locale = new Locale( language, country );
else locale = new Locale( language );
}
}
Map valuesPresent = rulesContainerAnnotation.getElementValues();
for ( Iterator ii = valuesPresent.entrySet().iterator(); ii.hasNext(); )
{
Map.Entry entry = ( Map.Entry ) ii.next();
AnnotationValue value = ( AnnotationValue ) entry.getValue();
Object val = value.getValue();
if ( val instanceof AnnotationInstance )
{
addFieldRuleFromAnnotation( ruleInfo, ( AnnotationInstance ) val, locale, applyToAllLocales );
}
else if ( val instanceof List )
{
List annotations = CompilerUtils.getAnnotationArray( value );
for ( Iterator i3 = annotations.iterator(); i3.hasNext(); )
{
AnnotationInstance i = ( AnnotationInstance ) i3.next();
addFieldRuleFromAnnotation( ruleInfo, i, locale, applyToAllLocales );
}
}
}
setEmpty( false ); // this ValidationModel is only "empty" if there are no rules.
}
|
java
|
private void addFieldRules( AnnotationInstance rulesContainerAnnotation, RuleInfo ruleInfo,
boolean applyToAllLocales )
{
//
// First parse the locale from the wrapper annotation. This will apply to all rules inside.
//
Locale locale = null;
if ( ! applyToAllLocales )
{
String language = CompilerUtils.getString( rulesContainerAnnotation, LANGUAGE_ATTR, true );
//
// If there's no language specified, then this rule will only apply for the default ruleset
// (i.e., if there are explicit rules for the requested locale, this rule will not be run).
//
if ( language != null )
{
String country = CompilerUtils.getString( rulesContainerAnnotation, COUNTRY_ATTR, true );
String variant = CompilerUtils.getString( rulesContainerAnnotation, VARIANT_ATTR, true );
language = language.trim();
if ( country != null ) country = country.trim();
if ( variant != null ) variant = variant.trim();
if ( country != null && variant != null ) locale = new Locale( language, country, variant );
else if ( country != null ) locale = new Locale( language, country );
else locale = new Locale( language );
}
}
Map valuesPresent = rulesContainerAnnotation.getElementValues();
for ( Iterator ii = valuesPresent.entrySet().iterator(); ii.hasNext(); )
{
Map.Entry entry = ( Map.Entry ) ii.next();
AnnotationValue value = ( AnnotationValue ) entry.getValue();
Object val = value.getValue();
if ( val instanceof AnnotationInstance )
{
addFieldRuleFromAnnotation( ruleInfo, ( AnnotationInstance ) val, locale, applyToAllLocales );
}
else if ( val instanceof List )
{
List annotations = CompilerUtils.getAnnotationArray( value );
for ( Iterator i3 = annotations.iterator(); i3.hasNext(); )
{
AnnotationInstance i = ( AnnotationInstance ) i3.next();
addFieldRuleFromAnnotation( ruleInfo, i, locale, applyToAllLocales );
}
}
}
setEmpty( false ); // this ValidationModel is only "empty" if there are no rules.
}
|
[
"private",
"void",
"addFieldRules",
"(",
"AnnotationInstance",
"rulesContainerAnnotation",
",",
"RuleInfo",
"ruleInfo",
",",
"boolean",
"applyToAllLocales",
")",
"{",
"//",
"// First parse the locale from the wrapper annotation. This will apply to all rules inside.",
"//",
"Locale",
"locale",
"=",
"null",
";",
"if",
"(",
"!",
"applyToAllLocales",
")",
"{",
"String",
"language",
"=",
"CompilerUtils",
".",
"getString",
"(",
"rulesContainerAnnotation",
",",
"LANGUAGE_ATTR",
",",
"true",
")",
";",
"//",
"// If there's no language specified, then this rule will only apply for the default ruleset",
"// (i.e., if there are explicit rules for the requested locale, this rule will not be run).",
"//",
"if",
"(",
"language",
"!=",
"null",
")",
"{",
"String",
"country",
"=",
"CompilerUtils",
".",
"getString",
"(",
"rulesContainerAnnotation",
",",
"COUNTRY_ATTR",
",",
"true",
")",
";",
"String",
"variant",
"=",
"CompilerUtils",
".",
"getString",
"(",
"rulesContainerAnnotation",
",",
"VARIANT_ATTR",
",",
"true",
")",
";",
"language",
"=",
"language",
".",
"trim",
"(",
")",
";",
"if",
"(",
"country",
"!=",
"null",
")",
"country",
"=",
"country",
".",
"trim",
"(",
")",
";",
"if",
"(",
"variant",
"!=",
"null",
")",
"variant",
"=",
"variant",
".",
"trim",
"(",
")",
";",
"if",
"(",
"country",
"!=",
"null",
"&&",
"variant",
"!=",
"null",
")",
"locale",
"=",
"new",
"Locale",
"(",
"language",
",",
"country",
",",
"variant",
")",
";",
"else",
"if",
"(",
"country",
"!=",
"null",
")",
"locale",
"=",
"new",
"Locale",
"(",
"language",
",",
"country",
")",
";",
"else",
"locale",
"=",
"new",
"Locale",
"(",
"language",
")",
";",
"}",
"}",
"Map",
"valuesPresent",
"=",
"rulesContainerAnnotation",
".",
"getElementValues",
"(",
")",
";",
"for",
"(",
"Iterator",
"ii",
"=",
"valuesPresent",
".",
"entrySet",
"(",
")",
".",
"iterator",
"(",
")",
";",
"ii",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"Map",
".",
"Entry",
"entry",
"=",
"(",
"Map",
".",
"Entry",
")",
"ii",
".",
"next",
"(",
")",
";",
"AnnotationValue",
"value",
"=",
"(",
"AnnotationValue",
")",
"entry",
".",
"getValue",
"(",
")",
";",
"Object",
"val",
"=",
"value",
".",
"getValue",
"(",
")",
";",
"if",
"(",
"val",
"instanceof",
"AnnotationInstance",
")",
"{",
"addFieldRuleFromAnnotation",
"(",
"ruleInfo",
",",
"(",
"AnnotationInstance",
")",
"val",
",",
"locale",
",",
"applyToAllLocales",
")",
";",
"}",
"else",
"if",
"(",
"val",
"instanceof",
"List",
")",
"{",
"List",
"annotations",
"=",
"CompilerUtils",
".",
"getAnnotationArray",
"(",
"value",
")",
";",
"for",
"(",
"Iterator",
"i3",
"=",
"annotations",
".",
"iterator",
"(",
")",
";",
"i3",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"AnnotationInstance",
"i",
"=",
"(",
"AnnotationInstance",
")",
"i3",
".",
"next",
"(",
")",
";",
"addFieldRuleFromAnnotation",
"(",
"ruleInfo",
",",
"i",
",",
"locale",
",",
"applyToAllLocales",
")",
";",
"}",
"}",
"}",
"setEmpty",
"(",
"false",
")",
";",
"// this ValidationModel is only \"empty\" if there are no rules.",
"}"
] |
Add field rules from either a Jpf.ValidationField or a Jpf.ValidationLocaleRules annotation.
|
[
"Add",
"field",
"rules",
"from",
"either",
"a",
"Jpf",
".",
"ValidationField",
"or",
"a",
"Jpf",
".",
"ValidationLocaleRules",
"annotation",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-compiler/src/main/java/org/apache/beehive/netui/compiler/genmodel/GenValidationModel.java#L286-L342
|
146,844
|
moparisthebest/beehive
|
beehive-netui-tags/src/main/java/org/apache/beehive/netui/databinding/datagrid/api/rendering/StyleModel.java
|
StyleModel.prefix
|
private final String prefix(String style) {
InternalStringBuilder sb = new InternalStringBuilder(16);
sb.append(_stylePrefix);
if(style != null) {
sb.append(DELIM);
sb.append(style);
}
return sb.toString();
}
|
java
|
private final String prefix(String style) {
InternalStringBuilder sb = new InternalStringBuilder(16);
sb.append(_stylePrefix);
if(style != null) {
sb.append(DELIM);
sb.append(style);
}
return sb.toString();
}
|
[
"private",
"final",
"String",
"prefix",
"(",
"String",
"style",
")",
"{",
"InternalStringBuilder",
"sb",
"=",
"new",
"InternalStringBuilder",
"(",
"16",
")",
";",
"sb",
".",
"append",
"(",
"_stylePrefix",
")",
";",
"if",
"(",
"style",
"!=",
"null",
")",
"{",
"sb",
".",
"append",
"(",
"DELIM",
")",
";",
"sb",
".",
"append",
"(",
"style",
")",
";",
"}",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}"
] |
Utility method to concatenate the given style class name and the style prefix.
@param style the core style name
@return the style class
|
[
"Utility",
"method",
"to",
"concatenate",
"the",
"given",
"style",
"class",
"name",
"and",
"the",
"style",
"prefix",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/databinding/datagrid/api/rendering/StyleModel.java#L211-L219
|
146,845
|
dmurph/jgoogleanalyticstracker
|
src/main/java/com/dmurph/tracking/JGoogleAnalyticsTracker.java
|
JGoogleAnalyticsTracker.setDispatchMode
|
public void setDispatchMode(DispatchMode argMode){
if(argMode == null){
argMode = DispatchMode.SINGLE_THREAD;
}
if(argMode == DispatchMode.SINGLE_THREAD){
startBackgroundThread();
}
mode = argMode;
}
|
java
|
public void setDispatchMode(DispatchMode argMode){
if(argMode == null){
argMode = DispatchMode.SINGLE_THREAD;
}
if(argMode == DispatchMode.SINGLE_THREAD){
startBackgroundThread();
}
mode = argMode;
}
|
[
"public",
"void",
"setDispatchMode",
"(",
"DispatchMode",
"argMode",
")",
"{",
"if",
"(",
"argMode",
"==",
"null",
")",
"{",
"argMode",
"=",
"DispatchMode",
".",
"SINGLE_THREAD",
";",
"}",
"if",
"(",
"argMode",
"==",
"DispatchMode",
".",
"SINGLE_THREAD",
")",
"{",
"startBackgroundThread",
"(",
")",
";",
"}",
"mode",
"=",
"argMode",
";",
"}"
] |
Sets the dispatch mode
@see DispatchMode
@param argMode the mode to to put the tracker in. If this is null, the tracker
defaults to {@link DispatchMode#SINGLE_THREAD}
|
[
"Sets",
"the",
"dispatch",
"mode"
] |
69f68caf8e09a53e6f6076477bf05b84bc80e386
|
https://github.com/dmurph/jgoogleanalyticstracker/blob/69f68caf8e09a53e6f6076477bf05b84bc80e386/src/main/java/com/dmurph/tracking/JGoogleAnalyticsTracker.java#L135-L143
|
146,846
|
dmurph/jgoogleanalyticstracker
|
src/main/java/com/dmurph/tracking/JGoogleAnalyticsTracker.java
|
JGoogleAnalyticsTracker.makeCustomRequest
|
public synchronized void makeCustomRequest(AnalyticsRequestData argData) {
if (!enabled) {
logger.debug("Ignoring tracking request, enabled is false");
return;
}
if (argData == null) {
throw new NullPointerException("Data cannot be null");
}
if (builder == null) {
throw new NullPointerException("Class was not initialized");
}
final String url = builder.buildURL(argData);
switch(mode){
case MULTI_THREAD:
Thread t = new Thread(asyncThreadGroup, "AnalyticsThread-" + asyncThreadGroup.activeCount()) {
public void run() {
synchronized (JGoogleAnalyticsTracker.class) {
asyncThreadsRunning++;
}
try {
dispatchRequest(url);
} finally {
synchronized (JGoogleAnalyticsTracker.class) {
asyncThreadsRunning--;
}
}
}
};
t.setDaemon(true);
t.start();
break;
case SYNCHRONOUS:
dispatchRequest(url);
break;
default: // in case it's null, we default to the single-thread
synchronized (fifo) {
fifo.addLast(url);
fifo.notify();
}
if(!backgroundThreadMayRun){
logger.error("A tracker request has been added to the queue but the background thread isn't running.", url);
}
break;
}
}
|
java
|
public synchronized void makeCustomRequest(AnalyticsRequestData argData) {
if (!enabled) {
logger.debug("Ignoring tracking request, enabled is false");
return;
}
if (argData == null) {
throw new NullPointerException("Data cannot be null");
}
if (builder == null) {
throw new NullPointerException("Class was not initialized");
}
final String url = builder.buildURL(argData);
switch(mode){
case MULTI_THREAD:
Thread t = new Thread(asyncThreadGroup, "AnalyticsThread-" + asyncThreadGroup.activeCount()) {
public void run() {
synchronized (JGoogleAnalyticsTracker.class) {
asyncThreadsRunning++;
}
try {
dispatchRequest(url);
} finally {
synchronized (JGoogleAnalyticsTracker.class) {
asyncThreadsRunning--;
}
}
}
};
t.setDaemon(true);
t.start();
break;
case SYNCHRONOUS:
dispatchRequest(url);
break;
default: // in case it's null, we default to the single-thread
synchronized (fifo) {
fifo.addLast(url);
fifo.notify();
}
if(!backgroundThreadMayRun){
logger.error("A tracker request has been added to the queue but the background thread isn't running.", url);
}
break;
}
}
|
[
"public",
"synchronized",
"void",
"makeCustomRequest",
"(",
"AnalyticsRequestData",
"argData",
")",
"{",
"if",
"(",
"!",
"enabled",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Ignoring tracking request, enabled is false\"",
")",
";",
"return",
";",
"}",
"if",
"(",
"argData",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"Data cannot be null\"",
")",
";",
"}",
"if",
"(",
"builder",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"Class was not initialized\"",
")",
";",
"}",
"final",
"String",
"url",
"=",
"builder",
".",
"buildURL",
"(",
"argData",
")",
";",
"switch",
"(",
"mode",
")",
"{",
"case",
"MULTI_THREAD",
":",
"Thread",
"t",
"=",
"new",
"Thread",
"(",
"asyncThreadGroup",
",",
"\"AnalyticsThread-\"",
"+",
"asyncThreadGroup",
".",
"activeCount",
"(",
")",
")",
"{",
"public",
"void",
"run",
"(",
")",
"{",
"synchronized",
"(",
"JGoogleAnalyticsTracker",
".",
"class",
")",
"{",
"asyncThreadsRunning",
"++",
";",
"}",
"try",
"{",
"dispatchRequest",
"(",
"url",
")",
";",
"}",
"finally",
"{",
"synchronized",
"(",
"JGoogleAnalyticsTracker",
".",
"class",
")",
"{",
"asyncThreadsRunning",
"--",
";",
"}",
"}",
"}",
"}",
";",
"t",
".",
"setDaemon",
"(",
"true",
")",
";",
"t",
".",
"start",
"(",
")",
";",
"break",
";",
"case",
"SYNCHRONOUS",
":",
"dispatchRequest",
"(",
"url",
")",
";",
"break",
";",
"default",
":",
"// in case it's null, we default to the single-thread",
"synchronized",
"(",
"fifo",
")",
"{",
"fifo",
".",
"addLast",
"(",
"url",
")",
";",
"fifo",
".",
"notify",
"(",
")",
";",
"}",
"if",
"(",
"!",
"backgroundThreadMayRun",
")",
"{",
"logger",
".",
"error",
"(",
"\"A tracker request has been added to the queue but the background thread isn't running.\"",
",",
"url",
")",
";",
"}",
"break",
";",
"}",
"}"
] |
Makes a custom tracking request based from the given data.
@param argData
@throws NullPointerException
if argData is null or if the URL builder is null
|
[
"Makes",
"a",
"custom",
"tracking",
"request",
"based",
"from",
"the",
"given",
"data",
"."
] |
69f68caf8e09a53e6f6076477bf05b84bc80e386
|
https://github.com/dmurph/jgoogleanalyticstracker/blob/69f68caf8e09a53e6f6076477bf05b84bc80e386/src/main/java/com/dmurph/tracking/JGoogleAnalyticsTracker.java#L410-L455
|
146,847
|
dmurph/jgoogleanalyticstracker
|
src/main/java/com/dmurph/tracking/JGoogleAnalyticsTracker.java
|
JGoogleAnalyticsTracker.startBackgroundThread
|
private synchronized static void startBackgroundThread() {
if (backgroundThread == null) {
backgroundThreadMayRun = true;
backgroundThread = new Thread(asyncThreadGroup, "AnalyticsBackgroundThread") {
public void run() {
logger.debug("AnalyticsBackgroundThread started");
while (backgroundThreadMayRun) {
try {
String url = null;
synchronized (fifo) {
if (fifo.isEmpty()) {
fifo.wait();
}
if (!fifo.isEmpty()) {
// Get a reference to the oldest element in the FIFO, but leave it in the FIFO until it is processed.
url = fifo.getFirst();
}
}
if (url != null) {
try {
dispatchRequest(url);
} finally {
// Now that we have completed the HTTP request to GA, remove the element from the FIFO.
synchronized (fifo) {
fifo.removeFirst();
}
}
}
} catch (Exception e) {
logger.error("Got exception from dispatch thread",e);
}
}
}
};
// Don't prevent the application from terminating.
// Use completeBackgroundTasks() before exit if you want to ensure that all pending GA requests are sent.
backgroundThread.setDaemon(true);
backgroundThread.start();
}
}
|
java
|
private synchronized static void startBackgroundThread() {
if (backgroundThread == null) {
backgroundThreadMayRun = true;
backgroundThread = new Thread(asyncThreadGroup, "AnalyticsBackgroundThread") {
public void run() {
logger.debug("AnalyticsBackgroundThread started");
while (backgroundThreadMayRun) {
try {
String url = null;
synchronized (fifo) {
if (fifo.isEmpty()) {
fifo.wait();
}
if (!fifo.isEmpty()) {
// Get a reference to the oldest element in the FIFO, but leave it in the FIFO until it is processed.
url = fifo.getFirst();
}
}
if (url != null) {
try {
dispatchRequest(url);
} finally {
// Now that we have completed the HTTP request to GA, remove the element from the FIFO.
synchronized (fifo) {
fifo.removeFirst();
}
}
}
} catch (Exception e) {
logger.error("Got exception from dispatch thread",e);
}
}
}
};
// Don't prevent the application from terminating.
// Use completeBackgroundTasks() before exit if you want to ensure that all pending GA requests are sent.
backgroundThread.setDaemon(true);
backgroundThread.start();
}
}
|
[
"private",
"synchronized",
"static",
"void",
"startBackgroundThread",
"(",
")",
"{",
"if",
"(",
"backgroundThread",
"==",
"null",
")",
"{",
"backgroundThreadMayRun",
"=",
"true",
";",
"backgroundThread",
"=",
"new",
"Thread",
"(",
"asyncThreadGroup",
",",
"\"AnalyticsBackgroundThread\"",
")",
"{",
"public",
"void",
"run",
"(",
")",
"{",
"logger",
".",
"debug",
"(",
"\"AnalyticsBackgroundThread started\"",
")",
";",
"while",
"(",
"backgroundThreadMayRun",
")",
"{",
"try",
"{",
"String",
"url",
"=",
"null",
";",
"synchronized",
"(",
"fifo",
")",
"{",
"if",
"(",
"fifo",
".",
"isEmpty",
"(",
")",
")",
"{",
"fifo",
".",
"wait",
"(",
")",
";",
"}",
"if",
"(",
"!",
"fifo",
".",
"isEmpty",
"(",
")",
")",
"{",
"// Get a reference to the oldest element in the FIFO, but leave it in the FIFO until it is processed.",
"url",
"=",
"fifo",
".",
"getFirst",
"(",
")",
";",
"}",
"}",
"if",
"(",
"url",
"!=",
"null",
")",
"{",
"try",
"{",
"dispatchRequest",
"(",
"url",
")",
";",
"}",
"finally",
"{",
"// Now that we have completed the HTTP request to GA, remove the element from the FIFO.",
"synchronized",
"(",
"fifo",
")",
"{",
"fifo",
".",
"removeFirst",
"(",
")",
";",
"}",
"}",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"logger",
".",
"error",
"(",
"\"Got exception from dispatch thread\"",
",",
"e",
")",
";",
"}",
"}",
"}",
"}",
";",
"// Don't prevent the application from terminating.",
"// Use completeBackgroundTasks() before exit if you want to ensure that all pending GA requests are sent. ",
"backgroundThread",
".",
"setDaemon",
"(",
"true",
")",
";",
"backgroundThread",
".",
"start",
"(",
")",
";",
"}",
"}"
] |
If the background thread for 'queued' mode is not running, start it now.
|
[
"If",
"the",
"background",
"thread",
"for",
"queued",
"mode",
"is",
"not",
"running",
"start",
"it",
"now",
"."
] |
69f68caf8e09a53e6f6076477bf05b84bc80e386
|
https://github.com/dmurph/jgoogleanalyticstracker/blob/69f68caf8e09a53e6f6076477bf05b84bc80e386/src/main/java/com/dmurph/tracking/JGoogleAnalyticsTracker.java#L489-L533
|
146,848
|
moparisthebest/beehive
|
beehive-netui-core/src/main/java/org/apache/beehive/netui/util/internal/concurrent/ReentrantLock.java
|
ReentrantLock.lock
|
public void lock() {
boolean wasInterrupted = false;
while (true) {
try {
impl.lockInterruptibly();
if (wasInterrupted) {
Thread.currentThread().interrupt();
}
return;
}
catch (InterruptedException e) {
wasInterrupted = true;
}
}
}
|
java
|
public void lock() {
boolean wasInterrupted = false;
while (true) {
try {
impl.lockInterruptibly();
if (wasInterrupted) {
Thread.currentThread().interrupt();
}
return;
}
catch (InterruptedException e) {
wasInterrupted = true;
}
}
}
|
[
"public",
"void",
"lock",
"(",
")",
"{",
"boolean",
"wasInterrupted",
"=",
"false",
";",
"while",
"(",
"true",
")",
"{",
"try",
"{",
"impl",
".",
"lockInterruptibly",
"(",
")",
";",
"if",
"(",
"wasInterrupted",
")",
"{",
"Thread",
".",
"currentThread",
"(",
")",
".",
"interrupt",
"(",
")",
";",
"}",
"return",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"wasInterrupted",
"=",
"true",
";",
"}",
"}",
"}"
] |
Acquires the lock.
<p>Acquires the lock if it is not held by another thread and returns
immediately, setting the lock hold count to one.
<p>If the current thread
already holds the lock then the hold count is incremented by one and
the method returns immediately.
<p>If the lock is held by another thread then the
current thread becomes disabled for thread scheduling
purposes and lies dormant until the lock has been acquired,
at which time the lock hold count is set to one.
|
[
"Acquires",
"the",
"lock",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/util/internal/concurrent/ReentrantLock.java#L383-L397
|
146,849
|
moparisthebest/beehive
|
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/DefaultServletContainerAdapter.java
|
DefaultServletContainerAdapter.setContext
|
public void setContext( AdapterContext context )
{
Object servletContext = context.getExternalContext();
assert servletContext instanceof ServletContext : servletContext;
_servletContext = ( ServletContext ) servletContext;
_eventReporter = createEventReporter();
}
|
java
|
public void setContext( AdapterContext context )
{
Object servletContext = context.getExternalContext();
assert servletContext instanceof ServletContext : servletContext;
_servletContext = ( ServletContext ) servletContext;
_eventReporter = createEventReporter();
}
|
[
"public",
"void",
"setContext",
"(",
"AdapterContext",
"context",
")",
"{",
"Object",
"servletContext",
"=",
"context",
".",
"getExternalContext",
"(",
")",
";",
"assert",
"servletContext",
"instanceof",
"ServletContext",
":",
"servletContext",
";",
"_servletContext",
"=",
"(",
"ServletContext",
")",
"servletContext",
";",
"_eventReporter",
"=",
"createEventReporter",
"(",
")",
";",
"}"
] |
Set the AdapterContext.
@param context the AdapterContext to set.
|
[
"Set",
"the",
"AdapterContext",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/DefaultServletContainerAdapter.java#L221-L227
|
146,850
|
moparisthebest/beehive
|
beehive-netui-compiler/src/main/java/org/apache/beehive/netui/compiler/LocalFileEntityResolver.java
|
LocalFileEntityResolver.resolveEntity
|
public InputSource resolveEntity(String publicID, String systemID) throws SAXException, IOException {
InputSource localFileInput = resolveLocalEntity(systemID);
return localFileInput != null ? localFileInput : new InputSource(systemID);
}
|
java
|
public InputSource resolveEntity(String publicID, String systemID) throws SAXException, IOException {
InputSource localFileInput = resolveLocalEntity(systemID);
return localFileInput != null ? localFileInput : new InputSource(systemID);
}
|
[
"public",
"InputSource",
"resolveEntity",
"(",
"String",
"publicID",
",",
"String",
"systemID",
")",
"throws",
"SAXException",
",",
"IOException",
"{",
"InputSource",
"localFileInput",
"=",
"resolveLocalEntity",
"(",
"systemID",
")",
";",
"return",
"localFileInput",
"!=",
"null",
"?",
"localFileInput",
":",
"new",
"InputSource",
"(",
"systemID",
")",
";",
"}"
] |
Resolve the entity. First try to find it locally, then fallback to the network.
|
[
"Resolve",
"the",
"entity",
".",
"First",
"try",
"to",
"find",
"it",
"locally",
"then",
"fallback",
"to",
"the",
"network",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-compiler/src/main/java/org/apache/beehive/netui/compiler/LocalFileEntityResolver.java#L47-L50
|
146,851
|
moparisthebest/beehive
|
beehive-netui-compiler/src/main/java/org/apache/beehive/netui/compiler/LocalFileEntityResolver.java
|
LocalFileEntityResolver.resolveLocalEntity
|
public InputSource resolveLocalEntity(String systemID) throws SAXException, IOException {
String localFileName = systemID;
int fileNameStart = localFileName.lastIndexOf('/') + 1;
if (fileNameStart < localFileName.length()) {
localFileName = systemID.substring(fileNameStart);
}
ClassLoader cl = LocalFileEntityResolver.class.getClassLoader();
InputStream stream = cl.getResourceAsStream(RESORUCE_PATH_PREFIX + localFileName);
if (stream != null) {
return new InputSource(stream);
}
return null;
}
|
java
|
public InputSource resolveLocalEntity(String systemID) throws SAXException, IOException {
String localFileName = systemID;
int fileNameStart = localFileName.lastIndexOf('/') + 1;
if (fileNameStart < localFileName.length()) {
localFileName = systemID.substring(fileNameStart);
}
ClassLoader cl = LocalFileEntityResolver.class.getClassLoader();
InputStream stream = cl.getResourceAsStream(RESORUCE_PATH_PREFIX + localFileName);
if (stream != null) {
return new InputSource(stream);
}
return null;
}
|
[
"public",
"InputSource",
"resolveLocalEntity",
"(",
"String",
"systemID",
")",
"throws",
"SAXException",
",",
"IOException",
"{",
"String",
"localFileName",
"=",
"systemID",
";",
"int",
"fileNameStart",
"=",
"localFileName",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
"+",
"1",
";",
"if",
"(",
"fileNameStart",
"<",
"localFileName",
".",
"length",
"(",
")",
")",
"{",
"localFileName",
"=",
"systemID",
".",
"substring",
"(",
"fileNameStart",
")",
";",
"}",
"ClassLoader",
"cl",
"=",
"LocalFileEntityResolver",
".",
"class",
".",
"getClassLoader",
"(",
")",
";",
"InputStream",
"stream",
"=",
"cl",
".",
"getResourceAsStream",
"(",
"RESORUCE_PATH_PREFIX",
"+",
"localFileName",
")",
";",
"if",
"(",
"stream",
"!=",
"null",
")",
"{",
"return",
"new",
"InputSource",
"(",
"stream",
")",
";",
"}",
"return",
"null",
";",
"}"
] |
Resolve the given entity locally.
|
[
"Resolve",
"the",
"given",
"entity",
"locally",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-compiler/src/main/java/org/apache/beehive/netui/compiler/LocalFileEntityResolver.java#L55-L67
|
146,852
|
tootedom/related
|
app/domain/src/main/java/org/greencheek/related/elastic/http/ahc/AHCFactory.java
|
AHCFactory.createClient
|
public static AsyncHttpClient createClient(Configuration configuration, int numberOfHostsBeingConnectedTo) {
AsyncHttpClientConfig.Builder cf = createClientConfig(configuration);
// A Bug exists in the AsyncConnection library that leak permits on a
// Connection exception (i.e. when host not listening .. hard fail)
// So we do not enable connection tracking. Which is fine as the ring
// buffer does the job of having a single thread talking to the backend repo (ES)
// So the connection should not grow in an unmanaged way, as the ring buffer
// is restricting the connections
// cf.setMaximumConnectionsTotal(numberOfHostsBeingConnectedTo);
cf.setMaximumConnectionsTotal(-1);
cf.setMaximumConnectionsPerHost(-1);
cf.setExecutorService(getExecutorService(numberOfHostsBeingConnectedTo));
return createClient(cf);
}
|
java
|
public static AsyncHttpClient createClient(Configuration configuration, int numberOfHostsBeingConnectedTo) {
AsyncHttpClientConfig.Builder cf = createClientConfig(configuration);
// A Bug exists in the AsyncConnection library that leak permits on a
// Connection exception (i.e. when host not listening .. hard fail)
// So we do not enable connection tracking. Which is fine as the ring
// buffer does the job of having a single thread talking to the backend repo (ES)
// So the connection should not grow in an unmanaged way, as the ring buffer
// is restricting the connections
// cf.setMaximumConnectionsTotal(numberOfHostsBeingConnectedTo);
cf.setMaximumConnectionsTotal(-1);
cf.setMaximumConnectionsPerHost(-1);
cf.setExecutorService(getExecutorService(numberOfHostsBeingConnectedTo));
return createClient(cf);
}
|
[
"public",
"static",
"AsyncHttpClient",
"createClient",
"(",
"Configuration",
"configuration",
",",
"int",
"numberOfHostsBeingConnectedTo",
")",
"{",
"AsyncHttpClientConfig",
".",
"Builder",
"cf",
"=",
"createClientConfig",
"(",
"configuration",
")",
";",
"// A Bug exists in the AsyncConnection library that leak permits on a",
"// Connection exception (i.e. when host not listening .. hard fail)",
"// So we do not enable connection tracking. Which is fine as the ring",
"// buffer does the job of having a single thread talking to the backend repo (ES)",
"// So the connection should not grow in an unmanaged way, as the ring buffer",
"// is restricting the connections",
"// cf.setMaximumConnectionsTotal(numberOfHostsBeingConnectedTo);",
"cf",
".",
"setMaximumConnectionsTotal",
"(",
"-",
"1",
")",
";",
"cf",
".",
"setMaximumConnectionsPerHost",
"(",
"-",
"1",
")",
";",
"cf",
".",
"setExecutorService",
"(",
"getExecutorService",
"(",
"numberOfHostsBeingConnectedTo",
")",
")",
";",
"return",
"createClient",
"(",
"cf",
")",
";",
"}"
] |
Creates a AsyncHttpClient object that can be used for talking to elasticsearch
@param configuration The configuration object containing properties for configuring the http connections
@param numberOfHostsBeingConnectedTo the number of hosts that are currently known about in the es cluster
@return
|
[
"Creates",
"a",
"AsyncHttpClient",
"object",
"that",
"can",
"be",
"used",
"for",
"talking",
"to",
"elasticsearch"
] |
3782dd5a839bbcdc15661d598e8b895aae8aabb7
|
https://github.com/tootedom/related/blob/3782dd5a839bbcdc15661d598e8b895aae8aabb7/app/domain/src/main/java/org/greencheek/related/elastic/http/ahc/AHCFactory.java#L30-L46
|
146,853
|
moparisthebest/beehive
|
beehive-jdbc-control/src/main/java/org/apache/beehive/controls/system/jdbc/parser/ReflectionFragment.java
|
ReflectionFragment.getPreparedStatementText
|
protected String getPreparedStatementText(ControlBeanContext context, Method m, Object[] args) {
// this reflection fragment may resolve to a JdbcControl.ComplexSqlFragment
// if so it changes the behavior a bit.
Object val = getParameterValue(context, m, args);
if (val instanceof JdbcControl.ComplexSqlFragment) {
return ((JdbcControl.ComplexSqlFragment)val).getSQL();
} else {
return PREPARED_STATEMENT_SUB_MARK;
}
}
|
java
|
protected String getPreparedStatementText(ControlBeanContext context, Method m, Object[] args) {
// this reflection fragment may resolve to a JdbcControl.ComplexSqlFragment
// if so it changes the behavior a bit.
Object val = getParameterValue(context, m, args);
if (val instanceof JdbcControl.ComplexSqlFragment) {
return ((JdbcControl.ComplexSqlFragment)val).getSQL();
} else {
return PREPARED_STATEMENT_SUB_MARK;
}
}
|
[
"protected",
"String",
"getPreparedStatementText",
"(",
"ControlBeanContext",
"context",
",",
"Method",
"m",
",",
"Object",
"[",
"]",
"args",
")",
"{",
"// this reflection fragment may resolve to a JdbcControl.ComplexSqlFragment",
"// if so it changes the behavior a bit.",
"Object",
"val",
"=",
"getParameterValue",
"(",
"context",
",",
"m",
",",
"args",
")",
";",
"if",
"(",
"val",
"instanceof",
"JdbcControl",
".",
"ComplexSqlFragment",
")",
"{",
"return",
"(",
"(",
"JdbcControl",
".",
"ComplexSqlFragment",
")",
"val",
")",
".",
"getSQL",
"(",
")",
";",
"}",
"else",
"{",
"return",
"PREPARED_STATEMENT_SUB_MARK",
";",
"}",
"}"
] |
Return text generated by this fragment for a PreparedStatement
@param context A ControlBeanContext instance.
@param m The annotated method.
@param args The method's parameters
@return Always returns a PREPARED_STATEMENT_SUB_MARK
|
[
"Return",
"text",
"generated",
"by",
"this",
"fragment",
"for",
"a",
"PreparedStatement"
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-jdbc-control/src/main/java/org/apache/beehive/controls/system/jdbc/parser/ReflectionFragment.java#L81-L90
|
146,854
|
moparisthebest/beehive
|
beehive-jdbc-control/src/main/java/org/apache/beehive/controls/system/jdbc/parser/ReflectionFragment.java
|
ReflectionFragment.hasComplexValue
|
protected boolean hasComplexValue(ControlBeanContext context, Method m, Object[] args) {
Object val = getParameterValue(context, m, args);
return val instanceof JdbcControl.ComplexSqlFragment;
}
|
java
|
protected boolean hasComplexValue(ControlBeanContext context, Method m, Object[] args) {
Object val = getParameterValue(context, m, args);
return val instanceof JdbcControl.ComplexSqlFragment;
}
|
[
"protected",
"boolean",
"hasComplexValue",
"(",
"ControlBeanContext",
"context",
",",
"Method",
"m",
",",
"Object",
"[",
"]",
"args",
")",
"{",
"Object",
"val",
"=",
"getParameterValue",
"(",
"context",
",",
"m",
",",
"args",
")",
";",
"return",
"val",
"instanceof",
"JdbcControl",
".",
"ComplexSqlFragment",
";",
"}"
] |
A reflection fragment may evaluate to an JdbcControl.ComplexSqlFragment type,
which requires additional steps to evaluate after reflection.
@param context Control bean context.
@param m Method.
@param args Method args.
@return true or false.
|
[
"A",
"reflection",
"fragment",
"may",
"evaluate",
"to",
"an",
"JdbcControl",
".",
"ComplexSqlFragment",
"type",
"which",
"requires",
"additional",
"steps",
"to",
"evaluate",
"after",
"reflection",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-jdbc-control/src/main/java/org/apache/beehive/controls/system/jdbc/parser/ReflectionFragment.java#L101-L104
|
146,855
|
moparisthebest/beehive
|
beehive-jdbc-control/src/main/java/org/apache/beehive/controls/system/jdbc/parser/ReflectionFragment.java
|
ReflectionFragment.getParameterNameQualifiers
|
protected String[] getParameterNameQualifiers() {
String[] nameQualifiersCopy = new String[_nameQualifiers.length];
System.arraycopy(_nameQualifiers, 0, nameQualifiersCopy, 0, _nameQualifiers.length);
return nameQualifiersCopy;
}
|
java
|
protected String[] getParameterNameQualifiers() {
String[] nameQualifiersCopy = new String[_nameQualifiers.length];
System.arraycopy(_nameQualifiers, 0, nameQualifiersCopy, 0, _nameQualifiers.length);
return nameQualifiersCopy;
}
|
[
"protected",
"String",
"[",
"]",
"getParameterNameQualifiers",
"(",
")",
"{",
"String",
"[",
"]",
"nameQualifiersCopy",
"=",
"new",
"String",
"[",
"_nameQualifiers",
".",
"length",
"]",
";",
"System",
".",
"arraycopy",
"(",
"_nameQualifiers",
",",
"0",
",",
"nameQualifiersCopy",
",",
"0",
",",
"_nameQualifiers",
".",
"length",
")",
";",
"return",
"nameQualifiersCopy",
";",
"}"
] |
Get a copy of the array of parameter name qualifiers.
@return An array of parameter name qualifiers.
|
[
"Get",
"a",
"copy",
"of",
"the",
"array",
"of",
"parameter",
"name",
"qualifiers",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-jdbc-control/src/main/java/org/apache/beehive/controls/system/jdbc/parser/ReflectionFragment.java#L125-L129
|
146,856
|
moparisthebest/beehive
|
beehive-jdbc-control/src/main/java/org/apache/beehive/controls/system/jdbc/parser/ReflectionFragment.java
|
ReflectionFragment.getParameterValues
|
protected Object[] getParameterValues(ControlBeanContext context, Method method, Object[] args) {
Object value = getParameterValue(context, method, args);
if (value instanceof JdbcControl.ComplexSqlFragment) {
JdbcControl.SQLParameter[] params = ((JdbcControl.ComplexSqlFragment)value).getParameters();
Object[] values = new Object[params.length];
for (int i = 0; i < params.length; i++) {
values[i] = params[i].value;
}
return values;
}
return new Object[]{value};
}
|
java
|
protected Object[] getParameterValues(ControlBeanContext context, Method method, Object[] args) {
Object value = getParameterValue(context, method, args);
if (value instanceof JdbcControl.ComplexSqlFragment) {
JdbcControl.SQLParameter[] params = ((JdbcControl.ComplexSqlFragment)value).getParameters();
Object[] values = new Object[params.length];
for (int i = 0; i < params.length; i++) {
values[i] = params[i].value;
}
return values;
}
return new Object[]{value};
}
|
[
"protected",
"Object",
"[",
"]",
"getParameterValues",
"(",
"ControlBeanContext",
"context",
",",
"Method",
"method",
",",
"Object",
"[",
"]",
"args",
")",
"{",
"Object",
"value",
"=",
"getParameterValue",
"(",
"context",
",",
"method",
",",
"args",
")",
";",
"if",
"(",
"value",
"instanceof",
"JdbcControl",
".",
"ComplexSqlFragment",
")",
"{",
"JdbcControl",
".",
"SQLParameter",
"[",
"]",
"params",
"=",
"(",
"(",
"JdbcControl",
".",
"ComplexSqlFragment",
")",
"value",
")",
".",
"getParameters",
"(",
")",
";",
"Object",
"[",
"]",
"values",
"=",
"new",
"Object",
"[",
"params",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"params",
".",
"length",
";",
"i",
"++",
")",
"{",
"values",
"[",
"i",
"]",
"=",
"params",
"[",
"i",
"]",
".",
"value",
";",
"}",
"return",
"values",
";",
"}",
"return",
"new",
"Object",
"[",
"]",
"{",
"value",
"}",
";",
"}"
] |
Get the value of this parameter.
@param context ControlBeanContext instance to evaluate the parameter's value against.
@param method Method instance to evaluate against.
@param args Method argument values
@return All parameter object values contained within this fragment
|
[
"Get",
"the",
"value",
"of",
"this",
"parameter",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-jdbc-control/src/main/java/org/apache/beehive/controls/system/jdbc/parser/ReflectionFragment.java#L153-L165
|
146,857
|
moparisthebest/beehive
|
beehive-jdbc-control/src/main/java/org/apache/beehive/controls/system/jdbc/parser/ReflectionFragment.java
|
ReflectionFragment.getParameterValue
|
private Object getParameterValue(ControlBeanContext context, Method method, Object[] args) {
Object value;
try {
value = context.getParameterValue(method, _nameQualifiers[0], args);
} catch (IllegalArgumentException iae) {
throw new ControlException("Invalid argument name in SQL statement: " + _nameQualifiers[0], iae);
}
for (int i = 1; i < _nameQualifiers.length; i++) {
// handle maps, properties, and fields...
value = extractValue(value, _nameQualifiers[i - 1], _nameQualifiers[i]);
}
return value;
}
|
java
|
private Object getParameterValue(ControlBeanContext context, Method method, Object[] args) {
Object value;
try {
value = context.getParameterValue(method, _nameQualifiers[0], args);
} catch (IllegalArgumentException iae) {
throw new ControlException("Invalid argument name in SQL statement: " + _nameQualifiers[0], iae);
}
for (int i = 1; i < _nameQualifiers.length; i++) {
// handle maps, properties, and fields...
value = extractValue(value, _nameQualifiers[i - 1], _nameQualifiers[i]);
}
return value;
}
|
[
"private",
"Object",
"getParameterValue",
"(",
"ControlBeanContext",
"context",
",",
"Method",
"method",
",",
"Object",
"[",
"]",
"args",
")",
"{",
"Object",
"value",
";",
"try",
"{",
"value",
"=",
"context",
".",
"getParameterValue",
"(",
"method",
",",
"_nameQualifiers",
"[",
"0",
"]",
",",
"args",
")",
";",
"}",
"catch",
"(",
"IllegalArgumentException",
"iae",
")",
"{",
"throw",
"new",
"ControlException",
"(",
"\"Invalid argument name in SQL statement: \"",
"+",
"_nameQualifiers",
"[",
"0",
"]",
",",
"iae",
")",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<",
"_nameQualifiers",
".",
"length",
";",
"i",
"++",
")",
"{",
"// handle maps, properties, and fields...",
"value",
"=",
"extractValue",
"(",
"value",
",",
"_nameQualifiers",
"[",
"i",
"-",
"1",
"]",
",",
"_nameQualifiers",
"[",
"i",
"]",
")",
";",
"}",
"return",
"value",
";",
"}"
] |
Get the value from the method param.
@param method
@param args
@return Value of reflected method param.
|
[
"Get",
"the",
"value",
"from",
"the",
"method",
"param",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-jdbc-control/src/main/java/org/apache/beehive/controls/system/jdbc/parser/ReflectionFragment.java#L177-L190
|
146,858
|
moparisthebest/beehive
|
beehive-jdbc-control/src/main/java/org/apache/beehive/controls/system/jdbc/parser/ReflectionFragment.java
|
ReflectionFragment.extractValue
|
private Object extractValue(Object aValue, String aName, String bName) {
Class aClass = aValue.getClass();
Object value;
//
// a.isB() or a.getB()
//
String bNameCapped = Character.toUpperCase(bName.charAt(0)) + bName.substring(1);
Method getMethod = null;
Class retType;
//
// try a.isB() first, if found verify that a.isB() returns a boolean value,
// and that there is not also a a.getB() method - if there is except
//
try {
getMethod = aClass.getMethod("is" + bNameCapped, (Class[]) null);
retType = getMethod.getReturnType();
if (!(retType.equals(Boolean.class) ||
retType.equals(Boolean.TYPE))) {
// only boolean returns can be isB()
getMethod = null;
} else {
/**
* make sure ("get" + bNameCapped) does not exist as well
* see CR216159
*/
boolean getMethodFound = true;
try {
aClass.getMethod("get" + bNameCapped, (Class[])null);
} catch (NoSuchMethodException e) {
getMethodFound = false;
}
if (getMethodFound) {
throw new ControlException("Colliding field accsessors in user defined class '"
+ aClass.getName() + "' for field '" + bName
+ "'. Please use is<FieldName> for boolean fields and get<FieldName> name for other datatypes.");
}
}
} catch (NoSuchMethodException e) {
// ignore
}
//
// try a.getB() if a.isB() was not found.
//
if (getMethod == null) {
try {
getMethod = aClass.getMethod("get" + bNameCapped, (Class[])null);
} catch (NoSuchMethodException e) {
// ignore
}
}
if (getMethod != null) {
// OK- a.getB()
try {
value = getMethod.invoke(aValue, (Object[]) null);
} catch (IllegalAccessException e) {
throw new ControlException("Unable to access public method: " + e.toString());
} catch (java.lang.reflect.InvocationTargetException e) {
throw new ControlException("Exception thrown when executing : " + getMethod.getName() + "() to use as parameter");
}
return value;
}
//
// try a.b
//
try {
value = aClass.getField(bName).get(aValue);
return value;
} catch (NoSuchFieldException e) {
// ignore
} catch (IllegalAccessException e) {
// ignore
}
//
// try a.get(b)
//
if (aValue instanceof Map) {
try {
value = TypeMappingsFactory.getInstance().lookupType(aValue, new Object[]{bName});
return value;
} catch (Exception mapex) {
throw new ControlException("Exception thrown when executing Map.get() to resolve parameter" + mapex.toString());
}
}
// no other options...
throw new ControlException("Illegal argument in SQL statement: " + _parameterName
+ "; unable to find suitable method of retrieving property " + bName
+ " out of object " + aName + ".");
}
|
java
|
private Object extractValue(Object aValue, String aName, String bName) {
Class aClass = aValue.getClass();
Object value;
//
// a.isB() or a.getB()
//
String bNameCapped = Character.toUpperCase(bName.charAt(0)) + bName.substring(1);
Method getMethod = null;
Class retType;
//
// try a.isB() first, if found verify that a.isB() returns a boolean value,
// and that there is not also a a.getB() method - if there is except
//
try {
getMethod = aClass.getMethod("is" + bNameCapped, (Class[]) null);
retType = getMethod.getReturnType();
if (!(retType.equals(Boolean.class) ||
retType.equals(Boolean.TYPE))) {
// only boolean returns can be isB()
getMethod = null;
} else {
/**
* make sure ("get" + bNameCapped) does not exist as well
* see CR216159
*/
boolean getMethodFound = true;
try {
aClass.getMethod("get" + bNameCapped, (Class[])null);
} catch (NoSuchMethodException e) {
getMethodFound = false;
}
if (getMethodFound) {
throw new ControlException("Colliding field accsessors in user defined class '"
+ aClass.getName() + "' for field '" + bName
+ "'. Please use is<FieldName> for boolean fields and get<FieldName> name for other datatypes.");
}
}
} catch (NoSuchMethodException e) {
// ignore
}
//
// try a.getB() if a.isB() was not found.
//
if (getMethod == null) {
try {
getMethod = aClass.getMethod("get" + bNameCapped, (Class[])null);
} catch (NoSuchMethodException e) {
// ignore
}
}
if (getMethod != null) {
// OK- a.getB()
try {
value = getMethod.invoke(aValue, (Object[]) null);
} catch (IllegalAccessException e) {
throw new ControlException("Unable to access public method: " + e.toString());
} catch (java.lang.reflect.InvocationTargetException e) {
throw new ControlException("Exception thrown when executing : " + getMethod.getName() + "() to use as parameter");
}
return value;
}
//
// try a.b
//
try {
value = aClass.getField(bName).get(aValue);
return value;
} catch (NoSuchFieldException e) {
// ignore
} catch (IllegalAccessException e) {
// ignore
}
//
// try a.get(b)
//
if (aValue instanceof Map) {
try {
value = TypeMappingsFactory.getInstance().lookupType(aValue, new Object[]{bName});
return value;
} catch (Exception mapex) {
throw new ControlException("Exception thrown when executing Map.get() to resolve parameter" + mapex.toString());
}
}
// no other options...
throw new ControlException("Illegal argument in SQL statement: " + _parameterName
+ "; unable to find suitable method of retrieving property " + bName
+ " out of object " + aName + ".");
}
|
[
"private",
"Object",
"extractValue",
"(",
"Object",
"aValue",
",",
"String",
"aName",
",",
"String",
"bName",
")",
"{",
"Class",
"aClass",
"=",
"aValue",
".",
"getClass",
"(",
")",
";",
"Object",
"value",
";",
"//",
"// a.isB() or a.getB()",
"//",
"String",
"bNameCapped",
"=",
"Character",
".",
"toUpperCase",
"(",
"bName",
".",
"charAt",
"(",
"0",
")",
")",
"+",
"bName",
".",
"substring",
"(",
"1",
")",
";",
"Method",
"getMethod",
"=",
"null",
";",
"Class",
"retType",
";",
"//",
"// try a.isB() first, if found verify that a.isB() returns a boolean value,",
"// and that there is not also a a.getB() method - if there is except",
"//",
"try",
"{",
"getMethod",
"=",
"aClass",
".",
"getMethod",
"(",
"\"is\"",
"+",
"bNameCapped",
",",
"(",
"Class",
"[",
"]",
")",
"null",
")",
";",
"retType",
"=",
"getMethod",
".",
"getReturnType",
"(",
")",
";",
"if",
"(",
"!",
"(",
"retType",
".",
"equals",
"(",
"Boolean",
".",
"class",
")",
"||",
"retType",
".",
"equals",
"(",
"Boolean",
".",
"TYPE",
")",
")",
")",
"{",
"// only boolean returns can be isB()",
"getMethod",
"=",
"null",
";",
"}",
"else",
"{",
"/**\n * make sure (\"get\" + bNameCapped) does not exist as well\n * see CR216159\n */",
"boolean",
"getMethodFound",
"=",
"true",
";",
"try",
"{",
"aClass",
".",
"getMethod",
"(",
"\"get\"",
"+",
"bNameCapped",
",",
"(",
"Class",
"[",
"]",
")",
"null",
")",
";",
"}",
"catch",
"(",
"NoSuchMethodException",
"e",
")",
"{",
"getMethodFound",
"=",
"false",
";",
"}",
"if",
"(",
"getMethodFound",
")",
"{",
"throw",
"new",
"ControlException",
"(",
"\"Colliding field accsessors in user defined class '\"",
"+",
"aClass",
".",
"getName",
"(",
")",
"+",
"\"' for field '\"",
"+",
"bName",
"+",
"\"'. Please use is<FieldName> for boolean fields and get<FieldName> name for other datatypes.\"",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"NoSuchMethodException",
"e",
")",
"{",
"// ignore",
"}",
"//",
"// try a.getB() if a.isB() was not found.",
"//",
"if",
"(",
"getMethod",
"==",
"null",
")",
"{",
"try",
"{",
"getMethod",
"=",
"aClass",
".",
"getMethod",
"(",
"\"get\"",
"+",
"bNameCapped",
",",
"(",
"Class",
"[",
"]",
")",
"null",
")",
";",
"}",
"catch",
"(",
"NoSuchMethodException",
"e",
")",
"{",
"// ignore",
"}",
"}",
"if",
"(",
"getMethod",
"!=",
"null",
")",
"{",
"// OK- a.getB()",
"try",
"{",
"value",
"=",
"getMethod",
".",
"invoke",
"(",
"aValue",
",",
"(",
"Object",
"[",
"]",
")",
"null",
")",
";",
"}",
"catch",
"(",
"IllegalAccessException",
"e",
")",
"{",
"throw",
"new",
"ControlException",
"(",
"\"Unable to access public method: \"",
"+",
"e",
".",
"toString",
"(",
")",
")",
";",
"}",
"catch",
"(",
"java",
".",
"lang",
".",
"reflect",
".",
"InvocationTargetException",
"e",
")",
"{",
"throw",
"new",
"ControlException",
"(",
"\"Exception thrown when executing : \"",
"+",
"getMethod",
".",
"getName",
"(",
")",
"+",
"\"() to use as parameter\"",
")",
";",
"}",
"return",
"value",
";",
"}",
"//",
"// try a.b",
"//",
"try",
"{",
"value",
"=",
"aClass",
".",
"getField",
"(",
"bName",
")",
".",
"get",
"(",
"aValue",
")",
";",
"return",
"value",
";",
"}",
"catch",
"(",
"NoSuchFieldException",
"e",
")",
"{",
"// ignore",
"}",
"catch",
"(",
"IllegalAccessException",
"e",
")",
"{",
"// ignore",
"}",
"//",
"// try a.get(b)",
"//",
"if",
"(",
"aValue",
"instanceof",
"Map",
")",
"{",
"try",
"{",
"value",
"=",
"TypeMappingsFactory",
".",
"getInstance",
"(",
")",
".",
"lookupType",
"(",
"aValue",
",",
"new",
"Object",
"[",
"]",
"{",
"bName",
"}",
")",
";",
"return",
"value",
";",
"}",
"catch",
"(",
"Exception",
"mapex",
")",
"{",
"throw",
"new",
"ControlException",
"(",
"\"Exception thrown when executing Map.get() to resolve parameter\"",
"+",
"mapex",
".",
"toString",
"(",
")",
")",
";",
"}",
"}",
"// no other options...",
"throw",
"new",
"ControlException",
"(",
"\"Illegal argument in SQL statement: \"",
"+",
"_parameterName",
"+",
"\"; unable to find suitable method of retrieving property \"",
"+",
"bName",
"+",
"\" out of object \"",
"+",
"aName",
"+",
"\".\"",
")",
";",
"}"
] |
Get the value from the referenced method parameter using java reflection
@param aValue
@param aName
@param bName
@return The value
|
[
"Get",
"the",
"value",
"from",
"the",
"referenced",
"method",
"parameter",
"using",
"java",
"reflection"
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-jdbc-control/src/main/java/org/apache/beehive/controls/system/jdbc/parser/ReflectionFragment.java#L200-L299
|
146,859
|
moparisthebest/beehive
|
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptType.java
|
AptType.isPrivateMethod
|
protected boolean isPrivateMethod(MethodDeclaration md)
{
Collection<Modifier> modifiers = md.getModifiers();
for (Modifier m : modifiers)
{
if (m.compareTo(Modifier.PRIVATE) == 0)
return true;
}
return false;
}
|
java
|
protected boolean isPrivateMethod(MethodDeclaration md)
{
Collection<Modifier> modifiers = md.getModifiers();
for (Modifier m : modifiers)
{
if (m.compareTo(Modifier.PRIVATE) == 0)
return true;
}
return false;
}
|
[
"protected",
"boolean",
"isPrivateMethod",
"(",
"MethodDeclaration",
"md",
")",
"{",
"Collection",
"<",
"Modifier",
">",
"modifiers",
"=",
"md",
".",
"getModifiers",
"(",
")",
";",
"for",
"(",
"Modifier",
"m",
":",
"modifiers",
")",
"{",
"if",
"(",
"m",
".",
"compareTo",
"(",
"Modifier",
".",
"PRIVATE",
")",
"==",
"0",
")",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] |
Checks a MethodDeclaration for a 'private' modifier.
@param md MethodDeclaration to check.
@return true if private modifier is present.
|
[
"Checks",
"a",
"MethodDeclaration",
"for",
"a",
"private",
"modifier",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptType.java#L48-L57
|
146,860
|
moparisthebest/beehive
|
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptType.java
|
AptType.getFormalTypeParameters
|
private String getFormalTypeParameters(boolean namesOnly)
{
Collection<TypeParameterDeclaration> ftColl = _typeDecl.getFormalTypeParameters();
if (ftColl.size() == 0)
return "";
StringBuffer sb = new StringBuffer("<");
boolean isFirst = true;
for (TypeParameterDeclaration tpDecl : ftColl)
{
if (!isFirst)
sb.append(",");
else
isFirst = false;
if (namesOnly)
sb.append(tpDecl.getSimpleName());
else
sb.append(tpDecl.toString());
}
sb.append(">");
return sb.toString();
}
|
java
|
private String getFormalTypeParameters(boolean namesOnly)
{
Collection<TypeParameterDeclaration> ftColl = _typeDecl.getFormalTypeParameters();
if (ftColl.size() == 0)
return "";
StringBuffer sb = new StringBuffer("<");
boolean isFirst = true;
for (TypeParameterDeclaration tpDecl : ftColl)
{
if (!isFirst)
sb.append(",");
else
isFirst = false;
if (namesOnly)
sb.append(tpDecl.getSimpleName());
else
sb.append(tpDecl.toString());
}
sb.append(">");
return sb.toString();
}
|
[
"private",
"String",
"getFormalTypeParameters",
"(",
"boolean",
"namesOnly",
")",
"{",
"Collection",
"<",
"TypeParameterDeclaration",
">",
"ftColl",
"=",
"_typeDecl",
".",
"getFormalTypeParameters",
"(",
")",
";",
"if",
"(",
"ftColl",
".",
"size",
"(",
")",
"==",
"0",
")",
"return",
"\"\"",
";",
"StringBuffer",
"sb",
"=",
"new",
"StringBuffer",
"(",
"\"<\"",
")",
";",
"boolean",
"isFirst",
"=",
"true",
";",
"for",
"(",
"TypeParameterDeclaration",
"tpDecl",
":",
"ftColl",
")",
"{",
"if",
"(",
"!",
"isFirst",
")",
"sb",
".",
"append",
"(",
"\",\"",
")",
";",
"else",
"isFirst",
"=",
"false",
";",
"if",
"(",
"namesOnly",
")",
"sb",
".",
"append",
"(",
"tpDecl",
".",
"getSimpleName",
"(",
")",
")",
";",
"else",
"sb",
".",
"append",
"(",
"tpDecl",
".",
"toString",
"(",
")",
")",
";",
"}",
"sb",
".",
"append",
"(",
"\">\"",
")",
";",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}"
] |
Helper method to return type parameter information
|
[
"Helper",
"method",
"to",
"return",
"type",
"parameter",
"information"
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptType.java#L95-L117
|
146,861
|
iig-uni-freiburg/SEWOL
|
src/de/uni/freiburg/iig/telematik/sewol/log/DULogEntry.java
|
DULogEntry.removeDataAttribute
|
public boolean removeDataAttribute(DataAttribute attribute) throws LockingException {
if (isFieldLocked(EntryField.DATA)) {
if (dataUsage.containsKey(attribute)) {
throw new LockingException(EntryField.DATA);
}
return false;
} else {
return dataUsage.remove(attribute) != null;
}
}
|
java
|
public boolean removeDataAttribute(DataAttribute attribute) throws LockingException {
if (isFieldLocked(EntryField.DATA)) {
if (dataUsage.containsKey(attribute)) {
throw new LockingException(EntryField.DATA);
}
return false;
} else {
return dataUsage.remove(attribute) != null;
}
}
|
[
"public",
"boolean",
"removeDataAttribute",
"(",
"DataAttribute",
"attribute",
")",
"throws",
"LockingException",
"{",
"if",
"(",
"isFieldLocked",
"(",
"EntryField",
".",
"DATA",
")",
")",
"{",
"if",
"(",
"dataUsage",
".",
"containsKey",
"(",
"attribute",
")",
")",
"{",
"throw",
"new",
"LockingException",
"(",
"EntryField",
".",
"DATA",
")",
";",
"}",
"return",
"false",
";",
"}",
"else",
"{",
"return",
"dataUsage",
".",
"remove",
"(",
"attribute",
")",
"!=",
"null",
";",
"}",
"}"
] |
Removes the given attribute from the set of managed attributes.
@param attribute Attribute to remove.
@return if the set of managed attributes was modified;<br>
<code>false</code> otherwise.
@throws LockingException if the corresponding field is locked <br>
and the given attribute is not already contained in the set of
managed attributes.
|
[
"Removes",
"the",
"given",
"attribute",
"from",
"the",
"set",
"of",
"managed",
"attributes",
"."
] |
e791cb07a6e62ecf837d760d58a25f32fbf6bbca
|
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/src/de/uni/freiburg/iig/telematik/sewol/log/DULogEntry.java#L71-L80
|
146,862
|
iig-uni-freiburg/SEWOL
|
src/de/uni/freiburg/iig/telematik/sewol/log/DULogEntry.java
|
DULogEntry.setDataUsage
|
public boolean setDataUsage(Map<DataAttribute, Set<DataUsage>> dataUsage) throws ParameterException, LockingException {
Validate.notNull(dataUsage);
Validate.notEmpty(dataUsage.keySet());
Validate.noNullElements(dataUsage.keySet());
Validate.noNullElements(dataUsage.values());
if (isFieldLocked(EntryField.DATA)) {
if (!this.dataUsage.equals(dataUsage)) {
throw new LockingException(EntryField.DATA);
}
return false;
} else {
this.dataUsage = dataUsage;
return true;
}
}
|
java
|
public boolean setDataUsage(Map<DataAttribute, Set<DataUsage>> dataUsage) throws ParameterException, LockingException {
Validate.notNull(dataUsage);
Validate.notEmpty(dataUsage.keySet());
Validate.noNullElements(dataUsage.keySet());
Validate.noNullElements(dataUsage.values());
if (isFieldLocked(EntryField.DATA)) {
if (!this.dataUsage.equals(dataUsage)) {
throw new LockingException(EntryField.DATA);
}
return false;
} else {
this.dataUsage = dataUsage;
return true;
}
}
|
[
"public",
"boolean",
"setDataUsage",
"(",
"Map",
"<",
"DataAttribute",
",",
"Set",
"<",
"DataUsage",
">",
">",
"dataUsage",
")",
"throws",
"ParameterException",
",",
"LockingException",
"{",
"Validate",
".",
"notNull",
"(",
"dataUsage",
")",
";",
"Validate",
".",
"notEmpty",
"(",
"dataUsage",
".",
"keySet",
"(",
")",
")",
";",
"Validate",
".",
"noNullElements",
"(",
"dataUsage",
".",
"keySet",
"(",
")",
")",
";",
"Validate",
".",
"noNullElements",
"(",
"dataUsage",
".",
"values",
"(",
")",
")",
";",
"if",
"(",
"isFieldLocked",
"(",
"EntryField",
".",
"DATA",
")",
")",
"{",
"if",
"(",
"!",
"this",
".",
"dataUsage",
".",
"equals",
"(",
"dataUsage",
")",
")",
"{",
"throw",
"new",
"LockingException",
"(",
"EntryField",
".",
"DATA",
")",
";",
"}",
"return",
"false",
";",
"}",
"else",
"{",
"this",
".",
"dataUsage",
"=",
"dataUsage",
";",
"return",
"true",
";",
"}",
"}"
] |
Sets the given data usage as data usage for this entry.
@param dataUsage The data usage to adopt.
@return <code>true</code> if the current data usage was modified;<br>
<code>false</code> otherwise.
@throws ParameterException if the given data usage is invalid
(<code>null</code> or empty).
@throws LockingException if the corresponding field is locked <br>
and the given data usage is not the same than the current one.
|
[
"Sets",
"the",
"given",
"data",
"usage",
"as",
"data",
"usage",
"for",
"this",
"entry",
"."
] |
e791cb07a6e62ecf837d760d58a25f32fbf6bbca
|
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/src/de/uni/freiburg/iig/telematik/sewol/log/DULogEntry.java#L93-L108
|
146,863
|
iig-uni-freiburg/SEWOL
|
src/de/uni/freiburg/iig/telematik/sewol/log/DULogEntry.java
|
DULogEntry.setDataUsageFor
|
public boolean setDataUsageFor(DataAttribute attribute, Set<DataUsage> dataUsage) throws ParameterException, LockingException {
Validate.notNull(attribute);
Validate.notNull(dataUsage);
Validate.notEmpty(dataUsage);
if (isFieldLocked(EntryField.DATA)) {
if (!(this.dataUsage.containsKey(attribute) && this.dataUsage.get(attribute).equals(dataUsage))) {
throw new LockingException(EntryField.DATA);
}
return false;
} else {
this.dataUsage.put(attribute, dataUsage);
return true;
}
}
|
java
|
public boolean setDataUsageFor(DataAttribute attribute, Set<DataUsage> dataUsage) throws ParameterException, LockingException {
Validate.notNull(attribute);
Validate.notNull(dataUsage);
Validate.notEmpty(dataUsage);
if (isFieldLocked(EntryField.DATA)) {
if (!(this.dataUsage.containsKey(attribute) && this.dataUsage.get(attribute).equals(dataUsage))) {
throw new LockingException(EntryField.DATA);
}
return false;
} else {
this.dataUsage.put(attribute, dataUsage);
return true;
}
}
|
[
"public",
"boolean",
"setDataUsageFor",
"(",
"DataAttribute",
"attribute",
",",
"Set",
"<",
"DataUsage",
">",
"dataUsage",
")",
"throws",
"ParameterException",
",",
"LockingException",
"{",
"Validate",
".",
"notNull",
"(",
"attribute",
")",
";",
"Validate",
".",
"notNull",
"(",
"dataUsage",
")",
";",
"Validate",
".",
"notEmpty",
"(",
"dataUsage",
")",
";",
"if",
"(",
"isFieldLocked",
"(",
"EntryField",
".",
"DATA",
")",
")",
"{",
"if",
"(",
"!",
"(",
"this",
".",
"dataUsage",
".",
"containsKey",
"(",
"attribute",
")",
"&&",
"this",
".",
"dataUsage",
".",
"get",
"(",
"attribute",
")",
".",
"equals",
"(",
"dataUsage",
")",
")",
")",
"{",
"throw",
"new",
"LockingException",
"(",
"EntryField",
".",
"DATA",
")",
";",
"}",
"return",
"false",
";",
"}",
"else",
"{",
"this",
".",
"dataUsage",
".",
"put",
"(",
"attribute",
",",
"dataUsage",
")",
";",
"return",
"true",
";",
"}",
"}"
] |
Sets the data usage for a given attribute.
@param attribute The attribute (data element) for which the usage is
specified.
@param dataUsage The usage of the data element specified by the given
attribute.
@return <code>true</code> if the data usage for the given attribute
was modified;<br>
<code>false</code> otherwise.
@throws ParameterException if the given attribute is
<code>null</code> or data usage is invalid (<code>null</code> or
empty).
@throws LockingException if the corresponding field is locked <br>
and the given data usage is not identical to the current one.
|
[
"Sets",
"the",
"data",
"usage",
"for",
"a",
"given",
"attribute",
"."
] |
e791cb07a6e62ecf837d760d58a25f32fbf6bbca
|
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/src/de/uni/freiburg/iig/telematik/sewol/log/DULogEntry.java#L126-L140
|
146,864
|
iig-uni-freiburg/SEWOL
|
src/de/uni/freiburg/iig/telematik/sewol/log/DULogEntry.java
|
DULogEntry.addDataUsage
|
public boolean addDataUsage(DataAttribute attribute, DataUsage usage) throws ParameterException, LockingException {
Validate.notNull(attribute);
if (isFieldLocked(EntryField.DATA)) {
if (!dataUsage.containsKey(attribute)) {
throw new LockingException(EntryField.DATA);
}
return false;
} else {
if (dataUsage.get(attribute) == null) {
dataUsage.put(attribute, new HashSet<>());
}
if (usage != null) {
dataUsage.get(attribute).add(usage);
}
return true;
}
}
|
java
|
public boolean addDataUsage(DataAttribute attribute, DataUsage usage) throws ParameterException, LockingException {
Validate.notNull(attribute);
if (isFieldLocked(EntryField.DATA)) {
if (!dataUsage.containsKey(attribute)) {
throw new LockingException(EntryField.DATA);
}
return false;
} else {
if (dataUsage.get(attribute) == null) {
dataUsage.put(attribute, new HashSet<>());
}
if (usage != null) {
dataUsage.get(attribute).add(usage);
}
return true;
}
}
|
[
"public",
"boolean",
"addDataUsage",
"(",
"DataAttribute",
"attribute",
",",
"DataUsage",
"usage",
")",
"throws",
"ParameterException",
",",
"LockingException",
"{",
"Validate",
".",
"notNull",
"(",
"attribute",
")",
";",
"if",
"(",
"isFieldLocked",
"(",
"EntryField",
".",
"DATA",
")",
")",
"{",
"if",
"(",
"!",
"dataUsage",
".",
"containsKey",
"(",
"attribute",
")",
")",
"{",
"throw",
"new",
"LockingException",
"(",
"EntryField",
".",
"DATA",
")",
";",
"}",
"return",
"false",
";",
"}",
"else",
"{",
"if",
"(",
"dataUsage",
".",
"get",
"(",
"attribute",
")",
"==",
"null",
")",
"{",
"dataUsage",
".",
"put",
"(",
"attribute",
",",
"new",
"HashSet",
"<>",
"(",
")",
")",
";",
"}",
"if",
"(",
"usage",
"!=",
"null",
")",
"{",
"dataUsage",
".",
"get",
"(",
"attribute",
")",
".",
"add",
"(",
"usage",
")",
";",
"}",
"return",
"true",
";",
"}",
"}"
] |
Adds the given attribute to the list of attributes
@param attribute The attribute to add.
@param usage The data usage
@throws ParameterException if the given attribute or usage is
<code>null</code>.
@throws LockingException if the field INPUT_DATA is locked <br>
and the attribute is not already contained in {@link #dataUsage}.
@return <code>true</code> if {@link #dataUsage} was modified;<br>
<code>false</code> otherwise.
|
[
"Adds",
"the",
"given",
"attribute",
"to",
"the",
"list",
"of",
"attributes"
] |
e791cb07a6e62ecf837d760d58a25f32fbf6bbca
|
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/src/de/uni/freiburg/iig/telematik/sewol/log/DULogEntry.java#L154-L171
|
146,865
|
moparisthebest/beehive
|
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptMethodSet.java
|
AptMethodSet.add
|
public void add(T method)
{
// check for overridden method
if (isOverrideMethod(method)) {
return;
}
// Add to the list of managed methods
_methods.put(method.getName() + method.getArgTypes(), method);
// Ensure that all added methods have a unique index
Object nameValue = _nameMap.get(method.getName());
if (nameValue == null)
{
// first method with this name, considered unique (for now)
_nameMap.put(method.getName(), method);
}
else
{
int nextIndex;
if (nameValue instanceof AptMethod)
{
// 2nd method with this name, add index to original and start indexing
((AptMethod)nameValue).setIndex(0);
nextIndex = 1;
}
else
{
// 3rd (or later) method with this name, continue indexing
nextIndex = ((Integer)nameValue).intValue();
}
method.setIndex(nextIndex++);
_nameMap.put(method.getName(), nextIndex);
}
}
|
java
|
public void add(T method)
{
// check for overridden method
if (isOverrideMethod(method)) {
return;
}
// Add to the list of managed methods
_methods.put(method.getName() + method.getArgTypes(), method);
// Ensure that all added methods have a unique index
Object nameValue = _nameMap.get(method.getName());
if (nameValue == null)
{
// first method with this name, considered unique (for now)
_nameMap.put(method.getName(), method);
}
else
{
int nextIndex;
if (nameValue instanceof AptMethod)
{
// 2nd method with this name, add index to original and start indexing
((AptMethod)nameValue).setIndex(0);
nextIndex = 1;
}
else
{
// 3rd (or later) method with this name, continue indexing
nextIndex = ((Integer)nameValue).intValue();
}
method.setIndex(nextIndex++);
_nameMap.put(method.getName(), nextIndex);
}
}
|
[
"public",
"void",
"add",
"(",
"T",
"method",
")",
"{",
"// check for overridden method",
"if",
"(",
"isOverrideMethod",
"(",
"method",
")",
")",
"{",
"return",
";",
"}",
"// Add to the list of managed methods",
"_methods",
".",
"put",
"(",
"method",
".",
"getName",
"(",
")",
"+",
"method",
".",
"getArgTypes",
"(",
")",
",",
"method",
")",
";",
"// Ensure that all added methods have a unique index",
"Object",
"nameValue",
"=",
"_nameMap",
".",
"get",
"(",
"method",
".",
"getName",
"(",
")",
")",
";",
"if",
"(",
"nameValue",
"==",
"null",
")",
"{",
"// first method with this name, considered unique (for now)",
"_nameMap",
".",
"put",
"(",
"method",
".",
"getName",
"(",
")",
",",
"method",
")",
";",
"}",
"else",
"{",
"int",
"nextIndex",
";",
"if",
"(",
"nameValue",
"instanceof",
"AptMethod",
")",
"{",
"// 2nd method with this name, add index to original and start indexing",
"(",
"(",
"AptMethod",
")",
"nameValue",
")",
".",
"setIndex",
"(",
"0",
")",
";",
"nextIndex",
"=",
"1",
";",
"}",
"else",
"{",
"// 3rd (or later) method with this name, continue indexing",
"nextIndex",
"=",
"(",
"(",
"Integer",
")",
"nameValue",
")",
".",
"intValue",
"(",
")",
";",
"}",
"method",
".",
"setIndex",
"(",
"nextIndex",
"++",
")",
";",
"_nameMap",
".",
"put",
"(",
"method",
".",
"getName",
"(",
")",
",",
"nextIndex",
")",
";",
"}",
"}"
] |
Adds a new method to the list. Also detects overloaded methods and ensures that they
will receive a unique index value.
|
[
"Adds",
"a",
"new",
"method",
"to",
"the",
"list",
".",
"Also",
"detects",
"overloaded",
"methods",
"and",
"ensures",
"that",
"they",
"will",
"receive",
"a",
"unique",
"index",
"value",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptMethodSet.java#L37-L72
|
146,866
|
moparisthebest/beehive
|
beehive-controls/src/main/java/org/apache/beehive/controls/api/properties/BaseMap.java
|
BaseMap.setMapClass
|
protected void setMapClass(Class mapClass)
{
//
// If the provided map class is a ControlBean type, then locate associated control
// interface or extension that defines properties.
//
if (ControlBean.class.isAssignableFrom(mapClass))
{
Class [] intfs = mapClass.getInterfaces();
for (int i = 0; i < intfs.length; i++)
{
if (intfs[i].isAnnotationPresent(ControlInterface.class) ||
intfs[i].isAnnotationPresent(ControlExtension.class))
{
mapClass = intfs[i];
break;
}
}
}
else
{
if (!mapClass.isAnnotation() &&
!mapClass.isAnnotationPresent(ControlInterface.class) &&
!mapClass.isAnnotationPresent(ControlExtension.class))
throw new IllegalArgumentException(mapClass+" must be Control or annotation type");
}
_mapClass = mapClass;
}
|
java
|
protected void setMapClass(Class mapClass)
{
//
// If the provided map class is a ControlBean type, then locate associated control
// interface or extension that defines properties.
//
if (ControlBean.class.isAssignableFrom(mapClass))
{
Class [] intfs = mapClass.getInterfaces();
for (int i = 0; i < intfs.length; i++)
{
if (intfs[i].isAnnotationPresent(ControlInterface.class) ||
intfs[i].isAnnotationPresent(ControlExtension.class))
{
mapClass = intfs[i];
break;
}
}
}
else
{
if (!mapClass.isAnnotation() &&
!mapClass.isAnnotationPresent(ControlInterface.class) &&
!mapClass.isAnnotationPresent(ControlExtension.class))
throw new IllegalArgumentException(mapClass+" must be Control or annotation type");
}
_mapClass = mapClass;
}
|
[
"protected",
"void",
"setMapClass",
"(",
"Class",
"mapClass",
")",
"{",
"//",
"// If the provided map class is a ControlBean type, then locate associated control",
"// interface or extension that defines properties.",
"//",
"if",
"(",
"ControlBean",
".",
"class",
".",
"isAssignableFrom",
"(",
"mapClass",
")",
")",
"{",
"Class",
"[",
"]",
"intfs",
"=",
"mapClass",
".",
"getInterfaces",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"intfs",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"intfs",
"[",
"i",
"]",
".",
"isAnnotationPresent",
"(",
"ControlInterface",
".",
"class",
")",
"||",
"intfs",
"[",
"i",
"]",
".",
"isAnnotationPresent",
"(",
"ControlExtension",
".",
"class",
")",
")",
"{",
"mapClass",
"=",
"intfs",
"[",
"i",
"]",
";",
"break",
";",
"}",
"}",
"}",
"else",
"{",
"if",
"(",
"!",
"mapClass",
".",
"isAnnotation",
"(",
")",
"&&",
"!",
"mapClass",
".",
"isAnnotationPresent",
"(",
"ControlInterface",
".",
"class",
")",
"&&",
"!",
"mapClass",
".",
"isAnnotationPresent",
"(",
"ControlExtension",
".",
"class",
")",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"mapClass",
"+",
"\" must be Control or annotation type\"",
")",
";",
"}",
"_mapClass",
"=",
"mapClass",
";",
"}"
] |
Sets the PropertySet or Control interface associated with this map. Only properties
declared by the PropertySet or one of the PropertySets on the Control interface may
be used with this map.
|
[
"Sets",
"the",
"PropertySet",
"or",
"Control",
"interface",
"associated",
"with",
"this",
"map",
".",
"Only",
"properties",
"declared",
"by",
"the",
"PropertySet",
"or",
"one",
"of",
"the",
"PropertySets",
"on",
"the",
"Control",
"interface",
"may",
"be",
"used",
"with",
"this",
"map",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/api/properties/BaseMap.java#L41-L69
|
146,867
|
moparisthebest/beehive
|
beehive-controls/src/main/java/org/apache/beehive/controls/api/properties/BaseMap.java
|
BaseMap.isCompatibleClass
|
private boolean isCompatibleClass(Class checkClass)
{
//
// If the check class is equal to or a super-interface of the map class, then
// they are compatible.
//
if (_mapClass.isAssignableFrom(checkClass))
return true;
//
// If the check class is a property set declared by the map class or a super interface
// of the map class, then they are compatible.
//
if (checkClass.isAnnotationPresent(PropertySet.class))
{
Class declaringClass = checkClass.getDeclaringClass();
// External property sets are always compatible.
// TODO: Could do a more extensive check..
if (declaringClass == null)
return true;
if (declaringClass.isAssignableFrom(_mapClass))
return true;
}
//
// If the map class is a property set declared by the check class or a super interface
// of the check class, then they are compatible. This is the inverse of the last check,
// and happens e.g. when a programatically instantiated control w/ an initial property
// map needs to delegate to the control interface's property map.
//
if (_mapClass.isAnnotationPresent(PropertySet.class))
{
Class declaringClass = _mapClass.getDeclaringClass();
if (declaringClass != null &&
declaringClass.isAssignableFrom(checkClass))
return true;
// External property sets have no declaring class
if (declaringClass == null)
{
ExternalPropertySets eps = (ExternalPropertySets) checkClass.getAnnotation(ExternalPropertySets.class);
if (eps != null)
{
Class[] propSets = eps.value();
if (propSets != null)
{
for (Class ps : propSets)
{
if (_mapClass.equals(ps))
return true;
}
}
}
}
}
return false;
}
|
java
|
private boolean isCompatibleClass(Class checkClass)
{
//
// If the check class is equal to or a super-interface of the map class, then
// they are compatible.
//
if (_mapClass.isAssignableFrom(checkClass))
return true;
//
// If the check class is a property set declared by the map class or a super interface
// of the map class, then they are compatible.
//
if (checkClass.isAnnotationPresent(PropertySet.class))
{
Class declaringClass = checkClass.getDeclaringClass();
// External property sets are always compatible.
// TODO: Could do a more extensive check..
if (declaringClass == null)
return true;
if (declaringClass.isAssignableFrom(_mapClass))
return true;
}
//
// If the map class is a property set declared by the check class or a super interface
// of the check class, then they are compatible. This is the inverse of the last check,
// and happens e.g. when a programatically instantiated control w/ an initial property
// map needs to delegate to the control interface's property map.
//
if (_mapClass.isAnnotationPresent(PropertySet.class))
{
Class declaringClass = _mapClass.getDeclaringClass();
if (declaringClass != null &&
declaringClass.isAssignableFrom(checkClass))
return true;
// External property sets have no declaring class
if (declaringClass == null)
{
ExternalPropertySets eps = (ExternalPropertySets) checkClass.getAnnotation(ExternalPropertySets.class);
if (eps != null)
{
Class[] propSets = eps.value();
if (propSets != null)
{
for (Class ps : propSets)
{
if (_mapClass.equals(ps))
return true;
}
}
}
}
}
return false;
}
|
[
"private",
"boolean",
"isCompatibleClass",
"(",
"Class",
"checkClass",
")",
"{",
"//",
"// If the check class is equal to or a super-interface of the map class, then",
"// they are compatible.",
"//",
"if",
"(",
"_mapClass",
".",
"isAssignableFrom",
"(",
"checkClass",
")",
")",
"return",
"true",
";",
"//",
"// If the check class is a property set declared by the map class or a super interface",
"// of the map class, then they are compatible.",
"//",
"if",
"(",
"checkClass",
".",
"isAnnotationPresent",
"(",
"PropertySet",
".",
"class",
")",
")",
"{",
"Class",
"declaringClass",
"=",
"checkClass",
".",
"getDeclaringClass",
"(",
")",
";",
"// External property sets are always compatible.",
"// TODO: Could do a more extensive check..",
"if",
"(",
"declaringClass",
"==",
"null",
")",
"return",
"true",
";",
"if",
"(",
"declaringClass",
".",
"isAssignableFrom",
"(",
"_mapClass",
")",
")",
"return",
"true",
";",
"}",
"//",
"// If the map class is a property set declared by the check class or a super interface",
"// of the check class, then they are compatible. This is the inverse of the last check,",
"// and happens e.g. when a programatically instantiated control w/ an initial property",
"// map needs to delegate to the control interface's property map.",
"//",
"if",
"(",
"_mapClass",
".",
"isAnnotationPresent",
"(",
"PropertySet",
".",
"class",
")",
")",
"{",
"Class",
"declaringClass",
"=",
"_mapClass",
".",
"getDeclaringClass",
"(",
")",
";",
"if",
"(",
"declaringClass",
"!=",
"null",
"&&",
"declaringClass",
".",
"isAssignableFrom",
"(",
"checkClass",
")",
")",
"return",
"true",
";",
"// External property sets have no declaring class",
"if",
"(",
"declaringClass",
"==",
"null",
")",
"{",
"ExternalPropertySets",
"eps",
"=",
"(",
"ExternalPropertySets",
")",
"checkClass",
".",
"getAnnotation",
"(",
"ExternalPropertySets",
".",
"class",
")",
";",
"if",
"(",
"eps",
"!=",
"null",
")",
"{",
"Class",
"[",
"]",
"propSets",
"=",
"eps",
".",
"value",
"(",
")",
";",
"if",
"(",
"propSets",
"!=",
"null",
")",
"{",
"for",
"(",
"Class",
"ps",
":",
"propSets",
")",
"{",
"if",
"(",
"_mapClass",
".",
"equals",
"(",
"ps",
")",
")",
"return",
"true",
";",
"}",
"}",
"}",
"}",
"}",
"return",
"false",
";",
"}"
] |
Checks to see if the provided class is a control or property set interface that is
compatible with the local PropertyMap.
|
[
"Checks",
"to",
"see",
"if",
"the",
"provided",
"class",
"is",
"a",
"control",
"or",
"property",
"set",
"interface",
"that",
"is",
"compatible",
"with",
"the",
"local",
"PropertyMap",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/api/properties/BaseMap.java#L80-L139
|
146,868
|
moparisthebest/beehive
|
beehive-controls/src/main/java/org/apache/beehive/controls/api/properties/BaseMap.java
|
BaseMap.setDelegateMap
|
public synchronized void setDelegateMap(PropertyMap delegateMap)
{
if (!isCompatibleClass(delegateMap.getMapClass()))
throw new IllegalArgumentException("The delegate map type (" + delegateMap.getMapClass() + " is an incompatible type with " + _mapClass);
_delegateMap = delegateMap;
}
|
java
|
public synchronized void setDelegateMap(PropertyMap delegateMap)
{
if (!isCompatibleClass(delegateMap.getMapClass()))
throw new IllegalArgumentException("The delegate map type (" + delegateMap.getMapClass() + " is an incompatible type with " + _mapClass);
_delegateMap = delegateMap;
}
|
[
"public",
"synchronized",
"void",
"setDelegateMap",
"(",
"PropertyMap",
"delegateMap",
")",
"{",
"if",
"(",
"!",
"isCompatibleClass",
"(",
"delegateMap",
".",
"getMapClass",
"(",
")",
")",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"The delegate map type (\"",
"+",
"delegateMap",
".",
"getMapClass",
"(",
")",
"+",
"\" is an incompatible type with \"",
"+",
"_mapClass",
")",
";",
"_delegateMap",
"=",
"delegateMap",
";",
"}"
] |
Sets a delegate base property map from which values will be derived if not found within
the local property map.
|
[
"Sets",
"a",
"delegate",
"base",
"property",
"map",
"from",
"which",
"values",
"will",
"be",
"derived",
"if",
"not",
"found",
"within",
"the",
"local",
"property",
"map",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/api/properties/BaseMap.java#L153-L159
|
146,869
|
moparisthebest/beehive
|
beehive-controls/src/main/java/org/apache/beehive/controls/api/properties/BaseMap.java
|
BaseMap.containsPropertySet
|
public boolean containsPropertySet(Class<? extends Annotation> propertySet)
{
//
// Defer to any delegate map
//
if (_delegateMap != null)
return _delegateMap.containsPropertySet(propertySet);
return false;
}
|
java
|
public boolean containsPropertySet(Class<? extends Annotation> propertySet)
{
//
// Defer to any delegate map
//
if (_delegateMap != null)
return _delegateMap.containsPropertySet(propertySet);
return false;
}
|
[
"public",
"boolean",
"containsPropertySet",
"(",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"propertySet",
")",
"{",
"//",
"// Defer to any delegate map",
"//",
"if",
"(",
"_delegateMap",
"!=",
"null",
")",
"return",
"_delegateMap",
".",
"containsPropertySet",
"(",
"propertySet",
")",
";",
"return",
"false",
";",
"}"
] |
Returns true if the PropertyMap contains one or more values for the specified
PropertySet, false otherwise.
|
[
"Returns",
"true",
"if",
"the",
"PropertyMap",
"contains",
"one",
"or",
"more",
"values",
"for",
"the",
"specified",
"PropertySet",
"false",
"otherwise",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/api/properties/BaseMap.java#L191-L200
|
146,870
|
moparisthebest/beehive
|
beehive-controls/src/main/java/org/apache/beehive/controls/api/properties/BaseMap.java
|
BaseMap.getPropertySet
|
public <T extends Annotation> T getPropertySet(Class<T> propertySet)
{
if (!containsPropertySet(propertySet))
return null;
return PropertySetProxy.getProxy(propertySet, this);
}
|
java
|
public <T extends Annotation> T getPropertySet(Class<T> propertySet)
{
if (!containsPropertySet(propertySet))
return null;
return PropertySetProxy.getProxy(propertySet, this);
}
|
[
"public",
"<",
"T",
"extends",
"Annotation",
">",
"T",
"getPropertySet",
"(",
"Class",
"<",
"T",
">",
"propertySet",
")",
"{",
"if",
"(",
"!",
"containsPropertySet",
"(",
"propertySet",
")",
")",
"return",
"null",
";",
"return",
"PropertySetProxy",
".",
"getProxy",
"(",
"propertySet",
",",
"this",
")",
";",
"}"
] |
Returns a PropertySet proxy instance that derives its data from the contents of
the property map. Will return null if the PropertyMap does not contain any properties
associated with the specified PropertySet.
|
[
"Returns",
"a",
"PropertySet",
"proxy",
"instance",
"that",
"derives",
"its",
"data",
"from",
"the",
"contents",
"of",
"the",
"property",
"map",
".",
"Will",
"return",
"null",
"if",
"the",
"PropertyMap",
"does",
"not",
"contain",
"any",
"properties",
"associated",
"with",
"the",
"specified",
"PropertySet",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/api/properties/BaseMap.java#L207-L213
|
146,871
|
tootedom/related
|
app/domain/src/main/java/org/greencheek/related/api/RelatedItemAdditionalProperties.java
|
RelatedItemAdditionalProperties.setProperty
|
public void setProperty(String name, String value, int propertyIndex) {
additionalProperties[propertyIndex].setName(name);
additionalProperties[propertyIndex].setValue(value);
}
|
java
|
public void setProperty(String name, String value, int propertyIndex) {
additionalProperties[propertyIndex].setName(name);
additionalProperties[propertyIndex].setValue(value);
}
|
[
"public",
"void",
"setProperty",
"(",
"String",
"name",
",",
"String",
"value",
",",
"int",
"propertyIndex",
")",
"{",
"additionalProperties",
"[",
"propertyIndex",
"]",
".",
"setName",
"(",
"name",
")",
";",
"additionalProperties",
"[",
"propertyIndex",
"]",
".",
"setValue",
"(",
"value",
")",
";",
"}"
] |
Sets the property, at the given index, to the given name, and value.
@param name The property name
@param value the property value
@param propertyIndex the property that is to be set or written over.
|
[
"Sets",
"the",
"property",
"at",
"the",
"given",
"index",
"to",
"the",
"given",
"name",
"and",
"value",
"."
] |
3782dd5a839bbcdc15661d598e8b895aae8aabb7
|
https://github.com/tootedom/related/blob/3782dd5a839bbcdc15661d598e8b895aae8aabb7/app/domain/src/main/java/org/greencheek/related/api/RelatedItemAdditionalProperties.java#L128-L131
|
146,872
|
moparisthebest/beehive
|
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/webcontext/ControlBeanContextServicesSupport.java
|
ControlBeanContextServicesSupport.hasService
|
public synchronized boolean hasService(Class serviceClass) {
// todo: for multithreaded usage this block needs to be synchronized
ServiceProvider sp = _serviceProviders.get(serviceClass);
if (sp != null && !sp.isRevoked()) {
return true;
}
// if service not found locally check in nested context
BeanContext bc = getBeanContext();
if (bc instanceof BeanContextServices) {
return ((BeanContextServices) bc).hasService(serviceClass);
}
return false;
// end synchronized
}
|
java
|
public synchronized boolean hasService(Class serviceClass) {
// todo: for multithreaded usage this block needs to be synchronized
ServiceProvider sp = _serviceProviders.get(serviceClass);
if (sp != null && !sp.isRevoked()) {
return true;
}
// if service not found locally check in nested context
BeanContext bc = getBeanContext();
if (bc instanceof BeanContextServices) {
return ((BeanContextServices) bc).hasService(serviceClass);
}
return false;
// end synchronized
}
|
[
"public",
"synchronized",
"boolean",
"hasService",
"(",
"Class",
"serviceClass",
")",
"{",
"// todo: for multithreaded usage this block needs to be synchronized",
"ServiceProvider",
"sp",
"=",
"_serviceProviders",
".",
"get",
"(",
"serviceClass",
")",
";",
"if",
"(",
"sp",
"!=",
"null",
"&&",
"!",
"sp",
".",
"isRevoked",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"// if service not found locally check in nested context",
"BeanContext",
"bc",
"=",
"getBeanContext",
"(",
")",
";",
"if",
"(",
"bc",
"instanceof",
"BeanContextServices",
")",
"{",
"return",
"(",
"(",
"BeanContextServices",
")",
"bc",
")",
".",
"hasService",
"(",
"serviceClass",
")",
";",
"}",
"return",
"false",
";",
"// end synchronized",
"}"
] |
Reports whether or not a given service is
currently available from this context.
@param serviceClass the service in question
@return true if the service is available
|
[
"Reports",
"whether",
"or",
"not",
"a",
"given",
"service",
"is",
"currently",
"available",
"from",
"this",
"context",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/webcontext/ControlBeanContextServicesSupport.java#L157-L172
|
146,873
|
moparisthebest/beehive
|
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/webcontext/ControlBeanContextServicesSupport.java
|
ControlBeanContextServicesSupport.getCurrentServiceClasses
|
public Iterator getCurrentServiceClasses() {
ArrayList<Class> currentClasses = new ArrayList<Class>();
for (Class serviceClass : _serviceProviders.keySet()) {
ServiceProvider sp = _serviceProviders.get(serviceClass);
if (!sp.isRevoked() && !sp.isDelegated()) {
currentClasses.add(serviceClass);
}
}
return currentClasses.iterator();
}
|
java
|
public Iterator getCurrentServiceClasses() {
ArrayList<Class> currentClasses = new ArrayList<Class>();
for (Class serviceClass : _serviceProviders.keySet()) {
ServiceProvider sp = _serviceProviders.get(serviceClass);
if (!sp.isRevoked() && !sp.isDelegated()) {
currentClasses.add(serviceClass);
}
}
return currentClasses.iterator();
}
|
[
"public",
"Iterator",
"getCurrentServiceClasses",
"(",
")",
"{",
"ArrayList",
"<",
"Class",
">",
"currentClasses",
"=",
"new",
"ArrayList",
"<",
"Class",
">",
"(",
")",
";",
"for",
"(",
"Class",
"serviceClass",
":",
"_serviceProviders",
".",
"keySet",
"(",
")",
")",
"{",
"ServiceProvider",
"sp",
"=",
"_serviceProviders",
".",
"get",
"(",
"serviceClass",
")",
";",
"if",
"(",
"!",
"sp",
".",
"isRevoked",
"(",
")",
"&&",
"!",
"sp",
".",
"isDelegated",
"(",
")",
")",
"{",
"currentClasses",
".",
"add",
"(",
"serviceClass",
")",
";",
"}",
"}",
"return",
"currentClasses",
".",
"iterator",
"(",
")",
";",
"}"
] |
Gets the currently available services for this context.
@return an <code>Iterator</code> consisting of the
currently available services
|
[
"Gets",
"the",
"currently",
"available",
"services",
"for",
"this",
"context",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/webcontext/ControlBeanContextServicesSupport.java#L283-L293
|
146,874
|
moparisthebest/beehive
|
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/webcontext/ControlBeanContextServicesSupport.java
|
ControlBeanContextServicesSupport.releaseBeanContextResources
|
protected synchronized void releaseBeanContextResources() {
for (Class serviceClass : _serviceProviders.keySet()) {
ServiceProvider sp = _serviceProviders.get(serviceClass);
if (sp.isDelegated()) {
sp.revoke(new BeanContextServiceRevokedEvent((BeanContextServices)getPeer(), serviceClass, true));
}
}
}
|
java
|
protected synchronized void releaseBeanContextResources() {
for (Class serviceClass : _serviceProviders.keySet()) {
ServiceProvider sp = _serviceProviders.get(serviceClass);
if (sp.isDelegated()) {
sp.revoke(new BeanContextServiceRevokedEvent((BeanContextServices)getPeer(), serviceClass, true));
}
}
}
|
[
"protected",
"synchronized",
"void",
"releaseBeanContextResources",
"(",
")",
"{",
"for",
"(",
"Class",
"serviceClass",
":",
"_serviceProviders",
".",
"keySet",
"(",
")",
")",
"{",
"ServiceProvider",
"sp",
"=",
"_serviceProviders",
".",
"get",
"(",
"serviceClass",
")",
";",
"if",
"(",
"sp",
".",
"isDelegated",
"(",
")",
")",
"{",
"sp",
".",
"revoke",
"(",
"new",
"BeanContextServiceRevokedEvent",
"(",
"(",
"BeanContextServices",
")",
"getPeer",
"(",
")",
",",
"serviceClass",
",",
"true",
")",
")",
";",
"}",
"}",
"}"
] |
Invoked when all resources obtained from the current nested bean context
need to be released. For BeanContextServices this means revoke any services
obtained from a delegate services provider. Typically invoked when the parent
context is changed.
|
[
"Invoked",
"when",
"all",
"resources",
"obtained",
"from",
"the",
"current",
"nested",
"bean",
"context",
"need",
"to",
"be",
"released",
".",
"For",
"BeanContextServices",
"this",
"means",
"revoke",
"any",
"services",
"obtained",
"from",
"a",
"delegate",
"services",
"provider",
".",
"Typically",
"invoked",
"when",
"the",
"parent",
"context",
"is",
"changed",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/webcontext/ControlBeanContextServicesSupport.java#L350-L358
|
146,875
|
moparisthebest/beehive
|
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/webcontext/ControlBeanContextServicesSupport.java
|
ControlBeanContextServicesSupport.initialize
|
protected void initialize() {
super.initialize();
_serviceProviders = Collections.synchronizedMap(new HashMap<Class, ServiceProvider>());
_bcsListeners = Collections.synchronizedList(new ArrayList<BeanContextServicesListener>());
}
|
java
|
protected void initialize() {
super.initialize();
_serviceProviders = Collections.synchronizedMap(new HashMap<Class, ServiceProvider>());
_bcsListeners = Collections.synchronizedList(new ArrayList<BeanContextServicesListener>());
}
|
[
"protected",
"void",
"initialize",
"(",
")",
"{",
"super",
".",
"initialize",
"(",
")",
";",
"_serviceProviders",
"=",
"Collections",
".",
"synchronizedMap",
"(",
"new",
"HashMap",
"<",
"Class",
",",
"ServiceProvider",
">",
"(",
")",
")",
";",
"_bcsListeners",
"=",
"Collections",
".",
"synchronizedList",
"(",
"new",
"ArrayList",
"<",
"BeanContextServicesListener",
">",
"(",
")",
")",
";",
"}"
] |
Initialize data structures.
|
[
"Initialize",
"data",
"structures",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/webcontext/ControlBeanContextServicesSupport.java#L391-L395
|
146,876
|
moparisthebest/beehive
|
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/webcontext/ControlBeanContextServicesSupport.java
|
ControlBeanContextServicesSupport.findServiceClass
|
private Class findServiceClass(Object service) {
for (Class sc : _serviceProviders.keySet()) {
if (sc.isInstance(service)) {
return sc;
}
}
throw new IllegalArgumentException("Cannot find service provider for: " + service.getClass().getCanonicalName());
}
|
java
|
private Class findServiceClass(Object service) {
for (Class sc : _serviceProviders.keySet()) {
if (sc.isInstance(service)) {
return sc;
}
}
throw new IllegalArgumentException("Cannot find service provider for: " + service.getClass().getCanonicalName());
}
|
[
"private",
"Class",
"findServiceClass",
"(",
"Object",
"service",
")",
"{",
"for",
"(",
"Class",
"sc",
":",
"_serviceProviders",
".",
"keySet",
"(",
")",
")",
"{",
"if",
"(",
"sc",
".",
"isInstance",
"(",
"service",
")",
")",
"{",
"return",
"sc",
";",
"}",
"}",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Cannot find service provider for: \"",
"+",
"service",
".",
"getClass",
"(",
")",
".",
"getCanonicalName",
"(",
")",
")",
";",
"}"
] |
Try to find the registered service for a service object instance.
May return null if the object instance is not from a service registered
with this service provider.
@return Service class for service instance.
@throws IllegalArgumentException if service class can not be found.
|
[
"Try",
"to",
"find",
"the",
"registered",
"service",
"for",
"a",
"service",
"object",
"instance",
".",
"May",
"return",
"null",
"if",
"the",
"object",
"instance",
"is",
"not",
"from",
"a",
"service",
"registered",
"with",
"this",
"service",
"provider",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/webcontext/ControlBeanContextServicesSupport.java#L405-L412
|
146,877
|
moparisthebest/beehive
|
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/webcontext/ControlBeanContextServicesSupport.java
|
ControlBeanContextServicesSupport.readObject
|
private synchronized void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException {
ois.defaultReadObject();
int svcsSize = ois.readInt();
for (int i = 0; i < svcsSize; i++) {
_serviceProviders.put((Class) ois.readObject(), (ServiceProvider) ois.readObject());
}
int listenersSize = ois.readInt();
for (int i = 0; i < listenersSize; i++) {
_bcsListeners.add((BeanContextServicesListener) ois.readObject());
}
}
|
java
|
private synchronized void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException {
ois.defaultReadObject();
int svcsSize = ois.readInt();
for (int i = 0; i < svcsSize; i++) {
_serviceProviders.put((Class) ois.readObject(), (ServiceProvider) ois.readObject());
}
int listenersSize = ois.readInt();
for (int i = 0; i < listenersSize; i++) {
_bcsListeners.add((BeanContextServicesListener) ois.readObject());
}
}
|
[
"private",
"synchronized",
"void",
"readObject",
"(",
"ObjectInputStream",
"ois",
")",
"throws",
"IOException",
",",
"ClassNotFoundException",
"{",
"ois",
".",
"defaultReadObject",
"(",
")",
";",
"int",
"svcsSize",
"=",
"ois",
".",
"readInt",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"svcsSize",
";",
"i",
"++",
")",
"{",
"_serviceProviders",
".",
"put",
"(",
"(",
"Class",
")",
"ois",
".",
"readObject",
"(",
")",
",",
"(",
"ServiceProvider",
")",
"ois",
".",
"readObject",
"(",
")",
")",
";",
"}",
"int",
"listenersSize",
"=",
"ois",
".",
"readInt",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"listenersSize",
";",
"i",
"++",
")",
"{",
"_bcsListeners",
".",
"add",
"(",
"(",
"BeanContextServicesListener",
")",
"ois",
".",
"readObject",
"(",
")",
")",
";",
"}",
"}"
] |
Deserialization support.
@param ois
@throws IOException
@throws ClassNotFoundException
|
[
"Deserialization",
"support",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/webcontext/ControlBeanContextServicesSupport.java#L421-L433
|
146,878
|
moparisthebest/beehive
|
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/webcontext/ControlBeanContextServicesSupport.java
|
ControlBeanContextServicesSupport.writeObject
|
private synchronized void writeObject(ObjectOutputStream oos) throws IOException {
int serializable = 0;
oos.defaultWriteObject();
// write out the service providers
Set<Map.Entry<Class, ServiceProvider>> providers = _serviceProviders.entrySet();
for (Map.Entry<Class, ServiceProvider> provider : providers) {
if (provider.getValue().isSerializable()) {
serializable++;
}
}
oos.writeInt(serializable);
if (serializable > 0) {
for (Map.Entry<Class, ServiceProvider> entry : providers) {
if (entry.getValue().isSerializable()) {
oos.writeObject(entry.getKey());
oos.writeObject(entry.getValue());
}
}
}
// write out the event listeners
serializable = 0;
for (BeanContextServicesListener l : _bcsListeners) {
if (l instanceof Serializable) {
serializable++;
}
}
oos.writeInt(serializable);
if (serializable > 0) {
for (BeanContextServicesListener l : _bcsListeners) {
if (l instanceof Serializable) {
oos.writeObject(l);
}
}
}
}
|
java
|
private synchronized void writeObject(ObjectOutputStream oos) throws IOException {
int serializable = 0;
oos.defaultWriteObject();
// write out the service providers
Set<Map.Entry<Class, ServiceProvider>> providers = _serviceProviders.entrySet();
for (Map.Entry<Class, ServiceProvider> provider : providers) {
if (provider.getValue().isSerializable()) {
serializable++;
}
}
oos.writeInt(serializable);
if (serializable > 0) {
for (Map.Entry<Class, ServiceProvider> entry : providers) {
if (entry.getValue().isSerializable()) {
oos.writeObject(entry.getKey());
oos.writeObject(entry.getValue());
}
}
}
// write out the event listeners
serializable = 0;
for (BeanContextServicesListener l : _bcsListeners) {
if (l instanceof Serializable) {
serializable++;
}
}
oos.writeInt(serializable);
if (serializable > 0) {
for (BeanContextServicesListener l : _bcsListeners) {
if (l instanceof Serializable) {
oos.writeObject(l);
}
}
}
}
|
[
"private",
"synchronized",
"void",
"writeObject",
"(",
"ObjectOutputStream",
"oos",
")",
"throws",
"IOException",
"{",
"int",
"serializable",
"=",
"0",
";",
"oos",
".",
"defaultWriteObject",
"(",
")",
";",
"// write out the service providers",
"Set",
"<",
"Map",
".",
"Entry",
"<",
"Class",
",",
"ServiceProvider",
">",
">",
"providers",
"=",
"_serviceProviders",
".",
"entrySet",
"(",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"Class",
",",
"ServiceProvider",
">",
"provider",
":",
"providers",
")",
"{",
"if",
"(",
"provider",
".",
"getValue",
"(",
")",
".",
"isSerializable",
"(",
")",
")",
"{",
"serializable",
"++",
";",
"}",
"}",
"oos",
".",
"writeInt",
"(",
"serializable",
")",
";",
"if",
"(",
"serializable",
">",
"0",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"Class",
",",
"ServiceProvider",
">",
"entry",
":",
"providers",
")",
"{",
"if",
"(",
"entry",
".",
"getValue",
"(",
")",
".",
"isSerializable",
"(",
")",
")",
"{",
"oos",
".",
"writeObject",
"(",
"entry",
".",
"getKey",
"(",
")",
")",
";",
"oos",
".",
"writeObject",
"(",
"entry",
".",
"getValue",
"(",
")",
")",
";",
"}",
"}",
"}",
"// write out the event listeners",
"serializable",
"=",
"0",
";",
"for",
"(",
"BeanContextServicesListener",
"l",
":",
"_bcsListeners",
")",
"{",
"if",
"(",
"l",
"instanceof",
"Serializable",
")",
"{",
"serializable",
"++",
";",
"}",
"}",
"oos",
".",
"writeInt",
"(",
"serializable",
")",
";",
"if",
"(",
"serializable",
">",
"0",
")",
"{",
"for",
"(",
"BeanContextServicesListener",
"l",
":",
"_bcsListeners",
")",
"{",
"if",
"(",
"l",
"instanceof",
"Serializable",
")",
"{",
"oos",
".",
"writeObject",
"(",
"l",
")",
";",
"}",
"}",
"}",
"}"
] |
Serialize this instance including any serializable services and BeanContextServicesListeners.
Any services or listeners which are not Serializable will not be present once deserialized.
@param oos
@throws IOException
|
[
"Serialize",
"this",
"instance",
"including",
"any",
"serializable",
"services",
"and",
"BeanContextServicesListeners",
".",
"Any",
"services",
"or",
"listeners",
"which",
"are",
"not",
"Serializable",
"will",
"not",
"be",
"present",
"once",
"deserialized",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/webcontext/ControlBeanContextServicesSupport.java#L442-L481
|
146,879
|
moparisthebest/beehive
|
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/CheckBoxGroup.java
|
CheckBoxGroup.isMatched
|
public boolean isMatched(String value, Boolean defaultValue)
{
if (value == null)
return false;
if (_match != null) {
for (int i = 0; i < _match.length; i++) {
if (value.equals(_match[i]))
return true;
}
}
else {
// a provided default value will override the group
if (defaultValue != null)
return defaultValue.booleanValue();
// if we have a singleton definition then use that
if (_defaultSingleton)
return _defaultSingleValue;
// check to see if we have a default arraylist with the value in it
if (_defaultSelections != null)
return _defaultSelections.contains(value);
}
return false;
}
|
java
|
public boolean isMatched(String value, Boolean defaultValue)
{
if (value == null)
return false;
if (_match != null) {
for (int i = 0; i < _match.length; i++) {
if (value.equals(_match[i]))
return true;
}
}
else {
// a provided default value will override the group
if (defaultValue != null)
return defaultValue.booleanValue();
// if we have a singleton definition then use that
if (_defaultSingleton)
return _defaultSingleValue;
// check to see if we have a default arraylist with the value in it
if (_defaultSelections != null)
return _defaultSelections.contains(value);
}
return false;
}
|
[
"public",
"boolean",
"isMatched",
"(",
"String",
"value",
",",
"Boolean",
"defaultValue",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"return",
"false",
";",
"if",
"(",
"_match",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"_match",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"value",
".",
"equals",
"(",
"_match",
"[",
"i",
"]",
")",
")",
"return",
"true",
";",
"}",
"}",
"else",
"{",
"// a provided default value will override the group",
"if",
"(",
"defaultValue",
"!=",
"null",
")",
"return",
"defaultValue",
".",
"booleanValue",
"(",
")",
";",
"// if we have a singleton definition then use that",
"if",
"(",
"_defaultSingleton",
")",
"return",
"_defaultSingleValue",
";",
"// check to see if we have a default arraylist with the value in it",
"if",
"(",
"_defaultSelections",
"!=",
"null",
")",
"return",
"_defaultSelections",
".",
"contains",
"(",
"value",
")",
";",
"}",
"return",
"false",
";",
"}"
] |
Checks whether the given value matches one of the CheckBoxGroup's selected
CheckBoxOptions.
@param value Value to be compared
|
[
"Checks",
"whether",
"the",
"given",
"value",
"matches",
"one",
"of",
"the",
"CheckBoxGroup",
"s",
"selected",
"CheckBoxOptions",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/CheckBoxGroup.java#L320-L346
|
146,880
|
moparisthebest/beehive
|
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/CheckBoxGroup.java
|
CheckBoxGroup.doStartTag
|
public int doStartTag() throws JspException
{
ServletRequest req = pageContext.getRequest();
if (_cr == null)
_cr = TagRenderingBase.Factory.getConstantRendering(req);
// get the evaluated dataSource and default values
Object val = evaluateDataSource();
_defaultSelections = (List) evaluateDefaultValue();
if (hasErrors()) {
return SKIP_BODY;
}
// process the default values and create the matching array...
if (val != null) {
buildMatch(val);
if (hasErrors()) {
return SKIP_BODY;
}
}
// if the checkbox group is disabled do not write out the
// hidden field.
_writer = new WriteRenderAppender(pageContext);
if (!_repeater && !_disabled) {
//Create hidden field for state tracking
_state.clear();
String hiddenParamName = null;
hiddenParamName = getQualifiedDataSourceName() + OLDVALUE_SUFFIX;
_state.name = hiddenParamName;
_state.value = "true";
TagRenderingBase hiddenTag = TagRenderingBase.Factory.getRendering(TagRenderingBase.INPUT_HIDDEN_TAG, req);
hiddenTag.doStartTag(_writer, _state);
hiddenTag.doEndTag(_writer);
}
if (isVertical())
_cr.TABLE(_writer);
// if this is a repeater then we shouid prime the pump...
_dynamicAttrs = evaluateOptionsDataSource();
assert (_dynamicAttrs != null);
assert (_dynamicAttrs instanceof Map ||
_dynamicAttrs instanceof Iterator);
if (_repeater) {
if (_dynamicAttrs instanceof Map) {
_dynamicAttrs = ((Map) _dynamicAttrs).entrySet().iterator();
}
if (!(_dynamicAttrs instanceof Iterator)) {
String s = Bundle.getString("Tags_OptionsDSIteratorError");
registerTagError(s, null);
return SKIP_BODY;
}
while (((Iterator) _dynamicAttrs).hasNext()) {
_repCurItem = ((Iterator) _dynamicAttrs).next();
if (_repCurItem != null)
break;
}
if (isVertical())
_cr.TR_TD(_writer);
DataAccessProviderStack.addDataAccessProvider(this, pageContext);
}
_saveBody = new InternalStringBuilder(128);
// Continue processing this page
return EVAL_BODY_BUFFERED;
}
|
java
|
public int doStartTag() throws JspException
{
ServletRequest req = pageContext.getRequest();
if (_cr == null)
_cr = TagRenderingBase.Factory.getConstantRendering(req);
// get the evaluated dataSource and default values
Object val = evaluateDataSource();
_defaultSelections = (List) evaluateDefaultValue();
if (hasErrors()) {
return SKIP_BODY;
}
// process the default values and create the matching array...
if (val != null) {
buildMatch(val);
if (hasErrors()) {
return SKIP_BODY;
}
}
// if the checkbox group is disabled do not write out the
// hidden field.
_writer = new WriteRenderAppender(pageContext);
if (!_repeater && !_disabled) {
//Create hidden field for state tracking
_state.clear();
String hiddenParamName = null;
hiddenParamName = getQualifiedDataSourceName() + OLDVALUE_SUFFIX;
_state.name = hiddenParamName;
_state.value = "true";
TagRenderingBase hiddenTag = TagRenderingBase.Factory.getRendering(TagRenderingBase.INPUT_HIDDEN_TAG, req);
hiddenTag.doStartTag(_writer, _state);
hiddenTag.doEndTag(_writer);
}
if (isVertical())
_cr.TABLE(_writer);
// if this is a repeater then we shouid prime the pump...
_dynamicAttrs = evaluateOptionsDataSource();
assert (_dynamicAttrs != null);
assert (_dynamicAttrs instanceof Map ||
_dynamicAttrs instanceof Iterator);
if (_repeater) {
if (_dynamicAttrs instanceof Map) {
_dynamicAttrs = ((Map) _dynamicAttrs).entrySet().iterator();
}
if (!(_dynamicAttrs instanceof Iterator)) {
String s = Bundle.getString("Tags_OptionsDSIteratorError");
registerTagError(s, null);
return SKIP_BODY;
}
while (((Iterator) _dynamicAttrs).hasNext()) {
_repCurItem = ((Iterator) _dynamicAttrs).next();
if (_repCurItem != null)
break;
}
if (isVertical())
_cr.TR_TD(_writer);
DataAccessProviderStack.addDataAccessProvider(this, pageContext);
}
_saveBody = new InternalStringBuilder(128);
// Continue processing this page
return EVAL_BODY_BUFFERED;
}
|
[
"public",
"int",
"doStartTag",
"(",
")",
"throws",
"JspException",
"{",
"ServletRequest",
"req",
"=",
"pageContext",
".",
"getRequest",
"(",
")",
";",
"if",
"(",
"_cr",
"==",
"null",
")",
"_cr",
"=",
"TagRenderingBase",
".",
"Factory",
".",
"getConstantRendering",
"(",
"req",
")",
";",
"// get the evaluated dataSource and default values",
"Object",
"val",
"=",
"evaluateDataSource",
"(",
")",
";",
"_defaultSelections",
"=",
"(",
"List",
")",
"evaluateDefaultValue",
"(",
")",
";",
"if",
"(",
"hasErrors",
"(",
")",
")",
"{",
"return",
"SKIP_BODY",
";",
"}",
"// process the default values and create the matching array...",
"if",
"(",
"val",
"!=",
"null",
")",
"{",
"buildMatch",
"(",
"val",
")",
";",
"if",
"(",
"hasErrors",
"(",
")",
")",
"{",
"return",
"SKIP_BODY",
";",
"}",
"}",
"// if the checkbox group is disabled do not write out the",
"// hidden field.",
"_writer",
"=",
"new",
"WriteRenderAppender",
"(",
"pageContext",
")",
";",
"if",
"(",
"!",
"_repeater",
"&&",
"!",
"_disabled",
")",
"{",
"//Create hidden field for state tracking",
"_state",
".",
"clear",
"(",
")",
";",
"String",
"hiddenParamName",
"=",
"null",
";",
"hiddenParamName",
"=",
"getQualifiedDataSourceName",
"(",
")",
"+",
"OLDVALUE_SUFFIX",
";",
"_state",
".",
"name",
"=",
"hiddenParamName",
";",
"_state",
".",
"value",
"=",
"\"true\"",
";",
"TagRenderingBase",
"hiddenTag",
"=",
"TagRenderingBase",
".",
"Factory",
".",
"getRendering",
"(",
"TagRenderingBase",
".",
"INPUT_HIDDEN_TAG",
",",
"req",
")",
";",
"hiddenTag",
".",
"doStartTag",
"(",
"_writer",
",",
"_state",
")",
";",
"hiddenTag",
".",
"doEndTag",
"(",
"_writer",
")",
";",
"}",
"if",
"(",
"isVertical",
"(",
")",
")",
"_cr",
".",
"TABLE",
"(",
"_writer",
")",
";",
"// if this is a repeater then we shouid prime the pump...",
"_dynamicAttrs",
"=",
"evaluateOptionsDataSource",
"(",
")",
";",
"assert",
"(",
"_dynamicAttrs",
"!=",
"null",
")",
";",
"assert",
"(",
"_dynamicAttrs",
"instanceof",
"Map",
"||",
"_dynamicAttrs",
"instanceof",
"Iterator",
")",
";",
"if",
"(",
"_repeater",
")",
"{",
"if",
"(",
"_dynamicAttrs",
"instanceof",
"Map",
")",
"{",
"_dynamicAttrs",
"=",
"(",
"(",
"Map",
")",
"_dynamicAttrs",
")",
".",
"entrySet",
"(",
")",
".",
"iterator",
"(",
")",
";",
"}",
"if",
"(",
"!",
"(",
"_dynamicAttrs",
"instanceof",
"Iterator",
")",
")",
"{",
"String",
"s",
"=",
"Bundle",
".",
"getString",
"(",
"\"Tags_OptionsDSIteratorError\"",
")",
";",
"registerTagError",
"(",
"s",
",",
"null",
")",
";",
"return",
"SKIP_BODY",
";",
"}",
"while",
"(",
"(",
"(",
"Iterator",
")",
"_dynamicAttrs",
")",
".",
"hasNext",
"(",
")",
")",
"{",
"_repCurItem",
"=",
"(",
"(",
"Iterator",
")",
"_dynamicAttrs",
")",
".",
"next",
"(",
")",
";",
"if",
"(",
"_repCurItem",
"!=",
"null",
")",
"break",
";",
"}",
"if",
"(",
"isVertical",
"(",
")",
")",
"_cr",
".",
"TR_TD",
"(",
"_writer",
")",
";",
"DataAccessProviderStack",
".",
"addDataAccessProvider",
"(",
"this",
",",
"pageContext",
")",
";",
"}",
"_saveBody",
"=",
"new",
"InternalStringBuilder",
"(",
"128",
")",
";",
"// Continue processing this page",
"return",
"EVAL_BODY_BUFFERED",
";",
"}"
] |
Determine the set of matches for the CheckBoxGroup
@throws JspException if a JSP exception has occurred
|
[
"Determine",
"the",
"set",
"of",
"matches",
"for",
"the",
"CheckBoxGroup"
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/CheckBoxGroup.java#L353-L424
|
146,881
|
moparisthebest/beehive
|
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/CheckBoxGroup.java
|
CheckBoxGroup.buildMatch
|
private void buildMatch(Object val)
{
if (val instanceof String[]) {
_match = (String[]) val;
}
else {
Iterator matchIterator = null;
// this should return null, but we should handle it it does
matchIterator = IteratorFactory.createIterator(val);
if (matchIterator == null)
matchIterator = IteratorFactory.EMPTY_ITERATOR;
List matchList = new ArrayList();
while (matchIterator.hasNext()) {
Object o = matchIterator.next();
if (o != null)
matchList.add(o.toString());
}
int size = matchList.size();
_match = new String[size];
for (int i = 0; i < size; i++) {
_match[i] = matchList.get(i).toString();
}
}
if (logger.isDebugEnabled()) {
logger.debug("****** CheckboxGroup Matches ******");
if (_match != null) {
for (int i = 0; i < _match.length; i++) {
logger.debug(i + ": " + _match[i]);
}
}
}
}
|
java
|
private void buildMatch(Object val)
{
if (val instanceof String[]) {
_match = (String[]) val;
}
else {
Iterator matchIterator = null;
// this should return null, but we should handle it it does
matchIterator = IteratorFactory.createIterator(val);
if (matchIterator == null)
matchIterator = IteratorFactory.EMPTY_ITERATOR;
List matchList = new ArrayList();
while (matchIterator.hasNext()) {
Object o = matchIterator.next();
if (o != null)
matchList.add(o.toString());
}
int size = matchList.size();
_match = new String[size];
for (int i = 0; i < size; i++) {
_match[i] = matchList.get(i).toString();
}
}
if (logger.isDebugEnabled()) {
logger.debug("****** CheckboxGroup Matches ******");
if (_match != null) {
for (int i = 0; i < _match.length; i++) {
logger.debug(i + ": " + _match[i]);
}
}
}
}
|
[
"private",
"void",
"buildMatch",
"(",
"Object",
"val",
")",
"{",
"if",
"(",
"val",
"instanceof",
"String",
"[",
"]",
")",
"{",
"_match",
"=",
"(",
"String",
"[",
"]",
")",
"val",
";",
"}",
"else",
"{",
"Iterator",
"matchIterator",
"=",
"null",
";",
"// this should return null, but we should handle it it does",
"matchIterator",
"=",
"IteratorFactory",
".",
"createIterator",
"(",
"val",
")",
";",
"if",
"(",
"matchIterator",
"==",
"null",
")",
"matchIterator",
"=",
"IteratorFactory",
".",
"EMPTY_ITERATOR",
";",
"List",
"matchList",
"=",
"new",
"ArrayList",
"(",
")",
";",
"while",
"(",
"matchIterator",
".",
"hasNext",
"(",
")",
")",
"{",
"Object",
"o",
"=",
"matchIterator",
".",
"next",
"(",
")",
";",
"if",
"(",
"o",
"!=",
"null",
")",
"matchList",
".",
"add",
"(",
"o",
".",
"toString",
"(",
")",
")",
";",
"}",
"int",
"size",
"=",
"matchList",
".",
"size",
"(",
")",
";",
"_match",
"=",
"new",
"String",
"[",
"size",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"size",
";",
"i",
"++",
")",
"{",
"_match",
"[",
"i",
"]",
"=",
"matchList",
".",
"get",
"(",
"i",
")",
".",
"toString",
"(",
")",
";",
"}",
"}",
"if",
"(",
"logger",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"logger",
".",
"debug",
"(",
"\"****** CheckboxGroup Matches ******\"",
")",
";",
"if",
"(",
"_match",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"_match",
".",
"length",
";",
"i",
"++",
")",
"{",
"logger",
".",
"debug",
"(",
"i",
"+",
"\": \"",
"+",
"_match",
"[",
"i",
"]",
")",
";",
"}",
"}",
"}",
"}"
] |
This method will build the match list, should this be a hashmap?
|
[
"This",
"method",
"will",
"build",
"the",
"match",
"list",
"should",
"this",
"be",
"a",
"hashmap?"
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/CheckBoxGroup.java#L611-L645
|
146,882
|
moparisthebest/beehive
|
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/ControlBean.java
|
ControlBean.getClassDeclaration
|
public String getClassDeclaration()
{
StringBuffer sb = new StringBuffer(_shortName);
sb.append(_controlIntf.getFormalTypeParameters());
return sb.toString();
}
|
java
|
public String getClassDeclaration()
{
StringBuffer sb = new StringBuffer(_shortName);
sb.append(_controlIntf.getFormalTypeParameters());
return sb.toString();
}
|
[
"public",
"String",
"getClassDeclaration",
"(",
")",
"{",
"StringBuffer",
"sb",
"=",
"new",
"StringBuffer",
"(",
"_shortName",
")",
";",
"sb",
".",
"append",
"(",
"_controlIntf",
".",
"getFormalTypeParameters",
"(",
")",
")",
";",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}"
] |
Returns the class declaration for the ControlBean
|
[
"Returns",
"the",
"class",
"declaration",
"for",
"the",
"ControlBean"
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/ControlBean.java#L80-L85
|
146,883
|
moparisthebest/beehive
|
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/ControlBean.java
|
ControlBean.getSuperTypeBinding
|
public String getSuperTypeBinding()
{
InterfaceType superType = _controlIntf.getSuperType();
if (superType != null)
{
String typeStr = superType.toString();
int paramIndex = typeStr.indexOf('<');
if (paramIndex > 0)
return typeStr.substring(paramIndex);
}
return "";
}
|
java
|
public String getSuperTypeBinding()
{
InterfaceType superType = _controlIntf.getSuperType();
if (superType != null)
{
String typeStr = superType.toString();
int paramIndex = typeStr.indexOf('<');
if (paramIndex > 0)
return typeStr.substring(paramIndex);
}
return "";
}
|
[
"public",
"String",
"getSuperTypeBinding",
"(",
")",
"{",
"InterfaceType",
"superType",
"=",
"_controlIntf",
".",
"getSuperType",
"(",
")",
";",
"if",
"(",
"superType",
"!=",
"null",
")",
"{",
"String",
"typeStr",
"=",
"superType",
".",
"toString",
"(",
")",
";",
"int",
"paramIndex",
"=",
"typeStr",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"paramIndex",
">",
"0",
")",
"return",
"typeStr",
".",
"substring",
"(",
"paramIndex",
")",
";",
"}",
"return",
"\"\"",
";",
"}"
] |
Returns any formal type parameters that should be bound for the bean's superclass,
based upon any type bindings that occur on the original interface.
|
[
"Returns",
"any",
"formal",
"type",
"parameters",
"that",
"should",
"be",
"bound",
"for",
"the",
"bean",
"s",
"superclass",
"based",
"upon",
"any",
"type",
"bindings",
"that",
"occur",
"on",
"the",
"original",
"interface",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/ControlBean.java#L114-L125
|
146,884
|
moparisthebest/beehive
|
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/template/Section.java
|
Section.processDivPanel
|
private int processDivPanel()
throws JspException {
if (!_visible)
return EVAL_PAGE;
if (hasErrors()) {
reportErrors();
localRelease();
return EVAL_PAGE;
}
BodyContent bc = getBodyContent();
String content = (bc != null) ? bc.getString() : "";
ResponseUtils.write(pageContext,content);
ResponseUtils.write(pageContext,"</div>");
localRelease();
return EVAL_PAGE;
}
|
java
|
private int processDivPanel()
throws JspException {
if (!_visible)
return EVAL_PAGE;
if (hasErrors()) {
reportErrors();
localRelease();
return EVAL_PAGE;
}
BodyContent bc = getBodyContent();
String content = (bc != null) ? bc.getString() : "";
ResponseUtils.write(pageContext,content);
ResponseUtils.write(pageContext,"</div>");
localRelease();
return EVAL_PAGE;
}
|
[
"private",
"int",
"processDivPanel",
"(",
")",
"throws",
"JspException",
"{",
"if",
"(",
"!",
"_visible",
")",
"return",
"EVAL_PAGE",
";",
"if",
"(",
"hasErrors",
"(",
")",
")",
"{",
"reportErrors",
"(",
")",
";",
"localRelease",
"(",
")",
";",
"return",
"EVAL_PAGE",
";",
"}",
"BodyContent",
"bc",
"=",
"getBodyContent",
"(",
")",
";",
"String",
"content",
"=",
"(",
"bc",
"!=",
"null",
")",
"?",
"bc",
".",
"getString",
"(",
")",
":",
"\"\"",
";",
"ResponseUtils",
".",
"write",
"(",
"pageContext",
",",
"content",
")",
";",
"ResponseUtils",
".",
"write",
"(",
"pageContext",
",",
"\"</div>\"",
")",
";",
"localRelease",
"(",
")",
";",
"return",
"EVAL_PAGE",
";",
"}"
] |
This method will process the section in the context of a DivPanel
@return returns the integer code doEndTag() will return.
|
[
"This",
"method",
"will",
"process",
"the",
"section",
"in",
"the",
"context",
"of",
"a",
"DivPanel"
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/template/Section.java#L268-L286
|
146,885
|
moparisthebest/beehive
|
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/template/Section.java
|
Section.processTemplate
|
private int processTemplate()
{
ServletRequest req = pageContext.getRequest();
Template.TemplateContext tc = (Template.TemplateContext)
req.getAttribute(TEMPLATE_SECTIONS);
if (tc.secs == null) {
tc.secs = new HashMap();
}
assert (tc.secs != null);
if (!_visible) {
// set the section so that it doesn't contain anything
tc.secs.put(_name,"");
localRelease();
return EVAL_PAGE;
}
if (hasErrors()) {
String s = getErrorsReport();
tc.secs.put(_name,s);
localRelease();
return EVAL_PAGE;
}
BodyContent bc = getBodyContent();
String content = (bc != null) ? bc.getString() : "";
tc.secs.put(_name,content);
localRelease();
return EVAL_PAGE;
}
|
java
|
private int processTemplate()
{
ServletRequest req = pageContext.getRequest();
Template.TemplateContext tc = (Template.TemplateContext)
req.getAttribute(TEMPLATE_SECTIONS);
if (tc.secs == null) {
tc.secs = new HashMap();
}
assert (tc.secs != null);
if (!_visible) {
// set the section so that it doesn't contain anything
tc.secs.put(_name,"");
localRelease();
return EVAL_PAGE;
}
if (hasErrors()) {
String s = getErrorsReport();
tc.secs.put(_name,s);
localRelease();
return EVAL_PAGE;
}
BodyContent bc = getBodyContent();
String content = (bc != null) ? bc.getString() : "";
tc.secs.put(_name,content);
localRelease();
return EVAL_PAGE;
}
|
[
"private",
"int",
"processTemplate",
"(",
")",
"{",
"ServletRequest",
"req",
"=",
"pageContext",
".",
"getRequest",
"(",
")",
";",
"Template",
".",
"TemplateContext",
"tc",
"=",
"(",
"Template",
".",
"TemplateContext",
")",
"req",
".",
"getAttribute",
"(",
"TEMPLATE_SECTIONS",
")",
";",
"if",
"(",
"tc",
".",
"secs",
"==",
"null",
")",
"{",
"tc",
".",
"secs",
"=",
"new",
"HashMap",
"(",
")",
";",
"}",
"assert",
"(",
"tc",
".",
"secs",
"!=",
"null",
")",
";",
"if",
"(",
"!",
"_visible",
")",
"{",
"// set the section so that it doesn't contain anything",
"tc",
".",
"secs",
".",
"put",
"(",
"_name",
",",
"\"\"",
")",
";",
"localRelease",
"(",
")",
";",
"return",
"EVAL_PAGE",
";",
"}",
"if",
"(",
"hasErrors",
"(",
")",
")",
"{",
"String",
"s",
"=",
"getErrorsReport",
"(",
")",
";",
"tc",
".",
"secs",
".",
"put",
"(",
"_name",
",",
"s",
")",
";",
"localRelease",
"(",
")",
";",
"return",
"EVAL_PAGE",
";",
"}",
"BodyContent",
"bc",
"=",
"getBodyContent",
"(",
")",
";",
"String",
"content",
"=",
"(",
"bc",
"!=",
"null",
")",
"?",
"bc",
".",
"getString",
"(",
")",
":",
"\"\"",
";",
"tc",
".",
"secs",
".",
"put",
"(",
"_name",
",",
"content",
")",
";",
"localRelease",
"(",
")",
";",
"return",
"EVAL_PAGE",
";",
"}"
] |
This method will process the section in the context of the Template
@return returns the integer code doEndTag() will return.
|
[
"This",
"method",
"will",
"process",
"the",
"section",
"in",
"the",
"context",
"of",
"the",
"Template"
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/template/Section.java#L292-L322
|
146,886
|
moparisthebest/beehive
|
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/InheritableState.java
|
InheritableState.getImageRoot
|
public String getImageRoot()
{
if (_imageRoot != null)
return _imageRoot;
if (_parent != null)
return _parent.getImageRoot();
return null;
}
|
java
|
public String getImageRoot()
{
if (_imageRoot != null)
return _imageRoot;
if (_parent != null)
return _parent.getImageRoot();
return null;
}
|
[
"public",
"String",
"getImageRoot",
"(",
")",
"{",
"if",
"(",
"_imageRoot",
"!=",
"null",
")",
"return",
"_imageRoot",
";",
"if",
"(",
"_parent",
"!=",
"null",
")",
"return",
"_parent",
".",
"getImageRoot",
"(",
")",
";",
"return",
"null",
";",
"}"
] |
Return the default location of all images. It is used as the location
for the tree structure images.
@return String
|
[
"Return",
"the",
"default",
"location",
"of",
"all",
"images",
".",
"It",
"is",
"used",
"as",
"the",
"location",
"for",
"the",
"tree",
"structure",
"images",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/InheritableState.java#L253-L260
|
146,887
|
moparisthebest/beehive
|
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/InheritableState.java
|
InheritableState.getRealIconRoot
|
private String getRealIconRoot()
{
if (_iconRoot != null)
return _iconRoot;
if (_parent != null)
return _parent.getRealIconRoot();
return null;
}
|
java
|
private String getRealIconRoot()
{
if (_iconRoot != null)
return _iconRoot;
if (_parent != null)
return _parent.getRealIconRoot();
return null;
}
|
[
"private",
"String",
"getRealIconRoot",
"(",
")",
"{",
"if",
"(",
"_iconRoot",
"!=",
"null",
")",
"return",
"_iconRoot",
";",
"if",
"(",
"_parent",
"!=",
"null",
")",
"return",
"_parent",
".",
"getRealIconRoot",
"(",
")",
";",
"return",
"null",
";",
"}"
] |
This method will walk the inheritable state looking for an icon root.
It returns null if not found.
@return the icon root or null.
|
[
"This",
"method",
"will",
"walk",
"the",
"inheritable",
"state",
"looking",
"for",
"an",
"icon",
"root",
".",
"It",
"returns",
"null",
"if",
"not",
"found",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/InheritableState.java#L289-L296
|
146,888
|
moparisthebest/beehive
|
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/InheritableState.java
|
InheritableState.initalizeTreeState
|
public void initalizeTreeState()
{
_lastNodeExpandedImage = IMAGE_NODE_EXPAND_LAST;
_nodeExpandedImage = IMAGE_NODE_EXPAND;
_lastNodeCollapsedImage = IMAGE_NODE_COLLAPSE_LAST;
_nodeCollapsedImage = IMAGE_NODE_COLLAPSE;
_lastLineJoinImage = IMAGE_LINE_JOIN_LAST;
_lineJoinImage = IMAGE_LINE_JOIN;
_verticalLineImage = IMAGE_LINE_VERTICAL;
_imageSpacer = IMAGE_SPACER;
_defaultIcon = DEFAULT_ICON;
_imageRoot = null;
_selectionAction = null;
_expansionAction = null;
}
|
java
|
public void initalizeTreeState()
{
_lastNodeExpandedImage = IMAGE_NODE_EXPAND_LAST;
_nodeExpandedImage = IMAGE_NODE_EXPAND;
_lastNodeCollapsedImage = IMAGE_NODE_COLLAPSE_LAST;
_nodeCollapsedImage = IMAGE_NODE_COLLAPSE;
_lastLineJoinImage = IMAGE_LINE_JOIN_LAST;
_lineJoinImage = IMAGE_LINE_JOIN;
_verticalLineImage = IMAGE_LINE_VERTICAL;
_imageSpacer = IMAGE_SPACER;
_defaultIcon = DEFAULT_ICON;
_imageRoot = null;
_selectionAction = null;
_expansionAction = null;
}
|
[
"public",
"void",
"initalizeTreeState",
"(",
")",
"{",
"_lastNodeExpandedImage",
"=",
"IMAGE_NODE_EXPAND_LAST",
";",
"_nodeExpandedImage",
"=",
"IMAGE_NODE_EXPAND",
";",
"_lastNodeCollapsedImage",
"=",
"IMAGE_NODE_COLLAPSE_LAST",
";",
"_nodeCollapsedImage",
"=",
"IMAGE_NODE_COLLAPSE",
";",
"_lastLineJoinImage",
"=",
"IMAGE_LINE_JOIN_LAST",
";",
"_lineJoinImage",
"=",
"IMAGE_LINE_JOIN",
";",
"_verticalLineImage",
"=",
"IMAGE_LINE_VERTICAL",
";",
"_imageSpacer",
"=",
"IMAGE_SPACER",
";",
"_defaultIcon",
"=",
"DEFAULT_ICON",
";",
"_imageRoot",
"=",
"null",
";",
"_selectionAction",
"=",
"null",
";",
"_expansionAction",
"=",
"null",
";",
"}"
] |
This method initalizes the state of the properties to their default values used by the
tree tag to create the tree markup.
|
[
"This",
"method",
"initalizes",
"the",
"state",
"of",
"the",
"properties",
"to",
"their",
"default",
"values",
"used",
"by",
"the",
"tree",
"tag",
"to",
"create",
"the",
"tree",
"markup",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/InheritableState.java#L311-L326
|
146,889
|
iig-uni-freiburg/SEWOL
|
ext/org/deckfour/xes/extension/XExtensionManager.java
|
XExtensionManager.register
|
public void register(XExtension extension) {
extensionMap.put(extension.getUri(), extension);
// replace the registered index in the list with the new extension.
int i = extensionList.indexOf(extension);
if (i < 0) {
extensionList.add(extension);
} else {
extensionList.remove(i);
extensionList.add(i, extension);
}
}
|
java
|
public void register(XExtension extension) {
extensionMap.put(extension.getUri(), extension);
// replace the registered index in the list with the new extension.
int i = extensionList.indexOf(extension);
if (i < 0) {
extensionList.add(extension);
} else {
extensionList.remove(i);
extensionList.add(i, extension);
}
}
|
[
"public",
"void",
"register",
"(",
"XExtension",
"extension",
")",
"{",
"extensionMap",
".",
"put",
"(",
"extension",
".",
"getUri",
"(",
")",
",",
"extension",
")",
";",
"// replace the registered index in the list with the new extension.",
"int",
"i",
"=",
"extensionList",
".",
"indexOf",
"(",
"extension",
")",
";",
"if",
"(",
"i",
"<",
"0",
")",
"{",
"extensionList",
".",
"add",
"(",
"extension",
")",
";",
"}",
"else",
"{",
"extensionList",
".",
"remove",
"(",
"i",
")",
";",
"extensionList",
".",
"add",
"(",
"i",
",",
"extension",
")",
";",
"}",
"}"
] |
Explicitly registers an extension instance with the extension
manager.
@param extension The extension to be registered.
|
[
"Explicitly",
"registers",
"an",
"extension",
"instance",
"with",
"the",
"extension",
"manager",
"."
] |
e791cb07a6e62ecf837d760d58a25f32fbf6bbca
|
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/ext/org/deckfour/xes/extension/XExtensionManager.java#L132-L142
|
146,890
|
iig-uni-freiburg/SEWOL
|
ext/org/deckfour/xes/extension/XExtensionManager.java
|
XExtensionManager.getByUri
|
public XExtension getByUri(URI uri) {
XExtension extension = extensionMap.get(uri);
if (extension == null) {
try {
extension = XExtensionParser.instance().parse(uri);
register(extension);
XLogging.log("Imported XES extension '" + extension.getUri()
+ "' from remote source", XLogging.Importance.DEBUG);
} catch (IOException e) {
// Now do something if the Internet is down...
} catch (ParserConfigurationException | SAXException e) {
e.printStackTrace();
return null;
}
cacheExtension(uri);
}
return extension;
}
|
java
|
public XExtension getByUri(URI uri) {
XExtension extension = extensionMap.get(uri);
if (extension == null) {
try {
extension = XExtensionParser.instance().parse(uri);
register(extension);
XLogging.log("Imported XES extension '" + extension.getUri()
+ "' from remote source", XLogging.Importance.DEBUG);
} catch (IOException e) {
// Now do something if the Internet is down...
} catch (ParserConfigurationException | SAXException e) {
e.printStackTrace();
return null;
}
cacheExtension(uri);
}
return extension;
}
|
[
"public",
"XExtension",
"getByUri",
"(",
"URI",
"uri",
")",
"{",
"XExtension",
"extension",
"=",
"extensionMap",
".",
"get",
"(",
"uri",
")",
";",
"if",
"(",
"extension",
"==",
"null",
")",
"{",
"try",
"{",
"extension",
"=",
"XExtensionParser",
".",
"instance",
"(",
")",
".",
"parse",
"(",
"uri",
")",
";",
"register",
"(",
"extension",
")",
";",
"XLogging",
".",
"log",
"(",
"\"Imported XES extension '\"",
"+",
"extension",
".",
"getUri",
"(",
")",
"+",
"\"' from remote source\"",
",",
"XLogging",
".",
"Importance",
".",
"DEBUG",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"// Now do something if the Internet is down...",
"}",
"catch",
"(",
"ParserConfigurationException",
"|",
"SAXException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"return",
"null",
";",
"}",
"cacheExtension",
"(",
"uri",
")",
";",
"}",
"return",
"extension",
";",
"}"
] |
Retrieves an extension instance by its unique URI. If the extension
has not been registered before, it is looked up in the local cache.
If it cannot be found in the cache, the manager attempts to download
it from its unique URI, and add it to the set of managed extensions.
@param uri The unique URI of the requested extension.
@return The requested extension.
|
[
"Retrieves",
"an",
"extension",
"instance",
"by",
"its",
"unique",
"URI",
".",
"If",
"the",
"extension",
"has",
"not",
"been",
"registered",
"before",
"it",
"is",
"looked",
"up",
"in",
"the",
"local",
"cache",
".",
"If",
"it",
"cannot",
"be",
"found",
"in",
"the",
"cache",
"the",
"manager",
"attempts",
"to",
"download",
"it",
"from",
"its",
"unique",
"URI",
"and",
"add",
"it",
"to",
"the",
"set",
"of",
"managed",
"extensions",
"."
] |
e791cb07a6e62ecf837d760d58a25f32fbf6bbca
|
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/ext/org/deckfour/xes/extension/XExtensionManager.java#L153-L171
|
146,891
|
iig-uni-freiburg/SEWOL
|
ext/org/deckfour/xes/extension/XExtensionManager.java
|
XExtensionManager.registerStandardExtensions
|
protected final void registerStandardExtensions() {
register(XConceptExtension.instance());
register(XTimeExtension.instance());
register(XLifecycleExtension.instance());
register(XOrganizationalExtension.instance());
register(XSemanticExtension.instance());
}
|
java
|
protected final void registerStandardExtensions() {
register(XConceptExtension.instance());
register(XTimeExtension.instance());
register(XLifecycleExtension.instance());
register(XOrganizationalExtension.instance());
register(XSemanticExtension.instance());
}
|
[
"protected",
"final",
"void",
"registerStandardExtensions",
"(",
")",
"{",
"register",
"(",
"XConceptExtension",
".",
"instance",
"(",
")",
")",
";",
"register",
"(",
"XTimeExtension",
".",
"instance",
"(",
")",
")",
";",
"register",
"(",
"XLifecycleExtension",
".",
"instance",
"(",
")",
")",
";",
"register",
"(",
"XOrganizationalExtension",
".",
"instance",
"(",
")",
")",
";",
"register",
"(",
"XSemanticExtension",
".",
"instance",
"(",
")",
")",
";",
"}"
] |
Registers all defined standard extensions with the extension manager
before caching.
|
[
"Registers",
"all",
"defined",
"standard",
"extensions",
"with",
"the",
"extension",
"manager",
"before",
"caching",
"."
] |
e791cb07a6e62ecf837d760d58a25f32fbf6bbca
|
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/ext/org/deckfour/xes/extension/XExtensionManager.java#L244-L250
|
146,892
|
iig-uni-freiburg/SEWOL
|
ext/org/deckfour/xes/extension/XExtensionManager.java
|
XExtensionManager.cacheExtension
|
protected void cacheExtension(URI uri) {
// extract extension file name from URI
String uriStr = uri.toString().toLowerCase();
if (uriStr.endsWith("/")) {
uriStr = uriStr.substring(0, uriStr.length() - 1);
}
String fileName = uriStr.substring(uriStr.lastIndexOf('/'));
if (fileName.endsWith(".xesext") == false) {
fileName += ".xesext";
}
File cacheFile = new File(XRuntimeUtils.getExtensionCacheFolder().getAbsolutePath() + File.separator + fileName);
if (uri.toString().equals(DATAUSAGE_EXTENSION_URI)) {
InputStream in = XExtensionManager.class.getResourceAsStream(DATAUSAGE_EXTENSION_LOCAL_PATH);
try {
final Path targetPath = cacheFile.toPath();
Files.copy(in, targetPath);
XLogging.log("Cached XES extension '" + uri + "'", XLogging.Importance.DEBUG);
} catch (IOException ex) {
ex.printStackTrace();
}
} else {
// download extension file to cache directory
try {
byte[] buffer = new byte[1024];
BufferedOutputStream bos;
try (BufferedInputStream bis = new BufferedInputStream(uri.toURL()
.openStream())) {
cacheFile.createNewFile();
bos = new BufferedOutputStream(
new FileOutputStream(cacheFile));
int read = bis.read(buffer);
while (read >= 0) {
bos.write(buffer, 0, read);
read = bis.read(buffer);
}
}
bos.flush();
bos.close();
XLogging.log("Cached XES extension '" + uri + "'", XLogging.Importance.DEBUG);
} catch (IOException e) {
e.printStackTrace();
}
}
}
|
java
|
protected void cacheExtension(URI uri) {
// extract extension file name from URI
String uriStr = uri.toString().toLowerCase();
if (uriStr.endsWith("/")) {
uriStr = uriStr.substring(0, uriStr.length() - 1);
}
String fileName = uriStr.substring(uriStr.lastIndexOf('/'));
if (fileName.endsWith(".xesext") == false) {
fileName += ".xesext";
}
File cacheFile = new File(XRuntimeUtils.getExtensionCacheFolder().getAbsolutePath() + File.separator + fileName);
if (uri.toString().equals(DATAUSAGE_EXTENSION_URI)) {
InputStream in = XExtensionManager.class.getResourceAsStream(DATAUSAGE_EXTENSION_LOCAL_PATH);
try {
final Path targetPath = cacheFile.toPath();
Files.copy(in, targetPath);
XLogging.log("Cached XES extension '" + uri + "'", XLogging.Importance.DEBUG);
} catch (IOException ex) {
ex.printStackTrace();
}
} else {
// download extension file to cache directory
try {
byte[] buffer = new byte[1024];
BufferedOutputStream bos;
try (BufferedInputStream bis = new BufferedInputStream(uri.toURL()
.openStream())) {
cacheFile.createNewFile();
bos = new BufferedOutputStream(
new FileOutputStream(cacheFile));
int read = bis.read(buffer);
while (read >= 0) {
bos.write(buffer, 0, read);
read = bis.read(buffer);
}
}
bos.flush();
bos.close();
XLogging.log("Cached XES extension '" + uri + "'", XLogging.Importance.DEBUG);
} catch (IOException e) {
e.printStackTrace();
}
}
}
|
[
"protected",
"void",
"cacheExtension",
"(",
"URI",
"uri",
")",
"{",
"// extract extension file name from URI",
"String",
"uriStr",
"=",
"uri",
".",
"toString",
"(",
")",
".",
"toLowerCase",
"(",
")",
";",
"if",
"(",
"uriStr",
".",
"endsWith",
"(",
"\"/\"",
")",
")",
"{",
"uriStr",
"=",
"uriStr",
".",
"substring",
"(",
"0",
",",
"uriStr",
".",
"length",
"(",
")",
"-",
"1",
")",
";",
"}",
"String",
"fileName",
"=",
"uriStr",
".",
"substring",
"(",
"uriStr",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
")",
";",
"if",
"(",
"fileName",
".",
"endsWith",
"(",
"\".xesext\"",
")",
"==",
"false",
")",
"{",
"fileName",
"+=",
"\".xesext\"",
";",
"}",
"File",
"cacheFile",
"=",
"new",
"File",
"(",
"XRuntimeUtils",
".",
"getExtensionCacheFolder",
"(",
")",
".",
"getAbsolutePath",
"(",
")",
"+",
"File",
".",
"separator",
"+",
"fileName",
")",
";",
"if",
"(",
"uri",
".",
"toString",
"(",
")",
".",
"equals",
"(",
"DATAUSAGE_EXTENSION_URI",
")",
")",
"{",
"InputStream",
"in",
"=",
"XExtensionManager",
".",
"class",
".",
"getResourceAsStream",
"(",
"DATAUSAGE_EXTENSION_LOCAL_PATH",
")",
";",
"try",
"{",
"final",
"Path",
"targetPath",
"=",
"cacheFile",
".",
"toPath",
"(",
")",
";",
"Files",
".",
"copy",
"(",
"in",
",",
"targetPath",
")",
";",
"XLogging",
".",
"log",
"(",
"\"Cached XES extension '\"",
"+",
"uri",
"+",
"\"'\"",
",",
"XLogging",
".",
"Importance",
".",
"DEBUG",
")",
";",
"}",
"catch",
"(",
"IOException",
"ex",
")",
"{",
"ex",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}",
"else",
"{",
"// download extension file to cache directory",
"try",
"{",
"byte",
"[",
"]",
"buffer",
"=",
"new",
"byte",
"[",
"1024",
"]",
";",
"BufferedOutputStream",
"bos",
";",
"try",
"(",
"BufferedInputStream",
"bis",
"=",
"new",
"BufferedInputStream",
"(",
"uri",
".",
"toURL",
"(",
")",
".",
"openStream",
"(",
")",
")",
")",
"{",
"cacheFile",
".",
"createNewFile",
"(",
")",
";",
"bos",
"=",
"new",
"BufferedOutputStream",
"(",
"new",
"FileOutputStream",
"(",
"cacheFile",
")",
")",
";",
"int",
"read",
"=",
"bis",
".",
"read",
"(",
"buffer",
")",
";",
"while",
"(",
"read",
">=",
"0",
")",
"{",
"bos",
".",
"write",
"(",
"buffer",
",",
"0",
",",
"read",
")",
";",
"read",
"=",
"bis",
".",
"read",
"(",
"buffer",
")",
";",
"}",
"}",
"bos",
".",
"flush",
"(",
")",
";",
"bos",
".",
"close",
"(",
")",
";",
"XLogging",
".",
"log",
"(",
"\"Cached XES extension '\"",
"+",
"uri",
"+",
"\"'\"",
",",
"XLogging",
".",
"Importance",
".",
"DEBUG",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}",
"}"
] |
Downloads and caches an extension from its remote definition file.
The extension is subsequently placed in the local cache, so that
future loading is accelerated.
@param uri Unique URI of the extension which is to be cached.
|
[
"Downloads",
"and",
"caches",
"an",
"extension",
"from",
"its",
"remote",
"definition",
"file",
".",
"The",
"extension",
"is",
"subsequently",
"placed",
"in",
"the",
"local",
"cache",
"so",
"that",
"future",
"loading",
"is",
"accelerated",
"."
] |
e791cb07a6e62ecf837d760d58a25f32fbf6bbca
|
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/ext/org/deckfour/xes/extension/XExtensionManager.java#L259-L302
|
146,893
|
iig-uni-freiburg/SEWOL
|
ext/org/deckfour/xes/extension/XExtensionManager.java
|
XExtensionManager.loadExtensionCache
|
protected final void loadExtensionCache() {
// threshold for discarding old cache files
long minModified = System.currentTimeMillis() - MAX_CACHE_MILLIS;
File extFolder = XRuntimeUtils.getExtensionCacheFolder();
XExtension extension;
File[] extFiles = extFolder.listFiles();
if (extFiles == null) {
// Extension folder may be non-existant for virtual users with no
// home directory
XLogging.log(
"Extension caching disabled (Could not access cache directory)!",
XLogging.Importance.WARNING);
return;
}
for (File extFile : extFiles) {
if (extFile.getName().toLowerCase().endsWith(".xesext") == false) {
// no real extension
continue;
}
if (extFile.lastModified() < minModified) {
// remove outdated cache files
if (extFile.delete() == false) {
extFile.deleteOnExit();
}
} else {
// load extension file
try {
extension = XExtensionParser.instance().parse(extFile);
if (extensionMap.containsKey((extension).getUri()) == false) {
extensionMap.put(extension.getUri(), extension);
extensionList.add(extension);
XLogging.log(
"Loaded XES extension '" + extension.getUri()
+ "' from cache",
XLogging.Importance.DEBUG);
} else {
XLogging.log("Skipping cached XES extension '"
+ extension.getUri() + "' (already defined)",
XLogging.Importance.DEBUG);
}
} catch (IOException | ParserConfigurationException | SAXException e) {
// ignore bad apples for now
e.printStackTrace();
}
}
}
}
|
java
|
protected final void loadExtensionCache() {
// threshold for discarding old cache files
long minModified = System.currentTimeMillis() - MAX_CACHE_MILLIS;
File extFolder = XRuntimeUtils.getExtensionCacheFolder();
XExtension extension;
File[] extFiles = extFolder.listFiles();
if (extFiles == null) {
// Extension folder may be non-existant for virtual users with no
// home directory
XLogging.log(
"Extension caching disabled (Could not access cache directory)!",
XLogging.Importance.WARNING);
return;
}
for (File extFile : extFiles) {
if (extFile.getName().toLowerCase().endsWith(".xesext") == false) {
// no real extension
continue;
}
if (extFile.lastModified() < minModified) {
// remove outdated cache files
if (extFile.delete() == false) {
extFile.deleteOnExit();
}
} else {
// load extension file
try {
extension = XExtensionParser.instance().parse(extFile);
if (extensionMap.containsKey((extension).getUri()) == false) {
extensionMap.put(extension.getUri(), extension);
extensionList.add(extension);
XLogging.log(
"Loaded XES extension '" + extension.getUri()
+ "' from cache",
XLogging.Importance.DEBUG);
} else {
XLogging.log("Skipping cached XES extension '"
+ extension.getUri() + "' (already defined)",
XLogging.Importance.DEBUG);
}
} catch (IOException | ParserConfigurationException | SAXException e) {
// ignore bad apples for now
e.printStackTrace();
}
}
}
}
|
[
"protected",
"final",
"void",
"loadExtensionCache",
"(",
")",
"{",
"// threshold for discarding old cache files",
"long",
"minModified",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
"-",
"MAX_CACHE_MILLIS",
";",
"File",
"extFolder",
"=",
"XRuntimeUtils",
".",
"getExtensionCacheFolder",
"(",
")",
";",
"XExtension",
"extension",
";",
"File",
"[",
"]",
"extFiles",
"=",
"extFolder",
".",
"listFiles",
"(",
")",
";",
"if",
"(",
"extFiles",
"==",
"null",
")",
"{",
"// Extension folder may be non-existant for virtual users with no",
"// home directory",
"XLogging",
".",
"log",
"(",
"\"Extension caching disabled (Could not access cache directory)!\"",
",",
"XLogging",
".",
"Importance",
".",
"WARNING",
")",
";",
"return",
";",
"}",
"for",
"(",
"File",
"extFile",
":",
"extFiles",
")",
"{",
"if",
"(",
"extFile",
".",
"getName",
"(",
")",
".",
"toLowerCase",
"(",
")",
".",
"endsWith",
"(",
"\".xesext\"",
")",
"==",
"false",
")",
"{",
"// no real extension",
"continue",
";",
"}",
"if",
"(",
"extFile",
".",
"lastModified",
"(",
")",
"<",
"minModified",
")",
"{",
"// remove outdated cache files",
"if",
"(",
"extFile",
".",
"delete",
"(",
")",
"==",
"false",
")",
"{",
"extFile",
".",
"deleteOnExit",
"(",
")",
";",
"}",
"}",
"else",
"{",
"// load extension file",
"try",
"{",
"extension",
"=",
"XExtensionParser",
".",
"instance",
"(",
")",
".",
"parse",
"(",
"extFile",
")",
";",
"if",
"(",
"extensionMap",
".",
"containsKey",
"(",
"(",
"extension",
")",
".",
"getUri",
"(",
")",
")",
"==",
"false",
")",
"{",
"extensionMap",
".",
"put",
"(",
"extension",
".",
"getUri",
"(",
")",
",",
"extension",
")",
";",
"extensionList",
".",
"add",
"(",
"extension",
")",
";",
"XLogging",
".",
"log",
"(",
"\"Loaded XES extension '\"",
"+",
"extension",
".",
"getUri",
"(",
")",
"+",
"\"' from cache\"",
",",
"XLogging",
".",
"Importance",
".",
"DEBUG",
")",
";",
"}",
"else",
"{",
"XLogging",
".",
"log",
"(",
"\"Skipping cached XES extension '\"",
"+",
"extension",
".",
"getUri",
"(",
")",
"+",
"\"' (already defined)\"",
",",
"XLogging",
".",
"Importance",
".",
"DEBUG",
")",
";",
"}",
"}",
"catch",
"(",
"IOException",
"|",
"ParserConfigurationException",
"|",
"SAXException",
"e",
")",
"{",
"// ignore bad apples for now",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}",
"}",
"}"
] |
Loads all extensions stored in the local cache. Cached extensions
which exceed the maximum caching age are discarded, and downloaded
freshly.
|
[
"Loads",
"all",
"extensions",
"stored",
"in",
"the",
"local",
"cache",
".",
"Cached",
"extensions",
"which",
"exceed",
"the",
"maximum",
"caching",
"age",
"are",
"discarded",
"and",
"downloaded",
"freshly",
"."
] |
e791cb07a6e62ecf837d760d58a25f32fbf6bbca
|
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/ext/org/deckfour/xes/extension/XExtensionManager.java#L309-L356
|
146,894
|
moparisthebest/beehive
|
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowContext.java
|
PageFlowContext.get
|
public Object get(String name, PageFlowContextActivator activator)
{
assert (name != null) : "Parameter 'name' must not be null";
assert (activator != null) : "Parameter 'activator' must not be null";
Object ret = _contexts.get(name);
if (ret == null) {
ret = activator.activate();
_contexts.put(name,ret);
}
return ret;
}
|
java
|
public Object get(String name, PageFlowContextActivator activator)
{
assert (name != null) : "Parameter 'name' must not be null";
assert (activator != null) : "Parameter 'activator' must not be null";
Object ret = _contexts.get(name);
if (ret == null) {
ret = activator.activate();
_contexts.put(name,ret);
}
return ret;
}
|
[
"public",
"Object",
"get",
"(",
"String",
"name",
",",
"PageFlowContextActivator",
"activator",
")",
"{",
"assert",
"(",
"name",
"!=",
"null",
")",
":",
"\"Parameter 'name' must not be null\"",
";",
"assert",
"(",
"activator",
"!=",
"null",
")",
":",
"\"Parameter 'activator' must not be null\"",
";",
"Object",
"ret",
"=",
"_contexts",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",
"ret",
"==",
"null",
")",
"{",
"ret",
"=",
"activator",
".",
"activate",
"(",
")",
";",
"_contexts",
".",
"put",
"(",
"name",
",",
"ret",
")",
";",
"}",
"return",
"ret",
";",
"}"
] |
This method will lookup a named object and return it. The object is
looked up by name. If the object doesn't exist, the activator object is
called to create a new instance of the object before it is returned.
@param name The name of the object to return
@param activator An <code>PageFlowContextActivator</code> that will create the new object if
it doesn't exist.
@return The object stored by the name.
|
[
"This",
"method",
"will",
"lookup",
"a",
"named",
"object",
"and",
"return",
"it",
".",
"The",
"object",
"is",
"looked",
"up",
"by",
"name",
".",
"If",
"the",
"object",
"doesn",
"t",
"exist",
"the",
"activator",
"object",
"is",
"called",
"to",
"create",
"a",
"new",
"instance",
"of",
"the",
"object",
"before",
"it",
"is",
"returned",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowContext.java#L121-L132
|
146,895
|
moparisthebest/beehive
|
beehive-netui-compiler/src/main/java/org/apache/beehive/netui/compiler/FlowControllerChecker.java
|
FlowControllerChecker.checkConditionalForwardsExpressions
|
private void checkConditionalForwardsExpressions(ClassDeclaration jclass)
throws FatalCompileTimeException
{
// Get simple actions in the Controller annotation.
List simpleActions =
CompilerUtils.getAnnotationArrayValue(jclass, CONTROLLER_TAG_NAME, SIMPLE_ACTIONS_ATTR, true);
if (simpleActions != null) {
HashSet expressionsFound = new HashSet();
for (Iterator j = simpleActions.iterator(); j.hasNext();) {
AnnotationInstance sa = (AnnotationInstance) j.next();
List conditionalForwards = CompilerUtils.getAnnotationArray(sa, CONDITIONAL_FORWARDS_ATTR, true);
if (conditionalForwards != null) {
for (Iterator k = conditionalForwards.iterator(); k.hasNext();) {
AnnotationInstance cf = (AnnotationInstance) k.next();
String expression = CompilerUtils.getString(cf, CONDITION_ATTR, true);
assert expression != null;
if (expressionsFound.contains(expression)) {
String name = CompilerUtils.getString(sa, NAME_ATTR, true);
getDiagnostics().addWarning(cf, "warning.duplicate-conditional-forward-expression",expression, name);
}
else {
expressionsFound.add(expression);
}
}
}
expressionsFound.clear();
}
}
}
|
java
|
private void checkConditionalForwardsExpressions(ClassDeclaration jclass)
throws FatalCompileTimeException
{
// Get simple actions in the Controller annotation.
List simpleActions =
CompilerUtils.getAnnotationArrayValue(jclass, CONTROLLER_TAG_NAME, SIMPLE_ACTIONS_ATTR, true);
if (simpleActions != null) {
HashSet expressionsFound = new HashSet();
for (Iterator j = simpleActions.iterator(); j.hasNext();) {
AnnotationInstance sa = (AnnotationInstance) j.next();
List conditionalForwards = CompilerUtils.getAnnotationArray(sa, CONDITIONAL_FORWARDS_ATTR, true);
if (conditionalForwards != null) {
for (Iterator k = conditionalForwards.iterator(); k.hasNext();) {
AnnotationInstance cf = (AnnotationInstance) k.next();
String expression = CompilerUtils.getString(cf, CONDITION_ATTR, true);
assert expression != null;
if (expressionsFound.contains(expression)) {
String name = CompilerUtils.getString(sa, NAME_ATTR, true);
getDiagnostics().addWarning(cf, "warning.duplicate-conditional-forward-expression",expression, name);
}
else {
expressionsFound.add(expression);
}
}
}
expressionsFound.clear();
}
}
}
|
[
"private",
"void",
"checkConditionalForwardsExpressions",
"(",
"ClassDeclaration",
"jclass",
")",
"throws",
"FatalCompileTimeException",
"{",
"// Get simple actions in the Controller annotation.",
"List",
"simpleActions",
"=",
"CompilerUtils",
".",
"getAnnotationArrayValue",
"(",
"jclass",
",",
"CONTROLLER_TAG_NAME",
",",
"SIMPLE_ACTIONS_ATTR",
",",
"true",
")",
";",
"if",
"(",
"simpleActions",
"!=",
"null",
")",
"{",
"HashSet",
"expressionsFound",
"=",
"new",
"HashSet",
"(",
")",
";",
"for",
"(",
"Iterator",
"j",
"=",
"simpleActions",
".",
"iterator",
"(",
")",
";",
"j",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"AnnotationInstance",
"sa",
"=",
"(",
"AnnotationInstance",
")",
"j",
".",
"next",
"(",
")",
";",
"List",
"conditionalForwards",
"=",
"CompilerUtils",
".",
"getAnnotationArray",
"(",
"sa",
",",
"CONDITIONAL_FORWARDS_ATTR",
",",
"true",
")",
";",
"if",
"(",
"conditionalForwards",
"!=",
"null",
")",
"{",
"for",
"(",
"Iterator",
"k",
"=",
"conditionalForwards",
".",
"iterator",
"(",
")",
";",
"k",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"AnnotationInstance",
"cf",
"=",
"(",
"AnnotationInstance",
")",
"k",
".",
"next",
"(",
")",
";",
"String",
"expression",
"=",
"CompilerUtils",
".",
"getString",
"(",
"cf",
",",
"CONDITION_ATTR",
",",
"true",
")",
";",
"assert",
"expression",
"!=",
"null",
";",
"if",
"(",
"expressionsFound",
".",
"contains",
"(",
"expression",
")",
")",
"{",
"String",
"name",
"=",
"CompilerUtils",
".",
"getString",
"(",
"sa",
",",
"NAME_ATTR",
",",
"true",
")",
";",
"getDiagnostics",
"(",
")",
".",
"addWarning",
"(",
"cf",
",",
"\"warning.duplicate-conditional-forward-expression\"",
",",
"expression",
",",
"name",
")",
";",
"}",
"else",
"{",
"expressionsFound",
".",
"add",
"(",
"expression",
")",
";",
"}",
"}",
"}",
"expressionsFound",
".",
"clear",
"(",
")",
";",
"}",
"}",
"}"
] |
Check for duplicate expressions in conditional forwards of the
simple action annotations.
|
[
"Check",
"for",
"duplicate",
"expressions",
"in",
"conditional",
"forwards",
"of",
"the",
"simple",
"action",
"annotations",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-compiler/src/main/java/org/apache/beehive/netui/compiler/FlowControllerChecker.java#L518-L549
|
146,896
|
moparisthebest/beehive
|
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/Forward.java
|
Forward.getFirstOutputForm
|
public ActionForm getFirstOutputForm( HttpServletRequest request )
{
if ( _outputForms == null || _outputForms.size() == 0 )
{
if ( _outputFormBeanType != null )
{
try
{
if ( _log.isDebugEnabled() )
{
_log.debug( "Creating form bean of type " + _outputFormBeanType );
}
ServletContext servletContext = InternalUtils.getServletContext( request );
ReloadableClassHandler rch = Handlers.get( servletContext ).getReloadableClassHandler();
Object formBean = rch.newInstance( _outputFormBeanType );
ActionForm wrappedFormBean = InternalUtils.wrapFormBean( formBean );
addOutputForm( wrappedFormBean );
return wrappedFormBean;
}
catch ( Exception e )
{
_log.error( "Could not create form bean instance of " + _outputFormBeanType, e );
}
}
return null;
}
else
{
return ( ActionForm ) _outputForms.get( 0 );
}
}
|
java
|
public ActionForm getFirstOutputForm( HttpServletRequest request )
{
if ( _outputForms == null || _outputForms.size() == 0 )
{
if ( _outputFormBeanType != null )
{
try
{
if ( _log.isDebugEnabled() )
{
_log.debug( "Creating form bean of type " + _outputFormBeanType );
}
ServletContext servletContext = InternalUtils.getServletContext( request );
ReloadableClassHandler rch = Handlers.get( servletContext ).getReloadableClassHandler();
Object formBean = rch.newInstance( _outputFormBeanType );
ActionForm wrappedFormBean = InternalUtils.wrapFormBean( formBean );
addOutputForm( wrappedFormBean );
return wrappedFormBean;
}
catch ( Exception e )
{
_log.error( "Could not create form bean instance of " + _outputFormBeanType, e );
}
}
return null;
}
else
{
return ( ActionForm ) _outputForms.get( 0 );
}
}
|
[
"public",
"ActionForm",
"getFirstOutputForm",
"(",
"HttpServletRequest",
"request",
")",
"{",
"if",
"(",
"_outputForms",
"==",
"null",
"||",
"_outputForms",
".",
"size",
"(",
")",
"==",
"0",
")",
"{",
"if",
"(",
"_outputFormBeanType",
"!=",
"null",
")",
"{",
"try",
"{",
"if",
"(",
"_log",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"_log",
".",
"debug",
"(",
"\"Creating form bean of type \"",
"+",
"_outputFormBeanType",
")",
";",
"}",
"ServletContext",
"servletContext",
"=",
"InternalUtils",
".",
"getServletContext",
"(",
"request",
")",
";",
"ReloadableClassHandler",
"rch",
"=",
"Handlers",
".",
"get",
"(",
"servletContext",
")",
".",
"getReloadableClassHandler",
"(",
")",
";",
"Object",
"formBean",
"=",
"rch",
".",
"newInstance",
"(",
"_outputFormBeanType",
")",
";",
"ActionForm",
"wrappedFormBean",
"=",
"InternalUtils",
".",
"wrapFormBean",
"(",
"formBean",
")",
";",
"addOutputForm",
"(",
"wrappedFormBean",
")",
";",
"return",
"wrappedFormBean",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"_log",
".",
"error",
"(",
"\"Could not create form bean instance of \"",
"+",
"_outputFormBeanType",
",",
"e",
")",
";",
"}",
"}",
"return",
"null",
";",
"}",
"else",
"{",
"return",
"(",
"ActionForm",
")",
"_outputForms",
".",
"get",
"(",
"0",
")",
";",
"}",
"}"
] |
Get the first output form bean that was added to this Forward.
|
[
"Get",
"the",
"first",
"output",
"form",
"bean",
"that",
"was",
"added",
"to",
"this",
"Forward",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/Forward.java#L349-L381
|
146,897
|
moparisthebest/beehive
|
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/Forward.java
|
Forward.findForward
|
protected ActionForward findForward( String forwardName )
{
ActionForward fwd = _mapping != null ? _mapping.findForward( forwardName ) : null;
if ( fwd != null )
{
return fwd;
}
else if ( _altModuleConfig != null )
{
return ( ActionForward ) _altModuleConfig.findForwardConfig( forwardName );
}
return null;
}
|
java
|
protected ActionForward findForward( String forwardName )
{
ActionForward fwd = _mapping != null ? _mapping.findForward( forwardName ) : null;
if ( fwd != null )
{
return fwd;
}
else if ( _altModuleConfig != null )
{
return ( ActionForward ) _altModuleConfig.findForwardConfig( forwardName );
}
return null;
}
|
[
"protected",
"ActionForward",
"findForward",
"(",
"String",
"forwardName",
")",
"{",
"ActionForward",
"fwd",
"=",
"_mapping",
"!=",
"null",
"?",
"_mapping",
".",
"findForward",
"(",
"forwardName",
")",
":",
"null",
";",
"if",
"(",
"fwd",
"!=",
"null",
")",
"{",
"return",
"fwd",
";",
"}",
"else",
"if",
"(",
"_altModuleConfig",
"!=",
"null",
")",
"{",
"return",
"(",
"ActionForward",
")",
"_altModuleConfig",
".",
"findForwardConfig",
"(",
"forwardName",
")",
";",
"}",
"return",
"null",
";",
"}"
] |
Resolves the forward with the given name, from the stored ActionMapping if possible, or
from the stored alternate ModuleConfig as a last resort.
@param forwardName the name of the forward to resolve.
@return the resolved ActionForward, or <code>null</code> if none is found.
|
[
"Resolves",
"the",
"forward",
"with",
"the",
"given",
"name",
"from",
"the",
"stored",
"ActionMapping",
"if",
"possible",
"or",
"from",
"the",
"stored",
"alternate",
"ModuleConfig",
"as",
"a",
"last",
"resort",
"."
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/Forward.java#L413-L427
|
146,898
|
moparisthebest/beehive
|
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/Forward.java
|
Forward.checkActionOutputs
|
private void checkActionOutputs( PageFlowActionForward fc )
{
PageFlowActionForward.ActionOutput[] actionOutputs = fc.getActionOutputs();
boolean doExpensiveChecks =
_actionOutputs != null
&& ! AdapterManager.getServletContainerAdapter( _servletContext ).isInProductionMode();
for ( int i = 0; i < actionOutputs.length; ++i )
{
PageFlowActionForward.ActionOutput actionOutput = actionOutputs[i];
if ( ! actionOutput.getNullable() )
{
String actionOutputName = actionOutput.getName();
if ( _actionOutputs == null || ! _actionOutputs.containsKey(actionOutputName) )
{
PageFlowException ex =
new MissingActionOutputException( _mappingPath, _flowController, actionOutput.getName(), getName() );
InternalUtils.throwPageFlowException( ex );
}
else if ( _actionOutputs.get(actionOutputName) == null )
{
PageFlowException ex =
new NullActionOutputException( _mappingPath, _flowController, actionOutput.getName(), getName() );
InternalUtils.throwPageFlowException( ex );
}
}
//
// If we're *not* in production mode, do some (expensive) checks to ensure that the types for the
// action outputs match their declared types.
//
if ( doExpensiveChecks )
{
Object actualActionOutput = _actionOutputs.get( actionOutput.getName() );
if ( actualActionOutput != null )
{
String expectedTypeName = actionOutput.getType();
int expectedArrayDims = 0;
while ( expectedTypeName.endsWith( "[]" ) )
{
++expectedArrayDims;
expectedTypeName = expectedTypeName.substring( 0, expectedTypeName.length() - 2 );
}
Class expectedType = ( Class ) PRIMITIVE_TYPES.get( expectedTypeName );
if ( expectedType == null )
{
try
{
ReloadableClassHandler rch = Handlers.get(_servletContext).getReloadableClassHandler();
expectedType = rch.loadClass( expectedTypeName );
}
catch ( ClassNotFoundException e )
{
_log.error( "Could not load expected action output type " + expectedTypeName
+ " for action output '" + actionOutput.getName() + "' on forward '"
+ fc.getName() + "'; skipping type check." );
continue;
}
}
Class actualType = actualActionOutput.getClass();
int actualArrayDims = 0;
InternalStringBuilder arraySuffix = new InternalStringBuilder();
while ( actualType.isArray() && actualArrayDims <= expectedArrayDims )
{
++actualArrayDims;
arraySuffix.append( "[]" );
actualType = actualType.getComponentType();
}
if ( actualArrayDims != expectedArrayDims || ! expectedType.isAssignableFrom( actualType ) )
{
PageFlowException ex =
new MismatchedActionOutputException( _mappingPath, _flowController,
actionOutput.getName(), getName(),
expectedTypeName,
actualType.getName() + arraySuffix );
InternalUtils.throwPageFlowException( ex );
}
}
}
}
}
|
java
|
private void checkActionOutputs( PageFlowActionForward fc )
{
PageFlowActionForward.ActionOutput[] actionOutputs = fc.getActionOutputs();
boolean doExpensiveChecks =
_actionOutputs != null
&& ! AdapterManager.getServletContainerAdapter( _servletContext ).isInProductionMode();
for ( int i = 0; i < actionOutputs.length; ++i )
{
PageFlowActionForward.ActionOutput actionOutput = actionOutputs[i];
if ( ! actionOutput.getNullable() )
{
String actionOutputName = actionOutput.getName();
if ( _actionOutputs == null || ! _actionOutputs.containsKey(actionOutputName) )
{
PageFlowException ex =
new MissingActionOutputException( _mappingPath, _flowController, actionOutput.getName(), getName() );
InternalUtils.throwPageFlowException( ex );
}
else if ( _actionOutputs.get(actionOutputName) == null )
{
PageFlowException ex =
new NullActionOutputException( _mappingPath, _flowController, actionOutput.getName(), getName() );
InternalUtils.throwPageFlowException( ex );
}
}
//
// If we're *not* in production mode, do some (expensive) checks to ensure that the types for the
// action outputs match their declared types.
//
if ( doExpensiveChecks )
{
Object actualActionOutput = _actionOutputs.get( actionOutput.getName() );
if ( actualActionOutput != null )
{
String expectedTypeName = actionOutput.getType();
int expectedArrayDims = 0;
while ( expectedTypeName.endsWith( "[]" ) )
{
++expectedArrayDims;
expectedTypeName = expectedTypeName.substring( 0, expectedTypeName.length() - 2 );
}
Class expectedType = ( Class ) PRIMITIVE_TYPES.get( expectedTypeName );
if ( expectedType == null )
{
try
{
ReloadableClassHandler rch = Handlers.get(_servletContext).getReloadableClassHandler();
expectedType = rch.loadClass( expectedTypeName );
}
catch ( ClassNotFoundException e )
{
_log.error( "Could not load expected action output type " + expectedTypeName
+ " for action output '" + actionOutput.getName() + "' on forward '"
+ fc.getName() + "'; skipping type check." );
continue;
}
}
Class actualType = actualActionOutput.getClass();
int actualArrayDims = 0;
InternalStringBuilder arraySuffix = new InternalStringBuilder();
while ( actualType.isArray() && actualArrayDims <= expectedArrayDims )
{
++actualArrayDims;
arraySuffix.append( "[]" );
actualType = actualType.getComponentType();
}
if ( actualArrayDims != expectedArrayDims || ! expectedType.isAssignableFrom( actualType ) )
{
PageFlowException ex =
new MismatchedActionOutputException( _mappingPath, _flowController,
actionOutput.getName(), getName(),
expectedTypeName,
actualType.getName() + arraySuffix );
InternalUtils.throwPageFlowException( ex );
}
}
}
}
}
|
[
"private",
"void",
"checkActionOutputs",
"(",
"PageFlowActionForward",
"fc",
")",
"{",
"PageFlowActionForward",
".",
"ActionOutput",
"[",
"]",
"actionOutputs",
"=",
"fc",
".",
"getActionOutputs",
"(",
")",
";",
"boolean",
"doExpensiveChecks",
"=",
"_actionOutputs",
"!=",
"null",
"&&",
"!",
"AdapterManager",
".",
"getServletContainerAdapter",
"(",
"_servletContext",
")",
".",
"isInProductionMode",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"actionOutputs",
".",
"length",
";",
"++",
"i",
")",
"{",
"PageFlowActionForward",
".",
"ActionOutput",
"actionOutput",
"=",
"actionOutputs",
"[",
"i",
"]",
";",
"if",
"(",
"!",
"actionOutput",
".",
"getNullable",
"(",
")",
")",
"{",
"String",
"actionOutputName",
"=",
"actionOutput",
".",
"getName",
"(",
")",
";",
"if",
"(",
"_actionOutputs",
"==",
"null",
"||",
"!",
"_actionOutputs",
".",
"containsKey",
"(",
"actionOutputName",
")",
")",
"{",
"PageFlowException",
"ex",
"=",
"new",
"MissingActionOutputException",
"(",
"_mappingPath",
",",
"_flowController",
",",
"actionOutput",
".",
"getName",
"(",
")",
",",
"getName",
"(",
")",
")",
";",
"InternalUtils",
".",
"throwPageFlowException",
"(",
"ex",
")",
";",
"}",
"else",
"if",
"(",
"_actionOutputs",
".",
"get",
"(",
"actionOutputName",
")",
"==",
"null",
")",
"{",
"PageFlowException",
"ex",
"=",
"new",
"NullActionOutputException",
"(",
"_mappingPath",
",",
"_flowController",
",",
"actionOutput",
".",
"getName",
"(",
")",
",",
"getName",
"(",
")",
")",
";",
"InternalUtils",
".",
"throwPageFlowException",
"(",
"ex",
")",
";",
"}",
"}",
"//",
"// If we're *not* in production mode, do some (expensive) checks to ensure that the types for the",
"// action outputs match their declared types.",
"//",
"if",
"(",
"doExpensiveChecks",
")",
"{",
"Object",
"actualActionOutput",
"=",
"_actionOutputs",
".",
"get",
"(",
"actionOutput",
".",
"getName",
"(",
")",
")",
";",
"if",
"(",
"actualActionOutput",
"!=",
"null",
")",
"{",
"String",
"expectedTypeName",
"=",
"actionOutput",
".",
"getType",
"(",
")",
";",
"int",
"expectedArrayDims",
"=",
"0",
";",
"while",
"(",
"expectedTypeName",
".",
"endsWith",
"(",
"\"[]\"",
")",
")",
"{",
"++",
"expectedArrayDims",
";",
"expectedTypeName",
"=",
"expectedTypeName",
".",
"substring",
"(",
"0",
",",
"expectedTypeName",
".",
"length",
"(",
")",
"-",
"2",
")",
";",
"}",
"Class",
"expectedType",
"=",
"(",
"Class",
")",
"PRIMITIVE_TYPES",
".",
"get",
"(",
"expectedTypeName",
")",
";",
"if",
"(",
"expectedType",
"==",
"null",
")",
"{",
"try",
"{",
"ReloadableClassHandler",
"rch",
"=",
"Handlers",
".",
"get",
"(",
"_servletContext",
")",
".",
"getReloadableClassHandler",
"(",
")",
";",
"expectedType",
"=",
"rch",
".",
"loadClass",
"(",
"expectedTypeName",
")",
";",
"}",
"catch",
"(",
"ClassNotFoundException",
"e",
")",
"{",
"_log",
".",
"error",
"(",
"\"Could not load expected action output type \"",
"+",
"expectedTypeName",
"+",
"\" for action output '\"",
"+",
"actionOutput",
".",
"getName",
"(",
")",
"+",
"\"' on forward '\"",
"+",
"fc",
".",
"getName",
"(",
")",
"+",
"\"'; skipping type check.\"",
")",
";",
"continue",
";",
"}",
"}",
"Class",
"actualType",
"=",
"actualActionOutput",
".",
"getClass",
"(",
")",
";",
"int",
"actualArrayDims",
"=",
"0",
";",
"InternalStringBuilder",
"arraySuffix",
"=",
"new",
"InternalStringBuilder",
"(",
")",
";",
"while",
"(",
"actualType",
".",
"isArray",
"(",
")",
"&&",
"actualArrayDims",
"<=",
"expectedArrayDims",
")",
"{",
"++",
"actualArrayDims",
";",
"arraySuffix",
".",
"append",
"(",
"\"[]\"",
")",
";",
"actualType",
"=",
"actualType",
".",
"getComponentType",
"(",
")",
";",
"}",
"if",
"(",
"actualArrayDims",
"!=",
"expectedArrayDims",
"||",
"!",
"expectedType",
".",
"isAssignableFrom",
"(",
"actualType",
")",
")",
"{",
"PageFlowException",
"ex",
"=",
"new",
"MismatchedActionOutputException",
"(",
"_mappingPath",
",",
"_flowController",
",",
"actionOutput",
".",
"getName",
"(",
")",
",",
"getName",
"(",
")",
",",
"expectedTypeName",
",",
"actualType",
".",
"getName",
"(",
")",
"+",
"arraySuffix",
")",
";",
"InternalUtils",
".",
"throwPageFlowException",
"(",
"ex",
")",
";",
"}",
"}",
"}",
"}",
"}"
] |
Make sure required action outputs are present, and are of the right type (only make the latter check when not
in production mode
|
[
"Make",
"sure",
"required",
"action",
"outputs",
"are",
"present",
"and",
"are",
"of",
"the",
"right",
"type",
"(",
"only",
"make",
"the",
"latter",
"check",
"when",
"not",
"in",
"production",
"mode"
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/Forward.java#L617-L705
|
146,899
|
moparisthebest/beehive
|
beehive-netui-tags/src/main/java/org/apache/beehive/netui/databinding/datagrid/api/filter/FilterTypeHint.java
|
FilterTypeHint.getTypeHint
|
public static FilterTypeHint getTypeHint(String hint) {
/* todo: this is static; consider providing on a concrete / overridable object */
if(STRING.getHint().equals(hint))
return STRING;
else if(NUMERIC.getHint().equals(hint))
return NUMERIC;
else if(DATE.getHint().equals(hint))
return DATE;
else throw new IllegalArgumentException(Bundle.getErrorString("FilterTypeHint_UnknownHintString",
new Object[] {hint}));
}
|
java
|
public static FilterTypeHint getTypeHint(String hint) {
/* todo: this is static; consider providing on a concrete / overridable object */
if(STRING.getHint().equals(hint))
return STRING;
else if(NUMERIC.getHint().equals(hint))
return NUMERIC;
else if(DATE.getHint().equals(hint))
return DATE;
else throw new IllegalArgumentException(Bundle.getErrorString("FilterTypeHint_UnknownHintString",
new Object[] {hint}));
}
|
[
"public",
"static",
"FilterTypeHint",
"getTypeHint",
"(",
"String",
"hint",
")",
"{",
"/* todo: this is static; consider providing on a concrete / overridable object */",
"if",
"(",
"STRING",
".",
"getHint",
"(",
")",
".",
"equals",
"(",
"hint",
")",
")",
"return",
"STRING",
";",
"else",
"if",
"(",
"NUMERIC",
".",
"getHint",
"(",
")",
".",
"equals",
"(",
"hint",
")",
")",
"return",
"NUMERIC",
";",
"else",
"if",
"(",
"DATE",
".",
"getHint",
"(",
")",
".",
"equals",
"(",
"hint",
")",
")",
"return",
"DATE",
";",
"else",
"throw",
"new",
"IllegalArgumentException",
"(",
"Bundle",
".",
"getErrorString",
"(",
"\"FilterTypeHint_UnknownHintString\"",
",",
"new",
"Object",
"[",
"]",
"{",
"hint",
"}",
")",
")",
";",
"}"
] |
Given a String, lookup a FilterTypeHint for the String. Valid
@param hint the String to use when looking up a filter type hint
@return the type hint
@throws IllegalArgumentException if the given <code>hint</code> doesn't match a know type hint
|
[
"Given",
"a",
"String",
"lookup",
"a",
"FilterTypeHint",
"for",
"the",
"String",
".",
"Valid"
] |
4246a0cc40ce3c05f1a02c2da2653ac622703d77
|
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/databinding/datagrid/api/filter/FilterTypeHint.java#L98-L108
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.