Package genj.gedcom

Examples of genj.gedcom.Gedcom


    }
   
    // the last part of the gedcomURL should be the individual id
    // if the gedcomURL does not end in an individual id then the
    // data for the first person in the gedcom is retrieved
    Gedcom gedcom = gedcomURL.loadGedcom(networkReload, request);
    Indi indi;
    if(gedcomURL.isValidIndividualId())
    {
      indi = (Indi)gedcom.getEntity(Gedcom.INDI, gedcomURL.getIndividualId());
      if(indi == null)
      {
        throw new ServletException(ErrorCodes.NONEXISTANT_INDI.getErrorMessage(new Object[] {gedcomURL.getIndividualId(), gedcomURL.getGedcomURL()}));
      }
    }
    else
    {
      indi = (Indi)gedcom.getFirstEntity(Gedcom.INDI);
      if(indi == null)
      {
        throw new ServletException(ErrorCodes.NO_INDIVIDUALS.getErrorMessage(new Object[] {gedcomURL.getGedcomURL()}));
      }
      gedcomURL.setIndividualId(indi.getId());
    }
   
    //switch on the view to know how to get the correct view data into X-JSON format
    BaseView baseView = null;
    switch(view)
    {
      case FAMILY_VIEW:
        LOG.finest("The gedapi view is: family: "+indi);
        //create family view java classes like described in vraptor2 (spouse, individual, parent, child, marriage), populate the
        //top level vraptor2 FamilyView class with the correct number of instances of spouse, individual, parent, child, marriage
        //objects and then use vraptor2 to serialize the FamilyView into a JSON string and send that back to the browser
        baseView = Gedcom2View.familyView(indi, networkReload, gedcomURL);
        break;
      case PEDIGREE_VIEW:
        LOG.finest("The gedapi view is: pedigree: "+indi);
        baseView = Gedcom2View.pedigreeView(indi, networkReload, gedcomURL);
        break;
      case INDIVIDUAL_VIEW:
        LOG.finest("The gedapi view is: individual list: "+indi);
        baseView = Gedcom2View.individualListView(gedcom, networkReload, gedcomURL);
        break;
      case GEDCOM_SEARCH_VIEW:
        LOG.finest("The gedapi view is: GEDCOM Search: "+indi);
        baseView = Gedcom2View.gedcomSearchView(gedcom, gedcomURL, searchCriteria, searchScope);
        break;
      case SUBMITTER_VIEW:
        SSOSubject authenticated = (SSOSubject)request.getAttribute(SSOSubject.SSOSUBJECT_KEY);
        if(authenticated == null)
        {
        throw new ServletException("The request does not have an "+SSOSubject.SSOSUBJECT_KEY+" attribute, this is not allowed!!!");
        }
        LOG.finest("The gedapi view is: submitter: "+indi);
        baseView = Gedcom2View.gedcomSubmitterView(gedcom, gedcomURL);
        break;
      case ALL_GLINKS_VIEW:
        LOG.finest("The gedapi view is: ALL_GLINKS: "+indi);
        baseView = Gedcom2View.gedcomAllGLinksView(gedcom, gedcomURL);
        break;
      default:
        throw new ServletException(ErrorCodes.VIEW_NOT_SUPPORTED.getErrorMessage(new Object[] {view, gedcomURL}));
    }
   
    long gedcomLastModified = gedcom.getOrigin().getLastModified();
    if(gedcomLastModified > baseView.lastModified)
    {
      baseView.lastModified = gedcomLastModified;
    }
   
View Full Code Here


    // memcached and the java libraries to access it, the data OUGHT to be
    // set to never expire; the key to the object in memory is the gedcomURL!!!
    File localGedcomFile = downloadGedcomURL(networkReload, request);
    String localGedcomPath = localGedcomFile.getAbsolutePath();
    String filename = "file://"+(localGedcomPath.startsWith("/") ? localGedcomPath : "/"+localGedcomPath);
    Gedcom gedcom = gedcomCache.get(gedcomURL);
   
    if(gedcom != null)
    {
      LOG.finest("gedcom.getOrigin().getLastModified(): "+gedcom.getOrigin().getLastModified());
      LOG.finest("localGedcomFile.lastModified(): "+localGedcomFile.lastModified());
    }
   
    if(gedcom == null || (gedcom.getOrigin().getLastModified() < localGedcomFile.lastModified()))
    {
      synchronized(gedcomCache)
      {
        LOG.finest("Creating the Origin for the GEDCOM file: "+localGedcomPath);
        Origin origin = Origin.create(filename, new Handler());
View Full Code Here

TOP

Related Classes of genj.gedcom.Gedcom

Copyright © 2018 www.massapicom. 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.