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,500
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/bean/ControlBean.java
ControlBean.getControlProperty
protected Object getControlProperty(PropertyKey key) { Object value = getRawControlProperty(key); // If the held value is a PropertyMap, then wrap it in an annotation proxy of // the expected type. if (value instanceof PropertyMap) { PropertyMap map = (PropertyMap)value; value = PropertySetProxy.getProxy(map.getMapClass(), map); } return value; }
java
protected Object getControlProperty(PropertyKey key) { Object value = getRawControlProperty(key); // If the held value is a PropertyMap, then wrap it in an annotation proxy of // the expected type. if (value instanceof PropertyMap) { PropertyMap map = (PropertyMap)value; value = PropertySetProxy.getProxy(map.getMapClass(), map); } return value; }
[ "protected", "Object", "getControlProperty", "(", "PropertyKey", "key", ")", "{", "Object", "value", "=", "getRawControlProperty", "(", "key", ")", ";", "// If the held value is a PropertyMap, then wrap it in an annotation proxy of", "// the expected type.", "if", "(", "value", "instanceof", "PropertyMap", ")", "{", "PropertyMap", "map", "=", "(", "PropertyMap", ")", "value", ";", "value", "=", "PropertySetProxy", ".", "getProxy", "(", "map", ".", "getMapClass", "(", ")", ",", "map", ")", ";", "}", "return", "value", ";", "}" ]
Returns a property on the ControlBean instance. All generated property getter methods will delegate down to this method
[ "Returns", "a", "property", "on", "the", "ControlBean", "instance", ".", "All", "generated", "property", "getter", "methods", "will", "delegate", "down", "to", "this", "method" ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/bean/ControlBean.java#L707-L720
146,501
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/bean/ControlBean.java
ControlBean.getAnnotationMap
protected PropertyMap getAnnotationMap(AnnotatedElement annotElem) { Map annotCache = getPropertyMapCache(); // If in the cache already , just return it if (annotCache.containsKey(annotElem)) return (PropertyMap)annotCache.get(annotElem); // // Ask the associated ControlBeanContext to locate and initialize a PropertyMap, then // store it in the local cache. // PropertyMap map = getControlBeanContext().getAnnotationMap(annotElem); annotCache.put(annotElem, map); return map; }
java
protected PropertyMap getAnnotationMap(AnnotatedElement annotElem) { Map annotCache = getPropertyMapCache(); // If in the cache already , just return it if (annotCache.containsKey(annotElem)) return (PropertyMap)annotCache.get(annotElem); // // Ask the associated ControlBeanContext to locate and initialize a PropertyMap, then // store it in the local cache. // PropertyMap map = getControlBeanContext().getAnnotationMap(annotElem); annotCache.put(annotElem, map); return map; }
[ "protected", "PropertyMap", "getAnnotationMap", "(", "AnnotatedElement", "annotElem", ")", "{", "Map", "annotCache", "=", "getPropertyMapCache", "(", ")", ";", "// If in the cache already , just return it", "if", "(", "annotCache", ".", "containsKey", "(", "annotElem", ")", ")", "return", "(", "PropertyMap", ")", "annotCache", ".", "get", "(", "annotElem", ")", ";", "//", "// Ask the associated ControlBeanContext to locate and initialize a PropertyMap, then", "// store it in the local cache.", "//", "PropertyMap", "map", "=", "getControlBeanContext", "(", ")", ".", "getAnnotationMap", "(", "annotElem", ")", ";", "annotCache", ".", "put", "(", "annotElem", ",", "map", ")", ";", "return", "map", ";", "}" ]
Returns the PropertyMap containing values associated with an AnnotatedElement. Elements that are associated with the bean's Control interface will be locally cached.
[ "Returns", "the", "PropertyMap", "containing", "values", "associated", "with", "an", "AnnotatedElement", ".", "Elements", "that", "are", "associated", "with", "the", "bean", "s", "Control", "interface", "will", "be", "locally", "cached", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/bean/ControlBean.java#L732-L748
146,502
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/bean/ControlBean.java
ControlBean.firePropertyChange
protected void firePropertyChange(PropertyKey propertyKey, Object oldValue, Object newValue) { // No change support instance means no listeners if (_changeSupport == null) return; _changeSupport.firePropertyChange(propertyKey.getPropertyName(), oldValue, newValue); }
java
protected void firePropertyChange(PropertyKey propertyKey, Object oldValue, Object newValue) { // No change support instance means no listeners if (_changeSupport == null) return; _changeSupport.firePropertyChange(propertyKey.getPropertyName(), oldValue, newValue); }
[ "protected", "void", "firePropertyChange", "(", "PropertyKey", "propertyKey", ",", "Object", "oldValue", ",", "Object", "newValue", ")", "{", "// No change support instance means no listeners", "if", "(", "_changeSupport", "==", "null", ")", "return", ";", "_changeSupport", ".", "firePropertyChange", "(", "propertyKey", ".", "getPropertyName", "(", ")", ",", "oldValue", ",", "newValue", ")", ";", "}" ]
Delivers a PropertyChangeEvent to any registered PropertyChangeListeners associated with the property referenced by the specified key. This method *should not* be synchronized, as the PropertyChangeSupport has its own built in synchronization mechanisms.
[ "Delivers", "a", "PropertyChangeEvent", "to", "any", "registered", "PropertyChangeListeners", "associated", "with", "the", "property", "referenced", "by", "the", "specified", "key", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/bean/ControlBean.java#L779-L786
146,503
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/bean/ControlBean.java
ControlBean.fireVetoableChange
protected void fireVetoableChange(PropertyKey propertyKey, Object oldValue, Object newValue) throws java.beans.PropertyVetoException { // No veto support instance means no listeners if (_vetoSupport == null) return; _vetoSupport.fireVetoableChange(propertyKey.getPropertyName(), oldValue, newValue); }
java
protected void fireVetoableChange(PropertyKey propertyKey, Object oldValue, Object newValue) throws java.beans.PropertyVetoException { // No veto support instance means no listeners if (_vetoSupport == null) return; _vetoSupport.fireVetoableChange(propertyKey.getPropertyName(), oldValue, newValue); }
[ "protected", "void", "fireVetoableChange", "(", "PropertyKey", "propertyKey", ",", "Object", "oldValue", ",", "Object", "newValue", ")", "throws", "java", ".", "beans", ".", "PropertyVetoException", "{", "// No veto support instance means no listeners", "if", "(", "_vetoSupport", "==", "null", ")", "return", ";", "_vetoSupport", ".", "fireVetoableChange", "(", "propertyKey", ".", "getPropertyName", "(", ")", ",", "oldValue", ",", "newValue", ")", ";", "}" ]
Delivers a PropertyChangeEvent to any registered VetoableChangeListeners associated with the property referenced by the specified key. This method *should not* be synchronized, as the VetoableChangeSupport has its own built in synchronization mechanisms.
[ "Delivers", "a", "PropertyChangeEvent", "to", "any", "registered", "VetoableChangeListeners", "associated", "with", "the", "property", "referenced", "by", "the", "specified", "key", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/bean/ControlBean.java#L809-L817
146,504
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/bean/ControlBean.java
ControlBean.writeObject
private synchronized void writeObject(ObjectOutputStream oos) throws IOException { if (_control != null) { // // If the implementation class is marked as transient/stateless, then reset the // reference to it prior to serialization. A new instance will be created by // ensureControl() upon first use after deserialization. // If the implementation class is not transient, then invoke the ImplInitializer // resetServices method to reset all contextual service references to null, as // contextual services should never be serializated and always reassociated on // deserialization. // ControlImplementation implAnnot = (ControlImplementation)_implClass.getAnnotation(ControlImplementation.class); assert implAnnot != null; if (implAnnot.isTransient()) { _control = null; } else { getImplInitializer().resetServices(this, _control); _hasServices = false; } } oos.defaultWriteObject(); }
java
private synchronized void writeObject(ObjectOutputStream oos) throws IOException { if (_control != null) { // // If the implementation class is marked as transient/stateless, then reset the // reference to it prior to serialization. A new instance will be created by // ensureControl() upon first use after deserialization. // If the implementation class is not transient, then invoke the ImplInitializer // resetServices method to reset all contextual service references to null, as // contextual services should never be serializated and always reassociated on // deserialization. // ControlImplementation implAnnot = (ControlImplementation)_implClass.getAnnotation(ControlImplementation.class); assert implAnnot != null; if (implAnnot.isTransient()) { _control = null; } else { getImplInitializer().resetServices(this, _control); _hasServices = false; } } oos.defaultWriteObject(); }
[ "private", "synchronized", "void", "writeObject", "(", "ObjectOutputStream", "oos", ")", "throws", "IOException", "{", "if", "(", "_control", "!=", "null", ")", "{", "//", "// If the implementation class is marked as transient/stateless, then reset the", "// reference to it prior to serialization. A new instance will be created by", "// ensureControl() upon first use after deserialization.", "// If the implementation class is not transient, then invoke the ImplInitializer", "// resetServices method to reset all contextual service references to null, as", "// contextual services should never be serializated and always reassociated on ", "// deserialization.", "//", "ControlImplementation", "implAnnot", "=", "(", "ControlImplementation", ")", "_implClass", ".", "getAnnotation", "(", "ControlImplementation", ".", "class", ")", ";", "assert", "implAnnot", "!=", "null", ";", "if", "(", "implAnnot", ".", "isTransient", "(", ")", ")", "{", "_control", "=", "null", ";", "}", "else", "{", "getImplInitializer", "(", ")", ".", "resetServices", "(", "this", ",", "_control", ")", ";", "_hasServices", "=", "false", ";", "}", "}", "oos", ".", "defaultWriteObject", "(", ")", ";", "}" ]
Implementation of the Java serialization writeObject method
[ "Implementation", "of", "the", "Java", "serialization", "writeObject", "method" ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/bean/ControlBean.java#L885-L913
146,505
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/bean/ControlBean.java
ControlBean.ensureInterceptor
protected Interceptor ensureInterceptor( String n ) { Interceptor i = null; if ( _interceptors == null ) { _interceptors = new HashMap<String,Interceptor>(); } else { i = _interceptors.get( n ); } if ( i == null ) { try { i = (Interceptor) getControlService( getControlBeanContext().getClassLoader().loadClass( n ), null ); } catch ( Exception e ) { // Couldn't instantiate the desired service; usually this is because the service interface itself // isn't present on this system at runtime (ClassNotFoundException), or if the container of the // control didn't registers the service. /* TODO log a message here to that effect, but just swallow the exception for now. */ } finally { // We want to always return an interceptor, so if we can't get the one we want, we'll substitute // a "null" interceptor that does nothing. if ( i == null) i = new NullInterceptor(); _interceptors.put( n, i ); } } return i; }
java
protected Interceptor ensureInterceptor( String n ) { Interceptor i = null; if ( _interceptors == null ) { _interceptors = new HashMap<String,Interceptor>(); } else { i = _interceptors.get( n ); } if ( i == null ) { try { i = (Interceptor) getControlService( getControlBeanContext().getClassLoader().loadClass( n ), null ); } catch ( Exception e ) { // Couldn't instantiate the desired service; usually this is because the service interface itself // isn't present on this system at runtime (ClassNotFoundException), or if the container of the // control didn't registers the service. /* TODO log a message here to that effect, but just swallow the exception for now. */ } finally { // We want to always return an interceptor, so if we can't get the one we want, we'll substitute // a "null" interceptor that does nothing. if ( i == null) i = new NullInterceptor(); _interceptors.put( n, i ); } } return i; }
[ "protected", "Interceptor", "ensureInterceptor", "(", "String", "n", ")", "{", "Interceptor", "i", "=", "null", ";", "if", "(", "_interceptors", "==", "null", ")", "{", "_interceptors", "=", "new", "HashMap", "<", "String", ",", "Interceptor", ">", "(", ")", ";", "}", "else", "{", "i", "=", "_interceptors", ".", "get", "(", "n", ")", ";", "}", "if", "(", "i", "==", "null", ")", "{", "try", "{", "i", "=", "(", "Interceptor", ")", "getControlService", "(", "getControlBeanContext", "(", ")", ".", "getClassLoader", "(", ")", ".", "loadClass", "(", "n", ")", ",", "null", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "// Couldn't instantiate the desired service; usually this is because the service interface itself", "// isn't present on this system at runtime (ClassNotFoundException), or if the container of the", "// control didn't registers the service.", "/* TODO log a message here to that effect, but just swallow the exception for now. */", "}", "finally", "{", "// We want to always return an interceptor, so if we can't get the one we want, we'll substitute", "// a \"null\" interceptor that does nothing.", "if", "(", "i", "==", "null", ")", "i", "=", "new", "NullInterceptor", "(", ")", ";", "_interceptors", ".", "put", "(", "n", ",", "i", ")", ";", "}", "}", "return", "i", ";", "}" ]
Retrieves interceptor instances, creates them lazily.
[ "Retrieves", "interceptor", "instances", "creates", "them", "lazily", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/bean/ControlBean.java#L963-L1000
146,506
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptPropertySet.java
AptPropertySet.initProperties
protected ArrayList<AptProperty> initProperties() { ArrayList<AptProperty> properties = new ArrayList<AptProperty>(); if (_propertySet == null || _propertySet.getMethods() == null ) return properties; // Add all declared method, but ignore the mystery <clinit> methods for (MethodDeclaration methodDecl : _propertySet.getMethods()) if (!methodDecl.toString().equals("<clinit>()")) properties.add( new AptProperty(this,(AnnotationTypeElementDeclaration)methodDecl,_ap)); return properties; }
java
protected ArrayList<AptProperty> initProperties() { ArrayList<AptProperty> properties = new ArrayList<AptProperty>(); if (_propertySet == null || _propertySet.getMethods() == null ) return properties; // Add all declared method, but ignore the mystery <clinit> methods for (MethodDeclaration methodDecl : _propertySet.getMethods()) if (!methodDecl.toString().equals("<clinit>()")) properties.add( new AptProperty(this,(AnnotationTypeElementDeclaration)methodDecl,_ap)); return properties; }
[ "protected", "ArrayList", "<", "AptProperty", ">", "initProperties", "(", ")", "{", "ArrayList", "<", "AptProperty", ">", "properties", "=", "new", "ArrayList", "<", "AptProperty", ">", "(", ")", ";", "if", "(", "_propertySet", "==", "null", "||", "_propertySet", ".", "getMethods", "(", ")", "==", "null", ")", "return", "properties", ";", "// Add all declared method, but ignore the mystery <clinit> methods", "for", "(", "MethodDeclaration", "methodDecl", ":", "_propertySet", ".", "getMethods", "(", ")", ")", "if", "(", "!", "methodDecl", ".", "toString", "(", ")", ".", "equals", "(", "\"<clinit>()\"", ")", ")", "properties", ".", "add", "(", "new", "AptProperty", "(", "this", ",", "(", "AnnotationTypeElementDeclaration", ")", "methodDecl", ",", "_ap", ")", ")", ";", "return", "properties", ";", "}" ]
Initializes the list of ControlProperties associated with this ControlPropertySet
[ "Initializes", "the", "list", "of", "ControlProperties", "associated", "with", "this", "ControlPropertySet" ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptPropertySet.java#L67-L81
146,507
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptPropertySet.java
AptPropertySet.getPackage
public String getPackage() { if (_propertySet == null || _propertySet.getPackage() == null ) return ""; return _propertySet.getPackage().getQualifiedName(); }
java
public String getPackage() { if (_propertySet == null || _propertySet.getPackage() == null ) return ""; return _propertySet.getPackage().getQualifiedName(); }
[ "public", "String", "getPackage", "(", ")", "{", "if", "(", "_propertySet", "==", "null", "||", "_propertySet", ".", "getPackage", "(", ")", "==", "null", ")", "return", "\"\"", ";", "return", "_propertySet", ".", "getPackage", "(", ")", ".", "getQualifiedName", "(", ")", ";", "}" ]
Returns the fully qualified package name of this property set
[ "Returns", "the", "fully", "qualified", "package", "name", "of", "this", "property", "set" ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptPropertySet.java#L91-L97
146,508
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptPropertySet.java
AptPropertySet.getPrefix
public String getPrefix() { if (_propertySet == null || _propertySet.getAnnotation(PropertySet.class) == null ) return ""; return _propertySet.getAnnotation(PropertySet.class).prefix(); }
java
public String getPrefix() { if (_propertySet == null || _propertySet.getAnnotation(PropertySet.class) == null ) return ""; return _propertySet.getAnnotation(PropertySet.class).prefix(); }
[ "public", "String", "getPrefix", "(", ")", "{", "if", "(", "_propertySet", "==", "null", "||", "_propertySet", ".", "getAnnotation", "(", "PropertySet", ".", "class", ")", "==", "null", ")", "return", "\"\"", ";", "return", "_propertySet", ".", "getAnnotation", "(", "PropertySet", ".", "class", ")", ".", "prefix", "(", ")", ";", "}" ]
Returns the property name prefix for properties in this PropertySet
[ "Returns", "the", "property", "name", "prefix", "for", "properties", "in", "this", "PropertySet" ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptPropertySet.java#L124-L130
146,509
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/util/type/TypeUtils.java
TypeUtils.convertToObject
public static final Object convertToObject(String value, Class type) { return convertToObject(value, type, null); }
java
public static final Object convertToObject(String value, Class type) { return convertToObject(value, type, null); }
[ "public", "static", "final", "Object", "convertToObject", "(", "String", "value", ",", "Class", "type", ")", "{", "return", "convertToObject", "(", "value", ",", "type", ",", "null", ")", ";", "}" ]
Convert an object from a String to the given type. @deprecated @param value the String to convert @param type the type to which to convert the String @return the Object result of converting the String to the type. @throws TypeConverterNotFoundException if a TypeConverter for the target type can not be found.
[ "Convert", "an", "object", "from", "a", "String", "to", "the", "given", "type", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/util/type/TypeUtils.java#L81-L83
146,510
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/AttributeRenderer.java
AttributeRenderer.addElement
public RemoveInfo addElement(TreeElement elem) { // if the attributes are empty then there is nothing to add to lists ArrayList attrs = elem.getAttributeList(); if (attrs == null || attrs.size() == 0) return emptyRemoves; // We will track all of the elements that we are removing from the current inheritence // list set and return those back to the caller to stash away on the stack. RemoveInfo removes = _removes; if (removes == null) removes = new RemoveInfo(); // walk all of the attributes int cnt = attrs.size(); assert (cnt > 0); for (int i = 0; i < cnt; i++) { TreeHtmlAttributeInfo attr = (TreeHtmlAttributeInfo) attrs.get(i); if (attr.isOnDiv()) { addAttribute(TreeHtmlAttributeInfo.HTML_LOCATION_DIV, attr, removes); } if (attr.isOnIcon()) { addAttribute(TreeHtmlAttributeInfo.HTML_LOCATION_ICON, attr, removes); } if (attr.isOnSelectionLink()) { addAttribute(TreeHtmlAttributeInfo.HTML_LOCATION_SELECTION_LINK, attr, removes); } } // if we didn't remove anything then we should simply stash the array list away for next time // and return null. if (removes.removes.size() == 0) { _removes = removes; removes = null; } else { _removes = null; } return removes; }
java
public RemoveInfo addElement(TreeElement elem) { // if the attributes are empty then there is nothing to add to lists ArrayList attrs = elem.getAttributeList(); if (attrs == null || attrs.size() == 0) return emptyRemoves; // We will track all of the elements that we are removing from the current inheritence // list set and return those back to the caller to stash away on the stack. RemoveInfo removes = _removes; if (removes == null) removes = new RemoveInfo(); // walk all of the attributes int cnt = attrs.size(); assert (cnt > 0); for (int i = 0; i < cnt; i++) { TreeHtmlAttributeInfo attr = (TreeHtmlAttributeInfo) attrs.get(i); if (attr.isOnDiv()) { addAttribute(TreeHtmlAttributeInfo.HTML_LOCATION_DIV, attr, removes); } if (attr.isOnIcon()) { addAttribute(TreeHtmlAttributeInfo.HTML_LOCATION_ICON, attr, removes); } if (attr.isOnSelectionLink()) { addAttribute(TreeHtmlAttributeInfo.HTML_LOCATION_SELECTION_LINK, attr, removes); } } // if we didn't remove anything then we should simply stash the array list away for next time // and return null. if (removes.removes.size() == 0) { _removes = removes; removes = null; } else { _removes = null; } return removes; }
[ "public", "RemoveInfo", "addElement", "(", "TreeElement", "elem", ")", "{", "// if the attributes are empty then there is nothing to add to lists", "ArrayList", "attrs", "=", "elem", ".", "getAttributeList", "(", ")", ";", "if", "(", "attrs", "==", "null", "||", "attrs", ".", "size", "(", ")", "==", "0", ")", "return", "emptyRemoves", ";", "// We will track all of the elements that we are removing from the current inheritence", "// list set and return those back to the caller to stash away on the stack.", "RemoveInfo", "removes", "=", "_removes", ";", "if", "(", "removes", "==", "null", ")", "removes", "=", "new", "RemoveInfo", "(", ")", ";", "// walk all of the attributes", "int", "cnt", "=", "attrs", ".", "size", "(", ")", ";", "assert", "(", "cnt", ">", "0", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "cnt", ";", "i", "++", ")", "{", "TreeHtmlAttributeInfo", "attr", "=", "(", "TreeHtmlAttributeInfo", ")", "attrs", ".", "get", "(", "i", ")", ";", "if", "(", "attr", ".", "isOnDiv", "(", ")", ")", "{", "addAttribute", "(", "TreeHtmlAttributeInfo", ".", "HTML_LOCATION_DIV", ",", "attr", ",", "removes", ")", ";", "}", "if", "(", "attr", ".", "isOnIcon", "(", ")", ")", "{", "addAttribute", "(", "TreeHtmlAttributeInfo", ".", "HTML_LOCATION_ICON", ",", "attr", ",", "removes", ")", ";", "}", "if", "(", "attr", ".", "isOnSelectionLink", "(", ")", ")", "{", "addAttribute", "(", "TreeHtmlAttributeInfo", ".", "HTML_LOCATION_SELECTION_LINK", ",", "attr", ",", "removes", ")", ";", "}", "}", "// if we didn't remove anything then we should simply stash the array list away for next time", "// and return null.", "if", "(", "removes", ".", "removes", ".", "size", "(", ")", "==", "0", ")", "{", "_removes", "=", "removes", ";", "removes", "=", "null", ";", "}", "else", "{", "_removes", "=", "null", ";", "}", "return", "removes", ";", "}" ]
Add all of the attributes associated with an element to the internal lists. @param elem
[ "Add", "all", "of", "the", "attributes", "associated", "with", "an", "element", "to", "the", "internal", "lists", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/AttributeRenderer.java#L51-L91
146,511
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/AttributeRenderer.java
AttributeRenderer.removeElementScoped
public void removeElementScoped(TreeElement elem, RemoveInfo removes) { assert(elem != null); // check to see if we can exist without processing this element. If the element // didn't define any attribute then we can. This is inforced in the addElement method. ArrayList attrs = elem.getAttributeList(); if (attrs == null || attrs.size() == 0) return; // walk all of the lists and each list looking for attributes that // are scoped only to the element for (int i = 0; i < _lists.length; i++) { ArrayList al = _lists[i]; assert(al != null); int cnt = al.size(); for (int j = 0; j < cnt; j++) { TreeHtmlAttributeInfo attr = (TreeHtmlAttributeInfo) al.get(j); assert(attr != null); // Remove all of the attributes not scoped to the element itself. We need to // update the indexes because this removes the current item.. if (!attr.isApplyToDescendents()) { al.remove(j); cnt--; j--; if (removes != null && removes.scopeOverrides) { TreeHtmlAttributeInfo addBack = checkScopeRemoval(i, attr, removes); if (addBack != null) { if (!al.contains(addBack)) al.add(addBack); } } } } } }
java
public void removeElementScoped(TreeElement elem, RemoveInfo removes) { assert(elem != null); // check to see if we can exist without processing this element. If the element // didn't define any attribute then we can. This is inforced in the addElement method. ArrayList attrs = elem.getAttributeList(); if (attrs == null || attrs.size() == 0) return; // walk all of the lists and each list looking for attributes that // are scoped only to the element for (int i = 0; i < _lists.length; i++) { ArrayList al = _lists[i]; assert(al != null); int cnt = al.size(); for (int j = 0; j < cnt; j++) { TreeHtmlAttributeInfo attr = (TreeHtmlAttributeInfo) al.get(j); assert(attr != null); // Remove all of the attributes not scoped to the element itself. We need to // update the indexes because this removes the current item.. if (!attr.isApplyToDescendents()) { al.remove(j); cnt--; j--; if (removes != null && removes.scopeOverrides) { TreeHtmlAttributeInfo addBack = checkScopeRemoval(i, attr, removes); if (addBack != null) { if (!al.contains(addBack)) al.add(addBack); } } } } } }
[ "public", "void", "removeElementScoped", "(", "TreeElement", "elem", ",", "RemoveInfo", "removes", ")", "{", "assert", "(", "elem", "!=", "null", ")", ";", "// check to see if we can exist without processing this element. If the element", "// didn't define any attribute then we can. This is inforced in the addElement method.", "ArrayList", "attrs", "=", "elem", ".", "getAttributeList", "(", ")", ";", "if", "(", "attrs", "==", "null", "||", "attrs", ".", "size", "(", ")", "==", "0", ")", "return", ";", "// walk all of the lists and each list looking for attributes that", "// are scoped only to the element", "for", "(", "int", "i", "=", "0", ";", "i", "<", "_lists", ".", "length", ";", "i", "++", ")", "{", "ArrayList", "al", "=", "_lists", "[", "i", "]", ";", "assert", "(", "al", "!=", "null", ")", ";", "int", "cnt", "=", "al", ".", "size", "(", ")", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "cnt", ";", "j", "++", ")", "{", "TreeHtmlAttributeInfo", "attr", "=", "(", "TreeHtmlAttributeInfo", ")", "al", ".", "get", "(", "j", ")", ";", "assert", "(", "attr", "!=", "null", ")", ";", "// Remove all of the attributes not scoped to the element itself. We need to", "// update the indexes because this removes the current item..", "if", "(", "!", "attr", ".", "isApplyToDescendents", "(", ")", ")", "{", "al", ".", "remove", "(", "j", ")", ";", "cnt", "--", ";", "j", "--", ";", "if", "(", "removes", "!=", "null", "&&", "removes", ".", "scopeOverrides", ")", "{", "TreeHtmlAttributeInfo", "addBack", "=", "checkScopeRemoval", "(", "i", ",", "attr", ",", "removes", ")", ";", "if", "(", "addBack", "!=", "null", ")", "{", "if", "(", "!", "al", ".", "contains", "(", "addBack", ")", ")", "al", ".", "add", "(", "addBack", ")", ";", "}", "}", "}", "}", "}", "}" ]
This method will remove all of the elements scoped to the attribute. @param elem
[ "This", "method", "will", "remove", "all", "of", "the", "elements", "scoped", "to", "the", "attribute", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/AttributeRenderer.java#L97-L133
146,512
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/AttributeRenderer.java
AttributeRenderer.renderIconImage
public void renderIconImage(ImageTag.State state, TreeElement elem) { ArrayList al = _lists[TreeHtmlAttributeInfo.HTML_LOCATION_ICON]; assert(al != null); if (al.size() == 0) return; int cnt = al.size(); for (int i = 0; i < cnt; i++) { TreeHtmlAttributeInfo attr = (TreeHtmlAttributeInfo) al.get(i); state.registerAttribute(AbstractHtmlState.ATTR_GENERAL, attr.getAttribute(), attr.getValue()); } }
java
public void renderIconImage(ImageTag.State state, TreeElement elem) { ArrayList al = _lists[TreeHtmlAttributeInfo.HTML_LOCATION_ICON]; assert(al != null); if (al.size() == 0) return; int cnt = al.size(); for (int i = 0; i < cnt; i++) { TreeHtmlAttributeInfo attr = (TreeHtmlAttributeInfo) al.get(i); state.registerAttribute(AbstractHtmlState.ATTR_GENERAL, attr.getAttribute(), attr.getValue()); } }
[ "public", "void", "renderIconImage", "(", "ImageTag", ".", "State", "state", ",", "TreeElement", "elem", ")", "{", "ArrayList", "al", "=", "_lists", "[", "TreeHtmlAttributeInfo", ".", "HTML_LOCATION_ICON", "]", ";", "assert", "(", "al", "!=", "null", ")", ";", "if", "(", "al", ".", "size", "(", ")", "==", "0", ")", "return", ";", "int", "cnt", "=", "al", ".", "size", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "cnt", ";", "i", "++", ")", "{", "TreeHtmlAttributeInfo", "attr", "=", "(", "TreeHtmlAttributeInfo", ")", "al", ".", "get", "(", "i", ")", ";", "state", ".", "registerAttribute", "(", "AbstractHtmlState", ".", "ATTR_GENERAL", ",", "attr", ".", "getAttribute", "(", ")", ",", "attr", ".", "getValue", "(", ")", ")", ";", "}", "}" ]
This method will render the values assocated with the Icon Image. @param state @param elem
[ "This", "method", "will", "render", "the", "values", "assocated", "with", "the", "Icon", "Image", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/AttributeRenderer.java#L168-L181
146,513
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/AttributeRenderer.java
AttributeRenderer.renderSelectionLink
public void renderSelectionLink(AnchorTag.State state, TreeElement elem) { ArrayList al = _lists[TreeHtmlAttributeInfo.HTML_LOCATION_SELECTION_LINK]; assert(al != null); if (al.size() == 0) return; int cnt = al.size(); for (int i = 0; i < cnt; i++) { TreeHtmlAttributeInfo attr = (TreeHtmlAttributeInfo) al.get(i); state.registerAttribute(AbstractHtmlState.ATTR_GENERAL, attr.getAttribute(), attr.getValue()); } }
java
public void renderSelectionLink(AnchorTag.State state, TreeElement elem) { ArrayList al = _lists[TreeHtmlAttributeInfo.HTML_LOCATION_SELECTION_LINK]; assert(al != null); if (al.size() == 0) return; int cnt = al.size(); for (int i = 0; i < cnt; i++) { TreeHtmlAttributeInfo attr = (TreeHtmlAttributeInfo) al.get(i); state.registerAttribute(AbstractHtmlState.ATTR_GENERAL, attr.getAttribute(), attr.getValue()); } }
[ "public", "void", "renderSelectionLink", "(", "AnchorTag", ".", "State", "state", ",", "TreeElement", "elem", ")", "{", "ArrayList", "al", "=", "_lists", "[", "TreeHtmlAttributeInfo", ".", "HTML_LOCATION_SELECTION_LINK", "]", ";", "assert", "(", "al", "!=", "null", ")", ";", "if", "(", "al", ".", "size", "(", ")", "==", "0", ")", "return", ";", "int", "cnt", "=", "al", ".", "size", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "cnt", ";", "i", "++", ")", "{", "TreeHtmlAttributeInfo", "attr", "=", "(", "TreeHtmlAttributeInfo", ")", "al", ".", "get", "(", "i", ")", ";", "state", ".", "registerAttribute", "(", "AbstractHtmlState", ".", "ATTR_GENERAL", ",", "attr", ".", "getAttribute", "(", ")", ",", "attr", ".", "getValue", "(", ")", ")", ";", "}", "}" ]
This method will render the values assocated with the selection link. @param state @param elem
[ "This", "method", "will", "render", "the", "values", "assocated", "with", "the", "selection", "link", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/AttributeRenderer.java#L188-L201
146,514
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/AttributeRenderer.java
AttributeRenderer.renderDiv
public void renderDiv(DivTag.State state, TreeElement elem) { ArrayList al = _lists[TreeHtmlAttributeInfo.HTML_LOCATION_DIV]; assert(al != null); if (al.size() == 0) return; int cnt = al.size(); for (int i = 0; i < cnt; i++) { TreeHtmlAttributeInfo attr = (TreeHtmlAttributeInfo) al.get(i); state.registerAttribute(AbstractHtmlState.ATTR_GENERAL, attr.getAttribute(), attr.getValue()); } }
java
public void renderDiv(DivTag.State state, TreeElement elem) { ArrayList al = _lists[TreeHtmlAttributeInfo.HTML_LOCATION_DIV]; assert(al != null); if (al.size() == 0) return; int cnt = al.size(); for (int i = 0; i < cnt; i++) { TreeHtmlAttributeInfo attr = (TreeHtmlAttributeInfo) al.get(i); state.registerAttribute(AbstractHtmlState.ATTR_GENERAL, attr.getAttribute(), attr.getValue()); } }
[ "public", "void", "renderDiv", "(", "DivTag", ".", "State", "state", ",", "TreeElement", "elem", ")", "{", "ArrayList", "al", "=", "_lists", "[", "TreeHtmlAttributeInfo", ".", "HTML_LOCATION_DIV", "]", ";", "assert", "(", "al", "!=", "null", ")", ";", "if", "(", "al", ".", "size", "(", ")", "==", "0", ")", "return", ";", "int", "cnt", "=", "al", ".", "size", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "cnt", ";", "i", "++", ")", "{", "TreeHtmlAttributeInfo", "attr", "=", "(", "TreeHtmlAttributeInfo", ")", "al", ".", "get", "(", "i", ")", ";", "state", ".", "registerAttribute", "(", "AbstractHtmlState", ".", "ATTR_GENERAL", ",", "attr", ".", "getAttribute", "(", ")", ",", "attr", ".", "getValue", "(", ")", ")", ";", "}", "}" ]
This method will render the values assocated with the div around a treeItem. @param state @param elem
[ "This", "method", "will", "render", "the", "values", "assocated", "with", "the", "div", "around", "a", "treeItem", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/AttributeRenderer.java#L208-L221
146,515
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptMethod.java
AptMethod.getArgDecl
public String getArgDecl(HashMap<String,TypeMirror> bindingMap) { StringBuffer sb = new StringBuffer(); if ( _methodDecl.getParameters() == null ) return ""; int i = 0; for (ParameterDeclaration paramDecl : _methodDecl.getParameters()) { TypeMirror paramType = paramDecl.getType(); if ( paramType == null ) return ""; if (bindingMap != null && bindingMap.containsKey(paramType.toString())) paramType = bindingMap.get(paramType.toString()); if (i != 0) sb.append(", "); sb.append(paramType.toString()); sb.append(' '); // BUGBUG: when the MethodDeclaration is derived from Reflection, this seems // to return 'arg0' for all arguments! String argName = paramDecl.getSimpleName(); if (argName.equals("arg0")) sb.append("arg" + i); else sb.append(argName); i++; } return sb.toString(); }
java
public String getArgDecl(HashMap<String,TypeMirror> bindingMap) { StringBuffer sb = new StringBuffer(); if ( _methodDecl.getParameters() == null ) return ""; int i = 0; for (ParameterDeclaration paramDecl : _methodDecl.getParameters()) { TypeMirror paramType = paramDecl.getType(); if ( paramType == null ) return ""; if (bindingMap != null && bindingMap.containsKey(paramType.toString())) paramType = bindingMap.get(paramType.toString()); if (i != 0) sb.append(", "); sb.append(paramType.toString()); sb.append(' '); // BUGBUG: when the MethodDeclaration is derived from Reflection, this seems // to return 'arg0' for all arguments! String argName = paramDecl.getSimpleName(); if (argName.equals("arg0")) sb.append("arg" + i); else sb.append(argName); i++; } return sb.toString(); }
[ "public", "String", "getArgDecl", "(", "HashMap", "<", "String", ",", "TypeMirror", ">", "bindingMap", ")", "{", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", ")", ";", "if", "(", "_methodDecl", ".", "getParameters", "(", ")", "==", "null", ")", "return", "\"\"", ";", "int", "i", "=", "0", ";", "for", "(", "ParameterDeclaration", "paramDecl", ":", "_methodDecl", ".", "getParameters", "(", ")", ")", "{", "TypeMirror", "paramType", "=", "paramDecl", ".", "getType", "(", ")", ";", "if", "(", "paramType", "==", "null", ")", "return", "\"\"", ";", "if", "(", "bindingMap", "!=", "null", "&&", "bindingMap", ".", "containsKey", "(", "paramType", ".", "toString", "(", ")", ")", ")", "paramType", "=", "bindingMap", ".", "get", "(", "paramType", ".", "toString", "(", ")", ")", ";", "if", "(", "i", "!=", "0", ")", "sb", ".", "append", "(", "\", \"", ")", ";", "sb", ".", "append", "(", "paramType", ".", "toString", "(", ")", ")", ";", "sb", ".", "append", "(", "'", "'", ")", ";", "// BUGBUG: when the MethodDeclaration is derived from Reflection, this seems", "// to return 'arg0' for all arguments!", "String", "argName", "=", "paramDecl", ".", "getSimpleName", "(", ")", ";", "if", "(", "argName", ".", "equals", "(", "\"arg0\"", ")", ")", "sb", ".", "append", "(", "\"arg\"", "+", "i", ")", ";", "else", "sb", ".", "append", "(", "argName", ")", ";", "i", "++", ";", "}", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
Returns the argument declaration of the method, applying the bindings in the provided type map to any parameter types
[ "Returns", "the", "argument", "declaration", "of", "the", "method", "applying", "the", "bindings", "in", "the", "provided", "type", "map", "to", "any", "parameter", "types" ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptMethod.java#L104-L139
146,516
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptMethod.java
AptMethod.getArgList
public String getArgList(boolean quoteDelimit) { StringBuffer sb = new StringBuffer(); int i = 0; if ( _methodDecl.getParameters() == null ) return ""; for (ParameterDeclaration paramDecl : _methodDecl.getParameters()) { if (i != 0) sb.append(", "); // BUGBUG: when the MethodDeclaration is derived from Reflection, this seems // to return 'arg0' for all arguments! String argName = paramDecl.getSimpleName(); if (quoteDelimit) sb.append('"'); if (argName.equals("arg0")) sb.append("arg" + i); else sb.append(argName); if (quoteDelimit) sb.append('"'); i++; } return sb.toString(); }
java
public String getArgList(boolean quoteDelimit) { StringBuffer sb = new StringBuffer(); int i = 0; if ( _methodDecl.getParameters() == null ) return ""; for (ParameterDeclaration paramDecl : _methodDecl.getParameters()) { if (i != 0) sb.append(", "); // BUGBUG: when the MethodDeclaration is derived from Reflection, this seems // to return 'arg0' for all arguments! String argName = paramDecl.getSimpleName(); if (quoteDelimit) sb.append('"'); if (argName.equals("arg0")) sb.append("arg" + i); else sb.append(argName); if (quoteDelimit) sb.append('"'); i++; } return sb.toString(); }
[ "public", "String", "getArgList", "(", "boolean", "quoteDelimit", ")", "{", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", ")", ";", "int", "i", "=", "0", ";", "if", "(", "_methodDecl", ".", "getParameters", "(", ")", "==", "null", ")", "return", "\"\"", ";", "for", "(", "ParameterDeclaration", "paramDecl", ":", "_methodDecl", ".", "getParameters", "(", ")", ")", "{", "if", "(", "i", "!=", "0", ")", "sb", ".", "append", "(", "\", \"", ")", ";", "// BUGBUG: when the MethodDeclaration is derived from Reflection, this seems", "// to return 'arg0' for all arguments!", "String", "argName", "=", "paramDecl", ".", "getSimpleName", "(", ")", ";", "if", "(", "quoteDelimit", ")", "sb", ".", "append", "(", "'", "'", ")", ";", "if", "(", "argName", ".", "equals", "(", "\"arg0\"", ")", ")", "sb", ".", "append", "(", "\"arg\"", "+", "i", ")", ";", "else", "sb", ".", "append", "(", "argName", ")", ";", "if", "(", "quoteDelimit", ")", "sb", ".", "append", "(", "'", "'", ")", ";", "i", "++", ";", "}", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
Returns the the method argument names, in a comma separated list
[ "Returns", "the", "the", "method", "argument", "names", "in", "a", "comma", "separated", "list" ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptMethod.java#L152-L177
146,517
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptMethod.java
AptMethod.getArgTypes
public String getArgTypes() { StringBuffer sb = new StringBuffer(); int i = 0; if ( _methodDecl == null || _methodDecl.getParameters() == null ) return ""; for (ParameterDeclaration paramDecl : _methodDecl.getParameters()) { if (i++ != 0) sb.append(", "); TypeMirror paramType = paramDecl.getType(); if (paramType == null) return ""; // // Use the erasure here, because we only want the raw type, not the reference // type // sb.append(_ap.getAnnotationProcessorEnvironment().getTypeUtils().getErasure(paramType)); sb.append(".class"); } return sb.toString(); }
java
public String getArgTypes() { StringBuffer sb = new StringBuffer(); int i = 0; if ( _methodDecl == null || _methodDecl.getParameters() == null ) return ""; for (ParameterDeclaration paramDecl : _methodDecl.getParameters()) { if (i++ != 0) sb.append(", "); TypeMirror paramType = paramDecl.getType(); if (paramType == null) return ""; // // Use the erasure here, because we only want the raw type, not the reference // type // sb.append(_ap.getAnnotationProcessorEnvironment().getTypeUtils().getErasure(paramType)); sb.append(".class"); } return sb.toString(); }
[ "public", "String", "getArgTypes", "(", ")", "{", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", ")", ";", "int", "i", "=", "0", ";", "if", "(", "_methodDecl", "==", "null", "||", "_methodDecl", ".", "getParameters", "(", ")", "==", "null", ")", "return", "\"\"", ";", "for", "(", "ParameterDeclaration", "paramDecl", ":", "_methodDecl", ".", "getParameters", "(", ")", ")", "{", "if", "(", "i", "++", "!=", "0", ")", "sb", ".", "append", "(", "\", \"", ")", ";", "TypeMirror", "paramType", "=", "paramDecl", ".", "getType", "(", ")", ";", "if", "(", "paramType", "==", "null", ")", "return", "\"\"", ";", "//", "// Use the erasure here, because we only want the raw type, not the reference", "// type", "//", "sb", ".", "append", "(", "_ap", ".", "getAnnotationProcessorEnvironment", "(", ")", ".", "getTypeUtils", "(", ")", ".", "getErasure", "(", "paramType", ")", ")", ";", "sb", ".", "append", "(", "\".class\"", ")", ";", "}", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
Returns the the method argument classes, in a comma separated list
[ "Returns", "the", "the", "method", "argument", "classes", "in", "a", "comma", "separated", "list" ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptMethod.java#L187-L212
146,518
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptMethod.java
AptMethod.hasParameterizedArguments
public boolean hasParameterizedArguments() { for (ParameterDeclaration paramDecl : _methodDecl.getParameters()) { TypeMirror paramType = paramDecl.getType(); if (paramType instanceof ReferenceType || paramType instanceof WildcardType) return true; } return false; }
java
public boolean hasParameterizedArguments() { for (ParameterDeclaration paramDecl : _methodDecl.getParameters()) { TypeMirror paramType = paramDecl.getType(); if (paramType instanceof ReferenceType || paramType instanceof WildcardType) return true; } return false; }
[ "public", "boolean", "hasParameterizedArguments", "(", ")", "{", "for", "(", "ParameterDeclaration", "paramDecl", ":", "_methodDecl", ".", "getParameters", "(", ")", ")", "{", "TypeMirror", "paramType", "=", "paramDecl", ".", "getType", "(", ")", ";", "if", "(", "paramType", "instanceof", "ReferenceType", "||", "paramType", "instanceof", "WildcardType", ")", "return", "true", ";", "}", "return", "false", ";", "}" ]
Returns 'true' if the method uses any parameterized types as parameters
[ "Returns", "true", "if", "the", "method", "uses", "any", "parameterized", "types", "as", "parameters" ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptMethod.java#L217-L226
146,519
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptMethod.java
AptMethod.getFormalTypes
public String getFormalTypes() { if ( _methodDecl == null || _methodDecl.getReturnType() == null ) return ""; Collection<TypeParameterDeclaration> formalTypes = _methodDecl.getFormalTypeParameters(); if (formalTypes.size() == 0) return ""; StringBuffer sb = new StringBuffer("<"); boolean isFirst = true; for (TypeParameterDeclaration tpd: formalTypes) { if (isFirst) isFirst = false; else sb.append(", "); sb.append(tpd.toString()); } sb.append(">"); return sb.toString(); }
java
public String getFormalTypes() { if ( _methodDecl == null || _methodDecl.getReturnType() == null ) return ""; Collection<TypeParameterDeclaration> formalTypes = _methodDecl.getFormalTypeParameters(); if (formalTypes.size() == 0) return ""; StringBuffer sb = new StringBuffer("<"); boolean isFirst = true; for (TypeParameterDeclaration tpd: formalTypes) { if (isFirst) isFirst = false; else sb.append(", "); sb.append(tpd.toString()); } sb.append(">"); return sb.toString(); }
[ "public", "String", "getFormalTypes", "(", ")", "{", "if", "(", "_methodDecl", "==", "null", "||", "_methodDecl", ".", "getReturnType", "(", ")", "==", "null", ")", "return", "\"\"", ";", "Collection", "<", "TypeParameterDeclaration", ">", "formalTypes", "=", "_methodDecl", ".", "getFormalTypeParameters", "(", ")", ";", "if", "(", "formalTypes", ".", "size", "(", ")", "==", "0", ")", "return", "\"\"", ";", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", "\"<\"", ")", ";", "boolean", "isFirst", "=", "true", ";", "for", "(", "TypeParameterDeclaration", "tpd", ":", "formalTypes", ")", "{", "if", "(", "isFirst", ")", "isFirst", "=", "false", ";", "else", "sb", ".", "append", "(", "\", \"", ")", ";", "sb", ".", "append", "(", "tpd", ".", "toString", "(", ")", ")", ";", "}", "sb", ".", "append", "(", "\">\"", ")", ";", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
Returns the declaration of any generic formal types associated with the method
[ "Returns", "the", "declaration", "of", "any", "generic", "formal", "types", "associated", "with", "the", "method" ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptMethod.java#L231-L253
146,520
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptMethod.java
AptMethod.getReturnType
public String getReturnType(HashMap<String,TypeMirror> bindingMap) { if ( _methodDecl == null || _methodDecl.getReturnType() == null ) return ""; String returnType = _methodDecl.getReturnType().toString(); if (bindingMap != null && bindingMap.containsKey(returnType)) return bindingMap.get(returnType).toString(); return returnType; }
java
public String getReturnType(HashMap<String,TypeMirror> bindingMap) { if ( _methodDecl == null || _methodDecl.getReturnType() == null ) return ""; String returnType = _methodDecl.getReturnType().toString(); if (bindingMap != null && bindingMap.containsKey(returnType)) return bindingMap.get(returnType).toString(); return returnType; }
[ "public", "String", "getReturnType", "(", "HashMap", "<", "String", ",", "TypeMirror", ">", "bindingMap", ")", "{", "if", "(", "_methodDecl", "==", "null", "||", "_methodDecl", ".", "getReturnType", "(", ")", "==", "null", ")", "return", "\"\"", ";", "String", "returnType", "=", "_methodDecl", ".", "getReturnType", "(", ")", ".", "toString", "(", ")", ";", "if", "(", "bindingMap", "!=", "null", "&&", "bindingMap", ".", "containsKey", "(", "returnType", ")", ")", "return", "bindingMap", ".", "get", "(", "returnType", ")", ".", "toString", "(", ")", ";", "return", "returnType", ";", "}" ]
Returns the method return type, applying any formal type parameter bindings defined by the provided map.
[ "Returns", "the", "method", "return", "type", "applying", "any", "formal", "type", "parameter", "bindings", "defined", "by", "the", "provided", "map", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptMethod.java#L259-L269
146,521
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptMethod.java
AptMethod.getThrowsClause
public String getThrowsClause() { if ( _methodDecl == null || _methodDecl.getThrownTypes() == null ) return ""; Collection<ReferenceType> thrownTypes = _methodDecl.getThrownTypes(); if (thrownTypes.size() == 0) return ""; StringBuffer sb = new StringBuffer("throws "); int i = 0; for (ReferenceType exceptType : thrownTypes) { if (i++ != 0) sb.append(", "); sb.append(exceptType.toString()); } return sb.toString(); }
java
public String getThrowsClause() { if ( _methodDecl == null || _methodDecl.getThrownTypes() == null ) return ""; Collection<ReferenceType> thrownTypes = _methodDecl.getThrownTypes(); if (thrownTypes.size() == 0) return ""; StringBuffer sb = new StringBuffer("throws "); int i = 0; for (ReferenceType exceptType : thrownTypes) { if (i++ != 0) sb.append(", "); sb.append(exceptType.toString()); } return sb.toString(); }
[ "public", "String", "getThrowsClause", "(", ")", "{", "if", "(", "_methodDecl", "==", "null", "||", "_methodDecl", ".", "getThrownTypes", "(", ")", "==", "null", ")", "return", "\"\"", ";", "Collection", "<", "ReferenceType", ">", "thrownTypes", "=", "_methodDecl", ".", "getThrownTypes", "(", ")", ";", "if", "(", "thrownTypes", ".", "size", "(", ")", "==", "0", ")", "return", "\"\"", ";", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", "\"throws \"", ")", ";", "int", "i", "=", "0", ";", "for", "(", "ReferenceType", "exceptType", ":", "thrownTypes", ")", "{", "if", "(", "i", "++", "!=", "0", ")", "sb", ".", "append", "(", "\", \"", ")", ";", "sb", ".", "append", "(", "exceptType", ".", "toString", "(", ")", ")", ";", "}", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
Returns the throws clause of the operation
[ "Returns", "the", "throws", "clause", "of", "the", "operation" ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptMethod.java#L282-L300
146,522
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptMethod.java
AptMethod.getThrowsList
public ArrayList<String> getThrowsList() { ArrayList<String> throwsList = new ArrayList<String>(); if ( _methodDecl == null || _methodDecl.getThrownTypes() == null || _methodDecl.getThrownTypes().size() == 0 ) return throwsList; Collection<ReferenceType> thrownTypes = _methodDecl.getThrownTypes(); for (ReferenceType exceptType : thrownTypes) throwsList.add(exceptType.toString()); return throwsList; }
java
public ArrayList<String> getThrowsList() { ArrayList<String> throwsList = new ArrayList<String>(); if ( _methodDecl == null || _methodDecl.getThrownTypes() == null || _methodDecl.getThrownTypes().size() == 0 ) return throwsList; Collection<ReferenceType> thrownTypes = _methodDecl.getThrownTypes(); for (ReferenceType exceptType : thrownTypes) throwsList.add(exceptType.toString()); return throwsList; }
[ "public", "ArrayList", "<", "String", ">", "getThrowsList", "(", ")", "{", "ArrayList", "<", "String", ">", "throwsList", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "if", "(", "_methodDecl", "==", "null", "||", "_methodDecl", ".", "getThrownTypes", "(", ")", "==", "null", "||", "_methodDecl", ".", "getThrownTypes", "(", ")", ".", "size", "(", ")", "==", "0", ")", "return", "throwsList", ";", "Collection", "<", "ReferenceType", ">", "thrownTypes", "=", "_methodDecl", ".", "getThrownTypes", "(", ")", ";", "for", "(", "ReferenceType", "exceptType", ":", "thrownTypes", ")", "throwsList", ".", "(", "exceptType", ".", "toString", "(", ")", ")", ";", "return", "throwsList", ";", "}" ]
Returns an ArrayList of thrown exceptions
[ "Returns", "an", "ArrayList", "of", "thrown", "exceptions" ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptMethod.java#L305-L319
146,523
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptMethod.java
AptMethod.getDefaultReturnValue
public String getDefaultReturnValue(HashMap<String,TypeMirror> typeBinding) { String returnType = getReturnType(typeBinding); if (_defaultReturnValues.containsKey(returnType)) return _defaultReturnValues.get(returnType); return "null"; }
java
public String getDefaultReturnValue(HashMap<String,TypeMirror> typeBinding) { String returnType = getReturnType(typeBinding); if (_defaultReturnValues.containsKey(returnType)) return _defaultReturnValues.get(returnType); return "null"; }
[ "public", "String", "getDefaultReturnValue", "(", "HashMap", "<", "String", ",", "TypeMirror", ">", "typeBinding", ")", "{", "String", "returnType", "=", "getReturnType", "(", "typeBinding", ")", ";", "if", "(", "_defaultReturnValues", ".", "containsKey", "(", "returnType", ")", ")", "return", "_defaultReturnValues", ".", "get", "(", "returnType", ")", ";", "return", "\"null\"", ";", "}" ]
Returns a default return value string for the method, based upon bound return type
[ "Returns", "a", "default", "return", "value", "string", "for", "the", "method", "based", "upon", "bound", "return", "type" ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptMethod.java#L324-L330
146,524
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptMethod.java
AptMethod.isPublic
protected boolean isPublic() { Collection<Modifier> modifiers = _methodDecl.getModifiers(); return modifiers.contains(Modifier.PUBLIC); }
java
protected boolean isPublic() { Collection<Modifier> modifiers = _methodDecl.getModifiers(); return modifiers.contains(Modifier.PUBLIC); }
[ "protected", "boolean", "isPublic", "(", ")", "{", "Collection", "<", "Modifier", ">", "modifiers", "=", "_methodDecl", ".", "getModifiers", "(", ")", ";", "return", "modifiers", ".", "contains", "(", "Modifier", ".", "PUBLIC", ")", ";", "}" ]
Is this a public method? @return true if public
[ "Is", "this", "a", "public", "method?" ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptMethod.java#L369-L372
146,525
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptMethod.java
AptMethod.getInterceptorDecl
public String getInterceptorDecl() { Collection<String> names = getInterceptorServiceNames(); if ( names == null || names.size() == 0 ) return null; StringBuffer ret = new StringBuffer("{"); String [] n = names.toArray(new String[0]); for (int i=0 ; i < n.length ; ++i) { ret.append('"'); ret.append( n[i] ); ret.append('"'); if ( i != n.length-1 ) ret.append(", "); } ret.append( "}" ); return ret.toString(); }
java
public String getInterceptorDecl() { Collection<String> names = getInterceptorServiceNames(); if ( names == null || names.size() == 0 ) return null; StringBuffer ret = new StringBuffer("{"); String [] n = names.toArray(new String[0]); for (int i=0 ; i < n.length ; ++i) { ret.append('"'); ret.append( n[i] ); ret.append('"'); if ( i != n.length-1 ) ret.append(", "); } ret.append( "}" ); return ret.toString(); }
[ "public", "String", "getInterceptorDecl", "(", ")", "{", "Collection", "<", "String", ">", "names", "=", "getInterceptorServiceNames", "(", ")", ";", "if", "(", "names", "==", "null", "||", "names", ".", "size", "(", ")", "==", "0", ")", "return", "null", ";", "StringBuffer", "ret", "=", "new", "StringBuffer", "(", "\"{\"", ")", ";", "String", "[", "]", "n", "=", "names", ".", "toArray", "(", "new", "String", "[", "0", "]", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "n", ".", "length", ";", "++", "i", ")", "{", "ret", ".", "append", "(", "'", "'", ")", ";", "ret", ".", "append", "(", "n", "[", "i", "]", ")", ";", "ret", ".", "append", "(", "'", "'", ")", ";", "if", "(", "i", "!=", "n", ".", "length", "-", "1", ")", "ret", ".", "append", "(", "\", \"", ")", ";", "}", "ret", ".", "append", "(", "\"}\"", ")", ";", "return", "ret", ".", "toString", "(", ")", ";", "}" ]
Returns the names of interceptor service interfaces associated with this operation, formatted as a constant initializer string. @return the names of the interceptor service interfaces associated with this operation
[ "Returns", "the", "names", "of", "interceptor", "service", "interfaces", "associated", "with", "this", "operation", "formatted", "as", "a", "constant", "initializer", "string", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptMethod.java#L392-L410
146,526
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/TreeElement.java
TreeElement.setIcon
public void setIcon(String icon) { ExtendedInfo info = getInfo(icon); if (info != null) info._icon = icon; }
java
public void setIcon(String icon) { ExtendedInfo info = getInfo(icon); if (info != null) info._icon = icon; }
[ "public", "void", "setIcon", "(", "String", "icon", ")", "{", "ExtendedInfo", "info", "=", "getInfo", "(", "icon", ")", ";", "if", "(", "info", "!=", "null", ")", "info", ".", "_icon", "=", "icon", ";", "}" ]
Set the pathname to the icon to display when this node is visible. The name is relative to the image directory. @param icon The relative path to the icond.
[ "Set", "the", "pathname", "to", "the", "icon", "to", "display", "when", "this", "node", "is", "visible", ".", "The", "name", "is", "relative", "to", "the", "image", "directory", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/TreeElement.java#L124-L129
146,527
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/TreeElement.java
TreeElement.setTagId
public void setTagId(String tagId) { ExtendedInfo info = getInfo(tagId); if (info != null) info._tagId = tagId; }
java
public void setTagId(String tagId) { ExtendedInfo info = getInfo(tagId); if (info != null) info._tagId = tagId; }
[ "public", "void", "setTagId", "(", "String", "tagId", ")", "{", "ExtendedInfo", "info", "=", "getInfo", "(", "tagId", ")", ";", "if", "(", "info", "!=", "null", ")", "info", ".", "_tagId", "=", "tagId", ";", "}" ]
Set the ID of the tag. @param tagId the tagId.
[ "Set", "the", "ID", "of", "the", "tag", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/TreeElement.java#L234-L239
146,528
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/TreeElement.java
TreeElement.isLast
public boolean isLast() { if (_parent == null) return true; int last = _parent.size() - 1; assert(last >= 0); return (_parent.getChild(last) == this); }
java
public boolean isLast() { if (_parent == null) return true; int last = _parent.size() - 1; assert(last >= 0); return (_parent.getChild(last) == this); }
[ "public", "boolean", "isLast", "(", ")", "{", "if", "(", "_parent", "==", "null", ")", "return", "true", ";", "int", "last", "=", "_parent", ".", "size", "(", ")", "-", "1", ";", "assert", "(", "last", ">=", "0", ")", ";", "return", "(", "_parent", ".", "getChild", "(", "last", ")", "==", "this", ")", ";", "}" ]
Gets whether or not this is the last node in the set of children for the parent node. @return if this is the last or not
[ "Gets", "whether", "or", "not", "this", "is", "the", "last", "node", "in", "the", "set", "of", "children", "for", "the", "parent", "node", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/TreeElement.java#L408-L415
146,529
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/TreeElement.java
TreeElement.addChild
public void addChild(TreeElement child) throws IllegalArgumentException { TreeElement theChild = child; theChild.setParent(this); if (getName() == null) { setName("0"); } if (_children == null) { _children = new ArrayList(); } //int n = _children.size(); //if (n > 0) { // TreeElement node = (TreeElement) _children.get(n - 1); // node.setLast(false); //} //theChild.setLast(true); _children.add(child); int n = _children.size(); theChild.updateName(this, n - 1); }
java
public void addChild(TreeElement child) throws IllegalArgumentException { TreeElement theChild = child; theChild.setParent(this); if (getName() == null) { setName("0"); } if (_children == null) { _children = new ArrayList(); } //int n = _children.size(); //if (n > 0) { // TreeElement node = (TreeElement) _children.get(n - 1); // node.setLast(false); //} //theChild.setLast(true); _children.add(child); int n = _children.size(); theChild.updateName(this, n - 1); }
[ "public", "void", "addChild", "(", "TreeElement", "child", ")", "throws", "IllegalArgumentException", "{", "TreeElement", "theChild", "=", "child", ";", "theChild", ".", "setParent", "(", "this", ")", ";", "if", "(", "getName", "(", ")", "==", "null", ")", "{", "setName", "(", "\"0\"", ")", ";", "}", "if", "(", "_children", "==", "null", ")", "{", "_children", "=", "new", "ArrayList", "(", ")", ";", "}", "//int n = _children.size();", "//if (n > 0) {", "// TreeElement node = (TreeElement) _children.get(n - 1);", "// node.setLast(false);", "//}", "//theChild.setLast(true);", "_children", ".", "add", "(", "child", ")", ";", "int", "n", "=", "_children", ".", "size", "(", ")", ";", "theChild", ".", "updateName", "(", "this", ",", "n", "-", "1", ")", ";", "}" ]
Add a new child node to the end of the list. @param child The new child node @throws IllegalArgumentException if the name of the new child node is not unique
[ "Add", "a", "new", "child", "node", "to", "the", "end", "of", "the", "list", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/TreeElement.java#L571-L592
146,530
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/TreeElement.java
TreeElement.addChild
public void addChild(int offset, TreeElement child) throws IllegalArgumentException { child.setSelected(false); child.setParent(this); if (_children == null) _children = new ArrayList(); _children.add(offset, child); //Need to rename all affected! int size = _children.size(); for (int i = offset; i < size; i++) { TreeElement thisChild = (TreeElement) _children.get(i); thisChild.updateName(this, i); } }
java
public void addChild(int offset, TreeElement child) throws IllegalArgumentException { child.setSelected(false); child.setParent(this); if (_children == null) _children = new ArrayList(); _children.add(offset, child); //Need to rename all affected! int size = _children.size(); for (int i = offset; i < size; i++) { TreeElement thisChild = (TreeElement) _children.get(i); thisChild.updateName(this, i); } }
[ "public", "void", "addChild", "(", "int", "offset", ",", "TreeElement", "child", ")", "throws", "IllegalArgumentException", "{", "child", ".", "setSelected", "(", "false", ")", ";", "child", ".", "setParent", "(", "this", ")", ";", "if", "(", "_children", "==", "null", ")", "_children", "=", "new", "ArrayList", "(", ")", ";", "_children", ".", "add", "(", "offset", ",", "child", ")", ";", "//Need to rename all affected!", "int", "size", "=", "_children", ".", "size", "(", ")", ";", "for", "(", "int", "i", "=", "offset", ";", "i", "<", "size", ";", "i", "++", ")", "{", "TreeElement", "thisChild", "=", "(", "TreeElement", ")", "_children", ".", "get", "(", "i", ")", ";", "thisChild", ".", "updateName", "(", "this", ",", "i", ")", ";", "}", "}" ]
Add a new child node at the specified position in the child list. @param offset Zero-relative offset at which the new node should be inserted @param child The new child node @throws IllegalArgumentException if the name of the new child node is not unique
[ "Add", "a", "new", "child", "node", "at", "the", "specified", "position", "in", "the", "child", "list", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/TreeElement.java#L613-L629
146,531
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/TreeElement.java
TreeElement.getChild
public TreeElement getChild(int index) { TreeElement childNode = null; if (_children == null) return null; Object child = _children.get(index); if (child != null) { childNode = (TreeElement) child; } return childNode; }
java
public TreeElement getChild(int index) { TreeElement childNode = null; if (_children == null) return null; Object child = _children.get(index); if (child != null) { childNode = (TreeElement) child; } return childNode; }
[ "public", "TreeElement", "getChild", "(", "int", "index", ")", "{", "TreeElement", "childNode", "=", "null", ";", "if", "(", "_children", "==", "null", ")", "return", "null", ";", "Object", "child", "=", "_children", ".", "get", "(", "index", ")", ";", "if", "(", "child", "!=", "null", ")", "{", "childNode", "=", "(", "TreeElement", ")", "child", ";", "}", "return", "childNode", ";", "}" ]
Return the child node at the given zero-relative index. @param index The child node index @return the child node
[ "Return", "the", "child", "node", "at", "the", "given", "zero", "-", "relative", "index", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/TreeElement.java#L657-L667
146,532
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/TreeElement.java
TreeElement.removeChild
public void removeChild(TreeElement child) { if (child == null || _children == null) return; int size = _children.size(); int removeIndex = -1; for (int i = 0; i < size; i++) { if (child == (TreeElement) _children.get(i)) { _children.remove(i); child.setParent(null); removeIndex = i; break; } } if (removeIndex >= 0) { size = _children.size(); for (int i = removeIndex; i < size; i++) { TreeElement thisChild = (TreeElement) _children.get(i); thisChild.updateName(this, i); } } }
java
public void removeChild(TreeElement child) { if (child == null || _children == null) return; int size = _children.size(); int removeIndex = -1; for (int i = 0; i < size; i++) { if (child == (TreeElement) _children.get(i)) { _children.remove(i); child.setParent(null); removeIndex = i; break; } } if (removeIndex >= 0) { size = _children.size(); for (int i = removeIndex; i < size; i++) { TreeElement thisChild = (TreeElement) _children.get(i); thisChild.updateName(this, i); } } }
[ "public", "void", "removeChild", "(", "TreeElement", "child", ")", "{", "if", "(", "child", "==", "null", "||", "_children", "==", "null", ")", "return", ";", "int", "size", "=", "_children", ".", "size", "(", ")", ";", "int", "removeIndex", "=", "-", "1", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "size", ";", "i", "++", ")", "{", "if", "(", "child", "==", "(", "TreeElement", ")", "_children", ".", "get", "(", "i", ")", ")", "{", "_children", ".", "remove", "(", "i", ")", ";", "child", ".", "setParent", "(", "null", ")", ";", "removeIndex", "=", "i", ";", "break", ";", "}", "}", "if", "(", "removeIndex", ">=", "0", ")", "{", "size", "=", "_children", ".", "size", "(", ")", ";", "for", "(", "int", "i", "=", "removeIndex", ";", "i", "<", "size", ";", "i", "++", ")", "{", "TreeElement", "thisChild", "=", "(", "TreeElement", ")", "_children", ".", "get", "(", "i", ")", ";", "thisChild", ".", "updateName", "(", "this", ",", "i", ")", ";", "}", "}", "}" ]
Remove the specified child node. All of the children of this child node will also be removed. @param child Child node to be removed
[ "Remove", "the", "specified", "child", "node", ".", "All", "of", "the", "children", "of", "this", "child", "node", "will", "also", "be", "removed", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/TreeElement.java#L700-L723
146,533
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/TreeElement.java
TreeElement.updateName
protected void updateName(TreeElement parentNode, int index) { setName(getNodeName(parentNode, index)); TreeElement[] children = getChildren(); for (int i = 0; i < children.length; i++) { children[i].updateName(this, i); } }
java
protected void updateName(TreeElement parentNode, int index) { setName(getNodeName(parentNode, index)); TreeElement[] children = getChildren(); for (int i = 0; i < children.length; i++) { children[i].updateName(this, i); } }
[ "protected", "void", "updateName", "(", "TreeElement", "parentNode", ",", "int", "index", ")", "{", "setName", "(", "getNodeName", "(", "parentNode", ",", "index", ")", ")", ";", "TreeElement", "[", "]", "children", "=", "getChildren", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "children", ".", "length", ";", "i", "++", ")", "{", "children", "[", "i", "]", ".", "updateName", "(", "this", ",", "i", ")", ";", "}", "}" ]
This method will update the name of this node and all of the children node. The name of a node reflects it's position in the tree. @param parentNode The parent node of this node. @param index the index position of this node within the parent node.
[ "This", "method", "will", "update", "the", "name", "of", "this", "node", "and", "all", "of", "the", "children", "node", ".", "The", "name", "of", "a", "node", "reflects", "it", "s", "position", "in", "the", "tree", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/TreeElement.java#L731-L738
146,534
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/TreeElement.java
TreeElement.getRoot
public static TreeElement getRoot(TreeElement node) { TreeElement parentNode = node.getParent(); while (parentNode != null) { node = parentNode; parentNode = node.getParent(); } return node; }
java
public static TreeElement getRoot(TreeElement node) { TreeElement parentNode = node.getParent(); while (parentNode != null) { node = parentNode; parentNode = node.getParent(); } return node; }
[ "public", "static", "TreeElement", "getRoot", "(", "TreeElement", "node", ")", "{", "TreeElement", "parentNode", "=", "node", ".", "getParent", "(", ")", ";", "while", "(", "parentNode", "!=", "null", ")", "{", "node", "=", "parentNode", ";", "parentNode", "=", "node", ".", "getParent", "(", ")", ";", "}", "return", "node", ";", "}" ]
Gets the root node of this tree. @param node The TreeElement to start from @return The root node
[ "Gets", "the", "root", "node", "of", "this", "tree", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/TreeElement.java#L746-L754
146,535
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/TreeElement.java
TreeElement.findNode
public TreeElement findNode(String nodeName) { TreeElement root = getRoot(this); return root.findNodeRecurse(nodeName, nodeName); }
java
public TreeElement findNode(String nodeName) { TreeElement root = getRoot(this); return root.findNodeRecurse(nodeName, nodeName); }
[ "public", "TreeElement", "findNode", "(", "String", "nodeName", ")", "{", "TreeElement", "root", "=", "getRoot", "(", "this", ")", ";", "return", "root", ".", "findNodeRecurse", "(", "nodeName", ",", "nodeName", ")", ";", "}" ]
Given a node, find the named child. @param nodeName the name of the child to find. @return the node identified by the name
[ "Given", "a", "node", "find", "the", "named", "child", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/TreeElement.java#L761-L765
146,536
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/TreeElement.java
TreeElement.findNodeRecurse
private TreeElement findNodeRecurse(String fullName, String currentName) { String remainingName = null; if ((currentName == null) || (fullName == null)) { return null; } if (getName().equals(fullName)) { return this; } if (currentName.indexOf('.') > 0) { remainingName = currentName.substring(currentName.indexOf('.') + 1); int nextIndex = -1; if (remainingName.indexOf(".") > -1) { nextIndex = new Integer(remainingName.substring(0, remainingName.indexOf('.'))).intValue(); } else { nextIndex = new Integer(remainingName).intValue(); } TreeElement child = getChild(nextIndex); if (child != null) { return child.findNodeRecurse(fullName, remainingName); } else { return null; } } return null; }
java
private TreeElement findNodeRecurse(String fullName, String currentName) { String remainingName = null; if ((currentName == null) || (fullName == null)) { return null; } if (getName().equals(fullName)) { return this; } if (currentName.indexOf('.') > 0) { remainingName = currentName.substring(currentName.indexOf('.') + 1); int nextIndex = -1; if (remainingName.indexOf(".") > -1) { nextIndex = new Integer(remainingName.substring(0, remainingName.indexOf('.'))).intValue(); } else { nextIndex = new Integer(remainingName).intValue(); } TreeElement child = getChild(nextIndex); if (child != null) { return child.findNodeRecurse(fullName, remainingName); } else { return null; } } return null; }
[ "private", "TreeElement", "findNodeRecurse", "(", "String", "fullName", ",", "String", "currentName", ")", "{", "String", "remainingName", "=", "null", ";", "if", "(", "(", "currentName", "==", "null", ")", "||", "(", "fullName", "==", "null", ")", ")", "{", "return", "null", ";", "}", "if", "(", "getName", "(", ")", ".", "equals", "(", "fullName", ")", ")", "{", "return", "this", ";", "}", "if", "(", "currentName", ".", "indexOf", "(", "'", "'", ")", ">", "0", ")", "{", "remainingName", "=", "currentName", ".", "substring", "(", "currentName", ".", "indexOf", "(", "'", "'", ")", "+", "1", ")", ";", "int", "nextIndex", "=", "-", "1", ";", "if", "(", "remainingName", ".", "indexOf", "(", "\".\"", ")", ">", "-", "1", ")", "{", "nextIndex", "=", "new", "Integer", "(", "remainingName", ".", "substring", "(", "0", ",", "remainingName", ".", "indexOf", "(", "'", "'", ")", ")", ")", ".", "intValue", "(", ")", ";", "}", "else", "{", "nextIndex", "=", "new", "Integer", "(", "remainingName", ")", ".", "intValue", "(", ")", ";", "}", "TreeElement", "child", "=", "getChild", "(", "nextIndex", ")", ";", "if", "(", "child", "!=", "null", ")", "{", "return", "child", ".", "findNodeRecurse", "(", "fullName", ",", "remainingName", ")", ";", "}", "else", "{", "return", "null", ";", "}", "}", "return", "null", ";", "}" ]
Helper routine that will recursively search the tree for the node. @param fullName The full name that we are looking for @param currentName The name of the current node. @return The node matching the name or <code>null</code>
[ "Helper", "routine", "that", "will", "recursively", "search", "the", "tree", "for", "the", "node", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/TreeElement.java#L788-L817
146,537
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/TreeElement.java
TreeElement.getInfo
private ExtendedInfo getInfo(Object o) { if (_info == null && o != null) { _info = new ExtendedInfo(); } return _info; }
java
private ExtendedInfo getInfo(Object o) { if (_info == null && o != null) { _info = new ExtendedInfo(); } return _info; }
[ "private", "ExtendedInfo", "getInfo", "(", "Object", "o", ")", "{", "if", "(", "_info", "==", "null", "&&", "o", "!=", "null", ")", "{", "_info", "=", "new", "ExtendedInfo", "(", ")", ";", "}", "return", "_info", ";", "}" ]
This will get the ExtendedInfo object. If it hasn't been created, this routine only creates it if the object passed in is non-null. @param o @return
[ "This", "will", "get", "the", "ExtendedInfo", "object", ".", "If", "it", "hasn", "t", "been", "created", "this", "routine", "only", "creates", "it", "if", "the", "object", "passed", "in", "is", "non", "-", "null", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/TreeElement.java#L825-L831
146,538
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/FlowController.java
FlowController.reinitialize
public void reinitialize( HttpServletRequest request, HttpServletResponse response, ServletContext servletContext ) { // // Cache the associated ModuleConfig. This is used throughout the code, in places where the request // isn't available to do a lazy initialization. // super.reinitialize( request, response, servletContext ); }
java
public void reinitialize( HttpServletRequest request, HttpServletResponse response, ServletContext servletContext ) { // // Cache the associated ModuleConfig. This is used throughout the code, in places where the request // isn't available to do a lazy initialization. // super.reinitialize( request, response, servletContext ); }
[ "public", "void", "reinitialize", "(", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ",", "ServletContext", "servletContext", ")", "{", "//", "// Cache the associated ModuleConfig. This is used throughout the code, in places where the request", "// isn't available to do a lazy initialization.", "//", "super", ".", "reinitialize", "(", "request", ",", "response", ",", "servletContext", ")", ";", "}" ]
Reinitialize the object for a new request. Used by the framework; normally should not be called directly.
[ "Reinitialize", "the", "object", "for", "a", "new", "request", ".", "Used", "by", "the", "framework", ";", "normally", "should", "not", "be", "called", "directly", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/FlowController.java#L154-L161
146,539
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/FlowController.java
FlowController.handleException
public synchronized ActionForward handleException( Throwable ex, ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response ) throws IOException, ServletException { PerRequestState prevState = setPerRequestState( new PerRequestState( request, response, mapping ) ); try { ExceptionsHandler eh = Handlers.get( getServletContext() ).getExceptionsHandler(); FlowControllerHandlerContext context = getHandlerContext(); // First, put the exception into the request (or other applicable context). Throwable unwrapped = eh.unwrapException( context, ex ); eh.exposeException( context, unwrapped, mapping ); return eh.handleException( context, unwrapped, mapping, form ); } finally { setPerRequestState( prevState ); } }
java
public synchronized ActionForward handleException( Throwable ex, ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response ) throws IOException, ServletException { PerRequestState prevState = setPerRequestState( new PerRequestState( request, response, mapping ) ); try { ExceptionsHandler eh = Handlers.get( getServletContext() ).getExceptionsHandler(); FlowControllerHandlerContext context = getHandlerContext(); // First, put the exception into the request (or other applicable context). Throwable unwrapped = eh.unwrapException( context, ex ); eh.exposeException( context, unwrapped, mapping ); return eh.handleException( context, unwrapped, mapping, form ); } finally { setPerRequestState( prevState ); } }
[ "public", "synchronized", "ActionForward", "handleException", "(", "Throwable", "ex", ",", "ActionMapping", "mapping", ",", "ActionForm", "form", ",", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ")", "throws", "IOException", ",", "ServletException", "{", "PerRequestState", "prevState", "=", "setPerRequestState", "(", "new", "PerRequestState", "(", "request", ",", "response", ",", "mapping", ")", ")", ";", "try", "{", "ExceptionsHandler", "eh", "=", "Handlers", ".", "get", "(", "getServletContext", "(", ")", ")", ".", "getExceptionsHandler", "(", ")", ";", "FlowControllerHandlerContext", "context", "=", "getHandlerContext", "(", ")", ";", "// First, put the exception into the request (or other applicable context).", "Throwable", "unwrapped", "=", "eh", ".", "unwrapException", "(", "context", ",", "ex", ")", ";", "eh", ".", "exposeException", "(", "context", ",", "unwrapped", ",", "mapping", ")", ";", "return", "eh", ".", "handleException", "(", "context", ",", "unwrapped", ",", "mapping", ",", "form", ")", ";", "}", "finally", "{", "setPerRequestState", "(", "prevState", ")", ";", "}", "}" ]
Handle the given exception - invoke user code if appropriate and return a destination URI. @param ex the Exception to handle. @param mapping the Struts action mapping for current Struts action being processed. @param form the form-bean (if any) associated with the Struts action being processed. May be null. @param request the current HttpServletRequest. @param response the current HttpServletResponse. @return a Struts ActionForward object that specifies the URI that should be displayed. @throws ServletException if another Exception is thrown during handling of <code>ex</code>.
[ "Handle", "the", "given", "exception", "-", "invoke", "user", "code", "if", "appropriate", "and", "return", "a", "destination", "URI", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/FlowController.java#L258-L279
146,540
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/FlowController.java
FlowController.execute
public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response ) throws Exception { // // Don't actually run the action (and perform the associated synchronization) if there are too many // concurrent requests to this instance. // if ( incrementRequestCount( request, response, getServletContext() ) ) { try { // netui:sync-point synchronized ( this ) { ActionForward ret = null; // establish the control context for running the beginAction, Action, afterAction code PageFlowControlContainer pfcc = null; try { pfcc = PageFlowControlContainerFactory.getControlContainer(request,getServletContext()); pfcc.beginContextOnPageFlow(this,request,response, getServletContext()); } catch (Exception e) { return handleException(e, mapping, form, request, response); } try { // execute the beginAction, Action, afterAction code ret = internalExecute( mapping, form, request, response ); } finally { try { pfcc.endContextOnPageFlow(this); } catch (Exception e) { // if already handling an exception during execute, then just log PageFlowRequestWrapper rw = PageFlowRequestWrapper.get(request); Throwable alreadyBeingHandled = rw.getExceptionBeingHandled(); if (alreadyBeingHandled != null) { _log.error( "Exception thrown while ending context on page flow in execute()", e ); } else { return handleException(e, mapping, form, request, response); } } } return ret; } } finally { decrementRequestCount( request ); } } else { return null; // error was written to the response by incrementRequestCount() } }
java
public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response ) throws Exception { // // Don't actually run the action (and perform the associated synchronization) if there are too many // concurrent requests to this instance. // if ( incrementRequestCount( request, response, getServletContext() ) ) { try { // netui:sync-point synchronized ( this ) { ActionForward ret = null; // establish the control context for running the beginAction, Action, afterAction code PageFlowControlContainer pfcc = null; try { pfcc = PageFlowControlContainerFactory.getControlContainer(request,getServletContext()); pfcc.beginContextOnPageFlow(this,request,response, getServletContext()); } catch (Exception e) { return handleException(e, mapping, form, request, response); } try { // execute the beginAction, Action, afterAction code ret = internalExecute( mapping, form, request, response ); } finally { try { pfcc.endContextOnPageFlow(this); } catch (Exception e) { // if already handling an exception during execute, then just log PageFlowRequestWrapper rw = PageFlowRequestWrapper.get(request); Throwable alreadyBeingHandled = rw.getExceptionBeingHandled(); if (alreadyBeingHandled != null) { _log.error( "Exception thrown while ending context on page flow in execute()", e ); } else { return handleException(e, mapping, form, request, response); } } } return ret; } } finally { decrementRequestCount( request ); } } else { return null; // error was written to the response by incrementRequestCount() } }
[ "public", "ActionForward", "execute", "(", "ActionMapping", "mapping", ",", "ActionForm", "form", ",", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ")", "throws", "Exception", "{", "//", "// Don't actually run the action (and perform the associated synchronization) if there are too many", "// concurrent requests to this instance.", "//", "if", "(", "incrementRequestCount", "(", "request", ",", "response", ",", "getServletContext", "(", ")", ")", ")", "{", "try", "{", "// netui:sync-point", "synchronized", "(", "this", ")", "{", "ActionForward", "ret", "=", "null", ";", "// establish the control context for running the beginAction, Action, afterAction code", "PageFlowControlContainer", "pfcc", "=", "null", ";", "try", "{", "pfcc", "=", "PageFlowControlContainerFactory", ".", "getControlContainer", "(", "request", ",", "getServletContext", "(", ")", ")", ";", "pfcc", ".", "beginContextOnPageFlow", "(", "this", ",", "request", ",", "response", ",", "getServletContext", "(", ")", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "return", "handleException", "(", "e", ",", "mapping", ",", "form", ",", "request", ",", "response", ")", ";", "}", "try", "{", "// execute the beginAction, Action, afterAction code", "ret", "=", "internalExecute", "(", "mapping", ",", "form", ",", "request", ",", "response", ")", ";", "}", "finally", "{", "try", "{", "pfcc", ".", "endContextOnPageFlow", "(", "this", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "// if already handling an exception during execute, then just log", "PageFlowRequestWrapper", "rw", "=", "PageFlowRequestWrapper", ".", "get", "(", "request", ")", ";", "Throwable", "alreadyBeingHandled", "=", "rw", ".", "getExceptionBeingHandled", "(", ")", ";", "if", "(", "alreadyBeingHandled", "!=", "null", ")", "{", "_log", ".", "error", "(", "\"Exception thrown while ending context on page flow in execute()\"", ",", "e", ")", ";", "}", "else", "{", "return", "handleException", "(", "e", ",", "mapping", ",", "form", ",", "request", ",", "response", ")", ";", "}", "}", "}", "return", "ret", ";", "}", "}", "finally", "{", "decrementRequestCount", "(", "request", ")", ";", "}", "}", "else", "{", "return", "null", ";", "// error was written to the response by incrementRequestCount()", "}", "}" ]
Perform decision logic to determine the next URI to be displayed. @param mapping the Struts ActionMapping for the current action being processed. @param form the form-bean (if any) associated with the Struts action being processed. May be null. @param request the current HttpServletRequest. @param response the current HttpServletResponse. @return a Struts ActionForward object that specifies the next URI to be displayed. @throws Exception if an Exception was thrown during user action-handling code.
[ "Perform", "decision", "logic", "to", "determine", "the", "next", "URI", "to", "be", "displayed", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/FlowController.java#L307-L366
146,541
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/FlowController.java
FlowController.destroy
void destroy( HttpSession session ) { onDestroy(); // for backwards compatiblity super.destroy( session ); // // We may have lost our transient ServletContext reference. Try to get the ServletContext reference from the // HttpSession object if necessary. // ServletContext servletContext = getServletContext(); if ( servletContext == null && session != null ) servletContext = session.getServletContext(); if ( servletContext != null ) { PageFlowEventReporter er = AdapterManager.getServletContainerAdapter( servletContext ).getEventReporter(); er.flowControllerDestroyed( this, session ); } }
java
void destroy( HttpSession session ) { onDestroy(); // for backwards compatiblity super.destroy( session ); // // We may have lost our transient ServletContext reference. Try to get the ServletContext reference from the // HttpSession object if necessary. // ServletContext servletContext = getServletContext(); if ( servletContext == null && session != null ) servletContext = session.getServletContext(); if ( servletContext != null ) { PageFlowEventReporter er = AdapterManager.getServletContainerAdapter( servletContext ).getEventReporter(); er.flowControllerDestroyed( this, session ); } }
[ "void", "destroy", "(", "HttpSession", "session", ")", "{", "onDestroy", "(", ")", ";", "// for backwards compatiblity", "super", ".", "destroy", "(", "session", ")", ";", "//", "// We may have lost our transient ServletContext reference. Try to get the ServletContext reference from the", "// HttpSession object if necessary.", "//", "ServletContext", "servletContext", "=", "getServletContext", "(", ")", ";", "if", "(", "servletContext", "==", "null", "&&", "session", "!=", "null", ")", "servletContext", "=", "session", ".", "getServletContext", "(", ")", ";", "if", "(", "servletContext", "!=", "null", ")", "{", "PageFlowEventReporter", "er", "=", "AdapterManager", ".", "getServletContainerAdapter", "(", "servletContext", ")", ".", "getEventReporter", "(", ")", ";", "er", ".", "flowControllerDestroyed", "(", "this", ",", "session", ")", ";", "}", "}" ]
Internal destroy method that is invoked when this object is being removed from the session. This is a framework-invoked method; it should not normally be called directly.
[ "Internal", "destroy", "method", "that", "is", "invoked", "when", "this", "object", "is", "being", "removed", "from", "the", "session", ".", "This", "is", "a", "framework", "-", "invoked", "method", ";", "it", "should", "not", "normally", "be", "called", "directly", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/FlowController.java#L608-L625
146,542
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/FlowController.java
FlowController.getActionMethodForward
ActionForward getActionMethodForward( String actionName, Object inputForm, HttpServletRequest request, HttpServletResponse response, ActionMapping mapping ) throws Exception { // // Find the method. // Class formClass = getFormClass( inputForm, mapping, request ); Method actionMethod = getActionMethod( actionName, formClass ); // // Invoke the method. // if ( actionMethod != null ) { return invokeActionMethod( actionMethod, inputForm, request, mapping ); } if ( _log.isWarnEnabled() ) { InternalStringBuilder msg = new InternalStringBuilder( "Could not find matching action method for action=" ); msg.append( actionName ).append( ", form=" ); msg.append( inputForm != null ? inputForm.getClass().getName() :"[none]" ); _log.warn( msg.toString() ); } PageFlowException ex = new NoMatchingActionMethodException( actionName, inputForm, this ); InternalUtils.throwPageFlowException( ex, request ); return null; }
java
ActionForward getActionMethodForward( String actionName, Object inputForm, HttpServletRequest request, HttpServletResponse response, ActionMapping mapping ) throws Exception { // // Find the method. // Class formClass = getFormClass( inputForm, mapping, request ); Method actionMethod = getActionMethod( actionName, formClass ); // // Invoke the method. // if ( actionMethod != null ) { return invokeActionMethod( actionMethod, inputForm, request, mapping ); } if ( _log.isWarnEnabled() ) { InternalStringBuilder msg = new InternalStringBuilder( "Could not find matching action method for action=" ); msg.append( actionName ).append( ", form=" ); msg.append( inputForm != null ? inputForm.getClass().getName() :"[none]" ); _log.warn( msg.toString() ); } PageFlowException ex = new NoMatchingActionMethodException( actionName, inputForm, this ); InternalUtils.throwPageFlowException( ex, request ); return null; }
[ "ActionForward", "getActionMethodForward", "(", "String", "actionName", ",", "Object", "inputForm", ",", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ",", "ActionMapping", "mapping", ")", "throws", "Exception", "{", "//", "// Find the method.", "//", "Class", "formClass", "=", "getFormClass", "(", "inputForm", ",", "mapping", ",", "request", ")", ";", "Method", "actionMethod", "=", "getActionMethod", "(", "actionName", ",", "formClass", ")", ";", "//", "// Invoke the method.", "//", "if", "(", "actionMethod", "!=", "null", ")", "{", "return", "invokeActionMethod", "(", "actionMethod", ",", "inputForm", ",", "request", ",", "mapping", ")", ";", "}", "if", "(", "_log", ".", "isWarnEnabled", "(", ")", ")", "{", "InternalStringBuilder", "msg", "=", "new", "InternalStringBuilder", "(", "\"Could not find matching action method for action=\"", ")", ";", "msg", ".", "append", "(", "actionName", ")", ".", "append", "(", "\", form=\"", ")", ";", "msg", ".", "append", "(", "inputForm", "!=", "null", "?", "inputForm", ".", "getClass", "(", ")", ".", "getName", "(", ")", ":", "\"[none]\"", ")", ";", "_log", ".", "warn", "(", "msg", ".", "toString", "(", ")", ")", ";", "}", "PageFlowException", "ex", "=", "new", "NoMatchingActionMethodException", "(", "actionName", ",", "inputForm", ",", "this", ")", ";", "InternalUtils", ".", "throwPageFlowException", "(", "ex", ",", "request", ")", ";", "return", "null", ";", "}" ]
Get the ActionForward returned by the action handler method that corresponds to the given action name and form-bean, or send an error to the browser if there is no matching method. @param actionName the name of the Struts action to handle. @param inputForm the form-bean associated with the action. May be <code>null</code>. @param response the current HttpServletResponse. @return the ActionForward returned by the action handler method, or <code>null</code> if there was no matching method (in which case an error was written to the browser. @throws Exception if an Exception was raised in user code.
[ "Get", "the", "ActionForward", "returned", "by", "the", "action", "handler", "method", "that", "corresponds", "to", "the", "given", "action", "name", "and", "form", "-", "bean", "or", "send", "an", "error", "to", "the", "browser", "if", "there", "is", "no", "matching", "method", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/FlowController.java#L794-L824
146,543
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/FlowController.java
FlowController.getModuleConfig
protected final ModuleConfig getModuleConfig() { if ( _moduleConfig == null ) { _moduleConfig = InternalUtils.ensureModuleConfig(getModulePath(), getServletContext()); assert _moduleConfig != null : getModulePath() + "; " + getClass().getName(); } return _moduleConfig; }
java
protected final ModuleConfig getModuleConfig() { if ( _moduleConfig == null ) { _moduleConfig = InternalUtils.ensureModuleConfig(getModulePath(), getServletContext()); assert _moduleConfig != null : getModulePath() + "; " + getClass().getName(); } return _moduleConfig; }
[ "protected", "final", "ModuleConfig", "getModuleConfig", "(", ")", "{", "if", "(", "_moduleConfig", "==", "null", ")", "{", "_moduleConfig", "=", "InternalUtils", ".", "ensureModuleConfig", "(", "getModulePath", "(", ")", ",", "getServletContext", "(", ")", ")", ";", "assert", "_moduleConfig", "!=", "null", ":", "getModulePath", "(", ")", "+", "\"; \"", "+", "getClass", "(", ")", ".", "getName", "(", ")", ";", "}", "return", "_moduleConfig", ";", "}" ]
Get the Struts ModuleConfig object associated with this FlowController.
[ "Get", "the", "Struts", "ModuleConfig", "object", "associated", "with", "this", "FlowController", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/FlowController.java#L1026-L1034
146,544
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/FlowController.java
FlowController.getActions
protected String[] getActions() { ActionConfig[] actionConfigs = getModuleConfig().findActionConfigs(); ArrayList actionNames = new ArrayList(); for ( int i = 0; i < actionConfigs.length; i++ ) { ActionConfig ac = actionConfigs[i]; actionNames.add( ac.getPath().substring( 1 ) ); // every action path has a '/' in front of it } return ( String[] ) actionNames.toArray( new String[0] ); }
java
protected String[] getActions() { ActionConfig[] actionConfigs = getModuleConfig().findActionConfigs(); ArrayList actionNames = new ArrayList(); for ( int i = 0; i < actionConfigs.length; i++ ) { ActionConfig ac = actionConfigs[i]; actionNames.add( ac.getPath().substring( 1 ) ); // every action path has a '/' in front of it } return ( String[] ) actionNames.toArray( new String[0] ); }
[ "protected", "String", "[", "]", "getActions", "(", ")", "{", "ActionConfig", "[", "]", "actionConfigs", "=", "getModuleConfig", "(", ")", ".", "findActionConfigs", "(", ")", ";", "ArrayList", "actionNames", "=", "new", "ArrayList", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "actionConfigs", ".", "length", ";", "i", "++", ")", "{", "ActionConfig", "ac", "=", "actionConfigs", "[", "i", "]", ";", "actionNames", ".", "add", "(", "ac", ".", "getPath", "(", ")", ".", "substring", "(", "1", ")", ")", ";", "// every action path has a '/' in front of it", "}", "return", "(", "String", "[", "]", ")", "actionNames", ".", "toArray", "(", "new", "String", "[", "0", "]", ")", ";", "}" ]
Get a list of the names of actions handled by methods in this PageFlowController. @return a String array containing the names of actions handled by methods in this PageFlowController.
[ "Get", "a", "list", "of", "the", "names", "of", "actions", "handled", "by", "methods", "in", "this", "PageFlowController", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/FlowController.java#L1145-L1157
146,545
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/FlowController.java
FlowController.invokeExceptionHandler
public synchronized ActionForward invokeExceptionHandler( Method method, Throwable ex, String message, ActionForm wrappedFormBean, PageFlowExceptionConfig exceptionConfig, ActionMapping actionMapping, HttpServletRequest request, HttpServletResponse response ) throws IOException, ServletException { PerRequestState prevState = setPerRequestState( new PerRequestState( request, response, actionMapping ) ); try { if ( _log.isDebugEnabled() ) { _log.debug( "Invoking exception handler method " + method.getName() + '(' + method.getParameterTypes()[0].getName() + ", ...)" ); } try { ActionForward retVal = null; String actionName = InternalUtils.getActionName( actionMapping ); if ( actionName == null && ex instanceof PageFlowException ) { actionName = ( ( PageFlowException ) ex ).getActionName(); } try { Object formBean = InternalUtils.unwrapFormBean( wrappedFormBean ); Object[] args = new Object[]{ ex, actionName, message, formBean }; retVal = ( ActionForward ) method.invoke( this, args ); } finally { if ( ! exceptionConfig.isReadonly() ) { ensureFailover( request ); } } return retVal; } catch ( InvocationTargetException e ) { Throwable target = e.getTargetException(); if ( target instanceof Exception ) { throw ( Exception ) target; } else { throw e; } } } catch ( Throwable e ) { _log.error( "Exception while handling exception " + ex.getClass().getName() + ". The original exception will be thrown.", e ); ExceptionsHandler eh = Handlers.get( getServletContext() ).getExceptionsHandler(); FlowControllerHandlerContext context = new FlowControllerHandlerContext( request, response, this ); Throwable unwrapped = eh.unwrapException( context, e ); if ( ! eh.eatUnhandledException( context, unwrapped ) ) { if ( ex instanceof ServletException ) throw ( ServletException ) ex; if ( ex instanceof IOException ) throw ( IOException ) ex; if ( ex instanceof Error ) throw ( Error ) ex; throw new UnhandledException( ex ); } return null; } finally { setPerRequestState( prevState ); } }
java
public synchronized ActionForward invokeExceptionHandler( Method method, Throwable ex, String message, ActionForm wrappedFormBean, PageFlowExceptionConfig exceptionConfig, ActionMapping actionMapping, HttpServletRequest request, HttpServletResponse response ) throws IOException, ServletException { PerRequestState prevState = setPerRequestState( new PerRequestState( request, response, actionMapping ) ); try { if ( _log.isDebugEnabled() ) { _log.debug( "Invoking exception handler method " + method.getName() + '(' + method.getParameterTypes()[0].getName() + ", ...)" ); } try { ActionForward retVal = null; String actionName = InternalUtils.getActionName( actionMapping ); if ( actionName == null && ex instanceof PageFlowException ) { actionName = ( ( PageFlowException ) ex ).getActionName(); } try { Object formBean = InternalUtils.unwrapFormBean( wrappedFormBean ); Object[] args = new Object[]{ ex, actionName, message, formBean }; retVal = ( ActionForward ) method.invoke( this, args ); } finally { if ( ! exceptionConfig.isReadonly() ) { ensureFailover( request ); } } return retVal; } catch ( InvocationTargetException e ) { Throwable target = e.getTargetException(); if ( target instanceof Exception ) { throw ( Exception ) target; } else { throw e; } } } catch ( Throwable e ) { _log.error( "Exception while handling exception " + ex.getClass().getName() + ". The original exception will be thrown.", e ); ExceptionsHandler eh = Handlers.get( getServletContext() ).getExceptionsHandler(); FlowControllerHandlerContext context = new FlowControllerHandlerContext( request, response, this ); Throwable unwrapped = eh.unwrapException( context, e ); if ( ! eh.eatUnhandledException( context, unwrapped ) ) { if ( ex instanceof ServletException ) throw ( ServletException ) ex; if ( ex instanceof IOException ) throw ( IOException ) ex; if ( ex instanceof Error ) throw ( Error ) ex; throw new UnhandledException( ex ); } return null; } finally { setPerRequestState( prevState ); } }
[ "public", "synchronized", "ActionForward", "invokeExceptionHandler", "(", "Method", "method", ",", "Throwable", "ex", ",", "String", "message", ",", "ActionForm", "wrappedFormBean", ",", "PageFlowExceptionConfig", "exceptionConfig", ",", "ActionMapping", "actionMapping", ",", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ")", "throws", "IOException", ",", "ServletException", "{", "PerRequestState", "prevState", "=", "setPerRequestState", "(", "new", "PerRequestState", "(", "request", ",", "response", ",", "actionMapping", ")", ")", ";", "try", "{", "if", "(", "_log", ".", "isDebugEnabled", "(", ")", ")", "{", "_log", ".", "debug", "(", "\"Invoking exception handler method \"", "+", "method", ".", "getName", "(", ")", "+", "'", "'", "+", "method", ".", "getParameterTypes", "(", ")", "[", "0", "]", ".", "getName", "(", ")", "+", "\", ...)\"", ")", ";", "}", "try", "{", "ActionForward", "retVal", "=", "null", ";", "String", "actionName", "=", "InternalUtils", ".", "getActionName", "(", "actionMapping", ")", ";", "if", "(", "actionName", "==", "null", "&&", "ex", "instanceof", "PageFlowException", ")", "{", "actionName", "=", "(", "(", "PageFlowException", ")", "ex", ")", ".", "getActionName", "(", ")", ";", "}", "try", "{", "Object", "formBean", "=", "InternalUtils", ".", "unwrapFormBean", "(", "wrappedFormBean", ")", ";", "Object", "[", "]", "args", "=", "new", "Object", "[", "]", "{", "ex", ",", "actionName", ",", "message", ",", "formBean", "}", ";", "retVal", "=", "(", "ActionForward", ")", "method", ".", "invoke", "(", "this", ",", "args", ")", ";", "}", "finally", "{", "if", "(", "!", "exceptionConfig", ".", "isReadonly", "(", ")", ")", "{", "ensureFailover", "(", "request", ")", ";", "}", "}", "return", "retVal", ";", "}", "catch", "(", "InvocationTargetException", "e", ")", "{", "Throwable", "target", "=", "e", ".", "getTargetException", "(", ")", ";", "if", "(", "target", "instanceof", "Exception", ")", "{", "throw", "(", "Exception", ")", "target", ";", "}", "else", "{", "throw", "e", ";", "}", "}", "}", "catch", "(", "Throwable", "e", ")", "{", "_log", ".", "error", "(", "\"Exception while handling exception \"", "+", "ex", ".", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\". The original exception will be thrown.\"", ",", "e", ")", ";", "ExceptionsHandler", "eh", "=", "Handlers", ".", "get", "(", "getServletContext", "(", ")", ")", ".", "getExceptionsHandler", "(", ")", ";", "FlowControllerHandlerContext", "context", "=", "new", "FlowControllerHandlerContext", "(", "request", ",", "response", ",", "this", ")", ";", "Throwable", "unwrapped", "=", "eh", ".", "unwrapException", "(", "context", ",", "e", ")", ";", "if", "(", "!", "eh", ".", "eatUnhandledException", "(", "context", ",", "unwrapped", ")", ")", "{", "if", "(", "ex", "instanceof", "ServletException", ")", "throw", "(", "ServletException", ")", "ex", ";", "if", "(", "ex", "instanceof", "IOException", ")", "throw", "(", "IOException", ")", "ex", ";", "if", "(", "ex", "instanceof", "Error", ")", "throw", "(", "Error", ")", "ex", ";", "throw", "new", "UnhandledException", "(", "ex", ")", ";", "}", "return", "null", ";", "}", "finally", "{", "setPerRequestState", "(", "prevState", ")", ";", "}", "}" ]
Invoke the given exception handler method. This is a framework-invoked method that should not normally be called directly @param method the action handler method to invoke. @param ex the Throwable that is to be handled. @param message the String message that is to be passed to the handler method. @param wrappedFormBean the wrapped form bean that is associated with the action being processed; may be <code>null</code>. @param exceptionConfig the exception configuration object for the current exception handler. @param actionMapping the action configuration object for the requested action. @param request the current HttpServletRequest. @param response the current HttpServletResponse. @return the ActionForward returned by the exception handler method.
[ "Invoke", "the", "given", "exception", "handler", "method", ".", "This", "is", "a", "framework", "-", "invoked", "method", "that", "should", "not", "normally", "be", "called", "directly" ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/FlowController.java#L1383-L1462
146,546
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/FlowController.java
FlowController.getDataSource
protected DataSource getDataSource( HttpServletRequest request, String key ) { // Return the requested data source instance return ( DataSource ) getServletContext().getAttribute( key + getModuleConfig().getPrefix() ); }
java
protected DataSource getDataSource( HttpServletRequest request, String key ) { // Return the requested data source instance return ( DataSource ) getServletContext().getAttribute( key + getModuleConfig().getPrefix() ); }
[ "protected", "DataSource", "getDataSource", "(", "HttpServletRequest", "request", ",", "String", "key", ")", "{", "// Return the requested data source instance", "return", "(", "DataSource", ")", "getServletContext", "(", ")", ".", "getAttribute", "(", "key", "+", "getModuleConfig", "(", ")", ".", "getPrefix", "(", ")", ")", ";", "}" ]
Return the specified data source for the current Struts module. @param request The servlet request we are processing @param key The key specified in the <code>&lt;message-resources&gt;</code> element for the requested bundle
[ "Return", "the", "specified", "data", "source", "for", "the", "current", "Struts", "module", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/FlowController.java#L1596-L1600
146,547
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/FlowController.java
FlowController.getLocale
protected Locale getLocale( HttpServletRequest request ) { HttpSession session = request.getSession(); Locale locale = ( Locale ) session.getAttribute( Globals.LOCALE_KEY ); return locale != null ? locale : DEFAULT_LOCALE; }
java
protected Locale getLocale( HttpServletRequest request ) { HttpSession session = request.getSession(); Locale locale = ( Locale ) session.getAttribute( Globals.LOCALE_KEY ); return locale != null ? locale : DEFAULT_LOCALE; }
[ "protected", "Locale", "getLocale", "(", "HttpServletRequest", "request", ")", "{", "HttpSession", "session", "=", "request", ".", "getSession", "(", ")", ";", "Locale", "locale", "=", "(", "Locale", ")", "session", ".", "getAttribute", "(", "Globals", ".", "LOCALE_KEY", ")", ";", "return", "locale", "!=", "null", "?", "locale", ":", "DEFAULT_LOCALE", ";", "}" ]
Return the user's currently selected Locale. @param request the current request. @return the user's currently selected Locale, stored in the session. @deprecated Use {@link #getLocale} or {@link #retrieveUserLocale}.
[ "Return", "the", "user", "s", "currently", "selected", "Locale", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/FlowController.java#L1610-L1616
146,548
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/FlowController.java
FlowController.getMessageResources
protected MessageResources getMessageResources( String key ) { return ( MessageResources ) getServletContext().getAttribute( key + getModuleConfig().getPrefix() ); }
java
protected MessageResources getMessageResources( String key ) { return ( MessageResources ) getServletContext().getAttribute( key + getModuleConfig().getPrefix() ); }
[ "protected", "MessageResources", "getMessageResources", "(", "String", "key", ")", "{", "return", "(", "MessageResources", ")", "getServletContext", "(", ")", ".", "getAttribute", "(", "key", "+", "getModuleConfig", "(", ")", ".", "getPrefix", "(", ")", ")", ";", "}" ]
Get the specified message resources for this FlowController. @param key The bundle key specified in a {@link org.apache.beehive.netui.pageflow.annotations.Jpf.MessageBundle &#64;Jpf.MessageBundle} annotation.
[ "Get", "the", "specified", "message", "resources", "for", "this", "FlowController", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/FlowController.java#L1690-L1693
146,549
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/FlowController.java
FlowController.getFormBean
public ActionForm getFormBean( ActionMapping mapping ) { if ( mapping instanceof PageFlowActionMapping ) { PageFlowActionMapping pfam = ( PageFlowActionMapping ) mapping; String formMember = pfam.getFormMember(); if ( formMember == null ) return null; Field field = null; try { field = getClass().getDeclaredField( formMember ); } catch ( NoSuchFieldException e ) { // try finding a non-private field from the class hierarchy field = InternalUtils.lookupField( getClass(), formMember ); if ( field == null || Modifier.isPrivate( field.getModifiers() ) ) { _log.error( "Could not find member field " + formMember + " as the form bean."); return null; } } try { field.setAccessible( true ); return InternalUtils.wrapFormBean( field.get( this ) ); } catch ( Exception e ) { _log.error( "Could not use member field " + formMember + " as the form bean.", e ); } } return null; }
java
public ActionForm getFormBean( ActionMapping mapping ) { if ( mapping instanceof PageFlowActionMapping ) { PageFlowActionMapping pfam = ( PageFlowActionMapping ) mapping; String formMember = pfam.getFormMember(); if ( formMember == null ) return null; Field field = null; try { field = getClass().getDeclaredField( formMember ); } catch ( NoSuchFieldException e ) { // try finding a non-private field from the class hierarchy field = InternalUtils.lookupField( getClass(), formMember ); if ( field == null || Modifier.isPrivate( field.getModifiers() ) ) { _log.error( "Could not find member field " + formMember + " as the form bean."); return null; } } try { field.setAccessible( true ); return InternalUtils.wrapFormBean( field.get( this ) ); } catch ( Exception e ) { _log.error( "Could not use member field " + formMember + " as the form bean.", e ); } } return null; }
[ "public", "ActionForm", "getFormBean", "(", "ActionMapping", "mapping", ")", "{", "if", "(", "mapping", "instanceof", "PageFlowActionMapping", ")", "{", "PageFlowActionMapping", "pfam", "=", "(", "PageFlowActionMapping", ")", "mapping", ";", "String", "formMember", "=", "pfam", ".", "getFormMember", "(", ")", ";", "if", "(", "formMember", "==", "null", ")", "return", "null", ";", "Field", "field", "=", "null", ";", "try", "{", "field", "=", "getClass", "(", ")", ".", "getDeclaredField", "(", "formMember", ")", ";", "}", "catch", "(", "NoSuchFieldException", "e", ")", "{", "// try finding a non-private field from the class hierarchy", "field", "=", "InternalUtils", ".", "lookupField", "(", "getClass", "(", ")", ",", "formMember", ")", ";", "if", "(", "field", "==", "null", "||", "Modifier", ".", "isPrivate", "(", "field", ".", "getModifiers", "(", ")", ")", ")", "{", "_log", ".", "error", "(", "\"Could not find member field \"", "+", "formMember", "+", "\" as the form bean.\"", ")", ";", "return", "null", ";", "}", "}", "try", "{", "field", ".", "setAccessible", "(", "true", ")", ";", "return", "InternalUtils", ".", "wrapFormBean", "(", "field", ".", "get", "(", "this", ")", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "_log", ".", "error", "(", "\"Could not use member field \"", "+", "formMember", "+", "\" as the form bean.\"", ",", "e", ")", ";", "}", "}", "return", "null", ";", "}" ]
Get the flow-scoped form bean member associated with the given ActionMapping. This is a framework-invoked method that should not normally be called directly.
[ "Get", "the", "flow", "-", "scoped", "form", "bean", "member", "associated", "with", "the", "given", "ActionMapping", ".", "This", "is", "a", "framework", "-", "invoked", "method", "that", "should", "not", "normally", "be", "called", "directly", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/FlowController.java#L1961-L1997
146,550
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/FlowController.java
FlowController.getRewrittenActionURI
public String getRewrittenActionURI( String actionName, Map parameters, boolean asValidXml ) throws URISyntaxException { if ( _perRequestState == null ) { throw new IllegalStateException( "getRewrittenActionURI was called outside of a valid context." ); } ServletContext servletContext = getServletContext(); HttpServletRequest request = getRequest(); HttpServletResponse response = getResponse(); return PageFlowUtils.getRewrittenActionURI( servletContext, request, response, actionName, parameters, null, asValidXml ); }
java
public String getRewrittenActionURI( String actionName, Map parameters, boolean asValidXml ) throws URISyntaxException { if ( _perRequestState == null ) { throw new IllegalStateException( "getRewrittenActionURI was called outside of a valid context." ); } ServletContext servletContext = getServletContext(); HttpServletRequest request = getRequest(); HttpServletResponse response = getResponse(); return PageFlowUtils.getRewrittenActionURI( servletContext, request, response, actionName, parameters, null, asValidXml ); }
[ "public", "String", "getRewrittenActionURI", "(", "String", "actionName", ",", "Map", "parameters", ",", "boolean", "asValidXml", ")", "throws", "URISyntaxException", "{", "if", "(", "_perRequestState", "==", "null", ")", "{", "throw", "new", "IllegalStateException", "(", "\"getRewrittenActionURI was called outside of a valid context.\"", ")", ";", "}", "ServletContext", "servletContext", "=", "getServletContext", "(", ")", ";", "HttpServletRequest", "request", "=", "getRequest", "(", ")", ";", "HttpServletResponse", "response", "=", "getResponse", "(", ")", ";", "return", "PageFlowUtils", ".", "getRewrittenActionURI", "(", "servletContext", ",", "request", ",", "response", ",", "actionName", ",", "parameters", ",", "null", ",", "asValidXml", ")", ";", "}" ]
Create a fully-rewritten URI given an action and parameters. @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 parameters the additional parameters to include in the URI query. @param asValidXml 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 url (derived from processing the given action name) into a URI. @throws IllegalStateException if this method is invoked outside of action method execution (i.e., outside of the call to {@link FlowController#execute}, and outside of {@link FlowController#onCreate}, {@link FlowController#beforeAction}, {@link FlowController#afterAction}.
[ "Create", "a", "fully", "-", "rewritten", "URI", "given", "an", "action", "and", "parameters", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/FlowController.java#L2070-L2083
146,551
moparisthebest/beehive
beehive-ejb-control/src/main/java/org/apache/beehive/controls/system/ejb/EJBInfo.java
EJBInfo.getRoot
public Class getRoot(Class clazz, HashMap derivesFrom) { while (derivesFrom.containsKey(clazz)) clazz = (Class) derivesFrom.get(clazz); return clazz; }
java
public Class getRoot(Class clazz, HashMap derivesFrom) { while (derivesFrom.containsKey(clazz)) clazz = (Class) derivesFrom.get(clazz); return clazz; }
[ "public", "Class", "getRoot", "(", "Class", "clazz", ",", "HashMap", "derivesFrom", ")", "{", "while", "(", "derivesFrom", ".", "containsKey", "(", "clazz", ")", ")", "clazz", "=", "(", "Class", ")", "derivesFrom", ".", "get", "(", "clazz", ")", ";", "return", "clazz", ";", "}" ]
Unwinds the results of reflecting through the interface inheritance hierachy to find the original root class from a derived class
[ "Unwinds", "the", "results", "of", "reflecting", "through", "the", "interface", "inheritance", "hierachy", "to", "find", "the", "original", "root", "class", "from", "a", "derived", "class" ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-ejb-control/src/main/java/org/apache/beehive/controls/system/ejb/EJBInfo.java#L148-L151
146,552
moparisthebest/beehive
beehive-jms-control/src/main/java/org/apache/beehive/controls/system/jndi/impl/JndiControlImpl.java
JndiControlImpl.getInitialContext
public InitialContext getInitialContext() throws ControlException { if (_initialContext != null) { return _initialContext; } Properties props = (Properties) _context.getControlPropertySet(Properties.class); String url = nullIfEmpty(props.url()); String factory = nullIfEmpty(props.factory()); if (url == null && factory == null) { try { return new InitialContext(); } catch (NamingException e) { throw new ControlException("Cannot get default JNDI initial context", e); } } if (url == null || factory == null) { throw new ControlException("Both the provider-url and jndi factory need to be provided"); } Hashtable<String, String> env = new Hashtable<String, String>(); env.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY, factory); env.put(javax.naming.Context.PROVIDER_URL, url); String username = nullIfEmpty(props.jndiSecurityPrincipal()); if (username != null) env.put(javax.naming.Context.SECURITY_PRINCIPAL, username); String password = nullIfEmpty(props.jndiSecurityCredentials()); if (password != null) env.put(javax.naming.Context.SECURITY_CREDENTIALS, password); try { return _initialContext = new InitialContext(env); } catch (NamingException e) { throw new ControlException("Cannot get JNDI initial context at provider '" + url + "' with factory '" + factory + "'", e); } }
java
public InitialContext getInitialContext() throws ControlException { if (_initialContext != null) { return _initialContext; } Properties props = (Properties) _context.getControlPropertySet(Properties.class); String url = nullIfEmpty(props.url()); String factory = nullIfEmpty(props.factory()); if (url == null && factory == null) { try { return new InitialContext(); } catch (NamingException e) { throw new ControlException("Cannot get default JNDI initial context", e); } } if (url == null || factory == null) { throw new ControlException("Both the provider-url and jndi factory need to be provided"); } Hashtable<String, String> env = new Hashtable<String, String>(); env.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY, factory); env.put(javax.naming.Context.PROVIDER_URL, url); String username = nullIfEmpty(props.jndiSecurityPrincipal()); if (username != null) env.put(javax.naming.Context.SECURITY_PRINCIPAL, username); String password = nullIfEmpty(props.jndiSecurityCredentials()); if (password != null) env.put(javax.naming.Context.SECURITY_CREDENTIALS, password); try { return _initialContext = new InitialContext(env); } catch (NamingException e) { throw new ControlException("Cannot get JNDI initial context at provider '" + url + "' with factory '" + factory + "'", e); } }
[ "public", "InitialContext", "getInitialContext", "(", ")", "throws", "ControlException", "{", "if", "(", "_initialContext", "!=", "null", ")", "{", "return", "_initialContext", ";", "}", "Properties", "props", "=", "(", "Properties", ")", "_context", ".", "getControlPropertySet", "(", "Properties", ".", "class", ")", ";", "String", "url", "=", "nullIfEmpty", "(", "props", ".", "url", "(", ")", ")", ";", "String", "factory", "=", "nullIfEmpty", "(", "props", ".", "factory", "(", ")", ")", ";", "if", "(", "url", "==", "null", "&&", "factory", "==", "null", ")", "{", "try", "{", "return", "new", "InitialContext", "(", ")", ";", "}", "catch", "(", "NamingException", "e", ")", "{", "throw", "new", "ControlException", "(", "\"Cannot get default JNDI initial context\"", ",", "e", ")", ";", "}", "}", "if", "(", "url", "==", "null", "||", "factory", "==", "null", ")", "{", "throw", "new", "ControlException", "(", "\"Both the provider-url and jndi factory need to be provided\"", ")", ";", "}", "Hashtable", "<", "String", ",", "String", ">", "env", "=", "new", "Hashtable", "<", "String", ",", "String", ">", "(", ")", ";", "env", ".", "put", "(", "javax", ".", "naming", ".", "Context", ".", "INITIAL_CONTEXT_FACTORY", ",", "factory", ")", ";", "env", ".", "put", "(", "javax", ".", "naming", ".", "Context", ".", "PROVIDER_URL", ",", "url", ")", ";", "String", "username", "=", "nullIfEmpty", "(", "props", ".", "jndiSecurityPrincipal", "(", ")", ")", ";", "if", "(", "username", "!=", "null", ")", "env", ".", "put", "(", "javax", ".", "naming", ".", "Context", ".", "SECURITY_PRINCIPAL", ",", "username", ")", ";", "String", "password", "=", "nullIfEmpty", "(", "props", ".", "jndiSecurityCredentials", "(", ")", ")", ";", "if", "(", "password", "!=", "null", ")", "env", ".", "put", "(", "javax", ".", "naming", ".", "Context", ".", "SECURITY_CREDENTIALS", ",", "password", ")", ";", "try", "{", "return", "_initialContext", "=", "new", "InitialContext", "(", "env", ")", ";", "}", "catch", "(", "NamingException", "e", ")", "{", "throw", "new", "ControlException", "(", "\"Cannot get JNDI initial context at provider '\"", "+", "url", "+", "\"' with factory '\"", "+", "factory", "+", "\"'\"", ",", "e", ")", ";", "}", "}" ]
Get the initial context. @return the initial context.
[ "Get", "the", "initial", "context", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-jms-control/src/main/java/org/apache/beehive/controls/system/jndi/impl/JndiControlImpl.java#L60-L98
146,553
moparisthebest/beehive
beehive-jms-control/src/main/java/org/apache/beehive/controls/system/jndi/impl/JndiControlImpl.java
JndiControlImpl.nullIfEmpty
protected String nullIfEmpty(String str) { return (str == null || str.trim().length() == 0) ? null : str; }
java
protected String nullIfEmpty(String str) { return (str == null || str.trim().length() == 0) ? null : str; }
[ "protected", "String", "nullIfEmpty", "(", "String", "str", ")", "{", "return", "(", "str", "==", "null", "||", "str", ".", "trim", "(", ")", ".", "length", "(", ")", "==", "0", ")", "?", "null", ":", "str", ";", "}" ]
Return null if the given string is null or an empty string. @param str a string. @return null or the string.
[ "Return", "null", "if", "the", "given", "string", "is", "null", "or", "an", "empty", "string", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-jms-control/src/main/java/org/apache/beehive/controls/system/jndi/impl/JndiControlImpl.java#L106-L108
146,554
iig-uni-freiburg/SEWOL
ext/org/deckfour/xes/info/impl/XAttributeInfoImpl.java
XAttributeInfoImpl.register
public void register(XAttribute attribute) { if(keyMap.containsKey(attribute.getKey()) == false) { // create new attribute prototype XAttribute prototype = XAttributeUtils.derivePrototype(attribute); // add to main map keyMap.put(attribute.getKey(), prototype); // initialize frequency frequencies.put(attribute.getKey(), 1); // register with type map Set<XAttribute> typeSet = typeMap.get(XAttributeUtils.getType(prototype)); if(typeSet == null) { typeSet = new HashSet<XAttribute>(); typeMap.put(XAttributeUtils.getType(prototype), typeSet); } typeSet.add(prototype); // register with extension map if(attribute.getExtension() == null) { // non-extension attribute noExtensionSet.add(prototype); } else { // register with extension map Set<XAttribute> extensionSet = extensionMap.get(attribute.getExtension()); if(extensionSet == null) { extensionSet = new HashSet<XAttribute>(); extensionMap.put(attribute.getExtension(), extensionSet); } extensionSet.add(prototype); } } else { // adjust frequency frequencies.put(attribute.getKey(), frequencies.get(attribute.getKey()) + 1); } // adjust total frequency totalFrequency++; }
java
public void register(XAttribute attribute) { if(keyMap.containsKey(attribute.getKey()) == false) { // create new attribute prototype XAttribute prototype = XAttributeUtils.derivePrototype(attribute); // add to main map keyMap.put(attribute.getKey(), prototype); // initialize frequency frequencies.put(attribute.getKey(), 1); // register with type map Set<XAttribute> typeSet = typeMap.get(XAttributeUtils.getType(prototype)); if(typeSet == null) { typeSet = new HashSet<XAttribute>(); typeMap.put(XAttributeUtils.getType(prototype), typeSet); } typeSet.add(prototype); // register with extension map if(attribute.getExtension() == null) { // non-extension attribute noExtensionSet.add(prototype); } else { // register with extension map Set<XAttribute> extensionSet = extensionMap.get(attribute.getExtension()); if(extensionSet == null) { extensionSet = new HashSet<XAttribute>(); extensionMap.put(attribute.getExtension(), extensionSet); } extensionSet.add(prototype); } } else { // adjust frequency frequencies.put(attribute.getKey(), frequencies.get(attribute.getKey()) + 1); } // adjust total frequency totalFrequency++; }
[ "public", "void", "register", "(", "XAttribute", "attribute", ")", "{", "if", "(", "keyMap", ".", "containsKey", "(", "attribute", ".", "getKey", "(", ")", ")", "==", "false", ")", "{", "// create new attribute prototype", "XAttribute", "prototype", "=", "XAttributeUtils", ".", "derivePrototype", "(", "attribute", ")", ";", "// add to main map", "keyMap", ".", "put", "(", "attribute", ".", "getKey", "(", ")", ",", "prototype", ")", ";", "// initialize frequency", "frequencies", ".", "put", "(", "attribute", ".", "getKey", "(", ")", ",", "1", ")", ";", "// register with type map", "Set", "<", "XAttribute", ">", "typeSet", "=", "typeMap", ".", "get", "(", "XAttributeUtils", ".", "getType", "(", "prototype", ")", ")", ";", "if", "(", "typeSet", "==", "null", ")", "{", "typeSet", "=", "new", "HashSet", "<", "XAttribute", ">", "(", ")", ";", "typeMap", ".", "put", "(", "XAttributeUtils", ".", "getType", "(", "prototype", ")", ",", "typeSet", ")", ";", "}", "typeSet", ".", "add", "(", "prototype", ")", ";", "// register with extension map", "if", "(", "attribute", ".", "getExtension", "(", ")", "==", "null", ")", "{", "// non-extension attribute", "noExtensionSet", ".", "add", "(", "prototype", ")", ";", "}", "else", "{", "// register with extension map", "Set", "<", "XAttribute", ">", "extensionSet", "=", "extensionMap", ".", "get", "(", "attribute", ".", "getExtension", "(", ")", ")", ";", "if", "(", "extensionSet", "==", "null", ")", "{", "extensionSet", "=", "new", "HashSet", "<", "XAttribute", ">", "(", ")", ";", "extensionMap", ".", "put", "(", "attribute", ".", "getExtension", "(", ")", ",", "extensionSet", ")", ";", "}", "extensionSet", ".", "add", "(", "prototype", ")", ";", "}", "}", "else", "{", "// adjust frequency", "frequencies", ".", "put", "(", "attribute", ".", "getKey", "(", ")", ",", "frequencies", ".", "get", "(", "attribute", ".", "getKey", "(", ")", ")", "+", "1", ")", ";", "}", "// adjust total frequency", "totalFrequency", "++", ";", "}" ]
Registers a concrete attribute with this registry. @param attribute Attribute to be registered.
[ "Registers", "a", "concrete", "attribute", "with", "this", "registry", "." ]
e791cb07a6e62ecf837d760d58a25f32fbf6bbca
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/ext/org/deckfour/xes/info/impl/XAttributeInfoImpl.java#L212-L246
146,555
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/core/urltemplates/URLTemplates.java
URLTemplates.addTemplate
public void addTemplate( String templateName, URLTemplate template ) { if ( templateName == null || templateName.length() == 0 ) { throw new IllegalArgumentException( "Template name cannot be null or empty." ); } if ( template == null ) { throw new IllegalArgumentException( "URLTemplate cannot be null." ); } _templates.put( templateName, template ); }
java
public void addTemplate( String templateName, URLTemplate template ) { if ( templateName == null || templateName.length() == 0 ) { throw new IllegalArgumentException( "Template name cannot be null or empty." ); } if ( template == null ) { throw new IllegalArgumentException( "URLTemplate cannot be null." ); } _templates.put( templateName, template ); }
[ "public", "void", "addTemplate", "(", "String", "templateName", ",", "URLTemplate", "template", ")", "{", "if", "(", "templateName", "==", "null", "||", "templateName", ".", "length", "(", ")", "==", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Template name cannot be null or empty.\"", ")", ";", "}", "if", "(", "template", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"URLTemplate cannot be null.\"", ")", ";", "}", "_templates", ".", "put", "(", "templateName", ",", "template", ")", ";", "}" ]
Add a template from url-template-config by name. @param templateName the name of the template. @param template the template to add.
[ "Add", "a", "template", "from", "url", "-", "template", "-", "config", "by", "name", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/core/urltemplates/URLTemplates.java#L41-L54
146,556
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/core/urltemplates/URLTemplates.java
URLTemplates.getTemplates
public URLTemplate[] getTemplates() { URLTemplate[] templates = new URLTemplate[ _templates.size() ]; int index = 0; for ( Iterator i = _templates.keySet().iterator(); i.hasNext(); ) { String name = ( String ) i.next(); templates[index++] = getTemplate( name ); } return templates; }
java
public URLTemplate[] getTemplates() { URLTemplate[] templates = new URLTemplate[ _templates.size() ]; int index = 0; for ( Iterator i = _templates.keySet().iterator(); i.hasNext(); ) { String name = ( String ) i.next(); templates[index++] = getTemplate( name ); } return templates; }
[ "public", "URLTemplate", "[", "]", "getTemplates", "(", ")", "{", "URLTemplate", "[", "]", "templates", "=", "new", "URLTemplate", "[", "_templates", ".", "size", "(", ")", "]", ";", "int", "index", "=", "0", ";", "for", "(", "Iterator", "i", "=", "_templates", ".", "keySet", "(", ")", ".", "iterator", "(", ")", ";", "i", ".", "hasNext", "(", ")", ";", ")", "{", "String", "name", "=", "(", "String", ")", "i", ".", "next", "(", ")", ";", "templates", "[", "index", "++", "]", "=", "getTemplate", "(", "name", ")", ";", "}", "return", "templates", ";", "}" ]
Returns the URL templates from url-template-config by name. Always returns a copy of the URLTemplates with the same parsed template data but with cleared set of token values. This allows multiple client requests access to the same parsed template structure, without requiring it to be parsed for each request. @return an array of the URL templates with the template names as the key.
[ "Returns", "the", "URL", "templates", "from", "url", "-", "template", "-", "config", "by", "name", ".", "Always", "returns", "a", "copy", "of", "the", "URLTemplates", "with", "the", "same", "parsed", "template", "data", "but", "with", "cleared", "set", "of", "token", "values", ".", "This", "allows", "multiple", "client", "requests", "access", "to", "the", "same", "parsed", "template", "structure", "without", "requiring", "it", "to", "be", "parsed", "for", "each", "request", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/core/urltemplates/URLTemplates.java#L67-L78
146,557
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/core/urltemplates/URLTemplates.java
URLTemplates.addTemplateRefGroup
public void addTemplateRefGroup( String refGroupName, Map/*< String, String >*/ templateRefGroup ) { if ( refGroupName == null || refGroupName.length() == 0 ) { throw new IllegalArgumentException( "Template Reference Group name cannot be null or empty." ); } if ( templateRefGroup == null || templateRefGroup.size() == 0 ) { throw new IllegalArgumentException( "Template Reference Group cannot be null or empty." ); } _templateRefGroups.put( refGroupName, templateRefGroup ); }
java
public void addTemplateRefGroup( String refGroupName, Map/*< String, String >*/ templateRefGroup ) { if ( refGroupName == null || refGroupName.length() == 0 ) { throw new IllegalArgumentException( "Template Reference Group name cannot be null or empty." ); } if ( templateRefGroup == null || templateRefGroup.size() == 0 ) { throw new IllegalArgumentException( "Template Reference Group cannot be null or empty." ); } _templateRefGroups.put( refGroupName, templateRefGroup ); }
[ "public", "void", "addTemplateRefGroup", "(", "String", "refGroupName", ",", "Map", "/*< String, String >*/", "templateRefGroup", ")", "{", "if", "(", "refGroupName", "==", "null", "||", "refGroupName", ".", "length", "(", ")", "==", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Template Reference Group name cannot be null or empty.\"", ")", ";", "}", "if", "(", "templateRefGroup", "==", "null", "||", "templateRefGroup", ".", "size", "(", ")", "==", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Template Reference Group cannot be null or empty.\"", ")", ";", "}", "_templateRefGroups", ".", "put", "(", "refGroupName", ",", "templateRefGroup", ")", ";", "}" ]
Add a template reference group from url-template-config by name. @param refGroupName the name of the template reference group. @param templateRefGroup the template reference group.
[ "Add", "a", "template", "reference", "group", "from", "url", "-", "template", "-", "config", "by", "name", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/core/urltemplates/URLTemplates.java#L107-L120
146,558
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/core/urltemplates/URLTemplates.java
URLTemplates.getTemplateNameByRef
public String getTemplateNameByRef( String refGroupName, String key ) { String templateName = null; Map/*< String, String >*/ templateRefGroup = ( Map ) _templateRefGroups.get( refGroupName ); if ( templateRefGroup != null ) { templateName = ( String ) templateRefGroup.get( key ); } return templateName; }
java
public String getTemplateNameByRef( String refGroupName, String key ) { String templateName = null; Map/*< String, String >*/ templateRefGroup = ( Map ) _templateRefGroups.get( refGroupName ); if ( templateRefGroup != null ) { templateName = ( String ) templateRefGroup.get( key ); } return templateName; }
[ "public", "String", "getTemplateNameByRef", "(", "String", "refGroupName", ",", "String", "key", ")", "{", "String", "templateName", "=", "null", ";", "Map", "/*< String, String >*/", "templateRefGroup", "=", "(", "Map", ")", "_templateRefGroups", ".", "get", "(", "refGroupName", ")", ";", "if", "(", "templateRefGroup", "!=", "null", ")", "{", "templateName", "=", "(", "String", ")", "templateRefGroup", ".", "get", "(", "key", ")", ";", "}", "return", "templateName", ";", "}" ]
Retrieve a template name from a reference group in url-template-config. @param refGroupName the name of the template reference group. @param key the key to the particular template reference in the group. @return a template name from the reference group.
[ "Retrieve", "a", "template", "name", "from", "a", "reference", "group", "in", "url", "-", "template", "-", "config", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/core/urltemplates/URLTemplates.java#L129-L139
146,559
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/databinding/datagrid/ImageCell.java
ImageCell.setOnMouseDown
public void setOnMouseDown(String onMouseDown) { _imageState.registerAttribute(AbstractHtmlState.ATTR_JAVASCRIPT, HtmlConstants.ONMOUSEDOWN, onMouseDown); }
java
public void setOnMouseDown(String onMouseDown) { _imageState.registerAttribute(AbstractHtmlState.ATTR_JAVASCRIPT, HtmlConstants.ONMOUSEDOWN, onMouseDown); }
[ "public", "void", "setOnMouseDown", "(", "String", "onMouseDown", ")", "{", "_imageState", ".", "registerAttribute", "(", "AbstractHtmlState", ".", "ATTR_JAVASCRIPT", ",", "HtmlConstants", ".", "ONMOUSEDOWN", ",", "onMouseDown", ")", ";", "}" ]
Sets the onMouseDown JavaScript event on the image tag. @param onMouseDown the onMouseDown event. @jsptagref.attributedescription The onMouseDown JavaScript event on the image tag. @jsptagref.attributesyntaxvalue <i>string_onMouseDown</i> @netui:attribute required="false" rtexprvalue="true" description="The onMouseDown JavaScript event on the image tag."
[ "Sets", "the", "onMouseDown", "JavaScript", "event", "on", "the", "image", "tag", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/databinding/datagrid/ImageCell.java#L158-L160
146,560
iig-uni-freiburg/SEWOL
src/de/uni/freiburg/iig/telematik/sewol/context/constraint/ConstraintContextProperties.java
ConstraintContextProperties.addRoutingConstraint
public void addRoutingConstraint(String activity, AbstractConstraint<?> constraint) throws PropertyException{ Validate.notNull(activity); Validate.notEmpty(activity); Validate.notNull(constraint); //1. Add constraint itself // This also adds the constraint to the list of constraints String propertyNameForNewConstraint = addConstraint(constraint); //2. Add constraint name to the list of constraints for this activity Set<String> currentConstraintNames = getConstraintNames(activity); currentConstraintNames.add(propertyNameForNewConstraint); if(currentConstraintNames.size() == 1){ //Add the activity to the list of activities with routing constraints addActivityWithConstraints(activity); } props.setProperty(String.format(ACTIVITY_CONSTRAINTS_FORMAT, activity), ArrayUtils.toString(currentConstraintNames.toArray())); }
java
public void addRoutingConstraint(String activity, AbstractConstraint<?> constraint) throws PropertyException{ Validate.notNull(activity); Validate.notEmpty(activity); Validate.notNull(constraint); //1. Add constraint itself // This also adds the constraint to the list of constraints String propertyNameForNewConstraint = addConstraint(constraint); //2. Add constraint name to the list of constraints for this activity Set<String> currentConstraintNames = getConstraintNames(activity); currentConstraintNames.add(propertyNameForNewConstraint); if(currentConstraintNames.size() == 1){ //Add the activity to the list of activities with routing constraints addActivityWithConstraints(activity); } props.setProperty(String.format(ACTIVITY_CONSTRAINTS_FORMAT, activity), ArrayUtils.toString(currentConstraintNames.toArray())); }
[ "public", "void", "addRoutingConstraint", "(", "String", "activity", ",", "AbstractConstraint", "<", "?", ">", "constraint", ")", "throws", "PropertyException", "{", "Validate", ".", "notNull", "(", "activity", ")", ";", "Validate", ".", "notEmpty", "(", "activity", ")", ";", "Validate", ".", "notNull", "(", "constraint", ")", ";", "//1. Add constraint itself", "// This also adds the constraint to the list of constraints", "String", "propertyNameForNewConstraint", "=", "addConstraint", "(", "constraint", ")", ";", "//2. Add constraint name to the list of constraints for this activity", "Set", "<", "String", ">", "currentConstraintNames", "=", "getConstraintNames", "(", "activity", ")", ";", "currentConstraintNames", ".", "add", "(", "propertyNameForNewConstraint", ")", ";", "if", "(", "currentConstraintNames", ".", "size", "(", ")", "==", "1", ")", "{", "//Add the activity to the list of activities with routing constraints", "addActivityWithConstraints", "(", "activity", ")", ";", "}", "props", ".", "setProperty", "(", "String", ".", "format", "(", "ACTIVITY_CONSTRAINTS_FORMAT", ",", "activity", ")", ",", "ArrayUtils", ".", "toString", "(", "currentConstraintNames", ".", "toArray", "(", ")", ")", ")", ";", "}" ]
Adds a routing constraint for an activity. @param activity The name of the activity for which the constraint is added. @param constraint The routing constraint to add. @throws ParameterException if the given parameters are invalid. @throws PropertyException if the given constraint cannot be added as a property. @see #addConstraint(AbstractConstraint) @see #addActivityWithConstraints(String)
[ "Adds", "a", "routing", "constraint", "for", "an", "activity", "." ]
e791cb07a6e62ecf837d760d58a25f32fbf6bbca
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/src/de/uni/freiburg/iig/telematik/sewol/context/constraint/ConstraintContextProperties.java#L43-L60
146,561
iig-uni-freiburg/SEWOL
src/de/uni/freiburg/iig/telematik/sewol/context/constraint/ConstraintContextProperties.java
ConstraintContextProperties.addActivityWithConstraints
private void addActivityWithConstraints(String activity) { Validate.notNull(activity); Validate.notEmpty(activity); Set<String> currentActivities = getActivitiesWithRoutingConstraints(); currentActivities.add(activity); setProperty(ConstraintContextProperty.ACTIVITIES_WITH_CONSTRAINTS, ArrayUtils.toString(currentActivities.toArray())); }
java
private void addActivityWithConstraints(String activity) { Validate.notNull(activity); Validate.notEmpty(activity); Set<String> currentActivities = getActivitiesWithRoutingConstraints(); currentActivities.add(activity); setProperty(ConstraintContextProperty.ACTIVITIES_WITH_CONSTRAINTS, ArrayUtils.toString(currentActivities.toArray())); }
[ "private", "void", "addActivityWithConstraints", "(", "String", "activity", ")", "{", "Validate", ".", "notNull", "(", "activity", ")", ";", "Validate", ".", "notEmpty", "(", "activity", ")", ";", "Set", "<", "String", ">", "currentActivities", "=", "getActivitiesWithRoutingConstraints", "(", ")", ";", "currentActivities", ".", "add", "(", "activity", ")", ";", "setProperty", "(", "ConstraintContextProperty", ".", "ACTIVITIES_WITH_CONSTRAINTS", ",", "ArrayUtils", ".", "toString", "(", "currentActivities", ".", "toArray", "(", ")", ")", ")", ";", "}" ]
Adds an activity to the list of activities with routing constraints. @param activity The name of the activity to add. @throws ParameterException if the activity name is invalid.
[ "Adds", "an", "activity", "to", "the", "list", "of", "activities", "with", "routing", "constraints", "." ]
e791cb07a6e62ecf837d760d58a25f32fbf6bbca
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/src/de/uni/freiburg/iig/telematik/sewol/context/constraint/ConstraintContextProperties.java#L67-L73
146,562
iig-uni-freiburg/SEWOL
src/de/uni/freiburg/iig/telematik/sewol/context/constraint/ConstraintContextProperties.java
ConstraintContextProperties.removeActivityWithConstraints
private void removeActivityWithConstraints(String activity) { Validate.notNull(activity); Validate.notEmpty(activity); Set<String> currentActivities = getActivitiesWithRoutingConstraints(); currentActivities.remove(activity); setProperty(ConstraintContextProperty.ACTIVITIES_WITH_CONSTRAINTS, ArrayUtils.toString(currentActivities.toArray())); }
java
private void removeActivityWithConstraints(String activity) { Validate.notNull(activity); Validate.notEmpty(activity); Set<String> currentActivities = getActivitiesWithRoutingConstraints(); currentActivities.remove(activity); setProperty(ConstraintContextProperty.ACTIVITIES_WITH_CONSTRAINTS, ArrayUtils.toString(currentActivities.toArray())); }
[ "private", "void", "removeActivityWithConstraints", "(", "String", "activity", ")", "{", "Validate", ".", "notNull", "(", "activity", ")", ";", "Validate", ".", "notEmpty", "(", "activity", ")", ";", "Set", "<", "String", ">", "currentActivities", "=", "getActivitiesWithRoutingConstraints", "(", ")", ";", "currentActivities", ".", "remove", "(", "activity", ")", ";", "setProperty", "(", "ConstraintContextProperty", ".", "ACTIVITIES_WITH_CONSTRAINTS", ",", "ArrayUtils", ".", "toString", "(", "currentActivities", ".", "toArray", "(", ")", ")", ")", ";", "}" ]
Removes an activity from the list of activities with routing constraints. @param activity The name of the activity to remove. @throws ParameterException if the activity name is invalid.
[ "Removes", "an", "activity", "from", "the", "list", "of", "activities", "with", "routing", "constraints", "." ]
e791cb07a6e62ecf837d760d58a25f32fbf6bbca
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/src/de/uni/freiburg/iig/telematik/sewol/context/constraint/ConstraintContextProperties.java#L80-L86
146,563
iig-uni-freiburg/SEWOL
src/de/uni/freiburg/iig/telematik/sewol/context/constraint/ConstraintContextProperties.java
ConstraintContextProperties.getActivitiesWithRoutingConstraints
public Set<String> getActivitiesWithRoutingConstraints(){ Set<String> result = new HashSet<>(); String propertyValue = getProperty(ConstraintContextProperty.ACTIVITIES_WITH_CONSTRAINTS); if(propertyValue == null) return result; StringTokenizer activityTokens = StringUtils.splitArrayString(propertyValue, " "); while(activityTokens.hasMoreTokens()){ result.add(activityTokens.nextToken()); } return result; }
java
public Set<String> getActivitiesWithRoutingConstraints(){ Set<String> result = new HashSet<>(); String propertyValue = getProperty(ConstraintContextProperty.ACTIVITIES_WITH_CONSTRAINTS); if(propertyValue == null) return result; StringTokenizer activityTokens = StringUtils.splitArrayString(propertyValue, " "); while(activityTokens.hasMoreTokens()){ result.add(activityTokens.nextToken()); } return result; }
[ "public", "Set", "<", "String", ">", "getActivitiesWithRoutingConstraints", "(", ")", "{", "Set", "<", "String", ">", "result", "=", "new", "HashSet", "<>", "(", ")", ";", "String", "propertyValue", "=", "getProperty", "(", "ConstraintContextProperty", ".", "ACTIVITIES_WITH_CONSTRAINTS", ")", ";", "if", "(", "propertyValue", "==", "null", ")", "return", "result", ";", "StringTokenizer", "activityTokens", "=", "StringUtils", ".", "splitArrayString", "(", "propertyValue", ",", "\" \"", ")", ";", "while", "(", "activityTokens", ".", "hasMoreTokens", "(", ")", ")", "{", "result", ".", "add", "(", "activityTokens", ".", "nextToken", "(", ")", ")", ";", "}", "return", "result", ";", "}" ]
Returns the names of all activities with routing constraints. @return A set of all activities with routing constraints.
[ "Returns", "the", "names", "of", "all", "activities", "with", "routing", "constraints", "." ]
e791cb07a6e62ecf837d760d58a25f32fbf6bbca
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/src/de/uni/freiburg/iig/telematik/sewol/context/constraint/ConstraintContextProperties.java#L92-L102
146,564
iig-uni-freiburg/SEWOL
src/de/uni/freiburg/iig/telematik/sewol/context/constraint/ConstraintContextProperties.java
ConstraintContextProperties.getRoutingConstraints
public Set<AbstractConstraint<?>> getRoutingConstraints(String activity) throws PropertyException{ Set<String> constraintNames = getConstraintNames(activity); Set<AbstractConstraint<?>> result = new HashSet<>(); for(String constraintName: constraintNames){ result.add(getConstraint(constraintName)); } return result; }
java
public Set<AbstractConstraint<?>> getRoutingConstraints(String activity) throws PropertyException{ Set<String> constraintNames = getConstraintNames(activity); Set<AbstractConstraint<?>> result = new HashSet<>(); for(String constraintName: constraintNames){ result.add(getConstraint(constraintName)); } return result; }
[ "public", "Set", "<", "AbstractConstraint", "<", "?", ">", ">", "getRoutingConstraints", "(", "String", "activity", ")", "throws", "PropertyException", "{", "Set", "<", "String", ">", "constraintNames", "=", "getConstraintNames", "(", "activity", ")", ";", "Set", "<", "AbstractConstraint", "<", "?", ">", ">", "result", "=", "new", "HashSet", "<>", "(", ")", ";", "for", "(", "String", "constraintName", ":", "constraintNames", ")", "{", "result", ".", "add", "(", "getConstraint", "(", "constraintName", ")", ")", ";", "}", "return", "result", ";", "}" ]
Returns all routing constraints of the given activity in form of constraint-objects. @param activity The name of the activity whose routing constraints are requested. @return A possibly empty set of routing constraints. @throws ParameterException if the activity name is <code>null</code> or empty. @throws PropertyException if corresponding constraint-properties cannot be extracted. @see #getConstraintNames(String) @see #getConstraint(String)
[ "Returns", "all", "routing", "constraints", "of", "the", "given", "activity", "in", "form", "of", "constraint", "-", "objects", "." ]
e791cb07a6e62ecf837d760d58a25f32fbf6bbca
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/src/de/uni/freiburg/iig/telematik/sewol/context/constraint/ConstraintContextProperties.java#L225-L232
146,565
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/databinding/cellrepeater/CellRepeater.java
CellRepeater.doStartTag
public int doStartTag() throws JspException { ServletRequest request = pageContext.getRequest(); _tableRenderer = TagRenderingBase.Factory.getRendering(TagRenderingBase.TABLE_TAG, request); _trRenderer = TagRenderingBase.Factory.getRendering(TagRenderingBase.TR_TAG, request); _tdRenderer = TagRenderingBase.Factory.getRendering(TagRenderingBase.TD_TAG, request); _htmlConstantRendering = TagRenderingBase.Factory.getConstantRendering(request); _sb = new InternalStringBuilder(1024); _appender = new StringBuilderRenderAppender(_sb); Object source = evaluateDataSource(); if(hasErrors()) return SKIP_BODY; if(source != null) { Iterator iterator = IteratorFactory.createIterator(source); if(iterator == null) { LOGGER.info("CellRepeater: The data structure from which to create an iterator is null."); iterator = Collections.EMPTY_LIST.iterator(); } if(iterator != null) { _dataList = new ArrayList(); while(iterator.hasNext()) { _dataList.add(iterator.next()); } } } if(_rows == DIMENSION_DEFAULT_VALUE || _columns == DIMENSION_DEFAULT_VALUE) { /* try to guess the dimensions of the table */ if(_dataList != null && _dataList.size() > 0) { guessDimensions(_dataList); if(hasErrors()) return SKIP_BODY; } /* the size of the data set isn't guessable */ else { _valid = false; return SKIP_BODY; } } /* check to make sure the rows / columns are actually valid before starting to render */ if(_rows <= 0) { String msg = Bundle.getString("Tags_CellRepeater_invalidRowValue", new Object[]{getTagName(), new Integer(_rows)}); registerTagError(msg, null); } if(_columns <= 0) { String msg = Bundle.getString("Tags_CellRepeater_invalidColumnValue", new Object[]{getTagName(), new Integer(_columns)}); registerTagError(msg, null); } if(hasErrors()) return SKIP_BODY; openTableTag(_appender, _tableState); _currentRow = 0; _currentColumn = 0; DataAccessProviderStack.addDataAccessProvider(this, pageContext); _containerInPageContext = true; boolean haveItem = ensureItem(0, _dataList); if(haveItem) { openRowTag(_appender, _trState); openCellTag(_appender, _currentColumn); return EVAL_BODY_BUFFERED; } else { // special case -- with no items, render the entire table here for(int i = 0; i < _rows; i++) { openRowTag(_appender, _trState); for(int j = 0; j < _columns; j++) { openCellTag(_appender, computeStyleIndex(i, j)); _htmlConstantRendering.NBSP(_appender); closeCellTag(_appender); } closeRowTag(_appender); _appender.append("\n"); } _currentRow = _rows; _currentColumn = _columns; return SKIP_BODY; } }
java
public int doStartTag() throws JspException { ServletRequest request = pageContext.getRequest(); _tableRenderer = TagRenderingBase.Factory.getRendering(TagRenderingBase.TABLE_TAG, request); _trRenderer = TagRenderingBase.Factory.getRendering(TagRenderingBase.TR_TAG, request); _tdRenderer = TagRenderingBase.Factory.getRendering(TagRenderingBase.TD_TAG, request); _htmlConstantRendering = TagRenderingBase.Factory.getConstantRendering(request); _sb = new InternalStringBuilder(1024); _appender = new StringBuilderRenderAppender(_sb); Object source = evaluateDataSource(); if(hasErrors()) return SKIP_BODY; if(source != null) { Iterator iterator = IteratorFactory.createIterator(source); if(iterator == null) { LOGGER.info("CellRepeater: The data structure from which to create an iterator is null."); iterator = Collections.EMPTY_LIST.iterator(); } if(iterator != null) { _dataList = new ArrayList(); while(iterator.hasNext()) { _dataList.add(iterator.next()); } } } if(_rows == DIMENSION_DEFAULT_VALUE || _columns == DIMENSION_DEFAULT_VALUE) { /* try to guess the dimensions of the table */ if(_dataList != null && _dataList.size() > 0) { guessDimensions(_dataList); if(hasErrors()) return SKIP_BODY; } /* the size of the data set isn't guessable */ else { _valid = false; return SKIP_BODY; } } /* check to make sure the rows / columns are actually valid before starting to render */ if(_rows <= 0) { String msg = Bundle.getString("Tags_CellRepeater_invalidRowValue", new Object[]{getTagName(), new Integer(_rows)}); registerTagError(msg, null); } if(_columns <= 0) { String msg = Bundle.getString("Tags_CellRepeater_invalidColumnValue", new Object[]{getTagName(), new Integer(_columns)}); registerTagError(msg, null); } if(hasErrors()) return SKIP_BODY; openTableTag(_appender, _tableState); _currentRow = 0; _currentColumn = 0; DataAccessProviderStack.addDataAccessProvider(this, pageContext); _containerInPageContext = true; boolean haveItem = ensureItem(0, _dataList); if(haveItem) { openRowTag(_appender, _trState); openCellTag(_appender, _currentColumn); return EVAL_BODY_BUFFERED; } else { // special case -- with no items, render the entire table here for(int i = 0; i < _rows; i++) { openRowTag(_appender, _trState); for(int j = 0; j < _columns; j++) { openCellTag(_appender, computeStyleIndex(i, j)); _htmlConstantRendering.NBSP(_appender); closeCellTag(_appender); } closeRowTag(_appender); _appender.append("\n"); } _currentRow = _rows; _currentColumn = _columns; return SKIP_BODY; } }
[ "public", "int", "doStartTag", "(", ")", "throws", "JspException", "{", "ServletRequest", "request", "=", "pageContext", ".", "getRequest", "(", ")", ";", "_tableRenderer", "=", "TagRenderingBase", ".", "Factory", ".", "getRendering", "(", "TagRenderingBase", ".", "TABLE_TAG", ",", "request", ")", ";", "_trRenderer", "=", "TagRenderingBase", ".", "Factory", ".", "getRendering", "(", "TagRenderingBase", ".", "TR_TAG", ",", "request", ")", ";", "_tdRenderer", "=", "TagRenderingBase", ".", "Factory", ".", "getRendering", "(", "TagRenderingBase", ".", "TD_TAG", ",", "request", ")", ";", "_htmlConstantRendering", "=", "TagRenderingBase", ".", "Factory", ".", "getConstantRendering", "(", "request", ")", ";", "_sb", "=", "new", "InternalStringBuilder", "(", "1024", ")", ";", "_appender", "=", "new", "StringBuilderRenderAppender", "(", "_sb", ")", ";", "Object", "source", "=", "evaluateDataSource", "(", ")", ";", "if", "(", "hasErrors", "(", ")", ")", "return", "SKIP_BODY", ";", "if", "(", "source", "!=", "null", ")", "{", "Iterator", "iterator", "=", "IteratorFactory", ".", "createIterator", "(", "source", ")", ";", "if", "(", "iterator", "==", "null", ")", "{", "LOGGER", ".", "info", "(", "\"CellRepeater: The data structure from which to create an iterator is null.\"", ")", ";", "iterator", "=", "Collections", ".", "EMPTY_LIST", ".", "iterator", "(", ")", ";", "}", "if", "(", "iterator", "!=", "null", ")", "{", "_dataList", "=", "new", "ArrayList", "(", ")", ";", "while", "(", "iterator", ".", "hasNext", "(", ")", ")", "{", "_dataList", ".", "add", "(", "iterator", ".", "next", "(", ")", ")", ";", "}", "}", "}", "if", "(", "_rows", "==", "DIMENSION_DEFAULT_VALUE", "||", "_columns", "==", "DIMENSION_DEFAULT_VALUE", ")", "{", "/* try to guess the dimensions of the table */", "if", "(", "_dataList", "!=", "null", "&&", "_dataList", ".", "size", "(", ")", ">", "0", ")", "{", "guessDimensions", "(", "_dataList", ")", ";", "if", "(", "hasErrors", "(", ")", ")", "return", "SKIP_BODY", ";", "}", "/* the size of the data set isn't guessable */", "else", "{", "_valid", "=", "false", ";", "return", "SKIP_BODY", ";", "}", "}", "/* check to make sure the rows / columns are actually valid before starting to render */", "if", "(", "_rows", "<=", "0", ")", "{", "String", "msg", "=", "Bundle", ".", "getString", "(", "\"Tags_CellRepeater_invalidRowValue\"", ",", "new", "Object", "[", "]", "{", "getTagName", "(", ")", ",", "new", "Integer", "(", "_rows", ")", "}", ")", ";", "registerTagError", "(", "msg", ",", "null", ")", ";", "}", "if", "(", "_columns", "<=", "0", ")", "{", "String", "msg", "=", "Bundle", ".", "getString", "(", "\"Tags_CellRepeater_invalidColumnValue\"", ",", "new", "Object", "[", "]", "{", "getTagName", "(", ")", ",", "new", "Integer", "(", "_columns", ")", "}", ")", ";", "registerTagError", "(", "msg", ",", "null", ")", ";", "}", "if", "(", "hasErrors", "(", ")", ")", "return", "SKIP_BODY", ";", "openTableTag", "(", "_appender", ",", "_tableState", ")", ";", "_currentRow", "=", "0", ";", "_currentColumn", "=", "0", ";", "DataAccessProviderStack", ".", "addDataAccessProvider", "(", "this", ",", "pageContext", ")", ";", "_containerInPageContext", "=", "true", ";", "boolean", "haveItem", "=", "ensureItem", "(", "0", ",", "_dataList", ")", ";", "if", "(", "haveItem", ")", "{", "openRowTag", "(", "_appender", ",", "_trState", ")", ";", "openCellTag", "(", "_appender", ",", "_currentColumn", ")", ";", "return", "EVAL_BODY_BUFFERED", ";", "}", "else", "{", "// special case -- with no items, render the entire table here", "for", "(", "int", "i", "=", "0", ";", "i", "<", "_rows", ";", "i", "++", ")", "{", "openRowTag", "(", "_appender", ",", "_trState", ")", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "_columns", ";", "j", "++", ")", "{", "openCellTag", "(", "_appender", ",", "computeStyleIndex", "(", "i", ",", "j", ")", ")", ";", "_htmlConstantRendering", ".", "NBSP", "(", "_appender", ")", ";", "closeCellTag", "(", "_appender", ")", ";", "}", "closeRowTag", "(", "_appender", ")", ";", "_appender", ".", "append", "(", "\"\\n\"", ")", ";", "}", "_currentRow", "=", "_rows", ";", "_currentColumn", "=", "_columns", ";", "return", "SKIP_BODY", ";", "}", "}" ]
Prepare to render the dataset that was specified in the dataSource attribute. The dataSource expression is evaluated and the table's dimensions are computed. If there is no data in the dataset but the rows and columns attributes were specified, an empty table of the given dimensions is rendered. @return EVAL_BODY_BUFFERED or SKIP_BODY if errors are reported, the data set is null, or there is no data in the data set @throws JspException if errors occurred that could not be reported in the page
[ "Prepare", "to", "render", "the", "dataset", "that", "was", "specified", "in", "the", "dataSource", "attribute", ".", "The", "dataSource", "expression", "is", "evaluated", "and", "the", "table", "s", "dimensions", "are", "computed", ".", "If", "there", "is", "no", "data", "in", "the", "dataset", "but", "the", "rows", "and", "columns", "attributes", "were", "specified", "an", "empty", "table", "of", "the", "given", "dimensions", "is", "rendered", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/databinding/cellrepeater/CellRepeater.java#L418-L509
146,566
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/databinding/cellrepeater/CellRepeater.java
CellRepeater.doEndTag
public int doEndTag() throws JspException { if(hasErrors()) reportErrors(); else if(_valid) { closeTableTag(_appender); write(_sb.toString()); } return EVAL_PAGE; }
java
public int doEndTag() throws JspException { if(hasErrors()) reportErrors(); else if(_valid) { closeTableTag(_appender); write(_sb.toString()); } return EVAL_PAGE; }
[ "public", "int", "doEndTag", "(", ")", "throws", "JspException", "{", "if", "(", "hasErrors", "(", ")", ")", "reportErrors", "(", ")", ";", "else", "if", "(", "_valid", ")", "{", "closeTableTag", "(", "_appender", ")", ";", "write", "(", "_sb", ".", "toString", "(", ")", ")", ";", "}", "return", "EVAL_PAGE", ";", "}" ]
Complete rendering the tag. If no errors have occurred, the content that the tag buffered is rendered. @return EVAL_PAGE to continue evaluating the page @throws JspException if an error occurs that can not be reported on the page
[ "Complete", "rendering", "the", "tag", ".", "If", "no", "errors", "have", "occurred", "the", "content", "that", "the", "tag", "buffered", "is", "rendered", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/databinding/cellrepeater/CellRepeater.java#L580-L590
146,567
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/databinding/cellrepeater/CellRepeater.java
CellRepeater.getCurrentMetadata
public Object getCurrentMetadata() { LocalizedUnsupportedOperationException uoe = new LocalizedUnsupportedOperationException("The " + getTagName() + "does not export metadata for its iterated items."); uoe.setLocalizedMessage(Bundle.getErrorString("Tags_DataAccessProvider_metadataUnsupported", new Object[]{getTagName()})); throw uoe; }
java
public Object getCurrentMetadata() { LocalizedUnsupportedOperationException uoe = new LocalizedUnsupportedOperationException("The " + getTagName() + "does not export metadata for its iterated items."); uoe.setLocalizedMessage(Bundle.getErrorString("Tags_DataAccessProvider_metadataUnsupported", new Object[]{getTagName()})); throw uoe; }
[ "public", "Object", "getCurrentMetadata", "(", ")", "{", "LocalizedUnsupportedOperationException", "uoe", "=", "new", "LocalizedUnsupportedOperationException", "(", "\"The \"", "+", "getTagName", "(", ")", "+", "\"does not export metadata for its iterated items.\"", ")", ";", "uoe", ".", "setLocalizedMessage", "(", "Bundle", ".", "getErrorString", "(", "\"Tags_DataAccessProvider_metadataUnsupported\"", ",", "new", "Object", "[", "]", "{", "getTagName", "(", ")", "}", ")", ")", ";", "throw", "uoe", ";", "}" ]
Get the metadata for the current item. This method is not supported by this tag. @throws UnsupportedOperationException this tag does not support this method from the IDataAccessProvider interface @see org.apache.beehive.netui.script.common.IDataAccessProvider
[ "Get", "the", "metadata", "for", "the", "current", "item", ".", "This", "method", "is", "not", "supported", "by", "this", "tag", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/databinding/cellrepeater/CellRepeater.java#L644-L649
146,568
iig-uni-freiburg/SEWOL
src/de/uni/freiburg/iig/telematik/sewol/context/process/ProcessContext.java
ProcessContext.removeAttribute
public boolean removeAttribute(String attribute, boolean removeFromACModel, boolean notifyListeners) { if (!super.removeObject(attribute, false)) { return false; } if (acModel != null && removeFromACModel && acModel.getContext() != this) { acModel.getContext().removeObject(attribute); } // Remove data usage of removed attributes for (String activity : activities) { removeDataUsageFor(activity, attribute); } if (notifyListeners) { contextListenerSupport.notifyObjectRemoved(attribute); } return true; }
java
public boolean removeAttribute(String attribute, boolean removeFromACModel, boolean notifyListeners) { if (!super.removeObject(attribute, false)) { return false; } if (acModel != null && removeFromACModel && acModel.getContext() != this) { acModel.getContext().removeObject(attribute); } // Remove data usage of removed attributes for (String activity : activities) { removeDataUsageFor(activity, attribute); } if (notifyListeners) { contextListenerSupport.notifyObjectRemoved(attribute); } return true; }
[ "public", "boolean", "removeAttribute", "(", "String", "attribute", ",", "boolean", "removeFromACModel", ",", "boolean", "notifyListeners", ")", "{", "if", "(", "!", "super", ".", "removeObject", "(", "attribute", ",", "false", ")", ")", "{", "return", "false", ";", "}", "if", "(", "acModel", "!=", "null", "&&", "removeFromACModel", "&&", "acModel", ".", "getContext", "(", ")", "!=", "this", ")", "{", "acModel", ".", "getContext", "(", ")", ".", "removeObject", "(", "attribute", ")", ";", "}", "// Remove data usage of removed attributes", "for", "(", "String", "activity", ":", "activities", ")", "{", "removeDataUsageFor", "(", "activity", ",", "attribute", ")", ";", "}", "if", "(", "notifyListeners", ")", "{", "contextListenerSupport", ".", "notifyObjectRemoved", "(", "attribute", ")", ";", "}", "return", "true", ";", "}" ]
Removes the given attribute from the context. @param attribute @param removeFromACModel @param notifyListeners @return
[ "Removes", "the", "given", "attribute", "from", "the", "context", "." ]
e791cb07a6e62ecf837d760d58a25f32fbf6bbca
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/src/de/uni/freiburg/iig/telematik/sewol/context/process/ProcessContext.java#L360-L377
146,569
iig-uni-freiburg/SEWOL
src/de/uni/freiburg/iig/telematik/sewol/context/process/ProcessContext.java
ProcessContext.validateAttribute
public void validateAttribute(String attribute) throws CompatibilityException { try { super.validateObject(attribute); } catch (CompatibilityException e) { throw new CompatibilityException("Unknown attribute: " + attribute, e); } }
java
public void validateAttribute(String attribute) throws CompatibilityException { try { super.validateObject(attribute); } catch (CompatibilityException e) { throw new CompatibilityException("Unknown attribute: " + attribute, e); } }
[ "public", "void", "validateAttribute", "(", "String", "attribute", ")", "throws", "CompatibilityException", "{", "try", "{", "super", ".", "validateObject", "(", "attribute", ")", ";", "}", "catch", "(", "CompatibilityException", "e", ")", "{", "throw", "new", "CompatibilityException", "(", "\"Unknown attribute: \"", "+", "attribute", ",", "e", ")", ";", "}", "}" ]
Checks if the given attribute is known, i.e. is contained in the attribute list. @param attribute Attribute to be checked. @throws IllegalArgumentException If the given attribute is not known.
[ "Checks", "if", "the", "given", "attribute", "is", "known", "i", ".", "e", ".", "is", "contained", "in", "the", "attribute", "list", "." ]
e791cb07a6e62ecf837d760d58a25f32fbf6bbca
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/src/de/uni/freiburg/iig/telematik/sewol/context/process/ProcessContext.java#L886-L892
146,570
iig-uni-freiburg/SEWOL
src/de/uni/freiburg/iig/telematik/sewol/context/process/ProcessContext.java
ProcessContext.validateAttributes
public void validateAttributes(Collection<String> attributes) throws CompatibilityException { Validate.notNull(attributes); for (String attribute : attributes) { validateAttribute(attribute); } }
java
public void validateAttributes(Collection<String> attributes) throws CompatibilityException { Validate.notNull(attributes); for (String attribute : attributes) { validateAttribute(attribute); } }
[ "public", "void", "validateAttributes", "(", "Collection", "<", "String", ">", "attributes", ")", "throws", "CompatibilityException", "{", "Validate", ".", "notNull", "(", "attributes", ")", ";", "for", "(", "String", "attribute", ":", "attributes", ")", "{", "validateAttribute", "(", "attribute", ")", ";", "}", "}" ]
Checks if the given attributes are known, i.e. they are all contained in the attribute list. @param attributes Attributes to be checked. @throws IllegalArgumentException If not all given attribute are known.
[ "Checks", "if", "the", "given", "attributes", "are", "known", "i", ".", "e", ".", "they", "are", "all", "contained", "in", "the", "attribute", "list", "." ]
e791cb07a6e62ecf837d760d58a25f32fbf6bbca
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/src/de/uni/freiburg/iig/telematik/sewol/context/process/ProcessContext.java#L902-L907
146,571
iig-uni-freiburg/SEWOL
src/de/uni/freiburg/iig/telematik/sewol/context/process/ProcessContext.java
ProcessContext.createSubjectList
public static List<String> createSubjectList(int number, String stringFormat) { Validate.notNegative(number); Validate.notNull(stringFormat); List<String> result = new ArrayList<>(number); for (int i = 1; i <= number; i++) { result.add(String.format(stringFormat, i)); } return result; }
java
public static List<String> createSubjectList(int number, String stringFormat) { Validate.notNegative(number); Validate.notNull(stringFormat); List<String> result = new ArrayList<>(number); for (int i = 1; i <= number; i++) { result.add(String.format(stringFormat, i)); } return result; }
[ "public", "static", "List", "<", "String", ">", "createSubjectList", "(", "int", "number", ",", "String", "stringFormat", ")", "{", "Validate", ".", "notNegative", "(", "number", ")", ";", "Validate", ".", "notNull", "(", "stringFormat", ")", ";", "List", "<", "String", ">", "result", "=", "new", "ArrayList", "<>", "(", "number", ")", ";", "for", "(", "int", "i", "=", "1", ";", "i", "<=", "number", ";", "i", "++", ")", "{", "result", ".", "add", "(", "String", ".", "format", "(", "stringFormat", ",", "i", ")", ")", ";", "}", "return", "result", ";", "}" ]
Creates a list of subject names in the given format with the given size. @param number Number of subjects to create. @param stringFormat The format for subject names. @return A list of subject names. @throws ParameterException
[ "Creates", "a", "list", "of", "subject", "names", "in", "the", "given", "format", "with", "the", "given", "size", "." ]
e791cb07a6e62ecf837d760d58a25f32fbf6bbca
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/src/de/uni/freiburg/iig/telematik/sewol/context/process/ProcessContext.java#L997-L1005
146,572
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/HtmlFocusBaseTag.java
HtmlFocusBaseTag.setOnBlur
public void setOnBlur(String onblur) { AbstractHtmlState tsh = getState(); tsh.registerAttribute(AbstractHtmlState.ATTR_JAVASCRIPT, ONBLUR, onblur); }
java
public void setOnBlur(String onblur) { AbstractHtmlState tsh = getState(); tsh.registerAttribute(AbstractHtmlState.ATTR_JAVASCRIPT, ONBLUR, onblur); }
[ "public", "void", "setOnBlur", "(", "String", "onblur", ")", "{", "AbstractHtmlState", "tsh", "=", "getState", "(", ")", ";", "tsh", ".", "registerAttribute", "(", "AbstractHtmlState", ".", "ATTR_JAVASCRIPT", ",", "ONBLUR", ",", "onblur", ")", ";", "}" ]
Sets the onBlur javascript event. @param onblur the onBlur event. @jsptagref.attributedescription The onBlur JavaScript event. @jsptagref.databindable false @jsptagref.attributesyntaxvalue <i>string_onBlur</i> @netui:attribute required="false" rtexprvalue="true" description="Sets the onBlur javascript event."
[ "Sets", "the", "onBlur", "javascript", "event", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/HtmlFocusBaseTag.java#L69-L73
146,573
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/HtmlFocusBaseTag.java
HtmlFocusBaseTag.setOnFocus
public void setOnFocus(String onfocus) { AbstractHtmlState tsh = getState(); tsh.registerAttribute(AbstractHtmlState.ATTR_JAVASCRIPT, ONFOCUS, onfocus); }
java
public void setOnFocus(String onfocus) { AbstractHtmlState tsh = getState(); tsh.registerAttribute(AbstractHtmlState.ATTR_JAVASCRIPT, ONFOCUS, onfocus); }
[ "public", "void", "setOnFocus", "(", "String", "onfocus", ")", "{", "AbstractHtmlState", "tsh", "=", "getState", "(", ")", ";", "tsh", ".", "registerAttribute", "(", "AbstractHtmlState", ".", "ATTR_JAVASCRIPT", ",", "ONFOCUS", ",", "onfocus", ")", ";", "}" ]
Sets the onFocus javascript event. @param onfocus the onFocus event. @jsptagref.attributedescription The onFocus JavaScript event. @jsptagref.databindable false @jsptagref.attributesyntaxvalue <i>string_onFocus</i> @netui:attribute required="false" rtexprvalue="true" description="Sets the onFocus javascript event."
[ "Sets", "the", "onFocus", "javascript", "event", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/HtmlFocusBaseTag.java#L84-L88
146,574
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/HtmlFocusBaseTag.java
HtmlFocusBaseTag.setOnChange
public void setOnChange(String onchange) { AbstractHtmlState tsh = getState(); tsh.registerAttribute(AbstractHtmlState.ATTR_JAVASCRIPT, ONCHANGE, onchange); }
java
public void setOnChange(String onchange) { AbstractHtmlState tsh = getState(); tsh.registerAttribute(AbstractHtmlState.ATTR_JAVASCRIPT, ONCHANGE, onchange); }
[ "public", "void", "setOnChange", "(", "String", "onchange", ")", "{", "AbstractHtmlState", "tsh", "=", "getState", "(", ")", ";", "tsh", ".", "registerAttribute", "(", "AbstractHtmlState", ".", "ATTR_JAVASCRIPT", ",", "ONCHANGE", ",", "onchange", ")", ";", "}" ]
Sets the onChange javascript event. @param onchange the onChange event. @jsptagref.attributedescription The onChange JavaScript event. @jsptagref.databindable false @jsptagref.attributesyntaxvalue <i>string_onChange</i> @netui:attribute required="false" rtexprvalue="true" description="Sets the onChange javascript event."
[ "Sets", "the", "onChange", "javascript", "event", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/HtmlFocusBaseTag.java#L99-L103
146,575
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/HtmlFocusBaseTag.java
HtmlFocusBaseTag.setOnSelect
public void setOnSelect(String onselect) { AbstractHtmlState tsh = getState(); tsh.registerAttribute(AbstractHtmlState.ATTR_JAVASCRIPT, ONSELECT, onselect); }
java
public void setOnSelect(String onselect) { AbstractHtmlState tsh = getState(); tsh.registerAttribute(AbstractHtmlState.ATTR_JAVASCRIPT, ONSELECT, onselect); }
[ "public", "void", "setOnSelect", "(", "String", "onselect", ")", "{", "AbstractHtmlState", "tsh", "=", "getState", "(", ")", ";", "tsh", ".", "registerAttribute", "(", "AbstractHtmlState", ".", "ATTR_JAVASCRIPT", ",", "ONSELECT", ",", "onselect", ")", ";", "}" ]
Sets the onSelect javascript event. @param onselect the onSelect event. @jsptagref.attributedescription The onSelect JavaScript event. @jsptagref.databindable false @jsptagref.attributesyntaxvalue <i>string_onSelect</i> @netui:attribute required="false" rtexprvalue="true" description="Sets the onSelect javascript event."
[ "Sets", "the", "onSelect", "javascript", "event", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/HtmlFocusBaseTag.java#L114-L118
146,576
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/DefaultURLTemplatesFactory.java
DefaultURLTemplatesFactory.load
public void load( ServletContext servletContext ) { _urlTemplates = new URLTemplates(); InputStream xmlInputStream = null; InputStream xsdInputStream = null; try { xmlInputStream = servletContext.getResourceAsStream( _configFilePath ); if ( xmlInputStream != null ) { /* load the XSD input stream */ xsdInputStream = SCHEMA_RESOLVER.getInputStream(); final String W3C_XML_SCHEMA = "http://www.w3.org/2001/XMLSchema"; final String JAXP_SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage"; final String JAXP_SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource"; DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setValidating(true); dbf.setNamespaceAware(true); dbf.setAttribute(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA); dbf.setAttribute(JAXP_SCHEMA_SOURCE, xsdInputStream); DocumentBuilder db = dbf.newDocumentBuilder(); /* add an ErrorHandler that just logs validation problems */ db.setErrorHandler(new ErrorHandler() { public void warning(SAXParseException exception) { _log.info("Validation warning validating config file \"" + _configFilePath + "\" against XML Schema \"" + SCHEMA_RESOLVER.getResourcePath()); } public void error(SAXParseException exception) { _log.error("Validation errors occurred parsing the config file \"" + _configFilePath + "\". Cause: " + exception, exception); } public void fatalError(SAXParseException exception) { _log.error("Validation errors occurred parsing the config file \"" + _configFilePath + "\". Cause: " + exception, exception); } }); db.setEntityResolver(new EntityResolver() { public InputSource resolveEntity(String publicId, String systemId) { if(systemId.endsWith("/url-template-config.xsd")) { InputStream inputStream = DefaultURLTemplatesFactory.class.getClassLoader().getResourceAsStream(CONFIG_SCHEMA); return new InputSource(inputStream); } else return null; } }); Document document = db.parse(xmlInputStream); Element root = document.getDocumentElement(); loadTemplates( root ); loadTemplateRefGroups( root ); } else { if ( _log.isInfoEnabled() ) _log.info( "Running without URL template descriptor, " + _configFilePath ); } } catch ( ParserConfigurationException pce ) { _log.error( "Problem loading URL template descriptor file " + _configFilePath, pce ); } catch ( SAXException se ) { _log.error( "Problem parsing URL template descriptor in " + _configFilePath, se ); } catch ( IOException ioe ) { _log.error( "Problem reading URL template descriptor file " + _configFilePath, ioe ); } finally { // Close the streams try { if ( xmlInputStream != null ) xmlInputStream.close(); } catch ( Exception ignore ) {} try { if ( xsdInputStream != null ) xsdInputStream.close(); } catch( IOException ignore ) {} } }
java
public void load( ServletContext servletContext ) { _urlTemplates = new URLTemplates(); InputStream xmlInputStream = null; InputStream xsdInputStream = null; try { xmlInputStream = servletContext.getResourceAsStream( _configFilePath ); if ( xmlInputStream != null ) { /* load the XSD input stream */ xsdInputStream = SCHEMA_RESOLVER.getInputStream(); final String W3C_XML_SCHEMA = "http://www.w3.org/2001/XMLSchema"; final String JAXP_SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage"; final String JAXP_SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource"; DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setValidating(true); dbf.setNamespaceAware(true); dbf.setAttribute(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA); dbf.setAttribute(JAXP_SCHEMA_SOURCE, xsdInputStream); DocumentBuilder db = dbf.newDocumentBuilder(); /* add an ErrorHandler that just logs validation problems */ db.setErrorHandler(new ErrorHandler() { public void warning(SAXParseException exception) { _log.info("Validation warning validating config file \"" + _configFilePath + "\" against XML Schema \"" + SCHEMA_RESOLVER.getResourcePath()); } public void error(SAXParseException exception) { _log.error("Validation errors occurred parsing the config file \"" + _configFilePath + "\". Cause: " + exception, exception); } public void fatalError(SAXParseException exception) { _log.error("Validation errors occurred parsing the config file \"" + _configFilePath + "\". Cause: " + exception, exception); } }); db.setEntityResolver(new EntityResolver() { public InputSource resolveEntity(String publicId, String systemId) { if(systemId.endsWith("/url-template-config.xsd")) { InputStream inputStream = DefaultURLTemplatesFactory.class.getClassLoader().getResourceAsStream(CONFIG_SCHEMA); return new InputSource(inputStream); } else return null; } }); Document document = db.parse(xmlInputStream); Element root = document.getDocumentElement(); loadTemplates( root ); loadTemplateRefGroups( root ); } else { if ( _log.isInfoEnabled() ) _log.info( "Running without URL template descriptor, " + _configFilePath ); } } catch ( ParserConfigurationException pce ) { _log.error( "Problem loading URL template descriptor file " + _configFilePath, pce ); } catch ( SAXException se ) { _log.error( "Problem parsing URL template descriptor in " + _configFilePath, se ); } catch ( IOException ioe ) { _log.error( "Problem reading URL template descriptor file " + _configFilePath, ioe ); } finally { // Close the streams try { if ( xmlInputStream != null ) xmlInputStream.close(); } catch ( Exception ignore ) {} try { if ( xsdInputStream != null ) xsdInputStream.close(); } catch( IOException ignore ) {} } }
[ "public", "void", "load", "(", "ServletContext", "servletContext", ")", "{", "_urlTemplates", "=", "new", "URLTemplates", "(", ")", ";", "InputStream", "xmlInputStream", "=", "null", ";", "InputStream", "xsdInputStream", "=", "null", ";", "try", "{", "xmlInputStream", "=", "servletContext", ".", "getResourceAsStream", "(", "_configFilePath", ")", ";", "if", "(", "xmlInputStream", "!=", "null", ")", "{", "/* load the XSD input stream */", "xsdInputStream", "=", "SCHEMA_RESOLVER", ".", "getInputStream", "(", ")", ";", "final", "String", "W3C_XML_SCHEMA", "=", "\"http://www.w3.org/2001/XMLSchema\"", ";", "final", "String", "JAXP_SCHEMA_LANGUAGE", "=", "\"http://java.sun.com/xml/jaxp/properties/schemaLanguage\"", ";", "final", "String", "JAXP_SCHEMA_SOURCE", "=", "\"http://java.sun.com/xml/jaxp/properties/schemaSource\"", ";", "DocumentBuilderFactory", "dbf", "=", "DocumentBuilderFactory", ".", "newInstance", "(", ")", ";", "dbf", ".", "setValidating", "(", "true", ")", ";", "dbf", ".", "setNamespaceAware", "(", "true", ")", ";", "dbf", ".", "setAttribute", "(", "JAXP_SCHEMA_LANGUAGE", ",", "W3C_XML_SCHEMA", ")", ";", "dbf", ".", "setAttribute", "(", "JAXP_SCHEMA_SOURCE", ",", "xsdInputStream", ")", ";", "DocumentBuilder", "db", "=", "dbf", ".", "newDocumentBuilder", "(", ")", ";", "/* add an ErrorHandler that just logs validation problems */", "db", ".", "setErrorHandler", "(", "new", "ErrorHandler", "(", ")", "{", "public", "void", "warning", "(", "SAXParseException", "exception", ")", "{", "_log", ".", "info", "(", "\"Validation warning validating config file \\\"\"", "+", "_configFilePath", "+", "\"\\\" against XML Schema \\\"\"", "+", "SCHEMA_RESOLVER", ".", "getResourcePath", "(", ")", ")", ";", "}", "public", "void", "error", "(", "SAXParseException", "exception", ")", "{", "_log", ".", "error", "(", "\"Validation errors occurred parsing the config file \\\"\"", "+", "_configFilePath", "+", "\"\\\". Cause: \"", "+", "exception", ",", "exception", ")", ";", "}", "public", "void", "fatalError", "(", "SAXParseException", "exception", ")", "{", "_log", ".", "error", "(", "\"Validation errors occurred parsing the config file \\\"\"", "+", "_configFilePath", "+", "\"\\\". Cause: \"", "+", "exception", ",", "exception", ")", ";", "}", "}", ")", ";", "db", ".", "setEntityResolver", "(", "new", "EntityResolver", "(", ")", "{", "public", "InputSource", "resolveEntity", "(", "String", "publicId", ",", "String", "systemId", ")", "{", "if", "(", "systemId", ".", "endsWith", "(", "\"/url-template-config.xsd\"", ")", ")", "{", "InputStream", "inputStream", "=", "DefaultURLTemplatesFactory", ".", "class", ".", "getClassLoader", "(", ")", ".", "getResourceAsStream", "(", "CONFIG_SCHEMA", ")", ";", "return", "new", "InputSource", "(", "inputStream", ")", ";", "}", "else", "return", "null", ";", "}", "}", ")", ";", "Document", "document", "=", "db", ".", "parse", "(", "xmlInputStream", ")", ";", "Element", "root", "=", "document", ".", "getDocumentElement", "(", ")", ";", "loadTemplates", "(", "root", ")", ";", "loadTemplateRefGroups", "(", "root", ")", ";", "}", "else", "{", "if", "(", "_log", ".", "isInfoEnabled", "(", ")", ")", "_log", ".", "info", "(", "\"Running without URL template descriptor, \"", "+", "_configFilePath", ")", ";", "}", "}", "catch", "(", "ParserConfigurationException", "pce", ")", "{", "_log", ".", "error", "(", "\"Problem loading URL template descriptor file \"", "+", "_configFilePath", ",", "pce", ")", ";", "}", "catch", "(", "SAXException", "se", ")", "{", "_log", ".", "error", "(", "\"Problem parsing URL template descriptor in \"", "+", "_configFilePath", ",", "se", ")", ";", "}", "catch", "(", "IOException", "ioe", ")", "{", "_log", ".", "error", "(", "\"Problem reading URL template descriptor file \"", "+", "_configFilePath", ",", "ioe", ")", ";", "}", "finally", "{", "// Close the streams", "try", "{", "if", "(", "xmlInputStream", "!=", "null", ")", "xmlInputStream", ".", "close", "(", ")", ";", "}", "catch", "(", "Exception", "ignore", ")", "{", "}", "try", "{", "if", "(", "xsdInputStream", "!=", "null", ")", "xsdInputStream", ".", "close", "(", ")", ";", "}", "catch", "(", "IOException", "ignore", ")", "{", "}", "}", "}" ]
Initialization method that parses the URL template config file to get the URL templates and template reference groups. @param servletContext the current ServletContext.
[ "Initialization", "method", "that", "parses", "the", "URL", "template", "config", "file", "to", "get", "the", "URL", "templates", "and", "template", "reference", "groups", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/DefaultURLTemplatesFactory.java#L157-L236
146,577
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/DefaultURLTemplatesFactory.java
DefaultURLTemplatesFactory.loadTemplates
private void loadTemplates( Element parent ) { // Load templates List templates = DomUtils.getChildElementsByName( parent, URL_TEMPLATE ); for ( int i = 0; i < templates.size(); i++ ) { Element template = ( Element ) templates.get( i ); String name = getElementText( template, NAME ); if ( name == null ) { _log.error( "Malformed URL template descriptor in " + _configFilePath + ". The url-template name is missing." ); continue; } String value = getElementText( template, VALUE ); if ( value == null ) { _log.error( "Malformed URL template descriptor in " + _configFilePath + ". The url-template value is missing for template " + name ); continue; } if ( _log.isDebugEnabled() ) { _log.debug( "[URLTemplate] " + name + " = " + value ); } URLTemplate urlTemplate = new URLTemplate( value, name ); if ( urlTemplate.verify( _knownTokens, _requiredTokens ) ) { _urlTemplates.addTemplate( name, urlTemplate ); } } }
java
private void loadTemplates( Element parent ) { // Load templates List templates = DomUtils.getChildElementsByName( parent, URL_TEMPLATE ); for ( int i = 0; i < templates.size(); i++ ) { Element template = ( Element ) templates.get( i ); String name = getElementText( template, NAME ); if ( name == null ) { _log.error( "Malformed URL template descriptor in " + _configFilePath + ". The url-template name is missing." ); continue; } String value = getElementText( template, VALUE ); if ( value == null ) { _log.error( "Malformed URL template descriptor in " + _configFilePath + ". The url-template value is missing for template " + name ); continue; } if ( _log.isDebugEnabled() ) { _log.debug( "[URLTemplate] " + name + " = " + value ); } URLTemplate urlTemplate = new URLTemplate( value, name ); if ( urlTemplate.verify( _knownTokens, _requiredTokens ) ) { _urlTemplates.addTemplate( name, urlTemplate ); } } }
[ "private", "void", "loadTemplates", "(", "Element", "parent", ")", "{", "// Load templates", "List", "templates", "=", "DomUtils", ".", "getChildElementsByName", "(", "parent", ",", "URL_TEMPLATE", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "templates", ".", "size", "(", ")", ";", "i", "++", ")", "{", "Element", "template", "=", "(", "Element", ")", "templates", ".", "get", "(", "i", ")", ";", "String", "name", "=", "getElementText", "(", "template", ",", "NAME", ")", ";", "if", "(", "name", "==", "null", ")", "{", "_log", ".", "error", "(", "\"Malformed URL template descriptor in \"", "+", "_configFilePath", "+", "\". The url-template name is missing.\"", ")", ";", "continue", ";", "}", "String", "value", "=", "getElementText", "(", "template", ",", "VALUE", ")", ";", "if", "(", "value", "==", "null", ")", "{", "_log", ".", "error", "(", "\"Malformed URL template descriptor in \"", "+", "_configFilePath", "+", "\". The url-template value is missing for template \"", "+", "name", ")", ";", "continue", ";", "}", "if", "(", "_log", ".", "isDebugEnabled", "(", ")", ")", "{", "_log", ".", "debug", "(", "\"[URLTemplate] \"", "+", "name", "+", "\" = \"", "+", "value", ")", ";", "}", "URLTemplate", "urlTemplate", "=", "new", "URLTemplate", "(", "value", ",", "name", ")", ";", "if", "(", "urlTemplate", ".", "verify", "(", "_knownTokens", ",", "_requiredTokens", ")", ")", "{", "_urlTemplates", ".", "addTemplate", "(", "name", ",", "urlTemplate", ")", ";", "}", "}", "}" ]
Loads the templates from a URL template config document. @param parent
[ "Loads", "the", "templates", "from", "a", "URL", "template", "config", "document", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/DefaultURLTemplatesFactory.java#L243-L277
146,578
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/DefaultURLTemplatesFactory.java
DefaultURLTemplatesFactory.loadTemplateRefGroups
private void loadTemplateRefGroups( Element parent ) { // Load template refs List templateRefGroups = DomUtils.getChildElementsByName( parent, URL_TEMPLATE_REF_GROUP );; for ( int i = 0; i < templateRefGroups.size(); i++ ) { Element refGroupElement = ( Element ) templateRefGroups.get( i ); String refGroupName = getElementText( refGroupElement, NAME ); if ( refGroupName == null ) { _log.error( "Malformed URL template descriptor in " + _configFilePath + ". The url-template-ref-group name is missing." ); continue; } HashMap refGroup = new HashMap(); List templateRefs = DomUtils.getChildElementsByName( refGroupElement, URL_TEMPLATE_REF );; for ( int j = 0; j < templateRefs.size(); j++ ) { Element templateRefElement = ( Element ) templateRefs.get( j ); String key = getElementText( templateRefElement, KEY ); if ( key == null ) { _log.error( "Malformed URL template descriptor in " + _configFilePath + ". The url-template-ref key is missing in url-template-ref-group " + refGroupName ); continue; } String name = getElementText( templateRefElement, TEMPLATE_NAME ); if ( name != null ) { refGroup.put( key, name ); if ( _log.isDebugEnabled() ) { _log.debug( "[" + refGroupName + " URLTemplate] " + key + " = " + name ); } } else { _log.error( "Malformed URL template descriptor in " + _configFilePath + ". The url-template-ref template-name is missing in url-template-ref-group " + refGroupName ); } } if ( refGroup.size() != 0 ) { _urlTemplates.addTemplateRefGroup( refGroupName, refGroup ); } } }
java
private void loadTemplateRefGroups( Element parent ) { // Load template refs List templateRefGroups = DomUtils.getChildElementsByName( parent, URL_TEMPLATE_REF_GROUP );; for ( int i = 0; i < templateRefGroups.size(); i++ ) { Element refGroupElement = ( Element ) templateRefGroups.get( i ); String refGroupName = getElementText( refGroupElement, NAME ); if ( refGroupName == null ) { _log.error( "Malformed URL template descriptor in " + _configFilePath + ". The url-template-ref-group name is missing." ); continue; } HashMap refGroup = new HashMap(); List templateRefs = DomUtils.getChildElementsByName( refGroupElement, URL_TEMPLATE_REF );; for ( int j = 0; j < templateRefs.size(); j++ ) { Element templateRefElement = ( Element ) templateRefs.get( j ); String key = getElementText( templateRefElement, KEY ); if ( key == null ) { _log.error( "Malformed URL template descriptor in " + _configFilePath + ". The url-template-ref key is missing in url-template-ref-group " + refGroupName ); continue; } String name = getElementText( templateRefElement, TEMPLATE_NAME ); if ( name != null ) { refGroup.put( key, name ); if ( _log.isDebugEnabled() ) { _log.debug( "[" + refGroupName + " URLTemplate] " + key + " = " + name ); } } else { _log.error( "Malformed URL template descriptor in " + _configFilePath + ". The url-template-ref template-name is missing in url-template-ref-group " + refGroupName ); } } if ( refGroup.size() != 0 ) { _urlTemplates.addTemplateRefGroup( refGroupName, refGroup ); } } }
[ "private", "void", "loadTemplateRefGroups", "(", "Element", "parent", ")", "{", "// Load template refs", "List", "templateRefGroups", "=", "DomUtils", ".", "getChildElementsByName", "(", "parent", ",", "URL_TEMPLATE_REF_GROUP", ")", ";", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "templateRefGroups", ".", "size", "(", ")", ";", "i", "++", ")", "{", "Element", "refGroupElement", "=", "(", "Element", ")", "templateRefGroups", ".", "get", "(", "i", ")", ";", "String", "refGroupName", "=", "getElementText", "(", "refGroupElement", ",", "NAME", ")", ";", "if", "(", "refGroupName", "==", "null", ")", "{", "_log", ".", "error", "(", "\"Malformed URL template descriptor in \"", "+", "_configFilePath", "+", "\". The url-template-ref-group name is missing.\"", ")", ";", "continue", ";", "}", "HashMap", "refGroup", "=", "new", "HashMap", "(", ")", ";", "List", "templateRefs", "=", "DomUtils", ".", "getChildElementsByName", "(", "refGroupElement", ",", "URL_TEMPLATE_REF", ")", ";", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "templateRefs", ".", "size", "(", ")", ";", "j", "++", ")", "{", "Element", "templateRefElement", "=", "(", "Element", ")", "templateRefs", ".", "get", "(", "j", ")", ";", "String", "key", "=", "getElementText", "(", "templateRefElement", ",", "KEY", ")", ";", "if", "(", "key", "==", "null", ")", "{", "_log", ".", "error", "(", "\"Malformed URL template descriptor in \"", "+", "_configFilePath", "+", "\". The url-template-ref key is missing in url-template-ref-group \"", "+", "refGroupName", ")", ";", "continue", ";", "}", "String", "name", "=", "getElementText", "(", "templateRefElement", ",", "TEMPLATE_NAME", ")", ";", "if", "(", "name", "!=", "null", ")", "{", "refGroup", ".", "put", "(", "key", ",", "name", ")", ";", "if", "(", "_log", ".", "isDebugEnabled", "(", ")", ")", "{", "_log", ".", "debug", "(", "\"[\"", "+", "refGroupName", "+", "\" URLTemplate] \"", "+", "key", "+", "\" = \"", "+", "name", ")", ";", "}", "}", "else", "{", "_log", ".", "error", "(", "\"Malformed URL template descriptor in \"", "+", "_configFilePath", "+", "\". The url-template-ref template-name is missing in url-template-ref-group \"", "+", "refGroupName", ")", ";", "}", "}", "if", "(", "refGroup", ".", "size", "(", ")", "!=", "0", ")", "{", "_urlTemplates", ".", "addTemplateRefGroup", "(", "refGroupName", ",", "refGroup", ")", ";", "}", "}", "}" ]
Loads the template reference groups from a URL template config document. @param parent
[ "Loads", "the", "template", "reference", "groups", "from", "a", "URL", "template", "config", "document", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/DefaultURLTemplatesFactory.java#L284-L333
146,579
uservoice/uservoice-java
src/main/java/com/uservoice/Client.java
Client.loginAsOwner
@SuppressWarnings("serial") public Client loginAsOwner() throws APIError { requestToken = service.getRequestToken(); JSONObject token = post("/api/v1/users/login_as_owner", new HashMap<String, Object>() { { put("request_token", requestToken.getToken()); } }); if (token != null && !token.getJSONObject("token").isNullObject()) { return loginWithAccessToken(token.getJSONObject("token").getString("oauth_token"), token.getJSONObject("token").getString("oauth_token_secret")); } else { throw new Unauthorized("Could not get Request Token"); } }
java
@SuppressWarnings("serial") public Client loginAsOwner() throws APIError { requestToken = service.getRequestToken(); JSONObject token = post("/api/v1/users/login_as_owner", new HashMap<String, Object>() { { put("request_token", requestToken.getToken()); } }); if (token != null && !token.getJSONObject("token").isNullObject()) { return loginWithAccessToken(token.getJSONObject("token").getString("oauth_token"), token.getJSONObject("token").getString("oauth_token_secret")); } else { throw new Unauthorized("Could not get Request Token"); } }
[ "@", "SuppressWarnings", "(", "\"serial\"", ")", "public", "Client", "loginAsOwner", "(", ")", "throws", "APIError", "{", "requestToken", "=", "service", ".", "getRequestToken", "(", ")", ";", "JSONObject", "token", "=", "post", "(", "\"/api/v1/users/login_as_owner\"", ",", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", "{", "{", "put", "(", "\"request_token\"", ",", "requestToken", ".", "getToken", "(", ")", ")", ";", "}", "}", ")", ";", "if", "(", "token", "!=", "null", "&&", "!", "token", ".", "getJSONObject", "(", "\"token\"", ")", ".", "isNullObject", "(", ")", ")", "{", "return", "loginWithAccessToken", "(", "token", ".", "getJSONObject", "(", "\"token\"", ")", ".", "getString", "(", "\"oauth_token\"", ")", ",", "token", ".", "getJSONObject", "(", "\"token\"", ")", ".", "getString", "(", "\"oauth_token_secret\"", ")", ")", ";", "}", "else", "{", "throw", "new", "Unauthorized", "(", "\"Could not get Request Token\"", ")", ";", "}", "}" ]
Logins as the first UserVoice account owner of the subdomain. @return The client instance for making API calls as the owner @throws APIError
[ "Logins", "as", "the", "first", "UserVoice", "account", "owner", "of", "the", "subdomain", "." ]
e93cb22204b3569f9c3880c08a92bbd0107947d3
https://github.com/uservoice/uservoice-java/blob/e93cb22204b3569f9c3880c08a92bbd0107947d3/src/main/java/com/uservoice/Client.java#L85-L99
146,580
uservoice/uservoice-java
src/main/java/com/uservoice/Client.java
Client.loginWithVerifier
public Client loginWithVerifier(String verifier) { Token token = service.getAccessToken(requestToken, new Verifier(verifier)); return loginWithAccessToken(token.getToken(), token.getSecret()); }
java
public Client loginWithVerifier(String verifier) { Token token = service.getAccessToken(requestToken, new Verifier(verifier)); return loginWithAccessToken(token.getToken(), token.getSecret()); }
[ "public", "Client", "loginWithVerifier", "(", "String", "verifier", ")", "{", "Token", "token", "=", "service", ".", "getAccessToken", "(", "requestToken", ",", "new", "Verifier", "(", "verifier", ")", ")", ";", "return", "loginWithAccessToken", "(", "token", ".", "getToken", "(", ")", ",", "token", ".", "getSecret", "(", ")", ")", ";", "}" ]
Retrieve a client instance for making calls as the user who gave permission in UserVoice site. @param verifier the verifier that was passed as a GET paramter or received in Out-Of-Band fashion @return The client for making calls as the authorized and verified user
[ "Retrieve", "a", "client", "instance", "for", "making", "calls", "as", "the", "user", "who", "gave", "permission", "in", "UserVoice", "site", "." ]
e93cb22204b3569f9c3880c08a92bbd0107947d3
https://github.com/uservoice/uservoice-java/blob/e93cb22204b3569f9c3880c08a92bbd0107947d3/src/main/java/com/uservoice/Client.java#L166-L169
146,581
uservoice/uservoice-java
src/main/java/com/uservoice/Client.java
Client.get
public JSONObject get(String path) throws APIError { return request(Verb.GET, path, null); }
java
public JSONObject get(String path) throws APIError { return request(Verb.GET, path, null); }
[ "public", "JSONObject", "get", "(", "String", "path", ")", "throws", "APIError", "{", "return", "request", "(", "Verb", ".", "GET", ",", "path", ",", "null", ")", ";", "}" ]
Make a GET API call. @param path The GET path. Include the GET parameters after ? @return A JSON object. @throws APIError If an error occurs.
[ "Make", "a", "GET", "API", "call", "." ]
e93cb22204b3569f9c3880c08a92bbd0107947d3
https://github.com/uservoice/uservoice-java/blob/e93cb22204b3569f9c3880c08a92bbd0107947d3/src/main/java/com/uservoice/Client.java#L180-L182
146,582
uservoice/uservoice-java
src/main/java/com/uservoice/Client.java
Client.delete
public JSONObject delete(String path) throws APIError { return request(Verb.DELETE, path, null); }
java
public JSONObject delete(String path) throws APIError { return request(Verb.DELETE, path, null); }
[ "public", "JSONObject", "delete", "(", "String", "path", ")", "throws", "APIError", "{", "return", "request", "(", "Verb", ".", "DELETE", ",", "path", ",", "null", ")", ";", "}" ]
Make a DELETE API call. @param path The GET path. Include the GET parameters after ? @return A JSON object. @throws APIError If an error occurs.
[ "Make", "a", "DELETE", "API", "call", "." ]
e93cb22204b3569f9c3880c08a92bbd0107947d3
https://github.com/uservoice/uservoice-java/blob/e93cb22204b3569f9c3880c08a92bbd0107947d3/src/main/java/com/uservoice/Client.java#L193-L195
146,583
uservoice/uservoice-java
src/main/java/com/uservoice/Client.java
Client.post
public JSONObject post(String path, Map<String, Object> params) throws APIError { return request(Verb.POST, path, params); }
java
public JSONObject post(String path, Map<String, Object> params) throws APIError { return request(Verb.POST, path, params); }
[ "public", "JSONObject", "post", "(", "String", "path", ",", "Map", "<", "String", ",", "Object", ">", "params", ")", "throws", "APIError", "{", "return", "request", "(", "Verb", ".", "POST", ",", "path", ",", "params", ")", ";", "}" ]
Make a GET POST call. @param path The GET path. Include the GET parameters after ? @param params The parameters to be passed in the body of the call as JSON @return A JSON object. @throws APIError If an error occurs.
[ "Make", "a", "GET", "POST", "call", "." ]
e93cb22204b3569f9c3880c08a92bbd0107947d3
https://github.com/uservoice/uservoice-java/blob/e93cb22204b3569f9c3880c08a92bbd0107947d3/src/main/java/com/uservoice/Client.java#L208-L210
146,584
uservoice/uservoice-java
src/main/java/com/uservoice/Client.java
Client.put
public JSONObject put(String path, Map<String, Object> params) throws APIError { return request(Verb.PUT, path, params); }
java
public JSONObject put(String path, Map<String, Object> params) throws APIError { return request(Verb.PUT, path, params); }
[ "public", "JSONObject", "put", "(", "String", "path", ",", "Map", "<", "String", ",", "Object", ">", "params", ")", "throws", "APIError", "{", "return", "request", "(", "Verb", ".", "PUT", ",", "path", ",", "params", ")", ";", "}" ]
Make a PUT API call. @param path The GET path. Include the GET parameters after ? @param params The parameters to be passed in the body of the call as JSON @return A JSON object. @throws APIError If an error occurs.
[ "Make", "a", "PUT", "API", "call", "." ]
e93cb22204b3569f9c3880c08a92bbd0107947d3
https://github.com/uservoice/uservoice-java/blob/e93cb22204b3569f9c3880c08a92bbd0107947d3/src/main/java/com/uservoice/Client.java#L223-L225
146,585
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/ImplInitializer.java
ImplInitializer.needsReflection
static public boolean needsReflection(AptField genField) { // // Since initializers are generated into the same package as the initialized class, // only private access fields require reflection // String accessModifier = genField.getAccessModifier(); if (accessModifier.equals("private")) return true; return false; }
java
static public boolean needsReflection(AptField genField) { // // Since initializers are generated into the same package as the initialized class, // only private access fields require reflection // String accessModifier = genField.getAccessModifier(); if (accessModifier.equals("private")) return true; return false; }
[ "static", "public", "boolean", "needsReflection", "(", "AptField", "genField", ")", "{", "//", "// Since initializers are generated into the same package as the initialized class,", "// only private access fields require reflection", "//", "String", "accessModifier", "=", "genField", ".", "getAccessModifier", "(", ")", ";", "if", "(", "accessModifier", ".", "equals", "(", "\"private\"", ")", ")", "return", "true", ";", "return", "false", ";", "}" ]
Returns true if the initializer will use Reflection to initialize the field, false otherwise.
[ "Returns", "true", "if", "the", "initializer", "will", "use", "Reflection", "to", "initialize", "the", "field", "false", "otherwise", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/ImplInitializer.java#L120-L131
146,586
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/EventAdaptor.java
EventAdaptor.initClassName
private String initClassName() { StringBuffer sb = new StringBuffer(); String fieldName = _eventField.getName(); String setName = _eventSet.getClassName(); sb.append(Character.toUpperCase(fieldName.charAt(0))); if (fieldName.length() > 1) sb.append(fieldName.substring(1)); sb.append(setName.substring(setName.lastIndexOf('.') + 1)); sb.append("EventAdaptor"); return sb.toString(); }
java
private String initClassName() { StringBuffer sb = new StringBuffer(); String fieldName = _eventField.getName(); String setName = _eventSet.getClassName(); sb.append(Character.toUpperCase(fieldName.charAt(0))); if (fieldName.length() > 1) sb.append(fieldName.substring(1)); sb.append(setName.substring(setName.lastIndexOf('.') + 1)); sb.append("EventAdaptor"); return sb.toString(); }
[ "private", "String", "initClassName", "(", ")", "{", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", ")", ";", "String", "fieldName", "=", "_eventField", ".", "getName", "(", ")", ";", "String", "setName", "=", "_eventSet", ".", "getClassName", "(", ")", ";", "sb", ".", "append", "(", "Character", ".", "toUpperCase", "(", "fieldName", ".", "charAt", "(", "0", ")", ")", ")", ";", "if", "(", "fieldName", ".", "length", "(", ")", ">", "1", ")", "sb", ".", "append", "(", "fieldName", ".", "substring", "(", "1", ")", ")", ";", "sb", ".", "append", "(", "setName", ".", "substring", "(", "setName", ".", "lastIndexOf", "(", "'", "'", ")", "+", "1", ")", ")", ";", "sb", ".", "append", "(", "\"EventAdaptor\"", ")", ";", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
Computes a unique adaptor class name
[ "Computes", "a", "unique", "adaptor", "class", "name" ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/EventAdaptor.java#L45-L56
146,587
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/EventAdaptor.java
EventAdaptor.getFormalClassName
public String getFormalClassName() { StringBuffer sb = new StringBuffer(_className); sb.append(_eventSet.getFormalTypeParameters()); return sb.toString(); }
java
public String getFormalClassName() { StringBuffer sb = new StringBuffer(_className); sb.append(_eventSet.getFormalTypeParameters()); return sb.toString(); }
[ "public", "String", "getFormalClassName", "(", ")", "{", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", "_className", ")", ";", "sb", ".", "append", "(", "_eventSet", ".", "getFormalTypeParameters", "(", ")", ")", ";", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
Returns the name of the generated class for this adaptor, including any formal type declarations from the associate event set.
[ "Returns", "the", "name", "of", "the", "generated", "class", "for", "this", "adaptor", "including", "any", "formal", "type", "declarations", "from", "the", "associate", "event", "set", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/EventAdaptor.java#L70-L75
146,588
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/EventAdaptor.java
EventAdaptor.addHandler
public void addHandler(AptEvent event, AptMethod eventHandler) { assert event.getEventSet() == _eventSet; _handlerMap.put(event, eventHandler); }
java
public void addHandler(AptEvent event, AptMethod eventHandler) { assert event.getEventSet() == _eventSet; _handlerMap.put(event, eventHandler); }
[ "public", "void", "addHandler", "(", "AptEvent", "event", ",", "AptMethod", "eventHandler", ")", "{", "assert", "event", ".", "getEventSet", "(", ")", "==", "_eventSet", ";", "_handlerMap", ".", "put", "(", "event", ",", "eventHandler", ")", ";", "}" ]
Adds a new EventHandler for a Event to the EventAdaptor
[ "Adds", "a", "new", "EventHandler", "for", "a", "Event", "to", "the", "EventAdaptor" ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/EventAdaptor.java#L90-L94
146,589
moparisthebest/beehive
beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/EventAdaptor.java
EventAdaptor.getEventSetBinding
public String getEventSetBinding() { // Get the type bindings for the associated event field. HashMap<String,TypeMirror> typeBinding = _eventField.getTypeBindingMap(); StringBuffer sb = new StringBuffer(); boolean isFirst = true; for (TypeParameterDeclaration tpd : _eventSet.getDeclaration().getFormalTypeParameters()) { if (isFirst) { sb.append("<"); isFirst = false; } else sb.append(", "); // Map from the declared formal type name to the bound type name // If no map entry exists (i.e. not bindings were specified on the field // declaration, then the implied binding is to Object.class String typeName = tpd.getSimpleName(); if (typeBinding.containsKey(typeName)) sb.append(typeBinding.get(tpd.getSimpleName())); else sb.append("java.lang.Object"); } if (!isFirst) sb.append(">"); return sb.toString(); }
java
public String getEventSetBinding() { // Get the type bindings for the associated event field. HashMap<String,TypeMirror> typeBinding = _eventField.getTypeBindingMap(); StringBuffer sb = new StringBuffer(); boolean isFirst = true; for (TypeParameterDeclaration tpd : _eventSet.getDeclaration().getFormalTypeParameters()) { if (isFirst) { sb.append("<"); isFirst = false; } else sb.append(", "); // Map from the declared formal type name to the bound type name // If no map entry exists (i.e. not bindings were specified on the field // declaration, then the implied binding is to Object.class String typeName = tpd.getSimpleName(); if (typeBinding.containsKey(typeName)) sb.append(typeBinding.get(tpd.getSimpleName())); else sb.append("java.lang.Object"); } if (!isFirst) sb.append(">"); return sb.toString(); }
[ "public", "String", "getEventSetBinding", "(", ")", "{", "// Get the type bindings for the associated event field.", "HashMap", "<", "String", ",", "TypeMirror", ">", "typeBinding", "=", "_eventField", ".", "getTypeBindingMap", "(", ")", ";", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", ")", ";", "boolean", "isFirst", "=", "true", ";", "for", "(", "TypeParameterDeclaration", "tpd", ":", "_eventSet", ".", "getDeclaration", "(", ")", ".", "getFormalTypeParameters", "(", ")", ")", "{", "if", "(", "isFirst", ")", "{", "sb", ".", "append", "(", "\"<\"", ")", ";", "isFirst", "=", "false", ";", "}", "else", "sb", ".", "append", "(", "\", \"", ")", ";", "// Map from the declared formal type name to the bound type name", "// If no map entry exists (i.e. not bindings were specified on the field", "// declaration, then the implied binding is to Object.class", "String", "typeName", "=", "tpd", ".", "getSimpleName", "(", ")", ";", "if", "(", "typeBinding", ".", "containsKey", "(", "typeName", ")", ")", "sb", ".", "append", "(", "typeBinding", ".", "get", "(", "tpd", ".", "getSimpleName", "(", ")", ")", ")", ";", "else", "sb", ".", "append", "(", "\"java.lang.Object\"", ")", ";", "}", "if", "(", "!", "isFirst", ")", "sb", ".", "append", "(", "\">\"", ")", ";", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
Returns any formal type parameter declaration for EventSet interface associated with the adaptor class. This will bind the formal types of the interface based on any type binding from the event field declaration
[ "Returns", "any", "formal", "type", "parameter", "declaration", "for", "EventSet", "interface", "associated", "with", "the", "adaptor", "class", ".", "This", "will", "bind", "the", "formal", "types", "of", "the", "interface", "based", "on", "any", "type", "binding", "from", "the", "event", "field", "declaration" ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/EventAdaptor.java#L117-L148
146,590
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/TreePropertyOverride.java
TreePropertyOverride.doTag
public void doTag() throws JspException { Object o = getParent(); assert (o != null); if (!(o instanceof TreeItem)) { logger.error("Invalid Parent (expected a TreeItem):" + o.getClass().getName()); return; } // assign the value to the parent's label value TreeItem ti = (TreeItem) o; ti.setItemInheritableState(_iState); }
java
public void doTag() throws JspException { Object o = getParent(); assert (o != null); if (!(o instanceof TreeItem)) { logger.error("Invalid Parent (expected a TreeItem):" + o.getClass().getName()); return; } // assign the value to the parent's label value TreeItem ti = (TreeItem) o; ti.setItemInheritableState(_iState); }
[ "public", "void", "doTag", "(", ")", "throws", "JspException", "{", "Object", "o", "=", "getParent", "(", ")", ";", "assert", "(", "o", "!=", "null", ")", ";", "if", "(", "!", "(", "o", "instanceof", "TreeItem", ")", ")", "{", "logger", ".", "error", "(", "\"Invalid Parent (expected a TreeItem):\"", "+", "o", ".", "getClass", "(", ")", ".", "getName", "(", ")", ")", ";", "return", ";", "}", "// assign the value to the parent's label value", "TreeItem", "ti", "=", "(", "TreeItem", ")", "o", ";", "ti", ".", "setItemInheritableState", "(", "_iState", ")", ";", "}" ]
Render this Tree control. @throws JspException if a processing error occurs
[ "Render", "this", "Tree", "control", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/TreePropertyOverride.java#L259-L272
146,591
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/AutoRegisterActionServlet.java
AutoRegisterActionServlet.getModuleConfPath
public String getModuleConfPath( String modulePath ) { if ( _moduleConfigLocators != null ) { for ( int i = 0; i < _moduleConfigLocators.length; ++i ) { ModuleConfigLocator locator = _moduleConfigLocators[i]; String moduleConfigPath = locator.getModuleConfigPath( modulePath ); try { if ( getConfigResource( moduleConfigPath ) != null ) return moduleConfigPath; } catch ( MalformedURLException e ) { _log.error( "ModuleConfigLocator " + locator.getClass().getName() + " returned an invalid path: " + moduleConfigPath + '.', e ); } } } return null; }
java
public String getModuleConfPath( String modulePath ) { if ( _moduleConfigLocators != null ) { for ( int i = 0; i < _moduleConfigLocators.length; ++i ) { ModuleConfigLocator locator = _moduleConfigLocators[i]; String moduleConfigPath = locator.getModuleConfigPath( modulePath ); try { if ( getConfigResource( moduleConfigPath ) != null ) return moduleConfigPath; } catch ( MalformedURLException e ) { _log.error( "ModuleConfigLocator " + locator.getClass().getName() + " returned an invalid path: " + moduleConfigPath + '.', e ); } } } return null; }
[ "public", "String", "getModuleConfPath", "(", "String", "modulePath", ")", "{", "if", "(", "_moduleConfigLocators", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "_moduleConfigLocators", ".", "length", ";", "++", "i", ")", "{", "ModuleConfigLocator", "locator", "=", "_moduleConfigLocators", "[", "i", "]", ";", "String", "moduleConfigPath", "=", "locator", ".", "getModuleConfigPath", "(", "modulePath", ")", ";", "try", "{", "if", "(", "getConfigResource", "(", "moduleConfigPath", ")", "!=", "null", ")", "return", "moduleConfigPath", ";", "}", "catch", "(", "MalformedURLException", "e", ")", "{", "_log", ".", "error", "(", "\"ModuleConfigLocator \"", "+", "locator", ".", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\" returned an invalid path: \"", "+", "moduleConfigPath", "+", "'", "'", ",", "e", ")", ";", "}", "}", "}", "return", "null", ";", "}" ]
Get the webapp-relative path to the Struts module configration file for a given module path, based on registered ModuleConfigLocators. @param modulePath the Struts module path. @return a String that is the path to the Struts configuration file, relative to the web application root, or <code>null</code> if no appropriate configuration file is found. @see #getDefaultModuleConfigLocators
[ "Get", "the", "webapp", "-", "relative", "path", "to", "the", "Struts", "module", "configration", "file", "for", "a", "given", "module", "path", "based", "on", "registered", "ModuleConfigLocators", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/AutoRegisterActionServlet.java#L229-L251
146,592
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/AutoRegisterActionServlet.java
AutoRegisterActionServlet.readObject
private void readObject( ObjectInputStream stream ) throws IOException, ClassNotFoundException { if ( _log.isInfoEnabled() ) _log.info( "deserializing ActionServlet " + this ); _configParams = ( Map ) stream.readObject(); }
java
private void readObject( ObjectInputStream stream ) throws IOException, ClassNotFoundException { if ( _log.isInfoEnabled() ) _log.info( "deserializing ActionServlet " + this ); _configParams = ( Map ) stream.readObject(); }
[ "private", "void", "readObject", "(", "ObjectInputStream", "stream", ")", "throws", "IOException", ",", "ClassNotFoundException", "{", "if", "(", "_log", ".", "isInfoEnabled", "(", ")", ")", "_log", ".", "info", "(", "\"deserializing ActionServlet \"", "+", "this", ")", ";", "_configParams", "=", "(", "Map", ")", "stream", ".", "readObject", "(", ")", ";", "}" ]
See comments on writeObject.
[ "See", "comments", "on", "writeObject", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/AutoRegisterActionServlet.java#L301-L306
146,593
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/AutoRegisterActionServlet.java
AutoRegisterActionServlet.getConfigResource
protected URL getConfigResource( String path ) throws MalformedURLException { URL resource = getServletContext().getResource( path ); if ( resource != null ) return resource; if ( path.startsWith( "/" ) ) path = path.substring( 1 ); return _rch.getResource( path ); }
java
protected URL getConfigResource( String path ) throws MalformedURLException { URL resource = getServletContext().getResource( path ); if ( resource != null ) return resource; if ( path.startsWith( "/" ) ) path = path.substring( 1 ); return _rch.getResource( path ); }
[ "protected", "URL", "getConfigResource", "(", "String", "path", ")", "throws", "MalformedURLException", "{", "URL", "resource", "=", "getServletContext", "(", ")", ".", "getResource", "(", "path", ")", ";", "if", "(", "resource", "!=", "null", ")", "return", "resource", ";", "if", "(", "path", ".", "startsWith", "(", "\"/\"", ")", ")", "path", "=", "path", ".", "substring", "(", "1", ")", ";", "return", "_rch", ".", "getResource", "(", "path", ")", ";", "}" ]
Get a resource URL for a module configuration file. By default, this looks in the ServletContext and in the context classloader. @param path the path to the resource. @return an URL for the resource, or <code>null</code> if the resource is not found. @throws MalformedURLException
[ "Get", "a", "resource", "URL", "for", "a", "module", "configuration", "file", ".", "By", "default", "this", "looks", "in", "the", "ServletContext", "and", "in", "the", "context", "classloader", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/AutoRegisterActionServlet.java#L507-L514
146,594
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/AutoRegisterActionServlet.java
AutoRegisterActionServlet.getConfigResourceAsStream
protected InputStream getConfigResourceAsStream( String path ) { InputStream stream = getServletContext().getResourceAsStream( path ); if ( stream != null ) return stream; if ( path.startsWith( "/" ) ) path = path.substring( 1 ); return _rch.getResourceAsStream( path ); }
java
protected InputStream getConfigResourceAsStream( String path ) { InputStream stream = getServletContext().getResourceAsStream( path ); if ( stream != null ) return stream; if ( path.startsWith( "/" ) ) path = path.substring( 1 ); return _rch.getResourceAsStream( path ); }
[ "protected", "InputStream", "getConfigResourceAsStream", "(", "String", "path", ")", "{", "InputStream", "stream", "=", "getServletContext", "(", ")", ".", "getResourceAsStream", "(", "path", ")", ";", "if", "(", "stream", "!=", "null", ")", "return", "stream", ";", "if", "(", "path", ".", "startsWith", "(", "\"/\"", ")", ")", "path", "=", "path", ".", "substring", "(", "1", ")", ";", "return", "_rch", ".", "getResourceAsStream", "(", "path", ")", ";", "}" ]
Get a resource stream for a module configuration file. By default, this looks in the ServletContext and in the context classloader. @param path the path to the resource. @return an InputStream for the resource, or <code>null</code> if the resource is not found.
[ "Get", "a", "resource", "stream", "for", "a", "module", "configuration", "file", ".", "By", "default", "this", "looks", "in", "the", "ServletContext", "and", "in", "the", "context", "classloader", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/AutoRegisterActionServlet.java#L523-L529
146,595
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/AutoRegisterActionServlet.java
AutoRegisterActionServlet.registerModule
protected synchronized ModuleConfig registerModule( String modulePath, String configFilePath ) throws ServletException { if ( _log.isInfoEnabled() ) { _log.info( "Dynamically registering module " + modulePath + ", config XML " + configFilePath ); } if ( _log.isInfoEnabled() ) { InternalStringBuilder msg = new InternalStringBuilder( "Dynamically registering module " ).append( modulePath ); _log.info( msg.append( ", config XML " ).append( configFilePath ).toString() ); } if ( _cachedConfigDigester == null ) { _cachedConfigDigester = initConfigDigester(); } configDigester = _cachedConfigDigester; ModuleConfig ac = initModuleConfig( modulePath, configFilePath ); initModuleMessageResources( ac ); initModuleDataSources( ac ); initModulePlugIns( ac ); ac.freeze(); configDigester = null; // If this is a FlowController module, make a callback to the event reporter. ControllerConfig cc = ac.getControllerConfig(); if ( cc instanceof PageFlowControllerConfig ) { PageFlowControllerConfig pfcc = ( PageFlowControllerConfig ) cc; PageFlowEventReporter er = AdapterManager.getServletContainerAdapter( getServletContext() ).getEventReporter(); er.flowControllerRegistered( modulePath, pfcc.getControllerClass(), ac ); } // Initialize any delegating action configs or exception handler configs. InternalUtils.initDelegatingConfigs(ac, getServletContext()); if ( _log.isDebugEnabled() ) { _log.debug( "Finished registering module " + modulePath + ", config XML " + configFilePath ); } return ac; }
java
protected synchronized ModuleConfig registerModule( String modulePath, String configFilePath ) throws ServletException { if ( _log.isInfoEnabled() ) { _log.info( "Dynamically registering module " + modulePath + ", config XML " + configFilePath ); } if ( _log.isInfoEnabled() ) { InternalStringBuilder msg = new InternalStringBuilder( "Dynamically registering module " ).append( modulePath ); _log.info( msg.append( ", config XML " ).append( configFilePath ).toString() ); } if ( _cachedConfigDigester == null ) { _cachedConfigDigester = initConfigDigester(); } configDigester = _cachedConfigDigester; ModuleConfig ac = initModuleConfig( modulePath, configFilePath ); initModuleMessageResources( ac ); initModuleDataSources( ac ); initModulePlugIns( ac ); ac.freeze(); configDigester = null; // If this is a FlowController module, make a callback to the event reporter. ControllerConfig cc = ac.getControllerConfig(); if ( cc instanceof PageFlowControllerConfig ) { PageFlowControllerConfig pfcc = ( PageFlowControllerConfig ) cc; PageFlowEventReporter er = AdapterManager.getServletContainerAdapter( getServletContext() ).getEventReporter(); er.flowControllerRegistered( modulePath, pfcc.getControllerClass(), ac ); } // Initialize any delegating action configs or exception handler configs. InternalUtils.initDelegatingConfigs(ac, getServletContext()); if ( _log.isDebugEnabled() ) { _log.debug( "Finished registering module " + modulePath + ", config XML " + configFilePath ); } return ac; }
[ "protected", "synchronized", "ModuleConfig", "registerModule", "(", "String", "modulePath", ",", "String", "configFilePath", ")", "throws", "ServletException", "{", "if", "(", "_log", ".", "isInfoEnabled", "(", ")", ")", "{", "_log", ".", "info", "(", "\"Dynamically registering module \"", "+", "modulePath", "+", "\", config XML \"", "+", "configFilePath", ")", ";", "}", "if", "(", "_log", ".", "isInfoEnabled", "(", ")", ")", "{", "InternalStringBuilder", "msg", "=", "new", "InternalStringBuilder", "(", "\"Dynamically registering module \"", ")", ".", "append", "(", "modulePath", ")", ";", "_log", ".", "info", "(", "msg", ".", "append", "(", "\", config XML \"", ")", ".", "append", "(", "configFilePath", ")", ".", "toString", "(", ")", ")", ";", "}", "if", "(", "_cachedConfigDigester", "==", "null", ")", "{", "_cachedConfigDigester", "=", "initConfigDigester", "(", ")", ";", "}", "configDigester", "=", "_cachedConfigDigester", ";", "ModuleConfig", "ac", "=", "initModuleConfig", "(", "modulePath", ",", "configFilePath", ")", ";", "initModuleMessageResources", "(", "ac", ")", ";", "initModuleDataSources", "(", "ac", ")", ";", "initModulePlugIns", "(", "ac", ")", ";", "ac", ".", "freeze", "(", ")", ";", "configDigester", "=", "null", ";", "// If this is a FlowController module, make a callback to the event reporter.", "ControllerConfig", "cc", "=", "ac", ".", "getControllerConfig", "(", ")", ";", "if", "(", "cc", "instanceof", "PageFlowControllerConfig", ")", "{", "PageFlowControllerConfig", "pfcc", "=", "(", "PageFlowControllerConfig", ")", "cc", ";", "PageFlowEventReporter", "er", "=", "AdapterManager", ".", "getServletContainerAdapter", "(", "getServletContext", "(", ")", ")", ".", "getEventReporter", "(", ")", ";", "er", ".", "flowControllerRegistered", "(", "modulePath", ",", "pfcc", ".", "getControllerClass", "(", ")", ",", "ac", ")", ";", "}", "// Initialize any delegating action configs or exception handler configs.", "InternalUtils", ".", "initDelegatingConfigs", "(", "ac", ",", "getServletContext", "(", ")", ")", ";", "if", "(", "_log", ".", "isDebugEnabled", "(", ")", ")", "{", "_log", ".", "debug", "(", "\"Finished registering module \"", "+", "modulePath", "+", "\", config XML \"", "+", "configFilePath", ")", ";", "}", "return", "ac", ";", "}" ]
Register a Struts module, initialized by the given configuration file. @param modulePath the module path, starting at the webapp root, e.g., "/info/help". @param configFilePath the path, starting at the webapp root, to the module configuration file (e.g., "/WEB-INF/my-generated-struts-config-info-help.xml"). @return the Struts ModuleConfig that was initialized.
[ "Register", "a", "Struts", "module", "initialized", "by", "the", "given", "configuration", "file", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/AutoRegisterActionServlet.java#L539-L584
146,596
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/AutoRegisterActionServlet.java
AutoRegisterActionServlet.clearRegisteredModules
public void clearRegisteredModules() { ServletContext servletContext = getServletContext(); for ( Iterator ii = _registeredModules.keySet().iterator(); ii.hasNext(); ) { String modulePrefix = ( String ) ii.next(); servletContext.removeAttribute( Globals.MODULE_KEY + modulePrefix ); servletContext.removeAttribute( Globals.REQUEST_PROCESSOR_KEY + modulePrefix ); } _registeredModules.clear(); }
java
public void clearRegisteredModules() { ServletContext servletContext = getServletContext(); for ( Iterator ii = _registeredModules.keySet().iterator(); ii.hasNext(); ) { String modulePrefix = ( String ) ii.next(); servletContext.removeAttribute( Globals.MODULE_KEY + modulePrefix ); servletContext.removeAttribute( Globals.REQUEST_PROCESSOR_KEY + modulePrefix ); } _registeredModules.clear(); }
[ "public", "void", "clearRegisteredModules", "(", ")", "{", "ServletContext", "servletContext", "=", "getServletContext", "(", ")", ";", "for", "(", "Iterator", "ii", "=", "_registeredModules", ".", "keySet", "(", ")", ".", "iterator", "(", ")", ";", "ii", ".", "hasNext", "(", ")", ";", ")", "{", "String", "modulePrefix", "=", "(", "String", ")", "ii", ".", "next", "(", ")", ";", "servletContext", ".", "removeAttribute", "(", "Globals", ".", "MODULE_KEY", "+", "modulePrefix", ")", ";", "servletContext", ".", "removeAttribute", "(", "Globals", ".", "REQUEST_PROCESSOR_KEY", "+", "modulePrefix", ")", ";", "}", "_registeredModules", ".", "clear", "(", ")", ";", "}" ]
Clear the internal map of registered modules. @exclude
[ "Clear", "the", "internal", "map", "of", "registered", "modules", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/AutoRegisterActionServlet.java#L925-L937
146,597
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/DefaultActionForwardHandler.java
DefaultActionForwardHandler.doReturnToPage
public ActionForward doReturnToPage( FlowControllerHandlerContext context, PreviousPageInfo prevPageInfo, PageFlowController currentPageFlow, ActionForm currentForm, String actionName, Forward pageFlowFwd ) { assert context.getRequest() instanceof HttpServletRequest : "don't support ServletRequest currently."; HttpServletRequest request = ( HttpServletRequest ) context.getRequest(); if ( prevPageInfo == null ) { if ( _log.isInfoEnabled() ) { _log.info( "Attempted return-to-page, but previous page info was missing." ); } PageFlowException ex = new NoPreviousPageException( actionName, pageFlowFwd, currentPageFlow ); InternalUtils.throwPageFlowException( ex, request ); } // // Figure out what URI to return to, and set the original form in the request or session. // ActionForward retFwd = prevPageInfo.getForward(); ActionMapping prevMapping = prevPageInfo.getMapping(); // // Restore any forms that are specified by this Forward (overwrite the original forms). // if ( retFwd instanceof Forward ) { PageFlowUtils.setOutputForms( prevMapping, ( Forward ) retFwd, request, false ); InternalUtils.addActionOutputs( ( ( Forward ) retFwd ).getActionOutputs(), request, false ); } // // If the user hit the previous page directly (without going through an action), prevMapping will be null. // if ( prevMapping != null ) { // // If the currently-posted form is of the right type, initialize the page with that (but we don't overwrite // the form that was set above). // if ( currentForm != null ) PageFlowUtils.setOutputForm( prevMapping, currentForm, request, false ); // // Initialize the page with the original form it got forwarded (but we don't overwrite the form that was // set above). // InternalUtils.setFormInScope( prevMapping.getName(), prevPageInfo.getForm(), prevMapping, request, false ); } // // If we're forwarding to a page in a different pageflow, we need to make sure the returned ActionForward has // the right module path, and that it has contextRelative=true. // FlowController flowController = context.getFlowController(); if ( ! retFwd.getContextRelative() && flowController != currentPageFlow ) { retFwd = new ActionForward( retFwd.getName(), currentPageFlow.getModulePath() + retFwd.getPath(), retFwd.getRedirect(), true ); } if ( _log.isDebugEnabled() ) { _log.debug( "Return-to-page in PageFlowController " + flowController.getClass().getName() + ": original URI " + retFwd.getPath() ); } if ( retFwd != null ) { // // If the new (return-to) Forward specifies a redirect value explicitly, use that; otherwise // use the redirect value from the original Forward. // if ( pageFlowFwd.hasExplicitRedirectValue() ) retFwd.setRedirect( pageFlowFwd.getRedirect() ); // // If there's a query string, override the previous query string. // String fwdPath = retFwd.getPath(); String newQueryString = pageFlowFwd.getQueryString(); int existingQueryPos = fwdPath.indexOf( '?' ); // // If the new Forward (the one with Jpf.NavigateTo.currentPage/previousPage) has a query string, use that. // Otherwise, if the old Forward has no query string, restore the one from the PreviousPageInfo if // appropriate. // if ( newQueryString != null ) { // Chop off the old query string if necessary. if ( existingQueryPos != -1 ) fwdPath = fwdPath.substring( 0, existingQueryPos ); retFwd.setPath( fwdPath + newQueryString ); } else if ( existingQueryPos == -1 ) { retFwd.setPath( fwdPath + getQueryString( pageFlowFwd, prevPageInfo ) ); } } PageFlowRequestWrapper.get( request ).setPreviousPageInfo( prevPageInfo ); return retFwd; }
java
public ActionForward doReturnToPage( FlowControllerHandlerContext context, PreviousPageInfo prevPageInfo, PageFlowController currentPageFlow, ActionForm currentForm, String actionName, Forward pageFlowFwd ) { assert context.getRequest() instanceof HttpServletRequest : "don't support ServletRequest currently."; HttpServletRequest request = ( HttpServletRequest ) context.getRequest(); if ( prevPageInfo == null ) { if ( _log.isInfoEnabled() ) { _log.info( "Attempted return-to-page, but previous page info was missing." ); } PageFlowException ex = new NoPreviousPageException( actionName, pageFlowFwd, currentPageFlow ); InternalUtils.throwPageFlowException( ex, request ); } // // Figure out what URI to return to, and set the original form in the request or session. // ActionForward retFwd = prevPageInfo.getForward(); ActionMapping prevMapping = prevPageInfo.getMapping(); // // Restore any forms that are specified by this Forward (overwrite the original forms). // if ( retFwd instanceof Forward ) { PageFlowUtils.setOutputForms( prevMapping, ( Forward ) retFwd, request, false ); InternalUtils.addActionOutputs( ( ( Forward ) retFwd ).getActionOutputs(), request, false ); } // // If the user hit the previous page directly (without going through an action), prevMapping will be null. // if ( prevMapping != null ) { // // If the currently-posted form is of the right type, initialize the page with that (but we don't overwrite // the form that was set above). // if ( currentForm != null ) PageFlowUtils.setOutputForm( prevMapping, currentForm, request, false ); // // Initialize the page with the original form it got forwarded (but we don't overwrite the form that was // set above). // InternalUtils.setFormInScope( prevMapping.getName(), prevPageInfo.getForm(), prevMapping, request, false ); } // // If we're forwarding to a page in a different pageflow, we need to make sure the returned ActionForward has // the right module path, and that it has contextRelative=true. // FlowController flowController = context.getFlowController(); if ( ! retFwd.getContextRelative() && flowController != currentPageFlow ) { retFwd = new ActionForward( retFwd.getName(), currentPageFlow.getModulePath() + retFwd.getPath(), retFwd.getRedirect(), true ); } if ( _log.isDebugEnabled() ) { _log.debug( "Return-to-page in PageFlowController " + flowController.getClass().getName() + ": original URI " + retFwd.getPath() ); } if ( retFwd != null ) { // // If the new (return-to) Forward specifies a redirect value explicitly, use that; otherwise // use the redirect value from the original Forward. // if ( pageFlowFwd.hasExplicitRedirectValue() ) retFwd.setRedirect( pageFlowFwd.getRedirect() ); // // If there's a query string, override the previous query string. // String fwdPath = retFwd.getPath(); String newQueryString = pageFlowFwd.getQueryString(); int existingQueryPos = fwdPath.indexOf( '?' ); // // If the new Forward (the one with Jpf.NavigateTo.currentPage/previousPage) has a query string, use that. // Otherwise, if the old Forward has no query string, restore the one from the PreviousPageInfo if // appropriate. // if ( newQueryString != null ) { // Chop off the old query string if necessary. if ( existingQueryPos != -1 ) fwdPath = fwdPath.substring( 0, existingQueryPos ); retFwd.setPath( fwdPath + newQueryString ); } else if ( existingQueryPos == -1 ) { retFwd.setPath( fwdPath + getQueryString( pageFlowFwd, prevPageInfo ) ); } } PageFlowRequestWrapper.get( request ).setPreviousPageInfo( prevPageInfo ); return retFwd; }
[ "public", "ActionForward", "doReturnToPage", "(", "FlowControllerHandlerContext", "context", ",", "PreviousPageInfo", "prevPageInfo", ",", "PageFlowController", "currentPageFlow", ",", "ActionForm", "currentForm", ",", "String", "actionName", ",", "Forward", "pageFlowFwd", ")", "{", "assert", "context", ".", "getRequest", "(", ")", "instanceof", "HttpServletRequest", ":", "\"don't support ServletRequest currently.\"", ";", "HttpServletRequest", "request", "=", "(", "HttpServletRequest", ")", "context", ".", "getRequest", "(", ")", ";", "if", "(", "prevPageInfo", "==", "null", ")", "{", "if", "(", "_log", ".", "isInfoEnabled", "(", ")", ")", "{", "_log", ".", "info", "(", "\"Attempted return-to-page, but previous page info was missing.\"", ")", ";", "}", "PageFlowException", "ex", "=", "new", "NoPreviousPageException", "(", "actionName", ",", "pageFlowFwd", ",", "currentPageFlow", ")", ";", "InternalUtils", ".", "throwPageFlowException", "(", "ex", ",", "request", ")", ";", "}", "//", "// Figure out what URI to return to, and set the original form in the request or session.", "// ", "ActionForward", "retFwd", "=", "prevPageInfo", ".", "getForward", "(", ")", ";", "ActionMapping", "prevMapping", "=", "prevPageInfo", ".", "getMapping", "(", ")", ";", "//", "// Restore any forms that are specified by this Forward (overwrite the original forms).", "//", "if", "(", "retFwd", "instanceof", "Forward", ")", "{", "PageFlowUtils", ".", "setOutputForms", "(", "prevMapping", ",", "(", "Forward", ")", "retFwd", ",", "request", ",", "false", ")", ";", "InternalUtils", ".", "addActionOutputs", "(", "(", "(", "Forward", ")", "retFwd", ")", ".", "getActionOutputs", "(", ")", ",", "request", ",", "false", ")", ";", "}", "//", "// If the user hit the previous page directly (without going through an action), prevMapping will be null.", "//", "if", "(", "prevMapping", "!=", "null", ")", "{", "//", "// If the currently-posted form is of the right type, initialize the page with that (but we don't overwrite", "// the form that was set above).", "//", "if", "(", "currentForm", "!=", "null", ")", "PageFlowUtils", ".", "setOutputForm", "(", "prevMapping", ",", "currentForm", ",", "request", ",", "false", ")", ";", "//", "// Initialize the page with the original form it got forwarded (but we don't overwrite the form that was", "// set above).", "//", "InternalUtils", ".", "setFormInScope", "(", "prevMapping", ".", "getName", "(", ")", ",", "prevPageInfo", ".", "getForm", "(", ")", ",", "prevMapping", ",", "request", ",", "false", ")", ";", "}", "//", "// If we're forwarding to a page in a different pageflow, we need to make sure the returned ActionForward has", "// the right module path, and that it has contextRelative=true.", "//", "FlowController", "flowController", "=", "context", ".", "getFlowController", "(", ")", ";", "if", "(", "!", "retFwd", ".", "getContextRelative", "(", ")", "&&", "flowController", "!=", "currentPageFlow", ")", "{", "retFwd", "=", "new", "ActionForward", "(", "retFwd", ".", "getName", "(", ")", ",", "currentPageFlow", ".", "getModulePath", "(", ")", "+", "retFwd", ".", "getPath", "(", ")", ",", "retFwd", ".", "getRedirect", "(", ")", ",", "true", ")", ";", "}", "if", "(", "_log", ".", "isDebugEnabled", "(", ")", ")", "{", "_log", ".", "debug", "(", "\"Return-to-page in PageFlowController \"", "+", "flowController", ".", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\": original URI \"", "+", "retFwd", ".", "getPath", "(", ")", ")", ";", "}", "if", "(", "retFwd", "!=", "null", ")", "{", "//", "// If the new (return-to) Forward specifies a redirect value explicitly, use that; otherwise", "// use the redirect value from the original Forward.", "//", "if", "(", "pageFlowFwd", ".", "hasExplicitRedirectValue", "(", ")", ")", "retFwd", ".", "setRedirect", "(", "pageFlowFwd", ".", "getRedirect", "(", ")", ")", ";", "//", "// If there's a query string, override the previous query string.", "//", "String", "fwdPath", "=", "retFwd", ".", "getPath", "(", ")", ";", "String", "newQueryString", "=", "pageFlowFwd", ".", "getQueryString", "(", ")", ";", "int", "existingQueryPos", "=", "fwdPath", ".", "indexOf", "(", "'", "'", ")", ";", "//", "// If the new Forward (the one with Jpf.NavigateTo.currentPage/previousPage) has a query string, use that.", "// Otherwise, if the old Forward has no query string, restore the one from the PreviousPageInfo if", "// appropriate.", "//", "if", "(", "newQueryString", "!=", "null", ")", "{", "// Chop off the old query string if necessary.", "if", "(", "existingQueryPos", "!=", "-", "1", ")", "fwdPath", "=", "fwdPath", ".", "substring", "(", "0", ",", "existingQueryPos", ")", ";", "retFwd", ".", "setPath", "(", "fwdPath", "+", "newQueryString", ")", ";", "}", "else", "if", "(", "existingQueryPos", "==", "-", "1", ")", "{", "retFwd", ".", "setPath", "(", "fwdPath", "+", "getQueryString", "(", "pageFlowFwd", ",", "prevPageInfo", ")", ")", ";", "}", "}", "PageFlowRequestWrapper", ".", "get", "(", "request", ")", ".", "setPreviousPageInfo", "(", "prevPageInfo", ")", ";", "return", "retFwd", ";", "}" ]
Get an ActionForward to the original page that was visible before the previous action.
[ "Get", "an", "ActionForward", "to", "the", "original", "page", "that", "was", "visible", "before", "the", "previous", "action", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/DefaultActionForwardHandler.java#L305-L412
146,598
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/scoping/internal/ScopedResponseImpl.java
ScopedResponseImpl.getCookie
public Cookie getCookie( String cookieName ) { List cookies = getHeaders(SET_COOKIE); if(cookies != null){ // start looking from the back (ie. the last cookie set) for(int i = cookies.size(); --i > -1;) { Cookie cookie = (Cookie)cookies.get(i); if(cookie.getName().equals(cookieName)) { return cookie; } } } return null; }
java
public Cookie getCookie( String cookieName ) { List cookies = getHeaders(SET_COOKIE); if(cookies != null){ // start looking from the back (ie. the last cookie set) for(int i = cookies.size(); --i > -1;) { Cookie cookie = (Cookie)cookies.get(i); if(cookie.getName().equals(cookieName)) { return cookie; } } } return null; }
[ "public", "Cookie", "getCookie", "(", "String", "cookieName", ")", "{", "List", "cookies", "=", "getHeaders", "(", "SET_COOKIE", ")", ";", "if", "(", "cookies", "!=", "null", ")", "{", "// start looking from the back (ie. the last cookie set)", "for", "(", "int", "i", "=", "cookies", ".", "size", "(", ")", ";", "--", "i", ">", "-", "1", ";", ")", "{", "Cookie", "cookie", "=", "(", "Cookie", ")", "cookies", ".", "get", "(", "i", ")", ";", "if", "(", "cookie", ".", "getName", "(", ")", ".", "equals", "(", "cookieName", ")", ")", "{", "return", "cookie", ";", "}", "}", "}", "return", "null", ";", "}" ]
Gets a cookie that was added to the response.
[ "Gets", "a", "cookie", "that", "was", "added", "to", "the", "response", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/scoping/internal/ScopedResponseImpl.java#L135-L149
146,599
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/scoping/internal/ScopedResponseImpl.java
ScopedResponseImpl.getCookies
public Cookie[] getCookies() { List cookies = (List)_headers.get(SET_COOKIE); return cookies != null ? ( Cookie[] ) cookies.toArray( new Cookie[cookies.size()] ) : NO_COOKIES; }
java
public Cookie[] getCookies() { List cookies = (List)_headers.get(SET_COOKIE); return cookies != null ? ( Cookie[] ) cookies.toArray( new Cookie[cookies.size()] ) : NO_COOKIES; }
[ "public", "Cookie", "[", "]", "getCookies", "(", ")", "{", "List", "cookies", "=", "(", "List", ")", "_headers", ".", "get", "(", "SET_COOKIE", ")", ";", "return", "cookies", "!=", "null", "?", "(", "Cookie", "[", "]", ")", "cookies", ".", "toArray", "(", "new", "Cookie", "[", "cookies", ".", "size", "(", ")", "]", ")", ":", "NO_COOKIES", ";", "}" ]
Gets all Cookies that were added to the response.
[ "Gets", "all", "Cookies", "that", "were", "added", "to", "the", "response", "." ]
4246a0cc40ce3c05f1a02c2da2653ac622703d77
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/scoping/internal/ScopedResponseImpl.java#L154-L158