@Override protected RowMapper<StorageServerConnectionExtension> createEntityRowMapper() { return (rs, rowNum) -> { StorageServerConnectionExtension ssce = new StorageServerConnectionExtension(); ssce.setId(getGuidDefaultEmpty(rs, "id")); ssce.setHostId(getGuidDefaultEmpty(rs, "vds_id")); ssce.setIqn(rs.getString("iqn")); ssce.setUserName(rs.getString("user_name")); ssce.setPassword(DbFacadeUtils.decryptPassword(rs.getString("password"))); return ssce; }; } }
@Override protected StorageServerConnectionExtension generateNewEntity() { Guid newId = Guid.newGuid(); StorageServerConnectionExtension newssce = new StorageServerConnectionExtension(); newssce.setId(newId); fillWithRandomData(newssce); return newssce; }
protected static StorageServerConnectionExtension getEntity(Guid extensionID, Guid hostID, String pass, String username, String iqn) { StorageServerConnectionExtension extension = new StorageServerConnectionExtension(); extension.setId(extensionID); extension.setHostId(hostID); extension.setPassword(pass); extension.setUserName(username); extension.setIqn(iqn); return extension; }
@Mapping(from = StorageConnectionExtension.class, to = org.ovirt.engine.core.common.businessentities.storage.StorageServerConnectionExtension.class) public static StorageServerConnectionExtension map(StorageConnectionExtension restConnectionModel, StorageServerConnectionExtension template) { StorageServerConnectionExtension engineConnectionExt = template != null ? template : new StorageServerConnectionExtension(); if (restConnectionModel.isSetId()) { engineConnectionExt.setId(new Guid(restConnectionModel.getId())); } if (restConnectionModel.isSetHost() && restConnectionModel.getHost().isSetId()) { engineConnectionExt.setHostId(new Guid(restConnectionModel.getHost().getId())); } if (restConnectionModel.isSetTarget()) { engineConnectionExt.setIqn(restConnectionModel.getTarget()); } if (restConnectionModel.isSetUsername()) { engineConnectionExt.setUserName(restConnectionModel.getUsername()); } if (restConnectionModel.isSetPassword()) { engineConnectionExt.setPassword(restConnectionModel.getPassword()); } return engineConnectionExt; }