package com.capgemini.reports.teamcenter.queries.saved;

import com.capgemini.framework.teamcenter.authent.TcSession;
import com.capgemini.framework.teamcenter.queries.saved.AbstractReplicatedQuery;
import com.teamcenter.soa.client.model.strong.ItemRevision;

/**
 * Queries all ChangeRevisions attached to an object.
 */
public class ChangeRequestR07Query extends AbstractReplicatedQuery<ItemRevision, ChangeRequestR07Query> {

    /**
     * Query name of Teamcenter request.
     */
    private static final String QUERY_SUFFIX_CHANGE_FROM_PART = "ChangeRequest_R07";
    private static final String PARAM_PART_ID = "part_id";
    private static final String PARAM_PART_REVISION = "part_revision";

    /**
     * Constructor to build a Query for ChangeItem objects from a Part.
     *
     * @param session the session for the connection
     */
    public ChangeRequestR07Query(final TcSession session) {
        super(session, QUERY_SUFFIX_CHANGE_FROM_PART);
    }

    @Override
    public ChangeRequestR07Query searchID(final String partId) {
        return this.addParam(AbstractReplicatedQuery.REPCOL_PREFIX + PARAM_PART_ID, partId);
    }


    @Override
    public ChangeRequestR07Query searchRevision(final String partRevision) {
        return this.addParam(AbstractReplicatedQuery.REPCOL_PREFIX + PARAM_PART_REVISION, partRevision);
    }

    @Override
    protected ChangeRequestR07Query selfCast() {
        return this;
    }

}
