Package dnb.data

Examples of dnb.data.Label


  @Override
  public Object getValueAt(int rowIndex, int columnIndex) { 
    if (columnIndex == 0) {
      return labels.get(rowIndex).getName();
    } else {
      Label l = labels.get(rowIndex);
      final int c = l.size();
      String entry = "";
      for (int i = 0; i < c; i++) {
        entry+= l.get(i) + " ";
      }
      return entry;
    }   
  }
View Full Code Here


  @SuppressWarnings("unchecked")
  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);
View Full Code Here

  private static void findLabelByLabelcode(Repository labelLookup,
      MatchResult labelCodeMatch, Map<NfoField, MatchResult> matchStore) {
   
    String lc = labelCodeMatch.getMatch();
    MatchResult mlbl;
    Label other = labelLookup.findByLabelcode(lc);
    if (other != null) { // we got a label name for our code
      // => create virtual label name match!
      mlbl = new MatchResult(other.getName(), Source.LOOKUP, Status.KNOWN);
      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

    for (Label l : labels) {
      if (l.getName().equalsIgnoreCase(name)) {       
        return l;
      }
    }   
    Label l = new LabelHibernateImpl(this, name);
    List<?> ll = labels; // old trick, we know Genre is a repo object
    InsertionSort.insert((List<RepositoryObjectHibernateImpl>)ll, (RepositoryObjectHibernateImpl) l);
    save(l);
    return l;
  }
View Full Code Here

      if (c.getName().equalsIgnoreCase(code)) {       
        return;
      }
    }
    //  not belonging to this, check if code is already assigned to other labels
    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);
View Full Code Here

   
    if (matchSource.containsKey(NfoField.GENRE)) {
      target.setGenre(repository.getGenre(matchSource.get(NfoField.GENRE).getMatch()));
    }
   
    Label l = null;
    if(matchSource.containsKey(NfoField.RECORD_LABEL)) {
      l = repository.getLabel(matchSource.get(NfoField.RECORD_LABEL).getMatch());
      target.setRecordLabel(l);
    }
    if(matchSource.containsKey(NfoField.LABEL_CODE)
        && matchSource.containsKey(NfoField.LABEL_CODE_NO)
        && matchSource.containsKey(NfoField.LABEL_CODE_SUFFIX)) {
       
      target.setLabelCode(new CatalogNumberHibernateImpl(matchSource.get(NfoField.LABEL_CODE).getMatch(),
          Integer.parseInt(matchSource.get(NfoField.LABEL_CODE_NO).getMatch()),
          matchSource.get(NfoField.LABEL_CODE_SUFFIX).getMatch()));
      if (l != null) {
        l.addCode(matchSource.get(NfoField.LABEL_CODE).getMatch());
      }
    }
  }
View Full Code Here

TOP

Related Classes of dnb.data.Label

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.