@Override public void updateLoadBalancerService( Service service, List<? extends Long> certIds, Long defaultCertId) { LoadBalancer lb = objectManager.findOne( LoadBalancer.class, LOAD_BALANCER.SERVICE_ID, service.getId(), LOAD_BALANCER.REMOVED, null); if (lb != null) { Map<String, Object> data = new HashMap<>(); if (certIds == null) { certIds = DataAccessor.fields(service) .withKey(LoadBalancerConstants.FIELD_LB_CERTIFICATE_IDS) .asList(jsonMapper, Long.class); } if (defaultCertId == null) { defaultCertId = DataAccessor.fieldLong(service, LoadBalancerConstants.FIELD_LB_DEFAULT_CERTIFICATE_ID); } data.put(LoadBalancerConstants.FIELD_LB_CERTIFICATE_IDS, certIds); data.put(LoadBalancerConstants.FIELD_LB_DEFAULT_CERTIFICATE_ID, defaultCertId); DataUtils.getWritableFields(lb).putAll(data); objectManager.persist(lb); objectProcessManager.scheduleStandardProcess(StandardProcess.UPDATE, lb, data); } }
private void activateServices(final Service initialService, final List<Service> services) { /* * Trigger activate for all the services */ try { for (Service service : services) { if (service.getState().equalsIgnoreCase(CommonStatesConstants.INACTIVE)) { objectProcessMgr.scheduleStandardProcess(StandardProcess.ACTIVATE, service, null); } else if (service.getState().equalsIgnoreCase(CommonStatesConstants.ACTIVE)) { objectProcessMgr.scheduleStandardProcess(StandardProcess.UPDATE, service, null); } } } catch (IdempotentRetryException ex) { // if not caught, the process will keep on spinning forever // figure out better solution } }