-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Social files currently have four required attribute fields and can contain an arbitrary number of non mandatory attributes. The attributes are described by a header row in the sample file. Adds functionality to parse a social sample file, persist sample attributes and post attributes to collection exercise. When a file is uploaded it is parsed and validated. If valid, it will be saved to a sample attributes table in the sample database linked by the sample unit id (UUID). When a request is made for samples the sample unit and sample attributes and put on the sample delivery queue. We have added integration tests to exercise the upload functionality and ensure they are published to the queue with the sample attributes. **How to test:** Requires changes in these branches: ONSdigital/rm-samplesvc-api#11 ONSdigital/rm-party-service-api#11 You'll have to build them locally then point the pom file to those snapshots, this will block Travis from building until those changes are on master. Try loading a social sample through the endpoint using the loader script: #45 You should also try the loader script with a full example sample file, there is one available as an attachment on the story card: ![](https://github.trello.services/images/mini-trello-icon.png) [Dev task 1: INT: load a social sample file (13)](https://trello.com/c/lTUmPnuf/97-dev-task-1-int-load-a-social-sample-file-13) Also requires these changes before being merged: ONSdigital/rm-samplesvc-api#9 #42
- Loading branch information
1 parent
3dd1912
commit 47c08e7
Showing
29 changed files
with
834 additions
and
369 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
src/main/java/uk/gov/ons/ctp/response/sample/domain/model/SampleAttributes.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package uk.gov.ons.ctp.response.sample.domain.model; | ||
|
||
|
||
import com.vladmihalcea.hibernate.type.json.JsonBinaryType; | ||
import lombok.*; | ||
import net.sourceforge.cobertura.CoverageIgnore; | ||
import org.hibernate.annotations.Type; | ||
import org.hibernate.annotations.TypeDef; | ||
|
||
import javax.persistence.*; | ||
import java.io.Serializable; | ||
import java.util.Map; | ||
import java.util.UUID; | ||
|
||
/** | ||
* Domain model object. | ||
*/ | ||
@CoverageIgnore | ||
@Entity | ||
@Data | ||
@Builder | ||
@NoArgsConstructor(access = AccessLevel.PUBLIC) | ||
@AllArgsConstructor | ||
@TypeDef(name = "jsonb", typeClass = JsonBinaryType.class) | ||
@Table(name = "sampleattributes", schema = "sample") | ||
public class SampleAttributes implements Serializable { | ||
|
||
@Id | ||
@Column(name = "sampleunitfk") | ||
private UUID sampleUnitFK; | ||
|
||
@Column(name = "attributes", columnDefinition = "jsonb") | ||
@Type(type = "jsonb") | ||
private Map<String, String> attributes; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
...ain/java/uk/gov/ons/ctp/response/sample/domain/repository/SampleAttributesRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package uk.gov.ons.ctp.response.sample.domain.repository; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.stereotype.Repository; | ||
import uk.gov.ons.ctp.response.sample.domain.model.SampleAttributes; | ||
|
||
import java.util.UUID; | ||
|
||
|
||
/** | ||
* JPA Data Repository needed to persist Survey SampleAttributes | ||
*/ | ||
@Repository | ||
public interface SampleAttributesRepository extends JpaRepository<SampleAttributes, UUID> { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.