tech.jhipster.lite.project.infrastructure.secondary.PersistedProjectHistory Maven / Gradle / Ivy
package tech.jhipster.lite.project.infrastructure.secondary;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Collection;
import tech.jhipster.lite.project.domain.ProjectPath;
import tech.jhipster.lite.project.domain.history.ProjectHistory;
final class PersistedProjectHistory {
private final Collection actions;
private PersistedProjectHistory(@JsonProperty("actions") Collection actions) {
this.actions = actions;
}
static PersistedProjectHistory from(ProjectHistory history) {
return new PersistedProjectHistory(history.actions().stream().map(PersistedProjectAction::from).toList());
}
public ProjectHistory toDomain(ProjectPath path) {
return new ProjectHistory(path, getActions().stream().map(PersistedProjectAction::toDomain).toList());
}
public Collection getActions() {
return actions;
}
}