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,700
iig-uni-freiburg/SEWOL
ext/org/deckfour/xes/nikefs2/NikeFS2Block.java
NikeFS2Block.write
public synchronized void write(int blockOffset, byte[] buffer, int offset, int length) throws IOException { provider.write(blockNumber, blockOffset, buffer, offset, length); }
java
public synchronized void write(int blockOffset, byte[] buffer, int offset, int length) throws IOException { provider.write(blockNumber, blockOffset, buffer, offset, length); }
[ "public", "synchronized", "void", "write", "(", "int", "blockOffset", ",", "byte", "[", "]", "buffer", ",", "int", "offset", ",", "int", "length", ")", "throws", "IOException", "{", "provider", ".", "write", "(", "blockNumber", ",", "blockOffset", ",", "buffer", ",", "offset", ",", "length", ")", ";", "}" ]
Writes a number of bytes to this block. @param blockOffset Offset within the block to commence writing at. @param buffer Buffer storing the data to be written. @param offset Offset within the buffer from where to read. @param length Number of bytes to be written.
[ "Writes", "a", "number", "of", "bytes", "to", "this", "block", "." ]
e791cb07a6e62ecf837d760d58a25f32fbf6bbca
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/ext/org/deckfour/xes/nikefs2/NikeFS2Block.java#L139-L142
146,701
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/databinding/datagrid/AbstractDataGridHtmlTag.java
AbstractDataGridHtmlTag.applyTagId
protected final void applyTagId(AbstractHtmlState state, String tagId) throws JspException { state.id = generateTagId(tagId); }
java
protected final void applyTagId(AbstractHtmlState state, String tagId) throws JspException { state.id = generateTagId(tagId); }
[ "protected", "final", "void", "applyTagId", "(", "AbstractHtmlState", "state", ",", "String", "tagId", ")", "throws", "JspException", "{", "state", ".", "id", "=", "generateTagId", "(", "tagId", ")", ";", "}" ]
Create an un-indexed tag identifier for the given state object. @param state the {@link AbstractHtmlState} upon which the tag identifier will be set once created @param tagId the base tag identifier @throws JspException
[ "Create", "an", "un", "-", "indexed", "tag", "identifier", "for", "the", "given", "state", "object", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/databinding/datagrid/AbstractDataGridHtmlTag.java#L79-L82
146,702
iig-uni-freiburg/SEWOL
ext/org/deckfour/xes/xstream/XesXStreamPersistency.java
XesXStreamPersistency.register
public static void register(XStream stream) { for (XConverter converter : converters) { stream.registerConverter(converter); converter.registerAliases(stream); } }
java
public static void register(XStream stream) { for (XConverter converter : converters) { stream.registerConverter(converter); converter.registerAliases(stream); } }
[ "public", "static", "void", "register", "(", "XStream", "stream", ")", "{", "for", "(", "XConverter", "converter", ":", "converters", ")", "{", "stream", ".", "registerConverter", "(", "converter", ")", ";", "converter", ".", "registerAliases", "(", "stream", ")", ";", "}", "}" ]
Registers all XES converters for XStream with the provided stream, registers corresponding aliases. @param stream The XStream instance to register with
[ "Registers", "all", "XES", "converters", "for", "XStream", "with", "the", "provided", "stream", "registers", "corresponding", "aliases", "." ]
e791cb07a6e62ecf837d760d58a25f32fbf6bbca
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/ext/org/deckfour/xes/xstream/XesXStreamPersistency.java#L77-L82
146,703
urish/gwt-titanium
src/main/java/org/urish/gwtit/client/util/Timers.java
Timers.setTimeout
public static Timer setTimeout(int milliseconds, TimerCallback callback) { TimeoutTimer timeout = new TimeoutTimer(); timeout.setId(nativeSetTimeout(milliseconds, callback, timeout)); return timeout; }
java
public static Timer setTimeout(int milliseconds, TimerCallback callback) { TimeoutTimer timeout = new TimeoutTimer(); timeout.setId(nativeSetTimeout(milliseconds, callback, timeout)); return timeout; }
[ "public", "static", "Timer", "setTimeout", "(", "int", "milliseconds", ",", "TimerCallback", "callback", ")", "{", "TimeoutTimer", "timeout", "=", "new", "TimeoutTimer", "(", ")", ";", "timeout", ".", "setId", "(", "nativeSetTimeout", "(", "milliseconds", ",", "callback", ",", "timeout", ")", ")", ";", "return", "timeout", ";", "}" ]
Defines a one-shot timer. @param milliseconds Time until the timeout callback fires @param callback Callback to fire @return The new timer object
[ "Defines", "a", "one", "-", "shot", "timer", "." ]
5b53a312093a84f235366932430f02006a570612
https://github.com/urish/gwt-titanium/blob/5b53a312093a84f235366932430f02006a570612/src/main/java/org/urish/gwtit/client/util/Timers.java#L114-L118
146,704
urish/gwt-titanium
src/main/java/org/urish/gwtit/client/util/Timers.java
Timers.setInterval
public static Timer setInterval(int milliseconds, TimerCallback callback) { IntervalTimer interval = new IntervalTimer(); interval.setId(nativeSetInterval(milliseconds, callback, interval)); return interval; }
java
public static Timer setInterval(int milliseconds, TimerCallback callback) { IntervalTimer interval = new IntervalTimer(); interval.setId(nativeSetInterval(milliseconds, callback, interval)); return interval; }
[ "public", "static", "Timer", "setInterval", "(", "int", "milliseconds", ",", "TimerCallback", "callback", ")", "{", "IntervalTimer", "interval", "=", "new", "IntervalTimer", "(", ")", ";", "interval", ".", "setId", "(", "nativeSetInterval", "(", "milliseconds", ",", "callback", ",", "interval", ")", ")", ";", "return", "interval", ";", "}" ]
Defines a repeating timer with a specified interval. @param milliseconds Interval between timer shots. @param callback Callback to fire on each timer shot. @return The new interval object
[ "Defines", "a", "repeating", "timer", "with", "a", "specified", "interval", "." ]
5b53a312093a84f235366932430f02006a570612
https://github.com/urish/gwt-titanium/blob/5b53a312093a84f235366932430f02006a570612/src/main/java/org/urish/gwtit/client/util/Timers.java#L127-L131
146,705
moparisthebest/beehive
beehive-netui-compiler/src/main/java/org/apache/beehive/netui/compiler/processor/TwoPhaseCoreAnnotationProcessor.java
TwoPhaseCoreAnnotationProcessor.check
public void check() throws FatalCompileTimeException { HashSet declsToCheck = new HashSet(); // // First, build up the Set of declarations to check. We don't want any duplicates. // for ( int i = 0; i < _atds.length; ++i ) { AnnotationTypeDeclaration atd = _atds[i]; Declaration[] decls = getAnnotationProcessorEnvironment().getDeclarationsAnnotatedWith( atd ); for ( int j = 0; j < decls.length; j++ ) { declsToCheck.add( decls[j] ); } } // Now, check the declarations. check(declsToCheck); }
java
public void check() throws FatalCompileTimeException { HashSet declsToCheck = new HashSet(); // // First, build up the Set of declarations to check. We don't want any duplicates. // for ( int i = 0; i < _atds.length; ++i ) { AnnotationTypeDeclaration atd = _atds[i]; Declaration[] decls = getAnnotationProcessorEnvironment().getDeclarationsAnnotatedWith( atd ); for ( int j = 0; j < decls.length; j++ ) { declsToCheck.add( decls[j] ); } } // Now, check the declarations. check(declsToCheck); }
[ "public", "void", "check", "(", ")", "throws", "FatalCompileTimeException", "{", "HashSet", "declsToCheck", "=", "new", "HashSet", "(", ")", ";", "//", "// First, build up the Set of declarations to check. We don't want any duplicates.", "//", "for", "(", "int", "i", "=", "0", ";", "i", "<", "_atds", ".", "length", ";", "++", "i", ")", "{", "AnnotationTypeDeclaration", "atd", "=", "_atds", "[", "i", "]", ";", "Declaration", "[", "]", "decls", "=", "getAnnotationProcessorEnvironment", "(", ")", ".", "getDeclarationsAnnotatedWith", "(", "atd", ")", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "decls", ".", "length", ";", "j", "++", ")", "{", "declsToCheck", ".", "add", "(", "decls", "[", "j", "]", ")", ";", "}", "}", "// Now, check the declarations.", "check", "(", "declsToCheck", ")", ";", "}" ]
Performs semantic validation of input Declarations that are annotated with annotations claimed by this CoreAnnotationProcessor.
[ "Performs", "semantic", "validation", "of", "input", "Declarations", "that", "are", "annotated", "with", "annotations", "claimed", "by", "this", "CoreAnnotationProcessor", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-compiler/src/main/java/org/apache/beehive/netui/compiler/processor/TwoPhaseCoreAnnotationProcessor.java#L126-L146
146,706
moparisthebest/beehive
beehive-netui-compiler/src/main/java/org/apache/beehive/netui/compiler/processor/TwoPhaseCoreAnnotationProcessor.java
TwoPhaseCoreAnnotationProcessor.generate
public void generate() { try { HashSet alreadyProcessed = new HashSet(); for ( int i = 0; i < _atds.length; i++ ) { AnnotationTypeDeclaration atd = _atds[i]; Declaration[] decls = getAnnotationProcessorEnvironment().getDeclarationsAnnotatedWith( atd ); for ( int j = 0; j < decls.length; j++ ) { Declaration decl = decls[j]; if ( ! alreadyProcessed.contains( decl ) ) generate( decl ); alreadyProcessed.add( decl ); } } } catch ( FatalCompileTimeException e ) { e.printDiagnostic( this ); } }
java
public void generate() { try { HashSet alreadyProcessed = new HashSet(); for ( int i = 0; i < _atds.length; i++ ) { AnnotationTypeDeclaration atd = _atds[i]; Declaration[] decls = getAnnotationProcessorEnvironment().getDeclarationsAnnotatedWith( atd ); for ( int j = 0; j < decls.length; j++ ) { Declaration decl = decls[j]; if ( ! alreadyProcessed.contains( decl ) ) generate( decl ); alreadyProcessed.add( decl ); } } } catch ( FatalCompileTimeException e ) { e.printDiagnostic( this ); } }
[ "public", "void", "generate", "(", ")", "{", "try", "{", "HashSet", "alreadyProcessed", "=", "new", "HashSet", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "_atds", ".", "length", ";", "i", "++", ")", "{", "AnnotationTypeDeclaration", "atd", "=", "_atds", "[", "i", "]", ";", "Declaration", "[", "]", "decls", "=", "getAnnotationProcessorEnvironment", "(", ")", ".", "getDeclarationsAnnotatedWith", "(", "atd", ")", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "decls", ".", "length", ";", "j", "++", ")", "{", "Declaration", "decl", "=", "decls", "[", "j", "]", ";", "if", "(", "!", "alreadyProcessed", ".", "contains", "(", "decl", ")", ")", "generate", "(", "decl", ")", ";", "alreadyProcessed", ".", "add", "(", "decl", ")", ";", "}", "}", "}", "catch", "(", "FatalCompileTimeException", "e", ")", "{", "e", ".", "printDiagnostic", "(", "this", ")", ";", "}", "}" ]
Emits additional artifacts for input Declarations that are annotated with annotations claimed by this CoreAnnotationProcessor.
[ "Emits", "additional", "artifacts", "for", "input", "Declarations", "that", "are", "annotated", "with", "annotations", "claimed", "by", "this", "CoreAnnotationProcessor", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-compiler/src/main/java/org/apache/beehive/netui/compiler/processor/TwoPhaseCoreAnnotationProcessor.java#L161-L184
146,707
iig-uni-freiburg/SEWOL
ext/org/deckfour/xes/classification/XEventClasses.java
XEventClasses.deriveEventClasses
public static synchronized XEventClasses deriveEventClasses( XEventClassifier classifier, XLog log) { XEventClasses nClasses = new XEventClasses(classifier); nClasses.register(log); nClasses.harmonizeIndices(); return nClasses; }
java
public static synchronized XEventClasses deriveEventClasses( XEventClassifier classifier, XLog log) { XEventClasses nClasses = new XEventClasses(classifier); nClasses.register(log); nClasses.harmonizeIndices(); return nClasses; }
[ "public", "static", "synchronized", "XEventClasses", "deriveEventClasses", "(", "XEventClassifier", "classifier", ",", "XLog", "log", ")", "{", "XEventClasses", "nClasses", "=", "new", "XEventClasses", "(", "classifier", ")", ";", "nClasses", ".", "register", "(", "log", ")", ";", "nClasses", ".", "harmonizeIndices", "(", ")", ";", "return", "nClasses", ";", "}" ]
Creates a new set of event classes, factory method. @param classifier The classifier to be used for event comparison. @param log The log, on which event classes should be imposed. @return A set of event classes, as an instance of this class.
[ "Creates", "a", "new", "set", "of", "event", "classes", "factory", "method", "." ]
e791cb07a6e62ecf837d760d58a25f32fbf6bbca
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/ext/org/deckfour/xes/classification/XEventClasses.java#L75-L81
146,708
iig-uni-freiburg/SEWOL
ext/org/deckfour/xes/classification/XEventClasses.java
XEventClasses.getByIndex
public XEventClass getByIndex(int index) { for (XEventClass eventClass : classMap.values()) { if (eventClass.getIndex() == index) { return eventClass; } } return null; }
java
public XEventClass getByIndex(int index) { for (XEventClass eventClass : classMap.values()) { if (eventClass.getIndex() == index) { return eventClass; } } return null; }
[ "public", "XEventClass", "getByIndex", "(", "int", "index", ")", "{", "for", "(", "XEventClass", "eventClass", ":", "classMap", ".", "values", "(", ")", ")", "{", "if", "(", "eventClass", ".", "getIndex", "(", ")", "==", "index", ")", "{", "return", "eventClass", ";", "}", "}", "return", "null", ";", "}" ]
Returns a given event class by its unique index. @param index Unique index of the requested event class. @return The requested event class. If no matching event class is found, this method may return <code>null</code>.
[ "Returns", "a", "given", "event", "class", "by", "its", "unique", "index", "." ]
e791cb07a6e62ecf837d760d58a25f32fbf6bbca
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/ext/org/deckfour/xes/classification/XEventClasses.java#L165-L172
146,709
iig-uni-freiburg/SEWOL
ext/org/deckfour/xes/classification/XEventClasses.java
XEventClasses.register
public synchronized void register(XEvent event) { String classId = classifier.getClassIdentity(event); XEventClass eventClass = classMap.get(classId); if (eventClass == null && classId != null) { eventClass = new XEventClass(classId, classMap.size()); classMap.put(classId, eventClass); } if (eventClass != null) { eventClass.incrementSize(); } }
java
public synchronized void register(XEvent event) { String classId = classifier.getClassIdentity(event); XEventClass eventClass = classMap.get(classId); if (eventClass == null && classId != null) { eventClass = new XEventClass(classId, classMap.size()); classMap.put(classId, eventClass); } if (eventClass != null) { eventClass.incrementSize(); } }
[ "public", "synchronized", "void", "register", "(", "XEvent", "event", ")", "{", "String", "classId", "=", "classifier", ".", "getClassIdentity", "(", "event", ")", ";", "XEventClass", "eventClass", "=", "classMap", ".", "get", "(", "classId", ")", ";", "if", "(", "eventClass", "==", "null", "&&", "classId", "!=", "null", ")", "{", "eventClass", "=", "new", "XEventClass", "(", "classId", ",", "classMap", ".", "size", "(", ")", ")", ";", "classMap", ".", "put", "(", "classId", ",", "eventClass", ")", ";", "}", "if", "(", "eventClass", "!=", "null", ")", "{", "eventClass", ".", "incrementSize", "(", ")", ";", "}", "}" ]
Registers an event with this set of event classes. This will potentially add a new event class to this set of event classes. An event class will be incremented in size, if the given event is found to be a member of it. @param event The event to be analyzed.
[ "Registers", "an", "event", "with", "this", "set", "of", "event", "classes", ".", "This", "will", "potentially", "add", "a", "new", "event", "class", "to", "this", "set", "of", "event", "classes", ".", "An", "event", "class", "will", "be", "incremented", "in", "size", "if", "the", "given", "event", "is", "found", "to", "be", "a", "member", "of", "it", "." ]
e791cb07a6e62ecf837d760d58a25f32fbf6bbca
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/ext/org/deckfour/xes/classification/XEventClasses.java#L214-L224
146,710
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/TreeRenderer.java
TreeRenderer.renderIndentation
protected void renderIndentation(AbstractRenderAppender writer, TreeElement node, int level, InheritableState state) { InternalStringBuilder img = new InternalStringBuilder(32); // Create the appropriate number of indents // These are either the spacer.gif if the parent is the last in the line or the // vertical line gif if the parent is not the last child. _imgState.clear(); _imgState.registerAttribute(AbstractHtmlState.ATTR_GENERAL, WIDTH, "16px"); _imgState.registerAttribute(AbstractHtmlState.ATTR_GENERAL, BORDER, "0"); _imgState.registerAttribute(AbstractHtmlState.ATTR_GENERAL, ALT, "", false); for (int i = 0; i < level; i++) { int levels = level - i; TreeElement parent = node; for (int j = 1; j <= levels; j++) { parent = parent.getParent(); } img.setLength(0); img.append(state.getImageRoot()); img.append('/'); if (parent.isLast()) { renderSpacerPrefix(writer, node); img.append(state.getImageSpacer()); _imgState.style = null; } else { renderVerticalLinePrefix(writer, node); img.append(state.getVerticalLineImage()); _imgState.style = "vertical-align:bottom;"; } _imgState.src = img.toString(); _imageRenderer.doStartTag(writer, _imgState); _imageRenderer.doEndTag(writer); if (parent.isLast()) { renderSpacerSuffix(writer, node); } else { renderVerticalLineSuffix(writer, node); } } }
java
protected void renderIndentation(AbstractRenderAppender writer, TreeElement node, int level, InheritableState state) { InternalStringBuilder img = new InternalStringBuilder(32); // Create the appropriate number of indents // These are either the spacer.gif if the parent is the last in the line or the // vertical line gif if the parent is not the last child. _imgState.clear(); _imgState.registerAttribute(AbstractHtmlState.ATTR_GENERAL, WIDTH, "16px"); _imgState.registerAttribute(AbstractHtmlState.ATTR_GENERAL, BORDER, "0"); _imgState.registerAttribute(AbstractHtmlState.ATTR_GENERAL, ALT, "", false); for (int i = 0; i < level; i++) { int levels = level - i; TreeElement parent = node; for (int j = 1; j <= levels; j++) { parent = parent.getParent(); } img.setLength(0); img.append(state.getImageRoot()); img.append('/'); if (parent.isLast()) { renderSpacerPrefix(writer, node); img.append(state.getImageSpacer()); _imgState.style = null; } else { renderVerticalLinePrefix(writer, node); img.append(state.getVerticalLineImage()); _imgState.style = "vertical-align:bottom;"; } _imgState.src = img.toString(); _imageRenderer.doStartTag(writer, _imgState); _imageRenderer.doEndTag(writer); if (parent.isLast()) { renderSpacerSuffix(writer, node); } else { renderVerticalLineSuffix(writer, node); } } }
[ "protected", "void", "renderIndentation", "(", "AbstractRenderAppender", "writer", ",", "TreeElement", "node", ",", "int", "level", ",", "InheritableState", "state", ")", "{", "InternalStringBuilder", "img", "=", "new", "InternalStringBuilder", "(", "32", ")", ";", "// Create the appropriate number of indents", "// These are either the spacer.gif if the parent is the last in the line or the", "// vertical line gif if the parent is not the last child.", "_imgState", ".", "clear", "(", ")", ";", "_imgState", ".", "registerAttribute", "(", "AbstractHtmlState", ".", "ATTR_GENERAL", ",", "WIDTH", ",", "\"16px\"", ")", ";", "_imgState", ".", "registerAttribute", "(", "AbstractHtmlState", ".", "ATTR_GENERAL", ",", "BORDER", ",", "\"0\"", ")", ";", "_imgState", ".", "registerAttribute", "(", "AbstractHtmlState", ".", "ATTR_GENERAL", ",", "ALT", ",", "\"\"", ",", "false", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "level", ";", "i", "++", ")", "{", "int", "levels", "=", "level", "-", "i", ";", "TreeElement", "parent", "=", "node", ";", "for", "(", "int", "j", "=", "1", ";", "j", "<=", "levels", ";", "j", "++", ")", "{", "parent", "=", "parent", ".", "getParent", "(", ")", ";", "}", "img", ".", "setLength", "(", "0", ")", ";", "img", ".", "append", "(", "state", ".", "getImageRoot", "(", ")", ")", ";", "img", ".", "append", "(", "'", "'", ")", ";", "if", "(", "parent", ".", "isLast", "(", ")", ")", "{", "renderSpacerPrefix", "(", "writer", ",", "node", ")", ";", "img", ".", "append", "(", "state", ".", "getImageSpacer", "(", ")", ")", ";", "_imgState", ".", "style", "=", "null", ";", "}", "else", "{", "renderVerticalLinePrefix", "(", "writer", ",", "node", ")", ";", "img", ".", "append", "(", "state", ".", "getVerticalLineImage", "(", ")", ")", ";", "_imgState", ".", "style", "=", "\"vertical-align:bottom;\"", ";", "}", "_imgState", ".", "src", "=", "img", ".", "toString", "(", ")", ";", "_imageRenderer", ".", "doStartTag", "(", "writer", ",", "_imgState", ")", ";", "_imageRenderer", ".", "doEndTag", "(", "writer", ")", ";", "if", "(", "parent", ".", "isLast", "(", ")", ")", "{", "renderSpacerSuffix", "(", "writer", ",", "node", ")", ";", "}", "else", "{", "renderVerticalLineSuffix", "(", "writer", ",", "node", ")", ";", "}", "}", "}" ]
Write out the images that create the leading indentation for the given node. @param writer the appender where the node indentation images are appended @param node the node to render @param level the level or depth of the node within the tree @param state the set of tree properties that are used to render the tree markup
[ "Write", "out", "the", "images", "that", "create", "the", "leading", "indentation", "for", "the", "given", "node", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/TreeRenderer.java#L263-L304
146,711
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/TreeRenderer.java
TreeRenderer.renderSelectionLink
protected TagRenderingBase renderSelectionLink(AbstractRenderAppender writer, TreeElement node, String nodeName, AttributeRenderer attrs, InheritableState state) throws JspException { // calculate the selection link for this node String selectionLink = getSelectionlink(node, nodeName, state); TagRenderingBase endRender = null; // if there is a selection link we need to put an anchor out. if (selectionLink != null) { _anchorState.clear(); _anchorState.href = selectionLink; String target = node.getTarget(); if (target == null) { target = state.getSelectionTarget(); } _anchorState.registerAttribute(AbstractHtmlState.ATTR_GENERAL, TARGET, target); String title = node.getTitle(); _anchorState.registerAttribute(AbstractHtmlState.ATTR_GENERAL, TITLE, title); // set the selection styles if (node.isSelected()) { _anchorState.style = _trs.selectedStyle; _anchorState.styleClass = _trs.selectedStyleClass; } else { _anchorState.style = _trs.unselectedStyle; _anchorState.styleClass = _trs.unselectedStyleClass; } if (_anchorState.style == null && _anchorState.styleClass == null) { _anchorState.style = "text-decoration: none"; } // render any attributes applied to the HTML attrs.renderSelectionLink(_anchorState, node); // render the runAtClient attributes if (_trs.runAtClient) { String action = node.getClientAction(); if (action != null) { action = HtmlUtils.escapeEscapes(action); action = ScriptRequestState.getString("netuiAction", new Object[]{action}); } _anchorState.registerAttribute(AbstractHtmlState.ATTR_JAVASCRIPT, ONCLICK, action); // Jira 299 //_anchorState.onClick = action; } // actually render the anchor. renderSelectionLinkPrefix(writer, node); _anchorRenderer.doStartTag(writer, _anchorState); endRender = _anchorRenderer; } else { // This node doesn's support selection. This means we consider it disabled. We will // put a span around it and set the style/class to indicate that it is disabled. _spanState.clear(); _spanState.styleClass = _trs.disabledStyleClass; _spanState.style = _trs.disabledStyle; renderSelectionLinkPrefix(writer, node); _spanRenderer.doStartTag(writer, _spanState); endRender = _spanRenderer; } return endRender; }
java
protected TagRenderingBase renderSelectionLink(AbstractRenderAppender writer, TreeElement node, String nodeName, AttributeRenderer attrs, InheritableState state) throws JspException { // calculate the selection link for this node String selectionLink = getSelectionlink(node, nodeName, state); TagRenderingBase endRender = null; // if there is a selection link we need to put an anchor out. if (selectionLink != null) { _anchorState.clear(); _anchorState.href = selectionLink; String target = node.getTarget(); if (target == null) { target = state.getSelectionTarget(); } _anchorState.registerAttribute(AbstractHtmlState.ATTR_GENERAL, TARGET, target); String title = node.getTitle(); _anchorState.registerAttribute(AbstractHtmlState.ATTR_GENERAL, TITLE, title); // set the selection styles if (node.isSelected()) { _anchorState.style = _trs.selectedStyle; _anchorState.styleClass = _trs.selectedStyleClass; } else { _anchorState.style = _trs.unselectedStyle; _anchorState.styleClass = _trs.unselectedStyleClass; } if (_anchorState.style == null && _anchorState.styleClass == null) { _anchorState.style = "text-decoration: none"; } // render any attributes applied to the HTML attrs.renderSelectionLink(_anchorState, node); // render the runAtClient attributes if (_trs.runAtClient) { String action = node.getClientAction(); if (action != null) { action = HtmlUtils.escapeEscapes(action); action = ScriptRequestState.getString("netuiAction", new Object[]{action}); } _anchorState.registerAttribute(AbstractHtmlState.ATTR_JAVASCRIPT, ONCLICK, action); // Jira 299 //_anchorState.onClick = action; } // actually render the anchor. renderSelectionLinkPrefix(writer, node); _anchorRenderer.doStartTag(writer, _anchorState); endRender = _anchorRenderer; } else { // This node doesn's support selection. This means we consider it disabled. We will // put a span around it and set the style/class to indicate that it is disabled. _spanState.clear(); _spanState.styleClass = _trs.disabledStyleClass; _spanState.style = _trs.disabledStyle; renderSelectionLinkPrefix(writer, node); _spanRenderer.doStartTag(writer, _spanState); endRender = _spanRenderer; } return endRender; }
[ "protected", "TagRenderingBase", "renderSelectionLink", "(", "AbstractRenderAppender", "writer", ",", "TreeElement", "node", ",", "String", "nodeName", ",", "AttributeRenderer", "attrs", ",", "InheritableState", "state", ")", "throws", "JspException", "{", "// calculate the selection link for this node", "String", "selectionLink", "=", "getSelectionlink", "(", "node", ",", "nodeName", ",", "state", ")", ";", "TagRenderingBase", "endRender", "=", "null", ";", "// if there is a selection link we need to put an anchor out.", "if", "(", "selectionLink", "!=", "null", ")", "{", "_anchorState", ".", "clear", "(", ")", ";", "_anchorState", ".", "href", "=", "selectionLink", ";", "String", "target", "=", "node", ".", "getTarget", "(", ")", ";", "if", "(", "target", "==", "null", ")", "{", "target", "=", "state", ".", "getSelectionTarget", "(", ")", ";", "}", "_anchorState", ".", "registerAttribute", "(", "AbstractHtmlState", ".", "ATTR_GENERAL", ",", "TARGET", ",", "target", ")", ";", "String", "title", "=", "node", ".", "getTitle", "(", ")", ";", "_anchorState", ".", "registerAttribute", "(", "AbstractHtmlState", ".", "ATTR_GENERAL", ",", "TITLE", ",", "title", ")", ";", "// set the selection styles", "if", "(", "node", ".", "isSelected", "(", ")", ")", "{", "_anchorState", ".", "style", "=", "_trs", ".", "selectedStyle", ";", "_anchorState", ".", "styleClass", "=", "_trs", ".", "selectedStyleClass", ";", "}", "else", "{", "_anchorState", ".", "style", "=", "_trs", ".", "unselectedStyle", ";", "_anchorState", ".", "styleClass", "=", "_trs", ".", "unselectedStyleClass", ";", "}", "if", "(", "_anchorState", ".", "style", "==", "null", "&&", "_anchorState", ".", "styleClass", "==", "null", ")", "{", "_anchorState", ".", "style", "=", "\"text-decoration: none\"", ";", "}", "// render any attributes applied to the HTML", "attrs", ".", "renderSelectionLink", "(", "_anchorState", ",", "node", ")", ";", "// render the runAtClient attributes", "if", "(", "_trs", ".", "runAtClient", ")", "{", "String", "action", "=", "node", ".", "getClientAction", "(", ")", ";", "if", "(", "action", "!=", "null", ")", "{", "action", "=", "HtmlUtils", ".", "escapeEscapes", "(", "action", ")", ";", "action", "=", "ScriptRequestState", ".", "getString", "(", "\"netuiAction\"", ",", "new", "Object", "[", "]", "{", "action", "}", ")", ";", "}", "_anchorState", ".", "registerAttribute", "(", "AbstractHtmlState", ".", "ATTR_JAVASCRIPT", ",", "ONCLICK", ",", "action", ")", ";", "// Jira 299", "//_anchorState.onClick = action;", "}", "// actually render the anchor.", "renderSelectionLinkPrefix", "(", "writer", ",", "node", ")", ";", "_anchorRenderer", ".", "doStartTag", "(", "writer", ",", "_anchorState", ")", ";", "endRender", "=", "_anchorRenderer", ";", "}", "else", "{", "// This node doesn's support selection. This means we consider it disabled. We will", "// put a span around it and set the style/class to indicate that it is disabled.", "_spanState", ".", "clear", "(", ")", ";", "_spanState", ".", "styleClass", "=", "_trs", ".", "disabledStyleClass", ";", "_spanState", ".", "style", "=", "_trs", ".", "disabledStyle", ";", "renderSelectionLinkPrefix", "(", "writer", ",", "node", ")", ";", "_spanRenderer", ".", "doStartTag", "(", "writer", ",", "_spanState", ")", ";", "endRender", "=", "_spanRenderer", ";", "}", "return", "endRender", ";", "}" ]
If needed, render the selection link around the icon for this node. Note that the tag rendered here needs to be closed after the actual icon and label are rendered. @param writer the appender where the tree markup is appended @param node the node to render @param nodeName the unique name of the node @param attrs renderer for supported attributes @param state the set of tree properties that are used to render the tree markup @return the selection link (or span) tag renderer to close after the item icon and label rendered @throws JspException
[ "If", "needed", "render", "the", "selection", "link", "around", "the", "icon", "for", "this", "node", ".", "Note", "that", "the", "tag", "rendered", "here", "needs", "to", "be", "closed", "after", "the", "actual", "icon", "and", "label", "are", "rendered", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/TreeRenderer.java#L536-L603
146,712
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/TreeRenderer.java
TreeRenderer.getSelectionlink
protected String getSelectionlink(TreeElement node, String nodeName, InheritableState state) throws JspException { String selectionLink = null; if (!node.isDisabled()) { // The action on the node overrides all. Otherwise, check to see if there // is either an href or clientAction. If neither is set, then we inherit the // action defined on the trees inheritable state. String action = node.getAction(); if (action == null) { selectionLink = node.getHref(); if (selectionLink == null && node.getClientAction() != null) { selectionLink = ""; } if (selectionLink == null) { action = state.getSelectionAction(); } } // create the selection link if (action != null && selectionLink == null) { HashMap params = null; boolean remove = false; params = node.getParams(); if (params == null) { params = new HashMap(); remove = true; } params.put(TreeElement.SELECTED_NODE, nodeName); if (_trs.tagId != null) { params.put(TreeElement.TREE_ID, _trs.tagId); } // Add the jpf ScopeID param if necessary. String scope = node.getScope(); if (scope != null) { params.put(ScopedServletUtils.SCOPE_ID_PARAM, scope); } String uri = null; try { boolean xml = TagRenderingBase.Factory.isXHTML(_req); uri = PageFlowUtils.getRewrittenActionURI(_servletContext, _req, _res, action, params, null, xml); } catch (URISyntaxException e) { // report the error... String s = Bundle.getString("Tags_Tree_Node_URLException", new Object[]{action, e.getMessage()}); registerTagError(s, e); } if (remove) { params.remove(TreeElement.SELECTED_NODE); if (_trs.tagId != null) { params.remove(TreeElement.TREE_ID); } if (scope != null) { params.remove(ScopedServletUtils.SCOPE_ID_PARAM); } } if (uri != null) { selectionLink = _res.encodeURL(uri); } } } return selectionLink; }
java
protected String getSelectionlink(TreeElement node, String nodeName, InheritableState state) throws JspException { String selectionLink = null; if (!node.isDisabled()) { // The action on the node overrides all. Otherwise, check to see if there // is either an href or clientAction. If neither is set, then we inherit the // action defined on the trees inheritable state. String action = node.getAction(); if (action == null) { selectionLink = node.getHref(); if (selectionLink == null && node.getClientAction() != null) { selectionLink = ""; } if (selectionLink == null) { action = state.getSelectionAction(); } } // create the selection link if (action != null && selectionLink == null) { HashMap params = null; boolean remove = false; params = node.getParams(); if (params == null) { params = new HashMap(); remove = true; } params.put(TreeElement.SELECTED_NODE, nodeName); if (_trs.tagId != null) { params.put(TreeElement.TREE_ID, _trs.tagId); } // Add the jpf ScopeID param if necessary. String scope = node.getScope(); if (scope != null) { params.put(ScopedServletUtils.SCOPE_ID_PARAM, scope); } String uri = null; try { boolean xml = TagRenderingBase.Factory.isXHTML(_req); uri = PageFlowUtils.getRewrittenActionURI(_servletContext, _req, _res, action, params, null, xml); } catch (URISyntaxException e) { // report the error... String s = Bundle.getString("Tags_Tree_Node_URLException", new Object[]{action, e.getMessage()}); registerTagError(s, e); } if (remove) { params.remove(TreeElement.SELECTED_NODE); if (_trs.tagId != null) { params.remove(TreeElement.TREE_ID); } if (scope != null) { params.remove(ScopedServletUtils.SCOPE_ID_PARAM); } } if (uri != null) { selectionLink = _res.encodeURL(uri); } } } return selectionLink; }
[ "protected", "String", "getSelectionlink", "(", "TreeElement", "node", ",", "String", "nodeName", ",", "InheritableState", "state", ")", "throws", "JspException", "{", "String", "selectionLink", "=", "null", ";", "if", "(", "!", "node", ".", "isDisabled", "(", ")", ")", "{", "// The action on the node overrides all. Otherwise, check to see if there", "// is either an href or clientAction. If neither is set, then we inherit the", "// action defined on the trees inheritable state.", "String", "action", "=", "node", ".", "getAction", "(", ")", ";", "if", "(", "action", "==", "null", ")", "{", "selectionLink", "=", "node", ".", "getHref", "(", ")", ";", "if", "(", "selectionLink", "==", "null", "&&", "node", ".", "getClientAction", "(", ")", "!=", "null", ")", "{", "selectionLink", "=", "\"\"", ";", "}", "if", "(", "selectionLink", "==", "null", ")", "{", "action", "=", "state", ".", "getSelectionAction", "(", ")", ";", "}", "}", "// create the selection link", "if", "(", "action", "!=", "null", "&&", "selectionLink", "==", "null", ")", "{", "HashMap", "params", "=", "null", ";", "boolean", "remove", "=", "false", ";", "params", "=", "node", ".", "getParams", "(", ")", ";", "if", "(", "params", "==", "null", ")", "{", "params", "=", "new", "HashMap", "(", ")", ";", "remove", "=", "true", ";", "}", "params", ".", "put", "(", "TreeElement", ".", "SELECTED_NODE", ",", "nodeName", ")", ";", "if", "(", "_trs", ".", "tagId", "!=", "null", ")", "{", "params", ".", "put", "(", "TreeElement", ".", "TREE_ID", ",", "_trs", ".", "tagId", ")", ";", "}", "// Add the jpf ScopeID param if necessary.", "String", "scope", "=", "node", ".", "getScope", "(", ")", ";", "if", "(", "scope", "!=", "null", ")", "{", "params", ".", "put", "(", "ScopedServletUtils", ".", "SCOPE_ID_PARAM", ",", "scope", ")", ";", "}", "String", "uri", "=", "null", ";", "try", "{", "boolean", "xml", "=", "TagRenderingBase", ".", "Factory", ".", "isXHTML", "(", "_req", ")", ";", "uri", "=", "PageFlowUtils", ".", "getRewrittenActionURI", "(", "_servletContext", ",", "_req", ",", "_res", ",", "action", ",", "params", ",", "null", ",", "xml", ")", ";", "}", "catch", "(", "URISyntaxException", "e", ")", "{", "// report the error...", "String", "s", "=", "Bundle", ".", "getString", "(", "\"Tags_Tree_Node_URLException\"", ",", "new", "Object", "[", "]", "{", "action", ",", "e", ".", "getMessage", "(", ")", "}", ")", ";", "registerTagError", "(", "s", ",", "e", ")", ";", "}", "if", "(", "remove", ")", "{", "params", ".", "remove", "(", "TreeElement", ".", "SELECTED_NODE", ")", ";", "if", "(", "_trs", ".", "tagId", "!=", "null", ")", "{", "params", ".", "remove", "(", "TreeElement", ".", "TREE_ID", ")", ";", "}", "if", "(", "scope", "!=", "null", ")", "{", "params", ".", "remove", "(", "ScopedServletUtils", ".", "SCOPE_ID_PARAM", ")", ";", "}", "}", "if", "(", "uri", "!=", "null", ")", "{", "selectionLink", "=", "_res", ".", "encodeURL", "(", "uri", ")", ";", "}", "}", "}", "return", "selectionLink", ";", "}" ]
Calculate the selection link for this node, if the node is disabled, we can skip this because a disabled node may not be selected. @param node the node to render @param nodeName the unique name of the node @param state the set of tree properties that are used to render the tree markup @return the URL for the selection link @throws JspException
[ "Calculate", "the", "selection", "link", "for", "this", "node", "if", "the", "node", "is", "disabled", "we", "can", "skip", "this", "because", "a", "disabled", "node", "may", "not", "be", "selected", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/TreeRenderer.java#L614-L684
146,713
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/TreeRenderer.java
TreeRenderer.renderItemIcon
protected void renderItemIcon(AbstractRenderAppender writer, TreeElement node, AttributeRenderer attrs, InheritableState state) { renderItemIconPrefix(writer, node); // There should always be one unless the tree turns off default // icons by setting the useDefaultIcons attribute to false. String icon = node.getIcon(); if (icon == null) { icon = state.getIconRoot() + "/" + state.getItemIcon(); } else { icon = state.getIconRoot() + "/" + icon; } // write out the icon if (icon != null) { _imgState.clear(); _imgState.src = icon; _imgState.style = "vertical-align:text-top"; String alt = null; String label = node.getLabel(); if (label != null && node.isLabelLegalAsAlt()) alt = label; else alt = node.getTitle(); if (alt == null) alt = Bundle.getString("Tags_TreeAltText", null); _imgState.registerAttribute(AbstractHtmlState.ATTR_GENERAL, ALT, alt, false); _imgState.registerAttribute(AbstractHtmlState.ATTR_GENERAL, BORDER, "0"); // set the inheritted attributes attrs.renderIconImage(_imgState, node); _imageRenderer.doStartTag(writer, _imgState); _imageRenderer.doEndTag(writer); renderItemIconSuffix(writer, node); } }
java
protected void renderItemIcon(AbstractRenderAppender writer, TreeElement node, AttributeRenderer attrs, InheritableState state) { renderItemIconPrefix(writer, node); // There should always be one unless the tree turns off default // icons by setting the useDefaultIcons attribute to false. String icon = node.getIcon(); if (icon == null) { icon = state.getIconRoot() + "/" + state.getItemIcon(); } else { icon = state.getIconRoot() + "/" + icon; } // write out the icon if (icon != null) { _imgState.clear(); _imgState.src = icon; _imgState.style = "vertical-align:text-top"; String alt = null; String label = node.getLabel(); if (label != null && node.isLabelLegalAsAlt()) alt = label; else alt = node.getTitle(); if (alt == null) alt = Bundle.getString("Tags_TreeAltText", null); _imgState.registerAttribute(AbstractHtmlState.ATTR_GENERAL, ALT, alt, false); _imgState.registerAttribute(AbstractHtmlState.ATTR_GENERAL, BORDER, "0"); // set the inheritted attributes attrs.renderIconImage(_imgState, node); _imageRenderer.doStartTag(writer, _imgState); _imageRenderer.doEndTag(writer); renderItemIconSuffix(writer, node); } }
[ "protected", "void", "renderItemIcon", "(", "AbstractRenderAppender", "writer", ",", "TreeElement", "node", ",", "AttributeRenderer", "attrs", ",", "InheritableState", "state", ")", "{", "renderItemIconPrefix", "(", "writer", ",", "node", ")", ";", "// There should always be one unless the tree turns off default", "// icons by setting the useDefaultIcons attribute to false.", "String", "icon", "=", "node", ".", "getIcon", "(", ")", ";", "if", "(", "icon", "==", "null", ")", "{", "icon", "=", "state", ".", "getIconRoot", "(", ")", "+", "\"/\"", "+", "state", ".", "getItemIcon", "(", ")", ";", "}", "else", "{", "icon", "=", "state", ".", "getIconRoot", "(", ")", "+", "\"/\"", "+", "icon", ";", "}", "// write out the icon", "if", "(", "icon", "!=", "null", ")", "{", "_imgState", ".", "clear", "(", ")", ";", "_imgState", ".", "src", "=", "icon", ";", "_imgState", ".", "style", "=", "\"vertical-align:text-top\"", ";", "String", "alt", "=", "null", ";", "String", "label", "=", "node", ".", "getLabel", "(", ")", ";", "if", "(", "label", "!=", "null", "&&", "node", ".", "isLabelLegalAsAlt", "(", ")", ")", "alt", "=", "label", ";", "else", "alt", "=", "node", ".", "getTitle", "(", ")", ";", "if", "(", "alt", "==", "null", ")", "alt", "=", "Bundle", ".", "getString", "(", "\"Tags_TreeAltText\"", ",", "null", ")", ";", "_imgState", ".", "registerAttribute", "(", "AbstractHtmlState", ".", "ATTR_GENERAL", ",", "ALT", ",", "alt", ",", "false", ")", ";", "_imgState", ".", "registerAttribute", "(", "AbstractHtmlState", ".", "ATTR_GENERAL", ",", "BORDER", ",", "\"0\"", ")", ";", "// set the inheritted attributes", "attrs", ".", "renderIconImage", "(", "_imgState", ",", "node", ")", ";", "_imageRenderer", ".", "doStartTag", "(", "writer", ",", "_imgState", ")", ";", "_imageRenderer", ".", "doEndTag", "(", "writer", ")", ";", "renderItemIconSuffix", "(", "writer", ",", "node", ")", ";", "}", "}" ]
Render the icon for this node. @param writer the appender where the tree markup is appended @param node the node to render @param attrs renderer for supported attributes @param state the set of tree properties that are used to render the tree markup
[ "Render", "the", "icon", "for", "this", "node", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/TreeRenderer.java#L693-L732
146,714
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/Hidden.java
Hidden.doEndTag
public int doEndTag() throws JspException { Object val = evaluateDataSource(); ServletRequest req = pageContext.getRequest(); if (_dataInput != null) { val = _dataInput.toString(); } // if there were expression errors report them if (hasErrors()) return reportAndExit(SKIP_BODY); if (val != null) { _value = val.toString(); } // Create an appropriate "input" element based on our parameters ByRef ref = new ByRef(); nameHtmlControl(_state, ref); if (_value != null) { InternalStringBuilder sb = new InternalStringBuilder(_value.length() + 16); StringBuilderRenderAppender sbAppend = new StringBuilderRenderAppender(sb); HtmlUtils.filter(_value, sbAppend); _state.value = sb.toString(); } // correct for null text here if (_state.value == null) _state.value = ""; WriteRenderAppender writer = new WriteRenderAppender(pageContext); TagRenderingBase hiddenTag = TagRenderingBase.Factory.getRendering(TagRenderingBase.INPUT_HIDDEN_TAG, req); hiddenTag.doStartTag(writer, _state); hiddenTag.doEndTag(writer); if (!ref.isNull()) write((String) ref.getRef()); // Continue processing this page localRelease(); return SKIP_BODY; }
java
public int doEndTag() throws JspException { Object val = evaluateDataSource(); ServletRequest req = pageContext.getRequest(); if (_dataInput != null) { val = _dataInput.toString(); } // if there were expression errors report them if (hasErrors()) return reportAndExit(SKIP_BODY); if (val != null) { _value = val.toString(); } // Create an appropriate "input" element based on our parameters ByRef ref = new ByRef(); nameHtmlControl(_state, ref); if (_value != null) { InternalStringBuilder sb = new InternalStringBuilder(_value.length() + 16); StringBuilderRenderAppender sbAppend = new StringBuilderRenderAppender(sb); HtmlUtils.filter(_value, sbAppend); _state.value = sb.toString(); } // correct for null text here if (_state.value == null) _state.value = ""; WriteRenderAppender writer = new WriteRenderAppender(pageContext); TagRenderingBase hiddenTag = TagRenderingBase.Factory.getRendering(TagRenderingBase.INPUT_HIDDEN_TAG, req); hiddenTag.doStartTag(writer, _state); hiddenTag.doEndTag(writer); if (!ref.isNull()) write((String) ref.getRef()); // Continue processing this page localRelease(); return SKIP_BODY; }
[ "public", "int", "doEndTag", "(", ")", "throws", "JspException", "{", "Object", "val", "=", "evaluateDataSource", "(", ")", ";", "ServletRequest", "req", "=", "pageContext", ".", "getRequest", "(", ")", ";", "if", "(", "_dataInput", "!=", "null", ")", "{", "val", "=", "_dataInput", ".", "toString", "(", ")", ";", "}", "// if there were expression errors report them", "if", "(", "hasErrors", "(", ")", ")", "return", "reportAndExit", "(", "SKIP_BODY", ")", ";", "if", "(", "val", "!=", "null", ")", "{", "_value", "=", "val", ".", "toString", "(", ")", ";", "}", "// Create an appropriate \"input\" element based on our parameters", "ByRef", "ref", "=", "new", "ByRef", "(", ")", ";", "nameHtmlControl", "(", "_state", ",", "ref", ")", ";", "if", "(", "_value", "!=", "null", ")", "{", "InternalStringBuilder", "sb", "=", "new", "InternalStringBuilder", "(", "_value", ".", "length", "(", ")", "+", "16", ")", ";", "StringBuilderRenderAppender", "sbAppend", "=", "new", "StringBuilderRenderAppender", "(", "sb", ")", ";", "HtmlUtils", ".", "filter", "(", "_value", ",", "sbAppend", ")", ";", "_state", ".", "value", "=", "sb", ".", "toString", "(", ")", ";", "}", "// correct for null text here", "if", "(", "_state", ".", "value", "==", "null", ")", "_state", ".", "value", "=", "\"\"", ";", "WriteRenderAppender", "writer", "=", "new", "WriteRenderAppender", "(", "pageContext", ")", ";", "TagRenderingBase", "hiddenTag", "=", "TagRenderingBase", ".", "Factory", ".", "getRendering", "(", "TagRenderingBase", ".", "INPUT_HIDDEN_TAG", ",", "req", ")", ";", "hiddenTag", ".", "doStartTag", "(", "writer", ",", "_state", ")", ";", "hiddenTag", ".", "doEndTag", "(", "writer", ")", ";", "if", "(", "!", "ref", ".", "isNull", "(", ")", ")", "write", "(", "(", "String", ")", "ref", ".", "getRef", "(", ")", ")", ";", "// Continue processing this page", "localRelease", "(", ")", ";", "return", "SKIP_BODY", ";", "}" ]
Generate the hidden input tag. @throws JspException if a JSP exception has occurred
[ "Generate", "the", "hidden", "input", "tag", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/Hidden.java#L136-L181
146,715
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/Hidden.java
Hidden.setTabindex
public void setTabindex(int tabindex) { _state.registerAttribute(AbstractHtmlState.ATTR_GENERAL, HtmlConstants.TABINDEX, Integer.toString(tabindex)); }
java
public void setTabindex(int tabindex) { _state.registerAttribute(AbstractHtmlState.ATTR_GENERAL, HtmlConstants.TABINDEX, Integer.toString(tabindex)); }
[ "public", "void", "setTabindex", "(", "int", "tabindex", ")", "{", "_state", ".", "registerAttribute", "(", "AbstractHtmlState", ".", "ATTR_GENERAL", ",", "HtmlConstants", ".", "TABINDEX", ",", "Integer", ".", "toString", "(", "tabindex", ")", ")", ";", "}" ]
Sets the tabIndex of the rendered html tag. @param tabindex the tab index. @jsptagref.attributedescription The tabIndex of the rendered HTML tag. This attribute determines the position of the rendered HTML tag in the sequence of tags that the user may advance through by pressing the TAB key. @jsptagref.databindable false @jsptagref.attributesyntaxvalue <i>string_tabIndex</i> @netui:attribute required="false" rtexprvalue="true" type="int" description="The tabIndex of the rendered HTML tag. This attribute determines the position of the rendered HTML tag in the sequence of tags that the user may advance through by pressing the TAB key."
[ "Sets", "the", "tabIndex", "of", "the", "rendered", "html", "tag", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/Hidden.java#L212-L215
146,716
iig-uni-freiburg/SEWOL
ext/org/deckfour/xes/extension/std/XOrganizationalExtension.java
XOrganizationalExtension.extractResource
public String extractResource(XEvent event) { XAttribute attribute = event.getAttributes().get(KEY_RESOURCE); if (attribute == null) { return null; } else { return ((XAttributeLiteral) attribute).getValue(); } }
java
public String extractResource(XEvent event) { XAttribute attribute = event.getAttributes().get(KEY_RESOURCE); if (attribute == null) { return null; } else { return ((XAttributeLiteral) attribute).getValue(); } }
[ "public", "String", "extractResource", "(", "XEvent", "event", ")", "{", "XAttribute", "attribute", "=", "event", ".", "getAttributes", "(", ")", ".", "get", "(", "KEY_RESOURCE", ")", ";", "if", "(", "attribute", "==", "null", ")", "{", "return", "null", ";", "}", "else", "{", "return", "(", "(", "XAttributeLiteral", ")", "attribute", ")", ".", "getValue", "(", ")", ";", "}", "}" ]
Extracts the resource attribute string from an event. @param event Event to be queried. @return Resource string for the given event (may be <code>null</code> if not defined)
[ "Extracts", "the", "resource", "attribute", "string", "from", "an", "event", "." ]
e791cb07a6e62ecf837d760d58a25f32fbf6bbca
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/ext/org/deckfour/xes/extension/std/XOrganizationalExtension.java#L178-L185
146,717
iig-uni-freiburg/SEWOL
ext/org/deckfour/xes/extension/std/XOrganizationalExtension.java
XOrganizationalExtension.assignResource
public void assignResource(XEvent event, String resource) { if (resource != null && resource.trim().length() > 0) { XAttributeLiteral attr = (XAttributeLiteral) ATTR_RESOURCE.clone(); attr.setValue(resource.trim()); event.getAttributes().put(KEY_RESOURCE, attr); } }
java
public void assignResource(XEvent event, String resource) { if (resource != null && resource.trim().length() > 0) { XAttributeLiteral attr = (XAttributeLiteral) ATTR_RESOURCE.clone(); attr.setValue(resource.trim()); event.getAttributes().put(KEY_RESOURCE, attr); } }
[ "public", "void", "assignResource", "(", "XEvent", "event", ",", "String", "resource", ")", "{", "if", "(", "resource", "!=", "null", "&&", "resource", ".", "trim", "(", ")", ".", "length", "(", ")", ">", "0", ")", "{", "XAttributeLiteral", "attr", "=", "(", "XAttributeLiteral", ")", "ATTR_RESOURCE", ".", "clone", "(", ")", ";", "attr", ".", "setValue", "(", "resource", ".", "trim", "(", ")", ")", ";", "event", ".", "getAttributes", "(", ")", ".", "put", "(", "KEY_RESOURCE", ",", "attr", ")", ";", "}", "}" ]
Assigns the resource attribute value for a given event. @param event Event to be modified. @param resource Resource string to be assigned.
[ "Assigns", "the", "resource", "attribute", "value", "for", "a", "given", "event", "." ]
e791cb07a6e62ecf837d760d58a25f32fbf6bbca
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/ext/org/deckfour/xes/extension/std/XOrganizationalExtension.java#L195-L201
146,718
iig-uni-freiburg/SEWOL
ext/org/deckfour/xes/extension/std/XOrganizationalExtension.java
XOrganizationalExtension.extractRole
public String extractRole(XEvent event) { XAttribute attribute = event.getAttributes().get(KEY_ROLE); if (attribute == null) { return null; } else { return ((XAttributeLiteral) attribute).getValue(); } }
java
public String extractRole(XEvent event) { XAttribute attribute = event.getAttributes().get(KEY_ROLE); if (attribute == null) { return null; } else { return ((XAttributeLiteral) attribute).getValue(); } }
[ "public", "String", "extractRole", "(", "XEvent", "event", ")", "{", "XAttribute", "attribute", "=", "event", ".", "getAttributes", "(", ")", ".", "get", "(", "KEY_ROLE", ")", ";", "if", "(", "attribute", "==", "null", ")", "{", "return", "null", ";", "}", "else", "{", "return", "(", "(", "XAttributeLiteral", ")", "attribute", ")", ".", "getValue", "(", ")", ";", "}", "}" ]
Extracts the role attribute string from an event. @param event Event to be queried. @return Role string for the given event (may be <code>null</code> if not defined)
[ "Extracts", "the", "role", "attribute", "string", "from", "an", "event", "." ]
e791cb07a6e62ecf837d760d58a25f32fbf6bbca
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/ext/org/deckfour/xes/extension/std/XOrganizationalExtension.java#L211-L218
146,719
iig-uni-freiburg/SEWOL
ext/org/deckfour/xes/extension/std/XOrganizationalExtension.java
XOrganizationalExtension.assignRole
public void assignRole(XEvent event, String role) { if (role != null && role.trim().length() > 0) { XAttributeLiteral attr = (XAttributeLiteral) ATTR_ROLE.clone(); attr.setValue(role.trim()); event.getAttributes().put(KEY_ROLE, attr); } }
java
public void assignRole(XEvent event, String role) { if (role != null && role.trim().length() > 0) { XAttributeLiteral attr = (XAttributeLiteral) ATTR_ROLE.clone(); attr.setValue(role.trim()); event.getAttributes().put(KEY_ROLE, attr); } }
[ "public", "void", "assignRole", "(", "XEvent", "event", ",", "String", "role", ")", "{", "if", "(", "role", "!=", "null", "&&", "role", ".", "trim", "(", ")", ".", "length", "(", ")", ">", "0", ")", "{", "XAttributeLiteral", "attr", "=", "(", "XAttributeLiteral", ")", "ATTR_ROLE", ".", "clone", "(", ")", ";", "attr", ".", "setValue", "(", "role", ".", "trim", "(", ")", ")", ";", "event", ".", "getAttributes", "(", ")", ".", "put", "(", "KEY_ROLE", ",", "attr", ")", ";", "}", "}" ]
Assigns the role attribute value for a given event. @param event Event to be modified. @param resource Role string to be assigned.
[ "Assigns", "the", "role", "attribute", "value", "for", "a", "given", "event", "." ]
e791cb07a6e62ecf837d760d58a25f32fbf6bbca
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/ext/org/deckfour/xes/extension/std/XOrganizationalExtension.java#L228-L234
146,720
iig-uni-freiburg/SEWOL
ext/org/deckfour/xes/extension/std/XOrganizationalExtension.java
XOrganizationalExtension.extractGroup
public String extractGroup(XEvent event) { XAttribute attribute = event.getAttributes().get(KEY_GROUP); if (attribute == null) { return null; } else { return ((XAttributeLiteral) attribute).getValue(); } }
java
public String extractGroup(XEvent event) { XAttribute attribute = event.getAttributes().get(KEY_GROUP); if (attribute == null) { return null; } else { return ((XAttributeLiteral) attribute).getValue(); } }
[ "public", "String", "extractGroup", "(", "XEvent", "event", ")", "{", "XAttribute", "attribute", "=", "event", ".", "getAttributes", "(", ")", ".", "get", "(", "KEY_GROUP", ")", ";", "if", "(", "attribute", "==", "null", ")", "{", "return", "null", ";", "}", "else", "{", "return", "(", "(", "XAttributeLiteral", ")", "attribute", ")", ".", "getValue", "(", ")", ";", "}", "}" ]
Extracts the group attribute string from an event. @param event Event to be queried. @return Group string for the given event (may be <code>null</code> if not defined)
[ "Extracts", "the", "group", "attribute", "string", "from", "an", "event", "." ]
e791cb07a6e62ecf837d760d58a25f32fbf6bbca
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/ext/org/deckfour/xes/extension/std/XOrganizationalExtension.java#L244-L251
146,721
iig-uni-freiburg/SEWOL
ext/org/deckfour/xes/extension/std/XOrganizationalExtension.java
XOrganizationalExtension.assignGroup
public void assignGroup(XEvent event, String group) { if (group != null && group.trim().length() > 0) { XAttributeLiteral attr = (XAttributeLiteral) ATTR_GROUP.clone(); attr.setValue(group.trim()); event.getAttributes().put(KEY_GROUP, attr); } }
java
public void assignGroup(XEvent event, String group) { if (group != null && group.trim().length() > 0) { XAttributeLiteral attr = (XAttributeLiteral) ATTR_GROUP.clone(); attr.setValue(group.trim()); event.getAttributes().put(KEY_GROUP, attr); } }
[ "public", "void", "assignGroup", "(", "XEvent", "event", ",", "String", "group", ")", "{", "if", "(", "group", "!=", "null", "&&", "group", ".", "trim", "(", ")", ".", "length", "(", ")", ">", "0", ")", "{", "XAttributeLiteral", "attr", "=", "(", "XAttributeLiteral", ")", "ATTR_GROUP", ".", "clone", "(", ")", ";", "attr", ".", "setValue", "(", "group", ".", "trim", "(", ")", ")", ";", "event", ".", "getAttributes", "(", ")", ".", "put", "(", "KEY_GROUP", ",", "attr", ")", ";", "}", "}" ]
Assigns the group attribute value for a given event. @param event Event to be modified. @param resource Group string to be assigned.
[ "Assigns", "the", "group", "attribute", "value", "for", "a", "given", "event", "." ]
e791cb07a6e62ecf837d760d58a25f32fbf6bbca
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/ext/org/deckfour/xes/extension/std/XOrganizationalExtension.java#L261-L267
146,722
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/HtmlUtils.java
HtmlUtils.filter
public static void filter(String value, AbstractRenderAppender result, boolean markupHTMLSpaceReturn) { // if the value is null, return if (value == null) return; // convert the string int numChars = value.length(); char c; char prev = 0; for (int i = 0; i < numChars; i++) { c = value.charAt(i); switch (c) { case '<': result.append("&lt;"); break; case '>': result.append("&gt;"); break; case '&': result.append("&amp;"); break; case '"': result.append("&quot;"); break; case '\'': result.append("&#39;"); break; case ' ': if (markupHTMLSpaceReturn) { if (prev == ' ') { result.append("&nbsp;"); } else result.append(c); } else result.append(c); break; case '\n': if (markupHTMLSpaceReturn) { result.append("<br />"); } else result.append(c); break; default: result.append(c); } prev = c; } }
java
public static void filter(String value, AbstractRenderAppender result, boolean markupHTMLSpaceReturn) { // if the value is null, return if (value == null) return; // convert the string int numChars = value.length(); char c; char prev = 0; for (int i = 0; i < numChars; i++) { c = value.charAt(i); switch (c) { case '<': result.append("&lt;"); break; case '>': result.append("&gt;"); break; case '&': result.append("&amp;"); break; case '"': result.append("&quot;"); break; case '\'': result.append("&#39;"); break; case ' ': if (markupHTMLSpaceReturn) { if (prev == ' ') { result.append("&nbsp;"); } else result.append(c); } else result.append(c); break; case '\n': if (markupHTMLSpaceReturn) { result.append("<br />"); } else result.append(c); break; default: result.append(c); } prev = c; } }
[ "public", "static", "void", "filter", "(", "String", "value", ",", "AbstractRenderAppender", "result", ",", "boolean", "markupHTMLSpaceReturn", ")", "{", "// if the value is null, return", "if", "(", "value", "==", "null", ")", "return", ";", "// convert the string", "int", "numChars", "=", "value", ".", "length", "(", ")", ";", "char", "c", ";", "char", "prev", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "numChars", ";", "i", "++", ")", "{", "c", "=", "value", ".", "charAt", "(", "i", ")", ";", "switch", "(", "c", ")", "{", "case", "'", "'", ":", "result", ".", "append", "(", "\"&lt;\"", ")", ";", "break", ";", "case", "'", "'", ":", "result", ".", "append", "(", "\"&gt;\"", ")", ";", "break", ";", "case", "'", "'", ":", "result", ".", "append", "(", "\"&amp;\"", ")", ";", "break", ";", "case", "'", "'", ":", "result", ".", "append", "(", "\"&quot;\"", ")", ";", "break", ";", "case", "'", "'", ":", "result", ".", "append", "(", "\"&#39;\"", ")", ";", "break", ";", "case", "'", "'", ":", "if", "(", "markupHTMLSpaceReturn", ")", "{", "if", "(", "prev", "==", "'", "'", ")", "{", "result", ".", "append", "(", "\"&nbsp;\"", ")", ";", "}", "else", "result", ".", "append", "(", "c", ")", ";", "}", "else", "result", ".", "append", "(", "c", ")", ";", "break", ";", "case", "'", "'", ":", "if", "(", "markupHTMLSpaceReturn", ")", "{", "result", ".", "append", "(", "\"<br />\"", ")", ";", "}", "else", "result", ".", "append", "(", "c", ")", ";", "break", ";", "default", ":", "result", ".", "append", "(", "c", ")", ";", "}", "prev", "=", "c", ";", "}", "}" ]
Filter the specified string for characters that are sensitive to HTML interpreters, returning the string with these characters replaced by the corresponding character entities. @param value The <code>String</code> value to be filtered and returned. @param markupHTMLSpaceReturn convert space characters and return characters to &amp;nbsp; and &lt;br /&gt; marketup for html. @param result the {@link AbstractRenderAppender} to which the results should be rendered
[ "Filter", "the", "specified", "string", "for", "characters", "that", "are", "sensitive", "to", "HTML", "interpreters", "returning", "the", "string", "with", "these", "characters", "replaced", "by", "the", "corresponding", "character", "entities", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/HtmlUtils.java#L81-L133
146,723
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/databinding/datagrid/api/DataGridResourceProvider.java
DataGridResourceProvider.internalFormatMessage
protected String internalFormatMessage(String pattern, Object[] args) { /* todo: perf -- could the MessageFormat objects be cached? */ MessageFormat format = new MessageFormat(pattern); String msg = format.format(args).toString(); return msg; }
java
protected String internalFormatMessage(String pattern, Object[] args) { /* todo: perf -- could the MessageFormat objects be cached? */ MessageFormat format = new MessageFormat(pattern); String msg = format.format(args).toString(); return msg; }
[ "protected", "String", "internalFormatMessage", "(", "String", "pattern", ",", "Object", "[", "]", "args", ")", "{", "/* todo: perf -- could the MessageFormat objects be cached? */", "MessageFormat", "format", "=", "new", "MessageFormat", "(", "pattern", ")", ";", "String", "msg", "=", "format", ".", "format", "(", "args", ")", ".", "toString", "(", ")", ";", "return", "msg", ";", "}" ]
Internal convenience method that is used to format a message given a pattern and a set of arguments. @param pattern the pattern to format @param args the arguments to use when formatting @return the formatted string
[ "Internal", "convenience", "method", "that", "is", "used", "to", "format", "a", "message", "given", "a", "pattern", "and", "a", "set", "of", "arguments", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/databinding/datagrid/api/DataGridResourceProvider.java#L127-L132
146,724
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/javascript/ScriptRequestState.java
ScriptRequestState.mapLegacyTagId
public String mapLegacyTagId(IScriptReporter scriptReporter, String tagId, String value) { if (scriptReporter != null) { scriptReporter.addLegacyTagIdMappings(tagId, value); return null; } // without a scripRepoter we need to create the actual JavaScript that will be written out InternalStringBuilder sb = new InternalStringBuilder(64); StringBuilderRenderAppender writer = new StringBuilderRenderAppender(sb); getTagIdMapping(tagId, value, writer); return sb.toString(); }
java
public String mapLegacyTagId(IScriptReporter scriptReporter, String tagId, String value) { if (scriptReporter != null) { scriptReporter.addLegacyTagIdMappings(tagId, value); return null; } // without a scripRepoter we need to create the actual JavaScript that will be written out InternalStringBuilder sb = new InternalStringBuilder(64); StringBuilderRenderAppender writer = new StringBuilderRenderAppender(sb); getTagIdMapping(tagId, value, writer); return sb.toString(); }
[ "public", "String", "mapLegacyTagId", "(", "IScriptReporter", "scriptReporter", ",", "String", "tagId", ",", "String", "value", ")", "{", "if", "(", "scriptReporter", "!=", "null", ")", "{", "scriptReporter", ".", "addLegacyTagIdMappings", "(", "tagId", ",", "value", ")", ";", "return", "null", ";", "}", "// without a scripRepoter we need to create the actual JavaScript that will be written out", "InternalStringBuilder", "sb", "=", "new", "InternalStringBuilder", "(", "64", ")", ";", "StringBuilderRenderAppender", "writer", "=", "new", "StringBuilderRenderAppender", "(", "sb", ")", ";", "getTagIdMapping", "(", "tagId", ",", "value", ",", "writer", ")", ";", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
This method will add a tagId and value to the ScriptRepoter TagId map. The a ScriptContainer tag will create a JavaScript table that allows the container, such as a portal, to rewrite the id so it's unique. The real name may be looked up based upon the tagId. If the no ScriptReporter is found, a script string will be returned to the caller so they can output the script block. @param tagId @param value @return String
[ "This", "method", "will", "add", "a", "tagId", "and", "value", "to", "the", "ScriptRepoter", "TagId", "map", ".", "The", "a", "ScriptContainer", "tag", "will", "create", "a", "JavaScript", "table", "that", "allows", "the", "container", "such", "as", "a", "portal", "to", "rewrite", "the", "id", "so", "it", "s", "unique", ".", "The", "real", "name", "may", "be", "looked", "up", "based", "upon", "the", "tagId", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/javascript/ScriptRequestState.java#L192-L204
146,725
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/javascript/ScriptRequestState.java
ScriptRequestState.getFeatureKey
private String getFeatureKey(CoreScriptFeature feature) { switch (feature.getIntValue()) { case CoreScriptFeature.INT_ANCHOR_SUBMIT: return "anchorFormSubmit"; case CoreScriptFeature.INT_SET_FOCUS: return "setFocus"; case CoreScriptFeature.INT_POPUP_OPEN: return "popupSupportPopupWindow"; case CoreScriptFeature.INT_POPUP_DONE: return "popupDone"; case CoreScriptFeature.INT_POPUP_UPDATE_FORM: return "popupSupportUpdateForm"; case CoreScriptFeature.INT_ROLLOVER: return "rollover"; case CoreScriptFeature.INT_TREE_INIT: return "initTree"; case CoreScriptFeature.INT_AJAX_PREFIX: return "initTreePrefix"; case CoreScriptFeature.INT_AJAX_PARAM: return "initTreeParam"; case CoreScriptFeature.INT_DIVPANEL_INIT: return "initDivPanel"; case CoreScriptFeature.INT_DYNAMIC_INIT: return "writeWebAppName"; case CoreScriptFeature.INT_BUTTON_DISABLE_AND_SUBMIT: return "buttonDisableAndSubmitForm"; case CoreScriptFeature.INT_BUTTON_DISABLE: return "buttonDisable"; } assert(false) : "getFeature fell through on feature:" + feature; return null; }
java
private String getFeatureKey(CoreScriptFeature feature) { switch (feature.getIntValue()) { case CoreScriptFeature.INT_ANCHOR_SUBMIT: return "anchorFormSubmit"; case CoreScriptFeature.INT_SET_FOCUS: return "setFocus"; case CoreScriptFeature.INT_POPUP_OPEN: return "popupSupportPopupWindow"; case CoreScriptFeature.INT_POPUP_DONE: return "popupDone"; case CoreScriptFeature.INT_POPUP_UPDATE_FORM: return "popupSupportUpdateForm"; case CoreScriptFeature.INT_ROLLOVER: return "rollover"; case CoreScriptFeature.INT_TREE_INIT: return "initTree"; case CoreScriptFeature.INT_AJAX_PREFIX: return "initTreePrefix"; case CoreScriptFeature.INT_AJAX_PARAM: return "initTreeParam"; case CoreScriptFeature.INT_DIVPANEL_INIT: return "initDivPanel"; case CoreScriptFeature.INT_DYNAMIC_INIT: return "writeWebAppName"; case CoreScriptFeature.INT_BUTTON_DISABLE_AND_SUBMIT: return "buttonDisableAndSubmitForm"; case CoreScriptFeature.INT_BUTTON_DISABLE: return "buttonDisable"; } assert(false) : "getFeature fell through on feature:" + feature; return null; }
[ "private", "String", "getFeatureKey", "(", "CoreScriptFeature", "feature", ")", "{", "switch", "(", "feature", ".", "getIntValue", "(", ")", ")", "{", "case", "CoreScriptFeature", ".", "INT_ANCHOR_SUBMIT", ":", "return", "\"anchorFormSubmit\"", ";", "case", "CoreScriptFeature", ".", "INT_SET_FOCUS", ":", "return", "\"setFocus\"", ";", "case", "CoreScriptFeature", ".", "INT_POPUP_OPEN", ":", "return", "\"popupSupportPopupWindow\"", ";", "case", "CoreScriptFeature", ".", "INT_POPUP_DONE", ":", "return", "\"popupDone\"", ";", "case", "CoreScriptFeature", ".", "INT_POPUP_UPDATE_FORM", ":", "return", "\"popupSupportUpdateForm\"", ";", "case", "CoreScriptFeature", ".", "INT_ROLLOVER", ":", "return", "\"rollover\"", ";", "case", "CoreScriptFeature", ".", "INT_TREE_INIT", ":", "return", "\"initTree\"", ";", "case", "CoreScriptFeature", ".", "INT_AJAX_PREFIX", ":", "return", "\"initTreePrefix\"", ";", "case", "CoreScriptFeature", ".", "INT_AJAX_PARAM", ":", "return", "\"initTreeParam\"", ";", "case", "CoreScriptFeature", ".", "INT_DIVPANEL_INIT", ":", "return", "\"initDivPanel\"", ";", "case", "CoreScriptFeature", ".", "INT_DYNAMIC_INIT", ":", "return", "\"writeWebAppName\"", ";", "case", "CoreScriptFeature", ".", "INT_BUTTON_DISABLE_AND_SUBMIT", ":", "return", "\"buttonDisableAndSubmitForm\"", ";", "case", "CoreScriptFeature", ".", "INT_BUTTON_DISABLE", ":", "return", "\"buttonDisable\"", ";", "}", "assert", "(", "false", ")", ":", "\"getFeature fell through on feature:\"", "+", "feature", ";", "return", "null", ";", "}" ]
This will map the Features into their keys @param feature @return String
[ "This", "will", "map", "the", "Features", "into", "their", "keys" ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/javascript/ScriptRequestState.java#L279-L311
146,726
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/javascript/ScriptRequestState.java
ScriptRequestState.getTagIdMapping
private void getTagIdMapping(String tagId, String value, AbstractRenderAppender results) { if ((_javaScriptFeatures & CoreScriptFeature.ALLOCATE_LEGACY.value) == 0) { _javaScriptFeatures |= CoreScriptFeature.ALLOCATE_LEGACY.value; String s = getString("singleIdMappingTable", new Object[]{tagId, value}); String meths = writeNetuiNameFunctions(null, true, false, false); if (meths != null) s += meths; writeScriptBlock(_req, results, s); } else { String s = getString("idMappingEntry", new Object[]{tagId, value}); writeScriptBlock(_req, results, s); } }
java
private void getTagIdMapping(String tagId, String value, AbstractRenderAppender results) { if ((_javaScriptFeatures & CoreScriptFeature.ALLOCATE_LEGACY.value) == 0) { _javaScriptFeatures |= CoreScriptFeature.ALLOCATE_LEGACY.value; String s = getString("singleIdMappingTable", new Object[]{tagId, value}); String meths = writeNetuiNameFunctions(null, true, false, false); if (meths != null) s += meths; writeScriptBlock(_req, results, s); } else { String s = getString("idMappingEntry", new Object[]{tagId, value}); writeScriptBlock(_req, results, s); } }
[ "private", "void", "getTagIdMapping", "(", "String", "tagId", ",", "String", "value", ",", "AbstractRenderAppender", "results", ")", "{", "if", "(", "(", "_javaScriptFeatures", "&", "CoreScriptFeature", ".", "ALLOCATE_LEGACY", ".", "value", ")", "==", "0", ")", "{", "_javaScriptFeatures", "|=", "CoreScriptFeature", ".", "ALLOCATE_LEGACY", ".", "value", ";", "String", "s", "=", "getString", "(", "\"singleIdMappingTable\"", ",", "new", "Object", "[", "]", "{", "tagId", ",", "value", "}", ")", ";", "String", "meths", "=", "writeNetuiNameFunctions", "(", "null", ",", "true", ",", "false", ",", "false", ")", ";", "if", "(", "meths", "!=", "null", ")", "s", "+=", "meths", ";", "writeScriptBlock", "(", "_req", ",", "results", ",", "s", ")", ";", "}", "else", "{", "String", "s", "=", "getString", "(", "\"idMappingEntry\"", ",", "new", "Object", "[", "]", "{", "tagId", ",", "value", "}", ")", ";", "writeScriptBlock", "(", "_req", ",", "results", ",", "s", ")", ";", "}", "}" ]
This method will write out a tagId map entry for when there isn't a ScriptContainer defined. @param tagId the tagId value @param value the "real" value of the written out @param results the JavaScript that will be output
[ "This", "method", "will", "write", "out", "a", "tagId", "map", "entry", "for", "when", "there", "isn", "t", "a", "ScriptContainer", "defined", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/javascript/ScriptRequestState.java#L333-L347
146,727
iig-uni-freiburg/SEWOL
ext/org/deckfour/xes/nikefs2/NikeFS2VirtualFileSystem.java
NikeFS2VirtualFileSystem.allocateBlock
public NikeFS2Block allocateBlock() throws IOException { // synchronized (this) { // // try to allocate from already created providers first // for (NikeFS2BlockProvider provider : blockProviders) { // if (provider.numberOfFreeBlocks() > 0) { // NikeFS2Block block = provider.allocateBlock(); // if (block != null) { // return block; // } // } // } // } // // force garbage collection and try again (stale files still around?) // // Running the finalization might cause the Finalizer thread to call the allocateBlock method again, // // hence the lock on "this" should be removed before calling System.runFinalization // System.gc(); // System.runFinalization(); // Thread.yield(); synchronized (this) { for (NikeFS2BlockProvider provider : blockProviders) { if (provider.numberOfFreeBlocks() > 0) { NikeFS2Block block = provider.allocateBlock(); if (block != null) { return block; } } } // ok, we give up: // create new swap file and provider, and allocate from there XLogging.log("NikeFS2: Allocating new swap file. (#" + (blockProviders.size() + 1) + ": " + swapFileSize + " bytes)", Importance.DEBUG); File swapFile = NikeFS2SwapFileManager.createSwapFile(); NikeFS2BlockProvider addedProvider = new NikeFS2BlockProvider( swapFile, swapFileSize, blockSize, true); blockProviders.add(addedProvider); return addedProvider.allocateBlock(); } }
java
public NikeFS2Block allocateBlock() throws IOException { // synchronized (this) { // // try to allocate from already created providers first // for (NikeFS2BlockProvider provider : blockProviders) { // if (provider.numberOfFreeBlocks() > 0) { // NikeFS2Block block = provider.allocateBlock(); // if (block != null) { // return block; // } // } // } // } // // force garbage collection and try again (stale files still around?) // // Running the finalization might cause the Finalizer thread to call the allocateBlock method again, // // hence the lock on "this" should be removed before calling System.runFinalization // System.gc(); // System.runFinalization(); // Thread.yield(); synchronized (this) { for (NikeFS2BlockProvider provider : blockProviders) { if (provider.numberOfFreeBlocks() > 0) { NikeFS2Block block = provider.allocateBlock(); if (block != null) { return block; } } } // ok, we give up: // create new swap file and provider, and allocate from there XLogging.log("NikeFS2: Allocating new swap file. (#" + (blockProviders.size() + 1) + ": " + swapFileSize + " bytes)", Importance.DEBUG); File swapFile = NikeFS2SwapFileManager.createSwapFile(); NikeFS2BlockProvider addedProvider = new NikeFS2BlockProvider( swapFile, swapFileSize, blockSize, true); blockProviders.add(addedProvider); return addedProvider.allocateBlock(); } }
[ "public", "NikeFS2Block", "allocateBlock", "(", ")", "throws", "IOException", "{", "//\t\tsynchronized (this) {", "//\t\t\t// try to allocate from already created providers first", "//\t\t\tfor (NikeFS2BlockProvider provider : blockProviders) {", "//\t\t\t\tif (provider.numberOfFreeBlocks() > 0) {", "//\t\t\t\t\tNikeFS2Block block = provider.allocateBlock();", "//\t\t\t\t\tif (block != null) {", "//\t\t\t\t\t\treturn block;", "//\t\t\t\t\t}", "//\t\t\t\t}", "//\t\t\t}", "//\t\t}", "//\t\t// force garbage collection and try again (stale files still around?)", "//\t\t// Running the finalization might cause the Finalizer thread to call the allocateBlock method again,", "//\t\t// hence the lock on \"this\" should be removed before calling System.runFinalization", "//\t\tSystem.gc();", "//\t\tSystem.runFinalization();", "//\t\tThread.yield();", "synchronized", "(", "this", ")", "{", "for", "(", "NikeFS2BlockProvider", "provider", ":", "blockProviders", ")", "{", "if", "(", "provider", ".", "numberOfFreeBlocks", "(", ")", ">", "0", ")", "{", "NikeFS2Block", "block", "=", "provider", ".", "allocateBlock", "(", ")", ";", "if", "(", "block", "!=", "null", ")", "{", "return", "block", ";", "}", "}", "}", "// ok, we give up:", "// create new swap file and provider, and allocate from there", "XLogging", ".", "log", "(", "\"NikeFS2: Allocating new swap file. (#\"", "+", "(", "blockProviders", ".", "size", "(", ")", "+", "1", ")", "+", "\": \"", "+", "swapFileSize", "+", "\" bytes)\"", ",", "Importance", ".", "DEBUG", ")", ";", "File", "swapFile", "=", "NikeFS2SwapFileManager", ".", "createSwapFile", "(", ")", ";", "NikeFS2BlockProvider", "addedProvider", "=", "new", "NikeFS2BlockProvider", "(", "swapFile", ",", "swapFileSize", ",", "blockSize", ",", "true", ")", ";", "blockProviders", ".", "add", "(", "addedProvider", ")", ";", "return", "addedProvider", ".", "allocateBlock", "(", ")", ";", "}", "}" ]
Allocates a new virtual storage block from this virtual file system instance. If no currently allocated swap file can provide any more storage blocks, a new swap file will be allocated. @return An empty storage block abstraction.
[ "Allocates", "a", "new", "virtual", "storage", "block", "from", "this", "virtual", "file", "system", "instance", ".", "If", "no", "currently", "allocated", "swap", "file", "can", "provide", "any", "more", "storage", "blocks", "a", "new", "swap", "file", "will", "be", "allocated", "." ]
e791cb07a6e62ecf837d760d58a25f32fbf6bbca
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/ext/org/deckfour/xes/nikefs2/NikeFS2VirtualFileSystem.java#L173-L211
146,728
iig-uni-freiburg/SEWOL
ext/org/deckfour/xes/extension/XExtensionParser.java
XExtensionParser.parse
public XExtension parse(File file) throws IOException, ParserConfigurationException, SAXException { BufferedInputStream is = new BufferedInputStream(new FileInputStream(file)); // set up a specialized SAX2 handler to fill the container XExtensionHandler handler = new XExtensionHandler(); // set up SAX parser and parse provided log file into the container SAXParserFactory parserFactory = SAXParserFactory.newInstance(); SAXParser parser = parserFactory.newSAXParser(); parser.parse(is, handler); is.close(); return handler.getExtension(); }
java
public XExtension parse(File file) throws IOException, ParserConfigurationException, SAXException { BufferedInputStream is = new BufferedInputStream(new FileInputStream(file)); // set up a specialized SAX2 handler to fill the container XExtensionHandler handler = new XExtensionHandler(); // set up SAX parser and parse provided log file into the container SAXParserFactory parserFactory = SAXParserFactory.newInstance(); SAXParser parser = parserFactory.newSAXParser(); parser.parse(is, handler); is.close(); return handler.getExtension(); }
[ "public", "XExtension", "parse", "(", "File", "file", ")", "throws", "IOException", ",", "ParserConfigurationException", ",", "SAXException", "{", "BufferedInputStream", "is", "=", "new", "BufferedInputStream", "(", "new", "FileInputStream", "(", "file", ")", ")", ";", "// set up a specialized SAX2 handler to fill the container", "XExtensionHandler", "handler", "=", "new", "XExtensionHandler", "(", ")", ";", "// set up SAX parser and parse provided log file into the container", "SAXParserFactory", "parserFactory", "=", "SAXParserFactory", ".", "newInstance", "(", ")", ";", "SAXParser", "parser", "=", "parserFactory", ".", "newSAXParser", "(", ")", ";", "parser", ".", "parse", "(", "is", ",", "handler", ")", ";", "is", ".", "close", "(", ")", ";", "return", "handler", ".", "getExtension", "(", ")", ";", "}" ]
Parses an extension from a definition file. @param file The definition file containing the extension. @return The extension object, as defined in the provided file.
[ "Parses", "an", "extension", "from", "a", "definition", "file", "." ]
e791cb07a6e62ecf837d760d58a25f32fbf6bbca
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/ext/org/deckfour/xes/extension/XExtensionParser.java#L92-L102
146,729
iig-uni-freiburg/SEWOL
ext/org/deckfour/xes/extension/XExtensionParser.java
XExtensionParser.parse
public XExtension parse(URI uri) throws IOException, ParserConfigurationException, SAXException { BufferedInputStream is = new BufferedInputStream(uri.toURL().openStream()); // set up a specialized SAX2 handler to fill the container XExtensionHandler handler = new XExtensionHandler(); // set up SAX parser and parse provided log file into the container SAXParserFactory parserFactory = SAXParserFactory.newInstance(); SAXParser parser = parserFactory.newSAXParser(); parser.parse(is, handler); is.close(); return handler.getExtension(); }
java
public XExtension parse(URI uri) throws IOException, ParserConfigurationException, SAXException { BufferedInputStream is = new BufferedInputStream(uri.toURL().openStream()); // set up a specialized SAX2 handler to fill the container XExtensionHandler handler = new XExtensionHandler(); // set up SAX parser and parse provided log file into the container SAXParserFactory parserFactory = SAXParserFactory.newInstance(); SAXParser parser = parserFactory.newSAXParser(); parser.parse(is, handler); is.close(); return handler.getExtension(); }
[ "public", "XExtension", "parse", "(", "URI", "uri", ")", "throws", "IOException", ",", "ParserConfigurationException", ",", "SAXException", "{", "BufferedInputStream", "is", "=", "new", "BufferedInputStream", "(", "uri", ".", "toURL", "(", ")", ".", "openStream", "(", ")", ")", ";", "// set up a specialized SAX2 handler to fill the container", "XExtensionHandler", "handler", "=", "new", "XExtensionHandler", "(", ")", ";", "// set up SAX parser and parse provided log file into the container", "SAXParserFactory", "parserFactory", "=", "SAXParserFactory", ".", "newInstance", "(", ")", ";", "SAXParser", "parser", "=", "parserFactory", ".", "newSAXParser", "(", ")", ";", "parser", ".", "parse", "(", "is", ",", "handler", ")", ";", "is", ".", "close", "(", ")", ";", "return", "handler", ".", "getExtension", "(", ")", ";", "}" ]
Parses an extension from a URI. @param file The URI which represents the extension definition file. @return The extension object, as defined in the file referenced by the given URI.
[ "Parses", "an", "extension", "from", "a", "URI", "." ]
e791cb07a6e62ecf837d760d58a25f32fbf6bbca
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/ext/org/deckfour/xes/extension/XExtensionParser.java#L111-L121
146,730
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/util/iterator/ResultSetIterator.java
ResultSetIterator.hasNext
public boolean hasNext() { if(_rs == null) return false; if(_primed) return true; try { _primed = _rs.next(); return _primed; } catch(SQLException sql) { String msg = "An exception occurred reading from the Iterator. Cause: " + sql; LOGGER.error(msg, sql); throw new IllegalStateException(msg, sql); } }
java
public boolean hasNext() { if(_rs == null) return false; if(_primed) return true; try { _primed = _rs.next(); return _primed; } catch(SQLException sql) { String msg = "An exception occurred reading from the Iterator. Cause: " + sql; LOGGER.error(msg, sql); throw new IllegalStateException(msg, sql); } }
[ "public", "boolean", "hasNext", "(", ")", "{", "if", "(", "_rs", "==", "null", ")", "return", "false", ";", "if", "(", "_primed", ")", "return", "true", ";", "try", "{", "_primed", "=", "_rs", ".", "next", "(", ")", ";", "return", "_primed", ";", "}", "catch", "(", "SQLException", "sql", ")", "{", "String", "msg", "=", "\"An exception occurred reading from the Iterator. Cause: \"", "+", "sql", ";", "LOGGER", ".", "error", "(", "msg", ",", "sql", ")", ";", "throw", "new", "IllegalStateException", "(", "msg", ",", "sql", ")", ";", "}", "}" ]
Check for a subsequent item in the ResultSet. @return <code>true</code> if there is another element; <code>false</code> otherwise @throws IllegalStateException when a {@link SQLException} occurs advancing the ResultSet
[ "Check", "for", "a", "subsequent", "item", "in", "the", "ResultSet", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/util/iterator/ResultSetIterator.java#L82-L98
146,731
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/util/iterator/ResultSetIterator.java
ResultSetIterator.next
public Object next() { if(_rs == null) throw new NoSuchElementException(Bundle.getErrorString("IteratorFactory_Iterator_noSuchElement")); try { if(!_primed) { _primed = _rs.next(); if(!_primed) { throw new NoSuchElementException(Bundle.getErrorString("IteratorFactory_Iterator_noSuchElement")); } } _primed = false; return convertRow(_rs, _columnNames); } catch(SQLException sql) { String msg = "An exception occurred reading from the Iterator. Cause: " + sql; LOGGER.error(msg, sql); throw new IllegalStateException(msg, sql); } }
java
public Object next() { if(_rs == null) throw new NoSuchElementException(Bundle.getErrorString("IteratorFactory_Iterator_noSuchElement")); try { if(!_primed) { _primed = _rs.next(); if(!_primed) { throw new NoSuchElementException(Bundle.getErrorString("IteratorFactory_Iterator_noSuchElement")); } } _primed = false; return convertRow(_rs, _columnNames); } catch(SQLException sql) { String msg = "An exception occurred reading from the Iterator. Cause: " + sql; LOGGER.error(msg, sql); throw new IllegalStateException(msg, sql); } }
[ "public", "Object", "next", "(", ")", "{", "if", "(", "_rs", "==", "null", ")", "throw", "new", "NoSuchElementException", "(", "Bundle", ".", "getErrorString", "(", "\"IteratorFactory_Iterator_noSuchElement\"", ")", ")", ";", "try", "{", "if", "(", "!", "_primed", ")", "{", "_primed", "=", "_rs", ".", "next", "(", ")", ";", "if", "(", "!", "_primed", ")", "{", "throw", "new", "NoSuchElementException", "(", "Bundle", ".", "getErrorString", "(", "\"IteratorFactory_Iterator_noSuchElement\"", ")", ")", ";", "}", "}", "_primed", "=", "false", ";", "return", "convertRow", "(", "_rs", ",", "_columnNames", ")", ";", "}", "catch", "(", "SQLException", "sql", ")", "{", "String", "msg", "=", "\"An exception occurred reading from the Iterator. Cause: \"", "+", "sql", ";", "LOGGER", ".", "error", "(", "msg", ",", "sql", ")", ";", "throw", "new", "IllegalStateException", "(", "msg", ",", "sql", ")", ";", "}", "}" ]
Advance to the next row in the ResultSet. @return a {@link java.util.Map} containing the data in the next row. The keys in the map correspond to the ResultSet's column names and are case insensitive when checking a key. @throws NoSuchElementException if the ResultSet is null or the end of the ResultSet has been reached
[ "Advance", "to", "the", "next", "row", "in", "the", "ResultSet", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/util/iterator/ResultSetIterator.java#L107-L127
146,732
matthewhorridge/owlapi-gwt
owlapi-gwt-client-side-emul/src/main/java/org/semanticweb/owlapi/util/NNF.java
NNF.visit
@Override public OWLAxiom visit(OWLSubClassOfAxiom axiom) { return dataFactory.getOWLSubClassOfAxiom( axiom.getSubClass().accept(this), axiom.getSuperClass().accept(this)); }
java
@Override public OWLAxiom visit(OWLSubClassOfAxiom axiom) { return dataFactory.getOWLSubClassOfAxiom( axiom.getSubClass().accept(this), axiom.getSuperClass().accept(this)); }
[ "@", "Override", "public", "OWLAxiom", "visit", "(", "OWLSubClassOfAxiom", "axiom", ")", "{", "return", "dataFactory", ".", "getOWLSubClassOfAxiom", "(", "axiom", ".", "getSubClass", "(", ")", ".", "accept", "(", "this", ")", ",", "axiom", ".", "getSuperClass", "(", ")", ".", "accept", "(", "this", ")", ")", ";", "}" ]
Conversion of non-class expressions to NNF
[ "Conversion", "of", "non", "-", "class", "expressions", "to", "NNF" ]
7ab975fb6cef3c8947099983551672a3b5d4e2fd
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-client-side-emul/src/main/java/org/semanticweb/owlapi/util/NNF.java#L449-L454
146,733
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/databinding/bundle/DeclareBundle.java
DeclareBundle.doEndTag
public int doEndTag() throws JspException { if(_name.length() == 0) { String msg = Bundle.getErrorString("Tags_DeclareBundle_invalidName", new Object[]{_name}); registerTagError(msg, null); } if(_name.equals(BundleMap.DEFAULT_STRUTS_BUNDLE_NAME)) { String msg = Bundle.getErrorString("Tags_DeclareBundle_defaultIsReservedWord", null); registerTagError(msg, null); } if(_bundlePath.length() == 0) { String msg = Bundle.getErrorString("Tags_DeclareBundle_invalidResourcePath", new Object[]{_bundlePath}); registerTagError(msg, null); } Locale locale = getCurrentLocale(); if(hasErrors()) { reportErrors(); return EVAL_PAGE; } BundleMap bundleMap = null; Object obj = pageContext.getAttribute("bundle"); if(obj == null) { // NetUI v2 -- in JSP 2.0 EL, the BundleMap is dropped into the PageContext so that // it's available to the EL runtime. bundleMap = new BundleMap((HttpServletRequest)pageContext.getRequest(), pageContext.getServletContext()); pageContext.setAttribute("bundle", bundleMap); } else if(!(obj instanceof BundleMap)) { String msg = Bundle.getErrorString("Tags_DeclareBundle_wrongContextType", new Object[]{obj.getClass().getName()}); registerTagError(msg, null); if(hasErrors()) reportErrors(); return EVAL_PAGE; } else bundleMap = (BundleMap)obj; bundleMap.registerResourceBundle(_name, _bundlePath, locale); return EVAL_PAGE; }
java
public int doEndTag() throws JspException { if(_name.length() == 0) { String msg = Bundle.getErrorString("Tags_DeclareBundle_invalidName", new Object[]{_name}); registerTagError(msg, null); } if(_name.equals(BundleMap.DEFAULT_STRUTS_BUNDLE_NAME)) { String msg = Bundle.getErrorString("Tags_DeclareBundle_defaultIsReservedWord", null); registerTagError(msg, null); } if(_bundlePath.length() == 0) { String msg = Bundle.getErrorString("Tags_DeclareBundle_invalidResourcePath", new Object[]{_bundlePath}); registerTagError(msg, null); } Locale locale = getCurrentLocale(); if(hasErrors()) { reportErrors(); return EVAL_PAGE; } BundleMap bundleMap = null; Object obj = pageContext.getAttribute("bundle"); if(obj == null) { // NetUI v2 -- in JSP 2.0 EL, the BundleMap is dropped into the PageContext so that // it's available to the EL runtime. bundleMap = new BundleMap((HttpServletRequest)pageContext.getRequest(), pageContext.getServletContext()); pageContext.setAttribute("bundle", bundleMap); } else if(!(obj instanceof BundleMap)) { String msg = Bundle.getErrorString("Tags_DeclareBundle_wrongContextType", new Object[]{obj.getClass().getName()}); registerTagError(msg, null); if(hasErrors()) reportErrors(); return EVAL_PAGE; } else bundleMap = (BundleMap)obj; bundleMap.registerResourceBundle(_name, _bundlePath, locale); return EVAL_PAGE; }
[ "public", "int", "doEndTag", "(", ")", "throws", "JspException", "{", "if", "(", "_name", ".", "length", "(", ")", "==", "0", ")", "{", "String", "msg", "=", "Bundle", ".", "getErrorString", "(", "\"Tags_DeclareBundle_invalidName\"", ",", "new", "Object", "[", "]", "{", "_name", "}", ")", ";", "registerTagError", "(", "msg", ",", "null", ")", ";", "}", "if", "(", "_name", ".", "equals", "(", "BundleMap", ".", "DEFAULT_STRUTS_BUNDLE_NAME", ")", ")", "{", "String", "msg", "=", "Bundle", ".", "getErrorString", "(", "\"Tags_DeclareBundle_defaultIsReservedWord\"", ",", "null", ")", ";", "registerTagError", "(", "msg", ",", "null", ")", ";", "}", "if", "(", "_bundlePath", ".", "length", "(", ")", "==", "0", ")", "{", "String", "msg", "=", "Bundle", ".", "getErrorString", "(", "\"Tags_DeclareBundle_invalidResourcePath\"", ",", "new", "Object", "[", "]", "{", "_bundlePath", "}", ")", ";", "registerTagError", "(", "msg", ",", "null", ")", ";", "}", "Locale", "locale", "=", "getCurrentLocale", "(", ")", ";", "if", "(", "hasErrors", "(", ")", ")", "{", "reportErrors", "(", ")", ";", "return", "EVAL_PAGE", ";", "}", "BundleMap", "bundleMap", "=", "null", ";", "Object", "obj", "=", "pageContext", ".", "getAttribute", "(", "\"bundle\"", ")", ";", "if", "(", "obj", "==", "null", ")", "{", "// NetUI v2 -- in JSP 2.0 EL, the BundleMap is dropped into the PageContext so that", "// it's available to the EL runtime.", "bundleMap", "=", "new", "BundleMap", "(", "(", "HttpServletRequest", ")", "pageContext", ".", "getRequest", "(", ")", ",", "pageContext", ".", "getServletContext", "(", ")", ")", ";", "pageContext", ".", "setAttribute", "(", "\"bundle\"", ",", "bundleMap", ")", ";", "}", "else", "if", "(", "!", "(", "obj", "instanceof", "BundleMap", ")", ")", "{", "String", "msg", "=", "Bundle", ".", "getErrorString", "(", "\"Tags_DeclareBundle_wrongContextType\"", ",", "new", "Object", "[", "]", "{", "obj", ".", "getClass", "(", ")", ".", "getName", "(", ")", "}", ")", ";", "registerTagError", "(", "msg", ",", "null", ")", ";", "if", "(", "hasErrors", "(", ")", ")", "reportErrors", "(", ")", ";", "return", "EVAL_PAGE", ";", "}", "else", "bundleMap", "=", "(", "BundleMap", ")", "obj", ";", "bundleMap", ".", "registerResourceBundle", "(", "_name", ",", "_bundlePath", ",", "locale", ")", ";", "return", "EVAL_PAGE", ";", "}" ]
Register a ResourceBundle that is available for the scope of this page. Errors raised during the execution of this tag will be reported in the page, which will continue rendering. @return {@link #EVAL_PAGE} @throws JspException if error conditions are encountered during this method which can not be reported in the page.
[ "Register", "a", "ResourceBundle", "that", "is", "available", "for", "the", "scope", "of", "this", "page", ".", "Errors", "raised", "during", "the", "execution", "of", "this", "tag", "will", "be", "reported", "in", "the", "page", "which", "will", "continue", "rendering", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/databinding/bundle/DeclareBundle.java#L330-L375
146,734
iig-uni-freiburg/SEWOL
ext/org/deckfour/xes/util/XAttributeUtils.java
XAttributeUtils.getType
public static Class<? extends XAttribute> getType(XAttribute attribute) { if (attribute instanceof XAttributeList) { return XAttributeList.class; } else if (attribute instanceof XAttributeContainer) { return XAttributeContainer.class; } else if (attribute instanceof XAttributeLiteral) { return XAttributeLiteral.class; } else if (attribute instanceof XAttributeBoolean) { return XAttributeBoolean.class; } else if (attribute instanceof XAttributeContinuous) { return XAttributeContinuous.class; } else if (attribute instanceof XAttributeDiscrete) { return XAttributeDiscrete.class; } else if (attribute instanceof XAttributeTimestamp) { return XAttributeTimestamp.class; } else if (attribute instanceof XAttributeID) { return XAttributeID.class; } else { throw new AssertionError("Unexpected attribute type!"); } }
java
public static Class<? extends XAttribute> getType(XAttribute attribute) { if (attribute instanceof XAttributeList) { return XAttributeList.class; } else if (attribute instanceof XAttributeContainer) { return XAttributeContainer.class; } else if (attribute instanceof XAttributeLiteral) { return XAttributeLiteral.class; } else if (attribute instanceof XAttributeBoolean) { return XAttributeBoolean.class; } else if (attribute instanceof XAttributeContinuous) { return XAttributeContinuous.class; } else if (attribute instanceof XAttributeDiscrete) { return XAttributeDiscrete.class; } else if (attribute instanceof XAttributeTimestamp) { return XAttributeTimestamp.class; } else if (attribute instanceof XAttributeID) { return XAttributeID.class; } else { throw new AssertionError("Unexpected attribute type!"); } }
[ "public", "static", "Class", "<", "?", "extends", "XAttribute", ">", "getType", "(", "XAttribute", "attribute", ")", "{", "if", "(", "attribute", "instanceof", "XAttributeList", ")", "{", "return", "XAttributeList", ".", "class", ";", "}", "else", "if", "(", "attribute", "instanceof", "XAttributeContainer", ")", "{", "return", "XAttributeContainer", ".", "class", ";", "}", "else", "if", "(", "attribute", "instanceof", "XAttributeLiteral", ")", "{", "return", "XAttributeLiteral", ".", "class", ";", "}", "else", "if", "(", "attribute", "instanceof", "XAttributeBoolean", ")", "{", "return", "XAttributeBoolean", ".", "class", ";", "}", "else", "if", "(", "attribute", "instanceof", "XAttributeContinuous", ")", "{", "return", "XAttributeContinuous", ".", "class", ";", "}", "else", "if", "(", "attribute", "instanceof", "XAttributeDiscrete", ")", "{", "return", "XAttributeDiscrete", ".", "class", ";", "}", "else", "if", "(", "attribute", "instanceof", "XAttributeTimestamp", ")", "{", "return", "XAttributeTimestamp", ".", "class", ";", "}", "else", "if", "(", "attribute", "instanceof", "XAttributeID", ")", "{", "return", "XAttributeID", ".", "class", ";", "}", "else", "{", "throw", "new", "AssertionError", "(", "\"Unexpected attribute type!\"", ")", ";", "}", "}" ]
For the given attribute, returns its type, i.e., the most high-level, typed interface this attribute implements. @param attribute Attribute to analyze. @return High-level type interface of this attribute.
[ "For", "the", "given", "attribute", "returns", "its", "type", "i", ".", "e", ".", "the", "most", "high", "-", "level", "typed", "interface", "this", "attribute", "implements", "." ]
e791cb07a6e62ecf837d760d58a25f32fbf6bbca
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/ext/org/deckfour/xes/util/XAttributeUtils.java#L75-L95
146,735
iig-uni-freiburg/SEWOL
ext/org/deckfour/xes/util/XAttributeUtils.java
XAttributeUtils.derivePrototype
public static XAttribute derivePrototype(XAttribute instance) { XAttribute prototype = (XAttribute) instance.clone(); if (prototype instanceof XAttributeList) { } else if (prototype instanceof XAttributeContainer) { } else if (prototype instanceof XAttributeLiteral) { ((XAttributeLiteral) prototype).setValue("DEFAULT"); } else if (prototype instanceof XAttributeBoolean) { ((XAttributeBoolean) prototype).setValue(true); } else if (prototype instanceof XAttributeContinuous) { ((XAttributeContinuous) prototype).setValue(0.0); } else if (prototype instanceof XAttributeDiscrete) { ((XAttributeDiscrete) prototype).setValue(0); } else if (prototype instanceof XAttributeTimestamp) { ((XAttributeTimestamp) prototype).setValueMillis(0); } else if (prototype instanceof XAttributeID) { ((XAttributeID) prototype).setValue(XIDFactory.instance().createId()); } else { throw new AssertionError("Unexpected attribute type!"); } return prototype; }
java
public static XAttribute derivePrototype(XAttribute instance) { XAttribute prototype = (XAttribute) instance.clone(); if (prototype instanceof XAttributeList) { } else if (prototype instanceof XAttributeContainer) { } else if (prototype instanceof XAttributeLiteral) { ((XAttributeLiteral) prototype).setValue("DEFAULT"); } else if (prototype instanceof XAttributeBoolean) { ((XAttributeBoolean) prototype).setValue(true); } else if (prototype instanceof XAttributeContinuous) { ((XAttributeContinuous) prototype).setValue(0.0); } else if (prototype instanceof XAttributeDiscrete) { ((XAttributeDiscrete) prototype).setValue(0); } else if (prototype instanceof XAttributeTimestamp) { ((XAttributeTimestamp) prototype).setValueMillis(0); } else if (prototype instanceof XAttributeID) { ((XAttributeID) prototype).setValue(XIDFactory.instance().createId()); } else { throw new AssertionError("Unexpected attribute type!"); } return prototype; }
[ "public", "static", "XAttribute", "derivePrototype", "(", "XAttribute", "instance", ")", "{", "XAttribute", "prototype", "=", "(", "XAttribute", ")", "instance", ".", "clone", "(", ")", ";", "if", "(", "prototype", "instanceof", "XAttributeList", ")", "{", "}", "else", "if", "(", "prototype", "instanceof", "XAttributeContainer", ")", "{", "}", "else", "if", "(", "prototype", "instanceof", "XAttributeLiteral", ")", "{", "(", "(", "XAttributeLiteral", ")", "prototype", ")", ".", "setValue", "(", "\"DEFAULT\"", ")", ";", "}", "else", "if", "(", "prototype", "instanceof", "XAttributeBoolean", ")", "{", "(", "(", "XAttributeBoolean", ")", "prototype", ")", ".", "setValue", "(", "true", ")", ";", "}", "else", "if", "(", "prototype", "instanceof", "XAttributeContinuous", ")", "{", "(", "(", "XAttributeContinuous", ")", "prototype", ")", ".", "setValue", "(", "0.0", ")", ";", "}", "else", "if", "(", "prototype", "instanceof", "XAttributeDiscrete", ")", "{", "(", "(", "XAttributeDiscrete", ")", "prototype", ")", ".", "setValue", "(", "0", ")", ";", "}", "else", "if", "(", "prototype", "instanceof", "XAttributeTimestamp", ")", "{", "(", "(", "XAttributeTimestamp", ")", "prototype", ")", ".", "setValueMillis", "(", "0", ")", ";", "}", "else", "if", "(", "prototype", "instanceof", "XAttributeID", ")", "{", "(", "(", "XAttributeID", ")", "prototype", ")", ".", "setValue", "(", "XIDFactory", ".", "instance", "(", ")", ".", "createId", "(", ")", ")", ";", "}", "else", "{", "throw", "new", "AssertionError", "(", "\"Unexpected attribute type!\"", ")", ";", "}", "return", "prototype", ";", "}" ]
Derives a prototype for the given attribute. This prototype attribute will be equal in all respects, expect for the value of the attribute. This value will be set to a default value, depending on the specific type of the given attribute. @param instance Attribute to derive prototype from. @return The derived prototype attribute.
[ "Derives", "a", "prototype", "for", "the", "given", "attribute", ".", "This", "prototype", "attribute", "will", "be", "equal", "in", "all", "respects", "expect", "for", "the", "value", "of", "the", "attribute", ".", "This", "value", "will", "be", "set", "to", "a", "default", "value", "depending", "on", "the", "specific", "type", "of", "the", "given", "attribute", "." ]
e791cb07a6e62ecf837d760d58a25f32fbf6bbca
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/ext/org/deckfour/xes/util/XAttributeUtils.java#L137-L157
146,736
iig-uni-freiburg/SEWOL
ext/org/deckfour/xes/util/XAttributeUtils.java
XAttributeUtils.extractExtensions
public static Set<XExtension> extractExtensions( Map<String, XAttribute> attributeMap) { HashSet<XExtension> extensions = new HashSet<XExtension>(); for (XAttribute attribute : attributeMap.values()) { XExtension extension = attribute.getExtension(); if (extension != null) { extensions.add(extension); } } return extensions; }
java
public static Set<XExtension> extractExtensions( Map<String, XAttribute> attributeMap) { HashSet<XExtension> extensions = new HashSet<XExtension>(); for (XAttribute attribute : attributeMap.values()) { XExtension extension = attribute.getExtension(); if (extension != null) { extensions.add(extension); } } return extensions; }
[ "public", "static", "Set", "<", "XExtension", ">", "extractExtensions", "(", "Map", "<", "String", ",", "XAttribute", ">", "attributeMap", ")", "{", "HashSet", "<", "XExtension", ">", "extensions", "=", "new", "HashSet", "<", "XExtension", ">", "(", ")", ";", "for", "(", "XAttribute", "attribute", ":", "attributeMap", ".", "values", "(", ")", ")", "{", "XExtension", "extension", "=", "attribute", ".", "getExtension", "(", ")", ";", "if", "(", "extension", "!=", "null", ")", "{", "extensions", ".", "add", "(", "extension", ")", ";", "}", "}", "return", "extensions", ";", "}" ]
Static helper method for extracting all extensions from an attribute map. @param attributeMap The attribute map from which to extract extensions. @return The set of extensions in the attribute map.
[ "Static", "helper", "method", "for", "extracting", "all", "extensions", "from", "an", "attribute", "map", "." ]
e791cb07a6e62ecf837d760d58a25f32fbf6bbca
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/ext/org/deckfour/xes/util/XAttributeUtils.java#L229-L239
146,737
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/Tree.java
Tree.replace
protected String replace(String template, String placeholder, String value) { if (template == null) return null; if ((placeholder == null) || (value == null)) return template; while (true) { int index = template.indexOf(placeholder); if (index < 0) break; InternalStringBuilder temp = new InternalStringBuilder(template.substring(0, index)); temp.append(value); temp.append(template.substring(index + placeholder.length())); template = temp.toString(); } return template; }
java
protected String replace(String template, String placeholder, String value) { if (template == null) return null; if ((placeholder == null) || (value == null)) return template; while (true) { int index = template.indexOf(placeholder); if (index < 0) break; InternalStringBuilder temp = new InternalStringBuilder(template.substring(0, index)); temp.append(value); temp.append(template.substring(index + placeholder.length())); template = temp.toString(); } return template; }
[ "protected", "String", "replace", "(", "String", "template", ",", "String", "placeholder", ",", "String", "value", ")", "{", "if", "(", "template", "==", "null", ")", "return", "null", ";", "if", "(", "(", "placeholder", "==", "null", ")", "||", "(", "value", "==", "null", ")", ")", "return", "template", ";", "while", "(", "true", ")", "{", "int", "index", "=", "template", ".", "indexOf", "(", "placeholder", ")", ";", "if", "(", "index", "<", "0", ")", "break", ";", "InternalStringBuilder", "temp", "=", "new", "InternalStringBuilder", "(", "template", ".", "substring", "(", "0", ",", "index", ")", ")", ";", "temp", ".", "append", "(", "value", ")", ";", "temp", ".", "append", "(", "template", ".", "substring", "(", "index", "+", "placeholder", ".", "length", "(", ")", ")", ")", ";", "template", "=", "temp", ".", "toString", "(", ")", ";", "}", "return", "template", ";", "}" ]
Replace any occurrence of the specified placeholder in the specified template string with the specified replacement value. @param template Pattern string possibly containing the placeholder @param placeholder Placeholder expression to be replaced @param value Replacement value for the placeholder
[ "Replace", "any", "occurrence", "of", "the", "specified", "placeholder", "in", "the", "specified", "template", "string", "with", "the", "specified", "replacement", "value", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/Tree.java#L992-L1009
146,738
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/Tree.java
Tree.collectChildError
public void collectChildError(String error) { if (_errorText == null) { _errorText = new InternalStringBuilder(32); } _errorText.append(error); }
java
public void collectChildError(String error) { if (_errorText == null) { _errorText = new InternalStringBuilder(32); } _errorText.append(error); }
[ "public", "void", "collectChildError", "(", "String", "error", ")", "{", "if", "(", "_errorText", "==", "null", ")", "{", "_errorText", "=", "new", "InternalStringBuilder", "(", "32", ")", ";", "}", "_errorText", ".", "append", "(", "error", ")", ";", "}" ]
This method will report all collected errors. @param error
[ "This", "method", "will", "report", "all", "collected", "errors", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/Tree.java#L1032-L1038
146,739
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/Tree.java
Tree.renderDefaultJavaScript
private String renderDefaultJavaScript(HttpServletRequest request, String realId) { String idScript = null; // map the tagId to the real id if (TagConfig.isDefaultJavaScript()) { ScriptRequestState srs = ScriptRequestState.getScriptRequestState(request); idScript = srs.mapTagId(getScriptReporter(), _trs.tagId, realId, null); } return idScript; }
java
private String renderDefaultJavaScript(HttpServletRequest request, String realId) { String idScript = null; // map the tagId to the real id if (TagConfig.isDefaultJavaScript()) { ScriptRequestState srs = ScriptRequestState.getScriptRequestState(request); idScript = srs.mapTagId(getScriptReporter(), _trs.tagId, realId, null); } return idScript; }
[ "private", "String", "renderDefaultJavaScript", "(", "HttpServletRequest", "request", ",", "String", "realId", ")", "{", "String", "idScript", "=", "null", ";", "// map the tagId to the real id", "if", "(", "TagConfig", ".", "isDefaultJavaScript", "(", ")", ")", "{", "ScriptRequestState", "srs", "=", "ScriptRequestState", ".", "getScriptRequestState", "(", "request", ")", ";", "idScript", "=", "srs", ".", "mapTagId", "(", "getScriptReporter", "(", ")", ",", "_trs", ".", "tagId", ",", "realId", ",", "null", ")", ";", "}", "return", "idScript", ";", "}" ]
Much of the code below is taken from the HtmlBaseTag. We need to eliminate this duplication through some type of helper methods.
[ "Much", "of", "the", "code", "below", "is", "taken", "from", "the", "HtmlBaseTag", ".", "We", "need", "to", "eliminate", "this", "duplication", "through", "some", "type", "of", "helper", "methods", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/Tree.java#L1045-L1055
146,740
moparisthebest/beehive
beehive-netui-compiler/src/main/java/org/apache/beehive/netui/compiler/CompilerUtils.java
CompilerUtils.getFormClassName
public static String getFormClassName( TypeDeclaration jclass, CoreAnnotationProcessorEnv env ) { if ( isAssignableFrom( STRUTS_FORM_CLASS_NAME, jclass, env ) ) { return getLoadableName( jclass ); } else if ( isAssignableFrom( BEA_XMLOBJECT_CLASS_NAME, jclass, env ) ) { return XML_FORM_CLASS_NAME; } else if ( isAssignableFrom( APACHE_XMLOBJECT_CLASS_NAME, jclass, env ) ) { return XML_FORM_CLASS_NAME; } else { return ANY_FORM_CLASS_NAME; } }
java
public static String getFormClassName( TypeDeclaration jclass, CoreAnnotationProcessorEnv env ) { if ( isAssignableFrom( STRUTS_FORM_CLASS_NAME, jclass, env ) ) { return getLoadableName( jclass ); } else if ( isAssignableFrom( BEA_XMLOBJECT_CLASS_NAME, jclass, env ) ) { return XML_FORM_CLASS_NAME; } else if ( isAssignableFrom( APACHE_XMLOBJECT_CLASS_NAME, jclass, env ) ) { return XML_FORM_CLASS_NAME; } else { return ANY_FORM_CLASS_NAME; } }
[ "public", "static", "String", "getFormClassName", "(", "TypeDeclaration", "jclass", ",", "CoreAnnotationProcessorEnv", "env", ")", "{", "if", "(", "isAssignableFrom", "(", "STRUTS_FORM_CLASS_NAME", ",", "jclass", ",", "env", ")", ")", "{", "return", "getLoadableName", "(", "jclass", ")", ";", "}", "else", "if", "(", "isAssignableFrom", "(", "BEA_XMLOBJECT_CLASS_NAME", ",", "jclass", ",", "env", ")", ")", "{", "return", "XML_FORM_CLASS_NAME", ";", "}", "else", "if", "(", "isAssignableFrom", "(", "APACHE_XMLOBJECT_CLASS_NAME", ",", "jclass", ",", "env", ")", ")", "{", "return", "XML_FORM_CLASS_NAME", ";", "}", "else", "{", "return", "ANY_FORM_CLASS_NAME", ";", "}", "}" ]
Get a Class.forName-able string for the given type signature.
[ "Get", "a", "Class", ".", "forName", "-", "able", "string", "for", "the", "given", "type", "signature", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-compiler/src/main/java/org/apache/beehive/netui/compiler/CompilerUtils.java#L548-L566
146,741
moparisthebest/beehive
beehive-netui-compiler/src/main/java/org/apache/beehive/netui/compiler/CompilerUtils.java
CompilerUtils.inferModulePathFromType
public static String inferModulePathFromType(TypeDeclaration type) { PackageDeclaration pkg = type.getPackage(); return pkg != null ? '/' + pkg.getQualifiedName().replace('.', '/') : "/"; }
java
public static String inferModulePathFromType(TypeDeclaration type) { PackageDeclaration pkg = type.getPackage(); return pkg != null ? '/' + pkg.getQualifiedName().replace('.', '/') : "/"; }
[ "public", "static", "String", "inferModulePathFromType", "(", "TypeDeclaration", "type", ")", "{", "PackageDeclaration", "pkg", "=", "type", ".", "getPackage", "(", ")", ";", "return", "pkg", "!=", "null", "?", "'", "'", "+", "pkg", ".", "getQualifiedName", "(", ")", ".", "replace", "(", "'", "'", ",", "'", "'", ")", ":", "\"/\"", ";", "}" ]
Infers the Struts module path from the given controller class.
[ "Infers", "the", "Struts", "module", "path", "from", "the", "given", "controller", "class", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-compiler/src/main/java/org/apache/beehive/netui/compiler/CompilerUtils.java#L999-L1002
146,742
moparisthebest/beehive
beehive-netui-compiler/src/main/java/org/apache/beehive/netui/compiler/CompilerUtils.java
CompilerUtils.isAbsoluteURI
public static boolean isAbsoluteURI( String uri ) { // // This method needs to be fast, so it can't use java.net.URI. // if ( uri.length() == 0 || uri.charAt( 0 ) == '/' ) return false; for ( int i = 0, len = uri.length(); i < len; ++i ) { char c = uri.charAt( i ); if ( c == ':' ) { return true; } else if ( c == '/' ) { return false; } } return false; }
java
public static boolean isAbsoluteURI( String uri ) { // // This method needs to be fast, so it can't use java.net.URI. // if ( uri.length() == 0 || uri.charAt( 0 ) == '/' ) return false; for ( int i = 0, len = uri.length(); i < len; ++i ) { char c = uri.charAt( i ); if ( c == ':' ) { return true; } else if ( c == '/' ) { return false; } } return false; }
[ "public", "static", "boolean", "isAbsoluteURI", "(", "String", "uri", ")", "{", "//", "// This method needs to be fast, so it can't use java.net.URI.", "//", "if", "(", "uri", ".", "length", "(", ")", "==", "0", "||", "uri", ".", "charAt", "(", "0", ")", "==", "'", "'", ")", "return", "false", ";", "for", "(", "int", "i", "=", "0", ",", "len", "=", "uri", ".", "length", "(", ")", ";", "i", "<", "len", ";", "++", "i", ")", "{", "char", "c", "=", "uri", ".", "charAt", "(", "i", ")", ";", "if", "(", "c", "==", "'", "'", ")", "{", "return", "true", ";", "}", "else", "if", "(", "c", "==", "'", "'", ")", "{", "return", "false", ";", "}", "}", "return", "false", ";", "}" ]
This is the same logic that we have in the runtime, in PageFlowRequestProcessor. Can't share the code, though.
[ "This", "is", "the", "same", "logic", "that", "we", "have", "in", "the", "runtime", "in", "PageFlowRequestProcessor", ".", "Can", "t", "share", "the", "code", "though", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-compiler/src/main/java/org/apache/beehive/netui/compiler/CompilerUtils.java#L1118-L1140
146,743
moparisthebest/beehive
beehive-netui-compiler/src/main/java/org/apache/beehive/netui/compiler/CompilerUtils.java
CompilerUtils.isReconcilePhase
public static String isReconcilePhase(CoreAnnotationProcessorEnv env) throws FatalCompileTimeException { String[] phase = getOption("-A" + JpfLanguageConstants.ANNOTATION_PROCESSOR_OPTION_PHASE, false, env); return phase != null && phase.length > 0 ? phase[0] : null; }
java
public static String isReconcilePhase(CoreAnnotationProcessorEnv env) throws FatalCompileTimeException { String[] phase = getOption("-A" + JpfLanguageConstants.ANNOTATION_PROCESSOR_OPTION_PHASE, false, env); return phase != null && phase.length > 0 ? phase[0] : null; }
[ "public", "static", "String", "isReconcilePhase", "(", "CoreAnnotationProcessorEnv", "env", ")", "throws", "FatalCompileTimeException", "{", "String", "[", "]", "phase", "=", "getOption", "(", "\"-A\"", "+", "JpfLanguageConstants", ".", "ANNOTATION_PROCESSOR_OPTION_PHASE", ",", "false", ",", "env", ")", ";", "return", "phase", "!=", "null", "&&", "phase", ".", "length", ">", "0", "?", "phase", "[", "0", "]", ":", "null", ";", "}" ]
Utility method to get the value of the "phase" option from the annotation processing environment. @param env the annotation processing environment @return the value of the "phase" option, or <code>null</code> if the option is unspecified @throws FatalCompileTimeException if an error occurs getting the value of the option
[ "Utility", "method", "to", "get", "the", "value", "of", "the", "phase", "option", "from", "the", "annotation", "processing", "environment", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-compiler/src/main/java/org/apache/beehive/netui/compiler/CompilerUtils.java#L1285-L1289
146,744
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/webcontext/ControlBeanContextSupport.java
ControlBeanContextSupport.needsGui
public boolean needsGui() { BeanContextChild bcc = getPeer(); if (bcc != this && bcc instanceof Visibility) { return ((Visibility) bcc).needsGui(); } // check children for (Object o : _children.keySet()) { if (o instanceof Visibility) { if (((Visibility) o).needsGui()) { return true; } } } return false; }
java
public boolean needsGui() { BeanContextChild bcc = getPeer(); if (bcc != this && bcc instanceof Visibility) { return ((Visibility) bcc).needsGui(); } // check children for (Object o : _children.keySet()) { if (o instanceof Visibility) { if (((Visibility) o).needsGui()) { return true; } } } return false; }
[ "public", "boolean", "needsGui", "(", ")", "{", "BeanContextChild", "bcc", "=", "getPeer", "(", ")", ";", "if", "(", "bcc", "!=", "this", "&&", "bcc", "instanceof", "Visibility", ")", "{", "return", "(", "(", "Visibility", ")", "bcc", ")", ".", "needsGui", "(", ")", ";", "}", "// check children", "for", "(", "Object", "o", ":", "_children", ".", "keySet", "(", ")", ")", "{", "if", "(", "o", "instanceof", "Visibility", ")", "{", "if", "(", "(", "(", "Visibility", ")", "o", ")", ".", "needsGui", "(", ")", ")", "{", "return", "true", ";", "}", "}", "}", "return", "false", ";", "}" ]
Determines whether this bean needs a GUI. @return True if the bean absolutely needs a GUI available in order to get its work done.
[ "Determines", "whether", "this", "bean", "needs", "a", "GUI", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/webcontext/ControlBeanContextSupport.java#L408-L423
146,745
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/webcontext/ControlBeanContextSupport.java
ControlBeanContextSupport.dontUseGui
public void dontUseGui() { if (!_mayUseGui) return; _mayUseGui = false; for (Object o : _children.keySet()) { if (o instanceof Visibility) { ((Visibility) o).dontUseGui(); } } }
java
public void dontUseGui() { if (!_mayUseGui) return; _mayUseGui = false; for (Object o : _children.keySet()) { if (o instanceof Visibility) { ((Visibility) o).dontUseGui(); } } }
[ "public", "void", "dontUseGui", "(", ")", "{", "if", "(", "!", "_mayUseGui", ")", "return", ";", "_mayUseGui", "=", "false", ";", "for", "(", "Object", "o", ":", "_children", ".", "keySet", "(", ")", ")", "{", "if", "(", "o", "instanceof", "Visibility", ")", "{", "(", "(", "Visibility", ")", "o", ")", ".", "dontUseGui", "(", ")", ";", "}", "}", "}" ]
This method instructs the bean that it should not use the Gui.
[ "This", "method", "instructs", "the", "bean", "that", "it", "should", "not", "use", "the", "Gui", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/webcontext/ControlBeanContextSupport.java#L428-L438
146,746
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/webcontext/ControlBeanContextSupport.java
ControlBeanContextSupport.okToUseGui
public void okToUseGui() { if (_mayUseGui) return; _mayUseGui = true; for (Object o : _children.keySet()) { if (o instanceof Visibility) { ((Visibility) o).okToUseGui(); } } }
java
public void okToUseGui() { if (_mayUseGui) return; _mayUseGui = true; for (Object o : _children.keySet()) { if (o instanceof Visibility) { ((Visibility) o).okToUseGui(); } } }
[ "public", "void", "okToUseGui", "(", ")", "{", "if", "(", "_mayUseGui", ")", "return", ";", "_mayUseGui", "=", "true", ";", "for", "(", "Object", "o", ":", "_children", ".", "keySet", "(", ")", ")", "{", "if", "(", "o", "instanceof", "Visibility", ")", "{", "(", "(", "Visibility", ")", "o", ")", ".", "okToUseGui", "(", ")", ";", "}", "}", "}" ]
This method instructs the bean that it is OK to use the Gui.
[ "This", "method", "instructs", "the", "bean", "that", "it", "is", "OK", "to", "use", "the", "Gui", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/webcontext/ControlBeanContextSupport.java#L443-L453
146,747
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/webcontext/ControlBeanContextSupport.java
ControlBeanContextSupport.vetoableChange
public void vetoableChange(PropertyChangeEvent evt) throws PropertyVetoException { // monitor "beanContext" property if ("beanContext".equals(evt.getPropertyName()) && contains(evt.getOldValue())) { // noop: at this point doesn't veto } }
java
public void vetoableChange(PropertyChangeEvent evt) throws PropertyVetoException { // monitor "beanContext" property if ("beanContext".equals(evt.getPropertyName()) && contains(evt.getOldValue())) { // noop: at this point doesn't veto } }
[ "public", "void", "vetoableChange", "(", "PropertyChangeEvent", "evt", ")", "throws", "PropertyVetoException", "{", "// monitor \"beanContext\" property", "if", "(", "\"beanContext\"", ".", "equals", "(", "evt", ".", "getPropertyName", "(", ")", ")", "&&", "contains", "(", "evt", ".", "getOldValue", "(", ")", ")", ")", "{", "// noop: at this point doesn't veto", "}", "}" ]
This method gets called when a constrained property is changed. @param evt a <code>PropertyChangeEvent</code> object describing the event source and the property that has changed. @throws java.beans.PropertyVetoException if the recipient wishes the property change to be rolled back.
[ "This", "method", "gets", "called", "when", "a", "constrained", "property", "is", "changed", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/webcontext/ControlBeanContextSupport.java#L490-L496
146,748
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/webcontext/ControlBeanContextSupport.java
ControlBeanContextSupport.initialize
protected void initialize() { _bcMembershipListeners = new ArrayList<BeanContextMembershipListener>(); _children = Collections.synchronizedMap(new HashMap<Object, BCChild>()); _childPcl = new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent pce) { ControlBeanContextSupport.this.propertyChange(pce); } }; _childVcl = new VetoableChangeListener() { public void vetoableChange(PropertyChangeEvent pce) throws PropertyVetoException { ControlBeanContextSupport.this.vetoableChange(pce); } }; }
java
protected void initialize() { _bcMembershipListeners = new ArrayList<BeanContextMembershipListener>(); _children = Collections.synchronizedMap(new HashMap<Object, BCChild>()); _childPcl = new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent pce) { ControlBeanContextSupport.this.propertyChange(pce); } }; _childVcl = new VetoableChangeListener() { public void vetoableChange(PropertyChangeEvent pce) throws PropertyVetoException { ControlBeanContextSupport.this.vetoableChange(pce); } }; }
[ "protected", "void", "initialize", "(", ")", "{", "_bcMembershipListeners", "=", "new", "ArrayList", "<", "BeanContextMembershipListener", ">", "(", ")", ";", "_children", "=", "Collections", ".", "synchronizedMap", "(", "new", "HashMap", "<", "Object", ",", "BCChild", ">", "(", ")", ")", ";", "_childPcl", "=", "new", "PropertyChangeListener", "(", ")", "{", "public", "void", "propertyChange", "(", "PropertyChangeEvent", "pce", ")", "{", "ControlBeanContextSupport", ".", "this", ".", "propertyChange", "(", "pce", ")", ";", "}", "}", ";", "_childVcl", "=", "new", "VetoableChangeListener", "(", ")", "{", "public", "void", "vetoableChange", "(", "PropertyChangeEvent", "pce", ")", "throws", "PropertyVetoException", "{", "ControlBeanContextSupport", ".", "this", ".", "vetoableChange", "(", "pce", ")", ";", "}", "}", ";", "}" ]
Init this classes data structures.
[ "Init", "this", "classes", "data", "structures", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/webcontext/ControlBeanContextSupport.java#L506-L521
146,749
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/webcontext/ControlBeanContextSupport.java
ControlBeanContextSupport.fireMembershipEvent
private void fireMembershipEvent(BeanContextMembershipEvent bcme, boolean childrenAdded) { for (BeanContextMembershipListener bcml : _bcMembershipListeners) { if (childrenAdded) { bcml.childrenAdded(bcme); } else { bcml.childrenRemoved(bcme); } } }
java
private void fireMembershipEvent(BeanContextMembershipEvent bcme, boolean childrenAdded) { for (BeanContextMembershipListener bcml : _bcMembershipListeners) { if (childrenAdded) { bcml.childrenAdded(bcme); } else { bcml.childrenRemoved(bcme); } } }
[ "private", "void", "fireMembershipEvent", "(", "BeanContextMembershipEvent", "bcme", ",", "boolean", "childrenAdded", ")", "{", "for", "(", "BeanContextMembershipListener", "bcml", ":", "_bcMembershipListeners", ")", "{", "if", "(", "childrenAdded", ")", "{", "bcml", ".", "childrenAdded", "(", "bcme", ")", ";", "}", "else", "{", "bcml", ".", "childrenRemoved", "(", "bcme", ")", ";", "}", "}", "}" ]
Fire a BeanContextMembershipEvent. @param bcme Event to fire. @param childrenAdded True if add event, false if remove event.
[ "Fire", "a", "BeanContextMembershipEvent", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/webcontext/ControlBeanContextSupport.java#L529-L539
146,750
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/webcontext/ControlBeanContextSupport.java
ControlBeanContextSupport.writeChildren
public final void writeChildren(ObjectOutputStream oos) throws IOException { int serializable = 0; Set<Map.Entry<Object, BCChild>> bcChildren = _children.entrySet(); for (Map.Entry<Object, BCChild> entry : bcChildren) { if (entry.getValue().isSerializable()) { serializable++; } } oos.writeInt(serializable); if (serializable > 0) { for (Map.Entry<Object, BCChild> bc : bcChildren) { if (bc.getValue().isSerializable()) { oos.writeObject(bc.getKey()); } } } }
java
public final void writeChildren(ObjectOutputStream oos) throws IOException { int serializable = 0; Set<Map.Entry<Object, BCChild>> bcChildren = _children.entrySet(); for (Map.Entry<Object, BCChild> entry : bcChildren) { if (entry.getValue().isSerializable()) { serializable++; } } oos.writeInt(serializable); if (serializable > 0) { for (Map.Entry<Object, BCChild> bc : bcChildren) { if (bc.getValue().isSerializable()) { oos.writeObject(bc.getKey()); } } } }
[ "public", "final", "void", "writeChildren", "(", "ObjectOutputStream", "oos", ")", "throws", "IOException", "{", "int", "serializable", "=", "0", ";", "Set", "<", "Map", ".", "Entry", "<", "Object", ",", "BCChild", ">", ">", "bcChildren", "=", "_children", ".", "entrySet", "(", ")", ";", "for", "(", "Map", ".", "Entry", "<", "Object", ",", "BCChild", ">", "entry", ":", "bcChildren", ")", "{", "if", "(", "entry", ".", "getValue", "(", ")", ".", "isSerializable", "(", ")", ")", "{", "serializable", "++", ";", "}", "}", "oos", ".", "writeInt", "(", "serializable", ")", ";", "if", "(", "serializable", ">", "0", ")", "{", "for", "(", "Map", ".", "Entry", "<", "Object", ",", "BCChild", ">", "bc", ":", "bcChildren", ")", "{", "if", "(", "bc", ".", "getValue", "(", ")", ".", "isSerializable", "(", ")", ")", "{", "oos", ".", "writeObject", "(", "bc", ".", "getKey", "(", ")", ")", ";", "}", "}", "}", "}" ]
Necessary for the case of this bean context having a peer. The specification states that a bean context which has a peer should not serialize its children, this hook is necessary to allow the peer to serialize children. @param oos ObjectOutputStream @throws IOException
[ "Necessary", "for", "the", "case", "of", "this", "bean", "context", "having", "a", "peer", ".", "The", "specification", "states", "that", "a", "bean", "context", "which", "has", "a", "peer", "should", "not", "serialize", "its", "children", "this", "hook", "is", "necessary", "to", "allow", "the", "peer", "to", "serialize", "children", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/webcontext/ControlBeanContextSupport.java#L725-L742
146,751
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/webcontext/ControlBeanContextSupport.java
ControlBeanContextSupport.readObject
private synchronized void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { // todo: for multithreaded usage this block needs to be synchronized in.defaultReadObject(); initialize(); // only deserialize child if not using a peer if (this.equals(getPeer())) { readChildren(in); } int listenerCount = in.readInt(); for (int i = 0; i < listenerCount; i++) { addBeanContextMembershipListener((BeanContextMembershipListener) in.readObject()); } // end synchronized block }
java
private synchronized void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { // todo: for multithreaded usage this block needs to be synchronized in.defaultReadObject(); initialize(); // only deserialize child if not using a peer if (this.equals(getPeer())) { readChildren(in); } int listenerCount = in.readInt(); for (int i = 0; i < listenerCount; i++) { addBeanContextMembershipListener((BeanContextMembershipListener) in.readObject()); } // end synchronized block }
[ "private", "synchronized", "void", "readObject", "(", "ObjectInputStream", "in", ")", "throws", "IOException", ",", "ClassNotFoundException", "{", "// todo: for multithreaded usage this block needs to be synchronized", "in", ".", "defaultReadObject", "(", ")", ";", "initialize", "(", ")", ";", "// only deserialize child if not using a peer", "if", "(", "this", ".", "equals", "(", "getPeer", "(", ")", ")", ")", "{", "readChildren", "(", "in", ")", ";", "}", "int", "listenerCount", "=", "in", ".", "readInt", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "listenerCount", ";", "i", "++", ")", "{", "addBeanContextMembershipListener", "(", "(", "BeanContextMembershipListener", ")", "in", ".", "readObject", "(", ")", ")", ";", "}", "// end synchronized block", "}" ]
Deserialize this an instance of this class, including any children and BeanContextMembershipListeners which were present during serialization and were serializable. @param in ObjectInputStream to deserialize from. @throws IOException @throws ClassNotFoundException
[ "Deserialize", "this", "an", "instance", "of", "this", "class", "including", "any", "children", "and", "BeanContextMembershipListeners", "which", "were", "present", "during", "serialization", "and", "were", "serializable", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/webcontext/ControlBeanContextSupport.java#L753-L768
146,752
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/webcontext/ControlBeanContextSupport.java
ControlBeanContextSupport.readChildren
public final void readChildren(ObjectInputStream in) throws IOException, ClassNotFoundException { int childCount = in.readInt(); for (int i = 0; i < childCount; i++) { internalAdd(in.readObject(), false); } }
java
public final void readChildren(ObjectInputStream in) throws IOException, ClassNotFoundException { int childCount = in.readInt(); for (int i = 0; i < childCount; i++) { internalAdd(in.readObject(), false); } }
[ "public", "final", "void", "readChildren", "(", "ObjectInputStream", "in", ")", "throws", "IOException", ",", "ClassNotFoundException", "{", "int", "childCount", "=", "in", ".", "readInt", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "childCount", ";", "i", "++", ")", "{", "internalAdd", "(", "in", ".", "readObject", "(", ")", ",", "false", ")", ";", "}", "}" ]
This public api is necessary to allow a bean context with a peer to deserialize its children. This api is not part any standard api. @param in ObjectInputStream @throws IOException @throws ClassNotFoundException
[ "This", "public", "api", "is", "necessary", "to", "allow", "a", "bean", "context", "with", "a", "peer", "to", "deserialize", "its", "children", ".", "This", "api", "is", "not", "part", "any", "standard", "api", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/webcontext/ControlBeanContextSupport.java#L778-L783
146,753
tootedom/related
app/domain/src/main/java/org/greencheek/related/elastic/http/ahc/AHCRequestExecutor.java
AHCRequestExecutor.executeSearch
public static HttpResult executeSearch(AsyncHttpClient client, HttpMethod method, String host, String path, String searchQuery) { RequestBuilder requestBuilder = new RequestBuilder(method.name()); log.debug("Executing request against host {} with path {}",host,path); if(searchQuery!=null) { requestBuilder.setBody(searchQuery); } requestBuilder.setUrl(host + path); try { Response res = client.executeRequest(requestBuilder.build(),new AsyncCompletionHandlerBase()).get(); return new HttpResult(HttpSearchExecutionStatus.OK,res.getResponseBody()); } catch (Exception e) { Throwable cause = e.getCause(); if(cause!=null) { if(cause instanceof ConnectException) { log.error("Unable to connect to {}",host,e); return HttpResult.CONNECTION_FAILURE; } else if (cause instanceof TimeoutException) { log.error("Request timeout talking to {}",host,e); return HttpResult.REQUEST_TIMEOUT_FAILURE; } else if (cause instanceof IOException && cause.getMessage().equalsIgnoreCase("closed")) { log.warn("Unable to use client, client is closed"); return HttpResult.CLIENT_CLOSED; } else { log.error("Exception talking to {}",host,e); return new HttpResult(HttpSearchExecutionStatus.REQUEST_FAILURE,null); } } else { if (e instanceof IOException && e.getMessage().equalsIgnoreCase("closed")) { log.warn("Unable to use client, client is closed"); return HttpResult.CLIENT_CLOSED; } else { log.error("Exception talking to {}",host,e); return new HttpResult(HttpSearchExecutionStatus.REQUEST_FAILURE,null); } } } }
java
public static HttpResult executeSearch(AsyncHttpClient client, HttpMethod method, String host, String path, String searchQuery) { RequestBuilder requestBuilder = new RequestBuilder(method.name()); log.debug("Executing request against host {} with path {}",host,path); if(searchQuery!=null) { requestBuilder.setBody(searchQuery); } requestBuilder.setUrl(host + path); try { Response res = client.executeRequest(requestBuilder.build(),new AsyncCompletionHandlerBase()).get(); return new HttpResult(HttpSearchExecutionStatus.OK,res.getResponseBody()); } catch (Exception e) { Throwable cause = e.getCause(); if(cause!=null) { if(cause instanceof ConnectException) { log.error("Unable to connect to {}",host,e); return HttpResult.CONNECTION_FAILURE; } else if (cause instanceof TimeoutException) { log.error("Request timeout talking to {}",host,e); return HttpResult.REQUEST_TIMEOUT_FAILURE; } else if (cause instanceof IOException && cause.getMessage().equalsIgnoreCase("closed")) { log.warn("Unable to use client, client is closed"); return HttpResult.CLIENT_CLOSED; } else { log.error("Exception talking to {}",host,e); return new HttpResult(HttpSearchExecutionStatus.REQUEST_FAILURE,null); } } else { if (e instanceof IOException && e.getMessage().equalsIgnoreCase("closed")) { log.warn("Unable to use client, client is closed"); return HttpResult.CLIENT_CLOSED; } else { log.error("Exception talking to {}",host,e); return new HttpResult(HttpSearchExecutionStatus.REQUEST_FAILURE,null); } } } }
[ "public", "static", "HttpResult", "executeSearch", "(", "AsyncHttpClient", "client", ",", "HttpMethod", "method", ",", "String", "host", ",", "String", "path", ",", "String", "searchQuery", ")", "{", "RequestBuilder", "requestBuilder", "=", "new", "RequestBuilder", "(", "method", ".", "name", "(", ")", ")", ";", "log", ".", "debug", "(", "\"Executing request against host {} with path {}\"", ",", "host", ",", "path", ")", ";", "if", "(", "searchQuery", "!=", "null", ")", "{", "requestBuilder", ".", "setBody", "(", "searchQuery", ")", ";", "}", "requestBuilder", ".", "setUrl", "(", "host", "+", "path", ")", ";", "try", "{", "Response", "res", "=", "client", ".", "executeRequest", "(", "requestBuilder", ".", "build", "(", ")", ",", "new", "AsyncCompletionHandlerBase", "(", ")", ")", ".", "get", "(", ")", ";", "return", "new", "HttpResult", "(", "HttpSearchExecutionStatus", ".", "OK", ",", "res", ".", "getResponseBody", "(", ")", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "Throwable", "cause", "=", "e", ".", "getCause", "(", ")", ";", "if", "(", "cause", "!=", "null", ")", "{", "if", "(", "cause", "instanceof", "ConnectException", ")", "{", "log", ".", "error", "(", "\"Unable to connect to {}\"", ",", "host", ",", "e", ")", ";", "return", "HttpResult", ".", "CONNECTION_FAILURE", ";", "}", "else", "if", "(", "cause", "instanceof", "TimeoutException", ")", "{", "log", ".", "error", "(", "\"Request timeout talking to {}\"", ",", "host", ",", "e", ")", ";", "return", "HttpResult", ".", "REQUEST_TIMEOUT_FAILURE", ";", "}", "else", "if", "(", "cause", "instanceof", "IOException", "&&", "cause", ".", "getMessage", "(", ")", ".", "equalsIgnoreCase", "(", "\"closed\"", ")", ")", "{", "log", ".", "warn", "(", "\"Unable to use client, client is closed\"", ")", ";", "return", "HttpResult", ".", "CLIENT_CLOSED", ";", "}", "else", "{", "log", ".", "error", "(", "\"Exception talking to {}\"", ",", "host", ",", "e", ")", ";", "return", "new", "HttpResult", "(", "HttpSearchExecutionStatus", ".", "REQUEST_FAILURE", ",", "null", ")", ";", "}", "}", "else", "{", "if", "(", "e", "instanceof", "IOException", "&&", "e", ".", "getMessage", "(", ")", ".", "equalsIgnoreCase", "(", "\"closed\"", ")", ")", "{", "log", ".", "warn", "(", "\"Unable to use client, client is closed\"", ")", ";", "return", "HttpResult", ".", "CLIENT_CLOSED", ";", "}", "else", "{", "log", ".", "error", "(", "\"Exception talking to {}\"", ",", "host", ",", "e", ")", ";", "return", "new", "HttpResult", "(", "HttpSearchExecutionStatus", ".", "REQUEST_FAILURE", ",", "null", ")", ";", "}", "}", "}", "}" ]
Executes a blocking request. @param client @param method @param host @param path @param searchQuery @return
[ "Executes", "a", "blocking", "request", "." ]
3782dd5a839bbcdc15661d598e8b895aae8aabb7
https://github.com/tootedom/related/blob/3782dd5a839bbcdc15661d598e8b895aae8aabb7/app/domain/src/main/java/org/greencheek/related/elastic/http/ahc/AHCRequestExecutor.java#L33-L77
146,754
iig-uni-freiburg/SEWOL
ext/org/deckfour/xes/util/XRuntimeUtils.java
XRuntimeUtils.determineOS
public static OS determineOS() { if(currentOs == null) { String osString = System.getProperty("os.name").trim().toLowerCase(); if(osString.startsWith("windows")) { currentOs = OS.WIN32; } else if(osString.startsWith("mac os x")) { currentOs = OS.MACOSX; } else if(osString.startsWith("mac os")) { currentOs = OS.MACOSCLASSIC; } else if(osString.startsWith("risc os")) { currentOs = OS.RISCOS; } else if( (osString.indexOf("linux")>-1) || (osString.indexOf("debian")>-1) || (osString.indexOf("redhat")>-1) || (osString.indexOf("lindows")>-1) ) { currentOs = OS.LINUX; } else if( (osString.indexOf("freebsd")>-1) || (osString.indexOf("openbsd")>-1) || (osString.indexOf("netbsd")>-1) || (osString.indexOf("irix")>-1) || (osString.indexOf("solaris")>-1) || (osString.indexOf("sunos")>-1) || (osString.indexOf("hp/ux")>-1) || (osString.indexOf("risc ix")>-1) || (osString.indexOf("dg/ux")>-1) ) { currentOs = OS.BSD; } else if(osString.indexOf("beos")>-1) { currentOs = OS.BEOS; } else { currentOs = OS.UNKNOWN; } } return currentOs; }
java
public static OS determineOS() { if(currentOs == null) { String osString = System.getProperty("os.name").trim().toLowerCase(); if(osString.startsWith("windows")) { currentOs = OS.WIN32; } else if(osString.startsWith("mac os x")) { currentOs = OS.MACOSX; } else if(osString.startsWith("mac os")) { currentOs = OS.MACOSCLASSIC; } else if(osString.startsWith("risc os")) { currentOs = OS.RISCOS; } else if( (osString.indexOf("linux")>-1) || (osString.indexOf("debian")>-1) || (osString.indexOf("redhat")>-1) || (osString.indexOf("lindows")>-1) ) { currentOs = OS.LINUX; } else if( (osString.indexOf("freebsd")>-1) || (osString.indexOf("openbsd")>-1) || (osString.indexOf("netbsd")>-1) || (osString.indexOf("irix")>-1) || (osString.indexOf("solaris")>-1) || (osString.indexOf("sunos")>-1) || (osString.indexOf("hp/ux")>-1) || (osString.indexOf("risc ix")>-1) || (osString.indexOf("dg/ux")>-1) ) { currentOs = OS.BSD; } else if(osString.indexOf("beos")>-1) { currentOs = OS.BEOS; } else { currentOs = OS.UNKNOWN; } } return currentOs; }
[ "public", "static", "OS", "determineOS", "(", ")", "{", "if", "(", "currentOs", "==", "null", ")", "{", "String", "osString", "=", "System", ".", "getProperty", "(", "\"os.name\"", ")", ".", "trim", "(", ")", ".", "toLowerCase", "(", ")", ";", "if", "(", "osString", ".", "startsWith", "(", "\"windows\"", ")", ")", "{", "currentOs", "=", "OS", ".", "WIN32", ";", "}", "else", "if", "(", "osString", ".", "startsWith", "(", "\"mac os x\"", ")", ")", "{", "currentOs", "=", "OS", ".", "MACOSX", ";", "}", "else", "if", "(", "osString", ".", "startsWith", "(", "\"mac os\"", ")", ")", "{", "currentOs", "=", "OS", ".", "MACOSCLASSIC", ";", "}", "else", "if", "(", "osString", ".", "startsWith", "(", "\"risc os\"", ")", ")", "{", "currentOs", "=", "OS", ".", "RISCOS", ";", "}", "else", "if", "(", "(", "osString", ".", "indexOf", "(", "\"linux\"", ")", ">", "-", "1", ")", "||", "(", "osString", ".", "indexOf", "(", "\"debian\"", ")", ">", "-", "1", ")", "||", "(", "osString", ".", "indexOf", "(", "\"redhat\"", ")", ">", "-", "1", ")", "||", "(", "osString", ".", "indexOf", "(", "\"lindows\"", ")", ">", "-", "1", ")", ")", "{", "currentOs", "=", "OS", ".", "LINUX", ";", "}", "else", "if", "(", "(", "osString", ".", "indexOf", "(", "\"freebsd\"", ")", ">", "-", "1", ")", "||", "(", "osString", ".", "indexOf", "(", "\"openbsd\"", ")", ">", "-", "1", ")", "||", "(", "osString", ".", "indexOf", "(", "\"netbsd\"", ")", ">", "-", "1", ")", "||", "(", "osString", ".", "indexOf", "(", "\"irix\"", ")", ">", "-", "1", ")", "||", "(", "osString", ".", "indexOf", "(", "\"solaris\"", ")", ">", "-", "1", ")", "||", "(", "osString", ".", "indexOf", "(", "\"sunos\"", ")", ">", "-", "1", ")", "||", "(", "osString", ".", "indexOf", "(", "\"hp/ux\"", ")", ">", "-", "1", ")", "||", "(", "osString", ".", "indexOf", "(", "\"risc ix\"", ")", ">", "-", "1", ")", "||", "(", "osString", ".", "indexOf", "(", "\"dg/ux\"", ")", ">", "-", "1", ")", ")", "{", "currentOs", "=", "OS", ".", "BSD", ";", "}", "else", "if", "(", "osString", ".", "indexOf", "(", "\"beos\"", ")", ">", "-", "1", ")", "{", "currentOs", "=", "OS", ".", "BEOS", ";", "}", "else", "{", "currentOs", "=", "OS", ".", "UNKNOWN", ";", "}", "}", "return", "currentOs", ";", "}" ]
Determines the current host platform. @return Current host platform.
[ "Determines", "the", "current", "host", "platform", "." ]
e791cb07a6e62ecf837d760d58a25f32fbf6bbca
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/ext/org/deckfour/xes/util/XRuntimeUtils.java#L91-L126
146,755
iig-uni-freiburg/SEWOL
ext/org/deckfour/xes/util/XRuntimeUtils.java
XRuntimeUtils.isRunningUnix
public static boolean isRunningUnix() { OS os = XRuntimeUtils.determineOS(); if( os.equals(OS.BSD) || os.equals(OS.LINUX) || os.equals(OS.MACOSX) ) { return true; } else { return false; } }
java
public static boolean isRunningUnix() { OS os = XRuntimeUtils.determineOS(); if( os.equals(OS.BSD) || os.equals(OS.LINUX) || os.equals(OS.MACOSX) ) { return true; } else { return false; } }
[ "public", "static", "boolean", "isRunningUnix", "(", ")", "{", "OS", "os", "=", "XRuntimeUtils", ".", "determineOS", "(", ")", ";", "if", "(", "os", ".", "equals", "(", "OS", ".", "BSD", ")", "||", "os", ".", "equals", "(", "OS", ".", "LINUX", ")", "||", "os", ".", "equals", "(", "OS", ".", "MACOSX", ")", ")", "{", "return", "true", ";", "}", "else", "{", "return", "false", ";", "}", "}" ]
Checks whether the current platform is some flavor of Unix.
[ "Checks", "whether", "the", "current", "platform", "is", "some", "flavor", "of", "Unix", "." ]
e791cb07a6e62ecf837d760d58a25f32fbf6bbca
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/ext/org/deckfour/xes/util/XRuntimeUtils.java#L152-L161
146,756
iig-uni-freiburg/SEWOL
ext/org/deckfour/xes/util/XRuntimeUtils.java
XRuntimeUtils.getSupportFolder
public static String getSupportFolder() { String homedir = System.getProperty("user.home"); String dirName = "OpenXES"; if(isRunningWindows()) { // any windows flavor (new File(homedir + "\\" + dirName)).mkdirs(); // create directories if necessary return homedir + "\\" + dirName + "\\"; } else if(isRunningMacOsX()) { // hey, it's a mac! (new File(homedir + "/Library/Application Support/" + dirName)).mkdirs(); return homedir + "/Library/Application Support/" + dirName + "/"; } else { // most likely Linux or any other *NIX (new File(homedir + "/." + dirName)).mkdirs(); // create directories if necessary return homedir + "/." + dirName + "/"; } }
java
public static String getSupportFolder() { String homedir = System.getProperty("user.home"); String dirName = "OpenXES"; if(isRunningWindows()) { // any windows flavor (new File(homedir + "\\" + dirName)).mkdirs(); // create directories if necessary return homedir + "\\" + dirName + "\\"; } else if(isRunningMacOsX()) { // hey, it's a mac! (new File(homedir + "/Library/Application Support/" + dirName)).mkdirs(); return homedir + "/Library/Application Support/" + dirName + "/"; } else { // most likely Linux or any other *NIX (new File(homedir + "/." + dirName)).mkdirs(); // create directories if necessary return homedir + "/." + dirName + "/"; } }
[ "public", "static", "String", "getSupportFolder", "(", ")", "{", "String", "homedir", "=", "System", ".", "getProperty", "(", "\"user.home\"", ")", ";", "String", "dirName", "=", "\"OpenXES\"", ";", "if", "(", "isRunningWindows", "(", ")", ")", "{", "// any windows flavor", "(", "new", "File", "(", "homedir", "+", "\"\\\\\"", "+", "dirName", ")", ")", ".", "mkdirs", "(", ")", ";", "// create directories if necessary", "return", "homedir", "+", "\"\\\\\"", "+", "dirName", "+", "\"\\\\\"", ";", "}", "else", "if", "(", "isRunningMacOsX", "(", ")", ")", "{", "// hey, it's a mac!", "(", "new", "File", "(", "homedir", "+", "\"/Library/Application Support/\"", "+", "dirName", ")", ")", ".", "mkdirs", "(", ")", ";", "return", "homedir", "+", "\"/Library/Application Support/\"", "+", "dirName", "+", "\"/\"", ";", "}", "else", "{", "// most likely Linux or any other *NIX", "(", "new", "File", "(", "homedir", "+", "\"/.\"", "+", "dirName", ")", ")", ".", "mkdirs", "(", ")", ";", "// create directories if necessary", "return", "homedir", "+", "\"/.\"", "+", "dirName", "+", "\"/\"", ";", "}", "}" ]
Retrieves the path of the platform-dependent OpenXES support folder.
[ "Retrieves", "the", "path", "of", "the", "platform", "-", "dependent", "OpenXES", "support", "folder", "." ]
e791cb07a6e62ecf837d760d58a25f32fbf6bbca
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/ext/org/deckfour/xes/util/XRuntimeUtils.java#L167-L183
146,757
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowRequestProcessor.java
PageFlowRequestProcessor.processActionOverride
protected boolean processActionOverride( HttpServletRequest request, HttpServletResponse response ) throws IOException, ServletException { // Only make this check if this is an initial (non-forwarded) request. // // TODO: performance? // PageFlowRequestWrapper wrapper = PageFlowRequestWrapper.get( request ); if ( ! wrapper.isForwardedByButton() && ! wrapper.isForwardedRequest() ) { // // First, since we need access to request parameters here, process a multipart request // if that's what we have. This puts the parameters (each in a MIME part) behind an // interface that makes them look like normal request parameters. // HttpServletRequest multipartAwareRequest = processMultipart( request ); for ( Enumeration e = multipartAwareRequest.getParameterNames(); e.hasMoreElements(); ) { String paramName = ( String ) e.nextElement(); if ( paramName.startsWith( ACTION_OVERRIDE_PARAM_PREFIX ) ) { String actionPath = paramName.substring( ACTION_OVERRIDE_PARAM_PREFIX_LEN ); ServletContext servletContext = getServletContext(); String qualifiedAction = InternalUtils.qualifyAction( servletContext,actionPath ); actionPath = InternalUtils.createActionPath(request, qualifiedAction ); if ( LOG.isDebugEnabled() ) { LOG.debug( "A request parameter overrode the action. Forwarding to: " + actionPath ); } wrapper.setForwardedByButton( true ); doForward( actionPath, request, response ); return true; } } } return false; }
java
protected boolean processActionOverride( HttpServletRequest request, HttpServletResponse response ) throws IOException, ServletException { // Only make this check if this is an initial (non-forwarded) request. // // TODO: performance? // PageFlowRequestWrapper wrapper = PageFlowRequestWrapper.get( request ); if ( ! wrapper.isForwardedByButton() && ! wrapper.isForwardedRequest() ) { // // First, since we need access to request parameters here, process a multipart request // if that's what we have. This puts the parameters (each in a MIME part) behind an // interface that makes them look like normal request parameters. // HttpServletRequest multipartAwareRequest = processMultipart( request ); for ( Enumeration e = multipartAwareRequest.getParameterNames(); e.hasMoreElements(); ) { String paramName = ( String ) e.nextElement(); if ( paramName.startsWith( ACTION_OVERRIDE_PARAM_PREFIX ) ) { String actionPath = paramName.substring( ACTION_OVERRIDE_PARAM_PREFIX_LEN ); ServletContext servletContext = getServletContext(); String qualifiedAction = InternalUtils.qualifyAction( servletContext,actionPath ); actionPath = InternalUtils.createActionPath(request, qualifiedAction ); if ( LOG.isDebugEnabled() ) { LOG.debug( "A request parameter overrode the action. Forwarding to: " + actionPath ); } wrapper.setForwardedByButton( true ); doForward( actionPath, request, response ); return true; } } } return false; }
[ "protected", "boolean", "processActionOverride", "(", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ")", "throws", "IOException", ",", "ServletException", "{", "// Only make this check if this is an initial (non-forwarded) request.", "//", "// TODO: performance?", "//", "PageFlowRequestWrapper", "wrapper", "=", "PageFlowRequestWrapper", ".", "get", "(", "request", ")", ";", "if", "(", "!", "wrapper", ".", "isForwardedByButton", "(", ")", "&&", "!", "wrapper", ".", "isForwardedRequest", "(", ")", ")", "{", "//", "// First, since we need access to request parameters here, process a multipart request", "// if that's what we have. This puts the parameters (each in a MIME part) behind an", "// interface that makes them look like normal request parameters.", "//", "HttpServletRequest", "multipartAwareRequest", "=", "processMultipart", "(", "request", ")", ";", "for", "(", "Enumeration", "e", "=", "multipartAwareRequest", ".", "getParameterNames", "(", ")", ";", "e", ".", "hasMoreElements", "(", ")", ";", ")", "{", "String", "paramName", "=", "(", "String", ")", "e", ".", "nextElement", "(", ")", ";", "if", "(", "paramName", ".", "startsWith", "(", "ACTION_OVERRIDE_PARAM_PREFIX", ")", ")", "{", "String", "actionPath", "=", "paramName", ".", "substring", "(", "ACTION_OVERRIDE_PARAM_PREFIX_LEN", ")", ";", "ServletContext", "servletContext", "=", "getServletContext", "(", ")", ";", "String", "qualifiedAction", "=", "InternalUtils", ".", "qualifyAction", "(", "servletContext", ",", "actionPath", ")", ";", "actionPath", "=", "InternalUtils", ".", "createActionPath", "(", "request", ",", "qualifiedAction", ")", ";", "if", "(", "LOG", ".", "isDebugEnabled", "(", ")", ")", "{", "LOG", ".", "debug", "(", "\"A request parameter overrode the action. Forwarding to: \"", "+", "actionPath", ")", ";", "}", "wrapper", ".", "setForwardedByButton", "(", "true", ")", ";", "doForward", "(", "actionPath", ",", "request", ",", "response", ")", ";", "return", "true", ";", "}", "}", "}", "return", "false", ";", "}" ]
The requested action can be overridden by a request parameter. In this case, we parse the action from the request parameter and forward to a URI constructed from it. @param request the current HttpServletRequest @param response the current HttpServletResponse @return <code>true</code> if the action was overridden by a request parameter, in which case the request was forwarded. @throws IOException @throws ServletException
[ "The", "requested", "action", "can", "be", "overridden", "by", "a", "request", "parameter", ".", "In", "this", "case", "we", "parse", "the", "action", "from", "the", "request", "parameter", "and", "forward", "to", "a", "URI", "constructed", "from", "it", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowRequestProcessor.java#L344-L386
146,758
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowRequestProcessor.java
PageFlowRequestProcessor.processPageFlowRequest
protected boolean processPageFlowRequest( HttpServletRequest request, HttpServletResponse response, String uri ) throws IOException, ServletException { // // Forward requests for *.jpf to the "begin" action within the appropriate Struts module. // if ( FileUtils.osSensitiveEndsWith( uri, PageFlowConstants.PAGEFLOW_EXTENSION ) ) { // // Make sure the current module config matches the request URI. If not, this could be an // EAR where the struts-config.xml wasn't included because of a compilation error. // String modulePath = PageFlowUtils.getModulePath( request ); if ( ! moduleConfig.getPrefix().equals( modulePath ) ) { if ( LOG.isErrorEnabled() ) { InternalStringBuilder msg = new InternalStringBuilder( "No module configuration registered for " ); msg.append( uri ).append( " (module path " ).append( modulePath ).append( ")." ); LOG.error( msg.toString() ); } if ( modulePath.length() == 0 ) modulePath = "/"; InternalUtils.sendDevTimeError( "PageFlow_NoModuleConf", null, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, request, response, getServletContext(), new Object[]{ uri, modulePath } ); return true; } // Make sure that the requested pageflow matches the pageflow for the directory. ActionMapping beginMapping = getBeginMapping(); if ( beginMapping != null ) { String desiredType = beginMapping.getParameter(); desiredType = desiredType.substring( desiredType.lastIndexOf( '.' ) + 1 ) + PAGEFLOW_EXTENSION; String requestedType = InternalUtils.getDecodedServletPath( request ); requestedType = requestedType.substring( requestedType.lastIndexOf( '/' ) + 1 ); if ( ! requestedType.equals( desiredType ) ) { if ( LOG.isDebugEnabled() ) { LOG.debug( "Wrong .jpf requested for this directory: got " + requestedType + ", expected " + desiredType ); } if ( LOG.isErrorEnabled() ) { InternalStringBuilder msg = new InternalStringBuilder( "Wrong .jpf requested for this directory: got " ); msg.append( requestedType ).append( ", expected " ).append( desiredType ).append( '.' ); LOG.error( msg.toString() ); } InternalUtils.sendDevTimeError( "PageFlow_WrongPath", null, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, request, response, getServletContext(), new Object[]{ requestedType, desiredType } ); return true; } } uri = PageFlowUtils.getBeginActionURI( uri ); if ( LOG.isDebugEnabled() ) { LOG.debug( "Got request for " + request.getRequestURI() + ", forwarding to " + uri ); } doForward( uri, request, response ); return true; } return false; }
java
protected boolean processPageFlowRequest( HttpServletRequest request, HttpServletResponse response, String uri ) throws IOException, ServletException { // // Forward requests for *.jpf to the "begin" action within the appropriate Struts module. // if ( FileUtils.osSensitiveEndsWith( uri, PageFlowConstants.PAGEFLOW_EXTENSION ) ) { // // Make sure the current module config matches the request URI. If not, this could be an // EAR where the struts-config.xml wasn't included because of a compilation error. // String modulePath = PageFlowUtils.getModulePath( request ); if ( ! moduleConfig.getPrefix().equals( modulePath ) ) { if ( LOG.isErrorEnabled() ) { InternalStringBuilder msg = new InternalStringBuilder( "No module configuration registered for " ); msg.append( uri ).append( " (module path " ).append( modulePath ).append( ")." ); LOG.error( msg.toString() ); } if ( modulePath.length() == 0 ) modulePath = "/"; InternalUtils.sendDevTimeError( "PageFlow_NoModuleConf", null, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, request, response, getServletContext(), new Object[]{ uri, modulePath } ); return true; } // Make sure that the requested pageflow matches the pageflow for the directory. ActionMapping beginMapping = getBeginMapping(); if ( beginMapping != null ) { String desiredType = beginMapping.getParameter(); desiredType = desiredType.substring( desiredType.lastIndexOf( '.' ) + 1 ) + PAGEFLOW_EXTENSION; String requestedType = InternalUtils.getDecodedServletPath( request ); requestedType = requestedType.substring( requestedType.lastIndexOf( '/' ) + 1 ); if ( ! requestedType.equals( desiredType ) ) { if ( LOG.isDebugEnabled() ) { LOG.debug( "Wrong .jpf requested for this directory: got " + requestedType + ", expected " + desiredType ); } if ( LOG.isErrorEnabled() ) { InternalStringBuilder msg = new InternalStringBuilder( "Wrong .jpf requested for this directory: got " ); msg.append( requestedType ).append( ", expected " ).append( desiredType ).append( '.' ); LOG.error( msg.toString() ); } InternalUtils.sendDevTimeError( "PageFlow_WrongPath", null, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, request, response, getServletContext(), new Object[]{ requestedType, desiredType } ); return true; } } uri = PageFlowUtils.getBeginActionURI( uri ); if ( LOG.isDebugEnabled() ) { LOG.debug( "Got request for " + request.getRequestURI() + ", forwarding to " + uri ); } doForward( uri, request, response ); return true; } return false; }
[ "protected", "boolean", "processPageFlowRequest", "(", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ",", "String", "uri", ")", "throws", "IOException", ",", "ServletException", "{", "//", "// Forward requests for *.jpf to the \"begin\" action within the appropriate Struts module.", "//", "if", "(", "FileUtils", ".", "osSensitiveEndsWith", "(", "uri", ",", "PageFlowConstants", ".", "PAGEFLOW_EXTENSION", ")", ")", "{", "//", "// Make sure the current module config matches the request URI. If not, this could be an", "// EAR where the struts-config.xml wasn't included because of a compilation error.", "//", "String", "modulePath", "=", "PageFlowUtils", ".", "getModulePath", "(", "request", ")", ";", "if", "(", "!", "moduleConfig", ".", "getPrefix", "(", ")", ".", "equals", "(", "modulePath", ")", ")", "{", "if", "(", "LOG", ".", "isErrorEnabled", "(", ")", ")", "{", "InternalStringBuilder", "msg", "=", "new", "InternalStringBuilder", "(", "\"No module configuration registered for \"", ")", ";", "msg", ".", "append", "(", "uri", ")", ".", "append", "(", "\" (module path \"", ")", ".", "append", "(", "modulePath", ")", ".", "append", "(", "\").\"", ")", ";", "LOG", ".", "error", "(", "msg", ".", "toString", "(", ")", ")", ";", "}", "if", "(", "modulePath", ".", "length", "(", ")", "==", "0", ")", "modulePath", "=", "\"/\"", ";", "InternalUtils", ".", "sendDevTimeError", "(", "\"PageFlow_NoModuleConf\"", ",", "null", ",", "HttpServletResponse", ".", "SC_INTERNAL_SERVER_ERROR", ",", "request", ",", "response", ",", "getServletContext", "(", ")", ",", "new", "Object", "[", "]", "{", "uri", ",", "modulePath", "}", ")", ";", "return", "true", ";", "}", "// Make sure that the requested pageflow matches the pageflow for the directory.", "ActionMapping", "beginMapping", "=", "getBeginMapping", "(", ")", ";", "if", "(", "beginMapping", "!=", "null", ")", "{", "String", "desiredType", "=", "beginMapping", ".", "getParameter", "(", ")", ";", "desiredType", "=", "desiredType", ".", "substring", "(", "desiredType", ".", "lastIndexOf", "(", "'", "'", ")", "+", "1", ")", "+", "PAGEFLOW_EXTENSION", ";", "String", "requestedType", "=", "InternalUtils", ".", "getDecodedServletPath", "(", "request", ")", ";", "requestedType", "=", "requestedType", ".", "substring", "(", "requestedType", ".", "lastIndexOf", "(", "'", "'", ")", "+", "1", ")", ";", "if", "(", "!", "requestedType", ".", "equals", "(", "desiredType", ")", ")", "{", "if", "(", "LOG", ".", "isDebugEnabled", "(", ")", ")", "{", "LOG", ".", "debug", "(", "\"Wrong .jpf requested for this directory: got \"", "+", "requestedType", "+", "\", expected \"", "+", "desiredType", ")", ";", "}", "if", "(", "LOG", ".", "isErrorEnabled", "(", ")", ")", "{", "InternalStringBuilder", "msg", "=", "new", "InternalStringBuilder", "(", "\"Wrong .jpf requested for this directory: got \"", ")", ";", "msg", ".", "append", "(", "requestedType", ")", ".", "append", "(", "\", expected \"", ")", ".", "append", "(", "desiredType", ")", ".", "append", "(", "'", "'", ")", ";", "LOG", ".", "error", "(", "msg", ".", "toString", "(", ")", ")", ";", "}", "InternalUtils", ".", "sendDevTimeError", "(", "\"PageFlow_WrongPath\"", ",", "null", ",", "HttpServletResponse", ".", "SC_INTERNAL_SERVER_ERROR", ",", "request", ",", "response", ",", "getServletContext", "(", ")", ",", "new", "Object", "[", "]", "{", "requestedType", ",", "desiredType", "}", ")", ";", "return", "true", ";", "}", "}", "uri", "=", "PageFlowUtils", ".", "getBeginActionURI", "(", "uri", ")", ";", "if", "(", "LOG", ".", "isDebugEnabled", "(", ")", ")", "{", "LOG", ".", "debug", "(", "\"Got request for \"", "+", "request", ".", "getRequestURI", "(", ")", "+", "\", forwarding to \"", "+", "uri", ")", ";", "}", "doForward", "(", "uri", ",", "request", ",", "response", ")", ";", "return", "true", ";", "}", "return", "false", ";", "}" ]
Process any direct request for a page flow by forwarding to its "begin" action. @param request the current HttpServletRequest @param response the current HttpServletResponse @param uri the decoded request URI @return <code>true</code> if the request was for a page flow, in which case it was forwarded. @throws IOException @throws ServletException
[ "Process", "any", "direct", "request", "for", "a", "page", "flow", "by", "forwarding", "to", "its", "begin", "action", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowRequestProcessor.java#L673-L746
146,759
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowRequestProcessor.java
PageFlowRequestProcessor.processMultipart
protected HttpServletRequest processMultipart( HttpServletRequest request ) { if ( ! "POST".equalsIgnoreCase( request.getMethod() ) ) return request; String contentType = request.getContentType(); if ( contentType != null && contentType.startsWith( "multipart/form-data" ) ) { PageFlowRequestWrapper pageFlowRequestWrapper = PageFlowRequestWrapper.get( request ); // // We may have already gotten a multipart wrapper during process(). If so, use that. // MultipartRequestWrapper cachedWrapper = pageFlowRequestWrapper.getMultipartRequestWrapper(); if ( cachedWrapper != null && cachedWrapper.getRequest() == request ) return cachedWrapper; try { // // First, pre-handle the multipart request. This parses the stream and caches a single // MultipartRequestHandler in the outer request, so we can create new wrappers around it at will. // MultipartRequestUtils.preHandleMultipartRequest( request ); } catch ( ServletException e ) { LOG.error( "Could not parse multipart request.", e.getRootCause() ); return request; } MultipartRequestWrapper ret = new RehydratedMultipartRequestWrapper( request ); pageFlowRequestWrapper.setMultipartRequestWrapper( ret ); return ret; } else { return request; } }
java
protected HttpServletRequest processMultipart( HttpServletRequest request ) { if ( ! "POST".equalsIgnoreCase( request.getMethod() ) ) return request; String contentType = request.getContentType(); if ( contentType != null && contentType.startsWith( "multipart/form-data" ) ) { PageFlowRequestWrapper pageFlowRequestWrapper = PageFlowRequestWrapper.get( request ); // // We may have already gotten a multipart wrapper during process(). If so, use that. // MultipartRequestWrapper cachedWrapper = pageFlowRequestWrapper.getMultipartRequestWrapper(); if ( cachedWrapper != null && cachedWrapper.getRequest() == request ) return cachedWrapper; try { // // First, pre-handle the multipart request. This parses the stream and caches a single // MultipartRequestHandler in the outer request, so we can create new wrappers around it at will. // MultipartRequestUtils.preHandleMultipartRequest( request ); } catch ( ServletException e ) { LOG.error( "Could not parse multipart request.", e.getRootCause() ); return request; } MultipartRequestWrapper ret = new RehydratedMultipartRequestWrapper( request ); pageFlowRequestWrapper.setMultipartRequestWrapper( ret ); return ret; } else { return request; } }
[ "protected", "HttpServletRequest", "processMultipart", "(", "HttpServletRequest", "request", ")", "{", "if", "(", "!", "\"POST\"", ".", "equalsIgnoreCase", "(", "request", ".", "getMethod", "(", ")", ")", ")", "return", "request", ";", "String", "contentType", "=", "request", ".", "getContentType", "(", ")", ";", "if", "(", "contentType", "!=", "null", "&&", "contentType", ".", "startsWith", "(", "\"multipart/form-data\"", ")", ")", "{", "PageFlowRequestWrapper", "pageFlowRequestWrapper", "=", "PageFlowRequestWrapper", ".", "get", "(", "request", ")", ";", "//", "// We may have already gotten a multipart wrapper during process(). If so, use that.", "//", "MultipartRequestWrapper", "cachedWrapper", "=", "pageFlowRequestWrapper", ".", "getMultipartRequestWrapper", "(", ")", ";", "if", "(", "cachedWrapper", "!=", "null", "&&", "cachedWrapper", ".", "getRequest", "(", ")", "==", "request", ")", "return", "cachedWrapper", ";", "try", "{", "//", "// First, pre-handle the multipart request. This parses the stream and caches a single", "// MultipartRequestHandler in the outer request, so we can create new wrappers around it at will.", "//", "MultipartRequestUtils", ".", "preHandleMultipartRequest", "(", "request", ")", ";", "}", "catch", "(", "ServletException", "e", ")", "{", "LOG", ".", "error", "(", "\"Could not parse multipart request.\"", ",", "e", ".", "getRootCause", "(", ")", ")", ";", "return", "request", ";", "}", "MultipartRequestWrapper", "ret", "=", "new", "RehydratedMultipartRequestWrapper", "(", "request", ")", ";", "pageFlowRequestWrapper", ".", "setMultipartRequestWrapper", "(", "ret", ")", ";", "return", "ret", ";", "}", "else", "{", "return", "request", ";", "}", "}" ]
If this is a multipart request, wrap it with a special wrapper. Otherwise, return the request unchanged. @param request The HttpServletRequest we are processing
[ "If", "this", "is", "a", "multipart", "request", "wrap", "it", "with", "a", "special", "wrapper", ".", "Otherwise", "return", "the", "request", "unchanged", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowRequestProcessor.java#L897-L936
146,760
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowRequestProcessor.java
PageFlowRequestProcessor.initDefinitionsMapping
protected void initDefinitionsMapping() throws ServletException { definitionsFactory = null; TilesUtilImpl tilesUtil = TilesUtil.getTilesUtil(); if ( tilesUtil instanceof TilesUtilStrutsImpl ) { // Retrieve and set factory for this modules definitionsFactory = ( ( TilesUtilStrutsImpl ) tilesUtil ).getDefinitionsFactory( getServletContext(), moduleConfig ); if ( definitionsFactory == null && log.isDebugEnabled() ) { log.debug( "Definition Factory not found for module: '" + moduleConfig.getPrefix() ); } } }
java
protected void initDefinitionsMapping() throws ServletException { definitionsFactory = null; TilesUtilImpl tilesUtil = TilesUtil.getTilesUtil(); if ( tilesUtil instanceof TilesUtilStrutsImpl ) { // Retrieve and set factory for this modules definitionsFactory = ( ( TilesUtilStrutsImpl ) tilesUtil ).getDefinitionsFactory( getServletContext(), moduleConfig ); if ( definitionsFactory == null && log.isDebugEnabled() ) { log.debug( "Definition Factory not found for module: '" + moduleConfig.getPrefix() ); } } }
[ "protected", "void", "initDefinitionsMapping", "(", ")", "throws", "ServletException", "{", "definitionsFactory", "=", "null", ";", "TilesUtilImpl", "tilesUtil", "=", "TilesUtil", ".", "getTilesUtil", "(", ")", ";", "if", "(", "tilesUtil", "instanceof", "TilesUtilStrutsImpl", ")", "{", "// Retrieve and set factory for this modules", "definitionsFactory", "=", "(", "(", "TilesUtilStrutsImpl", ")", "tilesUtil", ")", ".", "getDefinitionsFactory", "(", "getServletContext", "(", ")", ",", "moduleConfig", ")", ";", "if", "(", "definitionsFactory", "==", "null", "&&", "log", ".", "isDebugEnabled", "(", ")", ")", "{", "log", ".", "debug", "(", "\"Definition Factory not found for module: '\"", "+", "moduleConfig", ".", "getPrefix", "(", ")", ")", ";", "}", "}", "}" ]
Read component instance mapping configuration file. This is where we read files properties.
[ "Read", "component", "instance", "mapping", "configuration", "file", ".", "This", "is", "where", "we", "read", "files", "properties", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowRequestProcessor.java#L1191-L1208
146,761
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowRequestProcessor.java
PageFlowRequestProcessor.processNoCache
protected void processNoCache( HttpServletRequest request, HttpServletResponse response ) { // // Set the no-cache headers if: // 1) the module is configured for it, or // 2) netui-config.xml has an "always" value for <pageflow-config><prevent-cache>, or // 3) netui-config.xml has an "inDevMode" value for <pageflow-config><prevent-cache>, and we're not in // production mode. // boolean noCache = moduleConfig.getControllerConfig().getNocache(); if ( ! noCache ) { PageFlowConfig pfConfig = ConfigUtil.getConfig().getPageFlowConfig(); if ( pfConfig != null ) { PreventCache preventCache = pfConfig.getPreventCache(); if ( preventCache != null ) { switch ( preventCache.getValue() ) { case PreventCache.INT_ALWAYS: noCache = true; break; case PreventCache.INT_IN_DEV_MODE: noCache = ! _servletContainerAdapter.isInProductionMode(); break; } } } } if ( noCache ) { // // The call to PageFlowPageFilter.preventCache() will cause caching to be prevented // even when we end up forwarding to a page. Normally, no-cache headers are lost // when a server forward occurs. // ServletUtils.preventCache( response ); PageFlowUtils.setPreventCache( request ); } }
java
protected void processNoCache( HttpServletRequest request, HttpServletResponse response ) { // // Set the no-cache headers if: // 1) the module is configured for it, or // 2) netui-config.xml has an "always" value for <pageflow-config><prevent-cache>, or // 3) netui-config.xml has an "inDevMode" value for <pageflow-config><prevent-cache>, and we're not in // production mode. // boolean noCache = moduleConfig.getControllerConfig().getNocache(); if ( ! noCache ) { PageFlowConfig pfConfig = ConfigUtil.getConfig().getPageFlowConfig(); if ( pfConfig != null ) { PreventCache preventCache = pfConfig.getPreventCache(); if ( preventCache != null ) { switch ( preventCache.getValue() ) { case PreventCache.INT_ALWAYS: noCache = true; break; case PreventCache.INT_IN_DEV_MODE: noCache = ! _servletContainerAdapter.isInProductionMode(); break; } } } } if ( noCache ) { // // The call to PageFlowPageFilter.preventCache() will cause caching to be prevented // even when we end up forwarding to a page. Normally, no-cache headers are lost // when a server forward occurs. // ServletUtils.preventCache( response ); PageFlowUtils.setPreventCache( request ); } }
[ "protected", "void", "processNoCache", "(", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ")", "{", "//", "// Set the no-cache headers if:", "// 1) the module is configured for it, or", "// 2) netui-config.xml has an \"always\" value for <pageflow-config><prevent-cache>, or", "// 3) netui-config.xml has an \"inDevMode\" value for <pageflow-config><prevent-cache>, and we're not in", "// production mode.", "//", "boolean", "noCache", "=", "moduleConfig", ".", "getControllerConfig", "(", ")", ".", "getNocache", "(", ")", ";", "if", "(", "!", "noCache", ")", "{", "PageFlowConfig", "pfConfig", "=", "ConfigUtil", ".", "getConfig", "(", ")", ".", "getPageFlowConfig", "(", ")", ";", "if", "(", "pfConfig", "!=", "null", ")", "{", "PreventCache", "preventCache", "=", "pfConfig", ".", "getPreventCache", "(", ")", ";", "if", "(", "preventCache", "!=", "null", ")", "{", "switch", "(", "preventCache", ".", "getValue", "(", ")", ")", "{", "case", "PreventCache", ".", "INT_ALWAYS", ":", "noCache", "=", "true", ";", "break", ";", "case", "PreventCache", ".", "INT_IN_DEV_MODE", ":", "noCache", "=", "!", "_servletContainerAdapter", ".", "isInProductionMode", "(", ")", ";", "break", ";", "}", "}", "}", "}", "if", "(", "noCache", ")", "{", "//", "// The call to PageFlowPageFilter.preventCache() will cause caching to be prevented", "// even when we end up forwarding to a page. Normally, no-cache headers are lost", "// when a server forward occurs.", "//", "ServletUtils", ".", "preventCache", "(", "response", ")", ";", "PageFlowUtils", ".", "setPreventCache", "(", "request", ")", ";", "}", "}" ]
Set the no-cache headers. This overrides the base Struts behavior to prevent caching even for the pages.
[ "Set", "the", "no", "-", "cache", "headers", ".", "This", "overrides", "the", "base", "Struts", "behavior", "to", "prevent", "caching", "even", "for", "the", "pages", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowRequestProcessor.java#L1976-L2020
146,762
iig-uni-freiburg/SEWOL
ext/org/deckfour/spex/SXDocument.java
SXDocument.prepareToAddChildNode
protected void prepareToAddChildNode() throws IOException { // reject modification of already closed document if(isOpen==false) { throw new IOException("Attempting to write to a closed document!"); } // close previous tag, if applicable if(lastChildNode!=null) { lastChildNode.close(); lastChildNode = null; } writer.write("\n"); }
java
protected void prepareToAddChildNode() throws IOException { // reject modification of already closed document if(isOpen==false) { throw new IOException("Attempting to write to a closed document!"); } // close previous tag, if applicable if(lastChildNode!=null) { lastChildNode.close(); lastChildNode = null; } writer.write("\n"); }
[ "protected", "void", "prepareToAddChildNode", "(", ")", "throws", "IOException", "{", "// reject modification of already closed document", "if", "(", "isOpen", "==", "false", ")", "{", "throw", "new", "IOException", "(", "\"Attempting to write to a closed document!\"", ")", ";", "}", "// close previous tag, if applicable", "if", "(", "lastChildNode", "!=", "null", ")", "{", "lastChildNode", ".", "close", "(", ")", ";", "lastChildNode", "=", "null", ";", "}", "writer", ".", "write", "(", "\"\\n\"", ")", ";", "}" ]
Internal abstraction method; prepares the document for inserting a new child tag of any type.
[ "Internal", "abstraction", "method", ";", "prepares", "the", "document", "for", "inserting", "a", "new", "child", "tag", "of", "any", "type", "." ]
e791cb07a6e62ecf837d760d58a25f32fbf6bbca
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/ext/org/deckfour/spex/SXDocument.java#L138-L149
146,763
jboss/jboss-jaxrpc-api_spec
src/main/java/javax/xml/rpc/ServiceFactory.java
ServiceFactory.newInstance
public static ServiceFactory newInstance() throws ServiceException { // Create the factory singleton if needed if (factory == null) { PrivilegedAction action = new PropertyAccessAction(SERVICEFACTORY_PROPERTY, DEFAULT_SERVICE_FACTORY); String factoryName = (String)AccessController.doPrivileged(action); ClassLoader loader = Thread.currentThread().getContextClassLoader(); try { try { Class factoryClass = loader.loadClass(factoryName); factory = (ServiceFactory)factoryClass.newInstance(); } catch (ClassNotFoundException e) { // Throw the exception if the user asked for a specific factory if (factoryName.equals(DEFAULT_SERVICE_FACTORY) == false) throw e; for (int i = 0; i < alternativeFactories.length; i++) { factoryName = alternativeFactories[i]; try { Class factoryClass = loader.loadClass(factoryName); return (ServiceFactory)factoryClass.newInstance(); } catch (ClassNotFoundException e1) { log.severe("Cannot load factory: " + factoryName); } } } } catch (Throwable e) { throw new ServiceException("Failed to create factory: " + factoryName, e); } } if (factory == null) throw new ServiceException("Cannot find ServiceFactory implementation"); return factory; }
java
public static ServiceFactory newInstance() throws ServiceException { // Create the factory singleton if needed if (factory == null) { PrivilegedAction action = new PropertyAccessAction(SERVICEFACTORY_PROPERTY, DEFAULT_SERVICE_FACTORY); String factoryName = (String)AccessController.doPrivileged(action); ClassLoader loader = Thread.currentThread().getContextClassLoader(); try { try { Class factoryClass = loader.loadClass(factoryName); factory = (ServiceFactory)factoryClass.newInstance(); } catch (ClassNotFoundException e) { // Throw the exception if the user asked for a specific factory if (factoryName.equals(DEFAULT_SERVICE_FACTORY) == false) throw e; for (int i = 0; i < alternativeFactories.length; i++) { factoryName = alternativeFactories[i]; try { Class factoryClass = loader.loadClass(factoryName); return (ServiceFactory)factoryClass.newInstance(); } catch (ClassNotFoundException e1) { log.severe("Cannot load factory: " + factoryName); } } } } catch (Throwable e) { throw new ServiceException("Failed to create factory: " + factoryName, e); } } if (factory == null) throw new ServiceException("Cannot find ServiceFactory implementation"); return factory; }
[ "public", "static", "ServiceFactory", "newInstance", "(", ")", "throws", "ServiceException", "{", "// Create the factory singleton if needed", "if", "(", "factory", "==", "null", ")", "{", "PrivilegedAction", "action", "=", "new", "PropertyAccessAction", "(", "SERVICEFACTORY_PROPERTY", ",", "DEFAULT_SERVICE_FACTORY", ")", ";", "String", "factoryName", "=", "(", "String", ")", "AccessController", ".", "doPrivileged", "(", "action", ")", ";", "ClassLoader", "loader", "=", "Thread", ".", "currentThread", "(", ")", ".", "getContextClassLoader", "(", ")", ";", "try", "{", "try", "{", "Class", "factoryClass", "=", "loader", ".", "loadClass", "(", "factoryName", ")", ";", "factory", "=", "(", "ServiceFactory", ")", "factoryClass", ".", "newInstance", "(", ")", ";", "}", "catch", "(", "ClassNotFoundException", "e", ")", "{", "// Throw the exception if the user asked for a specific factory", "if", "(", "factoryName", ".", "equals", "(", "DEFAULT_SERVICE_FACTORY", ")", "==", "false", ")", "throw", "e", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "alternativeFactories", ".", "length", ";", "i", "++", ")", "{", "factoryName", "=", "alternativeFactories", "[", "i", "]", ";", "try", "{", "Class", "factoryClass", "=", "loader", ".", "loadClass", "(", "factoryName", ")", ";", "return", "(", "ServiceFactory", ")", "factoryClass", ".", "newInstance", "(", ")", ";", "}", "catch", "(", "ClassNotFoundException", "e1", ")", "{", "log", ".", "severe", "(", "\"Cannot load factory: \"", "+", "factoryName", ")", ";", "}", "}", "}", "}", "catch", "(", "Throwable", "e", ")", "{", "throw", "new", "ServiceException", "(", "\"Failed to create factory: \"", "+", "factoryName", ",", "e", ")", ";", "}", "}", "if", "(", "factory", "==", "null", ")", "throw", "new", "ServiceException", "(", "\"Cannot find ServiceFactory implementation\"", ")", ";", "return", "factory", ";", "}" ]
Gets an instance of the ServiceFactory Only one copy of a factory exists and is returned to the application each time this method is called. The implementation class to be used can be overridden by setting the javax.xml.rpc.ServiceFactory system property. @return The ServiceFactory singleton @throws ServiceException on failure to instantiate the ServiceFactory impl
[ "Gets", "an", "instance", "of", "the", "ServiceFactory", "Only", "one", "copy", "of", "a", "factory", "exists", "and", "is", "returned", "to", "the", "application", "each", "time", "this", "method", "is", "called", "." ]
1895e8068bc3ddd505aab3f5c13aaedab00bbf89
https://github.com/jboss/jboss-jaxrpc-api_spec/blob/1895e8068bc3ddd505aab3f5c13aaedab00bbf89/src/main/java/javax/xml/rpc/ServiceFactory.java#L50-L97
146,764
jboss/jboss-jaxrpc-api_spec
src/main/java/javax/xml/rpc/handler/HandlerInfo.java
HandlerInfo.setHandlerConfig
public void setHandlerConfig(Map config) { configMap.clear(); if (config != null) configMap.putAll(config); }
java
public void setHandlerConfig(Map config) { configMap.clear(); if (config != null) configMap.putAll(config); }
[ "public", "void", "setHandlerConfig", "(", "Map", "config", ")", "{", "configMap", ".", "clear", "(", ")", ";", "if", "(", "config", "!=", "null", ")", "configMap", ".", "putAll", "(", "config", ")", ";", "}" ]
Sets the Handler configuration as java.util.Map @param config Configuration map
[ "Sets", "the", "Handler", "configuration", "as", "java", ".", "util", ".", "Map" ]
1895e8068bc3ddd505aab3f5c13aaedab00bbf89
https://github.com/jboss/jboss-jaxrpc-api_spec/blob/1895e8068bc3ddd505aab3f5c13aaedab00bbf89/src/main/java/javax/xml/rpc/handler/HandlerInfo.java#L76-L81
146,765
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/TagConfig.java
TagConfig.isLegacyJavaScript
public static boolean isLegacyJavaScript() { if (javascriptMode == -1) { setLegacyJavaScriptMode(); } assert(javascriptMode != -1); return (javascriptMode == IdJavascript.INT_LEGACY || javascriptMode == IdJavascript.INT_LEGACY_ONLY); }
java
public static boolean isLegacyJavaScript() { if (javascriptMode == -1) { setLegacyJavaScriptMode(); } assert(javascriptMode != -1); return (javascriptMode == IdJavascript.INT_LEGACY || javascriptMode == IdJavascript.INT_LEGACY_ONLY); }
[ "public", "static", "boolean", "isLegacyJavaScript", "(", ")", "{", "if", "(", "javascriptMode", "==", "-", "1", ")", "{", "setLegacyJavaScriptMode", "(", ")", ";", "}", "assert", "(", "javascriptMode", "!=", "-", "1", ")", ";", "return", "(", "javascriptMode", "==", "IdJavascript", ".", "INT_LEGACY", "||", "javascriptMode", "==", "IdJavascript", ".", "INT_LEGACY_ONLY", ")", ";", "}" ]
Return true if the legacy JavaScript support should be written to the output stream. @return boolean
[ "Return", "true", "if", "the", "legacy", "JavaScript", "support", "should", "be", "written", "to", "the", "output", "stream", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/TagConfig.java#L46-L54
146,766
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/TagConfig.java
TagConfig.isDefaultJavaScript
public static boolean isDefaultJavaScript() { if (javascriptMode == -1) { setLegacyJavaScriptMode(); } assert(javascriptMode != -1); return (javascriptMode == IdJavascript.INT_DEFAULT || javascriptMode == IdJavascript.INT_LEGACY); }
java
public static boolean isDefaultJavaScript() { if (javascriptMode == -1) { setLegacyJavaScriptMode(); } assert(javascriptMode != -1); return (javascriptMode == IdJavascript.INT_DEFAULT || javascriptMode == IdJavascript.INT_LEGACY); }
[ "public", "static", "boolean", "isDefaultJavaScript", "(", ")", "{", "if", "(", "javascriptMode", "==", "-", "1", ")", "{", "setLegacyJavaScriptMode", "(", ")", ";", "}", "assert", "(", "javascriptMode", "!=", "-", "1", ")", ";", "return", "(", "javascriptMode", "==", "IdJavascript", ".", "INT_DEFAULT", "||", "javascriptMode", "==", "IdJavascript", ".", "INT_LEGACY", ")", ";", "}" ]
Return true if the default JavaScript support should be written to the output stream. @return boolean
[ "Return", "true", "if", "the", "default", "JavaScript", "support", "should", "be", "written", "to", "the", "output", "stream", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/TagConfig.java#L60-L68
146,767
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/TagConfig.java
TagConfig.setLegacyJavaScriptMode
private static void setLegacyJavaScriptMode() { JspTagConfig tagConfig = ConfigUtil.getConfig().getJspTagConfig(); if (tagConfig != null) { javascriptMode = tagConfig.getIdJavascript().getValue(); } else { javascriptMode = IdJavascript.INT_DEFAULT; } }
java
private static void setLegacyJavaScriptMode() { JspTagConfig tagConfig = ConfigUtil.getConfig().getJspTagConfig(); if (tagConfig != null) { javascriptMode = tagConfig.getIdJavascript().getValue(); } else { javascriptMode = IdJavascript.INT_DEFAULT; } }
[ "private", "static", "void", "setLegacyJavaScriptMode", "(", ")", "{", "JspTagConfig", "tagConfig", "=", "ConfigUtil", ".", "getConfig", "(", ")", ".", "getJspTagConfig", "(", ")", ";", "if", "(", "tagConfig", "!=", "null", ")", "{", "javascriptMode", "=", "tagConfig", ".", "getIdJavascript", "(", ")", ".", "getValue", "(", ")", ";", "}", "else", "{", "javascriptMode", "=", "IdJavascript", ".", "INT_DEFAULT", ";", "}", "}" ]
This will set the JavaScript support level for the id and name attributes.
[ "This", "will", "set", "the", "JavaScript", "support", "level", "for", "the", "id", "and", "name", "attributes", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/TagConfig.java#L127-L136
146,768
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/ImageAnchor.java
ImageAnchor.doEndTag
public int doEndTag() throws JspException { // report errors that may have occurred when the required attributes are being set if (hasErrors()) return reportAndExit(EVAL_PAGE); HttpServletRequest req = (HttpServletRequest) pageContext.getRequest(); // build the anchor into the results // render the anchor tag WriteRenderAppender writer = new WriteRenderAppender(pageContext); TagRenderingBase trb = TagRenderingBase.Factory.getRendering(TagRenderingBase.ANCHOR_TAG, req); ByRef script = new ByRef(); if (!createAnchorBeginTag(req, script, trb, writer, REQUIRED_ATTR)) { reportErrors(); if (!script.isNull()) write(script.getRef().toString()); localRelease(); return EVAL_PAGE; } // set the source and lowsrc attributes // the lowsrc is deprecated and should be removed. HttpServletResponse response = (HttpServletResponse) pageContext.getResponse(); if (_imgState.src != null) { try { String uri = PageFlowTagUtils.rewriteResourceURL(pageContext, _imgState.src, null, null); _imgState.src = response.encodeURL(uri); } catch (URISyntaxException e) { // report the error... String s = Bundle.getString("Tags_Image_URLException", new Object[]{_imgState.src, e.getMessage()}); registerTagError(s, e); } } // set the rollover image if (_rolloverImage != null) { try { String uri = PageFlowTagUtils.rewriteResourceURL(pageContext, _rolloverImage, null, null); _rolloverImage = response.encodeURL(uri); } catch (URISyntaxException e) { // report the error... String s = Bundle.getString("Tags_Rollover_Image_URLException", new Object[]{_rolloverImage, e.getMessage()}); registerTagError(s, e); } if (getJavaScriptAttribute(ONMOUSEOUT) == null) { String s = "swapImage(this,'" + response.encodeURL(_imgState.src) + "')"; _imgState.registerAttribute(AbstractHtmlState.ATTR_JAVASCRIPT, ONMOUSEOUT, s); } if (getJavaScriptAttribute(ONMOUSEOVER) == null) { String s = "swapImage(this,'" + response.encodeURL(_rolloverImage) + "')"; _imgState.registerAttribute(AbstractHtmlState.ATTR_JAVASCRIPT, ONMOUSEOVER, s); } } // render the image tag. TagRenderingBase br = TagRenderingBase.Factory.getRendering(TagRenderingBase.IMAGE_TAG, req); br.doStartTag(writer, _imgState); br.doEndTag(writer); // write the end tag trb.doEndTag(writer); if (!script.isNull()) write(script.getRef().toString()); localRelease(); return EVAL_PAGE; }
java
public int doEndTag() throws JspException { // report errors that may have occurred when the required attributes are being set if (hasErrors()) return reportAndExit(EVAL_PAGE); HttpServletRequest req = (HttpServletRequest) pageContext.getRequest(); // build the anchor into the results // render the anchor tag WriteRenderAppender writer = new WriteRenderAppender(pageContext); TagRenderingBase trb = TagRenderingBase.Factory.getRendering(TagRenderingBase.ANCHOR_TAG, req); ByRef script = new ByRef(); if (!createAnchorBeginTag(req, script, trb, writer, REQUIRED_ATTR)) { reportErrors(); if (!script.isNull()) write(script.getRef().toString()); localRelease(); return EVAL_PAGE; } // set the source and lowsrc attributes // the lowsrc is deprecated and should be removed. HttpServletResponse response = (HttpServletResponse) pageContext.getResponse(); if (_imgState.src != null) { try { String uri = PageFlowTagUtils.rewriteResourceURL(pageContext, _imgState.src, null, null); _imgState.src = response.encodeURL(uri); } catch (URISyntaxException e) { // report the error... String s = Bundle.getString("Tags_Image_URLException", new Object[]{_imgState.src, e.getMessage()}); registerTagError(s, e); } } // set the rollover image if (_rolloverImage != null) { try { String uri = PageFlowTagUtils.rewriteResourceURL(pageContext, _rolloverImage, null, null); _rolloverImage = response.encodeURL(uri); } catch (URISyntaxException e) { // report the error... String s = Bundle.getString("Tags_Rollover_Image_URLException", new Object[]{_rolloverImage, e.getMessage()}); registerTagError(s, e); } if (getJavaScriptAttribute(ONMOUSEOUT) == null) { String s = "swapImage(this,'" + response.encodeURL(_imgState.src) + "')"; _imgState.registerAttribute(AbstractHtmlState.ATTR_JAVASCRIPT, ONMOUSEOUT, s); } if (getJavaScriptAttribute(ONMOUSEOVER) == null) { String s = "swapImage(this,'" + response.encodeURL(_rolloverImage) + "')"; _imgState.registerAttribute(AbstractHtmlState.ATTR_JAVASCRIPT, ONMOUSEOVER, s); } } // render the image tag. TagRenderingBase br = TagRenderingBase.Factory.getRendering(TagRenderingBase.IMAGE_TAG, req); br.doStartTag(writer, _imgState); br.doEndTag(writer); // write the end tag trb.doEndTag(writer); if (!script.isNull()) write(script.getRef().toString()); localRelease(); return EVAL_PAGE; }
[ "public", "int", "doEndTag", "(", ")", "throws", "JspException", "{", "// report errors that may have occurred when the required attributes are being set", "if", "(", "hasErrors", "(", ")", ")", "return", "reportAndExit", "(", "EVAL_PAGE", ")", ";", "HttpServletRequest", "req", "=", "(", "HttpServletRequest", ")", "pageContext", ".", "getRequest", "(", ")", ";", "// build the anchor into the results", "// render the anchor tag", "WriteRenderAppender", "writer", "=", "new", "WriteRenderAppender", "(", "pageContext", ")", ";", "TagRenderingBase", "trb", "=", "TagRenderingBase", ".", "Factory", ".", "getRendering", "(", "TagRenderingBase", ".", "ANCHOR_TAG", ",", "req", ")", ";", "ByRef", "script", "=", "new", "ByRef", "(", ")", ";", "if", "(", "!", "createAnchorBeginTag", "(", "req", ",", "script", ",", "trb", ",", "writer", ",", "REQUIRED_ATTR", ")", ")", "{", "reportErrors", "(", ")", ";", "if", "(", "!", "script", ".", "isNull", "(", ")", ")", "write", "(", "script", ".", "getRef", "(", ")", ".", "toString", "(", ")", ")", ";", "localRelease", "(", ")", ";", "return", "EVAL_PAGE", ";", "}", "// set the source and lowsrc attributes", "// the lowsrc is deprecated and should be removed.", "HttpServletResponse", "response", "=", "(", "HttpServletResponse", ")", "pageContext", ".", "getResponse", "(", ")", ";", "if", "(", "_imgState", ".", "src", "!=", "null", ")", "{", "try", "{", "String", "uri", "=", "PageFlowTagUtils", ".", "rewriteResourceURL", "(", "pageContext", ",", "_imgState", ".", "src", ",", "null", ",", "null", ")", ";", "_imgState", ".", "src", "=", "response", ".", "encodeURL", "(", "uri", ")", ";", "}", "catch", "(", "URISyntaxException", "e", ")", "{", "// report the error...", "String", "s", "=", "Bundle", ".", "getString", "(", "\"Tags_Image_URLException\"", ",", "new", "Object", "[", "]", "{", "_imgState", ".", "src", ",", "e", ".", "getMessage", "(", ")", "}", ")", ";", "registerTagError", "(", "s", ",", "e", ")", ";", "}", "}", "// set the rollover image", "if", "(", "_rolloverImage", "!=", "null", ")", "{", "try", "{", "String", "uri", "=", "PageFlowTagUtils", ".", "rewriteResourceURL", "(", "pageContext", ",", "_rolloverImage", ",", "null", ",", "null", ")", ";", "_rolloverImage", "=", "response", ".", "encodeURL", "(", "uri", ")", ";", "}", "catch", "(", "URISyntaxException", "e", ")", "{", "// report the error...", "String", "s", "=", "Bundle", ".", "getString", "(", "\"Tags_Rollover_Image_URLException\"", ",", "new", "Object", "[", "]", "{", "_rolloverImage", ",", "e", ".", "getMessage", "(", ")", "}", ")", ";", "registerTagError", "(", "s", ",", "e", ")", ";", "}", "if", "(", "getJavaScriptAttribute", "(", "ONMOUSEOUT", ")", "==", "null", ")", "{", "String", "s", "=", "\"swapImage(this,'\"", "+", "response", ".", "encodeURL", "(", "_imgState", ".", "src", ")", "+", "\"')\"", ";", "_imgState", ".", "registerAttribute", "(", "AbstractHtmlState", ".", "ATTR_JAVASCRIPT", ",", "ONMOUSEOUT", ",", "s", ")", ";", "}", "if", "(", "getJavaScriptAttribute", "(", "ONMOUSEOVER", ")", "==", "null", ")", "{", "String", "s", "=", "\"swapImage(this,'\"", "+", "response", ".", "encodeURL", "(", "_rolloverImage", ")", "+", "\"')\"", ";", "_imgState", ".", "registerAttribute", "(", "AbstractHtmlState", ".", "ATTR_JAVASCRIPT", ",", "ONMOUSEOVER", ",", "s", ")", ";", "}", "}", "// render the image tag.", "TagRenderingBase", "br", "=", "TagRenderingBase", ".", "Factory", ".", "getRendering", "(", "TagRenderingBase", ".", "IMAGE_TAG", ",", "req", ")", ";", "br", ".", "doStartTag", "(", "writer", ",", "_imgState", ")", ";", "br", ".", "doEndTag", "(", "writer", ")", ";", "// write the end tag", "trb", ".", "doEndTag", "(", "writer", ")", ";", "if", "(", "!", "script", ".", "isNull", "(", ")", ")", "write", "(", "script", ".", "getRef", "(", ")", ".", "toString", "(", ")", ")", ";", "localRelease", "(", ")", ";", "return", "EVAL_PAGE", ";", "}" ]
Render the image and hyperlink. @throws JspException if a JSP exception has occurred
[ "Render", "the", "image", "and", "hyperlink", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/ImageAnchor.java#L388-L460
146,769
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/template/Template.java
Template.doStartTag
public int doStartTag() throws JspException { Tag parent = getParent(); if (parent != null) { String s = Bundle.getString("TempExcp_ContainedTemplate"); registerTagError(s,null); reportErrors(); _fatalError = true; return SKIP_BODY; } ServletRequest req = pageContext.getRequest(); _savedContext = (TemplateContext) req.getAttribute(TEMPLATE_SECTIONS); TemplateContext ctxt = new TemplateContext(); req.setAttribute(TEMPLATE_SECTIONS,ctxt); return EVAL_BODY_INCLUDE; }
java
public int doStartTag() throws JspException { Tag parent = getParent(); if (parent != null) { String s = Bundle.getString("TempExcp_ContainedTemplate"); registerTagError(s,null); reportErrors(); _fatalError = true; return SKIP_BODY; } ServletRequest req = pageContext.getRequest(); _savedContext = (TemplateContext) req.getAttribute(TEMPLATE_SECTIONS); TemplateContext ctxt = new TemplateContext(); req.setAttribute(TEMPLATE_SECTIONS,ctxt); return EVAL_BODY_INCLUDE; }
[ "public", "int", "doStartTag", "(", ")", "throws", "JspException", "{", "Tag", "parent", "=", "getParent", "(", ")", ";", "if", "(", "parent", "!=", "null", ")", "{", "String", "s", "=", "Bundle", ".", "getString", "(", "\"TempExcp_ContainedTemplate\"", ")", ";", "registerTagError", "(", "s", ",", "null", ")", ";", "reportErrors", "(", ")", ";", "_fatalError", "=", "true", ";", "return", "SKIP_BODY", ";", "}", "ServletRequest", "req", "=", "pageContext", ".", "getRequest", "(", ")", ";", "_savedContext", "=", "(", "TemplateContext", ")", "req", ".", "getAttribute", "(", "TEMPLATE_SECTIONS", ")", ";", "TemplateContext", "ctxt", "=", "new", "TemplateContext", "(", ")", ";", "req", ".", "setAttribute", "(", "TEMPLATE_SECTIONS", ",", "ctxt", ")", ";", "return", "EVAL_BODY_INCLUDE", ";", "}" ]
the tag extension lifecycle method called when the tag is first encountered. This will cause the body of the tag to be evaluated. @return int indicating that the body should be evaluated. @throws JspException on errors.
[ "the", "tag", "extension", "lifecycle", "method", "called", "when", "the", "tag", "is", "first", "encountered", ".", "This", "will", "cause", "the", "body", "of", "the", "tag", "to", "be", "evaluated", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/template/Template.java#L207-L225
146,770
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/template/Template.java
Template.localRelease
protected void localRelease() { super.localRelease(); _fatalError = false; _templatePage = null; _innerErrors = null; _reportErrors = false; _savedContext = null; }
java
protected void localRelease() { super.localRelease(); _fatalError = false; _templatePage = null; _innerErrors = null; _reportErrors = false; _savedContext = null; }
[ "protected", "void", "localRelease", "(", ")", "{", "super", ".", "localRelease", "(", ")", ";", "_fatalError", "=", "false", ";", "_templatePage", "=", "null", ";", "_innerErrors", "=", "null", ";", "_reportErrors", "=", "false", ";", "_savedContext", "=", "null", ";", "}" ]
Reset all of the fields of the tag.
[ "Reset", "all", "of", "the", "fields", "of", "the", "tag", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/template/Template.java#L420-L427
146,771
iig-uni-freiburg/SEWOL
ext/org/deckfour/spex/util/SXmlCharacterMethods.java
SXmlCharacterMethods.convertCharsToXml
public static String convertCharsToXml(String input) { StringBuffer result = new StringBuffer(); for(int i=0; i<input.length(); i++) { switch(input.charAt(i)) { case '<': result.append("&lt;"); break; case '>': result.append("&gt;"); break; case '"': result.append("&quot;"); break; case '\'': result.append("&apos;"); break; case '&': result.append("&amp;"); break; default: result.append(input.charAt(i)); } } return result.toString().trim(); }
java
public static String convertCharsToXml(String input) { StringBuffer result = new StringBuffer(); for(int i=0; i<input.length(); i++) { switch(input.charAt(i)) { case '<': result.append("&lt;"); break; case '>': result.append("&gt;"); break; case '"': result.append("&quot;"); break; case '\'': result.append("&apos;"); break; case '&': result.append("&amp;"); break; default: result.append(input.charAt(i)); } } return result.toString().trim(); }
[ "public", "static", "String", "convertCharsToXml", "(", "String", "input", ")", "{", "StringBuffer", "result", "=", "new", "StringBuffer", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "input", ".", "length", "(", ")", ";", "i", "++", ")", "{", "switch", "(", "input", ".", "charAt", "(", "i", ")", ")", "{", "case", "'", "'", ":", "result", ".", "append", "(", "\"&lt;\"", ")", ";", "break", ";", "case", "'", "'", ":", "result", ".", "append", "(", "\"&gt;\"", ")", ";", "break", ";", "case", "'", "'", ":", "result", ".", "append", "(", "\"&quot;\"", ")", ";", "break", ";", "case", "'", "'", ":", "result", ".", "append", "(", "\"&apos;\"", ")", ";", "break", ";", "case", "'", "'", ":", "result", ".", "append", "(", "\"&amp;\"", ")", ";", "break", ";", "default", ":", "result", ".", "append", "(", "input", ".", "charAt", "(", "i", ")", ")", ";", "}", "}", "return", "result", ".", "toString", "(", ")", ".", "trim", "(", ")", ";", "}" ]
Convenience method to convert XML reserved chars. @param input String to be converted. @return Converted string.
[ "Convenience", "method", "to", "convert", "XML", "reserved", "chars", "." ]
e791cb07a6e62ecf837d760d58a25f32fbf6bbca
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/ext/org/deckfour/spex/util/SXmlCharacterMethods.java#L55-L68
146,772
iig-uni-freiburg/SEWOL
ext/org/deckfour/spex/util/SXmlCharacterMethods.java
SXmlCharacterMethods.convertCharsFromXml
public static String convertCharsFromXml(String input) { StringBuffer result = new StringBuffer(); for(int i=0; i<input.length();) { if(input.charAt(i)=='&') { if(input.substring(i, i+3).equals("&lt;")) { result.append('<'); i += 4; } else if(input.substring(i, i+3).equals("&gt;")) { result.append('>'); i += 4; } else if(input.substring(i, i+4).equals("&amp;")) { result.append('&'); i += 5; } else if(input.substring(i, i+5).equals("&quot;")) { result.append('"'); i += 6; } else if(input.substring(i, i+5).equals("&apos;")) { result.append('\''); i += 6; } else { result.append(input.charAt(i)); i++; } } else { result.append(input.charAt(i)); i++; } } return result.toString(); }
java
public static String convertCharsFromXml(String input) { StringBuffer result = new StringBuffer(); for(int i=0; i<input.length();) { if(input.charAt(i)=='&') { if(input.substring(i, i+3).equals("&lt;")) { result.append('<'); i += 4; } else if(input.substring(i, i+3).equals("&gt;")) { result.append('>'); i += 4; } else if(input.substring(i, i+4).equals("&amp;")) { result.append('&'); i += 5; } else if(input.substring(i, i+5).equals("&quot;")) { result.append('"'); i += 6; } else if(input.substring(i, i+5).equals("&apos;")) { result.append('\''); i += 6; } else { result.append(input.charAt(i)); i++; } } else { result.append(input.charAt(i)); i++; } } return result.toString(); }
[ "public", "static", "String", "convertCharsFromXml", "(", "String", "input", ")", "{", "StringBuffer", "result", "=", "new", "StringBuffer", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "input", ".", "length", "(", ")", ";", ")", "{", "if", "(", "input", ".", "charAt", "(", "i", ")", "==", "'", "'", ")", "{", "if", "(", "input", ".", "substring", "(", "i", ",", "i", "+", "3", ")", ".", "equals", "(", "\"&lt;\"", ")", ")", "{", "result", ".", "append", "(", "'", "'", ")", ";", "i", "+=", "4", ";", "}", "else", "if", "(", "input", ".", "substring", "(", "i", ",", "i", "+", "3", ")", ".", "equals", "(", "\"&gt;\"", ")", ")", "{", "result", ".", "append", "(", "'", "'", ")", ";", "i", "+=", "4", ";", "}", "else", "if", "(", "input", ".", "substring", "(", "i", ",", "i", "+", "4", ")", ".", "equals", "(", "\"&amp;\"", ")", ")", "{", "result", ".", "append", "(", "'", "'", ")", ";", "i", "+=", "5", ";", "}", "else", "if", "(", "input", ".", "substring", "(", "i", ",", "i", "+", "5", ")", ".", "equals", "(", "\"&quot;\"", ")", ")", "{", "result", ".", "append", "(", "'", "'", ")", ";", "i", "+=", "6", ";", "}", "else", "if", "(", "input", ".", "substring", "(", "i", ",", "i", "+", "5", ")", ".", "equals", "(", "\"&apos;\"", ")", ")", "{", "result", ".", "append", "(", "'", "'", ")", ";", "i", "+=", "6", ";", "}", "else", "{", "result", ".", "append", "(", "input", ".", "charAt", "(", "i", ")", ")", ";", "i", "++", ";", "}", "}", "else", "{", "result", ".", "append", "(", "input", ".", "charAt", "(", "i", ")", ")", ";", "i", "++", ";", "}", "}", "return", "result", ".", "toString", "(", ")", ";", "}" ]
Convenience method for backward conversion of XML encoded chars. @param input XML encoded string to be converted. @return Converted string.
[ "Convenience", "method", "for", "backward", "conversion", "of", "XML", "encoded", "chars", "." ]
e791cb07a6e62ecf837d760d58a25f32fbf6bbca
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/ext/org/deckfour/spex/util/SXmlCharacterMethods.java#L76-L105
146,773
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/DefaultURLRewriter.java
DefaultURLRewriter.getAjaxUrl
public AjaxUrlInfo getAjaxUrl(ServletContext servletContext, ServletRequest request, Object nameable) { HttpServletRequest req = (HttpServletRequest) request; // the default behavior is to set the parameter as the nameable's name or null String name = null; if (nameable instanceof INameable) name = ((INameable) nameable).getObjectName(); String path = req.getServletPath(); int idx = path.lastIndexOf('/'); if (idx != -1) { path = "/" + path.substring(1, idx); } path = req.getContextPath() + path; return new AjaxUrlInfo(path,name); }
java
public AjaxUrlInfo getAjaxUrl(ServletContext servletContext, ServletRequest request, Object nameable) { HttpServletRequest req = (HttpServletRequest) request; // the default behavior is to set the parameter as the nameable's name or null String name = null; if (nameable instanceof INameable) name = ((INameable) nameable).getObjectName(); String path = req.getServletPath(); int idx = path.lastIndexOf('/'); if (idx != -1) { path = "/" + path.substring(1, idx); } path = req.getContextPath() + path; return new AjaxUrlInfo(path,name); }
[ "public", "AjaxUrlInfo", "getAjaxUrl", "(", "ServletContext", "servletContext", ",", "ServletRequest", "request", ",", "Object", "nameable", ")", "{", "HttpServletRequest", "req", "=", "(", "HttpServletRequest", ")", "request", ";", "// the default behavior is to set the parameter as the nameable's name or null", "String", "name", "=", "null", ";", "if", "(", "nameable", "instanceof", "INameable", ")", "name", "=", "(", "(", "INameable", ")", "nameable", ")", ".", "getObjectName", "(", ")", ";", "String", "path", "=", "req", ".", "getServletPath", "(", ")", ";", "int", "idx", "=", "path", ".", "lastIndexOf", "(", "'", "'", ")", ";", "if", "(", "idx", "!=", "-", "1", ")", "{", "path", "=", "\"/\"", "+", "path", ".", "substring", "(", "1", ",", "idx", ")", ";", "}", "path", "=", "req", ".", "getContextPath", "(", ")", "+", "path", ";", "return", "new", "AjaxUrlInfo", "(", "path", ",", "name", ")", ";", "}" ]
This method will get the prefix for all URLs that are used for AJAX processing @param servletContext the current ServletContext. @param request the current ServletRequest. @param nameable the INamable object that will handle the request
[ "This", "method", "will", "get", "the", "prefix", "for", "all", "URLs", "that", "are", "used", "for", "AJAX", "processing" ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/DefaultURLRewriter.java#L51-L67
146,774
iig-uni-freiburg/SEWOL
ext/org/deckfour/xes/out/XMxmlSerializer.java
XMxmlSerializer.addModelReference
protected void addModelReference(XAttributable object, SXTag target) throws IOException { XAttributeLiteral modelRefAttr = (XAttributeLiteral) object .getAttributes().get(XSemanticExtension.KEY_MODELREFERENCE); if (modelRefAttr != null) { target.addAttribute("modelReference", modelRefAttr.getValue()); } }
java
protected void addModelReference(XAttributable object, SXTag target) throws IOException { XAttributeLiteral modelRefAttr = (XAttributeLiteral) object .getAttributes().get(XSemanticExtension.KEY_MODELREFERENCE); if (modelRefAttr != null) { target.addAttribute("modelReference", modelRefAttr.getValue()); } }
[ "protected", "void", "addModelReference", "(", "XAttributable", "object", ",", "SXTag", "target", ")", "throws", "IOException", "{", "XAttributeLiteral", "modelRefAttr", "=", "(", "XAttributeLiteral", ")", "object", ".", "getAttributes", "(", ")", ".", "get", "(", "XSemanticExtension", ".", "KEY_MODELREFERENCE", ")", ";", "if", "(", "modelRefAttr", "!=", "null", ")", "{", "target", ".", "addAttribute", "(", "\"modelReference\"", ",", "modelRefAttr", ".", "getValue", "(", ")", ")", ";", "}", "}" ]
Helper method, adds all model references of an attributable to the given tag. @param object Attributable element. @param target Tag to add model references to.
[ "Helper", "method", "adds", "all", "model", "references", "of", "an", "attributable", "to", "the", "given", "tag", "." ]
e791cb07a6e62ecf837d760d58a25f32fbf6bbca
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/ext/org/deckfour/xes/out/XMxmlSerializer.java#L296-L303
146,775
matthewhorridge/owlapi-gwt
owlapi-gwt-client-side-emul/src/main/java/org/semanticweb/owlapi/model/OWLOntologyID.java
OWLOntologyID.isOWL2DLOntologyID
public boolean isOWL2DLOntologyID() { return !ontologyIRI.isPresent() || !ontologyIRI.get().isReservedVocabulary() && (!versionIRI.isPresent() || !versionIRI.get().isReservedVocabulary()); }
java
public boolean isOWL2DLOntologyID() { return !ontologyIRI.isPresent() || !ontologyIRI.get().isReservedVocabulary() && (!versionIRI.isPresent() || !versionIRI.get().isReservedVocabulary()); }
[ "public", "boolean", "isOWL2DLOntologyID", "(", ")", "{", "return", "!", "ontologyIRI", ".", "isPresent", "(", ")", "||", "!", "ontologyIRI", ".", "get", "(", ")", ".", "isReservedVocabulary", "(", ")", "&&", "(", "!", "versionIRI", ".", "isPresent", "(", ")", "||", "!", "versionIRI", ".", "get", "(", ")", ".", "isReservedVocabulary", "(", ")", ")", ";", "}" ]
Determines if this is a valid OWL 2 DL ontology ID. To be a valid OWL 2 DL ID, the ontology IRI and version IRI must not be reserved vocabulary. @return {@code true} if this is a valid OWL 2 DL ontology ID, otherwise {@code false} @see org.semanticweb.owlapi.model.IRI#isReservedVocabulary()
[ "Determines", "if", "this", "is", "a", "valid", "OWL", "2", "DL", "ontology", "ID", ".", "To", "be", "a", "valid", "OWL", "2", "DL", "ID", "the", "ontology", "IRI", "and", "version", "IRI", "must", "not", "be", "reserved", "vocabulary", "." ]
7ab975fb6cef3c8947099983551672a3b5d4e2fd
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-client-side-emul/src/main/java/org/semanticweb/owlapi/model/OWLOntologyID.java#L149-L152
146,776
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/ExpressionHandling.java
ExpressionHandling.ensureValidExpression
public String ensureValidExpression(String dataSource, String attrName, String errorId) throws JspException { try { boolean isExpr = isExpression(dataSource); // @perf: if the isExpr call fails, this is an error condition, and the containsExpression // call cost is irrelevant if (!isExpr && containsExpression(dataSource)) { String s = Bundle.getString(errorId, new Object[]{dataSource}); _tag.registerTagError(s, null); return null; } if (!isExpr) { String s = Bundle.getString(errorId, new Object[]{dataSource}); _tag.registerTagError(s, null); return null; } } catch (Exception e) { // pass throw JspExceptions if (e instanceof JspException) throw (JspException) e; String s = Bundle.getString(errorId, new Object[]{dataSource}); _tag.registerTagError(s, e); return null; } return dataSource; }
java
public String ensureValidExpression(String dataSource, String attrName, String errorId) throws JspException { try { boolean isExpr = isExpression(dataSource); // @perf: if the isExpr call fails, this is an error condition, and the containsExpression // call cost is irrelevant if (!isExpr && containsExpression(dataSource)) { String s = Bundle.getString(errorId, new Object[]{dataSource}); _tag.registerTagError(s, null); return null; } if (!isExpr) { String s = Bundle.getString(errorId, new Object[]{dataSource}); _tag.registerTagError(s, null); return null; } } catch (Exception e) { // pass throw JspExceptions if (e instanceof JspException) throw (JspException) e; String s = Bundle.getString(errorId, new Object[]{dataSource}); _tag.registerTagError(s, e); return null; } return dataSource; }
[ "public", "String", "ensureValidExpression", "(", "String", "dataSource", ",", "String", "attrName", ",", "String", "errorId", ")", "throws", "JspException", "{", "try", "{", "boolean", "isExpr", "=", "isExpression", "(", "dataSource", ")", ";", "// @perf: if the isExpr call fails, this is an error condition, and the containsExpression", "// call cost is irrelevant", "if", "(", "!", "isExpr", "&&", "containsExpression", "(", "dataSource", ")", ")", "{", "String", "s", "=", "Bundle", ".", "getString", "(", "errorId", ",", "new", "Object", "[", "]", "{", "dataSource", "}", ")", ";", "_tag", ".", "registerTagError", "(", "s", ",", "null", ")", ";", "return", "null", ";", "}", "if", "(", "!", "isExpr", ")", "{", "String", "s", "=", "Bundle", ".", "getString", "(", "errorId", ",", "new", "Object", "[", "]", "{", "dataSource", "}", ")", ";", "_tag", ".", "registerTagError", "(", "s", ",", "null", ")", ";", "return", "null", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "// pass throw JspExceptions", "if", "(", "e", "instanceof", "JspException", ")", "throw", "(", "JspException", ")", "e", ";", "String", "s", "=", "Bundle", ".", "getString", "(", "errorId", ",", "new", "Object", "[", "]", "{", "dataSource", "}", ")", ";", "_tag", ".", "registerTagError", "(", "s", ",", "e", ")", ";", "return", "null", ";", "}", "return", "dataSource", ";", "}" ]
Ensure that the passed in data source is a valid expression. @param dataSource @param attrName @param errorId @return String @throws javax.servlet.jsp.JspException
[ "Ensure", "that", "the", "passed", "in", "data", "source", "is", "a", "valid", "expression", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/ExpressionHandling.java#L63-L93
146,777
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/ExpressionHandling.java
ExpressionHandling.evaluateExpressionInternal
private Object evaluateExpressionInternal(String expression, String attrName, PageContext pageContext) throws JspException { if (logger.isDebugEnabled()) logger.debug("evaluate expression=\"" + expression + "\""); Object result = null; try { VariableResolver vr = ImplicitObjectUtil.getReadVariableResolver(pageContext); result = getExpressionEvaluator().evaluateStrict(expression, vr); } catch (ExpressionEvaluationException ee) { // if there is an expression evaluation error set the error and return null if (logger.isWarnEnabled()) logger.warn(Bundle.getString("Tags_ExpressionEvaluationFailure", expression)); // create the expression info an add it to the error tracking EvalErrorInfo info = new EvalErrorInfo(); info.evalExcp = ee; info.expression = expression; info.attr = attrName; info.tagType = _tag.getTagName(); // report the error _tag.registerTagError(info); return null; } catch (Exception e) { String s = Bundle.getString("Tags_ExpressionEvaluationException", new Object[]{expression, e.toString()}); _tag.registerTagError(s, e); return null; } if (logger.isDebugEnabled()) logger.debug("resulting object: " + result); return result; }
java
private Object evaluateExpressionInternal(String expression, String attrName, PageContext pageContext) throws JspException { if (logger.isDebugEnabled()) logger.debug("evaluate expression=\"" + expression + "\""); Object result = null; try { VariableResolver vr = ImplicitObjectUtil.getReadVariableResolver(pageContext); result = getExpressionEvaluator().evaluateStrict(expression, vr); } catch (ExpressionEvaluationException ee) { // if there is an expression evaluation error set the error and return null if (logger.isWarnEnabled()) logger.warn(Bundle.getString("Tags_ExpressionEvaluationFailure", expression)); // create the expression info an add it to the error tracking EvalErrorInfo info = new EvalErrorInfo(); info.evalExcp = ee; info.expression = expression; info.attr = attrName; info.tagType = _tag.getTagName(); // report the error _tag.registerTagError(info); return null; } catch (Exception e) { String s = Bundle.getString("Tags_ExpressionEvaluationException", new Object[]{expression, e.toString()}); _tag.registerTagError(s, e); return null; } if (logger.isDebugEnabled()) logger.debug("resulting object: " + result); return result; }
[ "private", "Object", "evaluateExpressionInternal", "(", "String", "expression", ",", "String", "attrName", ",", "PageContext", "pageContext", ")", "throws", "JspException", "{", "if", "(", "logger", ".", "isDebugEnabled", "(", ")", ")", "logger", ".", "debug", "(", "\"evaluate expression=\\\"\"", "+", "expression", "+", "\"\\\"\"", ")", ";", "Object", "result", "=", "null", ";", "try", "{", "VariableResolver", "vr", "=", "ImplicitObjectUtil", ".", "getReadVariableResolver", "(", "pageContext", ")", ";", "result", "=", "getExpressionEvaluator", "(", ")", ".", "evaluateStrict", "(", "expression", ",", "vr", ")", ";", "}", "catch", "(", "ExpressionEvaluationException", "ee", ")", "{", "// if there is an expression evaluation error set the error and return null", "if", "(", "logger", ".", "isWarnEnabled", "(", ")", ")", "logger", ".", "warn", "(", "Bundle", ".", "getString", "(", "\"Tags_ExpressionEvaluationFailure\"", ",", "expression", ")", ")", ";", "// create the expression info an add it to the error tracking", "EvalErrorInfo", "info", "=", "new", "EvalErrorInfo", "(", ")", ";", "info", ".", "evalExcp", "=", "ee", ";", "info", ".", "expression", "=", "expression", ";", "info", ".", "attr", "=", "attrName", ";", "info", ".", "tagType", "=", "_tag", ".", "getTagName", "(", ")", ";", "// report the error", "_tag", ".", "registerTagError", "(", "info", ")", ";", "return", "null", ";", "}", "catch", "(", "Exception", "e", ")", "{", "String", "s", "=", "Bundle", ".", "getString", "(", "\"Tags_ExpressionEvaluationException\"", ",", "new", "Object", "[", "]", "{", "expression", ",", "e", ".", "toString", "(", ")", "}", ")", ";", "_tag", ".", "registerTagError", "(", "s", ",", "e", ")", ";", "return", "null", ";", "}", "if", "(", "logger", ".", "isDebugEnabled", "(", ")", ")", "logger", ".", "debug", "(", "\"resulting object: \"", "+", "result", ")", ";", "return", "result", ";", "}" ]
This is the real implementation of evaluateExpression. @param expression @param attrName @return @throws JspException
[ "This", "is", "the", "real", "implementation", "of", "evaluateExpression", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/ExpressionHandling.java#L157-L192
146,778
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java
PageFlowUtils.getModulePath
public static String getModulePath( HttpServletRequest request, String requestURI ) { return getModulePathForRelativeURI( getRelativeURI( request, requestURI, null ) ); }
java
public static String getModulePath( HttpServletRequest request, String requestURI ) { return getModulePathForRelativeURI( getRelativeURI( request, requestURI, null ) ); }
[ "public", "static", "String", "getModulePath", "(", "HttpServletRequest", "request", ",", "String", "requestURI", ")", "{", "return", "getModulePathForRelativeURI", "(", "getRelativeURI", "(", "request", ",", "requestURI", ",", "null", ")", ")", ";", "}" ]
Get the Struts module path for a URI. This is the parent directory, relative to the web application root, of the file referenced by the URI. @param request the current HttpServletRequest. @param requestURI the URI for which to get the Struts module path.
[ "Get", "the", "Struts", "module", "path", "for", "a", "URI", ".", "This", "is", "the", "parent", "directory", "relative", "to", "the", "web", "application", "root", "of", "the", "file", "referenced", "by", "the", "URI", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java#L95-L98
146,779
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java
PageFlowUtils.getModulePathForRelativeURI
public static String getModulePathForRelativeURI( String uri ) { if ( uri == null ) return null; assert uri.length() > 0; assert uri.charAt( 0 ) == '/' : uri; // Strip off the actual page name (e.g., some_page.jsp) int slash = uri.lastIndexOf( '/' ); uri = uri.substring( 0, slash ); return uri; }
java
public static String getModulePathForRelativeURI( String uri ) { if ( uri == null ) return null; assert uri.length() > 0; assert uri.charAt( 0 ) == '/' : uri; // Strip off the actual page name (e.g., some_page.jsp) int slash = uri.lastIndexOf( '/' ); uri = uri.substring( 0, slash ); return uri; }
[ "public", "static", "String", "getModulePathForRelativeURI", "(", "String", "uri", ")", "{", "if", "(", "uri", "==", "null", ")", "return", "null", ";", "assert", "uri", ".", "length", "(", ")", ">", "0", ";", "assert", "uri", ".", "charAt", "(", "0", ")", "==", "'", "'", ":", "uri", ";", "// Strip off the actual page name (e.g., some_page.jsp)", "int", "slash", "=", "uri", ".", "lastIndexOf", "(", "'", "'", ")", ";", "uri", "=", "uri", ".", "substring", "(", "0", ",", "slash", ")", ";", "return", "uri", ";", "}" ]
Get the Struts module path for a URI that is relative to the web application root. @param uri the URI for which to get the module path.
[ "Get", "the", "Struts", "module", "path", "for", "a", "URI", "that", "is", "relative", "to", "the", "web", "application", "root", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java#L116-L127
146,780
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java
PageFlowUtils.getRelativeURI
public static String getRelativeURI( HttpServletRequest request, PageFlowController relativeTo ) { if ( relativeTo == null ) return InternalUtils.getDecodedServletPath( request ); return getRelativeURI( request, InternalUtils.getDecodedURI( request ), relativeTo ); }
java
public static String getRelativeURI( HttpServletRequest request, PageFlowController relativeTo ) { if ( relativeTo == null ) return InternalUtils.getDecodedServletPath( request ); return getRelativeURI( request, InternalUtils.getDecodedURI( request ), relativeTo ); }
[ "public", "static", "String", "getRelativeURI", "(", "HttpServletRequest", "request", ",", "PageFlowController", "relativeTo", ")", "{", "if", "(", "relativeTo", "==", "null", ")", "return", "InternalUtils", ".", "getDecodedServletPath", "(", "request", ")", ";", "return", "getRelativeURI", "(", "request", ",", "InternalUtils", ".", "getDecodedURI", "(", "request", ")", ",", "relativeTo", ")", ";", "}" ]
Get the request URI, relative to the URI of the given PageFlowController. @param request the current HttpServletRequest. @param relativeTo a PageFlowController to which the returned URI should be relative, or <code>null</code> if the returned URI should be relative to the webapp root.
[ "Get", "the", "request", "URI", "relative", "to", "the", "URI", "of", "the", "given", "PageFlowController", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java#L136-L140
146,781
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java
PageFlowUtils.getRelativeURI
public static String getRelativeURI( HttpServletRequest request, String uri, PageFlowController relativeTo ) { String contextPath = request.getContextPath(); if ( relativeTo != null ) contextPath += relativeTo.getModulePath(); int overlap = uri.indexOf( contextPath + '/' ); if ( overlap == -1 ) return null; return uri.substring( overlap + contextPath.length() ); }
java
public static String getRelativeURI( HttpServletRequest request, String uri, PageFlowController relativeTo ) { String contextPath = request.getContextPath(); if ( relativeTo != null ) contextPath += relativeTo.getModulePath(); int overlap = uri.indexOf( contextPath + '/' ); if ( overlap == -1 ) return null; return uri.substring( overlap + contextPath.length() ); }
[ "public", "static", "String", "getRelativeURI", "(", "HttpServletRequest", "request", ",", "String", "uri", ",", "PageFlowController", "relativeTo", ")", "{", "String", "contextPath", "=", "request", ".", "getContextPath", "(", ")", ";", "if", "(", "relativeTo", "!=", "null", ")", "contextPath", "+=", "relativeTo", ".", "getModulePath", "(", ")", ";", "int", "overlap", "=", "uri", ".", "indexOf", "(", "contextPath", "+", "'", "'", ")", ";", "if", "(", "overlap", "==", "-", "1", ")", "return", "null", ";", "return", "uri", ".", "substring", "(", "overlap", "+", "contextPath", ".", "length", "(", ")", ")", ";", "}" ]
Get a URI relative to the URI of the given PageFlowController. @param request the current HttpServletRequest. @param uri the URI which should be made relative. @param relativeTo a PageFlowController to which the returned URI should be relative, or <code>null</code> if the returned URI should be relative to the webapp root.
[ "Get", "a", "URI", "relative", "to", "the", "URI", "of", "the", "given", "PageFlowController", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java#L150-L157
146,782
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java
PageFlowUtils.getBeginActionURI
public static String getBeginActionURI( String requestURI ) { // Translate this to a request for the begin action ("begin.do") for this PageFlowController. InternalStringBuilder retVal = new InternalStringBuilder(); int lastSlash = requestURI.lastIndexOf( '/' ); if ( lastSlash != -1 ) { retVal.append( requestURI.substring( 0, lastSlash ) ); } retVal.append( '/' ).append( BEGIN_ACTION_NAME ).append( ACTION_EXTENSION ); return retVal.toString(); }
java
public static String getBeginActionURI( String requestURI ) { // Translate this to a request for the begin action ("begin.do") for this PageFlowController. InternalStringBuilder retVal = new InternalStringBuilder(); int lastSlash = requestURI.lastIndexOf( '/' ); if ( lastSlash != -1 ) { retVal.append( requestURI.substring( 0, lastSlash ) ); } retVal.append( '/' ).append( BEGIN_ACTION_NAME ).append( ACTION_EXTENSION ); return retVal.toString(); }
[ "public", "static", "String", "getBeginActionURI", "(", "String", "requestURI", ")", "{", "// Translate this to a request for the begin action (\"begin.do\") for this PageFlowController.", "InternalStringBuilder", "retVal", "=", "new", "InternalStringBuilder", "(", ")", ";", "int", "lastSlash", "=", "requestURI", ".", "lastIndexOf", "(", "'", "'", ")", ";", "if", "(", "lastSlash", "!=", "-", "1", ")", "{", "retVal", ".", "append", "(", "requestURI", ".", "substring", "(", "0", ",", "lastSlash", ")", ")", ";", "}", "retVal", ".", "append", "(", "'", "'", ")", ".", "append", "(", "BEGIN_ACTION_NAME", ")", ".", "append", "(", "ACTION_EXTENSION", ")", ";", "return", "retVal", ".", "toString", "(", ")", ";", "}" ]
Get a URI for the "begin" action in the PageFlowController associated with the given request URI. @return a String that is the URI for the "begin" action in the PageFlowController associated with the given request URI.
[ "Get", "a", "URI", "for", "the", "begin", "action", "in", "the", "PageFlowController", "associated", "with", "the", "given", "request", "URI", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java#L166-L179
146,783
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java
PageFlowUtils.getSharedFlow
public static SharedFlowController getSharedFlow( String sharedFlowClassName, HttpServletRequest request, ServletContext servletContext ) { StorageHandler sh = Handlers.get( servletContext ).getStorageHandler(); HttpServletRequest unwrappedRequest = unwrapMultipart( request ); RequestContext rc = new RequestContext( unwrappedRequest, null ); String attrName = ScopedServletUtils.getScopedSessionAttrName(InternalConstants.SHARED_FLOW_ATTR_PREFIX + sharedFlowClassName, request); SharedFlowController sf = (SharedFlowController) sh.getAttribute(rc, attrName); if (sf != null) { sf.reinitializeIfNecessary(request, null, servletContext); } return sf; }
java
public static SharedFlowController getSharedFlow( String sharedFlowClassName, HttpServletRequest request, ServletContext servletContext ) { StorageHandler sh = Handlers.get( servletContext ).getStorageHandler(); HttpServletRequest unwrappedRequest = unwrapMultipart( request ); RequestContext rc = new RequestContext( unwrappedRequest, null ); String attrName = ScopedServletUtils.getScopedSessionAttrName(InternalConstants.SHARED_FLOW_ATTR_PREFIX + sharedFlowClassName, request); SharedFlowController sf = (SharedFlowController) sh.getAttribute(rc, attrName); if (sf != null) { sf.reinitializeIfNecessary(request, null, servletContext); } return sf; }
[ "public", "static", "SharedFlowController", "getSharedFlow", "(", "String", "sharedFlowClassName", ",", "HttpServletRequest", "request", ",", "ServletContext", "servletContext", ")", "{", "StorageHandler", "sh", "=", "Handlers", ".", "get", "(", "servletContext", ")", ".", "getStorageHandler", "(", ")", ";", "HttpServletRequest", "unwrappedRequest", "=", "unwrapMultipart", "(", "request", ")", ";", "RequestContext", "rc", "=", "new", "RequestContext", "(", "unwrappedRequest", ",", "null", ")", ";", "String", "attrName", "=", "ScopedServletUtils", ".", "getScopedSessionAttrName", "(", "InternalConstants", ".", "SHARED_FLOW_ATTR_PREFIX", "+", "sharedFlowClassName", ",", "request", ")", ";", "SharedFlowController", "sf", "=", "(", "SharedFlowController", ")", "sh", ".", "getAttribute", "(", "rc", ",", "attrName", ")", ";", "if", "(", "sf", "!=", "null", ")", "{", "sf", ".", "reinitializeIfNecessary", "(", "request", ",", "null", ",", "servletContext", ")", ";", "}", "return", "sf", ";", "}" ]
Get the shared flow with the given class name. @param sharedFlowClassName the class name of the shared flow to retrieve. @param request the current HttpServletRequest. @return the {@link SharedFlowController} of the given class name which is stored in the user session.
[ "Get", "the", "shared", "flow", "with", "the", "given", "class", "name", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java#L374-L387
146,784
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java
PageFlowUtils.getFormBeanName
public static String getFormBeanName( ActionForm formInstance, HttpServletRequest request ) { return getFormBeanName( formInstance.getClass(), request ); }
java
public static String getFormBeanName( ActionForm formInstance, HttpServletRequest request ) { return getFormBeanName( formInstance.getClass(), request ); }
[ "public", "static", "String", "getFormBeanName", "(", "ActionForm", "formInstance", ",", "HttpServletRequest", "request", ")", "{", "return", "getFormBeanName", "(", "formInstance", ".", "getClass", "(", ")", ",", "request", ")", ";", "}" ]
Get the name for the type of a ActionForm instance. Use a name looked up from the current Struts module, or, if none is found, create one. @param formInstance the ActionForm instance whose type will determine the name. @param request the current HttpServletRequest, which contains a reference to the current Struts module. @return the name found in the Struts module, or, if none is found, a name that is either: <ul> <li>a camel-cased version of the base class name (minus any package or outer-class qualifiers, or, if that name is already taken,</li> <li>the full class name, with '.' and '$' replaced by '_'.</li> </ul>
[ "Get", "the", "name", "for", "the", "type", "of", "a", "ActionForm", "instance", ".", "Use", "a", "name", "looked", "up", "from", "the", "current", "Struts", "module", "or", "if", "none", "is", "found", "create", "one", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java#L715-L718
146,785
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java
PageFlowUtils.getFormBeanName
public static String getFormBeanName( Class formBeanClass, HttpServletRequest request ) { ModuleConfig moduleConfig = RequestUtils.getRequestModuleConfig( request ); List/*< String >*/ names = getFormNamesFromModuleConfig( formBeanClass.getName(), moduleConfig ); if ( names != null ) { assert names.size() > 0; // getFormNamesFromModuleConfig returns null or a nonempty list return ( String ) names.get( 0 ); } return generateFormBeanName( formBeanClass, request ); }
java
public static String getFormBeanName( Class formBeanClass, HttpServletRequest request ) { ModuleConfig moduleConfig = RequestUtils.getRequestModuleConfig( request ); List/*< String >*/ names = getFormNamesFromModuleConfig( formBeanClass.getName(), moduleConfig ); if ( names != null ) { assert names.size() > 0; // getFormNamesFromModuleConfig returns null or a nonempty list return ( String ) names.get( 0 ); } return generateFormBeanName( formBeanClass, request ); }
[ "public", "static", "String", "getFormBeanName", "(", "Class", "formBeanClass", ",", "HttpServletRequest", "request", ")", "{", "ModuleConfig", "moduleConfig", "=", "RequestUtils", ".", "getRequestModuleConfig", "(", "request", ")", ";", "List", "/*< String >*/", "names", "=", "getFormNamesFromModuleConfig", "(", "formBeanClass", ".", "getName", "(", ")", ",", "moduleConfig", ")", ";", "if", "(", "names", "!=", "null", ")", "{", "assert", "names", ".", "size", "(", ")", ">", "0", ";", "// getFormNamesFromModuleConfig returns null or a nonempty list", "return", "(", "String", ")", "names", ".", "get", "(", "0", ")", ";", "}", "return", "generateFormBeanName", "(", "formBeanClass", ",", "request", ")", ";", "}" ]
Get the name for an ActionForm type. Use a name looked up from the current Struts module, or, if none is found, create one. @param formBeanClass the ActionForm-derived class whose type will determine the name. @param request the current HttpServletRequest, which contains a reference to the current Struts module. @return the name found in the Struts module, or, if none is found, a name that is either: <ul> <li>a camel-cased version of the base class name (minus any package or outer-class qualifiers, or, if that name is already taken,</li> <li>the full class name, with '.' and '$' replaced by '_'.</li> </ul>
[ "Get", "the", "name", "for", "an", "ActionForm", "type", ".", "Use", "a", "name", "looked", "up", "from", "the", "current", "Struts", "module", "or", "if", "none", "is", "found", "create", "one", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java#L733-L745
146,786
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java
PageFlowUtils.generateFormBeanName
private static String generateFormBeanName( Class formBeanClass, HttpServletRequest request ) { ModuleConfig moduleConfig = RequestUtils.getRequestModuleConfig( request ); String formBeanClassName = formBeanClass.getName(); // // A form-bean wasn't found for this type, so we'll create a name. First try and create // name that is a camelcased version of the classname without all of its package/outer-class // qualifiers. If one with that name already exists, munge the fully-qualified classname. // String formType = formBeanClassName; int lastQualifier = formType.lastIndexOf( '$' ); if ( lastQualifier == -1 ) { lastQualifier = formType.lastIndexOf( '.' ); } String formName = formType.substring( lastQualifier + 1 ); formName = Character.toLowerCase( formName.charAt( 0 ) ) + formName.substring( 1 ); if ( moduleConfig.findFormBeanConfig( formName ) != null ) { formName = formType.replace( '.', '_' ).replace( '$', '_' ); assert moduleConfig.findFormBeanConfig( formName ) == null : formName; } return formName; }
java
private static String generateFormBeanName( Class formBeanClass, HttpServletRequest request ) { ModuleConfig moduleConfig = RequestUtils.getRequestModuleConfig( request ); String formBeanClassName = formBeanClass.getName(); // // A form-bean wasn't found for this type, so we'll create a name. First try and create // name that is a camelcased version of the classname without all of its package/outer-class // qualifiers. If one with that name already exists, munge the fully-qualified classname. // String formType = formBeanClassName; int lastQualifier = formType.lastIndexOf( '$' ); if ( lastQualifier == -1 ) { lastQualifier = formType.lastIndexOf( '.' ); } String formName = formType.substring( lastQualifier + 1 ); formName = Character.toLowerCase( formName.charAt( 0 ) ) + formName.substring( 1 ); if ( moduleConfig.findFormBeanConfig( formName ) != null ) { formName = formType.replace( '.', '_' ).replace( '$', '_' ); assert moduleConfig.findFormBeanConfig( formName ) == null : formName; } return formName; }
[ "private", "static", "String", "generateFormBeanName", "(", "Class", "formBeanClass", ",", "HttpServletRequest", "request", ")", "{", "ModuleConfig", "moduleConfig", "=", "RequestUtils", ".", "getRequestModuleConfig", "(", "request", ")", ";", "String", "formBeanClassName", "=", "formBeanClass", ".", "getName", "(", ")", ";", "//", "// A form-bean wasn't found for this type, so we'll create a name. First try and create", "// name that is a camelcased version of the classname without all of its package/outer-class", "// qualifiers. If one with that name already exists, munge the fully-qualified classname.", "//", "String", "formType", "=", "formBeanClassName", ";", "int", "lastQualifier", "=", "formType", ".", "lastIndexOf", "(", "'", "'", ")", ";", "if", "(", "lastQualifier", "==", "-", "1", ")", "{", "lastQualifier", "=", "formType", ".", "lastIndexOf", "(", "'", "'", ")", ";", "}", "String", "formName", "=", "formType", ".", "substring", "(", "lastQualifier", "+", "1", ")", ";", "formName", "=", "Character", ".", "toLowerCase", "(", "formName", ".", "charAt", "(", "0", ")", ")", "+", "formName", ".", "substring", "(", "1", ")", ";", "if", "(", "moduleConfig", ".", "findFormBeanConfig", "(", "formName", ")", "!=", "null", ")", "{", "formName", "=", "formType", ".", "replace", "(", "'", "'", ",", "'", "'", ")", ".", "replace", "(", "'", "'", ",", "'", "'", ")", ";", "assert", "moduleConfig", ".", "findFormBeanConfig", "(", "formName", ")", "==", "null", ":", "formName", ";", "}", "return", "formName", ";", "}" ]
Create the name for a form bean type. @param formBeanClass the class whose type will determine the name. @param request the current HttpServletRequest, which contains a reference to the current Struts module. @return the name found in the Struts module, or, if none is found, a name that is either: <ul> <li>a camel-cased version of the base class name (minus any package or outer-class qualifiers, or, if that name is already taken,</li> <li>the full class name, with '.' and '$' replaced by '_'.</li> </ul>
[ "Create", "the", "name", "for", "a", "form", "bean", "type", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java#L759-L787
146,787
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java
PageFlowUtils.getActionOutput
public static Object getActionOutput( String name, ServletRequest request ) { Map map = InternalUtils.getActionOutputMap( request, false ); return map != null ? map.get( name ) : null; }
java
public static Object getActionOutput( String name, ServletRequest request ) { Map map = InternalUtils.getActionOutputMap( request, false ); return map != null ? map.get( name ) : null; }
[ "public", "static", "Object", "getActionOutput", "(", "String", "name", ",", "ServletRequest", "request", ")", "{", "Map", "map", "=", "InternalUtils", ".", "getActionOutputMap", "(", "request", ",", "false", ")", ";", "return", "map", "!=", "null", "?", "map", ".", "get", "(", "name", ")", ":", "null", ";", "}" ]
Get a named action output that was registered in the current request. @param name the name of the action output. @param request the current ServletRequest @see #addActionOutput
[ "Get", "a", "named", "action", "output", "that", "was", "registered", "in", "the", "current", "request", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java#L969-L973
146,788
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java
PageFlowUtils.getRewrittenActionURI
public static String getRewrittenActionURI( ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, String actionName, Map params, String fragment, boolean forXML ) throws URISyntaxException { MutableURI uri = getActionURI( servletContext, request, response, actionName ); if ( params != null ) uri.addParameters( params, false ); if ( fragment != null ) uri.setFragment( uri.encode( fragment ) ); boolean needsToBeSecure = needsToBeSecure( servletContext, request, uri.getPath(), true ); URLRewriterService.rewriteURL( servletContext, request, response, uri, URLType.ACTION, needsToBeSecure ); String key = getURLTemplateKey( URLType.ACTION, needsToBeSecure ); URIContext uriContext = URIContextFactory.getInstance( forXML ); return URLRewriterService.getTemplatedURL( servletContext, request, uri, key, uriContext ); }
java
public static String getRewrittenActionURI( ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, String actionName, Map params, String fragment, boolean forXML ) throws URISyntaxException { MutableURI uri = getActionURI( servletContext, request, response, actionName ); if ( params != null ) uri.addParameters( params, false ); if ( fragment != null ) uri.setFragment( uri.encode( fragment ) ); boolean needsToBeSecure = needsToBeSecure( servletContext, request, uri.getPath(), true ); URLRewriterService.rewriteURL( servletContext, request, response, uri, URLType.ACTION, needsToBeSecure ); String key = getURLTemplateKey( URLType.ACTION, needsToBeSecure ); URIContext uriContext = URIContextFactory.getInstance( forXML ); return URLRewriterService.getTemplatedURL( servletContext, request, uri, key, uriContext ); }
[ "public", "static", "String", "getRewrittenActionURI", "(", "ServletContext", "servletContext", ",", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ",", "String", "actionName", ",", "Map", "params", ",", "String", "fragment", ",", "boolean", "forXML", ")", "throws", "URISyntaxException", "{", "MutableURI", "uri", "=", "getActionURI", "(", "servletContext", ",", "request", ",", "response", ",", "actionName", ")", ";", "if", "(", "params", "!=", "null", ")", "uri", ".", "addParameters", "(", "params", ",", "false", ")", ";", "if", "(", "fragment", "!=", "null", ")", "uri", ".", "setFragment", "(", "uri", ".", "encode", "(", "fragment", ")", ")", ";", "boolean", "needsToBeSecure", "=", "needsToBeSecure", "(", "servletContext", ",", "request", ",", "uri", ".", "getPath", "(", ")", ",", "true", ")", ";", "URLRewriterService", ".", "rewriteURL", "(", "servletContext", ",", "request", ",", "response", ",", "uri", ",", "URLType", ".", "ACTION", ",", "needsToBeSecure", ")", ";", "String", "key", "=", "getURLTemplateKey", "(", "URLType", ".", "ACTION", ",", "needsToBeSecure", ")", ";", "URIContext", "uriContext", "=", "URIContextFactory", ".", "getInstance", "(", "forXML", ")", ";", "return", "URLRewriterService", ".", "getTemplatedURL", "(", "servletContext", ",", "request", ",", "uri", ",", "key", ",", "uriContext", ")", ";", "}" ]
Create a fully-rewritten URI given an action name and parameters. @param servletContext the current ServletContext. @param request the current HttpServletRequest. @param response the current HttpServletResponse. @param actionName the action name to convert into a fully-rewritten URI; may be qualified with a path from the webapp root, in which case the parent directory from the current request is <i>not</i> used. @param params the additional parameters to include in the URI query. @param fragment the fragment (anchor or location) for this url. @param forXML flag indicating that the query of the uri should be written using the &quot;&amp;amp;&quot; entity, rather than the character, '&amp;'. @return a fully-rewritten URI for the given action. @throws URISyntaxException if there is a problem converting the action URI (derived from processing the given action name) into a MutableURI.
[ "Create", "a", "fully", "-", "rewritten", "URI", "given", "an", "action", "name", "and", "parameters", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java#L1512-L1527
146,789
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java
PageFlowUtils.needsToBeSecure
public static boolean needsToBeSecure(ServletContext context, ServletRequest request, String uri, boolean stripContextPath) { // Get the web-app relative path for security check String secureCheck = uri; if (stripContextPath) { String contextPath = ((HttpServletRequest) request).getContextPath(); if (secureCheck.startsWith(contextPath)) { secureCheck = secureCheck.substring(contextPath.length()); } } boolean secure = false; if (secureCheck.indexOf('?') > -1) { secureCheck = secureCheck.substring(0, secureCheck.indexOf('?')); } SecurityProtocol sp = getSecurityProtocol(secureCheck, context, (HttpServletRequest) request); if (sp.equals(SecurityProtocol.UNSPECIFIED)) { secure = request.isSecure(); } else { secure = sp.equals(SecurityProtocol.SECURE); } return secure; }
java
public static boolean needsToBeSecure(ServletContext context, ServletRequest request, String uri, boolean stripContextPath) { // Get the web-app relative path for security check String secureCheck = uri; if (stripContextPath) { String contextPath = ((HttpServletRequest) request).getContextPath(); if (secureCheck.startsWith(contextPath)) { secureCheck = secureCheck.substring(contextPath.length()); } } boolean secure = false; if (secureCheck.indexOf('?') > -1) { secureCheck = secureCheck.substring(0, secureCheck.indexOf('?')); } SecurityProtocol sp = getSecurityProtocol(secureCheck, context, (HttpServletRequest) request); if (sp.equals(SecurityProtocol.UNSPECIFIED)) { secure = request.isSecure(); } else { secure = sp.equals(SecurityProtocol.SECURE); } return secure; }
[ "public", "static", "boolean", "needsToBeSecure", "(", "ServletContext", "context", ",", "ServletRequest", "request", ",", "String", "uri", ",", "boolean", "stripContextPath", ")", "{", "// Get the web-app relative path for security check", "String", "secureCheck", "=", "uri", ";", "if", "(", "stripContextPath", ")", "{", "String", "contextPath", "=", "(", "(", "HttpServletRequest", ")", "request", ")", ".", "getContextPath", "(", ")", ";", "if", "(", "secureCheck", ".", "startsWith", "(", "contextPath", ")", ")", "{", "secureCheck", "=", "secureCheck", ".", "substring", "(", "contextPath", ".", "length", "(", ")", ")", ";", "}", "}", "boolean", "secure", "=", "false", ";", "if", "(", "secureCheck", ".", "indexOf", "(", "'", "'", ")", ">", "-", "1", ")", "{", "secureCheck", "=", "secureCheck", ".", "substring", "(", "0", ",", "secureCheck", ".", "indexOf", "(", "'", "'", ")", ")", ";", "}", "SecurityProtocol", "sp", "=", "getSecurityProtocol", "(", "secureCheck", ",", "context", ",", "(", "HttpServletRequest", ")", "request", ")", ";", "if", "(", "sp", ".", "equals", "(", "SecurityProtocol", ".", "UNSPECIFIED", ")", ")", "{", "secure", "=", "request", ".", "isSecure", "(", ")", ";", "}", "else", "{", "secure", "=", "sp", ".", "equals", "(", "SecurityProtocol", ".", "SECURE", ")", ";", "}", "return", "secure", ";", "}" ]
Tell whether a given URI should be written to be secure. @param context the current ServletContext. @param request the current HttpServletRequest. @param uri the URI to check. @param stripContextPath if <code>true</code>, strip the webapp context path from the URI before processing it. @return <code>true</code> when: <ul> <li>the given URI is configured in the deployment descriptor to be secure (according to {@link SecurityProtocol}), or <li>the given URI is not configured in the deployment descriptor, and the current request is secure ({@link HttpServletRequest#isSecure} returns <code>true</code>). </ul> <code>false</code> when: <ul> <li>the given URI is configured explicitly in the deployment descriptor to be unsecure (according to {@link SecurityProtocol}), or <li>the given URI is not configured in the deployment descriptor, and the current request is unsecure ({@link HttpServletRequest#isSecure} returns <code>false</code>). </ul>
[ "Tell", "whether", "a", "given", "URI", "should", "be", "written", "to", "be", "secure", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java#L1649-L1675
146,790
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java
PageFlowUtils.getURLTemplateKey
public static String getURLTemplateKey( URLType urlType, boolean needsToBeSecure ) { String key = URLTemplatesFactory.ACTION_TEMPLATE; if ( urlType.equals( URLType.ACTION ) ) { if ( needsToBeSecure ) { key = URLTemplatesFactory.SECURE_ACTION_TEMPLATE; } else { key = URLTemplatesFactory.ACTION_TEMPLATE; } } else if ( urlType.equals( URLType.RESOURCE ) ) { if ( needsToBeSecure ) { key = URLTemplatesFactory.SECURE_RESOURCE_TEMPLATE; } else { key = URLTemplatesFactory.RESOURCE_TEMPLATE; } } return key; }
java
public static String getURLTemplateKey( URLType urlType, boolean needsToBeSecure ) { String key = URLTemplatesFactory.ACTION_TEMPLATE; if ( urlType.equals( URLType.ACTION ) ) { if ( needsToBeSecure ) { key = URLTemplatesFactory.SECURE_ACTION_TEMPLATE; } else { key = URLTemplatesFactory.ACTION_TEMPLATE; } } else if ( urlType.equals( URLType.RESOURCE ) ) { if ( needsToBeSecure ) { key = URLTemplatesFactory.SECURE_RESOURCE_TEMPLATE; } else { key = URLTemplatesFactory.RESOURCE_TEMPLATE; } } return key; }
[ "public", "static", "String", "getURLTemplateKey", "(", "URLType", "urlType", ",", "boolean", "needsToBeSecure", ")", "{", "String", "key", "=", "URLTemplatesFactory", ".", "ACTION_TEMPLATE", ";", "if", "(", "urlType", ".", "equals", "(", "URLType", ".", "ACTION", ")", ")", "{", "if", "(", "needsToBeSecure", ")", "{", "key", "=", "URLTemplatesFactory", ".", "SECURE_ACTION_TEMPLATE", ";", "}", "else", "{", "key", "=", "URLTemplatesFactory", ".", "ACTION_TEMPLATE", ";", "}", "}", "else", "if", "(", "urlType", ".", "equals", "(", "URLType", ".", "RESOURCE", ")", ")", "{", "if", "(", "needsToBeSecure", ")", "{", "key", "=", "URLTemplatesFactory", ".", "SECURE_RESOURCE_TEMPLATE", ";", "}", "else", "{", "key", "=", "URLTemplatesFactory", ".", "RESOURCE_TEMPLATE", ";", "}", "}", "return", "key", ";", "}" ]
Returns a key for the URL template type given the URL type and a flag indicating a secure URL or not. @param urlType the type of URL (ACTION, RESOURCE). @param needsToBeSecure indicates that the template should be for a secure URL. @return the key/type of template to use.
[ "Returns", "a", "key", "for", "the", "URL", "template", "type", "given", "the", "URL", "type", "and", "a", "flag", "indicating", "a", "secure", "URL", "or", "not", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java#L1685-L1712
146,791
iig-uni-freiburg/SEWOL
src/de/uni/freiburg/iig/telematik/sewol/accesscontrol/rbac/lattice/graphic/RoleGraphEditingPlugin.java
RoleGraphEditingPlugin.mousePressed
@SuppressWarnings("unchecked") public void mousePressed(MouseEvent e) { if(checkModifiers(e)) { final VisualizationViewer<String,String> vv = (VisualizationViewer<String,String>)e.getSource(); final Point2D p = e.getPoint(); GraphElementAccessor<String,String> pickSupport = vv.getPickSupport(); if(pickSupport != null) { final String vertex = pickSupport.getVertex(vv.getModel().getGraphLayout(), p.getX(), p.getY()); if(vertex != null) { // get ready to make an edge startVertex = vertex; down = e.getPoint(); transformEdgeShape(down, down); vv.addPostRenderPaintable(edgePaintable); transformArrowShape(down, e.getPoint()); vv.addPostRenderPaintable(arrowPaintable); } } vv.repaint(); } }
java
@SuppressWarnings("unchecked") public void mousePressed(MouseEvent e) { if(checkModifiers(e)) { final VisualizationViewer<String,String> vv = (VisualizationViewer<String,String>)e.getSource(); final Point2D p = e.getPoint(); GraphElementAccessor<String,String> pickSupport = vv.getPickSupport(); if(pickSupport != null) { final String vertex = pickSupport.getVertex(vv.getModel().getGraphLayout(), p.getX(), p.getY()); if(vertex != null) { // get ready to make an edge startVertex = vertex; down = e.getPoint(); transformEdgeShape(down, down); vv.addPostRenderPaintable(edgePaintable); transformArrowShape(down, e.getPoint()); vv.addPostRenderPaintable(arrowPaintable); } } vv.repaint(); } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "void", "mousePressed", "(", "MouseEvent", "e", ")", "{", "if", "(", "checkModifiers", "(", "e", ")", ")", "{", "final", "VisualizationViewer", "<", "String", ",", "String", ">", "vv", "=", "(", "VisualizationViewer", "<", "String", ",", "String", ">", ")", "e", ".", "getSource", "(", ")", ";", "final", "Point2D", "p", "=", "e", ".", "getPoint", "(", ")", ";", "GraphElementAccessor", "<", "String", ",", "String", ">", "pickSupport", "=", "vv", ".", "getPickSupport", "(", ")", ";", "if", "(", "pickSupport", "!=", "null", ")", "{", "final", "String", "vertex", "=", "pickSupport", ".", "getVertex", "(", "vv", ".", "getModel", "(", ")", ".", "getGraphLayout", "(", ")", ",", "p", ".", "getX", "(", ")", ",", "p", ".", "getY", "(", ")", ")", ";", "if", "(", "vertex", "!=", "null", ")", "{", "// get ready to make an edge", "startVertex", "=", "vertex", ";", "down", "=", "e", ".", "getPoint", "(", ")", ";", "transformEdgeShape", "(", "down", ",", "down", ")", ";", "vv", ".", "addPostRenderPaintable", "(", "edgePaintable", ")", ";", "transformArrowShape", "(", "down", ",", "e", ".", "getPoint", "(", ")", ")", ";", "vv", ".", "addPostRenderPaintable", "(", "arrowPaintable", ")", ";", "}", "}", "vv", ".", "repaint", "(", ")", ";", "}", "}" ]
If the mouse is pressed in an empty area, create a new vertex there. If the mouse is pressed on an existing vertex, prepare to create an edge from that vertex to another
[ "If", "the", "mouse", "is", "pressed", "in", "an", "empty", "area", "create", "a", "new", "vertex", "there", ".", "If", "the", "mouse", "is", "pressed", "on", "an", "existing", "vertex", "prepare", "to", "create", "an", "edge", "from", "that", "vertex", "to", "another" ]
e791cb07a6e62ecf837d760d58a25f32fbf6bbca
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/src/de/uni/freiburg/iig/telematik/sewol/accesscontrol/rbac/lattice/graphic/RoleGraphEditingPlugin.java#L79-L100
146,792
iig-uni-freiburg/SEWOL
src/de/uni/freiburg/iig/telematik/sewol/accesscontrol/rbac/lattice/graphic/RoleGraphEditingPlugin.java
RoleGraphEditingPlugin.mouseReleased
@SuppressWarnings("unchecked") public void mouseReleased(MouseEvent e) { if(checkModifiers(e)) { final VisualizationViewer<String,String> vv = (VisualizationViewer<String,String>)e.getSource(); final Point2D p = e.getPoint(); Layout<String,String> layout = vv.getModel().getGraphLayout(); GraphElementAccessor<String,String> pickSupport = vv.getPickSupport(); if(pickSupport != null) { final String vertex = pickSupport.getVertex(layout, p.getX(), p.getY()); if(vertex != null && startVertex != null) { Graph<String,String> graph = vv.getGraphLayout().getGraph(); try{ if(graph.addEdge(startVertex+"-"+vertex, startVertex, vertex, EdgeType.DIRECTED)){ notifyListeners(startVertex, vertex); } } catch(Exception ex){ ex.printStackTrace(); } } vv.repaint(); } startVertex = null; down = null; vv.removePostRenderPaintable(edgePaintable); vv.removePostRenderPaintable(arrowPaintable); } }
java
@SuppressWarnings("unchecked") public void mouseReleased(MouseEvent e) { if(checkModifiers(e)) { final VisualizationViewer<String,String> vv = (VisualizationViewer<String,String>)e.getSource(); final Point2D p = e.getPoint(); Layout<String,String> layout = vv.getModel().getGraphLayout(); GraphElementAccessor<String,String> pickSupport = vv.getPickSupport(); if(pickSupport != null) { final String vertex = pickSupport.getVertex(layout, p.getX(), p.getY()); if(vertex != null && startVertex != null) { Graph<String,String> graph = vv.getGraphLayout().getGraph(); try{ if(graph.addEdge(startVertex+"-"+vertex, startVertex, vertex, EdgeType.DIRECTED)){ notifyListeners(startVertex, vertex); } } catch(Exception ex){ ex.printStackTrace(); } } vv.repaint(); } startVertex = null; down = null; vv.removePostRenderPaintable(edgePaintable); vv.removePostRenderPaintable(arrowPaintable); } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "void", "mouseReleased", "(", "MouseEvent", "e", ")", "{", "if", "(", "checkModifiers", "(", "e", ")", ")", "{", "final", "VisualizationViewer", "<", "String", ",", "String", ">", "vv", "=", "(", "VisualizationViewer", "<", "String", ",", "String", ">", ")", "e", ".", "getSource", "(", ")", ";", "final", "Point2D", "p", "=", "e", ".", "getPoint", "(", ")", ";", "Layout", "<", "String", ",", "String", ">", "layout", "=", "vv", ".", "getModel", "(", ")", ".", "getGraphLayout", "(", ")", ";", "GraphElementAccessor", "<", "String", ",", "String", ">", "pickSupport", "=", "vv", ".", "getPickSupport", "(", ")", ";", "if", "(", "pickSupport", "!=", "null", ")", "{", "final", "String", "vertex", "=", "pickSupport", ".", "getVertex", "(", "layout", ",", "p", ".", "getX", "(", ")", ",", "p", ".", "getY", "(", ")", ")", ";", "if", "(", "vertex", "!=", "null", "&&", "startVertex", "!=", "null", ")", "{", "Graph", "<", "String", ",", "String", ">", "graph", "=", "vv", ".", "getGraphLayout", "(", ")", ".", "getGraph", "(", ")", ";", "try", "{", "if", "(", "graph", ".", "addEdge", "(", "startVertex", "+", "\"-\"", "+", "vertex", ",", "startVertex", ",", "vertex", ",", "EdgeType", ".", "DIRECTED", ")", ")", "{", "notifyListeners", "(", "startVertex", ",", "vertex", ")", ";", "}", "}", "catch", "(", "Exception", "ex", ")", "{", "ex", ".", "printStackTrace", "(", ")", ";", "}", "}", "vv", ".", "repaint", "(", ")", ";", "}", "startVertex", "=", "null", ";", "down", "=", "null", ";", "vv", ".", "removePostRenderPaintable", "(", "edgePaintable", ")", ";", "vv", ".", "removePostRenderPaintable", "(", "arrowPaintable", ")", ";", "}", "}" ]
If startVertex is non-null, and the mouse is released over an existing vertex, create an undirected edge from startVertex to the vertex under the mouse pointer. If shift was also pressed, create a directed edge instead.
[ "If", "startVertex", "is", "non", "-", "null", "and", "the", "mouse", "is", "released", "over", "an", "existing", "vertex", "create", "an", "undirected", "edge", "from", "startVertex", "to", "the", "vertex", "under", "the", "mouse", "pointer", ".", "If", "shift", "was", "also", "pressed", "create", "a", "directed", "edge", "instead", "." ]
e791cb07a6e62ecf837d760d58a25f32fbf6bbca
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/src/de/uni/freiburg/iig/telematik/sewol/accesscontrol/rbac/lattice/graphic/RoleGraphEditingPlugin.java#L108-L134
146,793
iig-uni-freiburg/SEWOL
src/de/uni/freiburg/iig/telematik/sewol/accesscontrol/rbac/lattice/graphic/RoleGraphEditingPlugin.java
RoleGraphEditingPlugin.mouseDragged
@SuppressWarnings("unchecked") public void mouseDragged(MouseEvent e) { if(checkModifiers(e)) { if(startVertex != null) { transformEdgeShape(down, e.getPoint()); transformArrowShape(down, e.getPoint()); } VisualizationViewer<String,String> vv = (VisualizationViewer<String,String>)e.getSource(); vv.repaint(); } }
java
@SuppressWarnings("unchecked") public void mouseDragged(MouseEvent e) { if(checkModifiers(e)) { if(startVertex != null) { transformEdgeShape(down, e.getPoint()); transformArrowShape(down, e.getPoint()); } VisualizationViewer<String,String> vv = (VisualizationViewer<String,String>)e.getSource(); vv.repaint(); } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "void", "mouseDragged", "(", "MouseEvent", "e", ")", "{", "if", "(", "checkModifiers", "(", "e", ")", ")", "{", "if", "(", "startVertex", "!=", "null", ")", "{", "transformEdgeShape", "(", "down", ",", "e", ".", "getPoint", "(", ")", ")", ";", "transformArrowShape", "(", "down", ",", "e", ".", "getPoint", "(", ")", ")", ";", "}", "VisualizationViewer", "<", "String", ",", "String", ">", "vv", "=", "(", "VisualizationViewer", "<", "String", ",", "String", ">", ")", "e", ".", "getSource", "(", ")", ";", "vv", ".", "repaint", "(", ")", ";", "}", "}" ]
If startVertex is non-null, stretch an edge shape between startVertex and the mouse pointer to simulate edge creation
[ "If", "startVertex", "is", "non", "-", "null", "stretch", "an", "edge", "shape", "between", "startVertex", "and", "the", "mouse", "pointer", "to", "simulate", "edge", "creation" ]
e791cb07a6e62ecf837d760d58a25f32fbf6bbca
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/src/de/uni/freiburg/iig/telematik/sewol/accesscontrol/rbac/lattice/graphic/RoleGraphEditingPlugin.java#L146-L157
146,794
iig-uni-freiburg/SEWOL
src/de/uni/freiburg/iig/telematik/sewol/accesscontrol/rbac/lattice/graphic/RoleGraphEditingPlugin.java
RoleGraphEditingPlugin.transformEdgeShape
private void transformEdgeShape(Point2D down, Point2D out) { float x1 = (float) down.getX(); float y1 = (float) down.getY(); float x2 = (float) out.getX(); float y2 = (float) out.getY(); AffineTransform xform = AffineTransform.getTranslateInstance(x1, y1); float dx = x2-x1; float dy = y2-y1; float thetaRadians = (float) Math.atan2(dy, dx); xform.rotate(thetaRadians); float dist = (float) Math.sqrt(dx*dx + dy*dy); xform.scale(dist / rawEdge.getBounds().getWidth(), 1.0); edgeShape = xform.createTransformedShape(rawEdge); }
java
private void transformEdgeShape(Point2D down, Point2D out) { float x1 = (float) down.getX(); float y1 = (float) down.getY(); float x2 = (float) out.getX(); float y2 = (float) out.getY(); AffineTransform xform = AffineTransform.getTranslateInstance(x1, y1); float dx = x2-x1; float dy = y2-y1; float thetaRadians = (float) Math.atan2(dy, dx); xform.rotate(thetaRadians); float dist = (float) Math.sqrt(dx*dx + dy*dy); xform.scale(dist / rawEdge.getBounds().getWidth(), 1.0); edgeShape = xform.createTransformedShape(rawEdge); }
[ "private", "void", "transformEdgeShape", "(", "Point2D", "down", ",", "Point2D", "out", ")", "{", "float", "x1", "=", "(", "float", ")", "down", ".", "getX", "(", ")", ";", "float", "y1", "=", "(", "float", ")", "down", ".", "getY", "(", ")", ";", "float", "x2", "=", "(", "float", ")", "out", ".", "getX", "(", ")", ";", "float", "y2", "=", "(", "float", ")", "out", ".", "getY", "(", ")", ";", "AffineTransform", "xform", "=", "AffineTransform", ".", "getTranslateInstance", "(", "x1", ",", "y1", ")", ";", "float", "dx", "=", "x2", "-", "x1", ";", "float", "dy", "=", "y2", "-", "y1", ";", "float", "thetaRadians", "=", "(", "float", ")", "Math", ".", "atan2", "(", "dy", ",", "dx", ")", ";", "xform", ".", "rotate", "(", "thetaRadians", ")", ";", "float", "dist", "=", "(", "float", ")", "Math", ".", "sqrt", "(", "dx", "*", "dx", "+", "dy", "*", "dy", ")", ";", "xform", ".", "scale", "(", "dist", "/", "rawEdge", ".", "getBounds", "(", ")", ".", "getWidth", "(", ")", ",", "1.0", ")", ";", "edgeShape", "=", "xform", ".", "createTransformedShape", "(", "rawEdge", ")", ";", "}" ]
code lifted from PluggableRenderer to move an edge shape into an arbitrary position
[ "code", "lifted", "from", "PluggableRenderer", "to", "move", "an", "edge", "shape", "into", "an", "arbitrary", "position" ]
e791cb07a6e62ecf837d760d58a25f32fbf6bbca
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/src/de/uni/freiburg/iig/telematik/sewol/accesscontrol/rbac/lattice/graphic/RoleGraphEditingPlugin.java#L163-L178
146,795
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/internal/ReturnActionViewRenderer.java
ReturnActionViewRenderer.init
public void init(ServletRequest request) { String[] vals = request.getParameterValues(ITEM_PARAM); if (vals != null) { _retrieveMap = new HashMap(); for (int i = 0; i < vals.length; i++) { String val = vals[i]; int delimPos = val.indexOf(DELIM); if (delimPos != -1) { String expressionToRetrieve = val.substring(0, delimPos); String fieldID = val.substring(delimPos + 1); _retrieveMap.put(fieldID, expressionToRetrieve); } } } _callbackFunc = request.getParameter(CALLBACK_PARAM); }
java
public void init(ServletRequest request) { String[] vals = request.getParameterValues(ITEM_PARAM); if (vals != null) { _retrieveMap = new HashMap(); for (int i = 0; i < vals.length; i++) { String val = vals[i]; int delimPos = val.indexOf(DELIM); if (delimPos != -1) { String expressionToRetrieve = val.substring(0, delimPos); String fieldID = val.substring(delimPos + 1); _retrieveMap.put(fieldID, expressionToRetrieve); } } } _callbackFunc = request.getParameter(CALLBACK_PARAM); }
[ "public", "void", "init", "(", "ServletRequest", "request", ")", "{", "String", "[", "]", "vals", "=", "request", ".", "getParameterValues", "(", "ITEM_PARAM", ")", ";", "if", "(", "vals", "!=", "null", ")", "{", "_retrieveMap", "=", "new", "HashMap", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "vals", ".", "length", ";", "i", "++", ")", "{", "String", "val", "=", "vals", "[", "i", "]", ";", "int", "delimPos", "=", "val", ".", "indexOf", "(", "DELIM", ")", ";", "if", "(", "delimPos", "!=", "-", "1", ")", "{", "String", "expressionToRetrieve", "=", "val", ".", "substring", "(", "0", ",", "delimPos", ")", ";", "String", "fieldID", "=", "val", ".", "substring", "(", "delimPos", "+", "1", ")", ";", "_retrieveMap", ".", "put", "(", "fieldID", ",", "expressionToRetrieve", ")", ";", "}", "}", "}", "_callbackFunc", "=", "request", ".", "getParameter", "(", "CALLBACK_PARAM", ")", ";", "}" ]
Initialize, based on request parameters we're looking for.
[ "Initialize", "based", "on", "request", "parameters", "we", "re", "looking", "for", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/internal/ReturnActionViewRenderer.java#L75-L94
146,796
iig-uni-freiburg/SEWOL
src/de/uni/freiburg/iig/telematik/sewol/log/LogViewSerialization.java
LogViewSerialization.write
public static void write(LogView logView, String path) throws IOException { String xml = xstream.toXML(logView); try (BufferedWriter out = new BufferedWriter(new FileWriter(path))) { out.write(xml); } }
java
public static void write(LogView logView, String path) throws IOException { String xml = xstream.toXML(logView); try (BufferedWriter out = new BufferedWriter(new FileWriter(path))) { out.write(xml); } }
[ "public", "static", "void", "write", "(", "LogView", "logView", ",", "String", "path", ")", "throws", "IOException", "{", "String", "xml", "=", "xstream", ".", "toXML", "(", "logView", ")", ";", "try", "(", "BufferedWriter", "out", "=", "new", "BufferedWriter", "(", "new", "FileWriter", "(", "path", ")", ")", ")", "{", "out", ".", "write", "(", "xml", ")", ";", "}", "}" ]
Serializes the log view under the given path. @param logView Log view to serialize. @param path Target path of the serialized log view. @throws IOException If the log view can't be written under the given path.
[ "Serializes", "the", "log", "view", "under", "the", "given", "path", "." ]
e791cb07a6e62ecf837d760d58a25f32fbf6bbca
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/src/de/uni/freiburg/iig/telematik/sewol/log/LogViewSerialization.java#L160-L165
146,797
iig-uni-freiburg/SEWOL
ext/org/deckfour/xes/model/buffered/XTraceBufferedImpl.java
XTraceBufferedImpl.insertOrdered
public int insertOrdered(XEvent event) { try { return events.insertOrdered(event); } catch (IOException e) { e.printStackTrace(); return -1; } }
java
public int insertOrdered(XEvent event) { try { return events.insertOrdered(event); } catch (IOException e) { e.printStackTrace(); return -1; } }
[ "public", "int", "insertOrdered", "(", "XEvent", "event", ")", "{", "try", "{", "return", "events", ".", "insertOrdered", "(", "event", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "return", "-", "1", ";", "}", "}" ]
Insert the event in an ordered manner, if timestamp information is available in this trace. @param event the event to be inserted. @return index of the inserted event.
[ "Insert", "the", "event", "in", "an", "ordered", "manner", "if", "timestamp", "information", "is", "available", "in", "this", "trace", "." ]
e791cb07a6e62ecf837d760d58a25f32fbf6bbca
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/ext/org/deckfour/xes/model/buffered/XTraceBufferedImpl.java#L552-L559
146,798
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/spi/bean/JavaControlFactory.java
JavaControlFactory.instantiate
public <T extends ControlBean> T instantiate(Class<T> beanClass, PropertyMap props, ControlBeanContext context, String id) { String beanClassName = beanClass.getName(); String extImplBinding = _extImplBindings.getProperty( beanClassName + "_" + id ); if ( extImplBinding == null ) extImplBinding = _extImplBindings.getProperty( beanClassName ); if ( extImplBinding != null ) { BeanPropertyMap bpm = props == null ? new BeanPropertyMap( beanClass ) : new BeanPropertyMap( props ); PropertyKey propKey = new PropertyKey(org.apache.beehive.controls.api.properties.BaseProperties.class, KEY_CONTROL_IMPLEMENTATION); bpm.setProperty( propKey, extImplBinding ); props = bpm; } T ret = null; try { Constructor<T> ctor = _constructors.get(beanClass); if (ctor == null) { ctor = beanClass.getConstructor(ControlBeanContext.class, String.class, PropertyMap.class); _constructors.put(beanClass, ctor); } ret = ctor.newInstance(context, id, props); } catch (InvocationTargetException ite) { Throwable t = ite.getCause(); throw new ControlException("ControlBean constructor exception", t); } catch (Exception e) { throw new ControlException("Exception creating ControlBean", e); } return ret; }
java
public <T extends ControlBean> T instantiate(Class<T> beanClass, PropertyMap props, ControlBeanContext context, String id) { String beanClassName = beanClass.getName(); String extImplBinding = _extImplBindings.getProperty( beanClassName + "_" + id ); if ( extImplBinding == null ) extImplBinding = _extImplBindings.getProperty( beanClassName ); if ( extImplBinding != null ) { BeanPropertyMap bpm = props == null ? new BeanPropertyMap( beanClass ) : new BeanPropertyMap( props ); PropertyKey propKey = new PropertyKey(org.apache.beehive.controls.api.properties.BaseProperties.class, KEY_CONTROL_IMPLEMENTATION); bpm.setProperty( propKey, extImplBinding ); props = bpm; } T ret = null; try { Constructor<T> ctor = _constructors.get(beanClass); if (ctor == null) { ctor = beanClass.getConstructor(ControlBeanContext.class, String.class, PropertyMap.class); _constructors.put(beanClass, ctor); } ret = ctor.newInstance(context, id, props); } catch (InvocationTargetException ite) { Throwable t = ite.getCause(); throw new ControlException("ControlBean constructor exception", t); } catch (Exception e) { throw new ControlException("Exception creating ControlBean", e); } return ret; }
[ "public", "<", "T", "extends", "ControlBean", ">", "T", "instantiate", "(", "Class", "<", "T", ">", "beanClass", ",", "PropertyMap", "props", ",", "ControlBeanContext", "context", ",", "String", "id", ")", "{", "String", "beanClassName", "=", "beanClass", ".", "getName", "(", ")", ";", "String", "extImplBinding", "=", "_extImplBindings", ".", "getProperty", "(", "beanClassName", "+", "\"_\"", "+", "id", ")", ";", "if", "(", "extImplBinding", "==", "null", ")", "extImplBinding", "=", "_extImplBindings", ".", "getProperty", "(", "beanClassName", ")", ";", "if", "(", "extImplBinding", "!=", "null", ")", "{", "BeanPropertyMap", "bpm", "=", "props", "==", "null", "?", "new", "BeanPropertyMap", "(", "beanClass", ")", ":", "new", "BeanPropertyMap", "(", "props", ")", ";", "PropertyKey", "propKey", "=", "new", "PropertyKey", "(", "org", ".", "apache", ".", "beehive", ".", "controls", ".", "api", ".", "properties", ".", "BaseProperties", ".", "class", ",", "KEY_CONTROL_IMPLEMENTATION", ")", ";", "bpm", ".", "setProperty", "(", "propKey", ",", "extImplBinding", ")", ";", "props", "=", "bpm", ";", "}", "T", "ret", "=", "null", ";", "try", "{", "Constructor", "<", "T", ">", "ctor", "=", "_constructors", ".", "get", "(", "beanClass", ")", ";", "if", "(", "ctor", "==", "null", ")", "{", "ctor", "=", "beanClass", ".", "getConstructor", "(", "ControlBeanContext", ".", "class", ",", "String", ".", "class", ",", "PropertyMap", ".", "class", ")", ";", "_constructors", ".", "put", "(", "beanClass", ",", "ctor", ")", ";", "}", "ret", "=", "ctor", ".", "newInstance", "(", "context", ",", "id", ",", "props", ")", ";", "}", "catch", "(", "InvocationTargetException", "ite", ")", "{", "Throwable", "t", "=", "ite", ".", "getCause", "(", ")", ";", "throw", "new", "ControlException", "(", "\"ControlBean constructor exception\"", ",", "t", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "ControlException", "(", "\"Exception creating ControlBean\"", ",", "e", ")", ";", "}", "return", "ret", ";", "}" ]
Instantiates a new ControlBean of the requested class, using mechanisms provided by a provider-specific JavaBeans framework. @param beanClass the ControlBean class to instantiate @param props an initial set of client-specified properties to associate with the bean instance. May be null. @param context the containing ControlBeanContext for the bean, if nested inside of a container or other control. May be null to use the current active execution context. @param id the bean control ID. Must be unique within the containing context. If null, a unique identifier will be auto-generated. @return a new ControlBean instance of the requested class.
[ "Instantiates", "a", "new", "ControlBean", "of", "the", "requested", "class", "using", "mechanisms", "provided", "by", "a", "provider", "-", "specific", "JavaBeans", "framework", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/spi/bean/JavaControlFactory.java#L86-L132
146,799
moparisthebest/beehive
beehive-jdbc-control/src/main/java/org/apache/beehive/controls/system/jdbc/parser/ParameterChecker.java
ParameterChecker.checkReflectionParameters
public static void checkReflectionParameters(SqlFragmentContainer statement, MethodDeclaration methodDecl) { ArrayList<ParameterDeclaration> params = new ArrayList<ParameterDeclaration>(methodDecl.getParameters()); HashMap<String, ParameterDeclaration> paramMap = new HashMap<String, ParameterDeclaration>(); // don't run these checks if this is a compiled class file (method names replaced with arg0, arg1, etc) if (params.size() > 0 && params.get(0).getSimpleName().equals("arg0")) { return; } for (int i = 0; i < params.size(); i++) { paramMap.put(params.get(i).getSimpleName(), params.get(i)); } doCheck(statement, paramMap, methodDecl); }
java
public static void checkReflectionParameters(SqlFragmentContainer statement, MethodDeclaration methodDecl) { ArrayList<ParameterDeclaration> params = new ArrayList<ParameterDeclaration>(methodDecl.getParameters()); HashMap<String, ParameterDeclaration> paramMap = new HashMap<String, ParameterDeclaration>(); // don't run these checks if this is a compiled class file (method names replaced with arg0, arg1, etc) if (params.size() > 0 && params.get(0).getSimpleName().equals("arg0")) { return; } for (int i = 0; i < params.size(); i++) { paramMap.put(params.get(i).getSimpleName(), params.get(i)); } doCheck(statement, paramMap, methodDecl); }
[ "public", "static", "void", "checkReflectionParameters", "(", "SqlFragmentContainer", "statement", ",", "MethodDeclaration", "methodDecl", ")", "{", "ArrayList", "<", "ParameterDeclaration", ">", "params", "=", "new", "ArrayList", "<", "ParameterDeclaration", ">", "(", "methodDecl", ".", "getParameters", "(", ")", ")", ";", "HashMap", "<", "String", ",", "ParameterDeclaration", ">", "paramMap", "=", "new", "HashMap", "<", "String", ",", "ParameterDeclaration", ">", "(", ")", ";", "// don't run these checks if this is a compiled class file (method names replaced with arg0, arg1, etc)", "if", "(", "params", ".", "size", "(", ")", ">", "0", "&&", "params", ".", "get", "(", "0", ")", ".", "getSimpleName", "(", ")", ".", "equals", "(", "\"arg0\"", ")", ")", "{", "return", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "params", ".", "size", "(", ")", ";", "i", "++", ")", "{", "paramMap", ".", "put", "(", "params", ".", "get", "(", "i", ")", ".", "getSimpleName", "(", ")", ",", "params", ".", "get", "(", "i", ")", ")", ";", "}", "doCheck", "(", "statement", ",", "paramMap", ",", "methodDecl", ")", ";", "}" ]
Verify that all reflection parameters in the statement element can be mapped to method parameters. @param statement The parsed statement element. @param methodDecl The method declaration which was annotated.
[ "Verify", "that", "all", "reflection", "parameters", "in", "the", "statement", "element", "can", "be", "mapped", "to", "method", "parameters", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-jdbc-control/src/main/java/org/apache/beehive/controls/system/jdbc/parser/ParameterChecker.java#L50-L66