package com.capgemini.reports.definition.r26report;

import com.capgemini.framework.teamcenter.authent.TcSession;
import com.capgemini.framework.teamcenter.exceptions.EmptyNomenclatureException;
import com.capgemini.framework.teamcenter.object.types.SnecmaObjectTypes;
import com.capgemini.framework.teamcenter.resolution.filtering.ITcTypeFilter;
import com.capgemini.framework.teamcenter.resolution.filtering.TcTypeInclusionFilter;
import com.capgemini.reports.bomlineholder.BOMLineHolder;
import com.capgemini.reports.teamcenter.resolution.IBOMLineExplorer;
import com.capgemini.reports.teamcenter.resolution.structureservice.SingleStructureServiceCaller;

/**
 * Explorer of {@link BOMLineHolder}s used in {@link SingleStructureServiceCaller} for R26report.<br/>
 * Thanks to this class, the SINGLE resolution structure could carry on and the Part Number could be taken. <br>
 * The Rf Generic is returned, and its children Part Aero / RF Admin and Descriptif are loaded
 */
public class R26BOMLineExplorer implements IBOMLineExplorer {

  private static final ITcTypeFilter FILTER_DESCRIPTION = new TcTypeInclusionFilter(SnecmaObjectTypes.PART_AERO_REVISION,
    SnecmaObjectTypes.PART_NO_AERO_REVISION, SnecmaObjectTypes.PART_ASSEMB_REVISION, SnecmaObjectTypes.PART_MAT_REVISION,
    SnecmaObjectTypes.DET_REVISION, SnecmaObjectTypes.STANDARD_REVISION, SnecmaObjectTypes.ALTERNATE_REVISION,
    SnecmaObjectTypes.RF_GENERIC_REVISION, SnecmaObjectTypes.RF_PART_ASSEMB_REVISION, SnecmaObjectTypes.RF_ADMIN_REVISION,
    SnecmaObjectTypes.RF_PART_REVISION, SnecmaObjectTypes.RF_ADMIN_AG_REVISION, SnecmaObjectTypes.RF_ADMIN_AP_REVISION);

  public BOMLineHolder explore(TcSession session, final SingleStructureServiceCaller.SingleLevelExpander expander,
                               final BOMLineHolder genericBom) throws EmptyNomenclatureException {
    return expander.expand(genericBom, FILTER_DESCRIPTION);
  }
}
