Ejemplo n.º 1
0
  private void initialiseValue(String dataType) {
    if (dataType.equals("boolean")) {

      // if its a string of 'true' or 'false', use it to set the boolean value
      setValue(Boolean.valueOf(getValue()).toString());
    } else if (dataType.equals("positiveInteger")) {
      setValue("1");
    } else if (dataType.equals("negativeInteger")) {
      setValue("-1");
    } else if (XSDType.isNumericType(dataType)) {
      setValue("0");
    } else if (!dataType.equals("string")) setValue("");
  }
 /**
  * saves a JDOM Document to a file * public static void documentToFile(Document doc, String path)
  * { try { FileOutputStream fos = new FileOutputStream(path); XMLOutputter xop = new
  * XMLOutputter(Format.getPrettyFormat()); xop.output(doc, fos); fos.flush(); fos.close(); } catch
  * (IOException ioe){ _log.error("IO Exception in saving Document to file, filepath = " + path,
  * ioe) ; } }
  *
  * <p>/***************************************************************************
  */
 public static String getDefaultValueForType(String dataType) {
   if (dataType == null) return "null";
   else if (dataType.equalsIgnoreCase("boolean")) return "false";
   else if (dataType.equalsIgnoreCase("string") || (!XSDType.isBuiltInType(dataType))) return "";
   else return "0";
 }