public Map<String, Object> toMap() { Map<String, Object> result = mapSupplier.get(); String id = getId(); if (!ID_DEFAULT.equals(id)) { result.put(ID_KEY, id); } StringUtil.doIfNotNullOrEmpty(getName(), name -> result.put(NAME_KEY, name)); putListIfNotNull(result, PROCESSORS_KEY, processors); putListIfNotNull(result, CONTROLLER_SERVICES_KEY, controllerServiceSchemas); putListIfNotNull(result, PROCESS_GROUPS_KEY, processGroupSchemas); putListIfNotNull(result, INPUT_PORTS_KEY, inputPortSchemas); putListIfNotNull(result, OUTPUT_PORTS_KEY, outputPortSchemas); putListIfNotNull(result, FUNNELS_KEY, funnels); putListIfNotNull(result, CONNECTIONS_KEY, connections); putListIfNotNull(result, REMOTE_PROCESS_GROUPS_KEY, remoteProcessGroups); return result; }