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 JiraDcIntegrationStore

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

Overview

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

Description

JiraDcIntegrationStore provides the persistence layer for the Jira Data Center integration. It manages three related entity types: workspaces (representing a connected Jira DC instance), workspace-user links (mapping OpenHands users to Jira DC workspaces), and conversations (tying OpenHands conversations to specific Jira issues).

The store follows a consistent pattern across all integration stores: workspace creation and lifecycle management (create, update, deactivate), user link management (create link, get active user), and conversation tracking (create conversation, query by issue). Each method operates within a SQLAlchemy session context and uses the jira_dc_base_url as the primary workspace identifier, distinguishing it from the Cloud variant which uses jira_cloud_id.

Workspace deactivation is a soft-delete operation that marks the workspace as inactive rather than removing it, preserving audit history and allowing potential reactivation.

Usage

Use JiraDcIntegrationStore when building or maintaining the Jira Data Center integration endpoints. It is the sole data access layer for Jira DC workspace state and should be used in route handlers and background jobs that need to read or write Jira DC integration data.

Code Reference

Source Location

Signature

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

    def create_workspace(self, jira_dc_base_url: str, **kwargs) -> JiraDcWorkspace:
        ...

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

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

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

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

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

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

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

Import

from enterprise.storage.jira_dc_integration_store import JiraDcIntegrationStore

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_dc_base_url str Yes Base URL of the Jira Data Center instance (primary 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 issue ID to filter conversations by

Outputs

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

Usage Examples

Creating a Workspace and Linking a User

from enterprise.storage.jira_dc_integration_store import JiraDcIntegrationStore

store = JiraDcIntegrationStore(session=db_session)

# Register a new Jira DC instance
workspace = store.create_workspace(
    jira_dc_base_url="https://jira.example.com",
    shared_secret="secret-token",
    display_name="Engineering Jira"
)

# Link a user to the workspace
link = store.create_workspace_link(
    workspace_id=workspace.id,
    user_id="user-123",
    jira_account_id="jira-account-456"
)

Creating and Querying Conversations

# Create a conversation tied to a Jira issue
conversation = store.create_conversation(
    workspace_id=workspace.id,
    issue_id="PROJ-100",
    conversation_id="conv-789"
)

# Retrieve all conversations for a user on a specific issue
conversations = store.get_user_conversations_by_issue_id(
    workspace_id=workspace.id,
    user_id="user-123",
    issue_id="PROJ-100"
)

Related Pages

Related Implementations

Environment

Page Connections

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