public static NucleusDataStoreException wrapDatastoreFailureException( DatastoreFailureException e) { // could be a transient error so don't mark fatal return new NucleusDataStoreException("Datastore Failure", e); }
/** * Constructs a primary key information object from the current row of the given result set. * The {@link ResultSet} object passed must have been obtained from a call * to java.sql.DatabaseMetaData.getPrimaryKeys(). * @param rs The result set returned from java.sql.DatabaseMetaData.getPrimaryKeys(). * @exception NucleusDataStoreException if an exception occurs during retrieval */ public PrimaryKeyInfo(ResultSet rs) { try { addProperty("table_cat", rs.getString(1)); addProperty("table_schem", rs.getString(2)); addProperty("table_name", rs.getString(3)); addProperty("column_name", rs.getString(4)); addProperty("key_seq", Short.valueOf(rs.getShort(5))); addProperty("pk_name", rs.getString(6)); } catch (SQLException e) { throw new NucleusDataStoreException("Can't read JDBC metadata from result set", e).setFatal(); } }
static NucleusDataStoreException wrapConcurrentModificationException( ConcurrentModificationException e) { // do not mark fatal return new NucleusDataStoreException("Concurrent Modification", e); }
/** * Retrieves the Force.com object (SObject) for the given parent. * * @param parent Object * @return the Force.com object (SObject) corresponding to the given parent */ public synchronized SObject getParentSObject(Object parent) { SObject parentSObject; if (pcToSObject == null || (parentSObject = pcToSObject.get(parent)) == null) { throw new NucleusDataStoreException("Parent entity has not been saved"); } return parentSObject; }
/** * Retrieves the Force.com object (SObject) for the given parent. * * @param parent Object * @return the Force.com object (SObject) corresponding to the given parent */ public synchronized SObject getParentSObject(Object parent) { SObject parentSObject; if (pcToSObject == null || (parentSObject = pcToSObject.get(parent)) == null) { throw new NucleusDataStoreException("Parent entity has not been saved"); } return parentSObject; }
private char fetchCharField() { if (attr == null) { return ' '; } try { return attr.get(0).toString().charAt(0); } catch (NamingException e) { throw new NucleusDataStoreException(e.getMessage(), e); } }
private byte fetchByteField() { if (attr == null) { return 0; } try { return Byte.valueOf(attr.get(0).toString()).byteValue(); } catch (NamingException e) { throw new NucleusDataStoreException(e.getMessage(), e); } }
private double fetchDoubleField() { if (attr == null) { return 0; } try { return Double.valueOf(attr.get(0).toString()).doubleValue(); } catch (NamingException e) { throw new NucleusDataStoreException(e.getMessage(), e); } }
private short fetchShortField() { if (attr == null) { return 0; } try { return Short.valueOf(attr.get(0).toString()).shortValue(); } catch (NamingException e) { throw new NucleusDataStoreException(e.getMessage(), e); } }
private int fetchIntField() { if (attr == null) { return 0; } try { return Integer.valueOf(attr.get(0).toString()).intValue(); } catch (NamingException e) { throw new NucleusDataStoreException(e.getMessage(), e); } }
private long fetchLongField() { if (attr == null) { return 0; } try { return Long.valueOf(attr.get(0).toString()).longValue(); } catch (NamingException e) { throw new NucleusDataStoreException(e.getMessage(), e); } }
protected int fetchIntField(Attribute attr) { if (attr == null) { return 0; } try { return Integer.valueOf(attr.get(0).toString()).intValue(); } catch (NamingException e) { throw new NucleusDataStoreException(e.getMessage(), e); } }
protected long fetchLongField(Attribute attr) { if (attr == null) { return 0; } try { return Long.valueOf(attr.get(0).toString()).longValue(); } catch (NamingException e) { throw new NucleusDataStoreException(e.getMessage(), e); } }
private float fetchFloatField() { if (attr == null) { return 0; } try { return Float.valueOf(attr.get(0).toString()).floatValue(); } catch (NamingException e) { throw new NucleusDataStoreException(e.getMessage(), e); } }
protected float fetchFloatField(Attribute attr) { if (attr == null) { return 0; } try { return Float.valueOf(attr.get(0).toString()).floatValue(); } catch (NamingException e) { throw new NucleusDataStoreException(e.getMessage(), e); } }
protected short fetchShortField(Attribute attr) { if (attr == null) { return 0; } try { return Short.valueOf(attr.get(0).toString()).shortValue(); } catch (NamingException e) { throw new NucleusDataStoreException(e.getMessage(), e); } }
protected char fetchCharField(Attribute attr) { if (attr == null) { return ' '; } try { return attr.get(0).toString().charAt(0); } catch (NamingException e) { throw new NucleusDataStoreException(e.getMessage(), e); } }
@Override public void setSavepoint(String name) { try { Savepoint sp = ((Connection)conn).setSavepoint(name); if (savepoints == null) { savepoints = new HashMap<>(); } savepoints.put(name, sp); } catch (SQLException sqle) { throw new NucleusDataStoreException("Exception setting savepoint " + name, sqle); } }
public void setShort(PreparedStatement ps, int param, short value) { try { ps.setShort(param, value); } catch (SQLException e) { throw new NucleusDataStoreException(Localiser.msg("055001", "short", "" + value, column, e.getMessage()), e); } }
public void setLong(PreparedStatement ps, int param, long value) { try { ps.setLong(param, value); } catch (SQLException e) { throw new NucleusDataStoreException(Localiser.msg("055001", "short", "" + value, column, e.getMessage()), e); } }