From 1db6a3ae7b1febb64376d38dd5be119b0aa84b90 Mon Sep 17 00:00:00 2001 From: insanity Date: Tue, 15 Nov 2016 18:55:51 +0900 Subject: [PATCH] Collector --- .../bridge/collector/entity/Collector.java | 107 +++++++++++++++++- .../repository/CollectorRepository.java | 8 +- 2 files changed, 113 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/loafle/bridge/collector/entity/Collector.java b/src/main/java/com/loafle/bridge/collector/entity/Collector.java index 51c2a10..57a8af1 100644 --- a/src/main/java/com/loafle/bridge/collector/entity/Collector.java +++ b/src/main/java/com/loafle/bridge/collector/entity/Collector.java @@ -1,7 +1,112 @@ package com.loafle.bridge.collector.entity; +import javax.persistence.*; +import java.util.Date; + /** * Created by root on 16. 11. 15. */ -public class Collector { + +enum License { + LICENSE1, + LICENSE2, + LICENSE3, + LICENSE4, + LICENSE5; +} + +@Entity +public class Collector { + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private long id; + + @Column(nullable = false) + private String productId; + + @Column(columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", nullable = false, insertable = false, updatable = false) + private Date installedDate; + + @Column(columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") + private Date updatedDate; + + @Enumerated(EnumType.STRING) + private License licenseType; + + @Column(columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP") + private Date licenseDueDate; + + @Column(nullable = false) + private String configPath; + + @Column(nullable = false) + private String collectorVersion; + + public Collector() { + } + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public String getProductId() { + return productId; + } + + public void setProductId(String productId) { + this.productId = productId; + } + + public Date getInstalledDate() { + return installedDate; + } + + public void setInstalledDate(Date installedDate) { + this.installedDate = installedDate; + } + + public License getLicenseType() { + return licenseType; + } + + public void setLicenseType(License licenseType) { + this.licenseType = licenseType; + } + + public Date getLicenseDueDate() { + return licenseDueDate; + } + + public void setLicenseDueDate(Date licenseDueDate) { + this.licenseDueDate = licenseDueDate; + } + + public String getConfigPath() { + return configPath; + } + + public void setConfigPath(String configPath) { + this.configPath = configPath; + } + + public String getCollectorVersion() { + return collectorVersion; + } + + public void setCollectorVersion(String collectorVersion) { + this.collectorVersion = collectorVersion; + } + + public Date getUpdatedDate() { + return updatedDate; + } + + public void setUpdatedDate(Date updatedDate) { + this.updatedDate = updatedDate; + } } diff --git a/src/main/java/com/loafle/bridge/collector/repository/CollectorRepository.java b/src/main/java/com/loafle/bridge/collector/repository/CollectorRepository.java index aecd290..ca1d43a 100644 --- a/src/main/java/com/loafle/bridge/collector/repository/CollectorRepository.java +++ b/src/main/java/com/loafle/bridge/collector/repository/CollectorRepository.java @@ -1,7 +1,13 @@ package com.loafle.bridge.collector.repository; +import com.loafle.bridge.collector.entity.Collector; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.rest.core.annotation.RepositoryRestResource; + /** * Created by root on 16. 11. 15. */ -public class CollectorRepository { +@RepositoryRestResource(collectionResourceRel = "collector", path = "collector") +public interface CollectorRepository extends JpaRepository { + }