Examples of UscSection


Examples of com.cardence.lawshelf.model.UscSection

    if (priorSection != null) {
      // NOT THE FIRST - CLOSE THE PREVIOUS ONE
      sectionEnd();
    }
    // create a new one
    Section newSection = new UscSection();
    newSection.setCode(model.getCode());

    // process document text from comment
    String[] tokenString = StringUtils.tokenizeToStringArray(documentString, " ", true, true);
    for (String str : tokenString) {
      String[] documentElements = StringUtils.split(str, ":");
      if (documentElements == null) {
        log.debug("documentElements does not contain a ':' for string: " + str);
      } else {
        newSection.addAttribute(documentElements[0], documentElements[1]);
      }
    }

    // Is the previous element my parent???
View Full Code Here

Examples of com.cardence.lawshelf.model.UscSection

    // Parent = subpart 5, but there is not a subpart 5
    // create subpart 5

    String[] pathelements = getItemPathElements(parentItemPath);
    String onlyHeadingWeCouldFigureOut = extractHeadingFromItemPath(pathelements, 0);
    Section newParentSection = new UscSection();
    newParentSection.setCode(model.getCode());
    newParentSection.setHeading(onlyHeadingWeCouldFigureOut);
    newParentSection.setShortHeading(onlyHeadingWeCouldFigureOut);
    newParentSection.setSourceReference(parentItemPath);
    newParentSection.addAttribute("itempath", parentItemPath);

    // in order to make this work right, we NEED the parent's parent
    // information to "fit" this in
    // LOOKUP PARENT'S PARENT
    String grampsItemPath = getParentItemPath(parentItemPath);
    String[] grampsPathElements = getItemPathElements(grampsItemPath);
    Integer grampsPrimaryKey = this.model.findPrimaryKey(grampsItemPath);

    if (grampsPrimaryKey == null && grampsPathElements.length > 0) {
      buildMissingParentSection(grampsItemPath);
    }

    String grampsLevelPosition = this.model.findLevelPosition(grampsItemPath);
    Integer grampsCurrentSequence = this.sectionSequenceTracker.get(grampsItemPath);
    Integer grampsNextSequence = 1;
    if (grampsCurrentSequence != null) {
      grampsNextSequence = grampsCurrentSequence + 1;
    }

    // add parent's parent information
    newParentSection.setParentSectionId(grampsPrimaryKey);
    newParentSection.setSectionSequence(grampsNextSequence);
    newParentSection.setParentLevelPosition(grampsLevelPosition);

    // STORE NEW SIMULATED PARENT
    persistence.storeSection(newParentSection);

    assert newParentSection.getId() != null : "Attempting to add a new parent section's primary key, but it is null after a save";
    log.debug("Adding Primary Key for itempath->sectionId: " + parentItemPath + "," + newParentSection.getId());
    this.model.addPrimaryKeyMapping(parentItemPath, newParentSection.getId());
    this.model.addLevelPositionMapping(parentItemPath, newParentSection.getLevelPosition());
    this.sectionSequenceTracker.put(parentItemPath, 0);
    // NEW PARENT IS NOW READY

    return newParentSection;
  }
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.