class ConfigPropertyServiceImpl implements ConfigPropertyService {

	@Override
	public ConfigTreeNode listProperties() throws Exception {
		List<ConfigProperty> configPropertyList = configPropertyRepository.findAll();
		List<ConfigPropertyRelation> configRelationList = configPropertyRelationRepository.findAll();
		List<ConfigPropertyMetadata> configMetadataList = configPropertyMetadataRepository.findAll();

		List<String> rootNode = new ArrayList<>();

		Map<String, String> applicationParentMap = new HashMap<>();
		configRelationList.forEach(configRelation -> {
			applicationParentMap.put(configRelation.getApplication(), configRelation.getParent());
			if ("root".equals(configRelation.getParent())) {
				rootNode.add(configRelation.getApplication());
			}
		});

		ConfigTreeNode treeNode = new ConfigTreeNode();
		treeNode.setName(rootNode.get(0));

		populateNode(treeNode, applicationParentMap, configPropertyList, configMetadataList);

		return treeNode;
	}

}