Пример #1
0
  private Usuario crearExterno(Usuario usuario, String cargo) {
    logger.setLevel(Level.ALL);
    logger.entering(this.getClass().getName(), "crearExterno");

    if (usuario != null) {
      Usuario nuevoExterno = usuario;
      Area areaExterno = areaFacade.findByArea("Otro");
      TipoUsuario tue = tipoUsuarioFacade.findByTipo("Externo");
      Cargo cargoExterno = cargoFacade.findByCargo(cargo);
      if (cargoExterno == null) {
        Cargo nuevo = new Cargo();
        nuevo.setNombreCargo(cargo);
        cargoFacade.create(nuevo);
        cargoExterno = cargoFacade.findByCargo(cargo);
      }

      nuevoExterno.setAreaidArea(areaExterno);
      nuevoExterno.setCargoidCargo(cargoExterno);
      nuevoExterno.setTipoUsuarioidTipoUsuario(tue);
      nuevoExterno.setEstadoUsuario(Boolean.TRUE);
      nuevoExterno.setMailUsuario("na");
      nuevoExterno.setPassUsuario("na");
      logger.finest("se inicia la persistencia del nuevo usuario externo");
      usuarioFacade.create(nuevoExterno);
      logger.finest("se finaliza la persistencia del nuevo usuario externo");

      nuevoExterno = usuarioFacade.findByRUN(usuario.getRutUsuario());
      if (nuevoExterno != null) {
        logger.exiting(this.getClass().getName(), "crearExterno", nuevoExterno.toString());
        return nuevoExterno;
      }
    }
    logger.exiting(this.getClass().getName(), "crearExterno", null);
    return null;
  }
Пример #2
0
  // retorna true cuando el usuario si ha particiado en la cc.
  @Override
  public boolean esParticipanteCC(Formulario formulario, Usuario usuario) {
    logger.setLevel(Level.ALL);
    logger.entering(this.getClass().getName(), "obtenerParticipantesCC");
    if (usuario.equals(formulario.getUsuarioidUsuario1())) {
      logger.exiting(this.getClass().getName(), "obtenerParticipantesCC", true);
      return true;
    }
    List<Traslado> traslados = trasladoFacade.findByNue(formulario);
    if (traslados == null || traslados.isEmpty()) {
      logger.log(Level.INFO, "formulario ''{0}'' no registra traslados", formulario.getNue());
      logger.exiting(this.getClass().getName(), "obtenerParticipantesCC", false);
      return false;
    }

    if (traslados
        .get(0)
        .getUsuarioidUsuario()
        .equals(usuario)) { // valida 1er traslado, útil para digitador.
      logger.exiting(this.getClass().getName(), "obtenerParticipantesCC", true);
      return true;
    }

    for (int i = 0; i < traslados.size(); i++) {
      if (traslados.get(i).getUsuarioidUsuario1().equals(usuario)) {
        logger.exiting(this.getClass().getName(), "obtenerParticipantesCC", true);
        return true;
      }
    }
    logger.exiting(this.getClass().getName(), "obtenerParticipantesCC", false);
    return false;
  }
Пример #3
0
  // se crea una nueva edicion para el formulario indicado.
  @Override
  public String edicionFormulario(Formulario formulario, String obsEdicion, Usuario usuarioSesion) {
    logger.setLevel(Level.ALL);
    logger.entering(this.getClass().getName(), "edicionFormulario");
    if (obsEdicion == null) {
      logger.exiting(this.getClass().getName(), "edicionFormulario", "falta observación.");
      return "Se requiere la observación.";
    }

    // verificando que el usuario que edita si haya participado en la cc.
    if (!esParticipanteCC(formulario, usuarioSesion)) {
      logger.exiting(
          this.getClass().getName(), "edicionFormulario", "usuario no ha participado en cc");
      return "Ud no ha participado en esta cadena de custodia.";
    }

    // Creando el objeto edicion
    EdicionFormulario edF = new EdicionFormulario();

    edF.setFormularioNUE(formulario);
    edF.setUsuarioidUsuario(usuarioSesion);
    edF.setObservaciones(obsEdicion);
    edF.setFechaEdicion(new Date(System.currentTimeMillis()));

    // Actualizando ultima edicion formulario
    formulario.setUltimaEdicion(edF.getFechaEdicion());

    edicionFormularioFacade.edit(edF);
    formularioFacade.edit(formulario);

    logger.exiting(this.getClass().getName(), "edicionFormulario", "Exito");
    return "Exito";
  }
Пример #4
0
  // retorna true cuando el usuario si ha particiado en la cc.
  private boolean esParticipanteCC(Formulario formulario, Usuario usuario) {
    logger.setLevel(Level.ALL);
    logger.entering(this.getClass().getName(), "obtenerParticipantesCC");
    if (usuario.equals(formulario.getUsuarioidUsuario1())) {
      logger.exiting(this.getClass().getName(), "obtenerParticipantesCC", true);
      return true;
    }
    List<Traslado> traslados = trasladoFacade.findByNue(formulario);

    if (traslados
        .get(0)
        .getUsuarioidUsuario()
        .equals(usuario)) { // valida 1er traslado, útil para digitador.
      logger.exiting(this.getClass().getName(), "obtenerParticipantesCC", true);
      return true;
    }

    for (int i = 0; i < traslados.size(); i++) {
      if (traslados.get(i).getUsuarioidUsuario1().equals(usuario)) {
        logger.exiting(this.getClass().getName(), "obtenerParticipantesCC", true);
        return true;
      }
    }
    logger.exiting(this.getClass().getName(), "obtenerParticipantesCC", false);
    return false;
  }
  /**
   * Check the schema exists and if not we will use the default schema
   *
   * @return
   * @throws SQLException
   */
  private boolean isOracleSchemaValid() throws SQLException {

    logger.entering(CLASSNAME, "isOracleSchemaValid");
    boolean result = false;
    Connection conn = null;
    DatabaseMetaData dbmd = null;
    ResultSet rs = null;

    try {
      conn = getConnectionToDefaultSchema();
      dbmd = conn.getMetaData();
      rs = dbmd.getSchemas();

      while (rs.next()) {

        String schemaname = rs.getString("TABLE_SCHEM");
        if (schema.equalsIgnoreCase(schemaname)) {
          logger.exiting(CLASSNAME, "isSchemaValid", true);
          return true;
        }
      }
    } catch (SQLException e) {
      logger.severe(e.getLocalizedMessage());
      throw e;
    } finally {
      cleanupConnection(conn, rs, null);
    }
    logger.exiting(CLASSNAME, "isOracleSchemaValid", false);

    return result;
  }
Пример #6
0
  /**
   * Calculate the boolean complexity of the given expression. NPath boolean complexity is the sum
   * of && and || tokens. This is calculated by summing the number of children of the &&'s (minus
   * one) and the children of the ||'s (minus one).
   *
   * <p>Note that this calculation applies to Cyclomatic Complexity as well.
   *
   * @param expr control structure expression
   * @return complexity of the boolean expression
   */
  public static int sumExpressionComplexity(ASTExpression expr) {
    LOGGER.entering(CLASS_NAME, "visit(ASTExpression)");
    if (expr == null) {
      LOGGER.exiting(CLASS_NAME, "visit(ASTExpression)", 0);
      return 0;
    }

    List<ASTConditionalAndExpression> andNodes =
        expr.findDescendantsOfType(ASTConditionalAndExpression.class);
    List<ASTConditionalOrExpression> orNodes =
        expr.findDescendantsOfType(ASTConditionalOrExpression.class);

    int children = 0;

    for (ASTConditionalOrExpression element : orNodes) {
      children += element.jjtGetNumChildren();
      children--;
    }

    for (ASTConditionalAndExpression element : andNodes) {
      children += element.jjtGetNumChildren();
      children--;
    }

    LOGGER.exiting(CLASS_NAME, "visit(ASTExpression)", children);
    return children;
  }
Пример #7
0
  /**
   * Locates the array literal specified by the <code>array</code> node, in the source using the
   * source location information provided by the node, and inserts <code>str</code> as a string
   * literal (quoted) in the source at the end of the array.
   *
   * @param array Node with source position information
   * @param str the string to insert into the source at the end of the specified array
   */
  public void appendToArrayLit(Node array, String str) {
    final String sourceMethod = "appendToArrayLit"; // $NON-NLS-1$
    if (isTraceLogging) {
      log.entering(JSSource.class.getName(), sourceMethod, new Object[] {array, str});
    }
    // Get the node for the last element in the array
    Node lastChild = array.getLastChild();

    // If token is not a string, then punt
    if (lastChild.getType() != Token.STRING && lastChild.getType() != Token.NAME) {
      if (log.isLoggable(Level.WARNING)) {
        log.warning(
            "Last element of array at "
                + mid
                + "("
                + array.getLineno()
                + ","
                + array.getCharno()
                + ") is type "
                + array.getType()); // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
      }
      if (isTraceLogging) {
        log.exiting(JSSource.class.getName(), sourceMethod);
      }
      return;
    }
    int len =
        lastChild.getString().length()
            + (lastChild.getType() == Token.STRING ? 2 : 0); // add 2 for string quotes

    // Search the source for the closing array bracket ']', skipping over
    // whitespace and comments.  In order to be valid javascript, the next
    // token must be the closing bracket.
    int lineno = lastChild.getLineno();
    int charno = lastChild.getCharno() + len;
    PositionLocator pos = new PositionLocator(lineno, charno);
    if (pos.findNextJSToken() == ']') {
      insert(",\"" + str + "\"", pos.getLineno(), pos.getCharno()); // $NON-NLS-1$ //$NON-NLS-2$
    } else {
      if (log.isLoggable(Level.WARNING)) {
        log.warning(
            "Closing array bracket not found in "
                + mid
                + "("
                + lineno
                + ","
                + charno
                + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
      }
    }
    if (isTraceLogging) {
      log.exiting(JSSource.class.getName(), sourceMethod);
    }
  }
Пример #8
0
  @Override
  public Formulario findFormularioByNue(int nueAbuscar) {

    logger.setLevel(Level.ALL);
    logger.entering(this.getClass().getName(), "findFormularioByNue", nueAbuscar);

    Formulario formulario = formularioFacade.findByNue(nueAbuscar);
    if (formulario != null) {
      logger.exiting(this.getClass().getName(), "findFormularioByNue", formulario.toString());
      return formulario;
    }
    logger.exiting(this.getClass().getName(), "findFormularioByNue", "Error con formulario");
    return null;
  }
Пример #9
0
  /**
   * フレームの種類を判別して、登録されたRequestProcessorの適切なメソッドを呼び出す。 すでに処理済みであれば何も行なわない。
   *
   * @param subnet 受信したフレームの送受信が行なわれたサブネット
   * @param frame 受信したフレーム
   * @param processed 指定されたフレームがすでに処理済みである場合にはtrue、そうでなければfalse
   * @return 指定されたフレームを処理した場合にはtrue、そうでなければfalse
   */
  @Override
  public boolean process(Subnet subnet, Frame frame, boolean processed) {
    logger.entering(className, "process", new Object[] {subnet, frame, processed});

    if (processed) {
      logger.exiting(className, "process", false);
      return false;
    }

    if (!frame.getCommonFrame().isStandardPayload()) {
      logger.exiting(className, "process", false);
      return false;
    }

    boolean success = false;
    CommonFrame cf = frame.getCommonFrame();
    StandardPayload payload = cf.getEDATA(StandardPayload.class);

    if (payload == null) {
      logger.exiting(className, "process", false);
      return false;
    }

    switch (payload.getESV()) {
      case SetI:
        success = this.processSetI(subnet, frame);
        break;
      case SetC:
        success = this.processSetC(subnet, frame);
        break;
      case Get:
        success = this.processGet(subnet, frame);
        break;
      case SetGet:
        success = this.processSetGet(subnet, frame);
        break;
      case INF_REQ:
        success = this.processINF_REQ(subnet, frame);
        break;
      case INF:
        success = this.processINF(subnet, frame);
        break;
      case INFC:
        success = this.processINFC(subnet, frame);
        break;
    }

    logger.exiting(className, "process", success);
    return success;
  }
Пример #10
0
 // ** modificada para retornar una lista vacía si no encuentra resultados.
 @Override
 public List<Traslado> traslados(Formulario formulario) {
   logger.setLevel(Level.ALL);
   logger.entering(this.getClass().getName(), "traslados", formulario.toString());
   List<Traslado> retorno = trasladoFacade.findByNue(formulario);
   if (retorno == null) {
     retorno = new ArrayList<>();
     logger.exiting(this.getClass().getName(), "traslados", retorno.size());
     return retorno;
   } else {
     logger.exiting(this.getClass().getName(), "traslados", retorno.size());
     return retorno;
   }
 }
Пример #11
0
  /**
   * Wrapper method to get a list of pending invites for a user
   *
   * @param parameters list of query string parameters to pass to API
   * @return Collection<ConnectionEntry>
   * @throws ProfileServiceException
   */
  private Collection<ConnectionEntry> getMyInvites(Map<String, String> parameters)
      throws ProfileServiceException {
    if (logger.isLoggable(Level.FINEST)) {
      logger.entering(sourceClass, "getMyInvites", parameters);
    }

    Document data = null;
    Collection<ConnectionEntry> invites = null;
    String url =
        resolveProfileUrl(
            ProfileEntity.NONADMIN.getProfileEntityType(),
            ProfileType.CONNECTIONS.getProfileType());
    data = executeGet(url, parameters, ClientService.FORMAT_XML);
    if (parameters.containsKey("outputType")) {
      if (parameters.get("outputType").equalsIgnoreCase("profile")) {
        invites = Converter.returnConnectionEntries(data, "profile");
      } else invites = Converter.returnConnectionEntries(data, "connection");
    } else {
      invites = Converter.returnConnectionEntries(data, "connection");
    }
    if (logger.isLoggable(Level.FINEST)) {
      logger.exiting(sourceClass, "getMyInvites");
    }
    return invites;
  }
Пример #12
0
  /**
   * 指定されたRequestProcessorがリクエスト処理を行なうように登録する。
   *
   * @param processor リクエスト処理を実行するRequestProcessor
   */
  public synchronized void addRequestProcessor(RequestProcessor processor) {
    logger.entering(className, "addRequestProcessor", processor);

    processors.add(processor);

    logger.exiting(className, "addRequestProcessor");
  }
Пример #13
0
  /**
   * 指定されたRequestProcessorがリクエスト処理を行なわないように登録を抹消する。
   *
   * @param processor リクエスト処理を停止するRequestProcessor
   */
  public synchronized void removeRequestProcessor(RequestProcessor processor) {
    logger.entering(className, "removeRequestProcessor", processor);

    processors.remove(processor);

    logger.exiting(className, "removeRequestProcessor");
  }
Пример #14
0
 @Override
 public final void run() {
   final Locus locus = context.getLocus();
   final Bundle bundle = context.getBundle();
   final Alerts alerts = context.getAlerts();
   final File file = context.getFile();
   final String href = context.getHref();
   try {
     logger.entering(getClass().getName(), Runnable.class.getName());
     script.start();
     runInner();
   } catch (IOException e) {
     alerts.add(new Alert(Alert.Severity.ERR, e.getMessage(), e.getClass().getSimpleName()));
   } finally {
     script.finish();
   }
   try {
     new ScriptWriter(script, locus).writeTo(file);
     new AlertWriter(bundle, alerts).write("command.finished", "results.view", href);
   } catch (IOException e) {
     alerts.add(new Alert(Alert.Severity.ERR, e.getMessage()));
   } finally {
     logger.exiting(getClass().getName(), Runnable.class.getName());
   }
 }
Пример #15
0
  /** RequestDispatcherを生成する。 */
  public RequestDispatcher() {
    logger.entering(className, "RequestDispatcher");

    processors = new LinkedList<RequestProcessor>();

    logger.exiting(className, "RequestDispatcher");
  }
Пример #16
0
 @Override
 public Object visit(PLSQLNode node, Object data) {
   LOGGER.entering(CLASS_NAME, "visit(SimpleNode)");
   int npath = complexityMultipleOf(node, 1, data);
   LOGGER.exiting(CLASS_NAME, "visit(SimpleNode)", npath);
   return Integer.valueOf(npath);
 }
Пример #17
0
 /**
  * Returns profile's of multiple user's.
  *
  * @param userIds
  * @return Profile[]
  * @throws ProfileServiceException
  */
 private Profile[] getProfiles(String[] userIds) throws ProfileServiceException {
   if (logger.isLoggable(Level.FINEST)) {
     logger.entering(sourceClass, "getProfiles", userIds);
   }
   Profile[] profiles = new Profile[userIds.length];
   int i = 0;
   if (userIds != null) {
     for (String userId : userIds) {
       if (userId != null) {
         profiles[i] = getProfile(userId);
         i++;
       } else // elementary NP handling. Setting the profile null;
       {
         profiles[i] = null;
         i++;
       }
     }
   }
   if (logger.isLoggable(Level.FINEST)) {
     String log = "call to retrive profiles successful";
     if (profiles != null) {
       for (Profile profile : profiles) {
         if (null == profile) {
           log = "Empty response from server for one of the requested profiles";
           break;
         }
       }
       log = "";
     }
     logger.exiting(sourceClass, "getProfiles", log);
   }
   return profiles;
 }
Пример #18
0
  void start() throws KeyStoreException, CertificateEncodingException, IOException {
    if (Configuration.DEBUG) log.entering(this.getClass().getName(), "start"); // $NON-NLS-1$
    ensureStoreContainsAlias();
    Certificate certificate;
    if (store.isCertificateEntry(alias)) {
      if (Configuration.DEBUG)
        log.fine("Alias [" + alias + "] is a trusted certificate"); // $NON-NLS-1$ //$NON-NLS-2$
      certificate = store.getCertificate(alias);
    } else {
      if (Configuration.DEBUG)
        log.fine("Alias [" + alias + "] is a key entry"); // $NON-NLS-1$ //$NON-NLS-2$
      Certificate[] chain = store.getCertificateChain(alias);
      certificate = chain[0];
    }

    byte[] derBytes = certificate.getEncoded();
    if (rfc) {
      String encoded = Base64.encode(derBytes, 72);
      PrintWriter pw = new PrintWriter(outStream, true);
      pw.println("-----BEGIN CERTIFICATE-----"); // $NON-NLS-1$
      pw.println(encoded);
      pw.println("-----END CERTIFICATE-----"); // $NON-NLS-1$
    } else outStream.write(derBytes);

    // stream is closed in Command.teardown()
    if (Configuration.DEBUG) log.exiting(this.getClass().getName(), "start"); // $NON-NLS-1$
  }
Пример #19
0
  private void initParam() {
    lg.entering(TyPun.class.getName(), "initParam");

    /* keep track of parameter’s values that will be used */
    lg.config(
        String.format("Use typographic punctuation : %s", tc.do_UsePunctuation() ? "YES" : "NO"));
    lg.config(String.format("Use ligatures : %s", tc.do_UseLigatures() ? "YES" : "NO"));
    lg.config(String.format("Use old ligatures : %s", tc.do_UseOldLigatures() ? "YES" : "NO"));
    lg.config(String.format("Use French quotes : %s", tc.do_UseFrenchQuotes() ? "YES" : "NO"));
    lg.config(String.format("Use old style numbers : %s", tc.do_UseOldStyleNums() ? "YES" : "NO"));
    lg.config(String.format("Use French spacing : %s", tc.do_UseFrenchSpacing() ? "YES" : "NO"));
    lg.config(String.format("Use typographic dashes : %s", tc.do_UseTypoDash() ? "YES" : "NO"));

    /* left and right double quotes are currently defined at compile-time
     * but the code needs very few changes to make it dynamic. That way we
     * may use English or French quotes running the exact same code */
    // ldquo = bUseFrenchQuotes ? "\u00ab" : "\u201c"; /* U+00ab « U+201c “ */
    // rdquo = bUseFrenchQuotes ? "\u00bb" : "\u201d"; /* U+00bb » U+201d ” */
    ldquo = tc.do_UseFrenchQuotes() ? "\u00ab" : "\u201c"; /* U+00ab « U+201c “ */
    rdquo = tc.do_UseFrenchQuotes() ? "\u00bb" : "\u201d"; /* U+00bb » U+201d ” */

    tydash = "\u2013";
    /* tydash = "\u2014"; */

    lg.exiting(TyPun.class.getName(), "initParam");
  }
Пример #20
0
 /**
  * Wrapper method to send Invite to a user to become colleague
  *
  * @param profile profile of the user to whom the invite is to be sent
  * @param inviteMsg Invite message to the other user
  * @return value is true if invite is sent successfully else value is false
  * @throws ProfileServiceException
  */
 public boolean sendInvite(Profile profile, String inviteMsg) throws ProfileServiceException {
   if (logger.isLoggable(Level.FINEST)) {
     logger.entering(sourceClass, "getColleagues", inviteMsg);
   }
   if (profile == null) {
     throw new IllegalArgumentException(StringUtil.format("A null profile was passed"));
   }
   Map<String, String> parameters = new HashMap<String, String>();
   String url =
       resolveProfileUrl(
           ProfileEntity.NONADMIN.getProfileEntityType(),
           ProfileType.CONNECTIONS.getProfileType());
   if (isEmail(profile.getReqId())) {
     parameters.put(ProfileRequestParams.EMAIL, profile.getReqId());
   } else {
     parameters.put(ProfileRequestParams.USERID, profile.getReqId());
   }
   parameters.put("connectionType", "colleague");
   XMLProfilesPayloadBuilder builder = XMLProfilesPayloadBuilder.INSTANCE;
   Object content = builder.generateInviteRequestPayload(inviteMsg);
   // getClientService().post(url, parameters, content);
   boolean result = executePost(url, parameters, null, content, null);
   if (logger.isLoggable(Level.FINEST)) {
     logger.exiting(sourceClass, "getColleagues");
   }
   return result;
 }
Пример #21
0
 private boolean compareFechas(Date fechaT, Date fechaFormulario) {
   logger.setLevel(Level.ALL);
   logger.entering(this.getClass().getName(), "compareFechas");
   if (fechaT != null && fechaFormulario != null) {
     Date dateTraslado = fechaT;
     Date dateFormulario = fechaFormulario;
     if (dateTraslado.equals(dateFormulario) || dateTraslado.after(dateFormulario)) {
       logger.exiting(this.getClass().getName(), "compareFechas", true);
       return true;
     }
   } else {
     logger.severe("Error con fechas");
   }
   logger.exiting(this.getClass().getName(), "compareFechas", false);
   return false;
 }
  public Date getTriggerTimeForPhase(WorkflowTransactionPhase phase) throws ApplicationException {
    if (LOG.isLoggable(Level.FINER)) {
      LOG.entering(
          AutoRejectNewItemTransition.class.getName(),
          "#AutoReject: getTriggerTimeForPhase",
          new Object[] {phase});
    }

    NewItemPlacementBean nipb =
        NewItemServicesUtils.getNewItemPlacementCommand()
            ._getActivePlacementByTransactionId(phase.getTransactionId());
    if (nipb == null) {
      LOG.log(
          Level.SEVERE,
          "Error invoking AutoKillNewItemTransition timer for New Item Workflow on transaction ID: "
              + phase.getId());
      throw new ApplicationException(
          "Error invoking AutoKillNewItemTransition timer for New Item Workflow on transaction ID: "
              + phase.getId());
    }

    Calendar triggerDate = nipb.getReviewStartDate();

    triggerDate.set(Calendar.HOUR_OF_DAY, 0);
    triggerDate.set(Calendar.MINUTE, 0);
    triggerDate.set(Calendar.SECOND, 0);
    triggerDate.set(Calendar.MILLISECOND, 0);

    if (LOG.isLoggable(Level.FINER)) {
      LOG.exiting(
          AutoRejectNewItemTransition.class.getName(), "#AutoReject: getTriggerTimeForPhase");
    }
    return triggerDate.getTime();
  }
  protected boolean process(WorkflowTransactionPhase phase) throws WorkflowException {
    if (LOG.isLoggable(Level.FINER)) {
      LOG.entering(AutoRejectNewItemTransition.class.getName(), "process", new Object[] {phase});
    }
    boolean success = false;
    boolean processed = false;
    try {
      DBHelper.startTransaction();

      NewItemPlacementBean nipb =
          NewItemServicesUtils.getNewItemPlacementCommand()
              ._getActivePlacementByTransactionId(phase.getTransactionId());
      long offset = Long.parseLong(DEFAULT_MAX_LENGTH_DAYS_OPEN);
      if (nipb != null) {
        if (handlesRegMbr(nipb.getRegionMemberId())) {
          DataItemBean dib =
              NewItemServicesUtils.getExpireDaysByRegionAlias(
                  NewItemServicesUtils.getPlacementRegionMemberAliasById(nipb.getRegionMemberId()));
          if (dib != null) offset = Long.parseLong(dib.getValue());

          this.triggerWhenBeforeOffset = new Long((-1) * offset * 24 * 60 * 60 * 1000);

          processed = super.process(phase);

          if (processed) {
            updateNewItemData(nipb);
          }
        }
        success = true;
      } else
        throw new WorkflowException(
            "Unable to locate placement data for AutoRejectNewItemTransition call on Transaction_ID ["
                + phase.getTransactionId()
                + "].");
    } catch (WorkflowException we) {
      LOG.log(
          Level.SEVERE, "Error invoking AutoRejectNewItemTransition for New Item Workflow!", we);
      throw new WorkflowException(
          "Error invoking AutoRejectNewItemTransition for New Item Workflow!  " + we.getMessage());
    } catch (Throwable th) {
      LOG.log(
          Level.SEVERE,
          "Error invoking AutoRejectNewItemTransition for New Item Workflow for phase ["
              + phase.getId()
              + "]!",
          th);
    } finally {
      try {
        DBHelper.finalizeActiveTransaction(null, success);
      } catch (Throwable th) {
        LOG.log(Level.SEVERE, "Error finalizing transaction for AutoRejectNewItemTransition time!");
        th.printStackTrace();
      }
    }

    if (LOG.isLoggable(Level.FINER)) {
      LOG.exiting(AutoRejectNewItemTransition.class.getName(), "process");
    }
    return processed;
  }
Пример #24
0
 /*
  * Checks that all the provided <code>URL</code> s have permission to use
  * the given policy.
  */
 private static void checkPolicyPermission(String policy, URL[] urls) {
   logger.entering(
       ActivateWrapper.class.getName(),
       "checkPolicyPermission",
       new Object[] {policy, urlsToPath(urls)});
   // Create desired permission object
   Permission perm = new SharedActivationPolicyPermission(policy);
   Certificate[] certs = null;
   CodeSource cs;
   ProtectionDomain pd;
   // Loop over all codebases
   for (URL url : urls) {
     // Create ProtectionDomain for given codesource
     cs = new CodeSource(url, certs);
     pd = new ProtectionDomain(cs, null, null, null);
     logger.log(Level.FINEST, "Checking protection domain: {0}", pd);
     // Check if current domain allows desired permission
     if (!pd.implies(perm)) {
       SecurityException se =
           new SecurityException(
               "ProtectionDomain " + pd + " does not have required permission: " + perm);
       logger.throwing(ActivateWrapper.class.getName(), "checkPolicyPermission", se);
       throw se;
     }
   }
   logger.exiting(ActivateWrapper.class.getName(), "checkPolicyPermission");
 }
Пример #25
0
  /**
   * Wrapper method to update a User's profile
   *
   * @param Profile
   * @return returns true if profile is updated successfully
   * @throws ProfileServiceException
   */
  public boolean updateProfile(Profile profile) throws ProfileServiceException {
    if (logger.isLoggable(Level.FINEST)) {
      logger.entering(sourceClass, "update", profile);
    }
    if (profile == null) {
      throw new IllegalArgumentException(Messages.InvalidArgument_3);
    }
    boolean result = true;

    Map<String, String> parameters = new HashMap<String, String>();
    parameters.put(ProfileRequestParams.OUTPUT, "vcard");
    parameters.put(ProfileRequestParams.FORMAT, "full");
    Map<String, String> headers = new HashMap<String, String>();
    headers.put(Headers.ContentType, Headers.ATOM);
    if (isEmail(profile.getReqId())) {
      parameters.put(ProfileRequestParams.EMAIL, profile.getReqId());
    } else {
      parameters.put(ProfileRequestParams.USERID, profile.getReqId());
    }
    Object updateProfilePayload = profile.constructUpdateRequestBody();
    String url =
        resolveProfileUrl(
            ProfileEntity.NONADMIN.getProfileEntityType(),
            ProfileType.UPDATEPROFILE.getProfileType());
    result = executePut(url, parameters, headers, updateProfilePayload, ClientService.FORMAT_NULL);
    profile.clearFieldsMap();
    removeProfileDataFromCache(profile.getReqId());

    if (logger.isLoggable(Level.FINEST)) {
      logger.exiting(sourceClass, "update");
    }

    return result;
  }
Пример #26
0
  @Override
  public Object visit(ASTElseClause node, Object data) {
    LOGGER.entering(CLASS_NAME, "visit(ASTElseClause)");
    // (npath of if + npath of else (or 1) + bool_comp of if) * npath of
    // next

    int complexity = 0;

    List<PLSQLNode> statementChildren = new ArrayList<PLSQLNode>();
    for (int i = 0; i < node.jjtGetNumChildren(); i++) {
      if (node.jjtGetChild(i).getClass() == ASTStatement.class) {
        statementChildren.add((PLSQLNode) node.jjtGetChild(i));
      }
    }
    if (LOGGER.isLoggable(Level.FINEST)) {
      LOGGER.finest(
          statementChildren.size()
              + " statementChildren found for ELSE clause statement "
              + node.getBeginLine()
              + ", column "
              + node.getBeginColumn());
    }

    for (PLSQLNode element : statementChildren) {
      complexity += (Integer) element.jjtAccept(this, data);
    }

    LOGGER.exiting(CLASS_NAME, "visit(ASTElseClause)", complexity);
    return Integer.valueOf(complexity);
  }
Пример #27
0
  public ImageViewerFrame() {
    logger.entering("ImageViewerFrame", "<init>");
    setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);

    // set up menu bar
    JMenuBar menuBar = new JMenuBar();
    setJMenuBar(menuBar);
    JMenu menu = new JMenu("File");
    menuBar.add(menu);

    JMenuItem openItem = new JMenuItem("Open");
    menu.add(openItem);
    openItem.addActionListener(new FileOpenListener());
    JMenuItem exitItem = new JMenuItem("Exit");
    menu.add(exitItem);
    exitItem.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            logger.fine("Exiting.");
            System.exit(0);
          }
        });
    // use a label to display the images
    label = new JLabel();
    add(label);
    logger.exiting("ImageViewerFrame", "<init>");
  }
Пример #28
0
 /**
  * Wrapper method to search profiles based on different parameters
  *
  * @param parameters list of query string parameters to pass to API
  * @return Collection<Profile>
  */
 public Collection<Profile> searchProfiles(Map<String, String> parameters) {
   if (logger.isLoggable(Level.FINEST)) {
     logger.entering(sourceClass, "searchProfiles", parameters);
   }
   Document data = null;
   Collection<Profile> profiles = null;
   if (null == parameters) {
     parameters = new HashMap<String, String>();
   }
   try {
     String url =
         resolveProfileUrl(
             ProfileEntity.NONADMIN.getProfileEntityType(), ProfileType.SEARCH.getProfileType());
     data = (Document) getClientService().get(url, parameters);
     profiles = Converter.returnProfileEntries(this, data);
   } catch (ClientServicesException e) {
     if (logger.isLoggable(Level.SEVERE)) {
       logger.log(Level.SEVERE, Messages.ProfileServiceException_1 + "searchProfiles()", e);
     }
   }
   if (logger.isLoggable(Level.FINEST)) {
     logger.exiting(sourceClass, "getColleagues");
   }
   return profiles;
 }
  @Override
  public boolean onOptionsItemSelected(final MenuItem item) {
    mLogger.entering(getClass().getName(), "onOptionsItemSelected", item);

    boolean result;
    if (super.onOptionsItemSelected(item)) {
      result = true;
    } else {
      switch (item.getItemId()) {
        case R.id.action_refresh:
          getSupportFragmentManager().popBackStack();
          (new ServiceDiscoveryTask()).execute();
          result = true;
          break;
        case R.id.action_access_token:
          authrize();
          result = true;
          break;
        case R.id.action_open_websocket:
          openWebsocket();
          result = true;
          break;
        case R.id.action_plugins:
          openPluginList();
          result = true;
          break;
        default:
          result = super.onOptionsItemSelected(item);
          break;
      }
    }

    mLogger.exiting(getClass().getName(), "onOptionsItemSelected", result);
    return result;
  }
Пример #30
0
  /**
   * Method to remove the user profile from cache.
   *
   * @param userId
   */
  protected void removeProfileDataFromCache(String userId) throws ProfileServiceException {
    if (logger.isLoggable(Level.FINEST)) {
      logger.entering(sourceClass, "removeProfileDataFromCache", userId);
    }
    if (isEmail(userId)) {
      String key;
      Set<String> keys = lruCache.getKeySet();
      Iterator<String> itr = keys.iterator();
      while (itr.hasNext()) {
        key = itr.next();
        Document data = lruCache.get(key);
        // check if email in profile object is same as input userId
        String email = "";
        try {
          email = DOMUtil.value(data, Profile.xpathMap.get("email"));
        } catch (XMLException e) {
          continue;
        }

        // cache hit
        if (StringUtil.equalsIgnoreCase(email, userId)) {
          lruCache.remove(key);
        }
      }
      // Cache miss

    } else {
      lruCache.remove(userId);
    }
    if (logger.isLoggable(Level.FINEST)) {
      logger.exiting(sourceClass, "removeProfileDataFromCache");
    }
  }