use of com.helger.phoss.smp.domain.pmigration.EParticipantMigrationDirection 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.phoss.smp.domain.pmigration.EParticipantMigrationDirection in project phoss-smp by phax.
the class SMPParticipantMigrationManagerMongoDB method toDomain.
@Nonnull
@ReturnsMutableCopy
public static SMPParticipantMigration toDomain(@Nonnull final Document aDoc) {
final String sID = aDoc.getString(BSON_ID);
final EParticipantMigrationDirection eDirection = EParticipantMigrationDirection.getFromIDOrNull(aDoc.getString(BSON_DIRECTION));
final EParticipantMigrationState eState = EParticipantMigrationState.getFromIDOrNull(aDoc.getString(BSON_STATE));
final IParticipantIdentifier aParticipantID = toParticipantID(aDoc.get(BSON_PARTICIPANT_ID, Document.class));
final LocalDateTime aInitiationDateTime = TypeConverter.convert(aDoc.getDate(BSON_INIT_DT), LocalDateTime.class);
final String sMigrationKey = aDoc.getString(BSON_MIGRATION_KEY);
return new SMPParticipantMigration(sID, eDirection, eState, aParticipantID, aInitiationDateTime, sMigrationKey);
}
Aggregations