class AssignmentRules(MetadataType):
    ''' AssignmentRules Metadata Implementation '''
    TAG_NAME = 'AssignmentRules'
    PACKAGE_NAME = 'AssignmentRules'
    CHILD_OBJECTS = get_child_objects(__name__)
    FOLDER_NAME = 'assignmentRules'
    EXTENSION_NAME = 'assignmentRules'
    CHILD_SEPARATOR = '.'
Beispiel #2
0
class SharingRules(MetadataType):
    ''' Custom Object Class Implementation '''
    TAG_NAME = 'SharingRules'
    PACKAGE_NAME = 'SharingRules'
    CHILD_OBJECTS = get_child_objects(__name__)
    FOLDER_NAME = 'sharingRules'
    EXTENSION_NAME = 'sharingRules'
    CHILD_SEPARATOR = '.'
Beispiel #3
0
class EscalationRules(MetadataType):
    ''' Custom Labels Metadata Implementation '''
    TAG_NAME = 'EscalationRules'
    PACKAGE_NAME = 'EscalationRules'
    CHILD_OBJECTS = get_child_objects(__name__)
    FOLDER_NAME = 'escalationRules'
    EXTENSION_NAME = 'escalationRules'
    CHILD_SEPARATOR = '.'
Beispiel #4
0
class Workflow(MetadataType):
    ''' PermissionSet Class Implementation '''
    TAG_NAME = 'Workflow'
    PACKAGE_NAME = 'Workflow'
    CHILD_OBJECTS = get_child_objects(__name__)
    FOLDER_NAME = 'workflows'
    EXTENSION_NAME = 'workflow'
    CHILD_SEPARATOR = '.'
class CustomLabels(MetadataType):
    ''' Custom Labels Metadata Implementation '''
    TAG_NAME = 'CustomLabels'
    PACKAGE_NAME = 'CustomLabels'
    CHILD_OBJECTS = get_child_objects(__name__)
    FOLDER_NAME = 'labels'
    EXTENSION_NAME = 'labels'
    HAS_PREFIX = False
    CHILD_SEPARATOR = '.'
Beispiel #6
0
class PermissionSet(MetadataType):
    ''' PermissionSet Class Implementation '''
    TAG_NAME = 'PermissionSet'
    PACKAGE_NAME = 'PermissionSet'
    CHILD_OBJECTS = get_child_objects(__name__)
    FOLDER_NAME = 'permissionsets'
    EXTENSION_NAME = 'permissionset'
    CHILD_SEPARATOR = '.'
    MINIMUM_VALUES = {'label'}
class Object(MetadataType):
    ''' Custom Object Class Implementation '''
    TAG_NAME = 'CustomObject'
    PACKAGE_NAME = 'CustomObject'
    CHILD_OBJECTS = get_child_objects(__name__)
    MINIMUM_VALUES = set()
    FOLDER_NAME = 'objects'
    EXTENSION_NAME = 'object'
    CHILD_SEPARATOR = '.'

    def _add_minimum_values(self, news, builders):
        ''' Add minimum values to the news dictionary '''
        for key, value in getattr(self, CustomField.TAG_NAME, {}).items():
            if (hasattr(value, 'type')
                    and getattr(value, 'type') == 'MasterDetail'):
                isAdded = False
                for keyValue, itemsValue in getattr(
                        self, CustomField.TAG_NAME).items():
                    if keyValue == key:
                        isAdded = True
                if not isAdded:
                    if f'{CustomField.TAG_NAME}' not in news:
                        news[f'{CustomField.TAG_NAME}'] = set()
                    news[f'{CustomField.TAG_NAME}'].add(value)
                    self._added_values.add(value)
        super()._add_minimum_values(news, builders)

    def downcast(self):
        if (self._apiname.endswith('__c')
                and CustomSetting.CUSTOMSETTING_TAG in self.__dict__):
            self.__class__ = CustomSetting
        elif self._apiname.endswith('__c'):
            self.__class__ = CustomObject
        elif self._apiname.endswith('__x'):
            self.__class__ = ExternalObject
        elif self._apiname.endswith('__b'):
            self.__class__ = BigObject
        elif self._apiname.endswith('__mdt'):
            self.__class__ = CustomMetadataType
        elif self._apiname.endswith('__kav'):
            self.__class__ = ArticleType
        else:
            self.__class__ = StandardObject

    def get_display_name(self):
        return f'CustomObject-{self.__class__.__name__}'
class Profile(MetadataType):
    ''' Profile Class Implementation '''
    TAG_NAME = 'Profile'
    PACKAGE_NAME = 'Profile'
    CHILD_OBJECTS = get_child_objects(__name__)
    FOLDER_NAME = 'profiles'
    EXTENSION_NAME = 'profile'
    CHILD_SEPARATOR = '.'

    def __init__(self,
                 apiname,
                 filestring=None,
                 filepath=None,
                 _differences=None,
                 _composed=True,
                 **kwargs):
        super().__init__(apiname,
                         filestring,
                         filepath,
                         _differences,
                         _composed=False,
                         **kwargs)