class PeriodType implements Serializable {

    public static List<Period> getPeriodTypePeriods( Period period, org.hisp.dhis.calendar.Calendar calendar )
    {
        List<Period> periods = new ArrayList<>();

        PeriodType periodType = period.getPeriodType();

        for ( PeriodType type : PeriodType.PERIOD_TYPES )
        {
            if ( periodType.getFrequencyOrder() < type.getFrequencyOrder() || periodType.equals( type ) )
            {
                periods.add( IdentifiableObjectUtils.getPeriodByPeriodType( period, type, calendar ) );
            }
            else
            {
                periods.add( null );
            }
        }

        return periods;
    }

}