/*
 * Copyright 2015 Hewlett-Packard Development Company, L.P.
 * Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License.
 */

package com.hp.autonomy.types.requests.idol.actions.tags;

import com.fasterxml.jackson.annotation.JsonCreator;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.io.Serializable;

@SuppressWarnings({"WeakerAccess", "unused"})
@Getter
@NoArgsConstructor
@EqualsAndHashCode
public class TagName implements Serializable{
    private static final long serialVersionUID = -6221132711228529797L;
    private String id;
    private String name;

    @JsonCreator
    public TagName(final String path) {
        name = getFieldNameFromPath(path);
        id = adjustFieldPath(path, name);
    }

    private String adjustFieldPath(final String fieldPath, final String fieldName) {
        // Need an extra '/' to be able to query a field by its root path (since wildcards in Idol config file take the form */SOME_FIELD)
        // However, for the special autn_date field which does not have a path, adding such a '/' would break the query
        return fieldName.equals(fieldPath) || fieldPath.startsWith("/") ? fieldPath : '/' + fieldPath;
    }

    private String getFieldNameFromPath(final String value) {
        return value.contains("/") ? value.substring(value.lastIndexOf('/') + 1) : value;
    }
}

@@ -247,140 +247,19 @@
 ort 
-com.fasterxml.jackson.annotation.JsonCreator;%0Aimport lombok.EqualsAndHashCode;%0Aimport lombok.Getter;%0Aimport lombok.NoArgsConstructor
+lombok.Data
 ;%0A%0Ai
@@ -338,52 +338,12 @@
 %7D)%0A@
-Getter%0A@NoArgsConstructor%0A@EqualsAndHashCode
+Data
 %0Apub
@@ -383,16 +383,17 @@
 alizable
+ 
 %7B%0A    pr
@@ -466,24 +466,30 @@
     private 
+final 
 String id;%0A 
@@ -495,24 +495,30 @@
     private 
+final 
 String name;
@@ -523,25 +523,8 @@
 e;%0A%0A
-    @JsonCreator%0A
     
@@ -555,712 +555,83 @@
 ing 
-path) %7B%0A        name = getFieldNameFromPath(path);%0A        id = adjustFieldPath(path, name);%0A    %7D%0A%0A    private String adjustFieldPath(final String fieldPath, final String fieldName) %7B%0A        // Need an extra '/' to be able to query a field by its root path (since wildcards in Idol config file take the form */SOME_FIELD)%0A        // However, for the special autn_date field which does not have a path, adding such a '/' would break the query%0A        return fieldName.equals(fieldPath) %7C%7C fieldPath.startsWith(%22/%22) ? fieldPath : '/' + fieldPath;%0A    %7D%0A%0A    private String getFieldNameFromPath(final String value) %7B%0A        return value.contains(%22/%22) ? value.substring(value.lastIndexOf('/') + 1) : value
+name, final String path) %7B%0A        this.name = name;%0A        this.id = path
 ;%0A  

Update TagName to move logic