// Test Data - Fill the object with test values in every field. MediationProcess *MediationProcess::SampleData() { MediationProcess *result = new MediationProcess(); // unique string to append to fields static int _SAMPLE_INDEX = 0; std::stringstream ss; ss << ++_SAMPLE_INDEX; std::string strId = ss.str(); result->GetParties()->clear(); for(int i=0; i < rand() % 4 + 1; ++i) result->AddParty(Party::SampleData()); result->_countyOfMediation = (CountyIds)(rand() % 3 + 1); result->_disputeType = (DisputeTypes)(rand() % 7 + 1); result->_requiresSpanish = rand() % 2; result->_processInternalState = (DisputeProcessInternalStates)( rand() % 5 + 1 ); result->_referalSource = (ReferralTypes)(rand() % 8 + 1); result->_sessionType = (SessionTypes) (rand() % 3 + 1); MediationSessionVector *temp = new MediationSessionVector; for(int i = 0; i< rand() % 5 + 1; i++) temp->push_back(MediationSession::SampleData()); result->setMediationSessionVector(temp); for(int i=0; i < 5; ++i) result->GetNotes()->push_back(new Note("Some more mediation notes " + QString::number(i))); return result; }
/*#include "DRCClient.h" #include <QApplication> int main(int argc, char *argv[]) { QApplication a(argc, argv); DRCClient w; w.setWindowTitle("Mediation Intake Management Environment"); w.setWindowIcon(QIcon(":image/DRClogoFromJpg.ico")); w.show(); return a.exec(); } */ MediationProcessVector* organizeMediationProcessVector(MediationProcessVector* unorganized) { //Get the size of the unorganized vecotr int vectorLength = unorganized->size(); //Make a new organized vector MediationProcessVector* organized = new MediationProcessVector; //Bubble loop for (int i=0;i<vectorLength;i++) { for (int ii=0;ii<vectorLength;ii++) { MediationProcess* temp = unorganized->at(ii); if (temp->GetId() == i + 1) { organized->push_back(temp); break; } } } if (organized->size() == vectorLength) { return organized; } else { return NULL; } }
MediationProcess* DB_TEST_BASE::InitializeEntireMediationProcess() { MediationProcess* object = InitializeProcessObject(full_process_values); object->AddParty(InitializeClientObject(InitializePersonObject(full_person_values))); //object->AddParty(InitializeClientObject(InitializePersonObject(empty_person_values))); MediationSessionVector* sessions = new MediationSessionVector; MediationSession *pointer = InitializeSessionObject(full_session_values); pointer->addClientSessionData(InitializeClientSessionObject(full_client_session_values)); sessions->push_back(pointer); object->setMediationSessionVector(sessions); return object; }
MediationProcess* DB_TEST_BASE::InitializeProcessObject(QVector<QString> ProcessStringValues) { MediationProcess* object = new MediationProcess; ProcessObjectsTracker.push_back(object); object->SetDisputeType( (DisputeTypes) ProcessStringValues[DISPUTETYPE].toInt()); object->SetCreatedDate( QDateTime::fromString( ProcessStringValues[PROCESS_CREATIONDATETIME], QString("yyyy-MM-dd hh:mm:ss"))); object->SetUpdatedDate( QDateTime::fromString( ProcessStringValues[PROCESS_UPDATEDDATETIME], QString("yyyy-MM-dd hh:mm:ss"))); object->SetState( (DisputeProcessStates) ProcessStringValues[DISPUTESTATE].toInt()); //DisputeProcessStates - PROCESS_STATE_SCHEDULED object->SetInternalState( (DisputeProcessInternalStates) ProcessStringValues[DISPUTEINTERNALSTATE].toInt()); //DisputeProcessInternalStates - PROCESS_INTERNAL_STATE_SCHEDULED object->SetCountyId( (CountyIds) ProcessStringValues[DISPUTECOUNTY].toInt()); //CountyIds - COUNTY_BENTON object->SetReferralType( (ReferralTypes) ProcessStringValues[REFERALSOURCE].toInt()); //ReferralTypes - REFERRAL_T_PHONEBOOK object->SetInquiryTypes( (InquiryTypes) ProcessStringValues[INQUIRYTYPE].toInt()); //InquiryTypes - INQUIRY_T_WALKIN object->SetInfoOnly( (bool) ProcessStringValues[INFOONLY].toInt()); //Info Only - FALSE object->SetIsCourtCase( (bool) ProcessStringValues[ISCOURTCASE].toInt()); //Is Court Case - TRUE object->SetCourtDate( QDate::fromString( ProcessStringValues[COURTDATE], DateFormat)); object->SetCourtType( (CourtCaseTypes) ProcessStringValues[COURTCASETYPE].toInt()); //CourtCaseTypes - COURT_T_SUPERIOR object->SetCourtOrder( ProcessStringValues[COURTORDERTYPE]); object->SetRequiresSpanish( (bool) ProcessStringValues[TRANSLATORREQUIRED].toInt()); object->SetSessionType( (SessionTypes) ProcessStringValues[SESSIONTYPE].toInt()); object->setMediationClause( (bool) ProcessStringValues[MEDIATIONCLAUSE].toInt()); object->SetIndirectChildren( (int) ProcessStringValues[INDIRECTCHILDREN].toInt() ); object->SetDirectChildren( (int) ProcessStringValues[DIRECTCHILDREN].toInt() ); object->SetIndirectAdult( (int) ProcessStringValues[INDIRECTADULT].toInt() ); object->SetDirectAdult( (int) ProcessStringValues[DIRECTADULT].toInt() ); object->SetTags( (QString) ProcessStringValues[PROCESS_TAGS] ); return object; }