class RepositoryResourceServiceImpl implements RepositoryResourceService {

	@Override
	public List<String> findParentPathes(Integer resourceId) {
		List<String> pathes = new ArrayList<String>();
		
		while(resourceId != Constant.TREE_ROOT_ID) {
			resourceId = repositoryResourceDao.findById(resourceId).map(resource -> {
				if(resource.isDependence()) {
					pathes.add(0, resource.getName());
				} else {
					pathes.add(0, resource.getKey());
				}
				
				return resource.getParentId();
			}).orElse(Constant.TREE_ROOT_ID);
		}
		
		return pathes;
	}

}