@Override public void deleteUserAuthorityGroup( UserAuthorityGroup group ) { Collection<Program> programs = idObjectManager.getAllNoAcl( Program.class ); for ( Program program : programs ) { if ( program.getUserRoles().remove( group ) ) { idObjectManager.updateNoAcl( program ); } } }
@Override @Transactional public void generateCategoryOptionComboNames() { resourceTableStore.generateResourceTable( new CategoryOptionComboNameResourceTable( idObjectManager.getAllNoAcl( CategoryCombo.class ) ) ); }
@Override @Transactional public void generateDataElementTable() { resourceTableStore.generateResourceTable( new DataElementResourceTable( idObjectManager.getAllNoAcl( DataElement.class ) ) ); }
@Override public void deleteOrganisationUnit( OrganisationUnit unit ) { Collection<Program> programs = idObjectManager.getAllNoAcl( Program.class ); for ( Program program : programs ) { if ( program.getOrganisationUnits().remove( unit ) ) { idObjectManager.updateNoAcl( program ); } } }
@Override public void deleteProgramIndicator( ProgramIndicator programIndicator ) { Collection<ProgramStageSection> sections = idObjectManager.getAllNoAcl( ProgramStageSection.class ); for ( ProgramStageSection section : sections ) { if ( section.getProgramIndicators().remove( programIndicator ) ) { idObjectManager.update( section ); } } }
@Override @Transactional public void generateIndicatorGroupSetTable() { resourceTableStore.generateResourceTable( new IndicatorGroupSetResourceTable( idObjectManager.getAllNoAcl( IndicatorGroupSet.class ) ) ); }
@Override @Transactional public void generateDataSetOrganisationUnitCategoryTable() { resourceTableStore.generateResourceTable( new DataSetOrganisationUnitCategoryResourceTable( idObjectManager.getAllNoAcl( DataSet.class ), categoryService.getDefaultCategoryOptionCombo() ) ); }
@Override @Transactional public List<AnalyticsTable> getAnalyticsTables( Date earliest ) { List<AnalyticsTable> tables = new UniqueArrayList<>(); List<Program> programs = idObjectManager.getAllNoAcl( Program.class ); String baseName = getTableName(); for ( Program program : programs ) { AnalyticsTable table = new AnalyticsTable( baseName, getDimensionColumns( program ), Lists.newArrayList(), program ); tables.add( table ); } return tables; }
@Override public void deleteLegendSet( LegendSet legendSet ) { for ( DataElement element : idObjectManager.getAllNoAcl( DataElement.class ) ) { for ( LegendSet ls : element.getLegendSets() ) { if( legendSet.equals( ls ) ) { element.getLegendSets().remove( ls ); idObjectManager.updateNoAcl( element ); } } } }
@Override public void deleteLegendSet( LegendSet legendSet ) { for ( DataSet dataSet : idObjectManager.getAllNoAcl( DataSet.class ) ) { for ( LegendSet ls : dataSet.getLegendSets() ) { if( legendSet.equals( ls ) ) { dataSet.getLegendSets().remove( ls ); idObjectManager.updateNoAcl( dataSet ); } } } }
List<DataSet> dataSets = idObjectManager.getAllNoAcl( DataSet.class );
@Override public void deleteTrackedEntityAttribute( TrackedEntityAttribute trackedEntityAttribute ) { Collection<Program> programs = idObjectManager.getAllNoAcl( Program.class ); for ( Program program : programs ) { for ( ProgramTrackedEntityAttribute programAttribute : program.getProgramAttributes() ) { if ( programAttribute.getAttribute().equals( trackedEntityAttribute ) ) { program.getProgramAttributes().remove( programAttribute ); idObjectManager.updateNoAcl( program ); } } } }
@Override @Transactional public List<AnalyticsTable> getAnalyticsTables( Date earliest ) { log.info( String.format( "Get tables using earliest: %s, spatial support: %b", earliest, databaseInfo.isSpatialSupport() ) ); List<AnalyticsTable> tables = new ArrayList<>(); Calendar calendar = PeriodType.getCalendar(); String baseName = getTableName(); List<Program> programs = idObjectManager.getAllNoAcl( Program.class ); for ( Program program : programs ) { List<Integer> dataYears = getDataYears( program, earliest ); Collections.sort( dataYears ); AnalyticsTable table = new AnalyticsTable( baseName, getDimensionColumns( program ), Lists.newArrayList(), program ); for ( Integer year : dataYears ) { table.addPartitionTable( year, PartitionUtils.getStartDate( calendar, year ), PartitionUtils.getEndDate( calendar, year ) ); } if ( table.hasPartitionTables() ) { tables.add( table ); } } return tables; }
@Override public void deleteCategoryCombo( CategoryCombo categoryCombo ) { CategoryCombo defaultCategoryCombo = categoryService .getCategoryComboByName( DEFAULT_CATEGORY_COMBO_NAME ); for ( DataElement dataElement : idObjectManager.getAllNoAcl( DataElement.class ) ) { if ( dataElement != null && dataElement.getCategoryCombo().equals( categoryCombo ) ) { dataElement.setCategoryCombo( defaultCategoryCombo ); idObjectManager.updateNoAcl( dataElement ); } } }
@Override @Transactional public void substituteExpressions( Collection<Indicator> indicators, Integer days ) { if ( indicators != null && !indicators.isEmpty() ) { Map<String, Constant> constants = new CachingMap<String, Constant>() .load( idObjectManager.getAllNoAcl( Constant.class ), c -> c.getUid() ); Map<String, OrganisationUnitGroup> orgUnitGroups = new CachingMap<String, OrganisationUnitGroup>() .load( idObjectManager.getAllNoAcl( OrganisationUnitGroup.class ), g -> g.getUid() ); for ( Indicator indicator : indicators ) { indicator.setExplodedNumerator( substituteExpression( indicator.getNumerator(), constants, orgUnitGroups, days ) ); indicator.setExplodedDenominator( substituteExpression( indicator.getDenominator(), constants, orgUnitGroups, days ) ); } } }
@Override public void deleteCategoryCombo( CategoryCombo categoryCombo ) { CategoryCombo defaultCategoryCombo = categoryService .getCategoryComboByName( DEFAULT_CATEGORY_COMBO_NAME ); Collection<Program> programs = idObjectManager.getAllNoAcl( Program.class ); for ( Program program : programs ) { if ( program != null && categoryCombo.equals( program.getCategoryCombo() ) ) { program.setCategoryCombo( defaultCategoryCombo ); idObjectManager.updateNoAcl( program ); } } }
@Override public void deleteCategoryCombo( CategoryCombo categoryCombo ) { CategoryCombo defaultCategoryCombo = categoryService .getCategoryComboByName( DEFAULT_CATEGORY_COMBO_NAME ); Collection<DataSet> dataSets = idObjectManager.getAllNoAcl( DataSet.class ); for ( DataSet dataSet : dataSets ) { if ( dataSet != null && categoryCombo.equals( dataSet.getCategoryCombo() ) ) { dataSet.setCategoryCombo( defaultCategoryCombo ); idObjectManager.updateNoAcl( dataSet ); } } }