Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:OpenHands OpenHands JiraIntegrationStore

From Leeroopedia
Knowledge Sources
Domains Storage, Integration, Jira
Last Updated 2026-02-11 21:00 GMT

Overview

CRUD store for managing Jira Cloud workspace registrations, user associations, and conversation records, provided by the OpenHands enterprise storage layer.

Description

JiraIntegrationStore provides the persistence layer for the Jira Cloud integration. It manages the same three entity types as the Data Center variant: workspaces, workspace-user links, and conversations. The primary difference is that Jira Cloud workspaces are identified by jira_cloud_id (the Atlassian Cloud tenant identifier) rather than a base URL.

The store follows the same API pattern as JiraDcIntegrationStore: workspace lifecycle (create, update, deactivate), user link management (create link, get active user), and conversation tracking (create conversation, query by issue). All operations execute within a SQLAlchemy session context.

The Jira Cloud integration is the most common Jira deployment model for SaaS customers, making this store the primary Jira data access layer in production environments.

Usage

Use JiraIntegrationStore when building or maintaining Jira Cloud integration endpoints. It is used in the OAuth callback flow to register workspaces, in issue panel endpoints to look up user links, and in conversation creation flows to persist the Jira issue association.

Code Reference

Source Location

Signature

class JiraIntegrationStore:
    def __init__(self, session: Session):
        ...

    def create_workspace(self, jira_cloud_id: str, **kwargs) -> JiraWorkspace:
        ...

    def update_workspace(self, workspace_id: str, **kwargs) -> JiraWorkspace:
        ...

    def create_workspace_link(self, workspace_id: str, user_id: str, **kwargs) -> JiraWorkspaceLink:
        ...

    def get_workspace_by_id(self, workspace_id: str) -> Optional[JiraWorkspace]:
        ...

    def get_active_user(self, workspace_id: str, user_id: str) -> Optional[JiraWorkspaceLink]:
        ...

    def deactivate_workspace(self, workspace_id: str) -> None:
        ...

    def create_conversation(self, workspace_id: str, issue_id: str, conversation_id: str) -> JiraConversation:
        ...

    def get_user_conversations_by_issue_id(self, workspace_id: str, user_id: str, issue_id: str) -> List[JiraConversation]:
        ...

Import

from enterprise.storage.jira_integration_store import JiraIntegrationStore

I/O Contract

Inputs

Constructor

Name Type Required Description
session Session Yes SQLAlchemy database session for executing queries

create_workspace()

Name Type Required Description
jira_cloud_id str Yes Atlassian Cloud tenant identifier (primary workspace identifier)
**kwargs dict No Additional workspace attributes (e.g., shared_secret, display_name)

create_workspace_link()

Name Type Required Description
workspace_id str Yes The workspace to link the user to
user_id str Yes The OpenHands user ID to associate with the workspace
**kwargs dict No Additional link attributes (e.g., jira_account_id)

get_user_conversations_by_issue_id()

Name Type Required Description
workspace_id str Yes The workspace scope for the query
user_id str Yes The user whose conversations to retrieve
issue_id str Yes The Jira Cloud issue ID to filter conversations by

Outputs

Method Return Type Description
create_workspace() JiraWorkspace The newly created workspace ORM object
update_workspace() JiraWorkspace The updated workspace ORM object
create_workspace_link() JiraWorkspaceLink The newly created user-workspace link
get_workspace_by_id() Optional[JiraWorkspace] The workspace if found, None otherwise
get_active_user() Optional[JiraWorkspaceLink] The active link if found, None otherwise
deactivate_workspace() None Marks workspace as inactive (soft delete)
create_conversation() JiraConversation The newly created conversation record
get_user_conversations_by_issue_id() List[JiraConversation] All conversations for the user on the given issue

Usage Examples

Creating a Workspace via OAuth Callback

from enterprise.storage.jira_integration_store import JiraIntegrationStore

store = JiraIntegrationStore(session=db_session)

# Register a new Jira Cloud tenant after OAuth
workspace = store.create_workspace(
    jira_cloud_id="cloud-tenant-abc123",
    shared_secret="oauth-secret",
    display_name="Acme Corp Jira"
)

# Link the installing user
link = store.create_workspace_link(
    workspace_id=workspace.id,
    user_id="user-456",
    jira_account_id="atlassian-account-789"
)

Querying Conversations by Issue

# Look up existing conversations for an issue panel
conversations = store.get_user_conversations_by_issue_id(
    workspace_id="workspace-abc",
    user_id="user-456",
    issue_id="PROJ-200"
)

if not conversations:
    # No existing conversation, create one
    conversation = store.create_conversation(
        workspace_id="workspace-abc",
        issue_id="PROJ-200",
        conversation_id="conv-new-001"
    )

Related Pages

Related Implementations

Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment