CE-781 Make tie-break for sorting do backends earlier than everything else

This commit is contained in:
2024-01-10 19:52:22 -06:00
parent 5147a022fa
commit fed8cbbb45

View File

@ -95,6 +95,7 @@ public class MetaDataProducerHelper
//////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////
// sort them by sort order, then by the type that they return - specifically - doing apps // // sort them by sort order, then by the type that they return - specifically - doing apps //
// after all other types (as apps often try to get other types from the instance) // // after all other types (as apps often try to get other types from the instance) //
// also - do backends earlier than others (e.g., tables may expect backends to exist) //
//////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////
producers.sort(Comparator producers.sort(Comparator
.comparing((MetaDataProducerInterface<?> p) -> p.getSortOrder()) .comparing((MetaDataProducerInterface<?> p) -> p.getSortOrder())
@ -105,11 +106,15 @@ public class MetaDataProducerHelper
Class<?> outputType = p.getClass().getMethod("produce", QInstance.class).getReturnType(); Class<?> outputType = p.getClass().getMethod("produce", QInstance.class).getReturnType();
if(outputType.equals(QAppMetaData.class)) if(outputType.equals(QAppMetaData.class))
{ {
return (1); return (2);
}
else if(outputType.equals(QBackendMetaData.class))
{
return (0);
} }
else else
{ {
return (0); return (1);
} }
} }
catch(Exception e) catch(Exception e)