I have figured this out.
Thanks to David for the handy tip of:
MaturityBaseline baseline = pn.getConfiguration();
So my code to find objects on the promotion request that are not getting promoted and then remove
them from the promotion request's baseline is this:
//pn already set:
//wt.maturity.PromotionNotice pn
//get the objects actually getting promoted
wt.fc.QueryResult pnTargets = wt.maturity.MaturityHelper.service.getPromotionTargets(pn);
//get all the objects on the promotion notice baseline
wt.fc.QueryResult pnBaseLineItems = wt.maturity.MaturityHelper.service.getBaselineItems(pn);
java.util.HashMap<string, wt.epm.epmdocument="> hmPNTargets = new HashMap<string, <br="/>wt.epm.EPMDocument>();//holds Promotion Targets by number
java.util.HashMap<string, wt.epm.epmdocument="> hmPNBaseLineItems = new HashMap<string, <br="/>wt.epm.EPMDocument>();//holds Promotion BaseLineItems by number
//loop thru the BaseLine items and put them in their hashmap
while (pnBaseLineItems.hasMoreElements())
{
Object obj = pnBaseLineItems.nextElement();
EPMDocument epmDoc = (wt.epm.EPMDocument)obj;
hmPNBaseLineItems.put(epmDoc.getNumber(), epmDoc);
}
//loop thru the Promotion targets and put them in their hashmap
while (pnTargets.hasMoreElements())
{
Object obj = pnTargets.nextElement();
EPMDocument epmDoc = (wt.epm.EPMDocument)obj;
hmPNTargets.put(epmDoc.getNumber(), epmDoc);
}
//check to see if we have different number of baselines and promotables
if(hmPNTargets.size() != hmPNBaseLineItems.size())
{
//loop thru baseline objects to delete objects from baseline that are not in the promotable objects
for (Map.Entry<string, wt.epm.epmdocument="> entry : hmPNBaseLineItems.entrySet())
{
String partNumber = entry.getKey();
wt.epm.EPMDocument epmDoc = entry.getValue();
if(hmPNTargets.get(partNumber) == null)
{
//We have a baselines object that does NOT exist in the promotables
//this needs to be removed
wt.vc.baseline.BaselineHelper.service.removeFromBaseline(epmDoc, pnBaseLine);
}
}
}