Search in sources :

Example 26 with ProgramStageDataElement

use of org.hisp.dhis.program.ProgramStageDataElement in project dhis2-core by dhis2.

the class EventXmlImportTest method setUpTest.

@Override
protected void setUpTest() throws Exception {
    userService = _userService;
    organisationUnitA = createOrganisationUnit('A');
    organisationUnitA.setUid("A");
    manager.save(organisationUnitA);
    dataElementA = createDataElement('A');
    dataElementA.setValueType(ValueType.INTEGER);
    dataElementA.setUid("A");
    manager.save(dataElementA);
    programStageA = createProgramStage('A', 0);
    programStageA.setFeatureType(FeatureType.POINT);
    programStageA.setUid("A");
    manager.save(programStageA);
    ProgramStageDataElement programStageDataElement = new ProgramStageDataElement();
    programStageDataElement.setDataElement(dataElementA);
    programStageDataElement.setProgramStage(programStageA);
    programStageDataElementService.addProgramStageDataElement(programStageDataElement);
    programA = createProgram('A', new HashSet<>(), organisationUnitA);
    programA.setProgramType(ProgramType.WITHOUT_REGISTRATION);
    programA.setUid("A");
    manager.save(programA);
    ProgramInstance programInstance = new ProgramInstance();
    programInstance.setProgram(programA);
    programInstance.setAutoFields();
    programInstance.setEnrollmentDate(new Date());
    programInstance.setIncidentDate(new Date());
    programInstance.setStatus(ProgramStatus.ACTIVE);
    programInstanceService.addProgramInstance(programInstance);
    programStageA.getProgramStageDataElements().add(programStageDataElement);
    programStageA.setProgram(programA);
    programA.getProgramStages().add(programStageA);
    manager.update(programStageA);
    manager.update(programA);
    createUserAndInjectSecurityContext(true);
}
Also used : ProgramStageDataElement(org.hisp.dhis.program.ProgramStageDataElement) ProgramInstance(org.hisp.dhis.program.ProgramInstance) Date(java.util.Date) HashSet(java.util.HashSet)

Example 27 with ProgramStageDataElement

use of org.hisp.dhis.program.ProgramStageDataElement in project dhis2-core by dhis2.

the class DataValueFilteringTestSupport method getProgramStageDataElement.

public static ProgramStageDataElement getProgramStageDataElement(String uid) {
    ProgramStageDataElement programStageDataElement = new ProgramStageDataElement();
    DataElement dataElement = new DataElement();
    dataElement.setUid(uid);
    programStageDataElement.setDataElement(dataElement);
    return programStageDataElement;
}
Also used : ProgramStageDataElement(org.hisp.dhis.program.ProgramStageDataElement) DataElement(org.hisp.dhis.dataelement.DataElement) ProgramStageDataElement(org.hisp.dhis.program.ProgramStageDataElement)

Example 28 with ProgramStageDataElement

use of org.hisp.dhis.program.ProgramStageDataElement in project dhis2-core by dhis2.

the class NoRegistrationSingleEventServiceTest method setUpTest.

@Override
protected void setUpTest() throws Exception {
    userService = _userService;
    organisationUnitA = createOrganisationUnit('A');
    identifiableObjectManager.save(organisationUnitA);
    dataElementA = createDataElement('A');
    dataElementA.setValueType(ValueType.INTEGER);
    identifiableObjectManager.save(dataElementA);
    programStageA = createProgramStage('A', 0);
    identifiableObjectManager.save(programStageA);
    programA = createProgram('A', new HashSet<>(), organisationUnitA);
    programA.setProgramType(ProgramType.WITHOUT_REGISTRATION);
    identifiableObjectManager.save(programA);
    ProgramStageDataElement programStageDataElement = new ProgramStageDataElement();
    programStageDataElement.setDataElement(dataElementA);
    programStageDataElement.setProgramStage(programStageA);
    programStageDataElementService.addProgramStageDataElement(programStageDataElement);
    programStageA.getProgramStageDataElements().add(programStageDataElement);
    programStageA.setProgram(programA);
    programA.getProgramStages().add(programStageA);
    identifiableObjectManager.update(programStageA);
    identifiableObjectManager.update(programA);
    ProgramInstance programInstance = new ProgramInstance();
    programInstance.setProgram(programA);
    programInstance.setIncidentDate(new Date());
    programInstance.setEnrollmentDate(new Date());
    programInstanceService.addProgramInstance(programInstance);
    identifiableObjectManager.update(programA);
    createUserAndInjectSecurityContext(true);
    identifiableObjectManager.flush();
}
Also used : ProgramStageDataElement(org.hisp.dhis.program.ProgramStageDataElement) ProgramInstance(org.hisp.dhis.program.ProgramInstance) Date(java.util.Date) HashSet(java.util.HashSet)

Example 29 with ProgramStageDataElement

use of org.hisp.dhis.program.ProgramStageDataElement in project dhis2-core by dhis2.

the class RegistrationMultiEventsServiceTest method setUpTest.

@Override
protected void setUpTest() throws Exception {
    userService = _userService;
    organisationUnitA = createOrganisationUnit('A');
    organisationUnitB = createOrganisationUnit('B');
    manager.save(organisationUnitA);
    manager.save(organisationUnitB);
    TrackedEntityType trackedEntityType = createTrackedEntityType('A');
    trackedEntityTypeService.addTrackedEntityType(trackedEntityType);
    maleA = createTrackedEntityInstance(organisationUnitA);
    maleB = createTrackedEntityInstance(organisationUnitB);
    femaleA = createTrackedEntityInstance(organisationUnitA);
    femaleB = createTrackedEntityInstance(organisationUnitB);
    maleA.setTrackedEntityType(trackedEntityType);
    maleB.setTrackedEntityType(trackedEntityType);
    femaleA.setTrackedEntityType(trackedEntityType);
    femaleB.setTrackedEntityType(trackedEntityType);
    manager.save(maleA);
    manager.save(maleB);
    manager.save(femaleA);
    manager.save(femaleB);
    trackedEntityInstanceMaleA = trackedEntityInstanceService.getTrackedEntityInstance(maleA);
    dataElementA = createDataElement('A');
    dataElementB = createDataElement('B');
    dataElementA.setValueType(ValueType.INTEGER);
    dataElementB.setValueType(ValueType.INTEGER);
    manager.save(dataElementA);
    manager.save(dataElementB);
    programStageA = createProgramStage('A', 0);
    programStageB = createProgramStage('B', 0);
    programStageB.setRepeatable(true);
    manager.save(programStageA);
    manager.save(programStageB);
    programA = createProgram('A', new HashSet<>(), organisationUnitA);
    programA.setProgramType(ProgramType.WITH_REGISTRATION);
    manager.save(programA);
    ProgramStageDataElement programStageDataElement = new ProgramStageDataElement();
    programStageDataElement.setDataElement(dataElementA);
    programStageDataElement.setProgramStage(programStageA);
    programStageDataElementService.addProgramStageDataElement(programStageDataElement);
    programStageA.getProgramStageDataElements().add(programStageDataElement);
    programStageA.setProgram(programA);
    programStageDataElement = new ProgramStageDataElement();
    programStageDataElement.setDataElement(dataElementB);
    programStageDataElement.setProgramStage(programStageB);
    programStageDataElementService.addProgramStageDataElement(programStageDataElement);
    programStageB.getProgramStageDataElements().add(programStageDataElement);
    programStageB.setProgram(programA);
    programStageB.setMinDaysFromStart(2);
    programA.getProgramStages().add(programStageA);
    programA.getProgramStages().add(programStageB);
    manager.update(programStageA);
    manager.update(programStageB);
    manager.update(programA);
    createUserAndInjectSecurityContext(true);
}
Also used : ProgramStageDataElement(org.hisp.dhis.program.ProgramStageDataElement) TrackedEntityType(org.hisp.dhis.trackedentity.TrackedEntityType) HashSet(java.util.HashSet)

Example 30 with ProgramStageDataElement

use of org.hisp.dhis.program.ProgramStageDataElement in project dhis2-core by dhis2.

the class EnrollmentSecurityTest method setUpTest.

@Override
protected void setUpTest() {
    userService = _userService;
    organisationUnitA = createOrganisationUnit('A');
    organisationUnitB = createOrganisationUnit('B');
    manager.save(organisationUnitA);
    manager.save(organisationUnitB);
    TrackedEntityType trackedEntityType = createTrackedEntityType('A');
    trackedEntityType.getSharing().setPublicAccess(AccessStringHelper.FULL);
    manager.save(trackedEntityType, false);
    dataElementA = createDataElement('A');
    dataElementB = createDataElement('B');
    dataElementA.setValueType(ValueType.INTEGER);
    dataElementB.setValueType(ValueType.INTEGER);
    manager.save(dataElementA);
    manager.save(dataElementB);
    programStageA = createProgramStage('A', 0);
    programStageB = createProgramStage('B', 0);
    programStageB.setRepeatable(true);
    manager.save(programStageA);
    manager.save(programStageB);
    programA = createProgram('A', new HashSet<>(), organisationUnitA);
    programA.setProgramType(ProgramType.WITH_REGISTRATION);
    programA.setTrackedEntityType(trackedEntityType);
    manager.save(programA);
    ProgramStageDataElement programStageDataElement = new ProgramStageDataElement();
    programStageDataElement.setDataElement(dataElementA);
    programStageDataElement.setProgramStage(programStageA);
    programStageDataElementService.addProgramStageDataElement(programStageDataElement);
    programStageA.getProgramStageDataElements().add(programStageDataElement);
    programStageA.setProgram(programA);
    programStageDataElement = new ProgramStageDataElement();
    programStageDataElement.setDataElement(dataElementB);
    programStageDataElement.setProgramStage(programStageB);
    programStageDataElementService.addProgramStageDataElement(programStageDataElement);
    programStageB.getProgramStageDataElements().add(programStageDataElement);
    programStageB.setProgram(programA);
    programStageB.setMinDaysFromStart(2);
    programA.getProgramStages().add(programStageA);
    programA.getProgramStages().add(programStageB);
    manager.update(programStageA);
    manager.update(programStageB);
    manager.update(programA);
    maleA = createTrackedEntityInstance(organisationUnitA);
    maleB = createTrackedEntityInstance(organisationUnitB);
    femaleA = createTrackedEntityInstance(organisationUnitA);
    femaleB = createTrackedEntityInstance(organisationUnitB);
    maleA.setTrackedEntityType(trackedEntityType);
    maleB.setTrackedEntityType(trackedEntityType);
    femaleA.setTrackedEntityType(trackedEntityType);
    femaleB.setTrackedEntityType(trackedEntityType);
    manager.save(maleA);
    manager.save(maleB);
    manager.save(femaleA);
    manager.save(femaleB);
}
Also used : ProgramStageDataElement(org.hisp.dhis.program.ProgramStageDataElement) TrackedEntityType(org.hisp.dhis.trackedentity.TrackedEntityType) HashSet(java.util.HashSet)

Aggregations

ProgramStageDataElement (org.hisp.dhis.program.ProgramStageDataElement)43 DataElement (org.hisp.dhis.dataelement.DataElement)21 ProgramStage (org.hisp.dhis.program.ProgramStage)15 HashSet (java.util.HashSet)12 ProgramInstance (org.hisp.dhis.program.ProgramInstance)7 TrackedEntityType (org.hisp.dhis.trackedentity.TrackedEntityType)7 User (org.hisp.dhis.user.User)7 ArrayList (java.util.ArrayList)6 Date (java.util.Date)6 Program (org.hisp.dhis.program.Program)6 Test (org.junit.jupiter.api.Test)6 OrganisationUnit (org.hisp.dhis.organisationunit.OrganisationUnit)5 List (java.util.List)4 ProgramStageSection (org.hisp.dhis.program.ProgramStageSection)4 Event (org.hisp.dhis.tracker.domain.Event)4 HashMap (java.util.HashMap)3 TransactionalIntegrationTest (org.hisp.dhis.TransactionalIntegrationTest)3 IdentifiableObject (org.hisp.dhis.common.IdentifiableObject)3 ObjectBundleValidationReport (org.hisp.dhis.dxf2.metadata.objectbundle.feedback.ObjectBundleValidationReport)3 PeriodType (org.hisp.dhis.period.PeriodType)3