Showing results for 
Search instead for 
Do you mean 
Reply

TC RAC programming. How can i apply saved StoredOptionSet to BOMWindow ?

[ Edited ]

Windows 7 x64;

TC 8.3;

RAC java development (not SOA);

 

Hello,

I have a task to bypass recursively configured BOMLine tree.

 

First i hoped that "SendTo" handler sends expected data from any structure manager to my plugin, but i was wrong.

Now i try to make configuration of BOMLine tree into my plugin, but cant find workable example. Problem comes in a moment of creation Variant Rule, see code below:

 

rootCmpCtxt = ... //our root component

TCSession session = (TCSession) AIFUtility.getCurrentApplication().getSession();
TCClassService classService = session.getClassService();
TCVariantService variantService = session.getVariantService();

//-------------------------------------------------------

//Get all Revision Rules
TCComponent[] RevisionRules = classService.findByClass("RevisionRule", "object_type", "RevisionRule");

/*
user choose necessary revision rule here
TCComponent revision_rule = ...
*/

//Create BOMWindow with root component and revision rule
TCComponentBOMLine boml_cmp = (TCComponentBOMLine) rootCmpCtxt.getComponent();
TCComponentItemRevision item_cmp = (TCComponentItemRevision) boml_cmp.getItem();

TCComponentBOMWindowType bom_window_type = (TCComponentBOMWindowType) session.getTypeComponent("BOMWindow");
TCComponentBOMWindow bom_window = bom_window_type.create(revision_rule);

bom_window.setWindowTopLine(null, item_cmp, null, null);

//-------------------------------------------------------

//Get saved Stored Option Sets in our component
TCComponent[] StoredOptionSets = item_cmp.getStoredOptionSets(null);

/*
user choose necessary stored option sets here
TCComponent StoredOptionSet = ...
*/

//Get "raw data" of StoredOptionSet
StoredOptionValue[] sosVals = variantService.askStoredConfiguration(StoredOptionSet);

//Set "raw data" to new variant rule (in cycle)
    TCComponentVariantRule variantRule = new TCComponentVariantRule();
    variantRule.setOptionValue(sosVals[i].option, sosVals[i].value);

variantRule.apply(bom_window); //-------------------------------------------------------

Proplem appears in penult line

variantRule.setOptionValue(sosVals[i].option, sosVals[i].value);

function expects (TCComponentVariantOption, String), but get (String, String)

and i cant find any roundabout solution.