Subversion Repositories bacoAlunos

Rev

Rev 1871 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1871 Rev 1877
Line 1... Line 1...
1
package pt.estgp.estgweb.services.courses.coursereport.documentmodel;
1
package pt.estgp.estgweb.services.courses.coursereport.documentmodel;
2
 
2
 
3
import com.owlike.genson.Genson;
3
import com.owlike.genson.Genson;
4
import com.owlike.genson.GensonBuilder;
4
import com.owlike.genson.GensonBuilder;
-
 
5
import jomm.dao.impl.AbstractDao;
5
import org.apache.log4j.Logger;
6
import org.apache.log4j.Logger;
6
import org.json.JSONException;
7
import org.json.JSONException;
7
import org.json.JSONObject;
8
import org.json.JSONObject;
8
import pt.estgp.estgweb.domain.Course;
9
import pt.estgp.estgweb.domain.Course;
-
 
10
import pt.estgp.estgweb.domain.dao.DaoFactory;
9
import pt.estgp.estgweb.domain.utils.JsonView;
11
import pt.estgp.estgweb.domain.utils.JsonView;
10
import pt.estgp.estgweb.utils.documentBuilder.Document;
12
import pt.estgp.estgweb.utils.documentBuilder.Document;
11
import pt.estgp.estgweb.utils.documentBuilder.DocumentSection;
13
import pt.estgp.estgweb.utils.documentBuilder.DocumentSection;
12
 
14
 
13
import java.util.Date;
15
import java.util.Date;
Line 63... Line 65...
63
        setCourseName(c.getName());
65
        setCourseName(c.getName());
64
 
66
 
65
        //1 - Introducao
67
        //1 - Introducao
66
        IntroSection introSection = new IntroSection();
68
        IntroSection introSection = new IntroSection();
67
        introSection.init();
69
        introSection.init();
-
 
70
 
68
        getSections().add(introSection);
71
        getSections().add(introSection);
69
 
72
 
70
        //2 - Mapa Sintese dos Relatórios dos Responsáveis das UC's
73
        //2 - Mapa Sintese dos Relatórios dos Responsáveis das UC's
71
        ReportsUcSummarySection reportsUcSummarySection = new ReportsUcSummarySection();
74
        ReportsUcSummarySection reportsUcSummarySection = new ReportsUcSummarySection();
72
        reportsUcSummarySection.init();
75
        reportsUcSummarySection.init();
Line 156... Line 159...
156
    public 1.5.0/docs/api/java/lang/String.html">String toJson()
159
    public 1.5.0/docs/api/java/lang/String.html">String toJson()
157
    {
160
    {
158
        return gensonGenericLoad.serialize(this);
161
        return gensonGenericLoad.serialize(this);
159
    }
162
    }
160
 
163
 
-
 
164
    public static void main(1.5.0/docs/api/java/lang/String.html">String[] args)
-
 
165
    {
-
 
166
        CourseReportDocument d = new CourseReportDocument();
-
 
167
 
-
 
168
        AbstractDao.getCurrentSession().beginTransaction();
-
 
169
 
-
 
170
        List<Course> cursos = DaoFactory.getCourseDaoImpl().findAll();
-
 
171
 
-
 
172
 
-
 
173
        d.init(cursos.get(0),"201718");
-
 
174
 
-
 
175
        1.5.0/docs/api/java/lang/String.html">String json = d.toJson();
-
 
176
        1.5.0/docs/api/java/lang/System.html">System.out.println(json);
-
 
177
        CourseReportDocument d2 = CourseReportDocument.fromJson(json);
-
 
178
        1.5.0/docs/api/java/lang/System.html">System.out.println(d2.toJson());
-
 
179
 
-
 
180
        AbstractDao.getCurrentSession().getTransaction().commit();
-
 
181
    }
-
 
182
 
161
 
183
 
162
 
184
 
163
}
185
}