private void populateEPersonFromTableRow(EPerson eperson, TableRow row) { UUID uuid = UUID.fromString(row.getStringColumn("uuid")); for (EPersonMetadataField f : EPersonMetadataField.values()) { eperson.setMetadata(f, row.getStringColumn(f.toString())); } eperson.setIdentifier(new ObjectIdentifier(uuid)); eperson.setCanLogIn(row.getBooleanColumn("can_log_in")); eperson.setRequireCertificate(row.getBooleanColumn("require_certificate")); eperson.setSelfRegistered(row.getBooleanColumn("self_registered")); }
private void populateItemFromTableRow(Item item, TableRow row) { UUID uuid = UUID.fromString(row.getStringColumn("uuid")); int submitterId = row.getIntColumn("submitter_id"); int owningCollectionId = row.getIntColumn("owning_collection"); boolean inArchive = row.getBooleanColumn("in_archive"); boolean withdrawn = row.getBooleanColumn("withdrawn"); Date lastModified = row.getDateColumn("last_modified"); item.setIdentifier(new ObjectIdentifier(uuid)); item.setSubmitter(submitterId); item.setOwningCollectionId(owningCollectionId); item.setArchived(inArchive); item.setWithdrawn(withdrawn); item.setLastModified(lastModified); }
/** Return the list of running applications. */ public static List<AbstractDSpaceWebapp> getApps() { ArrayList<AbstractDSpaceWebapp> apps = new ArrayList<AbstractDSpaceWebapp>(); TableRowIterator tri; Context context = null; HttpMethod request = null; try { context = new Context(); tri = DatabaseManager.queryTable(context, "Webapp", "SELECT * FROM Webapp"); for (TableRow row : tri.toList()) { DSpaceWebapp app = new DSpaceWebapp(); app.kind = row.getStringColumn("AppName"); app.url = row.getStringColumn("URL"); app.started = row.getDateColumn("Started"); app.uiQ = row.getBooleanColumn("isUI"); HttpClient client = new HttpClient(); request = new HeadMethod(app.url); int status = client.executeMethod(request); request.getResponseBody(); if (status != HttpStatus.SC_OK) { DatabaseManager.delete(context, row); context.commit(); continue; } apps.add(app); } } catch (SQLException e) { log.error("Unable to list running applications", e); } catch (HttpException e) { log.error("Failure checking for a running webapp", e); } catch (IOException e) { log.error("Failure checking for a running webapp", e); } finally { if (null != request) { request.releaseConnection(); } if (null != context) { context.abort(); } } return apps; }
private static void loadParameters( PreparedStatement statement, Collection<ColumnInfo> columns, TableRow row) throws SQLException { int count = 0; for (ColumnInfo info : columns) { count++; String column = info.getCanonicalizedName(); int jdbctype = info.getType(); if (row.isColumnNull(column)) { statement.setNull(count, jdbctype); } else { switch (jdbctype) { case Types.BOOLEAN: case Types.BIT: statement.setBoolean(count, row.getBooleanColumn(column)); break; case Types.INTEGER: if (isOracle) { statement.setLong(count, row.getLongColumn(column)); } else { statement.setInt(count, row.getIntColumn(column)); } break; case Types.NUMERIC: case Types.DECIMAL: statement.setLong(count, row.getLongColumn(column)); // FIXME should be BigDecimal if TableRow supported that break; case Types.BIGINT: statement.setLong(count, row.getLongColumn(column)); break; case Types.CLOB: if (isOracle) { // Support CLOBs in place of TEXT columns in Oracle statement.setString(count, row.getStringColumn(column)); } else { throw new IllegalArgumentException("Unsupported JDBC type: " + jdbctype); } break; case Types.VARCHAR: statement.setString(count, row.getStringColumn(column)); break; case Types.DATE: statement.setDate(count, new java.sql.Date(row.getDateColumn(column).getTime())); break; case Types.TIME: statement.setTime(count, new Time(row.getDateColumn(column).getTime())); break; case Types.TIMESTAMP: statement.setTimestamp(count, new Timestamp(row.getDateColumn(column).getTime())); break; default: throw new IllegalArgumentException("Unsupported JDBC type: " + jdbctype); } } } }
public boolean isPublishedBefore() { return wfRow.getBooleanColumn("published_before"); }
public boolean hasMultipleTitles() { return wfRow.getBooleanColumn("multiple_titles"); }