Requirements
...
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
...
TemplateService getTemplateForUser(CriteriaContext context, TemplateType type);
/** Get all the templates for a given type. (I am assuming this will not need to be paged). */
List<TemplateService> getTemplatesForType(StudyIdentifier studyId, TemplateType type);
/** Get a specific template. */
TemplateService getTemplate(StudyIdentifier studyId, String guid);
/** Create a new template. */
GuidVersionHolder createTemplate(StudyIdentifier studyId, TemplateService template);
/**
* Update a template. You can delete it logically, change the published revision of the associated document, and you
...
GuidVersionHolder updateTemplate(StudyIdentifier studyId, TemplateService template);
/** Delete a template. */
void deleteTemplate(StudyIdentifier studyId, String guid);
/** Physically delete the template (probably leaving the 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:
1) Switch over to the new template system (server, SDK, BSM), but when reading a template, if there's no default template, have TemplateService read from the study object. Writes go forward as usual and are used thereafter. The *history* of revisions at this point will not be 100% accurate but all data and changes will be used correctly.
2) Go back and create default templates for each study, deleting the study object templates (we can have this script ready and do it shortly after #1);
3) Delete the fields in the study object itself and remove the bridge back to the study object.