Package dnb.data

Examples of dnb.data.Labelcode


  private static void createLabelcodeMatchFromLabel(
      Map<NfoField, MatchResult> matches, MatchResult labelNameMatch) {
    SimilarScanResult<Label> sr = (SimilarScanResult<Label>) labelNameMatch.getSimilarScanResult();
    if (sr != null) { // at least one found label
      Label l = null; // holds the found label
      Labelcode lc;
      SimilarScanResult<Labelcode> srlc = null; // holds the label code alternatives
      Match<Labelcode> mt = null; // holds the virtual match
      // => create virtual label code match from best label match having codes
      final int c = sr.size();
      MatchResult mr = null;
     
      for (int i = 0; i < c; i++) { // iterate label matches
        l = sr.get(i).getFoundObject(); // get label object from match
        if (l.size() == 0) { continue; } // label has no codes => skip
        // label has codes => create matches
        int ci = 0;
        if (mr == null) { // no match result yet => create from best entry & store
          mr = new MatchResult(l.get(ci++).getName(), Source.LOOKUP, Status.SIMILAR); // XXX derived, (not similar) entry ! 
          matches.put(NfoField.LABEL_CODE, mr);
        }
        for (int y = ci; y < l.size(); y++) { // => add other codes as alternatives
          lc = l.get(y);
          // XXX for now, use fake leven, but create virtual match type l8a on
          mt = new Match<Labelcode>(MatchType.LEVENSHTEIN, lc.getName(), lc);
          if (srlc == null) {
            srlc = new SimilarScanResult<Labelcode>(mt);
            mr.setSimilarScanResult(srlc);
          } else { srlc.add(mt); }
        }
View Full Code Here


      mlbl.setSimilarScanResult(new SimilarScanResult<Label>(
          new Match<Label>(MatchType.EXACT, other.getName(), other)));
      matchStore.put(NfoField.RECORD_LABEL, mlbl);
      // set label code match to green & create EXACT scan result
      labelCodeMatch.setStatus(Status.KNOWN);
      Labelcode found = other.findLabelcode(lc); // refind to get the lc object
      labelCodeMatch.setSimilarScanResult(new SimilarScanResult<Labelcode>(
          new Match<Labelcode>(MatchType.EXACT, found.getName(), found)));
    } else { // no label name could be parsed AND no label found for our code
      labelCodeMatch.setStatus(MatchResult.Status.UNKNOWN); // => set to unknown, too
    }
  }
View Full Code Here

    Label lo = parent.isLabelCodeAssigned(this, code);
    if (lo != null) {
      throw new IllegalArgumentException(code + " is already assigned to " + lo);
    }
    // ok, insert   
    Labelcode lc = new LabelcodeHibernateImpl(code);
    List l = codes; // old trick, we know lc is a repo object
    InsertionSort.insert((List<RepositoryObjectHibernateImpl>)l, (RepositoryObjectHibernateImpl) lc);
    // save this to get ref in join table !
    parent.save(this);
   
View Full Code Here

TOP

Related Classes of dnb.data.Labelcode

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.