blob: b8c9e6355fc9a505492105ffc52d406cff3a09e8 [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="de"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../jacoco-resources/report.css" type="text/css"/><link rel="shortcut icon" href="../jacoco-resources/report.gif" type="image/gif"/><title>BaseJobEntryTorqueRecordMapper.java</title><link rel="stylesheet" href="../jacoco-resources/prettify.css" type="text/css"/><script type="text/javascript" src="../jacoco-resources/prettify.js"></script></head><body onload="window['PR_TAB_WIDTH']=4;prettyPrint()"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../jacoco-sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">Apache Turbine</a> &gt; <a href="index.source.html" class="el_package">org.apache.turbine.services.schedule</a> &gt; <span class="el_source">BaseJobEntryTorqueRecordMapper.java</span></div><h1>BaseJobEntryTorqueRecordMapper.java</h1><pre class="source lang-java linenums">package org.apache.turbine.services.schedule;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.torque.Column;
import org.apache.torque.TorqueException;
import org.apache.torque.criteria.Criteria;
import org.apache.torque.om.mapper.RecordMapper;
import org.apache.torque.om.mapper.MappingStrategy;
/**
* Maps ResultSet rows into JobEntryTorque objects.
*
* The skeleton for this class was autogenerated by Torque on:
*
* [Tue Jun 17 14:08:22 CEST 2025]
*
*/
@SuppressWarnings(&quot;unused&quot;)
<span class="nc" id="L27">public class BaseJobEntryTorqueRecordMapper implements RecordMapper&lt;JobEntryTorque&gt;</span>
{
/** Serial version */
private static final long serialVersionUID = 1750162102601L;
/** The class log. */
<span class="nc" id="L33"> private static Log log</span>
<span class="nc" id="L34"> = LogFactory.getLog(BaseJobEntryTorqueRecordMapper.class);</span>
<span class="nc" id="L36"> private static final String JOB_ID_EXPRESSION = BaseJobEntryTorquePeer.JOB_ID.getSqlExpression();</span>
<span class="nc" id="L37"> private static final String SECOND_EXPRESSION = BaseJobEntryTorquePeer.SECOND.getSqlExpression();</span>
<span class="nc" id="L38"> private static final String MINUTE_EXPRESSION = BaseJobEntryTorquePeer.MINUTE.getSqlExpression();</span>
<span class="nc" id="L39"> private static final String HOUR_EXPRESSION = BaseJobEntryTorquePeer.HOUR.getSqlExpression();</span>
<span class="nc" id="L40"> private static final String WEEK_DAY_EXPRESSION = BaseJobEntryTorquePeer.WEEK_DAY.getSqlExpression();</span>
<span class="nc" id="L41"> private static final String DAY_OF_MONTH_EXPRESSION = BaseJobEntryTorquePeer.DAY_OF_MONTH.getSqlExpression();</span>
<span class="nc" id="L42"> private static final String TASK_EXPRESSION = BaseJobEntryTorquePeer.TASK.getSqlExpression();</span>
<span class="nc" id="L43"> private static final String EMAIL_EXPRESSION = BaseJobEntryTorquePeer.EMAIL.getSqlExpression();</span>
<span class="nc" id="L44"> private static final String PROPERTY_EXPRESSION = BaseJobEntryTorquePeer.PROPERTY.getSqlExpression();</span>
<span class="nc" id="L46"> private boolean useMappingStrategy = true;</span>
private MappingStrategy&lt;JobEntryTorque&gt; strategy;
public void initStrategy()
{
<span class="nc" id="L52"> this.strategy = new MappingStrategy&lt;JobEntryTorque&gt;();</span>
<span class="nc" id="L53"> }</span>
/**
* Constructs the object from the current row in the resultSet.
*
* @param resultSet the resultSet to operate on, already pointing
* to the correct row. Not null.
* @param offset a possible offset in the columns to be considered
* (if previous columns contain other objects),
* or 0 for no offset.
* @param criteria The criteria which created the result set.
* If set, the attributes to set in the data object
* are determined from the select columns in the criteria;
* if no matching column can be found, null is returned.
* If not set, all of the table's columns are read from the
* result set in the order defined in the table definition.
*
* @return the mapped object, not null.
*
* @throws TorqueException when reading fields from the RecordSet fails
* or if a Criteria is passed which contains select columns other
* than the columns in the TURBINE_SCHEDULED_JOB table.
*/
public JobEntryTorque processRow(
ResultSet resultSet,
int offset,
Criteria criteria)
throws TorqueException
{
<span class="nc" id="L83"> JobEntryTorque jobEntryTorque = new JobEntryTorque();</span>
try
{
<span class="nc" id="L87"> jobEntryTorque.setLoading(true);</span>
<span class="nc bnc" id="L88" title="All 2 branches missed."> if (criteria == null)</span>
{
<span class="nc" id="L90"> jobEntryTorque.setJobId(</span>
<span class="nc" id="L91"> getJobId(resultSet, offset + 1));</span>
<span class="nc" id="L92"> jobEntryTorque.setSecond(</span>
<span class="nc" id="L93"> getSecond(resultSet, offset + 2));</span>
<span class="nc" id="L94"> jobEntryTorque.setMinute(</span>
<span class="nc" id="L95"> getMinute(resultSet, offset + 3));</span>
<span class="nc" id="L96"> jobEntryTorque.setHour(</span>
<span class="nc" id="L97"> getHour(resultSet, offset + 4));</span>
<span class="nc" id="L98"> jobEntryTorque.setWeekDay(</span>
<span class="nc" id="L99"> getWeekDay(resultSet, offset + 5));</span>
<span class="nc" id="L100"> jobEntryTorque.setDayOfMonth(</span>
<span class="nc" id="L101"> getDayOfMonth(resultSet, offset + 6));</span>
<span class="nc" id="L102"> jobEntryTorque.setTask(</span>
<span class="nc" id="L103"> getTask(resultSet, offset + 7));</span>
<span class="nc" id="L104"> jobEntryTorque.setEmail(</span>
<span class="nc" id="L105"> getEmail(resultSet, offset + 8));</span>
<span class="nc" id="L106"> jobEntryTorque.setProperty(</span>
<span class="nc" id="L107"> getProperty(resultSet, offset + 9));</span>
}
else
{
<span class="nc bnc" id="L111" title="All 2 branches missed."> if (useMappingStrategy) {</span>
<span class="nc" id="L112"> initStrategy();</span>
}
// try to get columns to be mapped
// from criteria's select columns
<span class="nc" id="L116"> int totalOffset = offset + 1;</span>
<span class="nc" id="L117"> List&lt;Column&gt; selectColumns = criteria.getSelectColumns();</span>
<span class="nc" id="L118"> List&lt;Column&gt; columnsWithoutOffset = selectColumns.subList(</span>
offset,
<span class="nc" id="L120"> selectColumns.size());</span>
<span class="nc" id="L121"> Set&lt;String&gt; columnsMapped = new HashSet&lt;String&gt;();</span>
<span class="nc bnc" id="L122" title="All 2 branches missed."> for (Column column : columnsWithoutOffset)</span>
{
<span class="nc bnc" id="L124" title="All 4 branches missed."> final int nextOffset = totalOffset; if (!columnsMapped.contains(JOB_ID_EXPRESSION ) &amp;&amp; JOB_ID_EXPRESSION.equals(</span>
<span class="nc" id="L125"> column.getSqlExpression()))</span>
{
<span class="nc bnc" id="L127" title="All 2 branches missed."> if (useMappingStrategy) </span>
{
<span class="nc" id="L129"> strategy.addColumn(nextOffset, </span>
<span class="nc" id="L130"> (res, inst) -&gt; inst.setJobId( getJobId(res, nextOffset)));</span>
} else
{
<span class="nc" id="L133"> jobEntryTorque.setJobId( getJobId(resultSet, totalOffset));</span>
}
<span class="nc" id="L135"> columnsMapped.add( JOB_ID_EXPRESSION );</span>
}
<span class="nc bnc" id="L137" title="All 4 branches missed."> else if (!columnsMapped.contains(SECOND_EXPRESSION ) &amp;&amp; SECOND_EXPRESSION.equals(</span>
<span class="nc" id="L138"> column.getSqlExpression()))</span>
{
<span class="nc bnc" id="L140" title="All 2 branches missed."> if (useMappingStrategy) </span>
{
<span class="nc" id="L142"> strategy.addColumn(nextOffset, </span>
<span class="nc" id="L143"> (res, inst) -&gt; inst.setSecond( getSecond(res, nextOffset)));</span>
} else
{
<span class="nc" id="L146"> jobEntryTorque.setSecond( getSecond(resultSet, totalOffset));</span>
}
<span class="nc" id="L148"> columnsMapped.add( SECOND_EXPRESSION );</span>
}
<span class="nc bnc" id="L150" title="All 4 branches missed."> else if (!columnsMapped.contains(MINUTE_EXPRESSION ) &amp;&amp; MINUTE_EXPRESSION.equals(</span>
<span class="nc" id="L151"> column.getSqlExpression()))</span>
{
<span class="nc bnc" id="L153" title="All 2 branches missed."> if (useMappingStrategy) </span>
{
<span class="nc" id="L155"> strategy.addColumn(nextOffset, </span>
<span class="nc" id="L156"> (res, inst) -&gt; inst.setMinute( getMinute(res, nextOffset)));</span>
} else
{
<span class="nc" id="L159"> jobEntryTorque.setMinute( getMinute(resultSet, totalOffset));</span>
}
<span class="nc" id="L161"> columnsMapped.add( MINUTE_EXPRESSION );</span>
}
<span class="nc bnc" id="L163" title="All 4 branches missed."> else if (!columnsMapped.contains(HOUR_EXPRESSION ) &amp;&amp; HOUR_EXPRESSION.equals(</span>
<span class="nc" id="L164"> column.getSqlExpression()))</span>
{
<span class="nc bnc" id="L166" title="All 2 branches missed."> if (useMappingStrategy) </span>
{
<span class="nc" id="L168"> strategy.addColumn(nextOffset, </span>
<span class="nc" id="L169"> (res, inst) -&gt; inst.setHour( getHour(res, nextOffset)));</span>
} else
{
<span class="nc" id="L172"> jobEntryTorque.setHour( getHour(resultSet, totalOffset));</span>
}
<span class="nc" id="L174"> columnsMapped.add( HOUR_EXPRESSION );</span>
}
<span class="nc bnc" id="L176" title="All 4 branches missed."> else if (!columnsMapped.contains(WEEK_DAY_EXPRESSION ) &amp;&amp; WEEK_DAY_EXPRESSION.equals(</span>
<span class="nc" id="L177"> column.getSqlExpression()))</span>
{
<span class="nc bnc" id="L179" title="All 2 branches missed."> if (useMappingStrategy) </span>
{
<span class="nc" id="L181"> strategy.addColumn(nextOffset, </span>
<span class="nc" id="L182"> (res, inst) -&gt; inst.setWeekDay( getWeekDay(res, nextOffset)));</span>
} else
{
<span class="nc" id="L185"> jobEntryTorque.setWeekDay( getWeekDay(resultSet, totalOffset));</span>
}
<span class="nc" id="L187"> columnsMapped.add( WEEK_DAY_EXPRESSION );</span>
}
<span class="nc bnc" id="L189" title="All 4 branches missed."> else if (!columnsMapped.contains(DAY_OF_MONTH_EXPRESSION ) &amp;&amp; DAY_OF_MONTH_EXPRESSION.equals(</span>
<span class="nc" id="L190"> column.getSqlExpression()))</span>
{
<span class="nc bnc" id="L192" title="All 2 branches missed."> if (useMappingStrategy) </span>
{
<span class="nc" id="L194"> strategy.addColumn(nextOffset, </span>
<span class="nc" id="L195"> (res, inst) -&gt; inst.setDayOfMonth( getDayOfMonth(res, nextOffset)));</span>
} else
{
<span class="nc" id="L198"> jobEntryTorque.setDayOfMonth( getDayOfMonth(resultSet, totalOffset));</span>
}
<span class="nc" id="L200"> columnsMapped.add( DAY_OF_MONTH_EXPRESSION );</span>
}
<span class="nc bnc" id="L202" title="All 4 branches missed."> else if (!columnsMapped.contains(TASK_EXPRESSION ) &amp;&amp; TASK_EXPRESSION.equals(</span>
<span class="nc" id="L203"> column.getSqlExpression()))</span>
{
<span class="nc bnc" id="L205" title="All 2 branches missed."> if (useMappingStrategy) </span>
{
<span class="nc" id="L207"> strategy.addColumn(nextOffset, </span>
<span class="nc" id="L208"> (res, inst) -&gt; inst.setTask( getTask(res, nextOffset)));</span>
} else
{
<span class="nc" id="L211"> jobEntryTorque.setTask( getTask(resultSet, totalOffset));</span>
}
<span class="nc" id="L213"> columnsMapped.add( TASK_EXPRESSION );</span>
}
<span class="nc bnc" id="L215" title="All 4 branches missed."> else if (!columnsMapped.contains(EMAIL_EXPRESSION ) &amp;&amp; EMAIL_EXPRESSION.equals(</span>
<span class="nc" id="L216"> column.getSqlExpression()))</span>
{
<span class="nc bnc" id="L218" title="All 2 branches missed."> if (useMappingStrategy) </span>
{
<span class="nc" id="L220"> strategy.addColumn(nextOffset, </span>
<span class="nc" id="L221"> (res, inst) -&gt; inst.setEmail( getEmail(res, nextOffset)));</span>
} else
{
<span class="nc" id="L224"> jobEntryTorque.setEmail( getEmail(resultSet, totalOffset));</span>
}
<span class="nc" id="L226"> columnsMapped.add( EMAIL_EXPRESSION );</span>
}
<span class="nc bnc" id="L228" title="All 4 branches missed."> else if (!columnsMapped.contains(PROPERTY_EXPRESSION ) &amp;&amp; PROPERTY_EXPRESSION.equals(</span>
<span class="nc" id="L229"> column.getSqlExpression()))</span>
{
<span class="nc bnc" id="L231" title="All 2 branches missed."> if (useMappingStrategy) </span>
{
<span class="nc" id="L233"> strategy.addColumn(nextOffset, </span>
<span class="nc" id="L234"> (res, inst) -&gt; inst.setProperty( getProperty(res, nextOffset)));</span>
} else
{
<span class="nc" id="L237"> jobEntryTorque.setProperty( getProperty(resultSet, totalOffset));</span>
}
<span class="nc" id="L239"> columnsMapped.add( PROPERTY_EXPRESSION );</span>
}
<span class="nc" id="L241"> totalOffset++;</span>
<span class="nc" id="L242"> }</span>
<span class="nc bnc" id="L243" title="All 2 branches missed."> if (columnsMapped.isEmpty())</span>
{
<span class="nc" id="L245"> log.debug(&quot;no columns to map found in criteria, &quot;</span>
+ &quot;returning null&quot;);
<span class="nc" id="L247"> return null;</span>
}
<span class="nc bnc" id="L249" title="All 2 branches missed."> if (useMappingStrategy)</span>
{
<span class="nc" id="L251"> this.strategy.finish(9, true);</span>
<span class="nc" id="L252"> this.strategy.execute(resultSet, jobEntryTorque);</span>
}
}
<span class="nc" id="L255"> jobEntryTorque.setNew(false);</span>
<span class="nc" id="L256"> jobEntryTorque.setModified(false);</span>
}
finally
{
<span class="nc" id="L260"> jobEntryTorque.setLoading(false);</span>
}
<span class="nc" id="L262"> return jobEntryTorque;</span>
}
/**
* Reads the value of the &lt;code&gt;columnIndex&lt;/code&gt;'th column
* in the &lt;code&gt;resultSet&lt;/code&gt; so that it can be used to set
* the field jobId in JobEntryTorque.
*
* @param resultSet the ResultSet to read from, not null.
* @param columnIndex the index in the resultSet which should be read.
*
* @return the content of the column.
*
* @throws SQLException if a problem occurs when reading
* from the resultSet.
*/
protected int getJobId(
ResultSet resultSet,
int columnIndex)
throws TorqueException
{
try
{
<span class="nc" id="L285"> return resultSet.getInt(columnIndex);</span>
}
<span class="nc" id="L287"> catch (SQLException e)</span>
{
<span class="nc" id="L289"> throw new TorqueException(e);</span>
}
}
/**
* Reads the value of the &lt;code&gt;columnIndex&lt;/code&gt;'th column
* in the &lt;code&gt;resultSet&lt;/code&gt; so that it can be used to set
* the field second in JobEntryTorque.
*
* @param resultSet the ResultSet to read from, not null.
* @param columnIndex the index in the resultSet which should be read.
*
* @return the content of the column.
*
* @throws SQLException if a problem occurs when reading
* from the resultSet.
*/
protected int getSecond(
ResultSet resultSet,
int columnIndex)
throws TorqueException
{
try
{
<span class="nc" id="L312"> return resultSet.getInt(columnIndex);</span>
}
<span class="nc" id="L314"> catch (SQLException e)</span>
{
<span class="nc" id="L316"> throw new TorqueException(e);</span>
}
}
/**
* Reads the value of the &lt;code&gt;columnIndex&lt;/code&gt;'th column
* in the &lt;code&gt;resultSet&lt;/code&gt; so that it can be used to set
* the field minute in JobEntryTorque.
*
* @param resultSet the ResultSet to read from, not null.
* @param columnIndex the index in the resultSet which should be read.
*
* @return the content of the column.
*
* @throws SQLException if a problem occurs when reading
* from the resultSet.
*/
protected int getMinute(
ResultSet resultSet,
int columnIndex)
throws TorqueException
{
try
{
<span class="nc" id="L339"> return resultSet.getInt(columnIndex);</span>
}
<span class="nc" id="L341"> catch (SQLException e)</span>
{
<span class="nc" id="L343"> throw new TorqueException(e);</span>
}
}
/**
* Reads the value of the &lt;code&gt;columnIndex&lt;/code&gt;'th column
* in the &lt;code&gt;resultSet&lt;/code&gt; so that it can be used to set
* the field hour in JobEntryTorque.
*
* @param resultSet the ResultSet to read from, not null.
* @param columnIndex the index in the resultSet which should be read.
*
* @return the content of the column.
*
* @throws SQLException if a problem occurs when reading
* from the resultSet.
*/
protected int getHour(
ResultSet resultSet,
int columnIndex)
throws TorqueException
{
try
{
<span class="nc" id="L366"> return resultSet.getInt(columnIndex);</span>
}
<span class="nc" id="L368"> catch (SQLException e)</span>
{
<span class="nc" id="L370"> throw new TorqueException(e);</span>
}
}
/**
* Reads the value of the &lt;code&gt;columnIndex&lt;/code&gt;'th column
* in the &lt;code&gt;resultSet&lt;/code&gt; so that it can be used to set
* the field weekDay in JobEntryTorque.
*
* @param resultSet the ResultSet to read from, not null.
* @param columnIndex the index in the resultSet which should be read.
*
* @return the content of the column.
*
* @throws SQLException if a problem occurs when reading
* from the resultSet.
*/
protected int getWeekDay(
ResultSet resultSet,
int columnIndex)
throws TorqueException
{
try
{
<span class="nc" id="L393"> return resultSet.getInt(columnIndex);</span>
}
<span class="nc" id="L395"> catch (SQLException e)</span>
{
<span class="nc" id="L397"> throw new TorqueException(e);</span>
}
}
/**
* Reads the value of the &lt;code&gt;columnIndex&lt;/code&gt;'th column
* in the &lt;code&gt;resultSet&lt;/code&gt; so that it can be used to set
* the field dayOfMonth in JobEntryTorque.
*
* @param resultSet the ResultSet to read from, not null.
* @param columnIndex the index in the resultSet which should be read.
*
* @return the content of the column.
*
* @throws SQLException if a problem occurs when reading
* from the resultSet.
*/
protected int getDayOfMonth(
ResultSet resultSet,
int columnIndex)
throws TorqueException
{
try
{
<span class="nc" id="L420"> return resultSet.getInt(columnIndex);</span>
}
<span class="nc" id="L422"> catch (SQLException e)</span>
{
<span class="nc" id="L424"> throw new TorqueException(e);</span>
}
}
/**
* Reads the value of the &lt;code&gt;columnIndex&lt;/code&gt;'th column
* in the &lt;code&gt;resultSet&lt;/code&gt; so that it can be used to set
* the field task in JobEntryTorque.
*
* @param resultSet the ResultSet to read from, not null.
* @param columnIndex the index in the resultSet which should be read.
*
* @return the content of the column.
*
* @throws SQLException if a problem occurs when reading
* from the resultSet.
*/
protected String getTask(
ResultSet resultSet,
int columnIndex)
throws TorqueException
{
try
{
<span class="nc" id="L447"> return resultSet.getString(columnIndex);</span>
}
<span class="nc" id="L449"> catch (SQLException e)</span>
{
<span class="nc" id="L451"> throw new TorqueException(e);</span>
}
}
/**
* Reads the value of the &lt;code&gt;columnIndex&lt;/code&gt;'th column
* in the &lt;code&gt;resultSet&lt;/code&gt; so that it can be used to set
* the field email in JobEntryTorque.
*
* @param resultSet the ResultSet to read from, not null.
* @param columnIndex the index in the resultSet which should be read.
*
* @return the content of the column.
*
* @throws SQLException if a problem occurs when reading
* from the resultSet.
*/
protected String getEmail(
ResultSet resultSet,
int columnIndex)
throws TorqueException
{
try
{
<span class="nc" id="L474"> return resultSet.getString(columnIndex);</span>
}
<span class="nc" id="L476"> catch (SQLException e)</span>
{
<span class="nc" id="L478"> throw new TorqueException(e);</span>
}
}
/**
* Reads the value of the &lt;code&gt;columnIndex&lt;/code&gt;'th column
* in the &lt;code&gt;resultSet&lt;/code&gt; so that it can be used to set
* the field property in JobEntryTorque.
*
* @param resultSet the ResultSet to read from, not null.
* @param columnIndex the index in the resultSet which should be read.
*
* @return the content of the column.
*
* @throws SQLException if a problem occurs when reading
* from the resultSet.
*/
protected byte[] getProperty(
ResultSet resultSet,
int columnIndex)
throws TorqueException
{
try
{
<span class="nc" id="L501"> byte[] value = resultSet.getBytes(columnIndex);</span>
<span class="nc bnc" id="L502" title="All 2 branches missed."> if (resultSet.wasNull())</span>
{
<span class="nc" id="L504"> value = null;</span>
}
<span class="nc" id="L506"> return value;</span>
}
<span class="nc" id="L508"> catch (SQLException e)</span>
{
<span class="nc" id="L510"> throw new TorqueException(e);</span>
}
}
}
</pre><div class="footer"><span class="right">Created with <a href="http://www.jacoco.org/jacoco">JaCoCo</a> 0.8.12.202403310830</span></div></body></html>