idx
int64
0
165k
question
stringlengths
73
4.15k
target
stringlengths
5
918
len_question
int64
21
890
len_target
int64
3
255
7,400
private boolean hasHashChanged ( Set < RegData > regData ) { for ( RegData el : regData ) { if ( hasHashChanged ( mHasher , el ) ) { Log . d ( "CHANGED" , el . getURLExternalForm ( ) ) ; return true ; } } return false ; }
Hashes files and compares with the old hashes . If any hash is different returns true ; false otherwise .
70
21
7,401
private boolean hasHashChanged ( Hasher hasher , RegData regDatum ) { String urlExternalForm = regDatum . getURLExternalForm ( ) ; Boolean modified = mUrlExternalForm2Modified . get ( urlExternalForm ) ; if ( modified != null ) { return modified ; } // Check hash String newHash = hasher . hashURL ( urlExternalForm ) ; modified = ! newHash . equals ( regDatum . getHash ( ) ) ; mUrlExternalForm2Modified . put ( urlExternalForm , modified ) ; return modified ; }
Hashes file and compares with the old hash . If hashes are different return true ; false otherwise
122
19
7,402
@ Nonnull public FineUploader5Blobs setDefaultName ( @ Nonnull @ Nonempty final String sDefaultName ) { ValueEnforcer . notEmpty ( sDefaultName , "DefaultName" ) ; m_sBlobsDefaultName = sDefaultName ; return this ; }
The default name to be used for nameless Blobs .
60
12
7,403
@ Nullable @ OverrideOnDemand protected String getObjectDisplayName ( @ Nonnull final WPECTYPE aWPEC , @ Nonnull final DATATYPE aObject ) { return null ; }
Get the display name of the passed object .
44
9
7,404
@ Nullable public static IIcon get ( @ Nullable final EDefaultIcon eDefaultIcon ) { if ( eDefaultIcon == null ) return null ; return s_aMap . get ( eDefaultIcon ) ; }
Get the icon assigned to the passed default icon .
46
10
7,405
public static void set ( @ Nonnull final EDefaultIcon eDefaultIcon , @ Nullable final IIcon aIcon ) { ValueEnforcer . notNull ( eDefaultIcon , "DefaultIcon" ) ; if ( aIcon != null ) s_aMap . put ( eDefaultIcon , aIcon ) ; else s_aMap . remove ( eDefaultIcon ) ; }
Set the icon to be used for the specified default icon . Existing definitions are simply overwritten .
79
20
7,406
@ Nonnull public FineUploader5Session setEndpoint ( @ Nullable final ISimpleURL aEndpoint ) { ValueEnforcer . notNull ( aEndpoint , "Endpoint" ) ; m_aSessionEndpoint = aEndpoint ; return this ; }
If non - null Fine Uploader will send a GET request on startup to this endpoint expecting a JSON response containing data about the initial file list to populate .
58
31
7,407
@ Nonnull @ OverrideOnDemand protected UserDataObject getUserDataObject ( @ Nonnull final IRequestWebScopeWithoutResponse aRequestScope , @ Nonnull final String sFilename ) { // URL decode is required because requests contain e.g. "%20" final String sFilename1 = URLHelper . urlDecode ( sFilename ) ; return new UserDataObject ( sFilename1 ) ; }
Get the user data object matching the passed request and filename
84
11
7,408
public static void setUserDataPath ( @ Nonnull @ Nonempty final String sUserDataPath ) { ValueEnforcer . isTrue ( StringHelper . getLength ( sUserDataPath ) >= 2 , "userDataPath is too short" ) ; ValueEnforcer . isTrue ( StringHelper . startsWith ( sUserDataPath , ' ' ) , "userDataPath must start with a slash" ) ; s_aRWLock . writeLocked ( ( ) -> s_sUserDataPath = sUserDataPath ) ; }
Set the user data path relative to the URL context and relative to the servlet context directory .
114
19
7,409
@ Nonnull public static FileSystemResource getResource ( @ Nonnull final IUserDataObject aUDO ) { ValueEnforcer . notNull ( aUDO , "UDO" ) ; return _getFileIO ( ) . getResource ( getUserDataPath ( ) + aUDO . getPath ( ) ) ; }
Get the file system resource of the passed UDO object .
70
12
7,410
@ Nonnull public static File getFile ( @ Nonnull final IUserDataObject aUDO ) { ValueEnforcer . notNull ( aUDO , "UDO" ) ; return _getFileIO ( ) . getFile ( getUserDataPath ( ) + aUDO . getPath ( ) ) ; }
Get the File of the passed UDO object .
68
10
7,411
public void addAllOutOfBandNodesToHead ( @ Nonnull final List < IHCNode > aAllOOBNodes ) { ValueEnforcer . notNull ( aAllOOBNodes , "AllOOBNodes" ) ; // And now add all to head in the correct order for ( final IHCNode aNode : aAllOOBNodes ) { final IHCNode aUnwrappedNode = HCHelper . getUnwrappedNode ( aNode ) ; // Node for the body? if ( HCJSNodeDetector . isDirectJSNode ( aUnwrappedNode ) ) m_aHead . addJS ( aNode ) ; else if ( HCCSSNodeDetector . isDirectCSSNode ( aUnwrappedNode ) ) m_aHead . addCSS ( aNode ) ; else throw new IllegalStateException ( "Found illegal out-of-band head node: " + aNode ) ; } }
Add the passed OOB nodes to the head .
202
10
7,412
public void moveScriptElementsToBody ( ) { // Move all JS from head to body final ICommonsList < IHCNode > aJSNodes = new CommonsArrayList <> ( ) ; m_aHead . getAllAndRemoveAllJSNodes ( aJSNodes ) ; // Find index of first script in body int nFirstScriptIndex = 0 ; if ( m_aBody . hasChildren ( ) ) for ( final IHCNode aChild : m_aBody . getAllChildren ( ) ) { if ( aChild instanceof IHCScript < ? > ) { // Check if this is a special inline script to be emitted before files final boolean bIsInlineBeforeFiles = ( aChild instanceof IHCScriptInline < ? > ) && ! ( ( IHCScriptInline < ? > ) aChild ) . isEmitAfterFiles ( ) ; if ( ! bIsInlineBeforeFiles ) { // Remember index to insert before break ; } } nFirstScriptIndex ++ ; } m_aBody . addChildrenAt ( nFirstScriptIndex , aJSNodes ) ; }
Move all JS nodes from the head to the body .
237
11
7,413
@ Nonnull private String _readAndParseCSS ( @ Nonnull final IHasInputStream aISP , @ Nonnull @ Nonempty final String sBasePath , final boolean bRegular ) { final CascadingStyleSheet aCSS = CSSReader . readFromStream ( aISP , m_aCharset , ECSSVersion . CSS30 ) ; if ( aCSS == null ) { LOGGER . error ( "Failed to parse CSS. Returning 'as-is'" ) ; return StreamHelper . getAllBytesAsString ( aISP , m_aCharset ) ; } CSSVisitor . visitCSSUrl ( aCSS , new AbstractModifyingCSSUrlVisitor ( ) { @ Override protected String getModifiedURI ( @ Nonnull final String sURI ) { if ( LinkHelper . hasKnownProtocol ( sURI ) ) { // If e.g. an external resource is includes. // Example: https://fonts.googleapis.com/css return sURI ; } return FilenameHelper . getCleanConcatenatedUrlPath ( sBasePath , sURI ) ; } } ) ; // Write again after modification return new CSSWriter ( ECSSVersion . CSS30 , ! bRegular ) . setWriteHeaderText ( false ) . setWriteFooterText ( false ) . getCSSAsString ( aCSS ) ; }
Unify all paths in a CSS relative to the passed base path .
292
14
7,414
public static boolean isCSSNode ( @ Nullable final IHCNode aNode ) { final IHCNode aUnwrappedNode = HCHelper . getUnwrappedNode ( aNode ) ; return isDirectCSSNode ( aUnwrappedNode ) ; }
Check if the passed node is a CSS node after unwrapping .
57
14
7,415
public static boolean isCSSInlineNode ( @ Nullable final IHCNode aNode ) { final IHCNode aUnwrappedNode = HCHelper . getUnwrappedNode ( aNode ) ; return isDirectCSSInlineNode ( aUnwrappedNode ) ; }
Check if the passed node is an inline CSS node after unwrapping .
61
15
7,416
public static boolean isCSSFileNode ( @ Nullable final IHCNode aNode ) { final IHCNode aUnwrappedNode = HCHelper . getUnwrappedNode ( aNode ) ; return isDirectCSSFileNode ( aUnwrappedNode ) ; }
Check if the passed node is a file CSS node after unwrapping .
59
15
7,417
public static void setConversionSettings ( @ Nonnull final HCConversionSettings aConversionSettings ) { ValueEnforcer . notNull ( aConversionSettings , "ConversionSettings" ) ; s_aRWLock . writeLocked ( ( ) -> s_aConversionSettings = aConversionSettings ) ; }
Set the global conversion settings .
68
6
7,418
public static void setBaseDirectory ( @ Nonnull final String sBaseDirectory ) { ValueEnforcer . notNull ( sBaseDirectory , "BaseDirectory" ) ; s_aRWLock . writeLocked ( ( ) -> { s_sBaseDirectory = sBaseDirectory ; } ) ; }
Set the base directory to be used .
62
8
7,419
@ Nonnull public FineUploaderBasic setMaxConnections ( @ Nonnegative final int nMaxConnections ) { ValueEnforcer . isGT0 ( nMaxConnections , "MaxConnections" ) ; m_nMaxConnections = nMaxConnections ; return this ; }
Maximum allowable concurrent uploads .
60
6
7,420
@ Nonnull public FineUploaderBasic setSizeLimit ( @ Nonnegative final int nSizeLimit ) { ValueEnforcer . isGE0 ( nSizeLimit , "SizeLimit" ) ; m_nValidationSizeLimit = nSizeLimit ; return this ; }
Maximum allowable size in bytes for a file .
56
9
7,421
@ Nonnull public FineUploaderBasic setMinSizeLimit ( @ Nonnegative final int nMinSizeLimit ) { ValueEnforcer . isGE0 ( nMinSizeLimit , "MinSizeLimit" ) ; m_nValidationMinSizeLimit = nMinSizeLimit ; return this ; }
Minimum allowable size in bytes for a file .
62
9
7,422
@ Nonnull public FineUploaderBasic setInputName ( @ Nonnull @ Nonempty final String sInputName ) { ValueEnforcer . notEmpty ( sInputName , "InputName" ) ; m_sRequestInputName = sInputName ; return this ; }
This usually only useful with the ajax uploader which sends the name of the file as a parameter using a key name equal to the value of this options . In the case of the form uploader this is simply the value of the name attribute of the file s associated input element .
57
58
7,423
@ Nonnull public JSRegExLiteral gim ( final boolean bGlobal , final boolean bCaseInsensitive , final boolean bMultiLine ) { return global ( bGlobal ) . caseInsensitive ( bCaseInsensitive ) . multiLine ( bMultiLine ) ; }
Set global case insensitive and multi line at once
58
9
7,424
public boolean isExpectedNonce ( @ Nullable final String sNonceToCheck ) { final String sThisNonce = getNonce ( ) ; return StringHelper . hasText ( sThisNonce ) && sThisNonce . equals ( sNonceToCheck ) && CSRFManager . getInstance ( ) . isValidNonce ( sNonceToCheck ) ; }
Check if the passed nonce is the expected one for this session .
82
14
7,425
public void generateNewNonce ( ) { final CSRFManager aCSRFMgr = CSRFManager . getInstance ( ) ; m_aRWLock . writeLocked ( ( ) -> { aCSRFMgr . removeNonce ( m_sNonce ) ; m_sNonce = aCSRFMgr . createNewNonce ( ) ; } ) ; }
Generate a new nonce for this session .
82
10
7,426
@ Nullable protected final String getSelectedObjectID ( @ Nonnull final WPECTYPE aWPEC ) { return aWPEC . params ( ) . getAsString ( CPageParam . PARAM_OBJECT ) ; }
Get the ID of the selected object from the passed execution context .
50
13
7,427
@ Nonnull @ OverrideOnDemand protected TOOLBAR_TYPE createEditToolbar ( @ Nonnull final WPECTYPE aWPEC , @ Nonnull final FORM_TYPE aForm , @ Nonnull final DATATYPE aSelectedObject ) { final Locale aDisplayLocale = aWPEC . getDisplayLocale ( ) ; final TOOLBAR_TYPE aToolbar = createNewEditToolbar ( aWPEC ) ; aToolbar . addHiddenField ( CPageParam . PARAM_ACTION , CPageParam . ACTION_EDIT ) ; aToolbar . addHiddenField ( CPageParam . PARAM_OBJECT , aSelectedObject . getID ( ) ) ; aToolbar . addHiddenField ( CPageParam . PARAM_SUBACTION , CPageParam . ACTION_SAVE ) ; // Save button aToolbar . addSubmitButton ( getEditToolbarSubmitButtonText ( aDisplayLocale ) , getEditToolbarSubmitButtonIcon ( ) ) ; // Cancel button aToolbar . addButtonCancel ( aDisplayLocale ) ; // Callback modifyEditToolbar ( aWPEC , aSelectedObject , aToolbar ) ; return aToolbar ; }
Create toolbar for editing an existing object
264
7
7,428
@ Nonnull @ OverrideOnDemand protected TOOLBAR_TYPE createCreateToolbar ( @ Nonnull final WPECTYPE aWPEC , @ Nonnull final FORM_TYPE aForm , @ Nullable final DATATYPE aSelectedObject ) { final Locale aDisplayLocale = aWPEC . getDisplayLocale ( ) ; final TOOLBAR_TYPE aToolbar = createNewCreateToolbar ( aWPEC ) ; aToolbar . addHiddenField ( CPageParam . PARAM_ACTION , CPageParam . ACTION_CREATE ) ; if ( aSelectedObject != null ) aToolbar . addHiddenField ( CPageParam . PARAM_OBJECT , aSelectedObject . getID ( ) ) ; aToolbar . addHiddenField ( CPageParam . PARAM_SUBACTION , CPageParam . ACTION_SAVE ) ; // Save button aToolbar . addSubmitButton ( getCreateToolbarSubmitButtonText ( aDisplayLocale ) , getCreateToolbarSubmitButtonIcon ( ) ) ; // Cancel button aToolbar . addButtonCancel ( aDisplayLocale ) ; // Callback modifyCreateToolbar ( aWPEC , aToolbar ) ; return aToolbar ; }
Create toolbar for creating a new object
269
7
7,429
@ OverrideOnDemand @ OverridingMethodsMustInvokeSuper protected boolean performLocking ( @ Nonnull final WPECTYPE aWPEC , @ Nonnull final DATATYPE aSelectedObject , @ Nonnull final EWebPageFormAction eFormAction ) { // Lock EDIT and DELETE if an object is present // Also lock custom actions if an object is selected return eFormAction . isModifying ( ) || eFormAction . isCustom ( ) ; }
Check if locking should be performed on the current request or not . Override with care!
103
18
7,430
public static < Value extends Comparable < Value > > int nullSafeCompare ( final Value first , final Value second ) { if ( first == null ) { return second == null ? EQUAL_COMPARE_RESULT : LOWER_THAN_COMPARE_RESULT ; } return second == null ? GREATER_THAN_COMPARE_RESULT : first . compareTo ( second ) ; }
Safely compares two values that might be null . Null value is considered lower than non - null even if the non - null value is minimal in its range .
88
32
7,431
public Collection < Utterance > call ( final AnalysisRequest request ) { ClientResponse response = null ; try { response = service . type ( MediaType . APPLICATION_JSON ) . accept ( MediaType . APPLICATION_JSON ) . post ( ClientResponse . class , request ) ; return response . getEntity ( new GenericType < Collection < Utterance > > ( ) { } ) ; } finally { // belt and braces if ( response != null ) { //noinspection OverlyBroadCatchBlock try { response . close ( ) ; } catch ( final Throwable ignored ) { /* do nothing */ } } } }
Call the webservice with some request to analyse for SNOMED CT codes - this method can be used repeatedly on the same SnomedClient instance .
131
31
7,432
@ Nonnull @ OverrideOnDemand protected SimpleURL getURLForNonExistingItem ( @ Nonnull final IRequestWebScopeWithoutResponse aRequestScope , @ Nonnull final String sKey ) { return new SimpleURL ( aRequestScope . getFullContextPath ( ) ) ; }
Get the URL to redirect in case an invalid go mapping key was provided .
60
15
7,433
@ Nonnull public PhotonSessionStatePerApp state ( @ Nonnull @ Nonempty final String sAppID ) { ValueEnforcer . notEmpty ( sAppID , "AppID" ) ; return m_aStateMap . computeIfAbsent ( sAppID , k -> new PhotonSessionStatePerApp ( ) ) ; }
Get or create a new state for the provided app ID .
72
12
7,434
@ Nonnull public final IMPLTYPE setMode ( @ Nonnull final EHCScriptInlineMode eMode ) { m_eScriptMode = ValueEnforcer . notNull ( eMode , "Mode" ) ; return thisAsT ( ) ; }
Set the masking mode .
54
6
7,435
protected void format ( @ Nonnull final JSFormatter aFormatter , @ Nonnull final String sIndent ) { if ( ! isEmpty ( ) ) aFormatter . plain ( sIndent ) ; final Iterator < Object > aIter = iterator ( ) ; while ( aIter . hasNext ( ) ) { final Object aValue = aIter . next ( ) ; if ( aValue instanceof String ) { int nIdx ; String sValue = ( String ) aValue ; while ( ( nIdx = sValue . indexOf ( ' ' ) ) != - 1 ) { final String sLine = sValue . substring ( 0 , nIdx ) ; if ( sLine . length ( ) > 0 ) aFormatter . plain ( _escape ( sLine ) ) ; sValue = sValue . substring ( nIdx + 1 ) ; aFormatter . nlFix ( ) . plain ( sIndent ) ; } if ( sValue . length ( ) != 0 ) aFormatter . plain ( _escape ( sValue ) ) ; } else if ( aValue instanceof AbstractJSClass ) { ( ( AbstractJSClass ) aValue ) . printLink ( aFormatter ) ; } else if ( aValue instanceof AbstractJSType ) { aFormatter . generatable ( ( AbstractJSType ) aValue ) ; } else throw new IllegalStateException ( "Unsupported value: " + aValue ) ; } if ( ! isEmpty ( ) ) aFormatter . nlFix ( ) ; }
Writes this part into the formatter by using the specified indentation .
329
15
7,436
@ Nonnull private static String _escape ( @ Nonnull final String sStr ) { String ret = sStr ; while ( true ) { final int idx = ret . indexOf ( "*/" ) ; if ( idx < 0 ) return ret ; ret = ret . substring ( 0 , idx + 1 ) + "<!-- -->" + ret . substring ( idx + 1 ) ; } }
Escapes the appearance of the comment terminator .
87
10
7,437
public boolean skipSpaces ( ) { while ( m_nPos < m_sValue . length ( ) && m_sValue . charAt ( m_nPos ) == ' ' ) m_nPos ++ ; return m_nPos < m_sValue . length ( ) ; }
Skips spaces .
63
4
7,438
public String readUntil ( final char ... aEndChars ) { final StringBuilder aSB = new StringBuilder ( ) ; int nPos = m_nPos ; while ( nPos < m_sValue . length ( ) ) { final char ch = m_sValue . charAt ( nPos ) ; if ( ch == ' ' && nPos + 1 < m_sValue . length ( ) ) { final char c = m_sValue . charAt ( nPos + 1 ) ; if ( MarkdownHelper . isEscapeChar ( c ) ) { aSB . append ( c ) ; nPos ++ ; } else aSB . append ( ch ) ; } else { boolean bEndReached = false ; for ( final char cElement : aEndChars ) if ( ch == cElement ) { bEndReached = true ; break ; } if ( bEndReached ) break ; aSB . append ( ch ) ; } nPos ++ ; } final char ch = nPos < m_sValue . length ( ) ? m_sValue . charAt ( nPos ) : ' ' ; for ( final char cElement : aEndChars ) if ( ch == cElement ) { m_nPos = nPos ; return aSB . toString ( ) ; } return null ; }
Reads chars from this line until any end char is reached .
280
13
7,439
private int _countCharsStart ( final char ch ) { int nCount = 0 ; for ( int i = 0 ; i < m_sValue . length ( ) ; i ++ ) { final char c = m_sValue . charAt ( i ) ; if ( c == ' ' ) continue ; if ( c != ch ) break ; nCount ++ ; } return nCount ; }
Counts the amount of ch at the start of this line ignoring spaces .
83
15
7,440
public static void assertThatEndMethodCheckFileExists ( String uniqueFileName ) throws IOException { Enumeration < URL > resources = ClassLoader . getSystemResources ( uniqueFileName ) ; if ( ! resources . hasMoreElements ( ) ) { throw new AssertionError ( "End method check uniqueFileName named: " + uniqueFileName + " doesn't exist.\n" + "Either you didn't use anywhere the annotation @EndMethodCheckFile(\"" + uniqueFileName + "\")\n" + "or the annotation processor wasn't invoked by the compiler and you have to check it's configuration.\n" + "For more about annotation processor configuration and possible issues see:\n" + "https://github.com/c0stra/fluent-api-end-check" ) ; } URL url = resources . nextElement ( ) ; if ( resources . hasMoreElements ( ) ) { throw new IllegalArgumentException ( "Too many files with the same name: " + uniqueFileName + " found on class-path.\n" + "Chosen end method check file name is not unique.\n" + "Files found:\n" + url + "\n" + resources . nextElement ( ) ) ; } }
Assertion method to check that requested EndMethodCheckFile got created .
269
15
7,441
@ Nonnull public FineUploader5Resume setRecordsExpireIn ( @ Nonnegative final int nRecordsExpireIn ) { ValueEnforcer . isGE0 ( nRecordsExpireIn , "RecordsExpireIn" ) ; m_nResumeRecordsExpireIn = nRecordsExpireIn ; return this ; }
The number of days before a persistent resume record will expire .
76
12
7,442
@ Nonnull public FineUploader5Resume setParamNameResuming ( @ Nonnull @ Nonempty final String sParamNameResuming ) { ValueEnforcer . notEmpty ( sParamNameResuming , "ParamNameResuming" ) ; m_sResumeParamNamesResuming = sParamNameResuming ; return this ; }
Sent with the first request of the resume with a value of true .
72
14
7,443
@ Override protected String badIdentifier ( String expected ) { error ( expected ) ; final String id = "@" + ( nextId ++ ) ; if ( ! peekPunctuation ( ) ) { final Token token = getNextToken ( ) ; return "BAD_IDENTIFIER" + "_" + friendlyName ( token ) + id ; } else { return "NO_IDENTIFIER" + id ; } }
Called by the parser whenever a required identifier is missing .
89
12
7,444
private void error ( String expected , String actual ) { if ( ! recovering ) { recovering = true ; final String outputString = ( EOF_STRING . equals ( actual ) || UNTERMINATED_COMMENT_STRING . equals ( actual ) || COMMENT_NOT_ALLOWED . equals ( actual ) ) ? actual : "'" + actual + "'" ; errors . add ( SyntaxError . _UnexpectedToken ( expected , outputString , lookahead ( 1 ) . beginLine ) ) ; } }
If not currently recovering adds an error to the errors list and sets recovering to true
110
16
7,445
private String friendlyName ( Token token ) { return token . kind == EOF ? EOF_STRING : token . kind == UNTERMINATED_COMMENT ? UNTERMINATED_COMMENT_STRING : token . image ; }
Turn a token into a user readable name
51
8
7,446
private Token lookahead ( int n ) { Token current = token ; for ( int i = 0 ; i < n ; i ++ ) { if ( current . next == null ) { current . next = token_source . getNextToken ( ) ; } current = current . next ; } return current ; }
look ahead n tokens . 0 is the current token 1 is the next token 2 the one after that etc
64
21
7,447
@ Nonnull public IRole createNewRole ( @ Nonnull @ Nonempty final String sName , @ Nullable final String sDescription , @ Nullable final Map < String , String > aCustomAttrs ) { // Create role final Role aRole = new Role ( sName , sDescription , aCustomAttrs ) ; m_aRWLock . writeLocked ( ( ) -> { // Store internalCreateItem ( aRole ) ; } ) ; AuditHelper . onAuditCreateSuccess ( Role . OT , aRole . getID ( ) , sName ) ; // Execute callback as the very last action m_aCallbacks . forEach ( aCB -> aCB . onRoleCreated ( aRole , false ) ) ; return aRole ; }
Create a new role .
160
5
7,448
@ Nonnull public IRole createPredefinedRole ( @ Nonnull @ Nonempty final String sID , @ Nonnull @ Nonempty final String sName , @ Nullable final String sDescription , @ Nullable final Map < String , String > aCustomAttrs ) { // Create role final Role aRole = new Role ( StubObject . createForCurrentUserAndID ( sID , aCustomAttrs ) , sName , sDescription ) ; m_aRWLock . writeLocked ( ( ) -> { // Store internalCreateItem ( aRole ) ; } ) ; AuditHelper . onAuditCreateSuccess ( Role . OT , aRole . getID ( ) , "predefind-role" , sName ) ; // Execute callback as the very last action m_aCallbacks . forEach ( aCB -> aCB . onRoleCreated ( aRole , true ) ) ; return aRole ; }
Create a predefined role .
194
6
7,449
@ Nonnull public EChange deleteRole ( @ Nullable final String sRoleID ) { Role aDeletedRole ; m_aRWLock . writeLock ( ) . lock ( ) ; try { aDeletedRole = internalDeleteItem ( sRoleID ) ; if ( aDeletedRole == null ) { AuditHelper . onAuditDeleteFailure ( Role . OT , "no-such-role-id" , sRoleID ) ; return EChange . UNCHANGED ; } BusinessObjectHelper . setDeletionNow ( aDeletedRole ) ; } finally { m_aRWLock . writeLock ( ) . unlock ( ) ; } AuditHelper . onAuditDeleteSuccess ( Role . OT , sRoleID ) ; // Execute callback as the very last action m_aCallbacks . forEach ( aCB -> aCB . onRoleDeleted ( aDeletedRole ) ) ; return EChange . CHANGED ; }
Delete the role with the passed ID
202
7
7,450
@ Nonnull public EChange renameRole ( @ Nullable final String sRoleID , @ Nonnull @ Nonempty final String sNewName ) { // Resolve user group final Role aRole = getOfID ( sRoleID ) ; if ( aRole == null ) { AuditHelper . onAuditModifyFailure ( Role . OT , sRoleID , "no-such-id" ) ; return EChange . UNCHANGED ; } m_aRWLock . writeLock ( ) . lock ( ) ; try { if ( aRole . setName ( sNewName ) . isUnchanged ( ) ) return EChange . UNCHANGED ; BusinessObjectHelper . setLastModificationNow ( aRole ) ; internalUpdateItem ( aRole ) ; } finally { m_aRWLock . writeLock ( ) . unlock ( ) ; } AuditHelper . onAuditModifySuccess ( Role . OT , "name" , sRoleID , sNewName ) ; // Execute callback as the very last action m_aCallbacks . forEach ( aCB -> aCB . onRoleRenamed ( aRole ) ) ; return EChange . CHANGED ; }
Rename the role with the passed ID
251
8
7,451
public AnnotationVisitor visitAnnotation ( String desc , boolean visible ) { if ( fv != null ) { return fv . visitAnnotation ( desc , visible ) ; } return null ; }
Visits an annotation of the field .
42
8
7,452
@ Nullable public static IMicroElement getFirstChildElement ( @ Nonnull final IMicroElement aElement , @ Nonnull final EHTMLElement eHTMLElement ) { ValueEnforcer . notNull ( aElement , "element" ) ; ValueEnforcer . notNull ( eHTMLElement , "HTMLElement" ) ; // First try with lower case name IMicroElement aChild = aElement . getFirstChildElement ( eHTMLElement . getElementName ( ) ) ; if ( aChild == null ) { // Fallback: try with upper case name aChild = aElement . getFirstChildElement ( eHTMLElement . getElementNameUpperCase ( ) ) ; } return aChild ; }
Find the first HTML child element within a start element . This check considers both lower - and upper - case element names . Mixed case is not supported!
159
30
7,453
@ Nonnull @ ReturnsMutableCopy public static ICommonsList < IMicroElement > getChildElements ( @ Nonnull final IMicroElement aElement , @ Nonnull final EHTMLElement eHTMLElement ) { ValueEnforcer . notNull ( aElement , "element" ) ; ValueEnforcer . notNull ( eHTMLElement , "HTMLElement" ) ; final ICommonsList < IMicroElement > ret = new CommonsArrayList <> ( ) ; ret . addAll ( aElement . getAllChildElements ( eHTMLElement . getElementName ( ) ) ) ; ret . addAll ( aElement . getAllChildElements ( eHTMLElement . getElementNameUpperCase ( ) ) ) ; return ret ; }
Get a list of all HTML child elements of the given element . This methods handles lower - and upper - cased elements .
170
25
7,454
@ Nonnull public static String getAsHTMLID ( @ Nullable final String sSrc ) { String ret = StringHelper . getNotNull ( sSrc , "" ) . trim ( ) ; ret = StringHelper . removeMultiple ( ret , ID_REMOVE_CHARS ) ; return ret . isEmpty ( ) ? "_" : ret ; }
Convert the passed ID string to a valid HTML ID .
76
12
7,455
public String hashSystemEnv ( ) { List < String > system = new ArrayList < String > ( ) ; for ( Entry < Object , Object > el : System . getProperties ( ) . entrySet ( ) ) { system . add ( el . getKey ( ) + " " + el . getValue ( ) ) ; } Map < String , String > env = System . getenv ( ) ; for ( Entry < String , String > el : env . entrySet ( ) ) { system . add ( el . getKey ( ) + " " + el . getValue ( ) ) ; } Collections . sort ( system ) ; ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ; try { DataOutputStream dos = new DataOutputStream ( baos ) ; for ( String s : system ) { dos . write ( s . getBytes ( ) ) ; } } catch ( IOException ex ) { // never } return hashByteArray ( baos . toByteArray ( ) ) ; }
Hashes system environment .
213
5
7,456
protected String hashURL ( URL url , String externalForm ) { if ( url == null ) return ERR_HASH ; String hash = path2Hash . get ( externalForm ) ; if ( hash != null ) { return hash ; } if ( mIsSemanticHashing ) { byte [ ] bytes = FileUtil . loadBytes ( url ) ; if ( bytes == null ) return ERR_HASH ; // Remove debug info from classfiles. bytes = BytecodeCleaner . removeDebugInfo ( bytes ) ; hash = hashByteArray ( bytes ) ; } else { // http://www.oracle.com/technetwork/articles/java/compress-1565076.html Checksum cksum = new Adler32 ( ) ; byte [ ] bytes = FileUtil . loadBytes ( url , cksum ) ; if ( bytes == null ) return ERR_HASH ; hash = Long . toString ( cksum . getValue ( ) ) ; } path2Hash . put ( externalForm , hash ) ; return hash ; }
Hash resource at the given URL .
227
7
7,457
protected String hashByteArray ( byte [ ] data ) { if ( mCRC32 != null ) { return hashCRC32 ( data ) ; } else if ( mHashAlgorithm != null ) { return messageDigest ( data ) ; } else { // Default. return hashCRC32 ( data ) ; } }
Hashes byte array .
68
5
7,458
public static boolean isIgnorable ( Class < ? > clz ) { return clz . isArray ( ) || clz . isPrimitive ( ) || isIgnorableBinName ( clz . getName ( ) ) ; }
Checks if class should be ignored when collecting dependencies .
50
11
7,459
@ Research public static boolean isRetransformIgnorable ( Class < ? > clz ) { String className = clz . getName ( ) ; return ( isIgnorableBinName ( className ) || className . startsWith ( Names . ORG_APACHE_MAVEN_BIN , 0 ) || className . startsWith ( Names . ORG_JUNIT_PACKAGE_BIN , 0 ) || className . startsWith ( Names . JUNIT_FRAMEWORK_PACKAGE_BIN , 0 ) ) ; }
Checks if the given class should be instrumented . Returns true if the class should not be instrumented false otherwise .
123
24
7,460
public static URL extractJarURL ( URL url ) throws IOException { JarURLConnection connection = ( JarURLConnection ) url . openConnection ( ) ; return connection . getJarFileURL ( ) ; }
Extract URL part that corresponds to jar portion of the given url .
42
14
7,461
public static boolean isPrimitiveDesc ( String desc ) { if ( desc . length ( ) > 1 ) return false ; char c = desc . charAt ( 0 ) ; return c == ' ' || c == ' ' || c == ' ' || c == ' ' || c == ' ' || c == ' ' || c == ' ' || c == ' ' ; }
Returns true if descriptor describes one of the primitive types .
78
11
7,462
@ OverrideOnDemand public void beforeAddRenderedMenuItem ( @ Nonnull final IWebPageExecutionContext aWPEC , @ Nonnull final IMenuObject aMenuObj , @ Nullable final IHCElement < ? > aPreviousLI ) { if ( aMenuObj . getMenuObjectType ( ) == EMenuObjectType . SEPARATOR && aPreviousLI != null ) aPreviousLI . addStyle ( CCSSProperties . MARGIN_BOTTOM . newValue ( "1em" ) ) ; }
Called before a menu item is rendered .
115
9
7,463
@ Nullable @ OverrideOnDemand public IHCNode renderMenuSeparator ( @ Nonnull final IWebPageExecutionContext aWPEC , @ Nonnull final IMenuSeparator aMenuSeparator ) { return null ; }
Render a menu separator
53
5
7,464
@ Nullable @ OverrideOnDemand public IHCNode renderMenuItemPage ( @ Nonnull final IWebPageExecutionContext aWPEC , @ Nonnull final IMenuItemPage aMenuItemPage ) { if ( ! aMenuItemPage . matchesDisplayFilter ( ) ) return null ; final Locale aDisplayLocale = aWPEC . getDisplayLocale ( ) ; final HCA ret = new HCA ( aWPEC . getLinkToMenuItem ( aMenuItemPage . getID ( ) ) ) ; // Set window target (if defined) if ( aMenuItemPage . hasTarget ( ) ) ret . setTarget ( new HC_Target ( aMenuItemPage . getTarget ( ) ) ) ; ret . addChild ( aMenuItemPage . getDisplayText ( aDisplayLocale ) ) ; return ret ; }
Render a menu item to an internal page
180
8
7,465
@ Nullable @ OverrideOnDemand public IHCNode renderMenuItemExternal ( @ Nonnull final IWebPageExecutionContext aWPEC , @ Nonnull final IMenuItemExternal aMenuItemExternal ) { if ( ! aMenuItemExternal . matchesDisplayFilter ( ) ) return null ; final Locale aDisplayLocale = aWPEC . getDisplayLocale ( ) ; final HCA ret = new HCA ( aMenuItemExternal . getURL ( ) ) ; // Set window target (if defined) if ( aMenuItemExternal . hasTarget ( ) ) ret . setTarget ( new HC_Target ( aMenuItemExternal . getTarget ( ) ) ) ; ret . addChild ( aMenuItemExternal . getDisplayText ( aDisplayLocale ) ) ; return ret ; }
Render a menu item to an external page
169
8
7,466
@ Nonnull public EChange removeByName ( final String sName ) { final IJSDeclaration aDecl = m_aDecls . remove ( sName ) ; if ( aDecl == null ) return EChange . UNCHANGED ; m_aObjs . remove ( aDecl ) ; return EChange . CHANGED ; }
Removes a declaration from this package .
73
8
7,467
@ Nonnegative public int pos ( @ Nonnegative final int nNewPos ) { ValueEnforcer . isBetweenInclusive ( nNewPos , "NewPos" , 0 , m_aObjs . size ( ) ) ; final int nOldPos = m_nPos ; m_nPos = nNewPos ; return nOldPos ; }
Sets the current position .
74
6
7,468
@ Nonnull public JSDefinedClass _class ( @ Nonnull @ Nonempty final String sName ) throws JSNameAlreadyExistsException { final JSDefinedClass aDefinedClass = new JSDefinedClass ( sName ) ; return addDeclaration ( aDefinedClass ) ; }
Add a class to this package .
62
7
7,469
@ Nonnull public IMPLTYPE _throw ( @ Nonnull final IJSExpression aExpr ) { addStatement ( new JSThrow ( aExpr ) ) ; return thisAsT ( ) ; }
Create a throw statement and add it to this block
44
10
7,470
@ Nonnull public JSConditional _if ( @ Nonnull final IJSExpression aTest , @ Nullable final IHasJSCode aThen ) { return addStatement ( new JSConditional ( aTest , aThen ) ) ; }
Create an If statement and add it to this block
54
10
7,471
@ Nonnull public IMPLTYPE _return ( @ Nullable final IJSExpression aExpr ) { addStatement ( new JSReturn ( aExpr ) ) ; return thisAsT ( ) ; }
Create a return statement and add it to this block
44
10
7,472
@ Nonnull public final InternalErrorBuilder setDuplicateEliminiationCounter ( @ Nonnegative final int nDuplicateEliminiationCounter ) { ValueEnforcer . isGE0 ( nDuplicateEliminiationCounter , "DuplicateEliminiationCounter" ) ; m_nDuplicateEliminiationCounter = nDuplicateEliminiationCounter ; return this ; }
Set the duplicate elimination counter .
90
6
7,473
@ Nonnull public final InternalErrorBuilder setFromWebExecutionContext ( @ Nonnull final ISimpleWebExecutionContext aSWEC ) { setDisplayLocale ( aSWEC . getDisplayLocale ( ) ) ; setRequestScope ( aSWEC . getRequestScope ( ) ) ; return this ; }
Shortcut for setting display locale and request scope at once from a web execution context
67
16
7,474
@ Nonnull @ Nonempty public String handle ( ) { return InternalErrorHandler . handleInternalError ( m_bSendEmail , m_bSaveAsXML , m_aUIErrorHandler , m_aThrowable , m_aRequestScope , m_aCustomData , m_aEmailAttachments , m_aDisplayLocale , m_bInvokeCustomExceptionHandler , m_bAddClassPath , m_nDuplicateEliminiationCounter ) ; }
The main handling routine
104
4
7,475
@ Nonnull public BootstrapBorderBuilder type ( @ Nonnull final EBootstrapBorderType eType ) { ValueEnforcer . notNull ( eType , "Type" ) ; m_eType = eType ; return this ; }
Set the border type . Default is no border .
50
10
7,476
@ Nonnull public BootstrapBorderBuilder radius ( @ Nonnull final EBootstrapBorderRadiusType eRadius ) { ValueEnforcer . notNull ( eRadius , "Radius" ) ; m_eRadius = eRadius ; return this ; }
Set the border radius . Default is no radius .
57
10
7,477
@ Nonnull public static JSAnonymousFunction createFunctionPrintSum ( @ Nullable final String sPrefix , @ Nullable final String sSuffix , @ Nullable final String sBothPrefix , @ Nullable final String sBothSep , @ Nullable final String sBothSuffix ) { final JSAnonymousFunction aFuncPrintSum = new JSAnonymousFunction ( ) ; IJSExpression aTotal = aFuncPrintSum . param ( "t" ) ; IJSExpression aPageTotal = aFuncPrintSum . param ( "pt" ) ; if ( StringHelper . hasText ( sPrefix ) ) { aTotal = JSExpr . lit ( sPrefix ) . plus ( aTotal ) ; aPageTotal = JSExpr . lit ( sPrefix ) . plus ( aPageTotal ) ; } if ( StringHelper . hasText ( sSuffix ) ) { aTotal = aTotal . plus ( sSuffix ) ; aPageTotal = aPageTotal . plus ( sSuffix ) ; } IJSExpression aBoth ; if ( StringHelper . hasText ( sBothPrefix ) ) aBoth = JSExpr . lit ( sBothPrefix ) . plus ( aPageTotal ) ; else aBoth = aPageTotal ; if ( StringHelper . hasText ( sBothSep ) ) aBoth = aBoth . plus ( sBothSep ) ; aBoth = aBoth . plus ( aTotal ) ; if ( StringHelper . hasText ( sBothSuffix ) ) aBoth = aBoth . plus ( sBothSuffix ) ; aFuncPrintSum . body ( ) . _return ( JSOp . cond ( aTotal . eq ( aPageTotal ) , aTotal , aBoth ) ) ; return aFuncPrintSum ; }
Create the JS function to print the sum in the footer
388
12
7,478
@ Nonnull public static JSInvocation createClearFilterCode ( @ Nonnull final IJSExpression aDTSelect ) { return aDTSelect . invoke ( "DataTable" ) . invoke ( "search" ) . arg ( "" ) . invoke ( "columns" ) . invoke ( "search" ) . arg ( "" ) . invoke ( "draw" ) ; }
Remove all filters and redraw the data table
79
9
7,479
@ Nullable @ OverrideOnDemand protected IHCElement < ? > createSingleErrorNode ( @ Nonnull final IError aError , @ Nonnull final Locale aContentLocale ) { return BootstrapFormHelper . createDefaultErrorNode ( aError , aContentLocale ) ; }
Create the node for a single error .
63
8
7,480
public boolean canExecute ( @ Nonnull final IRequestWebScopeWithoutResponse aRequestScope , @ Nonnull final MutableInt aStatusCode ) { if ( aRequestScope == null ) return false ; // Note: HTTP method was already checked in APIDescriptorList // Check required headers for ( final String sRequiredHeader : m_aDescriptor . requiredHeaders ( ) ) if ( aRequestScope . headers ( ) . getFirstHeaderValue ( sRequiredHeader ) == null ) { LOGGER . warn ( "Request '" + m_sPath + "' is missing required HTTP header '" + sRequiredHeader + "'" ) ; return false ; } // Check required parameters for ( final String sRequiredParam : m_aDescriptor . requiredParams ( ) ) if ( ! aRequestScope . params ( ) . containsKey ( sRequiredParam ) ) { LOGGER . warn ( "Request '" + m_sPath + "' is missing required HTTP parameter '" + sRequiredParam + "'" ) ; return false ; } // Check explicit filter if ( m_aDescriptor . hasExecutionFilter ( ) ) if ( ! m_aDescriptor . getExecutionFilter ( ) . canExecute ( aRequestScope ) ) { LOGGER . warn ( "Request '" + m_sPath + "' cannot be executed because of ExecutionFilter" ) ; return false ; } if ( m_aDescriptor . allowedMimeTypes ( ) . isNotEmpty ( ) ) { final String sContentType = aRequestScope . getContentType ( ) ; // Parse to extract any parameters etc. final MimeType aMT = MimeTypeParser . safeParseMimeType ( sContentType ) ; // If parsing fails, use the provided String final String sMimeTypeToCheck = aMT == null ? sContentType : aMT . getAsStringWithoutParameters ( ) ; if ( ! m_aDescriptor . allowedMimeTypes ( ) . contains ( sMimeTypeToCheck ) && ! m_aDescriptor . allowedMimeTypes ( ) . contains ( sMimeTypeToCheck . toLowerCase ( CGlobal . DEFAULT_LOCALE ) ) ) { LOGGER . warn ( "Request '" + m_sPath + "' contains the Content-Type '" + sContentType + "' which is not in the allowed list of " + m_aDescriptor . allowedMimeTypes ( ) ) ; // Special error code HTTP 415 aStatusCode . set ( HttpServletResponse . SC_UNSUPPORTED_MEDIA_TYPE ) ; return false ; } } return true ; }
Check if all pre - requisites are handled correctly . This checks if all required headers and params are present .
571
22
7,481
@ Nonnull public static IMimeType getMimeType ( @ Nullable final IRequestWebScopeWithoutResponse aRequestScope ) { // Add the charset to the MIME type return new MimeType ( CMimeType . TEXT_HTML ) . addParameter ( CMimeType . PARAMETER_NAME_CHARSET , HCSettings . getHTMLCharset ( ) . name ( ) ) ; }
Get the HTML MIME type to use
89
8
7,482
public boolean isAccessTokenUsed ( @ Nullable final String sTokenString ) { if ( StringHelper . hasNoText ( sTokenString ) ) return false ; return containsAny ( x -> x . findFirstAccessToken ( y -> y . getTokenString ( ) . equals ( sTokenString ) ) != null ) ; }
Check if the passed token string was already used in this application . This method considers all access token - revoked expired or active .
69
25
7,483
public static void execute ( Object mojo ) throws Exception { // Note that the object can be an instance of // AbstractSurefireMojo. if ( ! ( isSurefirePlugin ( mojo ) || isFailsafePlugin ( mojo ) ) ) { return ; } // Check if the same object is already invoked. This may // happen (in the future) if execute method is in both // AbstractSurefire and SurefirePlugin classes. if ( isAlreadyInvoked ( mojo ) ) { return ; } // Check if surefire version is supported. checkSurefireVersion ( mojo ) ; // Check surefire configuration. checkSurefireConfiguration ( mojo ) ; try { // Update argLine. updateArgLine ( mojo ) ; // Update excludes. updateExcludes ( mojo ) ; // Update parallel. updateParallel ( mojo ) ; } catch ( Exception ex ) { // This exception should not happen in theory. throwMojoExecutionException ( mojo , "Unsupported surefire version" , ex ) ; } }
This method is invoked before SurefirePlugin execute method .
218
11
7,484
private static void checkSurefireVersion ( Object mojo ) throws Exception { try { // Check version specific methods/fields. // mojo.getClass().getMethod(GET_RUN_ORDER); getField ( SKIP_TESTS_FIELD , mojo ) ; getField ( FORK_MODE_FIELD , mojo ) ; // We will always require the following. getField ( ARGLINE_FIELD , mojo ) ; getField ( EXCLUDES_FIELD , mojo ) ; } catch ( NoSuchMethodException ex ) { throwMojoExecutionException ( mojo , "Unsupported surefire version. An alternative is to use select/restore goals." , ex ) ; } }
Checks that Surefire has all the metohds that are needed i . e . check Surefire version . Currently we support 2 . 7 and newer .
151
32
7,485
private static void checkSurefireConfiguration ( Object mojo ) throws Exception { String forkCount = null ; try { forkCount = invokeAndGetString ( GET_FORK_COUNT , mojo ) ; } catch ( NoSuchMethodException ex ) { // Nothing: earlier versions (before 2.14) of surefire did // not have forkCount. } String forkMode = null ; try { forkMode = getStringField ( FORK_MODE_FIELD , mojo ) ; } catch ( NoSuchMethodException ex ) { // Nothing: earlier versions (before 2.1) of surefire did // not have forkMode. } if ( ( forkCount != null && forkCount . equals ( "0" ) ) || ( forkMode != null && ( forkMode . equals ( "never" ) || forkMode . equals ( "none" ) ) ) ) { throwMojoExecutionException ( mojo , "Fork has to be enabled when running tests with Ekstazi; check forkMode and forkCount parameters." , null ) ; } }
Checks that surefire configuration allows integration with Ekstazi . At the moment we check that forking is enabled .
221
24
7,486
private static void updateParallel ( Object mojo ) throws Exception { try { String currentParallel = getStringField ( PARALLEL_FIELD , mojo ) ; if ( currentParallel != null ) { warn ( mojo , "Ekstazi does not support parallel parameter. This parameter will be set to null for this run." ) ; setField ( PARALLEL_FIELD , mojo , null ) ; } } catch ( NoSuchMethodException ex ) { // "parallel" was introduced in Surefire 2.2, so methods // may not exist, but we do not fail because default is // sequential execution. } }
Sets parallel parameter to null if the parameter is different from null and prints a warning .
136
18
7,487
private static boolean isOneVMPerClass ( Object mojo ) throws Exception { // We already know that we fork process (checked in // precondition). Threfore if we see reuseForks=false, we know // that one class will be run in one VM. try { return ! invokeAndGetBoolean ( IS_REUSE_FORKS , mojo ) ; } catch ( NoSuchMethodException ex ) { // Nothing: earlier versions (before 2.13) of surefire did // not have reuseForks. return false ; } }
Returns true if one test class is executed in one VM .
116
12
7,488
public static < Type > ArrayObjectProvider < Type > getProvider ( final Class < Type > arrayType ) { return new ArrayObjectProvider < Type > ( arrayType ) ; }
Produces typed arrays .
37
5
7,489
@ Nonnull public FineUploader5Request addCustomHeaders ( @ Nullable final Map < String , String > aCustomHeaders ) { m_aRequestCustomHeaders . addAll ( aCustomHeaders ) ; return this ; }
Additional headers sent along with each upload request .
51
9
7,490
@ Nonnull public FineUploader5Request setEndpoint ( @ Nonnull final ISimpleURL aRequestEndpoint ) { ValueEnforcer . notNull ( aRequestEndpoint , "RequestEndpoint" ) ; m_aRequestEndpoint = aRequestEndpoint ; return this ; }
The endpoint to send upload requests to .
62
8
7,491
@ Nonnull public FineUploader5Request setFilenameParam ( @ Nonnull @ Nonempty final String sFilenameParam ) { ValueEnforcer . notEmpty ( sFilenameParam , "FilenameParam" ) ; m_sRequestFilenameParam = sFilenameParam ; return this ; }
The name of the parameter passed if the original filename has been edited or a Blob is being sent .
58
21
7,492
@ Nonnull public FineUploader5Request setUUIDName ( @ Nonnull @ Nonempty final String sUUIDName ) { ValueEnforcer . notEmpty ( sUUIDName , "UUIDName" ) ; m_sRequestUUIDName = sUUIDName ; return this ; }
The name of the parameter the uniquely identifies each associated item . The value is a Level 4 UUID .
64
21
7,493
@ Nonnull public FineUploader5Request setTotalFileSizeName ( @ Nonnull @ Nonempty final String sTotalFileSizeName ) { ValueEnforcer . notEmpty ( sTotalFileSizeName , "TotalFileSizeName" ) ; m_sRequestTotalFileSizeName = sTotalFileSizeName ; return this ; }
The name of the parameter passed that specifies the total file size in bytes .
70
15
7,494
public boolean canBeBundledWith ( @ Nonnull final WebSiteResourceWithCondition aOther ) { ValueEnforcer . notNull ( aOther , "Other" ) ; // Resource cannot be bundled at all if ( ! m_bIsBundlable || ! aOther . isBundlable ( ) ) return false ; // Can only bundle resources of the same type if ( ! m_aResource . getResourceType ( ) . equals ( aOther . m_aResource . getResourceType ( ) ) ) return false ; // If the conditional comment is different, items cannot be bundled! if ( ! EqualsHelper . equals ( m_sConditionalComment , aOther . m_sConditionalComment ) ) return false ; // If the CSS media list is different, items cannot be bundled! if ( ! EqualsHelper . equals ( m_aMediaList , aOther . m_aMediaList ) ) return false ; // Can be bundled! return true ; }
Check if this resource can be bundled with the passed resource .
208
12
7,495
@ Nonnull public static WebSiteResourceWithCondition createForJS ( @ Nonnull final IJSPathProvider aPP , final boolean bRegular ) { return createForJS ( aPP . getJSItemPath ( bRegular ) , aPP . getConditionalComment ( ) , aPP . isBundlable ( ) ) ; }
Factory method for JavaScript resources .
72
6
7,496
@ Nonnull public static WebSiteResourceWithCondition createForCSS ( @ Nonnull final ICSSPathProvider aPP , final boolean bRegular ) { return createForCSS ( aPP . getCSSItemPath ( bRegular ) , aPP . getConditionalComment ( ) , aPP . isBundlable ( ) , aPP . getMediaList ( ) ) ; }
Factory method for CSS resources .
81
6
7,497
public static boolean canBeDeleted ( @ Nullable final IUser aUser ) { return aUser != null && ! aUser . isDeleted ( ) && ! aUser . isAdministrator ( ) ; }
Check if a user can be deleted or not . Currently all not deleted users can be deleted except for the administrator special user .
45
25
7,498
@ Nonnull public static IHCConversionSettings createConversionSettings ( ) { // Create HTML without namespaces final HCConversionSettings aRealCS = HCSettings . getMutableConversionSettings ( ) . getClone ( ) ; aRealCS . getMutableXMLWriterSettings ( ) . setEmitNamespaces ( false ) ; // Remove any "HCCustomizerAutoFocusFirstCtrl" customizer for AJAX calls on // DataTables final IHCCustomizer aCustomizer = aRealCS . getCustomizer ( ) ; if ( aCustomizer instanceof HCCustomizerAutoFocusFirstCtrl ) aRealCS . setCustomizer ( null ) ; else if ( aCustomizer instanceof HCCustomizerList ) ( ( HCCustomizerList ) aCustomizer ) . removeAllCustomizersOfClass ( HCCustomizerAutoFocusFirstCtrl . class ) ; return aRealCS ; }
Create the HC conversion settings to be used for HTML serialization .
197
13
7,499
public static void unregisterCSSIncludeFromThisRequest ( @ Nonnull final ICSSPathProvider aCSSPathProvider ) { final CSSResourceSet aSet = _getPerRequestSet ( false ) ; if ( aSet != null ) aSet . removeItem ( aCSSPathProvider ) ; }
Unregister an existing CSS item only from this request
65
10