userEntity.setUsername(jsonEntity.getString("username"));
userEntity.setEmail(jsonEntity.getString("email"));
userEntity.setPassword(jsonEntity.getString("password"));
if (newRecord) {
TransactionManager.manage(new Transactional(em) {
public void transact() {
em.persist(userEntity);
}
});
return Response.created(uriInfo.getAbsolutePath()).build();
} else {
TransactionManager.manage(new Transactional(em) {
public void transact() {
em.merge(userEntity);
}
});
return Response.noContent().build();