예제 #1
0
  public void writeToDb() {
    try {
      CaseDetailsModel.insertCaseDetails(this);
      for (Citations c : this.getCitationObjs()) {
        for (CitationCases cs : c.getRefCases()) {
          cs.setCaseRefId(this.getCaseRefId());
          CitationReferenceModel.insertNewCitation(cs);
        }
      }
      for (PageContent p : this.getDocumentPages()) {
        Set<String> insertedSet = new HashSet<String>();
        for (CitationCases cs : p.getRefCases()) {
          cs.setCaseRefId(this.caseRefId);
          // if(CitationReferenceModel.checkCitationExistance(cs.getCaseRefId(), cs.getCitationid(),
          // cs.getPageNumber(), cs.getCountryId(), cs.getCourtId()) > 0)
          // continue;
          String currentString =
              cs.getCaseRefId()
                  + "\t"
                  + cs.getCitationid()
                  + "\t"
                  + cs.getPageNumber()
                  + "\t"
                  + cs.getCountryId()
                  + "\t"
                  + cs.getCourtId();
          if (insertedSet.contains(currentString)) continue;
          insertedSet.add(currentString);
          CitationReferenceModel.insertNewCitation(cs);
        }
      }
    } catch (Exception ex) {

    }
  }
예제 #2
0
 public void extractCitationsFromPageBodyContent() {
   for (PageContent bodyContent : this.getDocumentPages()) {
     FranceCitations citationObj = new FranceCitations();
     citationObj.setCaseId("");
     citationObj.setCitationid(-1);
     citationObj.setCitationString(bodyContent.getPageContent());
     citationObj.setCitationCaseTitles(new ArrayList<String>());
     citationObj.setRefCases(new ArrayList<CitationCases>());
   }
 }
예제 #3
0
  public void extractCNSTCRTCitations(List<String> fileContent) {

    int currentCitationId = 1;
    int citationStartIndex = -1;
    int citationEndIndex = -1;
    int currentPageNo = 0;
    for (String pageContent : fileContent) {
      int startIndex = 0;
      int footerStartIndex = -1;
      boolean footerStartFlag = false;
      while (true) {

        citationStartIndex = this.checkCitationPattern(pageContent, currentCitationId, startIndex);
        if (!footerStartFlag) {
          footerStartIndex = citationStartIndex;
          footerStartFlag = true;
        }
        if (citationStartIndex == -1) break;
        citationEndIndex =
            this.checkCitationPattern(pageContent, currentCitationId + 1, citationStartIndex);
        if (citationEndIndex == -1) citationEndIndex = pageContent.length() - 1;
        String currCitationString =
            pageContent.substring(citationStartIndex, citationEndIndex).replaceAll("\n", " ");

        /*	 Australian Citation object is created for each citation found in the footer	*/
        FranceCitations currentCitationObj =
            new FranceCitations(
                this.getCaseId(),
                this.getCountryName(),
                this.getCourtName(),
                currentCitationId,
                currCitationString.trim(),
                currentPageNo);
        this.getCitationObjs().add(currentCitationObj);
        currentCitationId += 1;
        startIndex = citationEndIndex;
      }
      currentPageNo += 1;
      if (footerStartIndex == -1) {
        footerStartIndex = pageContent.length();
      }

      // changed the pageContent.substring(0,footerStartIndex) to pageContent as it was not
      // extracting important references
      // changed from pagecontent.tolowercase to see if pattern is matched
      PageContent currentPage = new FrancePageContent(currentPageNo, pageContent.toLowerCase());
      this.getDocumentPages().add(currentPage);
      currentPage.searchForeignReferencesInBodyContent();
    }
    return;
  }