def _updateRepositoryAttributes(self, data, **kwargs):
     try:
         self.call.updateRepositoryAttributes(**data.asDict())
     except Exception as e:
         yield response(False, message=str(e))
         return
     yield response(True)
 def _deleteTarget(self, data, **kwargs):
     try:
         self.call.deleteTarget(identifier=data.identifier,
                                domainId=data.domainId)
     except Exception as e:
         yield response(False, message=str(e))
         return
     yield response(True)
 def _addTarget(self, data, **kwargs):
     try:
         self.call.addTarget(name=data.name,
                             domainId=data.domainId,
                             targetType=data.targetType)
     except Exception as e:
         yield response(False, message=str(e))
         return
     yield response(True)
    def _addRepositoryGroup(self, data, **kwargs):
        try:
            self.call.addRepositoryGroup(identifier=data.identifier,
                                         domainId=data.domainId)
        except Exception as e:
            yield response(False, message=str(e))
            return

        yield response(True)
 def _addMapping(self, data, **kwargs):
     try:
         self.call.addMapping(
             name=data.name,
             domainId=data.domainId,
         )
     except Exception as e:
         yield response(False, message=str(e))
         return
     yield response(True)
 def _deleteReppositoryClosingHours(self, data, **kwargs):
     try:
         self.call.deleteClosingHours(
             identifier=data.repositoryId,
             domainId=data.domainId,
             closingHoursIndex=data.closingHour,
         )
     except Exception as e:
         yield response(False, message=str(e))
         return
     yield response(True)
 def _deleteRepository(self, data, **kwargs):
     try:
         self.call.deleteRepository(
             identifier=data.identifier,
             domainId=data.domainId,
             repositoryGroupId=data.repositoryGroupId,
         )
     except Exception as e:
         yield response(False, message=str(e))
         return
     yield response(True)
 def _addRepositoryClosingHours(self, data, **kwargs):
     try:
         self.call.addClosingHours(identifier=data.repositoryId,
                                   domainId=data.domainId,
                                   week=data.week,
                                   day=data.day,
                                   startHour=data.startHour,
                                   endHour=data.endHour)
     except Exception as e:
         yield response(False, message=str(e))
         return
     yield response(True)
 def _updateFieldDefinition(self, data, **kwargs):
     fieldDefinition = data.fieldDefinition
     try:
         fieldDefinition = loads(fieldDefinition)
         self.call.updateFieldDefinition(domainId=data.domainId,
                                         data=fieldDefinition)
     except JSONDecodeError:
         yield response(False, message="Ongeldige JSON")
         return
     except Exception as e:
         yield response(False, message=str(e))
         return
     yield response(True)
 def _updateMapping(self, data, **kwargs):
     try:
         self.call.updateMapping(
             identifier=data.identifier,
             domainId=data.domainId,
             name=data.name,
             description=data.description,
             code=(data.code or '').replace('\r', ''),
         )
     except Exception as e:
         yield response(False, message=str(e))
         return
     yield response(True)
 def _updateRepositoryActionAttributes(self, data, **kwargs):
     try:
         values = data.asDict()
         values['use'] = not values['use'] is None
         values['complete'] = not values['complete'] is None
         values['action'] = values[
             'action'] if values['action'] != "-" else None
         if values['maximumIgnore'] is None:
             values['maximumIgnore'] = 0
         self.call.updateRepositoryAttributes(**values)
     except Exception as e:
         yield response(False, message=str(e))
         return
     yield response(True)
 def _updateRepositoryGroup(self, data, **kwargs):
     try:
         self.call.updateRepositoryGroup(
             identifier=data.identifier,
             domainId=data.domainId,
             name={
                 'nl': data.nl_name,
                 'en': data.en_name,
             },
         )
     except Exception as e:
         yield response(False, message=str(e))
         return
     yield response(True)
 def _updateTarget(self, data, **kwargs):
     try:
         self.call.updateTarget(
             identifier=data.identifier,
             domainId=data.domainId,
             name=data.name,
             username=data.username,
             port=data.port,
             targetType=data.targetType,
             path=data.path,
             baseurl=data.baseurl,
             oaiEnvelope=not data.oaiEnvelope is None,
             delegateIds=data.delegateIds or [],
         )
     except Exception as e:
         yield response(False, message=str(e))
         print(data)
         raise
         return
     yield response(True)
 def _updateDomain(self, data, **kwargs):
     self.call.updateDomain(identifier=data.identifier,
                            description=data.description)
     yield response(True)
 def _addDomain(self, data, **kwargs):
     self.call.addDomain(identifier=data.identifier)
     yield response(True)