// Path: net.resheim.eclipse.timekeeper.db/src/main/java/net/resheim/eclipse/timekeeper/db/converters/LocalDateTimeAttributeConverter.java
// @Converter
// public class LocalDateTimeAttributeConverter implements AttributeConverter<LocalDateTime, Timestamp> {
// 
// 	@Override
// 	public Timestamp convertToDatabaseColumn(LocalDateTime locDateTime) {
// 		return (locDateTime == null ? null : Timestamp.valueOf(locDateTime));
// 	}
// 
// 	@Override
// 	public LocalDateTime convertToEntityAttribute(Timestamp sqlTimestamp) {
// 		return (sqlTimestamp == null ? null : sqlTimestamp.toLocalDateTime());
// 	}
// }


import java.io.Serializable;
import java.time.Duration;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Convert;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.eclipse.persistence.annotations.UuidGenerator;
import net.resheim.eclipse.timekeeper.db.converters.LocalDateTimeAttributeConverter;
/*******************************************************************************
 * Copyright © 2016-2020 Torkild U. Resheim
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Torkild U. Resheim - initial API and implementation
 *******************************************************************************/
package net.resheim.eclipse.timekeeper.db.model;





/**
 * The {@link Activity} type represents a period of work on a task. It holds the
 * start time, and the stop time. An activity can stretch over several days,
 * however that should typically not be the case. Multiple activities can be
 * assign to the same {@link Task}, on the same day.
 * 
 * @author Torkild U. Resheim
 */
@Entity
@Table(name = "ACTIVITY")
@UuidGenerator(name = "uuid")
public class Activity implements Comparable<Activity>, Serializable {

	private static final long serialVersionUID = 7770745026684660897L;

	@Id
	@GeneratedValue(generator = "uuid")
	@Column(name = "ID")
	private String id;

	/** The time the activity was started */
	@Column(name = "START_TIME")
// Path: net.resheim.eclipse.timekeeper.db/src/main/java/net/resheim/eclipse/timekeeper/db/converters/LocalDateTimeAttributeConverter.java
// @Converter
// public class LocalDateTimeAttributeConverter implements AttributeConverter<LocalDateTime, Timestamp> {
// 
// 	@Override
// 	public Timestamp convertToDatabaseColumn(LocalDateTime locDateTime) {
// 		return (locDateTime == null ? null : Timestamp.valueOf(locDateTime));
// 	}
// 
// 	@Override
// 	public LocalDateTime convertToEntityAttribute(Timestamp sqlTimestamp) {
// 		return (sqlTimestamp == null ? null : sqlTimestamp.toLocalDateTime());
// 	}
// }


// Path: net.resheim.eclipse.timekeeper.db/src/main/java/net/resheim/eclipse/timekeeper/db/model/Activity.java
import java.io.Serializable;
import java.time.Duration;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Convert;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.eclipse.persistence.annotations.UuidGenerator;
import net.resheim.eclipse.timekeeper.db.converters.LocalDateTimeAttributeConverter;

/*******************************************************************************
 * Copyright © 2016-2020 Torkild U. Resheim
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Torkild U. Resheim - initial API and implementation
 *******************************************************************************/
package net.resheim.eclipse.timekeeper.db.model;





/**
 * The {@link Activity} type represents a period of work on a task. It holds the
 * start time, and the stop time. An activity can stretch over several days,
 * however that should typically not be the case. Multiple activities can be
 * assign to the same {@link Task}, on the same day.
 * 
 * @author Torkild U. Resheim
 */
@Entity
@Table(name = "ACTIVITY")
@UuidGenerator(name = "uuid")
public class Activity implements Comparable<Activity>, Serializable {

	private static final long serialVersionUID = 7770745026684660897L;

	@Id
	@GeneratedValue(generator = "uuid")
	@Column(name = "ID")
	private String id;

	/** The time the activity was started */
	@Column(name = "START_TIME")
	@Convert(converter = LocalDateTimeAttributeConverter.class)