public static String formatTldPKeyAttributes(String separator, CFInternetTldPKey pkey) { String retval = CFLibXmlUtil.formatRequiredInt64(null, "TenantId", pkey.getRequiredTenantId()) + CFLibXmlUtil.formatRequiredInt64(separator, "TldId", pkey.getRequiredTldId()); return (retval); }
public CFInternetTldBuff lockBuff(CFSecurityAuthorization Authorization, CFInternetTldPKey PKey) { final String S_ProcName = "lockBuff"; if (!schema.isTransactionOpen()) { throw CFLib.getDefaultExceptionFactory() .newUsageException(getClass(), S_ProcName, "Transaction not open"); } ResultSet resultSet = null; Connection cnx = schema.getCnx(); CallableStatement stmtLockBuffByPKey = null; try { long TenantId = PKey.getRequiredTenantId(); long TldId = PKey.getRequiredTldId(); stmtLockBuffByPKey = cnx.prepareCall( "begin " + schema.getLowerDbSchemaName() + ".lck_tlddef( ?, ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?" + " ); end;"); int argIdx = 1; stmtLockBuffByPKey.registerOutParameter(argIdx++, OracleTypes.CURSOR); 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++, TldId); stmtLockBuffByPKey.execute(); resultSet = (ResultSet) stmtLockBuffByPKey.getObject(1); if (resultSet == null) { return (null); } try { if (resultSet.next()) { CFInternetTldBuff buff = unpackTldResultSetToBuff(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) { 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; } if (stmtLockBuffByPKey != null) { try { stmtLockBuffByPKey.close(); } catch (SQLException e) { } stmtLockBuffByPKey = null; } } }
public void deleteTldByIdIdx(CFSecurityAuthorization Authorization, CFInternetTldPKey argKey) { deleteTldByIdIdx(Authorization, argKey.getRequiredTenantId(), argKey.getRequiredTldId()); }
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { CFBamXMsgSchemaMessageFormatter schemaFormatter = null; try { // Common XML Attributes String attrId = null; // Primary Key Attributes for Constant Enum support String attrTenantId = null; String attrTldId = null; // Attribute Extraction String attrLocalName; int numAttrs; int idxAttr; final String S_ProcName = "startElement"; final String S_LocalName = "LocalName"; assert qName.equals("RqstTldLock"); CFBamXMsgRqstHandler xmsgRqstHandler = (CFBamXMsgRqstHandler) getParser(); if (xmsgRqstHandler == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()"); } schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); ICFBamSchemaObj schemaObj = xmsgRqstHandler.getSchemaObj(); if (schemaObj == null) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()"); } // Instantiate a PKey buffer for the parsed information CFInternetTldPKey pkey = ((ICFBamSchema) schemaObj.getBackingStore()).getFactoryTld().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("TenantId")) { if (attrTenantId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTenantId = attrs.getValue(idxAttr); } else if (attrLocalName.equals("TldId")) { if (attrTldId != null) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, S_LocalName, attrLocalName); } attrTldId = 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 ((attrTldId == null) || (attrTldId.length() <= 0)) { throw CFLib.getDefaultExceptionFactory() .newNullArgumentException(getClass(), S_ProcName, 0, "TldId"); } // 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 natTldId; natTldId = Long.parseLong(attrTldId); pkey.setRequiredTldId(natTldId); pkey.setRequiredTldId(natTldId); // Lock the object ICFBamTldObj locked = ((ICFBamTldObj) schemaObj.getTldTableObj().lockTld(pkey)); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFBamXMsgTldMessageFormatter.formatTldRspnLocked("\n\t\t\t", locked.getTldBuff()) + "\n" + schemaFormatter.formatRspnXmlPostamble(); ((CFBamXMsgRqstHandler) getParser()).appendResponse(response); } catch (RuntimeException e) { CFBamXMsgRqstHandler xmsgRqstHandler = ((CFBamXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFBamXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } catch (Error e) { CFBamXMsgRqstHandler xmsgRqstHandler = ((CFBamXMsgRqstHandler) getParser()); schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter(); String response = schemaFormatter.formatRspnXmlPreamble() + "\n" + "\t" + CFBamXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e) + "\n" + schemaFormatter.formatRspnXmlPostamble(); xmsgRqstHandler.resetResponse(); xmsgRqstHandler.appendResponse(response); xmsgRqstHandler.setCaughtException(true); } }