private static List<Attribute> createAttributes(Integer maxstanzas, Integer maxchars, Integer seconds, Calendar since) { List<Attribute> attributes = new ArrayList<Attribute>(); if (maxstanzas != null) attributes.add(new Attribute(ATTRIBUTE_MAXSTANZAS, maxstanzas.toString())); if (maxchars != null) attributes.add(new Attribute(ATTRIBUTE_MAXCHARS, maxchars.toString())); if (seconds != null) attributes.add(new Attribute(ATTRIBUTE_SECONDS, seconds.toString())); if (since != null) attributes.add(new Attribute(ATTRIBUTE_SINCE, DateTimeProfile.getInstance().getDateTimeInUTC( since.getTime()))); return attributes; }
private static List<Attribute> createAttributes(Entity jid, String nick, Affiliation affiliation, Role role) { List<Attribute> attributes = new ArrayList<Attribute>(); if (jid != null) attributes.add(new Attribute("jid", jid.getFullQualifiedName())); if (nick != null) attributes.add(new Attribute("nick", nick)); if (affiliation != null) attributes.add(new Attribute("affiliation", affiliation.toString())); if (role != null) attributes.add(new Attribute("role", role.toString())); return attributes; }
private static List<Attribute> createAttributes(String nick, Entity jid, Role role, Affiliation affiliation) { List<Attribute> attributes = new ArrayList<Attribute>(); if (nick != null) { attributes.add(new Attribute("nick", nick)); } if (jid != null) { attributes.add(new Attribute("jid", jid.getFullQualifiedName())); } if (role != null) { attributes.add(new Attribute("role", role.toString())); } if (affiliation != null) { attributes.add(new Attribute("affiliation", affiliation.toString())); } return attributes; }
private static List<Attribute> createAttributes(StatusCode code) { List<Attribute> attributes = new ArrayList<Attribute>(); if (code != null) attributes.add(new Attribute("code", Integer.toString(code.code()))); return attributes; }
private static List<Attribute> createAttributes(Entity from, Entity to) { List<Attribute> attributes = new ArrayList<Attribute>(); if (to != null) attributes.add(new Attribute("to", to.getFullQualifiedName())); if (from != null) attributes.add(new Attribute("from", from.getFullQualifiedName())); return attributes; }
public B addAttribute(String namespaceUris, String name, String value) { addAttribute(new Attribute(namespaceUris, name, value)); return (B) this; }
public B addAttribute(String name, String value) { addAttribute(new Attribute(name, value)); return (B) this; }
/** * creates a new stanza which only differs from the given original by 'from' and 'to' attributes. * * @param original * @param from if NOT NULL, the new 'from' * @param to if NOT NULL, the new 'to' * @return stanza builder with to and from replaced */ public static StanzaBuilder createForward(Stanza original, Entity from, Entity to) { List<Attribute> toFromReplacements = new ArrayList<Attribute>(2); if (to != null) toFromReplacements.add(new Attribute("to", to.getFullQualifiedName())); if (from != null) toFromReplacements.add(new Attribute("from", from.getFullQualifiedName())); return createClone(original, true, toFromReplacements); }
private void relayTo(Entity from, List<Entity> tos, PresenceStanza original, SessionContext sessionContext) { List<Attribute> toFromReplacements = new ArrayList<Attribute>(2); toFromReplacements.add(new Attribute("from", from.getFullQualifiedName())); for (Entity to : tos) { toFromReplacements.add(new Attribute("to", to.getFullQualifiedName())); Stanza outgoingStanza = StanzaBuilder.createClone(original, true, toFromReplacements).build(); relayStanza(to, outgoingStanza, sessionContext); toFromReplacements.remove(toFromReplacements.size() - 1); // clear space for new 'to' attribute } }
fieldAttributes.add(new Attribute("var", field.getVar())); fieldAttributes.add(new Attribute("label", field.getLabel())); fieldAttributes.add(new Attribute("type", field.getType().value())); Option option = optionIterator.next(); Attribute[] attributes = option.getLabel() == null ? null : new Attribute[] { new Attribute("label", option .getLabel()) }; XMLFragment[] elements = option.getValue() == null ? null : new XMLFragment[] { new XMLText(option
attributes.add(new Attribute("type", dataForm.getType().value()));
logger.debug("Relaying message to {}", occupent); List<Attribute> replaceAttributes = new ArrayList<Attribute>(); replaceAttributes.add(new Attribute("from", roomAndSendingNick.getFullQualifiedName())); replaceAttributes.add(new Attribute("to", occupent.getJid().getFullQualifiedName())); logger.debug("Relaying message to {}", receivingOccupant); List<Attribute> replaceAttributes = new ArrayList<Attribute>(); replaceAttributes.add(new Attribute("from", roomAndSendingNick.getFullQualifiedName())); replaceAttributes .add(new Attribute("to", receivingOccupant.getJid().getFullQualifiedName()));