code
stringlengths 67
466k
| docstring
stringlengths 1
13.2k
|
---|---|
public void addGreaterThan(Object attribute, Object value)
{
// PAW
// addSelectionCriteria(ValueCriteria.buildGreaterCriteria(attribute, value, getAlias()));
addSelectionCriteria(ValueCriteria.buildGreaterCriteria(attribute, value, getUserAlias(attribute)));
} | Adds Greater Than (>) criteria,
customer_id > 10034
@param attribute The field name to be used
@param value An object representing the value of the field |
public void addGreaterThanField(String attribute, Object value)
{
// PAW
// addSelectionCriteria(FieldCriteria.buildGreaterCriteria(attribute, value, getAlias()));
addSelectionCriteria(FieldCriteria.buildGreaterCriteria(attribute, value, getUserAlias(attribute)));
} | Adds Greater Than (>) criteria,
customer_id > person_id
@param attribute The field name to be used
@param value The field to compare with |
public void addLessThan(Object attribute, Object value)
{
// PAW
// addSelectionCriteria(ValueCriteria.buildLessCriteria(attribute, value, getAlias()));
addSelectionCriteria(ValueCriteria.buildLessCriteria(attribute, value, getUserAlias(attribute)));
} | Adds Less Than (<) criteria,
customer_id < 10034
@param attribute The field name to be used
@param value An object representing the value of the field |
public void addLessThanField(String attribute, Object value)
{
// PAW
// addSelectionCriteria(FieldCriteria.buildLessCriteria(attribute, value, getAlias()));
addSelectionCriteria(FieldCriteria.buildLessCriteria(attribute, value, getUserAlias(attribute)));
} | Adds Less Than (<) criteria,
customer_id < person_id
@param attribute The field name to be used
@param value The field to compare with |
public void addOrderBy(String fieldName, boolean sortAscending)
{
if (fieldName != null)
{
_getOrderby().add(new FieldHelper(fieldName, sortAscending));
}
} | Adds a field for orderBy
@param fieldName the field name to be used
@param sortAscending true for ASCENDING, false for DESCENDING
@deprecated use QueryByCriteria#addOrderBy |
List getOrderby()
{
List result = _getOrderby();
Iterator iter = getCriteria().iterator();
Object crit;
while (iter.hasNext())
{
crit = iter.next();
if (crit instanceof Criteria)
{
result.addAll(((Criteria) crit).getOrderby());
}
}
return result;
} | Answer the orderBy of all Criteria and Sub Criteria
the elements are of class Criteria.FieldHelper
@return List |
public void addOrCriteria(Criteria pc)
{
if (!m_criteria.isEmpty())
{
pc.setEmbraced(true);
pc.setType(OR);
addCriteria(pc);
}
else
{
setEmbraced(false);
pc.setType(OR);
addCriteria(pc);
}
} | ORs two sets of criteria together:
<pre>
active = true AND balance < 0 OR active = true AND overdraft = 0
</pre>
@param pc criteria |
public void addColumnIsNull(String column)
{
// PAW
//SelectionCriteria c = ValueCriteria.buildNullCriteria(column, getAlias());
SelectionCriteria c = ValueCriteria.buildNullCriteria(column, getUserAlias(column));
c.setTranslateAttribute(false);
addSelectionCriteria(c);
} | Adds is Null criteria,
customer_id is Null
The attribute will NOT be translated into column name
@param column The column name to be used without translation |
public void addColumnNotNull(String column)
{
// PAW
// SelectionCriteria c = ValueCriteria.buildNotNullCriteria(column, getAlias());
SelectionCriteria c = ValueCriteria.buildNotNullCriteria(column, getUserAlias(column));
c.setTranslateAttribute(false);
addSelectionCriteria(c);
} | Adds not Null criteria,
customer_id is not Null
The attribute will NOT be translated into column name
@param column The column name to be used without translation |
public void addBetween(Object attribute, Object value1, Object value2)
{
// PAW
// addSelectionCriteria(ValueCriteria.buildBeweenCriteria(attribute, value1, value2, getAlias()));
addSelectionCriteria(ValueCriteria.buildBeweenCriteria(attribute, value1, value2, getUserAlias(attribute)));
} | Adds BETWEEN criteria,
customer_id between 1 and 10
@param attribute The field name to be used
@param value1 The lower boundary
@param value2 The upper boundary |
public void addNotBetween(Object attribute, Object value1, Object value2)
{
// PAW
// addSelectionCriteria(ValueCriteria.buildNotBeweenCriteria(attribute, value1, value2, getAlias()));
addSelectionCriteria(ValueCriteria.buildNotBeweenCriteria(attribute, value1, value2, getUserAlias(attribute)));
} | Adds NOT BETWEEN criteria,
customer_id not between 1 and 10
@param attribute The field name to be used
@param value1 The lower boundary
@param value2 The upper boundary |
public void addIn(String attribute, Collection values)
{
List list = splitInCriteria(attribute, values, false, IN_LIMIT);
int index = 0;
InCriteria inCrit;
Criteria allInCritaria;
inCrit = (InCriteria) list.get(index);
allInCritaria = new Criteria(inCrit);
for (index = 1; index < list.size(); index++)
{
inCrit = (InCriteria) list.get(index);
allInCritaria.addOrCriteria(new Criteria(inCrit));
}
addAndCriteria(allInCritaria);
} | Adds IN criteria,
customer_id in(1,10,33,44)
large values are split into multiple InCriteria
IN (1,10) OR IN(33, 44)
@param attribute The field name to be used
@param values The value Collection |
public void addColumnIn(String column, Collection values)
{
List list = splitInCriteria(column, values, false, IN_LIMIT);
int index = 0;
InCriteria inCrit;
Criteria allInCritaria;
inCrit = (InCriteria) list.get(index);
inCrit.setTranslateAttribute(false);
allInCritaria = new Criteria(inCrit);
for (index = 1; index < list.size(); index++)
{
inCrit = (InCriteria) list.get(index);
inCrit.setTranslateAttribute(false);
allInCritaria.addOrCriteria(new Criteria(inCrit));
}
addAndCriteria(allInCritaria);
} | Adds IN criteria,
customer_id in(1,10,33,44)
large values are split into multiple InCriteria
IN (1,10) OR IN(33, 44) </br>
The attribute will NOT be translated into column name
@param column The column name to be used without translation
@param values The value Collection |
public void addNotIn(String attribute, Collection values)
{
List list = splitInCriteria(attribute, values, true, IN_LIMIT);
InCriteria inCrit;
for (int index = 0; index < list.size(); index++)
{
inCrit = (InCriteria) list.get(index);
addSelectionCriteria(inCrit);
}
} | Adds NOT IN criteria,
customer_id not in(1,10,33,44)
large values are split into multiple InCriteria
NOT IN (1,10) AND NOT IN(33, 44)
@param attribute The field name to be used
@param values The value Collection |
public void addIn(Object attribute, Query subQuery)
{
// PAW
// addSelectionCriteria(ValueCriteria.buildInCriteria(attribute, subQuery, getAlias()));
addSelectionCriteria(ValueCriteria.buildInCriteria(attribute, subQuery, getUserAlias(attribute)));
} | IN Criteria with SubQuery
@param attribute The field name to be used
@param subQuery The subQuery |
public void addNotIn(String attribute, Query subQuery)
{
// PAW
// addSelectionCriteria(ValueCriteria.buildNotInCriteria(attribute, subQuery, getAlias()));
addSelectionCriteria(ValueCriteria.buildNotInCriteria(attribute, subQuery, getUserAlias(attribute)));
} | NOT IN Criteria with SubQuery
@param attribute The field name to be used
@param subQuery The subQuery |
public void addAndCriteria(Criteria pc)
{
// by combining a second criteria by 'AND' the existing criteria needs to be enclosed
// in parenthesis
if (!m_criteria.isEmpty())
{
this.setEmbraced(true);
pc.setEmbraced(true);
pc.setType(AND);
addCriteria(pc);
}
else
{
setEmbraced(false);
pc.setType(AND);
addCriteria(pc);
}
} | ANDs two sets of criteria together:
@param pc criteria |
List getGroupby()
{
List result = _getGroupby();
Iterator iter = getCriteria().iterator();
Object crit;
while (iter.hasNext())
{
crit = iter.next();
if (crit instanceof Criteria)
{
result.addAll(((Criteria) crit).getGroupby());
}
}
return result;
} | Gets the groupby for ReportQueries of all Criteria and Sub Criteria
the elements are of class FieldHelper
@return List of FieldHelper |
public void addGroupBy(String fieldName)
{
if (fieldName != null)
{
_getGroupby().add(new FieldHelper(fieldName, false));
}
} | Adds a groupby fieldName for ReportQueries.
@param fieldName The groupby to set
@deprecated use QueryByCriteria#addGroupBy |
public void addGroupBy(String[] fieldNames)
{
for (int i = 0; i < fieldNames.length; i++)
{
addGroupBy(fieldNames[i]);
}
} | Adds an array of groupby fieldNames for ReportQueries.
@param fieldNames The groupby to set
@deprecated use QueryByCriteria#addGroupBy |
private static int getSqlInLimit()
{
try
{
PersistenceBrokerConfiguration config = (PersistenceBrokerConfiguration) PersistenceBrokerFactory
.getConfigurator().getConfigurationFor(null);
return config.getSqlInLimit();
}
catch (ConfigurationException e)
{
return 200;
}
} | read the prefetchInLimit from Config based on OJB.properties |
private UserAlias getUserAlias(Object attribute)
{
if (m_userAlias != null)
{
return m_userAlias;
}
if (!(attribute instanceof String))
{
return null;
}
if (m_alias == null)
{
return null;
}
if (m_aliasPath == null)
{
boolean allPathsAliased = true;
return new UserAlias(m_alias, (String)attribute, allPathsAliased);
}
return new UserAlias(m_alias, (String)attribute, m_aliasPath);
} | Retrieves or if necessary, creates a user alias to be used
by a child criteria
@param attribute The alias to set |
public void setAlias(String alias)
{
if (alias == null || alias.trim().equals(""))
{
m_alias = null;
}
else
{
m_alias = alias;
}
// propagate to SelectionCriteria,not to Criteria
for (int i = 0; i < m_criteria.size(); i++)
{
if (!(m_criteria.elementAt(i) instanceof Criteria))
{
((SelectionCriteria) m_criteria.elementAt(i)).setAlias(m_alias);
}
}
} | Sets the alias. Empty String is regarded as null.
@param alias The alias to set |
public void setAlias(UserAlias userAlias)
{
m_alias = userAlias.getName();
// propagate to SelectionCriteria,not to Criteria
for (int i = 0; i < m_criteria.size(); i++)
{
if (!(m_criteria.elementAt(i) instanceof Criteria))
{
((SelectionCriteria) m_criteria.elementAt(i)).setAlias(userAlias);
}
}
} | Sets the alias using a userAlias object.
@param userAlias The alias to set |
public Map getPathClasses()
{
if (m_pathClasses.isEmpty())
{
if (m_parentCriteria == null)
{
if (m_query == null)
{
return m_pathClasses;
}
else
{
return m_query.getPathClasses();
}
}
else
{
return m_parentCriteria.getPathClasses();
}
}
else
{
return m_pathClasses;
}
} | Gets the pathClasses.
A Map containing hints about what Class to be used for what path segment
If local instance not set, try parent Criteria's instance. If this is
the top-level Criteria, try the m_query's instance
@return Returns a Map |
public void afterStatementCreate(java.sql.Statement stmt) throws PlatformException
{
super.afterStatementCreate(stmt);
// Check for OracleStatement-specific row prefetching support
final Method methodSetRowPrefetch;
methodSetRowPrefetch = ClassHelper.getMethod(stmt, "setRowPrefetch", PARAM_TYPE_INTEGER);
final boolean rowPrefetchingSupported = methodSetRowPrefetch != null;
if (rowPrefetchingSupported)
{
try
{
// Set number of prefetched rows
methodSetRowPrefetch.invoke(stmt, PARAM_ROW_PREFETCH_SIZE);
}
catch (Exception e)
{
throw new PlatformException(e.getLocalizedMessage(), e);
}
}
} | Enables Oracle row prefetching if supported.
See http://otn.oracle.com/sample_code/tech/java/sqlj_jdbc/files/advanced/RowPrefetchSample/Readme.html.
This is RDBMS server-to-client prefetching and thus one layer below
the OJB-internal prefetching-to-cache introduced in version 1.0rc5.
@param stmt the statement just created
@throws PlatformException upon JDBC failure |
public void beforeBatch(PreparedStatement stmt) throws PlatformException
{
// Check for Oracle batching support
final Method methodSetExecuteBatch;
final Method methodSendBatch;
methodSetExecuteBatch = ClassHelper.getMethod(stmt, "setExecuteBatch", PARAM_TYPE_INTEGER);
methodSendBatch = ClassHelper.getMethod(stmt, "sendBatch", null);
final boolean statementBatchingSupported = methodSetExecuteBatch != null && methodSendBatch != null;
if (statementBatchingSupported)
{
try
{
// Set number of statements per batch
methodSetExecuteBatch.invoke(stmt, PARAM_STATEMENT_BATCH_SIZE);
m_batchStatementsInProgress.put(stmt, methodSendBatch);
}
catch (Exception e)
{
throw new PlatformException(e.getLocalizedMessage(), e);
}
}
else
{
super.beforeBatch(stmt);
}
} | Try Oracle update batching and call setExecuteBatch or revert to
JDBC update batching. See 12-2 Update Batching in the Oracle9i
JDBC Developer's Guide and Reference.
@param stmt the prepared statement to be used for batching
@throws PlatformException upon JDBC failure |
public void addBatch(PreparedStatement stmt) throws PlatformException
{
// Check for Oracle batching support
final boolean statementBatchingSupported = m_batchStatementsInProgress.containsKey(stmt);
if (statementBatchingSupported)
{
try
{
stmt.executeUpdate();
}
catch (SQLException e)
{
throw new PlatformException(e.getLocalizedMessage(), e);
}
}
else
{
super.addBatch(stmt);
}
} | Try Oracle update batching and call executeUpdate or revert to
JDBC update batching.
@param stmt the statement beeing added to the batch
@throws PlatformException upon JDBC failure |
public int[] executeBatch(PreparedStatement stmt) throws PlatformException
{
// Check for Oracle batching support
final Method methodSendBatch = (Method) m_batchStatementsInProgress.remove(stmt);
final boolean statementBatchingSupported = methodSendBatch != null;
int[] retval = null;
if (statementBatchingSupported)
{
try
{
// sendBatch() returns total row count as an Integer
methodSendBatch.invoke(stmt, null);
}
catch (Exception e)
{
throw new PlatformException(e.getLocalizedMessage(), e);
}
}
else
{
retval = super.executeBatch(stmt);
}
return retval;
} | Try Oracle update batching and call sendBatch or revert to
JDBC update batching.
@param stmt the batched prepared statement about to be executed
@return always <code>null</code> if Oracle update batching is used,
since it is impossible to dissolve total row count into distinct
statement counts. If JDBC update batching is used, an int array is
returned containing number of updated rows for each batched statement.
@throws PlatformException upon JDBC failure |
public String getStatement()
{
StringBuffer sb = new StringBuffer(512);
int argumentCount = this.procedureDescriptor.getArgumentCount();
if (this.procedureDescriptor.hasReturnValue())
{
sb.append("{ ?= call ");
}
else
{
sb.append("{ call ");
}
sb.append(this.procedureDescriptor.getName());
sb.append("(");
for (int i = 0; i < argumentCount; i++)
{
if (i == 0)
{
sb.append("?");
}
else
{
sb.append(",?");
}
}
sb.append(") }");
return sb.toString();
} | Get the syntax that is required to invoke the procedure that is defined
by the <code>ProcedureDescriptor</code> that was passed to the
constructor of this class.
@see SqlStatement#getStatement() |
@Api
public boolean setSecurityContext(String authenticationToken, List<Authentication> authentications) {
if (!authentications.isEmpty()) {
// build authorization and build thread local SecurityContext
((DefaultSecurityContext) securityContext).setAuthentications(authenticationToken, authentications);
return true;
}
return false;
} | Method which sets the authorizations in the {@link SecurityContext}. To be overwritten when adding custom
policies.
@param authenticationToken authentication token
@param authentications authorizations for this token
@return true when a valid context was created, false when the token is not authenticated |
private void appendListOfValues(ClassDescriptor cld, StringBuffer stmt)
{
FieldDescriptor[] fields = cld.getAllRwFields();
if(fields.length == 0)
{
return;
}
stmt.append(" VALUES (");
for(int i = 0; i < fields.length; i++)
{
stmt.append("?");
if(i < fields.length - 1)
{
stmt.append(",");
}
}
stmt.append(") ");
} | generates a values(?,) for a prepared insert statement.
returns null if there are no fields
@param stmt the StringBuffer |
public BeanDefinition toInternal(BeanDefinitionInfo beanDefinitionInfo) {
if (beanDefinitionInfo instanceof GenericBeanDefinitionInfo) {
GenericBeanDefinitionInfo genericInfo = (GenericBeanDefinitionInfo) beanDefinitionInfo;
GenericBeanDefinition def = new GenericBeanDefinition();
def.setBeanClassName(genericInfo.getClassName());
if (genericInfo.getPropertyValues() != null) {
MutablePropertyValues propertyValues = new MutablePropertyValues();
for (Entry<String, BeanMetadataElementInfo> entry : genericInfo.getPropertyValues().entrySet()) {
BeanMetadataElementInfo info = entry.getValue();
propertyValues.add(entry.getKey(), toInternal(info));
}
def.setPropertyValues(propertyValues);
}
return def;
} else if (beanDefinitionInfo instanceof ObjectBeanDefinitionInfo) {
ObjectBeanDefinitionInfo objectInfo = (ObjectBeanDefinitionInfo) beanDefinitionInfo;
return createBeanDefinitionByIntrospection(objectInfo.getObject());
} else {
throw new IllegalArgumentException("Conversion to internal of " + beanDefinitionInfo.getClass().getName()
+ " not implemented");
}
} | Convert from a DTO to an internal Spring bean definition.
@param beanDefinitionDto The DTO object.
@return Returns a Spring bean definition. |
public BeanDefinitionInfo toDto(BeanDefinition beanDefinition) {
if (beanDefinition instanceof GenericBeanDefinition) {
GenericBeanDefinitionInfo info = new GenericBeanDefinitionInfo();
info.setClassName(beanDefinition.getBeanClassName());
if (beanDefinition.getPropertyValues() != null) {
Map<String, BeanMetadataElementInfo> propertyValues = new HashMap<String, BeanMetadataElementInfo>();
for (PropertyValue value : beanDefinition.getPropertyValues().getPropertyValueList()) {
Object obj = value.getValue();
if (obj instanceof BeanMetadataElement) {
propertyValues.put(value.getName(), toDto((BeanMetadataElement) obj));
} else {
throw new IllegalArgumentException("Type " + obj.getClass().getName()
+ " is not a BeanMetadataElement for property: " + value.getName());
}
}
info.setPropertyValues(propertyValues);
}
return info;
} else {
throw new IllegalArgumentException("Conversion to DTO of " + beanDefinition.getClass().getName()
+ " not implemented");
}
} | Convert from an internal Spring bean definition to a DTO.
@param beanDefinition The internal Spring bean definition.
@return Returns a DTO representation. |
private void validate(Object object) {
Set<ConstraintViolation<Object>> viols = validator.validate(object);
for (ConstraintViolation<Object> constraintViolation : viols) {
if (Null.class.isAssignableFrom(constraintViolation.getConstraintDescriptor().getAnnotation().getClass())) {
Object o = constraintViolation.getLeafBean();
Iterator<Node> iterator = constraintViolation.getPropertyPath().iterator();
String propertyName = null;
while (iterator.hasNext()) {
propertyName = iterator.next().getName();
}
if (propertyName != null) {
try {
PropertyDescriptor descriptor = BeanUtils.getPropertyDescriptor(o.getClass(), propertyName);
descriptor.getWriteMethod().invoke(o, new Object[] { null });
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
} | Take a stab at fixing validation problems ?
@param object |
protected void initializeJdbcConnection(Connection con, JdbcConnectionDescriptor jcd)
throws LookupException
{
try
{
PlatformFactory.getPlatformFor(jcd).initializeJdbcConnection(jcd, con);
}
catch (PlatformException e)
{
throw new LookupException("Platform dependent initialization of connection failed", e);
}
} | Initialize the connection with the specified properties in OJB
configuration files and platform depended properties.
Invoke this method after a NEW connection is created, not if re-using from pool.
@see org.apache.ojb.broker.platforms.PlatformFactory
@see org.apache.ojb.broker.platforms.Platform |
protected Connection newConnectionFromDataSource(JdbcConnectionDescriptor jcd)
throws LookupException
{
Connection retval = null;
// use JNDI lookup
DataSource ds = jcd.getDataSource();
if (ds == null)
{
// [tomdz] Would it suffice to store the datasources only at the JCDs ?
// Only possible problem would be serialization of the JCD because
// the data source object in the JCD does not 'survive' this
ds = (DataSource) dataSourceCache.get(jcd.getDatasourceName());
}
try
{
if (ds == null)
{
/**
* this synchronization block won't be a big deal as we only look up
* new datasources not found in the map.
*/
synchronized (dataSourceCache)
{
InitialContext ic = new InitialContext();
ds = (DataSource) ic.lookup(jcd.getDatasourceName());
/**
* cache the datasource lookup.
*/
dataSourceCache.put(jcd.getDatasourceName(), ds);
}
}
if (jcd.getUserName() == null)
{
retval = ds.getConnection();
}
else
{
retval = ds.getConnection(jcd.getUserName(), jcd.getPassWord());
}
}
catch (SQLException sqlEx)
{
log.error("SQLException thrown while trying to get Connection from Datasource (" +
jcd.getDatasourceName() + ")", sqlEx);
throw new LookupException("SQLException thrown while trying to get Connection from Datasource (" +
jcd.getDatasourceName() + ")", sqlEx);
}
catch (NamingException namingEx)
{
log.error("Naming Exception while looking up DataSource (" + jcd.getDatasourceName() + ")", namingEx);
throw new LookupException("Naming Exception while looking up DataSource (" + jcd.getDatasourceName() +
")", namingEx);
}
// initialize connection
initializeJdbcConnection(retval, jcd);
if(log.isDebugEnabled()) log.debug("Create new connection using DataSource: "+retval);
return retval;
} | Creates a new connection from the data source that the connection descriptor
represents. If the connection descriptor does not directly contain the data source
then a JNDI lookup is performed to retrieve the data source.
@param jcd The connection descriptor
@return A connection instance
@throws LookupException if we can't get a connection from the datasource either due to a
naming exception, a failed sanity check, or a SQLException. |
protected Connection newConnectionFromDriverManager(JdbcConnectionDescriptor jcd)
throws LookupException
{
Connection retval = null;
// use JDBC DriverManager
final String driver = jcd.getDriver();
final String url = getDbURL(jcd);
try
{
// loads the driver - NB call to newInstance() added to force initialisation
ClassHelper.getClass(driver, true);
final String user = jcd.getUserName();
final String password = jcd.getPassWord();
final Properties properties = getJdbcProperties(jcd, user, password);
if (properties.isEmpty())
{
if (user == null)
{
retval = DriverManager.getConnection(url);
}
else
{
retval = DriverManager.getConnection(url, user, password);
}
}
else
{
retval = DriverManager.getConnection(url, properties);
}
}
catch (SQLException sqlEx)
{
log.error("Error getting Connection from DriverManager with url (" + url + ") and driver (" + driver + ")", sqlEx);
throw new LookupException("Error getting Connection from DriverManager with url (" + url + ") and driver (" + driver + ")", sqlEx);
}
catch (ClassNotFoundException cnfEx)
{
log.error(cnfEx);
throw new LookupException("A class was not found", cnfEx);
}
catch (Exception e)
{
log.error("Instantiation of jdbc driver failed", e);
throw new LookupException("Instantiation of jdbc driver failed", e);
}
// initialize connection
initializeJdbcConnection(retval, jcd);
if(log.isDebugEnabled()) log.debug("Create new connection using DriverManager: "+retval);
return retval;
} | Returns a new created connection
@param jcd the connection descriptor
@return an instance of Connection from the drivermanager |
protected Properties getJdbcProperties(JdbcConnectionDescriptor jcd,
String user, String password)
{
final Properties jdbcProperties;
jdbcProperties = jcd.getConnectionPoolDescriptor().getJdbcProperties();
if (user != null)
{
jdbcProperties.put("user", user);
jdbcProperties.put("password", password);
}
return jdbcProperties;
} | Returns connection properties for passing to DriverManager, after merging
JDBC driver-specific configuration settings with name/password from connection
descriptor.
@param jcd the connection descriptor with driver-specific settings
@param user the jcd username (or null if not using authenticated login)
@param password the jcd password (only used when user != null)
@return merged properties object to pass to DriverManager |
public void clear()
{
Iterator it = cachesByClass.values().iterator();
while (it.hasNext())
{
ObjectCache cache = (ObjectCache) it.next();
if (cache != null)
{
cache.clear();
}
}
} | Clears the cache |
private ObjectCache getCachePerClass(Class objectClass, int methodCall)
{
ObjectCache cache = (ObjectCache) cachesByClass.get(objectClass.getName());
if (cache == null && AbstractMetaCache.METHOD_CACHE == methodCall
&& !cachesByClass.containsKey(objectClass.getName()))
{
cache = new ObjectCacheDefaultImpl(null, null);
setClassCache(objectClass.getName(), cache);
}
return cache;
} | Gets the cache for the given class
@param objectClass The class to look up the cache for
@return The cache |
public void cache(Identity oid, Object obj)
{
if ((obj != null))
{
SoftReference ref = new SoftReference(obj);
objectTable.put(oid, ref);
}
} | Makes object persistent to the Objectcache.
I'm using soft-references to allow gc reclaim unused objects
even if they are still cached. |
public Object lookup(Identity oid)
{
Object obj = null;
SoftReference ref = (SoftReference) objectTable.get(oid);
if (ref != null)
{
obj = ref.get();
if (obj == null)
{
objectTable.remove(oid); // Soft-referenced Object reclaimed by GC
}
}
return obj;
} | Lookup object with Identity oid in objectTable.
Returns null if no matching id is found |
private void prepareModel(DescriptorRepository model)
{
TreeMap result = new TreeMap();
for (Iterator it = model.getDescriptorTable().values().iterator(); it.hasNext();)
{
ClassDescriptor classDesc = (ClassDescriptor)it.next();
if (classDesc.getFullTableName() == null)
{
// not mapped to a database table
continue;
}
String elementName = getElementName(classDesc);
Table mappedTable = getTableFor(elementName);
Map columnsMap = getColumnsFor(elementName);
Map requiredAttributes = getRequiredAttributes(elementName);
List classDescs = getClassDescriptorsMappingTo(elementName);
if (mappedTable == null)
{
mappedTable = _schema.findTable(classDesc.getFullTableName());
if (mappedTable == null)
{
continue;
}
columnsMap = new TreeMap();
requiredAttributes = new HashMap();
classDescs = new ArrayList();
_elementToTable.put(elementName, mappedTable);
_elementToClassDescriptors.put(elementName, classDescs);
_elementToColumnMap.put(elementName, columnsMap);
_elementToRequiredAttributesMap.put(elementName, requiredAttributes);
}
classDescs.add(classDesc);
extractAttributes(classDesc, mappedTable, columnsMap, requiredAttributes);
}
extractIndirectionTables(model, _schema);
} | Prepares a representation of the model that is easier accessible for our purposes.
@param model The original model
@return The model representation |
private void extractIndirectionTables(DescriptorRepository model, Database schema)
{
HashMap indirectionTables = new HashMap();
// first we gather all participants for each m:n relationship
for (Iterator classDescIt = model.getDescriptorTable().values().iterator(); classDescIt.hasNext();)
{
ClassDescriptor classDesc = (ClassDescriptor)classDescIt.next();
for (Iterator collDescIt = classDesc.getCollectionDescriptors().iterator(); collDescIt.hasNext();)
{
CollectionDescriptor collDesc = (CollectionDescriptor)collDescIt.next();
String indirTable = collDesc.getIndirectionTable();
if ((indirTable != null) && (indirTable.length() > 0))
{
Set columns = (Set)indirectionTables.get(indirTable);
if (columns == null)
{
columns = new HashSet();
indirectionTables.put(indirTable, columns);
}
columns.addAll(Arrays.asList(collDesc.getFksToThisClass()));
columns.addAll(Arrays.asList(collDesc.getFksToItemClass()));
}
}
}
if (indirectionTables.isEmpty())
{
// nothing to do
return;
}
for (Iterator it = indirectionTables.keySet().iterator(); it.hasNext();)
{
String tableName = (String)it.next();
Set columns = (Set)indirectionTables.get(tableName);
String elementName = tableName;
for (Iterator classDescIt = model.getDescriptorTable().values().iterator(); classDescIt.hasNext();)
{
ClassDescriptor classDesc = (ClassDescriptor)classDescIt.next();
if (tableName.equals(classDesc.getFullTableName()))
{
elementName = getElementName(classDesc);
FieldDescriptor[] fieldDescs = classDesc.getFieldDescriptions();
if (fieldDescs != null)
{
for (int idx = 0; idx < fieldDescs.length; idx++)
{
columns.remove(fieldDescs[idx].getColumnName());
}
}
}
}
Table mappedTable = getTableFor(elementName);
Map columnsMap = getColumnsFor(elementName);
Map requiredAttributes = getRequiredAttributes(elementName);
if (mappedTable == null)
{
mappedTable = schema.findTable(elementName);
if (mappedTable == null)
{
continue;
}
columnsMap = new TreeMap();
requiredAttributes = new HashMap();
_elementToTable.put(elementName, mappedTable);
_elementToColumnMap.put(elementName, columnsMap);
_elementToRequiredAttributesMap.put(elementName, requiredAttributes);
}
for (Iterator columnIt = columns.iterator(); columnIt.hasNext();)
{
String columnName = (String)columnIt.next();
Column column = mappedTable.findColumn(columnName);
if (column != null)
{
columnsMap.put(columnName, column);
requiredAttributes.put(columnName, Boolean.TRUE);
}
}
}
} | Extracts indirection tables from the given class descriptor, and adds elements
for them. In contrast to normal elements, for indirection tables the element name
matches the table name, and the attribute names match the column names.
@param model The model
@param elements The elements |
private String getElementName(ClassDescriptor classDesc)
{
String elementName = classDesc.getClassNameOfObject().replace('$', '_');
elementName = elementName.substring(elementName.lastIndexOf('.') + 1);
Table table = getTableFor(elementName);
int suffix = 0;
while ((table != null) && !table.getName().equals(classDesc.getFullTableName()))
{
++suffix;
table = getTableFor(elementName + "-" + suffix);
}
if (suffix > 0)
{
elementName += "-" + suffix;
}
return elementName;
} | Returns the element name for the class descriptor which is the adjusted short (unqualified) class
name. Also takes care that the element name does not clash with another class of the same short
name that maps to a different table though.
@param classDesc The class descriptor
@return The element name |
public Object add(final Object value)
{
final Object key = new IdentityKey(value);
if (!super.containsKey(key))
{
return super.put(key, value);
}
else
{
return null;
}
} | adds an object to the Map. new IdentityKey(obj) is used as key |
protected void checkForBatchSupport(Connection conn)
{
if (!m_batchUpdatesChecked)
{
DatabaseMetaData meta;
try
{
meta = conn.getMetaData();
m_supportsBatchUpdates = meta.supportsBatchUpdates();
}
catch (Throwable th)
{
log.info("Batch support check failed", th);
m_supportsBatchUpdates = false;
}
finally
{
m_batchUpdatesChecked = true;
}
}
} | Sets platform information for if the jdbc driver/db combo support
batch operations. Will only be checked once, then have same batch
support setting for the entire session.
@param conn |
public void setObjectForStatement(PreparedStatement ps, int index, Object value, int sqlType)
throws SQLException
{
if ((sqlType == Types.LONGVARCHAR) && (value instanceof String))
{
String s = (String) value;
ps.setCharacterStream(index, new StringReader(s), s.length());
}
/*
PATCH for BigDecimal truncation problem. Seems that several databases (e.g. DB2, Sybase)
has problem with BigDecimal fields if the sql-type was set. The problem was discussed here
http://nagoya.apache.org/eyebrowse/[email protected]&msgNo=14113
A better option will be
<snip>
else if ((value instanceof BigDecimal) && (sqlType == Types.DECIMAL
|| sqlType == Types.NUMERIC))
{
ps.setObject(index, value, sqlType,
((BigDecimal) value).scale());
}
</snip>
But this way maxDB/sapDB does not work correct, so we use the most flexible solution
and let the jdbc-driver handle BigDecimal objects by itself.
*/
else if(sqlType == Types.DECIMAL || sqlType == Types.NUMERIC)
{
ps.setObject(index, value);
}
else
{
// arminw: this method call is done very, very often, so we can improve performance
// by comment out this section
// if (log.isDebugEnabled()) {
// log.debug("Default setObjectForStatement, sqlType=" + sqlType +
// ", value class=" + (value == null ? "NULL!" : value.getClass().getName())
// + ", value=" + value);
// }
ps.setObject(index, value, sqlType);
}
} | /*
@see Platform#setObject(PreparedStatement, int, Object, int) |
public void setNullForStatement(PreparedStatement ps, int index, int sqlType) throws SQLException
{
ps.setNull(index, sqlType);
} | /*
@see Platform#setNullForStatement(PreparedStatement, int, int) |
public synchronized final void activateOptions() {
this.deactivateOptions();
super.activateOptions();
if (getFilterEmptyMessages()) {
addFilter(new EmptyMessageFilter());
}
// rollables
this.setFileRollable(new CompositeRoller(this, this.getProperties()));
// scavenger
LogFileScavenger fileScavenger = this.getLogFileScavenger();
if (fileScavenger == null) {
fileScavenger = this.initLogFileScavenger(new DefaultLogFileScavenger());
}
fileScavenger.begin();
// compressor
final LogFileCompressor logFileCompressor = new LogFileCompressor(this, this.getProperties());
this.setLogFileCompressor(logFileCompressor);
this.getFileRollable().addFileRollEventListener(logFileCompressor);
logFileCompressor.begin();
// guest listener
this.registerGuestFileRollEventListener();
// roll enforcer
final TimeBasedRollEnforcer logRollEnforcer = new TimeBasedRollEnforcer(this, this.getProperties());
this.setLogRollEnforcer(logRollEnforcer);
logRollEnforcer.begin();
// roll on start-up
if (this.getProperties().shouldRollOnActivation()) {
synchronized (this) {
this.rollFile(new StartupFileRollEvent());
}
}
} | /*
(non-Javadoc)
@see org.apache.log4j.FileAppender#activateOptions() |
public void setDatePatternLocale(String datePatternLocale) {
if (datePatternLocale == null) {
LogLog.warn("Null date pattern locale supplied for appender [" + this.getName() + "], defaulting to " + this.getProperties().getDatePatternLocale());
return;
}
datePatternLocale = datePatternLocale.trim();
if ("".equals(datePatternLocale)) {
LogLog.warn("Empty date pattern locale supplied for appender [" + this.getName() + "], defaulting to " + this.getProperties().getDatePatternLocale());
return;
}
final String[] parts = datePatternLocale.split("_");
switch (parts.length) {
case 1:
this.getProperties().setDatePatternLocale(new Locale(parts[0]));
break;
case 2:
this.getProperties().setDatePatternLocale(new Locale(parts[0], parts[1]));
break;
default:
LogLog.warn("Unable to parse date pattern locale supplied for appender [" + this.getName() + "], defaulting to " + this.getProperties().getDatePatternLocale());
}
} | Sets the {@link java.util.Locale} to be used when processing date patterns.
Variants are not supported; only language and (optionally) country may be
used, e.g. "en", "en_GB" or
"fr_CA" are all valid. If no locale is supplied,
{@link java.util.Locale#ENGLISH} will be used.
@param datePatternLocale
@see java.util.Locale
@see #setDatePattern(String) |
public void setMinFreeDiskSpace(String value) {
if (value == null) {
LogLog.warn("Null min free disk space supplied for appender [" + this.getName() + "], defaulting to " + this.getProperties().getMinFreeDiscSpace());
return;
}
value = value.trim();
if ("".equals(value)) {
LogLog.warn("Empty min free disk space supplied for appender [" + this.getName() + "], defaulting to " + this.getProperties().getMinFreeDiscSpace());
return;
}
final long defaultMinFreeDiskSpace = this.getProperties().getMinFreeDiscSpace();
final long minFreeDiskSpace = OptionConverter.toFileSize(value, defaultMinFreeDiskSpace);
this.getProperties().setMinFreeDiscSpace(minFreeDiskSpace);
} | <b>Warning</b> Use of this property requires Java 6.
@param value |
protected final void setQWForFiles(final Writer writer) {
final SynchronizedCountingQuietWriter countingQuietWriter = new SynchronizedCountingQuietWriter(writer, super.getErrorHandler());
this.getProperties().setCountingQuietWriter(countingQuietWriter);
super.qw = countingQuietWriter;
} | /*
(non-Javadoc)
@see org.apache.log4j.FileAppender#setQWForFiles(java.io.Writer) |
@Override
protected final void subAppend(final LoggingEvent event) {
if (event instanceof ScheduledFileRollEvent) {
// the scheduled append() call has been made by a different thread
synchronized (this) {
if (this.closed) {
// just consume the event
return;
}
this.rollFile(event);
}
} else if (event instanceof FileRollEvent) {
// definitely want to avoid rolling here whilst a file roll event is still being handled
super.subAppend(event);
} else {
if(event instanceof FoundationLof4jLoggingEvent){
FoundationLof4jLoggingEvent foundationLof4jLoggingEvent = (FoundationLof4jLoggingEvent)event;
foundationLof4jLoggingEvent.setAppenderName(this.getName());
}
this.rollFile(event);
super.subAppend(event);
}
} | Responsible for executing file rolls as and when required, in addition to
delegating to the super class to perform the actual append operation.
Synchronized for safety during enforced file roll.
@see org.apache.log4j.WriterAppender#subAppend(org.apache.log4j.spi.LoggingEvent) |
public void setup() {
introspector = JadeAgentIntrospector.getMyInstance(this);
// Initializes the message count
// introspector.storeBeliefValue(this, Definitions.RECEIVED_MESSAGE_COUNT, 0);
// introspector.storeBeliefValue(this, Definitions.SENDED_MESSAGE_COUNT, 0);
MockConfiguration configuration = (MockConfiguration) this
.getArguments()[0];
LogActivator.logToFile(logger, this.getName(), Level.ALL);
behaviour = configuration.getBehaviour();
// Attempts to register the agent.
registered = false;
try {
System.out.println(this.getLocalName());
AgentRegistration.registerAgent(this, configuration.getDFservice(),
this.getLocalName());
registered = true;
System.out.println("Registered");
} catch (FIPAException e) {
System.out.println("Exception while registring the BridgeMock");
logger.warning("Exception while registring the BridgeMock");
logger.warning(e.getMessage()); // Will this show anything useful?
}
// Creates the instrospector
introspector = (JadeAgentIntrospector) PlatformSelector.getAgentIntrospector("jade");
// Adds the behavior to store the messages.
addBehaviour(new MessageReceiver());
} | Initializes the Agent.
@see jade.core.Agent#setup() |
public void updateIntegerBelief(String name, int value) {
introspector.storeBeliefValue(this, name, getIntegerBelief(name) + value);
} | Updates the given integer belief
adding the given integer
newBelief = previousBelief + givenValue
@param String - the belief name
@param the value to add |
public int getIntegerBelief(String name){
Object belief = introspector.getBeliefBase(this).get(name);
int count = 0;
if (belief!=null) {
count = (Integer) belief;
}
return (Integer) count;
} | Returns the integer value o the given belief |
@Programmatic
public <T> List<T> fromExcel(
final Blob excelBlob,
final Class<T> cls,
final String sheetName) throws ExcelService.Exception {
return fromExcel(excelBlob, new WorksheetSpec(cls, sheetName));
} | Returns a list of objects for each line in the spreadsheet, of the specified type.
<p>
If the class is a view model then the objects will be properly instantiated (that is, using
{@link DomainObjectContainer#newViewModelInstance(Class, String)}, with the correct
view model memento); otherwise the objects will be simple transient objects (that is, using
{@link DomainObjectContainer#newTransientInstance(Class)}).
</p> |
public TransactionImpl getCurrentTransaction()
{
TransactionImpl tx = tx_table.get(Thread.currentThread());
if(tx == null)
{
throw new TransactionNotInProgressException("Calling method needed transaction, but no transaction found for current thread :-(");
}
return tx;
} | Returns the current transaction for the calling thread.
@throws org.odmg.TransactionNotInProgressException
{@link org.odmg.TransactionNotInProgressException} if no transaction was found. |
public String getDefaultTableName()
{
String name = getName();
int lastDotPos = name.lastIndexOf('.');
int lastDollarPos = name.lastIndexOf('$');
return lastDollarPos > lastDotPos ? name.substring(lastDollarPos + 1) : name.substring(lastDotPos + 1);
} | Returns the default table name for this class which is the unqualified class name.
@return The default table name |
public void process() throws ConstraintException
{
ClassDescriptorDef otherClassDef;
for (Iterator it = getDirectBaseTypes(); it.hasNext();)
{
otherClassDef = (ClassDescriptorDef)it.next();
if (!otherClassDef.hasBeenProcessed())
{
otherClassDef.process();
}
}
for (Iterator it = getNested(); it.hasNext();)
{
otherClassDef = ((NestedDef)it.next()).getNestedType();
if (!otherClassDef.hasBeenProcessed())
{
otherClassDef.process();
}
}
ArrayList newFields = new ArrayList();
ArrayList newReferences = new ArrayList();
ArrayList newCollections = new ArrayList();
FieldDescriptorDef newFieldDef;
ReferenceDescriptorDef newRefDef;
CollectionDescriptorDef newCollDef;
// adding base features
if (getBooleanProperty(PropertyHelper.OJB_PROPERTY_INCLUDE_INHERITED, true))
{
ArrayList baseTypes = new ArrayList();
DefBase featureDef;
addRelevantBaseTypes(this, baseTypes);
for (Iterator it = baseTypes.iterator(); it.hasNext();)
{
cloneInheritedFeatures((ClassDescriptorDef)it.next(), newFields, newReferences, newCollections);
}
for (Iterator it = newFields.iterator(); it.hasNext();)
{
newFieldDef = (FieldDescriptorDef)it.next();
featureDef = getFeature(newFieldDef.getName());
if (featureDef != null)
{
if (!getBooleanProperty(PropertyHelper.OJB_PROPERTY_IGNORE, false))
{
// we have the implicit constraint that an anonymous field cannot redefine/be redefined
// except if it is ignored
if ("anonymous".equals(featureDef.getProperty(PropertyHelper.OJB_PROPERTY_ACCESS)))
{
throw new ConstraintException("The anonymous field "+featureDef.getName()+" in class "+getName()+" overrides an inherited field");
}
if ("anonymous".equals(newFieldDef.getProperty(PropertyHelper.OJB_PROPERTY_ACCESS)))
{
throw new ConstraintException("The inherited anonymous field "+newFieldDef.getName()+" is overriden in class "+getName());
}
}
LogHelper.warn(true, ClassDescriptorDef.class, "process", "Class "+getName()+" redefines the inherited field "+newFieldDef.getName());
it.remove();
}
}
for (Iterator it = newReferences.iterator(); it.hasNext();)
{
newRefDef = (ReferenceDescriptorDef)it.next();
if ("super".equals(newRefDef.getName()))
{
// we don't inherit super-references
it.remove();
}
else if (hasFeature(newRefDef.getName()))
{
LogHelper.warn(true, ClassDescriptorDef.class, "process", "Class "+getName()+" redefines the inherited reference "+newRefDef.getName());
it.remove();
}
}
for (Iterator it = newCollections.iterator(); it.hasNext();)
{
newCollDef = (CollectionDescriptorDef)it.next();
if (hasFeature(newCollDef.getName()))
{
LogHelper.warn(true, ClassDescriptorDef.class, "process", "Class "+getName()+" redefines the inherited collection "+newCollDef.getName());
it.remove();
}
}
}
// adding nested features
for (Iterator it = getNested(); it.hasNext();)
{
cloneNestedFeatures((NestedDef)it.next(), newFields, newReferences, newCollections);
}
_fields.addAll(0, newFields);
_references.addAll(0, newReferences);
_collections.addAll(0, newCollections);
sortFields();
_hasBeenProcessed = true;
} | Processes theis class (ensures that all base types are processed, copies their features to this class, and applies
modifications (removes ignored features, changes declarations).
@throws ConstraintException If a constraint has been violated |
private void sortFields()
{
HashMap fields = new HashMap();
ArrayList fieldsWithId = new ArrayList();
ArrayList fieldsWithoutId = new ArrayList();
FieldDescriptorDef fieldDef;
for (Iterator it = getFields(); it.hasNext(); )
{
fieldDef = (FieldDescriptorDef)it.next();
fields.put(fieldDef.getName(), fieldDef);
if (fieldDef.hasProperty(PropertyHelper.OJB_PROPERTY_ID))
{
fieldsWithId.add(fieldDef.getName());
}
else
{
fieldsWithoutId.add(fieldDef.getName());
}
}
Collections.sort(fieldsWithId, new FieldWithIdComparator(fields));
ArrayList result = new ArrayList();
for (Iterator it = fieldsWithId.iterator(); it.hasNext();)
{
result.add(getField((String)it.next()));
}
for (Iterator it = fieldsWithoutId.iterator(); it.hasNext();)
{
result.add(getField((String)it.next()));
}
_fields = result;
} | Sorts the fields. |
public void checkConstraints(String checkLevel) throws ConstraintException
{
// now checking constraints
FieldDescriptorConstraints fieldConstraints = new FieldDescriptorConstraints();
ReferenceDescriptorConstraints refConstraints = new ReferenceDescriptorConstraints();
CollectionDescriptorConstraints collConstraints = new CollectionDescriptorConstraints();
for (Iterator it = getFields(); it.hasNext();)
{
fieldConstraints.check((FieldDescriptorDef)it.next(), checkLevel);
}
for (Iterator it = getReferences(); it.hasNext();)
{
refConstraints.check((ReferenceDescriptorDef)it.next(), checkLevel);
}
for (Iterator it = getCollections(); it.hasNext();)
{
collConstraints.check((CollectionDescriptorDef)it.next(), checkLevel);
}
new ClassDescriptorConstraints().check(this, checkLevel);
} | Checks the constraints on this class.
@param checkLevel The amount of checks to perform
@exception ConstraintException If a constraint has been violated |
private void addRelevantBaseTypes(ClassDescriptorDef curType, ArrayList baseTypes)
{
ClassDescriptorDef baseDef;
for (Iterator it = curType.getDirectBaseTypes(); it.hasNext();)
{
baseDef = (ClassDescriptorDef)it.next();
if (!baseDef.getBooleanProperty(PropertyHelper.OJB_PROPERTY_INCLUDE_INHERITED, true))
{
// the base type has include-inherited set to false which means that
// it does not include base features
// since we do want these base features, we have to traverse its base types
addRelevantBaseTypes(baseDef, baseTypes);
}
baseTypes.add(baseDef);
}
} | Adds all relevant base types (depending on their include-inherited setting) to the given list.
@param curType The type to process
@param baseTypes The list of basetypes |
private boolean contains(ArrayList defs, DefBase obj)
{
for (Iterator it = defs.iterator(); it.hasNext();)
{
if (obj.getName().equals(((DefBase)it.next()).getName()))
{
return true;
}
}
return false;
} | Determines whether the given list contains a descriptor with the same name.
@param defs The list to search
@param obj The object that is searched for
@return <code>true</code> if the list contains a descriptor with the same name |
private void cloneInheritedFeatures(ClassDescriptorDef baseDef, ArrayList newFields, ArrayList newReferences, ArrayList newCollections)
{
FieldDescriptorDef copyFieldDef;
ReferenceDescriptorDef copyRefDef;
CollectionDescriptorDef copyCollDef;
// note that we also copy features with the ignore-property set to true
// they will be ignored later on
for (Iterator fieldIt = baseDef.getFields(); fieldIt.hasNext();)
{
copyFieldDef = cloneField((FieldDescriptorDef)fieldIt.next(), null);
if (!contains(newFields, copyFieldDef))
{
copyFieldDef.setInherited();
newFields.add(copyFieldDef);
}
}
for (Iterator refIt = baseDef.getReferences(); refIt.hasNext();)
{
copyRefDef = cloneReference((ReferenceDescriptorDef)refIt.next(), null);
if (!contains(newReferences, copyRefDef))
{
copyRefDef.setInherited();
newReferences.add(copyRefDef);
}
}
for (Iterator collIt = baseDef.getCollections(); collIt.hasNext();)
{
copyCollDef = cloneCollection((CollectionDescriptorDef)collIt.next(), null);
if (!contains(newCollections, copyCollDef))
{
copyCollDef.setInherited();
newCollections.add(copyCollDef);
}
}
} | Clones the features of the given base class (using modifications if available) and puts them into
the given lists.
@param baseDef The base class descriptor
@param newFields Recieves the field copies
@param newReferences Recieves the reference copies
@param newCollections Recieves the collection copies |
private void cloneNestedFeatures(NestedDef nestedDef, ArrayList newFields, ArrayList newReferences, ArrayList newCollections)
{
ClassDescriptorDef nestedClassDef = nestedDef.getNestedType();
String prefix = nestedDef.getName()+"::";
FieldDescriptorDef copyFieldDef;
ReferenceDescriptorDef copyRefDef;
CollectionDescriptorDef copyCollDef;
StringBuffer newForeignkey;
for (Iterator fieldIt = nestedClassDef.getFields(); fieldIt.hasNext();)
{
copyFieldDef = cloneField((FieldDescriptorDef)fieldIt.next(), prefix);
if (!contains(newFields, copyFieldDef))
{
copyFieldDef.setNested();
newFields.add(copyFieldDef);
}
}
for (Iterator refIt = nestedClassDef.getReferences(); refIt.hasNext();)
{
copyRefDef = cloneReference((ReferenceDescriptorDef)refIt.next(), prefix);
if (contains(newReferences, copyRefDef))
{
continue;
}
copyRefDef.setNested();
// we have to modify the foreignkey setting as it specifies a field of the same (nested) class
newForeignkey = new StringBuffer();
for (CommaListIterator it = new CommaListIterator(copyRefDef.getProperty(PropertyHelper.OJB_PROPERTY_FOREIGNKEY)); it.hasNext();)
{
if (newForeignkey.length() > 0)
{
newForeignkey.append(",");
}
newForeignkey.append(prefix);
newForeignkey.append(it.next());
}
copyRefDef.setProperty(PropertyHelper.OJB_PROPERTY_FOREIGNKEY, newForeignkey.toString());
newReferences.add(copyRefDef);
}
for (Iterator collIt = nestedClassDef.getCollections(); collIt.hasNext();)
{
copyCollDef = cloneCollection((CollectionDescriptorDef)collIt.next(), prefix);
if (!contains(newCollections, copyCollDef))
{
copyCollDef.setNested();
newCollections.add(copyCollDef);
}
}
} | Clones the features of the given nested object (using modifications if available) and puts them into
the given lists.
@param nestedDef The nested object
@param newFields Recieves the field copies
@param newReferences Recieves the reference copies
@param newCollections Recieves the collection copies |
private FieldDescriptorDef cloneField(FieldDescriptorDef fieldDef, String prefix)
{
FieldDescriptorDef copyFieldDef = new FieldDescriptorDef(fieldDef, prefix);
copyFieldDef.setOwner(this);
// we remove properties that are only relevant to the class the features are declared in
copyFieldDef.setProperty(PropertyHelper.OJB_PROPERTY_IGNORE, null);
Properties mod = getModification(copyFieldDef.getName());
if (mod != null)
{
if (!PropertyHelper.toBoolean(mod.getProperty(PropertyHelper.OJB_PROPERTY_IGNORE), false) &&
hasFeature(copyFieldDef.getName()))
{
LogHelper.warn(true,
ClassDescriptorDef.class,
"process",
"Class "+getName()+" has a feature that has the same name as its included field "+
copyFieldDef.getName()+" from class "+fieldDef.getOwner().getName());
}
copyFieldDef.applyModifications(mod);
}
return copyFieldDef;
} | Clones the given field.
@param fieldDef The field descriptor
@param prefix A prefix for the name
@return The cloned field |
private ReferenceDescriptorDef cloneReference(ReferenceDescriptorDef refDef, String prefix)
{
ReferenceDescriptorDef copyRefDef = new ReferenceDescriptorDef(refDef, prefix);
copyRefDef.setOwner(this);
// we remove properties that are only relevant to the class the features are declared in
copyRefDef.setProperty(PropertyHelper.OJB_PROPERTY_IGNORE, null);
Properties mod = getModification(copyRefDef.getName());
if (mod != null)
{
if (!PropertyHelper.toBoolean(mod.getProperty(PropertyHelper.OJB_PROPERTY_IGNORE), false) &&
hasFeature(copyRefDef.getName()))
{
LogHelper.warn(true,
ClassDescriptorDef.class,
"process",
"Class "+getName()+" has a feature that has the same name as its included reference "+
copyRefDef.getName()+" from class "+refDef.getOwner().getName());
}
copyRefDef.applyModifications(mod);
}
return copyRefDef;
} | Clones the given reference.
@param refDef The reference descriptor
@param prefix A prefix for the name
@return The cloned reference |
private CollectionDescriptorDef cloneCollection(CollectionDescriptorDef collDef, String prefix)
{
CollectionDescriptorDef copyCollDef = new CollectionDescriptorDef(collDef, prefix);
copyCollDef.setOwner(this);
// we remove properties that are only relevant to the class the features are declared in
copyCollDef.setProperty(PropertyHelper.OJB_PROPERTY_IGNORE, null);
Properties mod = getModification(copyCollDef.getName());
if (mod != null)
{
if (!PropertyHelper.toBoolean(mod.getProperty(PropertyHelper.OJB_PROPERTY_IGNORE), false) &&
hasFeature(copyCollDef.getName()))
{
LogHelper.warn(true,
ClassDescriptorDef.class,
"process",
"Class "+getName()+" has a feature that has the same name as its included collection "+
copyCollDef.getName()+" from class "+collDef.getOwner().getName());
}
copyCollDef.applyModifications(mod);
}
return copyCollDef;
} | Clones the given collection.
@param collDef The collection descriptor
@param prefix A prefix for the name
@return The cloned collection |
public Iterator getAllBaseTypes()
{
ArrayList baseTypes = new ArrayList();
baseTypes.addAll(_directBaseTypes.values());
for (int idx = baseTypes.size() - 1; idx >= 0; idx--)
{
ClassDescriptorDef curClassDef = (ClassDescriptorDef)baseTypes.get(idx);
for (Iterator it = curClassDef.getDirectBaseTypes(); it.hasNext();)
{
ClassDescriptorDef curBaseTypeDef = (ClassDescriptorDef)it.next();
if (!baseTypes.contains(curBaseTypeDef))
{
baseTypes.add(0, curBaseTypeDef);
idx++;
}
}
}
return baseTypes.iterator();
} | Returns all base types.
@return An iterator of the base types |
public Iterator getAllExtentClasses()
{
ArrayList subTypes = new ArrayList();
subTypes.addAll(_extents);
for (int idx = 0; idx < subTypes.size(); idx++)
{
ClassDescriptorDef curClassDef = (ClassDescriptorDef)subTypes.get(idx);
for (Iterator it = curClassDef.getExtentClasses(); it.hasNext();)
{
ClassDescriptorDef curSubTypeDef = (ClassDescriptorDef)it.next();
if (!subTypes.contains(curSubTypeDef))
{
subTypes.add(curSubTypeDef);
}
}
}
return subTypes.iterator();
} | Returns an iterator of all direct and indirect extents of this class.
@return The extents iterator |
public DefBase getFeature(String name)
{
DefBase result = getField(name);
if (result == null)
{
result = getReference(name);
}
if (result == null)
{
result = getCollection(name);
}
return result;
} | Returns the feature (field, reference, collection) of the given name.
@param name The name
@return The feature or <code>null</code> if there is no such feature in the current class |
public FieldDescriptorDef getField(String name)
{
FieldDescriptorDef fieldDef = null;
for (Iterator it = _fields.iterator(); it.hasNext(); )
{
fieldDef = (FieldDescriptorDef)it.next();
if (fieldDef.getName().equals(name))
{
return fieldDef;
}
}
return null;
} | Returns the field definition with the specified name.
@param name The name of the desired field
@return The field definition or <code>null</code> if there is no such field |
public ArrayList getFields(String fieldNames) throws NoSuchFieldException
{
ArrayList result = new ArrayList();
FieldDescriptorDef fieldDef;
String name;
for (CommaListIterator it = new CommaListIterator(fieldNames); it.hasNext();)
{
name = it.getNext();
fieldDef = getField(name);
if (fieldDef == null)
{
throw new NoSuchFieldException(name);
}
result.add(fieldDef);
}
return result;
} | Returns the field descriptors given in the the field names list.
@param fieldNames The field names, separated by commas
@return The field descriptors in the order given by the field names
@throws NoSuchFieldException If a field hasn't been found |
public ArrayList getPrimaryKeys()
{
ArrayList result = new ArrayList();
FieldDescriptorDef fieldDef;
for (Iterator it = getFields(); it.hasNext();)
{
fieldDef = (FieldDescriptorDef)it.next();
if (fieldDef.getBooleanProperty(PropertyHelper.OJB_PROPERTY_PRIMARYKEY, false))
{
result.add(fieldDef);
}
}
return result;
} | Returns the primarykey fields.
@return The field descriptors of the primarykey fields |
public ReferenceDescriptorDef getReference(String name)
{
ReferenceDescriptorDef refDef;
for (Iterator it = _references.iterator(); it.hasNext(); )
{
refDef = (ReferenceDescriptorDef)it.next();
if (refDef.getName().equals(name))
{
return refDef;
}
}
return null;
} | Returns a reference definition of the given name if it exists.
@param name The name of the reference
@return The reference def or <code>null</code> if there is no such reference |
public CollectionDescriptorDef getCollection(String name)
{
CollectionDescriptorDef collDef = null;
for (Iterator it = _collections.iterator(); it.hasNext(); )
{
collDef = (CollectionDescriptorDef)it.next();
if (collDef.getName().equals(name))
{
return collDef;
}
}
return null;
} | Returns the collection definition of the given name if it exists.
@param name The name of the collection
@return The collection definition or <code>null</code> if there is no such collection |
public NestedDef getNested(String name)
{
NestedDef nestedDef = null;
for (Iterator it = _nested.iterator(); it.hasNext(); )
{
nestedDef = (NestedDef)it.next();
if (nestedDef.getName().equals(name))
{
return nestedDef;
}
}
return null;
} | Returns the nested object definition with the specified name.
@param name The name of the attribute of the nested object
@return The nested object definition or <code>null</code> if there is no such nested object |
public IndexDescriptorDef getIndexDescriptor(String name)
{
IndexDescriptorDef indexDef = null;
for (Iterator it = _indexDescriptors.iterator(); it.hasNext(); )
{
indexDef = (IndexDescriptorDef)it.next();
if (indexDef.getName().equals(name))
{
return indexDef;
}
}
return null;
} | Returns the index descriptor definition of the given name if it exists.
@param name The name of the index
@return The index descriptor definition or <code>null</code> if there is no such index |
public ObjectCacheDef setObjectCache(String name)
{
if ((_objectCache == null) || !_objectCache.getName().equals(name))
{
_objectCache = new ObjectCacheDef(name);
_objectCache.setOwner(this);
}
return _objectCache;
} | Sets an object cache definition to an object cache of the given name (if necessary), and returns it.
@param name The name of the object cache class
@return The object cache definition |
public void addProcedure(ProcedureDef procDef)
{
procDef.setOwner(this);
_procedures.put(procDef.getName(), procDef);
} | Adds a procedure definition to this class descriptor.
@param procDef The procedure definition |
public void addProcedureArgument(ProcedureArgumentDef argDef)
{
argDef.setOwner(this);
_procedureArguments.put(argDef.getName(), argDef);
} | Adds a procedure argument definition to this class descriptor.
@param argDef The procedure argument definition |
public void processClass(String template, Properties attributes) throws XDocletException
{
if (!_model.hasClass(getCurrentClass().getQualifiedName()))
{
// we only want to output the log message once
LogHelper.debug(true, OjbTagsHandler.class, "processClass", "Type "+getCurrentClass().getQualifiedName());
}
ClassDescriptorDef classDef = ensureClassDef(getCurrentClass());
String attrName;
for (Enumeration attrNames = attributes.propertyNames(); attrNames.hasMoreElements(); )
{
attrName = (String)attrNames.nextElement();
classDef.setProperty(attrName, attributes.getProperty(attrName));
}
_curClassDef = classDef;
generate(template);
_curClassDef = null;
} | Sets the current class definition derived from the current class, and optionally some attributes.
@param template The template
@param attributes The attributes of the tag
@exception XDocletException if an error occurs
@doc.tag type="block"
@doc.param name="accept-locks" optional="true" description="The accept locks setting" values="true,false"
@doc.param name="attributes" optional="true" description="Attributes of the class as name-value pairs 'name=value',
separated by commas"
@doc.param name="determine-extents" optional="true" description="Whether to determine
persistent direct sub types automatically" values="true,false"
@doc.param name="documentation" optional="true" description="Documentation on the class"
@doc.param name="factory-method" optional="true" description="Specifies a no-argument factory method that is
used to create instances (not yet implemented !)"
@doc.param name="factory-class" optional="true" description="Specifies a factory class to be used for creating
objects of this class"
@doc.param name="factory-method" optional="true" description="Specifies a static no-argument method in the factory class"
@doc.param name="generate-repository-info" optional="true" description="Whether repository data should be
generated for the class" values="true,false"
@doc.param name="generate-table-info" optional="true" description="Whether table data should be
generated for the class" values="true,false"
@doc.param name="include-inherited" optional="true" description="Whether to include
fields/references/collections of supertypes" values="true,false"
@doc.param name="initialization-method" optional="true" description="Specifies a no-argument instance method that is
called right after an instance has been read from the database"
@doc.param name="isolation-level" optional="true" description="The isolation level setting"
@doc.param name="proxy" optional="true" description="The proxy setting for this class"
@doc.param name="proxy-prefetching-limit" optional="true" description="Specifies the amount of objects of
objects of this class to prefetch in collections"
@doc.param name="refresh" optional="true" description="Can be set to force OJB to refresh instances when
loaded from the cache" values="true,false"
@doc.param name="row-reader" optional="true" description="The row reader for the class"
@doc.param name="schema" optional="true" description="The schema for the type"
@doc.param name="table" optional="true" description="The table for the class"
@doc.param name="table-documentation" optional="true" description="Documentation on the table" |
public void forAllClassDefinitions(String template, Properties attributes) throws XDocletException
{
for (Iterator it = _model.getClasses(); it.hasNext(); )
{
_curClassDef = (ClassDescriptorDef)it.next();
generate(template);
}
_curClassDef = null;
LogHelper.debug(true, OjbTagsHandler.class, "forAllClassDefinitions", "Processed "+_model.getNumClasses()+" types");
} | Processes the template for all class definitions.
@param template The template
@param attributes The attributes of the tag
@exception XDocletException if an error occurs
@doc.tag type="block" |
public void originalClass(String template, Properties attributes) throws XDocletException
{
pushCurrentClass(_curClassDef.getOriginalClass());
generate(template);
popCurrentClass();
} | Processes the original class rather than the current class definition.
@param template The template
@param attributes The attributes of the tag
@exception XDocletException if an error occurs
@doc.tag type="block" |
public String prepare() throws XDocletException
{
String checkLevel = (String)getDocletContext().getConfigParam(CONFIG_PARAM_CHECKS);
ArrayList queue = new ArrayList();
ClassDescriptorDef classDef, baseDef;
XClass original;
boolean isFinished;
// determine inheritance relationships
for (Iterator it = _model.getClasses(); it.hasNext();)
{
classDef = (ClassDescriptorDef)it.next();
original = classDef.getOriginalClass();
isFinished = false;
queue.clear();
while (!isFinished)
{
if (original == null)
{
isFinished = true;
for (Iterator baseIt = queue.iterator(); baseIt.hasNext();)
{
original = (XClass)baseIt.next();
baseDef = _model.getClass(original.getQualifiedName());
baseIt.remove();
if (baseDef != null)
{
classDef.addDirectBaseType(baseDef);
}
else
{
isFinished = false;
break;
}
}
}
if (!isFinished)
{
if (original.getInterfaces() != null)
{
for (Iterator baseIt = original.getInterfaces().iterator(); baseIt.hasNext();)
{
queue.add(baseIt.next());
}
}
if (original.getSuperclass() != null)
{
queue.add(original.getSuperclass());
}
original = null;
}
}
}
try
{
_model.process();
_model.checkConstraints(checkLevel);
}
catch (ConstraintException ex)
{
throw new XDocletException(ex.getMessage());
}
return "";
} | Processes all classes (flattens the hierarchy such that every class has declarations for all fields,
references,collections that it will have in the descriptor) and applies modifications (removes ignored
features, changes declarations).
@return An empty string
@doc.tag type="content" |
public void forAllSubClasses(String template, Properties attributes) throws XDocletException
{
ArrayList subTypes = new ArrayList();
XClass type = getCurrentClass();
addDirectSubTypes(type, subTypes);
int pos = 0;
ClassDescriptorDef classDef;
while (pos < subTypes.size())
{
type = (XClass)subTypes.get(pos);
classDef = _model.getClass(type.getQualifiedName());
if ((classDef != null) && classDef.hasProperty(PropertyHelper.OJB_PROPERTY_OJB_PERSISTENT))
{
pos++;
}
else
{
subTypes.remove(pos);
addDirectSubTypes(type, subTypes);
}
}
for (Iterator it = subTypes.iterator(); it.hasNext(); )
{
pushCurrentClass((XClass)it.next());
generate(template);
popCurrentClass();
}
} | The <code>forAllSubClasses</code> method iterates through all sub types of the current type (classes if it is a
class or classes and interfaces for an interface).
@param template The template
@param attributes The attributes of the tag
@exception XDocletException if an error occurs
@doc.tag type="block" |
public String addExtent(Properties attributes) throws XDocletException
{
String name = attributes.getProperty(ATTRIBUTE_NAME);
if (!_model.hasClass(name))
{
throw new XDocletException(Translator.getString(XDocletModulesOjbMessages.class,
XDocletModulesOjbMessages.COULD_NOT_FIND_TYPE,
new String[]{name}));
}
_curClassDef.addExtentClass(_model.getClass(name));
return "";
} | Adds an extent relation to the current class definition.
@param attributes The attributes of the tag
@return An empty string
@exception XDocletException If an error occurs
@doc.tag type="content"
@doc.param name="name" optional="false" description="The fully qualified name of the extending
class" |
public void forAllExtents(String template, Properties attributes) throws XDocletException
{
for (Iterator it = _curClassDef.getExtentClasses(); it.hasNext(); )
{
_curExtent = (ClassDescriptorDef)it.next();
generate(template);
}
_curExtent = null;
} | Processes the template for all extents of the current class.
@param template The template
@param attributes The attributes of the tag
@exception XDocletException if an error occurs
@doc.tag type="block" |
public String processIndexDescriptor(Properties attributes) throws XDocletException
{
String name = attributes.getProperty(ATTRIBUTE_NAME);
IndexDescriptorDef indexDef = _curClassDef.getIndexDescriptor(name);
String attrName;
if (indexDef == null)
{
indexDef = new IndexDescriptorDef(name);
_curClassDef.addIndexDescriptor(indexDef);
}
if ((indexDef.getName() == null) || (indexDef.getName().length() == 0))
{
throw new XDocletException(Translator.getString(XDocletModulesOjbMessages.class,
XDocletModulesOjbMessages.INDEX_NAME_MISSING,
new String[]{_curClassDef.getName()}));
}
attributes.remove(ATTRIBUTE_NAME);
for (Enumeration attrNames = attributes.propertyNames(); attrNames.hasMoreElements(); )
{
attrName = (String)attrNames.nextElement();
indexDef.setProperty(attrName, attributes.getProperty(attrName));
}
return "";
} | Processes an index descriptor tag.
@param template The template
@param attributes The attributes of the tag
@exception XDocletException If an error occurs
@doc.tag type="content"
@doc.param name="documentation" optional="true" description="Documentation on the index"
@doc.param name="fields" optional="false" description="The fields making up the index separated by commas"
@doc.param name="name" optional="false" description="The name of the index descriptor"
@doc.param name="unique" optional="true" description="Whether the index descriptor is unique" values="true,false" |
public void forAllIndexDescriptorDefinitions(String template, Properties attributes) throws XDocletException
{
for (Iterator it = _curClassDef.getIndexDescriptors(); it.hasNext(); )
{
_curIndexDescriptorDef = (IndexDescriptorDef)it.next();
generate(template);
}
_curIndexDescriptorDef = null;
} | Processes the template for all index descriptors of the current class definition.
@param template The template
@param attributes The attributes of the tag
@exception XDocletException if an error occurs
@doc.tag type="block" |
public void forAllIndexDescriptorColumns(String template, Properties attributes) throws XDocletException
{
String fields = _curIndexDescriptorDef.getProperty(PropertyHelper.OJB_PROPERTY_FIELDS);
FieldDescriptorDef fieldDef;
String name;
for (CommaListIterator it = new CommaListIterator(fields); it.hasNext();)
{
name = it.getNext();
fieldDef = _curClassDef.getField(name);
if (fieldDef == null)
{
throw new XDocletException(Translator.getString(XDocletModulesOjbMessages.class,
XDocletModulesOjbMessages.INDEX_FIELD_MISSING,
new String[]{name, _curIndexDescriptorDef.getName(), _curClassDef.getName()}));
}
_curIndexColumn = fieldDef.getProperty(PropertyHelper.OJB_PROPERTY_COLUMN);
generate(template);
}
_curIndexColumn = null;
} | Processes the template for all index columns for the current index descriptor.
@param template The template
@param attributes The attributes of the tag
@exception XDocletException if an error occurs
@doc.tag type="block" |
public String processObjectCache(Properties attributes) throws XDocletException
{
ObjectCacheDef objCacheDef = _curClassDef.setObjectCache(attributes.getProperty(ATTRIBUTE_CLASS));
String attrName;
attributes.remove(ATTRIBUTE_CLASS);
for (Enumeration attrNames = attributes.propertyNames(); attrNames.hasMoreElements(); )
{
attrName = (String)attrNames.nextElement();
objCacheDef.setProperty(attrName, attributes.getProperty(attrName));
}
return "";
} | Processes an object cache tag.
@param template The template
@param attributes The attributes of the tag
@exception XDocletException If an error occurs
@doc.tag type="content"
@doc.param name="attributes" optional="true" description="Attributes of the object-cache as name-value pairs 'name=value',
@doc.param name="class" optional="false" description="The object cache implementation"
@doc.param name="documentation" optional="true" description="Documentation on the object cache" |
public void forObjectCache(String template, Properties attributes) throws XDocletException
{
_curObjectCacheDef = _curClassDef.getObjectCache();
if (_curObjectCacheDef != null)
{
generate(template);
_curObjectCacheDef = null;
}
} | Processes the template for the object cache of the current class definition.
@param template The template
@param attributes The attributes of the tag
@exception XDocletException if an error occurs
@doc.tag type="block" |
public String processProcedure(Properties attributes) throws XDocletException
{
String type = attributes.getProperty(ATTRIBUTE_TYPE);
ProcedureDef procDef = _curClassDef.getProcedure(type);
String attrName;
if (procDef == null)
{
procDef = new ProcedureDef(type);
_curClassDef.addProcedure(procDef);
}
for (Enumeration attrNames = attributes.propertyNames(); attrNames.hasMoreElements(); )
{
attrName = (String)attrNames.nextElement();
procDef.setProperty(attrName, attributes.getProperty(attrName));
}
return "";
} | Processes a procedure tag.
@param template The template
@param attributes The attributes of the tag
@exception XDocletException If an error occurs
@doc.tag type="content"
@doc.param name="arguments" optional="true" description="The arguments of the procedure as a comma-separated
list of names of procedure attribute tags"
@doc.param name="attributes" optional="true" description="Attributes of the procedure as name-value pairs 'name=value',
separated by commas"
@doc.param name="documentation" optional="true" description="Documentation on the procedure"
@doc.param name="include-all-fields" optional="true" description="For insert/update: whether all fields of the current
class shall be included (arguments is ignored then)" values="true,false"
@doc.param name="include-pk-only" optional="true" description="For delete: whether all primary key fields
shall be included (arguments is ignored then)" values="true,false"
@doc.param name="name" optional="false" description="The name of the procedure"
@doc.param name="return-field-ref" optional="true" description="Identifies the field that receives the return value"
@doc.param name="type" optional="false" description="The type of the procedure" values="delete,insert,update" |
public void forAllProcedures(String template, Properties attributes) throws XDocletException
{
for (Iterator it = _curClassDef.getProcedures(); it.hasNext(); )
{
_curProcedureDef = (ProcedureDef)it.next();
generate(template);
}
_curProcedureDef = null;
} | Processes the template for all procedures of the current class definition.
@param template The template
@param attributes The attributes of the tag
@exception XDocletException if an error occurs
@doc.tag type="block" |
public String processProcedureArgument(Properties attributes) throws XDocletException
{
String id = attributes.getProperty(ATTRIBUTE_NAME);
ProcedureArgumentDef argDef = _curClassDef.getProcedureArgument(id);
String attrName;
if (argDef == null)
{
argDef = new ProcedureArgumentDef(id);
_curClassDef.addProcedureArgument(argDef);
}
attributes.remove(ATTRIBUTE_NAME);
for (Enumeration attrNames = attributes.propertyNames(); attrNames.hasMoreElements(); )
{
attrName = (String)attrNames.nextElement();
argDef.setProperty(attrName, attributes.getProperty(attrName));
}
return "";
} | Processes a runtime procedure argument tag.
@param template The template
@param attributes The attributes of the tag
@exception XDocletException If an error occurs
@doc.tag type="content"
@doc.param name="attributes" optional="true" description="Attributes of the procedure as name-value pairs 'name=value',
separated by commas"
@doc.param name="documentation" optional="true" description="Documentation on the procedure"
@doc.param name="field-ref" optional="true" description="Identifies the field that provides the value
if a runtime argument; if not set, then null is used"
@doc.param name="name" optional="false" description="The identifier of the argument tag"
@doc.param name="return" optional="true" description="Whether this is a return value (if a runtime argument)"
values="true,false"
@doc.param name="value" optional="false" description="The value if a constant argument" |
public void forAllProcedureArguments(String template, Properties attributes) throws XDocletException
{
String argNameList = _curProcedureDef.getProperty(PropertyHelper.OJB_PROPERTY_ARGUMENTS);
for (CommaListIterator it = new CommaListIterator(argNameList); it.hasNext();)
{
_curProcedureArgumentDef = _curClassDef.getProcedureArgument(it.getNext());
generate(template);
}
_curProcedureArgumentDef = null;
} | Processes the template for all procedure arguments of the current procedure.
@param template The template
@param attributes The attributes of the tag
@exception XDocletException if an error occurs
@doc.tag type="block" |
Subsets and Splits