public void doTag() throws JspException, IOException {

    StringBuilder builder = new StringBuilder();

    Set<String> subscribers = null;

    if (object instanceof Release) {
      subscribers = ((Release) object).getSubscribers();
    } else if (object instanceof Component) {
      subscribers = ((Component) object).getSubscribers();
    }

    subscribers = CommonUtils.nullToEmptySet(subscribers);

    if (subscribers.contains(email)) {
      builder.append(
          String.format(
              "<input type=\"button\" id=\"%s\" onclick=\"%s\" value=\"Unsubscribe\" class=\"addButton subscribed\" />",
              id, altonclick));
    } else {
      builder.append(
          String.format(
              "<input type=\"button\" id=\"%s\" onclick=\"%s\" value=\"Subscribe\" class=\"addButton\" />",
              id, onclick));
    }

    getJspContext().getOut().print(builder.toString());
  }
Example #2
0
 public SSOAutoLogin() {
   super();
   Properties props = CommonUtils.loadProperties(SSOAutoLogin.class, PROPERTIES_FILE_PATH);
   AUTH_EMAIL_VALUE = props.getProperty(AUTH_EMAIL_KEY, AUTH_EMAIL_VALUE);
   AUTH_EXTID_VALUE = props.getProperty(AUTH_EXTID_KEY, AUTH_EXTID_VALUE);
   log.info(
       "Expecting the following header values for auto login email: '"
           + AUTH_EMAIL_VALUE
           + "' and external ID: '"
           + AUTH_EXTID_VALUE
           + "'");
 }
  static {
    Properties props = CommonUtils.loadProperties(PortalConstants.class, PROPERTIES_FILE_PATH);

    PROGRAMMING_LANGUAGES =
        props.getProperty(
            "programming.languages",
            "[ \"ActionScript\", \"AppleScript\", \"Asp\",\"Bash\", \"BASIC\", \"C\", \"C++\", \"C#\", \"Cocoa\", \"Clojure\",\"COBOL\",\"ColdFusion\", \"D\", \"Delphi\", \"Erlang\", \"Fortran\", \"Go\", \"Groovy\",\"Haskell\", \"JSP\", \"Java\",\"JavaScript\", \"Objective-C\", \"Ocaml\",\"Lisp\", \"Perl\", \"PHP\", \"Python\", \"Ruby\", \"SQL\", \"SVG\",\"Scala\",\"SmallTalk\", \"Scheme\", \"Tcl\", \"XML\", \"Node.js\", \"JSON\" ]");
    SOFTWARE_PLATFORMS =
        props.getProperty(
            "software.platforms",
            "[ \"Adobe AIR\", \"Adobe Flash\", \"Adobe Shockwave\", \"Binary Runtime Environment for Wireless\", \"Cocoa (API)\", \"Cocoa Touch\", \"Java (software platform)|Java platform\", \"Java Platform, Micro Edition\", \"Java Platform, Standard Edition\", \"Java Platform, Enterprise Edition\", \"JavaFX\", \"JavaFX Mobile\", \"Microsoft XNA\", \"Mono (software)|Mono\", \"Mozilla Prism\", \".NET Framework\", \"Silverlight\", \"Open Web Platform\", \"Oracle Database\", \"Qt (framework)|Qt\", \"SAP NetWeaver\", \"Smartface\", \"Vexi\", \"Windows Runtime\" ]");
    OPERATING_SYSTEMS =
        props.getProperty(
            "operating.systems",
            "[ \"Android\", \"BSD\", \"iOS\", \"Linux\", \"OS X\", \"QNX\", \"Microsoft Windows\", \"Windows Phone\", \"IBM z/OS\"]");
    SET_CLEARING_TEAMS_STRING =
        CommonUtils.splitToSet(
            props.getProperty("clearing.teams", "E-P, EM-AM, BT-CPS, HC-IM, CT-RTC, CT-BE"));
    STATE = props.getProperty("state", "[ \"Active\", \"Phase out\", \"Unknown\"]");
    PROJECT_TYPE =
        props.getProperty(
            "project.type",
            "[ \"Customer Project\", \"Internal Project\", \"Product\", \"Service\"]");
  }
  @Override
  public void doView(RenderRequest request, RenderResponse response)
      throws IOException, PortletException {
    List<ModerationRequest> moderations = null;

    try {
      final User user = UserCacheHolder.getUserFromRequest(request);
      moderations = thriftClients.makeModerationClient().getRequestsByRequestingUser(user);
    } catch (TException e) {
      log.error("Could not fetch your moderations from backend", e);
    }

    request.setAttribute(
        PortalConstants.MODERATION_REQUESTS, CommonUtils.nullToEmptyList(moderations));

    super.doView(request, response);
  }
  static {
    Properties props = CommonUtils.loadProperties(ThriftClients.class, PROPERTIES_FILE_PATH);

    BACKEND_URL = props.getProperty("backend.url", "http://localhost:8080");
  }
 protected boolean isModerator() {
   return CommonUtils.contains(user.email, getModerators());
 }
 protected boolean isContributor() {
   return user != null && CommonUtils.contains(user.email, getContributors());
 }