swarmlib/db/data_objects.py
author Sam Hart <criswellious@gmail.com>
Sun Apr 06 14:09:14 2008 -0400 (4 years ago)
changeset 265 30be108fda3a
parent 2497bff1bb19cf7
permissions -rw-r--r--
short_hash_id to issue_id
     1 # Copyright 2007 Sam Hart
     2 #
     3 # This program is free software; you can redistribute it and/or modify
     4 # it under the terms of the GNU General Public License as published by
     5 # the Free Software Foundation; either version 2 of the License, or
     6 # (at your option) any later version.
     7 #
     8 # This program is distributed in the hope that it will be useful,
     9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
    10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    11 # GNU General Public License for more details.
    12 #
    13 # You should have received a copy of the GNU General Public License
    14 # along with this program; if not, write to the Free Software
    15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    16 #
    17 # Author: Sam Hart
    18 
    19 """
    20 Swarm Data Objects
    21 
    22 Contains all of the data objects defined and used by Swarm.
    23 """
    24 
    25 #from sqlalchemy.orm import mapper, relation, backref
    26 
    27 #import swarmlib.db.schema as schema
    28 
    29 class Issue(object):
    30     def __init__(self, hash_id, short_hash_id):
    31         self.issue_id = short_hash_id
    32         self.hash_id = hash_id
    33     def __repr__(self):
    34        return "<Issue('%s', '%s')>" % (self.hash_id, self.short_hash_id)
    35 
    36 class Node(object):
    37     def __init__(self, hash_id, summary):
    38         self.hash_id = hash_id
    39         self.summary = summary
    40     def __repr__(self):
    41         return "<Node('%s', '%s')>" % (self.hash_id, self.summary)
    42 
    43 class TransactionEntry(object):
    44     def __init__(self, root, time, transaction, transaction_data):
    45         self.root = root
    46         self.time = time
    47         self.transaction = transaction
    48         self.transaction_log = transaction_log
    49 
    50     def __repr__(self):
    51         return "<TransactionEntry(root:'%s', time:'%s'>" % (self.root,
    52                 self.time)
    53 
    54 class ComponentEntry(object):
    55     def __init__(self, name, isdefault=False):
    56         self.name = name
    57         self.isdefault = isdefault
    58 
    59     def __repr__(self):
    60         return "<ComponentEntry('%s', default:'%s')>" % (self.name,
    61                 self.isdefault)
    62 
    63 class VersionEntry(object):
    64     def __init__(self, name, isdefault=False):
    65         self.name = name
    66         self.isdefault = isdefault
    67 
    68     def __repr__(self):
    69         return "<VersionEntry('%s', default:'%s')>" % (self.name,
    70                 self.isdefault)
    71 
    72 class MilestoneEntry(object):
    73     def __init__(self, name, isdefault=False):
    74         self.name = name
    75         self.isdefault = isdefault
    76 
    77     def __repr__(self):
    78         return "<MilestoneEntry('%s', default:'%s')>" % (self.name,
    79                 self.isdefault)
    80 
    81 class SeverityEntry(object):
    82     def __init__(self, name, isdefault=False):
    83         self.name = name
    84         self.isdefault = isdefault
    85 
    86     def __repr__(self):
    87         return "<SeverityEntry('%s', default:'%s')>" % (self.name,
    88                 self.isdefault)
    89 
    90 class PriorityEntry(object):
    91     def __init__(self, name, isdefault=False):
    92         self.name = name
    93         self.isdefault = isdefault
    94 
    95     def __repr__(self):
    96         return "<PriorityEntry('%s', default:'%s')>" % (self.name,
    97                 self.isdefault)
    98 
    99 class StatusEntry(object):
   100     def __init__(self, name, isdefault=False):
   101         self.name = name
   102         self.isdefault = isdefault
   103 
   104     def __repr__(self):
   105         return "<StatusEntry('%s', default:'%s')>" % (self.name,
   106                 self.isdefault)
   107 
   108 class ResolutionEntry(object):
   109     def __init__(self, name, isdefault=False):
   110         self.name = name
   111         self.isdefault = isdefault
   112 
   113     def __repr__(self):
   114         return "<ResolutionEntry('%s', default:'%s')>" % (self.name,
   115                 self.isdefault)
   116 
   117 class Upstream(object):
   118     def __init__(self, uri, upstream_type, authentication, transport):
   119         self.uri = uri
   120         self.upstream_type = upstream_type
   121         self.authentication = authentication
   122         self.transport = transport
   123 
   124     def __repr__(self):
   125         return "<Upstream('%s')>" % self.uri