Package com.stimulus.archiva.domain.fields

Examples of com.stimulus.archiva.domain.fields.EmailFieldValue


       }
      EmailFields emailFields = Config.getConfig().getEmailFields();
       for (EmailField field : emailFields.getAvailableFields().values()) {
        
         String value = "";
         EmailFieldValue efv2 = message.getFields().get(field.getIndex());
         if (efv2!=null && efv2.getValue()!=null) {
           value = efv2.getValue();
         }
       
         if (Compare.equalsIgnoreCase(field.getName(), "body") ||
           Compare.equalsIgnoreCase(field.getName(), "attachments"))  
           continue; // we handle this later
View Full Code Here


   
   public List<DisplayField> getFieldValues() {
     ArrayList<DisplayField>  list = new ArrayList<DisplayField>();
     Iterator i = email.getFields().iterateValues();
     while (i.hasNext()) {
       EmailFieldValue efv = (EmailFieldValue)i.next();
      
//       we dont allow end-users to view bcc or delivered-to flags
        if (efv.getField().getName().equals("bcc") && getMailArchivaPrincipal().getRole().equals("user"))
          continue;
        if (efv.getField().getName().equals("deliveredto") && getMailArchivaPrincipal().getRole().equals("user"))
          continue;
       
       if (efv.getField().getViewEmail()==EmailField.AllowViewMail.VIEWMAIL) {
         list.add(DisplayField.getDisplayField(efv, getLocale(),true));
       }
     }
     return list;
   }
View Full Code Here

     ArrayList<DisplayField>  list = new ArrayList<DisplayField>();
     Iterator i = EmailField.getAvailableFields().iterateValues();
     while (i.hasNext()) {
       EmailField field = (EmailField)i.next();
       if (field.getShowInResults()!=EmailField.ShowInResults.NORESULTS) {
         EmailFieldValue efv = searchResult.getFieldValue(field.getName());
         list.add(DisplayField.getDisplayField(efv , locale,false));
       }
     }
     return list;
   }
View Full Code Here

          }
          String value = "";
          EmailField field = EmailField.get(key);
          if (field!=null) {
            if (Compare.equalsIgnoreCase(key, "score"))
              return new EmailFieldValue(field,Float.toString(round(score * 100, 2)) + "%");
            EmailField.SearchMethod searchMethod = field.getSearchMethod();
            if (searchMethod==EmailField.SearchMethod.STORED) {
              value = doc.get(field.getIndexKey());
            } else if (searchMethod==EmailField.SearchMethod.TOKENIZED_AND_STORED) {
              value = doc.get(field.getIndexKey()+"s");
            }
            return new EmailFieldValue(field,value);
          }
          logger.error("failed to retrieve email field {key='"+key+"'}");
          return null;
        }
View Full Code Here

         boolean archiveDateFound = false;
       Hashtable<String,EmailFieldValue> fields = message.getFields();
       Enumeration e = fields.elements();
       while (e.hasMoreElements()) {
        
         EmailFieldValue efv = (EmailFieldValue)e.nextElement();
        String fieldName = efv.getField().getName();
       
        String fieldValue = efv.getValue();
       
         if (Compare.equalsIgnoreCase(efv.getField().getName(), "body") ||
           Compare.equalsIgnoreCase(efv.getField().getName(), "attachments"))  
           continue; // we handle this later

         EmailField.SearchMethod searchMethod = efv.getField().getSearchMethod();
        
         if (searchMethod==EmailField.SearchMethod.STORED)
           doc.add(new Field(efv.getField().getIndexKey(),efv.getValue(),Field.Store.YES,Field.Index.UN_TOKENIZED));
         else if (searchMethod==EmailField.SearchMethod.TOKENIZED)
           doc.add(new Field(efv.getField().getIndexKey(),efv.getValue(),Field.Store.NO,Field.Index.TOKENIZED));
         else if (searchMethod==EmailField.SearchMethod.TOKENIZED_AND_STORED) {
          doc.add(new Field(efv.getField().getIndexKey()+"s",efv.getValue(),Field.Store.YES,Field.Index.UN_TOKENIZED));
           doc.add(new Field(efv.getField().getIndexKey(),efv.getValue(),Field.Store.NO,Field.Index.TOKENIZED));
         }
       }
      
       Config config = ConfigurationService.getConfig();
       if (config.getIndexMessageBody()) {
View Full Code Here

    if (getEmailId() != null) {
      outStr.append(getEmailId().toString());
      outStr.append(",");
    }
    for (Iterator it = getFields().values().iterator(); it.hasNext();) {
      EmailFieldValue efv = (EmailFieldValue) it.next();
      outStr.append(efv);
      outStr.append(",");
    }
    outStr.setLength(outStr.length() - 1);
    return outStr.toString();
View Full Code Here

    field = field.trim().toLowerCase(Locale.ENGLISH);

    if (EmailField.get(field) == null) // field not supported
      return;

    EmailFieldValue existingValue = (EmailFieldValue) applicationFields
        .get(field);
    if (existingValue == null)
      applicationFields.put(field, new EmailFieldValue(EmailField
          .get(field), value));
    else {
      String oldValue = existingValue.getValue();
      if (oldValue != null && oldValue.indexOf(value) == -1)
        applicationFields.put(field, new EmailFieldValue(EmailField
            .get(field), oldValue + ", " + value));
    }

  }
View Full Code Here

      EmailField field = emailFields.get(key);
      if (field!=null) {
          if (Compare.equalsIgnoreCase(key, "score")) {
            float score = 0;
            score = scoreDoc.score;
            return new EmailFieldValue(field,Float.toString(round(score * 100, 2)) + "%");
          }
          EmailField.SearchMethod searchMethod = field.getSearchMethod();
          if (searchMethod==EmailField.SearchMethod.STORED) {
          value = doc.get(field.getIndex());
          } else if (searchMethod==EmailField.SearchMethod.TOKENIZED_AND_STORED) {
          value = doc.get(field.getIndex()+"s");
          }
          return new EmailFieldValue(field,value);
      }
      logger.error("failed to retrieve email field {key='"+key+"'}");
      return null;
    }
View Full Code Here

       
        EmailFields emailFields = Config.getConfig().getEmailFields();
         for (EmailField field : emailFields.getAvailableFields().values()) {
          
           String value = "";
           EmailFieldValue efv2 = message.getFields().get(field.getIndex());
           if (efv2!=null && efv2.getValue()!=null) {
             value = efv2.getValue();
           }
         
          if ( Compare.equalsIgnoreCase(field.getName(), "body") ||
             Compare.equalsIgnoreCase(field.getName(), "attachments") ||
             Compare.equalsIgnoreCase(field.getName(), "attachname"))  
View Full Code Here

      String[] fields = searchResult.getFields();
      String[] values = searchResult.getFieldValues();
      EmailFields emailFields = Config.getConfig().getEmailFields();
      for (int i=0;i<fields.length;i++) {
        if (fields[i].equalsIgnoreCase(key)) {
          return new EmailFieldValue(emailFields.get(fields[i]),values[i]);
        }
      }
      logger.error("failed to retrieve email field {key='"+key+"'}");
      return null;
    }
View Full Code Here

TOP

Related Classes of com.stimulus.archiva.domain.fields.EmailFieldValue

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.