# Path: arangodb/transaction/action.py
# class DocumentAction(TransactionAction):
#     """
#     """
# 
#     def __init__(self, action_type, collection_name, document_data, _id=''):
#         """
#         """
# 
#         super(DocumentAction, self).__init__(action_type)
# 
#         self.collection_name = collection_name
#         self.document_data = document_data
#         self._id = _id
# 
#     @classmethod
#     def create(cls, collection_name, document_data):
#         """
#         """
# 
#         return cls(action_type='create', collection_name=collection_name, document_data=document_data)
# 
#     @classmethod
#     def update(cls, collection_name, _id, document_data):
#         """
#         """
# 
#         return cls(action_type='update', collection_name=collection_name, document_data=document_data, _id=_id)


from arangodb.transaction.action import DocumentAction


class Generator(object):
    """
    """

    def __init__(self):
        """
        """

        self.statements = ''
        self.last_variable_name = ''
        self.document_variable_counter = 1
        self.has_db_defined = False

    def compile_action(self, action):
        """
        """

        if not self.has_db_defined:
            self.statements += "var db = require('internal').db;"


# Path: arangodb/transaction/action.py
# class DocumentAction(TransactionAction):
#     """
#     """
# 
#     def __init__(self, action_type, collection_name, document_data, _id=''):
#         """
#         """
# 
#         super(DocumentAction, self).__init__(action_type)
# 
#         self.collection_name = collection_name
#         self.document_data = document_data
#         self._id = _id
# 
#     @classmethod
#     def create(cls, collection_name, document_data):
#         """
#         """
# 
#         return cls(action_type='create', collection_name=collection_name, document_data=document_data)
# 
#     @classmethod
#     def update(cls, collection_name, _id, document_data):
#         """
#         """
# 
#         return cls(action_type='update', collection_name=collection_name, document_data=document_data, _id=_id)


# Path: arangodb/transaction/javascript/code.py
from arangodb.transaction.action import DocumentAction



class Generator(object):
    """
    """

    def __init__(self):
        """
        """

        self.statements = ''
        self.last_variable_name = ''
        self.document_variable_counter = 1
        self.has_db_defined = False

    def compile_action(self, action):
        """
        """

        if not self.has_db_defined:
            self.statements += "var db = require('internal').db;"


        if isinstance(action, DocumentAction):