@Override public int getUpdateCount() { if (result.length == 0) { throw new CayenneRuntimeException("No update results"); } if (result.length == 1) { return result[0]; } throw new CayenneRuntimeException("This result is a batch update"); }
@Override public String toString() { return super.toString() + System.getProperty("line.separator") + this.result; } }
message = new PositionException(); message.setE(e); if (e.getCause() != null) { message.setMessage(e.getCause().getMessage()); message.setLength(message.getImage().length()); } catch (Exception e1) { throw new CayenneRuntimeException(e1); message.setMessage(e.getUnlabeledMessage());
public String getMessage() { StringBuffer buffer = new StringBuffer(); buffer.append("Can't delete object"); if (object != null && object.getObjectId() != null) { buffer.append(" with OID ").append(object.getObjectId()); } if (relationship != null) { buffer.append(". Reason: relationship '").append(relationship).append( "' has 'deny' delete rule"); } String message = super.getUnlabeledMessage(); if (message != null) { buffer.append(". Details: ").append(message); } return buffer.toString(); } }
/** * Returns descriptive message for this exception. */ @Override public String getMessage() { StringBuffer buffer = new StringBuffer(super.getMessage()); if (querySQL != null) { buffer.append(", SQL: [").append(querySQL.trim()).append("]"); } if (!qualifierSnapshot.isEmpty()) { buffer.append(", WHERE clause bindings: ["); Iterator it = qualifierSnapshot.entrySet().iterator(); while (it.hasNext()) { Map.Entry entry = (Map.Entry) it.next(); buffer.append(entry.getKey()).append("="); buffer.append(entry.getValue()); if (it.hasNext()) { buffer.append(", "); } } buffer.append("]"); } return buffer.toString(); }
@Override public String getMessage() { StringBuilder buffer = new StringBuilder(); buffer.append("Can't delete object"); if (object != null && object.getObjectId() != null) { buffer.append(" with OID ").append(object.getObjectId()); } if (relationship != null) { buffer.append(". Reason: relationship '").append(relationship).append( "' has 'deny' delete rule"); } String message = super.getUnlabeledMessage(); if (message != null) { buffer.append(". Details: ").append(message); } return buffer.toString(); } }
/** * Returns descriptive message for this exception. */ public String getMessage() { StringBuffer buffer = new StringBuffer(super.getMessage()); if (querySQL != null) { buffer.append(", SQL: [").append(querySQL.trim()).append("]"); } if (!qualifierSnapshot.isEmpty()) { buffer.append(", WHERE clause bindings: ["); Iterator it = qualifierSnapshot.entrySet().iterator(); while (it.hasNext()) { Map.Entry entry = (Map.Entry) it.next(); buffer.append(entry.getKey()).append("="); QueryLogger.sqlLiteralForObject(buffer, entry.getValue()); if (it.hasNext()) { buffer.append(", "); } } buffer.append("]"); } return buffer.toString(); } }
@Override public void nextGlobalException(Exception ex) { throw new CayenneRuntimeException(ex); } }
JOptionPane.showMessageDialog(this.getView(), exception.getUnlabeledMessage()); return null;
public String toString() { return super.toString() + System.getProperty("line.separator") + this.result; } }
@Override public boolean startUnknownPrefetch(PrefetchTreeNode node) { throw new CayenneRuntimeException("Unknown prefetch node: %s", node); } }
/** * Retrieves a stream to be used to write Ascii characters to the <code>CLOB</code> * value that this <code>Clob</code> object represents, starting at position * <code>pos</code>. * <p> * Calling this method always throws an <code>SQLException</code>. */ public java.io.OutputStream setAsciiStream(long pos) throws SQLException { throw new CayenneRuntimeException("Not supported"); }
/** * Returns a DataContext that holds this object. Object becomes assocaiated with a * DataContext either when the object is fetched using a query, or when a new object * is registered explicitly with a DataContext. */ public DataContext getDataContext() { if (objectContext == null || objectContext instanceof DataContext) { return (DataContext) objectContext; } throw new CayenneRuntimeException("ObjectContext is not a DataContext: " + objectContext); }
/** * Writes the given Java <code>String</code> to the <code>CLOB</code> value that * this <code>Clob</code> object designates at the position <code>pos</code>. * Calling this method always throws an <code>SQLException</code>. */ public int setString(long pos, String str) throws SQLException { throw new CayenneRuntimeException("Not supported"); }
/** * Retrieves a stream to be used to write a stream of Unicode characters to the * <code>CLOB</code> value that this <code>Clob</code> object represents, at * position <code>pos</code>. * <p> * Calling this method always throws an <code>SQLException</code>. */ public java.io.Writer setCharacterStream(long pos) throws SQLException { throw new CayenneRuntimeException("Not supported"); }
/** * <p>This method allows the setting of the escape character. * The escape character can be used in a LIKE clause. The * character 0 signifies no escape character. The escape * character '?' is disallowed.</p> */ public void setEscapeChar(char value) { if ('?' == value) throw new CayenneRuntimeException("the use of the '?' as an escape character in LIKE clauses is disallowed."); escapeChar = value; }
/** * Writes <code>len</code> characters of <code>str</code>, starting at character * <code>offset</code>, to the <code>CLOB</code> value that this * <code>Clob</code> represents. Calling this method always throws an * <code>SQLException</code>. */ public int setString(long pos, String str, int offset, int len) throws SQLException { throw new CayenneRuntimeException("Not supported"); }
/** * Writes <code>len</code> characters of <code>str</code>, starting at character * <code>offset</code>, to the <code>CLOB</code> value that this * <code>Clob</code> represents. Calling this method always throws an * <code>SQLException</code>. */ public int setString(long pos, String str, int offset, int len) throws SQLException { throw new CayenneRuntimeException("Not supported"); }
/** * Throws an exception as execution should've been delegated to the queries contained * in the chain. */ public SQLAction createSQLAction(SQLActionVisitor visitor) { throw new CayenneRuntimeException("Chain doesn't support its own execution " + "and should've been split into separate queries during routing phase."); }
/** * Constructs a new MemoryBlob instance wrapping the given octet sequence. * * @param data the octet sequence representing the Blob value * @throws CayenneRuntimeException if the argument is null */ public MemoryBlob(byte[] data) { if (data == null) { throw new CayenneRuntimeException("Null data"); } this.data = data; }