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

org.geneweaver.domain.AbstractEntity Maven / Gradle / Ivy

There is a newer version: 2.7.6
Show newest version
/*-
 * 
 * Copyright 2018, 2020  The Jackson Laboratory Inc.
 *
 * 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.
 * 
 * @author Matthew Gerring
 */
package org.geneweaver.domain;

import java.util.Objects;

import org.neo4j.ogm.annotation.GeneratedValue;
import org.neo4j.ogm.annotation.Id;

public abstract class AbstractEntity implements Entity {

	/** The uid. */
	@Id
	@GeneratedValue
    private Long uid;

	// We purposely use a character unlikely, the default character "," appears in some values.
	// You can override the delimier or set it if not writing bulk import files.
	private String delimiter = System.getProperty("delimiter", "±");// Character used for delimiter in bulk import files.
	
	/**
	 * @return the delimiter
	 */
	public String getDelimiter() {
		
		// If one ios set e.g. "," we use that
		return delimiter;
	}

	/**
	 * @param delimiter the delimiter to set
	 */
	public void setDelimiter(String delimiter) {
		this.delimiter = delimiter;
	}

	@Override
	public int hashCode() {
		return Objects.hash(delimiter, uid);
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (!(obj instanceof AbstractEntity))
			return false;
		AbstractEntity other = (AbstractEntity) obj;
		return Objects.equals(delimiter, other.delimiter) && Objects.equals(uid, other.uid);
	}

	/**
	 * @return the uid
	 */
	public final Long getUid() {
		return uid;
	}

	/**
	 * @param uid the uid to set
	 */
	public final void setUid(Long uid) {
		this.uid = uid;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy