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

com.weaverplatform.protocol.model.CreateAttributeOperation 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 CreateAttributeOperation extends CreatePropertyOperation {

  private AttributeValue value;
  private String datatype;
  private CreateAttributeOperation _previous;

  public CreateAttributeOperation(String id, String sourceId, String key, String value, String dataType) {
    this(id, sourceId, key, value, dataType, null, null);
  }
  public CreateAttributeOperation(String id, String sourceId, String key, double value, String dataType) {
    this(id, sourceId, key, value, dataType, null, null);
  }
  public CreateAttributeOperation(String id, String sourceId, String key, boolean value, String dataType) {
    this(id, sourceId, key, value, dataType, null, null);
  }
  public CreateAttributeOperation(String id, String sourceId, String key, String value, String dataType, String replacesId) {
    super(id, sourceId, key, replacesId);
    this.value = new AttributeValue(value);
    this.datatype = dataType;
  }

  @Deprecated
  public CreateAttributeOperation(String id, String sourceId, String key, String value, String dataType, String replaceId, String replacesId) {
    super(id, sourceId, key, replaceId, replacesId);
    this.value = new AttributeValue(value);
    this.datatype = dataType;
  }

  public CreateAttributeOperation(String id, String sourceId, String key, double value, String dataType, String replacesId) {
    super(id, sourceId, key, replacesId);
    this.value = new AttributeValue(value);
    this.datatype = dataType;
  }

  @Deprecated
  public CreateAttributeOperation(String id, String sourceId, String key, double value, String dataType, String replaceId, String replacesId) {
    super(id, sourceId, key, replaceId, replacesId);
    this.value = new AttributeValue(value);
    this.datatype = dataType;
  }

  public CreateAttributeOperation(String id, String sourceId, String key, boolean value, String dataType, String replacesId) {
    super(id, sourceId, key, replacesId);
    this.value = new AttributeValue(value);
    this.datatype = dataType;
  }

  @Deprecated
  public CreateAttributeOperation(String id, String sourceId, String key, boolean value, String dataType, String replaceId, String replacesId) {
    super(id, sourceId, key, replaceId, replacesId);
    this.value = new AttributeValue(value);
    this.datatype = dataType;
  }

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

  public AttributeValue getValue() {
    return value;
  }

  public String getDatatype() {
    return datatype;
  }

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

  public CreateAttributeOperation getPrevious() {
    return _previous;
  }

  @Override
  public boolean equals(Object obj) {
    if(!(obj instanceof CreateAttributeOperation)) {
      return false;
    }
    CreateAttributeOperation other = (CreateAttributeOperation) 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(getValue(), other.getValue())
      && Objects.equals(getDatatype(), other.getDatatype());
  }

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy