Search in sources :

Example 16 with DBResultRow

use of com.helger.db.jdbc.executor.DBResultRow in project phoss-smp by phax.

the class SMPParticipantMigrationManagerJDBC method getParticipantMigrationOfParticipantID.

@Nullable
public ISMPParticipantMigration getParticipantMigrationOfParticipantID(@Nonnull final EParticipantMigrationDirection eDirection, @Nonnull final EParticipantMigrationState eState, @Nullable final IParticipantIdentifier aParticipantID) {
    ValueEnforcer.notNull(eDirection, "Direction");
    ValueEnforcer.notNull(eState, "State");
    if (aParticipantID == null)
        return null;
    final Wrapper<DBResultRow> aDBResult = new Wrapper<>();
    newExecutor().querySingle("SELECT id, initdt, migkey FROM smp_pmigration WHERE direction=? AND state=? AND pid=?", new ConstantPreparedStatementDataProvider(eDirection.getID(), eState.getID(), aParticipantID.getURIEncoded()), aDBResult::set);
    if (aDBResult.isNotSet())
        return null;
    final DBResultRow aRow = aDBResult.get();
    return new SMPParticipantMigration(aRow.getAsString(0), eDirection, eState, aParticipantID, aRow.getAsLocalDateTime(1), aRow.getAsString(2));
}
Also used : Wrapper(com.helger.commons.wrapper.Wrapper) DBResultRow(com.helger.db.jdbc.executor.DBResultRow) SMPParticipantMigration(com.helger.phoss.smp.domain.pmigration.SMPParticipantMigration) ISMPParticipantMigration(com.helger.phoss.smp.domain.pmigration.ISMPParticipantMigration) ConstantPreparedStatementDataProvider(com.helger.db.jdbc.callback.ConstantPreparedStatementDataProvider) Nullable(javax.annotation.Nullable)

Example 17 with DBResultRow

use of com.helger.db.jdbc.executor.DBResultRow in project phoss-smp by phax.

the class SMPSettingsManagerJDBC method getSettingsValue.

@Nullable
public static String getSettingsValue(@Nonnull final DBExecutor aExecutor, @Nullable final String sKey) {
    if (StringHelper.hasNoText(sKey))
        return null;
    final Wrapper<DBResultRow> aDBResult = new Wrapper<>();
    aExecutor.querySingle("SELECT value FROM smp_settings WHERE id=?", new ConstantPreparedStatementDataProvider(sKey), aDBResult::set);
    if (aDBResult.isNotSet())
        return null;
    return aDBResult.get().getAsString(0);
}
Also used : Wrapper(com.helger.commons.wrapper.Wrapper) DBResultRow(com.helger.db.jdbc.executor.DBResultRow) ConstantPreparedStatementDataProvider(com.helger.db.jdbc.callback.ConstantPreparedStatementDataProvider) Nullable(javax.annotation.Nullable)

Aggregations

DBResultRow (com.helger.db.jdbc.executor.DBResultRow)17 ConstantPreparedStatementDataProvider (com.helger.db.jdbc.callback.ConstantPreparedStatementDataProvider)14 CommonsArrayList (com.helger.commons.collection.impl.CommonsArrayList)11 Nullable (javax.annotation.Nullable)11 ReturnsMutableCopy (com.helger.commons.annotation.ReturnsMutableCopy)10 Nonnull (javax.annotation.Nonnull)10 Wrapper (com.helger.commons.wrapper.Wrapper)9 IParticipantIdentifier (com.helger.peppolid.IParticipantIdentifier)8 ISMPServiceGroup (com.helger.phoss.smp.domain.servicegroup.ISMPServiceGroup)7 SimpleDocumentTypeIdentifier (com.helger.peppolid.simple.doctype.SimpleDocumentTypeIdentifier)6 SimpleParticipantIdentifier (com.helger.peppolid.simple.participant.SimpleParticipantIdentifier)6 ValueEnforcer (com.helger.commons.ValueEnforcer)4 ReturnsMutableObject (com.helger.commons.annotation.ReturnsMutableObject)4 CallbackList (com.helger.commons.callback.CallbackList)4 CommonsHashMap (com.helger.commons.collection.impl.CommonsHashMap)4 ICommonsList (com.helger.commons.collection.impl.ICommonsList)4 ICommonsMap (com.helger.commons.collection.impl.ICommonsMap)4 MutableBoolean (com.helger.commons.mutable.MutableBoolean)4 EChange (com.helger.commons.state.EChange)4 ESuccess (com.helger.commons.state.ESuccess)4