All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.openfact.models.jpa.entities.DocumentLineAttributeEntity Maven / Gradle / Ivy

There is a newer version: 1.1.3.Final
Show newest version
/*******************************************************************************
 * Copyright 2016 Sistcoop, Inc. and/or its affiliates
 * and other contributors as indicated by the @author tags.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *******************************************************************************/
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-2 
// See http://java.sun.com/xml/jaxb 
// Any modifications to this file will be lost upon recompilation of the source schema. 
// Generated on: 2016.09.14 at 11:44:49 AM PET 
//

package org.openfact.models.jpa.entities;

import javax.persistence.*;
import java.io.Serializable;

@Entity
@Table(name = "DOCUMENT_LINE_ATTRIBUTE")
@IdClass(DocumentLineAttributeEntity.Key.class)
@NamedQueries({
        @NamedQuery(name = "getDocumentLineAttributesByNameAndValue", query = "select attr from DocumentLineAttributeEntity attr where attr.name = :name and attr.value = :value"),
        @NamedQuery(name = "deleteDocumentLineAttributesByNameAndSendEvent", query = "delete from  DocumentLineAttributeEntity attr where attr.documentLine.id = :sendEventId and attr.name = :name"),
        @NamedQuery(name = "deleteDocumentLineAttributesByNameAndSendEventOtherThan", query = "delete from  DocumentLineAttributeEntity attr where attr.documentLine.id = :sendEventId and attr.name = :name and attr.id <> :attrId"),
        @NamedQuery(name = "deleteDocumentLineAttributesByOrganization", query = "delete from DocumentLineAttributeEntity attr where attr.documentLine IN (select line from DocumentLineEntity line join line.document doc where doc.organizationId=:organizationId)")
})
public class DocumentLineAttributeEntity {

    @Id
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(foreignKey = @ForeignKey, name = "DOCUMENT_LINE_ID")
    protected DocumentLineEntity documentLine;

    @Id
    @Column(name = "NAME")
    protected String name;

    @Column(name = "VALUE")
    protected String value;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getValue() {
        return value;
    }

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

    public DocumentLineEntity getDocumentLine() {
        return documentLine;
    }

    public void setDocumentLine(DocumentLineEntity documentLine) {
        this.documentLine = documentLine;
    }

    public static class Key implements Serializable {

        protected DocumentLineEntity documentLine;

        protected String name;

        public Key() {
        }

        public Key(DocumentLineEntity documentLine, String name) {
            this.documentLine = documentLine;
            this.name = name;
        }

        public DocumentLineEntity getDocumentLine() {
            return documentLine;
        }

        public String getName() {
            return name;
        }

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

            DocumentLineAttributeEntity.Key key = (DocumentLineAttributeEntity.Key) o;

            if (name != null ? !name.equals(key.name) : key.name != null) return false;
            if (documentLine != null ? !documentLine.getId().equals(key.documentLine != null ? key.documentLine.getId() : null) : key.documentLine != null)
                return false;

            return true;
        }

        @Override
        public int hashCode() {
            int result = documentLine != null ? documentLine.getId().hashCode() : 0;
            result = 31 * result + (name != null ? name.hashCode() : 0);
            return result;
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy