Compare commits
114 Commits
master
...
dev/techni
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
74378cdde0 | ||
|
|
a90e40be3e | ||
|
|
4a5835bcd0 | ||
|
|
71aada93ca | ||
|
|
edbcb70863 | ||
|
|
166840f3d7 | ||
|
|
0454235f9b | ||
|
|
90656b5019 | ||
|
|
3456145830 | ||
|
|
0194019077 | ||
|
|
9cabece18c | ||
|
|
39679d199a | ||
|
|
7bc840052d | ||
|
|
8bd6fb8d60 | ||
|
|
cbc261c07e | ||
|
|
171e5a984a | ||
|
|
d88e2e07c3 | ||
|
|
6306c7e350 | ||
|
|
82bf4545f0 | ||
|
|
5fd043ec87 | ||
|
|
98ba7e9388 | ||
|
|
e3e2e2e68a | ||
|
|
5fb31cf4a1 | ||
|
|
f3d02b00d9 | ||
|
|
1edf19a238 | ||
|
|
8b0aac3ec7 | ||
|
|
7c74c553af | ||
|
|
80887fea4c | ||
|
|
c51d5e8018 | ||
|
|
b6097f93f5 | ||
|
|
6bfb5d9052 | ||
|
|
e6eeee47a2 | ||
|
|
ff5ee160fb | ||
|
|
0801da3173 | ||
|
|
c7c751e61f | ||
|
|
7b75cfba5f | ||
|
|
d636453506 | ||
|
|
d5359d32e8 | ||
|
|
d62735d472 | ||
|
|
acaa503eb3 | ||
|
|
6d488d9e50 | ||
|
|
deb82fe07d | ||
|
|
2fbec4c930 | ||
|
|
9149695b02 | ||
|
|
3553c8ae71 | ||
|
|
7ff17ae188 | ||
|
|
1c7c3f46d3 | ||
|
|
5409f9ecd7 | ||
|
|
df8fa110a5 | ||
|
|
8f09984d7b | ||
|
|
1f7fc52c8a | ||
|
|
5cbff0fb14 | ||
|
|
bcf55096ec | ||
|
|
e00b238dca | ||
|
|
f1ff294aa0 | ||
|
|
1730eb9ebb | ||
|
|
f96617386d | ||
|
|
501993628a | ||
|
|
7f4ef1167e | ||
|
|
bddf8b3769 | ||
|
|
5861d6afea | ||
|
|
e30f49d33f | ||
|
|
ddf3f39dc0 | ||
|
|
8dd63d09cd | ||
|
|
fe33470ba2 | ||
|
|
f2b1859ec7 | ||
|
|
c5321965c7 | ||
|
|
3603fef63a | ||
|
|
f5faf50737 | ||
|
|
92a4d78560 | ||
|
|
c3ee97b3d2 | ||
|
|
12e1dcdc95 | ||
|
|
b532520f2e | ||
|
|
3512bb1b7b | ||
|
|
75c3512d30 | ||
|
|
5405e1c11e | ||
|
|
711084879d | ||
|
|
776ffe55a3 | ||
|
|
444f9eab94 | ||
|
|
c36a4e2bad | ||
|
|
d2bc46ffbe | ||
|
|
e2e94198a4 | ||
|
|
9fa0ff320c | ||
|
|
e953dbe0d6 | ||
|
|
59872a4d6c | ||
|
|
d734f762a6 | ||
|
|
72e5251785 | ||
|
|
1dbc607a88 | ||
|
|
a3ece3f090 | ||
|
|
2bb5b5154b | ||
|
|
ff04c6dba8 | ||
|
|
f987c74db4 | ||
|
|
352350002b | ||
|
|
71a48a7dfe | ||
|
|
3e4c001ae8 | ||
|
|
a5edc64e0e | ||
|
|
f2cbdb411a | ||
|
|
9d2466eaca | ||
|
|
60de4d71fa | ||
|
|
9d932fb6db | ||
|
|
a635ea60e7 | ||
|
|
62ad28d36f | ||
|
|
2af9d575b7 | ||
|
|
f7327095ea | ||
|
|
5a1f5ab3c9 | ||
|
|
aee2b1ff60 | ||
|
|
df53f95245 | ||
|
|
0da96226b1 | ||
|
|
47ba4a96a1 | ||
|
|
1d08143863 | ||
|
|
eb88d4b71a | ||
|
|
980ba07f9f | ||
|
|
758429d815 | ||
|
|
effa63bf0f |
@ -8,8 +8,6 @@ business : berisi Service, Repository/DAO dan class Business
|
||||
web : berisi REST Controller
|
||||
web-push : berisi implementasi untuk push notification using WebServlet async=true
|
||||
|
||||
|
||||
|
||||
Untuk menjalankan projectnya :
|
||||
|
||||
- Siapkan database Postgree
|
||||
@ -13,21 +13,21 @@
|
||||
<relativePath>../Medifirst2000/pom.xml</relativePath>
|
||||
</parent>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>io.socket</groupId>
|
||||
<artifactId>socket.io-client</artifactId>
|
||||
<version>0.7.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
<version>4.5.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-httpclient</groupId>
|
||||
<artifactId>commons-httpclient</artifactId>
|
||||
<version>3.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.socket</groupId>
|
||||
<artifactId>socket.io-client</artifactId>
|
||||
<version>0.7.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
<version>4.5.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-httpclient</groupId>
|
||||
<artifactId>commons-httpclient</artifactId>
|
||||
<version>3.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>jasamedika-config</artifactId>
|
||||
@ -58,7 +58,7 @@
|
||||
<version>4.12</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-test</artifactId>
|
||||
@ -79,8 +79,8 @@
|
||||
<version>${org.springframework.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- Spring AOP -->
|
||||
<dependency>
|
||||
@ -185,29 +185,29 @@
|
||||
<artifactId>swagger-springmvc</artifactId>
|
||||
<version>0.6.5</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- jasper -->
|
||||
<!-- https://mvnrepository.com/artifact/com.google.zxing/core -->
|
||||
<dependency>
|
||||
<groupId>com.google.zxing</groupId>
|
||||
<artifactId>core</artifactId>
|
||||
<version>2.2</version>
|
||||
<groupId>com.google.zxing</groupId>
|
||||
<artifactId>core</artifactId>
|
||||
<version>2.2</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/com.google.zxing/javase -->
|
||||
<dependency>
|
||||
<groupId>com.google.zxing</groupId>
|
||||
<artifactId>javase</artifactId>
|
||||
<version>2.2</version>
|
||||
<groupId>com.google.zxing</groupId>
|
||||
<artifactId>javase</artifactId>
|
||||
<version>2.2</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/com.google.zxing/zxing-parent -->
|
||||
<dependency>
|
||||
<groupId>com.google.zxing</groupId>
|
||||
<artifactId>zxing-parent</artifactId>
|
||||
<version>3.2.0</version>
|
||||
<type>pom</type>
|
||||
<groupId>com.google.zxing</groupId>
|
||||
<artifactId>zxing-parent</artifactId>
|
||||
<version>3.2.0</version>
|
||||
<type>pom</type>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@ -232,39 +232,44 @@
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context-support</artifactId>
|
||||
<version>${org.springframework.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/net.sourceforge.barbecue/barbecue -->
|
||||
<dependency>
|
||||
<groupId>net.sourceforge.barbecue</groupId>
|
||||
<artifactId>barbecue</artifactId>
|
||||
<version>1.5-beta1</version>
|
||||
<groupId>net.sourceforge.barbecue</groupId>
|
||||
<artifactId>barbecue</artifactId>
|
||||
<version>1.5-beta1</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/net.sf.barcode4j/barcode4j -->
|
||||
<dependency>
|
||||
<groupId>net.sf.barcode4j</groupId>
|
||||
<artifactId>barcode4j</artifactId>
|
||||
<version>2.1</version>
|
||||
<groupId>net.sf.barcode4j</groupId>
|
||||
<artifactId>barcode4j</artifactId>
|
||||
<version>2.1</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.xmlgraphics/batik-bridge -->
|
||||
<dependency>
|
||||
<groupId>org.apache.xmlgraphics</groupId>
|
||||
<artifactId>batik-bridge</artifactId>
|
||||
<version>1.7</version>
|
||||
<groupId>org.apache.xmlgraphics</groupId>
|
||||
<artifactId>batik-bridge</artifactId>
|
||||
<version>1.7</version>
|
||||
</dependency>
|
||||
|
||||
<!-- <dependency> <groupId>org.codehaus.groovy</groupId> <artifactId>groovy-all</artifactId>
|
||||
<version>1.8.4</version> </dependency> -->
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>${project.lombok.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- <dependency>
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<artifactId>groovy-all</artifactId>
|
||||
<version>1.8.4</version>
|
||||
</dependency> -->
|
||||
|
||||
</dependencies>
|
||||
<build>
|
||||
|
||||
@ -1216,7 +1216,7 @@ public class ReportingController extends LocaleController<RegistrasiPelayananVO>
|
||||
String month = (formatBulan(Integer.valueOf(new SimpleDateFormat("MM").format(new Date()))));
|
||||
String monthFirstCaplock = Character.toString(month.charAt(0)).toUpperCase() + month.substring(1);
|
||||
String monthAllCaplock = month.toUpperCase();
|
||||
List<KunjunganPasienStatusDanJenisPasienDto2> listKunjunganPasienStatusDto = new ArrayList<KunjunganPasienStatusDanJenisPasienDto2>();
|
||||
List<KunjunganPasienRuanganDto> listKunjunganPasienStatusDto = new ArrayList<KunjunganPasienRuanganDto>();
|
||||
|
||||
List<Object[]> listStatusPasien = reportingPelayananRekamMedisService
|
||||
.findAntrianPasienDiperiksaStatusPasien(startDate, endDate);
|
||||
@ -1227,7 +1227,7 @@ public class ReportingController extends LocaleController<RegistrasiPelayananVO>
|
||||
String jenisKelamin = ((String) data[4]);
|
||||
String judul = ((String) data[5]);
|
||||
String noRegistrasi = ((String) data[0]);
|
||||
KunjunganPasienStatusDanJenisPasienDto2 abc = new KunjunganPasienStatusDanJenisPasienDto2();
|
||||
KunjunganPasienRuanganDto abc = new KunjunganPasienRuanganDto();
|
||||
abc.setJudul(judul);
|
||||
abc.setDetailJudul(statusPasien);
|
||||
abc.setNoRegistrasi(noRegistrasi);
|
||||
@ -1259,7 +1259,7 @@ public class ReportingController extends LocaleController<RegistrasiPelayananVO>
|
||||
String month = (formatBulan(Integer.valueOf(new SimpleDateFormat("MM").format(new Date()))));
|
||||
String monthFirstCaplock = Character.toString(month.charAt(0)).toUpperCase() + month.substring(1);
|
||||
String monthAllCaplock = month.toUpperCase();
|
||||
List<KunjunganPasienStatusDanJenisPasienDto2> listKunjunganPasienStatusDanJenisPasienDto = new ArrayList<KunjunganPasienStatusDanJenisPasienDto2>();
|
||||
List<KunjunganPasienRuanganDto> listKunjunganPasienStatusDanJenisPasienDto = new ArrayList<KunjunganPasienRuanganDto>();
|
||||
|
||||
List<Object[]> listStatusPasien = reportingPelayananRekamMedisService
|
||||
.findAntrianPasienDiperiksaStatusPasien(startDate, endDate);
|
||||
@ -1270,7 +1270,7 @@ public class ReportingController extends LocaleController<RegistrasiPelayananVO>
|
||||
String jenisKelamin = ((String) data[4]);
|
||||
String judul = ((String) data[5]);
|
||||
String noRegistrasi = ((String) data[0]);
|
||||
KunjunganPasienStatusDanJenisPasienDto2 abc = new KunjunganPasienStatusDanJenisPasienDto2();
|
||||
KunjunganPasienRuanganDto abc = new KunjunganPasienRuanganDto();
|
||||
abc.setJudul(judul);
|
||||
abc.setDetailJudul(statusPasien);
|
||||
abc.setNoRegistrasi(noRegistrasi);
|
||||
@ -1289,7 +1289,7 @@ public class ReportingController extends LocaleController<RegistrasiPelayananVO>
|
||||
String jenisKelamin = ((String) data[4]);
|
||||
String judul = ((String) data[5]);
|
||||
String noRegistrasi = ((String) data[0]);
|
||||
KunjunganPasienStatusDanJenisPasienDto2 abc = new KunjunganPasienStatusDanJenisPasienDto2();
|
||||
KunjunganPasienRuanganDto abc = new KunjunganPasienRuanganDto();
|
||||
abc.setJudul(judul);
|
||||
abc.setDetailJudul(kelompokPasien);
|
||||
abc.setNoRegistrasi(noRegistrasi);
|
||||
@ -1322,19 +1322,19 @@ public class ReportingController extends LocaleController<RegistrasiPelayananVO>
|
||||
String month = (formatBulan(Integer.valueOf(new SimpleDateFormat("MM").format(new Date()))));
|
||||
String monthFirstCaplock = Character.toString(month.charAt(0)).toUpperCase() + month.substring(1);
|
||||
String monthAllCaplock = month.toUpperCase();
|
||||
List<KunjunganPasienStatusDanJenisPasienDto> listKunjunganPasienStatusDanJenisPasienDto = new ArrayList<KunjunganPasienStatusDanJenisPasienDto>();
|
||||
List<KunjunganPasienJenisPasienDto> listKunjunganPasienStatusDanJenisPasienDto = new ArrayList<KunjunganPasienJenisPasienDto>();
|
||||
|
||||
List<Object[]> list = reportingPelayananRekamMedisService.findAntrianPasienDiperiksaStatusJenisPasien(startDate,
|
||||
endDate);
|
||||
for (Object[] data : list) {
|
||||
KunjunganPasienStatusDanJenisPasienDto umumBaruL = new KunjunganPasienStatusDanJenisPasienDto();
|
||||
KunjunganPasienStatusDanJenisPasienDto bpjsBaruL = new KunjunganPasienStatusDanJenisPasienDto();
|
||||
KunjunganPasienStatusDanJenisPasienDto umumLamaL = new KunjunganPasienStatusDanJenisPasienDto();
|
||||
KunjunganPasienStatusDanJenisPasienDto bpjsLamaL = new KunjunganPasienStatusDanJenisPasienDto();
|
||||
KunjunganPasienStatusDanJenisPasienDto umumBaruP = new KunjunganPasienStatusDanJenisPasienDto();
|
||||
KunjunganPasienStatusDanJenisPasienDto bpjsBaruP = new KunjunganPasienStatusDanJenisPasienDto();
|
||||
KunjunganPasienStatusDanJenisPasienDto umumLamaP = new KunjunganPasienStatusDanJenisPasienDto();
|
||||
KunjunganPasienStatusDanJenisPasienDto bpjsLamaP = new KunjunganPasienStatusDanJenisPasienDto();
|
||||
KunjunganPasienJenisPasienDto umumBaruL = new KunjunganPasienJenisPasienDto();
|
||||
KunjunganPasienJenisPasienDto bpjsBaruL = new KunjunganPasienJenisPasienDto();
|
||||
KunjunganPasienJenisPasienDto umumLamaL = new KunjunganPasienJenisPasienDto();
|
||||
KunjunganPasienJenisPasienDto bpjsLamaL = new KunjunganPasienJenisPasienDto();
|
||||
KunjunganPasienJenisPasienDto umumBaruP = new KunjunganPasienJenisPasienDto();
|
||||
KunjunganPasienJenisPasienDto bpjsBaruP = new KunjunganPasienJenisPasienDto();
|
||||
KunjunganPasienJenisPasienDto umumLamaP = new KunjunganPasienJenisPasienDto();
|
||||
KunjunganPasienJenisPasienDto bpjsLamaP = new KunjunganPasienJenisPasienDto();
|
||||
String tglRegistrasi = ((String) data[1]);
|
||||
String ruangan = ((String) data[2]);
|
||||
String statusPasien = ((String) data[3]);
|
||||
@ -1432,7 +1432,7 @@ public class ReportingController extends LocaleController<RegistrasiPelayananVO>
|
||||
String month = (formatBulan(Integer.valueOf(new SimpleDateFormat("MM").format(new Date()))));
|
||||
String monthFirstCaplock = Character.toString(month.charAt(0)).toUpperCase() + month.substring(1);
|
||||
String monthAllCaplock = month.toUpperCase();
|
||||
List<KunjunganPasienStatusDanJenisPasienDto2> listKunjunganPasienStatusDanJenisPasienDto = new ArrayList<KunjunganPasienStatusDanJenisPasienDto2>();
|
||||
List<KunjunganPasienRuanganDto> listKunjunganPasienStatusDanJenisPasienDto = new ArrayList<KunjunganPasienRuanganDto>();
|
||||
|
||||
List<Object[]> listStatusPasien = reportingPelayananRekamMedisService
|
||||
.findAntrianPasienDiperiksaStatusPasien(startDate, endDate);
|
||||
@ -1443,7 +1443,7 @@ public class ReportingController extends LocaleController<RegistrasiPelayananVO>
|
||||
String jenisKelamin = ((String) data[4]);
|
||||
String judul = ((String) data[5]);
|
||||
String noRegistrasi = ((String) data[0]);
|
||||
KunjunganPasienStatusDanJenisPasienDto2 abc = new KunjunganPasienStatusDanJenisPasienDto2();
|
||||
KunjunganPasienRuanganDto abc = new KunjunganPasienRuanganDto();
|
||||
abc.setJudul(judul);
|
||||
abc.setDetailJudul(statusPasien);
|
||||
abc.setNoRegistrasi(noRegistrasi);
|
||||
@ -1462,7 +1462,7 @@ public class ReportingController extends LocaleController<RegistrasiPelayananVO>
|
||||
String jenisKelamin = ((String) data[4]);
|
||||
String judul = ((String) data[5]);
|
||||
String noRegistrasi = ((String) data[0]);
|
||||
KunjunganPasienStatusDanJenisPasienDto2 abc = new KunjunganPasienStatusDanJenisPasienDto2();
|
||||
KunjunganPasienRuanganDto abc = new KunjunganPasienRuanganDto();
|
||||
abc.setJudul(judul);
|
||||
abc.setDetailJudul(kelompokPasien);
|
||||
abc.setNoRegistrasi(noRegistrasi);
|
||||
@ -1495,7 +1495,7 @@ public class ReportingController extends LocaleController<RegistrasiPelayananVO>
|
||||
String month = (formatBulan(Integer.valueOf(new SimpleDateFormat("MM").format(new Date()))));
|
||||
String monthFirstCaplock = Character.toString(month.charAt(0)).toUpperCase() + month.substring(1);
|
||||
String monthAllCaplock = month.toUpperCase();
|
||||
List<KunjunganPasienStatusDanJenisPasienDto2> listKunjunganPasienStatusDanJenisPasienDto = new ArrayList<KunjunganPasienStatusDanJenisPasienDto2>();
|
||||
List<KunjunganPasienRuanganDto> listKunjunganPasienStatusDanJenisPasienDto = new ArrayList<KunjunganPasienRuanganDto>();
|
||||
|
||||
List<Object[]> listStatusPasien = reportingPelayananRekamMedisService
|
||||
.findAntrianPasienDiperiksaStatusPasien(startDate, endDate);
|
||||
@ -1506,7 +1506,7 @@ public class ReportingController extends LocaleController<RegistrasiPelayananVO>
|
||||
String jenisKelamin = ((String) data[4]);
|
||||
String judul = ((String) data[5]);
|
||||
String noRegistrasi = ((String) data[0]);
|
||||
KunjunganPasienStatusDanJenisPasienDto2 abc = new KunjunganPasienStatusDanJenisPasienDto2();
|
||||
KunjunganPasienRuanganDto abc = new KunjunganPasienRuanganDto();
|
||||
abc.setJudul(judul);
|
||||
abc.setDetailJudul(statusPasien);
|
||||
abc.setNoRegistrasi(noRegistrasi);
|
||||
@ -1525,7 +1525,7 @@ public class ReportingController extends LocaleController<RegistrasiPelayananVO>
|
||||
String jenisKelamin = ((String) data[4]);
|
||||
String judul = ((String) data[5]);
|
||||
String noRegistrasi = ((String) data[0]);
|
||||
KunjunganPasienStatusDanJenisPasienDto2 abc = new KunjunganPasienStatusDanJenisPasienDto2();
|
||||
KunjunganPasienRuanganDto abc = new KunjunganPasienRuanganDto();
|
||||
abc.setJudul(judul);
|
||||
abc.setDetailJudul(kelompokPasien);
|
||||
abc.setNoRegistrasi(noRegistrasi);
|
||||
@ -1558,7 +1558,7 @@ public class ReportingController extends LocaleController<RegistrasiPelayananVO>
|
||||
String month = (formatBulan(Integer.valueOf(new SimpleDateFormat("MM").format(new Date()))));
|
||||
String monthFirstCaplock = Character.toString(month.charAt(0)).toUpperCase() + month.substring(1);
|
||||
String monthAllCaplock = month.toUpperCase();
|
||||
List<KunjunganPasienStatusDanJenisPasienDto2> listKunjunganPasienStatusDanJenisPasienDto = new ArrayList<KunjunganPasienStatusDanJenisPasienDto2>();
|
||||
List<KunjunganPasienRuanganDto> listKunjunganPasienStatusDanJenisPasienDto = new ArrayList<KunjunganPasienRuanganDto>();
|
||||
|
||||
List<Object[]> listStatusPasien = reportingPelayananRekamMedisService
|
||||
.findAntrianPasienDiperiksaStatusPasien(startDate, endDate);
|
||||
@ -1569,7 +1569,7 @@ public class ReportingController extends LocaleController<RegistrasiPelayananVO>
|
||||
String jenisKelamin = ((String) data[4]);
|
||||
String judul = ((String) data[5]);
|
||||
String noRegistrasi = ((String) data[0]);
|
||||
KunjunganPasienStatusDanJenisPasienDto2 abc = new KunjunganPasienStatusDanJenisPasienDto2();
|
||||
KunjunganPasienRuanganDto abc = new KunjunganPasienRuanganDto();
|
||||
abc.setJudul(judul);
|
||||
abc.setDetailJudul(statusPasien);
|
||||
abc.setNoRegistrasi(noRegistrasi);
|
||||
@ -1588,7 +1588,7 @@ public class ReportingController extends LocaleController<RegistrasiPelayananVO>
|
||||
String jenisKelamin = ((String) data[4]);
|
||||
String judul = ((String) data[5]);
|
||||
String noRegistrasi = ((String) data[0]);
|
||||
KunjunganPasienStatusDanJenisPasienDto2 abc = new KunjunganPasienStatusDanJenisPasienDto2();
|
||||
KunjunganPasienRuanganDto abc = new KunjunganPasienRuanganDto();
|
||||
abc.setJudul(judul);
|
||||
abc.setDetailJudul(kelompokPasien);
|
||||
abc.setNoRegistrasi(noRegistrasi);
|
||||
@ -1621,7 +1621,7 @@ public class ReportingController extends LocaleController<RegistrasiPelayananVO>
|
||||
String month = (formatBulan(Integer.valueOf(new SimpleDateFormat("MM").format(new Date()))));
|
||||
String monthFirstCaplock = Character.toString(month.charAt(0)).toUpperCase() + month.substring(1);
|
||||
String monthAllCaplock = month.toUpperCase();
|
||||
List<KunjunganPasienStatusDanJenisPasienDto2> listKunjunganPasienStatusDanJenisPasienDto = new ArrayList<KunjunganPasienStatusDanJenisPasienDto2>();
|
||||
List<KunjunganPasienRuanganDto> listKunjunganPasienStatusDanJenisPasienDto = new ArrayList<KunjunganPasienRuanganDto>();
|
||||
|
||||
List<Object[]> listStatusPasien = reportingPelayananRekamMedisService
|
||||
.findAntrianPasienDiperiksaStatusPasien(startDate, endDate);
|
||||
@ -1632,7 +1632,7 @@ public class ReportingController extends LocaleController<RegistrasiPelayananVO>
|
||||
String jenisKelamin = ((String) data[4]);
|
||||
String judul = ((String) data[5]);
|
||||
String noRegistrasi = ((String) data[0]);
|
||||
KunjunganPasienStatusDanJenisPasienDto2 abc = new KunjunganPasienStatusDanJenisPasienDto2();
|
||||
KunjunganPasienRuanganDto abc = new KunjunganPasienRuanganDto();
|
||||
abc.setJudul(judul);
|
||||
abc.setDetailJudul(statusPasien);
|
||||
abc.setNoRegistrasi(noRegistrasi);
|
||||
@ -1651,7 +1651,7 @@ public class ReportingController extends LocaleController<RegistrasiPelayananVO>
|
||||
String jenisKelamin = ((String) data[4]);
|
||||
String judul = ((String) data[5]);
|
||||
String noRegistrasi = ((String) data[0]);
|
||||
KunjunganPasienStatusDanJenisPasienDto2 abc = new KunjunganPasienStatusDanJenisPasienDto2();
|
||||
KunjunganPasienRuanganDto abc = new KunjunganPasienRuanganDto();
|
||||
abc.setJudul(judul);
|
||||
abc.setDetailJudul(kelompokPasien);
|
||||
abc.setNoRegistrasi(noRegistrasi);
|
||||
@ -4394,7 +4394,7 @@ public class ReportingController extends LocaleController<RegistrasiPelayananVO>
|
||||
String month = (formatBulan(Integer.valueOf(new SimpleDateFormat("MM").format(new Date()))));
|
||||
String monthFirstCaplock = Character.toString(month.charAt(0)).toUpperCase() + month.substring(1);
|
||||
String monthAllCaplock = month.toUpperCase();
|
||||
List<KunjunganPasienStatusDanJenisPasienDto2> listKunjunganPasienStatusDanJenisPasienDto = new ArrayList<KunjunganPasienStatusDanJenisPasienDto2>();
|
||||
List<KunjunganPasienRuanganDto> listKunjunganPasienStatusDanJenisPasienDto = new ArrayList<KunjunganPasienRuanganDto>();
|
||||
|
||||
List<Object[]> listStatusPasien = reportingPelayananRekamMedisService
|
||||
.findAntrianPasienDiperiksaStatusPasien(startDate, endDate);
|
||||
@ -4405,7 +4405,7 @@ public class ReportingController extends LocaleController<RegistrasiPelayananVO>
|
||||
String jenisKelamin = ((String) data[4]);
|
||||
String judul = ((String) data[5]);
|
||||
String noRegistrasi = ((String) data[0]);
|
||||
KunjunganPasienStatusDanJenisPasienDto2 abc = new KunjunganPasienStatusDanJenisPasienDto2();
|
||||
KunjunganPasienRuanganDto abc = new KunjunganPasienRuanganDto();
|
||||
abc.setJudul(judul);
|
||||
abc.setDetailJudul(statusPasien);
|
||||
abc.setNoRegistrasi(noRegistrasi);
|
||||
@ -4424,7 +4424,7 @@ public class ReportingController extends LocaleController<RegistrasiPelayananVO>
|
||||
String jenisKelamin = ((String) data[4]);
|
||||
String judul = ((String) data[5]);
|
||||
String noRegistrasi = ((String) data[0]);
|
||||
KunjunganPasienStatusDanJenisPasienDto2 abc = new KunjunganPasienStatusDanJenisPasienDto2();
|
||||
KunjunganPasienRuanganDto abc = new KunjunganPasienRuanganDto();
|
||||
abc.setJudul(judul);
|
||||
abc.setDetailJudul(kelompokPasien);
|
||||
abc.setNoRegistrasi(noRegistrasi);
|
||||
|
||||
@ -1,42 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.controller.base;
|
||||
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.jasamedika.medifirst2000.base.vo.BaseVO;
|
||||
|
||||
/**
|
||||
* Base Rest Operation for Controller Class
|
||||
*
|
||||
* @author Roberto
|
||||
*/
|
||||
public interface BaseRestController<V extends BaseVO> extends
|
||||
RestPageController<V> {
|
||||
|
||||
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public ResponseEntity<V> getVO(@PathVariable("id") String id);
|
||||
|
||||
@RequestMapping(value = "/", method = RequestMethod.PUT)
|
||||
@ResponseBody
|
||||
public ResponseEntity<Integer> addVO(@RequestBody V vo);
|
||||
|
||||
@RequestMapping(value = "/", method = RequestMethod.POST, consumes = { "application/json" })
|
||||
@ResponseBody
|
||||
public ResponseEntity<Integer> editVO(@RequestBody V vo);
|
||||
|
||||
// @RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
|
||||
// @ResponseBody
|
||||
// public ResponseEntity<String> deleteVO(@PathVariable("id") Integer id);
|
||||
|
||||
// @RequestMapping(value = "/", method = RequestMethod.GET)
|
||||
// @ResponseBody
|
||||
// public ResponseEntity<Collection<V>> getAllVO();
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,38 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.controller.base;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.jasamedika.medifirst2000.base.vo.BaseVO;
|
||||
|
||||
/**
|
||||
* Base Rest Operation for 'pagination' Controller Class
|
||||
*
|
||||
* @author Roberto
|
||||
*/
|
||||
public interface RestPageController<V extends BaseVO> {
|
||||
/**
|
||||
*
|
||||
* @param page
|
||||
* : page of
|
||||
* @param limit
|
||||
* : limit query
|
||||
* @param sort
|
||||
* : sort by
|
||||
* @param dir
|
||||
* : direction {asc:desc}
|
||||
* @return Collection of VO, Total-Count & Total Pages on response header
|
||||
*/
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public ResponseEntity<Collection<V>> getAllVOWithQueryString(
|
||||
@RequestParam(value = "page", required = false) Integer page,
|
||||
@RequestParam(value = "limit", required = false) Integer limit,
|
||||
@RequestParam(value = "sort", required = false, defaultValue = "id") String sort,
|
||||
@RequestParam(value = "dir", required = false, defaultValue = "asc") String dir);
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 28 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 13 KiB |
@ -43,7 +43,7 @@
|
||||
</staticText>
|
||||
<image>
|
||||
<reportElement x="468" y="10" width="400" height="53" uuid="23964e2b-9ac1-49da-9447-dc8a66676a83"/>
|
||||
<imageExpression><![CDATA["../templates/images/logoHarkit.png"]]></imageExpression>
|
||||
<imageExpression><![CDATA["../images/logoHarkit.png"]]></imageExpression>
|
||||
</image>
|
||||
</band>
|
||||
</title>
|
||||
|
||||
@ -50,7 +50,7 @@
|
||||
</staticText>
|
||||
<image>
|
||||
<reportElement x="766" y="10" width="400" height="53" uuid="23964e2b-9ac1-49da-9447-dc8a66676a83"/>
|
||||
<imageExpression><![CDATA["../templates/images/logoHarkit.png"]]></imageExpression>
|
||||
<imageExpression><![CDATA["../images/logoHarkit.png"]]></imageExpression>
|
||||
</image>
|
||||
</band>
|
||||
</title>
|
||||
|
||||
@ -36,7 +36,7 @@
|
||||
</staticText>
|
||||
<image>
|
||||
<reportElement x="263" y="10" width="400" height="53" uuid="23964e2b-9ac1-49da-9447-dc8a66676a83"/>
|
||||
<imageExpression><![CDATA["../templates/images/logoHarkit.png"]]></imageExpression>
|
||||
<imageExpression><![CDATA["../images/logoHarkit.png"]]></imageExpression>
|
||||
</image>
|
||||
</band>
|
||||
</title>
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
</staticText>
|
||||
<image>
|
||||
<reportElement x="141" y="10" width="400" height="53" uuid="23964e2b-9ac1-49da-9447-dc8a66676a83"/>
|
||||
<imageExpression><![CDATA["../templates/images/logoHarkit.png"]]></imageExpression>
|
||||
<imageExpression><![CDATA["../images/logoHarkit.png"]]></imageExpression>
|
||||
</image>
|
||||
</band>
|
||||
</title>
|
||||
|
||||
@ -37,7 +37,7 @@
|
||||
</staticText>
|
||||
<image>
|
||||
<reportElement x="468" y="10" width="400" height="53" uuid="23964e2b-9ac1-49da-9447-dc8a66676a83"/>
|
||||
<imageExpression><![CDATA["../templates/images/logoHarkit.png"]]></imageExpression>
|
||||
<imageExpression><![CDATA["../images/logoHarkit.png"]]></imageExpression>
|
||||
</image>
|
||||
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
|
||||
<reportElement x="80" y="155" width="200" height="20" uuid="2cbd8347-89a6-4dcd-8f37-ec016ed9428a"/>
|
||||
|
||||
@ -36,7 +36,7 @@
|
||||
</staticText>
|
||||
<image>
|
||||
<reportElement x="468" y="10" width="400" height="53" uuid="23964e2b-9ac1-49da-9447-dc8a66676a83"/>
|
||||
<imageExpression><![CDATA["../templates/images/logoHarkit.png"]]></imageExpression>
|
||||
<imageExpression><![CDATA["../images/logoHarkit.png"]]></imageExpression>
|
||||
</image>
|
||||
</band>
|
||||
</title>
|
||||
|
||||
@ -37,7 +37,7 @@
|
||||
</staticText>
|
||||
<image>
|
||||
<reportElement x="468" y="10" width="400" height="53" uuid="23964e2b-9ac1-49da-9447-dc8a66676a83"/>
|
||||
<imageExpression><![CDATA["../templates/images/logoHarkit.png"]]></imageExpression>
|
||||
<imageExpression><![CDATA["../images/logoHarkit.png"]]></imageExpression>
|
||||
</image>
|
||||
</band>
|
||||
</title>
|
||||
|
||||
@ -36,7 +36,7 @@
|
||||
</staticText>
|
||||
<image>
|
||||
<reportElement x="468" y="10" width="400" height="53" uuid="23964e2b-9ac1-49da-9447-dc8a66676a83"/>
|
||||
<imageExpression><![CDATA["../templates/images/logoHarkit.png"]]></imageExpression>
|
||||
<imageExpression><![CDATA["../images/logoHarkit.png"]]></imageExpression>
|
||||
</image>
|
||||
<textField>
|
||||
<reportElement x="180" y="118" width="100" height="30" uuid="16c66f1d-0b75-4910-86bf-caa09d7a3a62"/>
|
||||
|
||||
@ -35,7 +35,7 @@
|
||||
</staticText>
|
||||
<image>
|
||||
<reportElement x="468" y="10" width="400" height="53" uuid="23964e2b-9ac1-49da-9447-dc8a66676a83"/>
|
||||
<imageExpression><![CDATA["../templates/images/logoHarkit.png"]]></imageExpression>
|
||||
<imageExpression><![CDATA["../images/logoHarkit.png"]]></imageExpression>
|
||||
</image>
|
||||
</band>
|
||||
</title>
|
||||
|
||||
@ -38,7 +38,7 @@
|
||||
</staticText>
|
||||
<image>
|
||||
<reportElement x="274" y="10" width="400" height="53" uuid="23964e2b-9ac1-49da-9447-dc8a66676a83"/>
|
||||
<imageExpression><![CDATA["../templates/images/logoHarkit.png"]]></imageExpression>
|
||||
<imageExpression><![CDATA["../images/logoHarkit.png"]]></imageExpression>
|
||||
</image>
|
||||
</band>
|
||||
</title>
|
||||
|
||||
@ -33,7 +33,7 @@
|
||||
</staticText>
|
||||
<image>
|
||||
<reportElement x="274" y="10" width="400" height="53" uuid="23964e2b-9ac1-49da-9447-dc8a66676a83"/>
|
||||
<imageExpression><![CDATA["../templates/images/logoHarkit.png"]]></imageExpression>
|
||||
<imageExpression><![CDATA["../images/logoHarkit.png"]]></imageExpression>
|
||||
</image>
|
||||
</band>
|
||||
</title>
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
</staticText>
|
||||
<image>
|
||||
<reportElement x="314" y="2" width="400" height="53" uuid="b68f753a-2f4a-4319-a580-fe9b9fc5088b"/>
|
||||
<imageExpression><![CDATA["../templates/images/logoHarkit.png"]]></imageExpression>
|
||||
<imageExpression><![CDATA["../images/logoHarkit.png"]]></imageExpression>
|
||||
</image>
|
||||
<staticText>
|
||||
<reportElement x="0" y="55" width="960" height="17" uuid="f8114a59-b8f9-48cc-9c25-98dd1aead127"/>
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
</staticText>
|
||||
<image>
|
||||
<reportElement x="263" y="2" width="400" height="53" uuid="b68f753a-2f4a-4319-a580-fe9b9fc5088b"/>
|
||||
<imageExpression><![CDATA["../templates/images/logoHarkit.png"]]></imageExpression>
|
||||
<imageExpression><![CDATA["../images/logoHarkit.png"]]></imageExpression>
|
||||
</image>
|
||||
<staticText>
|
||||
<reportElement x="0" y="55" width="802" height="17" uuid="f8114a59-b8f9-48cc-9c25-98dd1aead127"/>
|
||||
|
||||
@ -283,6 +283,15 @@
|
||||
<version>${commons-io.version}</version>
|
||||
</dependency>
|
||||
<!-- End Lukman -->
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>${project.lombok.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
<organization>
|
||||
<name>Jasa Medika</name>
|
||||
|
||||
@ -1,40 +0,0 @@
|
||||
/*package com.jasamedika.medifirst2000.chace;
|
||||
|
||||
import org.springframework.cache.CacheManager;
|
||||
import org.springframework.cache.annotation.EnableCaching;
|
||||
import org.springframework.cache.ehcache.EhCacheCacheManager;
|
||||
import org.springframework.cache.ehcache.EhCacheManagerFactoryBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
|
||||
|
||||
|
||||
@Configuration
|
||||
@EnableCaching
|
||||
@ComponentScan({ "com.jasamedika.*" })
|
||||
public class ChaceConfig {
|
||||
|
||||
@Bean
|
||||
public CacheManager cacheManager() {
|
||||
return new EhCacheCacheManager(ehCacheCacheManager().getObject());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Bean
|
||||
public EhCacheManagerFactoryBean ehCacheCacheManager() {
|
||||
EhCacheManagerFactoryBean cmfb = new EhCacheManagerFactoryBean();
|
||||
cmfb.setConfigLocation(new ClassPathResource("ehcache.xml"));
|
||||
cmfb.setShared(true);
|
||||
|
||||
return cmfb;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public CacheManager defaultCacheManager() {
|
||||
return new ConcurrentMapCacheManager("books");
|
||||
}
|
||||
|
||||
}*/
|
||||
@ -1,98 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.OneToMany;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.AdvokasiHukumMedicolegal;
|
||||
import com.jasamedika.medifirst2000.vo.AdvokasiHukumMedicolegalVO;
|
||||
|
||||
@Component
|
||||
public class AdvokasiHukumMedicolegalConverter implements BaseVoConverter<AdvokasiHukumMedicolegalVO, AdvokasiHukumMedicolegal>{
|
||||
|
||||
@Override
|
||||
public AdvokasiHukumMedicolegal transferVOToModel(AdvokasiHukumMedicolegalVO vo, AdvokasiHukumMedicolegal model) {
|
||||
if (null == model)
|
||||
model = new AdvokasiHukumMedicolegal();
|
||||
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude,vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, AdvokasiHukumMedicolegal.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AdvokasiHukumMedicolegalVO> transferListOfModelToListOfVO(List<AdvokasiHukumMedicolegal> models, List<AdvokasiHukumMedicolegalVO> vos) {
|
||||
|
||||
if (null == vos)
|
||||
vos = new ArrayList<AdvokasiHukumMedicolegalVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (AdvokasiHukumMedicolegal model : models) {
|
||||
AdvokasiHukumMedicolegalVO vo = new AdvokasiHukumMedicolegalVO();
|
||||
vo=transferModelToVO(model, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AdvokasiHukumMedicolegalVO transferModelToVO(AdvokasiHukumMedicolegal model, AdvokasiHukumMedicolegalVO vo) {
|
||||
if (null == vo)
|
||||
vo = new AdvokasiHukumMedicolegalVO();
|
||||
try {
|
||||
|
||||
List<String> fieldsToInclude = new ArrayList<String>();
|
||||
for (Field field : model.GetFields(model.getClass())) {
|
||||
String str = field.getName();
|
||||
String name = field.getName();
|
||||
if(name.equals("serialVersionUID"))continue;
|
||||
Boolean valid = false;
|
||||
for (java.lang.annotation.Annotation annotation : field.getDeclaredAnnotations()) {
|
||||
if (annotation instanceof JoinColumn) {
|
||||
valid=true;
|
||||
} else if (annotation instanceof Column) {
|
||||
Column column = (Column)annotation;
|
||||
if(column.name().endsWith("Fk"))
|
||||
if(field.getName().endsWith("Id")==false)
|
||||
valid=true;
|
||||
}else if (annotation instanceof OneToMany) {
|
||||
|
||||
valid=true;
|
||||
}
|
||||
|
||||
}
|
||||
if(valid ==false)
|
||||
fieldsToInclude.add(str);
|
||||
|
||||
}
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude.toArray(new String[0]),model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, AdvokasiHukumMedicolegalVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
}
|
||||
@ -1,71 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.dao.custom.base.impl.FindConverterDao;
|
||||
import com.jasamedika.medifirst2000.entities.Agama;
|
||||
import com.jasamedika.medifirst2000.util.ExtendedSpringBeanUtil;
|
||||
import com.jasamedika.medifirst2000.vo.AgamaVO;
|
||||
|
||||
/**
|
||||
* Converter class between AgamaM and AgamaVO
|
||||
*
|
||||
* @author Roberto
|
||||
*/
|
||||
@Component
|
||||
public class AgamaConverter extends FindConverterDao implements
|
||||
BaseVoConverter<AgamaVO, Agama> {
|
||||
|
||||
public Agama transferVOToModel(AgamaVO vo, Agama model) {
|
||||
if (null == model)
|
||||
model = new Agama();
|
||||
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude,vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, Agama.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return model;
|
||||
|
||||
}
|
||||
|
||||
public List<AgamaVO> transferListOfModelToListOfVO(List<Agama> models,
|
||||
List<AgamaVO> vos) {
|
||||
if (null == vos)
|
||||
vos = new ArrayList<AgamaVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (Agama agama : models) {
|
||||
AgamaVO agamaVO = new AgamaVO();
|
||||
transferModelToVO(agama, agamaVO);
|
||||
vos.add(agamaVO);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
public AgamaVO transferModelToVO(Agama model, AgamaVO vo) {
|
||||
if (null == vo)
|
||||
vo = new AgamaVO();
|
||||
|
||||
// fix this
|
||||
ExtendedSpringBeanUtil.copySpecificProperties(model, vo,
|
||||
new String[] { "agama", }, new String[] { "agama" });
|
||||
// LoginUserVO test = loginUserService.findById(new Integer(1));
|
||||
// System.out.println("tea = " + test.getKataSandi());
|
||||
return vo;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,78 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.Alamat;
|
||||
import com.jasamedika.medifirst2000.vo.AlamatVO;
|
||||
|
||||
/**
|
||||
* Converter class between Alamat and AlamatVO
|
||||
*
|
||||
* @author Askur
|
||||
*/
|
||||
@Component
|
||||
public class AlamatConverter implements BaseVoConverter<AlamatVO, Alamat> {
|
||||
|
||||
|
||||
public Alamat transferVOToModel(AlamatVO vo, Alamat model) {
|
||||
if (null == model)
|
||||
model = new Alamat();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude,vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, Alamat.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return model;
|
||||
|
||||
}
|
||||
|
||||
public List<AlamatVO> transferListOfModelToListOfVO(List<Alamat> models,
|
||||
List<AlamatVO> vos) {
|
||||
if (null == vos)
|
||||
vos = new ArrayList<AlamatVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (Alamat alamat : models) {
|
||||
AlamatVO vo = new AlamatVO();
|
||||
vo = transferModelToVO(alamat, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlamatVO transferModelToVO(Alamat model, AlamatVO vo) {
|
||||
|
||||
if (null == vo)
|
||||
vo = new AlamatVO();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create();
|
||||
String json = gson.toJson(serialized);
|
||||
Gson gson2 =new Gson();
|
||||
vo = gson2.fromJson(json, AlamatVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return vo;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -1,76 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.AlatTerpasangDetail;
|
||||
import com.jasamedika.medifirst2000.vo.AlatTerpasangDetailVO;
|
||||
|
||||
@Component
|
||||
public class AlatTerpasangDetailConverter implements BaseVoConverter<AlatTerpasangDetailVO, AlatTerpasangDetail> {
|
||||
|
||||
|
||||
@Override
|
||||
public AlatTerpasangDetail transferVOToModel(AlatTerpasangDetailVO vo, AlatTerpasangDetail model) {
|
||||
if (null == model)
|
||||
model = new AlatTerpasangDetail();
|
||||
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude,vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, AlatTerpasangDetail.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AlatTerpasangDetailVO> transferListOfModelToListOfVO(List<AlatTerpasangDetail> models, List<AlatTerpasangDetailVO> vos) {
|
||||
|
||||
if (null == vos)
|
||||
vos = new ArrayList<AlatTerpasangDetailVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (AlatTerpasangDetail alatTerpasangDetail : models) {
|
||||
AlatTerpasangDetailVO vo = new AlatTerpasangDetailVO();
|
||||
vo=transferModelToVO(alatTerpasangDetail, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlatTerpasangDetailVO transferModelToVO(AlatTerpasangDetail model, AlatTerpasangDetailVO vo) {
|
||||
if (null == vo)
|
||||
vo = new AlatTerpasangDetailVO();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, AlatTerpasangDetailVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,91 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.Anamnesis;
|
||||
|
||||
import com.jasamedika.medifirst2000.vo.AnamnesisVO;
|
||||
|
||||
@Component
|
||||
public class AnamnesisConverter implements BaseVoConverter<AnamnesisVO, Anamnesis> {
|
||||
|
||||
|
||||
@Override
|
||||
public Anamnesis transferVOToModel(AnamnesisVO vo, Anamnesis model) {
|
||||
if (null == model)
|
||||
model = new Anamnesis();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude,vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, Anamnesis.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AnamnesisVO> transferListOfModelToListOfVO(List<Anamnesis> models, List<AnamnesisVO> vos) {
|
||||
|
||||
if (null == vos)
|
||||
vos = new ArrayList<AnamnesisVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (Anamnesis anamansis : models) {
|
||||
AnamnesisVO vo = new AnamnesisVO();
|
||||
vo=transferModelToVO(anamansis, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AnamnesisVO transferModelToVO(Anamnesis model, AnamnesisVO vo) {
|
||||
if (null == vo)
|
||||
vo = new AnamnesisVO();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, AnamnesisVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
public AnamnesisVO transferModelToVOCustom(Anamnesis model, AnamnesisVO vo,String[] fieldsToInclude) {
|
||||
if (null == vo)
|
||||
|
||||
vo = new AnamnesisVO();
|
||||
|
||||
try {
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, AnamnesisVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,76 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.AntrianPasienDiPeriksa;
|
||||
import com.jasamedika.medifirst2000.vo.AntrianPasienDiPeriksaVO;
|
||||
|
||||
/**
|
||||
* Converter class between Pasien and PasienVO
|
||||
*
|
||||
* @author Askur
|
||||
*/
|
||||
@Component
|
||||
public class AntrianPasienDiPeriksaConverter implements BaseVoConverter<AntrianPasienDiPeriksaVO, AntrianPasienDiPeriksa> {
|
||||
|
||||
|
||||
@Override
|
||||
public AntrianPasienDiPeriksa transferVOToModel(AntrianPasienDiPeriksaVO vo, AntrianPasienDiPeriksa model) {
|
||||
if (null == model)
|
||||
model = new AntrianPasienDiPeriksa();
|
||||
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude,vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, AntrianPasienDiPeriksa.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AntrianPasienDiPeriksaVO> transferListOfModelToListOfVO(List<AntrianPasienDiPeriksa> models, List<AntrianPasienDiPeriksaVO> vos) {
|
||||
|
||||
if (null == vos)
|
||||
vos = new ArrayList<AntrianPasienDiPeriksaVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (AntrianPasienDiPeriksa pegawai : models) {
|
||||
AntrianPasienDiPeriksaVO vo = new AntrianPasienDiPeriksaVO();
|
||||
vo=transferModelToVO(pegawai, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AntrianPasienDiPeriksaVO transferModelToVO(AntrianPasienDiPeriksa model, AntrianPasienDiPeriksaVO vo) {
|
||||
if (null == vo)
|
||||
vo = new AntrianPasienDiPeriksaVO();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, AntrianPasienDiPeriksaVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,80 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.AntrianPasienRegistrasi;
|
||||
import com.jasamedika.medifirst2000.vo.AntrianPasienRegistrasiVO;
|
||||
|
||||
/**
|
||||
* Converter class between Pasien and PasienVO
|
||||
*
|
||||
* @author Askur
|
||||
*/
|
||||
@Component
|
||||
public class AntrianPasienRegistrasiConverter implements BaseVoConverter<AntrianPasienRegistrasiVO, AntrianPasienRegistrasi> {
|
||||
|
||||
|
||||
@Override
|
||||
public AntrianPasienRegistrasi transferVOToModel(AntrianPasienRegistrasiVO vo, AntrianPasienRegistrasi model) {
|
||||
if (null == model)
|
||||
model = new AntrianPasienRegistrasi();
|
||||
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude,vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, AntrianPasienRegistrasi.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AntrianPasienRegistrasiVO> transferListOfModelToListOfVO(List<AntrianPasienRegistrasi> models, List<AntrianPasienRegistrasiVO> vos) {
|
||||
|
||||
if (null == vos)
|
||||
vos = new ArrayList<AntrianPasienRegistrasiVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (AntrianPasienRegistrasi pegawai : models) {
|
||||
AntrianPasienRegistrasiVO vo = new AntrianPasienRegistrasiVO();
|
||||
vo=transferModelToVO(pegawai, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AntrianPasienRegistrasiVO transferModelToVO(AntrianPasienRegistrasi model, AntrianPasienRegistrasiVO vo) {
|
||||
if (null == vo)
|
||||
vo = new AntrianPasienRegistrasiVO();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, AntrianPasienRegistrasiVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,71 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.dao.custom.base.impl.FindConverterDao;
|
||||
import com.jasamedika.medifirst2000.entities.AsalPeserta;
|
||||
import com.jasamedika.medifirst2000.util.ExtendedSpringBeanUtil;
|
||||
import com.jasamedika.medifirst2000.vo.AsalPesertaVO;
|
||||
|
||||
/**
|
||||
* Converter class between AsalPeserta and AsalPesertaVO
|
||||
*
|
||||
* @author Lukman Hakim
|
||||
*/
|
||||
@Component
|
||||
public class AsalPesertaConverter extends FindConverterDao implements
|
||||
BaseVoConverter<AsalPesertaVO, AsalPeserta> {
|
||||
|
||||
public AsalPeserta transferVOToModel(AsalPesertaVO vo, AsalPeserta model) {
|
||||
if (null == model)
|
||||
model = new AsalPeserta();
|
||||
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude,vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, AsalPeserta.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return model;
|
||||
|
||||
}
|
||||
|
||||
public List<AsalPesertaVO> transferListOfModelToListOfVO(List<AsalPeserta> models,
|
||||
List<AsalPesertaVO> vos) {
|
||||
if (null == vos)
|
||||
vos = new ArrayList<AsalPesertaVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (AsalPeserta asalPeserta : models) {
|
||||
AsalPesertaVO asalPesertaVO = new AsalPesertaVO();
|
||||
transferModelToVO(asalPeserta, asalPesertaVO);
|
||||
vos.add(asalPesertaVO);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
public AsalPesertaVO transferModelToVO(AsalPeserta model, AsalPesertaVO vo) {
|
||||
if (null == vo)
|
||||
vo = new AsalPesertaVO();
|
||||
|
||||
// fix this
|
||||
ExtendedSpringBeanUtil.copySpecificProperties(model, vo,
|
||||
new String[] { "asalPeserta", }, new String[] { "asalPeserta" });
|
||||
// LoginUserVO test = loginUserService.findById(new Integer(1));
|
||||
// System.out.println("tea = " + test.getKataSandi());
|
||||
return vo;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,76 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.AsalRujukan;
|
||||
import com.jasamedika.medifirst2000.vo.AsalRujukanVO;
|
||||
|
||||
@Component
|
||||
public class AsalRujukanConverter implements BaseVoConverter<AsalRujukanVO, AsalRujukan> {
|
||||
|
||||
|
||||
@Override
|
||||
public AsalRujukan transferVOToModel(AsalRujukanVO vo, AsalRujukan model) {
|
||||
if (null == model)
|
||||
model = new AsalRujukan();
|
||||
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude,vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, AsalRujukan.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AsalRujukanVO> transferListOfModelToListOfVO(List<AsalRujukan> models, List<AsalRujukanVO> vos) {
|
||||
|
||||
if (null == vos)
|
||||
vos = new ArrayList<AsalRujukanVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (AsalRujukan asalRujukan : models) {
|
||||
AsalRujukanVO vo = new AsalRujukanVO();
|
||||
vo=transferModelToVO(asalRujukan, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AsalRujukanVO transferModelToVO(AsalRujukan model, AsalRujukanVO vo) {
|
||||
if (null == vo)
|
||||
vo = new AsalRujukanVO();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, AsalRujukanVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,91 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.AsesmenGiziAwal;
|
||||
|
||||
import com.jasamedika.medifirst2000.vo.AsesmenGiziAwalVO;
|
||||
|
||||
@Component
|
||||
public class AsesmenGiziAwalConverter implements BaseVoConverter<AsesmenGiziAwalVO, AsesmenGiziAwal> {
|
||||
|
||||
|
||||
@Override
|
||||
public AsesmenGiziAwal transferVOToModel(AsesmenGiziAwalVO vo, AsesmenGiziAwal model) {
|
||||
if (null == model)
|
||||
model = new AsesmenGiziAwal();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude,vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, AsesmenGiziAwal.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AsesmenGiziAwalVO> transferListOfModelToListOfVO(List<AsesmenGiziAwal> models, List<AsesmenGiziAwalVO> vos) {
|
||||
|
||||
if (null == vos)
|
||||
vos = new ArrayList<AsesmenGiziAwalVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (AsesmenGiziAwal asesmenGiziAwal : models) {
|
||||
AsesmenGiziAwalVO vo = new AsesmenGiziAwalVO();
|
||||
vo=transferModelToVO(asesmenGiziAwal, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AsesmenGiziAwalVO transferModelToVO(AsesmenGiziAwal model, AsesmenGiziAwalVO vo) {
|
||||
if (null == vo)
|
||||
vo = new AsesmenGiziAwalVO();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, AsesmenGiziAwalVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
public AsesmenGiziAwalVO transferModelToVOCustom(AsesmenGiziAwal model, AsesmenGiziAwalVO vo,String[] fieldsToInclude) {
|
||||
if (null == vo)
|
||||
|
||||
vo = new AsesmenGiziAwalVO();
|
||||
|
||||
try {
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, AsesmenGiziAwalVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,72 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.AsesmenGiziLanjut;
|
||||
import com.jasamedika.medifirst2000.vo.AsesmenGiziLanjutVO;
|
||||
|
||||
@Component
|
||||
public class AsesmenGiziLanjutConverter implements BaseVoConverter<AsesmenGiziLanjutVO, AsesmenGiziLanjut> {
|
||||
|
||||
@Override
|
||||
public AsesmenGiziLanjut transferVOToModel(AsesmenGiziLanjutVO vo, AsesmenGiziLanjut model) {
|
||||
|
||||
if (model == null)
|
||||
model = new AsesmenGiziLanjut();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude, vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, AsesmenGiziLanjut.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AsesmenGiziLanjutVO> transferListOfModelToListOfVO(List<AsesmenGiziLanjut> models,
|
||||
List<AsesmenGiziLanjutVO> vos) {
|
||||
|
||||
if (null == vos)
|
||||
vos = new ArrayList<AsesmenGiziLanjutVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (AsesmenGiziLanjut asesmenGiziLanjut : models) {
|
||||
AsesmenGiziLanjutVO vo = new AsesmenGiziLanjutVO();
|
||||
vo = transferModelToVO(asesmenGiziLanjut, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AsesmenGiziLanjutVO transferModelToVO(AsesmenGiziLanjut model, AsesmenGiziLanjutVO vo) {
|
||||
|
||||
if (null == vo)
|
||||
vo = new AsesmenGiziLanjutVO();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude, model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, AsesmenGiziLanjutVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
}
|
||||
@ -2,17 +2,15 @@ package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.TypeAdapterFactory;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import com.jasamedika.medifirst2000.base.BaseModel;
|
||||
import com.jasamedika.medifirst2000.base.vo.BaseActiveVO;
|
||||
import com.jasamedika.medifirst2000.base.vo.BaseModelVO;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.util.ExtendedSpringBeanUtil;
|
||||
import com.jasamedika.medifirst2000.util.JsonUtil;
|
||||
import org.hibernate.Hibernate;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.hibernate.proxy.HibernateProxy;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.stereotype.Component;
|
||||
@ -20,159 +18,41 @@ import org.springframework.stereotype.Component;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.OneToMany;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.jasamedika.medifirst2000.util.ExtendedSpringBeanUtil.copySpecificProperties;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Component
|
||||
public class BaseConverterImpl<T extends BaseActiveVO, T1 extends BaseModel> implements BaseVoConverter<T, T1> {
|
||||
@Slf4j
|
||||
public class BaseConverterImpl<V extends BaseActiveVO, T extends BaseModel> implements BaseVoConverter<V, T> {
|
||||
|
||||
private final Class<T> classOfT;
|
||||
|
||||
private final Class<V> classOfV;
|
||||
|
||||
private Class<T> classOfT;
|
||||
// private Class<T1> classOfT1;
|
||||
private Boolean useGson;
|
||||
private Boolean useExclude;
|
||||
|
||||
public static <TModel extends BaseModel, TVo extends BaseActiveVO> TModel transferVOToModelData(TVo vo,
|
||||
TModel model) {
|
||||
public BaseConverterImpl(Class<T> classOfT, Class<V> classOfV) {
|
||||
this.classOfT = classOfT;
|
||||
this.classOfV = classOfV;
|
||||
}
|
||||
|
||||
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public T transferVOToModel(V vo, T model) {
|
||||
if (null == model)
|
||||
try {
|
||||
model = (TModel) model.getClass().newInstance();
|
||||
} catch (InstantiationException e1) {
|
||||
e1.printStackTrace();
|
||||
} catch (IllegalAccessException e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
|
||||
model = classOfT.getDeclaredConstructor().newInstance();
|
||||
try {
|
||||
// String[] fieldsToInclude = null;
|
||||
List<String> fieldsToInclude = new ArrayList<String>();
|
||||
for (Field field : model.GetFields(model.getClass())) {
|
||||
String str = field.getName();
|
||||
fieldsToInclude.add(str);
|
||||
}
|
||||
Map<String, Object> serialized = vo.ToMap();
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
|
||||
model = (TModel) gson.fromJson(json, model.getClass());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return model;
|
||||
|
||||
}
|
||||
|
||||
public Boolean getUseExclude() {
|
||||
return useExclude;
|
||||
}
|
||||
|
||||
public void setUseExclude(Boolean useExclude) {
|
||||
this.useExclude = useExclude;
|
||||
}
|
||||
|
||||
private static final TypeAdapterFactory FACTORY = new TypeAdapterFactory() {
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
|
||||
return (HibernateProxy.class.isAssignableFrom(type.getRawType())
|
||||
? (TypeAdapter<T>) new HibernateProxyTypeAdapter(gson) : null);
|
||||
}
|
||||
};
|
||||
|
||||
private static final class HibernateProxyTypeAdapter extends TypeAdapter<HibernateProxy> {
|
||||
|
||||
private final Gson context;
|
||||
|
||||
private HibernateProxyTypeAdapter(Gson context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HibernateProxy read(JsonReader r) throws IOException {
|
||||
throw new UnsupportedOperationException("Not supported");
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@Override
|
||||
public void write(JsonWriter out, HibernateProxy value) throws IOException {
|
||||
if (value == null) {
|
||||
out.nullValue();
|
||||
return;
|
||||
}
|
||||
// Retrieve the original (not proxy) class
|
||||
Class<?> baseType = Hibernate.getClass(value);
|
||||
// Get the TypeAdapter of the original class, to delegate the
|
||||
// serialization
|
||||
TypeAdapter delegate = context.getAdapter(TypeToken.get(baseType));
|
||||
// Get a filled instance of the original class
|
||||
Object unproxiedValue = ((HibernateProxy) value).getHibernateLazyInitializer().getImplementation();
|
||||
// Serialize the value
|
||||
delegate.write(out, unproxiedValue);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public T transferModelToVOCustom(T1 model, T vo, String[] fieldsToInclude) {
|
||||
|
||||
try {
|
||||
|
||||
// Add TypeAdapterFactory // Syamsu
|
||||
// GsonBuilder builder = new GsonBuilder();
|
||||
// builder.registerTypeAdapterFactory(BaseConverterImpl.FACTORY);
|
||||
// Gson gson = builder.create();
|
||||
// Sampai sini
|
||||
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude, model.getClass().getSimpleName());
|
||||
|
||||
Gson gson = new Gson();
|
||||
|
||||
String json = gson.toJson(serialized);
|
||||
vo = (T) gson.fromJson(json, vo.getClass());
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
public T1 transferVOToModel(Map<String, Object> vo, T1 model) {
|
||||
if (null == model)
|
||||
try {
|
||||
model = (T1) model.getClass().newInstance();
|
||||
} catch (InstantiationException e1) {
|
||||
e1.printStackTrace();
|
||||
} catch (IllegalAccessException e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
|
||||
try {
|
||||
// String[] fieldsToInclude = null;
|
||||
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(vo);
|
||||
// model = (T1) gson.fromJson(json, model.getClass());
|
||||
model = (T1) gson.fromJson(json, model.getClass());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return model;
|
||||
|
||||
}
|
||||
|
||||
public T1 transferVOToModel(T vo, T1 model) {
|
||||
if (null == model)
|
||||
try {
|
||||
model = (T1) model.getClass().newInstance();
|
||||
} catch (InstantiationException e1) {
|
||||
e1.printStackTrace();
|
||||
} catch (IllegalAccessException e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
|
||||
try {
|
||||
// String[] fieldsToInclude = null;
|
||||
List<String> fieldsToInclude = new ArrayList<String>();
|
||||
for (Field field : model.GetFields(model.getClass())) {
|
||||
List<String> fieldsToInclude = new ArrayList<>();
|
||||
for (Field field : BaseModel.GetFields(model.getClass())) {
|
||||
String str = field.getName();
|
||||
fieldsToInclude.add(str);
|
||||
}
|
||||
@ -180,90 +60,179 @@ public class BaseConverterImpl<T extends BaseActiveVO, T1 extends BaseModel> imp
|
||||
vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
// model = (T1) gson.fromJson(json, model.getClass());
|
||||
if (getUseGson() == null || getUseGson() == false)
|
||||
ExtendedSpringBeanUtil.copySpecificProperties((Object) vo, (Object) model,
|
||||
fieldsToInclude.toArray(new String[0]), fieldsToInclude.toArray(new String[0]));
|
||||
if (getUseGson() == null || !getUseGson())
|
||||
copySpecificProperties(vo, model, fieldsToInclude.toArray(new String[0]),
|
||||
fieldsToInclude.toArray(new String[0]));
|
||||
else
|
||||
|
||||
model = (T1) gson.fromJson(json, model.getClass());
|
||||
model = (T) gson.fromJson(json, model.getClass());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
return model;
|
||||
|
||||
}
|
||||
|
||||
public List<T> transferListOfModelToListOfVO(Page<T1> models, List<T> vos, Class<T> cls) {
|
||||
if (null == vos)
|
||||
vos = new ArrayList<T>();
|
||||
@SneakyThrows
|
||||
public T transferVOToModel(Map<String, Object> vo, T model) {
|
||||
if (null == model)
|
||||
model = classOfT.getDeclaredConstructor().newInstance();
|
||||
try {
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(vo);
|
||||
model = (T) gson.fromJson(json, model.getClass());
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
return model;
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
public T transferVOToModelData(V vo, T model) {
|
||||
if (null == model)
|
||||
model = (T) classOfT.getDeclaredConstructor().newInstance();
|
||||
try {
|
||||
Map<String, Object> serialized = vo.ToMap();
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = (T) gson.fromJson(json, model.getClass());
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
return model;
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public List<V> transferListOfModelToListOfVO(List<T> models, List<V> vos) {
|
||||
if (null == vos)
|
||||
vos = new ArrayList<>();
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (T1 T1 : models.getContent()) {
|
||||
T T = null;
|
||||
for (T model : models) {
|
||||
V VO = classOfV.getDeclaredConstructor().newInstance();
|
||||
try {
|
||||
|
||||
T = (T) cls.newInstance();
|
||||
T = transferModelToVO(T1, T);
|
||||
vos.add(T);
|
||||
} catch (InstantiationException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
VO = transferModelToVO(model, VO);
|
||||
vos.add(VO);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
public List<T> transferListOfModelToListOfVO(List<T1> models, List<T> vos, Class<T> cls) {
|
||||
public List<V> transferListOfModelToListOfVO(List<T> models, List<V> vos, Class<V> cls) {
|
||||
if (null == vos)
|
||||
vos = new ArrayList<T>();
|
||||
|
||||
vos = new ArrayList<>();
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (T1 T1 : models) {
|
||||
T T = null;
|
||||
for (T T1 : models) {
|
||||
V T;
|
||||
try {
|
||||
|
||||
T = (T) cls.newInstance();
|
||||
T = cls.newInstance();
|
||||
T = transferModelToVO(T1, T);
|
||||
vos.add(T);
|
||||
} catch (InstantiationException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
} catch (InstantiationException | IllegalAccessException e) {
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
public T clone(T model, T vo, String[] expected) throws IllegalArgumentException, IllegalAccessException {
|
||||
public List<V> transferListOfModelToListOfVO(Page<T> models, List<V> vos, Class<V> cls) {
|
||||
if (null == vos)
|
||||
vos = new ArrayList<>();
|
||||
if (null == models)
|
||||
return vos;
|
||||
for (T T1 : models.getContent()) {
|
||||
V T;
|
||||
try {
|
||||
T = cls.newInstance();
|
||||
T = transferModelToVO(T1, T);
|
||||
vos.add(T);
|
||||
} catch (InstantiationException | IllegalAccessException e) {
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
return vos;
|
||||
}
|
||||
|
||||
List<String> fieldsToInclude = new ArrayList<String>();
|
||||
for (Field field : model.GetFields(model.getClass())) {
|
||||
@Override
|
||||
public V transferModelToVOCustom(T model, V vo, String[] fieldsToInclude) {
|
||||
try {
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude, model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = (V) gson.fromJson(json, vo.getClass());
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
public V transferModelToVOCustom(T model, V vo) {
|
||||
if (null == vo)
|
||||
vo = classOfV.getDeclaredConstructor().newInstance();
|
||||
try {
|
||||
Map<String, Object> serialized = model.serialize(null, model.getClass().getSimpleName());
|
||||
Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = (V) gson.fromJson(json, vo.getClass());
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public V transferModelToVO(T model, V vo) {
|
||||
if (null == vo)
|
||||
vo = classOfV.getDeclaredConstructor().newInstance();
|
||||
List<String> fieldsToInclude = new ArrayList<>();
|
||||
for (Field field : BaseModel.GetFields(model.getClass())) {
|
||||
String str = field.getName();
|
||||
Boolean valid = false;
|
||||
fieldsToInclude.add(str);
|
||||
}
|
||||
try {
|
||||
if (getUseGson() == null || !getUseGson()) {
|
||||
Gson gson;
|
||||
if (getUseExclude() == null || !getUseExclude()) {
|
||||
gson = new GsonBuilder().setDateFormat("yyyy-MM-dd HH:mm:ss.SSS").create();
|
||||
} else {
|
||||
gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation()
|
||||
.setDateFormat("yyyy-MM-dd HH:mm:ss.SSS").create();
|
||||
}
|
||||
String json = gson.toJson(ToMap(model));
|
||||
gson = new GsonBuilder().setDateFormat("yyyy-MM-dd HH:mm:ss.SSS").create();
|
||||
vo = (V) gson.fromJson(json, vo.getClass());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
if (getUseGson() != null && getUseGson())
|
||||
copySpecificProperties(model, vo, fieldsToInclude.toArray(new String[0]),
|
||||
fieldsToInclude.toArray(new String[0]));
|
||||
return vo;
|
||||
}
|
||||
|
||||
public V clone(V model, V vo, String[] expected) throws IllegalArgumentException, IllegalAccessException {
|
||||
for (Field field : BaseModelVO.GetFields(model.getClass())) {
|
||||
String str = field.getName();
|
||||
boolean valid = false;
|
||||
for (String key : expected) {
|
||||
if (str.equals(key))
|
||||
if (str.equals(key)) {
|
||||
valid = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!valid) {
|
||||
field.set(vo, field.get(model));
|
||||
}
|
||||
fieldsToInclude.add(str);
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
public T1 clone(T1 model, T1 vo, String[] expected) throws IllegalArgumentException, IllegalAccessException {
|
||||
public T clone(T model, T vo, String[] expected) throws IllegalArgumentException, IllegalAccessException {
|
||||
for (Field field : BaseModel.GetFields(model.getClass())) {
|
||||
String str = field.getName();
|
||||
boolean valid = false;
|
||||
@ -279,266 +248,107 @@ public class BaseConverterImpl<T extends BaseActiveVO, T1 extends BaseModel> imp
|
||||
Object obj = field.get(model);
|
||||
field.set(vo, obj);
|
||||
} catch (IllegalArgumentException | IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
public T transferModelToVO(T1 model, T vo) {
|
||||
if (null == vo)
|
||||
try {
|
||||
vo = (T) classOfT.newInstance();
|
||||
} catch (InstantiationException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// fix thi
|
||||
List<String> fieldsToInclude = new ArrayList<String>();
|
||||
for (Field field : model.GetFields(model.getClass())) {
|
||||
String str = field.getName();
|
||||
fieldsToInclude.add(str);
|
||||
}
|
||||
Gson gson = new Gson();
|
||||
try {
|
||||
if (getUseGson() == null || getUseGson() == false) {
|
||||
if (getUseExclude() == null || getUseExclude() == false)
|
||||
gson = new GsonBuilder()// .excludeFieldsWithoutExposeAnnotation()
|
||||
.setDateFormat("yyyy-MM-dd HH:mm:ss.SSS").create();
|
||||
else
|
||||
gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation()
|
||||
.setDateFormat("yyyy-MM-dd HH:mm:ss.SSS").create();
|
||||
// serialized = model.serialize(fieldsToInclude.toArray(new
|
||||
// String[0]), model.getClass().getName());
|
||||
String json = gson.toJson(ToMap(model));
|
||||
gson = new GsonBuilder()// .excludeFieldsWithoutExposeAnnotation()
|
||||
.setDateFormat("yyyy-MM-dd HH:mm:ss.SSS").create();
|
||||
vo = (T) gson.fromJson(json, vo.getClass());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (getUseGson() != null && getUseGson() == true)
|
||||
ExtendedSpringBeanUtil.copySpecificProperties((Object) model, (Object) vo,
|
||||
fieldsToInclude.toArray(new String[0]), fieldsToInclude.toArray(new String[0]));
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
public Boolean getUseGson() {
|
||||
return useGson;
|
||||
}
|
||||
|
||||
public void setUseGson(Boolean useGson) {
|
||||
this.useGson = useGson;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<T> transferListOfModelToListOfVO(List<T1> models, List<T> vos) {
|
||||
|
||||
if (null == vos)
|
||||
vos = new ArrayList<T>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (T1 T1 : models) {
|
||||
T T = null;
|
||||
try {
|
||||
T = transferModelToVO(T1, T);
|
||||
vos.add(T);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> ToMaps(List<T1> model) throws IllegalArgumentException, IllegalAccessException {
|
||||
|
||||
public List<Map<String, Object>> ToMaps(List<T> model) throws IllegalArgumentException, IllegalAccessException {
|
||||
List<Map<String, Object>> maps = new ArrayList<>();
|
||||
for (Iterator iterator = model.iterator(); iterator.hasNext();) {
|
||||
T1 map = (T1) iterator.next();
|
||||
for (T map : model) {
|
||||
Map<String, Object> convert = ToMap(map);
|
||||
maps.add(convert);
|
||||
}
|
||||
return maps;
|
||||
}
|
||||
|
||||
public Map<String, Object> ToMap(T1 model) throws IllegalArgumentException, IllegalAccessException {
|
||||
public Map<String, Object> ToMap(T model) throws IllegalArgumentException, IllegalAccessException {
|
||||
Map<String, Object> maps = new HashMap<>();
|
||||
for (Field field : model.GetFields(model.getClass())) {
|
||||
String str = field.getName();
|
||||
if (str.equals("ruanganTujuan")) {
|
||||
System.out.println();
|
||||
}
|
||||
for (Field field : BaseModel.GetFields(model.getClass())) {
|
||||
String name = field.getName();
|
||||
field.setAccessible(true);
|
||||
if (name.equals("serialVersionUID"))
|
||||
switch (name) {
|
||||
case "serialVersionUID":
|
||||
case "_methods_":
|
||||
case "handler":
|
||||
case "_filter_signature":
|
||||
continue;
|
||||
if (name.equals("_methods_"))
|
||||
continue;
|
||||
if (name.equals("handler"))
|
||||
continue;
|
||||
if (name.equals("_filter_signature"))
|
||||
continue;
|
||||
Boolean valid = false;
|
||||
for (java.lang.annotation.Annotation annotation : field.getDeclaredAnnotations()) {
|
||||
if (annotation instanceof JoinColumn) {
|
||||
valid = true;
|
||||
} else if (annotation instanceof Column) {
|
||||
Column column = (Column) annotation;
|
||||
if (column.name().endsWith("Fk"))
|
||||
if (field.getName().endsWith("Id") == false)
|
||||
valid = true;
|
||||
} else if (annotation instanceof OneToMany) {
|
||||
|
||||
valid = true;
|
||||
}
|
||||
|
||||
}
|
||||
if (valid == false)
|
||||
boolean valid = isValidItem(field, !field.getName().endsWith("Id"));
|
||||
if (!valid)
|
||||
maps.put(field.getName(), field.get(model));
|
||||
|
||||
}
|
||||
|
||||
for (Field field : model.GetFields(model.getClass())) {
|
||||
for (Field field : BaseModel.GetFields(model.getClass())) {
|
||||
String str = field.getName();
|
||||
String name = field.getName();
|
||||
field.setAccessible(true);
|
||||
if (str.equals("departemen")) {
|
||||
System.out.println();
|
||||
switch (name) {
|
||||
case "serialVersionUID":
|
||||
case "_methods_":
|
||||
case "handler":
|
||||
case "_filter_signature":
|
||||
continue;
|
||||
}
|
||||
if (name.equals("serialVersionUID"))
|
||||
continue;
|
||||
if (name.equals("_methods_"))
|
||||
continue;
|
||||
if (name.equals("handler"))
|
||||
continue;
|
||||
if (name.equals("_filter_signature"))
|
||||
continue;
|
||||
Boolean valid = false;
|
||||
for (java.lang.annotation.Annotation annotation : field.getDeclaredAnnotations()) {
|
||||
if (annotation instanceof JoinColumn) {
|
||||
valid = true;
|
||||
} else if (annotation instanceof Column) {
|
||||
Column column = (Column) annotation;
|
||||
if (column.name().endsWith("Fk"))
|
||||
if (field.getName().endsWith("Id") == false)
|
||||
valid = true;
|
||||
} else if (annotation instanceof OneToMany) {
|
||||
|
||||
valid = true;
|
||||
}
|
||||
}
|
||||
if (valid == true) {
|
||||
boolean valid = isValidItem(field, !field.getName().endsWith("Id"));
|
||||
if (valid) {
|
||||
Object property = field.get(model);
|
||||
if (property instanceof HibernateProxy) {
|
||||
if (property instanceof HibernateProxy)
|
||||
property = JsonUtil.initializeAndUnproxy(property);
|
||||
}
|
||||
if (property == null)
|
||||
maps.put(str, null);
|
||||
else {
|
||||
if (property instanceof BaseModel) {
|
||||
Map<String, Object> mapItems = new HashMap<>();
|
||||
for (Field fieldItem : ((BaseModel) property).GetFields(property.getClass())) {
|
||||
for (Field fieldItem : BaseModel.GetFields(property.getClass())) {
|
||||
String nameItem = fieldItem.getName();
|
||||
fieldItem.setAccessible(true);
|
||||
if (nameItem.equals("serialVersionUID"))
|
||||
switch (nameItem) {
|
||||
case "serialVersionUID":
|
||||
case "_methods_":
|
||||
case "handler":
|
||||
case "_filter_signature":
|
||||
continue;
|
||||
if (nameItem.equals("_methods_"))
|
||||
continue;
|
||||
if (nameItem.equals("handler"))
|
||||
continue;
|
||||
if (nameItem.equals("_filter_signature"))
|
||||
continue;
|
||||
Boolean validItem = false;
|
||||
for (java.lang.annotation.Annotation annotationItem : fieldItem.getDeclaredAnnotations()) {
|
||||
if (annotationItem instanceof JoinColumn) {
|
||||
validItem = true;
|
||||
} else if (annotationItem instanceof Column) {
|
||||
Column columnItem = (Column) annotationItem;
|
||||
if (columnItem.name().endsWith("Fk"))
|
||||
if (fieldItem.getName().endsWith("Id") == false)
|
||||
validItem = true;
|
||||
} else if (annotationItem instanceof OneToMany) {
|
||||
|
||||
validItem = true;
|
||||
}
|
||||
}
|
||||
if (validItem == false) {
|
||||
boolean validItem = isValidItem(fieldItem, !fieldItem.getName().endsWith("Id"));
|
||||
if (!validItem)
|
||||
mapItems.put(fieldItem.getName(), fieldItem.get(property));
|
||||
}
|
||||
}
|
||||
for (Field fieldDetail : ((BaseModel) property).GetFields(property.getClass())) {
|
||||
for (Field fieldDetail : BaseModel.GetFields(property.getClass())) {
|
||||
String strDetail = fieldDetail.getName();
|
||||
String nameDetail = fieldDetail.getName();
|
||||
fieldDetail.setAccessible(true);
|
||||
if (nameDetail.equals("serialVersionUID"))
|
||||
switch (nameDetail) {
|
||||
case "serialVersionUID":
|
||||
case "_methods_":
|
||||
case "handler":
|
||||
case "_filter_signature":
|
||||
continue;
|
||||
if (nameDetail.equals("_methods_"))
|
||||
continue;
|
||||
if (nameDetail.equals("handler"))
|
||||
continue;
|
||||
if (nameDetail.equals("_filter_signature"))
|
||||
continue;
|
||||
Boolean validDetail = false;
|
||||
for (java.lang.annotation.Annotation annotationDetail : fieldDetail
|
||||
.getDeclaredAnnotations()) {
|
||||
if (annotationDetail instanceof JoinColumn) {
|
||||
validDetail = true;
|
||||
} else if (annotationDetail instanceof Column) {
|
||||
Column column = (Column) annotationDetail;
|
||||
if (column.name().endsWith("Fk"))
|
||||
if (fieldDetail.getName().endsWith("Id") == false)
|
||||
validDetail = true;
|
||||
} else if (annotationDetail instanceof OneToMany) {
|
||||
|
||||
validDetail = true;
|
||||
}
|
||||
}
|
||||
if (validDetail == true) {
|
||||
boolean validDetail = isValidItem(fieldDetail, !fieldDetail.getName().endsWith("Id"));
|
||||
if (validDetail) {
|
||||
Object propertyDetail = fieldDetail.get(property);
|
||||
if (propertyDetail instanceof HibernateProxy) {
|
||||
propertyDetail = JsonUtil.initializeAndUnproxy(propertyDetail);
|
||||
}
|
||||
if (propertyDetail instanceof BaseModel) {
|
||||
Map<String, Object> mapDetailItems = new HashMap<>();
|
||||
for (Field fieldDetailItem : ((BaseModel) propertyDetail)
|
||||
.GetFields(propertyDetail.getClass())) {
|
||||
for (Field fieldDetailItem : BaseModel.GetFields(propertyDetail.getClass())) {
|
||||
String nameDetailItem = fieldDetailItem.getName();
|
||||
fieldDetailItem.setAccessible(true);
|
||||
if (nameDetailItem.equals("serialVersionUID"))
|
||||
switch (nameDetailItem) {
|
||||
case "serialVersionUID":
|
||||
case "_methods_":
|
||||
case "handler":
|
||||
case "_filter_signature":
|
||||
continue;
|
||||
if (nameDetailItem.equals("_methods_"))
|
||||
continue;
|
||||
if (nameDetailItem.equals("handler"))
|
||||
continue;
|
||||
if (nameDetailItem.equals("_filter_signature"))
|
||||
continue;
|
||||
Boolean validDetailItem = false;
|
||||
for (java.lang.annotation.Annotation annotationDetailItem : fieldDetailItem
|
||||
.getDeclaredAnnotations()) {
|
||||
if (annotationDetailItem instanceof JoinColumn) {
|
||||
validDetailItem = true;
|
||||
} else if (annotationDetailItem instanceof Column) {
|
||||
Column columnItem = (Column) annotationDetailItem;
|
||||
if (columnItem.name().endsWith("Fk"))
|
||||
if (fieldDetailItem.getName().endsWith("Id") == false)
|
||||
validDetailItem = true;
|
||||
} else if (annotationDetailItem instanceof OneToMany) {
|
||||
|
||||
validDetailItem = true;
|
||||
}
|
||||
}
|
||||
if (validDetailItem == false) {
|
||||
boolean validDetailItem = isValidItem(fieldDetailItem,
|
||||
!fieldDetailItem.getName().endsWith("Id"));
|
||||
if (!validDetailItem)
|
||||
mapDetailItems.put(fieldDetailItem.getName(),
|
||||
fieldDetailItem.get(propertyDetail));
|
||||
}
|
||||
}
|
||||
mapItems.put(strDetail, mapDetailItems);
|
||||
}
|
||||
@ -547,28 +357,29 @@ public class BaseConverterImpl<T extends BaseActiveVO, T1 extends BaseModel> imp
|
||||
}
|
||||
maps.put(str, mapItems);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return maps;
|
||||
}
|
||||
|
||||
public T transferModelToVOCustom(T1 model, T vo) {
|
||||
if (null == vo)
|
||||
vo = (T) new Object();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude, model.getClass().getSimpleName());
|
||||
Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = (T) gson.fromJson(json, vo.getClass());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
private static boolean isValidItem(Field fieldDetailItem, boolean fieldDetailItem1) {
|
||||
boolean validDetailItem = false;
|
||||
for (java.lang.annotation.Annotation annotationDetailItem : fieldDetailItem.getDeclaredAnnotations()) {
|
||||
if (annotationDetailItem instanceof JoinColumn) {
|
||||
validDetailItem = true;
|
||||
} else if (annotationDetailItem instanceof Column) {
|
||||
Column columnItem = (Column) annotationDetailItem;
|
||||
if (columnItem.name().endsWith("Fk"))
|
||||
if (fieldDetailItem1)
|
||||
validDetailItem = true;
|
||||
} else if (annotationDetailItem instanceof OneToMany) {
|
||||
|
||||
validDetailItem = true;
|
||||
}
|
||||
}
|
||||
return vo;
|
||||
return validDetailItem;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,114 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.OneToMany;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.BobotIndikator;
|
||||
import com.jasamedika.medifirst2000.vo.BobotIndikatorVO;
|
||||
|
||||
@Component
|
||||
public class BobotIndikatorConverter implements BaseVoConverter<BobotIndikatorVO, BobotIndikator>{
|
||||
|
||||
@Override
|
||||
public BobotIndikator transferVOToModel(BobotIndikatorVO vo, BobotIndikator model) {
|
||||
if (null == model)
|
||||
model = new BobotIndikator();
|
||||
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude,vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, BobotIndikator.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BobotIndikatorVO> transferListOfModelToListOfVO(List<BobotIndikator> models, List<BobotIndikatorVO> vos) {
|
||||
|
||||
if (null == vos)
|
||||
vos = new ArrayList<BobotIndikatorVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (BobotIndikator pegawai : models) {
|
||||
BobotIndikatorVO vo = new BobotIndikatorVO();
|
||||
vo=transferModelToVO(pegawai, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BobotIndikatorVO transferModelToVO(BobotIndikator model, BobotIndikatorVO vo) {
|
||||
if (null == vo)
|
||||
vo = new BobotIndikatorVO();
|
||||
try {
|
||||
|
||||
List<String> fieldsToInclude = new ArrayList<String>();
|
||||
for (Field field : model.GetFields(model.getClass())) {
|
||||
String str = field.getName();
|
||||
String name = field.getName();
|
||||
if(name.equals("serialVersionUID"))continue;
|
||||
Boolean valid = false;
|
||||
for (java.lang.annotation.Annotation annotation : field.getDeclaredAnnotations()) {
|
||||
if (annotation instanceof JoinColumn) {
|
||||
valid=true;
|
||||
} else if (annotation instanceof Column) {
|
||||
Column column = (Column)annotation;
|
||||
if(column.name().endsWith("Fk"))
|
||||
if(field.getName().endsWith("Id")==false)
|
||||
valid=true;
|
||||
}else if (annotation instanceof OneToMany) {
|
||||
|
||||
valid=true;
|
||||
}
|
||||
|
||||
}
|
||||
if(valid ==false)
|
||||
fieldsToInclude.add(str);
|
||||
|
||||
}
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude.toArray(new String[0]),model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, BobotIndikatorVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
public BobotIndikatorVO transferModelToVOCustom(BobotIndikator model, BobotIndikatorVO vo,String[] fieldsToInclude) {
|
||||
if (null == vo)
|
||||
|
||||
vo = new BobotIndikatorVO();
|
||||
|
||||
try {
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, BobotIndikatorVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
}
|
||||
@ -1,80 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.CaraBayar;
|
||||
import com.jasamedika.medifirst2000.vo.CaraBayarVO;
|
||||
|
||||
/**
|
||||
* Converter class between Pasien and PasienVO
|
||||
*
|
||||
* @author Askur
|
||||
*/
|
||||
@Component
|
||||
public class CaraBayarConverter implements BaseVoConverter<CaraBayarVO, CaraBayar> {
|
||||
|
||||
|
||||
@Override
|
||||
public CaraBayar transferVOToModel(CaraBayarVO vo, CaraBayar model) {
|
||||
if (null == model)
|
||||
model = new CaraBayar();
|
||||
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude,vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, CaraBayar.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CaraBayarVO> transferListOfModelToListOfVO(List<CaraBayar> models, List<CaraBayarVO> vos) {
|
||||
|
||||
if (null == vos)
|
||||
vos = new ArrayList<CaraBayarVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (CaraBayar pegawai : models) {
|
||||
CaraBayarVO vo = new CaraBayarVO();
|
||||
vo=transferModelToVO(pegawai, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CaraBayarVO transferModelToVO(CaraBayar model, CaraBayarVO vo) {
|
||||
if (null == vo)
|
||||
vo = new CaraBayarVO();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, CaraBayarVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,79 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.CaraMasuk;
|
||||
import com.jasamedika.medifirst2000.vo.CaraMasukVO;
|
||||
|
||||
/**
|
||||
* Converter class between Pasien and PasienVO
|
||||
*
|
||||
* @author Askur
|
||||
*/
|
||||
@Component
|
||||
public class CaraMasukConverter implements BaseVoConverter<CaraMasukVO, CaraMasuk> {
|
||||
|
||||
|
||||
@Override
|
||||
public CaraMasuk transferVOToModel(CaraMasukVO vo, CaraMasuk model) {
|
||||
if (null == model)
|
||||
model = new CaraMasuk();
|
||||
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude,vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, CaraMasuk.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CaraMasukVO> transferListOfModelToListOfVO(List<CaraMasuk> models, List<CaraMasukVO> vos) {
|
||||
|
||||
if (null == vos)
|
||||
vos = new ArrayList<CaraMasukVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (CaraMasuk pegawai : models) {
|
||||
CaraMasukVO vo = new CaraMasukVO();
|
||||
vo=transferModelToVO(pegawai, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CaraMasukVO transferModelToVO(CaraMasuk model, CaraMasukVO vo) {
|
||||
if (null == vo)
|
||||
vo = new CaraMasukVO();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, CaraMasukVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,70 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.CatatanPerkembangan;
|
||||
import com.jasamedika.medifirst2000.vo.CatatanPerkembanganVO;
|
||||
|
||||
@Component
|
||||
public class CatatanPerkembanganConverter implements BaseVoConverter<CatatanPerkembanganVO, CatatanPerkembangan>{
|
||||
|
||||
@Override
|
||||
public CatatanPerkembangan transferVOToModel(CatatanPerkembanganVO vo, CatatanPerkembangan model) {
|
||||
if (null == model)
|
||||
model = new CatatanPerkembangan();
|
||||
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude,vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, CatatanPerkembangan.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CatatanPerkembanganVO> transferListOfModelToListOfVO(List<CatatanPerkembangan> models,
|
||||
List<CatatanPerkembanganVO> vos) {
|
||||
if (null == vos)
|
||||
vos = new ArrayList<CatatanPerkembanganVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (CatatanPerkembangan model : models) {
|
||||
CatatanPerkembanganVO vo = new CatatanPerkembanganVO();
|
||||
transferModelToVO(model, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CatatanPerkembanganVO transferModelToVO(CatatanPerkembangan model, CatatanPerkembanganVO vo) {
|
||||
if (null == vo)
|
||||
vo = new CatatanPerkembanganVO();
|
||||
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, CatatanPerkembanganVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,66 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.CheckIn;
|
||||
import com.jasamedika.medifirst2000.vo.CheckInVO;
|
||||
|
||||
@Component
|
||||
public class CheckInConverter implements BaseVoConverter<CheckInVO, CheckIn> {
|
||||
|
||||
@Override
|
||||
public CheckIn transferVOToModel(CheckInVO vo, CheckIn model) {
|
||||
if (null == model)
|
||||
model = new CheckIn();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude,vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, CheckIn.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CheckInVO> transferListOfModelToListOfVO(List<CheckIn> models, List<CheckInVO> vos) {
|
||||
if (null == vos)
|
||||
vos = new ArrayList<CheckInVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (CheckIn papKebutuhanEdukasi : models) {
|
||||
CheckInVO vo = new CheckInVO();
|
||||
vo = transferModelToVO(papKebutuhanEdukasi, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CheckInVO transferModelToVO(CheckIn model, CheckInVO vo) {
|
||||
if (null == vo)
|
||||
vo = new CheckInVO();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, CheckInVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
}
|
||||
@ -1,90 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.CheckOutOperation;
|
||||
import com.jasamedika.medifirst2000.vo.CheckOutOperationVO;
|
||||
|
||||
@Component
|
||||
public class CheckOutOperationConverter implements BaseVoConverter<CheckOutOperationVO, CheckOutOperation> {
|
||||
|
||||
|
||||
@Override
|
||||
public CheckOutOperation transferVOToModel(CheckOutOperationVO vo, CheckOutOperation model) {
|
||||
if (null == model)
|
||||
model = new CheckOutOperation();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude,vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, CheckOutOperation.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CheckOutOperationVO> transferListOfModelToListOfVO(List<CheckOutOperation> models, List<CheckOutOperationVO> vos) {
|
||||
|
||||
if (null == vos)
|
||||
vos = new ArrayList<CheckOutOperationVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (CheckOutOperation checkOutOperation : models) {
|
||||
CheckOutOperationVO vo = new CheckOutOperationVO();
|
||||
vo=transferModelToVO(checkOutOperation, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CheckOutOperationVO transferModelToVO(CheckOutOperation model, CheckOutOperationVO vo) {
|
||||
if (null == vo)
|
||||
vo = new CheckOutOperationVO();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, CheckOutOperationVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
public CheckOutOperationVO transferModelToVOCustom(CheckOutOperation model, CheckOutOperationVO vo,String[] fieldsToInclude) {
|
||||
if (null == vo)
|
||||
|
||||
vo = new CheckOutOperationVO();
|
||||
|
||||
try {
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, CheckOutOperationVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,114 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.OneToMany;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.DampakResiko;
|
||||
import com.jasamedika.medifirst2000.vo.DampakResikoVO;
|
||||
|
||||
@Component
|
||||
public class DampakResikoConverter implements BaseVoConverter<DampakResikoVO, DampakResiko>{
|
||||
|
||||
@Override
|
||||
public DampakResiko transferVOToModel(DampakResikoVO vo, DampakResiko model) {
|
||||
if (null == model)
|
||||
model = new DampakResiko();
|
||||
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude,vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, DampakResiko.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DampakResikoVO> transferListOfModelToListOfVO(List<DampakResiko> models, List<DampakResikoVO> vos) {
|
||||
|
||||
if (null == vos)
|
||||
vos = new ArrayList<DampakResikoVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (DampakResiko pegawai : models) {
|
||||
DampakResikoVO vo = new DampakResikoVO();
|
||||
vo=transferModelToVO(pegawai, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DampakResikoVO transferModelToVO(DampakResiko model, DampakResikoVO vo) {
|
||||
if (null == vo)
|
||||
vo = new DampakResikoVO();
|
||||
try {
|
||||
|
||||
List<String> fieldsToInclude = new ArrayList<String>();
|
||||
for (Field field : model.GetFields(model.getClass())) {
|
||||
String str = field.getName();
|
||||
String name = field.getName();
|
||||
if(name.equals("serialVersionUID"))continue;
|
||||
Boolean valid = false;
|
||||
for (java.lang.annotation.Annotation annotation : field.getDeclaredAnnotations()) {
|
||||
if (annotation instanceof JoinColumn) {
|
||||
valid=true;
|
||||
} else if (annotation instanceof Column) {
|
||||
Column column = (Column)annotation;
|
||||
if(column.name().endsWith("Fk"))
|
||||
if(field.getName().endsWith("Id")==false)
|
||||
valid=true;
|
||||
}else if (annotation instanceof OneToMany) {
|
||||
|
||||
valid=true;
|
||||
}
|
||||
|
||||
}
|
||||
if(valid ==false)
|
||||
fieldsToInclude.add(str);
|
||||
|
||||
}
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude.toArray(new String[0]),model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, DampakResikoVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
public DampakResikoVO transferModelToVOCustom(DampakResiko model, DampakResikoVO vo,String[] fieldsToInclude) {
|
||||
if (null == vo)
|
||||
|
||||
vo = new DampakResikoVO();
|
||||
|
||||
try {
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, DampakResikoVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
}
|
||||
@ -1,70 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.DataGeneralCheckUp;
|
||||
import com.jasamedika.medifirst2000.vo.DataGeneralCheckUpVO;
|
||||
|
||||
@Component
|
||||
public class DataGeneralCheckUpConverter implements BaseVoConverter<DataGeneralCheckUpVO, DataGeneralCheckUp> {
|
||||
|
||||
|
||||
@Override
|
||||
public DataGeneralCheckUp transferVOToModel(DataGeneralCheckUpVO vo, DataGeneralCheckUp model) {
|
||||
if (null == model)
|
||||
model = new DataGeneralCheckUp();
|
||||
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude,vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, DataGeneralCheckUp.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DataGeneralCheckUpVO> transferListOfModelToListOfVO(List<DataGeneralCheckUp> models, List<DataGeneralCheckUpVO> vos) {
|
||||
|
||||
if (null == vos)
|
||||
vos = new ArrayList<DataGeneralCheckUpVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (DataGeneralCheckUp DataGeneralCheckUp : models) {
|
||||
DataGeneralCheckUpVO vo = new DataGeneralCheckUpVO();
|
||||
vo=transferModelToVO(DataGeneralCheckUp, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataGeneralCheckUpVO transferModelToVO(DataGeneralCheckUp model, DataGeneralCheckUpVO vo) {
|
||||
if (null == vo)
|
||||
vo = new DataGeneralCheckUpVO();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, DataGeneralCheckUpVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
}
|
||||
@ -1,70 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.DataPemeriksaanPraKerja;
|
||||
import com.jasamedika.medifirst2000.vo.DataPemeriksaanPraKerjaVO;
|
||||
|
||||
@Component
|
||||
public class DataPemeriksaanPraKerjaConverter implements BaseVoConverter<DataPemeriksaanPraKerjaVO, DataPemeriksaanPraKerja> {
|
||||
|
||||
|
||||
@Override
|
||||
public DataPemeriksaanPraKerja transferVOToModel(DataPemeriksaanPraKerjaVO vo, DataPemeriksaanPraKerja model) {
|
||||
if (null == model)
|
||||
model = new DataPemeriksaanPraKerja();
|
||||
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude,vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, DataPemeriksaanPraKerja.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DataPemeriksaanPraKerjaVO> transferListOfModelToListOfVO(List<DataPemeriksaanPraKerja> models, List<DataPemeriksaanPraKerjaVO> vos) {
|
||||
|
||||
if (null == vos)
|
||||
vos = new ArrayList<DataPemeriksaanPraKerjaVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (DataPemeriksaanPraKerja DataPemeriksaanPraKerja : models) {
|
||||
DataPemeriksaanPraKerjaVO vo = new DataPemeriksaanPraKerjaVO();
|
||||
vo=transferModelToVO(DataPemeriksaanPraKerja, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataPemeriksaanPraKerjaVO transferModelToVO(DataPemeriksaanPraKerja model, DataPemeriksaanPraKerjaVO vo) {
|
||||
if (null == vo)
|
||||
vo = new DataPemeriksaanPraKerjaVO();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, DataPemeriksaanPraKerjaVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
}
|
||||
@ -1,76 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.DataRujukan;
|
||||
import com.jasamedika.medifirst2000.vo.DataRujukanVO;
|
||||
|
||||
@Component
|
||||
public class DataRujukanConverter implements BaseVoConverter<DataRujukanVO, DataRujukan> {
|
||||
|
||||
|
||||
@Override
|
||||
public DataRujukan transferVOToModel(DataRujukanVO vo, DataRujukan model) {
|
||||
if (null == model)
|
||||
model = new DataRujukan();
|
||||
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude,vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, DataRujukan.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DataRujukanVO> transferListOfModelToListOfVO(List<DataRujukan> models, List<DataRujukanVO> vos) {
|
||||
|
||||
if (null == vos)
|
||||
vos = new ArrayList<DataRujukanVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (DataRujukan dataRujukan : models) {
|
||||
DataRujukanVO vo = new DataRujukanVO();
|
||||
vo=transferModelToVO(dataRujukan, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataRujukanVO transferModelToVO(DataRujukan model, DataRujukanVO vo) {
|
||||
if (null == vo)
|
||||
vo = new DataRujukanVO();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, DataRujukanVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,68 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.Departemen;
|
||||
import com.jasamedika.medifirst2000.vo.DepartemenVO;
|
||||
|
||||
@Component
|
||||
public class DepartemenConverter implements BaseVoConverter<DepartemenVO, Departemen> {
|
||||
|
||||
@Override
|
||||
public Departemen transferVOToModel(DepartemenVO vo, Departemen model) {
|
||||
if (null == model)
|
||||
model = new Departemen();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude,vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, Departemen.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DepartemenVO> transferListOfModelToListOfVO(List<Departemen> models, List<DepartemenVO> vos) {
|
||||
|
||||
if (null == vos)
|
||||
vos = new ArrayList<DepartemenVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (Departemen departemen : models) {
|
||||
DepartemenVO vo = new DepartemenVO();
|
||||
vo=transferModelToVO(departemen, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DepartemenVO transferModelToVO(Departemen model, DepartemenVO vo) {
|
||||
if (null == vo)
|
||||
vo = new DepartemenVO();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, DepartemenVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
}
|
||||
@ -1,78 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.DesaKelurahan;
|
||||
import com.jasamedika.medifirst2000.vo.DesaKelurahanVO;
|
||||
|
||||
/**
|
||||
* Converter class between DesaKelurahan and DesaKelurahanVO
|
||||
*
|
||||
* @author Askur
|
||||
*/
|
||||
@Component
|
||||
public class DesaKelurahanConverter implements BaseVoConverter<DesaKelurahanVO, DesaKelurahan> {
|
||||
|
||||
|
||||
public DesaKelurahan transferVOToModel(DesaKelurahanVO vo, DesaKelurahan model) {
|
||||
if (null == model)
|
||||
model = new DesaKelurahan();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude,vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, DesaKelurahan.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return model;
|
||||
|
||||
}
|
||||
|
||||
public List<DesaKelurahanVO> transferListOfModelToListOfVO(List<DesaKelurahan> models,
|
||||
List<DesaKelurahanVO> vos) {
|
||||
if (null == vos)
|
||||
vos = new ArrayList<DesaKelurahanVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (DesaKelurahan DesaKelurahan : models) {
|
||||
DesaKelurahanVO vo = new DesaKelurahanVO();
|
||||
vo = transferModelToVO(DesaKelurahan, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DesaKelurahanVO transferModelToVO(DesaKelurahan model, DesaKelurahanVO vo) {
|
||||
|
||||
if (null == vo)
|
||||
vo = new DesaKelurahanVO();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create();
|
||||
String json = gson.toJson(serialized);
|
||||
Gson gson2 =new Gson();
|
||||
vo = gson2.fromJson(json, DesaKelurahanVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return vo;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -1,91 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.DetailDiagnosaPasien;
|
||||
|
||||
import com.jasamedika.medifirst2000.vo.DetailDiagnosaPasienVO;
|
||||
|
||||
@Component
|
||||
public class DetailDiagnosaPasienConverter implements BaseVoConverter<DetailDiagnosaPasienVO, DetailDiagnosaPasien> {
|
||||
|
||||
|
||||
@Override
|
||||
public DetailDiagnosaPasien transferVOToModel(DetailDiagnosaPasienVO vo, DetailDiagnosaPasien model) {
|
||||
if (null == model)
|
||||
model = new DetailDiagnosaPasien();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude,vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, DetailDiagnosaPasien.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DetailDiagnosaPasienVO> transferListOfModelToListOfVO(List<DetailDiagnosaPasien> models, List<DetailDiagnosaPasienVO> vos) {
|
||||
|
||||
if (null == vos)
|
||||
vos = new ArrayList<DetailDiagnosaPasienVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (DetailDiagnosaPasien detailDiagnosaPasien : models) {
|
||||
DetailDiagnosaPasienVO vo = new DetailDiagnosaPasienVO();
|
||||
vo=transferModelToVO(detailDiagnosaPasien, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DetailDiagnosaPasienVO transferModelToVO(DetailDiagnosaPasien model, DetailDiagnosaPasienVO vo) {
|
||||
if (null == vo)
|
||||
vo = new DetailDiagnosaPasienVO();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, DetailDiagnosaPasienVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
public DetailDiagnosaPasienVO transferModelToVOCustom(DetailDiagnosaPasien model, DetailDiagnosaPasienVO vo,String[] fieldsToInclude) {
|
||||
if (null == vo)
|
||||
|
||||
vo = new DetailDiagnosaPasienVO();
|
||||
|
||||
try {
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, DetailDiagnosaPasienVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,91 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.DetailDiagnosaTindakanPasien;
|
||||
|
||||
import com.jasamedika.medifirst2000.vo.DetailDiagnosaTindakanPasienVO;
|
||||
|
||||
@Component
|
||||
public class DetailDiagnosaTindakanPasienConverter implements BaseVoConverter<DetailDiagnosaTindakanPasienVO, DetailDiagnosaTindakanPasien> {
|
||||
|
||||
|
||||
@Override
|
||||
public DetailDiagnosaTindakanPasien transferVOToModel(DetailDiagnosaTindakanPasienVO vo, DetailDiagnosaTindakanPasien model) {
|
||||
if (null == model)
|
||||
model = new DetailDiagnosaTindakanPasien();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude,vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, DetailDiagnosaTindakanPasien.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DetailDiagnosaTindakanPasienVO> transferListOfModelToListOfVO(List<DetailDiagnosaTindakanPasien> models, List<DetailDiagnosaTindakanPasienVO> vos) {
|
||||
|
||||
if (null == vos)
|
||||
vos = new ArrayList<DetailDiagnosaTindakanPasienVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (DetailDiagnosaTindakanPasien diagnosaTindakanPasien : models) {
|
||||
DetailDiagnosaTindakanPasienVO vo = new DetailDiagnosaTindakanPasienVO();
|
||||
vo=transferModelToVO(diagnosaTindakanPasien, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DetailDiagnosaTindakanPasienVO transferModelToVO(DetailDiagnosaTindakanPasien model, DetailDiagnosaTindakanPasienVO vo) {
|
||||
if (null == vo)
|
||||
vo = new DetailDiagnosaTindakanPasienVO();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, DetailDiagnosaTindakanPasienVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
public DetailDiagnosaTindakanPasienVO transferModelToVOCustom(DetailDiagnosaTindakanPasien model, DetailDiagnosaTindakanPasienVO vo,String[] fieldsToInclude) {
|
||||
if (null == vo)
|
||||
|
||||
vo = new DetailDiagnosaTindakanPasienVO();
|
||||
|
||||
try {
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, DetailDiagnosaTindakanPasienVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,91 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.dao.custom.base.impl.FindConverterDao;
|
||||
import com.jasamedika.medifirst2000.entities.DetailHasilTriase;
|
||||
import com.jasamedika.medifirst2000.vo.DetailHasilTriaseVO;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Shakato
|
||||
*/
|
||||
@Component
|
||||
public class DetailHasilTriaseConverter extends FindConverterDao implements
|
||||
BaseVoConverter<DetailHasilTriaseVO, DetailHasilTriase> {
|
||||
|
||||
public DetailHasilTriase transferVOToModel(DetailHasilTriaseVO vo, DetailHasilTriase model) {
|
||||
if (null == model)
|
||||
model = new DetailHasilTriase();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude,vo.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, DetailHasilTriase.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return model;
|
||||
|
||||
}
|
||||
|
||||
public List<DetailHasilTriaseVO> transferListOfModelToListOfVO(List<DetailHasilTriase> models,
|
||||
List<DetailHasilTriaseVO> vos) {
|
||||
if (null == vos)
|
||||
vos = new ArrayList<DetailHasilTriaseVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (DetailHasilTriase hasilTriase : models) {
|
||||
DetailHasilTriaseVO hasilTriaseVO = new DetailHasilTriaseVO();
|
||||
transferModelToVO(hasilTriase, hasilTriaseVO);
|
||||
vos.add(hasilTriaseVO);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
public DetailHasilTriaseVO transferModelToVO(DetailHasilTriase model, DetailHasilTriaseVO vo) {
|
||||
if (null == vo)
|
||||
|
||||
vo = new DetailHasilTriaseVO();
|
||||
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, DetailHasilTriaseVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
||||
public DetailHasilTriaseVO transferModelToVOCustom(DetailHasilTriase model, DetailHasilTriaseVO vo,String[] fieldsToInclude) {
|
||||
if (null == vo)
|
||||
|
||||
vo = new DetailHasilTriaseVO();
|
||||
|
||||
try {
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, DetailHasilTriaseVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,79 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.DetailKamar;
|
||||
import com.jasamedika.medifirst2000.vo.DetailKamarVO;
|
||||
|
||||
/**
|
||||
* Converter class between Pasien and PasienVO
|
||||
*
|
||||
* @author Askur
|
||||
*/
|
||||
@Component
|
||||
public class DetailKamarConverter implements BaseVoConverter<DetailKamarVO, DetailKamar> {
|
||||
|
||||
|
||||
@Override
|
||||
public DetailKamar transferVOToModel(DetailKamarVO vo, DetailKamar model) {
|
||||
if (null == model)
|
||||
model = new DetailKamar();
|
||||
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude,vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, DetailKamar.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DetailKamarVO> transferListOfModelToListOfVO(List<DetailKamar> models, List<DetailKamarVO> vos) {
|
||||
|
||||
if (null == vos)
|
||||
vos = new ArrayList<DetailKamarVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (DetailKamar pegawai : models) {
|
||||
DetailKamarVO vo = new DetailKamarVO();
|
||||
vo=transferModelToVO(pegawai, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DetailKamarVO transferModelToVO(DetailKamar model, DetailKamarVO vo) {
|
||||
if (null == vo)
|
||||
vo = new DetailKamarVO();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, DetailKamarVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,115 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.OneToMany;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.DetailSWOT;
|
||||
import com.jasamedika.medifirst2000.vo.DetailSWOTVO;
|
||||
|
||||
@Component
|
||||
public class DetailSWOTConverter implements BaseVoConverter<DetailSWOTVO,DetailSWOT>{
|
||||
|
||||
@Override
|
||||
public DetailSWOT transferVOToModel(DetailSWOTVO vo, DetailSWOT model) {
|
||||
if (null == model)
|
||||
model = new DetailSWOT();
|
||||
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude,vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, DetailSWOT.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DetailSWOTVO> transferListOfModelToListOfVO(List<DetailSWOT> models, List<DetailSWOTVO> vos) {
|
||||
|
||||
if (null == vos)
|
||||
vos = new ArrayList<DetailSWOTVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (DetailSWOT pegawai : models) {
|
||||
DetailSWOTVO vo = new DetailSWOTVO();
|
||||
vo=transferModelToVO(pegawai, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DetailSWOTVO transferModelToVO(DetailSWOT model, DetailSWOTVO vo) {
|
||||
if (null == vo)
|
||||
vo = new DetailSWOTVO();
|
||||
try {
|
||||
|
||||
List<String> fieldsToInclude = new ArrayList<String>();
|
||||
for (Field field : model.GetFields(model.getClass())) {
|
||||
String str = field.getName();
|
||||
String name = field.getName();
|
||||
if(name.equals("serialVersionUID"))continue;
|
||||
Boolean valid = false;
|
||||
for (java.lang.annotation.Annotation annotation : field.getDeclaredAnnotations()) {
|
||||
if (annotation instanceof JoinColumn) {
|
||||
valid=true;
|
||||
} else if (annotation instanceof Column) {
|
||||
Column column = (Column)annotation;
|
||||
if(column.name().endsWith("Fk"))
|
||||
if(field.getName().endsWith("Id")==false)
|
||||
valid=true;
|
||||
}else if (annotation instanceof OneToMany) {
|
||||
|
||||
valid=true;
|
||||
}
|
||||
|
||||
}
|
||||
if(valid ==false)
|
||||
fieldsToInclude.add(str);
|
||||
|
||||
}
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude.toArray(new String[0]),model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, DetailSWOTVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
public DetailSWOTVO transferModelToVOCustom(DetailSWOT model, DetailSWOTVO vo,String[] fieldsToInclude) {
|
||||
if (null == vo)
|
||||
|
||||
vo = new DetailSWOTVO();
|
||||
|
||||
try {
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, DetailSWOTVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,114 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.OneToMany;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.DetailTOWS;
|
||||
import com.jasamedika.medifirst2000.vo.DetailTOWSVO;
|
||||
|
||||
@Component
|
||||
public class DetailTOWSConverter implements BaseVoConverter<DetailTOWSVO, DetailTOWS>{
|
||||
|
||||
@Override
|
||||
public DetailTOWS transferVOToModel(DetailTOWSVO vo, DetailTOWS model) {
|
||||
if (null == model)
|
||||
model = new DetailTOWS();
|
||||
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude,vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, DetailTOWS.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DetailTOWSVO> transferListOfModelToListOfVO(List<DetailTOWS> models, List<DetailTOWSVO> vos) {
|
||||
|
||||
if (null == vos)
|
||||
vos = new ArrayList<DetailTOWSVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (DetailTOWS pegawai : models) {
|
||||
DetailTOWSVO vo = new DetailTOWSVO();
|
||||
vo=transferModelToVO(pegawai, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DetailTOWSVO transferModelToVO(DetailTOWS model, DetailTOWSVO vo) {
|
||||
if (null == vo)
|
||||
vo = new DetailTOWSVO();
|
||||
try {
|
||||
|
||||
List<String> fieldsToInclude = new ArrayList<String>();
|
||||
for (Field field : model.GetFields(model.getClass())) {
|
||||
String str = field.getName();
|
||||
String name = field.getName();
|
||||
if(name.equals("serialVersionUID"))continue;
|
||||
Boolean valid = false;
|
||||
for (java.lang.annotation.Annotation annotation : field.getDeclaredAnnotations()) {
|
||||
if (annotation instanceof JoinColumn) {
|
||||
valid=true;
|
||||
} else if (annotation instanceof Column) {
|
||||
Column column = (Column)annotation;
|
||||
if(column.name().endsWith("Fk"))
|
||||
if(field.getName().endsWith("Id")==false)
|
||||
valid=true;
|
||||
}else if (annotation instanceof OneToMany) {
|
||||
|
||||
valid=true;
|
||||
}
|
||||
|
||||
}
|
||||
if(valid ==false)
|
||||
fieldsToInclude.add(str);
|
||||
|
||||
}
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude.toArray(new String[0]),model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, DetailTOWSVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
public DetailTOWSVO transferModelToVOCustom(DetailTOWS model, DetailTOWSVO vo,String[] fieldsToInclude) {
|
||||
if (null == vo)
|
||||
|
||||
vo = new DetailTOWSVO();
|
||||
|
||||
try {
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, DetailTOWSVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
}
|
||||
@ -1,75 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.DetailTriase;
|
||||
import com.jasamedika.medifirst2000.vo.DetailTriaseVO;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Shakato
|
||||
*/
|
||||
@Component
|
||||
public class DetailTriaseConverter implements BaseVoConverter<DetailTriaseVO, DetailTriase>{
|
||||
|
||||
@Override
|
||||
public DetailTriase transferVOToModel(DetailTriaseVO vo, DetailTriase model) {
|
||||
if (null == model){
|
||||
model = new DetailTriase();
|
||||
}
|
||||
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude,vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, DetailTriase.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DetailTriaseVO> transferListOfModelToListOfVO(List<DetailTriase> models,
|
||||
List<DetailTriaseVO> vos) {
|
||||
if (vos == null) {
|
||||
vos = new ArrayList<DetailTriaseVO>();
|
||||
}
|
||||
|
||||
if (models == null) {
|
||||
return vos;
|
||||
}
|
||||
|
||||
for (DetailTriase status : models) {
|
||||
DetailTriaseVO vo = new DetailTriaseVO();
|
||||
vo=transferModelToVO(status, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DetailTriaseVO transferModelToVO(DetailTriase model, DetailTriaseVO vo) {
|
||||
if (vo == null)
|
||||
vo = new DetailTriaseVO();
|
||||
try {
|
||||
String[] fieldsToInclude = {"detailTriase","detailTriase"};
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, DetailTriaseVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,91 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.Diagnosa;
|
||||
|
||||
import com.jasamedika.medifirst2000.vo.DiagnosaVO;
|
||||
|
||||
@Component
|
||||
public class DiagnosaConverter implements BaseVoConverter<DiagnosaVO, Diagnosa> {
|
||||
|
||||
|
||||
@Override
|
||||
public Diagnosa transferVOToModel(DiagnosaVO vo, Diagnosa model) {
|
||||
if (null == model)
|
||||
model = new Diagnosa();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude,vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, Diagnosa.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DiagnosaVO> transferListOfModelToListOfVO(List<Diagnosa> models, List<DiagnosaVO> vos) {
|
||||
|
||||
if (null == vos)
|
||||
vos = new ArrayList<DiagnosaVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (Diagnosa diagnosa : models) {
|
||||
DiagnosaVO vo = new DiagnosaVO();
|
||||
vo=transferModelToVO(diagnosa, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DiagnosaVO transferModelToVO(Diagnosa model, DiagnosaVO vo) {
|
||||
if (null == vo)
|
||||
vo = new DiagnosaVO();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, DiagnosaVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
public DiagnosaVO transferModelToVOCustom(Diagnosa model, DiagnosaVO vo,String[] fieldsToInclude) {
|
||||
if (null == vo)
|
||||
|
||||
vo = new DiagnosaVO();
|
||||
|
||||
try {
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, DiagnosaVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,91 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.DiagnosaPasien;
|
||||
|
||||
import com.jasamedika.medifirst2000.vo.DiagnosaPasienVO;
|
||||
|
||||
@Component
|
||||
public class DiagnosaPasienConverter implements BaseVoConverter<DiagnosaPasienVO, DiagnosaPasien> {
|
||||
|
||||
|
||||
@Override
|
||||
public DiagnosaPasien transferVOToModel(DiagnosaPasienVO vo, DiagnosaPasien model) {
|
||||
if (null == model)
|
||||
model = new DiagnosaPasien();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude,vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, DiagnosaPasien.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DiagnosaPasienVO> transferListOfModelToListOfVO(List<DiagnosaPasien> models, List<DiagnosaPasienVO> vos) {
|
||||
|
||||
if (null == vos)
|
||||
vos = new ArrayList<DiagnosaPasienVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (DiagnosaPasien diagnosaPasien : models) {
|
||||
DiagnosaPasienVO vo = new DiagnosaPasienVO();
|
||||
vo=transferModelToVO(diagnosaPasien, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DiagnosaPasienVO transferModelToVO(DiagnosaPasien model, DiagnosaPasienVO vo) {
|
||||
if (null == vo)
|
||||
vo = new DiagnosaPasienVO();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, DiagnosaPasienVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
public DiagnosaPasienVO transferModelToVOCustom(DiagnosaPasien model, DiagnosaPasienVO vo,String[] fieldsToInclude) {
|
||||
if (null == vo)
|
||||
|
||||
vo = new DiagnosaPasienVO();
|
||||
|
||||
try {
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, DiagnosaPasienVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,91 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.DiagnosaTindakan;
|
||||
|
||||
import com.jasamedika.medifirst2000.vo.DiagnosaTindakanVO;
|
||||
|
||||
@Component
|
||||
public class DiagnosaTindakanConverter implements BaseVoConverter<DiagnosaTindakanVO, DiagnosaTindakan> {
|
||||
|
||||
|
||||
@Override
|
||||
public DiagnosaTindakan transferVOToModel(DiagnosaTindakanVO vo, DiagnosaTindakan model) {
|
||||
if (null == model)
|
||||
model = new DiagnosaTindakan();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude,vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, DiagnosaTindakan.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DiagnosaTindakanVO> transferListOfModelToListOfVO(List<DiagnosaTindakan> models, List<DiagnosaTindakanVO> vos) {
|
||||
|
||||
if (null == vos)
|
||||
vos = new ArrayList<DiagnosaTindakanVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (DiagnosaTindakan diagosaTindakan : models) {
|
||||
DiagnosaTindakanVO vo = new DiagnosaTindakanVO();
|
||||
vo=transferModelToVO(diagosaTindakan, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DiagnosaTindakanVO transferModelToVO(DiagnosaTindakan model, DiagnosaTindakanVO vo) {
|
||||
if (null == vo)
|
||||
vo = new DiagnosaTindakanVO();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, DiagnosaTindakanVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
public DiagnosaTindakanVO transferModelToVOCustom(DiagnosaTindakan model, DiagnosaTindakanVO vo,String[] fieldsToInclude) {
|
||||
if (null == vo)
|
||||
|
||||
vo = new DiagnosaTindakanVO();
|
||||
|
||||
try {
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, DiagnosaTindakanVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,91 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.DiagnosaTindakanPasien;
|
||||
|
||||
import com.jasamedika.medifirst2000.vo.DiagnosaTindakanPasienVO;
|
||||
|
||||
@Component
|
||||
public class DiagnosaTindakanPasienConverter implements BaseVoConverter<DiagnosaTindakanPasienVO, DiagnosaTindakanPasien> {
|
||||
|
||||
|
||||
@Override
|
||||
public DiagnosaTindakanPasien transferVOToModel(DiagnosaTindakanPasienVO vo, DiagnosaTindakanPasien model) {
|
||||
if (null == model)
|
||||
model = new DiagnosaTindakanPasien();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude,vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, DiagnosaTindakanPasien.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DiagnosaTindakanPasienVO> transferListOfModelToListOfVO(List<DiagnosaTindakanPasien> models, List<DiagnosaTindakanPasienVO> vos) {
|
||||
|
||||
if (null == vos)
|
||||
vos = new ArrayList<DiagnosaTindakanPasienVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (DiagnosaTindakanPasien diagnosaTindakanPasien : models) {
|
||||
DiagnosaTindakanPasienVO vo = new DiagnosaTindakanPasienVO();
|
||||
vo=transferModelToVO(diagnosaTindakanPasien, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DiagnosaTindakanPasienVO transferModelToVO(DiagnosaTindakanPasien model, DiagnosaTindakanPasienVO vo) {
|
||||
if (null == vo)
|
||||
vo = new DiagnosaTindakanPasienVO();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, DiagnosaTindakanPasienVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
public DiagnosaTindakanPasienVO transferModelToVOCustom(DiagnosaTindakanPasien model, DiagnosaTindakanPasienVO vo,String[] fieldsToInclude) {
|
||||
if (null == vo)
|
||||
|
||||
vo = new DiagnosaTindakanPasienVO();
|
||||
|
||||
try {
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, DiagnosaTindakanPasienVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,76 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.Diputuskan;
|
||||
import com.jasamedika.medifirst2000.vo.DiputuskanVO;
|
||||
|
||||
@Component
|
||||
public class DiputuskanConverter implements BaseVoConverter<DiputuskanVO, Diputuskan> {
|
||||
|
||||
|
||||
@Override
|
||||
public Diputuskan transferVOToModel(DiputuskanVO vo, Diputuskan model) {
|
||||
if (null == model)
|
||||
model = new Diputuskan();
|
||||
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude,vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, Diputuskan.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DiputuskanVO> transferListOfModelToListOfVO(List<Diputuskan> models, List<DiputuskanVO> vos) {
|
||||
|
||||
if (null == vos)
|
||||
vos = new ArrayList<DiputuskanVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (Diputuskan diputuskan : models) {
|
||||
DiputuskanVO vo = new DiputuskanVO();
|
||||
vo=transferModelToVO(diputuskan, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DiputuskanVO transferModelToVO(Diputuskan model, DiputuskanVO vo) {
|
||||
if (null == vo)
|
||||
vo = new DiputuskanVO();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, DiputuskanVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,98 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.OneToMany;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.DraftPeraturan;
|
||||
import com.jasamedika.medifirst2000.vo.DraftPeraturanVO;
|
||||
|
||||
@Component
|
||||
public class DraftPeraturanConverter implements BaseVoConverter<DraftPeraturanVO, DraftPeraturan>{
|
||||
|
||||
@Override
|
||||
public DraftPeraturan transferVOToModel(DraftPeraturanVO vo, DraftPeraturan model) {
|
||||
if (null == model)
|
||||
model = new DraftPeraturan();
|
||||
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude,vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, DraftPeraturan.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DraftPeraturanVO> transferListOfModelToListOfVO(List<DraftPeraturan> models, List<DraftPeraturanVO> vos) {
|
||||
|
||||
if (null == vos)
|
||||
vos = new ArrayList<DraftPeraturanVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (DraftPeraturan model : models) {
|
||||
DraftPeraturanVO vo = new DraftPeraturanVO();
|
||||
vo=transferModelToVO(model, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DraftPeraturanVO transferModelToVO(DraftPeraturan model, DraftPeraturanVO vo) {
|
||||
if (null == vo)
|
||||
vo = new DraftPeraturanVO();
|
||||
try {
|
||||
|
||||
List<String> fieldsToInclude = new ArrayList<String>();
|
||||
for (Field field : model.GetFields(model.getClass())) {
|
||||
String str = field.getName();
|
||||
String name = field.getName();
|
||||
if(name.equals("serialVersionUID"))continue;
|
||||
Boolean valid = false;
|
||||
for (java.lang.annotation.Annotation annotation : field.getDeclaredAnnotations()) {
|
||||
if (annotation instanceof JoinColumn) {
|
||||
valid=true;
|
||||
} else if (annotation instanceof Column) {
|
||||
Column column = (Column)annotation;
|
||||
if(column.name().endsWith("Fk"))
|
||||
if(field.getName().endsWith("Id")==false)
|
||||
valid=true;
|
||||
}else if (annotation instanceof OneToMany) {
|
||||
|
||||
valid=true;
|
||||
}
|
||||
|
||||
}
|
||||
if(valid ==false)
|
||||
fieldsToInclude.add(str);
|
||||
|
||||
}
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude.toArray(new String[0]),model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, DraftPeraturanVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
}
|
||||
@ -1,78 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.DraftSurat;
|
||||
import com.jasamedika.medifirst2000.vo.DraftSuratVO;
|
||||
|
||||
/**
|
||||
* Converter class between DraftSurat and DraftSuratVO
|
||||
*
|
||||
* @author Askur
|
||||
*/
|
||||
@Component
|
||||
public class DraftSuratConverter implements BaseVoConverter<DraftSuratVO, DraftSurat> {
|
||||
|
||||
|
||||
public DraftSurat transferVOToModel(DraftSuratVO vo, DraftSurat model) {
|
||||
if (null == model)
|
||||
model = new DraftSurat();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude,vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, DraftSurat.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return model;
|
||||
|
||||
}
|
||||
|
||||
public List<DraftSuratVO> transferListOfModelToListOfVO(List<DraftSurat> models,
|
||||
List<DraftSuratVO> vos) {
|
||||
if (null == vos)
|
||||
vos = new ArrayList<DraftSuratVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (DraftSurat draftSurat : models) {
|
||||
DraftSuratVO vo = new DraftSuratVO();
|
||||
vo = transferModelToVO(draftSurat, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DraftSuratVO transferModelToVO(DraftSurat model, DraftSuratVO vo) {
|
||||
|
||||
if (null == vo)
|
||||
vo = new DraftSuratVO();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create();
|
||||
String json = gson.toJson(serialized);
|
||||
Gson gson2 =new Gson();
|
||||
vo = gson2.fromJson(json, DraftSuratVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return vo;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -1,91 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.FisisPemeriksaanDokter;
|
||||
|
||||
import com.jasamedika.medifirst2000.vo.FisisPemeriksaanDokterVO;
|
||||
|
||||
@Component
|
||||
public class FisisPemeriksaanDokterConverter implements BaseVoConverter<FisisPemeriksaanDokterVO, FisisPemeriksaanDokter> {
|
||||
|
||||
|
||||
@Override
|
||||
public FisisPemeriksaanDokter transferVOToModel(FisisPemeriksaanDokterVO vo, FisisPemeriksaanDokter model) {
|
||||
if (null == model)
|
||||
model = new FisisPemeriksaanDokter();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude,vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, FisisPemeriksaanDokter.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FisisPemeriksaanDokterVO> transferListOfModelToListOfVO(List<FisisPemeriksaanDokter> models, List<FisisPemeriksaanDokterVO> vos) {
|
||||
|
||||
if (null == vos)
|
||||
vos = new ArrayList<FisisPemeriksaanDokterVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (FisisPemeriksaanDokter FisisPemeriksaanDokter : models) {
|
||||
FisisPemeriksaanDokterVO vo = new FisisPemeriksaanDokterVO();
|
||||
vo=transferModelToVO(FisisPemeriksaanDokter, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FisisPemeriksaanDokterVO transferModelToVO(FisisPemeriksaanDokter model, FisisPemeriksaanDokterVO vo) {
|
||||
if (null == vo)
|
||||
vo = new FisisPemeriksaanDokterVO();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, FisisPemeriksaanDokterVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
public FisisPemeriksaanDokterVO transferModelToVOCustom(FisisPemeriksaanDokter model, FisisPemeriksaanDokterVO vo,String[] fieldsToInclude) {
|
||||
if (null == vo)
|
||||
|
||||
vo = new FisisPemeriksaanDokterVO();
|
||||
|
||||
try {
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, FisisPemeriksaanDokterVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,70 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.GeneralCheckUp;
|
||||
import com.jasamedika.medifirst2000.vo.GeneralCheckUpVO;
|
||||
|
||||
@Component
|
||||
public class GeneralCheckUpConverter implements BaseVoConverter<GeneralCheckUpVO, GeneralCheckUp> {
|
||||
|
||||
|
||||
@Override
|
||||
public GeneralCheckUp transferVOToModel(GeneralCheckUpVO vo, GeneralCheckUp model) {
|
||||
if (null == model)
|
||||
model = new GeneralCheckUp();
|
||||
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude,vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, GeneralCheckUp.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GeneralCheckUpVO> transferListOfModelToListOfVO(List<GeneralCheckUp> models, List<GeneralCheckUpVO> vos) {
|
||||
|
||||
if (null == vos)
|
||||
vos = new ArrayList<GeneralCheckUpVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (GeneralCheckUp GeneralCheckUp : models) {
|
||||
GeneralCheckUpVO vo = new GeneralCheckUpVO();
|
||||
vo=transferModelToVO(GeneralCheckUp, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GeneralCheckUpVO transferModelToVO(GeneralCheckUp model, GeneralCheckUpVO vo) {
|
||||
if (null == vo)
|
||||
vo = new GeneralCheckUpVO();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, GeneralCheckUpVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
}
|
||||
@ -1,76 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.GenericView;
|
||||
import com.jasamedika.medifirst2000.vo.GenericViewVO;
|
||||
|
||||
/**
|
||||
* Converter class between GenericView and GenericViewVO
|
||||
*
|
||||
* @author Askur
|
||||
*/
|
||||
@Component
|
||||
public class GenericViewConverter implements BaseVoConverter<GenericViewVO, GenericView> {
|
||||
|
||||
|
||||
public GenericView transferVOToModel(GenericViewVO vo, GenericView model) {
|
||||
if (null == model)
|
||||
model = new GenericView();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude,vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, GenericView.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return model;
|
||||
|
||||
}
|
||||
|
||||
public List<GenericViewVO> transferListOfModelToListOfVO(List<GenericView> models,
|
||||
List<GenericViewVO> vos) {
|
||||
if (null == vos)
|
||||
vos = new ArrayList<GenericViewVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (GenericView GenericView : models) {
|
||||
GenericViewVO vo = new GenericViewVO();
|
||||
vo = transferModelToVO(GenericView, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GenericViewVO transferModelToVO(GenericView model, GenericViewVO vo) {
|
||||
|
||||
if (null == vo)
|
||||
vo = new GenericViewVO();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, GenericViewVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return vo;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -1,76 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.GolonganDarah;
|
||||
import com.jasamedika.medifirst2000.vo.GolonganDarahVO;
|
||||
|
||||
@Component
|
||||
public class GolonganDarahConverter implements BaseVoConverter<GolonganDarahVO, GolonganDarah> {
|
||||
|
||||
|
||||
@Override
|
||||
public GolonganDarah transferVOToModel(GolonganDarahVO vo, GolonganDarah model) {
|
||||
if (null == model)
|
||||
model = new GolonganDarah();
|
||||
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude,vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, GolonganDarah.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GolonganDarahVO> transferListOfModelToListOfVO(List<GolonganDarah> models, List<GolonganDarahVO> vos) {
|
||||
|
||||
if (null == vos)
|
||||
vos = new ArrayList<GolonganDarahVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (GolonganDarah GolonganDarah : models) {
|
||||
GolonganDarahVO vo = new GolonganDarahVO();
|
||||
vo=transferModelToVO(GolonganDarah, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GolonganDarahVO transferModelToVO(GolonganDarah model, GolonganDarahVO vo) {
|
||||
if (null == vo)
|
||||
vo = new GolonganDarahVO();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, GolonganDarahVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,71 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.GolonganPegawai;
|
||||
import com.jasamedika.medifirst2000.vo.GolonganPegawaiVO;
|
||||
|
||||
@Component
|
||||
public class GolonganPegawaiConverter implements BaseVoConverter<GolonganPegawaiVO, GolonganPegawai> {
|
||||
|
||||
@Override
|
||||
public GolonganPegawai transferVOToModel(GolonganPegawaiVO vo, GolonganPegawai model) {
|
||||
if (null == model)
|
||||
model = new GolonganPegawai();
|
||||
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude,vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, GolonganPegawai.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GolonganPegawaiVO> transferListOfModelToListOfVO(List<GolonganPegawai> models,
|
||||
List<GolonganPegawaiVO> vos) {
|
||||
if (null == vos)
|
||||
vos = new ArrayList<GolonganPegawaiVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (GolonganPegawai GolonganPegawai : models) {
|
||||
GolonganPegawaiVO vo = new GolonganPegawaiVO();
|
||||
vo=transferModelToVO(GolonganPegawai, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GolonganPegawaiVO transferModelToVO(GolonganPegawai model, GolonganPegawaiVO vo) {
|
||||
if (null == vo)
|
||||
vo = new GolonganPegawaiVO();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, GolonganPegawaiVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,99 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.OneToMany;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.dao.custom.base.impl.FindConverterDao;
|
||||
import com.jasamedika.medifirst2000.entities.HVA;
|
||||
import com.jasamedika.medifirst2000.vo.HVAVO;
|
||||
|
||||
@Component
|
||||
public class HVAConverter extends FindConverterDao implements
|
||||
BaseVoConverter<HVAVO, HVA>{
|
||||
@Override
|
||||
public HVA transferVOToModel(HVAVO vo, HVA model) {
|
||||
if (null == model)
|
||||
model = new HVA();
|
||||
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude,vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, HVA.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HVAVO> transferListOfModelToListOfVO(List<HVA> models, List<HVAVO> vos) {
|
||||
|
||||
if (null == vos)
|
||||
vos = new ArrayList<HVAVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (HVA model : models) {
|
||||
HVAVO vo = new HVAVO();
|
||||
vo=transferModelToVO(model, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HVAVO transferModelToVO(HVA model, HVAVO vo) {
|
||||
if (null == vo)
|
||||
vo = new HVAVO();
|
||||
try {
|
||||
|
||||
List<String> fieldsToInclude = new ArrayList<String>();
|
||||
for (Field field : model.GetFields(model.getClass())) {
|
||||
String str = field.getName();
|
||||
String name = field.getName();
|
||||
if(name.equals("serialVersionUID"))continue;
|
||||
Boolean valid = false;
|
||||
for (java.lang.annotation.Annotation annotation : field.getDeclaredAnnotations()) {
|
||||
if (annotation instanceof JoinColumn) {
|
||||
valid=true;
|
||||
} else if (annotation instanceof Column) {
|
||||
Column column = (Column)annotation;
|
||||
if(column.name().endsWith("Fk"))
|
||||
if(field.getName().endsWith("Id")==false)
|
||||
valid=true;
|
||||
}else if (annotation instanceof OneToMany) {
|
||||
|
||||
valid=true;
|
||||
}
|
||||
|
||||
}
|
||||
if(valid ==false)
|
||||
fieldsToInclude.add(str);
|
||||
|
||||
}
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude.toArray(new String[0]),model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, HVAVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
}
|
||||
@ -1,75 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.HasilPemeriksaanPraKerja;
|
||||
import com.jasamedika.medifirst2000.vo.HasilPemeriksaanPraKerjaVO;
|
||||
|
||||
@Component
|
||||
public class HasilPemeriksaanPraKerjaConverter implements BaseVoConverter<HasilPemeriksaanPraKerjaVO, HasilPemeriksaanPraKerja> {
|
||||
|
||||
|
||||
@Override
|
||||
public HasilPemeriksaanPraKerja transferVOToModel(HasilPemeriksaanPraKerjaVO vo, HasilPemeriksaanPraKerja model) {
|
||||
if (null == model)
|
||||
model = new HasilPemeriksaanPraKerja();
|
||||
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude,vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, HasilPemeriksaanPraKerja.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HasilPemeriksaanPraKerjaVO> transferListOfModelToListOfVO(List<HasilPemeriksaanPraKerja> models, List<HasilPemeriksaanPraKerjaVO> vos) {
|
||||
|
||||
if (null == vos)
|
||||
vos = new ArrayList<HasilPemeriksaanPraKerjaVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (HasilPemeriksaanPraKerja HasilPemeriksaanPraKerja : models) {
|
||||
HasilPemeriksaanPraKerjaVO vo = new HasilPemeriksaanPraKerjaVO();
|
||||
vo=transferModelToVO(HasilPemeriksaanPraKerja, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HasilPemeriksaanPraKerjaVO transferModelToVO(HasilPemeriksaanPraKerja model, HasilPemeriksaanPraKerjaVO vo) {
|
||||
if (null == vo)
|
||||
vo = new HasilPemeriksaanPraKerjaVO();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, HasilPemeriksaanPraKerjaVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,96 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.dao.custom.base.impl.FindConverterDao;
|
||||
import com.jasamedika.medifirst2000.entities.HasilTriase;
|
||||
import com.jasamedika.medifirst2000.vo.HasilTriaseVO;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Shakato
|
||||
*/
|
||||
@Component
|
||||
public class HasilTriaseConverter extends FindConverterDao implements
|
||||
BaseVoConverter<HasilTriaseVO, HasilTriase> {
|
||||
|
||||
public HasilTriase transferVOToModel(HasilTriaseVO vo, HasilTriase model) {
|
||||
if (null == model)
|
||||
model = new HasilTriase();
|
||||
try {
|
||||
Gson gson = new GsonBuilder()//.excludeFieldsWithoutExposeAnnotation()
|
||||
.setDateFormat("yyyy-MM-dd HH:mm:ss.SSS")
|
||||
.create();
|
||||
String json = gson.toJson(vo.ToMap());
|
||||
model = gson.fromJson(json, HasilTriase.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return model;
|
||||
|
||||
}
|
||||
|
||||
public List<HasilTriaseVO> transferListOfModelToListOfVO(List<HasilTriase> models,
|
||||
List<HasilTriaseVO> vos) {
|
||||
if (null == vos)
|
||||
vos = new ArrayList<HasilTriaseVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (HasilTriase hasilTriase : models) {
|
||||
HasilTriaseVO hasilTriaseVO = new HasilTriaseVO();
|
||||
transferModelToVO(hasilTriase, hasilTriaseVO);
|
||||
vos.add(hasilTriaseVO);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
public HasilTriaseVO transferModelToVO(HasilTriase model, HasilTriaseVO vo) {
|
||||
if (null == vo)
|
||||
|
||||
vo = new HasilTriaseVO();
|
||||
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson =new GsonBuilder()//.excludeFieldsWithoutExposeAnnotation()
|
||||
.setDateFormat("yyyy-MM-dd HH:mm:ss.SSS")
|
||||
.create();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, HasilTriaseVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
||||
public HasilTriaseVO transferModelToVOCustom(HasilTriase model, HasilTriaseVO vo,String[] fieldsToInclude) {
|
||||
if (null == vo)
|
||||
|
||||
vo = new HasilTriaseVO();
|
||||
|
||||
try {
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson =new GsonBuilder()//.excludeFieldsWithoutExposeAnnotation()
|
||||
.setDateFormat("yyyy-MM-dd HH:mm:ss.SSS")
|
||||
.create();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, HasilTriaseVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,53 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.HistoryLoginModulAplikasi;
|
||||
import com.jasamedika.medifirst2000.vo.HistoryLoginModulAplikasiVO;
|
||||
|
||||
@Component
|
||||
public class HistoryLoginModulAplikasiConverter implements BaseVoConverter<HistoryLoginModulAplikasiVO, HistoryLoginModulAplikasi> {
|
||||
|
||||
@Override
|
||||
public HistoryLoginModulAplikasi transferVOToModel(HistoryLoginModulAplikasiVO vo, HistoryLoginModulAplikasi model) {
|
||||
if (null == model)
|
||||
model = new HistoryLoginModulAplikasi();
|
||||
|
||||
BeanUtils.copyProperties(vo, model);
|
||||
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HistoryLoginModulAplikasiVO> transferListOfModelToListOfVO(List<HistoryLoginModulAplikasi> models,
|
||||
List<HistoryLoginModulAplikasiVO> vos) {
|
||||
if (null == vos)
|
||||
vos = new ArrayList<HistoryLoginModulAplikasiVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (HistoryLoginModulAplikasi historyLoginModulAplikasi : models) {
|
||||
HistoryLoginModulAplikasiVO vo = new HistoryLoginModulAplikasiVO();
|
||||
vo=transferModelToVO(historyLoginModulAplikasi, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HistoryLoginModulAplikasiVO transferModelToVO(HistoryLoginModulAplikasi model, HistoryLoginModulAplikasiVO vo) {
|
||||
if (null == vo)
|
||||
vo = new HistoryLoginModulAplikasiVO();
|
||||
BeanUtils.copyProperties(model, vo);
|
||||
return vo;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,53 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.HistoryLoginUser;
|
||||
import com.jasamedika.medifirst2000.vo.HistoryLoginUserVO;
|
||||
|
||||
@Component
|
||||
public class HistoryLoginUserConverter implements BaseVoConverter<HistoryLoginUserVO, HistoryLoginUser> {
|
||||
|
||||
@Override
|
||||
public HistoryLoginUser transferVOToModel(HistoryLoginUserVO vo, HistoryLoginUser model) {
|
||||
if (null == model)
|
||||
model = new HistoryLoginUser();
|
||||
|
||||
BeanUtils.copyProperties(vo, model);
|
||||
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HistoryLoginUserVO> transferListOfModelToListOfVO(List<HistoryLoginUser> models,
|
||||
List<HistoryLoginUserVO> vos) {
|
||||
if (null == vos)
|
||||
vos = new ArrayList<HistoryLoginUserVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (HistoryLoginUser historyLoginUser : models) {
|
||||
HistoryLoginUserVO vo = new HistoryLoginUserVO();
|
||||
vo=transferModelToVO(historyLoginUser, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HistoryLoginUserVO transferModelToVO(HistoryLoginUser model, HistoryLoginUserVO vo) {
|
||||
if (null == vo)
|
||||
vo = new HistoryLoginUserVO();
|
||||
BeanUtils.copyProperties(model, vo);
|
||||
return vo;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,75 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.HubunganKeluarga;
|
||||
import com.jasamedika.medifirst2000.vo.HubunganKeluargaVO;
|
||||
|
||||
@Component
|
||||
public class HubunganKeluargaConverter implements BaseVoConverter<HubunganKeluargaVO, HubunganKeluarga> {
|
||||
|
||||
|
||||
@Override
|
||||
public HubunganKeluarga transferVOToModel(HubunganKeluargaVO vo, HubunganKeluarga model) {
|
||||
if (null == model)
|
||||
model = new HubunganKeluarga();
|
||||
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude,vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, HubunganKeluarga.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HubunganKeluargaVO> transferListOfModelToListOfVO(List<HubunganKeluarga> models, List<HubunganKeluargaVO> vos) {
|
||||
|
||||
if (null == vos)
|
||||
vos = new ArrayList<HubunganKeluargaVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (HubunganKeluarga HubunganKeluarga : models) {
|
||||
HubunganKeluargaVO vo = new HubunganKeluargaVO();
|
||||
vo=transferModelToVO(HubunganKeluarga, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HubunganKeluargaVO transferModelToVO(HubunganKeluarga model, HubunganKeluargaVO vo) {
|
||||
if (null == vo)
|
||||
vo = new HubunganKeluargaVO();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, HubunganKeluargaVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,114 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.OneToMany;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.IndikatorRensar;
|
||||
import com.jasamedika.medifirst2000.vo.IndikatorRensarVO;
|
||||
|
||||
@Component
|
||||
public class IndikatorRensarConverter implements BaseVoConverter<IndikatorRensarVO, IndikatorRensar>{
|
||||
|
||||
@Override
|
||||
public IndikatorRensar transferVOToModel(IndikatorRensarVO vo, IndikatorRensar model) {
|
||||
if (null == model)
|
||||
model = new IndikatorRensar();
|
||||
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude,vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, IndikatorRensar.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IndikatorRensarVO> transferListOfModelToListOfVO(List<IndikatorRensar> models, List<IndikatorRensarVO> vos) {
|
||||
|
||||
if (null == vos)
|
||||
vos = new ArrayList<IndikatorRensarVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (IndikatorRensar pegawai : models) {
|
||||
IndikatorRensarVO vo = new IndikatorRensarVO();
|
||||
vo=transferModelToVO(pegawai, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IndikatorRensarVO transferModelToVO(IndikatorRensar model, IndikatorRensarVO vo) {
|
||||
if (null == vo)
|
||||
vo = new IndikatorRensarVO();
|
||||
try {
|
||||
|
||||
List<String> fieldsToInclude = new ArrayList<String>();
|
||||
for (Field field : model.GetFields(model.getClass())) {
|
||||
String str = field.getName();
|
||||
String name = field.getName();
|
||||
if(name.equals("serialVersionUID"))continue;
|
||||
Boolean valid = false;
|
||||
for (java.lang.annotation.Annotation annotation : field.getDeclaredAnnotations()) {
|
||||
if (annotation instanceof JoinColumn) {
|
||||
valid=true;
|
||||
} else if (annotation instanceof Column) {
|
||||
Column column = (Column)annotation;
|
||||
if(column.name().endsWith("Fk"))
|
||||
if(field.getName().endsWith("Id")==false)
|
||||
valid=true;
|
||||
}else if (annotation instanceof OneToMany) {
|
||||
|
||||
valid=true;
|
||||
}
|
||||
|
||||
}
|
||||
if(valid ==false)
|
||||
fieldsToInclude.add(str);
|
||||
|
||||
}
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude.toArray(new String[0]),model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, IndikatorRensarVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
public IndikatorRensarVO transferModelToVOCustom(IndikatorRensar model, IndikatorRensarVO vo,String[] fieldsToInclude) {
|
||||
if (null == vo)
|
||||
|
||||
vo = new IndikatorRensarVO();
|
||||
|
||||
try {
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, IndikatorRensarVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
}
|
||||
@ -1,69 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.Inseminasi;
|
||||
import com.jasamedika.medifirst2000.vo.InseminasiVO;
|
||||
|
||||
@Component
|
||||
public class InseminasiConverter implements BaseVoConverter<InseminasiVO, Inseminasi>{
|
||||
|
||||
@Override
|
||||
public Inseminasi transferVOToModel(InseminasiVO vo, Inseminasi model) {
|
||||
if (null == model)
|
||||
model = new Inseminasi();
|
||||
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude,vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, Inseminasi.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<InseminasiVO> transferListOfModelToListOfVO(List<Inseminasi> models, List<InseminasiVO> vos) {
|
||||
if (null == vos)
|
||||
vos = new ArrayList<InseminasiVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (Inseminasi model : models) {
|
||||
InseminasiVO vo = new InseminasiVO();
|
||||
transferModelToVO(model, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InseminasiVO transferModelToVO(Inseminasi model, InseminasiVO vo) {
|
||||
if (null == vo)
|
||||
vo = new InseminasiVO();
|
||||
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, InseminasiVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,76 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.Jabatan;
|
||||
import com.jasamedika.medifirst2000.vo.JabatanVO;
|
||||
|
||||
/**
|
||||
* Converter class between Jabatan and JabatanVO
|
||||
*
|
||||
* @author Askur
|
||||
*/
|
||||
@Component
|
||||
public class JabatanConverter implements BaseVoConverter<JabatanVO, Jabatan> {
|
||||
|
||||
|
||||
public Jabatan transferVOToModel(JabatanVO vo, Jabatan model) {
|
||||
if (null == model)
|
||||
model = new Jabatan();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude,vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, Jabatan.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return model;
|
||||
|
||||
}
|
||||
|
||||
public List<JabatanVO> transferListOfModelToListOfVO(List<Jabatan> models,
|
||||
List<JabatanVO> vos) {
|
||||
if (null == vos)
|
||||
vos = new ArrayList<JabatanVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (Jabatan Jabatan : models) {
|
||||
JabatanVO vo = new JabatanVO();
|
||||
vo = transferModelToVO(Jabatan, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JabatanVO transferModelToVO(Jabatan model, JabatanVO vo) {
|
||||
|
||||
if (null == vo)
|
||||
vo = new JabatanVO();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, JabatanVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return vo;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -1,68 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.JadwalDokter;
|
||||
import com.jasamedika.medifirst2000.vo.JadwalDokterVO;
|
||||
|
||||
@Component
|
||||
public class JadwalDokterConverter implements BaseVoConverter<JadwalDokterVO, JadwalDokter> {
|
||||
|
||||
@Override
|
||||
public JadwalDokter transferVOToModel(JadwalDokterVO vo, JadwalDokter model) {
|
||||
if (null == model)
|
||||
model = new JadwalDokter();
|
||||
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude, vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, JadwalDokter.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JadwalDokterVO> transferListOfModelToListOfVO(List<JadwalDokter> models, List<JadwalDokterVO> vos) {
|
||||
if (null == vos)
|
||||
vos = new ArrayList<JadwalDokterVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (JadwalDokter model : models) {
|
||||
JadwalDokterVO vo = new JadwalDokterVO();
|
||||
transferModelToVO(model, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JadwalDokterVO transferModelToVO(JadwalDokter model, JadwalDokterVO vo) {
|
||||
if (null == vo)
|
||||
vo = new JadwalDokterVO();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude, model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, JadwalDokterVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,99 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.OneToMany;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.JadwalRencanaPemeriksaan;
|
||||
import com.jasamedika.medifirst2000.vo.JadwalRencanaPemeriksaanVO;
|
||||
|
||||
@Component
|
||||
public class JadwalRencanaPemeriksaanConverter implements BaseVoConverter<JadwalRencanaPemeriksaanVO,JadwalRencanaPemeriksaan>{
|
||||
|
||||
@Override
|
||||
public JadwalRencanaPemeriksaan transferVOToModel(JadwalRencanaPemeriksaanVO vo, JadwalRencanaPemeriksaan model) {
|
||||
if (null == model)
|
||||
model = new JadwalRencanaPemeriksaan();
|
||||
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude,vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, JadwalRencanaPemeriksaan.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JadwalRencanaPemeriksaanVO> transferListOfModelToListOfVO(List<JadwalRencanaPemeriksaan> models, List<JadwalRencanaPemeriksaanVO> vos) {
|
||||
|
||||
if (null == vos)
|
||||
vos = new ArrayList<JadwalRencanaPemeriksaanVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (JadwalRencanaPemeriksaan model : models) {
|
||||
JadwalRencanaPemeriksaanVO vo = new JadwalRencanaPemeriksaanVO();
|
||||
vo=transferModelToVO(model, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JadwalRencanaPemeriksaanVO transferModelToVO(JadwalRencanaPemeriksaan model, JadwalRencanaPemeriksaanVO vo) {
|
||||
if (null == vo)
|
||||
vo = new JadwalRencanaPemeriksaanVO();
|
||||
try {
|
||||
|
||||
List<String> fieldsToInclude = new ArrayList<String>();
|
||||
for (Field field : model.GetFields(model.getClass())) {
|
||||
String str = field.getName();
|
||||
String name = field.getName();
|
||||
if(name.equals("serialVersionUID"))continue;
|
||||
Boolean valid = false;
|
||||
for (java.lang.annotation.Annotation annotation : field.getDeclaredAnnotations()) {
|
||||
if (annotation instanceof JoinColumn) {
|
||||
valid=true;
|
||||
} else if (annotation instanceof Column) {
|
||||
Column column = (Column)annotation;
|
||||
if(column.name().endsWith("Fk"))
|
||||
if(field.getName().endsWith("Id")==false)
|
||||
valid=true;
|
||||
}else if (annotation instanceof OneToMany) {
|
||||
|
||||
valid=true;
|
||||
}
|
||||
|
||||
}
|
||||
if(valid ==false)
|
||||
fieldsToInclude.add(str);
|
||||
|
||||
}
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude.toArray(new String[0]),model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, JadwalRencanaPemeriksaanVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,69 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.JawabanKonsultasi;
|
||||
import com.jasamedika.medifirst2000.vo.JawabanKonsultasiVO;
|
||||
|
||||
@Component
|
||||
public class JawabanKonsultasiConverter implements BaseVoConverter<JawabanKonsultasiVO, JawabanKonsultasi> {
|
||||
|
||||
@Override
|
||||
public JawabanKonsultasi transferVOToModel(JawabanKonsultasiVO vo, JawabanKonsultasi model) {
|
||||
if (null == model)
|
||||
model = new JawabanKonsultasi();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude,vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, JawabanKonsultasi.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JawabanKonsultasiVO> transferListOfModelToListOfVO(List<JawabanKonsultasi> models,
|
||||
List<JawabanKonsultasiVO> vos) {
|
||||
if (null == vos)
|
||||
vos = new ArrayList<JawabanKonsultasiVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (JawabanKonsultasi lembarKonsultasi : models) {
|
||||
JawabanKonsultasiVO vo = new JawabanKonsultasiVO();
|
||||
vo=transferModelToVO(lembarKonsultasi, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JawabanKonsultasiVO transferModelToVO(JawabanKonsultasi model, JawabanKonsultasiVO vo) {
|
||||
if (null == vo)
|
||||
vo = new JawabanKonsultasiVO();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, JawabanKonsultasiVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,74 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.JenisAlamat;
|
||||
import com.jasamedika.medifirst2000.vo.JenisAlamatVO;
|
||||
|
||||
@Component
|
||||
public class JenisAlamatConverter implements BaseVoConverter<JenisAlamatVO, JenisAlamat> {
|
||||
|
||||
|
||||
@Override
|
||||
public JenisAlamat transferVOToModel(JenisAlamatVO vo, JenisAlamat model) {
|
||||
if (null == model)
|
||||
model = new JenisAlamat();
|
||||
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude,vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, JenisAlamat.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JenisAlamatVO> transferListOfModelToListOfVO(List<JenisAlamat> models, List<JenisAlamatVO> vos) {
|
||||
|
||||
if (null == vos)
|
||||
vos = new ArrayList<JenisAlamatVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (JenisAlamat JenisAlamat : models) {
|
||||
JenisAlamatVO vo = new JenisAlamatVO();
|
||||
vo=transferModelToVO(JenisAlamat, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JenisAlamatVO transferModelToVO(JenisAlamat model, JenisAlamatVO vo) {
|
||||
if (null == vo)
|
||||
vo = new JenisAlamatVO();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, JenisAlamatVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,91 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.JenisDiagnosa;
|
||||
|
||||
import com.jasamedika.medifirst2000.vo.JenisDiagnosaVO;
|
||||
|
||||
@Component
|
||||
public class JenisDiagnosaConverter implements BaseVoConverter<JenisDiagnosaVO, JenisDiagnosa> {
|
||||
|
||||
|
||||
@Override
|
||||
public JenisDiagnosa transferVOToModel(JenisDiagnosaVO vo, JenisDiagnosa model) {
|
||||
if (null == model)
|
||||
model = new JenisDiagnosa();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude,vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, JenisDiagnosa.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JenisDiagnosaVO> transferListOfModelToListOfVO(List<JenisDiagnosa> models, List<JenisDiagnosaVO> vos) {
|
||||
|
||||
if (null == vos)
|
||||
vos = new ArrayList<JenisDiagnosaVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (JenisDiagnosa jenisDiagnosa : models) {
|
||||
JenisDiagnosaVO vo = new JenisDiagnosaVO();
|
||||
vo=transferModelToVO(jenisDiagnosa, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JenisDiagnosaVO transferModelToVO(JenisDiagnosa model, JenisDiagnosaVO vo) {
|
||||
if (null == vo)
|
||||
vo = new JenisDiagnosaVO();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, JenisDiagnosaVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
public JenisDiagnosaVO transferModelToVOCustom(JenisDiagnosa model, JenisDiagnosaVO vo,String[] fieldsToInclude) {
|
||||
if (null == vo)
|
||||
|
||||
vo = new JenisDiagnosaVO();
|
||||
|
||||
try {
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, JenisDiagnosaVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,91 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.JenisDiet;
|
||||
|
||||
import com.jasamedika.medifirst2000.vo.JenisDietVO;
|
||||
|
||||
@Component
|
||||
public class JenisDietConverter implements BaseVoConverter<JenisDietVO, JenisDiet> {
|
||||
|
||||
|
||||
@Override
|
||||
public JenisDiet transferVOToModel(JenisDietVO vo, JenisDiet model) {
|
||||
if (null == model)
|
||||
model = new JenisDiet();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude,vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, JenisDiet.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JenisDietVO> transferListOfModelToListOfVO(List<JenisDiet> models, List<JenisDietVO> vos) {
|
||||
|
||||
if (null == vos)
|
||||
vos = new ArrayList<JenisDietVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (JenisDiet jenisDiet : models) {
|
||||
JenisDietVO vo = new JenisDietVO();
|
||||
vo=transferModelToVO(jenisDiet, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JenisDietVO transferModelToVO(JenisDiet model, JenisDietVO vo) {
|
||||
if (null == vo)
|
||||
vo = new JenisDietVO();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, JenisDietVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
public JenisDietVO transferModelToVOCustom(JenisDiet model, JenisDietVO vo,String[] fieldsToInclude) {
|
||||
if (null == vo)
|
||||
|
||||
vo = new JenisDietVO();
|
||||
|
||||
try {
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, JenisDietVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,98 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.OneToMany;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.JenisIndikator;
|
||||
import com.jasamedika.medifirst2000.vo.JenisIndikatorVO;
|
||||
|
||||
@Component
|
||||
public class JenisIndikatorConverter implements BaseVoConverter<JenisIndikatorVO, JenisIndikator>{
|
||||
|
||||
@Override
|
||||
public JenisIndikator transferVOToModel(JenisIndikatorVO vo, JenisIndikator model) {
|
||||
if (null == model)
|
||||
model = new JenisIndikator();
|
||||
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude,vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, JenisIndikator.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JenisIndikatorVO> transferListOfModelToListOfVO(List<JenisIndikator> models, List<JenisIndikatorVO> vos) {
|
||||
|
||||
if (null == vos)
|
||||
vos = new ArrayList<JenisIndikatorVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (JenisIndikator model : models) {
|
||||
JenisIndikatorVO vo = new JenisIndikatorVO();
|
||||
vo=transferModelToVO(model, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JenisIndikatorVO transferModelToVO(JenisIndikator model, JenisIndikatorVO vo) {
|
||||
if (null == vo)
|
||||
vo = new JenisIndikatorVO();
|
||||
try {
|
||||
|
||||
List<String> fieldsToInclude = new ArrayList<String>();
|
||||
for (Field field : model.GetFields(model.getClass())) {
|
||||
String str = field.getName();
|
||||
String name = field.getName();
|
||||
if(name.equals("serialVersionUID"))continue;
|
||||
Boolean valid = false;
|
||||
for (java.lang.annotation.Annotation annotation : field.getDeclaredAnnotations()) {
|
||||
if (annotation instanceof JoinColumn) {
|
||||
valid=true;
|
||||
} else if (annotation instanceof Column) {
|
||||
Column column = (Column)annotation;
|
||||
if(column.name().endsWith("Fk"))
|
||||
if(field.getName().endsWith("Id")==false)
|
||||
valid=true;
|
||||
}else if (annotation instanceof OneToMany) {
|
||||
|
||||
valid=true;
|
||||
}
|
||||
|
||||
}
|
||||
if(valid ==false)
|
||||
fieldsToInclude.add(str);
|
||||
|
||||
}
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude.toArray(new String[0]),model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, JenisIndikatorVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
}
|
||||
@ -1,80 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.JenisKartu;
|
||||
import com.jasamedika.medifirst2000.vo.JenisKartuVO;
|
||||
|
||||
/**
|
||||
* Converter class between Pasien and PasienVO
|
||||
*
|
||||
* @author Askur
|
||||
*/
|
||||
@Component
|
||||
public class JenisKartuConverter implements BaseVoConverter<JenisKartuVO, JenisKartu> {
|
||||
|
||||
|
||||
@Override
|
||||
public JenisKartu transferVOToModel(JenisKartuVO vo, JenisKartu model) {
|
||||
if (null == model)
|
||||
model = new JenisKartu();
|
||||
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude,vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, JenisKartu.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JenisKartuVO> transferListOfModelToListOfVO(List<JenisKartu> models, List<JenisKartuVO> vos) {
|
||||
|
||||
if (null == vos)
|
||||
vos = new ArrayList<JenisKartuVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (JenisKartu pegawai : models) {
|
||||
JenisKartuVO vo = new JenisKartuVO();
|
||||
vo=transferModelToVO(pegawai, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JenisKartuVO transferModelToVO(JenisKartu model, JenisKartuVO vo) {
|
||||
if (null == vo)
|
||||
vo = new JenisKartuVO();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, JenisKartu.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,80 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.JenisKartuDetail;
|
||||
import com.jasamedika.medifirst2000.vo.JenisKartuDetailVO;
|
||||
|
||||
/**
|
||||
* Converter class between Pasien and PasienVO
|
||||
*
|
||||
* @author Askur
|
||||
*/
|
||||
@Component
|
||||
public class JenisKartuDetailConverter implements BaseVoConverter<JenisKartuDetailVO, JenisKartuDetail> {
|
||||
|
||||
|
||||
@Override
|
||||
public JenisKartuDetail transferVOToModel(JenisKartuDetailVO vo, JenisKartuDetail model) {
|
||||
if (null == model)
|
||||
model = new JenisKartuDetail();
|
||||
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude,vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, JenisKartuDetail.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JenisKartuDetailVO> transferListOfModelToListOfVO(List<JenisKartuDetail> models, List<JenisKartuDetailVO> vos) {
|
||||
|
||||
if (null == vos)
|
||||
vos = new ArrayList<JenisKartuDetailVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (JenisKartuDetail pegawai : models) {
|
||||
JenisKartuDetailVO vo = new JenisKartuDetailVO();
|
||||
vo=transferModelToVO(pegawai, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JenisKartuDetailVO transferModelToVO(JenisKartuDetail model, JenisKartuDetailVO vo) {
|
||||
if (null == vo)
|
||||
vo = new JenisKartuDetailVO();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, JenisKartuDetailVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,76 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.JenisKelamin;
|
||||
import com.jasamedika.medifirst2000.vo.JenisKelaminVO;
|
||||
|
||||
@Component
|
||||
public class JenisKelaminConverter implements BaseVoConverter<JenisKelaminVO, JenisKelamin> {
|
||||
|
||||
|
||||
@Override
|
||||
public JenisKelamin transferVOToModel(JenisKelaminVO vo, JenisKelamin model) {
|
||||
if (null == model)
|
||||
model = new JenisKelamin();
|
||||
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude,vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, JenisKelamin.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JenisKelaminVO> transferListOfModelToListOfVO(List<JenisKelamin> models, List<JenisKelaminVO> vos) {
|
||||
|
||||
if (null == vos)
|
||||
vos = new ArrayList<JenisKelaminVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (JenisKelamin JenisKelamin : models) {
|
||||
JenisKelaminVO vo = new JenisKelaminVO();
|
||||
vo=transferModelToVO(JenisKelamin, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JenisKelaminVO transferModelToVO(JenisKelamin model, JenisKelaminVO vo) {
|
||||
if (null == vo)
|
||||
vo = new JenisKelaminVO();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, JenisKelaminVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,76 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.JenisPegawai;
|
||||
import com.jasamedika.medifirst2000.vo.JenisPegawaiVO;
|
||||
|
||||
@Component
|
||||
public class JenisPegawaiConverter implements BaseVoConverter<JenisPegawaiVO, JenisPegawai> {
|
||||
|
||||
|
||||
@Override
|
||||
public JenisPegawai transferVOToModel(JenisPegawaiVO vo, JenisPegawai model) {
|
||||
if (null == model)
|
||||
model = new JenisPegawai();
|
||||
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude,vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, JenisPegawai.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JenisPegawaiVO> transferListOfModelToListOfVO(List<JenisPegawai> models, List<JenisPegawaiVO> vos) {
|
||||
|
||||
if (null == vos)
|
||||
vos = new ArrayList<JenisPegawaiVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (JenisPegawai JenisPegawai : models) {
|
||||
JenisPegawaiVO vo = new JenisPegawaiVO();
|
||||
vo=transferModelToVO(JenisPegawai, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JenisPegawaiVO transferModelToVO(JenisPegawai model, JenisPegawaiVO vo) {
|
||||
if (null == vo)
|
||||
vo = new JenisPegawaiVO();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, JenisPegawaiVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,76 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.JenisPengantarPasien;
|
||||
import com.jasamedika.medifirst2000.vo.JenisPengantarPasienVO;
|
||||
|
||||
@Component
|
||||
public class JenisPengantarPasienConverter implements BaseVoConverter<JenisPengantarPasienVO, JenisPengantarPasien> {
|
||||
|
||||
|
||||
@Override
|
||||
public JenisPengantarPasien transferVOToModel(JenisPengantarPasienVO vo, JenisPengantarPasien model) {
|
||||
if (null == model)
|
||||
model = new JenisPengantarPasien();
|
||||
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude,vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, JenisPengantarPasien.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JenisPengantarPasienVO> transferListOfModelToListOfVO(List<JenisPengantarPasien> models, List<JenisPengantarPasienVO> vos) {
|
||||
|
||||
if (null == vos)
|
||||
vos = new ArrayList<JenisPengantarPasienVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (JenisPengantarPasien JenisPengantarPasien : models) {
|
||||
JenisPengantarPasienVO vo = new JenisPengantarPasienVO();
|
||||
vo=transferModelToVO(JenisPengantarPasien, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JenisPengantarPasienVO transferModelToVO(JenisPengantarPasien model, JenisPengantarPasienVO vo) {
|
||||
if (null == vo)
|
||||
vo = new JenisPengantarPasienVO();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, JenisPengantarPasienVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,99 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.OneToMany;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.KajianEvaluasi;
|
||||
import com.jasamedika.medifirst2000.vo.KajianEvaluasiVO;
|
||||
|
||||
@Component
|
||||
public class KajianEvaluasiConverter implements BaseVoConverter<KajianEvaluasiVO, KajianEvaluasi>{
|
||||
|
||||
@Override
|
||||
public KajianEvaluasi transferVOToModel(KajianEvaluasiVO vo, KajianEvaluasi model) {
|
||||
if (null == model)
|
||||
model = new KajianEvaluasi();
|
||||
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude,vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, KajianEvaluasi.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<KajianEvaluasiVO> transferListOfModelToListOfVO(List<KajianEvaluasi> models, List<KajianEvaluasiVO> vos) {
|
||||
|
||||
if (null == vos)
|
||||
vos = new ArrayList<KajianEvaluasiVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (KajianEvaluasi model : models) {
|
||||
KajianEvaluasiVO vo = new KajianEvaluasiVO();
|
||||
vo=transferModelToVO(model, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public KajianEvaluasiVO transferModelToVO(KajianEvaluasi model, KajianEvaluasiVO vo) {
|
||||
if (null == vo)
|
||||
vo = new KajianEvaluasiVO();
|
||||
try {
|
||||
|
||||
List<String> fieldsToInclude = new ArrayList<String>();
|
||||
for (Field field : model.GetFields(model.getClass())) {
|
||||
String str = field.getName();
|
||||
String name = field.getName();
|
||||
if(name.equals("serialVersionUID"))continue;
|
||||
Boolean valid = false;
|
||||
for (java.lang.annotation.Annotation annotation : field.getDeclaredAnnotations()) {
|
||||
if (annotation instanceof JoinColumn) {
|
||||
valid=true;
|
||||
} else if (annotation instanceof Column) {
|
||||
Column column = (Column)annotation;
|
||||
if(column.name().endsWith("Fk"))
|
||||
if(field.getName().endsWith("Id")==false)
|
||||
valid=true;
|
||||
}else if (annotation instanceof OneToMany) {
|
||||
|
||||
valid=true;
|
||||
}
|
||||
|
||||
}
|
||||
if(valid ==false)
|
||||
fieldsToInclude.add(str);
|
||||
|
||||
}
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude.toArray(new String[0]),model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, KajianEvaluasiVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,69 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.springframework.stereotype.Component;
|
||||
import com.google.gson.Gson;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.Kamar;
|
||||
import com.jasamedika.medifirst2000.vo.KamarVO;
|
||||
|
||||
@Component
|
||||
public class KamarConverter implements BaseVoConverter<KamarVO, Kamar> {
|
||||
|
||||
@Override
|
||||
public Kamar transferVOToModel(KamarVO vo, Kamar model) {
|
||||
if (null == model)
|
||||
model = new Kamar();
|
||||
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude, vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, Kamar.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<KamarVO> transferListOfModelToListOfVO(List<Kamar> models, List<KamarVO> vos) {
|
||||
|
||||
if (null == vos)
|
||||
vos = new ArrayList<KamarVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (Kamar Kamar : models) {
|
||||
KamarVO vo = new KamarVO();
|
||||
vo = transferModelToVO(Kamar, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public KamarVO transferModelToVO(Kamar model, KamarVO vo) {
|
||||
if (null == vo)
|
||||
vo = new KamarVO();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude, model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, KamarVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,114 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.OneToMany;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.KamusIndikator;
|
||||
import com.jasamedika.medifirst2000.vo.KamusIndikatorVO;
|
||||
|
||||
@Component
|
||||
public class KamusIndikatorConverter implements BaseVoConverter<KamusIndikatorVO, KamusIndikator>{
|
||||
|
||||
@Override
|
||||
public KamusIndikator transferVOToModel(KamusIndikatorVO vo, KamusIndikator model) {
|
||||
if (null == model)
|
||||
model = new KamusIndikator();
|
||||
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude,vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, KamusIndikator.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<KamusIndikatorVO> transferListOfModelToListOfVO(List<KamusIndikator> models, List<KamusIndikatorVO> vos) {
|
||||
|
||||
if (null == vos)
|
||||
vos = new ArrayList<KamusIndikatorVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (KamusIndikator pegawai : models) {
|
||||
KamusIndikatorVO vo = new KamusIndikatorVO();
|
||||
vo=transferModelToVO(pegawai, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public KamusIndikatorVO transferModelToVO(KamusIndikator model, KamusIndikatorVO vo) {
|
||||
if (null == vo)
|
||||
vo = new KamusIndikatorVO();
|
||||
try {
|
||||
|
||||
List<String> fieldsToInclude = new ArrayList<String>();
|
||||
for (Field field : model.GetFields(model.getClass())) {
|
||||
String str = field.getName();
|
||||
String name = field.getName();
|
||||
if(name.equals("serialVersionUID"))continue;
|
||||
Boolean valid = false;
|
||||
for (java.lang.annotation.Annotation annotation : field.getDeclaredAnnotations()) {
|
||||
if (annotation instanceof JoinColumn) {
|
||||
valid=true;
|
||||
} else if (annotation instanceof Column) {
|
||||
Column column = (Column)annotation;
|
||||
if(column.name().endsWith("Fk"))
|
||||
if(field.getName().endsWith("Id")==false)
|
||||
valid=true;
|
||||
}else if (annotation instanceof OneToMany) {
|
||||
|
||||
valid=true;
|
||||
}
|
||||
|
||||
}
|
||||
if(valid ==false)
|
||||
fieldsToInclude.add(str);
|
||||
|
||||
}
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude.toArray(new String[0]),model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, KamusIndikatorVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
public KamusIndikatorVO transferModelToVOCustom(KamusIndikator model, KamusIndikatorVO vo,String[] fieldsToInclude) {
|
||||
if (null == vo)
|
||||
|
||||
vo = new KamusIndikatorVO();
|
||||
|
||||
try {
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, KamusIndikatorVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
}
|
||||
@ -1,79 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.KasusPenyakit;
|
||||
import com.jasamedika.medifirst2000.vo.KasusPenyakitVO;
|
||||
|
||||
/**
|
||||
* Converter class between Pasien and PasienVO
|
||||
*
|
||||
* @author Askur
|
||||
*/
|
||||
@Component
|
||||
public class KasusPenyakitConverter implements BaseVoConverter<KasusPenyakitVO, KasusPenyakit> {
|
||||
|
||||
|
||||
@Override
|
||||
public KasusPenyakit transferVOToModel(KasusPenyakitVO vo, KasusPenyakit model) {
|
||||
if (null == model)
|
||||
model = new KasusPenyakit();
|
||||
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude,vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, KasusPenyakit.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<KasusPenyakitVO> transferListOfModelToListOfVO(List<KasusPenyakit> models, List<KasusPenyakitVO> vos) {
|
||||
|
||||
if (null == vos)
|
||||
vos = new ArrayList<KasusPenyakitVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (KasusPenyakit pegawai : models) {
|
||||
KasusPenyakitVO vo = new KasusPenyakitVO();
|
||||
vo=transferModelToVO(pegawai, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public KasusPenyakitVO transferModelToVO(KasusPenyakit model, KasusPenyakitVO vo) {
|
||||
if (null == vo)
|
||||
vo = new KasusPenyakitVO();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, KasusPenyakitVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,75 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.KategoriHasilTriase;
|
||||
import com.jasamedika.medifirst2000.vo.KategoriHasilTriaseVO;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Shakato
|
||||
*/
|
||||
@Component
|
||||
public class KategoriHasilTriaseConverter implements BaseVoConverter<KategoriHasilTriaseVO, KategoriHasilTriase>{
|
||||
|
||||
@Override
|
||||
public KategoriHasilTriase transferVOToModel(KategoriHasilTriaseVO vo, KategoriHasilTriase model) {
|
||||
if (null == model){
|
||||
model = new KategoriHasilTriase();
|
||||
}
|
||||
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude,vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, KategoriHasilTriase.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<KategoriHasilTriaseVO> transferListOfModelToListOfVO(List<KategoriHasilTriase> models,
|
||||
List<KategoriHasilTriaseVO> vos) {
|
||||
if (vos == null) {
|
||||
vos = new ArrayList<KategoriHasilTriaseVO>();
|
||||
}
|
||||
|
||||
if (models == null) {
|
||||
return vos;
|
||||
}
|
||||
|
||||
for (KategoriHasilTriase status : models) {
|
||||
KategoriHasilTriaseVO vo = new KategoriHasilTriaseVO();
|
||||
vo=transferModelToVO(status, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public KategoriHasilTriaseVO transferModelToVO(KategoriHasilTriase model, KategoriHasilTriaseVO vo) {
|
||||
if (vo == null)
|
||||
vo = new KategoriHasilTriaseVO();
|
||||
try {
|
||||
String[] fieldsToInclude = {"detailTriase","detailTriase"};
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, KategoriHasilTriaseVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,91 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.KebutuhanDasar;
|
||||
|
||||
import com.jasamedika.medifirst2000.vo.KebutuhanDasarVO;
|
||||
|
||||
@Component
|
||||
public class KebutuhanDasarConverter implements BaseVoConverter<KebutuhanDasarVO, KebutuhanDasar> {
|
||||
|
||||
|
||||
@Override
|
||||
public KebutuhanDasar transferVOToModel(KebutuhanDasarVO vo, KebutuhanDasar model) {
|
||||
if (null == model)
|
||||
model = new KebutuhanDasar();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude,vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, KebutuhanDasar.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<KebutuhanDasarVO> transferListOfModelToListOfVO(List<KebutuhanDasar> models, List<KebutuhanDasarVO> vos) {
|
||||
|
||||
if (null == vos)
|
||||
vos = new ArrayList<KebutuhanDasarVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (KebutuhanDasar KebutuhanDasar : models) {
|
||||
KebutuhanDasarVO vo = new KebutuhanDasarVO();
|
||||
vo=transferModelToVO(KebutuhanDasar, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public KebutuhanDasarVO transferModelToVO(KebutuhanDasar model, KebutuhanDasarVO vo) {
|
||||
if (null == vo)
|
||||
vo = new KebutuhanDasarVO();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, KebutuhanDasarVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
public KebutuhanDasarVO transferModelToVOCustom(KebutuhanDasar model, KebutuhanDasarVO vo,String[] fieldsToInclude) {
|
||||
if (null == vo)
|
||||
|
||||
vo = new KebutuhanDasarVO();
|
||||
|
||||
try {
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, KebutuhanDasarVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,81 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.Kecamatan;
|
||||
import com.jasamedika.medifirst2000.vo.KecamatanVO;
|
||||
|
||||
/**
|
||||
* Converter class between Pasien and PasienVO
|
||||
*
|
||||
* @author Askur
|
||||
*/
|
||||
@Component
|
||||
public class KecamatanConverter implements BaseVoConverter<KecamatanVO, Kecamatan> {
|
||||
|
||||
|
||||
@Override
|
||||
public Kecamatan transferVOToModel(KecamatanVO vo, Kecamatan model) {
|
||||
if (null == model)
|
||||
model = new Kecamatan();
|
||||
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude,vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, Kecamatan.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<KecamatanVO> transferListOfModelToListOfVO(List<Kecamatan> models, List<KecamatanVO> vos) {
|
||||
|
||||
if (null == vos)
|
||||
vos = new ArrayList<KecamatanVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (Kecamatan pegawai : models) {
|
||||
KecamatanVO vo = new KecamatanVO();
|
||||
vo=transferModelToVO(pegawai, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public KecamatanVO transferModelToVO(Kecamatan model, KecamatanVO vo) {
|
||||
if (null == vo)
|
||||
vo = new KecamatanVO();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, KecamatanVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,76 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.KehamilanSekarang;
|
||||
import com.jasamedika.medifirst2000.vo.KehamilanSekarangVO;
|
||||
|
||||
/**
|
||||
* Converter class between KehamilanSekarangConverter
|
||||
*
|
||||
* @author Askur
|
||||
*/
|
||||
@Component
|
||||
public class KehamilanSekarangConverter implements BaseVoConverter<KehamilanSekarangVO, KehamilanSekarang> {
|
||||
|
||||
|
||||
public KehamilanSekarang transferVOToModel(KehamilanSekarangVO vo, KehamilanSekarang model) {
|
||||
if (null == model)
|
||||
model = new KehamilanSekarang();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude,vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, KehamilanSekarang.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return model;
|
||||
|
||||
}
|
||||
|
||||
public List<KehamilanSekarangVO> transferListOfModelToListOfVO(List<KehamilanSekarang> models,
|
||||
List<KehamilanSekarangVO> vos) {
|
||||
if (null == vos)
|
||||
vos = new ArrayList<KehamilanSekarangVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (KehamilanSekarang KehamilanSekarang : models) {
|
||||
KehamilanSekarangVO vo = new KehamilanSekarangVO();
|
||||
vo = transferModelToVO(KehamilanSekarang, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public KehamilanSekarangVO transferModelToVO(KehamilanSekarang model, KehamilanSekarangVO vo) {
|
||||
|
||||
if (null == vo)
|
||||
vo = new KehamilanSekarangVO();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, KehamilanSekarangVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return vo;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -1,76 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.KelahiranYangLalu;
|
||||
import com.jasamedika.medifirst2000.vo.KelahiranYangLaluVO;
|
||||
|
||||
/**
|
||||
* Converter class between KelahiranYangLaluConverter
|
||||
*
|
||||
* @author Askur
|
||||
*/
|
||||
@Component
|
||||
public class KelahiranYangLaluConverter implements BaseVoConverter<KelahiranYangLaluVO, KelahiranYangLalu> {
|
||||
|
||||
|
||||
public KelahiranYangLalu transferVOToModel(KelahiranYangLaluVO vo, KelahiranYangLalu model) {
|
||||
if (null == model)
|
||||
model = new KelahiranYangLalu();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude,vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, KelahiranYangLalu.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return model;
|
||||
|
||||
}
|
||||
|
||||
public List<KelahiranYangLaluVO> transferListOfModelToListOfVO(List<KelahiranYangLalu> models,
|
||||
List<KelahiranYangLaluVO> vos) {
|
||||
if (null == vos)
|
||||
vos = new ArrayList<KelahiranYangLaluVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (KelahiranYangLalu KelahiranYangLalu : models) {
|
||||
KelahiranYangLaluVO vo = new KelahiranYangLaluVO();
|
||||
vo = transferModelToVO(KelahiranYangLalu, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public KelahiranYangLaluVO transferModelToVO(KelahiranYangLalu model, KelahiranYangLaluVO vo) {
|
||||
|
||||
if (null == vo)
|
||||
vo = new KelahiranYangLaluVO();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, KelahiranYangLaluVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return vo;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -1,76 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.KelainanDetail;
|
||||
import com.jasamedika.medifirst2000.vo.KelainanDetailVO;
|
||||
|
||||
/**
|
||||
* Converter class between KelainanDetailConverter
|
||||
*
|
||||
* @author Askur
|
||||
*/
|
||||
@Component
|
||||
public class KelainanDetailConverter implements BaseVoConverter<KelainanDetailVO, KelainanDetail> {
|
||||
|
||||
|
||||
public KelainanDetail transferVOToModel(KelainanDetailVO vo, KelainanDetail model) {
|
||||
if (null == model)
|
||||
model = new KelainanDetail();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude,vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, KelainanDetail.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return model;
|
||||
|
||||
}
|
||||
|
||||
public List<KelainanDetailVO> transferListOfModelToListOfVO(List<KelainanDetail> models,
|
||||
List<KelainanDetailVO> vos) {
|
||||
if (null == vos)
|
||||
vos = new ArrayList<KelainanDetailVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (KelainanDetail KelainanDetail : models) {
|
||||
KelainanDetailVO vo = new KelainanDetailVO();
|
||||
vo = transferModelToVO(KelainanDetail, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public KelainanDetailVO transferModelToVO(KelainanDetail model, KelainanDetailVO vo) {
|
||||
|
||||
if (null == vo)
|
||||
vo = new KelainanDetailVO();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, KelainanDetailVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return vo;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -1,79 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.Kelas;
|
||||
import com.jasamedika.medifirst2000.vo.KelasVO;
|
||||
|
||||
/**
|
||||
* Converter class between Pasien and PasienVO
|
||||
*
|
||||
* @author Askur
|
||||
*/
|
||||
@Component
|
||||
public class KelasConverter implements BaseVoConverter<KelasVO, Kelas> {
|
||||
|
||||
|
||||
@Override
|
||||
public Kelas transferVOToModel(KelasVO vo, Kelas model) {
|
||||
if (null == model)
|
||||
model = new Kelas();
|
||||
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude,vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, Kelas.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<KelasVO> transferListOfModelToListOfVO(List<Kelas> models, List<KelasVO> vos) {
|
||||
|
||||
if (null == vos)
|
||||
vos = new ArrayList<KelasVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (Kelas pegawai : models) {
|
||||
KelasVO vo = new KelasVO();
|
||||
vo=transferModelToVO(pegawai, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public KelasVO transferModelToVO(Kelas model, KelasVO vo) {
|
||||
if (null == vo)
|
||||
vo = new KelasVO();
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, KelasVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,72 +0,0 @@
|
||||
/*package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.modelmapper.ModelMapper;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.KelasM;
|
||||
import com.jasamedika.medifirst2000.entities.MapRuanganToKelasM;
|
||||
import com.jasamedika.medifirst2000.entities.RuanganM;
|
||||
import com.jasamedika.medifirst2000.util.ExtendedSpringBeanUtil;
|
||||
import com.jasamedika.medifirst2000.vo.KelasMVO;
|
||||
|
||||
*//**
|
||||
* Converter class between KelasM and KelasMVO
|
||||
*
|
||||
* @author Roberto
|
||||
*//*
|
||||
@Component
|
||||
public class KelasMConverter implements BaseVoConverter<KelasMVO, KelasM> {
|
||||
|
||||
private ModelMapper modelMapper = new ModelMapper();
|
||||
|
||||
public KelasM transferVOToModel(KelasMVO vo, KelasM model) {
|
||||
if (null == model)
|
||||
model = new KelasM();
|
||||
|
||||
// fix this
|
||||
//ExtendedSpringBeanUtil.copySpecificProperties(vo, model, new String[] {"id","nama", "alamat", }, new String[] { "id","nama", "alamat", });
|
||||
model = modelMapper.map(vo, KelasM.class);
|
||||
|
||||
return model;
|
||||
|
||||
}
|
||||
|
||||
public List<KelasMVO> transferListOfModelToListOfVO(List<KelasM> models,
|
||||
List<KelasMVO> vos) {
|
||||
if (null == vos)
|
||||
vos = new ArrayList<KelasMVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
RuanganM ruanganM=new RuanganM();
|
||||
ruanganM.setFaksimile("123");
|
||||
//ruanganM.setKodeExsternal("2211");
|
||||
// ruanganM.setNamaExternal("test");
|
||||
for (KelasM kelas : models) {
|
||||
KelasMVO vo = new KelasMVO();
|
||||
MapRuanganToKelasM m=new MapRuanganToKelasM();
|
||||
m.setKelasM(kelas);
|
||||
m.setRuanganM(ruanganM);
|
||||
vo = modelMapper.map(kelas, KelasMVO.class);
|
||||
vo.getMapRuanganToKelasMSet().add(m);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public KelasMVO transferModelToVO(KelasM model, KelasMVO vo) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
*/
|
||||
@ -1,71 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.dao.custom.base.impl.FindConverterDao;
|
||||
import com.jasamedika.medifirst2000.entities.KelompokEvaluasi;
|
||||
import com.jasamedika.medifirst2000.util.ExtendedSpringBeanUtil;
|
||||
import com.jasamedika.medifirst2000.vo.KelompokEvaluasiVO;
|
||||
|
||||
/**
|
||||
* Converter class between KelompokEvaluasi and KelompokEvaluasiVO
|
||||
*
|
||||
* @author Lukman Hakim
|
||||
*/
|
||||
@Component
|
||||
public class KelompokEvaluasiConverter extends FindConverterDao implements
|
||||
BaseVoConverter<KelompokEvaluasiVO, KelompokEvaluasi> {
|
||||
|
||||
public KelompokEvaluasi transferVOToModel(KelompokEvaluasiVO vo, KelompokEvaluasi model) {
|
||||
if (null == model)
|
||||
model = new KelompokEvaluasi();
|
||||
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude,vo.getClass().getName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, KelompokEvaluasi.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return model;
|
||||
|
||||
}
|
||||
|
||||
public List<KelompokEvaluasiVO> transferListOfModelToListOfVO(List<KelompokEvaluasi> models,
|
||||
List<KelompokEvaluasiVO> vos) {
|
||||
if (null == vos)
|
||||
vos = new ArrayList<KelompokEvaluasiVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (KelompokEvaluasi agama : models) {
|
||||
KelompokEvaluasiVO agamaVO = new KelompokEvaluasiVO();
|
||||
transferModelToVO(agama, agamaVO);
|
||||
vos.add(agamaVO);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
public KelompokEvaluasiVO transferModelToVO(KelompokEvaluasi model, KelompokEvaluasiVO vo) {
|
||||
if (null == vo)
|
||||
vo = new KelompokEvaluasiVO();
|
||||
|
||||
ExtendedSpringBeanUtil.copySpecificProperties(model, vo,
|
||||
new String[] { "KelompokEvaluasi", }, new String[] { "KelompokEvaluasi" });
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,76 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.KelompokPasien;
|
||||
import com.jasamedika.medifirst2000.vo.KelompokPasienVO;
|
||||
|
||||
@Component
|
||||
public class KelompokPasienConverter implements BaseVoConverter<KelompokPasienVO, KelompokPasien> {
|
||||
|
||||
|
||||
@Override
|
||||
public KelompokPasien transferVOToModel(KelompokPasienVO vo, KelompokPasien model) {
|
||||
if (null == model)
|
||||
model = new KelompokPasien();
|
||||
|
||||
try {
|
||||
String[] fieldsToInclude = null;
|
||||
Map<String, Object> serialized = vo.serialize(fieldsToInclude,vo.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
model = gson.fromJson(json, KelompokPasien.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<KelompokPasienVO> transferListOfModelToListOfVO(List<KelompokPasien> models, List<KelompokPasienVO> vos) {
|
||||
|
||||
if (null == vos)
|
||||
vos = new ArrayList<KelompokPasienVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (KelompokPasien kelompokPasien : models) {
|
||||
KelompokPasienVO vo = new KelompokPasienVO();
|
||||
vo=transferModelToVO(kelompokPasien, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public KelompokPasienVO transferModelToVO(KelompokPasien model, KelompokPasienVO vo) {
|
||||
if(model==null)
|
||||
return new KelompokPasienVO();
|
||||
if (null == vo)
|
||||
vo = new KelompokPasienVO();
|
||||
try {
|
||||
Map<String, Object> serialized = model.ToMap();
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, KelompokPasienVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user