Requirements
...
GET /v3/templates?type=<type>
get documents of type (type parameter is probably required)POST /v3/templates
create new document with a single default revision with default content. As we do now, we should have default content to pre-fill the first revision, just to help people get started. GET /v3/templates/<guid>
get specific documentPOST /v3/templates/<guid>
update specific document (not revisioned, but optimistically locked)DELETE /v3/templates/<guid>?physical=true
delete specific document (logical or physical); probably just leaves revisions on S3GET /v3/templates/<guid>/revisions
get the revisions for a document (createdOn DESC) for history of editsPOST /v3/templates/<guid>/revisions
create a new revision of the given document (cannot update an existing revision)GET /v3/templates/<guid>/revisions/<createdOn>
get a specific revision of a documentPOST /v3/templates/<guid>/revisions/<createdOn>/publish
publish this revision as the revision to use when the document is selected
...
Sorry the formatting here is difficult to read, due to Jira.
public interface TemplateService {
/**
* Given a criteria context and a template type, return all the templates that match. If one is found through a
...
Template getTemplateForUser(CriteriaContext context, TemplateType type);
/** Get all the templates for a given type. (I am assuming this will not need to be paged). */
List<Template> getTemplatesForType(StudyIdentifier studyId, TemplateType type, boolean includeDeleted);
/** Get a specific template. */
Template getTemplate(StudyIdentifier studyId, String guid);
/** Create a new template. */
GuidVersionHolder createTemplate(StudyIdentifier studyId, TemplateService template);
/**
* Update a template. You can delete it logically, and change the published revision of the associated document with this call as well.
...
GuidVersionHolder updateTemplate(StudyIdentifier studyId, TemplateService template);
/** Mark a template as deleted. */
void deleteTemplate(StudyIdentifier studyId, String guid);
/** Physically delete the template and all its revisions. */
void deleteTemplatePermanently(StudyIdentifier studyId, String guid);
/** Get a page of revisions from a SQL-type data store. */
PagedResourceList<TemplateRevision> getTemplateRevisions(StudyIdentifier studyId, String guid,
int offsetBy, int pageSize);
/** Get a specific revision. */
TemplateRevision getTemplateRevision(StudyIdentifier studyId, String guid, long createdOn);
/** Create a new revision (this should fail if the createdOn timestamp for a given studyId and GUID already exists). */
CreatedOnHolder createTemplateRevision(StudyIdentifier studyId, TemplateRevision templateRevision);
}
Migration
Can be done in three deployments:
...