Пример #1
0
 private Map<String, Object> toStringRecord(Object o, String entityName) {
   Map<String, Object> words = new HashMap<>();
   PersistenceUnit pu = UPA.getPersistenceUnit();
   Record r =
       (o instanceof Record)
           ? ((Record) o)
           : pu.getEntity(entityName).getBuilder().objectToRecord(o, true);
   if (r != null) {
     for (Map.Entry<String, Object> entry : r.entrySet()) {
       String k = entry.getKey();
       Object v = entry.getValue();
       if (v != null) {
         Entity ve = pu.findEntity(v.getClass());
         if (ve != null) {
           Object mv = ve.getBuilder().getMainValue(v);
           String v2 = String.valueOf(mv);
           if (!StringUtils.isEmpty(v2)) {
             words.put(k, (v2));
           }
         } else if (v instanceof String) {
           if (!StringUtils.isEmpty(v.toString())) {
             words.put(k, (v));
           }
         } else {
           words.put(k, (v));
         }
       }
     }
   }
   return words;
 }
Пример #2
0
  public void openDialog(Config config) {
    if (config == null) {
      config = new Config();
    }

    ViewContext viewContext = new ViewContext();
    PropertyView emailType =
        propertyViewManager
            .createPropertyViews("emailType", RecipientType.class, null, viewContext)[0];
    getModel().setEmailType(emailType);
    // MailboxMessageFormat
    getModel()
        .setMailboxMessageFormat(
            propertyViewManager
                .createPropertyViews(
                    "mailboxMessageFormat", MailboxMessageFormat.class, null, viewContext)[0]);
    String t = config.getTitle();

    getModel().setTitle(StringUtils.isEmpty(t) ? "Envoi de Mail" : t);

    Map<String, Object> options = new HashMap<String, Object>();
    options.put("resizable", false);
    options.put("draggable", false);
    options.put("modal", true);

    RequestContext.getCurrentInstance()
        .openDialog("/modules/mailbox/send-external-mail-dialog", options, null);
  }
Пример #3
0
 public String getPrettyURL() {
   Vr c = Vr.get();
   String context = c.getContext();
   if (!context.endsWith("/")) {
     context = context + "/";
   }
   String p = context + "/p/" + type;
   if (!net.vpc.common.strings.StringUtils.isEmpty(command)) {
     try {
       p += "?a=" + URLEncoder.encode(command, "UTF-8");
     } catch (UnsupportedEncodingException ex) {
       Logger.getLogger(VRMenuDef.class.getName()).log(Level.SEVERE, null, ex);
     }
   }
   return p;
 }
Пример #4
0
 @Override
 public String toString() {
   return StringUtils.nonnull(name);
 }