Commit a7f9e1f3 authored by Sonia Zorba's avatar Sonia Zorba
Browse files

Improvements on error handling and JavaScript custom updates; bugfix

parent 91e65868
Loading
Loading
Loading
Loading
+9 −11
Original line number Diff line number Diff line
package it.inaf.oats.ia2.tapschemamanager.businesslayer;

import it.inaf.oats.ia2.tapschemamanager.datalayer.TapSchemaEntity;
import java.io.Serializable;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
@@ -11,22 +12,19 @@ import java.util.Map;
 * @author Sonia Zorba <zorba at oats.inaf.it>
 * @param <T>
 */
public abstract class EntityWrapper<T extends TapSchemaEntity> {
public abstract class EntityWrapper<T extends TapSchemaEntity> implements Serializable {

    private T entity;
    private static final long serialVersionUID = -8399058826120891216L;

    private final T entity;
    private final Map<String, String> originalValues;
    private final Map<String, String> editedValues;
    private List<String> supportedKeys;
    private final List<String> supportedKeys;
    private Status status;

    // Only for deserialization
    protected EntityWrapper() {
    public EntityWrapper(T entity, String... supportedKeys) {
        originalValues = new HashMap<String, String>();
        editedValues = new HashMap<String, String>();
    }
    
    public EntityWrapper(T entity, String... supportedKeys) {
        this();
        this.entity = entity;
        this.supportedKeys = Arrays.asList(supportedKeys);
    }
+0 −5
Original line number Diff line number Diff line
@@ -27,11 +27,6 @@ public class Schema extends EntityWrapper<SchemaEntity> implements EntityWrapper
    private String selectedTable;
    private Map<String, Table> tables;

    // Only for deserialization
    protected Schema() {
        super();
    }

    public Schema(TapSchemaHandler tapSchemaHandler, SchemaEntity schemaEntity) throws SQLException {
        super(schemaEntity, UTYPE, DESCRIPTION);

+3 −9
Original line number Diff line number Diff line
@@ -26,15 +26,9 @@ public class Table extends EntityWrapper<TableEntity> implements EntityWrapperCo
    private String selectedColumn;
    private final Map<String, Column> columns;

    private TapSchemaHandler tapSchemaHandler;
    private String schemaName;
    private String tableName;

    // Only for deserialization
    protected Table() {
        super();
        columns = new TreeMap<String, Column>(String.CASE_INSENSITIVE_ORDER);
    }
    private final TapSchemaHandler tapSchemaHandler;
    private final String schemaName;
    private final String tableName;

    public Table(TapSchemaHandler tapSchemaHandler, String schemaName, String tableName, TableEntity tableEntity) throws SQLException {
        super(tableEntity, UTYPE, DESCRIPTION);
+4 −0
Original line number Diff line number Diff line
@@ -164,4 +164,8 @@ public class TapSchema implements EntityWrapperContainer<Schema>, Serializable {
    public Schema getSelectedEntity() {
        return selectedSchema == null ? null : schemas.get(selectedSchema);
    }

    public TapSchemaHandler getTapSchemaHandler() {
        return tapSchemaHandler;
    }
}
+2 −1
Original line number Diff line number Diff line
@@ -80,6 +80,7 @@ public class CredentialsBean implements Serializable {
        try {
            Connection connection = credentials.getConnection();
            connection.close();
            conversation.setTimeout(30 * 60000L); // 30 minutes
            conversation.begin();
            schemaSelectionBean.setCredentials(credentials);
            return "schemaSelection.xhtml?faces-redirect=true";
Loading