idx
int64
0
165k
question
stringlengths
73
4.15k
target
stringlengths
5
918
len_question
int64
21
890
len_target
int64
3
255
700
private boolean isSpecial ( final char chr ) { return ( ( chr == ' ' ) || ( chr == ' ' ) || ( chr == ' ' ) || ( chr == ' ' ) || ( chr == ' ' ) || ( chr == ' ' ) || ( chr == ' ' ) || ( chr == ' ' ) || ( chr == ' ' ) || ( chr == ' ' ) || ( chr == ' ' ) || ( chr == ' ' ) || ( chr == ' ' ) ) ; }
Convenience method to determine if a character is special to the regex system .
119
16
701
private String fixSpecials ( final String inString ) { StringBuilder tmp = new StringBuilder ( ) ; for ( int i = 0 ; i < inString . length ( ) ; i ++ ) { char chr = inString . charAt ( i ) ; if ( isSpecial ( chr ) ) { tmp . append ( this . escape ) ; tmp . append ( chr ) ; } else { tmp . append ( chr ) ; } } return tmp...
Convenience method to escape any character that is special to the regex system .
104
16
702
protected PreparedStatement prepareStatement ( Connection con , String sql , boolean scrollable , boolean createPreparedStatement , int explicitFetchSizeHint ) throws SQLException { PreparedStatement result ; // if a JDBC1.0 driver is used the signature // prepareStatement(String, int, int) is not defined. // we then c...
Prepares a statement with parameters that should work with most RDBMS .
604
15
703
private Statement createStatement ( Connection con , boolean scrollable , int explicitFetchSizeHint ) throws java . sql . SQLException { Statement result ; try { // if necessary use JDBC1.0 methods if ( ! FORCEJDBC1_0 ) { result = con . createStatement ( scrollable ? ResultSet . TYPE_SCROLL_INSENSITIVE : ResultSet . TY...
Creates a statement with parameters that should work with most RDBMS .
418
15
704
public int compareTo ( InternalFeature o ) { if ( null == o ) { return - 1 ; // avoid NPE, put null objects at the end } if ( null != styleDefinition && null != o . getStyleInfo ( ) ) { if ( styleDefinition . getIndex ( ) > o . getStyleInfo ( ) . getIndex ( ) ) { return 1 ; } if ( styleDefinition . getIndex ( ) < o . g...
This function compares style ID s between features . Features are usually sorted by style .
113
16
705
public final void begin ( ) { this . file = this . getAppender ( ) . getIoFile ( ) ; if ( this . file == null ) { this . getAppender ( ) . getErrorHandler ( ) . error ( "Scavenger not started: missing log file name" ) ; return ; } if ( this . getProperties ( ) . getScavengeInterval ( ) > - 1 ) { final Thread thread = n...
Starts the scavenger .
135
6
706
public final void end ( ) { final Thread thread = threadRef ; if ( thread != null ) { thread . interrupt ( ) ; try { thread . join ( ) ; } catch ( InterruptedException e ) { Thread . currentThread ( ) . interrupt ( ) ; } } this . threadRef = null ; }
Stops the scavenger .
65
6
707
public static boolean isPropertyAllowed ( Class defClass , String propertyName ) { HashMap props = ( HashMap ) _properties . get ( defClass ) ; return ( props == null ? true : props . containsKey ( propertyName ) ) ; }
Checks whether the property of the given name is allowed for the model element .
53
16
708
public static boolean toBoolean ( String value , boolean defaultValue ) { return "true" . equals ( value ) ? true : ( "false" . equals ( value ) ? false : defaultValue ) ; }
Determines whether the boolean value of the given string value .
44
13
709
protected FieldDescriptor getFieldDescriptor ( TableAlias aTableAlias , PathInfo aPathInfo ) { FieldDescriptor fld = null ; String colName = aPathInfo . column ; if ( aTableAlias != null ) { fld = aTableAlias . cld . getFieldDescriptorByName ( colName ) ; if ( fld == null ) { ObjectReferenceDescriptor ord = aTableAlias...
Get the FieldDescriptor for the PathInfo
160
10
710
private FieldDescriptor getFldFromJoin ( TableAlias aTableAlias , String aColName ) { FieldDescriptor fld = null ; // Search Join Structure for attribute if ( aTableAlias . joins != null ) { Iterator itr = aTableAlias . joins . iterator ( ) ; while ( itr . hasNext ( ) ) { Join join = ( Join ) itr . next ( ) ; ClassDesc...
Get FieldDescriptor from joined superclass .
148
10
711
private FieldDescriptor getFldFromReference ( TableAlias aTableAlias , ObjectReferenceDescriptor anOrd ) { FieldDescriptor fld = null ; if ( aTableAlias == getRoot ( ) ) { // no path expression FieldDescriptor [ ] fk = anOrd . getForeignKeyFieldDescriptors ( aTableAlias . cld ) ; if ( fk . length > 0 ) { fld = fk [ 0 ]...
Get FieldDescriptor from Reference
245
7
712
protected void ensureColumns ( List columns , List existingColumns ) { if ( columns == null || columns . isEmpty ( ) ) { return ; } Iterator iter = columns . iterator ( ) ; while ( iter . hasNext ( ) ) { FieldHelper cf = ( FieldHelper ) iter . next ( ) ; if ( ! existingColumns . contains ( cf . name ) ) { getAttributeI...
Builds the Join for columns if they are not found among the existingColumns .
109
17
713
protected void appendWhereClause ( StringBuffer where , Criteria crit , StringBuffer stmt ) { if ( where . length ( ) == 0 ) { where = null ; } if ( where != null || ( crit != null && ! crit . isEmpty ( ) ) ) { stmt . append ( " WHERE " ) ; appendClause ( where , crit , stmt ) ; } }
appends a WHERE - clause to the Statement
82
9
714
protected void appendHavingClause ( StringBuffer having , Criteria crit , StringBuffer stmt ) { if ( having . length ( ) == 0 ) { having = null ; } if ( having != null || crit != null ) { stmt . append ( " HAVING " ) ; appendClause ( having , crit , stmt ) ; } }
appends a HAVING - clause to the Statement
74
11
715
private void appendBetweenCriteria ( TableAlias alias , PathInfo pathInfo , BetweenCriteria c , StringBuffer buf ) { appendColName ( alias , pathInfo , c . isTranslateAttribute ( ) , buf ) ; buf . append ( c . getClause ( ) ) ; appendParameter ( c . getValue ( ) , buf ) ; buf . append ( " AND " ) ; appendParameter ( c ...
Answer the SQL - Clause for a BetweenCriteria
97
10
716
private String getIndirectionTableColName ( TableAlias mnAlias , String path ) { int dotIdx = path . lastIndexOf ( "." ) ; String column = path . substring ( dotIdx ) ; return mnAlias . alias + column ; }
Get the column name from the indirection table .
57
10
717
private void appendLikeCriteria ( TableAlias alias , PathInfo pathInfo , LikeCriteria c , StringBuffer buf ) { appendColName ( alias , pathInfo , c . isTranslateAttribute ( ) , buf ) ; buf . append ( c . getClause ( ) ) ; appendParameter ( c . getValue ( ) , buf ) ; buf . append ( m_platform . getEscapeClause ( c ) ) ;...
Answer the SQL - Clause for a LikeCriteria
92
10
718
protected void appendSQLClause ( SelectionCriteria c , StringBuffer buf ) { // BRJ : handle SqlCriteria if ( c instanceof SqlCriteria ) { buf . append ( c . getAttribute ( ) ) ; return ; } // BRJ : criteria attribute is a query if ( c . getAttribute ( ) instanceof Query ) { Query q = ( Query ) c . getAttribute ( ) ; bu...
Answer the SQL - Clause for a SelectionCriteria If the Criteria references a class with extents an OR - Clause is added for each extent
409
29
719
private void appendParameter ( Object value , StringBuffer buf ) { if ( value instanceof Query ) { appendSubQuery ( ( Query ) value , buf ) ; } else { buf . append ( "?" ) ; } }
Append the Parameter Add the place holder ? or the SubQuery
46
14
720
private void appendSubQuery ( Query subQuery , StringBuffer buf ) { buf . append ( " (" ) ; buf . append ( getSubQuerySQL ( subQuery ) ) ; buf . append ( ") " ) ; }
Append a SubQuery the SQL - Clause
47
9
721
private String getSubQuerySQL ( Query subQuery ) { ClassDescriptor cld = getRoot ( ) . cld . getRepository ( ) . getDescriptorFor ( subQuery . getSearchClass ( ) ) ; String sql ; if ( subQuery instanceof QueryBySQL ) { sql = ( ( QueryBySQL ) subQuery ) . getSql ( ) ; } else { sql = new SqlSelectStatement ( this , m_pla...
Convert subQuery to SQL
120
6
722
private void addJoin ( TableAlias left , Object [ ] leftKeys , TableAlias right , Object [ ] rightKeys , boolean outer , String name ) { TableAlias extAlias , rightCopy ; left . addJoin ( new Join ( left , leftKeys , right , rightKeys , outer , name ) ) ; // build join between left and extents of right if ( right . has...
add a join between two aliases
352
6
723
private FieldDescriptor [ ] getExtentFieldDescriptors ( TableAlias extAlias , FieldDescriptor [ ] fds ) { FieldDescriptor [ ] result = new FieldDescriptor [ fds . length ] ; for ( int i = 0 ; i < fds . length ; i ++ ) { result [ i ] = extAlias . cld . getFieldDescriptorByName ( fds [ i ] . getAttributeName ( ) ) ; } re...
Get the FieldDescriptors of the extent based on the FieldDescriptors of the parent .
105
20
724
private TableAlias createTableAlias ( String aTable , String aPath , String aUserAlias ) { if ( aUserAlias == null ) { return createTableAlias ( aTable , aPath ) ; } else { return createTableAlias ( aTable , aUserAlias + ALIAS_SEPARATOR + aPath ) ; } }
Create a TableAlias for path or userAlias
70
9
725
private TableAlias getTableAliasForPath ( String aPath , List hintClasses ) { return ( TableAlias ) m_pathToAlias . get ( buildAliasKey ( aPath , hintClasses ) ) ; }
Answer the TableAlias for aPath
46
7
726
private void setTableAliasForPath ( String aPath , List hintClasses , TableAlias anAlias ) { m_pathToAlias . put ( buildAliasKey ( aPath , hintClasses ) , anAlias ) ; }
Set the TableAlias for aPath
48
7
727
private String buildAliasKey ( String aPath , List hintClasses ) { if ( hintClasses == null || hintClasses . isEmpty ( ) ) { return aPath ; } StringBuffer buf = new StringBuffer ( aPath ) ; for ( Iterator iter = hintClasses . iterator ( ) ; iter . hasNext ( ) ; ) { Class hint = ( Class ) iter . next ( ) ; buf . append ...
Build the key for the TableAlias based on the path and the hints
116
14
728
private void setTableAliasForClassDescriptor ( ClassDescriptor aCld , TableAlias anAlias ) { if ( m_cldToAlias . get ( aCld ) == null ) { m_cldToAlias . put ( aCld , anAlias ) ; } }
Set the TableAlias for ClassDescriptor
63
9
729
private TableAlias getTableAliasForPath ( String aPath , String aUserAlias , List hintClasses ) { if ( aUserAlias == null ) { return getTableAliasForPath ( aPath , hintClasses ) ; } else { return getTableAliasForPath ( aUserAlias + ALIAS_SEPARATOR + aPath , hintClasses ) ; } }
Answer the TableAlias for aPath or aUserAlias
79
11
730
protected void appendGroupByClause ( List groupByFields , StringBuffer buf ) { if ( groupByFields == null || groupByFields . size ( ) == 0 ) { return ; } buf . append ( " GROUP BY " ) ; for ( int i = 0 ; i < groupByFields . size ( ) ; i ++ ) { FieldHelper cf = ( FieldHelper ) groupByFields . get ( i ) ; if ( i > 0 ) { ...
Appends the GROUP BY clause for the Query
126
9
731
protected void appendTableWithJoins ( TableAlias alias , StringBuffer where , StringBuffer buf ) { int stmtFromPos = 0 ; byte joinSyntax = getJoinSyntaxType ( ) ; if ( joinSyntax == SQL92_JOIN_SYNTAX ) { stmtFromPos = buf . length ( ) ; // store position of join (by: Terry Dexter) } if ( alias == getRoot ( ) ) { // BRJ...
Appends to the statement table and all tables joined to it .
408
13
732
private void appendJoin ( StringBuffer where , StringBuffer buf , Join join ) { buf . append ( "," ) ; appendTableWithJoins ( join . right , where , buf ) ; if ( where . length ( ) > 0 ) { where . append ( " AND " ) ; } join . appendJoinEqualities ( where ) ; }
Append Join for non SQL92 Syntax
73
9
733
private void appendJoinSQL92 ( Join join , StringBuffer where , StringBuffer buf ) { if ( join . isOuter ) { buf . append ( " LEFT OUTER JOIN " ) ; } else { buf . append ( " INNER JOIN " ) ; } if ( join . right . hasJoins ( ) ) { buf . append ( "(" ) ; appendTableWithJoins ( join . right , where , buf ) ; buf . append ...
Append Join for SQL92 Syntax
142
8
734
private void appendJoinSQL92NoParen ( Join join , StringBuffer where , StringBuffer buf ) { if ( join . isOuter ) { buf . append ( " LEFT OUTER JOIN " ) ; } else { buf . append ( " INNER JOIN " ) ; } buf . append ( join . right . getTableAndAlias ( ) ) ; buf . append ( " ON " ) ; join . appendJoinEqualities ( buf ) ; a...
Append Join for SQL92 Syntax without parentheses
113
10
735
private void buildJoinTree ( Criteria crit ) { Enumeration e = crit . getElements ( ) ; while ( e . hasMoreElements ( ) ) { Object o = e . nextElement ( ) ; if ( o instanceof Criteria ) { buildJoinTree ( ( Criteria ) o ) ; } else { SelectionCriteria c = ( SelectionCriteria ) o ; // BRJ skip SqlCriteria if ( c instanceo...
Build the tree of joins for the given criteria
302
9
736
protected void buildSuperJoinTree ( TableAlias left , ClassDescriptor cld , String name , boolean useOuterJoin ) { ClassDescriptor superCld = cld . getSuperClassDescriptor ( ) ; if ( superCld != null ) { SuperReferenceDescriptor superRef = cld . getSuperReference ( ) ; FieldDescriptor [ ] leftFields = superRef . getFor...
build the Join - Information if a super reference exists
237
10
737
private void buildMultiJoinTree ( TableAlias left , ClassDescriptor cld , String name , boolean useOuterJoin ) { DescriptorRepository repository = cld . getRepository ( ) ; Class [ ] multiJoinedClasses = repository . getSubClassesMultipleJoinedTables ( cld , false ) ; for ( int i = 0 ; i < multiJoinedClasses . length ;...
build the Join - Information for Subclasses having a super reference to this class
316
15
738
protected void splitCriteria ( ) { Criteria whereCrit = getQuery ( ) . getCriteria ( ) ; Criteria havingCrit = getQuery ( ) . getHavingCriteria ( ) ; if ( whereCrit == null || whereCrit . isEmpty ( ) ) { getJoinTreeToCriteria ( ) . put ( getRoot ( ) , null ) ; } else { // TODO: parameters list shold be modified when th...
First reduce the Criteria to the normal disjunctive form then calculate the necessary tree of joined tables for each item then group items with the same tree of joined tables .
154
34
739
private Filter getFilter ( String layerFilter , String [ ] featureIds ) throws GeomajasException { Filter filter = null ; if ( null != layerFilter ) { filter = filterService . parseFilter ( layerFilter ) ; } if ( null != featureIds ) { Filter fidFilter = filterService . createFidFilter ( featureIds ) ; if ( null == fil...
Build filter for the request .
111
6
740
public static String resolveProxyUrl ( String relativeUrl , TileMap tileMap , String baseTmsUrl ) { TileCode tc = parseTileCode ( relativeUrl ) ; return buildUrl ( tc , tileMap , baseTmsUrl ) ; }
Replaces the proxy url with the correct url from the tileMap .
51
14
741
public AbstractGraph getModuleGraph ( final String moduleId ) { final ModuleHandler moduleHandler = new ModuleHandler ( repoHandler ) ; final DbModule module = moduleHandler . getModule ( moduleId ) ; final DbOrganization organization = moduleHandler . getOrganization ( module ) ; filters . setCorporateFilter ( new Cor...
Generate a module graph regarding the filters
102
8
742
private void addModuleToGraph ( final DbModule module , final AbstractGraph graph , final int depth ) { if ( graph . isTreated ( graph . getId ( module ) ) ) { return ; } final String moduleElementId = graph . getId ( module ) ; graph . addElement ( moduleElementId , module . getVersion ( ) , depth == 0 ) ; if ( filter...
Manage the artifact add to the Module AbstractGraph
160
10
743
private void addDependencyToGraph ( final DbDependency dependency , final AbstractGraph graph , final int depth , final String parentId ) { // In that case of Axway artifact we will add a module to the graph if ( filters . getCorporateFilter ( ) . filter ( dependency ) ) { final DbModule dbTarget = repoHandler . getMod...
Add a dependency to the graph
460
6
744
public TreeNode getModuleTree ( final String moduleId ) { final ModuleHandler moduleHandler = new ModuleHandler ( repoHandler ) ; final DbModule module = moduleHandler . getModule ( moduleId ) ; final TreeNode tree = new TreeNode ( ) ; tree . setName ( module . getName ( ) ) ; // Add submodules for ( final DbModule sub...
Generate a groupId tree regarding the filters
105
9
745
private void addModuleToTree ( final DbModule module , final TreeNode tree ) { final TreeNode subTree = new TreeNode ( ) ; subTree . setName ( module . getName ( ) ) ; tree . addChild ( subTree ) ; // Add SubsubModules for ( final DbModule subsubmodule : module . getSubmodules ( ) ) { addModuleToTree ( subsubmodule , s...
Add a module to a module tree
94
7
746
public static void main ( String [ ] args ) throws Exception { Logger logger = Logger . getLogger ( "MASReader.main" ) ; Properties beastConfigProperties = new Properties ( ) ; String beastConfigPropertiesFile = null ; if ( args . length > 0 ) { beastConfigPropertiesFile = args [ 0 ] ; beastConfigProperties . load ( ne...
Main method to start reading the plain text given by the client
437
12
747
private synchronized Constructor getIndirectionHandlerConstructor ( ) { if ( _indirectionHandlerConstructor == null ) { Class [ ] paramType = { PBKey . class , Identity . class } ; try { _indirectionHandlerConstructor = getIndirectionHandlerClass ( ) . getConstructor ( paramType ) ; } catch ( NoSuchMethodException ex )...
Returns the constructor of the indirection handler class .
157
10
748
public void setIndirectionHandlerClass ( Class indirectionHandlerClass ) { if ( indirectionHandlerClass == null ) { //throw new MetadataException("No IndirectionHandlerClass specified."); /** * andrew.clute * Allow the default IndirectionHandler for the given ProxyFactory implementation * when the parameter is not give...
Sets the indirection handler class .
202
8
749
public IndirectionHandler createIndirectionHandler ( PBKey brokerKey , Identity id ) { Object args [ ] = { brokerKey , id } ; try { return ( IndirectionHandler ) getIndirectionHandlerConstructor ( ) . newInstance ( args ) ; } catch ( InvocationTargetException ex ) { throw new PersistenceBrokerException ( "Exception whi...
Creates a new indirection handler instance .
152
9
750
private static Constructor retrieveCollectionProxyConstructor ( Class proxyClass , Class baseType , String typeDesc ) { if ( proxyClass == null ) { throw new MetadataException ( "No " + typeDesc + " specified." ) ; } if ( proxyClass . isInterface ( ) || Modifier . isAbstract ( proxyClass . getModifiers ( ) ) || ! baseT...
Retrieves the constructor that is used by OJB to create instances of the given collection proxy class .
262
21
751
public ManageableCollection createCollectionProxy ( PBKey brokerKey , Query query , Class collectionClass ) { Object args [ ] = { brokerKey , collectionClass , query } ; try { return ( ManageableCollection ) getCollectionProxyConstructor ( collectionClass ) . newInstance ( args ) ; } catch ( InstantiationException ex )...
Create a Collection Proxy for a given query .
158
9
752
public final Object getRealObject ( Object objectOrProxy ) { if ( isNormalOjbProxy ( objectOrProxy ) ) { String msg ; try { return getIndirectionHandler ( objectOrProxy ) . getRealSubject ( ) ; } catch ( ClassCastException e ) { // shouldn't happen but still ... msg = "The InvocationHandler for the provided Proxy was n...
Get the real Object
281
4
753
public Object getRealObjectIfMaterialized ( Object objectOrProxy ) { if ( isNormalOjbProxy ( objectOrProxy ) ) { String msg ; try { IndirectionHandler handler = getIndirectionHandler ( objectOrProxy ) ; return handler . alreadyMaterialized ( ) ? handler . getRealSubject ( ) : null ; } catch ( ClassCastException e ) { /...
Get the real Object for already materialized Handler
314
9
754
public Class getRealClass ( Object objectOrProxy ) { IndirectionHandler handler ; if ( isNormalOjbProxy ( objectOrProxy ) ) { String msg ; try { handler = getIndirectionHandler ( objectOrProxy ) ; /* arminw: think we should return the real class */ // return handler.getIdentity().getObjectsTopLevelClass(); return handl...
Get the real Class
304
4
755
public IndirectionHandler getIndirectionHandler ( Object obj ) { if ( obj == null ) { return null ; } else if ( isNormalOjbProxy ( obj ) ) { return getDynamicIndirectionHandler ( obj ) ; } else if ( isVirtualOjbProxy ( obj ) ) { return VirtualProxy . getIndirectionHandler ( ( VirtualProxy ) obj ) ; } else { return null...
Returns the invocation handler object of the given proxy object .
87
11
756
public boolean isMaterialized ( Object object ) { IndirectionHandler handler = getIndirectionHandler ( object ) ; return handler == null || handler . alreadyMaterialized ( ) ; }
Determines whether the object is a materialized object i . e . no proxy or a proxy that has already been loaded from the database .
37
29
757
public DbOrganization getOrganization ( final String organizationId ) { final DbOrganization dbOrganization = repositoryHandler . getOrganization ( organizationId ) ; if ( dbOrganization == null ) { throw new WebApplicationException ( Response . status ( Response . Status . NOT_FOUND ) . entity ( "Organization " + orga...
Returns an Organization
93
3
758
public void deleteOrganization ( final String organizationId ) { final DbOrganization dbOrganization = getOrganization ( organizationId ) ; repositoryHandler . deleteOrganization ( dbOrganization . getName ( ) ) ; repositoryHandler . removeModulesOrganization ( dbOrganization ) ; }
Deletes an organization
61
4
759
public List < String > getCorporateGroupIds ( final String organizationId ) { final DbOrganization dbOrganization = getOrganization ( organizationId ) ; return dbOrganization . getCorporateGroupIdPrefixes ( ) ; }
Returns the list view of corporate groupIds of an organization
52
12
760
public void addCorporateGroupId ( final String organizationId , final String corporateGroupId ) { final DbOrganization dbOrganization = getOrganization ( organizationId ) ; if ( ! dbOrganization . getCorporateGroupIdPrefixes ( ) . contains ( corporateGroupId ) ) { dbOrganization . getCorporateGroupIdPrefixes ( ) . add ...
Adds a corporate groupId to an organization
115
8
761
public void removeCorporateGroupId ( final String organizationId , final String corporateGroupId ) { final DbOrganization dbOrganization = getOrganization ( organizationId ) ; if ( dbOrganization . getCorporateGroupIdPrefixes ( ) . contains ( corporateGroupId ) ) { dbOrganization . getCorporateGroupIdPrefixes ( ) . rem...
Removes a corporate groupId from an Organisation
114
9
762
public DbOrganization getMatchingOrganization ( final DbModule dbModule ) { if ( dbModule . getOrganization ( ) != null && ! dbModule . getOrganization ( ) . isEmpty ( ) ) { return getOrganization ( dbModule . getOrganization ( ) ) ; } for ( final DbOrganization organization : repositoryHandler . getAllOrganizations ( ...
Returns an Organization that suits the Module or null if there is none
118
13
763
public void executeDelete ( ClassDescriptor cld , Object obj ) throws PersistenceBrokerException { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "executeDelete: " + obj ) ; } final StatementManagerIF sm = broker . serviceStatementManager ( ) ; PreparedStatement stmt = null ; try { stmt = sm . getDeleteStatement...
performs a DELETE operation against RDBMS .
536
12
764
public void executeInsert ( ClassDescriptor cld , Object obj ) throws PersistenceBrokerException { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "executeInsert: " + obj ) ; } final StatementManagerIF sm = broker . serviceStatementManager ( ) ; PreparedStatement stmt = null ; try { stmt = sm . getInsertStatement...
performs an INSERT operation against RDBMS .
393
11
765
public ResultSetAndStatement executeQuery ( Query query , ClassDescriptor cld ) throws PersistenceBrokerException { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "executeQuery: " + query ) ; } /* * MBAIRD: we should create a scrollable resultset if the start at * index or end at index is set */ boolean scrollab...
performs a SELECT operation against RDBMS .
635
10
766
public ResultSetAndStatement executeSQL ( final String sql , ClassDescriptor cld , ValueContainer [ ] values , boolean scrollable ) throws PersistenceBrokerException { if ( logger . isDebugEnabled ( ) ) logger . debug ( "executeSQL: " + sql ) ; final boolean isStoredprocedure = isStoredProcedure ( sql ) ; final Stateme...
performs a SQL SELECT statement against RDBMS .
520
11
767
public int executeUpdateSQL ( String sqlStatement , ClassDescriptor cld , ValueContainer [ ] values1 , ValueContainer [ ] values2 ) throws PersistenceBrokerException { if ( logger . isDebugEnabled ( ) ) logger . debug ( "executeUpdateSQL: " + sqlStatement ) ; int result ; int index ; PreparedStatement stmt = null ; fin...
performs a SQL UPDTE INSERT or DELETE statement against RDBMS .
298
19
768
public void executeUpdate ( ClassDescriptor cld , Object obj ) throws PersistenceBrokerException { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "executeUpdate: " + obj ) ; } // obj with nothing but key fields is not updated if ( cld . getNonPkRwFields ( ) . length == 0 ) { return ; } final StatementManagerIF s...
performs an UPDATE operation against RDBMS .
573
10
769
public Object materializeObject ( ClassDescriptor cld , Identity oid ) throws PersistenceBrokerException { final StatementManagerIF sm = broker . serviceStatementManager ( ) ; final SelectStatement sql = broker . serviceSqlGenerator ( ) . getPreparedSelectByPkStatement ( cld ) ; Object result = null ; PreparedStatement...
performs a primary key lookup operation against RDBMS and materializes an object from the resulting row . Only skalar attributes are filled from the row references are not resolved .
432
36
770
private void setLockingValues ( ClassDescriptor cld , Object obj , ValueContainer [ ] oldLockingValues ) { FieldDescriptor fields [ ] = cld . getLockingFields ( ) ; for ( int i = 0 ; i < fields . length ; i ++ ) { PersistentField field = fields [ i ] . getPersistentField ( ) ; Object lockVal = oldLockingValues [ i ] . ...
Set the locking values
109
4
771
private void harvestReturnValues ( ProcedureDescriptor proc , Object obj , PreparedStatement stmt ) throws PersistenceBrokerSQLException { // If the procedure descriptor is null or has no return values or // if the statement is not a callable statment, then we're done. if ( ( proc == null ) || ( ! proc . hasReturnValue...
Harvest any values that may have been returned during the execution of a procedure .
299
16
772
private void harvestReturnValue ( Object obj , CallableStatement callable , FieldDescriptor fmd , int index ) throws PersistenceBrokerSQLException { try { // If we have a field descriptor, then we can harvest // the return value. if ( ( callable != null ) && ( fmd != null ) && ( obj != null ) ) { // Get the value and c...
Harvest a single value that was returned by a callable statement .
259
14
773
protected boolean isStoredProcedure ( String sql ) { /* Stored procedures start with {?= call <procedure-name>[<arg1>,<arg2>, ...]} or {call <procedure-name>[<arg1>,<arg2>, ...]} but also statements with white space like { ?= call <procedure-name>[<arg1>,<arg2>, ...]} are possible. */ int k = 0 , i = 0 ; char c ; while...
Check if the specified sql - string is a stored procedure or not .
210
14
774
public String get ( ) { synchronized ( LOCK ) { if ( ! initialised ) { // generate the random number Random rnd = new Random ( ) ; // @todo need a different seed, this is now time based and I // would prefer something different, like an object address // get the random number, instead of getting an integer and converti...
Get a new token .
448
5
775
public boolean removeReader ( Object key , Object resourceId ) { boolean result = false ; ObjectLocks objectLocks = null ; synchronized ( locktable ) { objectLocks = ( ObjectLocks ) locktable . get ( resourceId ) ; if ( objectLocks != null ) { /** * MBAIRD, last one out, close the door and turn off the lights. * if no ...
Remove an read lock .
170
5
776
public boolean removeWriter ( Object key , Object resourceId ) { boolean result = false ; ObjectLocks objectLocks = null ; synchronized ( locktable ) { objectLocks = ( ObjectLocks ) locktable . get ( resourceId ) ; if ( objectLocks != null ) { /** * MBAIRD, last one out, close the door and turn off the lights. * if no ...
Remove an write lock .
199
5
777
private List < StyleFilter > initStyleFilters ( List < FeatureStyleInfo > styleDefinitions ) throws GeomajasException { List < StyleFilter > styleFilters = new ArrayList < StyleFilter > ( ) ; if ( styleDefinitions == null || styleDefinitions . size ( ) == 0 ) { styleFilters . add ( new StyleFilterImpl ( ) ) ; // use de...
Build list of style filters from style definitions .
201
9
778
public static List < Artifact > getAllArtifacts ( final Module module ) { final List < Artifact > artifacts = new ArrayList < Artifact > ( ) ; for ( final Module subModule : module . getSubmodules ( ) ) { artifacts . addAll ( getAllArtifacts ( subModule ) ) ; } artifacts . addAll ( module . getArtifacts ( ) ) ; return ...
Returns all the Artifacts of the module
82
8
779
public static List < Dependency > getAllDependencies ( final Module module ) { final Set < Dependency > dependencies = new HashSet < Dependency > ( ) ; final List < String > producedArtifacts = new ArrayList < String > ( ) ; for ( final Artifact artifact : getAllArtifacts ( module ) ) { producedArtifacts . add ( artifa...
Returns all the dependencies of a module
118
7
780
public static Set < Dependency > getAllDependencies ( final Module module , final List < String > producedArtifacts ) { final Set < Dependency > dependencies = new HashSet < Dependency > ( ) ; for ( final Dependency dependency : module . getDependencies ( ) ) { if ( ! producedArtifacts . contains ( dependency . getTarg...
Returns all the dependencies taken into account the artifact of the module that will be removed from the dependencies
137
19
781
public static List < Dependency > getCorporateDependencies ( final Module module , final List < String > corporateFilters ) { final List < Dependency > corporateDependencies = new ArrayList < Dependency > ( ) ; final Pattern corporatePattern = generateCorporatePattern ( corporateFilters ) ; for ( final Dependency depen...
Returns the corporate dependencies of a module
127
7
782
protected boolean _load ( ) { java . sql . ResultSet rs = null ; try { // This synchronization is necessary for Oracle JDBC drivers 8.1.7, 9.0.1, 9.2.0.1 // The documentation says synchronization is done within the driver, but they // must have overlooked something. Without the lock we'd get mysterious error // message...
Loads the columns for this table into the alChildren list .
449
13
783
private void configureCaching ( HttpServletResponse response , int seconds ) { // HTTP 1.0 header response . setDateHeader ( HTTP_EXPIRES_HEADER , System . currentTimeMillis ( ) + seconds * 1000L ) ; if ( seconds > 0 ) { // HTTP 1.1 header response . setHeader ( HTTP_CACHE_CONTROL_HEADER , "max-age=" + seconds ) ; } el...
Set HTTP headers to allow caching for the given number of seconds .
129
13
784
public int compare ( Object objA , Object objB ) { String idAStr = ( ( FieldDescriptorDef ) _fields . get ( objA ) ) . getProperty ( "id" ) ; String idBStr = ( ( FieldDescriptorDef ) _fields . get ( objB ) ) . getProperty ( "id" ) ; int idA ; int idB ; try { idA = Integer . parseInt ( idAStr ) ; } catch ( Exception ex ...
Compares two fields given by their names .
159
9
785
public boolean hasMoreElements ( ) { try { if ( ! hasCalledCheck ) { hasCalledCheck = true ; hasNext = resultSetAndStatment . m_rs . next ( ) ; } } catch ( SQLException e ) { LoggerFactory . getDefaultLogger ( ) . error ( e ) ; //releaseDbResources(); hasNext = false ; } finally { if ( ! hasNext ) { releaseDbResources ...
Tests if this enumeration contains more elements .
104
10
786
@ RequestMapping ( value = "/legendgraphic" , method = RequestMethod . GET ) public ModelAndView getGraphic ( @ RequestParam ( "layerId" ) String layerId , @ RequestParam ( value = "styleName" , required = false ) String styleName , @ RequestParam ( value = "ruleIndex" , required = false ) Integer ruleIndex , @ Request...
Gets a legend graphic with the specified metadata parameters . All parameters are passed as request parameters .
235
19
787
public boolean checkRead ( TransactionImpl tx , Object obj ) { if ( hasReadLock ( tx , obj ) ) { return true ; } LockEntry writer = getWriter ( obj ) ; if ( writer . isOwnedBy ( tx ) ) { return true ; } return false ; }
checks whether the specified Object obj is read - locked by Transaction tx .
60
14
788
public boolean checkWrite ( TransactionImpl tx , Object obj ) { LockEntry writer = getWriter ( obj ) ; if ( writer == null ) return false ; else if ( writer . isOwnedBy ( tx ) ) return true ; else return false ; }
checks whether the specified Object obj is write - locked by Transaction tx .
53
14
789
private Class getDynamicProxyClass ( Class baseClass ) { Class [ ] m_dynamicProxyClassInterfaces ; if ( foundInterfaces . containsKey ( baseClass ) ) { m_dynamicProxyClassInterfaces = ( Class [ ] ) foundInterfaces . get ( baseClass ) ; } else { m_dynamicProxyClassInterfaces = getInterfaces ( baseClass ) ; foundInterfac...
returns a dynamic Proxy that implements all interfaces of the class described by this ClassDescriptor .
148
20
790
private Class [ ] getInterfaces ( Class clazz ) { Class superClazz = clazz ; Class [ ] interfaces = clazz . getInterfaces ( ) ; // clazz can be an interface itself and when getInterfaces() // is called on an interface it returns only the extending // interfaces, not the interface itself. if ( clazz . isInterface ( ) ) ...
Get interfaces implemented by clazz
410
6
791
public Object getRealKey ( ) { if ( keyRealSubject != null ) { return keyRealSubject ; } else { TransactionExt tx = getTransaction ( ) ; if ( ( tx != null ) && tx . isOpen ( ) ) { prepareKeyRealSubject ( tx . getBroker ( ) ) ; } else { if ( getPBKey ( ) != null ) { PBCapsule capsule = new PBCapsule ( getPBKey ( ) , nul...
Returns the real key object .
169
6
792
public Object getRealValue ( ) { if ( valueRealSubject != null ) { return valueRealSubject ; } else { TransactionExt tx = getTransaction ( ) ; if ( ( tx != null ) && tx . isOpen ( ) ) { prepareValueRealSubject ( tx . getBroker ( ) ) ; } else { if ( getPBKey ( ) != null ) { PBCapsule capsule = new PBCapsule ( getPBKey (...
Returns the real value object .
169
6
793
private Object readMetadataFromXML ( InputSource source , Class target ) throws MalformedURLException , ParserConfigurationException , SAXException , IOException { // TODO: make this configurable boolean validate = false ; // get a xml reader instance: SAXParserFactory factory = SAXParserFactory . newInstance ( ) ; log...
Read metadata by populating an instance of the target class using SAXParser .
403
16
794
public Criteria copy ( boolean includeGroupBy , boolean includeOrderBy , boolean includePrefetchedRelationships ) { Criteria copy = new Criteria ( ) ; copy . m_criteria = new Vector ( this . m_criteria ) ; copy . m_negative = this . m_negative ; if ( includeGroupBy ) { copy . groupby = this . groupby ; } if ( includeOr...
make a copy of the criteria
131
6
795
protected List splitInCriteria ( Object attribute , Collection values , boolean negative , int inLimit ) { List result = new ArrayList ( ) ; Collection inCollection = new ArrayList ( ) ; if ( values == null || values . isEmpty ( ) ) { // OQL creates empty Criteria for late binding result . add ( buildInCriteria ( attri...
Answer a List of InCriteria based on values each InCriteria contains only inLimit values
171
19
796
List getOrderby ( ) { List result = _getOrderby ( ) ; Iterator iter = getCriteria ( ) . iterator ( ) ; Object crit ; while ( iter . hasNext ( ) ) { crit = iter . next ( ) ; if ( crit instanceof Criteria ) { result . addAll ( ( ( Criteria ) crit ) . getOrderby ( ) ) ; } } return result ; }
Answer the orderBy of all Criteria and Sub Criteria the elements are of class Criteria . FieldHelper
87
22
797
public void addColumnIsNull ( String column ) { // PAW //SelectionCriteria c = ValueCriteria.buildNullCriteria(column, getAlias()); SelectionCriteria c = ValueCriteria . buildNullCriteria ( column , getUserAlias ( column ) ) ; c . setTranslateAttribute ( false ) ; addSelectionCriteria ( c ) ; }
Adds is Null criteria customer_id is Null The attribute will NOT be translated into column name
79
18
798
public void addColumnNotNull ( String column ) { // PAW // SelectionCriteria c = ValueCriteria.buildNotNullCriteria(column, getAlias()); SelectionCriteria c = ValueCriteria . buildNotNullCriteria ( column , getUserAlias ( column ) ) ; c . setTranslateAttribute ( false ) ; addSelectionCriteria ( c ) ; }
Adds not Null criteria customer_id is not Null The attribute will NOT be translated into column name
80
19
799
public void addBetween ( Object attribute , Object value1 , Object value2 ) { // PAW // addSelectionCriteria(ValueCriteria.buildBeweenCriteria(attribute, value1, value2, getAlias())); addSelectionCriteria ( ValueCriteria . buildBeweenCriteria ( attribute , value1 , value2 , getUserAlias ( attribute ) ) ) ; }
Adds BETWEEN criteria customer_id between 1 and 10
85
12