Search in sources :

Example 1 with ArchivedDatasetFileBean

use of org.akaza.openclinica.bean.extract.ArchivedDatasetFileBean in project OpenClinica by OpenClinica.

the class ArchivedDatasetFileDAO method create.

public EntityBean create(EntityBean eb) {
    ArchivedDatasetFileBean fb = (ArchivedDatasetFileBean) eb;
    HashMap variables = new HashMap();
    HashMap nullVars = new HashMap();
    variables.put(Integer.valueOf(1), fb.getName());
    variables.put(Integer.valueOf(2), Integer.valueOf(fb.getDatasetId()));
    variables.put(Integer.valueOf(3), Integer.valueOf(fb.getExportFormatId()));
    variables.put(Integer.valueOf(4), fb.getFileReference());
    variables.put(Integer.valueOf(5), Integer.valueOf(fb.getFileSize()));
    variables.put(Integer.valueOf(6), new Double(fb.getRunTime()));
    variables.put(Integer.valueOf(7), Integer.valueOf(fb.getOwnerId()));
    this.executeWithPK(digester.getQuery("create"), variables, nullVars);
    if (isQuerySuccessful()) {
        fb.setId(getLatestPK());
    }
    return fb;
}
Also used : HashMap(java.util.HashMap) ArchivedDatasetFileBean(org.akaza.openclinica.bean.extract.ArchivedDatasetFileBean)

Example 2 with ArchivedDatasetFileBean

use of org.akaza.openclinica.bean.extract.ArchivedDatasetFileBean in project OpenClinica by OpenClinica.

the class ArchivedDatasetFileDAO method findAll.

public Collection findAll() {
    this.setTypesExpected();
    ArrayList alist = this.select(digester.getQuery("findAll"));
    ArrayList al = new ArrayList();
    Iterator it = alist.iterator();
    while (it.hasNext()) {
        ArchivedDatasetFileBean fb = (ArchivedDatasetFileBean) this.getEntityFromHashMap((HashMap) it.next());
        al.add(fb);
    }
    return al;
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) ArchivedDatasetFileBean(org.akaza.openclinica.bean.extract.ArchivedDatasetFileBean)

Example 3 with ArchivedDatasetFileBean

use of org.akaza.openclinica.bean.extract.ArchivedDatasetFileBean in project OpenClinica by OpenClinica.

the class ArchivedDatasetFileDAO method update.

public EntityBean update(EntityBean eb) {
    ArchivedDatasetFileBean fb = (ArchivedDatasetFileBean) eb;
    HashMap variables = new HashMap();
    HashMap nullVars = new HashMap();
    variables.put(Integer.valueOf(1), fb.getName());
    variables.put(Integer.valueOf(2), Integer.valueOf(fb.getDatasetId()));
    variables.put(Integer.valueOf(3), Integer.valueOf(fb.getExportFormatId()));
    variables.put(Integer.valueOf(4), fb.getFileReference());
    variables.put(Integer.valueOf(5), Integer.valueOf(fb.getFileSize()));
    variables.put(Integer.valueOf(6), new Double(fb.getRunTime()));
    variables.put(Integer.valueOf(7), Integer.valueOf(fb.getOwnerId()));
    variables.put(Integer.valueOf(8), Integer.valueOf(fb.getId()));
    this.execute(digester.getQuery("update"), variables, nullVars);
    return fb;
}
Also used : HashMap(java.util.HashMap) ArchivedDatasetFileBean(org.akaza.openclinica.bean.extract.ArchivedDatasetFileBean)

Example 4 with ArchivedDatasetFileBean

use of org.akaza.openclinica.bean.extract.ArchivedDatasetFileBean in project OpenClinica by OpenClinica.

the class ArchivedDatasetFileDAO method getEntityFromHashMap.

public Object getEntityFromHashMap(HashMap hm) {
    ArchivedDatasetFileBean fb = new ArchivedDatasetFileBean();
    fb.setId(((Integer) hm.get("archived_dataset_file_id")).intValue());
    fb.setDateCreated((Date) hm.get("date_created"));
    fb.setName((String) hm.get("name"));
    fb.setId(((Integer) hm.get("archived_dataset_file_id")).intValue());
    fb.setDatasetId(((Integer) hm.get("dataset_id")).intValue());
    fb.setExportFormatId(((Integer) hm.get("export_format_id")).intValue());
    fb.setFileReference((String) hm.get("file_reference"));
    fb.setRunTime(((Integer) hm.get("run_time")).doubleValue());
    fb.setFileSize(((Integer) hm.get("file_size")).intValue());
    fb.setOwnerId(((Integer) hm.get("owner_id")).intValue());
    UserAccountDAO uaDAO = new UserAccountDAO(this.ds);
    UserAccountBean owner = (UserAccountBean) uaDAO.findByPK(fb.getOwnerId());
    fb.setOwner(owner);
    return fb;
}
Also used : UserAccountBean(org.akaza.openclinica.bean.login.UserAccountBean) UserAccountDAO(org.akaza.openclinica.dao.login.UserAccountDAO) ArchivedDatasetFileBean(org.akaza.openclinica.bean.extract.ArchivedDatasetFileBean)

Example 5 with ArchivedDatasetFileBean

use of org.akaza.openclinica.bean.extract.ArchivedDatasetFileBean in project OpenClinica by OpenClinica.

the class ArchivedDatasetFileDAO method findByDatasetId.

public ArrayList findByDatasetId(int did) {
    // ArchivedDatasetFileBean fb = new ArchivedDatasetFileBean();
    this.setTypesExpected();
    ArrayList al = new ArrayList();
    HashMap variables = new HashMap();
    variables.put(Integer.valueOf(1), Integer.valueOf(did));
    String sql = digester.getQuery("findByDatasetId");
    ArrayList alist = this.select(sql, variables);
    Iterator it = alist.iterator();
    while (it.hasNext()) {
        ArchivedDatasetFileBean fb = (ArchivedDatasetFileBean) this.getEntityFromHashMap((HashMap) it.next());
        al.add(fb);
    }
    return al;
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) ArchivedDatasetFileBean(org.akaza.openclinica.bean.extract.ArchivedDatasetFileBean)

Aggregations

ArchivedDatasetFileBean (org.akaza.openclinica.bean.extract.ArchivedDatasetFileBean)22 ArchivedDatasetFileDAO (org.akaza.openclinica.dao.extract.ArchivedDatasetFileDAO)9 File (java.io.File)8 HashMap (java.util.HashMap)8 ArrayList (java.util.ArrayList)7 Date (java.util.Date)7 Iterator (java.util.Iterator)6 IOException (java.io.IOException)5 BufferedWriter (java.io.BufferedWriter)4 FileWriter (java.io.FileWriter)4 DatasetBean (org.akaza.openclinica.bean.extract.DatasetBean)4 FileInputStream (java.io.FileInputStream)3 FileOutputStream (java.io.FileOutputStream)3 StudyBean (org.akaza.openclinica.bean.managestudy.StudyBean)3 FormProcessor (org.akaza.openclinica.control.form.FormProcessor)3 ZipEntry (java.util.zip.ZipEntry)2 ZipFile (java.util.zip.ZipFile)2 ZipOutputStream (java.util.zip.ZipOutputStream)2 ExtractBean (org.akaza.openclinica.bean.extract.ExtractBean)2 TabReportBean (org.akaza.openclinica.bean.extract.TabReportBean)2