Exemplo n.º 1
0
  private static String getBody(
      Map<AcquisitionProcessStateType, MultiCounter<AcquisitionProcessStateType>> acquisitionMap,
      Map<RefundProcessStateType, MultiCounter<RefundProcessStateType>> refundMap,
      final VirtualHost virtualHost) {

    final StringBuilder builder =
        new StringBuilder("Caro utilizador, possui processos de aquisições pendentes nas ");
    builder.append(virtualHost.getApplicationSubTitle().getContent());
    builder.append(", em https://");
    builder.append(virtualHost.getHostname());
    builder.append("/.\n");

    if (!acquisitionMap.isEmpty()) {
      builder.append("Regime simplificado\n");
      for (final MultiCounter<AcquisitionProcessStateType> multiCounter : acquisitionMap.values()) {
        builder.append("\t");
        builder.append(multiCounter.getCountableObject().getLocalizedName());
        builder.append("\t");
        builder.append(ProcessMapGenerator.getDefaultCounter(multiCounter).getValue());
        builder.append("\n");
        final Set<SimplifiedProcedureProcess> processes =
            (Set) ProcessMapGenerator.getDefaultCounter(multiCounter).getObjects();
        if (processes.size() < 25) {
          for (final SimplifiedProcedureProcess process : processes) {
            builder.append("\t\t");
            builder.append(process.getProcessNumber());
            builder.append("\n");
          }
        }
      }
    }
    if (!refundMap.isEmpty()) {
      builder.append("Processos de reembolso\n");
      for (final MultiCounter<RefundProcessStateType> multiCounter : refundMap.values()) {
        builder.append("\t");
        builder.append(multiCounter.getCountableObject().getLocalizedName());
        builder.append("\t");
        builder.append(ProcessMapGenerator.getDefaultCounter(multiCounter).getValue());
        builder.append("\n");
        final Set<RefundProcess> processes =
            (Set) ProcessMapGenerator.getDefaultCounter(multiCounter).getObjects();
        if (processes.size() < 25) {
          for (final RefundProcess process : processes) {
            builder.append("\t\t");
            builder.append(process.getProcessNumber());
            builder.append("\n");
          }
        }
      }
    }
    return builder.toString();
  }
 public static boolean isActive() {
   final VirtualHost virtualHost = VirtualHost.getVirtualHostForThread();
   return virtualHost != null && isActive(virtualHost.getHostname());
 }