-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #649 from DwayneJengSage/develop
BRIDGE-3389 Upload Status API for EX3
- Loading branch information
Showing
30 changed files
with
1,655 additions
and
123 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
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
16 changes: 16 additions & 0 deletions
16
src/main/java/org/sagebionetworks/bridge/dynamodb/ExportedRecordInfoMapMarshaller.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 org.sagebionetworks.bridge.dynamodb; | ||
|
||
import java.util.Map; | ||
|
||
import com.fasterxml.jackson.core.type.TypeReference; | ||
|
||
import org.sagebionetworks.bridge.models.exporter.ExportedRecordInfo; | ||
|
||
public class ExportedRecordInfoMapMarshaller extends StringKeyMapMarshaller<ExportedRecordInfo> { | ||
private static final TypeReference<Map<String, ExportedRecordInfo>> REF = new TypeReference<Map<String, ExportedRecordInfo>>() { | ||
}; | ||
|
||
@Override public TypeReference<Map<String, ExportedRecordInfo>> getTypeReference() { | ||
return REF; | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
src/main/java/org/sagebionetworks/bridge/dynamodb/ExportedRecordInfoMarshaller.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,10 @@ | ||
package org.sagebionetworks.bridge.dynamodb; | ||
|
||
import org.sagebionetworks.bridge.models.exporter.ExportedRecordInfo; | ||
|
||
public class ExportedRecordInfoMarshaller extends JsonMarshaller<ExportedRecordInfo> { | ||
@Override | ||
public Class<ExportedRecordInfo> getConvertedClass() { | ||
return ExportedRecordInfo.class; | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
src/main/java/org/sagebionetworks/bridge/dynamodb/JsonMarshaller.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,45 @@ | ||
package org.sagebionetworks.bridge.dynamodb; | ||
|
||
import java.io.IOException; | ||
|
||
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMappingException; | ||
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBTypeConverter; | ||
import com.fasterxml.jackson.core.JsonProcessingException; | ||
|
||
import org.sagebionetworks.bridge.json.BridgeObjectMapper; | ||
|
||
/** | ||
* Generic JSON marshaller for DynamoDB. This converts the object into JSON for marshalling to DynamoDB. Because | ||
* DynamoDB annotations don't work with generics, you'll need to subclass this and fill in getConvertedClass(). | ||
*/ | ||
public abstract class JsonMarshaller<T> implements DynamoDBTypeConverter<String, T> { | ||
/** | ||
* Returns the class for Jackson to deserialize the value from DynamoDB, because Java can't infer generic types at | ||
* runtime. | ||
*/ | ||
public abstract Class<T> getConvertedClass(); | ||
|
||
@Override | ||
public String convert(T t) { | ||
if (t == null) { | ||
return null; | ||
} | ||
try { | ||
return BridgeObjectMapper.get().writerWithDefaultPrettyPrinter().writeValueAsString(t); | ||
} catch (JsonProcessingException ex) { | ||
throw new DynamoDBMappingException(ex); | ||
} | ||
} | ||
|
||
@Override | ||
public T unconvert(String json) { | ||
if (json == null) { | ||
return null; | ||
} | ||
try { | ||
return BridgeObjectMapper.get().readValue(json, getConvertedClass()); | ||
} catch (IOException ex) { | ||
throw new DynamoDBMappingException(ex); | ||
} | ||
} | ||
} |
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
55 changes: 55 additions & 0 deletions
55
src/main/java/org/sagebionetworks/bridge/models/exporter/ExportedRecordInfo.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,55 @@ | ||
package org.sagebionetworks.bridge.models.exporter; | ||
|
||
/** Info about a health data record that was exported to Synapse. */ | ||
public class ExportedRecordInfo { | ||
private String parentProjectId; | ||
private String rawFolderId; | ||
private String fileEntityId; | ||
private String s3Bucket; | ||
private String s3Key; | ||
|
||
/** Synapse project that the health data is exported to. */ | ||
public String getParentProjectId() { | ||
return parentProjectId; | ||
} | ||
|
||
public void setParentProjectId(String parentProjectId) { | ||
this.parentProjectId = parentProjectId; | ||
} | ||
|
||
/** Synapse folder that the health data is exported to. */ | ||
public String getRawFolderId() { | ||
return rawFolderId; | ||
} | ||
|
||
public void setRawFolderId(String rawFolderId) { | ||
this.rawFolderId = rawFolderId; | ||
} | ||
|
||
/** Synapse file entity of the health data that is exported. */ | ||
public String getFileEntityId() { | ||
return fileEntityId; | ||
} | ||
|
||
public void setFileEntityId(String fileEntityId) { | ||
this.fileEntityId = fileEntityId; | ||
} | ||
|
||
/** S3 bucket that contains the exported health data. */ | ||
public String getS3Bucket() { | ||
return s3Bucket; | ||
} | ||
|
||
public void setS3Bucket(String s3Bucket) { | ||
this.s3Bucket = s3Bucket; | ||
} | ||
|
||
/** S3 key that of the exported health data. */ | ||
public String getS3Key() { | ||
return s3Key; | ||
} | ||
|
||
public void setS3Key(String s3Key) { | ||
this.s3Key = s3Key; | ||
} | ||
} |
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.