// Path: modules/common/app/edu/berkeley/ground/common/dao/version/ItemDao.java
// public interface ItemDao<T extends Item> {
// 
//   T create(T item) throws GroundException;
// 
//   DbStatements insert(T item) throws GroundException;
// 
//   T retrieveFromDatabase(long id) throws GroundException;
// 
//   T retrieveFromDatabase(String sourceKey) throws GroundException;
// 
//   Class<T> getType();
// 
//   List<Long> getLeaves(long itemId) throws GroundException;
// 
//   Map<Long, Long> getHistory(long itemId) throws GroundException;
// 
//   /**
//    * Add a new Version to this Item. The provided parentIds will be the parents of this particular
//    * version. What's provided in the default case varies based on which database we are writing
//    * into.
//    *
//    * @param itemId the id of the Item we're updating
//    * @param childId the new version's id
//    * @param parentIds the ids of the parents of the child
//    */
//   DbStatements update(long itemId, long childId, List<Long> parentIds) throws GroundException;
// 
//   /**
//    * Truncate the item to only have the most recent levels.
//    *
//    * @param numLevels the levels to keep
//    * @throws GroundException an error while removing versions
//    */
//   void truncate(long itemId, int numLevels) throws GroundException;
// 
//   default boolean checkIfItemExists(String sourceKey) {
//     try {
//       this.retrieveFromDatabase(sourceKey);
// 
//       return true;
//     } catch (GroundException e) {
//       return false;
//     }
//   }
// 
//   default void verifyItemNotExists(String sourceKey) throws GroundException {
//     if (checkIfItemExists(sourceKey)) {
//       throw new GroundException(ExceptionType.ITEM_ALREADY_EXISTS, this.getType().getSimpleName(), sourceKey);
//     }
//   }
// }
// 
// Path: modules/common/app/edu/berkeley/ground/common/exception/GroundException.java
// public class GroundException extends Exception {
// 
//   private static final long serialVersionUID = 1L;
// 
//   private final String message;
//   private final ExceptionType exceptionType;
// 
//   public enum ExceptionType {
//     DB("Database Exception:", "%s"),
//     ITEM_NOT_FOUND("GroundItemNotFoundException", "No %s \'%s\' found."),
//     VERSION_NOT_FOUND("GroundVersionNotFoundException", "No %s \'%s\' found."),
//     ITEM_ALREADY_EXISTS("GroundItemAlreadyExistsException", "%s %s already exists."),
//     OTHER("GroundException", "%s");
// 
//     String name;
//     String description;
// 
//     ExceptionType(String name, String description) {
//       this.name = name;
//       this.description = description;
//     }
// 
//     public String format(String... values) {
//       return String.format(this.description, values);
//     }
//   }
// 
//   public GroundException(ExceptionType exceptionType, String... values) {
//     this.exceptionType = exceptionType;
//     this.message = this.exceptionType.format(values);
//   }
// 
//   public GroundException(Exception exception) {
//     this.exceptionType = ExceptionType.OTHER;
//     this.message = this.exceptionType.format(exception.getMessage());
//   }
// 
//   @Override
//   public String getMessage() {
//     return this.message;
//   }
// 
//   public ExceptionType getExceptionType() {
//     return this.exceptionType;
//   }
// }
// 
// Path: modules/common/app/edu/berkeley/ground/common/model/usage/LineageEdge.java
// public class LineageEdge extends Item {
// 
//   // the name of this LineageEdge
//   @JsonProperty("name")
//   private final String name;
// 
//   // the source key for this Node
//   @JsonProperty("sourceKey")
//   private final String sourceKey;
// 
//   /**
//    * Create a new lineage edge.
//    *
//    * @param id the id of the lineage edge
//    * @param name the name of the lineage edge
//    * @param sourceKey the user-generated unique key for the lineage edge
//    * @param tags the tags associated with this lineage edge
//    */
// 
//   @JsonCreator
//   public LineageEdge(@JsonProperty("itemId") long id, @JsonProperty("name") String name,
//                       @JsonProperty("sourceKey") String sourceKey, @JsonProperty("tags") Map<String, Tag> tags) {
//     super(id, tags);
// 
//     this.name = name;
//     this.sourceKey = sourceKey;
//   }
// 
//   public LineageEdge(long id, LineageEdge other) {
//     super(id, other.getTags());
// 
//     this.name = other.name;
//     this.sourceKey = other.sourceKey;
//   }
// 
//   public String getName() {
//     return this.name;
//   }
// 
//   public String getSourceKey() {
//     return this.sourceKey;
//   }
// 
//   @Override
//   public boolean equals(Object other) {
//     if (!(other instanceof LineageEdge)) {
//       return false;
//     }
// 
//     LineageEdge otherLineageEdge = (LineageEdge) other;
// 
//     return this.name.equals(otherLineageEdge.name)
//              && this.getId() == otherLineageEdge.getId()
//              && this.sourceKey.equals(otherLineageEdge.sourceKey)
//              && this.getTags().equals(otherLineageEdge.getTags());
//   }
// }


import edu.berkeley.ground.common.dao.version.ItemDao;
import edu.berkeley.ground.common.exception.GroundException;
import edu.berkeley.ground.common.model.usage.LineageEdge;
import java.util.List;
import java.util.Map;
/**
 * 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
 *
 * <p>http://www.apache.org/licenses/LICENSE-2.0
 *
 * <p>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.
 */
package edu.berkeley.ground.common.dao.usage;


public interface LineageEdgeDao extends ItemDao<LineageEdge> {

  @Override
// Path: modules/common/app/edu/berkeley/ground/common/dao/version/ItemDao.java
// public interface ItemDao<T extends Item> {
// 
//   T create(T item) throws GroundException;
// 
//   DbStatements insert(T item) throws GroundException;
// 
//   T retrieveFromDatabase(long id) throws GroundException;
// 
//   T retrieveFromDatabase(String sourceKey) throws GroundException;
// 
//   Class<T> getType();
// 
//   List<Long> getLeaves(long itemId) throws GroundException;
// 
//   Map<Long, Long> getHistory(long itemId) throws GroundException;
// 
//   /**
//    * Add a new Version to this Item. The provided parentIds will be the parents of this particular
//    * version. What's provided in the default case varies based on which database we are writing
//    * into.
//    *
//    * @param itemId the id of the Item we're updating
//    * @param childId the new version's id
//    * @param parentIds the ids of the parents of the child
//    */
//   DbStatements update(long itemId, long childId, List<Long> parentIds) throws GroundException;
// 
//   /**
//    * Truncate the item to only have the most recent levels.
//    *
//    * @param numLevels the levels to keep
//    * @throws GroundException an error while removing versions
//    */
//   void truncate(long itemId, int numLevels) throws GroundException;
// 
//   default boolean checkIfItemExists(String sourceKey) {
//     try {
//       this.retrieveFromDatabase(sourceKey);
// 
//       return true;
//     } catch (GroundException e) {
//       return false;
//     }
//   }
// 
//   default void verifyItemNotExists(String sourceKey) throws GroundException {
//     if (checkIfItemExists(sourceKey)) {
//       throw new GroundException(ExceptionType.ITEM_ALREADY_EXISTS, this.getType().getSimpleName(), sourceKey);
//     }
//   }
// }
// 
// Path: modules/common/app/edu/berkeley/ground/common/exception/GroundException.java
// public class GroundException extends Exception {
// 
//   private static final long serialVersionUID = 1L;
// 
//   private final String message;
//   private final ExceptionType exceptionType;
// 
//   public enum ExceptionType {
//     DB("Database Exception:", "%s"),
//     ITEM_NOT_FOUND("GroundItemNotFoundException", "No %s \'%s\' found."),
//     VERSION_NOT_FOUND("GroundVersionNotFoundException", "No %s \'%s\' found."),
//     ITEM_ALREADY_EXISTS("GroundItemAlreadyExistsException", "%s %s already exists."),
//     OTHER("GroundException", "%s");
// 
//     String name;
//     String description;
// 
//     ExceptionType(String name, String description) {
//       this.name = name;
//       this.description = description;
//     }
// 
//     public String format(String... values) {
//       return String.format(this.description, values);
//     }
//   }
// 
//   public GroundException(ExceptionType exceptionType, String... values) {
//     this.exceptionType = exceptionType;
//     this.message = this.exceptionType.format(values);
//   }
// 
//   public GroundException(Exception exception) {
//     this.exceptionType = ExceptionType.OTHER;
//     this.message = this.exceptionType.format(exception.getMessage());
//   }
// 
//   @Override
//   public String getMessage() {
//     return this.message;
//   }
// 
//   public ExceptionType getExceptionType() {
//     return this.exceptionType;
//   }
// }
// 
// Path: modules/common/app/edu/berkeley/ground/common/model/usage/LineageEdge.java
// public class LineageEdge extends Item {
// 
//   // the name of this LineageEdge
//   @JsonProperty("name")
//   private final String name;
// 
//   // the source key for this Node
//   @JsonProperty("sourceKey")
//   private final String sourceKey;
// 
//   /**
//    * Create a new lineage edge.
//    *
//    * @param id the id of the lineage edge
//    * @param name the name of the lineage edge
//    * @param sourceKey the user-generated unique key for the lineage edge
//    * @param tags the tags associated with this lineage edge
//    */
// 
//   @JsonCreator
//   public LineageEdge(@JsonProperty("itemId") long id, @JsonProperty("name") String name,
//                       @JsonProperty("sourceKey") String sourceKey, @JsonProperty("tags") Map<String, Tag> tags) {
//     super(id, tags);
// 
//     this.name = name;
//     this.sourceKey = sourceKey;
//   }
// 
//   public LineageEdge(long id, LineageEdge other) {
//     super(id, other.getTags());
// 
//     this.name = other.name;
//     this.sourceKey = other.sourceKey;
//   }
// 
//   public String getName() {
//     return this.name;
//   }
// 
//   public String getSourceKey() {
//     return this.sourceKey;
//   }
// 
//   @Override
//   public boolean equals(Object other) {
//     if (!(other instanceof LineageEdge)) {
//       return false;
//     }
// 
//     LineageEdge otherLineageEdge = (LineageEdge) other;
// 
//     return this.name.equals(otherLineageEdge.name)
//              && this.getId() == otherLineageEdge.getId()
//              && this.sourceKey.equals(otherLineageEdge.sourceKey)
//              && this.getTags().equals(otherLineageEdge.getTags());
//   }
// }


// Path: modules/common/app/edu/berkeley/ground/common/dao/usage/LineageEdgeDao.java
import edu.berkeley.ground.common.dao.version.ItemDao;
import edu.berkeley.ground.common.exception.GroundException;
import edu.berkeley.ground.common.model.usage.LineageEdge;
import java.util.List;
import java.util.Map;

/**
 * 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
 *
 * <p>http://www.apache.org/licenses/LICENSE-2.0
 *
 * <p>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.
 */
package edu.berkeley.ground.common.dao.usage;


public interface LineageEdgeDao extends ItemDao<LineageEdge> {

  @Override
  LineageEdge create(LineageEdge lineageEdge) throws GroundException;