Examples of GCSContent


Examples of net.sourceforge.gedapi.view.GCSContent

                      // if the subFile is a hashedFilename then add it to GCSContentView object
                      boolean validHash = GLinkURL.justFileHash(subFile.getName()).equals(contentFile.getName()+File.separator+subContentFile.getName());
                      if(subFile.isFile() && validHash)
                      {
                        LOG.finest("1) Adding file: "+subFile.getAbsolutePath());
                        GCSContent gcsContent = new GCSContent();
                        if(lastModified < subFile.lastModified())
                        {
                          lastModified = subFile.lastModified();
                        }
                        gcsContent.setIsFile(subFile.isFile());
                        gcsContent.setJsContent((gedcomFilePath.length() > 0 ? gedcomFilePath.substring(1)+"/" : gedcomFilePath)+subFile.getName());
                        gcsContent.setLinkURL(requestURL+subFile.getName());
                        gcsContent.setLinkContent(subFile.getName());
                        content.addContent(gcsContent);
                      }
                      else
                      {
                        if((subContentFile.isDirectory() || isValidFilename(subContentFile.getName())) &&
                           validHash)
                        {
                          LOG.finest("2) Adding file: "+subContentFile.getAbsolutePath());
                          // found one that does not match, therefore, need to add the full
                          // path to subContentFile (make sure and do this only once)
                          GCSContent gcsContent = new GCSContent();
                          if(lastModified < subContentFile.lastModified())
                          {
                            lastModified = subContentFile.lastModified();
                          }
                          gcsContent.setIsFile(subContentFile.isFile());
                          gcsContent.setJsContent((gedcomFilePath.length() > 0 ? gedcomFilePath.substring(1)+"/" : gedcomFilePath)+subContentFile.getName());
                          gcsContent.setLinkURL(requestURL+subContentFile.getName());
                          gcsContent.setLinkContent(subContentFile.getName());
                          content.addContent(gcsContent);
                        }
                      }
                    }
                  }
                }
                else
                {
                  // as part of the isValidFilename check method, the hash of the name of the file
                  // needs to be compared to it's two immediate parent directories to make sure
                  // that the file is not added if the hash of the name of the file is equal to
                  // it's two immediate parent directories
                  LOG.finest("The full path to the file: "+subContentFile.getAbsolutePath());
                  LOG.finest("File hash: "+GLinkURL.justFileHash(subContentFile.getName()));
                  LOG.finest("Two parent dirs: "+contentFile.getParentFile().getName()+File.separator+contentFile.getName());
                 
                  if((contentFile.isDirectory() || isValidFilename(contentFile.getName())) &&
                     !GLinkURL.justFileHash(subContentFile.getName()).equals(contentFile.getParentFile().getName()+File.separator+contentFile.getName()) &&
                     isValidFilename(subContentFile.getName()))
                  {
                    LOG.finest("3) Adding file: "+contentFile.getAbsolutePath());
                    // found one that does not match, therefore, need to add the full
                    // path to contentFile (make sure and do this only once)
                    GCSContent gcsContent = new GCSContent();
                    if(lastModified < contentFile.lastModified())
                    {
                      lastModified = contentFile.lastModified();
                    }
                    gcsContent.setIsFile(contentFile.isFile());
                    gcsContent.setJsContent((gedcomFilePath.length() > 0 ? gedcomFilePath.substring(1)+"/" : gedcomFilePath)+contentFile.getName());
                    gcsContent.setLinkURL(requestURL+contentFile.getName());
                    gcsContent.setLinkContent(contentFile.getName());
                    content.addContent(gcsContent);
                  }
                }
              }
            }
            else if(!contentFile.isFile() || !GLinkURL.justFileHash(contentFile.getName()).equals(contentFile.getParentFile().getParentFile().getName()+File.separator+contentFile.getParentFile().getName()))
            {
              LOG.finest("4) Adding file: "+contentFile.getAbsolutePath());
              GCSContent gcsContent = new GCSContent();
              if(lastModified < contentFile.lastModified())
              {
                lastModified = contentFile.lastModified();
              }
              gcsContent.setIsFile(contentFile.isFile());
              gcsContent.setJsContent((gedcomFilePath.length() > 0 ? gedcomFilePath.substring(1)+"/" : gedcomFilePath)+filename);
              gcsContent.setLinkURL(requestURL+filename);
              gcsContent.setLinkContent(filename);
              content.addContent(gcsContent);
            }
          }
          sendJSONResponse(response, content, lastModified);
        /*}*/
 
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.