Update service layer
Clean code
This commit is contained in:
parent
7c74c553af
commit
8b0aac3ec7
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -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.KelompokTransaksi;
|
||||
import com.jasamedika.medifirst2000.vo.KelompokTransaksiVO;
|
||||
|
||||
/**
|
||||
* Converter class between KelompokTransaksi and KelompokTransaksiVO
|
||||
*
|
||||
* @author Askur
|
||||
*/
|
||||
@Component
|
||||
public class KelompokTransaksiConverter implements BaseVoConverter<KelompokTransaksiVO, KelompokTransaksi> {
|
||||
|
||||
|
||||
public KelompokTransaksi transferVOToModel(KelompokTransaksiVO vo, KelompokTransaksi model) {
|
||||
if (null == model)
|
||||
model = new KelompokTransaksi();
|
||||
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, KelompokTransaksi.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return model;
|
||||
|
||||
}
|
||||
|
||||
public List<KelompokTransaksiVO> transferListOfModelToListOfVO(List<KelompokTransaksi> models,
|
||||
List<KelompokTransaksiVO> vos) {
|
||||
if (null == vos)
|
||||
vos = new ArrayList<KelompokTransaksiVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (KelompokTransaksi KelompokTransaksi : models) {
|
||||
KelompokTransaksiVO vo = new KelompokTransaksiVO();
|
||||
vo = transferModelToVO(KelompokTransaksi, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public KelompokTransaksiVO transferModelToVO(KelompokTransaksi model, KelompokTransaksiVO vo) {
|
||||
|
||||
if (null == vo)
|
||||
vo = new KelompokTransaksiVO();
|
||||
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, KelompokTransaksiVO.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.KelompokUmur;
|
||||
import com.jasamedika.medifirst2000.vo.KelompokUmurVO;
|
||||
|
||||
/**
|
||||
* Converter class between Pasien and PasienVO
|
||||
*
|
||||
* @author Askur
|
||||
*/
|
||||
@Component
|
||||
public class KelompokUmurConverter implements BaseVoConverter<KelompokUmurVO, KelompokUmur> {
|
||||
|
||||
|
||||
@Override
|
||||
public KelompokUmur transferVOToModel(KelompokUmurVO vo, KelompokUmur model) {
|
||||
if (null == model)
|
||||
model = new KelompokUmur();
|
||||
|
||||
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, KelompokUmur.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<KelompokUmurVO> transferListOfModelToListOfVO(List<KelompokUmur> models, List<KelompokUmurVO> vos) {
|
||||
|
||||
if (null == vos)
|
||||
vos = new ArrayList<KelompokUmurVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (KelompokUmur pegawai : models) {
|
||||
KelompokUmurVO vo = new KelompokUmurVO();
|
||||
vo=transferModelToVO(pegawai, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public KelompokUmurVO transferModelToVO(KelompokUmur model, KelompokUmurVO vo) {
|
||||
if (null == vo)
|
||||
vo = new KelompokUmurVO();
|
||||
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, KelompokUmurVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,64 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.dao.custom.base.impl.FindConverterDao;
|
||||
import com.jasamedika.medifirst2000.entities.KelompokUser;
|
||||
import com.jasamedika.medifirst2000.util.ExtendedSpringBeanUtil;
|
||||
import com.jasamedika.medifirst2000.vo.KelompokUserVO;
|
||||
|
||||
/**
|
||||
* Converter class between KelompokUser and KelompokUserVO
|
||||
*
|
||||
* @author Roberto
|
||||
*/
|
||||
@Component
|
||||
public class KelompokUserConverter extends FindConverterDao implements
|
||||
BaseVoConverter<KelompokUserVO, KelompokUser> {
|
||||
|
||||
public KelompokUser transferVOToModel(KelompokUserVO vo, KelompokUser model) {
|
||||
if (null == model)
|
||||
model = new KelompokUser();
|
||||
|
||||
// fix this
|
||||
ExtendedSpringBeanUtil.copySpecificProperties(vo, model, new String[] {
|
||||
"id", "kelompokUser" }, new String[] { "id", "kelompokUser" });
|
||||
|
||||
return model;
|
||||
|
||||
}
|
||||
|
||||
public List<KelompokUserVO> transferListOfModelToListOfVO(
|
||||
List<KelompokUser> models, List<KelompokUserVO> vos) {
|
||||
if (null == vos)
|
||||
vos = new ArrayList<KelompokUserVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (KelompokUser kelUser : models) {
|
||||
KelompokUserVO kelompokUserVO = new KelompokUserVO();
|
||||
transferModelToVO(kelUser, kelompokUserVO);
|
||||
vos.add(kelompokUserVO);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
public KelompokUserVO transferModelToVO(KelompokUser model,
|
||||
KelompokUserVO vo) {
|
||||
if (null == vo)
|
||||
vo = new KelompokUserVO();
|
||||
|
||||
// fix this
|
||||
ExtendedSpringBeanUtil.copySpecificProperties(model, vo, new String[] {
|
||||
"id", "kelompokUser" }, new String[] { "id", "kelompokUser" });
|
||||
|
||||
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.KeluargaPegawai;
|
||||
import com.jasamedika.medifirst2000.vo.KeluargaPegawaiVO;
|
||||
//import com.jasamedika.medifirst2000.entities.PasienPenyakit;
|
||||
|
||||
/**
|
||||
* Converter class between KeluargaPegawaiVO and KeluargaPegawai
|
||||
*
|
||||
* @author Lukman Hakim (lukman.uki@gmail.com)
|
||||
* @DateCreated 01 Februari 2017
|
||||
*/
|
||||
@Component
|
||||
public class KeluargaPegawaiConverter implements BaseVoConverter<KeluargaPegawaiVO, KeluargaPegawai> {
|
||||
|
||||
public KeluargaPegawai transferVOToModel(KeluargaPegawaiVO vo, KeluargaPegawai model) {
|
||||
if (null == model)
|
||||
model = new KeluargaPegawai();
|
||||
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, KeluargaPegawai.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return model;
|
||||
|
||||
}
|
||||
|
||||
public List<KeluargaPegawaiVO> transferListOfModelToListOfVO(List<KeluargaPegawai> models,
|
||||
List<KeluargaPegawaiVO> vos) {
|
||||
if (null == vos)
|
||||
vos = new ArrayList<KeluargaPegawaiVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (KeluargaPegawai KonsepDiri : models) {
|
||||
KeluargaPegawaiVO vo = new KeluargaPegawaiVO();
|
||||
vo = transferModelToVO(KonsepDiri, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public KeluargaPegawaiVO transferModelToVO(KeluargaPegawai model, KeluargaPegawaiVO vo) {
|
||||
|
||||
if (null == vo)
|
||||
vo = new KeluargaPegawaiVO();
|
||||
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, KeluargaPegawaiVO.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.KemungkinanResikoTerjadi;
|
||||
import com.jasamedika.medifirst2000.vo.KemungkinanResikoTerjadiVO;
|
||||
|
||||
@Component
|
||||
public class KemungkinanResikoTerjadiConverter implements BaseVoConverter<KemungkinanResikoTerjadiVO, KemungkinanResikoTerjadi>{
|
||||
|
||||
@Override
|
||||
public KemungkinanResikoTerjadi transferVOToModel(KemungkinanResikoTerjadiVO vo, KemungkinanResikoTerjadi model) {
|
||||
if (null == model)
|
||||
model = new KemungkinanResikoTerjadi();
|
||||
|
||||
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, KemungkinanResikoTerjadi.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<KemungkinanResikoTerjadiVO> transferListOfModelToListOfVO(List<KemungkinanResikoTerjadi> models, List<KemungkinanResikoTerjadiVO> vos) {
|
||||
|
||||
if (null == vos)
|
||||
vos = new ArrayList<KemungkinanResikoTerjadiVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (KemungkinanResikoTerjadi pegawai : models) {
|
||||
KemungkinanResikoTerjadiVO vo = new KemungkinanResikoTerjadiVO();
|
||||
vo=transferModelToVO(pegawai, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public KemungkinanResikoTerjadiVO transferModelToVO(KemungkinanResikoTerjadi model, KemungkinanResikoTerjadiVO vo) {
|
||||
if (null == vo)
|
||||
vo = new KemungkinanResikoTerjadiVO();
|
||||
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, KemungkinanResikoTerjadiVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
public KemungkinanResikoTerjadiVO transferModelToVOCustom(KemungkinanResikoTerjadi model, KemungkinanResikoTerjadiVO vo,String[] fieldsToInclude) {
|
||||
if (null == vo)
|
||||
|
||||
vo = new KemungkinanResikoTerjadiVO();
|
||||
|
||||
try {
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, KemungkinanResikoTerjadiVO.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.KomponenEvaluasi;
|
||||
import com.jasamedika.medifirst2000.util.ExtendedSpringBeanUtil;
|
||||
import com.jasamedika.medifirst2000.vo.KomponenEvaluasiVO;
|
||||
|
||||
/**
|
||||
* Converter class between KomponenEvaluasi and KomponenEvaluasiVO
|
||||
*
|
||||
* @author Lukman Hakim
|
||||
*/
|
||||
@Component
|
||||
public class KomponenEvaluasiConverter extends FindConverterDao implements
|
||||
BaseVoConverter<KomponenEvaluasiVO, KomponenEvaluasi> {
|
||||
|
||||
public KomponenEvaluasi transferVOToModel(KomponenEvaluasiVO vo, KomponenEvaluasi model) {
|
||||
if (null == model)
|
||||
model = new KomponenEvaluasi();
|
||||
|
||||
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, KomponenEvaluasi.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return model;
|
||||
|
||||
}
|
||||
|
||||
public List<KomponenEvaluasiVO> transferListOfModelToListOfVO(List<KomponenEvaluasi> models,
|
||||
List<KomponenEvaluasiVO> vos) {
|
||||
if (null == vos)
|
||||
vos = new ArrayList<KomponenEvaluasiVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (KomponenEvaluasi agama : models) {
|
||||
KomponenEvaluasiVO agamaVO = new KomponenEvaluasiVO();
|
||||
transferModelToVO(agama, agamaVO);
|
||||
vos.add(agamaVO);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
public KomponenEvaluasiVO transferModelToVO(KomponenEvaluasi model, KomponenEvaluasiVO vo) {
|
||||
if (null == vo)
|
||||
vo = new KomponenEvaluasiVO();
|
||||
|
||||
// fix this
|
||||
ExtendedSpringBeanUtil.copySpecificProperties(model, vo,
|
||||
new String[] { "KomponenEvaluasi", }, new String[] { "KomponenEvaluasi" });
|
||||
|
||||
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.KondisiPasien;
|
||||
import com.jasamedika.medifirst2000.vo.KondisiPasienVO;
|
||||
|
||||
@Component
|
||||
public class KondisiPasienConverter implements BaseVoConverter<KondisiPasienVO, KondisiPasien> {
|
||||
|
||||
|
||||
@Override
|
||||
public KondisiPasien transferVOToModel(KondisiPasienVO vo, KondisiPasien model) {
|
||||
if (null == model)
|
||||
model = new KondisiPasien();
|
||||
|
||||
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, KondisiPasien.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<KondisiPasienVO> transferListOfModelToListOfVO(List<KondisiPasien> models, List<KondisiPasienVO> vos) {
|
||||
|
||||
if (null == vos)
|
||||
vos = new ArrayList<KondisiPasienVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (KondisiPasien kondisiPasien : models) {
|
||||
KondisiPasienVO vo = new KondisiPasienVO();
|
||||
vo=transferModelToVO(kondisiPasien, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public KondisiPasienVO transferModelToVO(KondisiPasien model, KondisiPasienVO vo) {
|
||||
if (null == vo)
|
||||
vo = new KondisiPasienVO();
|
||||
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, KondisiPasienVO.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.KonsepDiri;
|
||||
import com.jasamedika.medifirst2000.vo.KonsepDiriVO;
|
||||
|
||||
/**
|
||||
* Converter class between KonsepDiri and KonsepDiriVO
|
||||
*
|
||||
* @author Askur
|
||||
*/
|
||||
@Component
|
||||
public class KonsepDiriConverter implements BaseVoConverter<KonsepDiriVO, KonsepDiri> {
|
||||
|
||||
|
||||
public KonsepDiri transferVOToModel(KonsepDiriVO vo, KonsepDiri model) {
|
||||
if (null == model)
|
||||
model = new KonsepDiri();
|
||||
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, KonsepDiri.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return model;
|
||||
|
||||
}
|
||||
|
||||
public List<KonsepDiriVO> transferListOfModelToListOfVO(List<KonsepDiri> models,
|
||||
List<KonsepDiriVO> vos) {
|
||||
if (null == vos)
|
||||
vos = new ArrayList<KonsepDiriVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (KonsepDiri KonsepDiri : models) {
|
||||
KonsepDiriVO vo = new KonsepDiriVO();
|
||||
vo = transferModelToVO(KonsepDiri, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public KonsepDiriVO transferModelToVO(KonsepDiri model, KonsepDiriVO vo) {
|
||||
|
||||
if (null == vo)
|
||||
vo = new KonsepDiriVO();
|
||||
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, KonsepDiriVO.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.Konsultasi;
|
||||
import com.jasamedika.medifirst2000.vo.KonsultasiVO;
|
||||
|
||||
/**
|
||||
* Converter class between Konsultasi and KonsultasiVO
|
||||
*
|
||||
* @author Askur
|
||||
*/
|
||||
@Component
|
||||
public class KonsultasiConverter implements BaseVoConverter<KonsultasiVO, Konsultasi> {
|
||||
|
||||
|
||||
public Konsultasi transferVOToModel(KonsultasiVO vo, Konsultasi model) {
|
||||
if (null == model)
|
||||
model = new Konsultasi();
|
||||
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, Konsultasi.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return model;
|
||||
|
||||
}
|
||||
|
||||
public List<KonsultasiVO> transferListOfModelToListOfVO(List<Konsultasi> models,
|
||||
List<KonsultasiVO> vos) {
|
||||
if (null == vos)
|
||||
vos = new ArrayList<KonsultasiVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (Konsultasi Konsultasi : models) {
|
||||
KonsultasiVO vo = new KonsultasiVO();
|
||||
vo = transferModelToVO(Konsultasi, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public KonsultasiVO transferModelToVO(Konsultasi model, KonsultasiVO vo) {
|
||||
|
||||
if (null == vo)
|
||||
vo = new KonsultasiVO();
|
||||
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, KonsultasiVO.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.KontrakKinerja;
|
||||
import com.jasamedika.medifirst2000.vo.KontrakKinerjaVO;
|
||||
|
||||
@Component
|
||||
public class KontrakKinerjaConverter implements BaseVoConverter<KontrakKinerjaVO, KontrakKinerja>{
|
||||
|
||||
@Override
|
||||
public KontrakKinerja transferVOToModel(KontrakKinerjaVO vo, KontrakKinerja model) {
|
||||
if (null == model)
|
||||
model = new KontrakKinerja();
|
||||
|
||||
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, KontrakKinerja.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<KontrakKinerjaVO> transferListOfModelToListOfVO(List<KontrakKinerja> models, List<KontrakKinerjaVO> vos) {
|
||||
|
||||
if (null == vos)
|
||||
vos = new ArrayList<KontrakKinerjaVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (KontrakKinerja pegawai : models) {
|
||||
KontrakKinerjaVO vo = new KontrakKinerjaVO();
|
||||
vo=transferModelToVO(pegawai, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public KontrakKinerjaVO transferModelToVO(KontrakKinerja model, KontrakKinerjaVO vo) {
|
||||
if (null == vo)
|
||||
vo = new KontrakKinerjaVO();
|
||||
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, KontrakKinerjaVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
public KontrakKinerjaVO transferModelToVOCustom(KontrakKinerja model, KontrakKinerjaVO vo,String[] fieldsToInclude) {
|
||||
if (null == vo)
|
||||
|
||||
vo = new KontrakKinerjaVO();
|
||||
|
||||
try {
|
||||
Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, KontrakKinerjaVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
}
|
||||
@ -1,104 +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.KonversiSatuan;
|
||||
import com.jasamedika.medifirst2000.vo.KonversiSatuanVO;
|
||||
|
||||
@Component
|
||||
public class KonversiSatuanConverter implements BaseVoConverter<KonversiSatuanVO, KonversiSatuan> {
|
||||
|
||||
@Override
|
||||
public KonversiSatuan transferVOToModel(KonversiSatuanVO vo, KonversiSatuan model) {
|
||||
if (model == null) {
|
||||
model = new KonversiSatuan();
|
||||
}
|
||||
|
||||
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, KonversiSatuan.class);
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<KonversiSatuanVO> transferListOfModelToListOfVO(List<KonversiSatuan> models,
|
||||
List<KonversiSatuanVO> vos) {
|
||||
|
||||
if (vos == null) {
|
||||
vos = new ArrayList<>();
|
||||
}
|
||||
|
||||
if (models == null) {
|
||||
return vos;
|
||||
}
|
||||
|
||||
for (KonversiSatuan model : models) {
|
||||
KonversiSatuanVO vo = new KonversiSatuanVO();
|
||||
vo = transferModelToVO(model, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public KonversiSatuanVO transferModelToVO(KonversiSatuan model, KonversiSatuanVO vo) {
|
||||
if (null == vo)
|
||||
vo = new KonversiSatuanVO();
|
||||
|
||||
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, KonversiSatuanVO.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.Koping;
|
||||
import com.jasamedika.medifirst2000.vo.KopingVO;
|
||||
|
||||
/**
|
||||
* Converter class between Koping and KopingVO
|
||||
*
|
||||
* @author Askur
|
||||
*/
|
||||
@Component
|
||||
public class KopingConverter implements BaseVoConverter<KopingVO, Koping> {
|
||||
|
||||
|
||||
public Koping transferVOToModel(KopingVO vo, Koping model) {
|
||||
if (null == model)
|
||||
model = new Koping();
|
||||
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, Koping.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return model;
|
||||
|
||||
}
|
||||
|
||||
public List<KopingVO> transferListOfModelToListOfVO(List<Koping> models,
|
||||
List<KopingVO> vos) {
|
||||
if (null == vos)
|
||||
vos = new ArrayList<KopingVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (Koping Koping : models) {
|
||||
KopingVO vo = new KopingVO();
|
||||
vo = transferModelToVO(Koping, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public KopingVO transferModelToVO(Koping model, KopingVO vo) {
|
||||
|
||||
if (null == vo)
|
||||
vo = new KopingVO();
|
||||
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, KopingVO.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.KotaKabupaten;
|
||||
import com.jasamedika.medifirst2000.vo.KotaKabupatenVO;
|
||||
|
||||
/**
|
||||
* Converter class between KotaKabupaten and KotaKabupatenVO
|
||||
*
|
||||
* @author Askur
|
||||
*/
|
||||
@Component
|
||||
public class KotaKabupatenConverter implements BaseVoConverter<KotaKabupatenVO, KotaKabupaten> {
|
||||
|
||||
|
||||
public KotaKabupaten transferVOToModel(KotaKabupatenVO vo, KotaKabupaten model) {
|
||||
if (null == model)
|
||||
model = new KotaKabupaten();
|
||||
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, KotaKabupaten.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return model;
|
||||
|
||||
}
|
||||
|
||||
public List<KotaKabupatenVO> transferListOfModelToListOfVO(List<KotaKabupaten> models,
|
||||
List<KotaKabupatenVO> vos) {
|
||||
if (null == vos)
|
||||
vos = new ArrayList<KotaKabupatenVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (KotaKabupaten KotaKabupaten : models) {
|
||||
KotaKabupatenVO vo = new KotaKabupatenVO();
|
||||
vo = transferModelToVO(KotaKabupaten, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public KotaKabupatenVO transferModelToVO(KotaKabupaten model, KotaKabupatenVO vo) {
|
||||
|
||||
if (null == vo)
|
||||
vo = new KotaKabupatenVO();
|
||||
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, KotaKabupatenVO.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.LembarKonsultasi;
|
||||
import com.jasamedika.medifirst2000.vo.LembarKonsultasiVO;
|
||||
|
||||
@Component
|
||||
public class LembarKonsultasiConverter implements BaseVoConverter<LembarKonsultasiVO, LembarKonsultasi> {
|
||||
|
||||
@Override
|
||||
public LembarKonsultasi transferVOToModel(LembarKonsultasiVO vo, LembarKonsultasi model) {
|
||||
if (null == model)
|
||||
model = new LembarKonsultasi();
|
||||
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, LembarKonsultasi.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LembarKonsultasiVO> transferListOfModelToListOfVO(List<LembarKonsultasi> models,
|
||||
List<LembarKonsultasiVO> vos) {
|
||||
if (null == vos)
|
||||
vos = new ArrayList<LembarKonsultasiVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (LembarKonsultasi lembarKonsultasi : models) {
|
||||
LembarKonsultasiVO vo = new LembarKonsultasiVO();
|
||||
vo=transferModelToVO(lembarKonsultasi, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LembarKonsultasiVO transferModelToVO(LembarKonsultasi model, LembarKonsultasiVO vo) {
|
||||
if (null == vo)
|
||||
vo = new LembarKonsultasiVO();
|
||||
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, LembarKonsultasiVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,73 +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.ListTanggalCuti;
|
||||
import com.jasamedika.medifirst2000.vo.ListTanggalCutiVO;
|
||||
|
||||
/**
|
||||
* Converter class between Jabatan and JabatanVO
|
||||
*
|
||||
* @author salmanoe
|
||||
*/
|
||||
@Component
|
||||
public class ListTanggalCutiConverter implements BaseVoConverter<ListTanggalCutiVO, ListTanggalCuti> {
|
||||
|
||||
@Override
|
||||
public ListTanggalCuti transferVOToModel(ListTanggalCutiVO vo, ListTanggalCuti model) {
|
||||
if (null == model)
|
||||
model = new ListTanggalCuti();
|
||||
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, ListTanggalCuti.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ListTanggalCutiVO> transferListOfModelToListOfVO(List<ListTanggalCuti> models,
|
||||
List<ListTanggalCutiVO> vos) {
|
||||
if (null == vos)
|
||||
vos = new ArrayList<ListTanggalCutiVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (ListTanggalCuti listTanggalCuti : models) {
|
||||
ListTanggalCutiVO vo = new ListTanggalCutiVO();
|
||||
vo = transferModelToVO(listTanggalCuti, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ListTanggalCutiVO transferModelToVO(ListTanggalCuti model, ListTanggalCutiVO vo) {
|
||||
if (null == vo)
|
||||
vo = new ListTanggalCutiVO();
|
||||
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, ListTanggalCutiVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,117 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.dao.custom.base.impl.FindConverterDao;
|
||||
import com.jasamedika.medifirst2000.entities.KelompokUser;
|
||||
import com.jasamedika.medifirst2000.entities.LoginUser;
|
||||
import com.jasamedika.medifirst2000.service.KelompokUserService;
|
||||
import com.jasamedika.medifirst2000.service.PegawaiService;
|
||||
import com.jasamedika.medifirst2000.util.ExtendedSpringBeanUtil;
|
||||
import com.jasamedika.medifirst2000.vo.KelompokUserVO;
|
||||
import com.jasamedika.medifirst2000.vo.LoginUserVO;
|
||||
import com.jasamedika.medifirst2000.vo.PegawaiVO;
|
||||
|
||||
/**
|
||||
* Converter class between LoginUser and LoginUserVO
|
||||
*
|
||||
* @author Roberto
|
||||
*/
|
||||
@Component
|
||||
public class LoginUserAuthConverter extends FindConverterDao implements BaseVoConverter<LoginUserVO, LoginUser> {
|
||||
/*
|
||||
* @Override public LoginUser transferVOToModel(LoginUserVO vo, LoginUser
|
||||
* model) { if (null == model) model = new LoginUser();
|
||||
*
|
||||
* 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, LoginUser.class); } catch (Exception e) {
|
||||
* e.printStackTrace(); }
|
||||
*
|
||||
* return model; }
|
||||
*
|
||||
* @Override public List<LoginUserVO>
|
||||
* transferListOfModelToListOfVO(List<LoginUser> models, List<LoginUserVO>
|
||||
* vos) { if (null == vos) vos = new ArrayList<LoginUserVO>();
|
||||
*
|
||||
* if (null == models) return vos;
|
||||
*
|
||||
* for (LoginUser loginUser : models) { LoginUserVO vo = new LoginUserVO();
|
||||
* vo=transferModelToVO(loginUser, vo); vos.add(vo); }
|
||||
*
|
||||
* return vos; }
|
||||
*
|
||||
* @Override public LoginUserVO transferModelToVO(LoginUser model,
|
||||
* LoginUserVO vo) { if (null == vo) vo = new LoginUserVO(); 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,
|
||||
* LoginUserVO.class); } catch (Exception e) { e.printStackTrace(); }
|
||||
*
|
||||
* return vo; }
|
||||
*/
|
||||
|
||||
public LoginUser transferVOToModel(LoginUserVO vo, LoginUser model) {
|
||||
if (null == model)
|
||||
model = new LoginUser();
|
||||
|
||||
// fix this
|
||||
ExtendedSpringBeanUtil.copySpecificProperties(vo, model, new String[] { "id", "kataSandi", "namaUser", },
|
||||
new String[] { "id", "kataSandi", "namaUser", });
|
||||
if (vo.getKelompokUser() != null) {
|
||||
KelompokUser kelompokUser = (KelompokUser) findObjectById(KelompokUser.class, vo.getKelompokUser().getId());
|
||||
model.setKelompokUser(kelompokUser);
|
||||
}
|
||||
return model;
|
||||
|
||||
}
|
||||
|
||||
public List<LoginUserVO> transferListOfModelToListOfVO(List<LoginUser> models, List<LoginUserVO> vos) {
|
||||
if (null == vos)
|
||||
vos = new ArrayList<LoginUserVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (LoginUser loginUser : models) {
|
||||
LoginUserVO loginUserVO = new LoginUserVO();
|
||||
transferModelToVO(loginUser, loginUserVO);
|
||||
vos.add(loginUserVO);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
public LoginUserVO transferModelToVO(LoginUser model, LoginUserVO vo) {
|
||||
if (null == vo)
|
||||
|
||||
vo = new LoginUserVO();
|
||||
|
||||
// fix this
|
||||
ExtendedSpringBeanUtil.copySpecificProperties(model, vo, new String[] { "id", "kataSandi", "namaUser", },
|
||||
new String[] { "id", "kataSandi", "namaUser", });
|
||||
|
||||
if (model.getKelompokUser() != null) {
|
||||
KelompokUserVO kelompokUserVo = kelompokUserService.findById(model.getKelompokUser().getId());
|
||||
vo.setKelompokUser(kelompokUserVo);
|
||||
}
|
||||
if (model.getPegawai() != null) {
|
||||
PegawaiVO kelompokUserVo = pgawaiService.findById(model.getPegawai().getId());
|
||||
vo.setPegawai(kelompokUserVo);
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private KelompokUserService kelompokUserService;
|
||||
@Autowired
|
||||
private PegawaiService pgawaiService;
|
||||
}
|
||||
@ -1,85 +0,0 @@
|
||||
package com.jasamedika.medifirst2000.converter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.beans.BeanUtils;
|
||||
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.LoginUser;
|
||||
import com.jasamedika.medifirst2000.vo.LoginUserVO;
|
||||
|
||||
/**
|
||||
* Converter class between LoginUser and LoginUserVO
|
||||
*
|
||||
* @author Roberto
|
||||
*/
|
||||
@Component
|
||||
public class LoginUserConverter extends FindConverterDao implements
|
||||
BaseVoConverter<LoginUserVO, LoginUser> {
|
||||
|
||||
@Override
|
||||
public LoginUser transferVOToModel(LoginUserVO vo, LoginUser model) {
|
||||
if (null == model)
|
||||
model = new LoginUser();
|
||||
|
||||
// BeanUtils.copyProperties(vo, model);
|
||||
|
||||
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, LoginUser.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LoginUserVO> transferListOfModelToListOfVO(List<LoginUser> models, List<LoginUserVO> vos) {
|
||||
if (null == vos)
|
||||
vos = new ArrayList<LoginUserVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (LoginUser loginUser : models) {
|
||||
LoginUserVO vo = new LoginUserVO();
|
||||
vo=transferModelToVO(loginUser, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LoginUserVO transferModelToVO(LoginUser model, LoginUserVO vo) {
|
||||
if (null == vo)
|
||||
vo = new LoginUserVO();
|
||||
|
||||
BeanUtils.copyProperties(model, vo);
|
||||
|
||||
// try {
|
||||
// String[] fieldsToInclude = null;
|
||||
// //Alter Syamsu
|
||||
// //Map<String, Object> serialized = model.serialize(fieldsToInclude,model.getClass().getSimpleName());
|
||||
// Map<String, Object> serialized = model.ToMap();
|
||||
// Gson gson = new Gson();
|
||||
//
|
||||
// String json = gson.toJson(serialized);
|
||||
// vo = gson.fromJson(json, LoginUserVO.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.Lokasi;
|
||||
import com.jasamedika.medifirst2000.vo.LokasiVO;
|
||||
|
||||
/**
|
||||
* Converter class between Pasien and PasienVO
|
||||
*
|
||||
* @author Askur
|
||||
*/
|
||||
@Component
|
||||
public class LokasiConverter implements BaseVoConverter<LokasiVO, Lokasi> {
|
||||
|
||||
|
||||
@Override
|
||||
public Lokasi transferVOToModel(LokasiVO vo, Lokasi model) {
|
||||
if (null == model)
|
||||
model = new Lokasi();
|
||||
|
||||
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, Lokasi.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LokasiVO> transferListOfModelToListOfVO(List<Lokasi> models, List<LokasiVO> vos) {
|
||||
|
||||
if (null == vos)
|
||||
vos = new ArrayList<LokasiVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (Lokasi pegawai : models) {
|
||||
LokasiVO vo = new LokasiVO();
|
||||
vo=transferModelToVO(pegawai, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LokasiVO transferModelToVO(Lokasi model, LokasiVO vo) {
|
||||
if (null == vo)
|
||||
vo = new LokasiVO();
|
||||
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, LokasiVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,108 +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.Pegawai;
|
||||
import com.jasamedika.medifirst2000.vo.PegawaiJabatanVO;
|
||||
|
||||
@Component
|
||||
public class MapPegawaiJabatanToUnitKerjaConverter implements BaseVoConverter<PegawaiJabatanVO, Pegawai> {
|
||||
|
||||
@Override
|
||||
public Pegawai transferVOToModel(PegawaiJabatanVO vo, Pegawai model) {
|
||||
if (null == model)
|
||||
model = new Pegawai();
|
||||
|
||||
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, Pegawai.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PegawaiJabatanVO> transferListOfModelToListOfVO(List<Pegawai> models, List<PegawaiJabatanVO> vos) {
|
||||
if (null == vos)
|
||||
vos = new ArrayList<PegawaiJabatanVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (Pegawai pegawai : models) {
|
||||
PegawaiJabatanVO vo = new PegawaiJabatanVO();
|
||||
vo = transferModelToVO(pegawai, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PegawaiJabatanVO transferModelToVO(Pegawai model, PegawaiJabatanVO vo) {
|
||||
if (null == vo)
|
||||
vo = new PegawaiJabatanVO();
|
||||
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.ToMap();
|
||||
Gson gson = new Gson();
|
||||
// serialized.put("jenisPegawai", model.getJenisPegawai());
|
||||
// serialized.put("pegawai", model.getId());
|
||||
// serialized.put("jabatanInternal", model.getJabatanInternal());
|
||||
// serialized.put("unitKerja", model.getUnitKerja());
|
||||
serialized.put("unitKerjaPegawai", model.getUnitKerja().getUnitKerja());
|
||||
serialized.put("isCanCreateJadwal",
|
||||
model.getJabatanInternal().getNamaJabatan().contains("Kepala") ? true : false);
|
||||
serialized.put("isPrimary", true);
|
||||
serialized.put("statusEnabled1", true);
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, PegawaiJabatanVO.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,55 +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.MapPegawaiToModulAplikasi;
|
||||
import com.jasamedika.medifirst2000.vo.MapPegawaiToModulAplikasiVO;
|
||||
|
||||
@Component
|
||||
public class MapPegawaiToModulAplikasiConverter implements BaseVoConverter<MapPegawaiToModulAplikasiVO, MapPegawaiToModulAplikasi> {
|
||||
|
||||
@Override
|
||||
public MapPegawaiToModulAplikasi transferVOToModel(MapPegawaiToModulAplikasiVO vo, MapPegawaiToModulAplikasi model) {
|
||||
if (null == model)
|
||||
model = new MapPegawaiToModulAplikasi();
|
||||
|
||||
BeanUtils.copyProperties(vo, model);
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MapPegawaiToModulAplikasiVO> transferListOfModelToListOfVO(List<MapPegawaiToModulAplikasi> models, List<MapPegawaiToModulAplikasiVO> vos) {
|
||||
|
||||
if (null == vos)
|
||||
vos = new ArrayList<MapPegawaiToModulAplikasiVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (MapPegawaiToModulAplikasi mapPegawaiToModulAplikasi : models) {
|
||||
MapPegawaiToModulAplikasiVO vo = new MapPegawaiToModulAplikasiVO();
|
||||
vo=transferModelToVO(mapPegawaiToModulAplikasi, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MapPegawaiToModulAplikasiVO transferModelToVO(MapPegawaiToModulAplikasi model, MapPegawaiToModulAplikasiVO vo) {
|
||||
if (null == vo)
|
||||
vo = new MapPegawaiToModulAplikasiVO();
|
||||
|
||||
BeanUtils.copyProperties(model, vo);
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,100 +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.base.BaseModel;
|
||||
import com.jasamedika.medifirst2000.converter.base.BaseVoConverter;
|
||||
import com.jasamedika.medifirst2000.entities.MapRuanganToAkomodasi;
|
||||
import com.jasamedika.medifirst2000.vo.MapRuanganToAkomodasiVO;
|
||||
|
||||
@Component
|
||||
public class MapRuanganToAkomodasiConverter implements BaseVoConverter<MapRuanganToAkomodasiVO, MapRuanganToAkomodasi> {
|
||||
|
||||
@Override
|
||||
public MapRuanganToAkomodasi transferVOToModel(MapRuanganToAkomodasiVO vo, MapRuanganToAkomodasi model) {
|
||||
if (null == model)
|
||||
model = new MapRuanganToAkomodasi();
|
||||
|
||||
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, MapRuanganToAkomodasi.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MapRuanganToAkomodasiVO> transferListOfModelToListOfVO(List<MapRuanganToAkomodasi> models,
|
||||
List<MapRuanganToAkomodasiVO> vos) {
|
||||
if (null == vos)
|
||||
vos = new ArrayList<MapRuanganToAkomodasiVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (MapRuanganToAkomodasi mak : models) {
|
||||
MapRuanganToAkomodasiVO vo = new MapRuanganToAkomodasiVO();
|
||||
vo=transferModelToVO(mak, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MapRuanganToAkomodasiVO transferModelToVO(MapRuanganToAkomodasi model, MapRuanganToAkomodasiVO vo) {
|
||||
if (null == vo)
|
||||
vo = new MapRuanganToAkomodasiVO();
|
||||
try {
|
||||
|
||||
List<String> fieldsToInclude = new ArrayList<String>();
|
||||
for (Field field : BaseModel.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.ToMap();
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(serialized);
|
||||
vo = gson.fromJson(json, MapRuanganToAkomodasiVO.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.MapRuanganToKelas;
|
||||
|
||||
import com.jasamedika.medifirst2000.vo.MapRuanganToKelasVO;
|
||||
|
||||
@Component
|
||||
public class MapRuanganToKelasConverter implements BaseVoConverter<MapRuanganToKelasVO, MapRuanganToKelas> {
|
||||
|
||||
|
||||
@Override
|
||||
public MapRuanganToKelas transferVOToModel(MapRuanganToKelasVO vo, MapRuanganToKelas model) {
|
||||
if (null == model)
|
||||
model = new MapRuanganToKelas();
|
||||
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, MapRuanganToKelas.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MapRuanganToKelasVO> transferListOfModelToListOfVO(List<MapRuanganToKelas> models, List<MapRuanganToKelasVO> vos) {
|
||||
|
||||
if (null == vos)
|
||||
vos = new ArrayList<MapRuanganToKelasVO>();
|
||||
|
||||
if (null == models)
|
||||
return vos;
|
||||
|
||||
for (MapRuanganToKelas mapRuanganToKelas : models) {
|
||||
MapRuanganToKelasVO vo = new MapRuanganToKelasVO();
|
||||
vo=transferModelToVO(mapRuanganToKelas, vo);
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MapRuanganToKelasVO transferModelToVO(MapRuanganToKelas model, MapRuanganToKelasVO vo) {
|
||||
if (null == vo)
|
||||
vo = new MapRuanganToKelasVO();
|
||||
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, MapRuanganToKelasVO.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