Advertisement
Guest User

Untitled

a guest
Sep 3rd, 2019
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Groovy 5.36 KB | None | 0 0
  1. package ProcessManagement.CommonScripts.TUK.HLR_Subscription;
  2. import com.comarch.oss.sf.model.api.IOrderItem ;
  3. import com.comarch.oss.sf.model.api.order.IOrderItemExt;
  4. import com.comarch.oss.sf.model.ServiceState;
  5.  
  6. log.debug "############################";
  7. log.debug "ENTERED mtas_binding"
  8.  
  9. foi = binder.getOrderItem();
  10. Map<String, String> attr = foi.getService().getProductSpecCharacteristic();
  11. String useCase = foi.getOrder().getOrderAdditionalParameter().get("useCase");
  12. Map<String, String> orderItemAdditionalParameter  = foi.getOrderItemAdditionalParameter();
  13. excludedOIAsyncUseCaseList = ["CREATE_LDAP_ENTRY_ASYNC", "UPDATE_LDAP_ENTRY_ASYNC"];
  14. String oIAsyncUseCase = foi.getOrderItemAdditionalParameter().get("oIAsyncUseCase")
  15.  
  16. def imsSubOrderItem = foi.getService().getProductSpecCharacteristic();
  17. String actionType = foi.getAction();
  18. def mapAttr = [
  19.         "service-profile-identity" :""];
  20.  
  21. String VOLTE_ORIGINATING_SYSTEM = "VOLTE";
  22.  
  23. def isVolte = { IOrderItemExt oi ->
  24.     return oi.getOrder().getSystemUser().getOriginatingSystem().equals(VOLTE_ORIGINATING_SYSTEM)};
  25.  
  26.  
  27. if (isVolte(foi) ) {
  28.     log.debug "Binding mtas script for VoLTE STARTED";
  29.     if(actionType.equals("PROVISION")){
  30.         if(!attr.get("profile").equals(null)&&!attr.get("profile").equals(" ")&&!attr.get("profile").equals("")){
  31.             int profile = attr.get("profile").toInteger();
  32.             if(profile>=30 && profile<=36){
  33.                 def bindEntry = binder.createBinder();
  34.                 bindEntry.bindCharacteristic("service-profile-identity", "sip:profile"+attr.get("profile")+"@o2.co.uk");
  35.             }
  36.         }
  37.         log.debug "Binding mtas PROVISION FINISHED";
  38.     } else if (actionType.equals("MODIFY") && !excludedOIAsyncUseCaseList.contains(oIAsyncUseCase) && !"SET:LDAPSUB".equals(useCase)){
  39.         Map<String, String> attrOrgin = foi.getService().getOrigin().getProductSpecCharacteristic();
  40.         if (useCase.equals("SET")){
  41.             def rootService = foi.getService();
  42.             def type = rootService.getProductSpecCharacteristic().get("subscription-type");
  43.             if(!attr.get("profile").equals(null)&&!attr.get("profile").equals(" ")&&!attr.get("profile").equals("")){
  44.                 int prof = attr.get("profile").toInteger();
  45.                 if(prof<30 || prof>36){
  46.                     if(binder.getBindingService()!=null){
  47.                         if(binder.getBindingService().getState() != ServiceState.RESERVED ) {
  48.                             def bindEntry = binder.createBinder();
  49.                             bindEntry.bindOrderItemAttribute("Action","reserve");
  50.                             def rfsAttr = binder.getBindingService().getProductSpecCharacteristic();
  51.                             rfsAttr.each{
  52.                                 bindEntry.bindCharacteristic(it.key, it.value);
  53.                             }
  54.                         }
  55.                     }
  56.                 }
  57.                 if( !attrOrgin.get("profile").equals(attr.get("profile")) && !attr.get("profile")?.trim().equals("") || binder.getBindingService().getState() == ServiceState.RESERVED ){
  58.                     def profOrginProfile = attrOrgin.get("profile");
  59.                     if(prof>=30 && prof<=36){
  60.                         def bindEntry = binder.createBinder();
  61.                         if (binder.getBindingService() == null || binder.getBindingService().getState() == ServiceState.RESERVED){
  62.                             bindEntry.bindOrderItemAttribute("Action","provision");
  63.                         } else if (profOrginProfile!=null){
  64.                             if(profOrginProfile.toInteger()<30||profOrginProfile.toInteger()>36){
  65.                                 bindEntry.bindOrderItemAttribute("Action","provision");
  66.                             }
  67.                         }
  68.                         bindEntry.bindCharacteristic("service-profile-identity", "sip:profile"+attr.get("profile")+"@o2.co.uk");
  69.                     }
  70.                 }
  71.             }
  72.         }
  73.         if( useCase.equals("DOWNGRADE3G") || useCase.equals("DOWNGRADE4G")) {
  74.             if (binder.getBindingService() != null){
  75.                 def bindEntry = binder.createBinder();
  76.                 bindEntry.bindOrderItemAttribute("Action","reserve");
  77.                 mapAttr.each{
  78.                     bindEntry.bindCharacteristic(it.key, "");
  79.                 }
  80.             }
  81.         }
  82.         if((useCase.equals("UPGRADE3G") || useCase.equals("UPGRADE4G"))&&(orderItemAdditionalParameter.containsKey("profile"))) {
  83.             if(!orderItemAdditionalParameter.get("profile").equals("")){
  84.                 int profile = orderItemAdditionalParameter.get("profile").toInteger();
  85.                 if(profile>=30 && profile<=36){
  86.                     def bindEntry = binder.createBinder();
  87.                     bindEntry.bindOrderItemAttribute("Action","provision");
  88.                     bindEntry.bindCharacteristic("service-profile-identity", "sip:profile"+attr.get("profile")+"@o2.co.uk");
  89.                 }
  90.             }
  91.         }
  92.         log.debug "Binding mtas MODIFY FINISHED";
  93.     } else if (actionType.equals("TERMINATE")){
  94.         if (binder.getBindingService() != null){
  95.             def bindEntry = binder.createBinder();
  96.         }
  97.         log.debug "Binding mtas TERMIANATE FINISHED";
  98.     }else {
  99.         log.debug "Binding mtas UNDONE";
  100.     }
  101.     log.debug "############################";
  102. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement