idx int64 0 165k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
1,300 | public OTMConnection acquireConnection ( PBKey pbKey ) { TransactionFactory txFactory = getTransactionFactory ( ) ; return txFactory . acquireConnection ( pbKey ) ; } | Obtain an OTMConnection for the given persistence broker key |
1,301 | public void sendMessageToAgents ( String [ ] agent_name , String msgtype , Object message_content , Connector connector ) { HashMap < String , Object > hm = new HashMap < String , Object > ( ) ; hm . put ( "performative" , msgtype ) ; hm . put ( SFipa . CONTENT , message_content ) ; IComponentIdentifier [ ] ici = new I... | This method sends the same message to many agents . |
1,302 | public void sendMessageToAgentsWithExtraProperties ( String [ ] agent_name , String msgtype , Object message_content , ArrayList < Object > properties , Connector connector ) { HashMap < String , Object > hm = new HashMap < String , Object > ( ) ; hm . put ( "performative" , msgtype ) ; hm . put ( SFipa . CONTENT , mes... | This method works as the one above adding some properties to the message |
1,303 | public void lock ( Object obj , int lockMode ) throws LockNotGrantedException { if ( log . isDebugEnabled ( ) ) log . debug ( "lock object was called on tx " + this + ", object is " + obj . toString ( ) ) ; checkOpen ( ) ; RuntimeObject rtObject = new RuntimeObject ( obj , this ) ; lockAndRegister ( rtObject , lockMode... | Upgrade the lock on the given object to the given lock mode . The call has no effect if the object s current lock is already at or above that level of lock mode . |
1,304 | protected synchronized void doWriteObjects ( boolean isFlush ) throws TransactionAbortedException , LockNotGrantedException { if ( ! getBroker ( ) . isInTransaction ( ) ) { if ( log . isDebugEnabled ( ) ) log . debug ( "call beginTransaction() on PB instance" ) ; broker . beginTransaction ( ) ; } performTransactionAwar... | Write objects to data store but don t release the locks . I don t know what we should do if we are in a checkpoint and we need to abort . |
1,305 | protected synchronized void doClose ( ) { try { LockManager lm = getImplementation ( ) . getLockManager ( ) ; Enumeration en = objectEnvelopeTable . elements ( ) ; while ( en . hasMoreElements ( ) ) { ObjectEnvelope oe = ( ObjectEnvelope ) en . nextElement ( ) ; lm . releaseLock ( this , oe . getIdentity ( ) , oe . get... | Close a transaction and do all the cleanup associated with it . |
1,306 | protected void refresh ( ) { if ( log . isDebugEnabled ( ) ) log . debug ( "Refresh this transaction for reuse: " + this ) ; try { objectEnvelopeTable . refresh ( ) ; } catch ( Exception e ) { if ( log . isDebugEnabled ( ) ) { log . debug ( "error closing object envelope table : " + e . getMessage ( ) ) ; e . printStac... | cleanup tx and prepare for reuse |
1,307 | public void abort ( ) { if ( txStatus == Status . STATUS_NO_TRANSACTION || txStatus == Status . STATUS_UNKNOWN || txStatus == Status . STATUS_ROLLEDBACK ) { log . info ( "Nothing to abort, tx is not active - status is " + TxUtil . getStatusString ( txStatus ) ) ; return ; } if ( txStatus != Status . STATUS_ACTIVE && tx... | Abort and close the transaction . Calling abort abandons all persistent object modifications and releases the associated locks . Aborting a transaction does not restore the state of modified transient objects |
1,308 | public Object getObjectByIdentity ( Identity id ) throws PersistenceBrokerException { checkOpen ( ) ; ObjectEnvelope envelope = objectEnvelopeTable . getByIdentity ( id ) ; if ( envelope != null ) { return ( envelope . needsDelete ( ) ? null : envelope . getObject ( ) ) ; } else { return getBroker ( ) . getObjectByIden... | Get object by identity . First lookup among objects registered in the transaction then in persistent storage . |
1,309 | private void lockAndRegisterReferences ( ClassDescriptor cld , Object sourceObject , int lockMode , List registeredObjects ) throws LockNotGrantedException { if ( implicitLocking ) { Iterator i = cld . getObjectReferenceDescriptors ( true ) . iterator ( ) ; while ( i . hasNext ( ) ) { ObjectReferenceDescriptor rds = ( ... | we only use the registrationList map if the object is not a proxy . During the reference locking we will materialize objects and they will enter the registered for lock map . |
1,310 | public void afterMaterialization ( IndirectionHandler handler , Object materializedObject ) { try { Identity oid = handler . getIdentity ( ) ; if ( log . isDebugEnabled ( ) ) log . debug ( "deferred registration: " + oid ) ; if ( ! isOpen ( ) ) { log . error ( "Proxy object materialization outside of a running tx, obj=... | this callback is invoked after an Object is materialized within an IndirectionHandler . this callback allows to defer registration of objects until it s really neccessary . |
1,311 | public void afterLoading ( CollectionProxyDefaultImpl colProxy ) { if ( log . isDebugEnabled ( ) ) log . debug ( "loading a proxied collection a collection: " + colProxy ) ; Collection data = colProxy . getData ( ) ; for ( Iterator iterator = data . iterator ( ) ; iterator . hasNext ( ) ; ) { Object o = iterator . next... | Remove colProxy from list of pending collections and register its contents with the transaction . |
1,312 | protected boolean isTransient ( ClassDescriptor cld , Object obj , Identity oid ) { boolean isNew = oid != null && oid . isTransient ( ) ; if ( ! isNew ) { final PersistenceBroker pb = getBroker ( ) ; if ( cld == null ) { cld = pb . getClassDescriptor ( obj . getClass ( ) ) ; } isNew = pb . serviceBrokerHelper ( ) . ha... | Detect new objects . |
1,313 | private License getLicense ( final String licenseId ) { License result = null ; final Set < DbLicense > matchingLicenses = licenseMatcher . getMatchingLicenses ( licenseId ) ; if ( matchingLicenses . isEmpty ( ) ) { result = DataModelFactory . createLicense ( "#" + licenseId + "# (to be identified)" , NOT_IDENTIFIED_YE... | Returns a licenses regarding its Id and a fake on if no license exist with such an Id |
1,314 | private String [ ] getHeaders ( ) { final List < String > headers = new ArrayList < > ( ) ; if ( decorator . getShowSources ( ) ) { headers . add ( SOURCE_FIELD ) ; } if ( decorator . getShowSourcesVersion ( ) ) { headers . add ( SOURCE_VERSION_FIELD ) ; } if ( decorator . getShowTargets ( ) ) { headers . add ( TARGET_... | Init the headers of the table regarding the filters |
1,315 | public InputStream getStream ( String url , RasterLayer layer ) throws IOException { if ( layer instanceof ProxyLayerSupport ) { ProxyLayerSupport proxyLayer = ( ProxyLayerSupport ) layer ; if ( proxyLayer . isUseCache ( ) && null != cacheManagerService ) { Object cachedObject = cacheManagerService . get ( proxyLayer ,... | Get the contents from the request URL . |
1,316 | private Envelope getLayerEnvelope ( ProxyLayerSupport layer ) { Bbox bounds = layer . getLayerInfo ( ) . getMaxExtent ( ) ; return new Envelope ( bounds . getX ( ) , bounds . getMaxX ( ) , bounds . getY ( ) , bounds . getMaxY ( ) ) ; } | Return the max bounds of the layer as envelope . |
1,317 | private static String buildErrorMsg ( List < String > dependencies , String message ) { final StringBuilder buffer = new StringBuilder ( ) ; boolean isFirstElement = true ; for ( String dependency : dependencies ) { if ( ! isFirstElement ) { buffer . append ( ", " ) ; } buffer . append ( dependency ) ; isFirstElement =... | Get the error message with the dependencies appended |
1,318 | protected Query buildPrefetchQuery ( Collection ids ) { CollectionDescriptor cds = getCollectionDescriptor ( ) ; QueryByCriteria query = buildPrefetchQuery ( ids , cds . getForeignKeyFieldDescriptors ( getItemClassDescriptor ( ) ) ) ; if ( ! cds . getOrderBy ( ) . isEmpty ( ) ) { Iterator iter = cds . getOrderBy ( ) . ... | Build the query to perform a batched read get orderBy settings from CollectionDescriptor |
1,319 | protected void associateBatched ( Collection owners , Collection children ) { CollectionDescriptor cds = getCollectionDescriptor ( ) ; PersistentField field = cds . getPersistentField ( ) ; PersistenceBroker pb = getBroker ( ) ; Class ownerTopLevelClass = pb . getTopLevelClass ( getOwnerClassDescriptor ( ) . getClassOf... | associate the batched Children with their owner object loop over children |
1,320 | protected ManageableCollection createCollection ( CollectionDescriptor desc , Class collectionClass ) { Class fieldType = desc . getPersistentField ( ) . getType ( ) ; ManageableCollection col ; if ( collectionClass == null ) { if ( ManageableCollection . class . isAssignableFrom ( fieldType ) ) { try { col = ( Managea... | Create a collection object of the given collection type . If none has been given OJB uses RemovalAwareList RemovalAwareSet or RemovalAwareCollection depending on the field type . |
1,321 | public void setFeatureModel ( FeatureModel featureModel ) throws LayerException { this . featureModel = featureModel ; if ( null != getLayerInfo ( ) ) { featureModel . setLayerInfo ( getLayerInfo ( ) ) ; } filterService . registerFeatureModel ( featureModel ) ; } | Set the featureModel . |
1,322 | public void update ( Object feature ) throws LayerException { Session session = getSessionFactory ( ) . getCurrentSession ( ) ; session . update ( feature ) ; } | Update a feature object in the Hibernate session . |
1,323 | private void enforceSrid ( Object feature ) throws LayerException { Geometry geom = getFeatureModel ( ) . getGeometry ( feature ) ; if ( null != geom ) { geom . setSRID ( srid ) ; getFeatureModel ( ) . setGeometry ( feature , geom ) ; } } | Enforces the correct srid on incoming features . |
1,324 | private Envelope getBoundsLocal ( Filter filter ) throws LayerException { try { Session session = getSessionFactory ( ) . getCurrentSession ( ) ; Criteria criteria = session . createCriteria ( getFeatureInfo ( ) . getDataSourceName ( ) ) ; CriteriaVisitor visitor = new CriteriaVisitor ( ( HibernateFeatureModel ) getFea... | Bounds are calculated locally can use any filter but slower than native . |
1,325 | public Object getBean ( String name ) { Bean bean = beans . get ( name ) ; if ( null == bean ) { return null ; } return bean . object ; } | Get a bean value from the context . |
1,326 | public void setBean ( String name , Object object ) { Bean bean = beans . get ( name ) ; if ( null == bean ) { bean = new Bean ( ) ; beans . put ( name , bean ) ; } bean . object = object ; } | Set a bean in the context . |
1,327 | public Object remove ( String name ) { Bean bean = beans . get ( name ) ; if ( null != bean ) { beans . remove ( name ) ; bean . destructionCallback . run ( ) ; return bean . object ; } return null ; } | Remove a bean from the context calling the destruction callback if any . |
1,328 | public void registerDestructionCallback ( String name , Runnable callback ) { Bean bean = beans . get ( name ) ; if ( null == bean ) { bean = new Bean ( ) ; beans . put ( name , bean ) ; } bean . destructionCallback = callback ; } | Register the given callback as to be executed after request completion . |
1,329 | public void clear ( ) { for ( Bean bean : beans . values ( ) ) { if ( null != bean . destructionCallback ) { bean . destructionCallback . run ( ) ; } } beans . clear ( ) ; } | Clear all beans and call the destruction callback . |
1,330 | private String parseLayerId ( HttpServletRequest request ) { StringTokenizer tokenizer = new StringTokenizer ( request . getRequestURI ( ) , "/" ) ; String token = "" ; while ( tokenizer . hasMoreTokens ( ) ) { token = tokenizer . nextToken ( ) ; } return token ; } | Get the layer ID out of the request URL . |
1,331 | private WmsLayer getLayer ( String layerId ) { RasterLayer layer = configurationService . getRasterLayer ( layerId ) ; if ( layer instanceof WmsLayer ) { return ( WmsLayer ) layer ; } return null ; } | Given a layer ID search for the WMS layer . |
1,332 | private byte [ ] createErrorImage ( int width , int height , Exception e ) throws IOException { String error = e . getMessage ( ) ; if ( null == error ) { Writer result = new StringWriter ( ) ; PrintWriter printWriter = new PrintWriter ( result ) ; e . printStackTrace ( printWriter ) ; error = result . toString ( ) ; }... | Create an error image should an error occur while fetching a WMS map . |
1,333 | public static String formatConnectionEstablishmentMessage ( final String connectionName , final String host , final String connectionReason ) { return CON_ESTABLISHMENT_FORMAT . format ( new Object [ ] { connectionName , host , connectionReason } ) ; } | Helper method for formatting connection establishment messages . |
1,334 | public static String formatConnectionTerminationMessage ( final String connectionName , final String host , final String connectionReason , final String terminationReason ) { return CON_TERMINATION_FORMAT . format ( new Object [ ] { connectionName , host , connectionReason , terminationReason } ) ; } | Helper method for formatting connection termination messages . |
1,335 | public String findPlatformFor ( String jdbcSubProtocol , String jdbcDriver ) { String platform = ( String ) jdbcSubProtocolToPlatform . get ( jdbcSubProtocol ) ; if ( platform == null ) { platform = ( String ) jdbcDriverToPlatform . get ( jdbcDriver ) ; } return platform ; } | Derives the OJB platform to use for a database that is connected via a url using the specified subprotocol and where the specified jdbc driver is used . |
1,336 | public static void validate ( final License license ) { if ( license . getName ( ) == null || license . getName ( ) . isEmpty ( ) ) { throw new WebApplicationException ( Response . status ( Response . Status . BAD_REQUEST ) . entity ( "License name should not be empty!" ) . build ( ) ) ; } if ( license . getLongName ( ... | Checks if the provided license is valid and could be stored into the database |
1,337 | public static void validate ( final Module module ) { if ( null == module ) { throw new WebApplicationException ( Response . status ( Response . Status . BAD_REQUEST ) . entity ( "Module cannot be null!" ) . build ( ) ) ; } if ( module . getName ( ) == null || module . getName ( ) . isEmpty ( ) ) { throw new WebApplica... | Checks if the provided module is valid and could be stored into the database |
1,338 | public static void validate ( final Organization organization ) { if ( organization . getName ( ) == null || organization . getName ( ) . isEmpty ( ) ) { throw new WebApplicationException ( Response . status ( Response . Status . BAD_REQUEST ) . entity ( "Organization name cannot be null or empty!" ) . build ( ) ) ; } ... | Checks if the provided organization is valid and could be stored into the database |
1,339 | public static void validate ( final ArtifactQuery artifactQuery ) { final Pattern invalidChars = Pattern . compile ( "[^A-Fa-f0-9]" ) ; if ( artifactQuery . getUser ( ) == null || artifactQuery . getUser ( ) . isEmpty ( ) ) { throw new WebApplicationException ( Response . status ( Response . Status . BAD_REQUEST ) . en... | Checks if the provided artifactQuery is valid |
1,340 | protected long getUniqueLong ( FieldDescriptor field ) throws SequenceManagerException { long result ; String sequenceName = calculateSequenceName ( field ) ; try { result = buildNextSequence ( field . getClassDescriptor ( ) , sequenceName ) ; } catch ( Throwable e ) { try { log . info ( "Create DB sequence key '" + se... | returns a unique long value for class clazz and field fieldName . the returned number is unique accross all tables in the extent of clazz . |
1,341 | protected Collection provideStateManagers ( Collection pojos ) { PersistenceCapable pc ; int [ ] fieldNums ; Iterator iter = pojos . iterator ( ) ; Collection result = new ArrayList ( ) ; while ( iter . hasNext ( ) ) { pc = ( PersistenceCapable ) iter . next ( ) ; Identity oid = new Identity ( pc , broker ) ; StateMana... | This methods enhances the objects loaded by a broker query with a JDO StateManager an brings them under JDO control . |
1,342 | public final Object copy ( final Object toCopy , PersistenceBroker broker ) { return clone ( toCopy , IdentityMapFactory . getIdentityMap ( ) , new HashMap ( ) ) ; } | makes a deep clone of the object using reflection . |
1,343 | private static void setFields ( final Object from , final Object to , final Field [ ] fields , final boolean accessible , final Map objMap , final Map metadataMap ) { for ( int f = 0 , fieldsLength = fields . length ; f < fieldsLength ; ++ f ) { final Field field = fields [ f ] ; final int modifiers = field . getModifi... | copy all fields from the from object to the to object . |
1,344 | public void registerComponent ( java . awt . Component c ) { unregisterComponent ( c ) ; if ( recognizerAbstractClass == null ) { hmDragGestureRecognizers . put ( c , dragSource . createDefaultDragGestureRecognizer ( c , dragWorker . getAcceptableActions ( c ) , dgListener ) ) ; } else { hmDragGestureRecognizers . put ... | add a Component to this Worker . After the call dragging is enabled for this Component . |
1,345 | public void unregisterComponent ( java . awt . Component c ) { java . awt . dnd . DragGestureRecognizer recognizer = ( java . awt . dnd . DragGestureRecognizer ) this . hmDragGestureRecognizers . remove ( c ) ; if ( recognizer != null ) recognizer . setComponent ( null ) ; } | remove drag support from the given Component . |
1,346 | protected Object doInvoke ( Object proxy , Method methodToBeInvoked , Object [ ] args ) throws Throwable { Method m = getRealSubject ( ) . getClass ( ) . getMethod ( methodToBeInvoked . getName ( ) , methodToBeInvoked . getParameterTypes ( ) ) ; return m . invoke ( getRealSubject ( ) , args ) ; } | this method will be invoked after methodToBeInvoked is invoked |
1,347 | public void addIterator ( OJBIterator iterator ) { if ( iterator != null ) { if ( iterator . hasNext ( ) ) { setNextIterator ( ) ; m_rsIterators . add ( iterator ) ; } } } | use this method to construct the ChainingIterator iterator by iterator . |
1,348 | public boolean absolute ( int row ) throws PersistenceBrokerException { if ( row == 0 ) { return true ; } if ( row == 1 ) { m_activeIteratorIndex = 0 ; m_activeIterator = ( OJBIterator ) m_rsIterators . get ( m_activeIteratorIndex ) ; m_activeIterator . absolute ( 1 ) ; return true ; } if ( row == - 1 ) { m_activeItera... | the absolute and relative calls are the trickiest parts . We have to move across cursor boundaries potentially . |
1,349 | public void releaseDbResources ( ) { Iterator it = m_rsIterators . iterator ( ) ; while ( it . hasNext ( ) ) { ( ( OJBIterator ) it . next ( ) ) . releaseDbResources ( ) ; } } | delegate to each contained OJBIterator and release its resources . |
1,350 | private boolean setNextIterator ( ) { boolean retval = false ; if ( m_activeIterator == null ) { if ( m_rsIterators . size ( ) > 0 ) { m_activeIteratorIndex = 0 ; m_currentCursorPosition = 0 ; m_activeIterator = ( OJBIterator ) m_rsIterators . get ( m_activeIteratorIndex ) ; } } else if ( ! m_activeIterator . hasNext (... | Convenience routine to move to the next iterator if needed . |
1,351 | public boolean containsIteratorForTable ( String aTable ) { boolean result = false ; if ( m_rsIterators != null ) { for ( int i = 0 ; i < m_rsIterators . size ( ) ; i ++ ) { OJBIterator it = ( OJBIterator ) m_rsIterators . get ( i ) ; if ( it instanceof RsIterator ) { if ( ( ( RsIterator ) it ) . getClassDescriptor ( )... | Answer true if an Iterator for a Table is already available |
1,352 | public Class getSearchClass ( ) { Object obj = getExampleObject ( ) ; if ( obj instanceof Identity ) { return ( ( Identity ) obj ) . getObjectsTopLevelClass ( ) ; } else { return obj . getClass ( ) ; } } | Answer the search class . This is the class of the example object or the class represented by Identity . |
1,353 | private < T > T getBeanOrNull ( String name , Class < T > requiredType ) { if ( name == null || ! applicationContext . containsBean ( name ) ) { return null ; } else { try { return applicationContext . getBean ( name , requiredType ) ; } catch ( BeansException be ) { log . error ( "Error during getBeanOrNull, not rethr... | Get a bean from the application context . Returns null if the bean does not exist . |
1,354 | public void restoreSecurityContext ( CacheContext context ) { SavedAuthorization cached = context . get ( CacheContext . SECURITY_CONTEXT_KEY , SavedAuthorization . class ) ; if ( cached != null ) { log . debug ( "Restoring security context {}" , cached ) ; securityManager . restoreSecurityContext ( cached ) ; } else {... | Puts the cached security context in the thread local . |
1,355 | private void sortFileList ( ) { if ( this . size ( ) > 1 ) { Collections . sort ( this . fileList , new Comparator ( ) { public final int compare ( final Object o1 , final Object o2 ) { final File f1 = ( File ) o1 ; final File f2 = ( File ) o2 ; final Object [ ] f1TimeAndCount = backupSuffixHelper . backupTimeAndCount ... | Sort by time bucket then backup count and by compression state . |
1,356 | private ClassDescriptor getRealClassDescriptor ( ClassDescriptor aCld , Object anObj ) { ClassDescriptor result ; if ( aCld . getClassOfObject ( ) == ProxyHelper . getRealClass ( anObj ) ) { result = aCld ; } else { result = aCld . getRepository ( ) . getDescriptorFor ( anObj . getClass ( ) ) ; } return result ; } | Answer the real ClassDescriptor for anObj ie . aCld may be an Interface of anObj so the cld for anObj is returned |
1,357 | public ValueContainer [ ] getKeyValues ( ClassDescriptor cld , Object objectOrProxy , boolean convertToSql ) throws PersistenceBrokerException { IndirectionHandler handler = ProxyHelper . getIndirectionHandler ( objectOrProxy ) ; if ( handler != null ) { return getKeyValues ( cld , handler . getIdentity ( ) , convertTo... | Returns an Array with an Objects PK VALUES if convertToSql is true any associated java - to - sql conversions are applied . If the Object is a Proxy or a VirtualProxy NO conversion is necessary . |
1,358 | public ValueContainer [ ] getKeyValues ( ClassDescriptor cld , Identity oid ) throws PersistenceBrokerException { return getKeyValues ( cld , oid , true ) ; } | Return primary key values of given Identity object . |
1,359 | public ValueContainer [ ] getKeyValues ( ClassDescriptor cld , Identity oid , boolean convertToSql ) throws PersistenceBrokerException { FieldDescriptor [ ] pkFields = cld . getPkFields ( ) ; ValueContainer [ ] result = new ValueContainer [ pkFields . length ] ; Object [ ] pkValues = oid . getPrimaryKeyValues ( ) ; try... | Return key Values of an Identity |
1,360 | public ValueContainer [ ] getKeyValues ( ClassDescriptor cld , Object objectOrProxy ) throws PersistenceBrokerException { return getKeyValues ( cld , objectOrProxy , true ) ; } | returns an Array with an Objects PK VALUES with any java - to - sql FieldConversion applied . If the Object is a Proxy or a VirtualProxy NO conversion is necessary . |
1,361 | public boolean hasNullPKField ( ClassDescriptor cld , Object obj ) { FieldDescriptor [ ] fields = cld . getPkFields ( ) ; boolean hasNull = false ; IndirectionHandler handler = ProxyHelper . getIndirectionHandler ( obj ) ; if ( handler == null || handler . alreadyMaterialized ( ) ) { if ( handler != null ) obj = handle... | Detect if the given object has a PK field represents a null value . |
1,362 | public ValueContainer [ ] getValuesForObject ( FieldDescriptor [ ] fields , Object obj , boolean convertToSql , boolean assignAutoincrement ) throws PersistenceBrokerException { ValueContainer [ ] result = new ValueContainer [ fields . length ] ; for ( int i = 0 ; i < fields . length ; i ++ ) { FieldDescriptor fd = fie... | Get the values of the fields for an obj Autoincrement values are automatically set . |
1,363 | public boolean assertValidPkForDelete ( ClassDescriptor cld , Object obj ) { if ( ! ProxyHelper . isProxy ( obj ) ) { FieldDescriptor fieldDescriptors [ ] = cld . getPkFields ( ) ; int fieldDescriptorSize = fieldDescriptors . length ; for ( int i = 0 ; i < fieldDescriptorSize ; i ++ ) { FieldDescriptor fd = fieldDescri... | returns true if the primary key fields are valid for delete else false . PK fields are valid if each of them contains a valid non - null value |
1,364 | public Query getCountQuery ( Query aQuery ) { if ( aQuery instanceof QueryBySQL ) { return getQueryBySqlCount ( ( QueryBySQL ) aQuery ) ; } else if ( aQuery instanceof ReportQueryByCriteria ) { return getReportQueryByCriteriaCount ( ( ReportQueryByCriteria ) aQuery ) ; } else { return getQueryByCriteriaCount ( ( QueryB... | Build a Count - Query based on aQuery |
1,365 | private Query getQueryBySqlCount ( QueryBySQL aQuery ) { String countSql = aQuery . getSql ( ) ; int fromPos = countSql . toUpperCase ( ) . indexOf ( " FROM " ) ; if ( fromPos >= 0 ) { countSql = "select count(*)" + countSql . substring ( fromPos ) ; } int orderPos = countSql . toUpperCase ( ) . indexOf ( " ORDER BY " ... | Create a Count - Query for QueryBySQL |
1,366 | private Query getQueryByCriteriaCount ( QueryByCriteria aQuery ) { Class searchClass = aQuery . getSearchClass ( ) ; ReportQueryByCriteria countQuery = null ; Criteria countCrit = null ; String [ ] columns = new String [ 1 ] ; if ( aQuery . getCriteria ( ) != null ) { countCrit = aQuery . getCriteria ( ) . copy ( false... | Create a Count - Query for QueryByCriteria |
1,367 | private Query getReportQueryByCriteriaCount ( ReportQueryByCriteria aQuery ) { ReportQueryByCriteria countQuery = ( ReportQueryByCriteria ) getQueryByCriteriaCount ( aQuery ) ; countQuery . setJoinAttributes ( aQuery . getAttributes ( ) ) ; Iterator iter = aQuery . getGroupBy ( ) . iterator ( ) ; while ( iter . hasNext... | Create a Count - Query for ReportQueryByCriteria |
1,368 | public boolean unlink ( Object source , String attributeName , Object target ) { return linkOrUnlink ( false , source , attributeName , false ) ; } | Unlink the specified reference object . More info see OJB doc . |
1,369 | public void unlink ( Object obj , ObjectReferenceDescriptor ord , boolean insert ) { linkOrUnlink ( false , obj , ord , insert ) ; } | Unlink the specified reference from this object . More info see OJB doc . |
1,370 | protected boolean _load ( ) { java . sql . ResultSet rs = null ; try { synchronized ( getDbMeta ( ) ) { getDbMetaTreeModel ( ) . setStatusBarMessage ( "Reading schemas for catalog " + this . getAttribute ( ATT_CATALOG_NAME ) ) ; rs = getDbMeta ( ) . getSchemas ( ) ; final java . util . ArrayList alNew = new java . util... | Loads the schemas associated to this catalog . |
1,371 | public void removeDescriptor ( Object validKey ) { PBKey pbKey ; if ( validKey instanceof PBKey ) { pbKey = ( PBKey ) validKey ; } else if ( validKey instanceof JdbcConnectionDescriptor ) { pbKey = ( ( JdbcConnectionDescriptor ) validKey ) . getPBKey ( ) ; } else { throw new MetadataException ( "Could not remove descri... | Remove a descriptor . |
1,372 | private int findIndexForName ( String [ ] fieldNames , String searchName ) { for ( int i = 0 ; i < fieldNames . length ; i ++ ) { if ( searchName . equals ( fieldNames [ i ] ) ) { return i ; } } throw new PersistenceBrokerException ( "Can't find field name '" + searchName + "' in given array of field names" ) ; } | Find the index of the specified name in field name array . |
1,373 | private boolean isOrdered ( FieldDescriptor [ ] flds , String [ ] pkFieldNames ) { if ( ( flds . length > 1 && pkFieldNames == null ) || flds . length != pkFieldNames . length ) { throw new PersistenceBrokerException ( "pkFieldName length does not match number of defined PK fields." + " Expected number of PK fields is ... | Checks length and compare order of field names with declared PK fields in metadata . |
1,374 | private PersistenceBrokerException createException ( final Exception ex , String message , final Object objectToIdentify , Class topLevelClass , Class realClass , Object [ ] pks ) { final String eol = SystemUtils . LINE_SEPARATOR ; StringBuffer msg = new StringBuffer ( ) ; if ( message == null ) { msg . append ( "Unexp... | Helper method which supports creation of proper error messages . |
1,375 | private void addEdgesForVertex ( Vertex vertex ) { ClassDescriptor cld = vertex . getEnvelope ( ) . getClassDescriptor ( ) ; Iterator rdsIter = cld . getObjectReferenceDescriptors ( true ) . iterator ( ) ; while ( rdsIter . hasNext ( ) ) { ObjectReferenceDescriptor rds = ( ObjectReferenceDescriptor ) rdsIter . next ( )... | Adds all edges for a given object envelope vertex . All edges are added to the edgeList map . |
1,376 | private void addObjectReferenceEdges ( Vertex vertex , ObjectReferenceDescriptor rds ) { Object refObject = rds . getPersistentField ( ) . get ( vertex . getEnvelope ( ) . getRealObject ( ) ) ; Class refClass = rds . getItemClass ( ) ; for ( int i = 0 ; i < vertices . length ; i ++ ) { Edge edge = null ; Vertex refVert... | Finds edges based to a specific object reference descriptor and adds them to the edge map . |
1,377 | private static boolean containsObject ( Object searchFor , Object [ ] searchIn ) { for ( int i = 0 ; i < searchIn . length ; i ++ ) { if ( searchFor == searchIn [ i ] ) { return true ; } } return false ; } | Helper method that searches an object array for the occurence of a specific object based on reference equality |
1,378 | protected static Map < String , String > getHeadersAsMap ( ResponseEntity response ) { Map < String , List < String > > headers = new HashMap < > ( response . getHeaders ( ) ) ; Map < String , String > map = new HashMap < > ( ) ; for ( Map . Entry < String , List < String > > header : headers . entrySet ( ) ) { String ... | Flat the map of list of string to map of strings with theoriginal values seperated by comma |
1,379 | private void init ( ) { jdbcProperties = new Properties ( ) ; dbcpProperties = new Properties ( ) ; setFetchSize ( 0 ) ; this . setTestOnBorrow ( true ) ; this . setTestOnReturn ( false ) ; this . setTestWhileIdle ( false ) ; this . setLogAbandoned ( false ) ; this . setRemoveAbandoned ( false ) ; } | Set some initial values . |
1,380 | public void addAttribute ( String attributeName , String attributeValue ) { if ( attributeName != null && attributeName . startsWith ( JDBC_PROPERTY_NAME_PREFIX ) ) { final String jdbcPropertyName = attributeName . substring ( JDBC_PROPERTY_NAME_LENGTH ) ; jdbcProperties . setProperty ( jdbcPropertyName , attributeValu... | Sets a custom configuration attribute . |
1,381 | private void userInfoInit ( ) { boolean first = true ; userId = null ; userLocale = null ; userName = null ; userOrganization = null ; userDivision = null ; if ( null != authentications ) { for ( Authentication auth : authentications ) { userId = combine ( userId , auth . getUserId ( ) ) ; userName = combine ( userName... | Calculate UserInfo strings . |
1,382 | public void restoreSecurityContext ( SavedAuthorization savedAuthorization ) { List < Authentication > auths = new ArrayList < Authentication > ( ) ; if ( null != savedAuthorization ) { for ( SavedAuthentication sa : savedAuthorization . getAuthentications ( ) ) { Authentication auth = new Authentication ( ) ; auth . s... | Restore authentications from persisted state . |
1,383 | public void work ( RepositoryHandler repoHandler , DbProduct product ) { if ( ! product . getDeliveries ( ) . isEmpty ( ) ) { product . getDeliveries ( ) . forEach ( delivery -> { final Set < Artifact > artifacts = new HashSet < > ( ) ; final DataFetchingUtils utils = new DataFetchingUtils ( ) ; final DependencyHandler... | refresh all deliveries dependencies for a particular product |
1,384 | private ClassDescriptor [ ] getMultiJoinedClassDescriptors ( ClassDescriptor cld ) { DescriptorRepository repository = cld . getRepository ( ) ; Class [ ] multiJoinedClasses = repository . getSubClassesMultipleJoinedTables ( cld , true ) ; ClassDescriptor [ ] result = new ClassDescriptor [ multiJoinedClasses . length ]... | Get MultiJoined ClassDescriptors |
1,385 | private void appendClazzColumnForSelect ( StringBuffer buf ) { ClassDescriptor cld = getSearchClassDescriptor ( ) ; ClassDescriptor [ ] clds = getMultiJoinedClassDescriptors ( cld ) ; if ( clds . length == 0 ) { return ; } buf . append ( ",CASE" ) ; for ( int i = clds . length ; i > 0 ; i -- ) { buf . append ( " WHEN "... | Create the OJB_CLAZZ pseudo column based on CASE WHEN . This column defines the Class to be instantiated . |
1,386 | Object lookup ( String key ) throws ObjectNameNotFoundException { Object result = null ; NamedEntry entry = localLookup ( key ) ; if ( entry == null ) { try { PersistenceBroker broker = tx . getBroker ( ) ; Identity oid = broker . serviceIdentity ( ) . buildIdentity ( NamedEntry . class , key ) ; entry = ( NamedEntry )... | Return a named object associated with the specified key . |
1,387 | void unbind ( String key ) { NamedEntry entry = new NamedEntry ( key , null , false ) ; localUnbind ( key ) ; addForDeletion ( entry ) ; } | Remove a named object |
1,388 | public DescriptorRepository readDescriptorRepository ( String fileName ) { try { RepositoryPersistor persistor = new RepositoryPersistor ( ) ; return persistor . readDescriptorRepository ( fileName ) ; } catch ( Exception e ) { throw new MetadataException ( "Can not read repository " + fileName , e ) ; } } | Read ClassDescriptors from the given repository file . |
1,389 | public DescriptorRepository readDescriptorRepository ( InputStream inst ) { try { RepositoryPersistor persistor = new RepositoryPersistor ( ) ; return persistor . readDescriptorRepository ( inst ) ; } catch ( Exception e ) { throw new MetadataException ( "Can not read repository " + inst , e ) ; } } | Read ClassDescriptors from the given InputStream . |
1,390 | public ConnectionRepository readConnectionRepository ( String fileName ) { try { RepositoryPersistor persistor = new RepositoryPersistor ( ) ; return persistor . readConnectionRepository ( fileName ) ; } catch ( Exception e ) { throw new MetadataException ( "Can not read repository " + fileName , e ) ; } } | Read JdbcConnectionDescriptors from the given repository file . |
1,391 | public ConnectionRepository readConnectionRepository ( InputStream inst ) { try { RepositoryPersistor persistor = new RepositoryPersistor ( ) ; return persistor . readConnectionRepository ( inst ) ; } catch ( Exception e ) { throw new MetadataException ( "Can not read repository from " + inst , e ) ; } } | Read JdbcConnectionDescriptors from this InputStream . |
1,392 | public void addProfile ( Object key , DescriptorRepository repository ) { if ( metadataProfiles . contains ( key ) ) { throw new MetadataException ( "Duplicate profile key. Key '" + key + "' already exists." ) ; } metadataProfiles . put ( key , repository ) ; } | Add a metadata profile . |
1,393 | public void loadProfile ( Object key ) { if ( ! isEnablePerThreadChanges ( ) ) { throw new MetadataException ( "Can not load profile with disabled per thread mode" ) ; } DescriptorRepository rep = ( DescriptorRepository ) metadataProfiles . get ( key ) ; if ( rep == null ) { throw new MetadataException ( "Can not find ... | Load the given metadata profile for the current thread . |
1,394 | private PBKey buildDefaultKey ( ) { List descriptors = connectionRepository ( ) . getAllDescriptor ( ) ; JdbcConnectionDescriptor descriptor ; PBKey result = null ; for ( Iterator iterator = descriptors . iterator ( ) ; iterator . hasNext ( ) ; ) { descriptor = ( JdbcConnectionDescriptor ) iterator . next ( ) ; if ( de... | Try to build an default PBKey for convenience PB create method . |
1,395 | private Object toReference ( int type , Object referent , int hash ) { switch ( type ) { case HARD : return referent ; case SOFT : return new SoftRef ( hash , referent , queue ) ; case WEAK : return new WeakRef ( hash , referent , queue ) ; default : throw new Error ( ) ; } } | Constructs a reference of the given type to the given referent . The reference is registered with the queue for later purging . |
1,396 | private Entry getEntry ( Object key ) { if ( key == null ) return null ; int hash = hashCode ( key ) ; int index = indexFor ( hash ) ; for ( Entry entry = table [ index ] ; entry != null ; entry = entry . next ) { if ( ( entry . hash == hash ) && equals ( key , entry . getKey ( ) ) ) { return entry ; } } return null ; ... | Returns the entry associated with the given key . |
1,397 | private int indexFor ( int hash ) { hash += ~ ( hash << 15 ) ; hash ^= ( hash >>> 10 ) ; hash += ( hash << 3 ) ; hash ^= ( hash >>> 6 ) ; hash += ~ ( hash << 11 ) ; hash ^= ( hash >>> 16 ) ; return hash & ( table . length - 1 ) ; } | Converts the given hash code into an index into the hash table . |
1,398 | public Object get ( Object key ) { purge ( ) ; Entry entry = getEntry ( key ) ; if ( entry == null ) return null ; return entry . getValue ( ) ; } | Returns the value associated with the given key if any . |
1,399 | public Object remove ( Object key ) { if ( key == null ) return null ; purge ( ) ; int hash = hashCode ( key ) ; int index = indexFor ( hash ) ; Entry previous = null ; Entry entry = table [ index ] ; while ( entry != null ) { if ( ( hash == entry . hash ) && equals ( key , entry . getKey ( ) ) ) { if ( previous == nul... | Removes the key and its associated value from this map . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.