コード例 #1
0
  /**
   * Deletes a template from a xml file.
   *
   * @param template template that should be deleted
   * @return true if the template was succesfuly deleted
   */
  public boolean deleteTemplate(ConstraintTemplate template, LanguageGroup parent) {
    Element parentElement = getParentElement(parent, template.getLanguage());

    Element element = factory.getTemplateElement(template, parentElement);
    if (element != null) {
      this.deleteElement(element, parentElement);
      // factory.deleteElement(element, parentElement);
      writeDocument();
      return true;
    }
    return false;
  }
コード例 #2
0
 /**
  * Edits/alters a template in a xml file.
  *
  * @param template template that should be edited
  * @return true if the template was succesfuly edited
  */
 public boolean editTemplate(ConstraintTemplate template, LanguageGroup parent) {
   /* Element languageElement = this.getLanguageElement(template.getLanguage());
   Element element = factory.getTemplateElement(template, languageElement);
   if (element != null) {
     factory.templateToElement(template, element);
     writeDocument();
     return true;
   }
   return false;*/
   Element parentElement = getParentElement(parent, template.getLanguage());
   Element element = factory.getTemplateElement(template, parentElement);
   if (element != null) {
     factory.templateToElement(template, element);
     writeDocument();
     return true;
   }
   return false;
 }