private void FetchData() { foreach (JEVisAttribute att in obj.GetAttributes()) { switch (att.GetName()) { case JEVisConstants.Attribute.USER_SYS_ADMIN: JEVisSample sysAdminAtt = att.GetLatestSample(); if (sysAdminAtt != null) { isSysAdmin = sysAdminAtt.GetValueAsBoolean(); } else { isSysAdmin = false; } break; case JEVisConstants.Attribute.USER_FIRST_NAME: JEVisSample firstNameAtt = att.GetLatestSample(); if (firstNameAtt != null) { firstName = firstNameAtt.GetValueAsString(); } else { firstName = ""; } break; case JEVisConstants.Attribute.USER_LAST_NAME: JEVisSample lastNameAtt = att.GetLatestSample(); if (lastNameAtt != null) { lastName = lastNameAtt.GetValueAsString(); } else { lastName = ""; } break; case JEVisConstants.Attribute.USER_ENABLED: //can only be true in the moment because if not the user can not access this information for him self JEVisSample enabledAtt = att.GetLatestSample(); if (enabledAtt != null) { enabled = enabledAtt.GetValueAsBoolean(); } else { enabled = false; } break; } } }
public JEVisSample buildSample(DateTime ts, Object value, String note) { JsonSample newJson = new JsonSample(); newJson.setTs(attDTF.print(ts)); JEVisSample newSample = null; //TODO: replace this , the getPrimitiveType() is very bad because it will call the Webservice for every sample // if (getPrimitiveType() == JEVisConstants.PrimitiveType.FILE) { if (value instanceof JEVisFile)// workaround { JEVisFile file = (JEVisFile)value; newSample = new JEVisSampleWS(ds, newJson, this, file); }