public void deleteDomainByIdIdx(long TenantId, long Id) {
   CFInternetDomainBasePKey pkey =
       ((ICFBamSchema) schema.getBackingStore()).getFactoryDomainBase().newPKey();
   pkey.setRequiredTenantId(TenantId);
   pkey.setRequiredId(Id);
   ICFInternetDomainObj obj = readDomain(pkey);
   if (obj != null) {
     ICFInternetDomainEditObj editObj = (ICFInternetDomainEditObj) obj.getEdit();
     boolean editStarted;
     if (editObj == null) {
       editObj = (ICFInternetDomainEditObj) obj.beginEdit();
       if (editObj != null) {
         editStarted = true;
       } else {
         editStarted = false;
       }
     } else {
       editStarted = false;
     }
     if (editObj != null) {
       editObj.delete();
       if (editStarted) {
         editObj.endEdit();
       }
     }
     obj.forget(true);
   }
 }
 public ICFInternetDomainObj readDomainByIdIdx(long TenantId, long Id, boolean forceRead) {
   CFInternetDomainBasePKey pkey =
       ((ICFBamSchema) schema.getBackingStore()).getFactoryDomainBase().newPKey();
   pkey.setRequiredTenantId(TenantId);
   pkey.setRequiredId(Id);
   ICFInternetDomainObj obj = readDomain(pkey, forceRead);
   return (obj);
 }
 public CFInternetTopDomainBuff lockBuff(
     CFSecurityAuthorization Authorization, CFInternetDomainBasePKey PKey) {
   final String S_ProcName = "lockBuff";
   if (!schema.isTransactionOpen()) {
     throw CFLib.getDefaultExceptionFactory()
         .newUsageException(getClass(), S_ProcName, "Transaction not open");
   }
   ResultSet resultSet = null;
   try {
     Connection cnx = schema.getCnx();
     long TenantId = PKey.getRequiredTenantId();
     long Id = PKey.getRequiredId();
     final String sql = "CALL sp_lock_tdomdef( ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " )";
     if (stmtLockBuffByPKey == null) {
       stmtLockBuffByPKey = cnx.prepareStatement(sql);
     }
     int argIdx = 1;
     stmtLockBuffByPKey.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
     stmtLockBuffByPKey.setString(
         argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString());
     stmtLockBuffByPKey.setString(
         argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
     stmtLockBuffByPKey.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
     stmtLockBuffByPKey.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
     stmtLockBuffByPKey.setLong(argIdx++, TenantId);
     stmtLockBuffByPKey.setLong(argIdx++, Id);
     resultSet = stmtLockBuffByPKey.executeQuery();
     if (resultSet.next()) {
       CFInternetTopDomainBuff buff = unpackTopDomainResultSetToBuff(resultSet);
       if (resultSet.next()) {
         resultSet.last();
         throw CFLib.getDefaultExceptionFactory()
             .newRuntimeException(
                 getClass(),
                 S_ProcName,
                 "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
       }
       return (buff);
     } else {
       return (null);
     }
   } catch (SQLException e) {
     throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
   } finally {
     if (resultSet != null) {
       try {
         resultSet.close();
       } catch (SQLException e) {
       }
       resultSet = null;
     }
   }
 }
 public void forgetDomainByIdIdx(long TenantId, long Id) {
   if (members == null) {
     return;
   }
   CFInternetDomainBasePKey key =
       ((ICFBamSchema) schema.getBackingStore()).getFactoryDomainBase().newPKey();
   key.setRequiredTenantId(TenantId);
   key.setRequiredId(Id);
   if (members.containsKey(key)) {
     ICFInternetDomainObj probed = members.get(key);
     if (probed != null) {
       probed.forget(true);
     }
   }
 }
 public ICFInternetDomainObj readDomain(CFInternetDomainBasePKey pkey, boolean forceRead) {
   ICFInternetDomainObj obj = null;
   if ((!forceRead) && members.containsKey(pkey)) {
     obj = members.get(pkey);
   } else {
     CFInternetDomainBuff readBuff =
         ((ICFBamSchema) schema.getBackingStore())
             .getTableDomain()
             .readDerivedByIdIdx(
                 schema.getAuthorization(), pkey.getRequiredTenantId(), pkey.getRequiredId());
     if (readBuff != null) {
       obj =
           (ICFInternetDomainObj)
               schema.getDomainBaseTableObj().constructByClassCode(readBuff.getClassCode());
       obj.setPKey(((ICFBamSchema) schema.getBackingStore()).getFactoryDomainBase().newPKey());
       obj.setBuff(readBuff);
       obj = (ICFInternetDomainObj) obj.realize();
     } else if (schema.getCacheMisses()) {
       members.put(pkey, null);
     }
   }
   return (obj);
 }
  public void startElement(String uri, String localName, String qName, Attributes attrs)
      throws SAXException {
    CFInternetXMsgSchemaMessageFormatter schemaFormatter = null;
    try {
      // Common XML Attributes
      String attrId = null;
      String attrRevision = null;
      // Primary Key Attributes for Constant Enum support
      String attrTenantId = null;
      // Attribute Extraction
      String attrLocalName;
      int numAttrs;
      int idxAttr;
      final String S_ProcName = "startElement";
      final String S_LocalName = "LocalName";

      assert qName.equals("RqstSubProjectDelete");

      CFInternetXMsgRqstHandler xmsgRqstHandler = (CFInternetXMsgRqstHandler) getParser();
      if (xmsgRqstHandler == null) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()");
      }

      schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter();

      ICFInternetSchemaObj schemaObj = xmsgRqstHandler.getSchemaObj();
      if (schemaObj == null) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()");
      }

      // Instantiate a PKey buffer for the parsed information
      CFInternetDomainBasePKey pkey =
          ((ICFInternetSchema) schemaObj.getBackingStore()).getFactoryDomainBase().newPKey();

      // Extract Attributes
      numAttrs = attrs.getLength();
      for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) {
        attrLocalName = attrs.getLocalName(idxAttr);
        if (attrLocalName.equals("Id")) {
          if (attrId != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrId = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("Revision")) {
          if (attrRevision != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrRevision = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("TenantId")) {
          if (attrTenantId != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrTenantId = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("schemaLocation")) {
          // ignored
        } else {
          throw CFLib.getDefaultExceptionFactory()
              .newUnrecognizedAttributeException(
                  getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName);
        }
      }

      // Ensure that required attributes have values
      if ((attrTenantId == null) || (attrTenantId.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "TenantId");
      }
      if ((attrId == null) || (attrId.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "Id");
      }
      if ((attrRevision == null) || (attrRevision.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "Revision");
      }

      // Get current context
      CFLibXmlCoreContext curContext = getParser().getCurContext();
      // Convert string attributes to native Java types
      // and apply the converted attributes to the editBuff.

      long natTenantId;
      natTenantId = Long.parseLong(attrTenantId);
      pkey.setRequiredTenantId(natTenantId);

      pkey.setRequiredTenantId(natTenantId);
      long natId;
      natId = Long.parseLong(attrId);
      pkey.setRequiredId(natId);

      pkey.setRequiredId(natId);
      int natRevision = Integer.parseInt(attrRevision);
      // Delete the object
      ICFInternetSubProjectObj read =
          ((ICFInternetSubProjectObj) schemaObj.getSubProjectTableObj().readSubProject(pkey));
      if (read != null) {
        if (read.getSubProjectBuff().getRequiredRevision() > natRevision) {
          throw CFLib.getDefaultExceptionFactory()
              .newCollisionDetectedException(
                  getClass(), S_ProcName, "Collision detected preparing to delete SubProject");
        } else {
          ICFInternetSubProjectEditObj editBuff = (ICFInternetSubProjectEditObj) read.beginEdit();
          if (editBuff != null) {
            editBuff.delete();
            editBuff.endEdit();
            String response =
                schemaFormatter.formatRspnXmlPreamble()
                    + "\n"
                    + "\t"
                    + CFInternetXMsgSubProjectMessageFormatter.formatSubProjectRspnDeleted()
                    + "\n"
                    + schemaFormatter.formatRspnXmlPostamble();
            ((CFInternetXMsgRqstHandler) getParser()).appendResponse(response);
          } else {
            throw CFLib.getDefaultExceptionFactory()
                .newNullArgumentException(getClass(), S_ProcName, 0, "read.beginEdit()");
          }
        }
      } else {
        String response =
            schemaFormatter.formatRspnXmlPreamble()
                + "\n"
                + "\t"
                + CFInternetXMsgSchemaMessageFormatter.formatRspnNoDataFound()
                + "\n"
                + schemaFormatter.formatRspnXmlPostamble();
        ((CFInternetXMsgRqstHandler) getParser()).appendResponse(response);
      }
    } catch (RuntimeException e) {
      CFInternetXMsgRqstHandler xmsgRqstHandler = ((CFInternetXMsgRqstHandler) getParser());
      schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter();
      String response =
          schemaFormatter.formatRspnXmlPreamble()
              + "\n"
              + "\t"
              + CFInternetXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e)
              + "\n"
              + schemaFormatter.formatRspnXmlPostamble();
      xmsgRqstHandler.resetResponse();
      xmsgRqstHandler.appendResponse(response);
      xmsgRqstHandler.setCaughtException(true);
    } catch (Error e) {
      CFInternetXMsgRqstHandler xmsgRqstHandler = ((CFInternetXMsgRqstHandler) getParser());
      schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter();
      String response =
          schemaFormatter.formatRspnXmlPreamble()
              + "\n"
              + "\t"
              + CFInternetXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e)
              + "\n"
              + schemaFormatter.formatRspnXmlPostamble();
      xmsgRqstHandler.resetResponse();
      xmsgRqstHandler.appendResponse(response);
      xmsgRqstHandler.setCaughtException(true);
    }
  }
 public void deleteTopDomainByIdIdx(
     CFSecurityAuthorization Authorization, CFInternetDomainBasePKey argKey) {
   deleteTopDomainByIdIdx(Authorization, argKey.getRequiredTenantId(), argKey.getRequiredId());
 }