# Path: tmapi/exceptions.py
# class ModelConstraintException (TMAPIRuntimeException):
# 
#     """This exception is used to report Topic Maps - Data Model
#     constraint violations."""
# 
#     def __init__ (self, reporter, message):
#         """Creates a new ModelConstraintException with the specified
#         message.
# 
#         :param reporter: the construct which has thrown this exception
#         :type reporter: `Construct`
#         :param message: the detail message
#         :type message: string
# 
#         """
#         self._reporter = reporter
#         self._message = message
#     
#     def get_reporter (self):
#         """Return the `Construct` which has thrown the exception.
# 
#         :rtype: `Construct`
# 
#         """
#         return self._reporter


from django.db import models
from tmapi.exceptions import ModelConstraintException
from construct_fields import ConstructFields
from reifiable import Reifiable
from typed import Typed

        :rtype: `Association`

        """
        parent = self.association
        if proxy is not None:
            parent = proxy.objects.get(pk=parent.id)
        return parent

    def get_player (self, proxy=None):
        """Returns the topic playing this role.

        :rtype: `Topic`

        """
        player = self.player
        if proxy is not None:
            player = proxy.objects.get(pk=player.id)
        return player

    def set_player (self, player):
        """Sets the role player.

        Any previous role player will be overridden by `player`.

        :param player: the `Topic` which should play this role
        :type player: `Topic`

        """
        if player is None:

# Path: tmapi/exceptions.py
# class ModelConstraintException (TMAPIRuntimeException):
# 
#     """This exception is used to report Topic Maps - Data Model
#     constraint violations."""
# 
#     def __init__ (self, reporter, message):
#         """Creates a new ModelConstraintException with the specified
#         message.
# 
#         :param reporter: the construct which has thrown this exception
#         :type reporter: `Construct`
#         :param message: the detail message
#         :type message: string
# 
#         """
#         self._reporter = reporter
#         self._message = message
#     
#     def get_reporter (self):
#         """Return the `Construct` which has thrown the exception.
# 
#         :rtype: `Construct`
# 
#         """
#         return self._reporter


# Path: tmapi/models/role.py
from django.db import models
from tmapi.exceptions import ModelConstraintException
from construct_fields import ConstructFields
from reifiable import Reifiable
from typed import Typed


        :rtype: `Association`

        """
        parent = self.association
        if proxy is not None:
            parent = proxy.objects.get(pk=parent.id)
        return parent

    def get_player (self, proxy=None):
        """Returns the topic playing this role.

        :rtype: `Topic`

        """
        player = self.player
        if proxy is not None:
            player = proxy.objects.get(pk=player.id)
        return player

    def set_player (self, player):
        """Sets the role player.

        Any previous role player will be overridden by `player`.

        :param player: the `Topic` which should play this role
        :type player: `Topic`

        """
        if player is None:

            raise ModelConstraintException(self, 'The player may not be None')