package com.mycom.workflowtemplatefilter; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Vector; import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JLabel; import javax.swing.JPanel; import com.teamcenter.rac.aif.AbstractAIFDialog; import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent; import com.teamcenter.rac.kernel.TCComponentTaskTemplate; import com.teamcenter.rac.kernel.TCComponentType; import com.teamcenter.rac.kernel.TCSession; import com.teamcenter.rac.kernel.TypeInfo; import com.teamcenter.rac.util.ButtonLayout; import com.teamcenter.rac.util.HorizontalLayout; import com.teamcenter.rac.util.MessageBox; import com.teamcenter.rac.util.Separator; import com.teamcenter.rac.util.VerticalLayout; import com.teamcenter.rac.workflow.commands.newprocess.ITemplateFilter; import com.teamcenter.rac.workflow.commands.newprocess.NoCustomFilteringRequiredException; public class CustomFilter implements ITemplateFilter { // Define the Teamcenter session TCSession session; // Define two lists of template public Vector allTasktemplates = new Vector(); public Vector assignedTasktemplates = new Vector(); // Define a variable for the release_status_list of the first workflow item / revision public String FirstReleaseStatus = ""; public String CurrentRole = ""; InterfaceAIFComponent[] pasteTargets = null; boolean cancelButtonClicked = false; public CustomFilter() { // TODO Auto-generated constructor stub } // Initiate the main function to filter the Workflow templates public Vector getFilteredTemplates(Vector alltemplates, Vector Assignedtemplates, InterfaceAIFComponent[] pastetargets, TCSession s)throws NoCustomFilteringRequiredException { allTasktemplates = alltemplates; assignedTasktemplates = Assignedtemplates; session = s; CurrentRole = s.getCurrentRole().toString(); // get the Release Status List from the first Item, pasted to the workflow try { FirstReleaseStatus = pastetargets[0].getProperty("release_status_list"); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } // test if the Release Status List is empty. If it is empty set it to none for the filter if (this.isNullOrBlank(FirstReleaseStatus)) { FirstReleaseStatus = "NONE"; } // define the filtered list Vector templatelist = new Vector (); try { boolean isMatchStatus = false; boolean isMatchRole = false; // define a new list as source for the analysis Vector filtertemplates = new Vector (); // check if the origin template filter is reporting a list. Otherwise check all Templates if(assignedTasktemplates.size() > 0) { filtertemplates = assignedTasktemplates; } else { filtertemplates = allTasktemplates; } // Now cycle all templates for(int i=0;i