Ejemplo n.º 1
0
    def _resolve_parent_apis(self, specifications):
        """
        """

        # certainly not the best algo ever... but I need to get somthing done :)
        for specification_rest_name, specification in specifications.iteritems():

            for rest_name, remote_spec in specifications.iteritems():

                for related_child_api in remote_spec.child_apis:

                    if related_child_api.remote_specification_name == specification.rest_name:

                        parent_api = SpecificationAPI(
                            remote_specification_name=related_child_api.remote_specification_name,
                            specification=specification,
                        )

                        if specification.allows_get:
                            parent_api.allows_get = True
                        if specification.allows_create:
                            parent_api.allows_create = True
                        if specification.allows_update:
                            parent_api.allows_update = True
                        if specification.allows_delete:
                            parent_api.allows_Delete = True

                        specification.parent_apis.append(parent_api)
Ejemplo n.º 2
0
    def _resolve_parent_apis(self, specifications):
        """
        """

        # certainly not the best algo ever... but I need to get somthing done :)
        for specification_rest_name, specification in specifications.items():

            for rest_name, remote_spec in specifications.items():

                for related_child_api in remote_spec.child_apis:

                    if related_child_api.rest_name == specification.rest_name:

                        parent_api = SpecificationAPI(
                            specification=specification)
                        parent_api.rest_name = related_child_api.rest_name
                        if specification.allows_get:
                            parent_api.allows_get = True
                        if specification.allows_create:
                            parent_api.allows_create = True
                        if specification.allows_update:
                            parent_api.allows_update = True
                        if specification.allows_delete:
                            parent_api.allows_Delete = True

                        specification.parent_apis.append(parent_api)
Ejemplo n.º 3
0
    def _resolve_parent_apis(self, specifications):
        """
        """
        for specification_rest_name, specification in specifications.items():
            specification.parent_apis[:] = []
            for rest_name, remote_spec in specifications.items():
                for related_child_api in remote_spec.child_apis:
                    if related_child_api.rest_name == specification.rest_name:
                        parent_api = SpecificationAPI(
                            specification=remote_spec)
                        parent_api.rest_name = remote_spec.rest_name
                        if related_child_api.allows_get:
                            parent_api.allows_get = True
                        if related_child_api.allows_create:
                            parent_api.allows_create = True
                        if related_child_api.allows_update:
                            parent_api.allows_update = True
                        if related_child_api.allows_delete:
                            parent_api.allows_Delete = True

                        specification.parent_apis.append(parent_api)
Ejemplo n.º 4
0
    def _resolve_parent_apis(self, specifications):
        """
        """
        for specification_rest_name, specification in specifications.items():
            specification.parent_apis[:] = []
            for rest_name, remote_spec in specifications.items():
                for related_child_api in remote_spec.child_apis:
                    if related_child_api.rest_name == specification.rest_name:
                        parent_api = SpecificationAPI(specification=remote_spec)
                        parent_api.rest_name = remote_spec.rest_name
                        if related_child_api.allows_get:
                            parent_api.allows_get = True
                        if related_child_api.allows_create:
                            parent_api.allows_create = True
                        if related_child_api.allows_update:
                            parent_api.allows_update = True
                        if related_child_api.allows_delete:
                            parent_api.allows_Delete = True

                        specification.parent_apis.append(parent_api)
    def _export_child_apis(self, specification, session_username):
        """
        """
        ret = []
        response = self._storage_controller.get_all(user_identifier=session_username, parent=specification, resource_name=self._sdk.SDChildAPI.rest_name)

        for child_api in response.data:

            mono_child_api = SpecificationAPI()
            response = self._storage_controller.get(user_identifier=session_username, resource_name=self._sdk.SDSpecification.rest_name, identifier=child_api.associated_specification_id)

            mono_child_api.rest_name = response.data.object_rest_name
            mono_child_api.deprecated = child_api.deprecated
            mono_child_api.relationship = child_api.relationship
            mono_child_api.allows_get = child_api.allows_get
            mono_child_api.allows_create = child_api.allows_create
            mono_child_api.allows_update = child_api.allows_update
            mono_child_api.allows_delete = child_api.allows_delete
            mono_child_api.allows_bulk_create = child_api.allows_bulk_create
            mono_child_api.allows_bulk_update = child_api.allows_bulk_update
            mono_child_api.allows_bulk_delete = child_api.allows_bulk_delete

            ret.append(mono_child_api)

        return sorted(ret, lambda x, y: cmp(x.rest_name, y.rest_name))
    def _export_child_apis(self, specification, session_username):
        """
        """
        ret = []
        response = self._storage_controller.get_all(user_identifier=session_username, parent=specification, resource_name=self._sdk.SDChildAPI.rest_name)

        for child_api in response.data:

            mono_child_api = SpecificationAPI()
            response = self._storage_controller.get(user_identifier=session_username, resource_name=self._sdk.SDSpecification.rest_name, identifier=child_api.associated_specification_id)

            mono_child_api.rest_name = response.data.object_rest_name
            mono_child_api.deprecated = child_api.deprecated
            mono_child_api.relationship = child_api.relationship
            mono_child_api.allows_get = child_api.allows_get
            mono_child_api.allows_create = child_api.allows_create
            mono_child_api.allows_update = child_api.allows_update
            mono_child_api.allows_delete = child_api.allows_delete
            mono_child_api.allows_bulk_create = child_api.allows_bulk_create
            mono_child_api.allows_bulk_update = child_api.allows_bulk_update
            mono_child_api.allows_bulk_delete = child_api.allows_bulk_delete

            ret.append(mono_child_api)

        return sorted(ret, lambda x, y: cmp(x.rest_name, y.rest_name))