idx int64 0 41.2k | question stringlengths 74 4.21k | target stringlengths 5 888 |
|---|---|---|
9,200 | public Vector subtract ( Vector vec ) { x -= vec . x ; y -= vec . y ; z -= vec . z ; return this ; } | Subtracts a vector from this one . |
9,201 | public Vector multiply ( Vector vec ) { x *= vec . x ; y *= vec . y ; z *= vec . z ; return this ; } | Multiplies the vector by another . |
9,202 | public Vector divide ( Vector vec ) { x /= vec . x ; y /= vec . y ; z /= vec . z ; return this ; } | Divides the vector by another . |
9,203 | public Vector copy ( Vector vec ) { x = vec . x ; y = vec . y ; z = vec . z ; return this ; } | Copies another vector |
9,204 | public double lengthSquared ( ) { return NumberConversions . square ( x ) + NumberConversions . square ( y ) + NumberConversions . square ( z ) ; } | Gets the magnitude of the vector squared . |
9,205 | public double distanceSquared ( Vector o ) { return NumberConversions . square ( x - o . x ) + NumberConversions . square ( y - o . y ) + NumberConversions . square ( z - o . z ) ; } | Get the squared distance between this vector and another . |
9,206 | public float angle ( Vector other ) { double dot = dot ( other ) / ( length ( ) * other . length ( ) ) ; return ( float ) Math . acos ( dot ) ; } | Gets the angle between this vector and another in radians . |
9,207 | public Vector midpoint ( Vector other ) { x = ( x + other . x ) / 2 ; y = ( y + other . y ) / 2 ; z = ( z + other . z ) / 2 ; return this ; } | Sets this vector to the midpoint between this vector and another . |
9,208 | public Vector getMidpoint ( Vector other ) { double x = ( this . x + other . x ) / 2 ; double y = ( this . y + other . y ) / 2 ; double z = ( this . z + other . z ) / 2 ; return new Vector ( x , y , z ) ; } | Gets a new midpoint vector between this vector and another . |
9,209 | public boolean isInSphere ( Vector origin , double radius ) { return ( NumberConversions . square ( origin . x - x ) + NumberConversions . square ( origin . y - y ) + NumberConversions . square ( origin . z - z ) ) <= NumberConversions . square ( radius ) ; } | Returns whether this vector is within a sphere . |
9,210 | public static Vector getMinimum ( Vector v1 , Vector v2 ) { return new Vector ( Math . min ( v1 . x , v2 . x ) , Math . min ( v1 . y , v2 . y ) , Math . min ( v1 . z , v2 . z ) ) ; } | Gets the minimum components of two vectors . |
9,211 | public static Vector getMaximum ( Vector v1 , Vector v2 ) { return new Vector ( Math . max ( v1 . x , v2 . x ) , Math . max ( v1 . y , v2 . y ) , Math . max ( v1 . z , v2 . z ) ) ; } | Gets the maximum components of two vectors . |
9,212 | public void setPlacement ( String placement ) { if ( placement . equals ( "after" ) ) _placement = ScriptPlacement . PLACE_AFTER ; else if ( placement . equals ( "before" ) ) _placement = ScriptPlacement . PLACE_BEFORE ; else _placement = ScriptPlacement . PLACE_INLINE ; } | Place the JavaScript inside in relationship to the frameword generated JavaScript . |
9,213 | public Collection < XAttributeNameMap > getAvailableMappings ( ) { HashSet < XAttributeNameMap > result = new HashSet < XAttributeNameMap > ( ) ; result . addAll ( mappings . values ( ) ) ; return Collections . unmodifiableCollection ( result ) ; } | Returns all available mappings . Note that returned mappings may be empty . |
9,214 | public XAttributeNameMap getMapping ( String name ) { XAttributeNameMapImpl mapping = mappings . get ( name ) ; if ( mapping == null ) { mapping = new XAttributeNameMapImpl ( name ) ; mappings . put ( name , mapping ) ; } return mapping ; } | Provides access to a specific attribute name mapping by its name . If the requested mapping does not exist yet a new mapping will be created added to the set of managed mappings and returned . This means this method will always return a mapping but this could be empty . |
9,215 | public void check ( ) { for ( AnnotationTypeDeclaration atd : _atds ) { Collection < Declaration > decls = getAnnotationProcessorEnvironment ( ) . getDeclarationsAnnotatedWith ( atd ) ; for ( Declaration decl : decls ) { check ( decl ) ; } } } | Performs semantic validation of input Declarations that are annotated with annotations claimed by this AnnotationProcessor . |
9,216 | public void generate ( ) throws CodeGenerationException { for ( AnnotationTypeDeclaration atd : _atds ) { Collection < Declaration > decls = getAnnotationProcessorEnvironment ( ) . getDeclarationsAnnotatedWith ( atd ) ; for ( Declaration decl : decls ) { generate ( decl ) ; } } } | Emits additional artifacts for input Declarations that are annotated with annotations claimed by this AnnotationProcessor . |
9,217 | public void printError ( Declaration d , String id , Object ... args ) { addError ( d , id , args ) ; } | Report an error detected during the check phase . The presence of errors will suppress execution of the generate phase . |
9,218 | public void printWarning ( Declaration d , String id , Object ... args ) { addWarning ( d , id , args ) ; } | Report a warning detected during the check phase . The presence of warnings will not affect execution of the generate phase . |
9,219 | public int doStartTag ( ) throws JspException { Object val = evaluateDataSource ( ) ; if ( val != null ) _match = val . toString ( ) ; pageContext . setAttribute ( RADIOBUTTONGROUP_KEY , this ) ; _defaultRadio = evaluateDefaultValue ( ) ; if ( hasErrors ( ) ) return SKIP_BODY ; ServletRequest req = pageContext . getRequest ( ) ; if ( _cr == null ) _cr = TagRenderingBase . Factory . getConstantRendering ( req ) ; _writer = new WriteRenderAppender ( pageContext ) ; if ( isVertical ( ) ) { _cr . TABLE ( _writer ) ; } _dynamicAttrs = evaluateOptionsDataSource ( ) ; assert ( _dynamicAttrs != null ) ; assert ( _dynamicAttrs instanceof Map || _dynamicAttrs instanceof Iterator ) ; if ( _repeater ) { if ( _dynamicAttrs instanceof Map ) { _dynamicAttrs = ( ( Map ) _dynamicAttrs ) . entrySet ( ) . iterator ( ) ; } if ( ! ( _dynamicAttrs instanceof Iterator ) ) { String s = Bundle . getString ( "Tags_OptionsDSIteratorError" ) ; registerTagError ( s , null ) ; return SKIP_BODY ; } while ( ( ( Iterator ) _dynamicAttrs ) . hasNext ( ) ) { _repCurItem = ( ( Iterator ) _dynamicAttrs ) . next ( ) ; if ( _repCurItem != null ) break ; } if ( isVertical ( ) ) _cr . TR_TD ( _writer ) ; DataAccessProviderStack . addDataAccessProvider ( this , pageContext ) ; } _saveBody = new InternalStringBuilder ( 640 ) ; return EVAL_BODY_INCLUDE ; } | Determine the match for the RadioButtonGroup |
9,220 | public int doEndTag ( ) throws JspException { if ( hasErrors ( ) ) return reportAndExit ( EVAL_PAGE ) ; String idScript = null ; String altText = null ; char accessKey = 0x00 ; pageContext . removeAttribute ( RADIOBUTTONGROUP_KEY ) ; ServletRequest req = pageContext . getRequest ( ) ; if ( _cr == null ) _cr = TagRenderingBase . Factory . getConstantRendering ( req ) ; if ( _saveBody != null ) write ( _saveBody . toString ( ) ) ; if ( _repeater ) { if ( isVertical ( ) ) _cr . end_TABLE ( _writer ) ; if ( idScript != null ) write ( idScript ) ; localRelease ( ) ; return EVAL_PAGE ; } if ( _dynamicAttrs instanceof Map ) { Map dynamicRadiosMap = ( Map ) _dynamicAttrs ; Iterator keyIterator = dynamicRadiosMap . keySet ( ) . iterator ( ) ; int idx = 0 ; while ( keyIterator . hasNext ( ) ) { Object optionValue = keyIterator . next ( ) ; String optionDisplay = null ; if ( dynamicRadiosMap . get ( optionValue ) != null ) { optionDisplay = dynamicRadiosMap . get ( optionValue ) . toString ( ) ; } else { optionDisplay = "" ; } if ( optionValue != null ) { addOption ( _writer , INPUT_RADIO , optionValue . toString ( ) , optionDisplay , idx ++ , altText , accessKey , _disabled ) ; } if ( hasErrors ( ) ) { reportErrors ( ) ; localRelease ( ) ; return EVAL_PAGE ; } write ( "\n" ) ; } } else { assert ( _dynamicAttrs instanceof Iterator ) ; Iterator it = ( Iterator ) _dynamicAttrs ; int idx = 0 ; while ( it . hasNext ( ) ) { Object o = it . next ( ) ; if ( o == null ) continue ; if ( o instanceof GroupOption ) { GroupOption go = ( GroupOption ) o ; addOption ( _writer , INPUT_RADIO , go . getValue ( ) , go . getName ( ) , idx ++ , go . getAlt ( ) , go . getAccessKey ( ) , _disabled ) ; } else { String radioValue = o . toString ( ) ; addOption ( _writer , INPUT_RADIO , radioValue , radioValue , idx ++ , altText , accessKey , _disabled ) ; } if ( hasErrors ( ) ) { reportErrors ( ) ; localRelease ( ) ; return EVAL_PAGE ; } write ( "\n" ) ; } } if ( isVertical ( ) ) { _cr . end_TABLE ( _writer ) ; } if ( idScript != null ) write ( idScript ) ; localRelease ( ) ; return EVAL_PAGE ; } | Render the set of RadioButtonOptions . |
9,221 | static void preHandleMultipartRequest ( HttpServletRequest request ) throws ServletException { MultipartRequestHandler multipartHandler = getCachedMultipartHandler ( request ) ; if ( multipartHandler == null ) { multipartHandler = getMultipartHandler ( request ) ; if ( multipartHandler != null ) { multipartHandler . handleRequest ( request ) ; HttpServletRequest outerRequest = ScopedServletUtils . getOuterRequest ( request ) ; outerRequest . setAttribute ( PREHANDLED_MULTIPART_REQUEST_ATTR , multipartHandler ) ; } } } | Can be called early in the request processing cycle to cache a single multipart handler for the request . |
9,222 | public void changeSelected ( String selectNode , ServletRequest request ) { _selectedNode = TreeHelpers . changeSelected ( this , _selectedNode , selectNode , request ) ; } | Change the node that is selected . This is an optimization were the root node can track which node is currently selected so it can unselect that node instead of searching the whole tree to find the selected node . |
9,223 | public void checkValidity ( ) throws ACMValidationException { if ( context == null ) { throw new ACMValidationException ( "Invalid state of AC model: No context assigned" ) ; } if ( ! getContext ( ) . containsActivities ( ) ) { return ; } for ( String activity : getContext ( ) . getActivities ( ) ) { try { if ( ! isExecutable ( activity ) ) { throw new ACMValidationException ( "Model contains non-executable transactions: " + activity ) ; } } catch ( CompatibilityException e ) { throw new ACMValidationException ( "Error during validation check: " + e . getMessage ( ) ) ; } } } | An Access Control Model is considered valid if all transactions are executable . |
9,224 | public void register ( T instance ) { if ( ! isContained ( instance ) ) { registry . add ( instance ) ; if ( current == null ) { current = instance ; } } } | Registers a new instance with this registry . |
9,225 | protected boolean isContained ( T instance ) { for ( T ref : registry ) { if ( areEqual ( instance , ref ) ) { return true ; } } return false ; } | Checks whether the given instance is already contained in the registry . |
9,226 | public String getReadMethod ( ) { StringBuffer sb = new StringBuffer ( ) ; if ( getType ( ) . equals ( "boolean" ) ) sb . append ( "is" ) ; else sb . append ( "get" ) ; sb . append ( getAccessorName ( ) ) ; return sb . toString ( ) ; } | Returns the name of the property reading accessor method |
9,227 | public String getType ( ) { if ( _propDecl == null || _propDecl . getReturnType ( ) == null ) return "" ; return _propDecl . getReturnType ( ) . toString ( ) ; } | Returns the type of the Property |
9,228 | public boolean isBound ( ) { PropertyInfo propInfo = getPropertyInfo ( ) ; return propInfo != null && ( propInfo . bound ( ) || propInfo . constrained ( ) ) ; } | Returns true is the property is a bound property that will support registration of a PropertyChangeListener for change notifications . |
9,229 | public String getEditorClass ( ) { PropertyInfo pi = getPropertyInfo ( ) ; if ( pi == null ) return null ; Collection < AnnotationMirror > annotMirrors = _propDecl . getAnnotationMirrors ( ) ; for ( AnnotationMirror am : annotMirrors ) { if ( am . getAnnotationType ( ) . toString ( ) . equals ( "org.apache.beehive.controls.api.packaging.PropertyInfo" ) ) { Map < AnnotationTypeElementDeclaration , AnnotationValue > avs = am . getElementValues ( ) ; for ( AnnotationTypeElementDeclaration ated : avs . keySet ( ) ) { if ( ated . toString ( ) . equals ( "editorClass()" ) ) { String editorClass = avs . get ( ated ) . getValue ( ) . toString ( ) ; if ( editorClass . equals ( "org.apache.beehive.controls.api.packaging.PropertyInfo.NoEditor.class" ) ) return null ; return editorClass ; } } break ; } } return null ; } | Returns the class name of the property editor class or null |
9,230 | protected CodeGenerator getGenerator ( ) { if ( _generator == null ) { AnnotationProcessorEnvironment env = getAnnotationProcessorEnvironment ( ) ; try { _generator = new VelocityGenerator ( env ) ; } catch ( Exception e ) { throw new CodeGenerationException ( "Unable to create code generator" , e ) ; } } return _generator ; } | Returns the CodeGenerator instance supporting this processor instantiating a new generator instance if necessary . |
9,231 | public void setMap ( Map map ) throws JspException { if ( map == null ) { String s = Bundle . getString ( "Tags_MapAttrValueRequired" , new Object [ ] { "map" } ) ; registerTagError ( s , null ) ; } _map = map ; } | Sets the map expression . |
9,232 | public int doStartTag ( ) throws JspException { if ( hasErrors ( ) ) return reportAndExit ( SKIP_BODY ) ; Tag parentTag = findAncestorWithClass ( this , IUrlParams . class ) ; if ( parentTag != null ) { assert ( _map != null ) ; IUrlParams parent = ( IUrlParams ) parentTag ; Iterator it = _map . entrySet ( ) . iterator ( ) ; while ( it . hasNext ( ) ) { Map . Entry key = ( Map . Entry ) it . next ( ) ; parent . addParameter ( key . getKey ( ) . toString ( ) , key . getValue ( ) , null ) ; } } else { String msg = Bundle . getString ( "Tags_InvalidParameterMapParent" ) ; registerTagError ( msg , null ) ; reportErrors ( ) ; } localRelease ( ) ; return SKIP_BODY ; } | Add each parameter in the URL parameter map to the Parameter s parent . |
9,233 | private void getResultSetMappings ( ) throws SQLException { if ( _schemaType . isDocumentType ( ) ) { return ; } final String [ ] keys = getKeysFromResultSet ( ) ; HashMap < String , Method > mapFields = new HashMap < String , Method > ( _columnCount * 2 ) ; for ( int i = 1 ; i <= _columnCount ; i ++ ) { mapFields . put ( keys [ i ] , null ) ; } Method [ ] classMethods = _returnTypeClass . getMethods ( ) ; for ( Method method : classMethods ) { if ( isSetterMethod ( method ) ) { final String fieldName = method . getName ( ) . substring ( 3 ) . toUpperCase ( ) ; if ( mapFields . containsKey ( fieldName ) ) { mapFields . put ( fieldName , method ) ; } } } _setterMethods = new SetterMethod [ _columnCount + 1 ] ; for ( int i = 1 ; i < _setterMethods . length ; i ++ ) { Method setterMethod = mapFields . get ( keys [ i ] ) ; if ( setterMethod == null ) { throw new ControlException ( "Unable to map the SQL column " + keys [ i ] + " to a field on the " + _returnTypeClass . getName ( ) + " class. Mapping is done using a case insensitive comparision of SQL ResultSet " + "columns to public setter methods on the return class." ) ; } _setterMethods [ i ] = new SetterMethod ( setterMethod ) ; } } | Build the necessary structures to do the mapping |
9,234 | private SchemaType getSchemaType ( Class returnType ) { SchemaType schemaType = null ; if ( XmlObject . class . isAssignableFrom ( returnType ) ) { try { Field f = returnType . getField ( "type" ) ; if ( SchemaType . class . isAssignableFrom ( f . getType ( ) ) && Modifier . isStatic ( f . getModifiers ( ) ) ) { schemaType = ( SchemaType ) f . get ( null ) ; } } catch ( NoSuchFieldException x ) { } catch ( IllegalAccessException x ) { } } return schemaType ; } | Get the SchemaType for the specified class . |
9,235 | public void addScriptFunction ( ScriptPlacement placement , String script ) { assert ( script != null ) : "The paramter 'script' must not be null" ; IScriptReporter sr = getParentScriptReporter ( ) ; if ( sr != null ) { sr . addScriptFunction ( placement , script ) ; return ; } if ( placement == null || placement == ScriptPlacement . PLACE_INFRAMEWORK ) { if ( _funcBlocks == null ) { _funcBlocks = new ArrayList ( ) ; } assert ( _funcBlocks != null ) : "_funcBlocks should not be null" ; _funcBlocks . add ( script ) ; } else if ( placement == ScriptPlacement . PLACE_BEFORE ) { if ( _codeBefore == null ) _codeBefore = new ArrayList ( ) ; _codeBefore . add ( script ) ; } else if ( placement == ScriptPlacement . PLACE_AFTER ) { if ( _codeAfter == null ) _codeAfter = new ArrayList ( ) ; _codeAfter . add ( script ) ; } else { assert ( false ) : "unsupported placement:" + placement ; } } | This method will add Script as a function . |
9,236 | public void addLegacyTagIdMappings ( String tagId , String tagName ) { assert ( tagId != null ) : "The parameter 'tagId' must not be null" ; assert ( tagName != null ) : "The parameter 'tagName' must not be null" ; if ( _idMap == null ) { _idMap = new HashMap ( ) ; } assert ( _idMap != null ) : "_idMap should not be null" ; _idMap . put ( tagId , tagName ) ; } | Adds a tagID and tagName to the Html s getId javascript function . |
9,237 | public void addTagIdMappings ( String tagId , String realId , String realName ) { assert ( tagId != null ) : "The parameter 'tagId' must not be null" ; assert ( realId != null ) : "The parameter 'realId' must not be null" ; _writeId = true ; if ( realName != null ) { if ( _idToNameMap == null ) _idToNameMap = new HashMap ( ) ; _idToNameMap . put ( tagId , realName ) ; } } | This will add the mapping between the tagId and the real name to the NameMap hashmap . |
9,238 | public void writeScript ( AbstractRenderAppender sb ) { assert ( sb != null ) : "The paramter 'sb' must not be null;" ; if ( _writeScript ) return ; _writeScript = true ; IScriptReporter sr = getParentScriptReporter ( ) ; if ( sr != null ) { sr . writeScript ( sb ) ; return ; } writeBeforeBlocks ( sb ) ; writeFrameworkScript ( sb ) ; writeAfterBlocks ( sb ) ; } | This method will output all of the Script associated with the script reporter . |
9,239 | protected String getRealIdScope ( ) { ServletRequest request = pageContext . getRequest ( ) ; String idScope = _idScope ; if ( _idScope == null && _genScope ) { int id = getNextId ( request ) ; idScope = "n" + Integer . toString ( id ) ; _idScope = idScope ; } if ( _idScope == null ) { ScopedRequest scopedRequest = ScopedServletUtils . unwrapRequest ( request ) ; if ( scopedRequest != null ) { _idScope = scopedRequest . getScopeKey ( ) . toString ( ) ; idScope = _idScope ; } } return idScope ; } | This method will return the real scope id for the script container . |
9,240 | protected void writeFrameworkScript ( AbstractRenderAppender sb ) { boolean script = false ; ScriptRequestState jsu = ScriptRequestState . getScriptRequestState ( ( HttpServletRequest ) pageContext . getRequest ( ) ) ; boolean writeLegacy = false ; boolean writeName = false ; String val ; if ( TagConfig . isLegacyJavaScript ( ) ) { val = processIdMap ( _idMap , "idMappingEntry" , _idScope ) ; if ( val != null ) { writeIdMap ( this , "idMappingTable" , val ) ; writeLegacy = true ; } } if ( TagConfig . isDefaultJavaScript ( ) ) { String idScope = getJavaScriptId ( ) ; if ( idScope . equals ( "" ) ) idScope = null ; val = processIdMap ( _idToNameMap , "tagIdNameMappingEntry" , idScope ) ; if ( val != null ) { writeIdMap ( this , "tagIdNameMappingTable" , val ) ; writeName = true ; } } if ( writeLegacy || _writeId || writeName ) jsu . writeNetuiNameFunctions ( this , writeLegacy , _writeId , writeName ) ; ScriptTag . State state = null ; ScriptTag br = null ; if ( _funcBlocks != null && _funcBlocks . size ( ) > 0 ) { if ( ! script ) { state = new ScriptTag . State ( ) ; state . suppressComments = false ; br = ( ScriptTag ) TagRenderingBase . Factory . getRendering ( TagRenderingBase . SCRIPT_TAG , pageContext . getRequest ( ) ) ; br . doStartTag ( sb , state ) ; script = true ; } String s = ScriptRequestState . getString ( "functionComment" , null ) ; sb . append ( s ) ; int cnt = _funcBlocks . size ( ) ; for ( int i = 0 ; i < cnt ; i ++ ) { sb . append ( ( String ) _funcBlocks . get ( i ) ) ; if ( i != cnt - 1 ) { sb . append ( "\n" ) ; } } } if ( script ) { assert ( br != null ) ; br . doEndTag ( sb , false ) ; } } | This will write the script block . |
9,241 | protected synchronized ImplInitializer getImplInitializer ( ) { if ( _implInitializer == null ) { try { Class initClass = _implClass . getClassLoader ( ) . loadClass ( _implClass . getName ( ) + "Initializer" ) ; _implInitializer = ( ImplInitializer ) initClass . newInstance ( ) ; } catch ( Exception e ) { throw new ControlException ( "Control initialization failure" , e ) ; } } return _implInitializer ; } | Obtains an instance of the appropriate ImplInitializer class |
9,242 | public synchronized Object ensureControl ( ) { if ( _control == null ) { String implBinding = null ; BaseProperties bp = _properties . getPropertySet ( BaseProperties . class ) ; if ( bp != null ) implBinding = bp . controlImplementation ( ) ; else implBinding = ControlUtils . getDefaultControlBinding ( _controlIntf ) ; try { _implClass = _controlIntf . getClassLoader ( ) . loadClass ( implBinding ) ; if ( _implClass . getAnnotation ( ControlImplementation . class ) == null ) { throw new ControlException ( "@" + ControlImplementation . class . getName ( ) + " annotation is missing from control implementation class: " + _implClass . getName ( ) ) ; } } catch ( ClassNotFoundException cnfe ) { throw new ControlException ( "Unable to load control implementation: " + implBinding , cnfe ) ; } Threading thr = ( Threading ) _implClass . getAnnotation ( Threading . class ) ; if ( thr != null ) _threadingPolicy = thr . value ( ) ; else _threadingPolicy = ThreadingPolicy . SINGLE_THREADED ; ensureThreadingBehaviour ( ) ; try { _control = _implClass . newInstance ( ) ; try { getImplInitializer ( ) . initialize ( this , _control ) ; _hasServices = true ; } catch ( Exception e ) { throw new ControlException ( "Control initialization failure" , e ) ; } ControlBeanContext cbcs = getBeanContextProxy ( ) ; cbcs . initializeControl ( ) ; } catch ( RuntimeException re ) { throw re ; } catch ( Exception e ) { throw new ControlException ( "Unable to create control instance" , e ) ; } } if ( ! _hasServices ) { getImplInitializer ( ) . initServices ( this , _control ) ; _hasServices = true ; } return _control ; } | Returns the target control instance associated with this ControlBean performing lazy instantiation and initialization of the instance . |
9,243 | protected void preInvoke ( Method m , Object [ ] args , String [ ] interceptorNames ) throws InterceptorPivotException { if ( _invokeLock != null ) { try { _invokeLock . acquire ( ) ; } catch ( InterruptedException ie ) { } } if ( interceptorNames != null ) { for ( String n : interceptorNames ) { Interceptor i = ensureInterceptor ( n ) ; try { i . preInvoke ( this , m , args ) ; } catch ( InterceptorPivotException ipe ) { ipe . setInterceptorName ( n ) ; throw ipe ; } } } Vector < InvokeListener > invokeListeners = getInvokeListeners ( ) ; if ( invokeListeners . size ( ) > 0 ) { for ( InvokeListener listener : invokeListeners ) listener . preInvoke ( m , args ) ; } } | The preinvoke method is called before all operations on the control . In addition to providing a basic hook for logging context initialization resource management and other common services it also provides a hook for interceptors . |
9,244 | protected void preInvoke ( Method m , Object [ ] args ) { try { preInvoke ( m , args , null ) ; } catch ( InterceptorPivotException ipe ) { } } | The preinvoke method is called before all operations on the control . It is the basic hook for logging context initialization resource management and other common services |
9,245 | protected void postInvoke ( Method m , Object [ ] args , Object retval , Throwable t ) { postInvoke ( m , args , retval , t , null , null ) ; } | The postInvoke method is called after all operations on the control . It is the basic hook for logging context initialization resource management and other common services . |
9,246 | protected < T > void setEventNotifier ( Class < T > eventSet , T notifier ) { _notifiers . put ( eventSet , notifier ) ; List < Class > superEventSets = new ArrayList < Class > ( ) ; getSuperEventSets ( eventSet , superEventSets ) ; Iterator < Class > i = superEventSets . iterator ( ) ; while ( i . hasNext ( ) ) { Class superEventSet = i . next ( ) ; _notifiers . put ( superEventSet , notifier ) ; } } | Sets the EventNotifier for this ControlBean |
9,247 | private void getSuperEventSets ( Class eventSet , List < Class > superEventSets ) { Class [ ] superInterfaces = eventSet . getInterfaces ( ) ; if ( superInterfaces != null ) { for ( int i = 0 ; i < superInterfaces . length ; i ++ ) { Class superInterface = superInterfaces [ i ] ; if ( superInterface . isAnnotationPresent ( EventSet . class ) ) { superEventSets . add ( superInterface ) ; getSuperEventSets ( superInterface , superEventSets ) ; } } } } | Finds all of the EventSets extended by the input EventSet and adds them to the provided list . |
9,248 | protected Object getControlService ( Class serviceClass , Object selector ) throws TooManyListenersException { ControlBeanContext cbc = getControlBeanContext ( ) ; BeanContext bc = cbc . getBeanContext ( ) ; if ( bc == null || ! ( bc instanceof BeanContextServices ) ) throw new ControlException ( "Can't locate service context: " + bc ) ; return ( ( BeanContextServices ) bc ) . getService ( cbc , this , serviceClass , selector , cbc ) ; } | Locates and obtains a context service from the BeanContextServices instance supporting this bean . |
9,249 | protected void setControlProperty ( PropertyKey key , Object o ) { AnnotationConstraintValidator . validate ( key , o ) ; _properties . setProperty ( key , o ) ; } | Sets a property on the ControlBean instance . All generated property setter methods will delegate down to this method . |
9,250 | protected Object getControlProperty ( PropertyKey key ) { Object value = getRawControlProperty ( key ) ; 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 |
9,251 | protected PropertyMap getAnnotationMap ( AnnotatedElement annotElem ) { Map annotCache = getPropertyMapCache ( ) ; if ( annotCache . containsKey ( annotElem ) ) return ( PropertyMap ) annotCache . get ( annotElem ) ; 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 . |
9,252 | protected void firePropertyChange ( PropertyKey propertyKey , Object oldValue , Object newValue ) { 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 . |
9,253 | protected void fireVetoableChange ( PropertyKey propertyKey , Object oldValue , Object newValue ) throws java . beans . PropertyVetoException { 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 . |
9,254 | private synchronized void writeObject ( ObjectOutputStream oos ) throws IOException { if ( _control != null ) { 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 |
9,255 | 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 ) { } finally { if ( i == null ) i = new NullInterceptor ( ) ; _interceptors . put ( n , i ) ; } } return i ; } | Retrieves interceptor instances creates them lazily . |
9,256 | protected ArrayList < AptProperty > initProperties ( ) { ArrayList < AptProperty > properties = new ArrayList < AptProperty > ( ) ; if ( _propertySet == null || _propertySet . getMethods ( ) == null ) return properties ; 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 |
9,257 | public String getPackage ( ) { if ( _propertySet == null || _propertySet . getPackage ( ) == null ) return "" ; return _propertySet . getPackage ( ) . getQualifiedName ( ) ; } | Returns the fully qualified package name of this property set |
9,258 | 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 |
9,259 | public static final Object convertToObject ( String value , Class type ) { return convertToObject ( value , type , null ) ; } | Convert an object from a String to the given type . |
9,260 | public RemoveInfo addElement ( TreeElement elem ) { ArrayList attrs = elem . getAttributeList ( ) ; if ( attrs == null || attrs . size ( ) == 0 ) return emptyRemoves ; RemoveInfo removes = _removes ; if ( removes == null ) removes = new RemoveInfo ( ) ; 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 ( 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 . |
9,261 | public void removeElementScoped ( TreeElement elem , RemoveInfo removes ) { assert ( elem != null ) ; ArrayList attrs = elem . getAttributeList ( ) ; if ( attrs == null || attrs . size ( ) == 0 ) return ; 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 ) ; 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 . |
9,262 | 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 . |
9,263 | 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 . |
9,264 | 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 . |
9,265 | 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 ( ' ' ) ; 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 |
9,266 | 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 ( ", " ) ; 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 |
9,267 | 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 "" ; sb . append ( _ap . getAnnotationProcessorEnvironment ( ) . getTypeUtils ( ) . getErasure ( paramType ) ) ; sb . append ( ".class" ) ; } return sb . toString ( ) ; } | Returns the the method argument classes in a comma separated list |
9,268 | 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 |
9,269 | 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 |
9,270 | 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 . |
9,271 | 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 |
9,272 | 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 ; } | Returns an ArrayList of thrown exceptions |
9,273 | 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 |
9,274 | protected boolean isPublic ( ) { Collection < Modifier > modifiers = _methodDecl . getModifiers ( ) ; return modifiers . contains ( Modifier . PUBLIC ) ; } | Is this a public method? |
9,275 | 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 . |
9,276 | 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 . |
9,277 | public void setTagId ( String tagId ) { ExtendedInfo info = getInfo ( tagId ) ; if ( info != null ) info . _tagId = tagId ; } | Set the ID of the tag . |
9,278 | 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 . |
9,279 | public void addChild ( TreeElement child ) throws IllegalArgumentException { TreeElement theChild = child ; theChild . setParent ( this ) ; if ( getName ( ) == null ) { setName ( "0" ) ; } if ( _children == null ) { _children = new ArrayList ( ) ; } _children . add ( child ) ; int n = _children . size ( ) ; theChild . updateName ( this , n - 1 ) ; } | Add a new child node to the end of the list . |
9,280 | 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 ) ; 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 . |
9,281 | 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 . |
9,282 | 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 . |
9,283 | 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 . |
9,284 | 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 . |
9,285 | public TreeElement findNode ( String nodeName ) { TreeElement root = getRoot ( this ) ; return root . findNodeRecurse ( nodeName , nodeName ) ; } | Given a node find the named child . |
9,286 | 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 . |
9,287 | 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 . |
9,288 | public void reinitialize ( HttpServletRequest request , HttpServletResponse response , ServletContext servletContext ) { super . reinitialize ( request , response , servletContext ) ; } | Reinitialize the object for a new request . Used by the framework ; normally should not be called directly . |
9,289 | 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 ( ) ; 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 . |
9,290 | public ActionForward execute ( ActionMapping mapping , ActionForm form , HttpServletRequest request , HttpServletResponse response ) throws Exception { if ( incrementRequestCount ( request , response , getServletContext ( ) ) ) { try { synchronized ( this ) { ActionForward ret = null ; 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 { ret = internalExecute ( mapping , form , request , response ) ; } finally { try { pfcc . endContextOnPageFlow ( this ) ; } catch ( Exception e ) { 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 ; } } | Perform decision logic to determine the next URI to be displayed . |
9,291 | void destroy ( HttpSession session ) { onDestroy ( ) ; super . destroy ( session ) ; 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 . |
9,292 | ActionForward getActionMethodForward ( String actionName , Object inputForm , HttpServletRequest request , HttpServletResponse response , ActionMapping mapping ) throws Exception { Class formClass = getFormClass ( inputForm , mapping , request ) ; Method actionMethod = getActionMethod ( actionName , formClass ) ; 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 . |
9,293 | 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 . |
9,294 | 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 ) ) ; } return ( String [ ] ) actionNames . toArray ( new String [ 0 ] ) ; } | Get a list of the names of actions handled by methods in this PageFlowController . |
9,295 | 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 |
9,296 | protected DataSource getDataSource ( HttpServletRequest request , String key ) { return ( DataSource ) getServletContext ( ) . getAttribute ( key + getModuleConfig ( ) . getPrefix ( ) ) ; } | Return the specified data source for the current Struts module . |
9,297 | 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 . |
9,298 | protected MessageResources getMessageResources ( String key ) { return ( MessageResources ) getServletContext ( ) . getAttribute ( key + getModuleConfig ( ) . getPrefix ( ) ) ; } | Get the specified message resources for this FlowController . |
9,299 | 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 ) { 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 . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.