@Override public ApplicationEntity apply(ResultSet resultSet) throws SQLException { ApplicationDesc applicationDesc = new ApplicationDesc(); String appType = resultSet.getString(4); applicationDesc.setType(appType); SiteEntity siteEntity = new SiteEntity(); siteEntity.setUuid(resultSet.getString(12)); siteEntity.setSiteId(resultSet.getString(13)); siteEntity.setSiteName(resultSet.getString(14)); siteEntity.setDescription(resultSet.getString(15)); siteEntity.setCreatedTime(resultSet.getLong(16)); siteEntity.setModifiedTime(resultSet.getLong(17)); ApplicationEntity resultEntity = new ApplicationEntity(); resultEntity.setUuid(resultSet.getString(1)); resultEntity.setAppId(resultSet.getString(2)); resultEntity.setSite(siteEntity); resultEntity.setDescriptor(applicationDesc); resultEntity.setMode(ApplicationEntity.Mode.valueOf(resultSet.getString(5))); resultEntity.setJarPath(resultSet.getString(6)); resultEntity.setStatus(ApplicationEntity.Status.valueOf(resultSet.getString(7))); resultEntity.setConfiguration(parse(resultSet.getString(8))); resultEntity.setContext(parse(resultSet.getString(9))); resultEntity.setCreatedTime(resultSet.getLong(10)); resultEntity.setModifiedTime(resultSet.getLong(11)); return resultEntity; }
@POST @Path("/{appUuid}") @Produces(MediaType.APPLICATION_JSON) public RESTResponse<ApplicationEntity> updateApplicationEntity(@PathParam("appUuid") String appUuid, ApplicationOperations.UpdateOperation updateOperation) { return RESTResponse.async(() -> { ApplicationEntity applicationEntity = new ApplicationEntity(); applicationEntity.setStatus(entityService.getByUUID(appUuid).getStatus()); applicationEntity.setUuid(appUuid); applicationEntity.setJarPath(updateOperation.getJarPath()); applicationEntity.setMode(updateOperation.getMode()); applicationEntity.setConfiguration(updateOperation.getConfiguration()); return entityService.update(applicationEntity); }).get(); }
/** * Update mutable fields from another ApplicationEntity. */ public void updateMutable(ApplicationEntity entityToUpdate) { this.ensureDefault(); this.setJarPath(entityToUpdate.getJarPath()); this.setMode(entityToUpdate.getMode()); this.setConfiguration(entityToUpdate.getConfiguration()); }
applicationEntity.setSite(siteEntity); applicationEntity.setMode(operation.getMode()); applicationEntity.setJarPath(operation.getJarPath() == null ? appDesc.getJarPath() : operation.getJarPath()); applicationEntity.ensureDefault();