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

org.openfact.models.jpa.entities.SendEventAttributeEntity 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 = "SEND_EVENT_ATTRIBUTE")
@IdClass(SendEventAttributeEntity.Key.class)
@NamedQueries({
        @NamedQuery(name = "getSendEventResponseAttributesByNameAndValue", query = "select attr from SendEventAttributeEntity attr where attr.name = :name and attr.value = :value"),
        @NamedQuery(name = "deleteSendEventResponseAttributesByNameAndSendEvent", query = "delete from  SendEventAttributeEntity attr where attr.sendEvent.id = :sendEventId and attr.name = :name"),
        @NamedQuery(name = "deleteSendEventResponseAttributesByNameAndSendEventOtherThan", query = "delete from  SendEventAttributeEntity attr where attr.sendEvent.id = :sendEventId and attr.name = :name and attr.id <> :attrId"),
        @NamedQuery(name = "deleteSendEventAttributesByOrganization", query = "delete from SendEventAttributeEntity attr where attr.sendEvent IN (select s from SendEventEntity s join s.document i where i.organizationId=:organizationId)")
})
public class SendEventAttributeEntity {

    @Id
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(foreignKey = @ForeignKey, name = "SEND_EVENT_ID")
    protected SendEventEntity sendEvent;

    @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 SendEventEntity getSendEvent() {
        return sendEvent;
    }

    public void setSendEvent(SendEventEntity ublDocumentSendEvent) {
        this.sendEvent = ublDocumentSendEvent;
    }

    public static class Key implements Serializable {

        private static final long serialVersionUID = 1L;

        protected SendEventEntity sendEvent;

        protected String name;

        public Key() {
        }

        public Key(SendEventEntity ublDocumentSendEvent, String name) {
            this.sendEvent = ublDocumentSendEvent;
            this.name = name;
        }

        public SendEventEntity getSendEvent() {
            return sendEvent;
        }

        public String getName() {
            return name;
        }

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

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

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

            return true;
        }

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy