File indexing completed on 2026-04-10 08:39:06
0001 """
0002 dataset specification
0003
0004 """
0005
0006
0007 class DatasetSpec(object):
0008
0009 _attributes = (
0010 "vuid",
0011 "name",
0012 "version",
0013 "type",
0014 "status",
0015 "numberfiles",
0016 "currentfiles",
0017 "creationdate",
0018 "modificationdate",
0019 "MoverID",
0020 "transferStatus",
0021 "subType",
0022 )
0023
0024
0025 _zeroAttrs = ("MoverID", "transferStatus")
0026
0027
0028 def __init__(self):
0029
0030 for attr in self._attributes:
0031 setattr(self, attr, None)
0032
0033
0034 def __getattribute__(self, name):
0035 ret = object.__getattribute__(self, name)
0036 if ret is None:
0037 return "NULL"
0038 return ret
0039
0040
0041 def values(self):
0042 ret = []
0043 for attr in self._attributes:
0044 val = getattr(self, attr)
0045 ret.append(val)
0046 return tuple(ret)
0047
0048
0049 def valuesMap(self):
0050 ret = {}
0051 for attr in self._attributes:
0052 val = getattr(self, attr)
0053 if val == "NULL":
0054 if attr in self._zeroAttrs:
0055 val = 0
0056 else:
0057 val = None
0058 ret[f":{attr}"] = val
0059 return ret
0060
0061
0062 def pack(self, values):
0063 for i in range(len(self._attributes)):
0064 attr = self._attributes[i]
0065 val = values[i]
0066 setattr(self, attr, val)
0067
0068
0069 def columnNames(cls):
0070 ret = ""
0071 for attr in cls._attributes:
0072 if ret != "":
0073 ret += ","
0074 ret += attr
0075 return ret
0076
0077 columnNames = classmethod(columnNames)
0078
0079
0080 def valuesExpression(cls):
0081 ret = "VALUES("
0082 for attr in cls._attributes:
0083 ret += "%s"
0084 if attr != cls._attributes[len(cls._attributes) - 1]:
0085 ret += ","
0086 ret += ")"
0087 return ret
0088
0089 valuesExpression = classmethod(valuesExpression)
0090
0091
0092 def bindValuesExpression(cls):
0093 ret = "VALUES("
0094 for attr in cls._attributes:
0095 ret += f":{attr},"
0096 ret = ret[:-1]
0097 ret += ")"
0098 return ret
0099
0100 bindValuesExpression = classmethod(bindValuesExpression)
0101
0102
0103 def updateExpression(cls):
0104 ret = ""
0105 for attr in cls._attributes:
0106 ret = ret + attr + "=%s"
0107 if attr != cls._attributes[len(cls._attributes) - 1]:
0108 ret += ","
0109 return ret
0110
0111 updateExpression = classmethod(updateExpression)
0112
0113
0114 def bindUpdateExpression(cls):
0115 ret = ""
0116 for attr in cls._attributes:
0117 ret += f"{attr}=:{attr},"
0118 ret = ret[:-1]
0119 return ret
0120
0121 bindUpdateExpression = classmethod(bindUpdateExpression)
0122
0123
0124 def __getstate__(self):
0125 state = []
0126 for attr in self._attributes:
0127 val = getattr(self, attr)
0128 state.append(val)
0129 return state
0130
0131
0132 def __setstate__(self, state):
0133 for i, attr in enumerate(self._attributes):
0134 if i < len(state):
0135 setattr(self, attr, state[i])
0136 else:
0137 setattr(self, attr, None)