class File(elixir.Entity): #parent = elixir.ManyToOne('File') #children = elixir.OneToMany('File') evidence = elixir.ManyToOne('Evidence') filesystem = elixir.ManyToOne('Filesystem') state = elixir.ManyToOne('FileState') filename = elixir.Field(elixir.Unicode(300), index=True) filesize = elixir.Field(elixir.Integer) fullpath = elixir.ManyToOne('FullPath') extension = elixir.ManyToOne('Extension') mimetype = elixir.ManyToOne('MimeType') md5 = elixir.ManyToOne('Md5') sha1 = elixir.ManyToOne('Sha1') sha256 = elixir.ManyToOne('Sha256') ssdeep = elixir.ManyToOne('Ssdeep') def fullFileSpec(self, hashtype='md5'): fp = os.path.join(self.fullpath.fullpath, self.filename) fsize = fritutils.humanize(self.filesize) hashes = { 'md5': self.md5.md5, 'sha1': self.sha1.sha1, 'sha256': self.sha256.sha256, 'ssdeep': self.ssdeep.ssdeep } fhash = 'NO_HASH_COMPUTED' if hashes[hashtype]: fhash = hashes[hashtype] specs = '%s,%s,%s: "%s" ,%s/%s,"%s"' % ( self.state.state, fsize, hashtype, fhash, self.evidence.configName, self.filesystem.configName, fp) return specs def __repr__(self): return os.path.join(self.fullpath.fullpath, self.filename)
class Order(el.Entity): name = el.Field(el.String(100)) status = el.ManyToOne(Status) customer = el.ManyToOne(People) assignee = el.ManyToOne(People) delivery = el.Field(el.Boolean) address = el.Field(el.String(200)) items = el.OneToMany('Item')
class Compatibility(elixir.Entity): compatibility = elixir.Field(types.Integer) user1 = elixir.ManyToOne('popserver.model.users.User', colname='user1_id', ondelete='cascade', primary_key=True) user2 = elixir.ManyToOne('popserver.model.users.User', colname='user2_id', ondelete='cascade', primary_key=True) elixir.using_options(tablename='compatibility')
class Game(elixir.Entity): """ The Game model. Contains all information about a game and allows querying. Many games can have one user. """ name = elixir.Field(elixir.String(40), unique=True) description = elixir.Field(elixir.String(512)) image = elixir.Field(elixir.String(512)) author = elixir.ManyToOne("User") platforms = elixir.ManyToMany("Platform") ratings = elixir.ManyToMany("Rating") event = elixir.ManyToOne("Event") def __repr__(self): return "<Game '%s' by %s>" % (self.name, self.author.name)
class Rating(elixir.Entity): """ The Rating model. Contains the a rating value. This value can be applied to a game and a user. Allows for checking game ratings and ratings a user has given. """ value = elixir.Field(elixir.Float(4)) games = elixir.ManyToMany("Game") user = elixir.ManyToOne("User") def __repr__(self): return "<Rating %s>" % (self.value)
class Link(elixir.Entity): elixir.using_options(tablename="links") intersections = elixir.ManyToMany("Intersection") road_segments = elixir.OneToMany("Road_segment") road = elixir.ManyToOne("Road") def forward_road_segments(self): return [ road_segment for road_segment in self.road_segment if road_segment.is_forward ] def reverse_road_segments(self): return [ road_segment for road_segment in self.road_segment if not road_segment.is_forward ]
class Lane(elixir.Entity, Road_item_with_polyline, Road_item_with_obstacle_points): """A lane represents a lane, in particularly the polyline field represents the lane's center- line; vehicles should be travelling along this polyline unless the driver intends to change lanes.""" elixir.using_options(tablename="lanes") # "max_traffic_rules" is just a placeholder, it is not a valid rule. The traffic_rules is # a string of '0' and '1', one for each of the rules above, not including "max_traffic_rules". traffic_rules = elixir.Field(elixir.Text, required=True, default='0' * (len(traffic_flags) - 1)) database_polyline = elixir.Field(elixir.Binary) database_obstacle_points = elixir.Field(elixir.Binary) # A road segment has one or more lanes. In each road-segment the lanes are numbered from right # to left when we are facing in the forward traffic flow. The lane_index is the 0-based number. road_segment = elixir.ManyToOne("Road_segment") lane_index = elixir.Field(elixir.SmallInteger) width = elixir.Field(elixir.Float) lane_connectors = elixir.ManyToMany("Lane_connector")
class Cast(elixir.Entity): movie = elixir.ManyToOne(Movie) character = elixir.Field(elixir.String) actor = elixir.Field(elixir.String)
class Road_segment(elixir.Entity): elixir.using_options(tablename="road_segments") lanes = elixir.OneToMany("Lane") link = elixir.ManyToOne("Link") segment_index = elixir.Field(elixir.SmallInteger) is_forward = elixir.Field(elixir.Boolean)
class Movie(e.Entity): title = e.Field(e.Unicode(30), primary_key=True) year = e.Field(e.Integer, primary_key=True) description = e.Field(e.UnicodeText, deferred=True) director = e.ManyToOne('Director') genres = e.ManyToMany('Genre')
class Filesystem(elixir.Entity): evidence = elixir.ManyToOne('Evidence') configName = elixir.Field(elixir.Unicode(300))
class Item(el.Entity): order = el.ManyToOne(Order) code = el.Field(el.String(50)) description = el.Field(el.String(200))