idx
int64 0
165k
| question
stringlengths 73
5.81k
| target
stringlengths 5
918
|
---|---|---|
800 |
public void addNotBetween ( Object attribute , Object value1 , Object value2 ) { addSelectionCriteria ( ValueCriteria . buildNotBeweenCriteria ( attribute , value1 , value2 , getUserAlias ( attribute ) ) ) ; }
|
Adds NOT BETWEEN criteria customer_id not between 1 and 10
|
801 |
public void addIn ( Object attribute , Query subQuery ) { addSelectionCriteria ( ValueCriteria . buildInCriteria ( attribute , subQuery , getUserAlias ( attribute ) ) ) ; }
|
IN Criteria with SubQuery
|
802 |
public void addNotIn ( String attribute , Query subQuery ) { addSelectionCriteria ( ValueCriteria . buildNotInCriteria ( attribute , subQuery , getUserAlias ( attribute ) ) ) ; }
|
NOT IN Criteria with SubQuery
|
803 |
List getGroupby ( ) { List result = _getGroupby ( ) ; Iterator iter = getCriteria ( ) . iterator ( ) ; Object crit ; while ( iter . hasNext ( ) ) { crit = iter . next ( ) ; if ( crit instanceof Criteria ) { result . addAll ( ( ( Criteria ) crit ) . getGroupby ( ) ) ; } } return result ; }
|
Gets the groupby for ReportQueries of all Criteria and Sub Criteria the elements are of class FieldHelper
|
804 |
public void addGroupBy ( String [ ] fieldNames ) { for ( int i = 0 ; i < fieldNames . length ; i ++ ) { addGroupBy ( fieldNames [ i ] ) ; } }
|
Adds an array of groupby fieldNames for ReportQueries .
|
805 |
private static int getSqlInLimit ( ) { try { PersistenceBrokerConfiguration config = ( PersistenceBrokerConfiguration ) PersistenceBrokerFactory . getConfigurator ( ) . getConfigurationFor ( null ) ; return config . getSqlInLimit ( ) ; } catch ( ConfigurationException e ) { return 200 ; } }
|
read the prefetchInLimit from Config based on OJB . properties
|
806 |
private UserAlias getUserAlias ( Object attribute ) { if ( m_userAlias != null ) { return m_userAlias ; } if ( ! ( attribute instanceof String ) ) { return null ; } if ( m_alias == null ) { return null ; } if ( m_aliasPath == null ) { boolean allPathsAliased = true ; return new UserAlias ( m_alias , ( String ) attribute , allPathsAliased ) ; } return new UserAlias ( m_alias , ( String ) attribute , m_aliasPath ) ; }
|
Retrieves or if necessary creates a user alias to be used by a child criteria
|
807 |
public void setAlias ( String alias ) { if ( alias == null || alias . trim ( ) . equals ( "" ) ) { m_alias = null ; } else { m_alias = alias ; } for ( int i = 0 ; i < m_criteria . size ( ) ; i ++ ) { if ( ! ( m_criteria . elementAt ( i ) instanceof Criteria ) ) { ( ( SelectionCriteria ) m_criteria . elementAt ( i ) ) . setAlias ( m_alias ) ; } } }
|
Sets the alias . Empty String is regarded as null .
|
808 |
public void setAlias ( UserAlias userAlias ) { m_alias = userAlias . getName ( ) ; for ( int i = 0 ; i < m_criteria . size ( ) ; i ++ ) { if ( ! ( m_criteria . elementAt ( i ) instanceof Criteria ) ) { ( ( SelectionCriteria ) m_criteria . elementAt ( i ) ) . setAlias ( userAlias ) ; } } }
|
Sets the alias using a userAlias object .
|
809 |
public Map getPathClasses ( ) { if ( m_pathClasses . isEmpty ( ) ) { if ( m_parentCriteria == null ) { if ( m_query == null ) { return m_pathClasses ; } else { return m_query . getPathClasses ( ) ; } } else { return m_parentCriteria . getPathClasses ( ) ; } } else { return m_pathClasses ; } }
|
Gets the pathClasses . A Map containing hints about what Class to be used for what path segment If local instance not set try parent Criteria s instance . If this is the top - level Criteria try the m_query s instance
|
810 |
public void beforeBatch ( PreparedStatement stmt ) throws PlatformException { final Method methodSetExecuteBatch ; final Method methodSendBatch ; methodSetExecuteBatch = ClassHelper . getMethod ( stmt , "setExecuteBatch" , PARAM_TYPE_INTEGER ) ; methodSendBatch = ClassHelper . getMethod ( stmt , "sendBatch" , null ) ; final boolean statementBatchingSupported = methodSetExecuteBatch != null && methodSendBatch != null ; if ( statementBatchingSupported ) { try { methodSetExecuteBatch . invoke ( stmt , PARAM_STATEMENT_BATCH_SIZE ) ; m_batchStatementsInProgress . put ( stmt , methodSendBatch ) ; } catch ( Exception e ) { throw new PlatformException ( e . getLocalizedMessage ( ) , e ) ; } } else { super . beforeBatch ( stmt ) ; } }
|
Try Oracle update batching and call setExecuteBatch or revert to JDBC update batching . See 12 - 2 Update Batching in the Oracle9i JDBC Developer s Guide and Reference .
|
811 |
public void addBatch ( PreparedStatement stmt ) throws PlatformException { final boolean statementBatchingSupported = m_batchStatementsInProgress . containsKey ( stmt ) ; if ( statementBatchingSupported ) { try { stmt . executeUpdate ( ) ; } catch ( SQLException e ) { throw new PlatformException ( e . getLocalizedMessage ( ) , e ) ; } } else { super . addBatch ( stmt ) ; } }
|
Try Oracle update batching and call executeUpdate or revert to JDBC update batching .
|
812 |
public int [ ] executeBatch ( PreparedStatement stmt ) throws PlatformException { final Method methodSendBatch = ( Method ) m_batchStatementsInProgress . remove ( stmt ) ; final boolean statementBatchingSupported = methodSendBatch != null ; int [ ] retval = null ; if ( statementBatchingSupported ) { try { methodSendBatch . invoke ( stmt , null ) ; } catch ( Exception e ) { throw new PlatformException ( e . getLocalizedMessage ( ) , e ) ; } } else { retval = super . executeBatch ( stmt ) ; } return retval ; }
|
Try Oracle update batching and call sendBatch or revert to JDBC update batching .
|
813 |
public BeanDefinition toInternal ( BeanDefinitionInfo beanDefinitionInfo ) { if ( beanDefinitionInfo instanceof GenericBeanDefinitionInfo ) { GenericBeanDefinitionInfo genericInfo = ( GenericBeanDefinitionInfo ) beanDefinitionInfo ; GenericBeanDefinition def = new GenericBeanDefinition ( ) ; def . setBeanClassName ( genericInfo . getClassName ( ) ) ; if ( genericInfo . getPropertyValues ( ) != null ) { MutablePropertyValues propertyValues = new MutablePropertyValues ( ) ; for ( Entry < String , BeanMetadataElementInfo > entry : genericInfo . getPropertyValues ( ) . entrySet ( ) ) { BeanMetadataElementInfo info = entry . getValue ( ) ; propertyValues . add ( entry . getKey ( ) , toInternal ( info ) ) ; } def . setPropertyValues ( propertyValues ) ; } return def ; } else if ( beanDefinitionInfo instanceof ObjectBeanDefinitionInfo ) { ObjectBeanDefinitionInfo objectInfo = ( ObjectBeanDefinitionInfo ) beanDefinitionInfo ; return createBeanDefinitionByIntrospection ( objectInfo . getObject ( ) ) ; } else { throw new IllegalArgumentException ( "Conversion to internal of " + beanDefinitionInfo . getClass ( ) . getName ( ) + " not implemented" ) ; } }
|
Convert from a DTO to an internal Spring bean definition .
|
814 |
public BeanDefinitionInfo toDto ( BeanDefinition beanDefinition ) { if ( beanDefinition instanceof GenericBeanDefinition ) { GenericBeanDefinitionInfo info = new GenericBeanDefinitionInfo ( ) ; info . setClassName ( beanDefinition . getBeanClassName ( ) ) ; if ( beanDefinition . getPropertyValues ( ) != null ) { Map < String , BeanMetadataElementInfo > propertyValues = new HashMap < String , BeanMetadataElementInfo > ( ) ; for ( PropertyValue value : beanDefinition . getPropertyValues ( ) . getPropertyValueList ( ) ) { Object obj = value . getValue ( ) ; if ( obj instanceof BeanMetadataElement ) { propertyValues . put ( value . getName ( ) , toDto ( ( BeanMetadataElement ) obj ) ) ; } else { throw new IllegalArgumentException ( "Type " + obj . getClass ( ) . getName ( ) + " is not a BeanMetadataElement for property: " + value . getName ( ) ) ; } } info . setPropertyValues ( propertyValues ) ; } return info ; } else { throw new IllegalArgumentException ( "Conversion to DTO of " + beanDefinition . getClass ( ) . getName ( ) + " not implemented" ) ; } }
|
Convert from an internal Spring bean definition to a DTO .
|
815 |
private void validate ( Object object ) { Set < ConstraintViolation < Object > > viols = validator . validate ( object ) ; for ( ConstraintViolation < Object > constraintViolation : viols ) { if ( Null . class . isAssignableFrom ( constraintViolation . getConstraintDescriptor ( ) . getAnnotation ( ) . getClass ( ) ) ) { Object o = constraintViolation . getLeafBean ( ) ; Iterator < Node > iterator = constraintViolation . getPropertyPath ( ) . iterator ( ) ; String propertyName = null ; while ( iterator . hasNext ( ) ) { propertyName = iterator . next ( ) . getName ( ) ; } if ( propertyName != null ) { try { PropertyDescriptor descriptor = BeanUtils . getPropertyDescriptor ( o . getClass ( ) , propertyName ) ; descriptor . getWriteMethod ( ) . invoke ( o , new Object [ ] { null } ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } } } } }
|
Take a stab at fixing validation problems ?
|
816 |
protected void initializeJdbcConnection ( Connection con , JdbcConnectionDescriptor jcd ) throws LookupException { try { PlatformFactory . getPlatformFor ( jcd ) . initializeJdbcConnection ( jcd , con ) ; } catch ( PlatformException e ) { throw new LookupException ( "Platform dependent initialization of connection failed" , e ) ; } }
|
Initialize the connection with the specified properties in OJB configuration files and platform depended properties . Invoke this method after a NEW connection is created not if re - using from pool .
|
817 |
protected Connection newConnectionFromDataSource ( JdbcConnectionDescriptor jcd ) throws LookupException { Connection retval = null ; DataSource ds = jcd . getDataSource ( ) ; if ( ds == null ) { ds = ( DataSource ) dataSourceCache . get ( jcd . getDatasourceName ( ) ) ; } try { if ( ds == null ) { synchronized ( dataSourceCache ) { InitialContext ic = new InitialContext ( ) ; ds = ( DataSource ) ic . lookup ( jcd . getDatasourceName ( ) ) ; dataSourceCache . put ( jcd . getDatasourceName ( ) , ds ) ; } } if ( jcd . getUserName ( ) == null ) { retval = ds . getConnection ( ) ; } else { retval = ds . getConnection ( jcd . getUserName ( ) , jcd . getPassWord ( ) ) ; } } catch ( SQLException sqlEx ) { log . error ( "SQLException thrown while trying to get Connection from Datasource (" + jcd . getDatasourceName ( ) + ")" , sqlEx ) ; throw new LookupException ( "SQLException thrown while trying to get Connection from Datasource (" + jcd . getDatasourceName ( ) + ")" , sqlEx ) ; } catch ( NamingException namingEx ) { log . error ( "Naming Exception while looking up DataSource (" + jcd . getDatasourceName ( ) + ")" , namingEx ) ; throw new LookupException ( "Naming Exception while looking up DataSource (" + jcd . getDatasourceName ( ) + ")" , namingEx ) ; } initializeJdbcConnection ( retval , jcd ) ; if ( log . isDebugEnabled ( ) ) log . debug ( "Create new connection using DataSource: " + retval ) ; return retval ; }
|
Creates a new connection from the data source that the connection descriptor represents . If the connection descriptor does not directly contain the data source then a JNDI lookup is performed to retrieve the data source .
|
818 |
protected Connection newConnectionFromDriverManager ( JdbcConnectionDescriptor jcd ) throws LookupException { Connection retval = null ; final String driver = jcd . getDriver ( ) ; final String url = getDbURL ( jcd ) ; try { ClassHelper . getClass ( driver , true ) ; final String user = jcd . getUserName ( ) ; final String password = jcd . getPassWord ( ) ; final Properties properties = getJdbcProperties ( jcd , user , password ) ; if ( properties . isEmpty ( ) ) { if ( user == null ) { retval = DriverManager . getConnection ( url ) ; } else { retval = DriverManager . getConnection ( url , user , password ) ; } } else { retval = DriverManager . getConnection ( url , properties ) ; } } catch ( SQLException sqlEx ) { log . error ( "Error getting Connection from DriverManager with url (" + url + ") and driver (" + driver + ")" , sqlEx ) ; throw new LookupException ( "Error getting Connection from DriverManager with url (" + url + ") and driver (" + driver + ")" , sqlEx ) ; } catch ( ClassNotFoundException cnfEx ) { log . error ( cnfEx ) ; throw new LookupException ( "A class was not found" , cnfEx ) ; } catch ( Exception e ) { log . error ( "Instantiation of jdbc driver failed" , e ) ; throw new LookupException ( "Instantiation of jdbc driver failed" , e ) ; } initializeJdbcConnection ( retval , jcd ) ; if ( log . isDebugEnabled ( ) ) log . debug ( "Create new connection using DriverManager: " + retval ) ; return retval ; }
|
Returns a new created connection
|
819 |
private void prepareModel ( DescriptorRepository model ) { TreeMap result = new TreeMap ( ) ; for ( Iterator it = model . getDescriptorTable ( ) . values ( ) . iterator ( ) ; it . hasNext ( ) ; ) { ClassDescriptor classDesc = ( ClassDescriptor ) it . next ( ) ; if ( classDesc . getFullTableName ( ) == null ) { continue ; } String elementName = getElementName ( classDesc ) ; Table mappedTable = getTableFor ( elementName ) ; Map columnsMap = getColumnsFor ( elementName ) ; Map requiredAttributes = getRequiredAttributes ( elementName ) ; List classDescs = getClassDescriptorsMappingTo ( elementName ) ; if ( mappedTable == null ) { mappedTable = _schema . findTable ( classDesc . getFullTableName ( ) ) ; if ( mappedTable == null ) { continue ; } columnsMap = new TreeMap ( ) ; requiredAttributes = new HashMap ( ) ; classDescs = new ArrayList ( ) ; _elementToTable . put ( elementName , mappedTable ) ; _elementToClassDescriptors . put ( elementName , classDescs ) ; _elementToColumnMap . put ( elementName , columnsMap ) ; _elementToRequiredAttributesMap . put ( elementName , requiredAttributes ) ; } classDescs . add ( classDesc ) ; extractAttributes ( classDesc , mappedTable , columnsMap , requiredAttributes ) ; } extractIndirectionTables ( model , _schema ) ; }
|
Prepares a representation of the model that is easier accessible for our purposes .
|
820 |
protected final void subAppend ( final LoggingEvent event ) { if ( event instanceof ScheduledFileRollEvent ) { synchronized ( this ) { if ( this . closed ) { return ; } this . rollFile ( event ) ; } } else if ( event instanceof FileRollEvent ) { super . subAppend ( event ) ; } else { if ( event instanceof FoundationLof4jLoggingEvent ) { FoundationLof4jLoggingEvent foundationLof4jLoggingEvent = ( FoundationLof4jLoggingEvent ) event ; foundationLof4jLoggingEvent . setAppenderName ( this . getName ( ) ) ; } this . rollFile ( event ) ; super . subAppend ( event ) ; } }
|
Responsible for executing file rolls as and when required in addition to delegating to the super class to perform the actual append operation . Synchronized for safety during enforced file roll .
|
821 |
public void updateIntegerBelief ( String name , int value ) { introspector . storeBeliefValue ( this , name , getIntegerBelief ( name ) + value ) ; }
|
Updates the given integer belief adding the given integer newBelief = previousBelief + givenValue
|
822 |
public int getIntegerBelief ( String name ) { Object belief = introspector . getBeliefBase ( this ) . get ( name ) ; int count = 0 ; if ( belief != null ) { count = ( Integer ) belief ; } return ( Integer ) count ; }
|
Returns the integer value o the given belief
|
823 |
public < T > List < T > fromExcel ( final Blob excelBlob , final Class < T > cls , final String sheetName ) throws ExcelService . Exception { return fromExcel ( excelBlob , new WorksheetSpec ( cls , sheetName ) ) ; }
|
Returns a list of objects for each line in the spreadsheet of the specified type .
|
824 |
public TransactionImpl getCurrentTransaction ( ) { TransactionImpl tx = tx_table . get ( Thread . currentThread ( ) ) ; if ( tx == null ) { throw new TransactionNotInProgressException ( "Calling method needed transaction, but no transaction found for current thread :-(" ) ; } return tx ; }
|
Returns the current transaction for the calling thread .
|
825 |
public String getDefaultTableName ( ) { String name = getName ( ) ; int lastDotPos = name . lastIndexOf ( '.' ) ; int lastDollarPos = name . lastIndexOf ( '$' ) ; return lastDollarPos > lastDotPos ? name . substring ( lastDollarPos + 1 ) : name . substring ( lastDotPos + 1 ) ; }
|
Returns the default table name for this class which is the unqualified class name .
|
826 |
private void sortFields ( ) { HashMap fields = new HashMap ( ) ; ArrayList fieldsWithId = new ArrayList ( ) ; ArrayList fieldsWithoutId = new ArrayList ( ) ; FieldDescriptorDef fieldDef ; for ( Iterator it = getFields ( ) ; it . hasNext ( ) ; ) { fieldDef = ( FieldDescriptorDef ) it . next ( ) ; fields . put ( fieldDef . getName ( ) , fieldDef ) ; if ( fieldDef . hasProperty ( PropertyHelper . OJB_PROPERTY_ID ) ) { fieldsWithId . add ( fieldDef . getName ( ) ) ; } else { fieldsWithoutId . add ( fieldDef . getName ( ) ) ; } } Collections . sort ( fieldsWithId , new FieldWithIdComparator ( fields ) ) ; ArrayList result = new ArrayList ( ) ; for ( Iterator it = fieldsWithId . iterator ( ) ; it . hasNext ( ) ; ) { result . add ( getField ( ( String ) it . next ( ) ) ) ; } for ( Iterator it = fieldsWithoutId . iterator ( ) ; it . hasNext ( ) ; ) { result . add ( getField ( ( String ) it . next ( ) ) ) ; } _fields = result ; }
|
Sorts the fields .
|
827 |
public void checkConstraints ( String checkLevel ) throws ConstraintException { FieldDescriptorConstraints fieldConstraints = new FieldDescriptorConstraints ( ) ; ReferenceDescriptorConstraints refConstraints = new ReferenceDescriptorConstraints ( ) ; CollectionDescriptorConstraints collConstraints = new CollectionDescriptorConstraints ( ) ; for ( Iterator it = getFields ( ) ; it . hasNext ( ) ; ) { fieldConstraints . check ( ( FieldDescriptorDef ) it . next ( ) , checkLevel ) ; } for ( Iterator it = getReferences ( ) ; it . hasNext ( ) ; ) { refConstraints . check ( ( ReferenceDescriptorDef ) it . next ( ) , checkLevel ) ; } for ( Iterator it = getCollections ( ) ; it . hasNext ( ) ; ) { collConstraints . check ( ( CollectionDescriptorDef ) it . next ( ) , checkLevel ) ; } new ClassDescriptorConstraints ( ) . check ( this , checkLevel ) ; }
|
Checks the constraints on this class .
|
828 |
private boolean contains ( ArrayList defs , DefBase obj ) { for ( Iterator it = defs . iterator ( ) ; it . hasNext ( ) ; ) { if ( obj . getName ( ) . equals ( ( ( DefBase ) it . next ( ) ) . getName ( ) ) ) { return true ; } } return false ; }
|
Determines whether the given list contains a descriptor with the same name .
|
829 |
private FieldDescriptorDef cloneField ( FieldDescriptorDef fieldDef , String prefix ) { FieldDescriptorDef copyFieldDef = new FieldDescriptorDef ( fieldDef , prefix ) ; copyFieldDef . setOwner ( this ) ; copyFieldDef . setProperty ( PropertyHelper . OJB_PROPERTY_IGNORE , null ) ; Properties mod = getModification ( copyFieldDef . getName ( ) ) ; if ( mod != null ) { if ( ! PropertyHelper . toBoolean ( mod . getProperty ( PropertyHelper . OJB_PROPERTY_IGNORE ) , false ) && hasFeature ( copyFieldDef . getName ( ) ) ) { LogHelper . warn ( true , ClassDescriptorDef . class , "process" , "Class " + getName ( ) + " has a feature that has the same name as its included field " + copyFieldDef . getName ( ) + " from class " + fieldDef . getOwner ( ) . getName ( ) ) ; } copyFieldDef . applyModifications ( mod ) ; } return copyFieldDef ; }
|
Clones the given field .
|
830 |
private ReferenceDescriptorDef cloneReference ( ReferenceDescriptorDef refDef , String prefix ) { ReferenceDescriptorDef copyRefDef = new ReferenceDescriptorDef ( refDef , prefix ) ; copyRefDef . setOwner ( this ) ; copyRefDef . setProperty ( PropertyHelper . OJB_PROPERTY_IGNORE , null ) ; Properties mod = getModification ( copyRefDef . getName ( ) ) ; if ( mod != null ) { if ( ! PropertyHelper . toBoolean ( mod . getProperty ( PropertyHelper . OJB_PROPERTY_IGNORE ) , false ) && hasFeature ( copyRefDef . getName ( ) ) ) { LogHelper . warn ( true , ClassDescriptorDef . class , "process" , "Class " + getName ( ) + " has a feature that has the same name as its included reference " + copyRefDef . getName ( ) + " from class " + refDef . getOwner ( ) . getName ( ) ) ; } copyRefDef . applyModifications ( mod ) ; } return copyRefDef ; }
|
Clones the given reference .
|
831 |
private CollectionDescriptorDef cloneCollection ( CollectionDescriptorDef collDef , String prefix ) { CollectionDescriptorDef copyCollDef = new CollectionDescriptorDef ( collDef , prefix ) ; copyCollDef . setOwner ( this ) ; copyCollDef . setProperty ( PropertyHelper . OJB_PROPERTY_IGNORE , null ) ; Properties mod = getModification ( copyCollDef . getName ( ) ) ; if ( mod != null ) { if ( ! PropertyHelper . toBoolean ( mod . getProperty ( PropertyHelper . OJB_PROPERTY_IGNORE ) , false ) && hasFeature ( copyCollDef . getName ( ) ) ) { LogHelper . warn ( true , ClassDescriptorDef . class , "process" , "Class " + getName ( ) + " has a feature that has the same name as its included collection " + copyCollDef . getName ( ) + " from class " + collDef . getOwner ( ) . getName ( ) ) ; } copyCollDef . applyModifications ( mod ) ; } return copyCollDef ; }
|
Clones the given collection .
|
832 |
public Iterator getAllBaseTypes ( ) { ArrayList baseTypes = new ArrayList ( ) ; baseTypes . addAll ( _directBaseTypes . values ( ) ) ; for ( int idx = baseTypes . size ( ) - 1 ; idx >= 0 ; idx -- ) { ClassDescriptorDef curClassDef = ( ClassDescriptorDef ) baseTypes . get ( idx ) ; for ( Iterator it = curClassDef . getDirectBaseTypes ( ) ; it . hasNext ( ) ; ) { ClassDescriptorDef curBaseTypeDef = ( ClassDescriptorDef ) it . next ( ) ; if ( ! baseTypes . contains ( curBaseTypeDef ) ) { baseTypes . add ( 0 , curBaseTypeDef ) ; idx ++ ; } } } return baseTypes . iterator ( ) ; }
|
Returns all base types .
|
833 |
public Iterator getAllExtentClasses ( ) { ArrayList subTypes = new ArrayList ( ) ; subTypes . addAll ( _extents ) ; for ( int idx = 0 ; idx < subTypes . size ( ) ; idx ++ ) { ClassDescriptorDef curClassDef = ( ClassDescriptorDef ) subTypes . get ( idx ) ; for ( Iterator it = curClassDef . getExtentClasses ( ) ; it . hasNext ( ) ; ) { ClassDescriptorDef curSubTypeDef = ( ClassDescriptorDef ) it . next ( ) ; if ( ! subTypes . contains ( curSubTypeDef ) ) { subTypes . add ( curSubTypeDef ) ; } } } return subTypes . iterator ( ) ; }
|
Returns an iterator of all direct and indirect extents of this class .
|
834 |
public FieldDescriptorDef getField ( String name ) { FieldDescriptorDef fieldDef = null ; for ( Iterator it = _fields . iterator ( ) ; it . hasNext ( ) ; ) { fieldDef = ( FieldDescriptorDef ) it . next ( ) ; if ( fieldDef . getName ( ) . equals ( name ) ) { return fieldDef ; } } return null ; }
|
Returns the field definition with the specified name .
|
835 |
public ArrayList getFields ( String fieldNames ) throws NoSuchFieldException { ArrayList result = new ArrayList ( ) ; FieldDescriptorDef fieldDef ; String name ; for ( CommaListIterator it = new CommaListIterator ( fieldNames ) ; it . hasNext ( ) ; ) { name = it . getNext ( ) ; fieldDef = getField ( name ) ; if ( fieldDef == null ) { throw new NoSuchFieldException ( name ) ; } result . add ( fieldDef ) ; } return result ; }
|
Returns the field descriptors given in the the field names list .
|
836 |
public ArrayList getPrimaryKeys ( ) { ArrayList result = new ArrayList ( ) ; FieldDescriptorDef fieldDef ; for ( Iterator it = getFields ( ) ; it . hasNext ( ) ; ) { fieldDef = ( FieldDescriptorDef ) it . next ( ) ; if ( fieldDef . getBooleanProperty ( PropertyHelper . OJB_PROPERTY_PRIMARYKEY , false ) ) { result . add ( fieldDef ) ; } } return result ; }
|
Returns the primarykey fields .
|
837 |
public ReferenceDescriptorDef getReference ( String name ) { ReferenceDescriptorDef refDef ; for ( Iterator it = _references . iterator ( ) ; it . hasNext ( ) ; ) { refDef = ( ReferenceDescriptorDef ) it . next ( ) ; if ( refDef . getName ( ) . equals ( name ) ) { return refDef ; } } return null ; }
|
Returns a reference definition of the given name if it exists .
|
838 |
public CollectionDescriptorDef getCollection ( String name ) { CollectionDescriptorDef collDef = null ; for ( Iterator it = _collections . iterator ( ) ; it . hasNext ( ) ; ) { collDef = ( CollectionDescriptorDef ) it . next ( ) ; if ( collDef . getName ( ) . equals ( name ) ) { return collDef ; } } return null ; }
|
Returns the collection definition of the given name if it exists .
|
839 |
public NestedDef getNested ( String name ) { NestedDef nestedDef = null ; for ( Iterator it = _nested . iterator ( ) ; it . hasNext ( ) ; ) { nestedDef = ( NestedDef ) it . next ( ) ; if ( nestedDef . getName ( ) . equals ( name ) ) { return nestedDef ; } } return null ; }
|
Returns the nested object definition with the specified name .
|
840 |
public IndexDescriptorDef getIndexDescriptor ( String name ) { IndexDescriptorDef indexDef = null ; for ( Iterator it = _indexDescriptors . iterator ( ) ; it . hasNext ( ) ; ) { indexDef = ( IndexDescriptorDef ) it . next ( ) ; if ( indexDef . getName ( ) . equals ( name ) ) { return indexDef ; } } return null ; }
|
Returns the index descriptor definition of the given name if it exists .
|
841 |
public void addProcedure ( ProcedureDef procDef ) { procDef . setOwner ( this ) ; _procedures . put ( procDef . getName ( ) , procDef ) ; }
|
Adds a procedure definition to this class descriptor .
|
842 |
public void addProcedureArgument ( ProcedureArgumentDef argDef ) { argDef . setOwner ( this ) ; _procedureArguments . put ( argDef . getName ( ) , argDef ) ; }
|
Adds a procedure argument definition to this class descriptor .
|
843 |
public void processClass ( String template , Properties attributes ) throws XDocletException { if ( ! _model . hasClass ( getCurrentClass ( ) . getQualifiedName ( ) ) ) { LogHelper . debug ( true , OjbTagsHandler . class , "processClass" , "Type " + getCurrentClass ( ) . getQualifiedName ( ) ) ; } ClassDescriptorDef classDef = ensureClassDef ( getCurrentClass ( ) ) ; String attrName ; for ( Enumeration attrNames = attributes . propertyNames ( ) ; attrNames . hasMoreElements ( ) ; ) { attrName = ( String ) attrNames . nextElement ( ) ; classDef . setProperty ( attrName , attributes . getProperty ( attrName ) ) ; } _curClassDef = classDef ; generate ( template ) ; _curClassDef = null ; }
|
Sets the current class definition derived from the current class and optionally some attributes .
|
844 |
public void forAllClassDefinitions ( String template , Properties attributes ) throws XDocletException { for ( Iterator it = _model . getClasses ( ) ; it . hasNext ( ) ; ) { _curClassDef = ( ClassDescriptorDef ) it . next ( ) ; generate ( template ) ; } _curClassDef = null ; LogHelper . debug ( true , OjbTagsHandler . class , "forAllClassDefinitions" , "Processed " + _model . getNumClasses ( ) + " types" ) ; }
|
Processes the template for all class definitions .
|
845 |
public void originalClass ( String template , Properties attributes ) throws XDocletException { pushCurrentClass ( _curClassDef . getOriginalClass ( ) ) ; generate ( template ) ; popCurrentClass ( ) ; }
|
Processes the original class rather than the current class definition .
|
846 |
public String addExtent ( Properties attributes ) throws XDocletException { String name = attributes . getProperty ( ATTRIBUTE_NAME ) ; if ( ! _model . hasClass ( name ) ) { throw new XDocletException ( Translator . getString ( XDocletModulesOjbMessages . class , XDocletModulesOjbMessages . COULD_NOT_FIND_TYPE , new String [ ] { name } ) ) ; } _curClassDef . addExtentClass ( _model . getClass ( name ) ) ; return "" ; }
|
Adds an extent relation to the current class definition .
|
847 |
public void forAllExtents ( String template , Properties attributes ) throws XDocletException { for ( Iterator it = _curClassDef . getExtentClasses ( ) ; it . hasNext ( ) ; ) { _curExtent = ( ClassDescriptorDef ) it . next ( ) ; generate ( template ) ; } _curExtent = null ; }
|
Processes the template for all extents of the current class .
|
848 |
public String processIndexDescriptor ( Properties attributes ) throws XDocletException { String name = attributes . getProperty ( ATTRIBUTE_NAME ) ; IndexDescriptorDef indexDef = _curClassDef . getIndexDescriptor ( name ) ; String attrName ; if ( indexDef == null ) { indexDef = new IndexDescriptorDef ( name ) ; _curClassDef . addIndexDescriptor ( indexDef ) ; } if ( ( indexDef . getName ( ) == null ) || ( indexDef . getName ( ) . length ( ) == 0 ) ) { throw new XDocletException ( Translator . getString ( XDocletModulesOjbMessages . class , XDocletModulesOjbMessages . INDEX_NAME_MISSING , new String [ ] { _curClassDef . getName ( ) } ) ) ; } attributes . remove ( ATTRIBUTE_NAME ) ; for ( Enumeration attrNames = attributes . propertyNames ( ) ; attrNames . hasMoreElements ( ) ; ) { attrName = ( String ) attrNames . nextElement ( ) ; indexDef . setProperty ( attrName , attributes . getProperty ( attrName ) ) ; } return "" ; }
|
Processes an index descriptor tag .
|
849 |
public void forAllIndexDescriptorDefinitions ( String template , Properties attributes ) throws XDocletException { for ( Iterator it = _curClassDef . getIndexDescriptors ( ) ; it . hasNext ( ) ; ) { _curIndexDescriptorDef = ( IndexDescriptorDef ) it . next ( ) ; generate ( template ) ; } _curIndexDescriptorDef = null ; }
|
Processes the template for all index descriptors of the current class definition .
|
850 |
public void forAllIndexDescriptorColumns ( String template , Properties attributes ) throws XDocletException { String fields = _curIndexDescriptorDef . getProperty ( PropertyHelper . OJB_PROPERTY_FIELDS ) ; FieldDescriptorDef fieldDef ; String name ; for ( CommaListIterator it = new CommaListIterator ( fields ) ; it . hasNext ( ) ; ) { name = it . getNext ( ) ; fieldDef = _curClassDef . getField ( name ) ; if ( fieldDef == null ) { throw new XDocletException ( Translator . getString ( XDocletModulesOjbMessages . class , XDocletModulesOjbMessages . INDEX_FIELD_MISSING , new String [ ] { name , _curIndexDescriptorDef . getName ( ) , _curClassDef . getName ( ) } ) ) ; } _curIndexColumn = fieldDef . getProperty ( PropertyHelper . OJB_PROPERTY_COLUMN ) ; generate ( template ) ; } _curIndexColumn = null ; }
|
Processes the template for all index columns for the current index descriptor .
|
851 |
public String processObjectCache ( Properties attributes ) throws XDocletException { ObjectCacheDef objCacheDef = _curClassDef . setObjectCache ( attributes . getProperty ( ATTRIBUTE_CLASS ) ) ; String attrName ; attributes . remove ( ATTRIBUTE_CLASS ) ; for ( Enumeration attrNames = attributes . propertyNames ( ) ; attrNames . hasMoreElements ( ) ; ) { attrName = ( String ) attrNames . nextElement ( ) ; objCacheDef . setProperty ( attrName , attributes . getProperty ( attrName ) ) ; } return "" ; }
|
Processes an object cache tag .
|
852 |
public void forObjectCache ( String template , Properties attributes ) throws XDocletException { _curObjectCacheDef = _curClassDef . getObjectCache ( ) ; if ( _curObjectCacheDef != null ) { generate ( template ) ; _curObjectCacheDef = null ; } }
|
Processes the template for the object cache of the current class definition .
|
853 |
public String processProcedure ( Properties attributes ) throws XDocletException { String type = attributes . getProperty ( ATTRIBUTE_TYPE ) ; ProcedureDef procDef = _curClassDef . getProcedure ( type ) ; String attrName ; if ( procDef == null ) { procDef = new ProcedureDef ( type ) ; _curClassDef . addProcedure ( procDef ) ; } for ( Enumeration attrNames = attributes . propertyNames ( ) ; attrNames . hasMoreElements ( ) ; ) { attrName = ( String ) attrNames . nextElement ( ) ; procDef . setProperty ( attrName , attributes . getProperty ( attrName ) ) ; } return "" ; }
|
Processes a procedure tag .
|
854 |
public void forAllProcedures ( String template , Properties attributes ) throws XDocletException { for ( Iterator it = _curClassDef . getProcedures ( ) ; it . hasNext ( ) ; ) { _curProcedureDef = ( ProcedureDef ) it . next ( ) ; generate ( template ) ; } _curProcedureDef = null ; }
|
Processes the template for all procedures of the current class definition .
|
855 |
public String processProcedureArgument ( Properties attributes ) throws XDocletException { String id = attributes . getProperty ( ATTRIBUTE_NAME ) ; ProcedureArgumentDef argDef = _curClassDef . getProcedureArgument ( id ) ; String attrName ; if ( argDef == null ) { argDef = new ProcedureArgumentDef ( id ) ; _curClassDef . addProcedureArgument ( argDef ) ; } attributes . remove ( ATTRIBUTE_NAME ) ; for ( Enumeration attrNames = attributes . propertyNames ( ) ; attrNames . hasMoreElements ( ) ; ) { attrName = ( String ) attrNames . nextElement ( ) ; argDef . setProperty ( attrName , attributes . getProperty ( attrName ) ) ; } return "" ; }
|
Processes a runtime procedure argument tag .
|
856 |
public void forAllProcedureArguments ( String template , Properties attributes ) throws XDocletException { String argNameList = _curProcedureDef . getProperty ( PropertyHelper . OJB_PROPERTY_ARGUMENTS ) ; for ( CommaListIterator it = new CommaListIterator ( argNameList ) ; it . hasNext ( ) ; ) { _curProcedureArgumentDef = _curClassDef . getProcedureArgument ( it . getNext ( ) ) ; generate ( template ) ; } _curProcedureArgumentDef = null ; }
|
Processes the template for all procedure arguments of the current procedure .
|
857 |
public void processAnonymousField ( Properties attributes ) throws XDocletException { if ( ! attributes . containsKey ( ATTRIBUTE_NAME ) ) { throw new XDocletException ( Translator . getString ( XDocletModulesOjbMessages . class , XDocletModulesOjbMessages . PARAMETER_IS_REQUIRED , new String [ ] { ATTRIBUTE_NAME } ) ) ; } String name = attributes . getProperty ( ATTRIBUTE_NAME ) ; FieldDescriptorDef fieldDef = _curClassDef . getField ( name ) ; String attrName ; if ( fieldDef == null ) { fieldDef = new FieldDescriptorDef ( name ) ; _curClassDef . addField ( fieldDef ) ; } fieldDef . setAnonymous ( ) ; LogHelper . debug ( false , OjbTagsHandler . class , "processAnonymousField" , " Processing anonymous field " + fieldDef . getName ( ) ) ; attributes . remove ( ATTRIBUTE_NAME ) ; for ( Enumeration attrNames = attributes . propertyNames ( ) ; attrNames . hasMoreElements ( ) ; ) { attrName = ( String ) attrNames . nextElement ( ) ; fieldDef . setProperty ( attrName , attributes . getProperty ( attrName ) ) ; } fieldDef . setProperty ( PropertyHelper . OJB_PROPERTY_ACCESS , "anonymous" ) ; }
|
Processes an anonymous field definition specified at the class level .
|
858 |
public void processField ( String template , Properties attributes ) throws XDocletException { String name = OjbMemberTagsHandler . getMemberName ( ) ; String defaultType = getDefaultJdbcTypeForCurrentMember ( ) ; String defaultConversion = getDefaultJdbcConversionForCurrentMember ( ) ; FieldDescriptorDef fieldDef = _curClassDef . getField ( name ) ; String attrName ; if ( fieldDef == null ) { fieldDef = new FieldDescriptorDef ( name ) ; _curClassDef . addField ( fieldDef ) ; } LogHelper . debug ( false , OjbTagsHandler . class , "processField" , " Processing field " + fieldDef . getName ( ) ) ; for ( Enumeration attrNames = attributes . propertyNames ( ) ; attrNames . hasMoreElements ( ) ; ) { attrName = ( String ) attrNames . nextElement ( ) ; fieldDef . setProperty ( attrName , attributes . getProperty ( attrName ) ) ; } fieldDef . setProperty ( PropertyHelper . OJB_PROPERTY_JAVA_TYPE , OjbMemberTagsHandler . getMemberType ( ) . getQualifiedName ( ) ) ; fieldDef . setProperty ( PropertyHelper . OJB_PROPERTY_DEFAULT_JDBC_TYPE , defaultType ) ; if ( defaultConversion != null ) { fieldDef . setProperty ( PropertyHelper . OJB_PROPERTY_DEFAULT_CONVERSION , defaultConversion ) ; } _curFieldDef = fieldDef ; generate ( template ) ; _curFieldDef = null ; }
|
Sets the current field definition derived from the current member and optionally some attributes .
|
859 |
public void processAnonymousReference ( Properties attributes ) throws XDocletException { ReferenceDescriptorDef refDef = _curClassDef . getReference ( "super" ) ; String attrName ; if ( refDef == null ) { refDef = new ReferenceDescriptorDef ( "super" ) ; _curClassDef . addReference ( refDef ) ; } refDef . setAnonymous ( ) ; LogHelper . debug ( false , OjbTagsHandler . class , "processAnonymousReference" , " Processing anonymous reference" ) ; for ( Enumeration attrNames = attributes . propertyNames ( ) ; attrNames . hasMoreElements ( ) ; ) { attrName = ( String ) attrNames . nextElement ( ) ; refDef . setProperty ( attrName , attributes . getProperty ( attrName ) ) ; } }
|
Processes an anonymous reference definition .
|
860 |
public void processReference ( String template , Properties attributes ) throws XDocletException { String name = OjbMemberTagsHandler . getMemberName ( ) ; XClass type = OjbMemberTagsHandler . getMemberType ( ) ; int dim = OjbMemberTagsHandler . getMemberDimension ( ) ; ReferenceDescriptorDef refDef = _curClassDef . getReference ( name ) ; String attrName ; if ( refDef == null ) { refDef = new ReferenceDescriptorDef ( name ) ; _curClassDef . addReference ( refDef ) ; } LogHelper . debug ( false , OjbTagsHandler . class , "processReference" , " Processing reference " + refDef . getName ( ) ) ; for ( Enumeration attrNames = attributes . propertyNames ( ) ; attrNames . hasMoreElements ( ) ; ) { attrName = ( String ) attrNames . nextElement ( ) ; refDef . setProperty ( attrName , attributes . getProperty ( attrName ) ) ; } if ( type == null ) { throw new XDocletException ( Translator . getString ( XDocletModulesOjbMessages . class , XDocletModulesOjbMessages . COULD_NOT_DETERMINE_TYPE_OF_MEMBER , new String [ ] { name } ) ) ; } if ( dim > 0 ) { throw new XDocletException ( Translator . getString ( XDocletModulesOjbMessages . class , XDocletModulesOjbMessages . MEMBER_CANNOT_BE_A_REFERENCE , new String [ ] { name , _curClassDef . getName ( ) } ) ) ; } refDef . setProperty ( PropertyHelper . OJB_PROPERTY_VARIABLE_TYPE , type . getQualifiedName ( ) ) ; String typeName = searchForPersistentSubType ( type ) ; if ( typeName != null ) { refDef . setProperty ( PropertyHelper . OJB_PROPERTY_DEFAULT_CLASS_REF , typeName ) ; } _curReferenceDef = refDef ; generate ( template ) ; _curReferenceDef = null ; }
|
Sets the current reference definition derived from the current member and optionally some attributes .
|
861 |
public void forAllReferenceDefinitions ( String template , Properties attributes ) throws XDocletException { for ( Iterator it = _curClassDef . getReferences ( ) ; it . hasNext ( ) ; ) { _curReferenceDef = ( ReferenceDescriptorDef ) it . next ( ) ; if ( _curReferenceDef . isAnonymous ( ) && ( _curReferenceDef . getOwner ( ) != _curClassDef ) ) { continue ; } if ( ! isFeatureIgnored ( LEVEL_REFERENCE ) && ! _curReferenceDef . getBooleanProperty ( PropertyHelper . OJB_PROPERTY_IGNORE , false ) ) { generate ( template ) ; } } _curReferenceDef = null ; }
|
Processes the template for all reference definitions of the current class definition .
|
862 |
public void processCollection ( String template , Properties attributes ) throws XDocletException { String name = OjbMemberTagsHandler . getMemberName ( ) ; CollectionDescriptorDef collDef = _curClassDef . getCollection ( name ) ; String attrName ; if ( collDef == null ) { collDef = new CollectionDescriptorDef ( name ) ; _curClassDef . addCollection ( collDef ) ; } LogHelper . debug ( false , OjbTagsHandler . class , "processCollection" , " Processing collection " + collDef . getName ( ) ) ; for ( Enumeration attrNames = attributes . propertyNames ( ) ; attrNames . hasMoreElements ( ) ; ) { attrName = ( String ) attrNames . nextElement ( ) ; collDef . setProperty ( attrName , attributes . getProperty ( attrName ) ) ; } if ( OjbMemberTagsHandler . getMemberDimension ( ) > 0 ) { collDef . setProperty ( PropertyHelper . OJB_PROPERTY_ARRAY_ELEMENT_CLASS_REF , OjbMemberTagsHandler . getMemberType ( ) . getQualifiedName ( ) ) ; } else { collDef . setProperty ( PropertyHelper . OJB_PROPERTY_VARIABLE_TYPE , OjbMemberTagsHandler . getMemberType ( ) . getQualifiedName ( ) ) ; } _curCollectionDef = collDef ; generate ( template ) ; _curCollectionDef = null ; }
|
Sets the current collection definition derived from the current member and optionally some attributes .
|
863 |
public void forAllCollectionDefinitions ( String template , Properties attributes ) throws XDocletException { for ( Iterator it = _curClassDef . getCollections ( ) ; it . hasNext ( ) ; ) { _curCollectionDef = ( CollectionDescriptorDef ) it . next ( ) ; if ( ! isFeatureIgnored ( LEVEL_COLLECTION ) && ! _curCollectionDef . getBooleanProperty ( PropertyHelper . OJB_PROPERTY_IGNORE , false ) ) { generate ( template ) ; } } _curCollectionDef = null ; }
|
Processes the template for all collection definitions of the current class definition .
|
864 |
public String processNested ( Properties attributes ) throws XDocletException { String name = OjbMemberTagsHandler . getMemberName ( ) ; XClass type = OjbMemberTagsHandler . getMemberType ( ) ; int dim = OjbMemberTagsHandler . getMemberDimension ( ) ; NestedDef nestedDef = _curClassDef . getNested ( name ) ; if ( type == null ) { throw new XDocletException ( Translator . getString ( XDocletModulesOjbMessages . class , XDocletModulesOjbMessages . COULD_NOT_DETERMINE_TYPE_OF_MEMBER , new String [ ] { name } ) ) ; } if ( dim > 0 ) { throw new XDocletException ( Translator . getString ( XDocletModulesOjbMessages . class , XDocletModulesOjbMessages . MEMBER_CANNOT_BE_NESTED , new String [ ] { name , _curClassDef . getName ( ) } ) ) ; } ClassDescriptorDef nestedTypeDef = _model . getClass ( type . getQualifiedName ( ) ) ; if ( nestedTypeDef == null ) { throw new XDocletException ( Translator . getString ( XDocletModulesOjbMessages . class , XDocletModulesOjbMessages . COULD_NOT_DETERMINE_TYPE_OF_MEMBER , new String [ ] { name } ) ) ; } if ( nestedDef == null ) { nestedDef = new NestedDef ( name , nestedTypeDef ) ; _curClassDef . addNested ( nestedDef ) ; } LogHelper . debug ( false , OjbTagsHandler . class , "processNested" , " Processing nested object " + nestedDef . getName ( ) + " of type " + nestedTypeDef . getName ( ) ) ; String attrName ; for ( Enumeration attrNames = attributes . propertyNames ( ) ; attrNames . hasMoreElements ( ) ; ) { attrName = ( String ) attrNames . nextElement ( ) ; nestedDef . setProperty ( attrName , attributes . getProperty ( attrName ) ) ; } return "" ; }
|
Addes the current member as a nested object .
|
865 |
public String createTorqueSchema ( Properties attributes ) throws XDocletException { String dbName = ( String ) getDocletContext ( ) . getConfigParam ( CONFIG_PARAM_DATABASENAME ) ; _torqueModel = new TorqueModelDef ( dbName , _model ) ; return "" ; }
|
Generates a torque schema for the model .
|
866 |
public void forAllTables ( String template , Properties attributes ) throws XDocletException { for ( Iterator it = _torqueModel . getTables ( ) ; it . hasNext ( ) ; ) { _curTableDef = ( TableDef ) it . next ( ) ; generate ( template ) ; } _curTableDef = null ; }
|
Processes the template for all table definitions in the torque model .
|
867 |
public void forAllColumns ( String template , Properties attributes ) throws XDocletException { for ( Iterator it = _curTableDef . getColumns ( ) ; it . hasNext ( ) ; ) { _curColumnDef = ( ColumnDef ) it . next ( ) ; generate ( template ) ; } _curColumnDef = null ; }
|
Processes the template for all column definitions of the current table .
|
868 |
public void forAllForeignkeys ( String template , Properties attributes ) throws XDocletException { for ( Iterator it = _curTableDef . getForeignkeys ( ) ; it . hasNext ( ) ; ) { _curForeignkeyDef = ( ForeignkeyDef ) it . next ( ) ; generate ( template ) ; } _curForeignkeyDef = null ; }
|
Processes the template for all foreignkeys of the current table .
|
869 |
public void forAllForeignkeyColumnPairs ( String template , Properties attributes ) throws XDocletException { for ( int idx = 0 ; idx < _curForeignkeyDef . getNumColumnPairs ( ) ; idx ++ ) { _curPairLeft = _curForeignkeyDef . getLocalColumn ( idx ) ; _curPairRight = _curForeignkeyDef . getRemoteColumn ( idx ) ; generate ( template ) ; } _curPairLeft = null ; _curPairRight = null ; }
|
Processes the template for all column pairs of the current foreignkey .
|
870 |
public void forAllIndices ( String template , Properties attributes ) throws XDocletException { boolean processUnique = TypeConversionUtil . stringToBoolean ( attributes . getProperty ( ATTRIBUTE_UNIQUE ) , false ) ; _curIndexDef = _curTableDef . getIndex ( null ) ; if ( ( _curIndexDef != null ) && ( processUnique == _curIndexDef . isUnique ( ) ) ) { generate ( template ) ; } for ( Iterator it = _curTableDef . getIndices ( ) ; it . hasNext ( ) ; ) { _curIndexDef = ( IndexDef ) it . next ( ) ; if ( ! _curIndexDef . isDefault ( ) && ( processUnique == _curIndexDef . isUnique ( ) ) ) { generate ( template ) ; } } _curIndexDef = null ; }
|
Processes the template for all indices of the current table .
|
871 |
public void forAllIndexColumns ( String template , Properties attributes ) throws XDocletException { for ( Iterator it = _curIndexDef . getColumns ( ) ; it . hasNext ( ) ; ) { _curColumnDef = _curTableDef . getColumn ( ( String ) it . next ( ) ) ; generate ( template ) ; } _curColumnDef = null ; }
|
Processes the template for all columns of the current table index .
|
872 |
public String name ( Properties attributes ) throws XDocletException { return getDefForLevel ( attributes . getProperty ( ATTRIBUTE_LEVEL ) ) . getName ( ) ; }
|
Returns the name of the current object on the specified level .
|
873 |
public void ifHasName ( String template , Properties attributes ) throws XDocletException { String name = getDefForLevel ( attributes . getProperty ( ATTRIBUTE_LEVEL ) ) . getName ( ) ; if ( ( name != null ) && ( name . length ( ) > 0 ) ) { generate ( template ) ; } }
|
Processes the template if the current object on the specified level has a non - empty name .
|
874 |
public void ifHasProperty ( String template , Properties attributes ) throws XDocletException { String value = getPropertyValue ( attributes . getProperty ( ATTRIBUTE_LEVEL ) , attributes . getProperty ( ATTRIBUTE_NAME ) ) ; if ( value != null ) { generate ( template ) ; } }
|
Determines whether the current object on the specified level has a specific property and if so processes the template
|
875 |
public String propertyValue ( Properties attributes ) throws XDocletException { String value = getPropertyValue ( attributes . getProperty ( ATTRIBUTE_LEVEL ) , attributes . getProperty ( ATTRIBUTE_NAME ) ) ; if ( value == null ) { value = attributes . getProperty ( ATTRIBUTE_DEFAULT ) ; } return value ; }
|
Returns the value of a property of the current object on the specified level .
|
876 |
public void ifPropertyValueEquals ( String template , Properties attributes ) throws XDocletException { String value = getPropertyValue ( attributes . getProperty ( ATTRIBUTE_LEVEL ) , attributes . getProperty ( ATTRIBUTE_NAME ) ) ; String expected = attributes . getProperty ( ATTRIBUTE_VALUE ) ; if ( value == null ) { value = attributes . getProperty ( ATTRIBUTE_DEFAULT ) ; } if ( expected . equals ( value ) ) { generate ( template ) ; } }
|
Processes the template if the property value of the current object on the specified level equals the given value .
|
877 |
public void forAllValuePairs ( String template , Properties attributes ) throws XDocletException { String name = attributes . getProperty ( ATTRIBUTE_NAME , "attributes" ) ; String defaultValue = attributes . getProperty ( ATTRIBUTE_DEFAULT_RIGHT , "" ) ; String attributePairs = getPropertyValue ( attributes . getProperty ( ATTRIBUTE_LEVEL ) , name ) ; if ( ( attributePairs == null ) || ( attributePairs . length ( ) == 0 ) ) { return ; } String token ; int pos ; for ( CommaListIterator it = new CommaListIterator ( attributePairs ) ; it . hasNext ( ) ; ) { token = it . getNext ( ) ; pos = token . indexOf ( '=' ) ; if ( pos >= 0 ) { _curPairLeft = token . substring ( 0 , pos ) ; _curPairRight = ( pos < token . length ( ) - 1 ? token . substring ( pos + 1 ) : defaultValue ) ; } else { _curPairLeft = token ; _curPairRight = defaultValue ; } if ( _curPairLeft . length ( ) > 0 ) { generate ( template ) ; } } _curPairLeft = null ; _curPairRight = null ; }
|
Processes the template for the comma - separated value pairs in an attribute of the current object on the specified level .
|
878 |
private ClassDescriptorDef ensureClassDef ( XClass original ) { String name = original . getQualifiedName ( ) ; ClassDescriptorDef classDef = _model . getClass ( name ) ; if ( classDef == null ) { classDef = new ClassDescriptorDef ( original ) ; _model . addClass ( classDef ) ; } return classDef ; }
|
Makes sure that there is a class definition for the given qualified name and returns it .
|
879 |
private void addDirectSubTypes ( XClass type , ArrayList subTypes ) { if ( type . isInterface ( ) ) { if ( type . getExtendingInterfaces ( ) != null ) { subTypes . addAll ( type . getExtendingInterfaces ( ) ) ; } if ( type . getImplementingClasses ( ) != null ) { Collection declaredInterfaces = null ; XClass subType ; for ( Iterator it = type . getImplementingClasses ( ) . iterator ( ) ; it . hasNext ( ) ; ) { subType = ( XClass ) it . next ( ) ; if ( subType instanceof AbstractClass ) { declaredInterfaces = ( ( AbstractClass ) subType ) . getDeclaredInterfaces ( ) ; if ( ( declaredInterfaces != null ) && declaredInterfaces . contains ( type ) ) { subTypes . add ( subType ) ; } } else { subTypes . add ( subType ) ; } } } } else { subTypes . addAll ( type . getDirectSubclasses ( ) ) ; } }
|
Adds all direct subtypes to the given list .
|
880 |
private String searchForPersistentSubType ( XClass type ) { ArrayList queue = new ArrayList ( ) ; XClass subType ; queue . add ( type ) ; while ( ! queue . isEmpty ( ) ) { subType = ( XClass ) queue . get ( 0 ) ; queue . remove ( 0 ) ; if ( _model . hasClass ( subType . getQualifiedName ( ) ) ) { return subType . getQualifiedName ( ) ; } addDirectSubTypes ( subType , queue ) ; } return null ; }
|
Searches the type and its sub types for the nearest ojb - persistent type and returns its name .
|
881 |
private DefBase getDefForLevel ( String level ) { if ( LEVEL_CLASS . equals ( level ) ) { return _curClassDef ; } else if ( LEVEL_FIELD . equals ( level ) ) { return _curFieldDef ; } else if ( LEVEL_REFERENCE . equals ( level ) ) { return _curReferenceDef ; } else if ( LEVEL_COLLECTION . equals ( level ) ) { return _curCollectionDef ; } else if ( LEVEL_OBJECT_CACHE . equals ( level ) ) { return _curObjectCacheDef ; } else if ( LEVEL_INDEX_DESC . equals ( level ) ) { return _curIndexDescriptorDef ; } else if ( LEVEL_TABLE . equals ( level ) ) { return _curTableDef ; } else if ( LEVEL_COLUMN . equals ( level ) ) { return _curColumnDef ; } else if ( LEVEL_FOREIGNKEY . equals ( level ) ) { return _curForeignkeyDef ; } else if ( LEVEL_INDEX . equals ( level ) ) { return _curIndexDef ; } else if ( LEVEL_PROCEDURE . equals ( level ) ) { return _curProcedureDef ; } else if ( LEVEL_PROCEDURE_ARGUMENT . equals ( level ) ) { return _curProcedureArgumentDef ; } else { return null ; } }
|
Returns the current definition on the indicated level .
|
882 |
private String getPropertyValue ( String level , String name ) { return getDefForLevel ( level ) . getProperty ( name ) ; }
|
Returns the value of the indicated property of the current object on the specified level .
|
883 |
final void compress ( final File backupFile , final AppenderRollingProperties properties ) { if ( this . isCompressed ( backupFile ) ) { LogLog . debug ( "Backup log file " + backupFile . getName ( ) + " is already compressed" ) ; return ; } final long lastModified = backupFile . lastModified ( ) ; if ( 0L == lastModified ) { LogLog . debug ( "Backup log file " + backupFile . getName ( ) + " may have been scavenged" ) ; return ; } final File deflatedFile = this . createDeflatedFile ( backupFile ) ; if ( deflatedFile == null ) { LogLog . debug ( "Backup log file " + backupFile . getName ( ) + " may have been scavenged" ) ; return ; } if ( this . compress ( backupFile , deflatedFile , properties ) ) { deflatedFile . setLastModified ( lastModified ) ; FileHelper . getInstance ( ) . deleteExisting ( backupFile ) ; LogLog . debug ( "Compressed backup log file to " + deflatedFile . getName ( ) ) ; } else { FileHelper . getInstance ( ) . deleteExisting ( deflatedFile ) ; LogLog . debug ( "Unable to compress backup log file " + backupFile . getName ( ) ) ; } }
|
Template method responsible for file compression checks file creation and delegation to specific strategy implementations .
|
884 |
public static PersistenceBroker createPersistenceBroker ( String jcdAlias , String user , String password ) throws PBFactoryException { return PersistenceBrokerFactoryFactory . instance ( ) . createPersistenceBroker ( jcdAlias , user , password ) ; }
|
Creates a new broker instance .
|
885 |
public void setRegistrationConfig ( RegistrationConfig registrationConfig ) { this . registrationConfig = registrationConfig ; if ( registrationConfig . getDefaultConfig ( ) != null ) { for ( String key : registrationConfig . getDefaultConfig ( ) . keySet ( ) ) { dynamicConfig . put ( key , registrationConfig . getDefaultConfig ( ) . get ( key ) ) ; } } }
|
The mediator registration config . If it contains default config and definitions then the dynamic config will be initialized with those values .
|
886 |
public void characters ( char ch [ ] , int start , int length ) { if ( m_CurrentString == null ) m_CurrentString = new String ( ch , start , length ) ; else m_CurrentString += new String ( ch , start , length ) ; }
|
characters callback .
|
887 |
public synchronized boolean hasNext ( ) { try { if ( ! isHasCalledCheck ( ) ) { setHasCalledCheck ( true ) ; setHasNext ( getRsAndStmt ( ) . m_rs . next ( ) ) ; if ( ! getHasNext ( ) ) { autoReleaseDbResources ( ) ; } } } catch ( Exception ex ) { setHasNext ( false ) ; autoReleaseDbResources ( ) ; if ( ex instanceof ResourceClosedException ) { throw ( ResourceClosedException ) ex ; } if ( ex instanceof SQLException ) { throw new PersistenceBrokerSQLException ( "Calling ResultSet.next() failed" , ( SQLException ) ex ) ; } else { throw new PersistenceBrokerException ( "Can't get next row from ResultSet" , ex ) ; } } if ( logger . isDebugEnabled ( ) ) logger . debug ( "hasNext() -> " + getHasNext ( ) ) ; return getHasNext ( ) ; }
|
returns true if there are still more rows in the underlying ResultSet . Returns false if ResultSet is exhausted .
|
888 |
public synchronized Object next ( ) throws NoSuchElementException { try { if ( ! isHasCalledCheck ( ) ) { hasNext ( ) ; } setHasCalledCheck ( false ) ; if ( getHasNext ( ) ) { Object obj = getObjectFromResultSet ( ) ; m_current_row ++ ; if ( ! disableLifeCycleEvents ) { getAfterLookupEvent ( ) . setTarget ( obj ) ; getBroker ( ) . fireBrokerEvent ( getAfterLookupEvent ( ) ) ; getAfterLookupEvent ( ) . setTarget ( null ) ; } return obj ; } else { throw new NoSuchElementException ( "inner hasNext was false" ) ; } } catch ( ResourceClosedException ex ) { autoReleaseDbResources ( ) ; throw ex ; } catch ( NoSuchElementException ex ) { autoReleaseDbResources ( ) ; logger . error ( "Error while iterate ResultSet for query " + m_queryObject , ex ) ; throw new NoSuchElementException ( "Could not obtain next object: " + ex . getMessage ( ) ) ; } }
|
moves to the next row of the underlying ResultSet and returns the corresponding Object materialized from this row .
|
889 |
private Collection getOwnerObjects ( ) { Collection owners = new Vector ( ) ; while ( hasNext ( ) ) { owners . add ( next ( ) ) ; } return owners ; }
|
read all objects of this iterator . objects will be placed in cache
|
890 |
private void prefetchRelationships ( Query query ) { List prefetchedRel ; Collection owners ; String relName ; RelationshipPrefetcher [ ] prefetchers ; if ( query == null || query . getPrefetchedRelationships ( ) == null || query . getPrefetchedRelationships ( ) . isEmpty ( ) ) { return ; } if ( ! supportsAdvancedJDBCCursorControl ( ) ) { logger . info ( "prefetching relationships requires JDBC level 2.0" ) ; return ; } setInBatchedMode ( true ) ; prefetchedRel = query . getPrefetchedRelationships ( ) ; prefetchers = new RelationshipPrefetcher [ prefetchedRel . size ( ) ] ; for ( int i = 0 ; i < prefetchedRel . size ( ) ; i ++ ) { relName = ( String ) prefetchedRel . get ( i ) ; prefetchers [ i ] = getBroker ( ) . getRelationshipPrefetcherFactory ( ) . createRelationshipPrefetcher ( getQueryObject ( ) . getClassDescriptor ( ) , relName ) ; prefetchers [ i ] . prepareRelationshipSettings ( ) ; } owners = getOwnerObjects ( ) ; for ( int i = 0 ; i < prefetchedRel . size ( ) ; i ++ ) { prefetchers [ i ] . prefetchRelationship ( owners ) ; } for ( int i = 0 ; i < prefetchedRel . size ( ) ; i ++ ) { prefetchers [ i ] . restoreRelationshipSettings ( ) ; } try { getRsAndStmt ( ) . m_rs . beforeFirst ( ) ; } catch ( SQLException e ) { logger . error ( "beforeFirst failed !" , e ) ; } setInBatchedMode ( false ) ; setHasCalledCheck ( false ) ; }
|
prefetch defined relationships requires JDBC level 2 . 0 does not work with Arrays
|
891 |
protected Object getProxyFromResultSet ( ) throws PersistenceBrokerException { Identity oid = getIdentityFromResultSet ( ) ; return getBroker ( ) . createProxy ( getItemProxyClass ( ) , oid ) ; }
|
Reads primary key information from current RS row and generates a
|
892 |
protected int countedSize ( ) throws PersistenceBrokerException { Query countQuery = getBroker ( ) . serviceBrokerHelper ( ) . getCountQuery ( getQueryObject ( ) . getQuery ( ) ) ; ResultSetAndStatement rsStmt ; ClassDescriptor cld = getQueryObject ( ) . getClassDescriptor ( ) ; int count = 0 ; if ( countQuery instanceof QueryBySQL ) { String countSql = ( ( QueryBySQL ) countQuery ) . getSql ( ) ; rsStmt = getBroker ( ) . serviceJdbcAccess ( ) . executeSQL ( countSql , cld , Query . NOT_SCROLLABLE ) ; } else { rsStmt = getBroker ( ) . serviceJdbcAccess ( ) . executeQuery ( countQuery , cld ) ; } try { if ( rsStmt . m_rs . next ( ) ) { count = rsStmt . m_rs . getInt ( 1 ) ; } } catch ( SQLException e ) { throw new PersistenceBrokerException ( e ) ; } finally { rsStmt . close ( ) ; } return count ; }
|
Answer the counted size
|
893 |
public boolean absolute ( int row ) throws PersistenceBrokerException { boolean retval ; if ( supportsAdvancedJDBCCursorControl ( ) ) { retval = absoluteAdvanced ( row ) ; } else { retval = absoluteBasic ( row ) ; } return retval ; }
|
Moves the cursor to the given row number in the iterator . If the row number is positive the cursor moves to the given row number with respect to the beginning of the iterator . The first row is row 1 the second is row 2 and so on .
|
894 |
private boolean absoluteBasic ( int row ) { boolean retval = false ; if ( row > m_current_row ) { try { while ( m_current_row < row && getRsAndStmt ( ) . m_rs . next ( ) ) { m_current_row ++ ; } if ( m_current_row == row ) { retval = true ; } else { setHasCalledCheck ( true ) ; setHasNext ( false ) ; retval = false ; autoReleaseDbResources ( ) ; } } catch ( Exception ex ) { setHasCalledCheck ( true ) ; setHasNext ( false ) ; retval = false ; } } else { logger . info ( "Your driver does not support advanced JDBC Functionality, " + "you cannot call absolute() with a position < current" ) ; } return retval ; }
|
absolute for basicJDBCSupport
|
895 |
private boolean absoluteAdvanced ( int row ) { boolean retval = false ; try { if ( getRsAndStmt ( ) . m_rs != null ) { if ( row == 0 ) { getRsAndStmt ( ) . m_rs . beforeFirst ( ) ; } else { retval = getRsAndStmt ( ) . m_rs . absolute ( row ) ; } m_current_row = row ; setHasCalledCheck ( false ) ; } } catch ( SQLException e ) { advancedJDBCSupport = false ; } return retval ; }
|
absolute for advancedJDBCSupport
|
896 |
private String safeToString ( Object obj ) { String toString = null ; if ( obj != null ) { try { toString = obj . toString ( ) ; } catch ( Throwable ex ) { toString = "BAD toString() impl for " + obj . getClass ( ) . getName ( ) ; } } return toString ; }
|
provides a safe toString
|
897 |
public void setRowReader ( String newReaderClassName ) { try { m_rowReader = ( RowReader ) ClassHelper . newInstance ( newReaderClassName , ClassDescriptor . class , this ) ; } catch ( Exception e ) { throw new MetadataException ( "Instantiating of current set RowReader failed" , e ) ; } }
|
sets the row reader class name for thie class descriptor
|
898 |
public void setClassOfObject ( Class c ) { m_Class = c ; isAbstract = Modifier . isAbstract ( m_Class . getModifiers ( ) ) ; }
|
sets the class object described by this descriptor .
|
899 |
public void addFieldDescriptor ( FieldDescriptor fld ) { fld . setClassDescriptor ( this ) ; if ( m_FieldDescriptions == null ) { m_FieldDescriptions = new FieldDescriptor [ 1 ] ; m_FieldDescriptions [ 0 ] = fld ; } else { int size = m_FieldDescriptions . length ; FieldDescriptor [ ] tmpArray = new FieldDescriptor [ size + 1 ] ; System . arraycopy ( m_FieldDescriptions , 0 , tmpArray , 0 , size ) ; tmpArray [ size ] = fld ; m_FieldDescriptions = tmpArray ; Arrays . sort ( m_FieldDescriptions , FieldDescriptor . getComparator ( ) ) ; } m_fieldDescriptorNameMap = null ; m_PkFieldDescriptors = null ; m_nonPkFieldDescriptors = null ; m_lockingFieldDescriptors = null ; m_RwFieldDescriptors = null ; m_RwNonPkFieldDescriptors = null ; }
|
adds a FIELDDESCRIPTOR to this ClassDescriptor .
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.