*/
private DatabaseFrontend frontend;
+ /**
+ * Session id assigned with this basket, or any other unique identifier
+ */
+ private String sessionId;
+
/**
* Initialize object
*/
this.frontend = frontend;
}
+ /**
+ * Setter for session id
+ *
+ * @param sessionId Session id
+ */
+ @Override
+ public final void setSessionId (final String sessionId) {
+ this.sessionId = sessionId;
+ }
+
+ /**
+ * Getter for session id
+ *
+ * @return Session id
+ */
+ @Override
+ public final String getSessionId () {
+ return this.sessionId;
+ }
+
+ /**
+ * Checks if the bundle is initialized
+ *
+ * @return Whether the bundle has been initialized
+ */
+ protected boolean isBundledInitialized () {
+ // Check it
+ return (bundle instanceof ResourceBundle);
+ }
+
/**
* Initializes i18n bundles
*/
this.getLogger().trace("CALLED!"); //NOI18N
// Is the bundle set?
- if (bundle instanceof ResourceBundle) {
+ if (this.isBundledInitialized()) {
// Is already set
throw new IllegalStateException("called twice"); //NOI18N
}
@Override
public void connectToDatabase () throws SQLException, NamingException {
// Trace message
- this.getLogger().trace("CALLED!");
+ this.getLogger().trace("CALLED!"); //NOI18N
// Is the connection given?
if (null == connection) {
Context context = new InitialContext();
// Get data source instance
- DataSource source = (DataSource) context.lookup(this.getProperty("database.datasource.name"));
+ DataSource source = (DataSource) context.lookup("jdbc/pizza-service"); //NOI18N
// Debug message
- this.getLogger().debug(MessageFormat.format("source={0}", source));
+ this.getLogger().debug(MessageFormat.format("source={0}", source)); //NOI18N
// Now as all access data is stored in data source, get a connection from it
connection = source.getConnection();
// Debug log
- this.getLogger().debug(MessageFormat.format("connection={0}", connection));
+ this.getLogger().debug(MessageFormat.format("connection={0}", connection)); //NOI18N
}
// Debug message
this.totalRows = connection.prepareStatement(String.format("SELECT COUNT(`%s`) AS `cnt` FROM `%s` LIMIT 1", this.getFrontend().getIdName(), this.getTableName())); //NOI18N
// Trace message
- this.getLogger().trace("EXIT!");
+ this.getLogger().trace("EXIT!"); //NOI18N
}
@Override
public Result<? extends Storeable> doInsertDataSet (final Map<String, Object> dataset) throws SQLException, IOException {
- throw new UnsupportedOperationException("Not supported yet: dataset=" + dataset); //To change body of generated methods, choose Tools | Templates.
+ throw new UnsupportedOperationException(MessageFormat.format("Not supported yet: dataset={0}", dataset));
}
@Override
public Result<? extends Storeable> doSelectByCriteria (final SearchableCriteria criteria) throws IOException, BadTokenException, CorruptedDatabaseFileException, SQLException, NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
- throw new UnsupportedOperationException("Not supported yet: criteria=" + criteria); //To change body of generated methods, choose Tools | Templates.
+ throw new UnsupportedOperationException(MessageFormat.format("Not supported yet: criteria={0}", criteria));
}
@Override