Rev 1505 | Rev 1670 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1505 | jmachado | 1 | package pt.estgp.estgweb.domain; |
2 | |||
1626 | jmachado | 3 | import com.owlike.genson.Genson; |
4 | import com.owlike.genson.TransformationException; |
||
1505 | jmachado | 5 | import pt.estgp.estgweb.utils.ConfigProperties; |
6 | |||
1626 | jmachado | 7 | import java.io.IOException; |
1505 | jmachado | 8 | import java.io.Serializable; |
1626 | jmachado | 9 | import java.util.ArrayList; |
1505 | jmachado | 10 | |
11 | /** |
||
12 | * Created by jorgemachado on 14/09/16. |
||
13 | */ |
||
14 | public class CourseDepartmentImpl extends CourseDepartment { |
||
15 | @1.5.0/docs/api/java/lang/Override.html">Override |
||
16 | public 1.5.0/docs/api/java/io/Serializable.html">Serializable getSerializable() { |
||
17 | return getSigla(); |
||
18 | } |
||
19 | |||
20 | public 1.5.0/docs/api/java/lang/String.html">String getSchoolFromInstitutionalCode() |
||
21 | { |
||
22 | return ConfigProperties.getProperty("institution.code.prefix." + getInstitutionalCode()); |
||
23 | } |
||
1626 | jmachado | 24 | |
25 | static Genson courseDepartmentGenson = new Genson.Builder() |
||
26 | .exclude(5+0%2Fdocs%2Fapi+Object">Object.class) |
||
27 | .include(CourseDepartment.class) |
||
28 | .include("id", CourseDepartment.class) |
||
29 | .include("active", CourseDepartment.class) |
||
30 | .include("institutionalCode", CourseDepartment.class) |
||
31 | .include("name", CourseDepartment.class) |
||
32 | .include("nameEn", CourseDepartment.class) |
||
33 | .include("nameEs", CourseDepartment.class) |
||
34 | .include("nameFr",CourseDepartment.class) |
||
35 | .create(); |
||
36 | |||
37 | public 1.5.0/docs/api/java/lang/String.html">String getJson() throws 1.5.0/docs/api/java/io/IOException.html">IOException, TransformationException |
||
38 | { |
||
39 | return courseDepartmentGenson.serialize(this); |
||
40 | } |
||
41 | |||
42 | public static 1.5.0/docs/api/java/lang/String.html">String getJson(ArrayList<CourseDepartment> departments) throws 1.5.0/docs/api/java/io/IOException.html">IOException, TransformationException |
||
43 | { |
||
44 | return courseDepartmentGenson.serialize(departments); |
||
45 | } |
||
1505 | jmachado | 46 | } |