public void createLoaderBehaviour(
      CFSecurityAuthorization Authorization, CFDbTestLoaderBehaviourBuff Buff) {
    final String S_ProcName = "createLoaderBehaviour";
    CFDbTestLoaderBehaviourPKey pkey = schema.getFactoryLoaderBehaviour().newPKey();
    pkey.setRequiredId(Buff.getRequiredId());
    Buff.setRequiredId(pkey.getRequiredId());
    CFDbTestLoaderBehaviourByUNameIdxKey keyUNameIdx =
        schema.getFactoryLoaderBehaviour().newUNameIdxKey();
    keyUNameIdx.setRequiredName(Buff.getRequiredName());

    // Validate unique indexes

    if (dictByPKey.containsKey(pkey)) {
      throw CFLib.getDefaultExceptionFactory()
          .newPrimaryKeyNotNewException(getClass(), S_ProcName, pkey);
    }

    if (dictByUNameIdx.containsKey(keyUNameIdx)) {
      throw CFLib.getDefaultExceptionFactory()
          .newUniqueIndexViolationException(
              getClass(), S_ProcName, "LoaderBehaviourUNameIdx", keyUNameIdx);
    }

    // Validate foreign keys

    // Proceed with adding the new record

    dictByPKey.put(pkey, Buff);

    dictByUNameIdx.put(keyUNameIdx, Buff);
  }
  public void createOptFullRange(
      CFSecurityAuthorization Authorization, CFDbTestOptFullRangeBuff Buff) {
    final String S_ProcName = "createOptFullRange";
    CFDbTestOptFullRangePKey pkey = schema.getFactoryOptFullRange().newPKey();
    pkey.setRequiredId(schema.nextOptFullRangeIdGen());
    Buff.setRequiredId(pkey.getRequiredId());
    CFDbTestOptFullRangeByUDescrIdxKey keyUDescrIdx =
        schema.getFactoryOptFullRange().newUDescrIdxKey();
    keyUDescrIdx.setRequiredTenantId(Buff.getRequiredTenantId());
    keyUDescrIdx.setRequiredDescription(Buff.getRequiredDescription());

    CFDbTestOptFullRangeByTenantIdxKey keyTenantIdx =
        schema.getFactoryOptFullRange().newTenantIdxKey();
    keyTenantIdx.setRequiredTenantId(Buff.getRequiredTenantId());

    // Validate unique indexes

    if (dictByPKey.containsKey(pkey)) {
      throw CFLib.getDefaultExceptionFactory()
          .newPrimaryKeyNotNewException(getClass(), S_ProcName, pkey);
    }

    if (dictByUDescrIdx.containsKey(keyUDescrIdx)) {
      throw CFLib.getDefaultExceptionFactory()
          .newUniqueIndexViolationException(
              getClass(), S_ProcName, "OptFullRangeUDescrIdx", keyUDescrIdx);
    }

    // Validate foreign keys

    {
      boolean allNull = true;
      allNull = false;
      if (!allNull) {
        if (null
            == schema
                .getTableTenant()
                .readDerivedByIdIdx(Authorization, Buff.getRequiredTenantId())) {
          throw CFLib.getDefaultExceptionFactory()
              .newUnresolvedRelationException(
                  getClass(), S_ProcName, "Container", "Tenant", "Tenant", null);
        }
      }
    }

    // Proceed with adding the new record

    dictByPKey.put(pkey, Buff);

    dictByUDescrIdx.put(keyUDescrIdx, Buff);

    Map<CFDbTestOptFullRangePKey, CFDbTestOptFullRangeBuff> subdictTenantIdx;
    if (dictByTenantIdx.containsKey(keyTenantIdx)) {
      subdictTenantIdx = dictByTenantIdx.get(keyTenantIdx);
    } else {
      subdictTenantIdx = new HashMap<CFDbTestOptFullRangePKey, CFDbTestOptFullRangeBuff>();
      dictByTenantIdx.put(keyTenantIdx, subdictTenantIdx);
    }
    subdictTenantIdx.put(pkey, Buff);
  }
Ejemplo n.º 3
0
 @Override
 public boolean containsKey(Object key) {
   if (JdbcIndexDefinition.this.identifier.equals(key)) return true;
   if (keys.containsKey(key)) return true;
   check();
   return map.containsKey(key);
 }
 public ICFCrmMemoObj readMemoByUDescrIdx(
     long TenantId, long ContactId, String Description, boolean forceRead) {
   if (indexByUDescrIdx == null) {
     indexByUDescrIdx = new HashMap<CFCrmMemoByUDescrIdxKey, ICFCrmMemoObj>();
   }
   CFCrmMemoByUDescrIdxKey key =
       ((ICFAccSchema) schema.getBackingStore()).getFactoryMemo().newUDescrIdxKey();
   key.setRequiredTenantId(TenantId);
   key.setRequiredContactId(ContactId);
   key.setRequiredDescription(Description);
   ICFCrmMemoObj obj = null;
   if ((!forceRead) && indexByUDescrIdx.containsKey(key)) {
     obj = indexByUDescrIdx.get(key);
   } else {
     CFCrmMemoBuff buff =
         ((ICFAccSchema) schema.getBackingStore())
             .getTableMemo()
             .readDerivedByUDescrIdx(schema.getAuthorization(), TenantId, ContactId, Description);
     if (buff != null) {
       obj = schema.getMemoTableObj().newInstance();
       obj.setPKey(((ICFAccSchema) schema.getBackingStore()).getFactoryMemo().newPKey());
       obj.setBuff(buff);
       obj = (ICFCrmMemoObj) obj.realize();
     } else if (schema.getCacheMisses()) {
       indexByUDescrIdx.put(key, null);
     }
   }
   return (obj);
 }
 public ICFInternetDomainObj readDomainByNameIdx(
     long TenantId, long SubDomainOfId, String Name, boolean forceRead) {
   if (indexByNameIdx == null) {
     indexByNameIdx = new HashMap<CFInternetDomainByNameIdxKey, ICFInternetDomainObj>();
   }
   CFInternetDomainByNameIdxKey key =
       ((ICFBamSchema) schema.getBackingStore()).getFactoryDomain().newNameIdxKey();
   key.setRequiredTenantId(TenantId);
   key.setRequiredSubDomainOfId(SubDomainOfId);
   key.setRequiredName(Name);
   ICFInternetDomainObj obj = null;
   if ((!forceRead) && indexByNameIdx.containsKey(key)) {
     obj = indexByNameIdx.get(key);
   } else {
     CFInternetDomainBuff buff =
         ((ICFBamSchema) schema.getBackingStore())
             .getTableDomain()
             .readDerivedByNameIdx(schema.getAuthorization(), TenantId, SubDomainOfId, Name);
     if (buff != null) {
       obj =
           (ICFInternetDomainObj)
               schema.getDomainBaseTableObj().constructByClassCode(buff.getClassCode());
       obj.setPKey(((ICFBamSchema) schema.getBackingStore()).getFactoryDomainBase().newPKey());
       obj.setBuff(buff);
       obj = (ICFInternetDomainObj) obj.realize();
     } else if (schema.getCacheMisses()) {
       indexByNameIdx.put(key, null);
     }
   }
   return (obj);
 }
 public ICFSecurityISOCountryObj readISOCountryByNameIdx(String Name, boolean forceRead) {
   if (indexByNameIdx == null) {
     indexByNameIdx = new HashMap<CFSecurityISOCountryByNameIdxKey, ICFSecurityISOCountryObj>();
   }
   CFSecurityISOCountryByNameIdxKey key =
       ((ICFInternetSchema) schema.getBackingStore()).getFactoryISOCountry().newNameIdxKey();
   key.setRequiredName(Name);
   ICFSecurityISOCountryObj obj = null;
   if ((!forceRead) && indexByNameIdx.containsKey(key)) {
     obj = indexByNameIdx.get(key);
   } else {
     CFSecurityISOCountryBuff buff =
         ((ICFInternetSchema) schema.getBackingStore())
             .getTableISOCountry()
             .readDerivedByNameIdx(schema.getAuthorization(), Name);
     if (buff != null) {
       obj = schema.getISOCountryTableObj().newInstance();
       obj.setPKey(
           ((ICFInternetSchema) schema.getBackingStore()).getFactoryISOCountry().newPKey());
       obj.setBuff(buff);
       obj = (ICFSecurityISOCountryObj) obj.realize();
     } else if (schema.getCacheMisses()) {
       indexByNameIdx.put(key, null);
     }
   }
   return (obj);
 }
 public ICFBamClearTopDepObj readClearTopDepByUNameIdx(
     long TenantId, long ContTableId, String Name, boolean forceRead) {
   if (indexByUNameIdx == null) {
     indexByUNameIdx = new HashMap<CFBamClearTopDepByUNameIdxKey, ICFBamClearTopDepObj>();
   }
   CFBamClearTopDepByUNameIdxKey key =
       schema.getBackingStore().getFactoryClearTopDep().newUNameIdxKey();
   key.setRequiredTenantId(TenantId);
   key.setRequiredContTableId(ContTableId);
   key.setRequiredName(Name);
   ICFBamClearTopDepObj obj = null;
   if ((!forceRead) && indexByUNameIdx.containsKey(key)) {
     obj = indexByUNameIdx.get(key);
   } else {
     CFBamClearTopDepBuff buff =
         schema
             .getBackingStore()
             .getTableClearTopDep()
             .readDerivedByUNameIdx(schema.getAuthorization(), TenantId, ContTableId, Name);
     if (buff != null) {
       obj =
           (ICFBamClearTopDepObj)
               schema.getScopeTableObj().constructByClassCode(buff.getClassCode());
       obj.setPKey(schema.getBackingStore().getFactoryScope().newPKey());
       obj.setBuff(buff);
       obj = (ICFBamClearTopDepObj) obj.realize();
     } else if (schema.getCacheMisses()) {
       indexByUNameIdx.put(key, null);
     }
   }
   return (obj);
 }
 public ICFSecuritySecAppObj readSecAppByUJEEMountIdx(
     long ClusterId, String JEEMountName, boolean forceRead) {
   if (indexByUJEEMountIdx == null) {
     indexByUJEEMountIdx = new HashMap<CFSecuritySecAppByUJEEMountIdxKey, ICFSecuritySecAppObj>();
   }
   CFSecuritySecAppByUJEEMountIdxKey key =
       ((ICFCrmSchema) schema.getBackingStore()).getFactorySecApp().newUJEEMountIdxKey();
   key.setRequiredClusterId(ClusterId);
   key.setRequiredJEEMountName(JEEMountName);
   ICFSecuritySecAppObj obj = null;
   if ((!forceRead) && indexByUJEEMountIdx.containsKey(key)) {
     obj = indexByUJEEMountIdx.get(key);
   } else {
     CFSecuritySecAppBuff buff =
         ((ICFCrmSchema) schema.getBackingStore())
             .getTableSecApp()
             .readDerivedByUJEEMountIdx(schema.getAuthorization(), ClusterId, JEEMountName);
     if (buff != null) {
       obj = schema.getSecAppTableObj().newInstance();
       obj.setPKey(((ICFCrmSchema) schema.getBackingStore()).getFactorySecApp().newPKey());
       obj.setBuff(buff);
       obj = (ICFSecuritySecAppObj) obj.realize();
     } else if (schema.getCacheMisses()) {
       indexByUJEEMountIdx.put(key, null);
     }
   }
   return (obj);
 }
 public void deleteTSecGroupMemberByUUserIdx(long TenantId, int TSecGroupId, UUID SecUserId) {
   if (indexByUUserIdx == null) {
     indexByUUserIdx =
         new HashMap<CFSecurityTSecGroupMemberByUUserIdxKey, ICFSecurityTSecGroupMemberObj>();
   }
   CFSecurityTSecGroupMemberByUUserIdxKey key =
       ((ICFCrmSchema) schema.getBackingStore()).getFactoryTSecGroupMember().newUUserIdxKey();
   key.setRequiredTenantId(TenantId);
   key.setRequiredTSecGroupId(TSecGroupId);
   key.setRequiredSecUserId(SecUserId);
   ICFSecurityTSecGroupMemberObj obj = null;
   if (indexByUUserIdx.containsKey(key)) {
     obj = indexByUUserIdx.get(key);
     ((ICFCrmSchema) schema.getBackingStore())
         .getTableTSecGroupMember()
         .deleteTSecGroupMemberByUUserIdx(
             schema.getAuthorization(), TenantId, TSecGroupId, SecUserId);
     obj.forget(true);
   } else {
     ((ICFCrmSchema) schema.getBackingStore())
         .getTableTSecGroupMember()
         .deleteTSecGroupMemberByUUserIdx(
             schema.getAuthorization(), TenantId, TSecGroupId, SecUserId);
   }
 }
 public ICFAccTaxObj readTaxByUNameIdx(long TenantId, String Name, boolean forceRead) {
   if (indexByUNameIdx == null) {
     indexByUNameIdx = new HashMap<CFAccTaxByUNameIdxKey, ICFAccTaxObj>();
   }
   CFAccTaxByUNameIdxKey key =
       ((ICFAccSchema) schema.getBackingStore()).getFactoryTax().newUNameIdxKey();
   key.setRequiredTenantId(TenantId);
   key.setRequiredName(Name);
   ICFAccTaxObj obj = null;
   if ((!forceRead) && indexByUNameIdx.containsKey(key)) {
     obj = indexByUNameIdx.get(key);
   } else {
     CFAccTaxBuff buff =
         ((ICFAccSchema) schema.getBackingStore())
             .getTableTax()
             .readDerivedByUNameIdx(schema.getAuthorization(), TenantId, Name);
     if (buff != null) {
       obj = schema.getTaxTableObj().newInstance();
       obj.setPKey(((ICFAccSchema) schema.getBackingStore()).getFactoryTax().newPKey());
       obj.setBuff(buff);
       obj = (ICFAccTaxObj) obj.realize();
     } else if (schema.getCacheMisses()) {
       indexByUNameIdx.put(key, null);
     }
   }
   return (obj);
 }
 public ICFSecuritySecGroupIncludeObj readSecGroupInclude(
     CFSecuritySecGroupIncludePKey pkey, boolean forceRead) {
   ICFSecuritySecGroupIncludeObj obj = null;
   if ((!forceRead) && members.containsKey(pkey)) {
     obj = members.get(pkey);
   } else {
     CFSecuritySecGroupIncludeBuff readBuff =
         ((ICFInternetSchema) schema.getBackingStore())
             .getTableSecGroupInclude()
             .readDerivedByIdIdx(
                 schema.getAuthorization(),
                 pkey.getRequiredClusterId(),
                 pkey.getRequiredSecGroupIncludeId());
     if (readBuff != null) {
       obj = schema.getSecGroupIncludeTableObj().newInstance();
       obj.setPKey(
           ((ICFInternetSchema) schema.getBackingStore()).getFactorySecGroupInclude().newPKey());
       obj.setBuff(readBuff);
       obj = (ICFSecuritySecGroupIncludeObj) obj.realize();
     } else if (schema.getCacheMisses()) {
       members.put(pkey, null);
     }
   }
   return (obj);
 }
  public void forgetSecDevice(ICFSecuritySecDeviceObj Obj, boolean forgetSubObjects) {
    ICFSecuritySecDeviceObj obj = Obj;
    CFSecuritySecDevicePKey pkey = obj.getPKey();
    if (members.containsKey(pkey)) {
      ICFSecuritySecDeviceObj keepObj = members.get(pkey);
      // Detach object from alternate, duplicate, all and PKey indexes

      if (indexByUserIdx != null) {
        CFSecuritySecDeviceByUserIdxKey keyUserIdx =
            ((ICFSecuritySchema) schema.getBackingStore()).getFactorySecDevice().newUserIdxKey();
        keyUserIdx.setRequiredSecUserId(keepObj.getRequiredSecUserId());
        Map<CFSecuritySecDevicePKey, ICFSecuritySecDeviceObj> mapUserIdx =
            indexByUserIdx.get(keyUserIdx);
        if (mapUserIdx != null) {
          mapUserIdx.remove(keepObj.getPKey());
        }
      }

      if (allSecDevice != null) {
        allSecDevice.remove(keepObj.getPKey());
      }
      members.remove(pkey);
      if (forgetSubObjects) {}
    }
  }
 public void deleteSecGroupIncludeByUIncludeIdx(
     long ClusterId, int SecGroupId, int IncludeGroupId) {
   if (indexByUIncludeIdx == null) {
     indexByUIncludeIdx =
         new HashMap<CFSecuritySecGroupIncludeByUIncludeIdxKey, ICFSecuritySecGroupIncludeObj>();
   }
   CFSecuritySecGroupIncludeByUIncludeIdxKey key =
       ((ICFInternetSchema) schema.getBackingStore())
           .getFactorySecGroupInclude()
           .newUIncludeIdxKey();
   key.setRequiredClusterId(ClusterId);
   key.setRequiredSecGroupId(SecGroupId);
   key.setRequiredIncludeGroupId(IncludeGroupId);
   ICFSecuritySecGroupIncludeObj obj = null;
   if (indexByUIncludeIdx.containsKey(key)) {
     obj = indexByUIncludeIdx.get(key);
     ((ICFInternetSchema) schema.getBackingStore())
         .getTableSecGroupInclude()
         .deleteSecGroupIncludeByUIncludeIdx(
             schema.getAuthorization(), ClusterId, SecGroupId, IncludeGroupId);
     obj.forget(true);
   } else {
     ((ICFInternetSchema) schema.getBackingStore())
         .getTableSecGroupInclude()
         .deleteSecGroupIncludeByUIncludeIdx(
             schema.getAuthorization(), ClusterId, SecGroupId, IncludeGroupId);
   }
 }
Ejemplo n.º 14
0
 @Override
 public String get(Object key) {
   if (JdbcIndexDefinition.this.identifier.equals(key)) return identifier;
   if (keys.containsKey(key)) return keys.get(key);
   check();
   return map.get(key);
 }
  public void forgetServiceType(ICFSecurityServiceTypeObj Obj, boolean forgetSubObjects) {
    ICFSecurityServiceTypeObj obj = Obj;
    CFSecurityServiceTypePKey pkey = obj.getPKey();
    if (members.containsKey(pkey)) {
      ICFSecurityServiceTypeObj keepObj = members.get(pkey);
      // Detach object from alternate, duplicate, all and PKey indexes

      if (indexByUDescrIdx != null) {
        CFSecurityServiceTypeByUDescrIdxKey keyUDescrIdx =
            ((ICFAccSchema) schema.getBackingStore()).getFactoryServiceType().newUDescrIdxKey();
        keyUDescrIdx.setRequiredDescription(keepObj.getRequiredDescription());
        indexByUDescrIdx.remove(keyUDescrIdx);
      }

      if (allServiceType != null) {
        allServiceType.remove(keepObj.getPKey());
      }
      members.remove(pkey);
      if (forgetSubObjects) {
        ((ICFSecuritySchemaObj) schema)
            .getServiceTableObj()
            .forgetServiceByTypeIdx(keepObj.getRequiredServiceTypeId());
      }
    }
  }
 public ICFSecurityTSecGroupMemberObj readTSecGroupMember(
     CFSecurityTSecGroupMemberPKey pkey, boolean forceRead) {
   ICFSecurityTSecGroupMemberObj obj = null;
   if ((!forceRead) && members.containsKey(pkey)) {
     obj = members.get(pkey);
   } else {
     CFSecurityTSecGroupMemberBuff readBuff =
         ((ICFCrmSchema) schema.getBackingStore())
             .getTableTSecGroupMember()
             .readDerivedByIdIdx(
                 schema.getAuthorization(),
                 pkey.getRequiredTenantId(),
                 pkey.getRequiredTSecGroupMemberId());
     if (readBuff != null) {
       obj = schema.getTSecGroupMemberTableObj().newInstance();
       obj.setPKey(
           ((ICFCrmSchema) schema.getBackingStore()).getFactoryTSecGroupMember().newPKey());
       obj.setBuff(readBuff);
       obj = (ICFSecurityTSecGroupMemberObj) obj.realize();
     } else if (schema.getCacheMisses()) {
       members.put(pkey, null);
     }
   }
   return (obj);
 }
 public ICFSecurityTSecGroupMemberObj readTSecGroupMemberByUUserIdx(
     long TenantId, int TSecGroupId, UUID SecUserId, boolean forceRead) {
   if (indexByUUserIdx == null) {
     indexByUUserIdx =
         new HashMap<CFSecurityTSecGroupMemberByUUserIdxKey, ICFSecurityTSecGroupMemberObj>();
   }
   CFSecurityTSecGroupMemberByUUserIdxKey key =
       ((ICFCrmSchema) schema.getBackingStore()).getFactoryTSecGroupMember().newUUserIdxKey();
   key.setRequiredTenantId(TenantId);
   key.setRequiredTSecGroupId(TSecGroupId);
   key.setRequiredSecUserId(SecUserId);
   ICFSecurityTSecGroupMemberObj obj = null;
   if ((!forceRead) && indexByUUserIdx.containsKey(key)) {
     obj = indexByUUserIdx.get(key);
   } else {
     CFSecurityTSecGroupMemberBuff buff =
         ((ICFCrmSchema) schema.getBackingStore())
             .getTableTSecGroupMember()
             .readDerivedByUUserIdx(schema.getAuthorization(), TenantId, TSecGroupId, SecUserId);
     if (buff != null) {
       obj = schema.getTSecGroupMemberTableObj().newInstance();
       obj.setPKey(
           ((ICFCrmSchema) schema.getBackingStore()).getFactoryTSecGroupMember().newPKey());
       obj.setBuff(buff);
       obj = (ICFSecurityTSecGroupMemberObj) obj.realize();
     } else if (schema.getCacheMisses()) {
       indexByUUserIdx.put(key, null);
     }
   }
   return (obj);
 }
Ejemplo n.º 18
0
  public boolean validateParameters(
      List<ReportParameterMap> reportParameters, Map<String, Object> parameters)
      throws ProviderException {
    parameters = new SingleValueMap(parameters);

    if (reportParameters != null && reportParameters.size() > 0) {
      Iterator<ReportParameterMap> iterator = reportParameters.iterator();
      while (iterator.hasNext()) {
        ReportParameterMap rpMap = iterator.next();

        ReportParameter param = rpMap.getReportParameter();

        if (!parameters.containsKey(param.getName()) && rpMap.isRequired()) {
          throw new ProviderException(LocalStrings.ERROR_PARAMETER_REQUIRED);
        }

        if (param.getType().equals(ReportParameter.TEXT_PARAM)
            || param.getType().equals(ReportParameter.DATE_PARAM)) {
          String value = (String) parameters.get(param.getName());

          if (value != null && value.length() > 0) {
            try {
              validateParameter(param, value);
            } catch (Exception e) {
              throw new ProviderException(e.getMessage());
            }
          } else if (rpMap.isRequired()) {
            throw new ProviderException(LocalStrings.ERROR_PARAMETER_REQUIRED);
          }
        }
      }
    }

    return true;
  }
  public void forgetTax(ICFAccTaxObj Obj, boolean forgetSubObjects) {
    ICFAccTaxObj obj = Obj;
    CFAccTaxPKey pkey = obj.getPKey();
    if (members.containsKey(pkey)) {
      ICFAccTaxObj keepObj = members.get(pkey);
      // Detach object from alternate, duplicate, all and PKey indexes

      if (indexByTenantIdx != null) {
        CFAccTaxByTenantIdxKey keyTenantIdx =
            ((ICFAccSchema) schema.getBackingStore()).getFactoryTax().newTenantIdxKey();
        keyTenantIdx.setRequiredTenantId(keepObj.getRequiredTenantId());
        Map<CFAccTaxPKey, ICFAccTaxObj> mapTenantIdx = indexByTenantIdx.get(keyTenantIdx);
        if (mapTenantIdx != null) {
          mapTenantIdx.remove(keepObj.getPKey());
        }
      }

      if (indexByUNameIdx != null) {
        CFAccTaxByUNameIdxKey keyUNameIdx =
            ((ICFAccSchema) schema.getBackingStore()).getFactoryTax().newUNameIdxKey();
        keyUNameIdx.setRequiredTenantId(keepObj.getRequiredTenantId());
        keyUNameIdx.setRequiredName(keepObj.getRequiredName());
        indexByUNameIdx.remove(keyUNameIdx);
      }

      if (allTax != null) {
        allTax.remove(keepObj.getPKey());
      }
      members.remove(pkey);
      if (forgetSubObjects) {}
    }
  }
 public ICFSecurityISOCountryCurrencyObj readISOCountryCurrency(
     CFSecurityISOCountryCurrencyPKey pkey, boolean forceRead) {
   ICFSecurityISOCountryCurrencyObj obj = null;
   if ((!forceRead) && members.containsKey(pkey)) {
     obj = members.get(pkey);
   } else {
     CFSecurityISOCountryCurrencyBuff readBuff =
         ((ICFInternetSchema) schema.getBackingStore())
             .getTableISOCountryCurrency()
             .readDerivedByIdIdx(
                 schema.getAuthorization(),
                 pkey.getRequiredISOCountryId(),
                 pkey.getRequiredISOCurrencyId());
     if (readBuff != null) {
       obj = schema.getISOCountryCurrencyTableObj().newInstance();
       obj.setPKey(
           ((ICFInternetSchema) schema.getBackingStore())
               .getFactoryISOCountryCurrency()
               .newPKey());
       obj.setBuff(readBuff);
       obj = (ICFSecurityISOCountryCurrencyObj) obj.realize();
     } else if (schema.getCacheMisses()) {
       members.put(pkey, null);
     }
   }
   return (obj);
 }
Ejemplo n.º 21
0
  /**
   * This adds a special check for exceptions that occured because the session is down. In this
   * case, the error count will not be increased so that the message will be resent when the session
   * comes back up.
   *
   * @param e Exception
   * @param queueMessage QueueMessage
   * @param queue MessageQueue
   * @throws QueueException
   */
  public void handleError(Exception e, QueueMessage queueMessage, MessageQueue queue)
      throws QueueException {

    if (e instanceof ConnectivityDownException) {

      // The session is down. Set the error message, but do not
      // increment the error count.
      NPACMessageType message = (NPACMessageType) queueMessage;
      NPACQueueUtils.updateLastErrorMessage(message.getInvokeID().toString(), e.getMessage());

    } else {

      if (Debug.isLevelEnabled(Debug.MSG_STATUS)) {
        Debug.log(
            Debug.MSG_STATUS,
            "NPACConsumerPolicy, handleError(), Before removing REGION ID...queueMessage.getValues():-"
                + queueMessage.getValues());
      }

      Map queueMessageValues = queueMessage.getValues();

      if (queueMessageValues.containsKey("REGIONID")) {
        queueMessageValues.remove("REGIONID");
        queueMessage.setValues(queueMessageValues);
      }

      if (Debug.isLevelEnabled(Debug.MSG_STATUS)) {
        Debug.log(
            Debug.MSG_STATUS,
            "NPACConsumerPolicy, handleError(), After removing REGION ID...queueMessage.getValues():-"
                + queueMessage.getValues());
      }
      super.handleError(e, queueMessage, queue);
    }
  }
 public ICFSecurityServiceTypeObj readServiceTypeByUDescrIdx(
     String Description, boolean forceRead) {
   if (indexByUDescrIdx == null) {
     indexByUDescrIdx =
         new HashMap<CFSecurityServiceTypeByUDescrIdxKey, ICFSecurityServiceTypeObj>();
   }
   CFSecurityServiceTypeByUDescrIdxKey key =
       ((ICFAccSchema) schema.getBackingStore()).getFactoryServiceType().newUDescrIdxKey();
   key.setRequiredDescription(Description);
   ICFSecurityServiceTypeObj obj = null;
   if ((!forceRead) && indexByUDescrIdx.containsKey(key)) {
     obj = indexByUDescrIdx.get(key);
   } else {
     CFSecurityServiceTypeBuff buff =
         ((ICFAccSchema) schema.getBackingStore())
             .getTableServiceType()
             .readDerivedByUDescrIdx(schema.getAuthorization(), Description);
     if (buff != null) {
       obj = schema.getServiceTypeTableObj().newInstance();
       obj.setPKey(((ICFAccSchema) schema.getBackingStore()).getFactoryServiceType().newPKey());
       obj.setBuff(buff);
       obj = (ICFSecurityServiceTypeObj) obj.realize();
     } else if (schema.getCacheMisses()) {
       indexByUDescrIdx.put(key, null);
     }
   }
   return (obj);
 }
 public ICFSecuritySecGroupIncludeObj readSecGroupIncludeByUIncludeIdx(
     long ClusterId, int SecGroupId, int IncludeGroupId, boolean forceRead) {
   if (indexByUIncludeIdx == null) {
     indexByUIncludeIdx =
         new HashMap<CFSecuritySecGroupIncludeByUIncludeIdxKey, ICFSecuritySecGroupIncludeObj>();
   }
   CFSecuritySecGroupIncludeByUIncludeIdxKey key =
       ((ICFInternetSchema) schema.getBackingStore())
           .getFactorySecGroupInclude()
           .newUIncludeIdxKey();
   key.setRequiredClusterId(ClusterId);
   key.setRequiredSecGroupId(SecGroupId);
   key.setRequiredIncludeGroupId(IncludeGroupId);
   ICFSecuritySecGroupIncludeObj obj = null;
   if ((!forceRead) && indexByUIncludeIdx.containsKey(key)) {
     obj = indexByUIncludeIdx.get(key);
   } else {
     CFSecuritySecGroupIncludeBuff buff =
         ((ICFInternetSchema) schema.getBackingStore())
             .getTableSecGroupInclude()
             .readDerivedByUIncludeIdx(
                 schema.getAuthorization(), ClusterId, SecGroupId, IncludeGroupId);
     if (buff != null) {
       obj = schema.getSecGroupIncludeTableObj().newInstance();
       obj.setPKey(
           ((ICFInternetSchema) schema.getBackingStore()).getFactorySecGroupInclude().newPKey());
       obj.setBuff(buff);
       obj = (ICFSecuritySecGroupIncludeObj) obj.realize();
     } else if (schema.getCacheMisses()) {
       indexByUIncludeIdx.put(key, null);
     }
   }
   return (obj);
 }
 private void removeMaintenanceTimer(int idAset) {
   if (maintenanceTimer.containsKey(idAset)) {
     maintenanceTimer.get(idAset).cancel();
     maintenanceTimer.get(idAset).purge();
     maintenanceTimer.remove(idAset);
   }
 }
  public void forgetSecGroupInclude(ICFGenKbSecGroupIncludeObj Obj, boolean forgetSubObjects) {
    ICFGenKbSecGroupIncludeObj obj = Obj;
    CFGenKbSecGroupIncludePKey pkey = obj.getPKey();
    if (members.containsKey(pkey)) {
      ICFGenKbSecGroupIncludeObj keepObj = members.get(pkey);
      // Detach object from alternate, duplicate, all and PKey indexes

      if (indexByClusterIdx != null) {
        CFGenKbSecGroupIncludeByClusterIdxKey keyClusterIdx =
            schema.getBackingStore().getFactorySecGroupInclude().newClusterIdxKey();
        keyClusterIdx.setRequiredClusterId(keepObj.getRequiredClusterId());
        Map<CFGenKbSecGroupIncludePKey, ICFGenKbSecGroupIncludeObj> mapClusterIdx =
            indexByClusterIdx.get(keyClusterIdx);
        if (mapClusterIdx != null) {
          mapClusterIdx.remove(keepObj.getPKey());
        }
      }

      if (indexByGroupIdx != null) {
        CFGenKbSecGroupIncludeByGroupIdxKey keyGroupIdx =
            schema.getBackingStore().getFactorySecGroupInclude().newGroupIdxKey();
        keyGroupIdx.setRequiredClusterId(keepObj.getRequiredClusterId());
        keyGroupIdx.setRequiredSecGroupId(keepObj.getRequiredSecGroupId());
        Map<CFGenKbSecGroupIncludePKey, ICFGenKbSecGroupIncludeObj> mapGroupIdx =
            indexByGroupIdx.get(keyGroupIdx);
        if (mapGroupIdx != null) {
          mapGroupIdx.remove(keepObj.getPKey());
        }
      }

      if (indexByIncludeIdx != null) {
        CFGenKbSecGroupIncludeByIncludeIdxKey keyIncludeIdx =
            schema.getBackingStore().getFactorySecGroupInclude().newIncludeIdxKey();
        keyIncludeIdx.setRequiredClusterId(keepObj.getRequiredClusterId());
        keyIncludeIdx.setRequiredIncludeGroupId(keepObj.getRequiredIncludeGroupId());
        Map<CFGenKbSecGroupIncludePKey, ICFGenKbSecGroupIncludeObj> mapIncludeIdx =
            indexByIncludeIdx.get(keyIncludeIdx);
        if (mapIncludeIdx != null) {
          mapIncludeIdx.remove(keepObj.getPKey());
        }
      }

      if (indexByUIncludeIdx != null) {
        CFGenKbSecGroupIncludeByUIncludeIdxKey keyUIncludeIdx =
            schema.getBackingStore().getFactorySecGroupInclude().newUIncludeIdxKey();
        keyUIncludeIdx.setRequiredClusterId(keepObj.getRequiredClusterId());
        keyUIncludeIdx.setRequiredSecGroupId(keepObj.getRequiredSecGroupId());
        keyUIncludeIdx.setRequiredIncludeGroupId(keepObj.getRequiredIncludeGroupId());
        indexByUIncludeIdx.remove(keyUIncludeIdx);
      }

      if (allSecGroupInclude != null) {
        allSecGroupInclude.remove(keepObj.getPKey());
      }
      members.remove(pkey);
      if (forgetSubObjects) {}
    }
  }
  public void forgetTSecGroupMember(ICFSecurityTSecGroupMemberObj Obj, boolean forgetSubObjects) {
    ICFSecurityTSecGroupMemberObj obj = Obj;
    CFSecurityTSecGroupMemberPKey pkey = obj.getPKey();
    if (members.containsKey(pkey)) {
      ICFSecurityTSecGroupMemberObj keepObj = members.get(pkey);
      // Detach object from alternate, duplicate, all and PKey indexes

      if (indexByTenantIdx != null) {
        CFSecurityTSecGroupMemberByTenantIdxKey keyTenantIdx =
            ((ICFCrmSchema) schema.getBackingStore()).getFactoryTSecGroupMember().newTenantIdxKey();
        keyTenantIdx.setRequiredTenantId(keepObj.getRequiredTenantId());
        Map<CFSecurityTSecGroupMemberPKey, ICFSecurityTSecGroupMemberObj> mapTenantIdx =
            indexByTenantIdx.get(keyTenantIdx);
        if (mapTenantIdx != null) {
          mapTenantIdx.remove(keepObj.getPKey());
        }
      }

      if (indexByGroupIdx != null) {
        CFSecurityTSecGroupMemberByGroupIdxKey keyGroupIdx =
            ((ICFCrmSchema) schema.getBackingStore()).getFactoryTSecGroupMember().newGroupIdxKey();
        keyGroupIdx.setRequiredTenantId(keepObj.getRequiredTenantId());
        keyGroupIdx.setRequiredTSecGroupId(keepObj.getRequiredTSecGroupId());
        Map<CFSecurityTSecGroupMemberPKey, ICFSecurityTSecGroupMemberObj> mapGroupIdx =
            indexByGroupIdx.get(keyGroupIdx);
        if (mapGroupIdx != null) {
          mapGroupIdx.remove(keepObj.getPKey());
        }
      }

      if (indexByUserIdx != null) {
        CFSecurityTSecGroupMemberByUserIdxKey keyUserIdx =
            ((ICFCrmSchema) schema.getBackingStore()).getFactoryTSecGroupMember().newUserIdxKey();
        keyUserIdx.setRequiredSecUserId(keepObj.getRequiredSecUserId());
        Map<CFSecurityTSecGroupMemberPKey, ICFSecurityTSecGroupMemberObj> mapUserIdx =
            indexByUserIdx.get(keyUserIdx);
        if (mapUserIdx != null) {
          mapUserIdx.remove(keepObj.getPKey());
        }
      }

      if (indexByUUserIdx != null) {
        CFSecurityTSecGroupMemberByUUserIdxKey keyUUserIdx =
            ((ICFCrmSchema) schema.getBackingStore()).getFactoryTSecGroupMember().newUUserIdxKey();
        keyUUserIdx.setRequiredTenantId(keepObj.getRequiredTenantId());
        keyUUserIdx.setRequiredTSecGroupId(keepObj.getRequiredTSecGroupId());
        keyUUserIdx.setRequiredSecUserId(keepObj.getRequiredSecUserId());
        indexByUUserIdx.remove(keyUUserIdx);
      }

      if (allTSecGroupMember != null) {
        allTSecGroupMember.remove(keepObj.getPKey());
      }
      members.remove(pkey);
      if (forgetSubObjects) {}
    }
  }
  public void createISOLanguage(
      CFSecurityAuthorization Authorization, CFSecurityISOLanguageBuff Buff) {
    final String S_ProcName = "createISOLanguage";
    CFSecurityISOLanguagePKey pkey = schema.getFactoryISOLanguage().newPKey();
    pkey.setRequiredISOLanguageId(schema.nextISOLanguageIdGen());
    Buff.setRequiredISOLanguageId(pkey.getRequiredISOLanguageId());
    CFSecurityISOLanguageByCode3IdxKey keyCode3Idx =
        schema.getFactoryISOLanguage().newCode3IdxKey();
    keyCode3Idx.setRequiredISO6392Code(Buff.getRequiredISO6392Code());

    CFSecurityISOLanguageByCode2IdxKey keyCode2Idx =
        schema.getFactoryISOLanguage().newCode2IdxKey();
    keyCode2Idx.setOptionalISO6391Code(Buff.getOptionalISO6391Code());

    // Validate unique indexes

    if (dictByPKey.containsKey(pkey)) {
      throw CFLib.getDefaultExceptionFactory()
          .newPrimaryKeyNotNewException(getClass(), S_ProcName, pkey);
    }

    if (dictByCode3Idx.containsKey(keyCode3Idx)) {
      throw CFLib.getDefaultExceptionFactory()
          .newUniqueIndexViolationException(
              getClass(), S_ProcName, "ISOLanguage6392Idx", keyCode3Idx);
    }

    // Validate foreign keys

    // Proceed with adding the new record

    dictByPKey.put(pkey, Buff);

    dictByCode3Idx.put(keyCode3Idx, Buff);

    Map<CFSecurityISOLanguagePKey, CFSecurityISOLanguageBuff> subdictCode2Idx;
    if (dictByCode2Idx.containsKey(keyCode2Idx)) {
      subdictCode2Idx = dictByCode2Idx.get(keyCode2Idx);
    } else {
      subdictCode2Idx = new HashMap<CFSecurityISOLanguagePKey, CFSecurityISOLanguageBuff>();
      dictByCode2Idx.put(keyCode2Idx, subdictCode2Idx);
    }
    subdictCode2Idx.put(pkey, Buff);
  }
Ejemplo n.º 28
0
  public void parseInputFile(File inputFile) throws IOException {
    geneFeatures.clear();
    otherRecords.clear();

    try {
      GFFEntrySet gffEntries = GFFTools.readGFF(inputFile);

      Iterator itr = gffEntries.lineIterator();
      int count = 0;
      int intronFeatures = 0;
      LinkedList<GFFRecord> cdsRecs = new LinkedList<GFFRecord>();

      while (itr.hasNext()) {
        Object val = itr.next();
        if (val instanceof GFFRecord) {
          GFFRecord rec = (GFFRecord) val;
          count += 1;

          if (rec.getFeature().endsWith("gene")) {
            GeneFeatures gf = new GeneFeatures(rec);
            geneFeatures.put(gf.id, gf);
          } else if (rec.getFeature().equals("CDS")) {
            cdsRecs.addLast(rec);
          } else {
            otherRecords.add(rec);
          }
        }
      }

      for (GFFRecord rec : cdsRecs) {
        Map<String, List<String>> attrs = decodeAttrMap(rec);
        if (geneFeatures.containsKey(attrs.get("Parent").get(0))) {
          geneFeatures.get(attrs.get("Parent").get(0)).addCDS(rec, attrs);
        } else {
          System.err.println("Unknown CDS Parent: " + attrs.get("Parent").get(0));
        }
      }

      for (String k : geneFeatures.keySet()) {
        GeneFeatures gf = geneFeatures.get(k);
        if (gf.cds != null && gf.cds.size() > 1) {
          intronFeatures++;
        }
      }

      System.err.println("# GFF Records: " + count);
      System.err.println("# Gene Feature Sets: " + geneFeatures.size());
      System.err.println("\t# Intron-Features: " + intronFeatures);

    } catch (ParserException e) {
      e.printStackTrace();
    } catch (BioException e) {
      e.printStackTrace();
    }
  }
  public void createCluster(CFSecurityAuthorization Authorization, CFSecurityClusterBuff Buff) {
    final String S_ProcName = "createCluster";
    CFSecurityClusterPKey pkey = schema.getFactoryCluster().newPKey();
    pkey.setRequiredId(schema.nextClusterIdGen());
    Buff.setRequiredId(pkey.getRequiredId());
    CFSecurityClusterByUDomainNameIdxKey keyUDomainNameIdx =
        schema.getFactoryCluster().newUDomainNameIdxKey();
    keyUDomainNameIdx.setRequiredFullDomainName(Buff.getRequiredFullDomainName());

    CFSecurityClusterByUDescrIdxKey keyUDescrIdx = schema.getFactoryCluster().newUDescrIdxKey();
    keyUDescrIdx.setRequiredDescription(Buff.getRequiredDescription());

    // Validate unique indexes

    if (dictByPKey.containsKey(pkey)) {
      throw CFLib.getDefaultExceptionFactory()
          .newPrimaryKeyNotNewException(getClass(), S_ProcName, pkey);
    }

    if (dictByUDomainNameIdx.containsKey(keyUDomainNameIdx)) {
      throw CFLib.getDefaultExceptionFactory()
          .newUniqueIndexViolationException(
              getClass(), S_ProcName, "ClusterUDomainNameIdx", keyUDomainNameIdx);
    }

    if (dictByUDescrIdx.containsKey(keyUDescrIdx)) {
      throw CFLib.getDefaultExceptionFactory()
          .newUniqueIndexViolationException(
              getClass(), S_ProcName, "ClusterUDescrNameIdx", keyUDescrIdx);
    }

    // Validate foreign keys

    // Proceed with adding the new record

    dictByPKey.put(pkey, Buff);

    dictByUDomainNameIdx.put(keyUDomainNameIdx, Buff);

    dictByUDescrIdx.put(keyUDescrIdx, Buff);
  }
  public void createISOCurrency(CFBamAuthorization Authorization, CFBamISOCurrencyBuff Buff) {
    final String S_ProcName = "createISOCurrency";
    CFBamISOCurrencyPKey pkey = schema.getFactoryISOCurrency().newPKey();
    pkey.setRequiredId(Buff.getRequiredId());
    Buff.setRequiredId(pkey.getRequiredId());
    CFBamISOCurrencyByCcyCdIdxKey keyCcyCdIdx = schema.getFactoryISOCurrency().newCcyCdIdxKey();
    keyCcyCdIdx.setRequiredISOCode(Buff.getRequiredISOCode());

    CFBamISOCurrencyByCcyNmIdxKey keyCcyNmIdx = schema.getFactoryISOCurrency().newCcyNmIdxKey();
    keyCcyNmIdx.setRequiredName(Buff.getRequiredName());

    // Validate unique indexes

    if (dictByPKey.containsKey(pkey)) {
      throw CFLib.getDefaultExceptionFactory()
          .newPrimaryKeyNotNewException(getClass(), S_ProcName, pkey);
    }

    if (dictByCcyCdIdx.containsKey(keyCcyCdIdx)) {
      throw CFLib.getDefaultExceptionFactory()
          .newUniqueIndexViolationException(
              getClass(), S_ProcName, "ISOCurrencyCodeIdx", keyCcyCdIdx);
    }

    if (dictByCcyNmIdx.containsKey(keyCcyNmIdx)) {
      throw CFLib.getDefaultExceptionFactory()
          .newUniqueIndexViolationException(
              getClass(), S_ProcName, "ISOCurrencyNameIdx", keyCcyNmIdx);
    }

    // Validate foreign keys

    // Proceed with adding the new record

    dictByPKey.put(pkey, Buff);

    dictByCcyCdIdx.put(keyCcyCdIdx, Buff);

    dictByCcyNmIdx.put(keyCcyNmIdx, Buff);
  }