PeriodOffsetUtils { public static Period shiftPeriod( Period period, int periodOffset ) { if ( periodOffset == 0 ) { return period; } PeriodType periodType = period.getPeriodType(); Period p; if ( periodOffset > 0 ) { p = periodType.getNextPeriod( period, periodOffset ); } else { p = periodType.getPreviousPeriod( period, periodOffset ); } p.setShifted( true ); return p; }  static ListMap<String, DimensionalItemObject> getPeriodTypePeriodMap( DataQueryParams params ); static Period shiftPeriod( Period period, int periodOffset ); static DataQueryParams removeOffsetPeriodsIfNotNeeded( DataQueryParams params ); static List<Object> getPeriodOffsetRow( Grid grid, DimensionalItemObject dimItem, String isoPeriod,
        int offset );  }
@Test public void verifyShiftPeriod() { Period p1 = PeriodOffsetUtils.shiftPeriod( createMonthlyPeriod( 2020, 1 ), 12 ); assertThat( p1.getIsoDate(), is( "202101" ) ); Period p2 = PeriodOffsetUtils.shiftPeriod( createQuarterPeriod( 2020, 1 ), 12 ); assertThat( p2.getIsoDate(), is( "2023Q1" ) ); Period p3 = PeriodOffsetUtils.shiftPeriod( createWeeklyType( 2020, 5, 1 ), 2 ); assertThat( p3.getIsoDate(), is( "2020W20" ) ); }