From 77ac48d08a7c440695e6e53e75051b1273853fe7 Mon Sep 17 00:00:00 2001
From: bourgesl <bourges.laurent@gmail.com>
Date: Fri, 8 Mar 2019 14:39:15 +0100
Subject: [PATCH] minor refactoring to describe keyword attributes

---
 src/main/java/fr/osug/doi/Const.java      | 10 +++++++---
 src/main/java/fr/osug/doi/DoiCsvData.java |  6 +++---
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/main/java/fr/osug/doi/Const.java b/src/main/java/fr/osug/doi/Const.java
index a626a64..40d2a25 100644
--- a/src/main/java/fr/osug/doi/Const.java
+++ b/src/main/java/fr/osug/doi/Const.java
@@ -160,7 +160,7 @@ public interface Const {
         //# 19 [funder]
         KEY_FUNDER_NAME
     };
-    public static final String[] KEY_ATTRS = new String[]{
+    public static final String[] KEY_ATTRS_NAMES = new String[]{
         // creator / contributor attributes:
         // nameIdentifier variants:
         //        "nameIdentifier:AUTHORCLAIM",
@@ -170,11 +170,15 @@ public interface Const {
         //        "nameIdentifier:VIAF",
         //        "nameIdentifier:URL",
         // affiliation:
-        "affiliation",
+        "affiliation"
         //        givenName
         //        familyName
+    };    
+    public static final String[] KEY_ATTRS_RIGHTS = new String[]{
         // rights attribute:
-        "rightsURI",
+        "rightsURI"
+    };    
+    public static final String[] KEY_ATTRS_FUNDER = new String[]{
         // funder attributes:
         //        funderIdentifier
         "awardNumber",
diff --git a/src/main/java/fr/osug/doi/DoiCsvData.java b/src/main/java/fr/osug/doi/DoiCsvData.java
index 999a967..5c40667 100644
--- a/src/main/java/fr/osug/doi/DoiCsvData.java
+++ b/src/main/java/fr/osug/doi/DoiCsvData.java
@@ -31,9 +31,9 @@ public final class DoiCsvData extends CsvData {
             KEY_ORDER_INDEX.put(key, Integer.valueOf(i++));
         }
         // supported attributes (extra CSV columns):
-        for (String key : Const.KEY_ATTRS) {
-            KEY_ATTR_SET.add(key);
-        }
+        KEY_ATTR_SET.addAll(Arrays.asList(Const.KEY_ATTRS_NAMES));
+        KEY_ATTR_SET.addAll(Arrays.asList(Const.KEY_ATTRS_RIGHTS));
+        KEY_ATTR_SET.addAll(Arrays.asList(Const.KEY_ATTRS_FUNDER));
     }
 
     DoiCsvData(final List<String[]> rows) {
-- 
GitLab