AgentClientConfig.java

package com.tradecloud.domain.configuration;

import com.tradecloud.common.base.PersistenceBase;
import com.tradecloud.domain.configuration.agent.AgentValidationProperties;
import org.hibernate.annotations.ForeignKey;

import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import java.math.BigDecimal;

/**
 * A holder for agent client configuration values.
 */
@Entity
@Table(name = "agentclientconfig")
@Access(AccessType.FIELD)
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "AgentClientConfig")
@NamedQueries({
        @NamedQuery(name = "agentClientConfig.findAgentValidationProperties",
                query = "select a.agentValidationProperties from AgentClientConfig a")})
public class AgentClientConfig extends PersistenceBase {

    private static final long serialVersionUID = 1L;

    /**
     * Maximum Agent name field length. Can be a whole number between 1 and
     * 75, defaults to 60.
     */
    @XmlAttribute
    @NotNull
    private int maxNameLength;

    /**
     * Maximum Agent reference field length. Can be a whole number between 1
     * and 75, defaults to 40.
     */
    @XmlAttribute
    @NotNull
    private int maxReferenceLength;

    /**
     * Options are 15 and 21, defaults to 15.
     */
    @XmlAttribute
    @NotNull
    private int presentationDays;

    /**
     * Agent destination system (Tradecloud or MasterData are the only two options).
     */
    @XmlAttribute
    @NotNull
    private String agentDestinationSystem;

    /**
     * Whether or not agents can be created through the UI.
     * With some of our clients all the agents must come through integrations.
     */
    @XmlAttribute
    @NotNull
    private boolean allowNonIntegratedUserCreation;

    /**
     * Indicates that a LC can be drawn for X% more than the face value of the
     * LC. Should not be less than 0 and more than 10. Agent specific config
     * overrides order level config.
     */
    @XmlAttribute
    @NotNull
    private BigDecimal lcToleranceAbove;

    /**
     * Indicates that a LC can be drawn for X% less than the face value of the
     * LC. Should not be less than 0 or more than 10. Agent specific config
     * overrides order level config.
     */
    @XmlAttribute
    @NotNull
    private BigDecimal lcToleranceBelow;

    /**
     * Indicates if Agent names are unique, default is true.
     */
    @XmlAttribute
    @NotNull
    private boolean allowDuplicateAgentNames;

    /**
     * Indicates if Agent references are unique, default is true.
     */
    @XmlAttribute
    @NotNull
    private boolean allowDuplicateAgentReferences;

    /**
     * Indicates if Agent names and references are unique, default is false.
     * Unique identifier would be the agent/org-unit link.
     */
    @XmlAttribute
    @NotNull
    private boolean allowDuplicateAgentNameAndReference;

    @OneToOne(cascade = CascadeType.ALL)
    @ForeignKey(name = "fk_agentvalidationproperties")
    private AgentValidationProperties agentValidationProperties = new AgentValidationProperties();

    public int getMaxNameLength() {
        return maxNameLength;
    }

    public AgentValidationProperties getAgentValidationProperties() {
        return agentValidationProperties;
    }

    public void setAgentValidationProperties(AgentValidationProperties agentValidationProperties) {
        this.agentValidationProperties = agentValidationProperties;
    }

    public void setMaxNameLength(int maxNameLength) {
        this.maxNameLength = maxNameLength;
    }

    public int getMaxReferenceLength() {
        return maxReferenceLength;
    }

    public void setMaxReferenceLength(int maxReferenceLength) {
        this.maxReferenceLength = maxReferenceLength;
    }

    public int getPresentationDays() {
        return presentationDays;
    }

    public void setPresentationDays(int presentationDays) {
        this.presentationDays = presentationDays;
    }

    public BigDecimal getLcToleranceAbove() {
        return lcToleranceAbove;
    }

    public void setLcToleranceAbove(BigDecimal lcToleranceAbove) {
        this.lcToleranceAbove = lcToleranceAbove;
    }

    public BigDecimal getLcToleranceBelow() {
        return lcToleranceBelow;
    }

    public void setLcToleranceBelow(BigDecimal lcToleranceBelow) {
        this.lcToleranceBelow = lcToleranceBelow;
    }

    public boolean isAllowDuplicateAgentNames() {
        return allowDuplicateAgentNames;
    }

    public void setAllowDuplicateAgentNames(boolean allowDuplicateAgentNames) {
        this.allowDuplicateAgentNames = allowDuplicateAgentNames;
    }

    public boolean isAllowDuplicateAgentReferences() {
        return allowDuplicateAgentReferences;
    }

    public void setAllowDuplicateAgentReferences(boolean allowDuplicateAgentReferences) {
        this.allowDuplicateAgentReferences = allowDuplicateAgentReferences;
    }

    public boolean isAllowDuplicateAgentNameAndReference() {
        return allowDuplicateAgentNameAndReference;
    }

    public void setAllowDuplicateAgentNameAndReference(boolean allowDuplicateAgentNameAndReference) {
        this.allowDuplicateAgentNameAndReference = allowDuplicateAgentNameAndReference;
    }

    public String getAgentDestinationSystem() {
        return agentDestinationSystem;
    }

    public void setAgentDestinationSystem(String agentDestinationSystem) {
        this.agentDestinationSystem = agentDestinationSystem;
    }

    public boolean isAllowNonIntegratedUserCreation() {
        return allowNonIntegratedUserCreation;
    }

    public void setAllowNonIntegratedUserCreation(boolean allowNonIntegratedUserCreation) {
        this.allowNonIntegratedUserCreation = allowNonIntegratedUserCreation;
    }
}