Package com.webobjects.eoaccess

Examples of com.webobjects.eoaccess.EOGeneralAdaptorException


    catch (EOGeneralAdaptorException e) {
      throw e;
    }
    catch (Throwable e) {
      e.printStackTrace();
      throw new EOGeneralAdaptorException("Failed to delete '" + entity.name() + "' with qualifier " + qualifier + ": " + e.getMessage());
    }
  }
View Full Code Here


    catch (EOGeneralAdaptorException e) {
      throw e;
    }
    catch (Throwable e) {
      e.printStackTrace();
      throw new EOGeneralAdaptorException("Failed to insert '" + entity.name() + "' with row " + row + ": " + e.getMessage());
    }
  }
View Full Code Here

      e.printStackTrace();
      throw e;
    }
    catch (Throwable e) {
      e.printStackTrace();
      throw new EOGeneralAdaptorException("Failed to update '" + entity.name() + "' row " + updatedRow + " with qualifier " + qualifier + ": " + e.getMessage());
    }
  } 
View Full Code Here

      throw e;
    }
    catch (Throwable e) {
      e.printStackTrace();
      cancelFetch();
      throw new EOGeneralAdaptorException("Failed to fetch '" + entity.name() + "' with fetch specification '" + fetchSpecification + "': " + e.getMessage());
    }
  }
View Full Code Here

    catch (EOGeneralAdaptorException e) {
      throw e;
    }
    catch (Throwable e) {
      e.printStackTrace();
      throw new EOGeneralAdaptorException("Failed to update '" + entity.name() + "' row " + updatedRow + " with qualifier " + qualifier + ": " + e.getMessage());
    }
  }
View Full Code Here

    catch (EOGeneralAdaptorException e) {
      throw e;
    }
    catch (Throwable e) {
      e.printStackTrace();
      throw new EOGeneralAdaptorException("Failed to insert '" + entity.name() + "' with row " + row + ": " + e.getMessage());
    }
  }
View Full Code Here

    catch (EOGeneralAdaptorException e) {
      throw e;
    }
    catch (Throwable e) {
      e.printStackTrace();
      throw new EOGeneralAdaptorException("Failed to delete '" + entity.name() + "' with qualifier " + qualifier + ": " + e.getMessage());
    }
  }
View Full Code Here

  @Override
  public NSDictionary _newPrimaryKey(EOEnterpriseObject object, EOEntity entity) {
    EREntityStore store = _entityStoreForEntity(entity, false);
    NSArray pkAttributes = entity.primaryKeyAttributes();
    if (pkAttributes.count() > 1) {
      throw new EOGeneralAdaptorException("Failed to generate primary key because " + entity.name() + " has a composite primary key.");
    }
    EOAttribute pkAttribute = (EOAttribute) pkAttributes.objectAtIndex(0);
    int nextSequence = store.nextSequence();
    Object pkValue;
    String className = pkAttribute.className();
View Full Code Here

            else {
              value = null;
            }
          }
          else if (attributeElements.getLength() > 1) {
            throw new EOGeneralAdaptorException("There was more than one column named '" + columnName + "'.");
          }
          else {
            Element attributeElement = (Element) attributeElements.item(0);
            if ("true".equals(attributeElement.getAttribute("nil"))) {
              value = null;
            }
            else {
              String strValue = textValue(attributeElement);
              if (attributeElement.hasAttribute("type")) {
                String type = attributeElement.getAttribute("type");
                if ("bigit".equals(type)) {
                  value = new BigDecimal(strValue);
                }
                else if ("boolean".equals(type)) {
                  value = Boolean.parseBoolean(strValue);
                }
                else if ("datetime".equals(type)) {
                  value = ERRESTAdaptorChannel.restDateFormat.parseObject(strValue);
                }
                else if ("double".equals(type)) {
                  value = Double.parseDouble(strValue);
                }
                else if ("float".equals(type)) {
                  value = Float.parseFloat(strValue);
                }
                else if ("integer".equals(type)) {
                  value = Integer.parseInt(strValue);
                }
                else if ("short".equals(type)) {
                  value = Short.parseShort(strValue);
                }
                else {
                  throw new IllegalArgumentException("Unknown type '" + type + "'.");
                }
              }
              else {
                value = convertValue(strValue, attribute);
              }
            }
          }

          if (value != null) {
            row.setObjectForKey(value, attribute.name());
          }
        }

        // Just in case you qualified against attributes that ended up not
        // being returned in the results, we augment the resulting row
        // with the key-value pairs from your qualifier.
        if (attributesFromQualifier.count() > 0) {
          for (String qualifierAttributeName : attributesFromQualifier.allKeys()) {
            if (!row.containsKey(qualifierAttributeName)) {
              EOAttribute qualifierAttribute = entity.attributeNamed(qualifierAttributeName);
              if (qualifierAttribute != null && attributesToFetch.containsObject(qualifierAttribute)) {
                row.setObjectForKey(attributesFromQualifier.objectForKey(qualifierAttributeName), qualifierAttributeName);
              }
            }
          }
        }

        // Because we can only interpret parts of your qualifier, we now run the
        // fetched dictionaries through the in-memory qualifier and let it weed
        // out results using the more complicatd qualifiers.
        EOQualifier qualifier = fetchSpecification.qualifier();
        if (qualifier == null || qualifier.evaluateWithObject(row)) {
          _fetchedRows.addObject(row);
        }
        else {
          System.out.println("ERRESTAdaptorChannel.selectAttributes: skipping " + row + " (" + qualifier + ")");
        }
      }
    }
    catch (EOGeneralAdaptorException e) {
      throw e;
    }
    catch (Throwable e) {
      e.printStackTrace();
      throw new EOGeneralAdaptorException("Failed to fetch '" + entity.name() + "' with fetch specification '" + fetchSpecification + "': " + e.getMessage());
    }
  }
View Full Code Here

  }

  @Override
  public int updateValuesInRowsDescribedByQualifier(NSDictionary updatedRow, EOQualifier qualifier, EOEntity entity) {
    try {
      throw new EOGeneralAdaptorException("ERRESTAdaptorChannel.updateValuesInRowsDescribedByQualifier not supported.");
    }
    catch (EOGeneralAdaptorException e) {
      throw e;
    }
    catch (Throwable e) {
      e.printStackTrace();
      throw new EOGeneralAdaptorException("Failed to update '" + entity.name() + "' row " + updatedRow + " with qualifier " + qualifier + ": " + e.getMessage());
    }
  }
View Full Code Here

TOP

Related Classes of com.webobjects.eoaccess.EOGeneralAdaptorException

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.