DataApprovalWorkflow extends BaseIdentifiableObject implements MetadataObject { public List<DataApprovalLevel> getSortedLevels() { Comparator<DataApprovalLevel> orderByLevelNumber = ( DataApprovalLevel dal1, DataApprovalLevel dal2 ) -> dal1.getLevel() - dal2.getLevel(); List<DataApprovalLevel> sortedLevels = new ArrayList<>( levels ); Collections.sort( sortedLevels, orderByLevelNumber ); return sortedLevels; } DataApprovalWorkflow();  DataApprovalWorkflow( String name );  DataApprovalWorkflow( String name, PeriodType periodType, Set<DataApprovalLevel> levels );  DataApprovalWorkflow( String name, PeriodType periodType,
        CategoryCombo categoryCombo, Set<DataApprovalLevel> levels ); List<DataApprovalLevel> getSortedLevels(); String getSqlCoEndDateExtension(); @JsonProperty @JsonSerialize( using = JacksonPeriodTypeSerializer.class ) @JsonDeserialize( using = JacksonPeriodTypeDeserializer.class ) @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) @Property( PropertyType.TEXT ) PeriodType getPeriodType(); void setPeriodType( PeriodType periodType ); @JsonProperty @JsonSerialize( as = BaseIdentifiableObject.class ) @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) CategoryCombo getCategoryCombo(); void setCategoryCombo( CategoryCombo categoryCombo ); @JsonProperty( "dataApprovalLevels" ) @JsonSerialize( contentAs = BaseIdentifiableObject.class ) @JacksonXmlElementWrapper( localName = "dataApprovalLevels", namespace = DxfNamespaces.DXF_2_0 ) @JacksonXmlProperty( localName = "dataApprovalLevel", namespace = DxfNamespaces.DXF_2_0 ) Set<DataApprovalLevel> getLevels(); void setLevels( Set<DataApprovalLevel> levels ); @JsonProperty @JsonSerialize( contentAs = BaseIdentifiableObject.class ) @JacksonXmlElementWrapper( localName = "dataSets", namespace = DxfNamespaces.DXF_2_0 ) @JacksonXmlProperty( localName = "dataSet", namespace = DxfNamespaces.DXF_2_0 ) Set<DataSet> getDataSets(); void setDataSets( Set<DataSet> dataSets );  }
@Test public void testGetSortedLevels() { DataApprovalLevel level1 = new DataApprovalLevel( "level1", 1, null ); level1.setLevel( 1 ); DataApprovalLevel level2 = new DataApprovalLevel( "level2", 2, null ); level2.setLevel( 2 ); DataApprovalLevel level3 = new DataApprovalLevel( "level3", 3, null ); level3.setLevel( 3 ); DataApprovalWorkflow workflow = new DataApprovalWorkflow( "test workflow", new DailyPeriodType(), newHashSet(level3, level2, level1 ) ); List<DataApprovalLevel> levels = workflow.getSortedLevels(); assertEquals( 1, levels.get( 0 ).getLevel() ); assertEquals( 2, levels.get( 1 ).getLevel() ); assertEquals( 3, levels.get( 2 ).getLevel() ); }