use of org.hisp.dhis.period.MonthlyPeriodType in project dhis2-core by dhis2.
the class DataEntryFormServiceTest method setUpTest.
// -------------------------------------------------------------------------
// Fixture
// -------------------------------------------------------------------------
@Override
public void setUpTest() throws Exception {
periodType = new MonthlyPeriodType();
dataElement = createDataElement('A');
dataElementService.addDataElement(dataElement);
categoryOptionCombo = categoryService.getDefaultDataElementCategoryOptionCombo();
dataElementUid = dataElement.getUid();
categoryOptionComboUid = categoryOptionCombo.getUid();
i18n = new MockI18n();
}
use of org.hisp.dhis.period.MonthlyPeriodType in project dhis2-core by dhis2.
the class SectionStoreTest method setUpTest.
@Override
public void setUpTest() {
dataSet = createDataSet('A', new MonthlyPeriodType());
dataSetService.addDataSet(dataSet);
DataElement dataElementA = createDataElement('A');
DataElement dataElementB = createDataElement('B');
dataElementService.addDataElement(dataElementA);
dataElementService.addDataElement(dataElementB);
List<DataElement> dataElements = new ArrayList<>();
dataElements.add(dataElementA);
dataElements.add(dataElementB);
sectionA = new Section("SectionA", dataSet, dataElements, null);
sectionB = new Section("SectionB", dataSet, dataElements, null);
sectionC = new Section("SectionC", dataSet, dataElements, null);
}
use of org.hisp.dhis.period.MonthlyPeriodType in project dhis2-core by dhis2.
the class DataApprovalAuditStoreTest method setUpTest.
// -------------------------------------------------------------------------
// Set up/tear down
// -------------------------------------------------------------------------
@Override
public void setUpTest() throws Exception {
// ---------------------------------------------------------------------
// Add supporting data
// ---------------------------------------------------------------------
level1 = new DataApprovalLevel("01", 1, null);
level2 = new DataApprovalLevel("02", 2, null);
dataApprovalLevelService.addDataApprovalLevel(level1);
dataApprovalLevelService.addDataApprovalLevel(level2);
PeriodType periodType = PeriodType.getPeriodTypeByName("Monthly");
workflowA = new DataApprovalWorkflow("workflowA", periodType, newHashSet(level1));
workflowB = new DataApprovalWorkflow("workflowB", periodType, newHashSet(level1, level2));
dataApprovalService.addWorkflow(workflowA);
dataApprovalService.addWorkflow(workflowB);
periodA = createPeriod(new MonthlyPeriodType(), getDate(2017, 1, 1), getDate(2017, 1, 31));
periodB = createPeriod(new MonthlyPeriodType(), getDate(2018, 1, 1), getDate(2018, 1, 31));
periodService.addPeriod(periodA);
periodService.addPeriod(periodB);
sourceA = createOrganisationUnit('A');
sourceB = createOrganisationUnit('B', sourceA);
organisationUnitService.addOrganisationUnit(sourceA);
organisationUnitService.addOrganisationUnit(sourceB);
userA = createUser('A');
userService.addUser(userA);
optionA = new DataElementCategoryOption("CategoryOptionA");
optionB = new DataElementCategoryOption("CategoryOptionB");
categoryService.addDataElementCategoryOption(optionA);
categoryService.addDataElementCategoryOption(optionB);
categoryA = createDataElementCategory('A', optionA, optionB);
categoryService.addDataElementCategory(categoryA);
categoryComboA = createCategoryCombo('A', categoryA);
categoryService.addDataElementCategoryCombo(categoryComboA);
optionComboA = createCategoryOptionCombo('A', categoryComboA, optionA);
optionComboB = createCategoryOptionCombo('B', categoryComboA, optionA, optionB);
categoryService.addDataElementCategoryOptionCombo(optionComboA);
categoryService.addDataElementCategoryOptionCombo(optionComboB);
dateA = getDate(2017, 1, 1);
dateB = getDate(2018, 1, 1);
DataApproval approvalA = new DataApproval(level1, workflowA, periodA, sourceA, optionComboA, false, dateA, userA);
DataApproval approvalB = new DataApproval(level2, workflowB, periodB, sourceB, optionComboB, false, dateB, userA);
auditA = new DataApprovalAudit(approvalA, APPROVE);
auditB = new DataApprovalAudit(approvalB, UNAPPROVE);
}
use of org.hisp.dhis.period.MonthlyPeriodType in project dhis2-core by dhis2.
the class DataValueSetServiceIntegrationTest method setUpTest.
@Override
public void setUpTest() {
deA = createDataElement('A');
deB = createDataElement('B');
deC = createDataElement('C');
deA.setUid("f7n9E0hX8qk");
deB.setUid("Ix2HsbDMLea");
deC.setUid("eY5ehpbEsB7");
idObjectManager.save(deA);
idObjectManager.save(deB);
idObjectManager.save(deC);
ptA = new MonthlyPeriodType();
dsA = createDataSet('A', ptA);
dsA.setUid("pBOMPrpg1QX");
dataSetService.addDataSet(dsA);
peA = createPeriod(PeriodType.getByNameIgnoreCase(MonthlyPeriodType.NAME), getDate(2012, 1, 1), getDate(2012, 1, 31));
peB = createPeriod(PeriodType.getByNameIgnoreCase(MonthlyPeriodType.NAME), getDate(2012, 2, 1), getDate(2012, 2, 29));
peC = createPeriod(PeriodType.getByNameIgnoreCase(MonthlyPeriodType.NAME), getDate(2012, 3, 1), getDate(2012, 3, 31));
periodService.addPeriod(peA);
periodService.addPeriod(peB);
periodService.addPeriod(peC);
ouA = createOrganisationUnit('A');
ouB = createOrganisationUnit('B');
ouC = createOrganisationUnit('C');
ouA.setUid("DiszpKrYNg8");
ouB.setUid("BdfsJfj87js");
ouC.setUid("j7Hg26FpoIa");
idObjectManager.save(ouA);
idObjectManager.save(ouB);
idObjectManager.save(ouC);
user = createUser('A');
user.setOrganisationUnits(Sets.newHashSet(ouA, ouB, ouC));
CurrentUserService currentUserService = new MockCurrentUserService(user);
setDependency(dataValueSetService, "currentUserService", currentUserService);
}
use of org.hisp.dhis.period.MonthlyPeriodType in project dhis2-core by dhis2.
the class FacilityReportingServiceImpl method getMobileDataSetsForUnit.
// -------------------------------------------------------------------------
// Service methods
// -------------------------------------------------------------------------
@Override
public List<DataSet> getMobileDataSetsForUnit(OrganisationUnit unit, String localeString) {
List<DataSet> datasets = new ArrayList<>();
Locale locale = LocaleUtil.getLocale(localeString);
if (DEBUG)
log.debug("Getting data sets for unit " + unit.getName());
for (org.hisp.dhis.dataset.DataSet dataSet : dataSetService.getDataSetsForMobile(unit)) {
PeriodType periodType = dataSet.getPeriodType();
if (periodType instanceof DailyPeriodType || periodType instanceof WeeklyPeriodType || periodType instanceof MonthlyPeriodType || periodType instanceof YearlyPeriodType || periodType instanceof QuarterlyPeriodType) {
if (DEBUG)
log.debug("Found data set " + dataSet.getName());
datasets.add(getDataSetForLocale(dataSet.getId(), locale));
} else {
log.warn("Dataset '" + dataSet.getName() + "' set to be reported from mobile, but not of a supported period type: " + periodType.getName());
}
}
return datasets;
}
Aggregations