org.eclipse.dirigible.components.odata.domain.OData Maven / Gradle / Ivy
/*
* Copyright (c) 2023 SAP SE or an SAP affiliate company and Eclipse Dirigible contributors
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v20.html
*
* SPDX-FileCopyrightText: 2023 SAP SE or an SAP affiliate company and Eclipse Dirigible contributors
* SPDX-License-Identifier: EPL-2.0
*/
package org.eclipse.dirigible.components.odata.domain;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import org.eclipse.dirigible.commons.api.helpers.GsonHelper;
import org.eclipse.dirigible.components.base.artefact.Artefact;
import org.eclipse.dirigible.components.odata.api.ODataAssociation;
import org.eclipse.dirigible.components.odata.api.ODataEntity;
import com.google.gson.annotations.Expose;
/**
* The OData Model.
*/
@Entity
@Table(name = "DIRIGIBLE_ODATA")
public class OData extends Artefact {
/** The Constant ARTEFACT_TYPE. */
public static final String ARTEFACT_TYPE = "odata";
/** The id. */
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "ODATA_ID", nullable = false)
private Long id;
/** The namespace. */
@Column(name = "ODATA_NAMESPACE", columnDefinition = "VARCHAR", nullable = false, length = 255)
@Expose
private String namespace;
/** The entities. */
@Transient
@Expose
private List entities = new ArrayList();
/** The associations. */
@Transient
@Expose
private List associations = new ArrayList();
/**
* Instantiates a new o data.
*
* @param location the location
* @param name the name
* @param description the description
* @param dependencies the dependencies
* @param namespace the namespace
* @param entities the entities
* @param associations the associations
*/
public OData(String location, String name, String description, String dependencies,
String namespace, List entities, List associations) {
super(location, name, ARTEFACT_TYPE, description, dependencies);
this.namespace = namespace;
this.entities = entities;
this.associations = associations;
}
/**
* Instantiates a new o data.
*/
public OData() {
super();
}
/**
* Gets the id.
*
* @return the id
*/
public Long getId() {
return id;
}
/**
* Sets the id.
*
* @param id the new id
*/
public void setId(Long id) {
this.id = id;
}
/**
* Gets the namesapce.
*
* @return the namespace
*/
public String getNamespace() {
return namespace;
}
/**
* Sets the namespace.
*
* @param namespace the namespace to set
*/
public void setNamespace(String namespace) {
this.namespace = namespace;
}
/**
* To json.
*
* @return the string
*/
public String toJson() {
return GsonHelper.toJson(this);
}
/**
* Gets the entities.
*
* @return the entities
*/
public List getEntities() {
return entities;
}
/**
* Gets the associations.
*
* @return the associations
*/
public List getAssociations() {
return associations;
}
/**
* To string.
*
* @return the string
*/
@Override
public String toString() {
return "OData [id=" + id + ", namespace=" + namespace + ", entities=" + entities + ", associations="
+ associations + ", location=" + location + ", name=" + name + ", type=" + type + ", description="
+ description + ", key=" + key + ", dependencies=" + dependencies + ", createdBy=" + createdBy
+ ", createdAt=" + createdAt + ", updatedBy=" + updatedBy + ", updatedAt=" + updatedAt + "]";
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy