use of com.helger.db.jdbc.executor.DBResultRow in project phoss-smp by phax.
the class SMPTransportProfileManagerJDBC method getSMPTransportProfileOfID.
@Nullable
public ISMPTransportProfile getSMPTransportProfileOfID(@Nullable final String sID) {
if (StringHelper.hasNoText(sID))
return null;
final Wrapper<DBResultRow> aDBResult = new Wrapper<>();
newExecutor().querySingle("SELECT name, deprecated FROM smp_tprofile WHERE id=?", new ConstantPreparedStatementDataProvider(sID), aDBResult::set);
if (aDBResult.isNotSet())
return null;
final DBResultRow aRow = aDBResult.get();
return new SMPTransportProfile(sID, aRow.getAsString(0), aRow.getAsBoolean(1, SMPTransportProfile.DEFAULT_DEPRECATED));
}
use of com.helger.db.jdbc.executor.DBResultRow in project phoss-smp by phax.
the class SMPUserManagerJDBC method getAllUsers.
@Nonnull
@ReturnsMutableCopy
public ICommonsList<DBUser> getAllUsers() {
final ICommonsList<DBUser> ret = new CommonsArrayList<>();
// Plaintext password....
final ICommonsList<DBResultRow> aDBResult = newExecutor().queryAll("SELECT username, password FROM smp_user");
if (aDBResult != null)
for (final DBResultRow aRow : aDBResult) ret.add(new DBUser(aRow.getAsString(0), aRow.getAsString(1)));
return ret;
}
use of com.helger.db.jdbc.executor.DBResultRow in project phoss-smp by phax.
the class SMPRedirectManagerJDBC method getAllSMPRedirects.
@Nonnull
@ReturnsMutableCopy
public ICommonsList<ISMPRedirect> getAllSMPRedirects() {
final ICommonsList<DBResultRow> aDBResult = newExecutor().queryAll("SELECT businessIdentifierScheme, businessIdentifier, documentIdentifierScheme, documentIdentifier, redirectionUrl, certificateUID, certificate, extension" + " FROM smp_service_metadata_red");
final ICommonsList<ISMPRedirect> ret = new CommonsArrayList<>();
if (aDBResult != null)
for (final DBResultRow aRow : aDBResult) {
final ISMPServiceGroup aServiceGroup = m_aServiceGroupMgr.getSMPServiceGroupOfID(new SimpleParticipantIdentifier(aRow.getAsString(0), aRow.getAsString(1)));
final X509Certificate aCertificate = CertificateHelper.convertStringToCertficateOrNull(aRow.getAsString(6));
ret.add(new SMPRedirect(aServiceGroup, new SimpleDocumentTypeIdentifier(aRow.getAsString(2), aRow.getAsString(3)), aRow.getAsString(4), aRow.getAsString(5), aCertificate, aRow.getAsString(7)));
}
return ret;
}
use of com.helger.db.jdbc.executor.DBResultRow in project phoss-smp by phax.
the class SMPRedirectManagerJDBC method getAllSMPRedirectsOfServiceGroup.
@Nonnull
@ReturnsMutableCopy
public ICommonsList<ISMPRedirect> getAllSMPRedirectsOfServiceGroup(@Nullable final ISMPServiceGroup aServiceGroup) {
final ICommonsList<ISMPRedirect> ret = new CommonsArrayList<>();
if (aServiceGroup != null) {
final IParticipantIdentifier aParticipantID = aServiceGroup.getParticipantIdentifier();
final ICommonsList<DBResultRow> aDBResult = newExecutor().queryAll("SELECT documentIdentifierScheme, documentIdentifier, redirectionUrl, certificateUID, certificate, extension" + " FROM smp_service_metadata_red" + " WHERE businessIdentifierScheme=? AND businessIdentifier=?", new ConstantPreparedStatementDataProvider(aParticipantID.getScheme(), aParticipantID.getValue()));
if (aDBResult != null)
for (final DBResultRow aRow : aDBResult) {
final X509Certificate aCertificate = CertificateHelper.convertStringToCertficateOrNull(aRow.getAsString(4));
ret.add(new SMPRedirect(aServiceGroup, new SimpleDocumentTypeIdentifier(aRow.getAsString(0), aRow.getAsString(1)), aRow.getAsString(2), aRow.getAsString(3), aCertificate, aRow.getAsString(5)));
}
}
return ret;
}
use of com.helger.db.jdbc.executor.DBResultRow in project phoss-smp by phax.
the class SMPServiceGroupManagerJDBC method getSMPServiceGroupOfID.
@Nullable
public SMPServiceGroup getSMPServiceGroupOfID(@Nullable final IParticipantIdentifier aParticipantID) {
if (LOGGER.isDebugEnabled())
LOGGER.debug("getSMPServiceGroupOfID(" + (aParticipantID == null ? "null" : aParticipantID.getURIEncoded()) + ")");
if (aParticipantID == null)
return null;
// Use cache
SMPServiceGroup ret = m_aCache == null ? null : m_aCache.get(aParticipantID.getURIEncoded());
if (ret != null)
return ret;
// Not in cache
final Wrapper<DBResultRow> aResult = new Wrapper<>();
newExecutor().querySingle("SELECT sg.extension, so.username" + " FROM smp_service_group sg, smp_ownership so" + " WHERE sg.businessIdentifierScheme=? AND sg.businessIdentifier=?" + " AND so.businessIdentifierScheme=sg.businessIdentifierScheme AND so.businessIdentifier=sg.businessIdentifier", new ConstantPreparedStatementDataProvider(aParticipantID.getScheme(), aParticipantID.getValue()), aResult::set);
if (aResult.isNotSet())
return null;
ret = new SMPServiceGroup(aResult.get().getAsString(1), aParticipantID, aResult.get().getAsString(0));
if (m_aCache != null)
m_aCache.put(aParticipantID.getURIEncoded(), ret);
return ret;
}
Aggregations