Ejemplo n.º 1
0
 def _known_versions(cls):
     return {
         1: {
             'type': 'array',
             'items': {
                 'type': 'record',
                 'name': 'FieldDataError',
                 'fields': [
                     field('Blobname', 'string', doc='Blob Name'),
                     field('Error', 'string', doc='Error'),
                 ]
             },
         },
         2: {
             'type': 'array',
             'items': {
                 'type': 'record',
                 'name': 'FieldDataError',
                 'fields': [
                     field('Blobname', 'string', doc='Blob Name'),
                     cls._location_field,  # from LocationSetMixin
                     field('Error', 'string', doc='Error'),
                 ]
             },
         },
     }
Ejemplo n.º 2
0
class LocationSetMixin:
    """Mixin for events containing data about the location of the asset. Provides attribute _location_field, a record
    containing Latitude and Longitude float fields, which it expects/validates at the top level of the event record.
    This Location can be None if no location data is available.
    """

    _location_field = field('Location', ['null', {
        'type': 'record',
        'name': 'Location',
        'fields': [
            field('Latitude', 'float', doc='Asset latitude'),
            field('Longitude', 'float', doc='Asset longitude')
        ]
    }], doc='Asset location')

    __coordinate_dimensions = {'Latitude': (-90.0, 90.0), 'Longitude': (-180.0, 180.0)}

    def _validate_data(self):
        super()._validate_data()

        # TODO: restructure FieldDataErrorSet so wrapping array for SuccessSet is unnecessary
        data = self.data if isinstance(self.data, list) else [self.data]
        for item in data:
            self.__check_location(item)

    @classmethod
    def __check_location(cls, data):
        location = data['Location']
        if location is None:
            return
        for coordinate, (minval, maxval) in cls.__coordinate_dimensions.items():
            assert isinstance(location[coordinate], float)
            assert minval <= location[coordinate] <= maxval
Ejemplo n.º 3
0
 def _known_versions(cls):
     return {
         1: {
             'type': 'record',
             'name': 'TalendFirmware',
             'fields': [
                 field('serialNumber', 'string'),
                 field('version', 'string')
             ]
         }
     }
Ejemplo n.º 4
0
 def _known_versions(cls):
     return {
         1: {
             'type': 'record',
             'name': 'FieldDataSuccess',
             'fields': [
                 field('Blobname', 'string', doc='Blob Name'),
             ]
         },
         2: {
             'type': 'record',
             'name': 'FieldDataSuccess',
             'fields': [
                 field('Blobname', 'string', doc='Blob Name'),
                 cls._location_field,  # from LocationSetMixin
             ]
         },
     }
Ejemplo n.º 5
0
 def _known_versions(cls):
     return {
         1: {
             'type': 'array',
             'items': {
                 'type': 'record',
                 'name': 'TalendTimDocument',
                 'fields': [
                     field('documentLabel', 'string', doc='Document Label'),
                     field('documentName', 'string', doc='Document Name'),
                     field('documentDescription', 'string',
                           doc='Document Description'),
                     field('documentType', 'string', doc='Document Type'),
                     field('enterDate', 'string', doc='Document Date')
                 ]
             }
         }
     }
Ejemplo n.º 6
0
 def _known_versions(cls):
     return {
         1: {
             'type': 'array',
             'items': {
                 'type': 'record',
                 'name': 'SapBomAsBuilt',
                 'fields': [
                     field('ParRecno', 'string',
                           doc='IB: Unique record number'),
                     field('SonRecno', 'string',
                           doc='IB: Unique record number'),
                     field('Matnr', 'string', doc='Material Number'),
                     field('Sernr', 'string', doc='IB: Serial numbers'),
                     field('Descr', 'string',
                           doc='IB: IBase Short Text/Description'),
                     field('Valfr', 'string', doc='Valid from'),
                     field('Valto', 'string', doc='Valid to'),
                     field('Yyemrel', 'string', doc='Emission relevance')
                 ]
             }
         }
     }
Ejemplo n.º 7
0
    def _known_versions(cls):
        return {
            1: {
                {
                    'type': 'record',
                    'name': 'WeatherInfoSet',
                    'fields': [
                        field("WeatherType", "string"),
                        field("Position", "string"),
                        field("WindSpeed", "float"),
                        field("WindDirection", "float"),
                        field("WindGust", "float"),
                        field("Humidity", "float"),
                        field("Visibility", "string"),
                        field("Temperature", "float"),
                        field("FeelsLikeTemperature", "float"),
                        field("MaxUVIndex", "float"),
                        field("PrecipitationProbability", "string"),
                        field("WeatherStation", "KETTERING, ENGLAND"),
                        field("WeatherProvider", "mettofice_forecast"),
                        cls._location_field,  # from LocationSetMixin


                    ]
            }

        }
}
Ejemplo n.º 8
0
 def _known_versions(cls):
     return {
         1: {
             'type': 'array',
             'items': {
                 'type': 'record',
                 'name': 'SapWarrantyRecall',
                 'fields': [
                     field('Pnguid', 'string',
                           doc='Internal Number of iPPE Node'),
                     field('Pncnt', 'string', doc='Internal Counter'),
                     field('HPntext', 'string',
                           doc='Text in Warranty Claim Header'),
                     field('Clmno', 'string', doc='Number of Warranty Claim'),
                     field('Clmty', 'string', doc='Category'),
                     field(
                         'Refdt', [{'type': 'long', 'logicalType': 'date'}], doc='Reference Date'),
                     field('Refno', 'string', doc='External Number of Claim'),
                     field('Sernr', 'string', doc='Serial Number'),
                     field('Equnr', 'string', doc='Equipment Number'),
                     field('Parnr', 'string', doc='Partner'),
                     field('Astate', 'string',
                           doc='Processing Status of Warranty Claim'),
                     field(
                         'Abdes', 'string', doc='Description of Processing Status of Warranty Claim'),
                     field('YywtyState', 'string',
                           doc='TOGA: Warranty status'),
                     field('YycifPrio', 'string',
                           doc='TOGA: Priority of corrective action'),
                     field('YycifPriotxt', 'string',
                           doc='TOGA: Priority of corrective action'),
                     field(
                         'Yyroopen', 'string', doc='TOGA: Repair order open date (date the customer complaint ha'),
                     field('Yyroclosed', 'string',
                           doc='TOGA: Repair order closed date'),
                     field('YydueDate', 'string', doc='Due Date'),
                     field('Yysystfir', 'string',
                           doc='TOGA: FI system reimbursement'),
                     field('Yyclmtype', 'string', doc='Claim type'),
                     field('Yyclmtypetxt', 'string',
                           doc='TOGA: Claim type'),
                     field('Yyrepcountry', 'string',
                           doc='TOGA: Repair Country'),
                     field('DocLink', 'string', doc='Documentation Object')
                 ]
             }
         }
     }
Ejemplo n.º 9
0
 def _known_versions(cls):
     return {
         1: {
             'type': 'record',
             'name': 'SapMasterData',
             'fields': [
                 field('EqunrAgg', 'string', doc='Equipment Number'),
                 field('MaktxAgg', 'string', doc=''),
                 field('MatnrAgg', 'string', doc='Material Number'),
                 field('MaktxEng', 'string',
                       doc='Material Description Short Text'),
                 field('SernrAgg', 'string', doc='Serial Number'),
                 field('Name1', 'string', doc='Customer Name'),
                 field('EqunrEng', 'string', doc='Equipment Number'),
                 field('MatnrEng', 'string', doc='Material Number'),
                 field('SernrEng', 'string', doc='Serial Number'),
                 field('Kunde', 'string',
                       doc='Customer to Whom Serial Number was Delivered'),
                 field(
                     'Datab', [{'type': 'long', 'logicalType': 'date'}], doc='Valid From Date'),
                 field(
                     'Datbi', [{'type': 'long', 'logicalType': 'date'}], doc='Valid To Date'),
                 field('Yybau', 'string', doc='Engine series')
             ]
         }
     }
Ejemplo n.º 10
0
 def _known_versions(cls):
     return {
         1: {
             "type": "record",
             "name": "SapEquipmentHistory",
             "fields": [
                 field('Sernr', 'string', doc='Serial number'),
                 field('Equnr', 'string', doc='Equipment Number'),
                 field('Obknr', 'long', doc='Object list number'),
                 field('Docnr', 'string', doc='Business Document Number'),
                 field('Docitm', 'string',
                       doc='Business Document item number'),
                 field(
                     'Datum', [{'type': 'long', 'logicalType': 'date'}], doc='Date'),
                 field('Doctype', 'string', doc='Doctype'),
                 field('Ktext', 'string', doc='Description'),
                 field('Documents', {
                     "type": "array",
                     "items": {
                         "type": "record",
                         "name": "Documents",
                         "fields": [
                             field('Equnr', 'string',
                                   doc='Equipment Number'),
                             field('Instid', 'string',
                                   doc='Instance Ident. in BOR Compat. Persistent Object References'),
                             field(
                                 'Docnam', 'string', doc='Name of document, folder or distribution list'),
                             field('Docdes', 'string',
                                   doc='Short description of contents'),
                             field(
                                 'Docla', 'string', doc='Language in Which Document Is Created'),
                             field(
                                 'Crdat', [{'type': 'long', 'logicalType': 'date'}], doc='Date created'),
                             field(
                                 'Chdat', [{'type': 'long', 'logicalType': 'date'}], doc='Last Changed On'),
                             field('FileExt', 'string',
                                   doc='File extension for PC application')
                         ]
                     }
                 })
             ]
         }
     }