Esempio n. 1
0
  public ActionForward fetchEscalationLevel(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {

    EscalationDao escalationDaoImpl = new EscalationDaoImpl();
    EscalationForm escalationForm = (EscalationForm) form;
    EscalationDTO escalationDTO = new EscalationDTO();
    String escalation_level_status = null;

    Document document = DocumentHelper.createDocument();
    Element root = document.addElement("options");
    Element optionElement, hiddenElement;

    try {
      String escalation_type = escalationForm.getEscalation_type();
      String workflow_step_id = escalationForm.getWorkflow_step_id();

      System.out.println("escalation_type---->" + escalation_type);
      System.out.println("workflow_step_id---->" + workflow_step_id);

      if (escalation_type != null && workflow_step_id != null) {
        populate(form, request);

        List escalation_level_list =
            escalationDaoImpl.getEscalation_Level(escalation_type, workflow_step_id);

        if (escalation_level_list != null && escalation_level_list.size() > 0) {
          escalationForm.setEscalation_level_list(escalation_level_list);
          for (int intCounter = 0; intCounter < escalation_level_list.size(); intCounter++) {
            optionElement = root.addElement("option");
            optionElement.addAttribute(
                "value",
                ((EscalationDTO) escalation_level_list.get(intCounter)).getEscalation_level());
            optionElement.addAttribute(
                "text",
                ((EscalationDTO) escalation_level_list.get(intCounter)).getEscalation_level());
            hiddenElement = root.addElement("hidden");
            hiddenElement.addAttribute(
                "status",
                ((EscalationDTO) escalation_level_list.get(intCounter))
                    .getEscalation_level_status());
          }
        }
        response.setContentType("text/xml");
        response.setHeader("Cache-Control", "No-Cache");
        PrintWriter out = response.getWriter();
        XMLWriter writer = new XMLWriter(out);
        writer.write(document);
        logger.info("document : \n\n" + document.asXML());
        writer.flush();
        out.flush();
      }
    } catch (Exception exception) {
      exception.printStackTrace();
    }
    return null;
  }
  @Test
  public void testValidateElementName() {
    Document document = DocumentHelper.createDocument();

    Element element = document.addElement("execute");

    element.addAttribute("function", "AssertTextPresent");
    element.addAttribute("value1", "hello world");

    List<String> possibleElementNames = Arrays.asList("command", "execute");

    PoshiRunnerValidation.validateElementName(
        element, possibleElementNames, "ValidateElementName.macro");

    Assert.assertEquals("validateElementName is failing", "", getExceptionMessage());

    document = DocumentHelper.createDocument();

    element = document.addElement("poshi");

    element.addAttribute("function", "AssertTextPresent");
    element.addAttribute("value1", "hello world");

    PoshiRunnerValidation.validateElementName(
        element, possibleElementNames, "ValidateElementName.macro");

    Assert.assertEquals(
        "validateElementName is failing",
        "Missing " + possibleElementNames + " element",
        getExceptionMessage());
  }
  @Override
  public IQ createServiceRequest(Object object, String fromNode, String toNode) {
    if (object instanceof JingleIQ) {
      final IQ request = new IQ(IQ.Type.set);
      if (toNode.indexOf("00") == 0) {
        toNode = "+" + toNode.substring(2);
      }
      final JID to = JIDFactory.getInstance().getJID(null, creditService, null);
      final JID from =
          JIDFactory.getInstance().getJID(fromNode, this.getComponentJID().getDomain(), null);
      final JingleIQ jingleIQ = (JingleIQ) object;
      request.setTo(to);
      request.setFrom(from);
      request.setChildElement(requestElement.createCopy());
      final String toBareJid =
          JIDFactory.getInstance().getJID(toNode, creditService, null).toBareJID();

      final Element e = request.getChildElement();
      e.addAttribute("initiator", from.toBareJID());
      e.addAttribute("responder", toBareJid);
      e.addAttribute("sid", jingleIQ.getJingle().getSid());
      log.debug("createCreditRequest: " + request.toXML());
      return request;
    }
    return null;
  }
Esempio n. 4
0
  protected void addRootPlace(Element originInfoEl) {
    ModsTypeClient mods = getFirstMods();
    PlaceTypeClient placeClient = null;
    if (mods != null
        && mods.getOriginInfo() != null
        && mods.getOriginInfo().size() > 0
        && mods.getOriginInfo().get(0).getPlace() != null
        && mods.getOriginInfo().get(0).getPlace().size() > 0)
      placeClient = mods.getOriginInfo().get(0).getPlace().get(0);

    if (placeClient != null
        && placeClient.getPlaceTerm() != null
        && placeClient.getPlaceTerm().size() > 0) {
      String authority = placeClient.getPlaceTerm().get(0).getAuthority().value();
      String type = placeClient.getPlaceTerm().get(0).getType().value();
      String place = placeClient.getPlaceTerm().get(0).getValue();
      if (authority != null && type != null && place != null) {
        Element placeEl = originInfoEl.addElement(new QName("place", Namespaces.mods));
        Element placeTermEl = placeEl.addElement(new QName("placeTerm", Namespaces.mods));
        placeTermEl.addAttribute("type", type);
        placeTermEl.addAttribute("authority", authority);
        placeTermEl.addText(place);
      }
    }
  }
Esempio n. 5
0
  @Override
  public Document getManeuverAsDocument(String rootElementName) {
    Document document = DocumentHelper.createDocument();
    Element root = document.addElement(rootElementName);
    root.addAttribute("kind", "automatic");

    // basePoint
    Element basePoint = root.addElement("basePoint");
    Element point = getManeuverLocation().asElement("point");
    basePoint.add(point);
    Element radTolerance = basePoint.addElement("radiusTolerance");
    radTolerance.setText("0");
    basePoint.addAttribute("type", "pointType");

    // duration
    root.addElement("duration").setText("" + getDuration());

    // trajectory
    Element trajectory = root.addElement("trajectory");
    Element trajRadius = trajectory.addElement("radius");
    trajRadius.setText(String.valueOf(getRadius()));
    trajRadius.addAttribute("type", "float");

    // speed
    Element velocity = root.addElement("speed");
    // velocity.addAttribute("tolerance", String.valueOf(getSpeedTolerance()));
    velocity.addAttribute("type", "float");
    velocity.addAttribute("unit", getSpeedUnits());
    velocity.setText(String.valueOf(getSpeed()));

    return document;
  }
  public Element getElement() {
    Element element = DocumentFactory.getInstance().createElement(QNAME);

    if (classificationScheme != null) {
      element.addAttribute(CLASSIFICATION_SCHEME_ATTRIBUTE, classificationScheme);
    }

    element.addAttribute(CLASSIFIED_OBJECT_ATTRIBUTE, classifiedObject);

    if (nodeRepresentation != null) {
      element.addAttribute(NODE_REPRESENTATION_ATTRIBUTE, nodeRepresentation);
    }

    if (classificationNode != null) {
      element.addAttribute(CLASSIFICATION_NODE_ATTRIBUTE, classificationNode);
    }

    if (name != null) {
      element.add(name.getElement());
    }
    if (slot != null) {
      element.add(slot.getElement());
    }
    return element;
  }
Esempio n. 7
0
  @Override
  public Document getManeuverAsDocument(String rootElementName) {
    Document document = DocumentHelper.createDocument();
    Element root = document.addElement(rootElementName);
    //        root.addAttribute("kind", "automatic");
    Element finalPoint = root.addElement("finalPoint");
    finalPoint.addAttribute("type", "pointType");
    Element point = getManeuverLocation().asElement("point");
    finalPoint.add(point);

    Element radTolerance = finalPoint.addElement("radiusTolerance");
    radTolerance.setText("0");

    Element startZ = root.addElement("startZ");
    startZ.setText(String.valueOf(getStartZ()));
    Element startZUnits = root.addElement("startZUnits");
    startZUnits.setText(String.valueOf(getStartZUnits().toString()));

    Element radius = root.addElement("radius");
    radius.setText(String.valueOf(getRadius()));

    Element velocity = root.addElement("speed");
    velocity.addAttribute("tolerance", String.valueOf(speedTolerance));
    velocity.addAttribute("type", "float");
    velocity.addAttribute("unit", getSpeedUnits());
    velocity.setText(String.valueOf(getSpeed()));

    Element flags = root.addElement("flags");
    flags.addAttribute("useCurrentLocation", String.valueOf(isStartFromCurrentPosition()));

    return document;
  }
Esempio n. 8
0
 /**
  * Sends an event notification for the last published item to the subscriber. If the subscription
  * has not yet been authorized or is pending to be configured then no notification is going to be
  * sent.
  *
  * <p>Depending on the subscription configuration the event notification may or may not have a
  * payload, may not be sent if a keyword (i.e. filter) was defined and it was not matched.
  *
  * @param publishedItem the last item that was published to the node.
  */
 void sendLastPublishedItem(PublishedItem publishedItem) {
   // Check if the published item can be sent to the subscriber
   if (!canSendPublicationEvent(publishedItem.getNode(), publishedItem)) {
     return;
   }
   // Send event notification to the subscriber
   Message notification = new Message();
   Element event =
       notification.getElement().addElement("event", "http://jabber.org/protocol/pubsub#event");
   Element items = event.addElement("items");
   items.addAttribute("node", node.getNodeID());
   Element item = items.addElement("item");
   if (((LeafNode) node).isItemRequired()) {
     item.addAttribute("id", publishedItem.getID());
   }
   if (node.isPayloadDelivered() && publishedItem.getPayload() != null) {
     item.add(publishedItem.getPayload().createCopy());
   }
   // Add a message body (if required)
   if (isIncludingBody()) {
     notification.setBody(LocaleUtils.getLocalizedString("pubsub.notification.message.body"));
   }
   // Include date when published item was created
   notification
       .getElement()
       .addElement("delay", "urn:xmpp:delay")
       .addAttribute("stamp", fastDateFormat.format(publishedItem.getCreationDate()));
   // Send the event notification to the subscriber
   service.sendNotification(node, notification, jid);
 }
Esempio n. 9
0
  /** 生成DEML,即将这个多边形输出到DEML文件中 */
  public Element exportAsDeml() throws IOException {

    Document _document = DocumentHelper.createDocument();
    Element _feature = _document.addElement("Feature");

    Element _type = _feature.addElement("Type");
    _type.setText("Polygon");

    Element _lName = _feature.addElement("LayerName");
    _lName.setText(this.getName());

    Element _pointList = _feature.addElement("PointList");

    for (Position pos : this.getPositions()) {
      Element _point = _pointList.addElement("Point");
      _point.addAttribute("Lat", pos.getLatitude().degrees + "");
      _point.addAttribute("Lng", pos.getLongitude().degrees + "");
    }

    Element _attributes = _feature.addElement("Attributes");

    Element _outlineMaterial = _attributes.addElement("InteriorMaterial");
    _outlineMaterial.addAttribute(
        "r", this.getPolygon().getAttributes().getInteriorMaterial().getDiffuse().getRed() + "");
    _outlineMaterial.addAttribute(
        "g", this.getPolygon().getAttributes().getInteriorMaterial().getDiffuse().getGreen() + "");
    _outlineMaterial.addAttribute(
        "b", this.getPolygon().getAttributes().getInteriorMaterial().getDiffuse().getBlue() + "");

    return _feature;
  }
Esempio n. 10
0
 public Document buildCampaignListInfoResponseXML(Integer driveId) throws HelixServiceException {
   Document document = DocumentHelper.createDocument();
   Element root = document.addElement("campaigns");
   List<Campaign> campaignList = campaignService.getDriveCampaignList(driveId);
   if (campaignList != null) {
     for (Campaign campaign : campaignList) {
       Element element = root.addElement("campaign");
       element.addAttribute("campaignId", campaign.getIdCampaign().toString());
       element.addAttribute(
           "edit",
           "<a href='client'> C </a> | <a href='campaign?clientId="
               + campaign.getClient().getIdClient()
               + "'> C </a> | <a href='#'> D </a> "
               + "| <a href='#'> F </a>");
       element.addAttribute("client", campaign.getClient().getClientName());
       element.addAttribute("year", campaign.getCampaignYear());
       element.addAttribute(
           "type",
           (campaign.getCampaigntype() != null)
               ? campaign.getCampaigntype().getCampaignType()
               : "");
       element.addAttribute("amount", "");
       element.addAttribute("ccAmount", "");
       element.addAttribute("count", "");
       element.addAttribute("average", "");
       element.addAttribute("response", "");
     }
   }
   return document;
 }
Esempio n. 11
0
 /**
  * Constructs a new Packet. The JID address contained in the XML Element may not be validated.
  * When validation can be skipped then stringprep operations will not be performed on the JIDs to
  * verify that addresses are well-formed. However, when validation cannot be skipped then
  * <tt>only</tt> the TO address will be verified. The FROM address is assigned by the server so
  * there is no need to verify it.
  *
  * @param element the XML Element that contains the packet contents.
  * @param skipValidation true if stringprep should not be applied to the TO address.
  */
 public Packet(Element element, boolean skipValidation) {
   this.element = element;
   // Apply stringprep profiles to the "to" and "from" values.
   String to = element.attributeValue("to");
   if (to != null) {
     if (to.length() == 0) {
       // Remove empty TO values
       element.addAttribute("to", null);
     } else {
       String[] parts = JID.getParts(to);
       toJID = new JID(parts[0], parts[1], parts[2], skipValidation);
       element.addAttribute("to", toJID.toString());
     }
   }
   String from = element.attributeValue("from");
   if (from != null) {
     if (from.length() == 0) {
       // Remove empty FROM values
       element.addAttribute("from", null);
     } else {
       String[] parts = JID.getParts(from);
       fromJID = new JID(parts[0], parts[1], parts[2], true);
       element.addAttribute("from", fromJID.toString());
     }
   }
 }
  @Test
  public void testValidateElseElement() {
    Document document = DocumentHelper.createDocument();

    Element element = document.addElement("if");

    Element elseElement1 = element.addElement("else");

    Element executeElement1 = elseElement1.addElement("execute");

    executeElement1.addAttribute("function", "Click");
    executeElement1.addAttribute("locator1", "//else element");

    PoshiRunnerValidation.validateElseElement(element, "ValidateElseElement.macro");

    Assert.assertEquals("validateElseElement is failing", "", getExceptionMessage());

    Element elseElement2 = element.addElement("else");

    Element executeElement2 = elseElement2.addElement("execute");

    executeElement2.addAttribute("function", "Click");
    executeElement2.addAttribute("locator1", "//else element");

    PoshiRunnerValidation.validateElseElement(element, "ValidateElseElement.macro");

    Assert.assertEquals(
        "validateElseElement is failing", "Too many else elements", getExceptionMessage());
  }
Esempio n. 13
0
  public static void main(String[] args) throws Exception {
    // 第一种方式
    // 创建文档对象
    /*
     * Document document = DocumentHelper.createDocument(); // 创建根元素节点
     * Element root = DocumentHelper.createElement("student"); // 设置根元素节点
     * document.setRootElement(root);
     */
    Element root = DocumentHelper.createElement("student");
    Document document = DocumentHelper.createDocument(root);

    // 元素添加属性
    root.addAttribute("name", "张三");
    // 添加子元素
    Element helloElement = root.addElement("hello");
    Element worldElement = root.addElement("world");
    // 设置文本内容
    helloElement.setText("hello");
    worldElement.setText("world");

    // 给hello设置一个属性
    helloElement.addAttribute("age", "20");

    // 输出到
    XMLWriter xmlWriter = new XMLWriter();
    xmlWriter.write(document);

    // 保存到xml文件中
    XMLWriter xmlWriter1 =
        new XMLWriter(new FileOutputStream("t.xml"), new OutputFormat("    ", true));
    xmlWriter1.write(document);
  }
Esempio n. 14
0
  public Document generateDocumentByMethod() {
    Document document = DocumentHelper.createDocument();
    // 1.使用DocumentHelper得到Document实例
    Map<String, String> inMap = new HashMap<String, String>();
    inMap.put("type", "text/xsl");
    inMap.put("href", "students.xsl");
    document.addProcessingInstruction("xml-stylesheet", inMap);
    // 2.创建Processing Instruction
    Element studentsElement = document.addElement("students");
    studentsElement.addComment("An Student Catalog");
    // son element
    Element stuElement = studentsElement.addElement("student");
    stuElement.addAttribute("sn", "01");
    Element nameElement = stuElement.addElement("name");
    nameElement.setText("sam");
    Element ageElement = stuElement.addElement("age");
    ageElement.setText("18");
    // son element
    Element anotherStuElement = studentsElement.addElement("student");
    anotherStuElement.addAttribute("sn", "02");
    Element anotherNameElement = anotherStuElement.addElement("name");
    anotherNameElement.setText("lin");
    Element anotherAgeElement = anotherStuElement.addElement("age");
    anotherAgeElement.setText("20");

    return document;
  }
  @Test
  public void testValidateMacroFile() throws Exception {
    Document document = DocumentHelper.createDocument();

    Element rootElement = document.addElement("definition");

    Element commandElement = rootElement.addElement("command");

    commandElement.addAttribute("name", "validateMacroFile");

    Element echoElement = commandElement.addElement("echo");

    echoElement.addAttribute("message", "hello world");

    PoshiRunnerValidation.validateMacroFile(rootElement, "ValidateMacroFile.macro");

    Assert.assertEquals("validateMacroFile is failing", "", getExceptionMessage());

    document = DocumentHelper.createDocument();

    rootElement = document.addElement("definition");

    commandElement = rootElement.addElement("command");

    commandElement.addAttribute("name", "validateMacroFile");

    Element containsElement = commandElement.addElement("contains");

    containsElement.addAttribute("string", "string");

    PoshiRunnerValidation.validateMacroFile(rootElement, "ValidateMacroFile.macro");

    Assert.assertEquals(
        "validateMacroFile is failing", "Invalid contains element", getExceptionMessage());
  }
  private Element createMiddleEntityXml(
      String auditMiddleTableName, String auditMiddleEntityName, String where) {
    String schema =
        mainGenerator.getSchema(
            propertyAuditingData.getJoinTable().schema(), propertyValue.getCollectionTable());
    String catalog =
        mainGenerator.getCatalog(
            propertyAuditingData.getJoinTable().catalog(), propertyValue.getCollectionTable());

    Element middleEntityXml =
        MetadataTools.createEntity(
            xmlMappingData.newAdditionalMapping(),
            new AuditTableData(auditMiddleEntityName, auditMiddleTableName, schema, catalog),
            null);
    Element middleEntityXmlId = middleEntityXml.addElement("composite-id");

    // If there is a where clause on the relation, adding it to the middle entity.
    if (where != null) {
      middleEntityXml.addAttribute("where", where);
    }

    middleEntityXmlId.addAttribute("name", mainGenerator.getVerEntCfg().getOriginalIdPropName());

    // Adding the revision number as a foreign key to the revision info entity to the composite id
    // of the
    // middle table.
    mainGenerator.addRevisionInfoRelation(middleEntityXmlId);

    // Adding the revision type property to the entity xml.
    mainGenerator.addRevisionType(middleEntityXml);

    // All other properties should also be part of the primary key of the middle entity.
    return middleEntityXmlId;
  }
  /**
   * Translates {@code entry} into a set of attributes for {@code row}.
   *
   * @param row
   * @param entry
   * @param entryFormat
   * @param schemaIDBinding
   */
  private static void entryToAttributes(
      Element row,
      DatabaseEntry entry,
      List<BdbEntryInfo> entryFormat,
      ISchemaIDBinding schemaIDBinding) {

    ByteBufferReader keyReader = new ByteBufferReader(schemaIDBinding, entry.getData());
    for (BdbEntryInfo info : entryFormat) {
      boolean repeater = info.isRepeater();
      Exception ex = null;
      try {
        if (keyReader.hasFinished()) {
          row.addAttribute(info.getEntryTag(), "");
        } else if (repeater) {
          while (!keyReader.hasFinished()) {
            Object keyPiece = info.invokeMethod(keyReader);
            row.addAttribute(info.getEntryTag(), keyPiece.toString());
          }
        } else {
          Object keyPiece = info.invokeMethod(keyReader);
          String value = keyPiece == null ? "null" : keyPiece.toString();
          row.addAttribute(info.getEntryTag(), value);
        }
      } catch (Exception e) {
        ex = e;
      }
      if (ex != null) {
        row.addAttribute(info.getEntryTag(), "ERROR (" + info.getMethodName() + ")");
        ex.printStackTrace();
      }
      info.reset();
    }
  }
  @Test
  public void testValidateHasNoAttributes() {
    Document document = DocumentHelper.createDocument();

    Element element = document.addElement("if");

    Element childElement = element.addElement("equals");

    childElement.addAttribute("arg1", "hello");
    childElement.addAttribute("arg2", "world");

    PoshiRunnerValidation.validateHasNoAttributes(element, "ValidateHasNoAttributes.macro");

    Assert.assertEquals("validateHasNoAttributes is failing", "", getExceptionMessage());

    document = DocumentHelper.createDocument();

    element = document.addElement("while");

    element.addAttribute("then", "Click");

    PoshiRunnerValidation.validateHasNoAttributes(element, "ValidateHasNoAttributes.macro");

    Assert.assertEquals(
        "validateHasNoAttributes is failing", "Invalid then attribute", getExceptionMessage());
  }
Esempio n. 19
0
  /** Saves the configuration on local drive. Usually you needn't to call this on your own. */
  public void save() {
    Document xmlDocument = DocumentHelper.createDocument();
    Element root = xmlDocument.addElement("config");

    for (String id : config.keySet()) {
      Element tool = root.addElement("key");
      tool.addAttribute("id", id);
      tool.addAttribute("value", config.get(id));
    }

    try {
      OutputFormat format = OutputFormat.createPrettyPrint();

      if (!Key.KEY_CONFIG_FILE.exists()) {
        Key.KEY_CONFIG_FILE.getParentFile().mkdirs();
        Key.KEY_CONFIG_FILE.createNewFile();
      }

      XMLWriter writer = new XMLWriter(new FileWriter(Key.KEY_CONFIG_FILE), format);

      writer.write(xmlDocument);
      writer.close();
    } catch (IOException ex) {
      ex.printStackTrace();
    }
  }
  @Test
  public void testValidateRequiredChildElementNames() {
    Document document = DocumentHelper.createDocument();

    Element element = document.addElement("and");

    Element childElement1 = element.addElement("condition");

    childElement1.addAttribute("argument", "//here");
    childElement1.addAttribute("selenium", "isElementPresent");

    Element childElement2 = element.addElement("contains");

    childElement2.addAttribute("string", "name");
    childElement2.addAttribute("substring", "value");

    PoshiRunnerValidation.validateRequiredChildElementNames(
        element, Arrays.asList("condition", "contains"), "ValidateRequiredChildElementNames.macro");

    Assert.assertEquals("validateRequiredChildElementNames is failing", "", getExceptionMessage());

    PoshiRunnerValidation.validateRequiredChildElementNames(
        element,
        Arrays.asList("condition", "contains", "equals"),
        "ValidateRequiredChildElementNames.macro");

    Assert.assertEquals(
        "validateRequiredChildElementNames is failing",
        "Missing required equals child element",
        getExceptionMessage());
  }
  @Test
  public void testValidateRequiredAttributeNames() {
    Document document = DocumentHelper.createDocument();

    Element element = document.addElement("property");

    element.addAttribute("line-number", "1");
    element.addAttribute("name", "testray.main.component.name");
    element.addAttribute("value", "Tools");

    PoshiRunnerValidation.validateRequiredAttributeNames(
        element,
        Arrays.asList("line-number", "name", "value"),
        "ValidateRequiredAttributeNames.macro");

    Assert.assertEquals("validateRequiredAttributeNames is failing", "", getExceptionMessage());

    document = DocumentHelper.createDocument();

    element = document.addElement("property");

    element.addAttribute("name", "testray.main.component.name");
    element.addAttribute("value", "Tools");

    PoshiRunnerValidation.validateRequiredAttributeNames(
        element,
        Arrays.asList("line-number", "name", "value"),
        "ValidateRequiredAttributeNames.macro");

    Assert.assertEquals(
        "validateRequiredAttributeNames is failing",
        "Missing line-number attribute",
        getExceptionMessage());
  }
Esempio n. 22
0
 private void doTypeCoverage(
     Element element, String type, int covered, float percentage, int required) {
   Element elem = element.addElement(type);
   elem.addAttribute("covered", String.format("%d", covered));
   elem.addAttribute("percentage", String.format("%f", percentage));
   elem.addAttribute("required", String.format("%d", required));
 }
Esempio n. 23
0
 /**
  * Sets the XMPP address (JID) that the packet comes from. The XMPP protocol often makes the
  * "from" attribute optional, so it does not always need to be set.
  *
  * @param from the XMPP address (JID) that the packet comes from.
  */
 public void setFrom(JID from) {
   fromJID = from;
   if (from == null) {
     element.addAttribute("from", null);
   } else {
     element.addAttribute("from", from.toString());
   }
 }
Esempio n. 24
0
 /**
  * Sets the XMPP address (JID) that the packet is address to. The XMPP protocol often makes the
  * "to" attribute optional, so it does not always need to be set.
  *
  * @param to the XMPP address (JID) that the packet is addressed to.
  */
 public void setTo(JID to) {
   toJID = to;
   if (to == null) {
     element.addAttribute("to", null);
   } else {
     element.addAttribute("to", to.toString());
   }
 }
Esempio n. 25
0
 private void createTaskdef(Element parent) {
   if (isOptional()) {
     Element taskdef = parent.addElement("taskdef");
     taskdef.addAttribute("name", task.getName());
     taskdef.addAttribute("classname", classname);
     taskdef.addAttribute("classpathref", PATH_ID);
   }
 }
Esempio n. 26
0
 @Override
 public Element getXml() {
   DocumentFactory f = DocumentFactory.getInstance();
   Element toRet = f.createElement("gene");
   toRet.addAttribute("name", this.getName());
   toRet.addAttribute("expressiveness", this.getExpressiveness().toString());
   return toRet;
 }
Esempio n. 27
0
 private static Element writeGoToFrame2(Element parentElement, GoToFrame2 goToFrame2) {
   Element element = parentElement.addElement("gotoframe2");
   element.addAttribute("scenebias", Integer.toString(goToFrame2.getSceneBias()));
   if (goToFrame2.play()) {
     element.addAttribute("play", "true");
   }
   return element;
 }
 public void versionGet(HttpServletRequest request, HttpServletResponse response)
     throws Exception {
   Document d = XmlUtils.getNewDocument("version");
   Element root = d.getRootElement();
   root.addAttribute("number", jtrac.getReleaseVersion());
   root.addAttribute("timestamp", jtrac.getReleaseTimestamp());
   writeXml(d, response);
 }
 public Iterator<Element> getIdentities(String name, String node, JID senderJID) {
   ArrayList<Element> identities = new ArrayList<Element>();
   Element identity = DocumentHelper.createElement("identity");
   identity.addAttribute("category", "automation");
   identity.addAttribute("type", "message-list");
   identities.add(identity);
   return identities.iterator();
 }
 private void createLanguagesXML(Element configElement) {
   Element languagesElement = configElement.addElement("languages");
   List<LanguageEntity> langs = getDao().getLanguageDao().select();
   for (LanguageEntity lang : langs) {
     Element langElem = languagesElement.addElement("language");
     langElem.addAttribute("code", lang.getCode());
     langElem.addAttribute("title", lang.getTitle());
   }
 }