コード例 #1
0
        public JEVisFile GetValueAsFile()
        {
            if (file != null && file.getBytes() != null)
            {
                return(file);
            }
            else
            {
                try
                {
                    String resource = REQUEST.API_PATH_V1
                                      + REQUEST.OBJECTS.PATH
                                      + GetAttribute().GetObjectID() + "/"
                                      + REQUEST.OBJECTS.ATTRIBUTES.PATH
                                      + GetAttribute().GetName() + "/"
                                      + REQUEST.OBJECTS.ATTRIBUTES.SAMPLES.PATH
                                      + REQUEST.OBJECTS.ATTRIBUTES.SAMPLES.FILES.PATH
                                      + HTTPConnection.FMT.print(GetTimestamp());

                    byte[] response = ds.GetHTTPConnection().getByteRequest(resource);

                    file = new JEVisFileImp(GetValueAsString(), response);
                    return(file);
                }
                catch (Exception ex)
                {
                    logger.Error(ex);
                    return(null);
                }
            }
        }
コード例 #2
0
 public JEVisSampleWS(JEVisDataSourceWS ds, JsonSample json, JEVisAttribute att, JEVisFile file)
 {
     this.attribute = att;
     this.ds        = ds;
     this.json      = json;
     this.file      = file;
     try
     {
         SetValue(file.getFilename());
     }
     catch (Exception ex)
     {
         logger.Error(ex);
     }
 }
コード例 #3
0
        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);
            }