Commit 40dd5f4a authored by Sara Bertocco's avatar Sara Bertocco
Browse files

New working version after Victoria trip - new version more generic

parent a0a8ae7b
Loading
Loading
Loading
Loading
+95 −38
Original line number Diff line number Diff line
/**_____________________________________________________________________________
/**
 * _____________________________________________________________________________
 *
 *                                 OATS - INAF
 *  Osservatorio Astronomico di Tireste - Istituto Nazionale di Astrofisica
@@ -21,60 +22,116 @@
 * along with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 * _____________________________________________________________________________
 **/
 *
 */
package it.inaf.oats.vospacebackend.implementation;

import java.util.HashMap;


public class FileRecord {

    private static final String stored_file_name   = "stored_file_name";
    private static final String md5_checksum       = "md5_checksum"; 
    private static final String relative_path      = "relative_path";  
    private static final String nodeID             = "nodeID";       
    //private static final String stored_file_name = "stored_file_name";
    //private static final String md5_checksum = "md5_checksum";
    //private static final String relative_path = "relative_path";
    //private static final String nodeID = "nodeID";
    //private static final String operationSuccessful = "ifSuccessful";
    
    private HashMap content = new HashMap<String, String>();
    private  String stored_file_name_value;
    private  String md5_checksum_value;
    private  String relative_path_value;
    private  String nodeID_value;
    private  boolean operationSuccessful_value;

    public FileRecord() { 
        
        content.put(stored_file_name, "");
        content.put(md5_checksum, "");
        content.put(relative_path, "");
        content.put(nodeID, "");
        stored_file_name_value = "";
        md5_checksum_value = "";
        relative_path_value = "";
        nodeID_value = "";
        operationSuccessful_value = false;

    }

    public void setFileRecord(String stored_f_name, String md5Checksum,
            String relativePath, String nodeId, boolean ifSuccessful) {

        this.stored_file_name_value = stored_f_name;
        this.md5_checksum_value = md5Checksum;
        this.relative_path_value = relativePath;
        this.nodeID_value = nodeId;
        this.operationSuccessful_value = ifSuccessful;

    }

    public void setStoredfileName(String storedfName) {
        
        this.stored_file_name_value = storedfName;
        
    }

    public String getStoredfileName() {

        return this.stored_file_name_value;
        
    }

    public void setMD5Checksum(String md5checksum) {
        
        this.md5_checksum_value = md5checksum;
        
    }

    public FileRecord(String stored_f_name, String md5Checksum, String relativePath) {
    public String getMD5Checksum() {
        
        content.put(stored_file_name, stored_f_name);
        content.put(md5_checksum, md5Checksum);
        content.put(relative_path, relativePath);
        return this.md5_checksum_value;
        
    }

    public FileRecord(String stored_f_name, String md5Checksum, String relativePath, String nodeIDStr) {
    public void setRelativePath(String relativePath) {
        
        content.put(stored_file_name, stored_f_name);
        content.put(md5_checksum, md5Checksum);
        content.put(relative_path, relativePath);
        content.put(nodeID, nodeIDStr);
        this.relative_path_value = relativePath;
        
    }

    public HashMap getFileRecord() {
    public String getRelativePath() {
            
        return content;
        return this.relative_path_value;
        
    }

    public void setFileRecord(String stored_f_name, String md5Checksum, String relativePath) {
    public void setNodeId(String nodeId) {
        
        content.put(stored_file_name, stored_f_name);
        content.put(md5_checksum, md5Checksum);
        content.put(relative_path, relativePath);
        this.nodeID_value = nodeId;
        
    }

    public String getNodeId() {
        
        return this.nodeID_value;
        
    }

    public boolean getIfOperationSuccessful() {
            
        return this.operationSuccessful_value;
        
    }

    public void setIfOperationSuccessful(boolean ifSuccess) {
        
        this.operationSuccessful_value = ifSuccess;
    }

    public String toString() {

        String res = "FileRecord:  \nstored_file_name   = " + getStoredfileName() + "\n"
                + "md5_checksum       = " + getMD5Checksum() + "\n"
                + "relative_path      = " + getRelativePath() + "\n"
                + "nodeID             = " + getNodeId() + "\n"
                + "operationSuccessful = " + getIfOperationSuccessful() + "\n";

        return res;

    }

}