public JpaPortalPreference convert(PortalPreference source) {
return source instanceof JpaPortalPreference ? (JpaPortalPreference) source : createEntity(source);
}
private JpaPortalPreference createEntity(PortalPreference source) {
JpaPortalPreference converted = null;
if (source != null) {
TypedQuery<JpaPortalPreference> query = manager.createNamedQuery(JpaPortalPreference.GET_BY_KEY, JpaPortalPreference.class);
query.setParameter(JpaPortalPreference.PARAM_KEY, source.getKey());
converted = getSingleResult(query.getResultList());
if (converted == null) {
converted = new JpaPortalPreference();
}
updateProperties(source, converted);
}
return converted;
}