1 # Copyright (C) 2010 Richard Lincoln
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License, or (at your option) any later version.
8 # This library 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 GNU
11 # Lesser General Public License for more details.
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA, USA
17 from CIM14
.IEC61970
.Core
.IdentifiedObject
import IdentifiedObject
19 class Document(IdentifiedObject
):
20 """Parent class for different groupings of information collected and managed as a part of a business process. It will frequently contain references to other objects, such as assets, people and power system resources.
23 def __init__(self
, revisionNumber
='', subject
='', createdDateTime
='', title
='', category
='', lastModifiedDateTime
='', electronicAddress
=None, status
=None, ActivityRecords
=None, docStatus
=None, Measurements
=None, *args
, **kw_args
):
24 """Initialises a new 'Document' instance.
26 @param revisionNumber: Revision number for this document.
27 @param subject: Document subject.
28 @param createdDateTime: Date and time that this document was created.
29 @param title: Document title.
30 @param category: Utility-specific categorisation of this document, according to their corporate standards, practices, and existing IT systems (e.g., for management of assets, maintenance, work, outage, customers, etc.).
31 @param lastModifiedDateTime: Date and time this document was last modified. Documents may potentially be modified many times during their lifetime.
32 @param electronicAddress: Electronic address.
33 @param status: Status of subject matter (e.g., Agreement, Work) this document represents. For status of the document itself, use 'docStatus' attribute.
34 @param ActivityRecords: All activity records created for this document.
35 @param docStatus: Status of this document. For status of subject matter this document represents (e.g., Agreement, Work), use 'status' attribute. Example values for 'docStatus.status' are draft, approved, cancelled, etc.
36 @param Measurements: Measurements are specified in types of documents, such as procedures.
38 #: Revision number for this document.
39 self
.revisionNumber
= revisionNumber
42 self
.subject
= subject
44 #: Date and time that this document was created.
45 self
.createdDateTime
= createdDateTime
50 #: Utility-specific categorisation of this document, according to their corporate standards, practices, and existing IT systems (e.g., for management of assets, maintenance, work, outage, customers, etc.).
51 self
.category
= category
53 #: Date and time this document was last modified. Documents may potentially be modified many times during their lifetime.
54 self
.lastModifiedDateTime
= lastModifiedDateTime
56 self
.electronicAddress
= electronicAddress
60 self
._ActivityRecords
= []
61 self
.ActivityRecords
= [] if ActivityRecords
is None else ActivityRecords
63 self
.docStatus
= docStatus
65 self
._Measurements
= []
66 self
.Measurements
= [] if Measurements
is None else Measurements
68 super(Document
, self
).__init
__(*args
, **kw_args
)
70 _attrs
= ["revisionNumber", "subject", "createdDateTime", "title", "category", "lastModifiedDateTime"]
71 _attr_types
= {"revisionNumber": str, "subject": str, "createdDateTime": str, "title": str, "category": str, "lastModifiedDateTime": str}
72 _defaults
= {"revisionNumber": '', "subject": '', "createdDateTime": '', "title": '', "category": '', "lastModifiedDateTime": ''}
74 _refs
= ["electronicAddress", "status", "ActivityRecords", "docStatus", "Measurements"]
75 _many_refs
= ["ActivityRecords", "Measurements"]
78 electronicAddress
= None
80 # Status of subject matter (e.g., Agreement, Work) this document represents. For status of the document itself, use 'docStatus' attribute.
83 def getActivityRecords(self
):
84 """All activity records created for this document.
86 return self
._ActivityRecords
88 def setActivityRecords(self
, value
):
89 for p
in self
._ActivityRecords
:
90 filtered
= [q
for q
in p
.Documents
if q
!= self
]
91 self
._ActivityRecords
._Documents
= filtered
93 if self
not in r
._Documents
:
94 r
._Documents
.append(self
)
95 self
._ActivityRecords
= value
97 ActivityRecords
= property(getActivityRecords
, setActivityRecords
)
99 def addActivityRecords(self
, *ActivityRecords
):
100 for obj
in ActivityRecords
:
101 if self
not in obj
._Documents
:
102 obj
._Documents
.append(self
)
103 self
._ActivityRecords
.append(obj
)
105 def removeActivityRecords(self
, *ActivityRecords
):
106 for obj
in ActivityRecords
:
107 if self
in obj
._Documents
:
108 obj
._Documents
.remove(self
)
109 self
._ActivityRecords
.remove(obj
)
111 # Status of this document. For status of subject matter this document represents (e.g., Agreement, Work), use 'status' attribute. Example values for 'docStatus.status' are draft, approved, cancelled, etc.
114 def getMeasurements(self
):
115 """Measurements are specified in types of documents, such as procedures.
117 return self
._Measurements
119 def setMeasurements(self
, value
):
120 for p
in self
._Measurements
:
121 filtered
= [q
for q
in p
.Documents
if q
!= self
]
122 self
._Measurements
._Documents
= filtered
124 if self
not in r
._Documents
:
125 r
._Documents
.append(self
)
126 self
._Measurements
= value
128 Measurements
= property(getMeasurements
, setMeasurements
)
130 def addMeasurements(self
, *Measurements
):
131 for obj
in Measurements
:
132 if self
not in obj
._Documents
:
133 obj
._Documents
.append(self
)
134 self
._Measurements
.append(obj
)
136 def removeMeasurements(self
, *Measurements
):
137 for obj
in Measurements
:
138 if self
in obj
._Documents
:
139 obj
._Documents
.remove(self
)
140 self
._Measurements
.remove(obj
)