Beispiel #1
0
  public IOID addJavaObjectGetId(Object o, String objectName) {
    ISBAObject isbaObject = null;
    if (o instanceof String) {
      isbaObject = new StringObject(objectName, (String) o);
    } else if (o instanceof Boolean) {
      isbaObject = new BooleanObject(objectName, ((Boolean) o));
    } else if (o instanceof Byte) {
      isbaObject = new IntegerObject(objectName, ((Byte) o).intValue());
    } else if (o instanceof Character) {
      isbaObject = new StringObject(objectName, ((Character) o).toString());
    } else if (o instanceof Short) {
      isbaObject = new IntegerObject(objectName, ((Short) o).intValue());
    } else if (o instanceof Integer) {
      isbaObject = new IntegerObject(objectName, (Integer) o);
    } else if (o instanceof Long) {
      isbaObject = new IntegerObject(objectName, ((Long) o).intValue());
    } else if (o instanceof Double) {
      isbaObject = new DoubleObject(objectName, ((Double) o));
    } else if (o instanceof Float) {
      isbaObject = new DoubleObject(objectName, ((Float) o).doubleValue());
    } else if (o instanceof Collection) {
      // rekurencja dla kazdego
      isbaObject = getComplexObject(objectName, (Collection) o);

    } else if (o instanceof Map) {
      isbaObject = getComplexObject(objectName, (Map) o);
    } else {
      isbaObject = getComplexObject(objectName, getObjectAsFieldValuesMap(o));
    }
    persist((OIDAwareObject) isbaObject);
    return isbaObject.getOID();
  }
Beispiel #2
0
 @Override
 public void loadXML(String filePath) {
   try {
     DataSourceParser parser =
         new XMLDataSourceParser(
             new ObjectPersister() {
               @Override
               public void persist(ISBAObject isbaObject) {
                 SBAStore.this.persist(isbaObject);
               }
             });
     InputStream is = new URL("file://" + filePath).openStream();
     ISBAObject isbaObject = parser.parse(is);
     this.entryOID = isbaObject.getOID();
   } catch (Exception e) {
     e.printStackTrace();
   }
 }