Search in sources :

Example 1 with DataMetaPacket

use of me.retrodaredevil.solarthing.misc.common.meta.DataMetaPacket in project solarthing by wildmountainfarms.

the class SolarThingGraphQLMetaService method getMeta.

@Nullable
private DataMetaPacket getMeta(PacketNode<? extends DataIdentifiable> packetNode) {
    int fragmentId = packetNode.getFragmentId();
    int dataId = packetNode.getPacket().getDataId();
    MetaDatabase metaDatabase = simpleQueryHandler.queryMeta();
    for (TargetedMetaPacket targetedMetaPacket : metaDatabase.getMeta(packetNode.getDateMillis(), fragmentId)) {
        if (targetedMetaPacket instanceof DataMetaPacket) {
            DataMetaPacket dataMetaPacket = (DataMetaPacket) targetedMetaPacket;
            if (dataMetaPacket.getDataId() == dataId) {
                return dataMetaPacket;
            }
        }
    }
    return null;
}
Also used : MetaDatabase(me.retrodaredevil.solarthing.type.closed.meta.MetaDatabase) TargetedMetaPacket(me.retrodaredevil.solarthing.type.closed.meta.TargetedMetaPacket) DataMetaPacket(me.retrodaredevil.solarthing.misc.common.meta.DataMetaPacket) Nullable(me.retrodaredevil.solarthing.annotations.Nullable)

Aggregations

Nullable (me.retrodaredevil.solarthing.annotations.Nullable)1 DataMetaPacket (me.retrodaredevil.solarthing.misc.common.meta.DataMetaPacket)1 MetaDatabase (me.retrodaredevil.solarthing.type.closed.meta.MetaDatabase)1 TargetedMetaPacket (me.retrodaredevil.solarthing.type.closed.meta.TargetedMetaPacket)1