Changeset 31867 for main


Ignore:
Timestamp:
2017-08-10T14:19:33+12:00 (7 years ago)
Author:
kjdon
Message:

setting classifier style attribute - can't remember why! Also, need to set teh class loader for the macro resolver AFTER the class loader is constructedsvn diff util/GSXML.java

Location:
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/AbstractBrowse.java

    r30634 r31867  
    7979    protected AbstractBrowse()
    8080    {
     81
    8182    }
    8283
     
    566567                    Node parentNode = current.getParentNode();
    567568
    568                     if (parentNode == null)
     569                    if (parentNode == null || !parentNode.getNodeName().equals(GSXML.CLASS_NODE_ELEM))
    569570                    {
    570                         continue;
     571                      String this_style = getThisType(current.getAttribute(GSXML.NODE_ID_ATT));
     572                      if (this_style != null) {
     573                        current.setAttribute(GSXML.CLASSIFIER_STYLE_ATT, this_style);
    571574                    }
    572 
     575                    }
     576                    else {
    573577                    Element parent = (Element) parentNode;
    574578                    String childType = parent.getAttribute(GSXML.CHILD_TYPE_ATT);
     
    579583
    580584                    current.setAttribute(GSXML.CLASSIFIER_STYLE_ATT, childType);
     585                    }
    581586                }
    582587            } // if want structure
     
    775780    /** Gets the type of list a classifier is (e.g. VList or HList) */
    776781    abstract protected String getChildType(String node_id);
    777 
     782 
     783  /** Gets the type of list this current node is part of */
     784  abstract protected String getThisType(String node_id);
    778785    /**
    779786     * returns the document type of the doc that the specified node belongs to.
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/GS2Browse.java

    r29990 r31867  
    5151    public GS2Browse()
    5252    {
    53       this.macro_resolver = new GS2MacroResolver(this.coll_db, this.class_loader);
     53      this.macro_resolver = new GS2MacroResolver();
    5454    }
    5555
     
    118118        }
    119119        this.gs_doc = gs_doc_db;
     120       
     121        // we need to set the database for our GS2 macro resolver
     122        GS2MacroResolver gs2_macro_resolver = (GS2MacroResolver) this.macro_resolver;
     123        gs2_macro_resolver.setDB(this.coll_db);
     124        // set the class loader in case we have collection specific properties files
     125        gs2_macro_resolver.setClassLoader(this.class_loader);
    120126
    121127   
     
    139145    }
    140146
    141 
     147  /** the type of a node is the same as teh child type of its parent */
     148  protected String getThisType(String node_id) {
     149    String parent_id = OID.getParent(node_id);
     150    if (parent_id.equals(node_id)) {
     151      return null; // no parent so doesn't have a thistype
     152    }
     153    DBInfo info = this.coll_db.getInfo(parent_id);
     154    if (info == null)
     155      {
     156    return null;
     157      }
     158    return info.getInfo("childtype");
     159  }
    142160
    143161
Note: See TracChangeset for help on using the changeset viewer.