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

com.weaverplatform.protocol.model.CreateRelationOperation Maven / Gradle / Ivy

There is a newer version: 3.7.2
Show newest version
package com.weaverplatform.protocol.model;

import java.util.Objects;

/**
 * @author Mohamad Alamili
 */
public class CreateRelationOperation extends CreatePropertyOperation {

  private String targetId, targetGraph;
  private boolean only;
  private CreateRelationOperation _previous;

  public CreateRelationOperation(String id, String sourceId, String key, String targetId) {
    this(id, sourceId, key, targetId, null, null);
  }

  public CreateRelationOperation(String id, String sourceId, String key, String targetId, String replacesId) {
    super(id, sourceId, key, replacesId);
    this.targetId = targetId;
    this.only = false;
  }

  @Deprecated
  public CreateRelationOperation(String id, String sourceId, String key, String targetId, String replaceId, String replacesId) {
    super(id, sourceId, key, replaceId, replacesId);
    this.targetId = targetId;
    this.only = false;
  }

  public WriteOperationAction getAction(){
    return WriteOperationAction.CREATE_RELATION;
  }

  public void setTargetId(String targetId) {
    this.targetId = targetId;
  }

  public String getTargetGraph() {
    return targetGraph;
  }

  public void setTargetGraph(String targetGraph) {
    this.targetGraph = targetGraph;
  }

  public String getTargetId() {
    return targetId;
  }

  public void setOnly(boolean only) {
    this.only = only;
  }

  public boolean getOnly() {
    return only;
  }

  public void setPrevious(CreateRelationOperation previous) {
    this._previous = previous;
  }

  public CreateRelationOperation getPrevious() {
    return _previous;
  }

  @Override
  public boolean equals(Object obj) {
    if(!(obj instanceof CreateRelationOperation)) {
      return false;
    }
    CreateRelationOperation other = (CreateRelationOperation) obj;
    return Objects.equals(getId(), other.getId())
      && Objects.equals(getGraph(), other.getGraph())
      && Objects.equals(getSourceId(), other.getSourceId())
      && Objects.equals(getSourceGraph(), other.getSourceGraph())
      && Objects.equals(getKey(), other.getKey())
      && Objects.equals(getTargetId(), other.getTargetId())
      && Objects.equals(getTargetGraph(), other.getTargetGraph());
  }

  @Override
  public int hashCode() {
    return Objects.hash(super.hashCode(), getTargetId(), getTargetGraph());
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy