idx int64 0 165k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
7,300 | public void markRevoked ( final String sRevocationUserID , final LocalDateTime aRevocationDT , final String sRevocationReason ) { ValueEnforcer . notEmpty ( sRevocationUserID , "RevocationUserID" ) ; ValueEnforcer . notNull ( aRevocationDT , "RevocationDT" ) ; ValueEnforcer . notEmpty ( sRevocationReason , "RevocationReason" ) ; if ( m_bRevoked ) throw new IllegalStateException ( "This object is already revoked!" ) ; m_bRevoked = true ; m_sRevocationUserID = sRevocationUserID ; m_aRevocationDT = aRevocationDT ; m_sRevocationReason = sRevocationReason ; } | Mark the owning item as revoked . |
7,301 | @ Produces ( MediaType . TEXT_PLAIN ) public InputStream doc ( ) throws IOException { return getClass ( ) . getClassLoader ( ) . getResource ( "SnomedCoderService_help.txt" ) . openStream ( ) ; } | Return some docs about how to call this webservice |
7,302 | @ Consumes ( MediaType . APPLICATION_JSON ) @ Produces ( { MediaType . APPLICATION_JSON , MediaType . TEXT_XML } ) public static Collection < Utterance > mapTextWithOptions ( final AnalysisRequest r ) throws IOException , InterruptedException , JAXBException , SQLException , ParserConfigurationException , SAXException { System . out . println ( r ) ; final Collection < Option > opts = new ArrayList < > ( ) ; final Set < String > optionNames = new HashSet < > ( ) ; for ( final String o : r . getOptions ( ) ) { final Option opt = MetaMapOptions . strToOpt ( o ) ; if ( opt != null ) { optionNames . add ( opt . name ( ) ) ; if ( ! opt . useProcessorDefault ( ) ) opts . add ( opt ) ; } } if ( ! optionNames . contains ( new RestrictToSources ( ) . name ( ) ) ) opts . add ( new RestrictToSources ( ) ) ; final File infile = File . createTempFile ( "metamap-input-" , ".txt" ) ; final File outfile = File . createTempFile ( "metamap-output-" , ".xml" ) ; final String s = r . getText ( ) + ( r . getText ( ) . endsWith ( "\n" ) ? "" : "\n" ) ; final String ascii = MetaMap . decomposeToAscii ( URLDecoder . decode ( s , "UTF-8" ) ) ; Files . write ( ascii , infile , Charsets . UTF_8 ) ; if ( infile . length ( ) > MAX_DATA_BYTES ) { throw new WebApplicationException ( Response . status ( Responses . NOT_ACCEPTABLE ) . entity ( "Too much data, currently limited to " + MAX_DATA_BYTES + " bytes." ) . type ( "text/plain" ) . build ( ) ) ; } final MetaMap metaMap = new MetaMap ( PUBLIC_MM_DIR , opts ) ; if ( ! metaMap . process ( infile , outfile ) ) { throw new WebApplicationException ( Response . status ( INTERNAL_SERVER_ERROR ) . entity ( "Processing failed, aborting." ) . type ( "text/plain" ) . build ( ) ) ; } final MMOs root = JaxbLoader . loadXml ( outfile ) ; try ( final SnomedLookup snomedLookup = new SnomedLookup ( DB_PATH ) ) { snomedLookup . enrichXml ( root ) ; } infile . delete ( ) ; outfile . delete ( ) ; return destructiveFilter ( root ) ; } | Accepts a JSON object with text and possible options for the analysis . |
7,303 | private static Collection < Utterance > destructiveFilter ( final MMOs root ) { final Collection < Utterance > utterances = new ArrayList < > ( ) ; for ( final MMO mmo : root . getMMO ( ) ) { for ( final Utterance utterance : mmo . getUtterances ( ) . getUtterance ( ) ) { for ( final Phrase phrase : utterance . getPhrases ( ) . getPhrase ( ) ) { phrase . setCandidates ( null ) ; } utterances . add ( utterance ) ; } } return utterances ; } | Beware! Destructive filtering of things we are not interested in in the JAXB data structure . |
7,304 | private static void _initialFillSet ( final ICommonsOrderedSet < String > aSet , final String sItemList , final boolean bUnify ) { ValueEnforcer . notNull ( aSet , "Set" ) ; if ( ! aSet . isEmpty ( ) ) throw new IllegalArgumentException ( "The provided set must be empty, but it is not: " + aSet ) ; if ( StringHelper . hasText ( sItemList ) ) { final String sRealItemList = StringHelper . replaceAll ( sItemList , EXTENSION_MACRO_WEB_DEFAULT , "js,css,png,jpg,jpeg,gif,eot,svg,ttf,woff,woff2,map" ) ; for ( final String sItem : StringHelper . getExploded ( ',' , sRealItemList ) ) { String sRealItem = sItem . trim ( ) ; if ( bUnify ) sRealItem = getUnifiedItem ( sRealItem ) ; if ( StringHelper . hasText ( sRealItem ) ) aSet . add ( sRealItem ) ; } } } | Helper function to convert the configuration string to a collection . |
7,305 | public List < Page > extractText ( InputStream src ) throws IOException { List < Page > pages = Lists . newArrayList ( ) ; PdfReader reader = new PdfReader ( src ) ; RenderListener listener = new InternalListener ( ) ; PdfContentStreamProcessor processor = new PdfContentStreamProcessor ( listener ) ; for ( int i = 1 ; i <= reader . getNumberOfPages ( ) ; i ++ ) { pages . add ( currentPage = new Page ( ) ) ; PdfDictionary pageDic = reader . getPageN ( i ) ; PdfDictionary resourcesDic = pageDic . getAsDict ( PdfName . RESOURCES ) ; processor . processContent ( ContentByteUtils . getContentBytesForPage ( reader , i ) , resourcesDic ) ; } reader . close ( ) ; return pages ; } | Extracts text from a PDF document . |
7,306 | public String createResponse ( String challenge ) throws IllegalArgumentException , KeyNotFoundException , ProtocolVersionException { byte [ ] decodedChallenge = decode ( challenge ) ; Challenge deserializedChallenge = CrtAuthCodec . deserializeChallenge ( decodedChallenge ) ; if ( ! deserializedChallenge . getServerName ( ) . equals ( serverName ) ) { throw new IllegalArgumentException ( String . format ( "Server name mismatch (%s != %s). Possible MITM attack." , deserializedChallenge . getServerName ( ) , serverName ) ) ; } byte [ ] signature = signer . sign ( decodedChallenge , deserializedChallenge . getFingerprint ( ) ) ; return encode ( CrtAuthCodec . serialize ( new Response ( decodedChallenge , signature ) ) ) ; } | Generate a response String using the Signer of this instance additionally verifying that the embedded serverName matches the serverName of this instance . |
7,307 | private static boolean initSingleCoverageMode ( final String runName , Instrumentation instrumentation ) { if ( Ekstazi . inst ( ) . checkIfAffected ( runName ) ) { Ekstazi . inst ( ) . startCollectingDependencies ( runName ) ; Runtime . getRuntime ( ) . addShutdownHook ( new Thread ( ) { public void run ( ) { Ekstazi . inst ( ) . finishCollectingDependencies ( runName ) ; } } ) ; return true ; } else { instrumentation . addTransformer ( new RemoveMainCFT ( ) ) ; return false ; } } | Initialize SingleMode run . We first check if run is affected and only in that case start coverage otherwise we remove bodies of all main methods to avoid any execution . |
7,308 | protected void addMetaElements ( final IRequestWebScopeWithoutResponse aRequestScope , final HCHead aHead ) { final ICommonsList < IMetaElement > aMetaElements = new CommonsArrayList < > ( ) ; { final IMimeType aMimeType = PhotonHTMLHelper . getMimeType ( aRequestScope ) ; aMetaElements . add ( EStandardMetaElement . CONTENT_TYPE . getAsMetaElement ( aMimeType . getAsString ( ) ) ) ; } PhotonMetaElements . getAllRegisteredMetaElementsForGlobal ( aMetaElements ) ; PhotonMetaElements . getAllRegisteredMetaElementsForThisRequest ( aMetaElements ) ; for ( final IMetaElement aMetaElement : aMetaElements ) for ( final Map . Entry < Locale , String > aEntry : aMetaElement . getContent ( ) ) { final HCMeta aMeta = new HCMeta ( ) ; if ( aMetaElement . isHttpEquiv ( ) ) aMeta . setHttpEquiv ( aMetaElement . getName ( ) ) ; else aMeta . setName ( aMetaElement . getName ( ) ) ; aMeta . setContent ( aEntry . getValue ( ) ) ; final Locale aContentLocale = aEntry . getKey ( ) ; if ( aContentLocale != null && ! LocaleHelper . isSpecialLocale ( aContentLocale ) ) aMeta . setLanguage ( aContentLocale . toString ( ) ) ; aHead . metaElements ( ) . add ( aMeta ) ; } } | Add all meta elements to the HTML head element . |
7,309 | public FineUploader5Core setMaxConnections ( final int nMaxConnections ) { ValueEnforcer . isGT0 ( nMaxConnections , "MaxConnections" ) ; m_nCoreMaxConnections = nMaxConnections ; return this ; } | Maximum allowable concurrent requests |
7,310 | public JSFormatter outdentAlways ( ) { if ( m_nIndentLevel == 0 ) throw new IllegalStateException ( "Nothing left to outdent!" ) ; m_nIndentLevel -- ; m_sIndentCache = m_sIndentCache . substring ( 0 , m_nIndentLevel * m_aSettings . getIndent ( ) . length ( ) ) ; return this ; } | Decrement the indentation level . |
7,311 | public JSDefinedClass _extends ( final AbstractJSClass aSuperClass ) { m_aSuperClass = ValueEnforcer . notNull ( aSuperClass , "SuperClass" ) ; return this ; } | This class extends the specified class . |
7,312 | public JSMethod method ( final String sName ) { final JSMethod aMethod = new JSMethod ( this , sName ) ; m_aMethods . add ( aMethod ) ; return aMethod ; } | Add a method to the list of method members of this JS class instance . |
7,313 | public JSPackage openModal ( final EBootstrapModalOptionBackdrop aBackdrop , final Boolean aKeyboard , final Boolean aFocus , final Boolean aShow , final String sRemotePath ) { final JSPackage ret = new JSPackage ( ) ; final JSAssocArray aOptions = new JSAssocArray ( ) ; if ( aBackdrop != null ) aOptions . add ( "backdrop" , aBackdrop . getJSExpression ( ) ) ; if ( aFocus != null ) aOptions . add ( "focus" , aFocus . booleanValue ( ) ) ; if ( aKeyboard != null ) aOptions . add ( "keyboard" , aKeyboard . booleanValue ( ) ) ; if ( aShow != null ) aOptions . add ( "show" , aShow . booleanValue ( ) ) ; ret . add ( jsModal ( ) . arg ( aOptions ) ) ; if ( StringHelper . hasText ( sRemotePath ) ) { ret . add ( JQuery . idRef ( _getContentID ( ) ) . load ( sRemotePath ) ) ; } return ret ; } | Activates your content as a modal . Accepts an optional options object . |
7,314 | protected ICommonsSet < String > onShowSelectedObjectCustomAttrs ( final WPECTYPE aWPEC , final DATATYPE aSelectedObject , final Map < String , String > aCustomAttrs , final BootstrapViewForm aViewForm ) { return null ; } | Callback for manually extracting custom attributes . This method is called independently if custom attributes are present or not . |
7,315 | protected ICommonsMap < String , String > validateCustomInputParameters ( final WPECTYPE aWPEC , final DATATYPE aSelectedObject , final FormErrorList aFormErrors , final EWebPageFormAction eFormAction ) { return null ; } | Validate custom data of the input field . |
7,316 | public void addUploadedFile ( final String sFieldName , final TemporaryUserDataObject aUDO ) { ValueEnforcer . notEmpty ( sFieldName , "FieldName" ) ; ValueEnforcer . notNull ( aUDO , "UDO" ) ; m_aRWLock . writeLocked ( ( ) -> { final TemporaryUserDataObject aOldUDO = m_aMap . remove ( sFieldName ) ; if ( aOldUDO != null ) _deleteUDO ( aOldUDO ) ; m_aMap . put ( sFieldName , aUDO ) ; } ) ; } | Add an uploaded file . Existing UDOs with the same field name are overwritten and the underlying file is deleted . By default an uploaded file is not confirmed and will be deleted when the session expires . By confirming the uploaded image it is safe for later reuse . |
7,317 | public ICommonsOrderedMap < String , UserDataObject > confirmUploadedFiles ( final String ... aFieldNames ) { final ICommonsOrderedMap < String , UserDataObject > ret = new CommonsLinkedHashMap < > ( ) ; if ( aFieldNames != null ) { m_aRWLock . writeLocked ( ( ) -> { for ( final String sFieldName : aFieldNames ) { final TemporaryUserDataObject aUDO = m_aMap . remove ( sFieldName ) ; if ( aUDO != null ) { LOGGER . info ( "Confirmed uploaded file " + aUDO ) ; ret . put ( sFieldName , new UserDataObject ( aUDO . getPath ( ) ) ) ; } } } ) ; } return ret ; } | Confirm the uploaded files with the passed field names . |
7,318 | public UserDataObject confirmUploadedFile ( final String sFieldName ) { return m_aRWLock . writeLocked ( ( ) -> { if ( StringHelper . hasText ( sFieldName ) ) { final TemporaryUserDataObject aUDO = m_aMap . remove ( sFieldName ) ; if ( aUDO != null ) { LOGGER . info ( "Confirmed uploaded file " + aUDO ) ; return new UserDataObject ( aUDO . getPath ( ) ) ; } } return null ; } ) ; } | Confirm a single uploaded file with the passed field name . |
7,319 | public ICommonsList < String > cancelUploadedFiles ( final String ... aFieldNames ) { final ICommonsList < String > ret = new CommonsArrayList < > ( ) ; if ( ArrayHelper . isNotEmpty ( aFieldNames ) ) { m_aRWLock . writeLocked ( ( ) -> { for ( final String sFieldName : aFieldNames ) { final TemporaryUserDataObject aUDO = m_aMap . remove ( sFieldName ) ; if ( aUDO != null ) { _deleteUDO ( aUDO ) ; ret . add ( sFieldName ) ; } } } ) ; } return ret ; } | Remove all uploaded files and delete the underlying UDO objects . This is usually called when the operation is cancelled without saving . |
7,320 | public TemporaryUserDataObject getUploadedFile ( final String sFieldName ) { if ( StringHelper . hasNoText ( sFieldName ) ) return null ; return m_aRWLock . readLocked ( ( ) -> m_aMap . get ( sFieldName ) ) ; } | Get the user data object matching the specified field name . |
7,321 | protected void modifyFirstControlIfLabelIsPresent ( final IHCElementWithChildren < ? > aLabel , final IHCControl < ? > aFirstControl ) { if ( aFirstControl instanceof IHCInput < ? > ) { final IHCInput < ? > aEdit = ( IHCInput < ? > ) aFirstControl ; final EHCInputType eType = aEdit . getType ( ) ; if ( eType != null && eType . hasPlaceholder ( ) && ! aEdit . hasPlaceholder ( ) ) aEdit . setPlaceholder ( _getPlaceholderText ( aLabel ) ) ; } else if ( aFirstControl instanceof IHCTextArea < ? > ) { final IHCTextArea < ? > aTextArea = ( IHCTextArea < ? > ) aFirstControl ; if ( ! aTextArea . hasPlaceholder ( ) ) aTextArea . setPlaceholder ( _getPlaceholderText ( aLabel ) ) ; } } | Modify the first control that is inserted . This method is only called when a label is present . |
7,322 | public IHasJSCode getJSUpdateCode ( final IJSExpression aJSDataVar ) { final JSPackage ret = new JSPackage ( ) ; ret . invoke ( JSExpr . ref ( getJSChartVar ( ) ) , "destroy" ) ; ret . assign ( JSExpr . ref ( getJSChartVar ( ) ) , new JSDefinedClass ( "Chart" ) . _new ( ) . arg ( JSExpr . ref ( getCanvasID ( ) ) . invoke ( "getContext" ) . arg ( "2d" ) ) . invoke ( m_aChart . getJSMethodName ( ) ) . arg ( aJSDataVar ) . arg ( getJSOptions ( ) ) ) ; return ret ; } | Update the chart with new datasets . This destroys the old chart . |
7,323 | public static void unregisterJSIncludeFromThisRequest ( final IJSPathProvider aJSPathProvider ) { final JSResourceSet aSet = _getPerRequestSet ( false ) ; if ( aSet != null ) aSet . removeItem ( aJSPathProvider ) ; } | Unregister a existing JS item only from this request |
7,324 | public static byte [ ] readFile ( File file ) throws IOException { RandomAccessFile f = new RandomAccessFile ( file , "r" ) ; try { long longlength = f . length ( ) ; int length = ( int ) longlength ; if ( length != longlength ) { throw new IOException ( "File size >= 2 GB" ) ; } byte [ ] data = new byte [ length ] ; f . readFully ( data ) ; return data ; } finally { f . close ( ) ; } } | Loads bytes of the given file . |
7,325 | public static void writeFile ( File file , byte [ ] bytes ) throws IOException { FileOutputStream fos = null ; try { fos = new FileOutputStream ( file ) ; fos . write ( bytes ) ; } finally { if ( fos != null ) { fos . close ( ) ; } } } | Write bytes to the given file . |
7,326 | public static boolean isSecondNewerThanFirst ( File first , File second ) { boolean isSecondNewerThanFirst = false ; if ( second . exists ( ) ) { long firstLastModified = first . lastModified ( ) ; long secondLastModified = second . lastModified ( ) ; if ( firstLastModified != 0L && secondLastModified != 0L ) { isSecondNewerThanFirst = secondLastModified > firstLastModified ; } } return isSecondNewerThanFirst ; } | Checks if tool jar is newer than JUnit jar . If tool jar is newer return true ; false otherwise . |
7,327 | public static byte [ ] loadBytes ( URL url ) { byte [ ] bytes = null ; try { bytes = loadBytes ( url . openStream ( ) ) ; } catch ( IOException ex ) { } return bytes ; } | Load bytes from the given url . |
7,328 | public WebSiteResourceBundleSerialized getResourceBundleOfID ( final String sBundleID ) { if ( StringHelper . hasNoText ( sBundleID ) ) return null ; return m_aRWLock . readLocked ( ( ) -> m_aMapToBundle . get ( sBundleID ) ) ; } | Get the serialized resource bundle with the passed ID . |
7,329 | public boolean containsResourceBundleOfID ( final String sBundleID ) { if ( StringHelper . hasNoText ( sBundleID ) ) return false ; return m_aRWLock . readLocked ( ( ) -> m_aMapToBundle . containsKey ( sBundleID ) ) ; } | Check if the passed resource bundle ID is contained . |
7,330 | protected static void throwMojoExecutionException ( Object mojo , String message , Exception cause ) throws Exception { Class < ? > clz = mojo . getClass ( ) . getClassLoader ( ) . loadClass ( MavenNames . MOJO_EXECUTION_EXCEPTION_BIN ) ; Constructor < ? > con = clz . getConstructor ( String . class , Exception . class ) ; Exception ex = ( Exception ) con . newInstance ( message , cause ) ; throw ex ; } | Throws MojoExecutionException . |
7,331 | protected static String invokeAndGetString ( String methodName , Object mojo ) throws Exception { return ( String ) invokeGetMethod ( methodName , mojo ) ; } | Gets String field value from the given mojo based on the given method name . |
7,332 | protected static boolean invokeAndGetBoolean ( String methodName , Object mojo ) throws Exception { return ( Boolean ) invokeGetMethod ( methodName , mojo ) ; } | Gets boolean field value from the given mojo based on the given method name . |
7,333 | @ SuppressWarnings ( "unchecked" ) protected static List < String > invokeAndGetList ( String methodName , Object mojo ) throws Exception { return ( List < String > ) invokeGetMethod ( methodName , mojo ) ; } | Gets List field value from the given mojo based on the given method name . |
7,334 | protected static void setField ( String fieldName , Object mojo , Object value ) throws Exception { Field field = null ; try { field = mojo . getClass ( ) . getDeclaredField ( fieldName ) ; } catch ( NoSuchFieldException ex ) { field = mojo . getClass ( ) . getSuperclass ( ) . getDeclaredField ( fieldName ) ; } field . setAccessible ( true ) ; field . set ( mojo , value ) ; } | Sets the given field to the given value . This is an alternative to invoking a set method . |
7,335 | protected static Object getField ( String fieldName , Object mojo ) throws Exception { Field field = null ; try { field = mojo . getClass ( ) . getDeclaredField ( fieldName ) ; } catch ( NoSuchFieldException ex ) { field = mojo . getClass ( ) . getSuperclass ( ) . getDeclaredField ( fieldName ) ; } field . setAccessible ( true ) ; return field . get ( mojo ) ; } | Gets the value of the field . This is an alternative to invoking a get method . |
7,336 | public static boolean loadAgent ( URL agentJarURL ) throws Exception { File toolsJarFile = findToolsJar ( ) ; Class < ? > vmClass = null ; if ( toolsJarFile == null || ! toolsJarFile . exists ( ) ) { vmClass = ClassLoader . getSystemClassLoader ( ) . loadClass ( "com.sun.tools.attach.VirtualMachine" ) ; } else { vmClass = loadVirtualMachine ( toolsJarFile ) ; } if ( vmClass == null ) { return false ; } attachAgent ( vmClass , agentJarURL ) ; return true ; } | Loads agent from the given URL . |
7,337 | private static void attachAgent ( Class < ? > vmClass , URL agentJarURL ) throws Exception { String pid = getPID ( ) ; String agentAbsolutePath = new File ( agentJarURL . toURI ( ) . getSchemeSpecificPart ( ) ) . getAbsolutePath ( ) ; Object vm = getAttachMethod ( vmClass ) . invoke ( null , new Object [ ] { pid } ) ; getLoadAgentMethod ( vmClass ) . invoke ( vm , new Object [ ] { agentAbsolutePath } ) ; getDetachMethod ( vmClass ) . invoke ( vm ) ; } | Attaches jar where this class belongs to the current VirtualMachine as an agent . |
7,338 | private static Method getAttachMethod ( Class < ? > vmClass ) throws SecurityException , NoSuchMethodException { return vmClass . getMethod ( "attach" , new Class < ? > [ ] { String . class } ) ; } | Finds attach method in VirtualMachine . |
7,339 | private static Method getLoadAgentMethod ( Class < ? > vmClass ) throws SecurityException , NoSuchMethodException { return vmClass . getMethod ( "loadAgent" , new Class [ ] { String . class } ) ; } | Finds loadAgent method in VirtualMachine . |
7,340 | private static String getPID ( ) { String vmName = ManagementFactory . getRuntimeMXBean ( ) . getName ( ) ; return vmName . substring ( 0 , vmName . indexOf ( "@" ) ) ; } | Returns process id . Note that Java does not guarantee any format for id so this is just a common heuristic . |
7,341 | private static File findToolsJar ( ) { String javaHome = System . getProperty ( "java.home" ) ; File javaHomeFile = new File ( javaHome ) ; File toolsJarFile = new File ( javaHomeFile , "lib" + File . separator + TOOLS_JAR_NAME ) ; if ( ! toolsJarFile . exists ( ) ) { toolsJarFile = new File ( System . getenv ( "java_home" ) , "lib" + File . separator + TOOLS_JAR_NAME ) ; } if ( ! toolsJarFile . exists ( ) && javaHomeFile . getAbsolutePath ( ) . endsWith ( File . separator + "jre" ) ) { javaHomeFile = javaHomeFile . getParentFile ( ) ; toolsJarFile = new File ( javaHomeFile , "lib" + File . separator + TOOLS_JAR_NAME ) ; } if ( ! toolsJarFile . exists ( ) && isMac ( ) && javaHomeFile . getAbsolutePath ( ) . endsWith ( File . separator + "Home" ) ) { javaHomeFile = javaHomeFile . getParentFile ( ) ; toolsJarFile = new File ( javaHomeFile , "Classes" + File . separator + CLASSES_JAR_NAME ) ; } return toolsJarFile ; } | Finds tools . jar in JDK . |
7,342 | public Token lookahead ( ) { Token current = token ; if ( current . next == null ) { current . next = token_source . getNextToken ( ) ; } return current . next ; } | look ahead 1 token |
7,343 | protected List < JDToken > whiteSpace ( Token token ) { final List < JDToken > wss = new ArrayList < JDToken > ( ) ; Token ws = token . specialToken ; while ( ws != null ) { switch ( ws . kind ) { case WS : wss . add ( _JDWhiteSpace ( ws . image ) ) ; break ; default : } ws = ws . specialToken ; } Collections . reverse ( wss ) ; return wss ; } | Return all the comments attached to the specified token |
7,344 | public static boolean hasOperator ( final IJSExpression aExpr ) { return aExpr instanceof JSOpUnary || aExpr instanceof JSOpBinary || aExpr instanceof JSOpTernary ; } | Determine whether the top level of an expression involves an operator . |
7,345 | public static JSOpBinary band ( final IJSExpression aLeft , final IJSExpression aRight ) { return new JSOpBinary ( aLeft , "&" , aRight ) ; } | Binary - and |
7,346 | public static JSOpBinary bor ( final IJSExpression aLeft , final IJSExpression aRight ) { return new JSOpBinary ( aLeft , "|" , aRight ) ; } | Binary - or |
7,347 | public static IJSExpression cand ( final IJSExpression aLeft , final IJSExpression aRight ) { if ( aLeft == JSExpr . TRUE ) return aRight ; if ( aRight == JSExpr . TRUE ) return aLeft ; if ( aLeft == JSExpr . FALSE || aRight == JSExpr . FALSE ) return JSExpr . FALSE ; return new JSOpBinary ( aLeft , "&&" , aRight ) ; } | Logical - and |
7,348 | public static JSOpBinary xor ( final IJSExpression aLeft , final IJSExpression aRight ) { return new JSOpBinary ( aLeft , "^" , aRight ) ; } | Exclusive - or |
7,349 | public static JSOpBinary ene ( final IJSExpression aLeft , final IJSExpression aRight ) { return new JSOpBinary ( aLeft , "!==" , aRight ) ; } | exactly not equal |
7,350 | protected String determineMimeType ( final String sFilename , final IReadableResource aResource ) { return MimeTypeInfoManager . getDefaultInstance ( ) . getPrimaryMimeTypeStringForFilename ( sFilename ) ; } | Determine the MIME type of the resource to deliver . |
7,351 | public static ICommonsList < IHCNode > createPasswordConstraintTip ( final Locale aDisplayLocale ) { final ICommonsList < String > aTexts = GlobalPasswordSettings . getPasswordConstraintList ( ) . getAllPasswordConstraintDescriptions ( aDisplayLocale ) ; if ( aTexts . isEmpty ( ) ) return null ; return HCExtHelper . list2divList ( aTexts ) ; } | Create a tooltip with all the requirements for a password |
7,352 | public String onStartJob ( final ILongRunningJob aJob , final String sStartingUserID ) { ValueEnforcer . notNull ( aJob , "Job" ) ; final String sJobID = GlobalIDFactory . getNewStringID ( ) ; final LongRunningJobData aJobData = new LongRunningJobData ( sJobID , aJob . getJobDescription ( ) , sStartingUserID ) ; m_aRWLock . writeLocked ( ( ) -> m_aRunningJobs . put ( sJobID , aJobData ) ) ; return sJobID ; } | Start a long running job |
7,353 | public void onEndJob ( final String sJobID , final ESuccess eExecSucess , final LongRunningJobResult aResult ) { ValueEnforcer . notNull ( eExecSucess , "ExecSuccess" ) ; ValueEnforcer . notNull ( aResult , "Result" ) ; final LongRunningJobData aJobData = m_aRWLock . writeLocked ( ( ) -> { final LongRunningJobData ret = m_aRunningJobs . remove ( sJobID ) ; if ( ret == null ) throw new IllegalArgumentException ( "Illegal job ID '" + sJobID + "' passed!" ) ; ret . onJobEnd ( eExecSucess , aResult ) ; return ret ; } ) ; m_aResultMgr . addResult ( aJobData ) ; } | End a job . |
7,354 | public static void unregisterMetaElementFromThisRequest ( final String sMetaElementName ) { final MetaElementList aSet = _getPerRequestSet ( false ) ; if ( aSet != null ) aSet . removeMetaElement ( sMetaElementName ) ; } | Unregister an existing meta element only from this request |
7,355 | protected void fillHead ( final ISimpleWebExecutionContext aSWEC , final HCHtml aHtml ) { final IRequestWebScopeWithoutResponse aRequestScope = aSWEC . getRequestScope ( ) ; final HCHead aHead = aHtml . head ( ) ; addMetaElements ( aRequestScope , aHead ) ; } | Fill the HTML HEAD element . |
7,356 | public final EChange setType ( final EBootstrapPanelType eType ) { ValueEnforcer . notNull ( eType , "Type" ) ; if ( eType . equals ( m_eType ) ) return EChange . UNCHANGED ; removeClass ( m_eType ) ; addClass ( eType ) ; m_eType = eType ; return EChange . CHANGED ; } | Set the type . |
7,357 | public TypeaheadDataset setLimit ( final int nLimit ) { ValueEnforcer . isGT0 ( nLimit , "Limit" ) ; m_nLimit = nLimit ; return this ; } | The max number of suggestions from the dataset to display for a given query . Defaults to 5 . |
7,358 | public TypeaheadDataset setPrefetch ( final ISimpleURL aURL ) { return setPrefetch ( aURL == null ? null : new TypeaheadPrefetch ( aURL ) ) ; } | Can be a URL to a JSON file containing an array of datums or if more configurability is needed a prefetch options object . |
7,359 | public final IMPLTYPE scaleBestMatching ( final int nMaxWidth , final int nMaxHeight ) { if ( m_aExtent != null ) m_aExtent = m_aExtent . getBestMatchingSize ( nMaxWidth , nMaxHeight ) ; return thisAsT ( ) ; } | Scales the image so that neither with nor height are exceeded keeping the aspect ratio . |
7,360 | public int checkInternalMappings ( final IMenuTree aMenuTree , final Consumer < GoMappingItem > aErrorCallback ) { ValueEnforcer . notNull ( aMenuTree , "MenuTree" ) ; ValueEnforcer . notNull ( aErrorCallback , "ErrorCallback" ) ; final IRequestParameterManager aRPM = RequestParameterManager . getInstance ( ) ; int nCount = 0 ; int nErrors = 0 ; m_aRWLock . readLock ( ) . lock ( ) ; try { for ( final GoMappingItem aItem : m_aMap . values ( ) ) if ( aItem . isInternal ( ) ) { final String sParamValue = aRPM . getMenuItemFromURL ( aItem . getTargetURLReadonly ( ) , aMenuTree ) ; if ( sParamValue != null ) { ++ nCount ; if ( aMenuTree . getItemWithID ( sParamValue ) == null ) { ++ nErrors ; aErrorCallback . accept ( aItem ) ; } } } } finally { m_aRWLock . readLock ( ) . unlock ( ) ; } if ( nErrors == 0 ) LOGGER . info ( "Successfully checked " + nCount + " internal go-mappings for consistency" ) ; else LOGGER . warn ( "Checked " + nCount + " internal go-mappings for consistency and found " + nErrors + " errors!" ) ; return nErrors ; } | Check whether all internal go links that point to a page use existing menu item IDs |
7,361 | public static String getGuestUserDisplayName ( final Locale aDisplayLocale ) { ValueEnforcer . notNull ( aDisplayLocale , "DisplayLocale" ) ; return ESecurityUIText . GUEST . getDisplayText ( aDisplayLocale ) ; } | Get the display name of the guest user in the specified locale . |
7,362 | public static String getUserDisplayName ( final String sUserID , final Locale aDisplayLocale ) { if ( StringHelper . hasNoText ( sUserID ) ) return getGuestUserDisplayName ( aDisplayLocale ) ; final IUser aUser = PhotonSecurityManager . getUserMgr ( ) . getUserOfID ( sUserID ) ; return aUser == null ? sUserID : getUserDisplayName ( aUser , aDisplayLocale ) ; } | Get the display name of the user . |
7,363 | public static byte [ ] serialize ( Challenge challenge , byte [ ] hmacSecret ) { MiniMessagePack . Packer packer = new MiniMessagePack . Packer ( ) ; packer . pack ( VERSION ) ; packer . pack ( CHALLENGE_MAGIC ) ; packer . pack ( challenge . getUniqueData ( ) ) ; packer . pack ( challenge . getValidFromTimestamp ( ) ) ; packer . pack ( challenge . getValidToTimestamp ( ) ) ; packer . pack ( challenge . getFingerprint ( ) . getBytes ( ) ) ; packer . pack ( challenge . getServerName ( ) ) ; packer . pack ( challenge . getUserName ( ) ) ; byte [ ] bytes = packer . getBytes ( ) ; byte [ ] mac = getAuthenticationCode ( hmacSecret , bytes ) ; packer . pack ( mac ) ; return packer . getBytes ( ) ; } | Serialize a challenge into it s binary representation |
7,364 | public static byte [ ] serialize ( Response response ) { MiniMessagePack . Packer packer = new MiniMessagePack . Packer ( ) ; packer . pack ( VERSION ) ; packer . pack ( RESPONSE_MAGIC ) ; packer . pack ( response . getPayload ( ) ) ; packer . pack ( response . getSignature ( ) ) ; return packer . getBytes ( ) ; } | Serialize a Response into binary representation |
7,365 | private static byte [ ] getAuthenticationCode ( byte [ ] secret , byte [ ] data , int length ) { try { SecretKey secretKey = new SecretKeySpec ( secret , MAC_ALGORITHM ) ; Mac mac = Mac . getInstance ( MAC_ALGORITHM ) ; mac . init ( secretKey ) ; mac . update ( data , 0 , length ) ; return mac . doFinal ( ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } } | Calculate and return a keyed hash message authentication code HMAC as specified in RFC2104 using SHA256 as hash function . |
7,366 | public static String serializeEncodedRequest ( String username ) { MiniMessagePack . Packer packer = new MiniMessagePack . Packer ( ) ; packer . pack ( 1 ) ; packer . pack ( 'q' ) ; packer . pack ( username ) ; return ASCIICodec . encode ( packer . getBytes ( ) ) ; } | Create a request string from a username . Request is too trivial for it to make it into a class of it s own a this stage . |
7,367 | public static String deserializeRequest ( String request ) throws IllegalArgumentException , ProtocolVersionException { MiniMessagePack . Unpacker unpacker = new MiniMessagePack . Unpacker ( ASCIICodec . decode ( request ) ) ; try { parseVersionMagic ( REQUEST_MAGIC , unpacker ) ; return unpacker . unpackString ( ) ; } catch ( DeserializationException e ) { throw new IllegalArgumentException ( e . getMessage ( ) ) ; } } | Deserialize an ASCII encoded request messages and return the username string it encodes . Also verifies that the type magic value matches and that the version equals 1 . |
7,368 | private static boolean constantTimeEquals ( byte [ ] a , byte [ ] b ) { if ( a . length != b . length ) { return false ; } int result = 0 ; for ( int i = 0 ; i < a . length ; i ++ ) { result |= a [ i ] ^ b [ i ] ; } return result == 0 ; } | Checks if byte arrays a and be are equal in an algorithm that runs in constant time provided that their lengths are equal . |
7,369 | public static void setFallbackLocale ( final Locale aFallbackLocale ) { ValueEnforcer . notNull ( aFallbackLocale , "FallbackLocale" ) ; s_aRWLock . writeLocked ( ( ) -> s_aFallbackLocale = aFallbackLocale ) ; } | Set the fallback locale in case none could be determined . |
7,370 | public static void setStorageFileProvider ( final IFunction < InternalErrorMetadata , File > aStorageFileProvider ) { ValueEnforcer . notNull ( aStorageFileProvider , "StorageFileProvider" ) ; s_aStorageFileProvider = aStorageFileProvider ; } | Set the provider that defines how to build the filename to save internal error files . |
7,371 | public static void setDefaultStorageFileProvider ( ) { setStorageFileProvider ( aMetadata -> { final LocalDateTime aNow = PDTFactory . getCurrentLocalDateTime ( ) ; final String sFilename = StringHelper . getConcatenatedOnDemand ( PDTIOHelper . getLocalDateTimeForFilename ( aNow ) , "-" , aMetadata . getErrorID ( ) ) + ".xml" ; return WebFileIO . getDataIO ( ) . getFile ( "internal-errors/" + aNow . getYear ( ) + "/" + StringHelper . getLeadingZero ( aNow . getMonthValue ( ) , 2 ) + "/" + sFilename ) ; } ) ; } | Set the default storage file provider . In case you played around and want to restore the default behavior . |
7,372 | public static TriggerKey schedule ( final IScheduleBuilder < ? extends ITrigger > aScheduleBuilder , final long nThresholdBytes ) { ValueEnforcer . notNull ( aScheduleBuilder , "ScheduleBuilder" ) ; ValueEnforcer . isGE0 ( nThresholdBytes , "ThresholdBytes" ) ; final ICommonsMap < String , Object > aJobDataMap = new CommonsHashMap < > ( ) ; aJobDataMap . put ( JOB_DATA_ATTR_THRESHOLD_BYTES , Long . valueOf ( nThresholdBytes ) ) ; return GlobalQuartzScheduler . getInstance ( ) . scheduleJob ( CheckDiskUsableSpaceJob . class . getName ( ) , JDK8TriggerBuilder . newTrigger ( ) . startNow ( ) . withSchedule ( aScheduleBuilder ) , CheckDiskUsableSpaceJob . class , aJobDataMap ) ; } | Call this method to schedule the check disk usage job to run . |
7,373 | public List < StringSource > createSources ( String sourceFileName ) { return Util . list ( new StringSource ( sourceFileName , source ) ) ; } | Create a list with a single StringSource - the sourceFileName will be used as the srcInfo in the resulting Source |
7,374 | public static HC_Target getFromName ( final String sName , final HC_Target aDefault ) { if ( BLANK . getAttrValue ( ) . equalsIgnoreCase ( sName ) ) return BLANK ; if ( SELF . getAttrValue ( ) . equalsIgnoreCase ( sName ) ) return SELF ; if ( PARENT . getAttrValue ( ) . equalsIgnoreCase ( sName ) ) return PARENT ; if ( TOP . getAttrValue ( ) . equalsIgnoreCase ( sName ) ) return TOP ; return aDefault ; } | Try to find one of the default targets by name . The name comparison is performed case insensitive . |
7,375 | public IUser createPredefinedUser ( final String sID , final String sLoginName , final String sEmailAddress , final String sPlainTextPassword , final String sFirstName , final String sLastName , final String sDescription , final Locale aDesiredLocale , final Map < String , String > aCustomAttrs , final boolean bDisabled ) { ValueEnforcer . notEmpty ( sLoginName , "LoginName" ) ; ValueEnforcer . notNull ( sPlainTextPassword , "PlainTextPassword" ) ; if ( getUserOfLoginName ( sLoginName ) != null ) { AuditHelper . onAuditCreateFailure ( User . OT , "login-name-already-in-use" , sLoginName , "predefined-user" ) ; return null ; } final User aUser = new User ( sID , sLoginName , sEmailAddress , GlobalPasswordSettings . createUserDefaultPasswordHash ( new PasswordSalt ( ) , sPlainTextPassword ) , sFirstName , sLastName , sDescription , aDesiredLocale , aCustomAttrs , bDisabled ) ; m_aRWLock . writeLocked ( ( ) -> { internalCreateItem ( aUser ) ; } ) ; AuditHelper . onAuditCreateSuccess ( User . OT , aUser . getID ( ) , "predefined-user" , sLoginName , sEmailAddress , sFirstName , sLastName , sDescription , aDesiredLocale , aCustomAttrs , Boolean . valueOf ( bDisabled ) ) ; m_aCallbacks . forEach ( aCB -> aCB . onUserCreated ( aUser , true ) ) ; return aUser ; } | Create a predefined user . |
7,376 | public IUser getUserOfLoginName ( final String sLoginName ) { if ( StringHelper . hasNoText ( sLoginName ) ) return null ; return findFirst ( x -> x . getLoginName ( ) . equals ( sLoginName ) ) ; } | Get the user with the specified login name |
7,377 | public EChange deleteUser ( final String sUserID ) { final User aUser = getOfID ( sUserID ) ; if ( aUser == null ) { AuditHelper . onAuditDeleteFailure ( User . OT , "no-such-user-id" , sUserID ) ; return EChange . UNCHANGED ; } m_aRWLock . writeLock ( ) . lock ( ) ; try { if ( BusinessObjectHelper . setDeletionNow ( aUser ) . isUnchanged ( ) ) { AuditHelper . onAuditDeleteFailure ( User . OT , "already-deleted" , sUserID ) ; return EChange . UNCHANGED ; } internalMarkItemDeleted ( aUser ) ; } finally { m_aRWLock . writeLock ( ) . unlock ( ) ; } AuditHelper . onAuditDeleteSuccess ( User . OT , sUserID ) ; m_aCallbacks . forEach ( aCB -> aCB . onUserDeleted ( aUser ) ) ; return EChange . CHANGED ; } | Delete the user with the specified ID . |
7,378 | public EChange undeleteUser ( final String sUserID ) { final User aUser = getOfID ( sUserID ) ; if ( aUser == null ) { AuditHelper . onAuditUndeleteFailure ( User . OT , sUserID , "no-such-user-id" ) ; return EChange . UNCHANGED ; } m_aRWLock . writeLock ( ) . lock ( ) ; try { if ( BusinessObjectHelper . setUndeletionNow ( aUser ) . isUnchanged ( ) ) return EChange . UNCHANGED ; internalMarkItemUndeleted ( aUser ) ; } finally { m_aRWLock . writeLock ( ) . unlock ( ) ; } AuditHelper . onAuditUndeleteSuccess ( User . OT , sUserID ) ; m_aCallbacks . forEach ( aCB -> aCB . onUserUndeleted ( aUser ) ) ; return EChange . CHANGED ; } | Undelete the user with the specified ID . |
7,379 | public EChange disableUser ( final String sUserID ) { final User aUser = getOfID ( sUserID ) ; if ( aUser == null ) { AuditHelper . onAuditModifyFailure ( User . OT , sUserID , "no-such-user-id" , "disable" ) ; return EChange . UNCHANGED ; } m_aRWLock . writeLock ( ) . lock ( ) ; try { if ( aUser . setDisabled ( true ) . isUnchanged ( ) ) return EChange . UNCHANGED ; internalUpdateItem ( aUser ) ; } finally { m_aRWLock . writeLock ( ) . unlock ( ) ; } AuditHelper . onAuditModifySuccess ( User . OT , "disable" , sUserID ) ; m_aCallbacks . forEach ( aCB -> aCB . onUserEnabled ( aUser , false ) ) ; return EChange . CHANGED ; } | disable the user with the specified ID . |
7,380 | public boolean areUserIDAndPasswordValid ( final String sUserID , final String sPlainTextPassword ) { if ( sPlainTextPassword == null ) return false ; final IUser aUser = getOfID ( sUserID ) ; if ( aUser == null ) return false ; final String sPasswordHashAlgorithm = aUser . getPasswordHash ( ) . getAlgorithmName ( ) ; final IPasswordSalt aSalt = aUser . getPasswordHash ( ) . getSalt ( ) ; final PasswordHash aPasswordHash = GlobalPasswordSettings . createUserPasswordHash ( sPasswordHashAlgorithm , aSalt , sPlainTextPassword ) ; return aUser . getPasswordHash ( ) . equals ( aPasswordHash ) ; } | Check if the passed combination of user ID and password matches . |
7,381 | public static boolean isOutOfBandNode ( final IHCNode aHCNode ) { ValueEnforcer . notNull ( aHCNode , "HCNode" ) ; if ( s_aOOBNAnnotationCache . hasAnnotation ( aHCNode ) ) return true ; if ( HCHelper . isWrappedNode ( aHCNode ) ) return isOutOfBandNode ( HCHelper . getUnwrappedNode ( aHCNode ) ) ; return false ; } | Check if the passed node is an out - of - band node . |
7,382 | public static void recursiveExtractAndRemoveOutOfBandNodes ( final IHCNode aParentElement , final List < IHCNode > aTargetList ) { ValueEnforcer . notNull ( aParentElement , "ParentElement" ) ; ValueEnforcer . notNull ( aTargetList , "TargetList" ) ; _recursiveExtractAndRemoveOutOfBandNodes ( aParentElement , aTargetList , 0 ) ; } | Extract all out - of - band child nodes for the passed element . Must be called after the element is finished! All out - of - band nodes are detached from their parent so that the original node can be reused . Wrapped nodes where the inner node is an out of band node are also considered and removed . |
7,383 | public JSBlock _continue ( final JSLabel aLabel ) { addStatement ( new JSContinue ( aLabel ) ) ; return this ; } | Create a continue statement and add it to this block |
7,384 | public final APIDescriptor addRequiredHeader ( final String sHeaderName ) { if ( StringHelper . hasText ( sHeaderName ) ) m_aRequiredHeaders . add ( sHeaderName ) ; return this ; } | Add a required HTTP header . If this HTTP header is not present invocation will not be possible . |
7,385 | public final APIDescriptor addRequiredHeaders ( final String ... aHeaderNames ) { if ( aHeaderNames != null ) for ( final String sHeaderName : aHeaderNames ) addRequiredHeader ( sHeaderName ) ; return this ; } | Add one or more required HTTP headers . If one of these HTTP headers are not present invocation will not be possible . |
7,386 | public final APIDescriptor addRequiredParam ( final String sParamName ) { if ( StringHelper . hasText ( sParamName ) ) m_aRequiredParams . add ( sParamName ) ; return this ; } | Add a required request parameter . If this request parameter is not present invocation will not be possible . |
7,387 | public final APIDescriptor addRequiredParams ( final String ... aParamNames ) { if ( aParamNames != null ) for ( final String sParamName : aParamNames ) addRequiredParam ( sParamName ) ; return this ; } | Add one or more required request parameters . If one of these request parameters are not present invocation will not be possible . |
7,388 | public JQueryInvocation jqinvoke ( final String sMethod ) { return new JQueryInvocation ( this , sMethod ) ; } | Invoke an arbitrary function on this jQuery object . |
7,389 | public static HCLink createCSSLink ( final ISimpleURL aCSSURL ) { return new HCLink ( ) . setRel ( EHCLinkType . STYLESHEET ) . setType ( CMimeType . TEXT_CSS ) . setHref ( aCSSURL ) ; } | Shortcut to create a < ; link> ; element specific to CSS |
7,390 | public static JADT standardConfigDriver ( ) { logger . fine ( "Using standard configuration." ) ; final SourceFactory sourceFactory = new FileSourceFactory ( ) ; final ClassBodyEmitter classBodyEmitter = new StandardClassBodyEmitter ( ) ; final ConstructorEmitter constructorEmitter = new StandardConstructorEmitter ( classBodyEmitter ) ; final DataTypeEmitter dataTypeEmitter = new StandardDataTypeEmitter ( classBodyEmitter , constructorEmitter ) ; final DocEmitter docEmitter = new StandardDocEmitter ( dataTypeEmitter ) ; final Parser parser = new StandardParser ( new JavaCCParserImplFactory ( ) ) ; final Checker checker = new StandardChecker ( ) ; final SinkFactoryFactory factoryFactory = new FileSinkFactoryFactory ( ) ; return new JADT ( sourceFactory , parser , checker , docEmitter , factoryFactory ) ; } | Convenient factory method to create a complete standard configuration |
7,391 | public void parseAndEmit ( String [ ] args ) { logger . finest ( "Checking command line arguments." ) ; if ( args . length != 2 ) { final String version = new Version ( ) . getVersion ( ) ; logger . info ( "jADT version " + version + "." ) ; logger . info ( "Not enough arguments provided to jADT" ) ; logger . info ( "usage: java sfdc.adt.JADT [source file or directory with .jadt files] [output directory]" ) ; throw new IllegalArgumentException ( "\njADT version " + version + "\nusage: java sfdc.adt.JADT [source file or directory with .jadt files] [output directory]" ) ; } final String srcPath = args [ 0 ] ; final String destDirName = args [ 1 ] ; parseAndEmit ( srcPath , destDirName ) ; } | Do the jADT thing based on an array of String args . There must be 2 and the must be the source file and destination directory |
7,392 | public void parseAndEmit ( String srcPath , final String destDir ) { final String version = new Version ( ) . getVersion ( ) ; logger . info ( "jADT version " + version + "." ) ; logger . info ( "Will read from source " + srcPath ) ; logger . info ( "Will write to destDir " + destDir ) ; final List < ? extends Source > sources = sourceFactory . createSources ( srcPath ) ; for ( Source source : sources ) { final List < UserError > errors = new ArrayList < UserError > ( ) ; final ParseResult result = parser . parse ( source ) ; for ( SyntaxError error : result . errors ) { errors . add ( UserError . _Syntactic ( error ) ) ; } final List < SemanticError > semanticErrors = checker . check ( result . doc ) ; for ( SemanticError error : semanticErrors ) { errors . add ( UserError . _Semantic ( error ) ) ; } if ( ! errors . isEmpty ( ) ) { throw new JADTUserErrorsException ( errors ) ; } emitter . emit ( factoryFactory . createSinkFactory ( destDir ) , result . doc ) ; } } | Do the jADT thing given the srceFileName and destination directory |
7,393 | public static JADT createDummyJADT ( List < SyntaxError > syntaxErrors , List < SemanticError > semanticErrors , String testSrcInfo , SinkFactoryFactory factory ) { final SourceFactory sourceFactory = new StringSourceFactory ( TEST_STRING ) ; final Doc doc = new Doc ( TEST_SRC_INFO , Pkg . _Pkg ( NO_COMMENTS , "pkg" ) , Util . < Imprt > list ( ) , Util . < DataType > list ( ) ) ; final ParseResult parseResult = new ParseResult ( doc , syntaxErrors ) ; final DocEmitter docEmitter = new DummyDocEmitter ( doc , TEST_CLASS_NAME ) ; final Parser parser = new DummyParser ( parseResult , testSrcInfo , TEST_STRING ) ; final Checker checker = new DummyChecker ( semanticErrors ) ; final JADT jadt = new JADT ( sourceFactory , parser , checker , docEmitter , factory ) ; return jadt ; } | Create a dummy configged jADT based on the provided syntaxErrors semanticErrors testSrcInfo and sink factory Useful for testing |
7,394 | private boolean hasHashChanged ( Set < RegData > regData ) { for ( RegData el : regData ) { if ( hasHashChanged ( mHasher , el ) ) { return true ; } } return false ; } | Check if any element of the given set has changed . |
7,395 | protected final boolean hasHashChanged ( Hasher hasher , RegData regDatum ) { String urlExternalForm = regDatum . getURLExternalForm ( ) ; String newHash = hasher . hashURL ( urlExternalForm ) ; boolean anyDiff = ! newHash . equals ( regDatum . getHash ( ) ) ; return anyDiff ; } | Check if the given datum has changed using the given hasher . |
7,396 | public TypeaheadRemote setCache ( final ETriState eCache ) { m_eCache = ValueEnforcer . notNull ( eCache , "Cache" ) ; return this ; } | Determines whether or not the browser will cache responses . See the jQuery . ajax docs for more info . |
7,397 | public PhotonGlobalState setDefaultApplicationID ( final String sDefaultApplicationID ) { m_aRWLock . writeLocked ( ( ) -> { if ( ! EqualsHelper . equals ( m_sDefaultApplicationID , sDefaultApplicationID ) ) { m_sDefaultApplicationID = sDefaultApplicationID ; if ( LOGGER . isInfoEnabled ( ) ) LOGGER . info ( "Default application ID set to '" + sDefaultApplicationID + "'" ) ; } } ) ; return this ; } | Set the default application ID of an application servlet . |
7,398 | public HCNodeList createSelectedFileEdit ( final String sPlaceholder ) { final HCEdit aEdit = new HCEdit ( ) . setPlaceholder ( sPlaceholder ) . setReadOnly ( true ) ; final HCScriptInline aScript = new HCScriptInline ( JQuery . idRef ( m_aEdit ) . on ( "change" , new JSAnonymousFunction ( JQuery . idRef ( aEdit ) . val ( JSExpr . THIS . ref ( "value" ) ) ) ) ) ; return new HCNodeList ( ) . addChildren ( aEdit , aScript ) ; } | Create a read only edit that contains the value of the selected file . It can be placed anywhere in the DOM . |
7,399 | public FineUploader5DeleteFile setEndpoint ( final ISimpleURL aEndpoint ) { ValueEnforcer . notNull ( aEndpoint , "Endpoint" ) ; m_aDeleteFileEndpoint = aEndpoint ; return this ; } | The endpoint to which delete file requests are sent . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.