Package org.objectstyle.wolips.eomodeler.core.model

Examples of org.objectstyle.wolips.eomodeler.core.model.EOModelMap


    _encoding = encoding;
    _changes.firePropertyChange(ENCODING, oldEncoding, _encoding);
  }

  private void loadModelFromFile(final File file) throws IOException, PropertyListParserException {
    _modelMap = new EOModelMap((Map<?, ?>) WOLPropertyListSerialization.propertyListFromFile(file, new EOModelParserDataStructureFactory()));
  }
View Full Code Here


  private void loadModelFromFile(final File file) throws IOException, PropertyListParserException {
    _modelMap = new EOModelMap((Map<?, ?>) WOLPropertyListSerialization.propertyListFromFile(file, new EOModelParserDataStructureFactory()));
  }

  public void loadModelFromStream(final InputStream input) throws IOException, PropertyListParserException {
    _modelMap = new EOModelMap((Map<?, ?>) WOLPropertyListSerialization.propertyListFromStream(input, new EOModelParserDataStructureFactory()));
  }
View Full Code Here

    _variables = new PropertyListMap<Object, Object>();
    _displayGroups = new ArrayList<DisplayGroup>();

    Map<?, ?> variables = _modelMap.getMap("variables");
    if (variables != null) {
      EOModelMap variableMap = new EOModelMap(variables);
      Set<Map.Entry<String, Object>> variableEntries = variableMap.entrySet();
      for (Map.Entry<String, Object> entry : variableEntries) {
        if (entry.getValue() instanceof Map) {
          EOModelMap entryMap = new EOModelMap((Map<?, ?>) entry.getValue());
          String className = entryMap.getString("class", true);
          //XXX This should support subclasses of WODisplayGroup
          try {
            IType classType = findDisplayGroupClass(className);
            if (classType != null) {
              DisplayGroup displayGroup = new DisplayGroup(this);
View Full Code Here

  }

  public void doSave(final OutputStream writer) throws IOException {
    // XXX Need to validate model before saving
    EOModelMap modelMap = toModelMap();
    try {
      WOLPropertyListSerialization.propertyListToStream(writer, modelMap);
    }
    catch (PropertyListParserException e) {
      // TODO Auto-generated catch block
View Full Code Here

    loadModelFromFile(_file.getLocation().toFile());
    parseModel();
  }

  public EOModelMap toModelMap() {
    EOModelMap modelMap = _modelMap.cloneModelMap();
    modelMap.setString("WebObjects Release", _woRelease, true);
    modelMap.setString("encoding", _encoding, true);
    EOModelMap variableMap = new EOModelMap();
    if (_variables != null) {
      variableMap.putAll(_variables);
    }
    for (DisplayGroup displayGroup : _displayGroups) {
      String displayGroupName = displayGroup.getName();
      EOModelMap displayGroupMap = displayGroup.toMap();
      variableMap.setMap(displayGroupName, displayGroupMap, true);
    }
    modelMap.setMap("variables", variableMap, true);
    return modelMap;
  }
View Full Code Here

    List<String> qualificationFormatList = Arrays.asList(QUALIFICATION_FORMATS);
    _qualificationIndex = qualificationFormatList.indexOf(_qualifierFormat);

    if (map.containsKey("dataSource")) {
      EOModelMap dataSourceMap = new EOModelMap(map.getMap("dataSource"));
      try {
        EODataSource dataSource = EODataSourceFactory.createDataSourceFromMap(dataSourceMap, _wooModel.getModelGroup());
        dataSource.loadFromMap(dataSourceMap, failures);
        _dataSource = dataSource;
      } catch (Throwable e) {
        e.printStackTrace();
      }

      if (_dataSource instanceof EODetailDataSource) {
        EODetailDataSource ds = (EODetailDataSource) _dataSource;
        _hasMasterDetail = true;
        setMasterEntityName(ds.getMasterClass());
        setDetailKeyName(ds.getDetailKey());
        _detailDataSource = ds;
      }
      else if (_dataSource instanceof EODatabaseDataSource) {
        EODatabaseDataSource ds = (EODatabaseDataSource) _dataSource;
        _hasMasterDetail = false;
        setEntityName(ds.getEntityName());
        _databaseDataSource = ds;
      }

      if (_entityName == null) {
        // XXX Invalid display group
        if (dataSourceMap.containsKey("fetchSpecification")) {
          EOModelMap fetchSpecMap = new EOModelMap(dataSourceMap.getMap("fetchSpecification"));
          _entityName = fetchSpecMap.getString("entityName", true);
        }
        else if (dataSourceMap.containsKey("masterClassDescription")) {
          _entityName = dataSourceMap.getString("masterClassDescription", true);
        }
      }
    }

    List<Map<Object, Object>> sortOrderList = map.getList("sortOrdering");
    if (sortOrderList != null) {
      for (Map<Object, Object> sortOrdering : sortOrderList) {
        if (sortOrdering != null) {
          EOModelMap sortOrderingMap = new EOModelMap(sortOrdering);
          _sortOrder.loadFromMap(sortOrderingMap);
          _isSorted = true;
        }
      }
    }
View Full Code Here

  public EOModelMap toMap() {
    // XXX Need to validate model before saving
    if (_entity == null) {
      //return null;
    }
    EOModelMap modelMap = new EOModelMap();
    modelMap.setString("class", _className, true);
    modelMap.setMap("dataSource", _dataSource.toMap(), true);
    modelMap.setBoolean("fetchesOnLoad", _fetchesOnLoad, EOModelMap.YESNO);
    modelMap.setString("formatForLikeQualifier", _qualifierFormat, true);
    modelMap.setList("localKeys", _localKeys, true);
    modelMap.setInteger("numberOfObjectsPerBatch", _entriesPerBatch);
    modelMap.setBoolean("selectsFirstObjectAfterFetch", _selectsFirstObject, EOModelMap.YESNO);
    if (_isSorted) {
      List<Object> sortOrderingList = new ArrayList<Object>();
      sortOrderingList.add(_sortOrder.toMap());
      modelMap.setList("sortOrdering", sortOrderingList, true);
    }
    _originalName = _name;
    return modelMap;
  }
View Full Code Here

TOP

Related Classes of org.objectstyle.wolips.eomodeler.core.model.EOModelMap

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.