idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
1,400
public Collection values ( ) { if ( values != null ) return values ; values = new AbstractCollection ( ) { public int size ( ) { return size ; } public void clear ( ) { ReferenceMap . this . clear ( ) ; } public Iterator iterator ( ) { return new ValueIterator ( ) ; } } ; return values ; }
Returns a collection view of this map s values .
1,401
public Object toInternal ( Attribute < ? > attribute ) throws GeomajasException { if ( attribute instanceof PrimitiveAttribute < ? > ) { return toPrimitiveObject ( ( PrimitiveAttribute < ? > ) attribute ) ; } else if ( attribute instanceof AssociationAttribute < ? > ) { return toAssociationObject ( ( AssociationAttribu...
Converts a DTO attribute into a generic attribute object .
1,402
public Feature toDto ( InternalFeature feature , int featureIncludes ) throws GeomajasException { if ( feature == null ) { return null ; } Feature dto = new Feature ( feature . getId ( ) ) ; if ( ( featureIncludes & VectorLayerService . FEATURE_INCLUDE_ATTRIBUTES ) != 0 && null != feature . getAttributes ( ) ) { Map < ...
Convert the server side feature to a DTO feature that can be sent to the client .
1,403
public Class < ? extends com . vividsolutions . jts . geom . Geometry > toInternal ( LayerType layerType ) { switch ( layerType ) { case GEOMETRY : return com . vividsolutions . jts . geom . Geometry . class ; case LINESTRING : return LineString . class ; case MULTILINESTRING : return MultiLineString . class ; case POI...
Convert a layer type to a geometry class .
1,404
public LayerType toDto ( Class < ? extends com . vividsolutions . jts . geom . Geometry > geometryClass ) { if ( geometryClass == LineString . class ) { return LayerType . LINESTRING ; } else if ( geometryClass == MultiLineString . class ) { return LayerType . MULTILINESTRING ; } else if ( geometryClass == Point . clas...
Convert a geometry class to a layer type .
1,405
public void put ( String key , Object object , Envelope envelope ) { index . put ( key , envelope ) ; cache . put ( key , object ) ; }
Put a spatial object in the cache and index it .
1,406
public < TYPE > TYPE get ( String key , Class < TYPE > type ) { return cache . get ( key , type ) ; }
Get the spatial object from the cache .
1,407
public void addFkToThisClass ( String column ) { if ( fksToThisClass == null ) { fksToThisClass = new Vector ( ) ; } fksToThisClass . add ( column ) ; fksToThisClassAry = null ; }
add a FK column pointing to This Class
1,408
public void addFkToItemClass ( String column ) { if ( fksToItemClass == null ) { fksToItemClass = new Vector ( ) ; } fksToItemClass . add ( column ) ; fksToItemClassAry = null ; }
add a FK column pointing to the item Class
1,409
protected String sp_createSequenceQuery ( String sequenceName , long maxKey ) { return "insert into " + SEQ_TABLE_NAME + " (" + SEQ_NAME_STRING + "," + SEQ_ID_STRING + ") values ('" + sequenceName + "'," + maxKey + ")" ; }
Insert syntax for our special table
1,410
protected long getUniqueLong ( FieldDescriptor field ) throws SequenceManagerException { boolean needsCommit = false ; long result = 0 ; PersistenceBroker targetBroker = getBrokerForClass ( ) ; if ( ! targetBroker . isInTransaction ( ) ) { targetBroker . beginTransaction ( ) ; needsCommit = true ; } try { String sequen...
Gets the actual key - will create a new row with the max key of table if it does not exist .
1,411
protected long buildNextSequence ( PersistenceBroker broker , ClassDescriptor cld , String sequenceName ) throws LookupException , SQLException , PlatformException { CallableStatement cs = null ; try { Connection con = broker . serviceConnectionManager ( ) . getConnection ( ) ; cs = getPlatform ( ) . prepareNextValProc...
Calls the stored procedure stored procedure throws an error if it doesn t exist .
1,412
protected void createSequence ( PersistenceBroker broker , FieldDescriptor field , String sequenceName , long maxKey ) throws Exception { Statement stmt = null ; try { stmt = broker . serviceStatementManager ( ) . getGenericStatement ( field . getClassDescriptor ( ) , Query . NOT_SCROLLABLE ) ; stmt . execute ( sp_crea...
Creates new row in table
1,413
static void init ( ) { determineIfNTEventLogIsSupported ( ) ; URL resource = null ; final String configurationOptionStr = OptionConverter . getSystemProperty ( DEFAULT_CONFIGURATION_KEY , null ) ; if ( configurationOptionStr != null ) { try { resource = new URL ( configurationOptionStr ) ; } catch ( MalformedURLExcepti...
Initialize that Foundation Logging library .
1,414
private static void updateSniffingLoggersLevel ( Logger logger ) { InputStream settingIS = FoundationLogger . class . getResourceAsStream ( "/sniffingLogger.xml" ) ; if ( settingIS == null ) { logger . debug ( "file sniffingLogger.xml not found in classpath" ) ; } else { try { SAXBuilder builder = new SAXBuilder ( ) ; ...
The sniffing Loggers are some special Loggers whose level will be set to TRACE forcedly .
1,415
public void cache ( Identity oid , Object obj ) { try { jcsCache . put ( oid . toString ( ) , obj ) ; } catch ( CacheException e ) { throw new RuntimeCacheException ( e ) ; } }
makes object obj persistent to the Objectcache under the key oid .
1,416
public void remove ( Identity oid ) { try { jcsCache . remove ( oid . toString ( ) ) ; } catch ( CacheException e ) { throw new RuntimeCacheException ( e . getMessage ( ) ) ; } }
removes an Object from the cache .
1,417
public List < GetLocationResult > search ( String q , int maxRows , Locale locale ) throws Exception { List < GetLocationResult > searchResult = new ArrayList < GetLocationResult > ( ) ; String url = URLEncoder . encode ( q , "UTF8" ) ; url = "q=select%20*%20from%20geo.placefinder%20where%20text%3D%22" + url + "%22" ; ...
Call the Yahoo! PlaceFinder service for a result .
1,418
public ClassDescriptor getDescriptorFor ( String strClassName ) throws ClassNotPersistenceCapableException { ClassDescriptor result = discoverDescriptor ( strClassName ) ; if ( result == null ) { throw new ClassNotPersistenceCapableException ( strClassName + " not found in OJB Repository" ) ; } else { return result ; }...
lookup a ClassDescriptor in the internal Hashtable
1,419
protected String getIsolationLevelAsString ( ) { if ( defaultIsolationLevel == IL_READ_UNCOMMITTED ) { return LITERAL_IL_READ_UNCOMMITTED ; } else if ( defaultIsolationLevel == IL_READ_COMMITTED ) { return LITERAL_IL_READ_COMMITTED ; } else if ( defaultIsolationLevel == IL_REPEATABLE_READ ) { return LITERAL_IL_REPEATAB...
returns IsolationLevel literal as matching to the corresponding id
1,420
private ClassDescriptor discoverDescriptor ( Class clazz ) { ClassDescriptor result = ( ClassDescriptor ) descriptorTable . get ( clazz . getName ( ) ) ; if ( result == null ) { Class superClass = clazz . getSuperclass ( ) ; if ( superClass != null ) { result = discoverDescriptor ( superClass ) ; } if ( result == null ...
Internal method for recursivly searching for a class descriptor that avoids class loading when we already have a class object .
1,421
private void createResultSubClassesMultipleJoinedTables ( List result , ClassDescriptor cld , boolean wholeTree ) { List tmp = ( List ) superClassMultipleJoinedTablesMap . get ( cld . getClassOfObject ( ) ) ; if ( tmp != null ) { result . addAll ( tmp ) ; if ( wholeTree ) { for ( int i = 0 ; i < tmp . size ( ) ; i ++ )...
Add all sub - classes using multiple joined tables feature for specified class .
1,422
public ProxyAuthentication getProxyAuthentication ( ) { if ( layerAuthentication == null && authentication != null ) { layerAuthentication = new LayerAuthentication ( ) ; layerAuthentication . setAuthenticationMethod ( LayerAuthenticationMethod . valueOf ( authentication . getAuthenticationMethod ( ) . name ( ) ) ) ; l...
Get the authentication info for this layer .
1,423
public void setUseCache ( boolean useCache ) { if ( null == cacheManagerService && useCache ) { log . warn ( "The caching plugin needs to be available to cache WMS requests. Not setting useCache." ) ; } else { this . useCache = useCache ; } }
Set whether the WMS tiles should be cached for later use . This implies that the WMS tiles will be proxied .
1,424
protected boolean check ( String id , List < String > includes , List < String > excludes ) { return check ( id , includes ) && ! check ( id , excludes ) ; }
Check whether the given id is included in the list of includes and not excluded .
1,425
protected boolean check ( String id , List < String > includes ) { if ( null != includes ) { for ( String check : includes ) { if ( check ( id , check ) ) { return true ; } } } return false ; }
Check whether the given is is matched by one of the include expressions .
1,426
protected boolean check ( String value , String regex ) { Pattern pattern = Pattern . compile ( regex ) ; return pattern . matcher ( value ) . matches ( ) ; }
Check whether the value is matched by a regular expression .
1,427
protected ClassDescriptor getClassDescriptor ( ) { ClassDescriptor cld = ( ClassDescriptor ) m_classDescriptor . get ( ) ; if ( cld == null ) { throw new OJBRuntimeException ( "Requested ClassDescriptor instance was already GC by JVM" ) ; } return cld ; }
Returns the classDescriptor .
1,428
protected void appendWhereClause ( FieldDescriptor [ ] fields , StringBuffer stmt ) throws PersistenceBrokerException { stmt . append ( " WHERE " ) ; for ( int i = 0 ; i < fields . length ; i ++ ) { FieldDescriptor fmd = fields [ i ] ; stmt . append ( fmd . getColumnName ( ) ) ; stmt . append ( " = ? " ) ; if ( i < fie...
Generate a sql where - clause for the array of fields
1,429
protected void appendWhereClause ( ClassDescriptor cld , boolean useLocking , StringBuffer stmt ) { FieldDescriptor [ ] pkFields = cld . getPkFields ( ) ; FieldDescriptor [ ] fields ; fields = pkFields ; if ( useLocking ) { FieldDescriptor [ ] lockingFields = cld . getLockingFields ( ) ; if ( lockingFields . length > 0...
Generate a where clause for a prepared Statement . Only primary key and locking fields are used in this where clause
1,430
public Object copy ( final Object obj , PersistenceBroker broker ) throws ObjectCopyException { ObjectOutputStream oos = null ; ObjectInputStream ois = null ; try { final ByteArrayOutputStream bos = new ByteArrayOutputStream ( ) ; oos = new ObjectOutputStream ( bos ) ; oos . writeObject ( obj ) ; oos . flush ( ) ; fina...
This implementation will probably be slower than the metadata object copy but this was easier to implement .
1,431
public void bindDelete ( PreparedStatement stmt , Identity oid , ClassDescriptor cld ) throws SQLException { Object [ ] pkValues = oid . getPrimaryKeyValues ( ) ; FieldDescriptor [ ] pkFields = cld . getPkFields ( ) ; int i = 0 ; try { for ( ; i < pkValues . length ; i ++ ) { setObjectForStatement ( stmt , i + 1 , pkVa...
binds the Identities Primary key values to the statement
1,432
public void bindDelete ( PreparedStatement stmt , ClassDescriptor cld , Object obj ) throws SQLException { if ( cld . getDeleteProcedure ( ) != null ) { this . bindProcedure ( stmt , cld , obj , cld . getDeleteProcedure ( ) ) ; } else { int index = 1 ; ValueContainer [ ] values , currentLockingValues ; currentLockingVa...
binds the objects primary key and locking values to the statement BRJ
1,433
private int bindStatementValue ( PreparedStatement stmt , int index , Object attributeOrQuery , Object value , ClassDescriptor cld ) throws SQLException { FieldDescriptor fld = null ; if ( value instanceof Query ) { Query subQuery = ( Query ) value ; return bindStatement ( stmt , subQuery , cld . getRepository ( ) . ge...
bind attribute and value
1,434
public void bindSelect ( PreparedStatement stmt , Identity oid , ClassDescriptor cld , boolean callableStmt ) throws SQLException { ValueContainer [ ] values = null ; int i = 0 ; int j = 0 ; if ( cld == null ) { cld = m_broker . getClassDescriptor ( oid . getObjectsRealClass ( ) ) ; } try { if ( callableStmt ) { m_plat...
Binds the Identities Primary key values to the statement .
1,435
public PreparedStatement getDeleteStatement ( ClassDescriptor cld ) throws PersistenceBrokerSQLException , PersistenceBrokerException { try { return cld . getStatementsForClass ( m_conMan ) . getDeleteStmt ( m_conMan . getConnection ( ) ) ; } catch ( SQLException e ) { throw new PersistenceBrokerSQLException ( "Could n...
return a prepared DELETE Statement fitting for the given ClassDescriptor
1,436
public PreparedStatement getInsertStatement ( ClassDescriptor cds ) throws PersistenceBrokerSQLException , PersistenceBrokerException { try { return cds . getStatementsForClass ( m_conMan ) . getInsertStmt ( m_conMan . getConnection ( ) ) ; } catch ( SQLException e ) { throw new PersistenceBrokerSQLException ( "Could n...
return a prepared Insert Statement fitting for the given ClassDescriptor
1,437
public PreparedStatement getPreparedStatement ( ClassDescriptor cds , String sql , boolean scrollable , int explicitFetchSizeHint , boolean callableStmt ) throws PersistenceBrokerException { try { return cds . getStatementsForClass ( m_conMan ) . getPreparedStmt ( m_conMan . getConnection ( ) , sql , scrollable , expli...
return a generic Statement for the given ClassDescriptor
1,438
public PreparedStatement getSelectByPKStatement ( ClassDescriptor cds ) throws PersistenceBrokerSQLException , PersistenceBrokerException { try { return cds . getStatementsForClass ( m_conMan ) . getSelectByPKStmt ( m_conMan . getConnection ( ) ) ; } catch ( SQLException e ) { throw new PersistenceBrokerSQLException ( ...
return a prepared Select Statement for the given ClassDescriptor
1,439
public PreparedStatement getUpdateStatement ( ClassDescriptor cds ) throws PersistenceBrokerSQLException , PersistenceBrokerException { try { return cds . getStatementsForClass ( m_conMan ) . getUpdateStmt ( m_conMan . getConnection ( ) ) ; } catch ( SQLException e ) { throw new PersistenceBrokerSQLException ( "Could n...
return a prepared Update Statement fitting to the given ClassDescriptor
1,440
protected ValueContainer [ ] getAllValues ( ClassDescriptor cld , Object obj ) throws PersistenceBrokerException { return m_broker . serviceBrokerHelper ( ) . getAllRwValues ( cld , obj ) ; }
returns an array containing values for all the Objects attribute
1,441
protected ValueContainer [ ] getKeyValues ( PersistenceBroker broker , ClassDescriptor cld , Object obj ) throws PersistenceBrokerException { return broker . serviceBrokerHelper ( ) . getKeyValues ( cld , obj ) ; }
returns an Array with an Objects PK VALUES
1,442
protected ValueContainer [ ] getKeyValues ( PersistenceBroker broker , ClassDescriptor cld , Identity oid ) throws PersistenceBrokerException { return broker . serviceBrokerHelper ( ) . getKeyValues ( cld , oid ) ; }
returns an Array with an Identities PK VALUES
1,443
protected ValueContainer [ ] getNonKeyValues ( PersistenceBroker broker , ClassDescriptor cld , Object obj ) throws PersistenceBrokerException { return broker . serviceBrokerHelper ( ) . getNonKeyRwValues ( cld , obj ) ; }
returns an Array with an Objects NON - PK VALUES
1,444
private void bindProcedure ( PreparedStatement stmt , ClassDescriptor cld , Object obj , ProcedureDescriptor proc ) throws SQLException { int valueSub = 0 ; CallableStatement callable = null ; try { callable = ( CallableStatement ) stmt ; } catch ( Exception e ) { m_log . error ( "Error while bind values for class '" +...
Bind a prepared statment that represents a call to a procedure or user - defined function .
1,445
private void setObjectForStatement ( PreparedStatement stmt , int index , Object value , int sqlType ) throws SQLException { if ( value == null ) { m_platform . setNullForStatement ( stmt , index , sqlType ) ; } else { m_platform . setObjectForStatement ( stmt , index , value , sqlType ) ; } }
Sets object for statement at specific index adhering to platform - and null - rules .
1,446
public void remove ( Identity oid ) { if ( log . isDebugEnabled ( ) ) log . debug ( "Remove object " + oid ) ; sessionCache . remove ( oid ) ; getApplicationCache ( ) . remove ( oid ) ; }
Remove the corresponding object from session AND application cache .
1,447
private void putToSessionCache ( Identity oid , CacheEntry entry , boolean onlyIfNew ) { if ( onlyIfNew ) { if ( ! sessionCache . containsKey ( oid ) ) sessionCache . put ( oid , entry ) ; } else { sessionCache . put ( oid , entry ) ; } }
Put object to session cache .
1,448
private void processQueue ( ) { CacheEntry sv ; while ( ( sv = ( CacheEntry ) queue . poll ( ) ) != null ) { sessionCache . remove ( sv . oid ) ; } }
Make sure that the Identity objects of garbage collected cached objects are removed too .
1,449
public void beforeClose ( PBStateEvent event ) { if ( ! broker . isInTransaction ( ) ) { if ( log . isDebugEnabled ( ) ) log . debug ( "Clearing the session cache" ) ; resetSessionCache ( ) ; } }
Before closing the PersistenceBroker ensure that the session cache is cleared
1,450
public boolean isUpToDate ( final DbArtifact artifact ) { final List < String > versions = repoHandler . getArtifactVersions ( artifact ) ; final String currentVersion = artifact . getVersion ( ) ; final String lastDevVersion = getLastVersion ( versions ) ; final String lastReleaseVersion = getLastRelease ( versions ) ...
Check if the current version match the last release or the last snapshot one
1,451
protected Object buildOrRefreshObject ( Map row , ClassDescriptor targetClassDescriptor , Object targetObject ) { Object result = targetObject ; FieldDescriptor fmd ; FieldDescriptor [ ] fields = targetClassDescriptor . getFieldDescriptor ( true ) ; if ( targetObject == null ) { result = ClassHelper . buildNewObjectIns...
Creates an object instance according to clb and fills its fileds width data provided by row .
1,452
protected ClassDescriptor selectClassDescriptor ( Map row ) throws PersistenceBrokerException { ClassDescriptor result = m_cld ; Class ojbConcreteClass = ( Class ) row . get ( OJB_CONCRETE_CLASS_KEY ) ; if ( ojbConcreteClass != null ) { result = m_cld . getRepository ( ) . getDescriptorFor ( ojbConcreteClass ) ; if ( r...
Check if there is an attribute which tells us which concrete class is to be instantiated .
1,453
protected void load ( ) { properties = new Properties ( ) ; String filename = getFilename ( ) ; try { URL url = ClassHelper . getResource ( filename ) ; if ( url == null ) { url = ( new File ( filename ) ) . toURL ( ) ; } logger . info ( "Loading OJB's properties: " + url ) ; URLConnection conn = url . openConnection (...
Loads the Configuration from the properties file .
1,454
public static void init ( ) { reports . clear ( ) ; Reflections reflections = new Reflections ( REPORTS_PACKAGE ) ; final Set < Class < ? extends Report > > reportClasses = reflections . getSubTypesOf ( Report . class ) ; for ( Class < ? extends Report > c : reportClasses ) { LOG . info ( "Report class: " + c . getName...
Initializes the set of report implementation .
1,455
public InternalTile paint ( InternalTile tile ) throws RenderException { if ( tile . getContentType ( ) . equals ( VectorTileContentType . URL_CONTENT ) ) { if ( urlBuilder != null ) { if ( paintGeometries ) { urlBuilder . paintGeometries ( paintGeometries ) ; urlBuilder . paintLabels ( false ) ; tile . setFeatureConte...
Painter the tile by building a URL where the image can be found .
1,456
public void addPropertyChangeListener ( String propertyName , java . beans . PropertyChangeListener listener ) { this . propertyChangeDelegate . addPropertyChangeListener ( propertyName , listener ) ; }
Add a new PropertyChangeListener to this node for a specific property . This functionality has been borrowed from the java . beans package though this class has nothing to do with a bean
1,457
public void removePropertyChangeListener ( String propertyName , java . beans . PropertyChangeListener listener ) { this . propertyChangeDelegate . removePropertyChangeListener ( propertyName , listener ) ; }
Remove a PropertyChangeListener for a specific property from this node . This functionality has . Please note that the listener this does not remove a listener that has been added without specifying the property it is interested in .
1,458
public void setAttribute ( String strKey , Object value ) { this . propertyChangeDelegate . firePropertyChange ( strKey , hmAttributes . put ( strKey , value ) , value ) ; }
Set an attribute of this node as Object . This method is backed by a HashMap so all rules of HashMap apply to this method . Fires a PropertyChangeEvent .
1,459
private void modifyBeliefCount ( int count ) { introspector . setBeliefValue ( getLocalName ( ) , Definitions . RECEIVED_MESSAGE_COUNT , getBeliefCount ( ) + count , null ) ; }
Modifies the msgCount belief
1,460
private int getBeliefCount ( ) { Integer count = ( Integer ) introspector . getBeliefBase ( ListenerMockAgent . this ) . get ( Definitions . RECEIVED_MESSAGE_COUNT ) ; if ( count == null ) count = 0 ; return count ; }
Returns the msgCount belief
1,461
@ SuppressWarnings ( "unchecked" ) private void addParameters ( Model model , HttpServletRequest request ) { for ( Object objectEntry : request . getParameterMap ( ) . entrySet ( ) ) { Map . Entry < String , String [ ] > entry = ( Map . Entry < String , String [ ] > ) objectEntry ; String key = entry . getKey ( ) ; Str...
Add the extra parameters which are passed as report parameters . The type of the parameter is guessed from the first letter of the parameter name .
1,462
private Object getParameter ( String name , String value ) throws ParseException , NumberFormatException { Object result = null ; if ( name . length ( ) > 0 ) { switch ( name . charAt ( 0 ) ) { case 'i' : if ( null == value || value . length ( ) == 0 ) { value = "0" ; } result = new Integer ( value ) ; break ; case 'f'...
Convert a query parameter to the correct object type based on the first letter of the name .
1,463
public SqlStatement getPreparedDeleteStatement ( ClassDescriptor cld ) { SqlForClass sfc = getSqlForClass ( cld ) ; SqlStatement sql = sfc . getDeleteSql ( ) ; if ( sql == null ) { ProcedureDescriptor pd = cld . getDeleteProcedure ( ) ; if ( pd == null ) { sql = new SqlDeleteByPkStatement ( cld , logger ) ; } else { sq...
generate a prepared DELETE - Statement for the Class described by cld .
1,464
public SqlStatement getPreparedInsertStatement ( ClassDescriptor cld ) { SqlStatement sql ; SqlForClass sfc = getSqlForClass ( cld ) ; sql = sfc . getInsertSql ( ) ; if ( sql == null ) { ProcedureDescriptor pd = cld . getInsertProcedure ( ) ; if ( pd == null ) { sql = new SqlInsertStatement ( cld , logger ) ; } else { ...
generate a prepared INSERT - Statement for the Class described by cld .
1,465
public SelectStatement getPreparedSelectByPkStatement ( ClassDescriptor cld ) { SelectStatement sql ; SqlForClass sfc = getSqlForClass ( cld ) ; sql = sfc . getSelectByPKSql ( ) ; if ( sql == null ) { sql = new SqlSelectByPkStatement ( m_platform , cld , logger ) ; sfc . setSelectByPKSql ( sql ) ; if ( logger . isDebug...
generate a prepared SELECT - Statement for the Class described by cld
1,466
public SelectStatement getPreparedSelectStatement ( Query query , ClassDescriptor cld ) { SelectStatement sql = new SqlSelectStatement ( m_platform , cld , query , logger ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "SQL:" + sql . getStatement ( ) ) ; } return sql ; }
generate a select - Statement according to query
1,467
public SqlStatement getPreparedUpdateStatement ( ClassDescriptor cld ) { SqlForClass sfc = getSqlForClass ( cld ) ; SqlStatement result = sfc . getUpdateSql ( ) ; if ( result == null ) { ProcedureDescriptor pd = cld . getUpdateProcedure ( ) ; if ( pd == null ) { result = new SqlUpdateStatement ( cld , logger ) ; } else...
generate a prepared UPDATE - Statement for the Class described by cld
1,468
private String toSQLClause ( FieldCriteria c , ClassDescriptor cld ) { String colName = toSqlClause ( c . getAttribute ( ) , cld ) ; return colName + c . getClause ( ) + c . getValue ( ) ; }
Answer the SQL - Clause for a FieldCriteria
1,469
public SqlStatement getPreparedDeleteStatement ( Query query , ClassDescriptor cld ) { return new SqlDeleteByQuery ( m_platform , cld , query , logger ) ; }
generate a prepared DELETE - Statement according to query
1,470
private boolean hasBidirectionalAssociation ( Class clazz ) { ClassDescriptor cdesc ; Collection refs ; boolean hasBidirAssc ; if ( _withoutBidirAssc . contains ( clazz ) ) { return false ; } if ( _withBidirAssc . contains ( clazz ) ) { return true ; } cdesc = _pb . getClassDescriptor ( clazz ) ; refs = cdesc . getObje...
Does the given class has bidirectional assiciation with some other class?
1,471
private ArrayList handleDependentReferences ( Identity oid , Object userObject , Object [ ] origFields , Object [ ] newFields , Object [ ] newRefs ) throws LockingException { ClassDescriptor mif = _pb . getClassDescriptor ( userObject . getClass ( ) ) ; FieldDescriptor [ ] fieldDescs = mif . getFieldDescriptions ( ) ; ...
Mark for creation all newly introduced dependent references . Mark for deletion all nullified dependent references .
1,472
private ArrayList handleDependentCollections ( Identity oid , Object obj , Object [ ] origCollections , Object [ ] newCollections , Object [ ] newCollectionsOfObjects ) throws LockingException { ClassDescriptor mif = _pb . getClassDescriptor ( obj . getClass ( ) ) ; Collection colDescs = mif . getCollectionDescriptors ...
Mark for creation all objects that were included into dependent collections . Mark for deletion all objects that were excluded from dependent collections .
1,473
public void refresh ( String [ ] configLocations ) throws GeomajasException { try { setConfigLocations ( configLocations ) ; refresh ( ) ; } catch ( Exception e ) { throw new GeomajasException ( e , ExceptionCode . REFRESH_CONFIGURATION_FAILED ) ; } }
Refresh this context with the specified configuration locations .
1,474
public void rollback ( ) throws GeomajasException { try { setConfigLocations ( previousConfigLocations ) ; refresh ( ) ; } catch ( Exception e ) { throw new GeomajasException ( e , ExceptionCode . REFRESH_CONFIGURATION_FAILED ) ; } }
Roll back to the previous configuration .
1,475
public String getUrl ( ) { final StringBuilder sb = new StringBuilder ( ) ; sb . append ( "http://" ) ; sb . append ( getHttpConfiguration ( ) . getBindHost ( ) . get ( ) ) ; sb . append ( ":" ) ; sb . append ( getHttpConfiguration ( ) . getPort ( ) ) ; return sb . toString ( ) ; }
Returns the complete Grapes root URL
1,476
public void addRow ( final String ... cells ) { final Row row = new Row ( ( Object [ ] ) cells ) ; if ( ! rows . contains ( row ) ) { rows . add ( row ) ; } }
Add a row to the table if it does not already exist
1,477
private static String firstFoundTableName ( PersistenceBroker brokerForClass , ClassDescriptor cld ) { String name = null ; if ( ! cld . isInterface ( ) && cld . getFullTableName ( ) != null ) { return cld . getFullTableName ( ) ; } if ( cld . isExtent ( ) ) { Collection extentClasses = cld . getExtentClasses ( ) ; for...
try to find the first none null table name for the given class - descriptor . If cld has extent classes all of these cld s searched for the first none null table name .
1,478
public static long getMaxId ( PersistenceBroker brokerForClass , Class topLevel , FieldDescriptor original ) throws PersistenceBrokerException { long max = 0 ; long tmp ; ClassDescriptor cld = brokerForClass . getClassDescriptor ( topLevel ) ; if ( ! cld . isInterface ( ) && ! cld . isAbstract ( ) ) { tmp = getMaxIdFor...
Search down all extent classes and return max of all found PK values .
1,479
public static long getMaxIdForClass ( PersistenceBroker brokerForClass , ClassDescriptor cldForOriginalOrExtent , FieldDescriptor original ) throws PersistenceBrokerException { FieldDescriptor field = null ; if ( ! original . getClassDescriptor ( ) . equals ( cldForOriginalOrExtent ) ) { if ( ! original . getClassDescr...
lookup current maximum value for a single field in table the given class descriptor was associated .
1,480
public static Identity fromByteArray ( final byte [ ] anArray ) throws PersistenceBrokerException { try { final ByteArrayInputStream bais = new ByteArrayInputStream ( anArray ) ; final GZIPInputStream gis = new GZIPInputStream ( bais ) ; final ObjectInputStream ois = new ObjectInputStream ( gis ) ; final Identity resul...
Factory method that returns an Identity object created from a serializated representation .
1,481
public byte [ ] serialize ( ) throws PersistenceBrokerException { try { final ByteArrayOutputStream bao = new ByteArrayOutputStream ( ) ; final GZIPOutputStream gos = new GZIPOutputStream ( bao ) ; final ObjectOutputStream oos = new ObjectOutputStream ( gos ) ; oos . writeObject ( this ) ; oos . close ( ) ; gos . close...
Return the serialized form of this Identity .
1,482
protected void checkForPrimaryKeys ( final Object realObject ) throws ClassNotPersistenceCapableException { if ( m_pkValues == null || m_pkValues . length == 0 ) { throw createException ( "OJB needs at least one primary key attribute for class: " , realObject , null ) ; } }
OJB can handle only classes that declare at least one primary key attribute this method checks this condition .
1,483
public TileMap getCapabilities ( TmsLayer layer ) throws TmsLayerException { try { JAXBContext context = JAXBContext . newInstance ( TileMap . class ) ; Unmarshaller um = context . createUnmarshaller ( ) ; if ( layer . getBaseTmsUrl ( ) . startsWith ( CLASSPATH ) ) { String location = layer . getBaseTmsUrl ( ) . substr...
Get the configuration for a TMS layer by retrieving and parsing it s XML description file . The parsing is done using JaxB .
1,484
public RasterLayerInfo asLayerInfo ( TileMap tileMap ) { RasterLayerInfo layerInfo = new RasterLayerInfo ( ) ; layerInfo . setCrs ( tileMap . getSrs ( ) ) ; layerInfo . setDataSourceName ( tileMap . getTitle ( ) ) ; layerInfo . setLayerType ( LayerType . RASTER ) ; layerInfo . setMaxExtent ( asBbox ( tileMap . getBound...
Transform a TMS layer description object into a raster layer info object .
1,485
private void init_jdbcTypes ( ) throws SQLException { ReportQuery q = ( ReportQuery ) getQueryObject ( ) . getQuery ( ) ; m_jdbcTypes = new int [ m_attributeCount ] ; if ( q . getJdbcTypes ( ) != null ) { m_jdbcTypes = q . getJdbcTypes ( ) ; } else { ResultSetMetaData rsMetaData = getRsAndStmt ( ) . m_rs . getMetaData ...
get the jdbcTypes from the Query or the ResultSet if not available from the Query
1,486
private int getLiteralId ( String literal ) throws PersistenceBrokerException { try { return tags . getIdByTag ( literal ) ; } catch ( NullPointerException t ) { throw new MetadataException ( "unknown literal: '" + literal + "'" , t ) ; } }
returns the XmlCapable id associated with the literal . OJB maintains a RepositoryTags table that provides a mapping from xml - tags to XmlCapable ids .
1,487
public final boolean hasReturnValues ( ) { if ( this . hasReturnValue ( ) ) { return true ; } else { Iterator iter = this . getArguments ( ) . iterator ( ) ; while ( iter . hasNext ( ) ) { ArgumentDescriptor arg = ( ArgumentDescriptor ) iter . next ( ) ; if ( arg . getIsReturnedByProcedure ( ) ) { return true ; } } } r...
Does this procedure return any values to the caller ?
1,488
protected void addArguments ( FieldDescriptor field [ ] ) { for ( int i = 0 ; i < field . length ; i ++ ) { ArgumentDescriptor arg = new ArgumentDescriptor ( this ) ; arg . setValue ( field [ i ] . getAttributeName ( ) , false ) ; this . addArgument ( arg ) ; } }
Set up arguments for each FieldDescriptor in an array .
1,489
public void setNamedRoles ( Map < String , List < NamedRoleInfo > > namedRoles ) { this . namedRoles = namedRoles ; ldapRoleMapping = new HashMap < String , Set < String > > ( ) ; for ( String roleName : namedRoles . keySet ( ) ) { if ( ! ldapRoleMapping . containsKey ( roleName ) ) { ldapRoleMapping . put ( roleName ,...
Set the named roles which may be defined .
1,490
public void setPixelPerUnit ( double pixelPerUnit ) { if ( pixelPerUnit < MINIMUM_PIXEL_PER_UNIT ) { pixelPerUnit = MINIMUM_PIXEL_PER_UNIT ; } if ( pixelPerUnit > MAXIMUM_PIXEL_PER_UNIT ) { pixelPerUnit = MAXIMUM_PIXEL_PER_UNIT ; } this . pixelPerUnit = pixelPerUnit ; setPixelPerUnitBased ( true ) ; postConstruct ( ) ;...
Sets the scale value in pixel per map unit .
1,491
protected void postConstruct ( ) { if ( pixelPerUnitBased ) { if ( pixelPerUnit > PIXEL_PER_METER ) { this . numerator = pixelPerUnit / conversionFactor ; this . denominator = 1 ; } else { this . numerator = 1 ; this . denominator = PIXEL_PER_METER / pixelPerUnit ; } setPixelPerUnitBased ( false ) ; } else { this . pix...
Finish configuration .
1,492
void nextExecuted ( String sql ) throws SQLException { count ++ ; if ( _order . contains ( sql ) ) { return ; } String sqlCmd = sql . substring ( 0 , 7 ) ; String rest = sql . substring ( sqlCmd . equals ( "UPDATE " ) ? 7 : 12 ) ; String tableName = rest . substring ( 0 , rest . indexOf ( ' ' ) ) ; HashSet fkTables = (...
Remember the order of execution
1,493
private PreparedStatement prepareBatchStatement ( String sql ) { String sqlCmd = sql . substring ( 0 , 7 ) ; if ( sqlCmd . equals ( "UPDATE " ) || sqlCmd . equals ( "DELETE " ) || ( _useBatchInserts && sqlCmd . equals ( "INSERT " ) ) ) { PreparedStatement stmt = ( PreparedStatement ) _statements . get ( sql ) ; if ( st...
If UPDATE INSERT or DELETE return BatchPreparedStatement otherwise return null .
1,494
public static void generateJavaFiles ( String requirementsFolder , String platformName , String src_test_dir , String tests_package , String casemanager_package , String loggingPropFile ) throws Exception { File reqFolder = new File ( requirementsFolder ) ; if ( reqFolder . isDirectory ( ) ) { for ( File f : reqFolder ...
Main method of the class which handles the process of creating the tests
1,495
public void setPromoted ( final boolean promoted ) { this . promoted = promoted ; for ( final Artifact artifact : artifacts ) { artifact . setPromoted ( promoted ) ; } for ( final Module suModule : submodules ) { suModule . setPromoted ( promoted ) ; } }
Sets the promotion state .
1,496
public void addDependency ( final Dependency dependency ) { if ( dependency != null && ! dependencies . contains ( dependency ) ) { this . dependencies . add ( dependency ) ; } }
Add a dependency to the module .
1,497
public void addSubmodule ( final Module submodule ) { if ( ! submodules . contains ( submodule ) ) { submodule . setSubmodule ( true ) ; if ( promoted ) { submodule . setPromoted ( promoted ) ; } submodules . add ( submodule ) ; } }
Adds a submodule to the module .
1,498
public void addArtifact ( final Artifact artifact ) { if ( ! artifacts . contains ( artifact ) ) { if ( promoted ) { artifact . setPromoted ( promoted ) ; } artifacts . add ( artifact ) ; } }
Adds an artifact to the module .
1,499
public static String get ( MessageKey key ) { return data . getProperty ( key . toString ( ) , key . toString ( ) ) ; }
Retrieves the configured message by property key