| <?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>BaseJobEntryTorquePeerImpl.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> > <a href="index.source.html" class="el_package">org.apache.turbine.services.schedule</a> > <span class="el_source">BaseJobEntryTorquePeerImpl.java</span></div><h1>BaseJobEntryTorquePeerImpl.java</h1><pre class="source lang-java linenums">package org.apache.turbine.services.schedule; |
| |
| import java.sql.Connection; |
| import java.util.ArrayList; |
| import java.util.Collection; |
| import java.util.List; |
| import java.util.Map; |
| import java.util.Objects; |
| import java.util.stream.Collectors; |
| |
| import org.apache.torque.NoRowsException; |
| import org.apache.torque.TooManyRowsException; |
| import org.apache.torque.TorqueException; |
| import org.apache.torque.criteria.Criteria; |
| import org.apache.torque.om.mapper.RecordMapper; |
| import org.apache.torque.om.ObjectKey; |
| import org.apache.torque.om.SimpleKey; |
| import org.apache.torque.map.TableMap; |
| import org.apache.torque.util.TorqueConnection; |
| import org.apache.torque.util.Transaction; |
| import org.apache.torque.util.ColumnValues; |
| import org.apache.torque.util.JdbcTypedValue; |
| |
| |
| |
| /** |
| * The skeleton for this class was autogenerated by Torque on: |
| * |
| * [Tue Jun 17 14:08:22 CEST 2025] |
| * |
| * You should not use this class directly. It should not even be |
| * extended; all references should be to JobEntryTorquePeer |
| */ |
| |
| @SuppressWarnings("unused") |
| public abstract class BaseJobEntryTorquePeerImpl |
| extends org.apache.torque.util.AbstractPeerImpl<JobEntryTorque> |
| { |
| /** Serial version */ |
| private static final long serialVersionUID = 1750162102041L; |
| |
| |
| |
| /** |
| * Constructor. |
| * The recordMapper, tableMap and databaseName fields are correctly |
| * initialized. |
| */ |
| public BaseJobEntryTorquePeerImpl() |
| { |
| <span class="nc" id="L51"> this(new JobEntryTorqueRecordMapper(),</span> |
| JobEntryTorquePeer.TABLE, |
| JobEntryTorquePeer.DATABASE_NAME); |
| <span class="nc" id="L54"> }</span> |
| |
| /** |
| * Constructor providing the objects to be injected as parameters. |
| * |
| * @param recordMapper a record mapper to map JDBC result sets to objects |
| * @param tableMap the default table map |
| * @param databaseName the name of the database |
| */ |
| public BaseJobEntryTorquePeerImpl( |
| RecordMapper<JobEntryTorque> recordMapper, |
| TableMap tableMap, |
| String databaseName) |
| { |
| <span class="nc" id="L68"> super(recordMapper, tableMap, databaseName);</span> |
| <span class="nc" id="L69"> }</span> |
| |
| |
| /** |
| * Returns a new instance of the Data object class |
| */ |
| public JobEntryTorque getDbObjectInstance() |
| { |
| <span class="nc" id="L77"> return new JobEntryTorque();</span> |
| } |
| |
| |
| /** |
| * Method to do updates. This method is to be used during a transaction, |
| * otherwise use the doUpdate(Criteria) method. |
| * |
| * @param columnValues the values to update plus the primary key |
| * identifying the row to update. |
| * @param con the connection to use, not null. |
| * |
| * @return the number of affected rows. |
| * |
| * @throws TorqueException Any exceptions caught during processing will be |
| * rethrown wrapped into a TorqueException. |
| */ |
| public int doUpdate(ColumnValues columnValues, Connection con) |
| throws TorqueException |
| { |
| <span class="nc" id="L97"> Criteria selectCriteria = new Criteria(getDatabaseName());</span> |
| <span class="nc" id="L98"> correctBooleans(columnValues);</span> |
| |
| { |
| <span class="nc" id="L101"> JdbcTypedValue pkValue</span> |
| <span class="nc" id="L102"> = columnValues.remove(JobEntryTorquePeer.JOB_ID);</span> |
| <span class="nc bnc" id="L103" title="All 2 branches missed."> if (pkValue == null)</span> |
| { |
| <span class="nc" id="L105"> throw new TorqueException(</span> |
| "The value for the primary key column " |
| + "JobEntryTorquePeer.JOB_ID" |
| + " must be set"); |
| } |
| <span class="nc bnc" id="L110" title="All 2 branches missed."> if (pkValue.getSqlExpression() == null)</span> |
| { |
| <span class="nc" id="L112"> selectCriteria.where(</span> |
| JobEntryTorquePeer.JOB_ID, |
| <span class="nc" id="L114"> pkValue.getValue());</span> |
| } |
| else |
| { |
| <span class="nc" id="L118"> selectCriteria.where(</span> |
| JobEntryTorquePeer.JOB_ID, |
| <span class="nc" id="L120"> pkValue.getSqlExpression());</span> |
| } |
| } |
| |
| |
| <span class="nc" id="L125"> int rowCount = doUpdate(selectCriteria, columnValues, con);</span> |
| <span class="nc" id="L126"> return rowCount;</span> |
| } |
| |
| /** |
| * Deletes a data object, i.e. a row in a table, in the database. |
| * |
| * @param obj the data object to delete in the database, not null. |
| * |
| * @return the number of deleted rows. |
| * |
| * @throws TorqueException Any exceptions caught during processing will be |
| * rethrown wrapped into a TorqueException. |
| */ |
| public int doDelete(JobEntryTorque obj) throws TorqueException |
| { |
| <span class="nc" id="L141"> int result = doDelete(buildCriteria(obj.getPrimaryKey()));</span> |
| <span class="nc" id="L142"> obj.setDeleted(true);</span> |
| <span class="nc" id="L143"> return result;</span> |
| } |
| |
| /** |
| * Deletes a data object, i.e. a row in a table, in the database. |
| * This method is to be used during a transaction, otherwise use the |
| * doDelete(JobEntryTorque) method. |
| * |
| * @param obj the data object to delete in the database, not null. |
| * @param con the connection to use, not null. |
| * |
| * @return the number of deleted rows. |
| * |
| * @throws TorqueException Any exceptions caught during processing will be |
| * rethrown wrapped into a TorqueException. |
| */ |
| public int doDelete(JobEntryTorque obj, Connection con) |
| throws TorqueException |
| { |
| <span class="nc" id="L162"> int result = doDelete(buildCriteria(obj.getPrimaryKey()), con);</span> |
| <span class="nc" id="L163"> obj.setDeleted(true);</span> |
| <span class="nc" id="L164"> return result;</span> |
| } |
| |
| /** |
| * Deletes data objects, i.e. rows in a table, in the database. |
| * |
| * @param objects the data object to delete in the database, not null, |
| * may not contain null. |
| * |
| * @return the number of deleted rows. |
| * |
| * @throws TorqueException Any exceptions caught during processing will be |
| * rethrown wrapped into a TorqueException. |
| */ |
| public int doDelete(Collection<JobEntryTorque> objects) |
| throws TorqueException |
| { |
| <span class="nc" id="L181"> int result = doDelete(buildPkCriteria(objects));</span> |
| <span class="nc" id="L182"> objects.forEach(object -> object.setDeleted(true));</span> |
| <span class="nc" id="L183"> return result;</span> |
| } |
| |
| /** |
| * Deletes data objects, i.e. rows in a table, in the database. |
| * This method uses the passed connection to delete the rows; |
| * if a transaction is open in the connection, the deletion happens inside |
| * this transaction. |
| * |
| * @param objects the data objects to delete in the database, not null, |
| * may not contain null. |
| * @param con the connection to use for deleting, not null. |
| * |
| * @return the number of deleted rows. |
| * |
| * @throws TorqueException Any exceptions caught during processing will be |
| * rethrown wrapped into a TorqueException. |
| */ |
| public int doDelete( |
| Collection<JobEntryTorque> objects, |
| Connection con) |
| throws TorqueException |
| { |
| <span class="nc" id="L206"> int result = doDelete(buildPkCriteria(objects), con);</span> |
| <span class="nc" id="L207"> objects.forEach(object -> object.setDeleted(true));</span> |
| <span class="nc" id="L208"> return result;</span> |
| } |
| |
| /** |
| * Build a Criteria object which selects all objects which have a given |
| * primary key. |
| * |
| * @param pk the primary key value to build the criteria from, not null. |
| */ |
| public Criteria buildCriteria(ObjectKey<?> pk) |
| { |
| <span class="nc" id="L219"> Criteria criteria = new Criteria();</span> |
| <span class="nc" id="L220"> criteria.and(JobEntryTorquePeer.JOB_ID, pk);</span> |
| <span class="nc" id="L221"> return criteria;</span> |
| } |
| |
| /** |
| * Build a Criteria object which selects all objects which primary keys |
| * are contained in the passed collection. |
| * |
| * @param pks the primary key values to build the criteria from, not null, |
| * may not contain null. |
| */ |
| public Criteria buildCriteria(Collection<ObjectKey<?>> pks) |
| { |
| <span class="nc" id="L233"> Criteria criteria = new Criteria();</span> |
| <span class="nc" id="L234"> criteria.andIn(JobEntryTorquePeer.JOB_ID, pks);</span> |
| <span class="nc" id="L235"> return criteria;</span> |
| } |
| |
| |
| /** |
| * Build a Criteria object which selects all passed objects using their |
| * primary key. Objects which do not yet have a primary key are ignored. |
| * |
| * @param objects the objects to build the criteria from, not null, |
| * may not contain null. |
| */ |
| public Criteria buildPkCriteria( |
| Collection<JobEntryTorque> objects) |
| { |
| <span class="nc" id="L249"> return buildCriteria(objects.stream()</span> |
| <span class="nc" id="L250"> .map(object -> object.getPrimaryKey())</span> |
| <span class="nc" id="L251"> .collect(Collectors.toList()));</span> |
| } |
| |
| /** |
| * Build a Criteria object from the data object for this peer. |
| * The primary key columns are only added if the object is not new. |
| * |
| * @param obj the object to build the criteria from, not null. |
| */ |
| public Criteria buildCriteria(JobEntryTorque obj) |
| { |
| <span class="nc" id="L262"> Criteria criteria = new Criteria(getDatabaseName());</span> |
| <span class="nc bnc" id="L263" title="All 2 branches missed."> if (!obj.isNew())</span> |
| { |
| <span class="nc" id="L265"> criteria.and(JobEntryTorquePeer.JOB_ID, obj.getJobId());</span> |
| } |
| <span class="nc" id="L267"> criteria.and(JobEntryTorquePeer.SECOND, obj.getSecond());</span> |
| <span class="nc" id="L268"> criteria.and(JobEntryTorquePeer.MINUTE, obj.getMinute());</span> |
| <span class="nc" id="L269"> criteria.and(JobEntryTorquePeer.HOUR, obj.getHour());</span> |
| <span class="nc" id="L270"> criteria.and(JobEntryTorquePeer.WEEK_DAY, obj.getWeekDay());</span> |
| <span class="nc" id="L271"> criteria.and(JobEntryTorquePeer.DAY_OF_MONTH, obj.getDayOfMonth());</span> |
| <span class="nc" id="L272"> criteria.and(JobEntryTorquePeer.TASK, obj.getTask());</span> |
| <span class="nc" id="L273"> criteria.and(JobEntryTorquePeer.EMAIL, obj.getEmail());</span> |
| <span class="nc" id="L274"> criteria.and(JobEntryTorquePeer.PROPERTY, obj.getProperty());</span> |
| <span class="nc" id="L275"> return criteria;</span> |
| } |
| |
| /** |
| * Build a Criteria object from the data object for this peer, |
| * skipping all binary columns. |
| * |
| * @param obj the object to build the criteria from, not null. |
| */ |
| public Criteria buildSelectCriteria(JobEntryTorque obj) |
| { |
| <span class="nc" id="L286"> Criteria criteria = new Criteria(getDatabaseName());</span> |
| <span class="nc bnc" id="L287" title="All 2 branches missed."> if (!obj.isNew())</span> |
| { |
| <span class="nc" id="L289"> criteria.and(JobEntryTorquePeer.JOB_ID, obj.getJobId());</span> |
| } |
| <span class="nc" id="L291"> criteria.and(JobEntryTorquePeer.SECOND, obj.getSecond());</span> |
| <span class="nc" id="L292"> criteria.and(JobEntryTorquePeer.MINUTE, obj.getMinute());</span> |
| <span class="nc" id="L293"> criteria.and(JobEntryTorquePeer.HOUR, obj.getHour());</span> |
| <span class="nc" id="L294"> criteria.and(JobEntryTorquePeer.WEEK_DAY, obj.getWeekDay());</span> |
| <span class="nc" id="L295"> criteria.and(JobEntryTorquePeer.DAY_OF_MONTH, obj.getDayOfMonth());</span> |
| <span class="nc" id="L296"> criteria.and(JobEntryTorquePeer.TASK, obj.getTask());</span> |
| <span class="nc" id="L297"> criteria.and(JobEntryTorquePeer.EMAIL, obj.getEmail());</span> |
| <span class="nc" id="L298"> return criteria;</span> |
| } |
| |
| /** |
| * Returns the contents of the object as ColumnValues object. |
| * Primary key columns which are generated on insertion are not |
| * added to the returned object if they still have their initial |
| * value. Also, columns which have the useDatabaseDefaultValue |
| * flag set to true are also not added to the returned object |
| * if they still have their initial value. |
| * |
| * @throws TorqueException if the table map cannot be retrieved |
| * (should not happen). |
| */ |
| public ColumnValues buildColumnValues(JobEntryTorque jobEntryTorque) |
| throws TorqueException |
| { |
| <span class="nc" id="L315"> ColumnValues columnValues = new ColumnValues();</span> |
| <span class="nc bnc" id="L316" title="All 2 branches missed."> if (!jobEntryTorque.isNew() </span> |
| <span class="nc bnc" id="L317" title="All 2 branches missed."> || jobEntryTorque.getJobId() != 0)</span> |
| { |
| <span class="nc" id="L319"> columnValues.put(</span> |
| JobEntryTorquePeer.JOB_ID, |
| new JdbcTypedValue( |
| <span class="nc" id="L322"> jobEntryTorque.getJobId(),</span> |
| 4)); |
| } |
| <span class="nc" id="L325"> columnValues.put(</span> |
| JobEntryTorquePeer.SECOND, |
| new JdbcTypedValue( |
| <span class="nc" id="L328"> jobEntryTorque.getSecond(),</span> |
| 4)); |
| <span class="nc" id="L330"> columnValues.put(</span> |
| JobEntryTorquePeer.MINUTE, |
| new JdbcTypedValue( |
| <span class="nc" id="L333"> jobEntryTorque.getMinute(),</span> |
| 4)); |
| <span class="nc" id="L335"> columnValues.put(</span> |
| JobEntryTorquePeer.HOUR, |
| new JdbcTypedValue( |
| <span class="nc" id="L338"> jobEntryTorque.getHour(),</span> |
| 4)); |
| <span class="nc" id="L340"> columnValues.put(</span> |
| JobEntryTorquePeer.WEEK_DAY, |
| new JdbcTypedValue( |
| <span class="nc" id="L343"> jobEntryTorque.getWeekDay(),</span> |
| 4)); |
| <span class="nc" id="L345"> columnValues.put(</span> |
| JobEntryTorquePeer.DAY_OF_MONTH, |
| new JdbcTypedValue( |
| <span class="nc" id="L348"> jobEntryTorque.getDayOfMonth(),</span> |
| 4)); |
| <span class="nc" id="L350"> columnValues.put(</span> |
| JobEntryTorquePeer.TASK, |
| new JdbcTypedValue( |
| <span class="nc" id="L353"> jobEntryTorque.getTask(),</span> |
| 12)); |
| <span class="nc" id="L355"> columnValues.put(</span> |
| JobEntryTorquePeer.EMAIL, |
| new JdbcTypedValue( |
| <span class="nc" id="L358"> jobEntryTorque.getEmail(),</span> |
| 12)); |
| <span class="nc" id="L360"> columnValues.put(</span> |
| JobEntryTorquePeer.PROPERTY, |
| new JdbcTypedValue( |
| <span class="nc" id="L363"> jobEntryTorque.getProperty(),</span> |
| -3)); |
| <span class="nc" id="L365"> return columnValues;</span> |
| } |
| |
| /** |
| * Retrieve a single object by pk |
| * |
| * @param pk the primary key |
| * @throws TorqueException Any exceptions caught during processing will be |
| * rethrown wrapped into a TorqueException. |
| * @throws NoRowsException Primary key was not found in database. |
| * @throws TooManyRowsException Primary key was not found in database. |
| */ |
| public JobEntryTorque retrieveByPK(int pk) |
| throws TorqueException, NoRowsException, TooManyRowsException |
| { |
| <span class="nc" id="L380"> return retrieveByPK(SimpleKey.keyFor(pk));</span> |
| } |
| |
| /** |
| * Retrieve a single object by pk |
| * |
| * @param pk the primary key |
| * @param con the connection to use |
| * @throws TorqueException Any exceptions caught during processing will be |
| * rethrown wrapped into a TorqueException. |
| * @throws NoRowsException Primary key was not found in database. |
| * @throws TooManyRowsException Primary key was not found in database. |
| */ |
| public JobEntryTorque retrieveByPK(int pk, Connection con) |
| throws TorqueException, NoRowsException, TooManyRowsException |
| { |
| <span class="nc" id="L396"> return retrieveByPK(SimpleKey.keyFor(pk), con);</span> |
| } |
| |
| |
| |
| |
| /** |
| * Retrieve a single object by pk |
| * |
| * @param pk the primary key |
| * @throws TorqueException Any exceptions caught during processing will be |
| * rethrown wrapped into a TorqueException. |
| * @throws NoRowsException Primary key was not found in database. |
| * @throws TooManyRowsException Primary key was not found in database. |
| */ |
| public JobEntryTorque retrieveByPK(ObjectKey<?> pk) |
| throws TorqueException, NoRowsException, TooManyRowsException |
| { |
| <span class="nc" id="L414"> try (TorqueConnection connection = Transaction.begin(getDatabaseName()))</span> |
| { |
| <span class="nc" id="L416"> JobEntryTorque result = retrieveByPK(pk, connection);</span> |
| <span class="nc" id="L417"> Transaction.commit(connection);</span> |
| <span class="nc" id="L418"> return result;</span> |
| } |
| } |
| |
| /** |
| * Retrieve a single object by pk |
| * |
| * @param pk the primary key |
| * @param con the connection to use |
| * @throws TorqueException Any exceptions caught during processing will be |
| * rethrown wrapped into a TorqueException. |
| * @throws NoRowsException Primary key was not found in database. |
| * @throws TooManyRowsException Primary key was not found in database. |
| */ |
| public JobEntryTorque retrieveByPK(ObjectKey<?> pk, Connection con) |
| throws TorqueException, NoRowsException, TooManyRowsException |
| { |
| <span class="nc" id="L435"> Criteria criteria = buildCriteria(pk);</span> |
| <span class="nc" id="L436"> JobEntryTorque v = doSelectSingleRecord(criteria, con);</span> |
| <span class="nc bnc" id="L437" title="All 2 branches missed."> if (v == null)</span> |
| { |
| <span class="nc" id="L439"> throw new NoRowsException("Failed to select a row.");</span> |
| } |
| |
| <span class="nc" id="L442"> return v;</span> |
| } |
| |
| |
| /** |
| * Retrieve multiple objects by pk. |
| * |
| * @param pks List of primary keys. |
| * Entries in pks which do not match entries in the database are ignored. |
| * |
| * @return the list of matching objects, not null. |
| * |
| * @throws TorqueException Any exceptions caught during processing will be |
| * rethrown wrapped into a TorqueException. |
| */ |
| public List<JobEntryTorque> retrieveByTypedPKs(Collection<Integer> pks) |
| throws TorqueException |
| { |
| <span class="nc" id="L460"> try (TorqueConnection connection = Transaction.begin(getDatabaseName()))</span> |
| { |
| <span class="nc" id="L462"> List<JobEntryTorque> result = retrieveByTypedPKs(pks, connection);</span> |
| <span class="nc" id="L463"> Transaction.commit(connection);</span> |
| <span class="nc" id="L464"> return result;</span> |
| } |
| } |
| |
| /** |
| * Retrieve multiple objects by pk. |
| * |
| * @param pks List of primary keys. |
| * Entries in pks which do not match entries in the database are ignored. |
| * @param dbcon the connection to use |
| * |
| * @return the list of matching objects, not null. |
| * |
| * @throws TorqueException Any exceptions caught during processing will be |
| * rethrown wrapped into a TorqueException. |
| */ |
| public List<JobEntryTorque> retrieveByTypedPKs( |
| Collection<Integer> pks, |
| Connection dbcon) |
| throws TorqueException |
| { |
| <span class="nc bnc" id="L485" title="All 4 branches missed."> if (pks == null || pks.size() == 0)</span> |
| { |
| <span class="nc" id="L487"> return new ArrayList<JobEntryTorque>();</span> |
| } |
| <span class="nc" id="L489"> List<ObjectKey<?>> objectKeyList = new ArrayList<ObjectKey<?>>();</span> |
| <span class="nc bnc" id="L490" title="All 2 branches missed."> for (Integer pk : pks)</span> |
| { |
| <span class="nc" id="L492"> objectKeyList.add(SimpleKey.keyFor(pk));</span> |
| <span class="nc" id="L493"> }</span> |
| <span class="nc" id="L494"> Criteria criteria = buildCriteria(objectKeyList);</span> |
| <span class="nc" id="L495"> List<JobEntryTorque> result = doSelect(criteria, dbcon);</span> |
| <span class="nc" id="L496"> return result;</span> |
| } |
| |
| /** |
| * Retrieve multiple objects by pk. |
| * |
| * @param pks List of primary keys. |
| * Entries in pks which do not match entries in the database are ignored. |
| * |
| * @return the list of matching objects, not null. |
| * |
| * @throws TorqueException Any exceptions caught during processing will be |
| * rethrown wrapped into a TorqueException. |
| */ |
| public List<JobEntryTorque> retrieveByObjectKeys(Collection<ObjectKey<?>> pks) |
| throws TorqueException |
| { |
| <span class="nc" id="L513"> try (TorqueConnection connection = Transaction.begin(getDatabaseName()))</span> |
| { |
| <span class="nc" id="L515"> List<JobEntryTorque> result = retrieveByObjectKeys(pks, connection);</span> |
| <span class="nc" id="L516"> Transaction.commit(connection);</span> |
| <span class="nc" id="L517"> return result;</span> |
| } |
| } |
| |
| /** |
| * Retrieve multiple objects by pk. |
| * |
| * @param pks List of primary keys. |
| * Entries in pks which do not match entries in the database are ignored. |
| * @param dbcon the connection to use |
| * |
| * @return the list of matching objects, not null. |
| * |
| * @throws TorqueException Any exceptions caught during processing will be |
| * rethrown wrapped into a TorqueException. |
| */ |
| public List<JobEntryTorque> retrieveByObjectKeys( |
| Collection<ObjectKey<?>> pks, |
| Connection dbcon) |
| throws TorqueException |
| { |
| <span class="nc bnc" id="L538" title="All 4 branches missed."> if (pks == null || pks.size() == 0)</span> |
| { |
| <span class="nc" id="L540"> return new ArrayList<JobEntryTorque>();</span> |
| } |
| <span class="nc" id="L542"> Criteria criteria = buildCriteria(pks);</span> |
| <span class="nc" id="L543"> List<JobEntryTorque> result = doSelect(criteria, dbcon);</span> |
| <span class="nc" id="L544"> return result;</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> |