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);
}
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;
}
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();
}
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);
}
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);
}
Aggregations