@Override public int compare(final BulletinEntity bulletin1, final BulletinEntity bulletin2) { if (bulletin1 == null && bulletin2 == null) { return 0; } else if (bulletin1 == null) { return 1; } else if (bulletin2 == null) { return -1; } final Date timestamp1 = bulletin1.getTimestamp(); final Date timestamp2 = bulletin2.getTimestamp(); if (timestamp1 == null && timestamp2 == null) { return 0; } else if (timestamp1 == null) { return 1; } else if (timestamp2 == null) { return -1; } else { return timestamp1.compareTo(timestamp2); } } });
public BulletinEntity createBulletinEntity(final BulletinDTO dto, final boolean canRead) { final BulletinEntity entity = new BulletinEntity(); if (dto != null) { entity.setId(dto.getId()); entity.setSourceId(dto.getSourceId()); entity.setGroupId(dto.getGroupId()); entity.setTimestamp(dto.getTimestamp()); entity.setNodeAddress(dto.getNodeAddress()); entity.setCanRead(canRead); if (canRead) { entity.setBulletin(dto); } } return entity; }
if (bulletinEntity.getNodeAddress() == null) { bulletinEntity.setNodeAddress(nodeAddress); if (bulletinEntity.getCanRead() && bulletinEntity.getBulletin() != null && bulletinEntity.getBulletin().getNodeAddress() == null) { bulletinEntity.getBulletin().setNodeAddress(nodeAddress); .filter(bulletinEntity -> bulletinEntity.getCanRead()) .collect(Collectors.groupingBy(b -> b.getBulletin().getMessage())); if (bulletinEntity.getTimestamp() == null) { return 0; } else { return bulletinEntity.getTimestamp().getTime(); selectedBulletinEntity.setNodeAddress(ALL_NODES_MESSAGE); selectedBulletinEntity.getBulletin().setNodeAddress(ALL_NODES_MESSAGE); entities.add(selectedBulletinEntity); .filter(bulletinEntity -> !bulletinEntity.getCanRead()) .forEach(entities::add); final int timeComparison = o1.getTimestamp().compareTo(o2.getTimestamp()); if (timeComparison != 0) { return timeComparison; return o1.getNodeAddress().compareTo(o2.getNodeAddress()); });
) final BulletinEntity requestBulletinEntity) { if (requestBulletinEntity == null || requestBulletinEntity.getBulletin() == null) { throw new IllegalArgumentException("Bulletin details must be specified."); final BulletinDTO requestBulletin = requestBulletinEntity.getBulletin(); if (requestBulletin.getId() != null) { throw new IllegalArgumentException("A bulletin ID cannot be specified."); null, (bulletinEntity) -> { final BulletinDTO bulletin = bulletinEntity.getBulletin(); final BulletinEntity entity = serviceFacade.createBulletin(bulletin,true); return generateOkResponse(entity).build();
if (bulletin.getNodeAddress() == null) { bulletin.setNodeAddress(nodeAddress); if (bulletin.getNodeAddress() == null) { bulletin.setNodeAddress(nodeAddress); if (bulletin.getNodeAddress() == null) { bulletin.setNodeAddress(nodeAddress);
private void printServicesStillDisabling(final FlowClient flowClient, final String pgId) throws NiFiClientException, IOException { final ControllerServicesEntity servicesEntity = flowClient.getControllerServices(pgId); if (servicesEntity == null || servicesEntity.getControllerServices() == null) { return; } println(); println("One or more services appear to be stuck disabling: "); for (final ControllerServiceEntity serviceEntity : servicesEntity.getControllerServices()) { if (ControllerServiceStates.STATE_DISABLING.equals(serviceEntity.getComponent().getState())) { println(); println("Service: " + serviceEntity.getId() + " - " + serviceEntity.getComponent().getName()); if (serviceEntity.getBulletins() != null) { println(); println("Reasons: "); for (final BulletinEntity bulletinEntity : serviceEntity.getBulletins()) { println("- " + bulletinEntity.getBulletin().getMessage()); } } } } }
private void printServicesStillEnabling(final FlowClient flowClient, final String pgId) throws NiFiClientException, IOException { final ControllerServicesEntity servicesEntity = flowClient.getControllerServices(pgId); if (servicesEntity == null || servicesEntity.getControllerServices() == null) { return; } println(); println("One or more services appear to be stuck enabling: "); for (final ControllerServiceEntity serviceEntity : servicesEntity.getControllerServices()) { if (ControllerServiceStates.STATE_ENABLING.equals(serviceEntity.getComponent().getState())) { println(); println("Service: " + serviceEntity.getId() + " - " + serviceEntity.getComponent().getName()); if (serviceEntity.getBulletins() != null) { println(); println("Reasons: "); for (final BulletinEntity bulletinEntity : serviceEntity.getBulletins()) { println("- " + bulletinEntity.getBulletin().getMessage()); } } } } }