idx int64 0 41.2k | question stringlengths 74 4.21k | target stringlengths 5 888 |
|---|---|---|
15,300 | public int doSetData ( Object vpData , boolean bDisplayOption , int iMoveMode ) { if ( ( vpData != null ) && ( ! ( vpData instanceof java . util . Date ) ) ) return DBConstants . ERROR_RETURN ; return super . doSetData ( vpData , bDisplayOption , iMoveMode ) ; } | Move this physical binary data to this field . Must be java Date type . |
15,301 | public void propertyChange ( PropertyChangeEvent evt ) { if ( MenuConstants . DATE . equalsIgnoreCase ( evt . getPropertyName ( ) ) ) if ( evt . getNewValue ( ) instanceof java . util . Date ) this . setDateTime ( ( java . util . Date ) evt . getNewValue ( ) , true , DBConstants . SCREEN_MOVE ) ; } | This method gets called when a bound property is changed . This is required to listen to changes by the date popup control . |
15,302 | public String getProperty ( String strProperty ) { if ( ( strProperty == null ) || ( strProperty . length ( ) == 0 ) ) return null ; if ( m_propertiesCache == null ) m_propertiesCache = this . loadProperties ( ) ; return ( String ) m_propertiesCache . get ( strProperty ) ; } | Get this property in the user s property area . |
15,303 | public String getNewValue ( String strKey , String strReadValue , String strOrigValue , String strCurrentValue ) { String strNewValue = null ; if ( ( ( strCurrentValue != null ) && ( strCurrentValue . equals ( strOrigValue ) ) ) || ( ( strCurrentValue == null ) && ( strOrigValue == null ) ) ) { strNewValue = strReadValue ; } else if ( ( ( strReadValue != null ) && ( strReadValue . equals ( strOrigValue ) ) ) || ( ( strReadValue == null ) && ( strOrigValue == null ) ) ) { strNewValue = strCurrentValue ; } else if ( ( ( strReadValue != null ) && ( strReadValue . equals ( strCurrentValue ) ) ) || ( ( strReadValue == null ) && ( strCurrentValue == null ) ) ) { strNewValue = strCurrentValue ; } else { strNewValue = this . mergeKey ( strKey , strReadValue , strCurrentValue ) ; } return strNewValue ; } | Given the read original and current values for this key decide which to use . |
15,304 | public boolean updateOrigKey ( Map < String , Object > propOrig , String strKey , String strOrigValue , String strNewValue , boolean bOrigChange ) { if ( ( ( strNewValue != null ) && ( ! strNewValue . equals ( strOrigValue ) ) ) || ( ( strNewValue == null ) && ( strOrigValue != null ) ) ) { bOrigChange = true ; if ( strNewValue != null ) propOrig . put ( strKey , strNewValue ) ; else propOrig . remove ( strKey ) ; } return bOrigChange ; } | Given the read original and current values for this key update the original key value . |
15,305 | public static FMDate fromString ( String value ) { return StringUtils . isEmpty ( value ) ? null : new FMDate ( value ) ; } | Converts a string value to a FM date . |
15,306 | private long setCalendar ( Calendar cal , int part , long value , long div ) { cal . set ( part , ( int ) ( value % div ) ) ; return value / div ; } | Sets a calendar component based on the input value . Meant to be called successively with the return value used as the input value for the next call to extract lower digits from the input value to be set into the calendar component . |
15,307 | public void setFMDate ( String value ) { final long multiplier = 100000000 ; Calendar cal = Calendar . getInstance ( ) ; double val = Double . parseDouble ( value ) ; if ( val < 1000000D || val > 9999999D ) { throw new IllegalArgumentException ( ) ; } long date = ( long ) Math . floor ( val * multiplier ) ; hasTime = date % multiplier != 0 ; date = setCalendar ( cal , Calendar . MILLISECOND , date , 100 ) ; date = setCalendar ( cal , Calendar . SECOND , date , 100 ) ; date = setCalendar ( cal , Calendar . MINUTE , date , 100 ) ; date = setCalendar ( cal , Calendar . HOUR_OF_DAY , date , 100 ) ; date = setCalendar ( cal , Calendar . DAY_OF_MONTH , date , 100 ) ; date = setCalendar ( cal , Calendar . MONTH , date - 1 , 100 ) ; date = setCalendar ( cal , Calendar . YEAR , date + 1700 , 10000 ) ; setTime ( cal . getTimeInMillis ( ) ) ; } | Sets the date value based on the specified FM string representation . |
15,308 | public String getFMDate ( ) { Calendar cal = Calendar . getInstance ( ) ; cal . setTime ( this ) ; StringBuilder sb = new StringBuilder ( 15 ) ; int hour = cal . get ( Calendar . HOUR_OF_DAY ) ; if ( hour == 0 && hasTime ) { hour = 24 ; cal . add ( Calendar . DAY_OF_MONTH , - 1 ) ; } addFMPiece ( sb , cal . get ( Calendar . YEAR ) - 1700 , 0 ) ; addFMPiece ( sb , cal . get ( Calendar . MONTH ) + 1 , 2 ) ; addFMPiece ( sb , cal . get ( Calendar . DAY_OF_MONTH ) , 2 ) ; if ( hasTime ) { sb . append ( '.' ) ; addFMPiece ( sb , hour , 2 ) ; addFMPiece ( sb , cal . get ( Calendar . MINUTE ) , 2 ) ; addFMPiece ( sb , cal . get ( Calendar . SECOND ) , 2 ) ; addFMPiece ( sb , cal . get ( Calendar . MILLISECOND ) , 2 ) ; for ( int i = sb . length ( ) - 1 ; i >= 0 ; i -- ) { char c = sb . charAt ( i ) ; if ( c == '0' ) { sb . deleteCharAt ( i ) ; } else if ( c == '.' ) { sb . deleteCharAt ( i ) ; break ; } else { break ; } } } return sb . toString ( ) ; } | Returns the FM string representation of the date . |
15,309 | private void addFMPiece ( StringBuilder sb , int value , int pad ) { String val = Integer . toString ( value ) ; pad -= val . length ( ) ; while ( pad -- > 0 ) { sb . append ( '0' ) ; } sb . append ( val ) ; } | Used to build a FM string representation of a date . |
15,310 | protected void ignoreDuplicatedChangeItemRequests ( ) { if ( getItems ( ) != null ) { final List < RESTCategoryInTagCollectionItemV1 > items = new ArrayList < RESTCategoryInTagCollectionItemV1 > ( getItems ( ) ) ; for ( int i = 0 ; i < items . size ( ) ; ++ i ) { final RESTCategoryInTagCollectionItemV1 child1 = items . get ( i ) ; final RESTCategoryInTagV1 childItem1 = child1 . getItem ( ) ; if ( childItem1 . getId ( ) == null ) continue ; final boolean add1 = child1 . getState ( ) . equals ( ADD_STATE ) ; final boolean remove1 = child1 . getState ( ) . equals ( REMOVE_STATE ) ; final boolean update1 = child1 . getState ( ) . equals ( UPDATE_STATE ) ; for ( int j = i + 1 ; j < items . size ( ) ; ++ j ) { final RESTCategoryInTagCollectionItemV1 child2 = items . get ( j ) ; final RESTCategoryInTagV1 childItem2 = child2 . getItem ( ) ; if ( childItem2 . getId ( ) == null ) continue ; final boolean relationshipIdEqual = childItem1 . getRelationshipId ( ) == null && childItem2 . getRelationshipId ( ) == null || childItem1 . getRelationshipId ( ) != null && childItem1 . getRelationshipId ( ) . equals ( childItem2 . getRelationshipId ( ) ) ; if ( childItem1 . getId ( ) . equals ( childItem2 . getId ( ) ) && relationshipIdEqual ) { final boolean add2 = child2 . getState ( ) . equals ( ADD_STATE ) ; final boolean remove2 = child2 . getState ( ) . equals ( REMOVE_STATE ) ; final boolean update2 = child2 . getState ( ) . equals ( UPDATE_STATE ) ; final boolean relationshipSortEqual = childItem1 . getRelationshipSort ( ) == null && childItem2 . getRelationshipSort ( ) == null || childItem1 . getRelationshipSort ( ) != null && childItem1 . getRelationshipSort ( ) . equals ( childItem2 . getRelationshipSort ( ) ) ; if ( ( add1 && add2 ) || ( remove1 && remove2 ) || ( update1 && update2 ) ) { if ( relationshipSortEqual ) { getItems ( ) . remove ( child1 ) ; } else { getItems ( ) . remove ( child1 ) ; getItems ( ) . remove ( child2 ) ; } } if ( ( add1 && remove2 ) || ( remove1 && add2 ) || ( update1 && remove2 ) || ( update2 && remove1 ) || ( update1 && add2 ) || ( update2 && add1 ) ) { getItems ( ) . remove ( child1 ) ; getItems ( ) . remove ( child2 ) ; } } } } } } | CategoryTags are only duplicated when they have the same ID and the same value . |
15,311 | public String getSFieldProperty ( String strFieldName ) { String strValue = super . getSFieldProperty ( strFieldName ) ; if ( strValue == null ) if ( this . getParentScreen ( ) != null ) if ( DBConstants . SUBMIT . equalsIgnoreCase ( this . getParentScreen ( ) . getProperty ( DBParams . COMMAND ) ) ) strValue = DBConstants . NO ; return strValue ; } | Set this control s value as it was submitted by the HTML post operation . |
15,312 | public static FileCreationState newDirectories ( final Collection < File > directories ) throws DirectoryAlreadyExistsException { FileCreationState created = FileCreationState . PENDING ; for ( final File dir : directories ) { created = CreateFileExtensions . newDirectory ( dir ) ; } return created ; } | Creates the directories . |
15,313 | public static FileCreationState newFile ( final File file ) throws IOException { FileCreationState fileCreationState = FileCreationState . ALREADY_EXISTS ; if ( ! file . exists ( ) ) { fileCreationState = FileCreationState . FAILED ; newParentDirectories ( file ) ; if ( file . createNewFile ( ) ) { fileCreationState = FileCreationState . CREATED ; } } return fileCreationState ; } | Creates an empty file if the File does not exists otherwise it lets the file as it is . |
15,314 | public static FileCreationState newFiles ( final Collection < File > files ) throws IOException { FileCreationState created = FileCreationState . PENDING ; for ( final File file : files ) { created = CreateFileExtensions . newFile ( file ) ; } return created ; } | Creates all files contained in the collection as empty files if the files does not exists otherwise it lets the files as they are . |
15,315 | public static void newParentDirectories ( final File file ) { if ( ! file . exists ( ) ) { final File parent = file . getParentFile ( ) ; if ( parent != null && ! parent . exists ( ) ) { parent . mkdirs ( ) ; } } } | Creates the parent directories from the given file . |
15,316 | public MapBuilder < K , V > putAll ( Map < K , V > otherMap ) { map . putAll ( otherMap ) ; return this ; } | Puts all entries from otherMap into the map . |
15,317 | public void init ( BaseDatabase database , Record record ) { m_tableNext = null ; database = null ; super . init ( database , record ) ; if ( record . getTable ( ) != this ) m_tableNext = record . getTable ( ) ; record . setTable ( this ) ; } | Initialize the table . Adds the record s current table to my chain and sets the record s table to this new table . |
15,318 | public void free ( ) { if ( m_mapTable != null ) { Iterator < BaseTable > iterator = this . getTables ( ) ; while ( iterator . hasNext ( ) ) { BaseTable table = iterator . next ( ) ; if ( ( table != null ) && ( table != this . getNextTable ( ) ) ) { Record record = table . getRecord ( ) ; if ( record != null ) record . free ( ) ; } } m_mapTable . clear ( ) ; m_mapTable = null ; } if ( m_tableNext != null ) { BaseTable baseTable = m_tableNext ; m_tableNext = null ; baseTable . free ( ) ; m_record = null ; } super . free ( ) ; } | Free this passthrutable and all linked tables in this chain . |
15,319 | public void close ( ) { if ( m_mapTable != null ) { Iterator < BaseTable > iterator = this . getTables ( ) ; while ( iterator . hasNext ( ) ) { BaseTable table = iterator . next ( ) ; if ( ( table != null ) && ( table != this . getNextTable ( ) ) ) { Record record = table . getRecord ( ) ; if ( record != null ) record . close ( ) ; } } } if ( m_tableNext != null ) m_tableNext . close ( ) ; super . close ( ) ; } | Close the all the recordsets in the list . |
15,320 | public BaseTable getTableAt ( Object objKey ) { if ( m_mapTable != null ) if ( objKey != null ) return ( BaseTable ) m_mapTable . get ( objKey ) ; return null ; } | Get the table at this position in the table list . |
15,321 | public void addTable ( Object objKey , BaseTable table ) { if ( m_mapTable == null ) m_mapTable = new Hashtable < Object , BaseTable > ( ) ; if ( objKey == null ) objKey = new Integer ( m_mapTable . size ( ) ) ; m_mapTable . put ( objKey , table ) ; } | Add this record s table to the list of tables to pass commands to . |
15,322 | public boolean removeTable ( BaseTable table ) { if ( m_mapTable != null ) { for ( Object objKey : m_mapTable . keySet ( ) ) { if ( table == m_mapTable . get ( objKey ) ) { return ( m_mapTable . remove ( objKey ) != null ) ; } } } else { if ( this . getNextTable ( ) != null ) return this . getNextTable ( ) . removeTable ( table ) ; } return super . removeTable ( table ) ; } | Remove this table from this table list . |
15,323 | public BaseDatabase getDatabase ( ) { BaseDatabase database = super . getDatabase ( ) ; if ( database == null ) if ( this . getNextTable ( ) != null ) database = this . getNextTable ( ) . getDatabase ( ) ; return database ; } | Get the table s database . |
15,324 | public boolean savePool ( ) { if ( newTopicPool . isEmpty ( ) && updatedTopicPool . isEmpty ( ) ) return true ; try { if ( ! newTopicPool . isEmpty ( ) ) { final CollectionWrapper < TopicWrapper > response = topicProvider . createTopics ( newTopicPool ) ; if ( response == null ) return false ; if ( response . getItems ( ) == null ) return false ; newTopicPool = response ; } if ( ! updatedTopicPool . isEmpty ( ) ) { final CollectionWrapper < TopicWrapper > response = topicProvider . updateTopics ( updatedTopicPool ) ; if ( response == null ) return false ; if ( response . getItems ( ) == null ) return false ; updatedTopicPool = response ; } initialised = true ; return true ; } catch ( Exception e ) { log . error ( "" , e ) ; return false ; } } | Saves all the topics in the pool to the database using the REST API . |
15,325 | public ITopicNode initialiseFromPool ( final ITopicNode topicNode ) { if ( initialised ) { if ( newTopicPool != null && ! newTopicPool . isEmpty ( ) ) { for ( final TopicWrapper topic : newTopicPool . getItems ( ) ) { if ( topic . getProperty ( cspIdPropertyTagId ) != null ) { if ( topic . getProperty ( cspIdPropertyTagId ) . getValue ( ) . equals ( topicNode . getUniqueId ( ) ) ) { topicNode . setId ( Integer . toString ( topic . getId ( ) ) ) ; return topicNode ; } } } } if ( updatedTopicPool != null && ! updatedTopicPool . isEmpty ( ) ) { for ( final TopicWrapper topic : updatedTopicPool . getItems ( ) ) { if ( topic . getProperty ( cspIdPropertyTagId ) != null ) { if ( topic . getProperty ( cspIdPropertyTagId ) . getValue ( ) . equals ( topicNode . getUniqueId ( ) ) ) { topicNode . setId ( Integer . toString ( topic . getId ( ) ) ) ; return topicNode ; } } } } } return topicNode ; } | Initialises a content spec topic using the REST topics that exist within this pool . The topic pool must be saved and initialised before this call will work . |
15,326 | public boolean isEmpty ( ) { return ( newTopicPool == null ? true : newTopicPool . isEmpty ( ) ) && ( updatedTopicPool == null ? true : updatedTopicPool . isEmpty ( ) ) ; } | Checks to see if the topic pool is empty . |
15,327 | public void rollbackPool ( ) { if ( newTopicPool == null || newTopicPool . isEmpty ( ) ) return ; final List < Integer > topicIds = new ArrayList < Integer > ( ) ; for ( final TopicWrapper topic : newTopicPool . getItems ( ) ) { topicIds . add ( topic . getTopicId ( ) ) ; } try { topicProvider . deleteTopics ( topicIds ) ; initialised = false ; } catch ( Exception e ) { log . error ( "An error occurred while trying to rollback the Topic Pool" , e ) ; } } | Rolls back any new topics that were created . Since existing topics are stored in revision data when edited we can t roll back that data properly . |
15,328 | public String getStylesheetName ( ) { if ( this . getProperty ( DBParams . HELP ) != null ) return "menuhelp" ; else if ( this . getProperty ( DBParams . STYLESHEET ) != null ) return this . getProperty ( DBParams . STYLESHEET ) ; else return "menus" ; } | Get the name of the stylesheet . |
15,329 | public synchronized V probe ( K key ) { Item < V > item ; item = items . get ( key ) ; return item == null ? null : item . value ; } | lookup without stats |
15,330 | private static void wait ( Object lock , int timeout ) { try { lock . wait ( timeout ) ; } catch ( InterruptedException unused ) { Thread . currentThread ( ) . interrupt ( ) ; } } | Wait notification on synchronized object for specified period of time . If timeout is zero this method blocks till notification arrive . |
15,331 | public synchronized Collection < IResult > executeWithInputs ( Collection < IInputValue > inputs ) throws ModelException { if ( ! hasGrounding ( ) ) { return null ; } ValueMap < Output , OWLValue > returnedOutputs ; try { returnedOutputs = executionEngine ( ) . execute ( service . getProcess ( ) , fromParameterInputs ( service . getProcess ( ) , inputs ) , service . getKB ( ) ) ; } catch ( ExecutionException ex ) { throw new ServiceExecutionException ( "Problem executing service with inputs: " + inputs . toString ( ) , ex ) ; } return valuesToParameters ( service . getProcess ( ) , returnedOutputs ) ; } | Executes the handled OWL - S service given a list of inputs as IParameter |
15,332 | private static ValueMap < Input , OWLValue > fromParameterInputs ( Process process , Collection < IInputValue > parameters ) throws ModelException { if ( parameters . isEmpty ( ) ) { return null ; } ValueMap < Input , OWLValue > valueMap = new ValueMap < Input , OWLValue > ( ) ; for ( IInputValue parameter : parameters ) { valueMap . setValue ( process . getInput ( parameter . getInput ( ) . name ( ) ) , process . getKB ( ) . createDataValue ( parameter . object ( ) ) ) ; } return valueMap ; } | Translates a list of IParameter to a collection of Input OWLValue |
15,333 | private synchronized Collection < IResult > valuesToParameters ( Process process , ValueMap < Output , OWLValue > values ) throws NotYetImplementedException , OWLTranslationException { if ( values . isEmpty ( ) ) { return null ; } Collection < IResult > parameters = new ArrayList < IResult > ( ) ; Iterator < Entry < Output , OWLValue > > valuesIterator = values . iterator ( ) ; while ( valuesIterator . hasNext ( ) ) { Entry < Output , OWLValue > valuesEntry = valuesIterator . next ( ) ; final OWLSParameter parameter = new OWLSParameter ( process . getOntology ( ) , valuesEntry . getKey ( ) . getName ( ) , valuesEntry . getValue ( ) ) ; parameters . add ( new IOutputValue ( ) { public IOutput getOutput ( ) { try { return output ( parameter . name ( ) ) ; } catch ( ModelException ex ) { return null ; } } public Object object ( ) throws ModelException { return parameter . object ( ) ; } public ISemanticIdentifier getSemanticAnnotation ( ) { return parameter . getSemanticAnnotation ( ) ; } public ISubject value ( ) throws ModelException { if ( null != functionalityGrounding ) { return functionalityGrounding . createOutput ( parameter . object ( ) , OWLSAtomicService . this ) . value ( ) ; } throw new UnsupportedOperationException ( "Not supported yet." ) ; } } ) ; } return parameters ; } | Translates a collection of Output OWLvalue to a list of IParameter |
15,334 | public void writeDetailLine ( Record registration , StreamOut out , boolean bResourceListBundle ) { String strKey = registration . getField ( Registration . KEY_VALUE ) . toString ( ) ; String strValue = registration . getField ( Registration . OBJECT_VALUE ) . toString ( ) ; strValue = ResourcesUtilities . fixPropertyValue ( strValue , bResourceListBundle ) ; if ( bResourceListBundle ) out . writeit ( "\t{\"" + strKey + "\", " + strValue + "}" ) ; else out . writeit ( ResourcesUtilities . fixPropertyKey ( strKey ) + "=" + strValue ) ; } | WriteDetailLine Method . |
15,335 | public StreamOut createFile ( String strFullFileName ) { StreamOut streamOut = null ; try { File file = new File ( strFullFileName ) ; String pathName = file . getParent ( ) ; File fileDir = new File ( pathName ) ; fileDir . mkdirs ( ) ; streamOut = new StreamOut ( strFullFileName ) ; } catch ( IOException ex ) { ex . printStackTrace ( ) ; streamOut = null ; } return streamOut ; } | CreateFile Method . |
15,336 | public String getStartSourceCode ( String packagePath , String strFileName , String strDescription , boolean bResourceListBundle ) { String string ; if ( bResourceListBundle ) { string = "package " + packagePath + ";\n" + "/**\n" + " * @(#)" + strFileName + ".java 0.00 1-Jan-10 Don Corley\n" + " *\n" + " * Copyright © 2010 tourgeek.com. All Rights Reserved.\n" + " * don@donandann.com\n" + " */\n" + "import java.util.*;\n" + "\n" + "/**\n" + " * " + strFileName + " - Resources.\n" + strDescription + "\n" + " */\n" + "public class " + strFileName + " extends ListResourceBundle\n" + "{\n" + "\tpublic Object[][] getContents() {\n" + "\t\treturn contents;\n" + "\t}\n" ; } else string = "# " + strFileName + " property file" + "\n" + "# " + strDescription + "\n" ; return string ; } | GetStartSourceCode Method . |
15,337 | public void free ( ) { this . close ( ) ; while ( m_vTableList . size ( ) > 0 ) { BaseTable table = m_vTableList . elementAt ( 0 ) ; table . free ( ) ; } m_vTableList . removeAllElements ( ) ; m_vTableList = null ; if ( m_databaseOwner != null ) m_databaseOwner . removeDatabase ( this ) ; m_databaseOwner = null ; m_strDbName = null ; } | Free this database object . |
15,338 | public BaseTable doMakeTable ( Record record ) { if ( ( ( record . getDatabaseType ( ) & DBConstants . TABLE_TYPE_MASK ) == DBConstants . MEMORY ) || ( ( record . getDatabaseType ( ) & DBConstants . TABLE_TYPE_MASK ) == DBConstants . UNSHAREABLE_MEMORY ) ) { BaseDatabase database = ( BaseDatabase ) this . getDatabaseOwner ( ) . getDatabase ( DBParams . MEMORY , record . getDatabaseType ( ) , null ) ; return database . doMakeTable ( record ) ; } else return null ; } | You must override this to make a table for this database . Always override this method . |
15,339 | public PropertyOwner retrieveUserProperties ( String strRegistrationKey ) { if ( m_properties != null ) if ( m_properties . get ( strRegistrationKey ) != null ) return this ; return m_databaseOwner . retrieveUserProperties ( strRegistrationKey ) ; } | Get the owner of this property key . |
15,340 | public static Map < String , Object > addDBProperties ( Map < String , Object > properties , PropertyOwner propertyOwner , Map < String , Object > otherProperties ) { if ( properties == null ) properties = new Hashtable < String , Object > ( ) ; BaseDatabase . addDBProperty ( properties , propertyOwner , otherProperties , DBConstants . CREATE_DB_IF_NOT_FOUND ) ; BaseDatabase . addDBProperty ( properties , propertyOwner , otherProperties , DBConstants . DB_USER_PREFIX ) ; BaseDatabase . addDBProperty ( properties , propertyOwner , otherProperties , DBConstants . SYSTEM_NAME ) ; BaseDatabase . addDBProperty ( properties , propertyOwner , otherProperties , DBConstants . MODE ) ; BaseDatabase . addDBProperty ( properties , propertyOwner , otherProperties , DBConstants . LOAD_INITIAL_DATA ) ; BaseDatabase . addDBProperty ( properties , propertyOwner , otherProperties , DBConstants . ARCHIVE_FOLDER ) ; BaseDatabase . addDBProperty ( properties , propertyOwner , otherProperties , DBConstants . USER_ARCHIVE_FOLDER ) ; BaseDatabase . addDBProperty ( properties , propertyOwner , otherProperties , DBConstants . SHARED_ARCHIVE_FOLDER ) ; BaseDatabase . addDBProperty ( properties , propertyOwner , otherProperties , DBConstants . BASE_TABLE_ONLY ) ; BaseDatabase . addDBProperty ( properties , propertyOwner , otherProperties , SQLParams . AUTO_COMMIT_PARAM ) ; if ( propertyOwner != null ) { BaseDatabase . addOtherDBProperties ( properties , propertyOwner . getProperties ( ) ) ; if ( propertyOwner instanceof RecordOwnerParent ) { Task task = ( ( RecordOwnerParent ) propertyOwner ) . getTask ( ) ; if ( task != null ) { BaseDatabase . addOtherDBProperties ( properties , task . getProperties ( ) ) ; App app = task . getApplication ( ) ; if ( app != null ) { BaseDatabase . addOtherDBProperties ( properties , app . getProperties ( ) ) ; } } } } if ( otherProperties != null ) BaseDatabase . addOtherDBProperties ( properties , otherProperties ) ; return properties ; } | Since only the DB properties are passed down to the server make sure any global properties that pertain to databases are passed down also . |
15,341 | public boolean setupDatabaseProperties ( ) { if ( this . getProperty ( DB_PROPERTIES_LOADED ) != null ) return true ; String strDatabaseName = this . getDatabaseName ( true ) ; Environment env = ( Environment ) this . getDatabaseOwner ( ) . getEnvironment ( ) ; Map < String , String > map = env . getCachedDatabaseProperties ( strDatabaseName ) ; if ( ( map == null ) || ( map == Environment . DATABASE_DOESNT_EXIST ) ) { map = this . getDatabaseProperties ( ) ; if ( map == null ) return false ; env . cacheDatabaseProperties ( strDatabaseName , map ) ; } for ( String key : map . keySet ( ) ) { this . setProperty ( key , map . get ( key ) ) ; } if ( m_databaseBase == null ) if ( this . getProperty ( BASE_DATABASE ) != null ) { Map < String , Object > properties = new HashMap < String , Object > ( ) ; properties . putAll ( this . getProperties ( ) ) ; properties . remove ( BASE_DATABASE ) ; properties . remove ( SQLParams . JDBC_DRIVER_PARAM ) ; properties . put ( DBConstants . DB_USER_PREFIX , DBConstants . BLANK ) ; properties . remove ( DBConstants . SYSTEM_NAME ) ; properties . put ( DBConstants . MODE , DBConstants . BLANK ) ; m_databaseBase = ( BaseDatabase ) m_databaseOwner . getDatabase ( this . getProperty ( BASE_DATABASE ) , this . getDatabaseType ( ) & DBConstants . TABLE_MASK , properties ) ; } this . setProperty ( DB_PROPERTIES_LOADED , DBConstants . TRUE ) ; return true ; } | Given the name of the database get the properties file and optionally merge them with my current properties . |
15,342 | public BaseTable returnBaseTable ( BaseTable table ) { Record record = table . getRecord ( ) ; int iRawDBType = ( record . getDatabaseType ( ) & DBConstants . TABLE_TYPE_MASK ) ; if ( ( iRawDBType == DBConstants . LOCAL ) || ( iRawDBType == DBConstants . REMOTE ) || ( iRawDBType == DBConstants . TABLE ) ) if ( ( this . getMasterSlave ( ) & RecordOwner . SLAVE ) == RecordOwner . SLAVE ) { if ( ( record . getDatabaseType ( ) & DBConstants . LOCALIZABLE ) == DBConstants . LOCALIZABLE ) { m_databaseLocale = this . makeDBLocale ( record , m_databaseLocale ) ; if ( m_databaseLocale != this ) { table . setRecord ( null ) ; table . free ( ) ; table = m_databaseLocale . makeTable ( record ) ; } } } return table ; } | Return the base table for this record . This is very specialized logic for exporting and importing only the base file . Further this logic will return the localized version of the file if language = xxx is set for the client . |
15,343 | protected void updated ( ) { if ( remaining < 0 && remaining > capacity ) { throw new IllegalArgumentException ( remaining + " illegal remaining at %s" + toString ( ) ) ; } if ( marked < 0 && marked > capacity ) { throw new IllegalArgumentException ( marked + " illegal marked at %s" + toString ( ) ) ; } } | This method is called after some parameters like marked are updated . |
15,344 | protected int writeTo ( SparseBufferOperator < B > op , Splitter < SparseBufferOperator < B > > splitter , int start , int length ) throws IOException { return splitter . split ( op , start , length ) ; } | Write buffers content from start |
15,345 | public String getString ( ) { StringBuilder sb = new StringBuilder ( ) ; for ( int ii = 0 ; ii < marked ; ii ++ ) { sb . append ( charAt ( ii ) ) ; } return sb . toString ( ) ; } | Returns input between discard and position as a string |
15,346 | public CharSequence subSequence ( int start , int end ) { StringBuilder sb = new StringBuilder ( ) ; for ( int ii = start ; ii < end ; ii ++ ) { sb . append ( ( char ) getAt ( ii ) ) ; } return sb . toString ( ) ; } | Note that implementation uses StringBuilder to create String as CharSequence . |
15,347 | public void printHtmlNavMenu ( PrintWriter out ) throws DBException { String strForms = this . getProperty ( HtmlConstants . FORMS ) ; if ( strForms != null ) if ( strForms . equalsIgnoreCase ( HtmlConstants . DISPLAY ) ) ( ( BasePanel ) this . getScreenField ( ) ) . setProperty ( DBParams . NAVMENUS , UserInfoModel . NO_ICONS ) ; super . printHtmlNavMenu ( out ) ; } | Code to display a Menu . Skip Nav menu for reports . |
15,348 | public String getString ( String strKey ) { if ( m_resources == null ) { BaseApplication application = ( BaseApplication ) this . getTask ( ) . getApplication ( ) ; m_resources = application . getResources ( ResourceConstants . MENU_RESOURCE , true ) ; } return m_resources . getString ( strKey ) ; } | Get the Menu resource object . |
15,349 | private boolean matchesResourceAnnotation ( final Resource resourceAnnotation ) { for ( final Resource expectedResources : this . matchingResources ) { if ( expectedResources . equals ( resourceAnnotation ) ) { return true ; } } return false ; } | Verifies if the specified resource annotation matches any of the resource specification for this injection . |
15,350 | public void fakeTheDate ( ) { int ecErrorCode ; BaseField fldToCompare = m_fldToCompare ; if ( m_fldToCompare . isNull ( ) ) return ; if ( m_fldFakeDate == null ) m_fldFakeDate = new DateField ( null , FAKE_DATE , DBConstants . DEFAULT_FIELD_LENGTH , FAKE_DATE , null ) ; m_fldToCompare = m_fldFakeDate ; ecErrorCode = m_fldToCompare . moveFieldToThis ( fldToCompare , DBConstants . DISPLAY , DBConstants . SCREEN_MOVE ) ; boolean bOldState = fldToCompare . getListener ( FieldReSelectHandler . class . getName ( ) ) . setEnabledListener ( false ) ; if ( ( ecErrorCode == DBConstants . NORMAL_RETURN ) && ( ( ( NumberField ) m_fldToCompare ) . getValue ( ) != 0 ) ) fldToCompare . moveFieldToThis ( m_fldToCompare , DBConstants . DISPLAY , DBConstants . SCREEN_MOVE ) ; else { fldToCompare . initField ( DBConstants . DISPLAY ) ; m_fldToCompare . initField ( DBConstants . DISPLAY ) ; } fldToCompare . getListener ( FieldReSelectHandler . class . getName ( ) ) . setEnabledListener ( bOldState ) ; } | If the current key starts with a date convert the search field to a date and compare . |
15,351 | public boolean isBreak ( ) { if ( this . getMainRecord ( ) != null ) if ( ( this . getMainRecord ( ) . getEditMode ( ) != DBConstants . EDIT_CURRENT ) && ( this . getMainRecord ( ) . getEditMode ( ) != DBConstants . EDIT_IN_PROGRESS ) ) { if ( ( m_iDisplayFieldDesc & HtmlConstants . FOOTING_SCREEN ) == HtmlConstants . FOOTING_SCREEN ) return true ; if ( ( m_iDisplayFieldDesc & HtmlConstants . HEADING_SCREEN ) == HtmlConstants . HEADING_SCREEN ) return false ; } Object objValue = this . getBreakValue ( ) ; if ( m_objLastValue != INITIAL_VALUE ) if ( ( objValue == m_objLastValue ) || ( ( objValue != null ) && ( objValue . equals ( m_objLastValue ) ) ) ) return false ; boolean bChange = true ; if ( m_objLastValue == INITIAL_VALUE ) { if ( ( m_iDisplayFieldDesc & HtmlConstants . FOOTING_SCREEN ) == HtmlConstants . FOOTING_SCREEN ) bChange = false ; } m_objLastValue = objValue ; return bChange ; } | Is this a control break? |
15,352 | public void add ( T style ) { Integer cnt = styles . get ( style ) ; if ( cnt == null ) styles . put ( style , 1 ) ; else styles . put ( style , cnt + 1 ) ; } | Adds a new occurence to the counter . |
15,353 | public int getCount ( T style ) { Integer cnt = styles . get ( style ) ; return cnt == null ? 0 : cnt ; } | Obtains total registered number of occurences of the given style . |
15,354 | public int getMaximalFrequency ( ) { int maxfreq = 0 ; for ( Map . Entry < T , Integer > entry : styles . entrySet ( ) ) { if ( entry . getValue ( ) > maxfreq ) maxfreq = entry . getValue ( ) ; } return maxfreq ; } | Gets the number of the most frequent entry . |
15,355 | public T getMostFrequent ( ) { T ret = null ; int freq = 0 ; for ( Map . Entry < T , Integer > entry : styles . entrySet ( ) ) { if ( entry . getValue ( ) > freq ) { ret = entry . getKey ( ) ; freq = entry . getValue ( ) ; } } return ret ; } | Obtains the most frequent style . If there are multiple styles with the same frequency then only one of them is returned . |
15,356 | public List < T > getMostFrequentAll ( ) { List < T > ret = new ArrayList < T > ( ) ; int maxfreq = getMaximalFrequency ( ) ; for ( Map . Entry < T , Integer > entry : styles . entrySet ( ) ) { if ( entry . getValue ( ) == maxfreq ) ret . add ( entry . getKey ( ) ) ; } return ret ; } | Obtains the most frequent style or styles when multiple of them have the maximal frequency . |
15,357 | public Map < T , Integer > getAllSorted ( ) { Map < T , Integer > map = styles ; TreeMap < T , Integer > smap = new TreeMap < T , Integer > ( new StyleCountComparator ( map ) ) ; smap . putAll ( map ) ; return smap ; } | Obtains all the registered styles and their frequencies sorted by frequency . |
15,358 | public double getPercentage ( T style ) { int scnt = 0 ; int allcnt = 0 ; for ( Map . Entry < T , Integer > entry : getAll ( ) . entrySet ( ) ) { if ( entry . getKey ( ) . equals ( style ) ) scnt = entry . getValue ( ) ; allcnt += entry . getValue ( ) ; } return scnt / ( double ) allcnt ; } | Computes the percentage of the given style among all the style occurences . |
15,359 | public static char getPDBTypeFromDBType ( int iDatabaseType ) { char strPDBType = ThinPhysicalDatabase . MEMORY_TYPE ; if ( ( iDatabaseType & Constants . MAPPED ) != 0 ) ; iDatabaseType = iDatabaseType & Constants . TABLE_TYPE_MASK ; if ( iDatabaseType == Constants . LOCAL ) strPDBType = ThinPhysicalDatabase . NET_TYPE ; if ( iDatabaseType == Constants . REMOTE ) strPDBType = ThinPhysicalDatabase . NET_TYPE ; if ( iDatabaseType == Constants . TABLE ) strPDBType = ThinPhysicalDatabase . NET_TYPE ; return strPDBType ; } | Get the physical db type from the record db type . |
15,360 | public void addPTable ( PTable physicalTable ) { Object strKey = physicalTable . getLookupKey ( ) ; m_htTableList . put ( strKey , physicalTable ) ; this . getPDatabaseParent ( ) . addTableToCache ( physicalTable ) ; } | Add this raw data table to my table list . |
15,361 | public int removePDatabaseOwner ( ThinPhysicalDatabaseOwner pDatabaseOwner , boolean bFreeIfEmpty ) { m_setPDatabaseOwners . remove ( pDatabaseOwner ) ; if ( bFreeIfEmpty ) if ( m_setPDatabaseOwners . size ( ) == 0 ) if ( m_htTableList . size ( ) == 0 ) { this . free ( ) ; return 0 ; } return m_setPDatabaseOwners . size ( ) ; } | Remove this physical database owner . |
15,362 | public BaseField getFieldCopy ( ) { try { if ( m_fldCopy == null ) m_fldCopy = ( BaseField ) this . getOwner ( ) . clone ( ) ; } catch ( CloneNotSupportedException ex ) { m_fldCopy = null ; } return m_fldCopy ; } | Get the field copy . Clone a copy if the copy doesn t exist . |
15,363 | public void detach ( Object ob ) { Iterator < Map . Entry < String , List < InstanceMethod > > > ki = map . entrySet ( ) . iterator ( ) ; while ( ki . hasNext ( ) ) { Map . Entry < String , List < InstanceMethod > > entry = ki . next ( ) ; Iterator < InstanceMethod > li = entry . getValue ( ) . iterator ( ) ; while ( li . hasNext ( ) ) { InstanceMethod im = li . next ( ) ; if ( im . instance . equals ( ob ) ) { li . remove ( ) ; } } if ( entry . getValue ( ) . isEmpty ( ) ) { ki . remove ( ) ; } } } | Removes all previously made attachments to given object . |
15,364 | public void detach ( Class < ? > cls ) { Iterator < Map . Entry < String , List < InstanceMethod > > > ki = map . entrySet ( ) . iterator ( ) ; while ( ki . hasNext ( ) ) { Map . Entry < String , List < InstanceMethod > > entry = ki . next ( ) ; Iterator < InstanceMethod > li = entry . getValue ( ) . iterator ( ) ; while ( li . hasNext ( ) ) { InstanceMethod im = li . next ( ) ; if ( im . type . equals ( cls ) ) { li . remove ( ) ; } } if ( entry . getValue ( ) . isEmpty ( ) ) { ki . remove ( ) ; } } } | Removes all previously made attachments to static class . |
15,365 | public static String encodeDateTime ( DateTimeField field ) { Date date = ( ( DateTimeField ) field ) . getDateTime ( ) ; if ( date == null ) return null ; if ( field instanceof TimeField ) return timeFormat . format ( date ) ; else if ( field instanceof DateField ) return dateFormat . format ( date ) ; else return dateTimeFormat . format ( date ) ; } | Encode date time field . |
15,366 | public static String encodeFieldData ( BaseField field ) { if ( field . getData ( ) == null ) return DBConstants . BLANK ; ByteArrayOutputStream baOut = new ByteArrayOutputStream ( ) ; DataOutputStream daOut = new DataOutputStream ( baOut ) ; try { field . write ( daOut , false ) ; daOut . flush ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } char [ ] chOut = Base64 . encode ( baOut . toByteArray ( ) ) ; if ( chOut == null ) return DBConstants . BLANK ; return new String ( chOut ) ; } | Change the data in this field to base64 . WARNING - This requires 64bit encoding found in javax . mail! |
15,367 | public static void decodeFieldData ( BaseField field , String string ) { if ( ( string == null ) || ( string . length ( ) == 0 ) ) return ; byte [ ] ba = Base64 . decode ( string . toCharArray ( ) ) ; InputStream is = new ByteArrayInputStream ( ba ) ; DataInputStream daIn = new DataInputStream ( is ) ; field . read ( daIn , false ) ; } | Change this base64 string to raw data and set the value in this field . WARNING - This requires 64bit encoding found in javax . mail! |
15,368 | public static boolean isNumeric ( String string , boolean bAllowFormatting ) { if ( ( string == null ) || ( string . length ( ) == 0 ) ) return false ; boolean bIsNumeric = true ; for ( int i = 0 ; i < string . length ( ) ; i ++ ) { if ( ! Character . isDigit ( string . charAt ( i ) ) ) { if ( ( ! bAllowFormatting ) || ( Character . isLetter ( string . charAt ( i ) ) ) ) bIsNumeric = false ; } } return bIsNumeric ; } | Is this string a valid number? |
15,369 | public static StringBuffer addXMLMap ( StringBuffer sbXML , Map < String , Object > mapMessage ) { if ( sbXML == null ) sbXML = new StringBuffer ( ) ; if ( mapMessage != null ) { for ( String strParam : mapMessage . keySet ( ) ) { Object objValue = mapMessage . get ( strParam ) ; if ( objValue != null ) Util . getXML ( sbXML , strParam , objValue ) ; } } return sbXML ; } | Add this map as an xml string . |
15,370 | @ SuppressWarnings ( { "rawtypes" , "unchecked" } ) public static StringBuffer getXML ( StringBuffer sbXML , String strParam , Object objValue ) { Util . addStartTag ( sbXML , strParam ) ; if ( objValue instanceof Map ) { Util . addXMLMap ( sbXML , ( Map ) objValue ) ; } else { String strValue = Constant . BLANK ; if ( objValue != null ) strValue = objValue . toString ( ) ; if ( Util . isCData ( strValue ) ) strValue = CDATA_START + strValue + CDATA_END ; sbXML . append ( strValue ) ; } return Util . addEndTag ( sbXML , strParam ) . append ( Constant . RETURN ) ; } | Convert this value to a XML string . |
15,371 | public static boolean isCData ( String string ) { if ( string != null ) { for ( int i = 0 ; i < string . length ( ) ; i ++ ) { char chChar = string . charAt ( i ) ; if ( ( chChar == 0x9 ) || ( chChar == 0xD ) || ( chChar == 0xA ) ) return true ; } } return false ; } | Is this a CData string? |
15,372 | public static String fixDOMElementName ( String string ) { for ( int i = 0 ; i < string . length ( ) ; i ++ ) { if ( ! Character . isJavaIdentifierPart ( string . charAt ( i ) ) ) string = string . substring ( 0 , i ) + "." + string . substring ( i + 1 ) ; } return string ; } | Fix this string so it can be a DOM element name . |
15,373 | public static String convertClassName ( String className , String stringToInsert , int location ) { int startSeq = 0 ; if ( location >= 0 ) { for ( int i = 0 ; i < location ; i ++ ) { startSeq = className . indexOf ( '.' , startSeq + 1 ) ; } } else { startSeq = className . length ( ) ; for ( int i = location ; i < 0 ; i ++ ) { startSeq = className . lastIndexOf ( '.' , startSeq - 1 ) ; } } if ( startSeq == - 1 ) return null ; int domainSeq = startSeq ; if ( className . indexOf ( Constant . THIN_SUBPACKAGE , startSeq ) == startSeq + 1 ) startSeq = startSeq + Constant . THIN_SUBPACKAGE . length ( ) ; className = className . substring ( 0 , domainSeq + 1 ) + stringToInsert + className . substring ( startSeq + 1 ) ; return className ; } | Convert this class name by inserting this package after the domain . ie . if location = 2 com . xyz . abc . ClassName - > com . xyz . newpackage . abc . ClassName . |
15,374 | public static String getDomainName ( String className ) { int i = className . indexOf ( '.' ) ; i = className . indexOf ( '.' , i + 1 ) ; if ( i == - 1 ) return null ; return className . substring ( 0 , i ) ; } | Get the domain name from this package or class name |
15,375 | public static String getPackageName ( String className , boolean resource ) { String packageName = null ; if ( className != null ) { if ( resource ) if ( className . endsWith ( PROPERTIES ) ) className = className . substring ( 0 , className . length ( ) - PROPERTIES . length ( ) ) ; if ( className . lastIndexOf ( '.' ) != - 1 ) packageName = className . substring ( 0 , className . lastIndexOf ( '.' ) ) ; } return packageName ; } | Get the package name of this class name |
15,376 | public static Logger getLogger ( ) { if ( m_logger == null ) { m_logger = Logger . getLogger ( Constant . ROOT_PACKAGE . substring ( 0 , Constant . ROOT_PACKAGE . length ( ) - 1 ) ) ; try { LogManager logManager = LogManager . getLogManager ( ) ; logManager . reset ( ) ; ConsoleHandler fh = new ConsoleHandler ( ) ; fh . setFormatter ( new SimpleFormatter ( ) ) ; m_logger . addHandler ( fh ) ; } catch ( java . security . AccessControlException ex ) { m_logger = Logger . getAnonymousLogger ( ) ; } finally { try { m_logger . setLevel ( Level . WARNING ) ; } catch ( java . security . AccessControlException ex ) { ex . printStackTrace ( ) ; } } } return m_logger ; } | Get the logger . |
15,377 | public String addSelectParams ( String seekSign , int iAreaDesc , boolean bAddOnlyMods , boolean bIncludeFileName , boolean bUseCurrentValues , Vector < BaseField > vParamList , boolean bForceUniqueKey , boolean bIncludeTempFields ) { if ( iAreaDesc == DBConstants . START_SELECT_KEY ) if ( bAddOnlyMods ) if ( bForceUniqueKey ) if ( ">=" . equals ( seekSign ) ) if ( this . getRecord ( ) . getCounterField ( ) != this . getField ( 0 ) ) if ( this . getKeyField ( this . getKeyFields ( bForceUniqueKey , false ) - 1 , bForceUniqueKey ) . getField ( iAreaDesc ) . isModified ( ) ) return this . addGreaterThanParams ( seekSign , iAreaDesc , bAddOnlyMods , bIncludeFileName , bUseCurrentValues , vParamList , bForceUniqueKey ) ; String strFilter = DBConstants . BLANK ; int iKeyFieldCount = this . getKeyFields ( bForceUniqueKey , bIncludeTempFields ) ; if ( bAddOnlyMods ) iKeyFieldCount = this . lastModified ( iAreaDesc , bForceUniqueKey ) + 1 ; for ( int iKeyFieldSeq = DBConstants . MAIN_KEY_FIELD ; iKeyFieldSeq < iKeyFieldCount ; iKeyFieldSeq ++ ) { KeyField keyField = this . getKeyField ( iKeyFieldSeq , bForceUniqueKey ) ; BaseField pParamField = keyField . getField ( iAreaDesc ) ; BaseField field = keyField . getField ( DBConstants . FILE_KEY_AREA ) ; if ( ">=" . equals ( seekSign ) ) if ( pParamField . isNull ( ) ) break ; if ( strFilter . length ( ) > 0 ) strFilter += " AND " ; String strCompare = null ; strFilter += field . getFieldName ( true , bIncludeFileName ) ; String strSign = seekSign ; if ( bUseCurrentValues == false ) { strCompare = "?" ; strFilter += strSign + strCompare ; if ( vParamList != null ) vParamList . add ( pParamField ) ; } else strFilter += pParamField . getSQLFilter ( strSign , strCompare , true ) ; } return strFilter ; } | Setup the SQL Key Filter . |
15,378 | public BaseField getField ( int iKeyFieldSeq ) { if ( this . getKeyField ( iKeyFieldSeq ) == null ) return null ; return this . getKeyField ( iKeyFieldSeq ) . getField ( DBConstants . FILE_KEY_AREA ) ; } | Get the Field in this KeyField . This is just a convenience to get the field from the KeyField . |
15,379 | public KeyField getKeyField ( int iKeyFieldSeq ) { if ( iKeyFieldSeq >= m_vKeyFieldList . size ( ) ) return null ; return ( KeyField ) m_vKeyFieldList . elementAt ( iKeyFieldSeq ) ; } | Get this Key Field . |
15,380 | public int getKeySeq ( ) { int iLastIndexArea = m_record . getKeyAreaCount ( ) - 1 + DBConstants . MAIN_KEY_AREA ; for ( int nIndex = DBConstants . MAIN_KEY_AREA ; nIndex <= iLastIndexArea ; nIndex ++ ) { KeyAreaInfo index = m_record . getKeyArea ( nIndex ) ; if ( index == null ) return - 1 ; if ( this == index ) return nIndex ; } return - 1 ; } | Get the seq of this key area . Get rid of this method . |
15,381 | public int lastModified ( int iAreaDesc , boolean bForceUniqueKey ) { int iLastKeyField = this . getKeyFields ( bForceUniqueKey , false ) - 1 ; for ( int iKeyFieldSeq = iLastKeyField ; iKeyFieldSeq >= DBConstants . MAIN_KEY_FIELD ; iKeyFieldSeq -- ) { KeyField keyField = this . getKeyField ( iKeyFieldSeq , bForceUniqueKey ) ; if ( keyField . getField ( iAreaDesc ) . isModified ( ) ) return iKeyFieldSeq ; } return - 1 ; } | Any of these key fields modified? |
15,382 | public void reverseBookmark ( Object bookmark , int iAreaDesc ) { if ( this . getKeyFields ( ) == 1 ) { BaseField field = this . getField ( iAreaDesc ) ; boolean [ ] rgbEnabled = field . setEnableListeners ( false ) ; field . setData ( bookmark , DBConstants . DONT_DISPLAY , DBConstants . INIT_MOVE ) ; field . setEnableListeners ( rgbEnabled ) ; } else { BaseBuffer buffer = ( BaseBuffer ) bookmark ; if ( buffer != null ) buffer . resetPosition ( ) ; this . reverseKeyBuffer ( buffer , iAreaDesc ) ; } } | Take this BOOKMARK handle and back it into the fields . |
15,383 | public Object setupBookmark ( int iAreaDesc ) { if ( this . getKeyFields ( ) == 1 ) return this . getField ( iAreaDesc ) . getData ( ) ; BaseBuffer buffer = new org . jbundle . thin . base . db . buff . str . StrBuffer ( null ) ; this . setupKeyBuffer ( buffer , iAreaDesc ) ; return buffer ; } | Create a BOOKMARK handle for this key area . |
15,384 | public void setupKeyBuffer ( BaseBuffer destBuffer , int iAreaDesc , boolean bMoveToField ) { boolean bForceUniqueKey = true ; int iKeyFieldCount = this . getKeyFields ( bForceUniqueKey , false ) ; for ( int iKeyFieldSeq = DBConstants . MAIN_KEY_FIELD ; iKeyFieldSeq < iKeyFieldCount ; iKeyFieldSeq ++ ) { KeyField keyField = this . getKeyField ( iKeyFieldSeq , bForceUniqueKey ) ; BaseField field = keyField . getField ( DBConstants . FILE_KEY_AREA ) ; BaseField paramField = keyField . getField ( iAreaDesc ) ; if ( bMoveToField ) if ( iAreaDesc != DBConstants . FILE_KEY_AREA ) { paramField . moveFieldToThis ( field , DBConstants . DONT_DISPLAY , DBConstants . INIT_MOVE ) ; boolean bIsModified = field . isModified ( ) ; paramField . setModified ( bIsModified ) ; } if ( destBuffer != null ) { destBuffer . addNextField ( paramField ) ; } } if ( destBuffer != null ) destBuffer . finishBuffer ( ) ; } | Set up the key area indicated . Remember to clear the destBuffer first . |
15,385 | public void zeroKeyFields ( int iAreaDesc ) { boolean bForceUniqueKey = true ; int iKeyFieldCount = this . getKeyFields ( bForceUniqueKey , false ) ; for ( int iKeyFieldSeq = DBConstants . MAIN_KEY_FIELD ; iKeyFieldSeq < iKeyFieldCount ; iKeyFieldSeq ++ ) { KeyField keyField = this . getKeyField ( iKeyFieldSeq , bForceUniqueKey ) ; BaseField thisField = keyField . getField ( DBConstants . FILE_KEY_AREA ) ; int limitDesc = iAreaDesc ; if ( keyField . getKeyOrder ( ) == DBConstants . DESCENDING ) { if ( iAreaDesc == DBConstants . START_SELECT_KEY ) limitDesc = DBConstants . END_SELECT_KEY ; else limitDesc = DBConstants . START_SELECT_KEY ; } thisField . setToLimit ( limitDesc ) ; thisField . setModified ( false ) ; keyField . getField ( iAreaDesc ) . moveFieldToThis ( thisField , false , DBConstants . INIT_MOVE ) ; keyField . getField ( iAreaDesc ) . setModified ( false ) ; } } | Initialize the Key Fields . |
15,386 | public void setKeyOrder ( boolean bKeyOrder ) { super . setKeyOrder ( bKeyOrder ) ; boolean bForceUniqueKey = true ; int iKeyFieldCount = this . getKeyFields ( bForceUniqueKey , false ) ; for ( int iKeyFieldSeq = DBConstants . MAIN_KEY_FIELD ; iKeyFieldSeq < iKeyFieldCount ; iKeyFieldSeq ++ ) { KeyField keyField = this . getKeyField ( iKeyFieldSeq , bForceUniqueKey ) ; keyField . setKeyOrder ( bKeyOrder ) ; } } | Order the keys ascending or descending? |
15,387 | public boolean isNull ( int iAreaDesc , boolean bIncludeTempFields ) { for ( int i = 0 ; i < this . getKeyFields ( false , bIncludeTempFields ) ; i ++ ) { if ( this . getField ( i ) != this . getRecord ( ) . getCounterField ( ) ) if ( this . getKeyField ( i ) . getField ( iAreaDesc ) . isNull ( ) ) return true ; } return false ; } | If any of the non - counter fields are null return true . |
15,388 | public boolean isNullable ( ) { for ( int i = 0 ; i < this . getKeyFields ( ) ; i ++ ) { if ( this . getKeyField ( i ) . getField ( DBConstants . FILE_KEY_AREA ) . isNullable ( ) ) return true ; } return false ; } | Can any of the fields in this key be null? |
15,389 | public long read ( ByteBuffer [ ] dsts , int offset , int length ) throws IOException { long rc = fillAppRead ( ) ; if ( rc <= 0 ) { return rc ; } return ByteBuffers . move ( appRead , dsts , offset , length ) ; } | Reads ByteBuffer from peer . Starts handshaking if needed . |
15,390 | public long write ( ByteBuffer [ ] srcs , int offset , int length ) throws IOException { appWrite . compact ( ) ; long len = ByteBuffers . move ( srcs , offset , length , appWrite ) ; appWrite . flip ( ) ; wrap ( ) ; return len ; } | Writes ByteBuffer to peer . Starts handshaking if needed . |
15,391 | public static String encodeBase64 ( byte [ ] rawData , int lineLength ) { if ( rawData == null ) { return "" ; } StringBuffer retval = new StringBuffer ( ) ; int i = 0 ; int n = 0 ; for ( ; i < rawData . length - 2 ; i += 3 ) { if ( lineLength > 0 && i > 0 && i % lineLength == 0 ) { retval . append ( "\n" ) ; } n = ( ( ( rawData [ i ] << 24 ) >>> 8 ) + ( ( rawData [ i + 1 ] << 24 ) >>> 16 ) + ( ( rawData [ i + 2 ] << 24 ) >>> 24 ) ) ; retval . append ( base64Chars . charAt ( ( n >>> 18 ) & 63 ) ) ; retval . append ( base64Chars . charAt ( ( n >>> 12 ) & 63 ) ) ; retval . append ( base64Chars . charAt ( ( n >>> 6 ) & 63 ) ) ; retval . append ( base64Chars . charAt ( n & 63 ) ) ; } if ( i + 1 == rawData . length ) { n = ( ( rawData [ i ] << 24 ) >>> 8 ) ; retval . append ( base64Chars . charAt ( ( n >>> 18 ) & 63 ) ) ; retval . append ( base64Chars . charAt ( ( n >>> 12 ) & 63 ) ) ; retval . append ( "==" ) ; } if ( i + 2 == rawData . length ) { n = ( ( rawData [ i ] << 24 ) >>> 8 ) + ( ( rawData [ i + 1 ] << 24 ) >>> 16 ) ; retval . append ( base64Chars . charAt ( ( n >>> 18 ) & 63 ) ) ; retval . append ( base64Chars . charAt ( ( n >>> 12 ) & 63 ) ) ; retval . append ( base64Chars . charAt ( ( n >>> 6 ) & 63 ) ) ; retval . append ( '=' ) ; } return retval . toString ( ) ; } | Converts a chunk of data into base 64 encoding . |
15,392 | public static byte [ ] decodeBase64 ( String encodedData ) { BufferedReader reader = new BufferedReader ( new StringReader ( encodedData ) ) ; int length = encodedData . length ( ) ; byte [ ] retval = new byte [ length ] ; int actualLength = 0 ; String line ; try { while ( ( line = reader . readLine ( ) ) != null ) { byte [ ] rawData = line . getBytes ( ) ; int n = 0 ; for ( int i = 0 ; i < rawData . length ; i += 4 ) { n = ( base64Chars . indexOf ( rawData [ i ] ) << 18 ) | ( base64Chars . indexOf ( rawData [ i + 1 ] ) << 12 ) ; retval [ actualLength ++ ] = ( byte ) ( ( n >>> 16 ) & 255 ) ; if ( rawData [ i + 2 ] != '=' ) { n |= ( base64Chars . indexOf ( rawData [ i + 2 ] ) << 6 ) ; retval [ actualLength ++ ] = ( byte ) ( ( n >>> 8 ) & 255 ) ; } if ( rawData [ i + 3 ] != '=' ) { n |= ( base64Chars . indexOf ( rawData [ i + 3 ] ) ) ; retval [ actualLength ++ ] = ( byte ) ( n & 255 ) ; } } } } catch ( IOException ioe ) { throw new IllegalStateException ( "exception while reading input with message: " + ioe ) ; } if ( actualLength != length ) { byte [ ] actualRetval = new byte [ actualLength ] ; System . arraycopy ( retval , 0 , actualRetval , 0 , actualLength ) ; return actualRetval ; } return retval ; } | Decodes base 64 encoded string . |
15,393 | public void init ( String strPageDesc ) { super . init ( null ) ; m_PageNo = 0 ; m_strPageDesc = strPageDesc ; if ( ( m_strPageDesc == null ) || ( m_strPageDesc . length ( ) == 0 ) ) m_strPageDesc = "Page" ; } | Initialize this Converter . |
15,394 | public Hashtable < String , Database > getDatabaseList ( int iDatabaseType ) { String strDbPrefix = this . getDatabasePrefix ( iDatabaseType ) ; iDatabaseType = iDatabaseType & DBConstants . TABLE_MASK ; if ( ( iDatabaseType & DBConstants . TABLE_TYPE_MASK ) == DBConstants . REMOTE ) if ( this . getProperty ( DBParams . LOCAL ) != null ) if ( this . getProperty ( DBParams . LOCAL ) . equals ( this . getProperty ( DBParams . REMOTE ) ) ) iDatabaseType = ( iDatabaseType & ~ DBConstants . TABLE_TYPE_MASK ) | DBConstants . LOCAL ; if ( ( iDatabaseType & DBConstants . TABLE_TYPE_MASK ) == DBConstants . TABLE ) if ( this . getProperty ( DBParams . LOCAL ) != null ) if ( this . getProperty ( DBParams . LOCAL ) . equals ( this . getProperty ( DBParams . TABLE ) ) ) iDatabaseType = ( iDatabaseType & ~ DBConstants . TABLE_TYPE_MASK ) | DBConstants . LOCAL ; if ( iDatabaseType == DBConstants . SCREEN ) iDatabaseType = ( iDatabaseType & ~ DBConstants . TABLE_TYPE_MASK ) | DBConstants . LOCAL ; if ( "Mapped" . equalsIgnoreCase ( strDbPrefix ) ) iDatabaseType = DBConstants . INTERNAL_MAPPED ; if ( m_htDatabaseList [ iDatabaseType ] == null ) m_htDatabaseList [ iDatabaseType ] = new Hashtable < String , Database > ( ) ; return m_htDatabaseList [ iDatabaseType ] ; } | Get the table that holds this type of database . |
15,395 | public boolean isConcreteDBClass ( String strDbPrefix ) { if ( ( DBParams . JDBC . equalsIgnoreCase ( strDbPrefix ) ) || ( "Serial" . equalsIgnoreCase ( strDbPrefix ) ) || ( "Soap" . equalsIgnoreCase ( strDbPrefix ) ) || ( "Xml" . equalsIgnoreCase ( strDbPrefix ) ) ) return true ; return false ; } | Is this DB type directly accessing the data? |
15,396 | public String getDatabasePrefix ( int iDatabaseType ) { int iDBType = ( iDatabaseType & DBConstants . TABLE_TYPE_MASK ) ; String strDbPrefix = null ; if ( iDBType == DBConstants . LOCAL ) strDbPrefix = this . getProperty ( DBParams . LOCAL ) ; else if ( iDBType == DBConstants . REMOTE ) strDbPrefix = this . getProperty ( DBParams . REMOTE ) ; else if ( iDBType == DBConstants . TABLE ) strDbPrefix = this . getProperty ( DBParams . TABLE ) ; else if ( iDBType == DBConstants . MEMORY ) strDbPrefix = DBParams . MEMORY ; else if ( iDBType == DBConstants . UNSHAREABLE_MEMORY ) strDbPrefix = DBParams . MEMORY ; else if ( iDBType == DBConstants . SYSTEM_DATABASE ) strDbPrefix = this . getProperty ( DBParams . REMOTE ) ; else if ( iDBType == DBConstants . REMOTE_MEMORY ) { strDbPrefix = this . getProperty ( DBParams . REMOTE ) ; if ( ( strDbPrefix == null ) || ( this . isConcreteDBClass ( strDbPrefix ) ) ) strDbPrefix = DBParams . MEMORY ; } if ( ( iDatabaseType & DBConstants . MAPPED ) != 0 ) if ( this . isConcreteDBClass ( strDbPrefix ) ) strDbPrefix = "Mapped" ; return strDbPrefix ; } | Get Database prefix . |
15,397 | public boolean removeDatabase ( Database database ) { database = ( BaseDatabase ) this . getDatabaseList ( ( database . getDatabaseType ( ) & DBConstants . TABLE_MASK ) ) . remove ( database . getDatabaseName ( false ) ) ; if ( database == null ) return false ; return true ; } | Remove this database from my database list . Do not call these directly used in database free . |
15,398 | private String getProperty ( String strProperty ) { String strValue = m_databaseOwner . getProperty ( strProperty ) ; if ( strValue == null ) if ( ! ( m_databaseOwner instanceof Environment ) ) if ( m_databaseOwner . getEnvironment ( ) != null ) strValue = ( ( Environment ) m_databaseOwner . getEnvironment ( ) ) . getProperty ( strProperty ) ; return strValue ; } | This is just a utility method to get the properties from the DB Owner . There is a slight difference between this getProperties and the one in the recordOwner . The recordowner getProperty method only checks up to the application . This method also checks the Environment properties . |
15,399 | public int fieldChanged ( boolean bDisplayOption , int iMoveMode ) { int value = ( int ) ( ( NumberField ) this . getOwner ( ) ) . getValue ( ) ; if ( ( value / 10 ) % 7 != value - ( value / 10 * 10 ) ) { Task task = null ; if ( this . getOwner ( ) != null ) if ( this . getOwner ( ) . getRecord ( ) != null ) task = this . getOwner ( ) . getRecord ( ) . getTask ( ) ; String strError = "Incorrect Magic number" ; if ( task != null ) { strError = ( ( BaseApplication ) task . getApplication ( ) ) . getResources ( ResourceConstants . ERROR_RESOURCE , true ) . getString ( strError ) ; return task . setLastError ( strError ) ; } return DBConstants . ERROR_RETURN ; } return super . fieldChanged ( bDisplayOption , iMoveMode ) ; } | The Field has Changed . Make sure this is a valid modulus - 7 number if not return an error . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.