From 5db1733cdfdac831cc10ff734c61d68079c47d1f Mon Sep 17 00:00:00 2001
From: Kai Reinhard <K.Reinhard@micromata.de>
Date: Sat, 08 Dec 2018 11:46:22 +0000
Subject: [PATCH] Caching started...

---
 borgbutler-core/src/main/java/de/micromata/borgbutler/json/borg/Repository.java |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/borgbutler-core/src/main/java/de/micromata/borgbutler/json/borg/Repository.java b/borgbutler-core/src/main/java/de/micromata/borgbutler/json/borg/Repository.java
index c0006e4..85a51a9 100644
--- a/borgbutler-core/src/main/java/de/micromata/borgbutler/json/borg/Repository.java
+++ b/borgbutler-core/src/main/java/de/micromata/borgbutler/json/borg/Repository.java
@@ -1,9 +1,21 @@
 package de.micromata.borgbutler.json.borg;
 
 import com.fasterxml.jackson.annotation.JsonProperty;
+import de.micromata.borgbutler.config.BorgRepoConfig;
+import de.micromata.borgbutler.config.ConfigurationHandler;
 import lombok.Getter;
+import lombok.Setter;
 
 public class Repository {
+    /**
+     * A name describing this config. Only used for displaying purposes. This is automatically set with the name
+     * of the repository configuration.
+     *
+     * @see BorgRepoConfig#getName()
+     */
+    @Getter
+    @Setter
+    String name;
     @Getter
     private String id;
     @Getter
@@ -11,4 +23,20 @@
     private String lastModified;
     @Getter
     private String location;
+
+    /**
+     * Sets also the name for this repository if available in the configuration.
+     *
+     * @param location
+     * @return
+     */
+    public Repository setLocation(String location) {
+        this.location = location;
+        // It's ugly but efficiently ;-)
+        BorgRepoConfig repoConfig = ConfigurationHandler.getConfiguration().getRepo(location);
+        if (repoConfig != null) {
+            this.name = repoConfig.getName();
+        }
+        return this;
+    }
 }

--
Gitblit v1.10.0