@Override public void run() { try { Thread.sleep(5000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } try { perun.getMembersManagerBl().validateMember(registrarSession, member); } catch (InternalErrorException | WrongAttributeValueException | WrongReferenceAttributeValueException e) { log.error("[REGISTRAR] Exception when validating {} after approving application {}.", member, app); } try { // get user's group apps with auto-approve and approve them autoApproveUsersGroupApplications(sess, app.getVo(), app.getUser()); } catch (PerunException ex) { log.error("[REGISTRAR] Exception when auto-approving waiting group applications for {} after approving application {}.", member, app); } } }).start();
/** * Validates member whose expiration is set after the given date * * @param date date * @throws InternalErrorException internal error * @throws WrongAttributeAssignmentException error * @throws AttributeNotExistsException error */ private void validateMembers(Calendar date) throws InternalErrorException, WrongAttributeAssignmentException, AttributeNotExistsException { List<Member> shouldntBeExpired = perun.getSearcherBl().getMembersByExpiration(sess, ">", date); for (Member member : shouldntBeExpired) { if (member.getStatus().equals(Status.EXPIRED)) { try { perun.getMembersManagerBl().validateMember(sess, member); log.info("Switching {} to VALID state, due to changed expiration {}.", member, perun.getAttributesManagerBl().getAttribute(sess, member, "urn:perun:member:attribute-def:def:membershipExpiration").getValue()); } catch (WrongAttributeValueException | WrongReferenceAttributeValueException e) { log.error("Error during validating member {}, exception {}", member, e); } } } }