コード例 #1
0
ファイル: importer.py プロジェクト: AnjaliWadhwa/oclapi
  def update_concept_retired_status(self, concept, new_retired_state):
      """ Updates and persists a new retired status for a concept """

      # Do nothing if retired status is unchanged
      concept_version = ConceptVersion.get_latest_version_of(concept)
      if concept_version.retired == new_retired_state:
          return ImportActionHelper.IMPORT_ACTION_NONE

      # Retire/un-retire the concept
      if new_retired_state:
          if not self.test_mode:
              errors = Concept.retire(concept, self.user)
              if errors:
                  raise IllegalInputException('Failed to retire concept due to %s' % errors)
          return ImportActionHelper.IMPORT_ACTION_RETIRE
      else:
          if not self.test_mode:
              errors = Concept.unretire(concept, self.user)
              if errors:
                  raise IllegalInputException('Failed to un-retire concept due to %s' % errors)
          return ImportActionHelper.IMPORT_ACTION_UNRETIRE
コード例 #2
0
ファイル: importer.py プロジェクト: wandesky/oclapi
    def update_concept_retired_status(self, concept, new_retired_state):
        """ Updates and persists a new retired status for a concept """

        # Do nothing if retired status is unchanged
        concept_version = ConceptVersion.get_latest_version_of(concept)
        if concept_version.retired == new_retired_state:
            return ImportActionHelper.IMPORT_ACTION_NONE

        # Retire/un-retire the concept
        if new_retired_state:
            if not self.test_mode:
                errors = Concept.retire(concept, self.user)
                if errors:
                    raise IllegalInputException(
                        'Failed to retire concept due to %s' % errors)
            return ImportActionHelper.IMPORT_ACTION_RETIRE
        else:
            if not self.test_mode:
                errors = Concept.unretire(concept, self.user)
                if errors:
                    raise IllegalInputException(
                        'Failed to un-retire concept due to %s' % errors)
            return ImportActionHelper.IMPORT_ACTION_UNRETIRE