import com.alu.e3.data.model.sub.TdrStaticRule;
import com.alu.e3.tdr.TDRDataService;
public class TdrProcessorHelper {
public static void processTdrRules(Exchange exchange, ExtractFromType efType, boolean doStatic){
AuthIdentity identity = (AuthIdentity) exchange.getProperty(ExchangeConstantKeys.E3_AUTH_IDENTITY.toString());
if (identity == null) return;
@SuppressWarnings("unchecked")
Map<String, String> properties = (Map<String,String>) exchange.getProperty(ExchangeConstantKeys.E3_MODEL_PROPERTIES.toString());
if(properties == null)
properties = new HashMap<String, String>();
// First add the TDRs from the API
Api api = identity.getApi();
if (api != null)
if(doStatic)
processTdrGenerationRuleStatic(api.getTdrGenerationRule(), exchange, properties);
else
processTdrGenerationRuleDynamic(api.getTdrGenerationRule(), exchange, properties, efType);
// Next add all of the tdr values for the Policies
Iterator<CallDescriptor> it = identity.getCallDescriptors().iterator();
while(it.hasNext()){
CallDescriptor cd = it.next();
Policy policy = cd.getPolicy();
if(policy != null){
if(doStatic)
processTdrGenerationRuleStatic(policy.getTdrGenerationRule(), exchange, properties);
else
processTdrGenerationRuleDynamic(policy.getTdrGenerationRule(), exchange, properties, efType);
}
}
// Finally add the values from the Auth
Auth auth = identity.getAuth();
if(auth != null)
if(doStatic)
processTdrGenerationRuleStatic(auth.getTdrGenerationRule(), exchange, properties);
else
processTdrGenerationRuleDynamic(auth.getTdrGenerationRule(), exchange, properties, efType);