idx int64 0 41.2k | question stringlengths 74 4.21k | target stringlengths 5 888 |
|---|---|---|
14,700 | protected synchronized Response netCall ( Request request , int timeout ) { Response response = null ; if ( serverCaps != null && serverCaps . isDebugMode ( ) ) { timeout = 0 ; } try { socket . setSoTimeout ( timeout ) ; DataOutputStream requestPacket = new DataOutputStream ( new BufferedOutputStream ( socket . getOutp... | Issues a request to the server returning the response . |
14,701 | public void addHostEventHandler ( IHostEventHandler hostEventHandler ) { synchronized ( hostEventHandlers ) { if ( ! hostEventHandlers . contains ( hostEventHandler ) ) { hostEventHandlers . add ( hostEventHandler ) ; } } } | Adds an event handler for background polling events . |
14,702 | protected void onRPCError ( int asyncHandle , int asyncError , String text ) { IAsyncRPCEvent callback = getCallback ( asyncHandle ) ; if ( callback != null ) { callback . onRPCError ( asyncHandle , asyncError , text ) ; } } | Invokes the callback for the specified handle when an error is encountered during an asynchronous RPC call . |
14,703 | protected void onRPCComplete ( int asyncHandle , String data ) { IAsyncRPCEvent callback = getCallback ( asyncHandle ) ; if ( callback != null ) { callback . onRPCComplete ( asyncHandle , data ) ; } } | Invokes the callback for the specified handle upon successful completion of an asynchronous RPC call . |
14,704 | public void setSerializationMethod ( SerializationMethod serializationMethod ) { if ( serializationMethod == SerializationMethod . NULL ) { throw new IllegalArgumentException ( "Invalid serialization method." ) ; } this . serializationMethod = serializationMethod == null ? SerializationMethod . JSON : serializationMeth... | Sets the serialization method to be used when sending objects . |
14,705 | public static Validator getExperimentalValidator ( ) { return CascadingValidator . create ( ParenthesesValidator . INSTANCE , ConfigurableValidator . create ( ValidatorConfiguration . createExperimental ( ) ) ) ; } | This validator includes support for the experimental gdl keyword and associated GDL variants . |
14,706 | public < T > void handleEvent ( final T event ) throws EventException { final Class < ? > type = event . getClass ( ) ; if ( ! this . cachedListeners . containsKey ( event . getClass ( ) ) ) { this . cachedListeners . put ( type , new LinkedList < ListenerInstancePair < ? > > ( ) ) ; for ( final ListenerInstancePair < ... | Handle an event . |
14,707 | public Dimension getPreferredSize ( ) { if ( this . getParent ( ) != null ) return new Dimension ( this . getParent ( ) . getWidth ( ) / 3 , super . getPreferredSize ( ) . height ) ; return super . getPreferredSize ( ) ; } | Preferred panel size . |
14,708 | private String removeAbsoluteRootPathElement ( String xPath ) { String trimmedXpath = xPath ; if ( xPath . startsWith ( "/" ) && xPath . charAt ( 1 ) != '/' ) { trimmedXpath = xPath . substring ( 1 ) ; } return trimmedXpath ; } | we stop absolute queries on sub - roots from failing |
14,709 | private void injectInto ( final Object target , final boolean oneMatch ) throws AssertionError { boolean success = false ; for ( final Field field : this . collectFieldCandidates ( target ) ) { if ( this . isMatching ( field ) ) { Object val = getValue ( field ) ; try { field . setAccessible ( true ) ; this . inject ( ... | Injects the value of the Injection into the target . |
14,710 | private List < Field > collectFieldCandidates ( final Object target ) { final Class < ? > targetClass = target . getClass ( ) ; return this . collectFieldCandidates ( this . value , targetClass ) ; } | Determines all fields that are candidates for the injection as their type is compatible with the injected object . The method checks the target objects type and supertypes for declared fields . |
14,711 | private List < Field > collectFieldCandidates ( final Object injectedValue , final Class < ? > targetClass ) { final List < Field > fieldCandidates = new ArrayList < > ( ) ; Class < ? > current = targetClass ; while ( current != Object . class ) { fieldCandidates . addAll ( this . collectionDeclaredFieldCandidates ( in... | Collects all matching declared fields of the target class and returns the result as a list . |
14,712 | private boolean isNullOrMatchingType ( final Object injectedValue , final Field field ) { if ( injectedValue == null ) { return true ; } final Class < ? > fieldType = field . getType ( ) ; final Class < ? > valueType = injectedValue . getClass ( ) ; if ( fieldType . isPrimitive ( ) ) { return fieldType == primitiveType... | Checks if the specified value is either null or compatible with the field . Compatibility is verified based on inheritance or primitive - type compatibility . |
14,713 | private List < Field > collectionDeclaredFieldCandidates ( final Object injectedValue , final Class < ? > targetClass ) { final List < Field > fieldCandidates = new ArrayList < > ( ) ; for ( final Field field : targetClass . getDeclaredFields ( ) ) { if ( this . isFieldCandidate ( field , injectedValue ) ) { fieldCandi... | Collects all declared fields from the targetClass that are type - compatible with the class of the injected value into the fieldCandidates list . |
14,714 | public static Set < Field > getDeclaredFields ( Class < ? > clazz , FieldFilter filter ) { Set < Field > fields = new HashSet < Field > ( ) ; Field [ ] allFields = clazz . getDeclaredFields ( ) ; for ( Field field : allFields ) { if ( filter . passFilter ( field ) ) { fields . add ( field ) ; } } return fields ; } | Returns a set of all fields matching the supplied filter declared in the clazz class . |
14,715 | public Record moveRecordToBase ( Record record ) { SharedBaseRecordTable sharedTable = this . getSharedTable ( ) ; sharedTable . setCurrentRecord ( record ) ; boolean bCopyEditMode = false ; boolean bOnlyModifiedFields = false ; Record recBase = sharedTable . getBaseRecord ( ) ; sharedTable . copyRecordInfo ( recBase ,... | Copy this record to the base table . |
14,716 | public static < T , R , V > Function < T , V > compose ( final Function < T , R > first , final Function < ? super R , ? extends V > second ) { return new Function < T , V > ( ) { public V apply ( T argument ) { return second . apply ( first . apply ( argument ) ) ; } } ; } | Create a function that uses the result of the first function as the input to the second . |
14,717 | public static < F , S , R , V > BiFunction < F , S , V > andThen ( final BiFunction < F , S , R > first , final Function < ? super R , ? extends V > second ) { return new BiFunction < F , S , V > ( ) { public V apply ( F f , S s ) { return second . apply ( first . apply ( f , s ) ) ; } } ; } | Compose a BiFunction which applies a Function to the result of another BiFunction . |
14,718 | public static < T > Consumer < T > andThen ( final Consumer < T > first , final Consumer < T > second ) { return new Consumer < T > ( ) { public void accept ( T consumable ) { first . accept ( consumable ) ; second . accept ( consumable ) ; } } ; } | Compose a new consumer from two existing ones . The consumable will be passed to the first then the second . |
14,719 | public static final void xmlConfig ( File configFile ) throws IOException { try { JAXBContext jaxbCtx = JAXBContext . newInstance ( "org.vesalainen.util.jaxb" ) ; Unmarshaller unmarshaller = jaxbCtx . createUnmarshaller ( ) ; JavaLoggingConfig javaLoggingConfig = ( JavaLoggingConfig ) unmarshaller . unmarshal ( configF... | Configures logging from xml file . |
14,720 | public static final Set < String > impliedSet ( String ... views ) { Set < String > set = new HashSet < > ( ) ; for ( String view : views ) { set . addAll ( impliesMap . get ( view ) ) ; } return set ; } | Returns a set that contains given views as well as all implied views . |
14,721 | public void removeAll ( ) { if ( m_gridList != null ) m_gridList . removeAll ( ) ; if ( m_gridBuffer != null ) m_gridBuffer . removeAll ( ) ; if ( m_gridNew != null ) m_gridNew . removeAll ( ) ; m_iEndOfFileIndex = UNKNOWN_POSITION ; m_iPhysicalFilePosition = UNKNOWN_POSITION ; m_iLogicalFilePosition = UNKNOWN_POSITION... | Free the buffers in this grid table . |
14,722 | public void addRecordReference ( int iTargetPosition ) { DataRecord bookmark = this . getNextTable ( ) . getDataRecord ( m_bCacheRecordData , BaseBuffer . SELECTED_FIELDS ) ; m_gridBuffer . addElement ( iTargetPosition , bookmark , m_gridList ) ; } | Add this record s unique info to the end of the recordset . The current record is at this logical position cache it . |
14,723 | private int lowestNonNullIndex ( int iTargetPosition ) { Object bookmark = null ; int iBookmarkIndex = iTargetPosition ; while ( bookmark == null ) { int iArrayIndex = m_gridList . listToArrayIndex ( iBookmarkIndex ) ; iBookmarkIndex = m_gridList . arrayToListIndex ( iArrayIndex ) ; bookmark = m_gridList . elementAt ( ... | Search backwards from this position for the first non - null value . |
14,724 | public int findElement ( Object bookmark , int iHandleType ) { if ( bookmark == null ) return - 1 ; int iTargetPosition = m_gridBuffer . findElement ( bookmark , iHandleType ) ; if ( iTargetPosition == - 1 ) iTargetPosition = m_gridList . findElement ( bookmark , iHandleType ) ; return iTargetPosition ; } | Find this bookmark in one of the lists . |
14,725 | public boolean seek ( String strSeekSign ) throws DBException { boolean bAutonomousSeek = false ; if ( m_iEndOfFileIndex == UNKNOWN_POSITION ) if ( ( m_iPhysicalFilePosition == UNKNOWN_POSITION ) || ( m_iPhysicalFilePosition == ADD_NEW_POSITION ) ) if ( ( m_iLogicalFilePosition == UNKNOWN_POSITION ) || ( m_iLogicalFile... | Read the record that matches this record s current key . For a GridTable this method calls the inherited seek . |
14,726 | public int addNewBookmark ( Object bookmark , int iHandleType ) { if ( bookmark == null ) return - 1 ; if ( iHandleType != DBConstants . DATA_SOURCE_HANDLE ) { DataRecord dataRecord = new DataRecord ( null ) ; dataRecord . setHandle ( bookmark , iHandleType ) ; bookmark = dataRecord ; } int iIndexAdded = m_iEndOfFileIn... | Here is a bookmark for a brand new record add it to the end of the list . |
14,727 | public int updateGridToMessage ( BaseMessage message , boolean bReReadMessage , boolean bAddIfNotFound ) { Record record = this . getRecord ( ) ; int iHandleType = DBConstants . BOOKMARK_HANDLE ; if ( this . getNextTable ( ) instanceof org . jbundle . base . db . shared . MultiTable ) iHandleType = DBConstants . FULL_O... | Use this record update notification to update this gridtable . |
14,728 | public String getTitle ( ComponentParent screenMain ) { String strScreenTitle = DBConstants . BLANK ; if ( screenMain != null ) strScreenTitle = screenMain . getTitle ( ) ; return strScreenTitle ; } | Get the default title for this screen . Calls the getTitle method of this screen . |
14,729 | protected < T > T createProxy ( Class < T > interfaceClass , Session session ) throws Exception { return configBean . getConfig ( ) . getStoredProcedureProxyFactory ( ) . getProxy ( interfaceClass , session ) ; } | Creates data proxy of specified class for specified session . |
14,730 | protected < T > T createProxy ( Class < T > interfaceClass ) throws Exception { return createProxy ( interfaceClass , getSession ( ) ) ; } | Creates data proxy of specified class for current invocation SQL session . |
14,731 | protected Response ok ( Object entity ) { entity = mapResponseEntity ( entity ) ; return buildResponse ( Response . ok ( entity ) ) ; } | This is shorthand method for simple response 200 OK with entity . |
14,732 | protected Response ok ( List < Object > entityList ) { for ( int i = 0 ; i < entityList . size ( ) ; i ++ ) { entityList . set ( i , mapResponseEntity ( entityList . get ( i ) ) ) ; } return buildResponse ( Response . ok ( entityList ) ) ; } | This is shorthand method for simple response 200 OK with list of entities . |
14,733 | public int fieldChanged ( boolean bDisplayOption , int iMoveMode ) { boolean flag = this . getOwner ( ) . getState ( ) ; if ( flag ) m_mergeRecord . getTable ( ) . addTable ( m_subRecord . getTable ( ) ) ; else m_mergeRecord . getTable ( ) . removeTable ( m_subRecord . getTable ( ) ) ; m_mergeRecord . close ( ) ; if ( ... | The Field has Changed . If this field is true add the table back to the grid query and requery the grid table . |
14,734 | private static Object toPrimitive ( final String value , final Class < ? > type ) { final Class < ? > objectType = objectTypeFor ( type ) ; final Object objectValue = valueOf ( value , objectType ) ; final Object primitiveValue ; final String toValueMethodName = type . getSimpleName ( ) + "Value" ; try { final Method t... | Converts the given value to it s given primitive type . |
14,735 | private static Object valueOf ( final String value , final Class < ? > objectType ) { if ( objectType == Character . class ) { return value . charAt ( 0 ) ; } try { final Constructor < ? > constructor = objectType . getConstructor ( String . class ) ; return constructor . newInstance ( value ) ; } catch ( Instantiation... | Converts the given String value to a object type . The method assumes the object type has a constructor accepting a single String representation of the content . |
14,736 | public static final String decode ( String str ) { Matcher m = ENT . matcher ( str ) ; StringBuffer sb = new StringBuffer ( ) ; while ( m . find ( ) ) { String entity = m . group ( 1 ) ; Matcher m2 = HENT . matcher ( entity ) ; Integer codePoint = null ; if ( m2 . matches ( ) ) { codePoint = Integer . parseInt ( m2 . g... | Decodes String from HTML format . & ; - > ; & ; |
14,737 | public void log ( int iUserID , int iUserLogTypeID , String strMessage ) { try { this . addNew ( ) ; this . getField ( UserLog . USER_ID ) . setValue ( iUserID ) ; this . getField ( UserLog . USER_LOG_TYPE_ID ) . setValue ( iUserLogTypeID ) ; this . getField ( UserLog . MESSAGE ) . setString ( strMessage ) ; this . add... | Add this log entry . |
14,738 | public static OWLValueObject buildFromObject ( OWLModel model , Object object ) throws NotYetImplementedException , OWLTranslationException { return buildFromClasAndObject ( model , OWLURIClass . from ( object ) , object ) ; } | Builds an instance from a given object |
14,739 | public static OWLValueObject buildFromCollection ( OWLModel model , Collection col ) throws NotYetImplementedException , OWLTranslationException { if ( col . isEmpty ( ) ) { return null ; } return buildFromClasAndCollection ( model , OWLURIClass . from ( col . iterator ( ) . next ( ) ) , col ) ; } | Builds an instance from a given collection |
14,740 | private Bitmap decodeFile ( File f ) { try { BitmapFactory . Options o = new BitmapFactory . Options ( ) ; o . inJustDecodeBounds = true ; BitmapFactory . decodeStream ( new FileInputStream ( f ) , null , o ) ; final int REQUIRED_SIZE = 70 ; int width_tmp = o . outWidth , height_tmp = o . outHeight ; int scale = 1 ; wh... | decodes image and scales it to reduce memory consumption |
14,741 | public GetIndividualProfilesRequest withIndividualId ( final int id ) { this . id = id ; this . password = new char [ 0 ] ; this . login = this . accountNumber = this . routingNumber = null ; return this ; } | Request the IndividualProfile for the given individual id . |
14,742 | public GetIndividualProfilesRequest withLoginPassword ( final String login , final char [ ] password ) { this . login = login ; this . password = password ; this . id = 0 ; this . accountNumber = this . routingNumber = null ; return this ; } | Request the IndividualProfile for the given login and password . |
14,743 | public GetIndividualProfilesRequest withMICR ( final String routingNumber , final String accountNumber ) { this . routingNumber = routingNumber ; this . accountNumber = accountNumber ; return this ; } | Request the IndividualProfile for the given bank account information . |
14,744 | public void traverse ( X x , Function < ? super X , ? extends Collection < X > > edges ) { traverseS ( x , ( y ) -> edges . apply ( y ) . stream ( ) ) ; } | This algorithm traverses all vertices and all edges once . |
14,745 | public Map < String , Object > getProperties ( ) { Map < String , Object > properties = ( ( PropertiesField ) this . getField ( CalendarEntry . PROPERTIES ) ) . getProperties ( ) ; if ( ! this . getField ( Anniversary . ANNIV_MASTER_ID ) . isNull ( ) ) if ( this . getField ( Anniversary . ANNIV_MASTER_ID ) instanceof R... | Get the properties from the Properties field and merge with the properties from the Master field if it exists . |
14,746 | public Object getStartIcon ( ) { Object iconStart = null ; Record recCalendarCategory = ( ( ReferenceField ) this . getField ( CalendarEntry . CALENDAR_CATEGORY_ID ) ) . getReference ( ) ; if ( ( recCalendarCategory == null ) || ( recCalendarCategory . getEditMode ( ) != DBConstants . EDIT_CURRENT ) ) if ( this . getFi... | Get the icon for the screen display . |
14,747 | @ SuppressWarnings ( "rawtypes" ) public static < S > ServiceLoader load ( final Class < S > service ) { return load ( service , Thread . currentThread ( ) . getContextClassLoader ( ) ) ; } | Creates a new service loader for the given service type using the current thread s context class loader . |
14,748 | public boolean execute ( Properties properties ) { if ( this . getEditMode ( ) == DBConstants . EDIT_IN_PROGRESS ) { try { this . writeAndRefresh ( ) ; } catch ( DBException ex ) { ex . printStackTrace ( ) ; } } if ( this . getEditMode ( ) != DBConstants . EDIT_CURRENT ) return false ; RunScriptProcess process = new Ru... | Execute Method . |
14,749 | public Record getTargetRecord ( Map < String , Object > properties , String strParam ) { String strRecordName = ( String ) properties . get ( strParam ) ; Record record = null ; if ( ( strRecordName != null ) && ( strRecordName . length ( ) > 0 ) ) { String strTableName = strRecordName ; if ( strTableName . indexOf ( '... | GetTargetRecord Method . |
14,750 | public String getProperty ( String strKey ) { return ( ( PropertiesField ) this . getField ( Script . PROPERTIES ) ) . getProperty ( strKey ) ; } | GetProperty Method . |
14,751 | public Script getSubScript ( ) { if ( m_recSubScript == null ) { RecordOwner recordOwner = this . findRecordOwner ( ) ; m_recSubScript = new Script ( recordOwner ) ; recordOwner . removeRecord ( m_recSubScript ) ; m_recSubScript . addListener ( new SubFileFilter ( this ) ) ; } return m_recSubScript ; } | Create a record to read through this script s children . |
14,752 | public static < T > Maker < T > cycle ( T first , T ... rest ) { ImmutableList < T > values = ImmutableList . < T > builder ( ) . add ( first ) . add ( rest ) . build ( ) ; return new RangeValuesMaker < T > ( Iterables . cycle ( values ) . iterator ( ) ) ; } | Factory method . Given a list of values and the produced maker will cycle them infinitely . |
14,753 | public static < T > Maker < T > errorOnEnd ( T first , T ... rest ) { ImmutableList < T > values = ImmutableList . < T > builder ( ) . add ( first ) . add ( rest ) . build ( ) ; return new RangeValuesMaker < T > ( values . iterator ( ) ) ; } | Factory method . Given a list of values and the produced maker will exhaust them before throwing an exception . |
14,754 | @ SuppressWarnings ( "unchecked" ) public void init ( ) throws ServletException { ServletConfig config = getServletConfig ( ) ; try { final Grammar root = XmlGrammar . getMainGrammar ( ) ; final InputStream inpt = CernunnosServlet . class . getResourceAsStream ( "servlet.grammar" ) ; final Document doc = new SAXReader ... | Don t declare as static in general libraries |
14,755 | @ BeforeSuite ( alwaysRun = true ) @ Parameters ( value = { "parameters" } ) public static void startSelenium ( String parameters ) { parametersMap = parameterScanner ( parameters ) ; parametersInfo ( ) ; String browserName = parametersMap . get ( "browser" ) , profile = parametersMap . get ( "profile" ) , chromeDriver... | This method starts the selenium remote control using the parameters informed by testng . xml file |
14,756 | @ AfterSuite ( alwaysRun = true ) public static void closeSelenium ( ) { if ( driver != null ) { driver . quit ( ) ; driver = null ; } } | Close the driver . It ll close the browsers window and stop the selenium RC . |
14,757 | public static < T > T [ ] recoveredValueASArray ( Class < T > type , String properties ) throws ExecutionException { LOGGER . info ( String . format ( "Recovered propeties [%s] as [%s]" , properties , type ) ) ; String [ ] stringParseProperties = properties . replaceAll ( "\\s+" , "" ) . replaceAll ( "\\[" , "" ) . rep... | This method recovered the array of properties . |
14,758 | public static < T > T recoveredValue ( Class < T > type , String properties ) throws ExecutionException { return recoveredValueASArray ( type , properties ) [ 0 ] ; } | This method recovered the property . |
14,759 | public static final void init ( ) { String settingDir = System . getProperty ( SETTINGS_DIR ) ; if ( settingDir == null ) { settingDir = System . getenv ( SETTINGS_DIR ) ; } if ( settingDir == null ) { throw Fault . create ( SettingsFaultCodes . SettingsDirNotSpecified , SETTINGS_DIR ) ; } init ( settingDir ) ; } | load the files from - Dcom . pahakia . settings . dir = directory |
14,760 | public void updateGroupPermission ( int iGroupID ) { if ( m_recUserPermission == null ) m_recUserPermission = new UserPermission ( this . getOwner ( ) . findRecordOwner ( ) ) ; Record m_recUserGroup = ( ( ReferenceField ) m_recUserPermission . getField ( UserPermission . USER_GROUP_ID ) ) . getReferenceRecord ( ) ; m_r... | UpdateGroupPermission Method . |
14,761 | public boolean inMap ( Location location ) { for ( String map : schedule . getMap ( ) ) { if ( station . inMap ( map , location ) ) { return true ; } } return false ; } | Returns true if location is inside map . |
14,762 | public void init ( Object env , Map < String , Object > properties , Object applet ) { super . init ( env , properties , applet ) ; } | Initializes the ServletApplication . Usually you pass the object that wants to use this session . For example the applet or ServletApplication . |
14,763 | public void valueUnbound ( HttpSessionBindingEvent event ) { Utility . getLogger ( ) . info ( "Session Unbound" ) ; if ( this . getMainTask ( ) == null ) this . free ( ) ; else Utility . getLogger ( ) . severe ( "Unbound error ServletApplication.valueUnbound" ) ; } | Notifies the object that is being unbound from a session and identifies the session . |
14,764 | public static boolean isSynchronized ( final AcraReport pReport , final Issue pIssue ) throws IssueParseException { final IssueDescriptionReader reader = new IssueDescriptionReader ( pIssue ) ; return CollectionUtils . exists ( reader . getOccurrences ( ) , new ReportPredicate ( pReport ) ) ; } | Gets wheter or not the given report has already been synchronized with the given issue . |
14,765 | public int getNumWarnings ( ) { int numWarnings = 0 ; if ( getBuildData ( ) . getErrorDatabase ( ) != null && getBuildData ( ) . getErrorDatabase ( ) . getErrors ( getBuildData ( ) . getBuildLocale ( ) ) != null ) { for ( final TopicErrorData errorData : getBuildData ( ) . getErrorDatabase ( ) . getErrors ( getBuildDat... | Gets the number of warnings that occurred during the last build . |
14,766 | public int getNumErrors ( ) { int numErrors = 0 ; if ( getBuildData ( ) . getErrorDatabase ( ) != null && getBuildData ( ) . getErrorDatabase ( ) . getErrors ( getBuildData ( ) . getBuildLocale ( ) ) != null ) { for ( final TopicErrorData errorData : getBuildData ( ) . getErrorDatabase ( ) . getErrors ( getBuildData ( ... | Gets the number of errors that occurred during the last build . |
14,767 | protected void pullTranslations ( final ContentSpec contentSpec , final String locale ) throws BuildProcessingException { final CollectionWrapper < TranslatedContentSpecWrapper > translatedContentSpecs = providerFactory . getProvider ( TranslatedContentSpecProvider . class ) . getTranslatedContentSpecsWithQuery ( "quer... | Get the translations from the REST API and replace the original strings with the values downloaded . |
14,768 | protected void setTranslationUniqueIds ( final ContentSpec contentSpec , final TranslatedContentSpecWrapper translatedContentSpec ) throws BuildProcessingException { final List < TranslatedCSNodeWrapper > translatedCSNodes = translatedContentSpec . getTranslatedNodes ( ) . getItems ( ) ; for ( final TranslatedCSNodeWra... | Sets the Translation Unique Ids on all the content spec nodes that have a matching translated node . |
14,769 | @ SuppressWarnings ( "unchecked" ) protected void validateTopicLinks ( final BuildData buildData , final Set < String > bookIdAttributes ) throws BuildProcessingException { final List < SpecTopic > topics = buildData . getBuildDatabase ( ) . getAllSpecTopics ( ) ; final Set < Integer > processedTopics = new HashSet < I... | Validate all the book links in the each topic to ensure that they exist somewhere in the book . If they don t then the topic XML is replaced with a generic error template . |
14,770 | @ SuppressWarnings ( "unchecked" ) private void doPopulateDatabasePass ( final BuildData buildData ) throws BuildProcessingException { log . info ( "Doing " + buildData . getBuildLocale ( ) + " Populate Database Pass" ) ; final ContentSpec contentSpec = buildData . getContentSpec ( ) ; final Map < String , BaseTopicWra... | Populates the SpecTopicDatabase with the SpecTopics inside the content specification . It also adds the equivalent real topics to each SpecTopic . |
14,771 | private void populateTranslatedTopicDatabase ( final BuildData buildData , final Map < String , BaseTopicWrapper < ? > > translatedTopics ) throws BuildProcessingException { final List < ITopicNode > topicNodes = buildData . getContentSpec ( ) . getAllTopicNodes ( ) ; final int showPercent = 10 ; final float total = to... | Gets the translated topics from the REST Interface and also creates any dummy translations for topics that have yet to be translated . |
14,772 | private TranslatedTopicWrapper createDummyTranslatedTopicFromExisting ( final TranslatedTopicWrapper translatedTopic , final LocaleWrapper locale ) { translatedTopic . getTags ( ) ; translatedTopic . getProperties ( ) ; final TranslatedTopicWrapper defaultLocaleTranslatedTopic = translatedTopic . clone ( false ) ; defa... | Creates a dummy translated topic from an existing translated topic so that a book can be built using the same relationships as a normal build . |
14,773 | private Document mergeAdditionalTranslatedXML ( BuildData buildData , final Document topicDoc , final TranslatedTopicWrapper translatedTopic , final TopicType topicType ) throws BuildProcessingException { Document retValue = topicDoc ; if ( ! isNullOrEmpty ( translatedTopic . getTranslatedAdditionalXML ( ) ) ) { Docume... | Merges the Additional Translated XML of a Translated Topic into the original Topic XML content . |
14,774 | protected void processConditions ( final BuildData buildData , final SpecTopic specTopic , final Document doc ) { final String condition = specTopic . getConditionStatement ( true ) ; DocBookUtilities . processConditions ( condition , doc , BuilderConstants . DEFAULT_CONDITION ) ; } | Checks if the conditional pass should be performed . |
14,775 | protected void doLinkSecondPass ( final BuildData buildData , final Map < SpecTopic , Set < String > > usedIdAttributes ) throws BuildProcessingException { final List < SpecTopic > topics = buildData . getBuildDatabase ( ) . getAllSpecTopics ( ) ; for ( final SpecTopic specTopic : topics ) { final Document doc = specTo... | Fixes any topics links that have been broken due to the linked topics XML being invalid . |
14,776 | protected boolean processSpecTopicInjectionErrors ( final BuildData buildData , final BaseTopicWrapper < ? > topic , final List < String > customInjectionErrors ) { boolean valid = true ; if ( ! customInjectionErrors . isEmpty ( ) ) { final String message = "Topic has referenced Topic/Level(s) " + CollectionUtilities .... | Process the Injection Errors and add them to the Error Database . |
14,777 | protected void addBookBaseFilesAndImages ( final BuildData buildData ) throws BuildProcessingException { final String pressgangWebsiteJS = buildPressGangWebsiteJS ( buildData ) ; addToZip ( buildData . getBookImagesFolder ( ) + "icon.svg" , ResourceUtilities . resourceFileToByteArray ( "/" , "icon.svg" ) , buildData ) ... | Adds the basic Images and Files to the book that are the minimum requirements to build it . |
14,778 | protected void buildBookPreface ( final BuildData buildData ) throws BuildProcessingException { final ContentSpec contentSpec = buildData . getContentSpec ( ) ; if ( contentSpec . getUseDefaultPreface ( ) ) { final Map < String , String > overrides = buildData . getBuildOptions ( ) . getOverrides ( ) ; final Map < Stri... | Builds the Preface . xml file for the book . |
14,779 | protected String buildBookEntityFile ( final BuildData buildData ) throws BuildProcessingException { final ContentSpec contentSpec = buildData . getContentSpec ( ) ; final StringBuilder retValue = new StringBuilder ( ) ; if ( ! buildData . getBuildOptions ( ) . getUseOldBugLinks ( ) && buildData . getBuildOptions ( ) .... | Builds the book . ent file that is a basic requirement to build the book . |
14,780 | protected void setUpRootElement ( final BuildData buildData , final Level level , final Document doc , Element ele ) { final Element titleNode = doc . createElement ( "title" ) ; if ( buildData . isTranslationBuild ( ) && ! isNullOrEmpty ( level . getTranslatedTitle ( ) ) ) { titleNode . setTextContent ( DocBookUtiliti... | Sets up an elements title info and id based on the passed level . |
14,781 | protected String createTopicXMLFile ( final BuildData buildData , final SpecTopic specTopic , final String parentFileLocation ) throws BuildProcessingException { String topicFileName ; final BaseTopicWrapper < ? > topic = specTopic . getTopic ( ) ; if ( topic != null ) { topicFileName = specTopic . getUniqueLinkId ( bu... | Creates the Topic component of a chapter . xml for a specific SpecTopic . |
14,782 | protected void buildRevisionHistoryFromTemplate ( final BuildData buildData , final String revisionHistoryXml ) throws BuildProcessingException { log . info ( "\tBuilding " + REVISION_HISTORY_FILE_NAME ) ; Document revHistoryDoc ; try { revHistoryDoc = XMLUtilities . convertStringToDocument ( revisionHistoryXml ) ; } c... | Builds the revision history using the requester of the build . |
14,783 | private void addRevisionToRevHistory ( final Node revHistory , final Node revision ) { if ( revHistory . hasChildNodes ( ) ) { revHistory . insertBefore ( revision , revHistory . getFirstChild ( ) ) ; } else { revHistory . appendChild ( revision ) ; } } | Adds a revision element to the list of revisions in a revhistory element . This method ensures that the new revision is at the top of the revhistory list . |
14,784 | private String buildTranslateCSChapter ( final BuildData buildData ) { final ContentSpec contentSpec = buildData . getContentSpec ( ) ; final TranslatedContentSpecWrapper translatedContentSpec = EntityUtilities . getClosestTranslatedContentSpecById ( providerFactory , contentSpec . getId ( ) , contentSpec . getRevision... | Builds a Chapter with a single paragraph that contains a link to translate the Content Specification . |
14,785 | private String buildErrorChapterGlossary ( final BuildData buildData , final String title ) { final StringBuilder glossary = new StringBuilder ( "<glossary>" ) ; glossary . append ( "<title>" ) ; if ( title != null ) { glossary . append ( title ) ; } glossary . append ( "</title>" ) ; glossary . append ( DocBookUtiliti... | Builds the Glossary used in the Error Chapter . |
14,786 | @ SuppressWarnings ( "unchecked" ) private void processImageLocations ( final BuildData buildData ) { final List < Integer > topicIds = buildData . getBuildDatabase ( ) . getTopicIds ( ) ; for ( final Integer topicId : topicIds ) { final ITopicNode topicNode = buildData . getBuildDatabase ( ) . getTopicNodesForTopicID ... | Processes the Topics in the BuildDatabase and builds up the images found within the topics XML . If the image reference is blank or invalid it is replaced by the fail penguin image . |
14,787 | protected void processTopicSectionInfo ( final BuildData buildData , final BaseTopicWrapper < ? > topic , final Document doc ) { if ( doc == null || topic == null ) return ; final String infoName ; if ( buildData . getDocBookVersion ( ) == DocBookVersion . DOCBOOK_50 ) { infoName = "info" ; } else { infoName = DocBookU... | Process a topic and add the section info information . This information consists of the keywordset information . The keywords are populated using the tags assigned to the topic . |
14,788 | protected boolean doFixedURLsPass ( final BuildData buildData ) throws BuildProcessingException { log . info ( "Doing Fixed URL Pass" ) ; final Set < String > processedFileNames = new HashSet < String > ( ) ; final Set < SpecNode > nodesWithoutFixedUrls = new HashSet < SpecNode > ( ) ; boolean success = true ; try { Fi... | This method does a pass over all the spec nodes and attempts to create unique Fixed URL if one does not already exist . |
14,789 | protected void addAdditionalFilesToBook ( final BuildData buildData ) throws BuildProcessingException { final FileProvider fileProvider = providerFactory . getProvider ( FileProvider . class ) ; final ContentSpec contentSpec = buildData . getContentSpec ( ) ; if ( contentSpec . getFiles ( ) != null ) { log . info ( "\t... | Adds the additional files defined in a content spec to the book . |
14,790 | private void segmentPage ( ) { DefaultContentRect . resetId ( ) ; if ( segmentatorCombo . getSelectedIndex ( ) != - 1 ) { AreaTreeProvider provider = segmentatorCombo . getItemAt ( segmentatorCombo . getSelectedIndex ( ) ) ; proc . segmentPage ( provider , null ) ; setAreaTree ( proc . getAreaTree ( ) ) ; } } | Segments the page using the chosen provider and parametres . |
14,791 | private void buildLogicalTree ( ) { if ( logicalCombo . getSelectedIndex ( ) != - 1 ) { LogicalTreeProvider provider = logicalCombo . getItemAt ( logicalCombo . getSelectedIndex ( ) ) ; proc . buildLogicalTree ( provider , null ) ; setLogicalTree ( proc . getLogicalAreaTree ( ) ) ; } } | Builds the logical tree the chosen provider and parametres . |
14,792 | private JPanel createContentCanvas ( ) { if ( contentCanvas != null ) { contentCanvas = new BrowserPanel ( proc . getPage ( ) ) ; contentCanvas . setLayout ( null ) ; selection = new Selection ( ) ; contentCanvas . add ( selection ) ; selection . setVisible ( false ) ; selection . setLocation ( 0 , 0 ) ; } return conte... | Creates the appropriate canvas based on the file type |
14,793 | private void canvasClick ( int x , int y ) { for ( CanvasClickListener listener : canvasClickAlwaysListeners ) listener . canvasClicked ( x , y ) ; for ( JToggleButton button : canvasClickToggleListeners . keySet ( ) ) { if ( button . isSelected ( ) ) canvasClickToggleListeners . get ( button ) . canvasClicked ( x , y ... | This is called when the browser canvas is clicked |
14,794 | @ SuppressWarnings ( "PMD.EmptyCatchBlock" ) private synchronized void cleanup ( final WatchKey key ) { logger . trace ( "cleanUp {}" , key ) ; try { key . cancel ( ) ; } catch ( Exception ex ) { } Collection < SFMF4JWatchListener > listeners = listenersByWatchKey . remove ( key ) ; if ( listeners != null && ! listener... | Properly unregisters and removes a watch key . |
14,795 | public static Map < String , String > getCapabilities ( HttpServletRequest request , String ddsUrl ) throws IOException { URL url ; try { url = new URL ( ddsUrl + "/get_capabilities?capability=resolution_width&capability=model_name&capability=xhtml_support_level&" + "headers=" + URLEncoder . encode ( jsonEncode ( getHe... | Get the capabilities as a map of capabilities . There are times that a strict data type is not desirable . Getting it as map provides some flexibility . This does not require any knowledge of what capabilities will be returned by the service . |
14,796 | private static String fetchHttpResponse ( URL url ) throws IOException { HttpURLConnection conn = null ; try { logger . info ( "fetching from url = " + url ) ; conn = ( HttpURLConnection ) url . openConnection ( ) ; int response = conn . getResponseCode ( ) ; if ( response != HttpURLConnection . HTTP_ACCEPTED ) { Strin... | convenience method to do a http request on url and return result as a string |
14,797 | private static < T > T jsonDecode ( String responseContent , TypeReference < T > valueTypeRef ) throws IOException { ObjectMapper mapper = new ObjectMapper ( ) ; try { return mapper . < T > readValue ( responseContent , valueTypeRef ) ; } catch ( JsonGenerationException e ) { logger . severe ( "unable decode" ) ; throw... | Given a string and a type ref . Decode the string and return the values . |
14,798 | private static String jsonEncode ( Object object ) throws IOException { ObjectMapper mapper = new ObjectMapper ( ) ; ByteArrayOutputStream outputStream = new ByteArrayOutputStream ( ) ; try { mapper . writeValue ( outputStream , object ) ; return new String ( outputStream . toByteArray ( ) ) ; } catch ( JsonGenerationE... | Encode a java object into a json which is returned as a string |
14,799 | private static Map < String , String > getHeadersAsHashMap ( HttpServletRequest request ) { Map < String , String > headers = new HashMap < String , String > ( ) ; for ( Enumeration < ? > h = request . getHeaderNames ( ) ; h . hasMoreElements ( ) ; ) { String headerName = ( String ) h . nextElement ( ) ; String headerV... | convenience method turn http headers into a hash map |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.