package com.imcode.entities.embed;

import com.imcode.entities.superclasses.AbstractIdEntity;
import com.imcode.entities.superclasses.AbstractNamedEntity;
import org.codehaus.jackson.map.util.Comparators;

import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Comparator;

import static java.util.Comparator.*;
import static java.util.Comparator.comparing;

/**
 * Created by vitaly on 15.10.15.
 */
@Embeddable
public class ApplicationFormQuestion implements Comparable<ApplicationFormQuestion>{
    private static Comparator<ApplicationFormQuestion> naturalComparator = nullsFirst(comparing(ApplicationFormQuestion::getSortOrder));

    @Column
    private Integer sortOrder;

    @Column
    private String xsdElementName;

    @Column
    private String text;

    @Column
    private String value;

    public Integer getSortOrder() {
        return sortOrder;
    }

    public void setSortOrder(Integer sortOrder) {
        this.sortOrder = sortOrder;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public String getXsdElementName() {
        return xsdElementName;
    }

    public void setXsdElementName(String xsdElementName) {
        this.xsdElementName = xsdElementName;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        ApplicationFormQuestion that = (ApplicationFormQuestion) o;

        return !(xsdElementName != null ? !xsdElementName.equals(that.xsdElementName) : that.xsdElementName != null);

    }

    @Override
    public int hashCode() {
        return xsdElementName != null ? xsdElementName.hashCode() : 0;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder()
                .append(xsdElementName)
                .append(": ")
                .append(value);

        return sb.toString();
    }

    @Override
    public int compareTo(ApplicationFormQuestion o) {
        return naturalComparator.compare(this, o);
    }
}

@@ -814,24 +814,114 @@
 ementName;%0A%0A
+    @Column%0A    private String stepName;%0A%0A    @Column%0A    private Integer stepSortOrder;%0A%0A
     @Column%0A
@@ -1595,32 +1595,372 @@
 entName;%0A    %7D%0A%0A
+    public String getStepName() %7B%0A        return stepName;%0A    %7D%0A%0A    public void setStepName(String stepName) %7B%0A        this.stepName = stepName;%0A    %7D%0A%0A    public Integer getStepSortOrder() %7B%0A        return stepSortOrder;%0A    %7D%0A%0A    public void setStepSortOrder(Integer stepSortOrder) %7B%0A        this.stepSortOrder = stepSortOrder;%0A    %7D%0A%0A
     @Override%0A  

Add step to Application form