use of com.helger.db.jdbc.executor.DBResultRow in project phoss-smp by phax.
the class SMPParticipantMigrationManagerJDBC method getParticipantMigrationOfID.
@Nullable
public SMPParticipantMigration getParticipantMigrationOfID(@Nullable final String sID) {
if (StringHelper.hasNoText(sID))
return null;
final Wrapper<DBResultRow> aDBResult = new Wrapper<>();
newExecutor().querySingle("SELECT direction, state, pid, initdt, migkey FROM smp_pmigration WHERE id=?", new ConstantPreparedStatementDataProvider(sID), aDBResult::set);
if (aDBResult.isNotSet())
return null;
final DBResultRow aRow = aDBResult.get();
final EParticipantMigrationDirection eDirection = EParticipantMigrationDirection.getFromIDOrNull(aRow.getAsString(0));
final EParticipantMigrationState eState = EParticipantMigrationState.getFromIDOrNull(aRow.getAsString(1));
final IParticipantIdentifier aPI = SMPMetaManager.getIdentifierFactory().parseParticipantIdentifier(aRow.getAsString(2));
return new SMPParticipantMigration(sID, eDirection, eState, aPI, aRow.getAsLocalDateTime(3), aRow.getAsString(4));
}
use of com.helger.db.jdbc.executor.DBResultRow in project phoss-smp by phax.
the class SMPRedirectManagerJDBC method getSMPRedirectOfServiceGroupAndDocumentType.
@Nullable
public ISMPRedirect getSMPRedirectOfServiceGroupAndDocumentType(@Nullable final ISMPServiceGroup aServiceGroup, @Nullable final IDocumentTypeIdentifier aDocTypeID) {
if (aServiceGroup == null)
return null;
if (aDocTypeID == null)
return null;
final IParticipantIdentifier aParticipantID = aServiceGroup.getParticipantIdentifier();
final Wrapper<DBResultRow> aDBResult = new Wrapper<>();
newExecutor().querySingle("SELECT redirectionUrl, certificateUID, certificate, extension" + " FROM smp_service_metadata_red" + " WHERE businessIdentifierScheme=? AND businessIdentifier=? AND documentIdentifierScheme=? and documentIdentifier=?", new ConstantPreparedStatementDataProvider(aParticipantID.getScheme(), aParticipantID.getValue(), aDocTypeID.getScheme(), aDocTypeID.getValue()), aDBResult::set);
if (aDBResult.isNotSet())
return null;
final DBResultRow aRow = aDBResult.get();
final X509Certificate aCertificate = CertificateHelper.convertStringToCertficateOrNull(aRow.getAsString(2));
return new SMPRedirect(aServiceGroup, aDocTypeID, aRow.getAsString(0), aRow.getAsString(1), aCertificate, aRow.getAsString(3));
}
use of com.helger.db.jdbc.executor.DBResultRow in project phoss-smp by phax.
the class SMPServiceGroupManagerJDBC method getAllSMPServiceGroups.
@Nonnull
@ReturnsMutableCopy
public ICommonsList<ISMPServiceGroup> getAllSMPServiceGroups() {
if (LOGGER.isDebugEnabled())
LOGGER.debug("getAllSMPServiceGroups()");
final ICommonsList<DBResultRow> aDBResult = newExecutor().queryAll("SELECT sg.businessIdentifierScheme, sg.businessIdentifier, sg.extension, so.username" + " FROM smp_service_group sg, smp_ownership so" + " WHERE so.businessIdentifierScheme=sg.businessIdentifierScheme AND so.businessIdentifier=sg.businessIdentifier");
final ICommonsList<ISMPServiceGroup> ret = new CommonsArrayList<>();
if (aDBResult != null)
for (final DBResultRow aRow : aDBResult) ret.add(new SMPServiceGroup(aRow.getAsString(3), new SimpleParticipantIdentifier(aRow.getAsString(0), aRow.getAsString(1)), aRow.getAsString(2)));
return ret;
}
use of com.helger.db.jdbc.executor.DBResultRow in project phoss-smp by phax.
the class SMPServiceInformationManagerJDBC method getAllSMPServiceInformationOfServiceGroup.
@Nonnull
@ReturnsMutableCopy
public ICommonsList<ISMPServiceInformation> getAllSMPServiceInformationOfServiceGroup(@Nullable final ISMPServiceGroup aServiceGroup) {
final ICommonsList<ISMPServiceInformation> ret = new CommonsArrayList<>();
if (aServiceGroup != null) {
final IParticipantIdentifier aPID = aServiceGroup.getParticipantIdentifier();
final ICommonsList<DBResultRow> aDBResult = newExecutor().queryAll("SELECT sm.documentIdentifierScheme, sm.documentIdentifier, sm.extension," + " sp.processIdentifierType, sp.processIdentifier, sp.extension," + " se.transportProfile, se.endpointReference, se.requireBusinessLevelSignature, se.minimumAuthenticationLevel," + " se.serviceActivationDate, se.serviceExpirationDate, se.certificate, se.serviceDescription," + " se.technicalContactUrl, se.technicalInformationUrl, se.extension" + " FROM smp_service_metadata AS sm" + " INNER JOIN smp_process AS sp" + " ON sm.businessIdentifierScheme=sp.businessIdentifierScheme AND sm.businessIdentifier=sp.businessIdentifier" + " AND sm.documentIdentifierScheme=sp.documentIdentifierScheme AND sm.documentIdentifier=sp.documentIdentifier" + " INNER JOIN smp_endpoint AS se" + " ON sp.businessIdentifierScheme=se.businessIdentifierScheme AND sp.businessIdentifier=se.businessIdentifier" + " AND sp.documentIdentifierScheme=se.documentIdentifierScheme AND sp.documentIdentifier=se.documentIdentifier" + " AND sp.processIdentifierType=se.processIdentifierType AND sp.processIdentifier=se.processIdentifier" + " WHERE sm.businessIdentifierScheme=? AND sm.businessIdentifier=?", new ConstantPreparedStatementDataProvider(aPID.getScheme(), aPID.getValue()));
if (aDBResult != null) {
final ICommonsMap<DocTypeAndExtension, ICommonsMap<SMPProcess, ICommonsList<SMPEndpoint>>> aGrouping = new CommonsHashMap<>();
for (final DBResultRow aDBRow : aDBResult) {
// Document type ID and extension
final IDocumentTypeIdentifier aDocTypeID = new SimpleDocumentTypeIdentifier(aDBRow.getAsString(0), aDBRow.getAsString(1));
final String sServiceInformationExtension = aDBRow.getAsString(2);
// Process without endpoints
final SMPProcess aProcess = new SMPProcess(new SimpleProcessIdentifier(aDBRow.getAsString(3), aDBRow.getAsString(4)), null, aDBRow.getAsString(5));
// Don't add endpoint to process, because that impacts
// SMPProcess.equals/hashcode
final SMPEndpoint aEndpoint = new SMPEndpoint(aDBRow.getAsString(6), aDBRow.getAsString(7), aDBRow.getAsBoolean(8, SMPEndpoint.DEFAULT_REQUIRES_BUSINESS_LEVEL_SIGNATURE), aDBRow.getAsString(9), aDBRow.getAsXMLOffsetDateTime(10), aDBRow.getAsXMLOffsetDateTime(11), aDBRow.getAsString(12), aDBRow.getAsString(13), aDBRow.getAsString(14), aDBRow.getAsString(15), aDBRow.getAsString(16));
aGrouping.computeIfAbsent(new DocTypeAndExtension(aDocTypeID, sServiceInformationExtension), k -> new CommonsHashMap<>()).computeIfAbsent(aProcess, k -> new CommonsArrayList<>()).add(aEndpoint);
}
for (final Map.Entry<DocTypeAndExtension, ICommonsMap<SMPProcess, ICommonsList<SMPEndpoint>>> aEntry : aGrouping.entrySet()) {
// Flatten list
final ICommonsList<SMPProcess> aProcesses = new CommonsArrayList<>();
for (final Map.Entry<SMPProcess, ICommonsList<SMPEndpoint>> aEntry2 : aEntry.getValue().entrySet()) {
final SMPProcess aProcess = aEntry2.getKey();
aProcess.addEndpoints(aEntry2.getValue());
aProcesses.add(aProcess);
}
final DocTypeAndExtension aDE = aEntry.getKey();
ret.add(new SMPServiceInformation(aServiceGroup, aDE.m_aDocTypeID, aProcesses, aDE.m_sExt));
}
}
}
return ret;
}
use of com.helger.db.jdbc.executor.DBResultRow in project phoss-smp by phax.
the class SMPServiceInformationManagerJDBC method getAllSMPDocumentTypesOfServiceGroup.
@Nonnull
@ReturnsMutableCopy
public ICommonsList<IDocumentTypeIdentifier> getAllSMPDocumentTypesOfServiceGroup(@Nullable final ISMPServiceGroup aServiceGroup) {
final ICommonsList<IDocumentTypeIdentifier> ret = new CommonsArrayList<>();
if (aServiceGroup != null) {
final IParticipantIdentifier aPID = aServiceGroup.getParticipantIdentifier();
final ICommonsList<DBResultRow> aDBResult = newExecutor().queryAll("SELECT sm.documentIdentifierScheme, sm.documentIdentifier" + " FROM smp_service_metadata AS sm" + " WHERE sm.businessIdentifierScheme=? AND sm.businessIdentifier=?", new ConstantPreparedStatementDataProvider(aPID.getScheme(), aPID.getValue()));
if (aDBResult != null)
for (final DBResultRow aRow : aDBResult) ret.add(new SimpleDocumentTypeIdentifier(aRow.getAsString(0), aRow.getAsString(1)));
}
return ret;
}
Aggregations