def _create_context(self, data, force_domain_creation, update_if_already_exists, publish): entity = Context.create_new(data.organization, data.domain, data.name, data.version, data.content) return self._create_schema_or_context("context", self._client.contexts, entity, data, force_domain_creation, update_if_already_exists, publish)
def create_context(self, name: str, version: str, data: JSON, publish: bool) -> Context: key = self._entity_name(name, version) context = self.client.contexts.read(self.organization, self.domain, name, version) if context is not None: self._print_already_created(key) return context else: local = Context.create_new(self.organization, self.domain, name, version, data) context = self.client.contexts.create(local) self.client.contexts.publish(context, publish=publish) self._print_created(key) return context
def resolve(self, search_result): identifier = Entity.extract_id_from_url(search_result.self_link, self.path) data = self._read(identifier) return Context(identifier, data, self.path) if data is not None else None
def read(self, organization, domain, context, version, revision=None): identifier = Context.create_id(organization, domain, context, version) data = self._read(identifier, revision) return Context(identifier, data, self.path) if data is not None else None