-
Notifications
You must be signed in to change notification settings - Fork 0
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 #8 from AAFC-BICoE/Support-34788-Add-form-template…
…-and-split-configuration-support Support #34788 - Add form template and split configuration support
- Loading branch information
Showing
14 changed files
with
791 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# This file contains the FormTemplateAPI class used for interacting with the Form Template endpoint of the Collection API. | ||
from .collectionapi import CollectionModuleApi | ||
|
||
class FormTemplateAPI(CollectionModuleApi): | ||
""" | ||
Class for handling form template related DINA API requests. | ||
""" | ||
|
||
def __init__(self, config_path: str = None, base_url: str = None) -> None: | ||
""" | ||
Parameters: | ||
config_path (str, optional): Path to a config file (default: None). | ||
base_url (str, optional): URL to the URL to perform the API requests against. If not | ||
provided then local deployment URL is used. Should end with a forward slash. | ||
""" | ||
super().__init__(config_path, base_url) | ||
self.base_url += "form-template" | ||
|
||
|
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,19 @@ | ||
# This file contains the SplitConfigurationAPI class used for interacting with the Split Configuration endpoint of the Collection API. | ||
from .collectionapi import CollectionModuleApi | ||
|
||
class SplitConfigurationAPI(CollectionModuleApi): | ||
""" | ||
Class for handling split configuration related DINA API requests. | ||
""" | ||
|
||
def __init__(self, config_path: str = None, base_url: str = None) -> None: | ||
""" | ||
Parameters: | ||
config_path (str, optional): Path to a config file (default: None). | ||
base_url (str, optional): URL to the URL to perform the API requests against. If not | ||
provided then local deployment URL is used. Should end with a forward slash. | ||
""" | ||
super().__init__(config_path, base_url) | ||
self.base_url += "split-configuration" | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
class FormTemplateDTO: | ||
def __init__(self, id=None, type=None, attributes=None, relationships=None): | ||
self.id = id | ||
self.type = type | ||
self.attributes = attributes | ||
self.relationships = relationships | ||
|
||
def get_id(self): | ||
return self.id | ||
|
||
def get_type(self): | ||
return self.type | ||
|
||
class FormTemplateDTOBuilder: | ||
def __init__(self): | ||
self._id = None | ||
self._type = 'form-template' | ||
self._attributes = None | ||
self._relationships = None | ||
|
||
def set_id(self, id): | ||
self._id = id | ||
return self | ||
|
||
def set_type(self, type): | ||
self._type = type | ||
return self | ||
|
||
def set_attributes(self, attributes): | ||
self._attributes = attributes | ||
return self | ||
|
||
def set_relationships(self, relationships): | ||
self._relationships = relationships | ||
return self | ||
|
||
def build(self): | ||
return FormTemplateDTO(self._id, self._type, self._attributes, self._relationships) | ||
|
||
class FormTemplateAttributesDTO: | ||
def __init__( | ||
self, | ||
createdOn=None, | ||
createdBy=None, | ||
group=None, | ||
name=None, | ||
restrictToCreatedBy=None, | ||
viewConfiguration=None, | ||
components=None | ||
): | ||
self.createdOn = createdOn | ||
self.createdBy = createdBy | ||
self.group = group | ||
self.name = name | ||
self.restrictToCreatedBy = restrictToCreatedBy | ||
self.viewConfiguration = viewConfiguration | ||
self.components = components | ||
|
||
class FormTemplateAttributesDTOBuilder: | ||
def __init__(self): | ||
self._createdOn = 'undefined' | ||
self._createdBy = 'undefined' | ||
self._group = 'undefined' | ||
self._name = 'undefined' | ||
self._restrictToCreatedBy = 'undefined' | ||
self._viewConfiguration = 'undefined' | ||
self._components = 'undefined' | ||
|
||
def set_createdOn(self, createdOn): | ||
self._createdOn = createdOn | ||
return self | ||
|
||
def set_createdBy(self, createdBy): | ||
self._createdBy = createdBy | ||
return self | ||
|
||
def set_group(self, group): | ||
self._group = group | ||
return self | ||
|
||
def set_name(self, name): | ||
self._name = name | ||
return self | ||
|
||
def set_restrictToCreatedBy(self, restrictToCreatedBy): | ||
self._restrictToCreatedBy = restrictToCreatedBy | ||
return self | ||
|
||
def set_viewConfiguration(self, viewConfiguration): | ||
self._viewConfiguration = viewConfiguration | ||
return self | ||
|
||
def set_components(self, components): | ||
self._components = components | ||
return self | ||
|
||
def build(self): | ||
return FormTemplateAttributesDTO( | ||
self._createdOn, | ||
self._createdBy, | ||
self._group, | ||
self._name, | ||
self._restrictToCreatedBy, | ||
self._viewConfiguration, | ||
self._components | ||
) |
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,117 @@ | ||
class SplitConfigurationDTO: | ||
def __init__(self, id=None, type=None, attributes=None, relationships=None): | ||
self.id = id | ||
self.type = type | ||
self.attributes = attributes | ||
self.relationships = relationships | ||
|
||
def get_id(self): | ||
return self.id | ||
|
||
def get_type(self): | ||
return self.type | ||
|
||
|
||
class SplitConfigurationDTOBuilder: | ||
def __init__(self): | ||
self._id = None | ||
self._type = 'split-configuration' | ||
self._attributes = None | ||
self._relationships = None | ||
|
||
def set_attributes(self, attributes): | ||
self._attributes = attributes | ||
return self | ||
|
||
def set_relationships(self, relationships): | ||
self._relationships = relationships | ||
return self | ||
|
||
def build(self): | ||
return SplitConfigurationDTO(self._id, self._type, self._attributes, self._relationships) | ||
|
||
|
||
class SplitConfigurationAttributesDTO: | ||
def __init__( | ||
self, | ||
createdOn=None, | ||
createdBy=None, | ||
group=None, | ||
name=None, | ||
strategy=None, | ||
conditionalOnMaterialSampleTypes=None, | ||
characterType=None, | ||
separator=None, | ||
materialSampleTypeCreatedBySplit=None | ||
): | ||
self.createdOn = createdOn | ||
self.createdBy = createdBy | ||
self.group = group | ||
self.name = name | ||
self.strategy = strategy | ||
self.conditionalOnMaterialSampleTypes = conditionalOnMaterialSampleTypes | ||
self.characterType = characterType | ||
self.separator = separator | ||
self.materialSampleTypeCreatedBySplit = materialSampleTypeCreatedBySplit | ||
|
||
|
||
class SplitConfigurationAttributesDTOBuilder: | ||
def __init__(self): | ||
self._createdOn = 'undefined' | ||
self._createdBy = 'undefined' | ||
self._group = 'undefined' | ||
self._name = 'undefined' | ||
self._strategy = 'undefined' | ||
self._conditionalOnMaterialSampleTypes = 'undefined' | ||
self._characterType = 'undefined' | ||
self._separator = 'undefined' | ||
self._materialSampleTypeCreatedBySplit = 'undefined' | ||
|
||
def set_createdOn(self, createdOn): | ||
self._createdOn = createdOn | ||
return self | ||
|
||
def set_createdBy(self, createdBy): | ||
self._createdBy = createdBy | ||
return self | ||
|
||
def set_group(self, group): | ||
self._group = group | ||
return self | ||
|
||
def set_name(self, name): | ||
self._name = name | ||
return self | ||
|
||
def set_strategy(self, strategy): | ||
self._strategy = strategy | ||
return self | ||
|
||
def set_conditionalOnMaterialSampleTypes(self, conditionalOnMaterialSampleTypes): | ||
self._conditionalOnMaterialSampleTypes = conditionalOnMaterialSampleTypes | ||
return self | ||
|
||
def set_characterType(self, characterType): | ||
self._characterType = characterType | ||
return self | ||
|
||
def set_separator(self, separator): | ||
self._separator = separator | ||
return self | ||
|
||
def set_materialSampleTypeCreatedBySplit(self, materialSampleTypeCreatedBySplit): | ||
self._materialSampleTypeCreatedBySplit = materialSampleTypeCreatedBySplit | ||
return self | ||
|
||
def build(self): | ||
return SplitConfigurationAttributesDTO( | ||
self._createdOn, | ||
self._createdBy, | ||
self._group, | ||
self._name, | ||
self._strategy, | ||
self._conditionalOnMaterialSampleTypes, | ||
self._characterType, | ||
self._separator, | ||
self._materialSampleTypeCreatedBySplit | ||
) |
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.