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

com.almworks.jira.structure.api.item.ItemVersionUpdate Maven / Gradle / Ivy

There is a newer version: 17.25.3
Show newest version
package com.almworks.jira.structure.api.item;

import com.almworks.jira.structure.api.pull.DataVersion;
import com.almworks.jira.structure.api.pull.VersionedDataUpdate;
import org.jetbrains.annotations.NotNull;

import java.util.Collections;
import java.util.Set;

public abstract class ItemVersionUpdate extends VersionedDataUpdate {
  protected ItemVersionUpdate(@NotNull DataVersion version) {
    super(version);
  }

  @NotNull
  public abstract DataVersion getFromVersion();

  @NotNull
  public abstract Set getAffectedItems();


  public static final class Empty extends ItemVersionUpdate {
    public Empty(@NotNull DataVersion version) {
      super(version);
    }

    @NotNull
    public DataVersion getFromVersion() {
      return getVersion();
    }

    public boolean isEmpty() {
      return true;
    }

    @NotNull
    public Set getAffectedItems() {
      return Collections.emptySet();
    }

    public String toString() {
      return String.format("empty[%s]", getVersion());
    }
  }


  public static final class Total extends ItemVersionUpdate {
    public Total(@NotNull DataVersion version) {
      super(version);
    }

    @NotNull
    public DataVersion getFromVersion() {
      return DataVersion.ZERO;
    }

    public boolean isFull() {
      return true;
    }

    @NotNull
    public Set getAffectedItems() {
      return Collections.emptySet();
    }

    public String toString() {
      return String.format("FULL[%s]", getVersion());
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy