Bases: object
The base class of all the others
The SimpleEntity is the starting point of the Stalker Object Model, it starts by adding the basic information about an entity which are name, description, the audit informations like created_by, updated_by, date_created, date_updated and a couple of naming attributes like code and nice_name and last but not least the type attribute which is very important for entities that needs a type.
For derived classes if the type needed to be specifically specified, that is it can not be None or nothing else then a Type instance, set the strictly_typed class attribute to True:
class NewClass(SimpleEntity):
__strictly_typed__ = True
This will ensure that the derived class always have a proper type attribute and can not initialize without one.
Two SimpleEntities considered to be equal if they have the same name, the other attributes doesn’t matter.
The formatting rules for the code attribute is as follows:
- only alphanumerics and underscore is allowed [a-zA-Z0-9_]
- no number is allowed at the beggining
- no white spaces are allowed
- all the white spaces will be converted to underscore characters
- all the underscores are converted to only one underscore character if more than one follows each other
Examples:
Input Value Formatted Output testCode testCode 1testCode testCode _testCode testCode 2423$+^^+^’%+%%&_testCode testCode 2423$+^^+^’%+%%&_testCode_35 testCode_35 2423$ +^^+^ ‘%+%%&_ testCode_ 35 testCode_35 SH001 SH001 My CODE is Ozgur My_CODE_is_Ozgur this is another code for an asset this_is_another_code_for_an_asset
Parameters: |
|
---|
Methods
__init__(6, 30, 23, 5, 54, 6, 30, 23, 5, 54, ...) |
Attributes
code | The code name of this object. |
created_by | The User who has created this object. |
date_created | A datetime.datetime instance showing the creation date and time of this object. |
date_updated | A datetime.datetime instance showing the update date and time of this object. |
description | Description of this object. |
name | Name of this object |
nice_name | Nice name of this object. |
type | The type of the object. |
updated_by | The User who has updated this object. |
Nice name of this object.
It has the same value with the name (contextually) but with a different format like, all the white spaces replaced by underscores (“_”), all the CamelCase form will be expanded by underscore (_) characters and it is always lower case.
There is also the code attribute which is simply the upper case form of nice_name if it is not defined differently (i.e set to another value).
The type of the object.
It is an instance of Type with a proper target_entity_type.
The code name of this object.
It accepts string or unicode values and any other kind of objects will be converted to string. In any update to the name attribute the code also will be updated. If the code is not initialized or given as None, it will be set to the uppercase version of the nice_name attribute. Setting the code attribute to None will reset it to the default value. The default value is the upper case form of the nice_name.