private Map<String, Object> getMetadataSocial(final Upload upload) {
    final Map<String, Object> params = new HashMap<>(3);
    final Permissions permissions = upload.getPermissions();
    if (Visibility.PUBLIC == permissions.getVisibility()
        || Visibility.SCHEDULED == permissions.getVisibility()) {

      final Social social = upload.getSocial();
      if (null != social.getMessage() && !social.getMessage().isEmpty()) {
        params.put("creator_share_custom_message", social.getMessage());
        params.put("creator_share_facebook", boolConverter(social.isFacebook()));
        params.put("creator_share_twitter", boolConverter(social.isTwitter()));
        params.put("creator_share_gplus", boolConverter(social.isGplus()));
      }
    }
    return params;
  }
Пример #2
0
  public void load(IXMLElement xml) throws Exception {
    super.load(xml);

    final int priority = parameters().getAttribute(PARAM_PRIORITY, 3);
    this.socials = new MudObjectInterpreter(getName(), priority, this);

    for (Enumeration enu = xml.enumerateChildren(); enu.hasMoreElements(); ) {

      IXMLElement nxt = (IXMLElement) enu.nextElement();
      String nom = nxt.getName();

      if (nom.equals(Social.MARKUP)) {

        this.socials.addCommand(Social.loadSocial(nxt));

      } else if (nom.equals(PROPERTY_SOCIALS)) {

        loadSocialsElement(nxt);
      }
    }
  }
Пример #3
0
  public void loadSocialsElement(IXMLElement xml) throws Exception {
    String src = xml.getAttribute(PROPERTY_SRC, null);

    // If the passed xml element just points to a file
    if (src != null) {
      IXMLParser xmp = new StdXMLParser();
      xmp.setBuilder(new StdXMLBuilder());
      xmp.setValidator(new NonValidator());
      xmp.setReader(StdXMLReader.fileReader(src));

      xml = (XMLElement) xmp.parse();
      xmp = null;
    }

    int count = 0;
    for (Enumeration enu = xml.getChildrenNamed(Social.MARKUP).elements();
        enu.hasMoreElements();
        count++) {

      IXMLElement nxt = (IXMLElement) enu.nextElement();
      this.socials.addCommand(Social.loadSocial(nxt));
    }
  }