idx
int64
0
41.2k
question
stringlengths
74
4.21k
target
stringlengths
5
888
9,700
public void setOnMouseOut ( String onMouseOut ) { _tbodyTag . registerAttribute ( AbstractHtmlState . ATTR_JAVASCRIPT , HtmlConstants . ONMOUSEOUT , onMouseOut ) ; }
Sets the onMouseOut JavaScript event for the HTML tbody tag .
9,701
public void setOnMouseOver ( String onMouseOver ) { _tbodyTag . registerAttribute ( AbstractHtmlState . ATTR_JAVASCRIPT , HtmlConstants . ONMOUSEOVER , onMouseOver ) ; }
Sets the onMouseOver JavaScript event for the HTML tbody tag .
9,702
public void setAlign ( String align ) { _tbodyTag . registerAttribute ( AbstractHtmlState . ATTR_GENERAL , HtmlConstants . ALIGN , align ) ; }
Sets the value of the horizontal alignment attribute of the HTML tbody tag .
9,703
public void setCharoff ( String alignCharOff ) { _tbodyTag . registerAttribute ( AbstractHtmlState . ATTR_GENERAL , HtmlConstants . CHAROFF , alignCharOff ) ; }
Sets the value of the horizontal alignment character offset attribute .
9,704
public void setValign ( String align ) { _tbodyTag . registerAttribute ( AbstractHtmlState . ATTR_GENERAL , HtmlConstants . VALIGN , align ) ; }
Sets the value of the vertical alignment attribute of the HTML tbody tag .
9,705
public static boolean isInteger ( String number ) { boolean result = false ; try { Integer . parseInt ( number ) ; result = true ; } catch ( NumberFormatException e ) { } return result ; }
Checks if a string is a valid integer
9,706
public static boolean isLong ( String number ) { boolean result = false ; try { Long . parseLong ( number ) ; result = true ; } catch ( NumberFormatException e ) { } return result ; }
Checks if a string is a valid long
9,707
public static boolean isDouble ( String number ) { boolean result = false ; if ( number != null ) { try { Double . parseDouble ( number ) ; result = true ; } catch ( NumberFormatException e ) { } } return result ; }
Checks if a string is a valid Double
9,708
public static boolean isBoolean ( String number ) { boolean result = false ; if ( number != null && ( number . equalsIgnoreCase ( "true" ) || number . equalsIgnoreCase ( "false" ) ) ) { result = true ; } return result ; }
Checks if a string is a valid boolean
9,709
public static boolean isValidDouble ( String number ) { boolean valid = false ; if ( isDouble ( number ) && isPositive ( Double . parseDouble ( number ) ) ) { valid = true ; } return valid ; }
Checks if a string is a valid double .
9,710
public static ScopedRequest getScopedRequest ( HttpServletRequest realRequest , String overrideURI , ServletContext servletContext , Object scopeKey , boolean seeOuterRequestAttributes ) { assert ! ( realRequest instanceof ScopedRequest ) ; String requestAttr = getScopedName ( OVERRIDE_REQUEST_ATTR , scopeKey ) ; ScopedRequest scopedRequest = ( ScopedRequest ) realRequest . getAttribute ( requestAttr ) ; if ( scopedRequest == null ) { if ( overrideURI != null && ! overrideURI . startsWith ( "/" ) ) overrideURI = '/' + overrideURI ; scopedRequest = new ScopedRequestImpl ( realRequest , overrideURI , scopeKey , servletContext , seeOuterRequestAttributes ) ; realRequest . setAttribute ( requestAttr , scopedRequest ) ; } return scopedRequest ; }
Get the cached ScopedRequest wrapper . If none exists creates one and caches it .
9,711
public static ScopedResponse getScopedResponse ( HttpServletResponse realResponse , ScopedRequest scopedRequest ) { assert ! ( realResponse instanceof ScopedResponse ) ; String responseAttr = getScopedName ( OVERRIDE_RESPONSE_ATTR , scopedRequest . getScopeKey ( ) ) ; HttpServletRequest outerRequest = scopedRequest . getOuterRequest ( ) ; ScopedResponse scopedResponse = ( ScopedResponse ) outerRequest . getAttribute ( responseAttr ) ; if ( scopedResponse == null ) { scopedResponse = new ScopedResponseImpl ( realResponse ) ; outerRequest . setAttribute ( responseAttr , scopedResponse ) ; } return scopedResponse ; }
Get the cached wrapper servlet response . If none exists creates one and caches it .
9,712
public static ScopedRequest unwrapRequest ( ServletRequest request ) { if ( request instanceof MultipartRequestWrapper ) { request = ( ( MultipartRequestWrapper ) request ) . getRequest ( ) ; } while ( request instanceof ServletRequestWrapper ) { if ( request instanceof ScopedRequest ) { return ( ScopedRequest ) request ; } else { request = ( ( ServletRequestWrapper ) request ) . getRequest ( ) ; } } return null ; }
Unwraps the contained ScopedRequest from the given ServletRequest which may be a ServletRequestWrapper .
9,713
public static ScopedResponse unwrapResponse ( ServletResponse response ) { while ( response instanceof ServletResponseWrapper ) { if ( response instanceof ScopedResponse ) { return ( ScopedResponse ) response ; } else { response = ( ( ServletResponseWrapper ) response ) . getResponse ( ) ; } } return null ; }
Unwraps the contained ScopedResponseImpl from the given ServletResponse which may be a ServletResponseWrapper .
9,714
public static String getScopedSessionAttrName ( String attrName , HttpServletRequest request ) { String requestScopeParam = request . getParameter ( SCOPE_ID_PARAM ) ; if ( requestScopeParam != null ) { return getScopedName ( attrName , requestScopeParam ) ; } ScopedRequest scopedRequest = unwrapRequest ( request ) ; return scopedRequest != null ? scopedRequest . getScopedName ( attrName ) : attrName ; }
If the request is a ScopedRequest this returns an attribute name scoped to that request s scope - ID ; otherwise it returns the given attribute name .
9,715
public static final String getRelativeURI ( HttpServletRequest request , String uri ) { return getRelativeURI ( request . getContextPath ( ) , uri ) ; }
Get a URI relative to the webapp root .
9,716
public static final String getRelativeURI ( String contextPath , String uri ) { String requestUrl = uri ; int overlap = requestUrl . indexOf ( contextPath + '/' ) ; assert overlap != - 1 : "contextPath: " + contextPath + ", uri: " + uri ; return requestUrl . substring ( overlap + contextPath . length ( ) ) ; }
Get a URI relative to a given webapp root .
9,717
public static String normalizeURI ( String uri ) { if ( uri . indexOf ( "./" ) != - 1 ) { try { uri = new URI ( uri ) . normalize ( ) . toString ( ) ; } catch ( URISyntaxException e ) { logger . error ( "Could not parse relative URI " + uri ) ; } } return uri ; }
Resolve . and .. in a URI .
9,718
public void updateProperties ( Collection newProps ) { _properties = new ArrayList ( ) ; if ( newProps != null ) { _properties . addAll ( newProps ) ; } }
Sets the collection of properties for a form bean to a new collection .
9,719
protected final Element findChildElement ( XmlModelWriter xw , Element parent , String childName , String keyAttributeName , String keyAttributeValue , boolean createIfNotPresent , String [ ] createOrder ) { NodeList childNodes = parent . getChildNodes ( ) ; for ( int i = 0 ; i < childNodes . getLength ( ) ; ++ i ) { Node node = childNodes . item ( i ) ; if ( node instanceof Element ) { Element childElement = ( Element ) node ; if ( childName . equals ( childElement . getTagName ( ) ) ) { if ( keyAttributeName == null ) { return childElement ; } String childElementAttributeValue = getElementAttribute ( childElement , keyAttributeName ) ; if ( ( keyAttributeValue == null && childElementAttributeValue == null ) || ( keyAttributeValue != null && keyAttributeValue . equals ( childElementAttributeValue ) ) ) { return childElement ; } } } } if ( createIfNotPresent ) { Element newChild = xw . getDocument ( ) . createElement ( childName ) ; Node insertBefore = null ; if ( createOrder != null ) { for ( int i = 0 ; i < createOrder . length ; i ++ ) { String nodeName = createOrder [ i ] ; if ( nodeName . equals ( childName ) ) { while ( ++ i < createOrder . length ) { insertBefore = findChildElement ( xw , parent , createOrder [ i ] , false , null ) ; if ( insertBefore != null ) { break ; } } break ; } } } if ( insertBefore != null ) { parent . insertBefore ( newChild , insertBefore ) ; } else { parent . appendChild ( newChild ) ; } if ( keyAttributeName != null && keyAttributeValue != null ) { newChild . setAttribute ( keyAttributeName , keyAttributeValue ) ; } return newChild ; } return null ; }
Find a child element by name and optionally add it if it isn t present .
9,720
public String getModulePath ( ) { ClassLevelCache cache = ClassLevelCache . getCache ( getClass ( ) ) ; String modulePath = ( String ) cache . getCacheObject ( CACHED_INFO_KEY ) ; if ( modulePath == null ) { modulePath = "/-" ; String className = getClass ( ) . getName ( ) ; int lastDot = className . lastIndexOf ( '.' ) ; if ( lastDot != - 1 ) { className = className . substring ( 0 , lastDot ) ; modulePath += className . replace ( '.' , '/' ) ; } cache . setCacheObject ( CACHED_INFO_KEY , modulePath ) ; } return modulePath ; }
Get the Struts module path for actions in this shared flow .
9,721
void savePreviousActionInfo ( ActionForm form , HttpServletRequest request , ActionMapping mapping , ServletContext servletContext ) { PageFlowController currentJpf = PageFlowUtils . getCurrentPageFlow ( request , getServletContext ( ) ) ; if ( currentJpf != null ) currentJpf . savePreviousActionInfo ( form , request , mapping , servletContext ) ; }
Store information about the most recent action invocation . This is a framework - invoked method that should not normally be called directly
9,722
void reinitializeIfNecessary ( HttpServletRequest request , HttpServletResponse response , ServletContext servletContext ) { if ( _servletContext == null ) { reinitialize ( request , response , servletContext ) ; } }
Internal method to reinitialize only if necessary . The test is whether the ServletContext reference has been lost .
9,723
protected boolean fieldIsUninitialized ( Field field ) { try { return field != null && field . get ( this ) == null ; } catch ( IllegalAccessException e ) { _log . error ( "Error initializing field " + field . getName ( ) + " in " + getDisplayName ( ) , e ) ; return false ; } }
Tell whether the given Field is uninitialized .
9,724
protected void initializeField ( Field field , Object instance ) { if ( instance != null ) { if ( _log . isTraceEnabled ( ) ) { _log . trace ( "Initializing field " + field . getName ( ) + " in " + getDisplayName ( ) + " with " + instance ) ; } try { field . set ( this , instance ) ; } catch ( IllegalArgumentException e ) { _log . error ( "Could not set field " + field . getName ( ) + " on " + getDisplayName ( ) + "; instance is of type " + instance . getClass ( ) . getName ( ) + ", field type is " + field . getType ( ) . getName ( ) ) ; } catch ( IllegalAccessException e ) { _log . error ( "Error initializing field " + field . getName ( ) + " in " + getDisplayName ( ) , e ) ; } } }
Initialize the given field with an instance . Mainly useful for the error handling .
9,725
public Object mapToResultType ( ControlBeanContext context , Method m , ResultSet resultSet , Calendar cal ) { return resultSet ; }
Maps a ResultSet to a ResultSet . The default implementation is a NOOP .
9,726
public String extractModel ( XLog log ) { XAttribute attribute = log . getAttributes ( ) . get ( KEY_MODEL ) ; if ( attribute == null ) { return null ; } else { return ( ( XAttributeLiteral ) attribute ) . getValue ( ) ; } }
Extracts the lifecycle model identifier from a given log .
9,727
public void assignModel ( XLog log , String model ) { if ( model != null && model . trim ( ) . length ( ) > 0 ) { XAttributeLiteral modelAttr = ( XAttributeLiteral ) ATTR_MODEL . clone ( ) ; modelAttr . setValue ( model . trim ( ) ) ; log . getAttributes ( ) . put ( KEY_MODEL , modelAttr ) ; } }
Assigns a value for the lifecycle model identifier to a given log .
9,728
public boolean usesStandardModel ( XLog log ) { String model = extractModel ( log ) ; if ( model == null ) { return false ; } else if ( model . trim ( ) . equals ( VALUE_MODEL_STANDARD ) ) { return true ; } else { return false ; } }
Checks whether a given log uses the standard model for lifecycle transitions .
9,729
public String extractTransition ( XEvent event ) { XAttribute attribute = event . getAttributes ( ) . get ( KEY_TRANSITION ) ; if ( attribute == null ) { return null ; } else { return ( ( XAttributeLiteral ) attribute ) . getValue ( ) ; } }
Extracts the lifecycle transition string from a given event .
9,730
public StandardModel extractStandardTransition ( XEvent event ) { String transition = extractTransition ( event ) ; if ( transition != null ) { return StandardModel . decode ( transition ) ; } else { return null ; } }
Extracts the standard lifecycle transition object from a given event .
9,731
public void assignTransition ( XEvent event , String transition ) { if ( transition != null && transition . trim ( ) . length ( ) > 0 ) { XAttributeLiteral transAttr = ( XAttributeLiteral ) ATTR_TRANSITION . clone ( ) ; transAttr . setValue ( transition . trim ( ) ) ; event . getAttributes ( ) . put ( KEY_TRANSITION , transAttr ) ; } }
Assigns a lifecycle transition string to the given event .
9,732
protected int getNextId ( ServletRequest req ) { Integer i = ( Integer ) RequestUtils . getOuterAttribute ( ( HttpServletRequest ) req , NETUI_UNIQUE_CNT ) ; if ( i == null ) { i = new Integer ( 0 ) ; } int ret = i . intValue ( ) ; RequestUtils . setOuterAttribute ( ( HttpServletRequest ) req , NETUI_UNIQUE_CNT , new Integer ( ret + 1 ) ) ; return ret ; }
This method will generate the next unique int within the HTML tag .
9,733
protected Form getNearestForm ( ) { Tag parentTag = getParent ( ) ; while ( parentTag != null ) { if ( parentTag instanceof Form ) return ( Form ) parentTag ; parentTag = parentTag . getParent ( ) ; } return null ; }
Returns the closest parent form tag or null if there is none .
9,734
public synchronized void setProperty ( PropertyKey key , Object value ) { if ( ! isValidKey ( key ) ) throw new IllegalArgumentException ( "Key " + key + " is not valid for " + getMapClass ( ) ) ; Class propType = key . getPropertyType ( ) ; if ( value == null ) { if ( propType . isPrimitive ( ) || propType . isAnnotation ( ) ) throw new IllegalArgumentException ( "Invalid null value for key " + key ) ; } else { if ( propType . isPrimitive ( ) ) propType = ( Class ) _primToObject . get ( propType ) ; if ( ! propType . isAssignableFrom ( value . getClass ( ) ) ) { throw new IllegalArgumentException ( "Value class (" + value . getClass ( ) + ") not of expected type: " + propType ) ; } } _properties . put ( key , value ) ; _propertySets . add ( key . getPropertySet ( ) ) ; }
Sets the property specifed by key within this map .
9,735
public static NameService instance ( HttpSession session ) { if ( session == null ) throw new IllegalArgumentException ( "Session must not be null" ) ; Object sessionMutex = ServletUtils . getSessionMutex ( session , NAME_SERVICE_MUTEX_ATTRIBUTE ) ; synchronized ( sessionMutex ) { NameService nameService = ( NameService ) session . getAttribute ( NAME_SERVICE ) ; if ( nameService == null ) { nameService = new NameService ( ) ; session . setAttribute ( NAME_SERVICE , nameService ) ; } return nameService ; } }
This will return the session specific instance of a NameService . There will only be a single NameService per session .
9,736
private synchronized void readObject ( ObjectInputStream in ) throws IOException , ClassNotFoundException { in . defaultReadObject ( ) ; if ( _nameMap == null ) { _nameMap = new HashMap ( ) ; } }
Deserialize an instance of this class .
9,737
public synchronized void nameObject ( String namePrefix , INameable object ) { String name = namePrefix + Integer . toString ( _nextValue ++ ) ; object . setObjectName ( name ) ; }
This method will create a unique name for an INameable object . The name will be unque within the session . This will throw an IllegalStateException if INameable . setObjectName has previously been called on object .
9,738
private void reclaimSpace ( ) { if ( _nameMap == null ) return ; if ( _nameMap . size ( ) > 0 && _nameMap . size ( ) % _reclaimPoint == 0 ) { synchronized ( _nameMap ) { Set s = _nameMap . entrySet ( ) ; Iterator it = s . iterator ( ) ; while ( it . hasNext ( ) ) { Map . Entry e = ( Map . Entry ) it . next ( ) ; TrackingObject to = ( TrackingObject ) e . getValue ( ) ; WeakReference wr = to . getWeakINameable ( ) ; INameable o = ( INameable ) wr . get ( ) ; if ( o == null ) { it . remove ( ) ; } } _reclaimPoint = _nameMap . size ( ) + _reclaimIncrement ; } } }
This mehtod will check the name map for entries where the WeakReference object has been reclaimed . When they are found it will reclaim the entry in the map .
9,739
private void fireNamingObjectEvent ( TrackingObject to ) { Object [ ] copy ; if ( _listeners == null ) return ; synchronized ( _listeners ) { copy = _listeners . toArray ( ) ; } INameable o = ( INameable ) to . getWeakINameable ( ) . get ( ) ; for ( int i = 0 ; i < copy . length ; i ++ ) { ( ( NamingObjectListener ) copy [ i ] ) . namingObject ( o , to ) ; } }
This method will fire the NamingObject event . This event is triggered when we have added an element to be tracked .
9,740
private static synchronized File getSwapDir ( ) throws IOException { if ( SWAP_DIR == null ) { File swapDir = File . createTempFile ( SWAP_DIR_PREFIX , SWAP_DIR_SUFFIX , TMP_DIR ) ; swapDir . delete ( ) ; File lockFile = new File ( TMP_DIR , swapDir . getName ( ) + LOCK_FILE_SUFFIX ) ; lockFile . createNewFile ( ) ; lockFile . deleteOnExit ( ) ; swapDir . mkdirs ( ) ; swapDir . deleteOnExit ( ) ; SWAP_DIR = swapDir ; } return SWAP_DIR ; }
Retrieves a file handle on the swap directory of this session .
9,741
private static synchronized void cleanup ( ) { int cleanedDirs = 0 ; int cleanedFiles = 0 ; File [ ] swapDirs = TMP_DIR . listFiles ( new FileFilter ( ) { public boolean accept ( File pathname ) { return pathname . getName ( ) . endsWith ( SWAP_DIR_SUFFIX ) ; } } ) ; for ( File swapDir : swapDirs ) { File lockFile = new File ( TMP_DIR , swapDir . getName ( ) + LOCK_FILE_SUFFIX ) ; if ( lockFile . exists ( ) == false ) { cleanedDirs ++ ; cleanedFiles += deleteRecursively ( swapDir ) ; } } System . out . println ( "NikeFS2: cleaned up " + cleanedFiles + " stale swap files (from " + cleanedDirs + " sessions)." ) ; }
Cleans up stale swap files and directories left over from previous sessions . Only swap directories for which no lock file exists will be removed .
9,742
private static synchronized int deleteRecursively ( File directory ) { int deleted = 0 ; if ( directory . isDirectory ( ) ) { File [ ] contents = directory . listFiles ( ) ; for ( File file : contents ) { deleted += deleteRecursively ( file ) ; } } else { deleted ++ ; } directory . delete ( ) ; return deleted ; }
Deletes the given directory recursively i . e . bottom - up .
9,743
public Locale getLocale ( ) throws JspException { Locale loc = null ; if ( _language != null || _country != null ) { if ( _language == null ) { String s = Bundle . getString ( "Tags_LocaleRequiresLanguage" , new Object [ ] { _country } ) ; registerTagError ( s , null ) ; return super . getUserLocale ( ) ; } if ( _country == null ) loc = new Locale ( _language ) ; else loc = new Locale ( _language , _country ) ; } else loc = super . getUserLocale ( ) ; return loc ; }
Returns the locale based on the country and language .
9,744
public synchronized boolean replace ( XEvent event , int index ) throws IOException { if ( index < 0 || index >= size ) { throw new IndexOutOfBoundsException ( ) ; } navigateToIndex ( index ) ; storage . seek ( position ) ; long atePosition = position ; int fwd = storage . readInt ( ) ; storage . skipBytes ( 8 ) ; int segmentSize = fwd - 12 ; byte [ ] evtEnc = encode ( event ) ; boolean success = false ; if ( evtEnc . length <= segmentSize ) { storage . seek ( atePosition + 8 ) ; storage . writeInt ( evtEnc . length ) ; byte segmentPadding [ ] = new byte [ segmentSize - evtEnc . length ] ; Arrays . fill ( segmentPadding , ( byte ) 0 ) ; storage . write ( evtEnc ) ; storage . write ( segmentPadding ) ; success = true ; } else { success = false ; } this . position = atePosition ; storage . seek ( this . position ) ; return success ; }
Replaces an event at the given position .
9,745
public synchronized XEvent get ( int eventIndex ) throws IOException , IndexOutOfBoundsException { if ( eventIndex < 0 || eventIndex >= size ) { throw new IndexOutOfBoundsException ( ) ; } navigateToIndex ( eventIndex ) ; return read ( ) ; }
Retrieves the event recorded at the specified position
9,746
protected synchronized void navigateToIndex ( int reqIndex ) throws IOException { if ( reqIndex != index ) { if ( reqIndex < 0 || reqIndex >= size ) { throw new IndexOutOfBoundsException ( ) ; } if ( reqIndex > index ) { skipForward ( reqIndex - index ) ; } else { int backSkips = index - reqIndex ; if ( backSkips < ( index / 2 ) ) { if ( index == size ) { index = ( size - 1 ) ; position = lastInsertPosition ; backSkips = index - reqIndex ; } skipBackward ( backSkips ) ; } else { resetPosition ( ) ; skipForward ( reqIndex ) ; } } } if ( reqIndex != index ) { throw new IOException ( "Navigation fault! (required: " + reqIndex + ", yielded: " + index + ")" ) ; } }
Repositions the low - level layer to read from the specified index .
9,747
protected synchronized void skipForward ( int eventsToSkip ) throws IOException { int offset = 0 ; for ( int i = 0 ; i < eventsToSkip ; i ++ ) { storage . seek ( position ) ; offset = storage . readInt ( ) ; position += offset ; index ++ ; } }
Repositions the position of the data access layer to skip the specified number of records towards the end of the file .
9,748
protected synchronized XEvent read ( ) throws IOException { storage . seek ( position ) ; long nextPosition = position + storage . readInt ( ) ; storage . skipBytes ( 4 ) ; int eventSize = storage . readInt ( ) ; byte [ ] eventData = new byte [ eventSize ] ; storage . readFully ( eventData ) ; DataInputStream dis = new DataInputStream ( new ByteArrayInputStream ( eventData ) ) ; XID id = XID . read ( dis ) ; XAttributeMap attributes = this . attributeMapSerializer . deserialize ( dis ) ; XEvent event = factory . createEvent ( id , attributes ) ; position = nextPosition ; index ++ ; return event ; }
Reads an event from the current position of the data access layer . Calling this method implies the advancement of the data access layer so that the next call will yield the subsequent event .
9,749
public int doEndTag ( ) throws JspException { HttpServletRequest req = ( HttpServletRequest ) pageContext . getRequest ( ) ; if ( ! InternalUtils . isMultipartHandlingEnabled ( req ) ) { String s = Bundle . getString ( "Tags_FileMultiOff" , null ) ; registerTagError ( s , null ) ; return EVAL_PAGE ; } ByRef ref = new ByRef ( ) ; nameHtmlControl ( _state , ref ) ; if ( hasErrors ( ) ) return reportAndExit ( EVAL_PAGE ) ; WriteRenderAppender writer = new WriteRenderAppender ( pageContext ) ; TagRenderingBase br = TagRenderingBase . Factory . getRendering ( TagRenderingBase . INPUT_FILE_TAG , req ) ; br . doStartTag ( writer , _state ) ; if ( ! ref . isNull ( ) ) write ( ( String ) ref . getRef ( ) ) ; localRelease ( ) ; return EVAL_PAGE ; }
Render the FileUpload .
9,750
protected String buildLiveFirstLink ( ) { InternalStringBuilder builder = new InternalStringBuilder ( ) ; AbstractRenderAppender appender = new StringBuilderRenderAppender ( builder ) ; buildAnchor ( appender , _gridModel . getUrlBuilder ( ) . getQueryParamsForFirstPage ( ) , IDataGridMessageKeys . PAGER_MSG_FIRST ) ; return builder . toString ( ) ; }
Build an HTML anchor that contains URL state for navigating to the first page of a data set .
9,751
protected String buildLiveLastLink ( ) { InternalStringBuilder builder = new InternalStringBuilder ( ) ; AbstractRenderAppender appender = new StringBuilderRenderAppender ( builder ) ; buildAnchor ( appender , _gridModel . getUrlBuilder ( ) . getQueryParamsForLastPage ( ) , IDataGridMessageKeys . PAGER_MSG_LAST ) ; return builder . toString ( ) ; }
Build an HTML anchor that contains URL state for navigating to the last page of a data set .
9,752
protected final void buildAnchor ( AbstractRenderAppender appender , Map queryParams , String labelKey ) { assert appender != null ; assert queryParams != null ; assert labelKey != null && labelKey . length ( ) > 0 ; _anchorState . href = buildPageUri ( queryParams ) ; _anchorTag . doStartTag ( appender , _anchorState ) ; appender . append ( _gridModel . getMessage ( labelKey ) ) ; _anchorTag . doEndTag ( appender ) ; _anchorState . clear ( ) ; }
Build the anchor
9,753
private static void initPrefixHandlers ( ) { PrefixHandlerConfig [ ] prefixHandlers = ConfigUtil . getConfig ( ) . getPrefixHandlers ( ) ; if ( prefixHandlers == null ) { return ; } for ( int i = 0 ; i < prefixHandlers . length ; i ++ ) { try { Class prefixClass = Class . forName ( prefixHandlers [ i ] . getHandlerClass ( ) ) ; String name = prefixHandlers [ i ] . getName ( ) ; if ( name == null || name . equals ( "" ) ) { _log . warn ( "The name for the prefix handler '" + prefixHandlers [ i ] . getHandlerClass ( ) + "' must not be null" ) ; continue ; } Object o = prefixClass . newInstance ( ) ; if ( ! ( o instanceof RequestParameterHandler ) ) { _log . warn ( "The class '" + prefixHandlers [ i ] . getHandlerClass ( ) + "' must be an instance of RequestParameterHandler" ) ; continue ; } ProcessPopulate . registerPrefixHandler ( name , ( RequestParameterHandler ) o ) ; } catch ( ClassNotFoundException e ) { _log . warn ( "Class '" + prefixHandlers [ i ] . getHandlerClass ( ) + "' not found" , e ) ; } catch ( IllegalAccessException e ) { _log . warn ( "Illegal access on Class '" + prefixHandlers [ i ] . getHandlerClass ( ) + "'" , e ) ; } catch ( InstantiationException e ) { _log . warn ( "InstantiationException on Class '" + prefixHandlers [ i ] . getHandlerClass ( ) + "'" , e . getCause ( ) ) ; } } }
This method will initialize all of the PrefixHandlers registered in the netui config . The prefix handlers are registered with ProcessPopulate and are typically implemented as public inner classes in the tags that require prefix handlers .
9,754
protected Object evaluateDefaultValue ( ) throws JspException { Object val = _defaultValue ; List defaults = null ; if ( val instanceof String ) { defaults = new ArrayList ( ) ; defaults . add ( val ) ; } else { Iterator optionsIterator = null ; optionsIterator = IteratorFactory . createIterator ( val ) ; if ( optionsIterator == null && _defaultValue != null ) logger . warn ( Bundle . getString ( "Tags_IteratorError" , new Object [ ] { getTagName ( ) , "defaultValue" , _defaultValue } ) ) ; if ( optionsIterator == null ) optionsIterator = IteratorFactory . EMPTY_ITERATOR ; defaults = new ArrayList ( ) ; while ( optionsIterator . hasNext ( ) ) { Object o = optionsIterator . next ( ) ; defaults . add ( o . toString ( ) ) ; } } return defaults ; }
Evaluate the defaultValues
9,755
public int doStartTag ( ) throws JspException { Object val = evaluateDataSource ( ) ; _defaultSelections = ( List ) evaluateDefaultValue ( ) ; if ( hasErrors ( ) ) return SKIP_BODY ; buildMatch ( val ) ; if ( hasErrors ( ) ) return SKIP_BODY ; _formatters = new ArrayList ( ) ; _optionList = new ArrayList ( ) ; _dynamicOptions = evaluateOptionsDataSource ( ) ; if ( _repeater ) { _repCurStage = _order [ 0 ] ; boolean valid = doRepeaterAfterBody ( ) ; if ( ! valid ) return SKIP_BODY ; DataAccessProviderStack . addDataAccessProvider ( this , pageContext ) ; } return EVAL_BODY_BUFFERED ; }
Render the beginning of this select .
9,756
private void buildMatch ( Object val ) { if ( val != null ) { if ( val instanceof String ) { _match = new String [ ] { ( String ) val } ; } else if ( val instanceof String [ ] ) { String [ ] s = ( String [ ] ) val ; int cnt = 0 ; for ( int i = 0 ; i < s . length ; i ++ ) { if ( s [ i ] != null ) cnt ++ ; } if ( cnt == s . length ) _match = s ; else { if ( cnt > 0 ) { _match = new String [ cnt ] ; cnt = 0 ; for ( int i = 0 ; i < s . length ; i ++ ) { if ( s [ i ] != null ) { _match [ cnt ++ ] = s [ i ] ; } } } } } else { Iterator matchIterator = null ; matchIterator = IteratorFactory . createIterator ( val ) ; if ( matchIterator == null ) { matchIterator = IteratorFactory . EMPTY_ITERATOR ; } ArrayList matchList = new ArrayList ( ) ; while ( matchIterator . hasNext ( ) ) { Object o = matchIterator . next ( ) ; if ( o == null ) continue ; matchList . add ( o ) ; } int size = matchList . size ( ) ; _match = new String [ size ] ; for ( int i = 0 ; i < size ; i ++ ) { assert ( matchList . get ( i ) != null ) ; assert ( matchList . get ( i ) . toString ( ) != null ) ; _match [ i ] = matchList . get ( i ) . toString ( ) ; } } if ( logger . isDebugEnabled ( ) ) { logger . debug ( "****** Select Matches ******" ) ; if ( _match != null ) { for ( int i = 0 ; i < _match . length ; i ++ ) { logger . debug ( i + ": " + _match [ i ] ) ; } } } } else { if ( _nullable && ! isMultiple ( ) && ( _defaultSelections == null || _defaultSelections . size ( ) == 0 ) ) { _match = new String [ ] { NULL_VALUE } ; } } }
This method builds the list of selected items so that they can be marked as selected .
9,757
private void addDefaultsIfNeeded ( ServletRequest req ) throws JspException { if ( _defaultSelections != null ) { Iterator iterator = _defaultSelections . iterator ( ) ; while ( iterator . hasNext ( ) ) { Object selection = iterator . next ( ) ; if ( ! _optionList . contains ( selection ) ) { addOption ( req , selection . toString ( ) , selection . toString ( ) ) ; } } } }
add the default values specified in the tag if they are needed .
9,758
private void addDatasourceIfNeeded ( ServletRequest req ) throws JspException { if ( _match == null ) return ; for ( int i = 0 ; i < _match . length ; i ++ ) { if ( ! _optionList . contains ( _match [ i ] ) ) { if ( ! _match [ i ] . equals ( NULL_VALUE ) ) addOption ( req , _match [ i ] , _match [ i ] ) ; } } }
add dthe datasource values if needed .
9,759
public void register ( XEvent event ) { Date date = XTimeExtension . instance ( ) . extractTimestamp ( event ) ; if ( date != null ) { register ( date ) ; } }
Registers the given event i . e . if it has a timestamp the timestamp boundaries will be potentially adjusted to accomodate for inclusion of this event .
9,760
public void register ( Date date ) { if ( date != null ) { if ( first == null ) { first = date ; last = date ; } else if ( date . before ( first ) ) { first = date ; } else if ( date . after ( last ) ) { last = date ; } } }
Registers the given date . The timestamp boundaries will be potentially adjusted to accomodate for inclusion of this date .
9,761
public int doEndTag ( ) throws JspException { ServletRequest req = pageContext . getRequest ( ) ; if ( _password ) { _state . type = INPUT_PASSWORD ; } else { _state . type = INPUT_TEXT ; } ByRef ref = new ByRef ( ) ; nameHtmlControl ( _state , ref ) ; _state . disabled = isDisabled ( ) ; Object textObject = evaluateDataSource ( ) ; if ( ( textObject == null ) || ( textObject . toString ( ) . length ( ) == 0 ) ) { textObject = _defaultValue ; } String text = null ; if ( textObject != null ) { text = formatText ( textObject ) ; InternalStringBuilder sb = new InternalStringBuilder ( text . length ( ) + 16 ) ; StringBuilderRenderAppender sbAppend = new StringBuilderRenderAppender ( sb ) ; HtmlUtils . filter ( text , sbAppend ) ; text = sb . toString ( ) ; } _state . value = text ; if ( _formatErrors ) { if ( bodyContent != null ) { String value = bodyContent . getString ( ) . trim ( ) ; bodyContent . clearBody ( ) ; write ( value ) ; } } if ( hasErrors ( ) ) return reportAndExit ( EVAL_PAGE ) ; WriteRenderAppender writer = new WriteRenderAppender ( pageContext ) ; TagRenderingBase br = TagRenderingBase . Factory . getRendering ( TagRenderingBase . INPUT_TEXT_TAG , req ) ; assert ( br != null ) ; br . doStartTag ( writer , _state ) ; br . doEndTag ( writer ) ; if ( ! ref . isNull ( ) ) write ( ( String ) ref . getRef ( ) ) ; localRelease ( ) ; return EVAL_PAGE ; }
Render the TextBox .
9,762
public static void dumpRequest ( ServletRequest request , PrintStream output ) { if ( output == null ) { output = System . err ; } output . println ( "*** ServletRequest " + request ) ; if ( request instanceof HttpServletRequest ) { output . println ( " uri = " + ( ( HttpServletRequest ) request ) . getRequestURI ( ) ) ; } for ( Enumeration e = request . getParameterNames ( ) ; e . hasMoreElements ( ) ; ) { String name = ( String ) e . nextElement ( ) ; output . println ( " parameter " + name + " = " + request . getParameter ( name ) ) ; } for ( Enumeration e = request . getAttributeNames ( ) ; e . hasMoreElements ( ) ; ) { String name = ( String ) e . nextElement ( ) ; output . println ( " attribute " + name + " = " + request . getAttribute ( name ) ) ; } if ( request instanceof HttpServletRequest ) { HttpSession session = ( ( HttpServletRequest ) request ) . getSession ( false ) ; if ( session != null ) { for ( Enumeration e = session . getAttributeNames ( ) ; e . hasMoreElements ( ) ; ) { String name = ( String ) e . nextElement ( ) ; output . println ( " session attribute " + name + " = " + session . getAttribute ( name ) ) ; } } } }
Print parameters and attributes in the given request .
9,763
public static void dumpServletContext ( ServletContext context , PrintStream output ) { if ( output == null ) { output = System . err ; } output . println ( "*** ServletContext " + context ) ; for ( Enumeration e = context . getAttributeNames ( ) ; e . hasMoreElements ( ) ; ) { String name = ( String ) e . nextElement ( ) ; output . println ( " attribute " + name + " = " + context . getAttribute ( name ) ) ; } }
Print attributes in the given ServletContext .
9,764
public static void preventCache ( ServletResponse response ) { if ( response instanceof HttpServletResponse ) { HttpServletResponse httpResponse = ( HttpServletResponse ) response ; httpResponse . setHeader ( "Pragma" , "No-cache" ) ; httpResponse . setHeader ( "Cache-Control" , "no-cache,no-store,max-age=0" ) ; httpResponse . setDateHeader ( "Expires" , 1 ) ; } }
Set response headers to prevent caching of the response by the browser .
9,765
public static String getBaseName ( String uri ) { int lastSlash = uri . lastIndexOf ( '/' ) ; assert lastSlash != - 1 : uri ; assert lastSlash < uri . length ( ) - 1 : "URI must not end with a slash: " + uri ; return uri . substring ( lastSlash + 1 ) ; }
Get the base filename of the given URI .
9,766
public static String getDirName ( String uri ) { int lastSlash = uri . lastIndexOf ( '/' ) ; assert lastSlash != - 1 : uri ; assert uri . length ( ) > 1 : uri ; assert lastSlash < uri . length ( ) - 1 : "URI must not end with a slash: " + uri ; return uri . substring ( 0 , lastSlash ) ; }
Get the directory path of the given URI .
9,767
private int parseContentLength ( int maxPostDataSize , String length ) { if ( length != null ) { try { int size = Integer . parseInt ( length ) ; if ( size > maxPostDataSize ) return - 1 ; else return size ; } catch ( NumberFormatException e ) { return - 1 ; } } else { return - 2 ; } }
If there is a content length header . Check the reported length making sure it isn t over the max post data size .
9,768
public static String getNamePrefix ( ServletContext servletContext , ServletRequest request , String name ) { ArrayList rewriters = getRewriters ( request ) ; InternalStringBuilder prefix = new InternalStringBuilder ( ) ; if ( rewriters != null ) { for ( Iterator i = rewriters . iterator ( ) ; i . hasNext ( ) ; ) { URLRewriter rewriter = ( URLRewriter ) i . next ( ) ; String nextPrefix = rewriter . getNamePrefix ( servletContext , request , name ) ; if ( nextPrefix != null ) { prefix . append ( nextPrefix ) ; } } } return prefix . toString ( ) ; }
Get the prefix to use when rewriting a query parameter name . Loops through the list of registered URLRewriters to build up a the prefix .
9,769
public static void rewriteURL ( ServletContext servletContext , ServletRequest request , ServletResponse response , MutableURI url , URLType type , boolean needsToBeSecure ) { ArrayList rewriters = getRewriters ( request ) ; if ( rewriters != null ) { for ( Iterator i = rewriters . iterator ( ) ; i . hasNext ( ) ; ) { URLRewriter rewriter = ( URLRewriter ) i . next ( ) ; rewriter . rewriteURL ( servletContext , request , response , url , type , needsToBeSecure ) ; } } if ( url instanceof FreezableMutableURI ) { ( ( FreezableMutableURI ) url ) . setFrozen ( true ) ; } }
Rewrite the given URL looping through the list of registered URLRewriters .
9,770
public static void dumpURLRewriters ( ServletRequest request , PrintStream output ) { ArrayList rewriters = getRewriters ( request ) ; if ( output == null ) output = System . err ; output . println ( "*** List of URLRewriter objects: " + rewriters ) ; if ( rewriters != null ) { int count = 0 ; for ( Iterator i = rewriters . iterator ( ) ; i . hasNext ( ) ; ) { URLRewriter rewriter = ( URLRewriter ) i . next ( ) ; output . println ( " " + count ++ + ". " + rewriter . getClass ( ) . getName ( ) ) ; output . println ( " allows other rewriters: " + rewriter . allowOtherRewriters ( ) ) ; output . println ( " rewriter: " + rewriter ) ; } } else { output . println ( " No URLRewriter objects are registered with this request." ) ; } }
Print out information about the chain of URLRewriters in this request .
9,771
public String getMethodField ( ) { StringBuffer sb = new StringBuffer ( ) ; sb . append ( "_" ) ; sb . append ( _eventSet . getShortName ( ) ) ; sb . append ( "_" ) ; sb . append ( getName ( ) ) ; int methodIndex = getIndex ( ) ; if ( methodIndex != - 1 ) sb . append ( methodIndex ) ; sb . append ( "Event" ) ; return sb . toString ( ) ; }
Returns the name of the static field that holds the name of this method .
9,772
protected static Interceptor addInterceptor ( InterceptorConfig config , Class baseClassOrInterface , List interceptors ) { Interceptor interceptor = createInterceptor ( config , baseClassOrInterface ) ; if ( interceptor != null ) interceptors . add ( interceptor ) ; return interceptor ; }
Instantiates an interceptor based on the class name in the given InterceptorConfig and adds it to the given collection of interceptors .
9,773
protected static Interceptor createInterceptor ( InterceptorConfig config , Class baseClassOrInterface ) { assert Interceptor . class . isAssignableFrom ( baseClassOrInterface ) : baseClassOrInterface . getName ( ) + " cannot be assigned to " + Interceptor . class . getName ( ) ; ClassLoader cl = DiscoveryUtils . getClassLoader ( ) ; String className = config . getInterceptorClass ( ) ; try { Class interceptorClass = cl . loadClass ( className ) ; if ( ! baseClassOrInterface . isAssignableFrom ( interceptorClass ) ) { _log . error ( "Interceptor " + interceptorClass . getName ( ) + " does not implement or extend " + baseClassOrInterface . getName ( ) ) ; return null ; } Interceptor interceptor = ( Interceptor ) interceptorClass . newInstance ( ) ; interceptor . init ( config ) ; return interceptor ; } catch ( ClassNotFoundException e ) { _log . error ( "Could not find interceptor class " + className , e ) ; } catch ( InstantiationException e ) { _log . error ( "Could not instantiate interceptor class " + className , e ) ; } catch ( IllegalAccessException e ) { _log . error ( "Could not instantiate interceptor class " + className , e ) ; } return null ; }
Instantiates an interceptor using the class name in the given InterceptorConfig .
9,774
public Object continueChain ( ) throws InterceptorException { if ( ! _chain . isEmpty ( ) ) { return invoke ( ( Interceptor ) _chain . removeFirst ( ) ) ; } else { return null ; } }
Execute the next interceptor in the chain of interceptors .
9,775
public static boolean isAction ( HttpServletRequest request , String action ) { FlowController flowController = PageFlowUtils . getCurrentPageFlow ( request ) ; if ( flowController != null ) { if ( action . endsWith ( PageFlowConstants . ACTION_EXTENSION ) ) { action = action . substring ( 0 , action . length ( ) - PageFlowConstants . ACTION_EXTENSION . length ( ) ) ; } if ( getActionMapping ( request , flowController , action ) != null ) return true ; FlowController globalApp = PageFlowUtils . getSharedFlow ( InternalConstants . GLOBALAPP_CLASSNAME , request ) ; return getActionMapping ( request , globalApp , action ) != null ; } return true ; }
Determine whether a given URI is an Action .
9,776
protected void renderGeneral ( HashMap map , AbstractRenderAppender sb , boolean doubleQuote ) { if ( map == null ) return ; Iterator iterator = map . keySet ( ) . iterator ( ) ; for ( ; iterator . hasNext ( ) ; ) { String key = ( String ) iterator . next ( ) ; if ( key == null ) continue ; String value = ( String ) map . get ( key ) ; if ( doubleQuote ) renderAttribute ( sb , key , value ) ; else renderAttributeSingleQuotes ( sb , key , value ) ; } }
This method will render all of the general attributes .
9,777
static String getDefaultControlBinding ( Class controlIntf ) { controlIntf = getMostDerivedInterface ( controlIntf ) ; ControlInterface intfAnnot = ( ControlInterface ) controlIntf . getAnnotation ( ControlInterface . class ) ; String implBinding = intfAnnot . defaultBinding ( ) ; implBinding = resolveDefaultBinding ( implBinding , controlIntf . getName ( ) ) ; return implBinding ; }
Returns the default binding based entirely upon annotations or naming conventions .
9,778
static Class getMostDerivedInterface ( Class controlIntf ) { while ( controlIntf . isAnnotationPresent ( ControlExtension . class ) ) { Class [ ] intfs = controlIntf . getInterfaces ( ) ; boolean found = false ; for ( int i = 0 ; i < intfs . length ; i ++ ) { if ( intfs [ i ] . isAnnotationPresent ( ControlExtension . class ) || intfs [ i ] . isAnnotationPresent ( ControlInterface . class ) ) { controlIntf = intfs [ i ] ; found = true ; break ; } } if ( ! found ) { throw new ControlException ( "Can't find base control interface for " + controlIntf ) ; } } return controlIntf ; }
Computes the most derived ControlInterface for the specified ControlExtension .
9,779
protected void update ( long readBytes ) throws IOException { if ( progressListener . isAborted ( ) ) { throw new IOException ( "Reading Cancelled by ProgressListener" ) ; } this . bytesRead += readBytes ; int step = ( int ) ( bytesRead / stepSize ) ; if ( step > lastStep ) { lastStep = step ; progressListener . updateProgress ( step , stepNumber ) ; } }
This method is called by the actual input stream method to provide feedback about the number of read bytes .
9,780
protected synchronized void addResourceContext ( ResourceContext resourceContext , ControlBean bean ) { if ( ! resourceContext . hasResources ( ) ) _resourceContexts . push ( resourceContext ) ; }
Adds a new managed ResourceContext to the ControlContainerContext . This method is used to register a resource context that has just acquired resources
9,781
protected synchronized void removeResourceContext ( ResourceContext resourceContext , ControlBean bean ) { if ( ! _releasingAll && resourceContext . hasResources ( ) ) _resourceContexts . remove ( resourceContext ) ; }
Removes a managed ResourceContext from the ControlContainerContext . This method is used to unregister a resource context that has already acquired resources
9,782
protected synchronized void releaseResources ( ) { _releasingAll = true ; while ( ! _resourceContexts . empty ( ) ) { ResourceContext resourceContext = _resourceContexts . pop ( ) ; resourceContext . release ( ) ; } _releasingAll = false ; }
Releases all ResourceContexts associated with the current ControlContainerContext . This method is called by the associated container whenever all managed ResourceContexts that have acquired resources should release them .
9,783
public Object dispatchEvent ( ControlHandle handle , EventRef event , Object [ ] args ) throws IllegalArgumentException , IllegalAccessException , InvocationTargetException { ControlBean bean = getBean ( handle . getControlID ( ) ) ; if ( bean == null ) throw new IllegalArgumentException ( "Invalid bean ID: " + handle . getControlID ( ) ) ; return bean . dispatchEvent ( event , args ) ; }
Dispatch an operation or an event to a bean within this container bean context .
9,784
public ControlHandle getControlHandle ( org . apache . beehive . controls . api . bean . ControlBean bean ) { return null ; }
Returns a ControlHandle to the component containing the control . This handle can be used to dispatch events and operations to a control instance . This method will return null if the containing component does not support direct dispatch .
9,785
public void setTemplate ( String template ) { if ( template == null || template . length ( ) == 0 ) { throw new IllegalStateException ( "Template cannot be null or empty." ) ; } if ( template . equals ( _template ) ) { return ; } _template = template ; _isParsed = false ; _parsedTemplate = null ; }
Reset the String form of the template .
9,786
public boolean verify ( Collection knownTokens , Collection requiredTokens ) { boolean valid = true ; if ( knownTokens != null ) { for ( java . util . Iterator ii = knownTokens . iterator ( ) ; ii . hasNext ( ) ; ) { String token = ( String ) ii . next ( ) ; if ( token != null && token . length ( ) > 2 ) { token = token . substring ( 1 , token . length ( ) - 1 ) ; int index = _template . indexOf ( token ) ; if ( index != - 1 ) { if ( _template . charAt ( index - 1 ) != BEGIN_TOKEN_QUALIFIER || _template . charAt ( index + token . length ( ) ) != END_TOKEN_QUALIFIER ) { _log . error ( "Template token, " + token + ", is not correctly enclosed with braces in template: " + _template ) ; valid = false ; } } } } } parseTemplate ( ) ; if ( requiredTokens != null ) { for ( java . util . Iterator ii = requiredTokens . iterator ( ) ; ii . hasNext ( ) ; ) { String token = ( String ) ii . next ( ) ; TemplateItem requiredItem = new TemplateItem ( token , true ) ; if ( ! _parsedTemplate . contains ( requiredItem ) ) { _log . error ( "Required token, " + token + ", not found in template: " + _template ) ; valid = false ; } } } return valid ; }
Verification will ensure the URL template conforms to a valid format for known tokens and contains the required tokens . It will also parse the tokens and literal data into a list to improve the replacement performance when constructing the final URL string .
9,787
protected void appendToResult ( InternalStringBuilder result , String value ) { if ( value == null || value . length ( ) == 0 ) { return ; } if ( result . length ( ) > 0 && result . charAt ( result . length ( ) - 1 ) == '/' && value . charAt ( 0 ) == '/' ) { result . deleteCharAt ( result . length ( ) - 1 ) ; } result . append ( value ) ; }
of the URL
9,788
public static XID parse ( String idString ) { UUID uuid = UUID . fromString ( idString ) ; return new XID ( uuid ) ; }
Parses an XID object from its text representation .
9,789
public static XID read ( DataInputStream dis ) throws IOException { long msb = dis . readLong ( ) ; long lsb = dis . readLong ( ) ; return new XID ( msb , lsb ) ; }
Reads a binary - serialized XID from a data input stream .
9,790
public static XID read ( DataInput in ) throws IOException { long msb = in . readLong ( ) ; long lsb = in . readLong ( ) ; return new XID ( msb , lsb ) ; }
Reads a binary - serialized XID from a data input .
9,791
public static String getIRIFromNodeID ( String nodeID ) { if ( nodeID . startsWith ( PREFIX_SHARED_NODE ) ) { return nodeID ; } return PREFIX_SHARED_NODE + nodeID . replace ( NODE_ID_PREFIX , "" ) ; }
Returns an absolute IRI from a nodeID attribute .
9,792
public static NodeID getNodeID ( String id ) { String nonBlankId = id == null || id . isEmpty ( ) ? nextAnonymousIRI ( ) : id ; return new NodeID ( nonBlankId ) ; }
Gets a NodeID with a specific identifier string
9,793
public static URIContext getInstance ( ) { URIContext uriContext = MutableURI . getDefaultContext ( ) ; UrlConfig urlConfig = ConfigUtil . getConfig ( ) . getUrlConfig ( ) ; if ( urlConfig != null ) { uriContext . setUseAmpEntity ( urlConfig . isHtmlAmpEntity ( ) ) ; } return uriContext ; }
Get a URIContext . The context has data used to write a MutableURI as a string . For example it will indicate that the URI should be written using the &quot ; &amp ; amp ; &quot ; entity rather than the character &amp ; . This returns the default context but also checks for any overriding setting in the NetUI config .
9,794
public static URIContext getInstance ( boolean forXML ) { URIContext uriContext = null ; if ( forXML ) { uriContext = new URIContext ( ) ; uriContext . setUseAmpEntity ( true ) ; } else { uriContext = getInstance ( ) ; } return uriContext ; }
Get a URIContext . If it s for an XML document type the context will indicate that the URI should be written using the &quot ; &amp ; amp ; &quot ; entity rather than the character &amp ; . If it s not for an XML doc type then use the default context but check for any overriding setting in the NetUI config .
9,795
public static void reportCollectedErrors ( PageContext pc , JspTag tag ) { IErrorReporter er = getErrorReporter ( tag ) ; if ( er == null ) return ; assert ( pc != null ) ; ArrayList errors = er . returnErrors ( ) ; if ( errors == null || errors . size ( ) == 0 ) return ; assert ( errors . size ( ) > 0 ) ; String s ; s = Bundle . getString ( "Footer_Error_Header" ) ; write ( pc , s ) ; int cnt = errors . size ( ) ; Object [ ] args = new Object [ 5 ] ; for ( int i = 0 ; i < cnt ; i ++ ) { Object o = errors . get ( i ) ; assert ( o != null ) ; if ( o instanceof EvalErrorInfo ) { EvalErrorInfo err = ( EvalErrorInfo ) o ; args [ 0 ] = Integer . toString ( err . errorNo ) ; args [ 1 ] = err . tagType ; args [ 2 ] = err . attr ; args [ 3 ] = err . expression ; args [ 4 ] = err . evalExcp . getMessage ( ) ; s = Bundle . getString ( "Footer_Error_Expr_Body" , args ) ; write ( pc , s ) ; } else if ( o instanceof TagErrorInfo ) { TagErrorInfo tei = ( TagErrorInfo ) o ; args [ 0 ] = Integer . toString ( tei . errorNo ) ; args [ 1 ] = tei . tagType ; args [ 2 ] = tei . message ; s = Bundle . getString ( "Footer_Error_Tag_Body" , args ) ; write ( pc , s ) ; } } s = Bundle . getString ( "Footer_Error_Footer" ) ; write ( pc , s ) ; }
This method get the current errors and write the formated output
9,796
public static void initJavaControls ( HttpServletRequest request , HttpServletResponse response , ServletContext servletContext , PageFlowManagedObject controlClient ) throws ControlFieldInitializationException { Class controlClientClass = controlClient . getClass ( ) ; Map controlFields = getAccessibleControlFieldAnnotations ( controlClientClass , servletContext ) ; if ( controlFields . isEmpty ( ) ) { if ( LOG . isTraceEnabled ( ) ) LOG . trace ( "No control field annotations were found for " + controlClient ) ; PageFlowControlContainer pfcc = PageFlowControlContainerFactory . getControlContainer ( request , servletContext ) ; pfcc . beginContextOnPageFlow ( controlClient , request , response , servletContext ) ; return ; } request = PageFlowUtils . unwrapMultipart ( request ) ; PageFlowControlContainer pfcc = PageFlowControlContainerFactory . getControlContainer ( request , servletContext ) ; pfcc . createAndBeginControlBeanContext ( controlClient , request , response , servletContext ) ; ControlBeanContext beanContext = pfcc . getControlContainerContext ( controlClient ) ; assert beanContext != null : "ControlBeanContext was not initialized by PageFlowRequestProcessor" ; try { if ( LOG . isDebugEnabled ( ) ) LOG . debug ( "Initializing control client " + controlClient ) ; Controls . initializeClient ( null , controlClient , beanContext ) ; } catch ( Exception e ) { LOG . error ( "Exception occurred while initializing controls" , e ) ; throw new ControlFieldInitializationException ( controlClientClass . getName ( ) , controlClient , e ) ; } }
Initialize all null member variables that are Java Controls .
9,797
public static void uninitJavaControls ( ServletContext servletContext , PageFlowManagedObject controlClient ) { Map controlFields = getAccessibleControlFieldAnnotations ( controlClient . getClass ( ) , servletContext ) ; for ( Iterator i = controlFields . keySet ( ) . iterator ( ) ; i . hasNext ( ) ; ) { Field controlField = ( Field ) i . next ( ) ; try { Object fieldValue = controlField . get ( controlClient ) ; if ( fieldValue != null ) { controlField . set ( controlClient , null ) ; destroyControl ( fieldValue ) ; } } catch ( IllegalAccessException e ) { LOG . error ( "Exception while uninitializing Java Control " + controlField . getName ( ) , e ) ; } } }
Clean up all member variables that are Java Controls .
9,798
private static void destroyControl ( Object controlInstance ) { assert controlInstance instanceof ControlBean : controlInstance . getClass ( ) . getName ( ) ; BeanContext beanContext = ( ( ControlBean ) controlInstance ) . getBeanContext ( ) ; if ( beanContext != null ) { if ( LOG . isTraceEnabled ( ) ) LOG . trace ( "Removing control " + controlInstance + " from ControlBeanContext " + beanContext ) ; beanContext . remove ( controlInstance ) ; } }
Destroy a Beehive Control .
9,799
public String getFlowControllerURI ( ) { FlowController flowController = getFlowController ( ) ; return flowController != null ? flowController . getDisplayName ( ) : null ; }
Get the name of the related FlowController .