idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
1,100
public void drawImage ( Image img , Rectangle rect , Rectangle clipRect ) { drawImage ( img , rect , clipRect , 1 ) ; }
Draws the specified image with the first rectangle s bounds clipping with the second one and adding transparency .
1,101
public void drawImage ( Image img , Rectangle rect , Rectangle clipRect , float opacity ) { try { template . saveState ( ) ; PdfGState state = new PdfGState ( ) ; state . setFillOpacity ( opacity ) ; state . setBlendMode ( PdfGState . BM_NORMAL ) ; template . setGState ( state ) ; if ( clipRect != null ) { template . r...
Draws the specified image with the first rectangle s bounds clipping with the second one .
1,102
public void drawGeometry ( Geometry geometry , SymbolInfo symbol , Color fillColor , Color strokeColor , float lineWidth , float [ ] dashArray , Rectangle clipRect ) { template . saveState ( ) ; if ( clipRect != null ) { template . rectangle ( clipRect . getLeft ( ) + origX , clipRect . getBottom ( ) + origY , clipRect...
Draw the specified geometry .
1,103
public Rectangle toRelative ( Rectangle rect ) { return new Rectangle ( rect . getLeft ( ) - origX , rect . getBottom ( ) - origY , rect . getRight ( ) - origX , rect . getTop ( ) - origY ) ; }
Converts an absolute rectangle to a relative one wrt to the current coordinate system .
1,104
public int getCount ( Class target ) { PersistenceBroker broker = ( ( HasBroker ) odmg . currentTransaction ( ) ) . getBroker ( ) ; int result = broker . getCount ( new QueryByCriteria ( target ) ) ; return result ; }
Return the count of all objects found for given class using the PB - api within ODMG - this may change in further versions .
1,105
public void setClasspath ( Path classpath ) { if ( _classpath == null ) { _classpath = classpath ; } else { _classpath . append ( classpath ) ; } log ( "Verification classpath is " + _classpath , Project . MSG_VERBOSE ) ; }
Set the classpath for loading the driver .
1,106
public void setClasspathRef ( Reference r ) { createClasspath ( ) . setRefid ( r ) ; log ( "Verification classpath is " + _classpath , Project . MSG_VERBOSE ) ; }
Set the classpath for loading the driver using the classpath reference .
1,107
public Class getPersistentFieldClass ( ) { if ( m_persistenceClass == null ) { Properties properties = new Properties ( ) ; try { this . logWarning ( "Loading properties file: " + getPropertiesFile ( ) ) ; properties . load ( new FileInputStream ( getPropertiesFile ( ) ) ) ; } catch ( IOException e ) { this . logWarnin...
Returns the Class object of the class specified in the OJB . properties file for the PersistentFieldClass property .
1,108
public void visit ( FeatureTypeStyle fts ) { FeatureTypeStyle copy = new FeatureTypeStyleImpl ( ( FeatureTypeStyleImpl ) fts ) ; Rule [ ] rules = fts . getRules ( ) ; int length = rules . length ; Rule [ ] rulesCopy = new Rule [ length ] ; for ( int i = 0 ; i < length ; i ++ ) { if ( rules [ i ] != null ) { rules [ i ]...
Overridden to add transform .
1,109
public void visit ( Rule rule ) { Rule copy = null ; Filter filterCopy = null ; if ( rule . getFilter ( ) != null ) { Filter filter = rule . getFilter ( ) ; filterCopy = copy ( filter ) ; } List < Symbolizer > symsCopy = new ArrayList < Symbolizer > ( ) ; for ( Symbolizer sym : rule . symbolizers ( ) ) { if ( ! skipSym...
Overridden to skip some symbolizers .
1,110
private void registerSynchronization ( TransactionImpl odmgTrans , Transaction transaction ) { if ( odmgTrans == null || transaction == null ) { log . error ( "One of the given parameters was null + " omdg transaction was null: " + ( odmgTrans == null ) + ", external transaction was null: " + ( transaction == null ) )...
Do synchronization of the given J2EE ODMG Transaction
1,111
private TransactionManager getTransactionManager ( ) { TransactionManager retval = null ; try { if ( log . isDebugEnabled ( ) ) log . debug ( "getTransactionManager called" ) ; retval = TransactionManagerFactoryFactory . instance ( ) . getTransactionManager ( ) ; } catch ( TransactionManagerFactoryException e ) { log ....
Return the TransactionManager of the external app
1,112
public void abortExternalTx ( TransactionImpl odmgTrans ) { if ( log . isDebugEnabled ( ) ) log . debug ( "abortExternTransaction was called" ) ; if ( odmgTrans == null ) return ; TxBuffer buf = ( TxBuffer ) txRepository . get ( ) ; Transaction extTx = buf != null ? buf . getExternTx ( ) : null ; try { if ( extTx != nu...
Abort an active extern transaction associated with the given PB .
1,113
public void check ( FieldDescriptorDef fieldDef , String checkLevel ) throws ConstraintException { ensureColumn ( fieldDef , checkLevel ) ; ensureJdbcType ( fieldDef , checkLevel ) ; ensureConversion ( fieldDef , checkLevel ) ; ensureLength ( fieldDef , checkLevel ) ; ensurePrecisionAndScale ( fieldDef , checkLevel ) ;...
Checks the given field descriptor .
1,114
private void ensureColumn ( FieldDescriptorDef fieldDef , String checkLevel ) { if ( ! fieldDef . hasProperty ( PropertyHelper . OJB_PROPERTY_COLUMN ) ) { String javaname = fieldDef . getName ( ) ; if ( fieldDef . isNested ( ) ) { int pos = javaname . indexOf ( "::" ) ; if ( pos > 0 ) { StringBuffer newJavaname = new S...
Constraint that ensures that the field has a column property . If none is specified then the name of the field is used .
1,115
private void ensureConversion ( FieldDescriptorDef fieldDef , String checkLevel ) throws ConstraintException { if ( CHECKLEVEL_NONE . equals ( checkLevel ) ) { return ; } if ( "java.util.Date" . equals ( fieldDef . getProperty ( PropertyHelper . OJB_PROPERTY_JAVA_TYPE ) ) && ! fieldDef . hasProperty ( PropertyHelper . ...
Constraint that ensures that the field has a conversion if the java type requires it . Also checks the conversion class .
1,116
private void ensureLength ( FieldDescriptorDef fieldDef , String checkLevel ) { if ( ! fieldDef . hasProperty ( PropertyHelper . OJB_PROPERTY_LENGTH ) ) { String defaultLength = JdbcTypeHelper . getDefaultLengthFor ( fieldDef . getProperty ( PropertyHelper . OJB_PROPERTY_JDBC_TYPE ) ) ; if ( defaultLength != null ) { L...
Constraint that ensures that the field has a length if the jdbc type requires it .
1,117
private void ensurePrecisionAndScale ( FieldDescriptorDef fieldDef , String checkLevel ) { fieldDef . setProperty ( PropertyHelper . OJB_PROPERTY_DEFAULT_PRECISION , null ) ; fieldDef . setProperty ( PropertyHelper . OJB_PROPERTY_DEFAULT_SCALE , null ) ; if ( ! fieldDef . hasProperty ( PropertyHelper . OJB_PROPERTY_PRE...
Constraint that ensures that the field has precision and scale settings if the jdbc type requires it .
1,118
private void checkLocking ( FieldDescriptorDef fieldDef , String checkLevel ) throws ConstraintException { if ( CHECKLEVEL_NONE . equals ( checkLevel ) ) { return ; } String jdbcType = fieldDef . getProperty ( PropertyHelper . OJB_PROPERTY_JDBC_TYPE ) ; if ( ! "TIMESTAMP" . equals ( jdbcType ) && ! "INTEGER" . equals (...
Checks that locking and update - lock are only used for fields of TIMESTAMP or INTEGER type .
1,119
private void checkSequenceName ( FieldDescriptorDef fieldDef , String checkLevel ) throws ConstraintException { if ( CHECKLEVEL_NONE . equals ( checkLevel ) ) { return ; } String autoIncr = fieldDef . getProperty ( PropertyHelper . OJB_PROPERTY_AUTOINCREMENT ) ; String seqName = fieldDef . getProperty ( PropertyHelper ...
Checks that sequence - name is only used with autoincrement = ojb
1,120
private void checkId ( FieldDescriptorDef fieldDef , String checkLevel ) throws ConstraintException { if ( CHECKLEVEL_NONE . equals ( checkLevel ) ) { return ; } String id = fieldDef . getProperty ( PropertyHelper . OJB_PROPERTY_ID ) ; if ( ( id != null ) && ( id . length ( ) > 0 ) ) { try { Integer . parseInt ( id ) ;...
Checks the id value .
1,121
private void checkReadonlyAccessForNativePKs ( FieldDescriptorDef fieldDef , String checkLevel ) { if ( CHECKLEVEL_NONE . equals ( checkLevel ) ) { return ; } String access = fieldDef . getProperty ( PropertyHelper . OJB_PROPERTY_ACCESS ) ; String autoInc = fieldDef . getProperty ( PropertyHelper . OJB_PROPERTY_AUTOINC...
Checks that native primarykey fields have readonly access and warns if not .
1,122
private void checkAnonymous ( FieldDescriptorDef fieldDef , String checkLevel ) throws ConstraintException { if ( CHECKLEVEL_NONE . equals ( checkLevel ) ) { return ; } String access = fieldDef . getProperty ( PropertyHelper . OJB_PROPERTY_ACCESS ) ; if ( ! "anonymous" . equals ( access ) ) { throw new ConstraintExcept...
Checks anonymous fields .
1,123
protected String sendRequestToDF ( String df_service , Object msgContent ) { IDFComponentDescription [ ] receivers = getReceivers ( df_service ) ; if ( receivers . length > 0 ) { IMessageEvent mevent = createMessageEvent ( "send_request" ) ; mevent . getParameter ( SFipa . CONTENT ) . setValue ( msgContent ) ; for ( in...
Method to send Request messages to a specific df_service
1,124
public Object copy ( Object obj , PersistenceBroker broker ) throws ObjectCopyException { if ( obj instanceof OjbCloneable ) { try { return ( ( OjbCloneable ) obj ) . ojbClone ( ) ; } catch ( Exception e ) { throw new ObjectCopyException ( e ) ; } } else { throw new ObjectCopyException ( "Object must implement OjbClone...
If users want to implement clone on all their objects we can use this to make copies . This is hazardous as user may mess it up but it is also potentially the fastest way of making a copy .
1,125
public void addColumn ( ColumnDef columnDef ) { columnDef . setOwner ( this ) ; _columns . put ( columnDef . getName ( ) , columnDef ) ; }
Adds a column to this table definition .
1,126
public IndexDef getIndex ( String name ) { String realName = ( name == null ? "" : name ) ; IndexDef def = null ; for ( Iterator it = getIndices ( ) ; it . hasNext ( ) ; ) { def = ( IndexDef ) it . next ( ) ; if ( def . getName ( ) . equals ( realName ) ) { return def ; } } return null ; }
Returns the index of the given name .
1,127
public void addForeignkey ( String relationName , String remoteTable , List localColumns , List remoteColumns ) { ForeignkeyDef foreignkeyDef = new ForeignkeyDef ( relationName , remoteTable ) ; for ( int idx = 0 ; idx < localColumns . size ( ) ; idx ++ ) { foreignkeyDef . addColumnPair ( ( String ) localColumns . get ...
Adds a foreignkey to this table .
1,128
public boolean hasForeignkey ( String name ) { String realName = ( name == null ? "" : name ) ; ForeignkeyDef def = null ; for ( Iterator it = getForeignkeys ( ) ; it . hasNext ( ) ; ) { def = ( ForeignkeyDef ) it . next ( ) ; if ( realName . equals ( def . getName ( ) ) ) { return true ; } } return false ; }
Determines whether this table has a foreignkey of the given name .
1,129
public ForeignkeyDef getForeignkey ( String name , String tableName ) { String realName = ( name == null ? "" : name ) ; ForeignkeyDef def = null ; for ( Iterator it = getForeignkeys ( ) ; it . hasNext ( ) ; ) { def = ( ForeignkeyDef ) it . next ( ) ; if ( realName . equals ( def . getName ( ) ) && def . getTableName (...
Returns the foreignkey to the specified table .
1,130
protected static PropertyDescriptor findPropertyDescriptor ( Class aClass , String aPropertyName ) { BeanInfo info ; PropertyDescriptor [ ] pd ; PropertyDescriptor descriptor = null ; try { info = Introspector . getBeanInfo ( aClass ) ; pd = info . getPropertyDescriptors ( ) ; for ( int i = 0 ; i < pd . length ; i ++ )...
Get the PropertyDescriptor for aClass and aPropertyName
1,131
private Expression getExpression ( String expressionString ) throws ParseException { if ( ! expressionCache . containsKey ( expressionString ) ) { Expression expression ; expression = parser . parseExpression ( expressionString ) ; expressionCache . put ( expressionString , expression ) ; } return expressionCache . get...
Fetch the specified expression from the cache or create it if necessary .
1,132
static final TimeBasedRollStrategy findRollStrategy ( final AppenderRollingProperties properties ) { if ( properties . getDatePattern ( ) == null ) { LogLog . error ( "null date pattern" ) ; return ROLL_ERROR ; } final LocalizedDateFormatPatternHelper localizedDateFormatPatternHelper = new LocalizedDateFormatPatternHel...
Checks each available roll strategy in turn starting at the per - minute strategy next per - hour and so on for increasing units of time until a match is found . If no match is found the error strategy is returned .
1,133
private void exitForm ( java . awt . event . WindowEvent evt ) { Main . getProperties ( ) . setProperty ( Main . PROPERTY_MAINFRAME_HEIGHT , "" + this . getHeight ( ) ) ; Main . getProperties ( ) . setProperty ( Main . PROPERTY_MAINFRAME_WIDTH , "" + this . getWidth ( ) ) ; Main . getProperties ( ) . setProperty ( Main...
Exit the Application
1,134
public String getPrototypeName ( ) { String name = getClass ( ) . getName ( ) ; if ( name . startsWith ( ORG_GEOMAJAS ) ) { name = name . substring ( ORG_GEOMAJAS . length ( ) ) ; } name = name . replace ( ".dto." , ".impl." ) ; return name . substring ( 0 , name . length ( ) - 4 ) + "Impl" ; }
Get prototype name .
1,135
public < T > Blob toExcelPivot ( final List < T > domainObjects , final Class < T > cls , final String fileName ) throws ExcelService . Exception { return toExcelPivot ( domainObjects , cls , null , fileName ) ; }
Creates a Blob holding a single - sheet spreadsheet with a pivot of the domain objects . The sheet name is derived from the class name .
1,136
protected void checkProxyPrefetchingLimit ( DefBase def , String checkLevel ) throws ConstraintException { if ( CHECKLEVEL_NONE . equals ( checkLevel ) ) { return ; } if ( def . hasProperty ( PropertyHelper . OJB_PROPERTY_PROXY_PREFETCHING_LIMIT ) ) { if ( ! def . hasProperty ( PropertyHelper . OJB_PROPERTY_PROXY ) ) {...
Constraint that ensures that the proxy - prefetching - limit has a valid value .
1,137
public boolean shouldCache ( String requestUri ) { String uri = requestUri . toLowerCase ( ) ; return checkContains ( uri , cacheIdentifiers ) || checkSuffixes ( uri , cacheSuffixes ) ; }
Should the URI be cached?
1,138
public boolean shouldNotCache ( String requestUri ) { String uri = requestUri . toLowerCase ( ) ; return checkContains ( uri , noCacheIdentifiers ) || checkSuffixes ( uri , noCacheSuffixes ) ; }
Should the URI explicitly not be cached .
1,139
public boolean shouldCompress ( String requestUri ) { String uri = requestUri . toLowerCase ( ) ; return checkSuffixes ( uri , zipSuffixes ) ; }
Should this request URI be compressed?
1,140
public boolean checkContains ( String uri , String [ ] patterns ) { for ( String pattern : patterns ) { if ( pattern . length ( ) > 0 ) { if ( uri . contains ( pattern ) ) { return true ; } } } return false ; }
Check whether the URL contains one of the patterns .
1,141
public boolean checkSuffixes ( String uri , String [ ] patterns ) { for ( String pattern : patterns ) { if ( pattern . length ( ) > 0 ) { if ( uri . endsWith ( pattern ) ) { return true ; } } } return false ; }
Check whether the URL end with one of the given suffixes .
1,142
public boolean checkPrefixes ( String uri , String [ ] patterns ) { for ( String pattern : patterns ) { if ( pattern . length ( ) > 0 ) { if ( uri . startsWith ( pattern ) ) { return true ; } } } return false ; }
Check whether the URL start with one of the given prefixes .
1,143
public static void configureNoCaching ( HttpServletResponse response ) { response . setHeader ( HTTP_EXPIRES_HEADER , HTTP_EXPIRES_HEADER_NOCACHE_VALUE ) ; response . setHeader ( HTTP_CACHE_PRAGMA , HTTP_CACHE_PRAGMA_VALUE ) ; response . setHeader ( HTTP_CACHE_CONTROL_HEADER , HTTP_CACHE_CONTROL_HEADER_NOCACHE_VALUE ) ...
Configure the HTTP response to switch off caching .
1,144
public static Context getContext ( ) { if ( ctx == null ) { try { setContext ( null ) ; } catch ( Exception e ) { log . error ( "Cannot instantiate the InitialContext" , e ) ; throw new OJBRuntimeException ( e ) ; } } return ctx ; }
Returns the naming context .
1,145
public static Object lookup ( String jndiName ) { if ( log . isDebugEnabled ( ) ) log . debug ( "lookup(" + jndiName + ") was called" ) ; try { return getContext ( ) . lookup ( jndiName ) ; } catch ( NamingException e ) { throw new OJBRuntimeException ( "Lookup failed for: " + jndiName , e ) ; } catch ( OJBRuntimeExcep...
Lookup an object instance from JNDI context .
1,146
public Authentication getAuthentication ( String token ) { if ( null != token ) { TokenContainer container = tokens . get ( token ) ; if ( null != container ) { if ( container . isValid ( ) ) { return container . getAuthentication ( ) ; } else { logout ( token ) ; } } } return null ; }
Get the authentication for a specific token .
1,147
public String login ( Authentication authentication ) { String token = getToken ( ) ; return login ( token , authentication ) ; }
Login for a specific authentication creating a new token .
1,148
public String login ( String token , Authentication authentication ) { if ( null == token ) { return login ( authentication ) ; } tokens . put ( token , new TokenContainer ( authentication ) ) ; return token ; }
Login for a specific authentication creating a specific token if given .
1,149
public boolean getBooleanProperty ( String name , boolean defaultValue ) { return PropertyHelper . toBoolean ( _properties . getProperty ( name ) , defaultValue ) ; }
Returns the boolean value of the specified property .
1,150
public SimpleFeatureSource getFeatureSource ( ) throws LayerException { try { if ( dataStore instanceof WFSDataStore ) { return dataStore . getFeatureSource ( featureSourceName . replace ( ":" , "_" ) ) ; } else { return dataStore . getFeatureSource ( featureSourceName ) ; } } catch ( IOException e ) { throw new LayerE...
Retrieve the FeatureSource object from the data store .
1,151
public void setAttributes ( Object feature , Map < String , Attribute > attributes ) throws LayerException { for ( Map . Entry < String , Attribute > entry : attributes . entrySet ( ) ) { String name = entry . getKey ( ) ; if ( ! name . equals ( getGeometryAttributeName ( ) ) ) { asFeature ( feature ) . setAttribute ( ...
Set the attributes of a feature .
1,152
private Object getAttributeRecursively ( Object feature , String name ) throws LayerException { if ( feature == null ) { return null ; } String [ ] properties = name . split ( SEPARATOR_REGEXP , 2 ) ; Object tempFeature ; if ( properties [ 0 ] . equals ( getFeatureInfo ( ) . getIdentifier ( ) . getName ( ) ) ) { tempFe...
A recursive getAttribute method . In case a one - to - many is passed an array will be returned .
1,153
public boolean shouldBeInReport ( final DbDependency dependency ) { if ( dependency == null ) { return false ; } if ( dependency . getTarget ( ) == null ) { return false ; } if ( corporateFilter != null ) { if ( ! decorator . getShowThirdparty ( ) && ! corporateFilter . filter ( dependency ) ) { return false ; } if ( !...
Check if a dependency matches the filters
1,154
public Map < String , Object > getArtifactFieldsFilters ( ) { final Map < String , Object > params = new HashMap < String , Object > ( ) ; for ( final Filter filter : filters ) { params . putAll ( filter . artifactFilterFields ( ) ) ; } return params ; }
Generates a Map of query parameters for Artifact regarding the filters
1,155
public Map < String , Object > getModuleFieldsFilters ( ) { final Map < String , Object > params = new HashMap < String , Object > ( ) ; for ( final Filter filter : filters ) { params . putAll ( filter . moduleFilterFields ( ) ) ; } return params ; }
Generates a Map of query parameters for Module regarding the filters
1,156
private DBHandling createDBHandling ( ) throws BuildException { if ( ( _handling == null ) || ( _handling . length ( ) == 0 ) ) { throw new BuildException ( "No handling specified" ) ; } try { String className = "org.apache.ojb.broker.platforms." + Character . toTitleCase ( _handling . charAt ( 0 ) ) + _handling . subs...
Creates a db handling object .
1,157
private void addIncludes ( DBHandling handling , FileSet fileSet ) throws BuildException { DirectoryScanner scanner = fileSet . getDirectoryScanner ( getProject ( ) ) ; String [ ] files = scanner . getIncludedFiles ( ) ; StringBuffer includes = new StringBuffer ( ) ; for ( int idx = 0 ; idx < files . length ; idx ++ ) ...
Adds the includes of the fileset to the handling .
1,158
public void setModel ( Database databaseModel , DescriptorRepository objModel ) { _dbModel = databaseModel ; _preparedModel = new PreparedModel ( objModel , databaseModel ) ; }
Sets the model that the handling works on .
1,159
public void getDataDTD ( Writer output ) throws DataTaskException { try { output . write ( "<!ELEMENT dataset (\n" ) ; for ( Iterator it = _preparedModel . getElementNames ( ) ; it . hasNext ( ) ; ) { String elementName = ( String ) it . next ( ) ; output . write ( " " ) ; output . write ( elementName ) ; output . w...
Writes a DTD that can be used for data XML files matching the current model to the given writer .
1,160
public static Object instantiate ( Class clazz ) throws InstantiationException { Object result = null ; try { result = ClassHelper . newInstance ( clazz ) ; } catch ( IllegalAccessException e ) { try { result = ClassHelper . newInstance ( clazz , true ) ; } catch ( Exception e1 ) { throw new ClassNotPersistenceCapableE...
create a new instance of class clazz . first use the public default constructor . If this fails also try to use protected an private constructors .
1,161
public static Object instantiate ( Constructor constructor ) throws InstantiationException { if ( constructor == null ) { throw new ClassNotPersistenceCapableException ( "A zero argument constructor was not provided!" ) ; } Object result = null ; try { result = constructor . newInstance ( NO_ARGS ) ; } catch ( Instanti...
create a new instance of the class represented by the no - argument constructor provided
1,162
public void synchTransaction ( SimpleFeatureStore featureStore ) { if ( TransactionSynchronizationManager . isActualTransactionActive ( ) ) { DataAccess < SimpleFeatureType , SimpleFeature > dataStore = featureStore . getDataStore ( ) ; if ( ! transactions . containsKey ( dataStore ) ) { Transaction transaction = null ...
Synchronize the geotools transaction with the platform transaction if such a transaction is active .
1,163
protected void buildCopyrightMap ( ) { if ( null == declaredPlugins ) { return ; } for ( PluginInfo plugin : declaredPlugins . values ( ) ) { for ( CopyrightInfo copyright : plugin . getCopyrightInfo ( ) ) { String key = copyright . getKey ( ) ; String msg = copyright . getKey ( ) + ": " + copyright . getCopyright ( ) ...
Build copyright map once .
1,164
public void storeIfNew ( final DbArtifact fromClient ) { final DbArtifact existing = repositoryHandler . getArtifact ( fromClient . getGavc ( ) ) ; if ( existing != null ) { existing . setLicenses ( fromClient . getLicenses ( ) ) ; store ( existing ) ; } if ( existing == null ) { store ( fromClient ) ; } }
If the Artifact does not exist it will add it to the database . Nothing if it already exit .
1,165
public void addLicense ( final String gavc , final String licenseId ) { final DbArtifact dbArtifact = getArtifact ( gavc ) ; final LicenseHandler licenseHandler = new LicenseHandler ( repositoryHandler ) ; final DbLicense license = licenseHandler . resolve ( licenseId ) ; if ( license == null ) { if ( dbArtifact . getL...
Adds a license to an artifact if the license exist into the database
1,166
public List < String > getArtifactVersions ( final String gavc ) { final DbArtifact artifact = getArtifact ( gavc ) ; return repositoryHandler . getArtifactVersions ( artifact ) ; }
Returns a the list of available version of an artifact
1,167
public String getArtifactLastVersion ( final String gavc ) { final List < String > versions = getArtifactVersions ( gavc ) ; final VersionsHandler versionHandler = new VersionsHandler ( repositoryHandler ) ; final String viaCompare = versionHandler . getLastVersion ( versions ) ; if ( viaCompare != null ) { return viaC...
Returns the last available version of an artifact
1,168
public DbArtifact getArtifact ( final String gavc ) { final DbArtifact artifact = repositoryHandler . getArtifact ( gavc ) ; if ( artifact == null ) { throw new WebApplicationException ( Response . status ( Response . Status . NOT_FOUND ) . entity ( "Artifact " + gavc + " does not exist." ) . build ( ) ) ; } return art...
Return an artifact regarding its gavc
1,169
public DbOrganization getOrganization ( final DbArtifact dbArtifact ) { final DbModule module = getModule ( dbArtifact ) ; if ( module == null || module . getOrganization ( ) == null ) { return null ; } return repositoryHandler . getOrganization ( module . getOrganization ( ) ) ; }
Returns the Organization that produce this artifact or null if there is none
1,170
public void updateDownLoadUrl ( final String gavc , final String downLoadUrl ) { final DbArtifact artifact = getArtifact ( gavc ) ; repositoryHandler . updateDownloadUrl ( artifact , downLoadUrl ) ; }
Update artifact download url of an artifact
1,171
public void updateProvider ( final String gavc , final String provider ) { final DbArtifact artifact = getArtifact ( gavc ) ; repositoryHandler . updateProvider ( artifact , provider ) ; }
Update artifact provider
1,172
public List < DbModule > getAncestors ( final String gavc , final FiltersHolder filters ) { final DbArtifact dbArtifact = getArtifact ( gavc ) ; return repositoryHandler . getAncestors ( dbArtifact , filters ) ; }
Return the list of module that uses the targeted artifact
1,173
public List < DbLicense > getArtifactLicenses ( final String gavc , final FiltersHolder filters ) { final DbArtifact artifact = getArtifact ( gavc ) ; final List < DbLicense > licenses = new ArrayList < > ( ) ; for ( final String name : artifact . getLicenses ( ) ) { final Set < DbLicense > matchingLicenses = licenseMa...
Return the list of licenses attached to an artifact
1,174
public void removeLicenseFromArtifact ( final String gavc , final String licenseId ) { final DbArtifact dbArtifact = getArtifact ( gavc ) ; repositoryHandler . removeLicenseFromArtifact ( dbArtifact , licenseId , licenseMatcher ) ; }
Remove a license from an artifact
1,175
public String getModuleJenkinsJobInfo ( final DbArtifact dbArtifact ) { final DbModule module = getModule ( dbArtifact ) ; if ( module == null ) { return "" ; } final String jenkinsJobUrl = module . getBuildInfo ( ) . get ( "jenkins-job-url" ) ; if ( jenkinsJobUrl == null ) { return "" ; } return jenkinsJobUrl ; }
k Returns a list of artifact regarding the filters
1,176
public static String getDefaultJdbcTypeFor ( String javaType ) { return _jdbcMappings . containsKey ( javaType ) ? ( String ) _jdbcMappings . get ( javaType ) : JDBC_DEFAULT_TYPE ; }
Returns the default jdbc type for the given java type .
1,177
public static String getDefaultConversionFor ( String javaType ) { return _jdbcConversions . containsKey ( javaType ) ? ( String ) _jdbcConversions . get ( javaType ) : null ; }
Returns the default conversion for the given java type .
1,178
protected Query buildMtoNImplementorQuery ( Collection ids ) { String [ ] indFkCols = getFksToThisClass ( ) ; String [ ] indItemFkCols = getFksToItemClass ( ) ; FieldDescriptor [ ] pkFields = getOwnerClassDescriptor ( ) . getPkFields ( ) ; FieldDescriptor [ ] itemPkFields = getItemClassDescriptor ( ) . getPkFields ( ) ...
Build a query to read the mn - implementors
1,179
private String [ ] getFksToThisClass ( ) { String indTable = getCollectionDescriptor ( ) . getIndirectionTable ( ) ; String [ ] fks = getCollectionDescriptor ( ) . getFksToThisClass ( ) ; String [ ] result = new String [ fks . length ] ; for ( int i = 0 ; i < result . length ; i ++ ) { result [ i ] = indTable + "." + f...
prefix the this class fk columns with the indirection table
1,180
private FieldConversion [ ] getPkFieldConversion ( ClassDescriptor cld ) { FieldDescriptor [ ] pks = cld . getPkFields ( ) ; FieldConversion [ ] fc = new FieldConversion [ pks . length ] ; for ( int i = 0 ; i < pks . length ; i ++ ) { fc [ i ] = pks [ i ] . getFieldConversion ( ) ; } return fc ; }
Answer the FieldConversions for the PkFields
1,181
private Object [ ] convert ( FieldConversion [ ] fcs , Object [ ] values ) { Object [ ] convertedValues = new Object [ values . length ] ; for ( int i = 0 ; i < values . length ; i ++ ) { convertedValues [ i ] = fcs [ i ] . sqlToJava ( values [ i ] ) ; } return convertedValues ; }
Convert the Values using the FieldConversion . sqlToJava
1,182
public void displayUseCases ( ) { System . out . println ( ) ; for ( int i = 0 ; i < useCases . size ( ) ; i ++ ) { System . out . println ( "[" + i + "] " + ( ( UseCase ) useCases . get ( i ) ) . getDescription ( ) ) ; } }
Disply available use cases .
1,183
public void run ( ) { System . out . println ( AsciiSplash . getSplashArt ( ) ) ; System . out . println ( "Welcome to the OJB PB tutorial application" ) ; System . out . println ( ) ; while ( true ) { try { UseCase uc = selectUseCase ( ) ; uc . apply ( ) ; } catch ( Throwable t ) { broker . close ( ) ; System . out . ...
the applications main loop .
1,184
public UseCase selectUseCase ( ) { displayUseCases ( ) ; System . out . println ( "type in number to select a use case" ) ; String in = readLine ( ) ; int index = Integer . parseInt ( in ) ; return ( UseCase ) useCases . get ( index ) ; }
select a use case .
1,185
public int getJdbcType ( String ojbType ) throws SQLException { int result ; if ( ojbType == null ) ojbType = "" ; ojbType = ojbType . toLowerCase ( ) ; if ( ojbType . equals ( "bit" ) ) result = Types . BIT ; else if ( ojbType . equals ( "tinyint" ) ) result = Types . TINYINT ; else if ( ojbType . equals ( "smallint" ...
Determines the java . sql . Types constant value from an OJB FIELDDESCRIPTOR value .
1,186
public void addRoute ( String path , Class < ? extends Actor > actorClass ) throws RouteAlreadyMappedException { addRoute ( new Route ( path , false ) , actorClass ) ; }
Add an exact path to the routing table .
1,187
public void addRegexRoute ( String urlPattern , Class < ? extends Actor > actorClass ) throws RouteAlreadyMappedException { addRoute ( new Route ( urlPattern , true ) , actorClass ) ; }
Add a URL pattern to the routing table .
1,188
public void setObjectForStatement ( PreparedStatement ps , int index , Object value , int sqlType ) throws SQLException { if ( sqlType == Types . TINYINT ) { ps . setByte ( index , ( ( Byte ) value ) . byteValue ( ) ) ; } else { super . setObjectForStatement ( ps , index , value , sqlType ) ; } }
Patch provided by Avril Kotzen ( hi001
1,189
public Collection getAllObjects ( Class target ) { PersistenceBroker broker = getBroker ( ) ; Collection result ; try { Query q = new QueryByCriteria ( target ) ; result = broker . getCollectionByQuery ( q ) ; } finally { if ( broker != null ) broker . close ( ) ; } return result ; }
Return all objects for the given class .
1,190
public void deleteObject ( Object object ) { PersistenceBroker broker = null ; try { broker = getBroker ( ) ; broker . delete ( object ) ; } finally { if ( broker != null ) broker . close ( ) ; } }
Delete an object .
1,191
public void bind ( Object object , String name ) throws ObjectNameNotUniqueException { if ( ! this . isOpen ( ) ) { throw new DatabaseClosedException ( "Database is not open. Must have an open DB to call bind." ) ; } TransactionImpl tx = getTransaction ( ) ; if ( tx == null || ! tx . isOpen ( ) ) { throw new Transactio...
Associate a name with an object and make it persistent . An object instance may be bound to more than one name . Binding a previously transient object to a name makes that object persistent .
1,192
public Object lookup ( String name ) throws ObjectNameNotFoundException { if ( ! this . isOpen ( ) ) { throw new DatabaseClosedException ( "Database is not open. Must have an open DB to call lookup" ) ; } TransactionImpl tx = getTransaction ( ) ; if ( tx == null || ! tx . isOpen ( ) ) { throw new TransactionNotInProgre...
Lookup an object via its name .
1,193
public void unbind ( String name ) throws ObjectNameNotFoundException { if ( ! this . isOpen ( ) ) { throw new DatabaseClosedException ( "Database is not open. Must have an open DB to call unbind" ) ; } TransactionImpl tx = getTransaction ( ) ; if ( tx == null || ! tx . isOpen ( ) ) { throw new TransactionNotInProgress...
Disassociate a name with an object
1,194
public void deletePersistent ( Object object ) { if ( ! this . isOpen ( ) ) { throw new DatabaseClosedException ( "Database is not open" ) ; } TransactionImpl tx = getTransaction ( ) ; if ( tx == null || ! tx . isOpen ( ) ) { throw new TransactionNotInProgressException ( "No transaction in progress, cannot delete persi...
Deletes an object from the database . It must be executed in the context of an open transaction . If the object is not persistent then ObjectNotPersistent is thrown . If the transaction in which this method is executed commits then the object is removed from the database . If the transaction aborts then the deletePersi...
1,195
protected void appendWhereClause ( StringBuffer stmt , Object [ ] columns ) { stmt . append ( " WHERE " ) ; for ( int i = 0 ; i < columns . length ; i ++ ) { if ( i > 0 ) { stmt . append ( " AND " ) ; } stmt . append ( columns [ i ] ) ; stmt . append ( "=?" ) ; } }
Generate a sql where - clause matching the contraints defined by the array of fields
1,196
private void logState ( final FileRollEvent fileRollEvent ) { synchronized ( this ) { final Collection < ApplicationState . ApplicationStateMessage > entries = ApplicationState . getAppStateEntries ( ) ; for ( ApplicationState . ApplicationStateMessage entry : entries ) { Level level = ApplicationState . getLog4jLevel ...
Write all state items to the log file .
1,197
public void setBooleanAttribute ( String name , Boolean value ) { ensureValue ( ) ; Attribute attribute = new BooleanAttribute ( value ) ; attribute . setEditable ( isEditable ( name ) ) ; getValue ( ) . getAllAttributes ( ) . put ( name , attribute ) ; }
Sets the specified boolean attribute to the specified value .
1,198
public void setFloatAttribute ( String name , Float value ) { ensureValue ( ) ; Attribute attribute = new FloatAttribute ( value ) ; attribute . setEditable ( isEditable ( name ) ) ; getValue ( ) . getAllAttributes ( ) . put ( name , attribute ) ; }
Sets the specified float attribute to the specified value .
1,199
public void setIntegerAttribute ( String name , Integer value ) { ensureValue ( ) ; Attribute attribute = new IntegerAttribute ( value ) ; attribute . setEditable ( isEditable ( name ) ) ; getValue ( ) . getAllAttributes ( ) . put ( name , attribute ) ; }
Sets the specified integer attribute to the specified value .