Package com.webobjects.eocontrol

Examples of com.webobjects.eocontrol.EOClassDescription


   * @return NSArray of language/locale keys
   */
  @SuppressWarnings("unchecked")
  public NSArray<String> localesForKey(String key) {
    NSArray<String> result = NSArray.EmptyArray;
    EOClassDescription cd = classDescription();
    if (cd instanceof ERXEntityClassDescription) {
      ERXEntityClassDescription ecd = (ERXEntityClassDescription) cd;
      EOAttribute attribute = ecd.entity().attributeNamed(key);
      if (attribute == null) {
        attribute = ecd.entity().attributeNamed(localizedKey(key));
View Full Code Here


  public final <T> void takeValueForKey(Object value, ERXKey<T> key) {
    takeValueForKeyPath(value, key.key());
  }
 
  protected String localizedKey(String key) {
    EOClassDescription cd = classDescription();
    if (cd instanceof ERXEntityClassDescription) {
      return ((ERXEntityClassDescription) cd).localizedKey(key);
    }
    return null;
  }
View Full Code Here

    if (key == null) // better to raise before calling super which will crash
      throw new RuntimeException("validateValueForKey called with null key on " + this);
    Object result = null;
    try {
      result = super.validateValueForKey(value, key);
      EOClassDescription cd = classDescription();
      if (cd instanceof ERXEntityClassDescription) {
        ((ERXEntityClassDescription) cd).validateObjectWithUserInfo(this, value, "validateForKey." + key, key);
      }
      value = _validateValueForKey(value, key);
    }
View Full Code Here

   *             if the object does not pass validation for saving to the
   *             database.
   */
  @Override
  public void validateForInsert() throws NSValidation.ValidationException {
    EOClassDescription cd = classDescription();
    if (cd instanceof ERXEntityClassDescription) {
      ((ERXEntityClassDescription) cd).validateObjectForInsert(this);
    }
    super.validateForInsert();
  }
View Full Code Here

   *             if the object does not pass validation for saving to the
   *             database.
   */
  @Override
  public void validateForUpdate() throws NSValidation.ValidationException {
    EOClassDescription cd = classDescription();
    if (cd instanceof ERXEntityClassDescription) {
      ((ERXEntityClassDescription) cd).validateObjectForUpdate(this);
    }
    super.validateForUpdate();
  }
View Full Code Here

      if(useEO) {
        destination = new JSONObject();
        destination.put("eo", eoData);
        state.push(source, eoData, "eo");
      }
      EOClassDescription cd = source.classDescription();
      NSArray<String> attributeNames = _readableAttributeNames(source);
      NSArray<String> relationshipNames = _includedRelationshipNames(source);
     
      for (Enumeration e = attributeNames.objectEnumerator(); e.hasMoreElements();) {
        String key = (String) e.nextElement();
        Object jsonValue;
        if(cd.toManyRelationshipKeys().containsObject(key)) {
          if (relationshipNames.containsObject(key)) {
            Object value = source.valueForKey(key);
            jsonValue = ser.marshall(state, source, value, key);
          }
          else {
//            JSONObject rel = new JSONObject();
//            rel.put("javaClass", "com.webobjects.eocontrol.EOArrayFault");
//            rel.put("sourceGlobalID", destination.get("gid"));
//            rel.put("relationshipName", key);
//            jsonValue = rel;
            jsonValue = null;
          }
        } else if (cd.toOneRelationshipKeys().containsObject(key)) {
          if (relationshipNames.containsObject(key)) {
            Object value = source.valueForKey(key);
            jsonValue = ser.marshall(state, source, value, key);
          }
          else {
View Full Code Here

      removeObjectFromBothSidesOfRelationshipWithKey(object, "employees");
    }
  }

  public er.ajax.mootools.example.components.Employee createEmployeesRelationship() {
    EOClassDescription eoClassDesc = EOClassDescription.classDescriptionForEntityName("Employee");
    EOEnterpriseObject eo = eoClassDesc.createInstanceWithEditingContext(editingContext(), null);
    editingContext().insertObject(eo);
    addObjectToBothSidesOfRelationshipWithKey(eo, "employees");
    return (er.ajax.mootools.example.components.Employee) eo;
  }
View Full Code Here

    }
    else if (valueType != null && ERXCryptoString.class.isAssignableFrom(valueType)) {
      parsedValue = new ERXCryptoString(value.toString());
    }
    else if (resolveEntities) {
      EOClassDescription entity = ERXRestClassDescriptionFactory.classDescriptionForEntityName(valueTypeName);
      if (entity != null) {
        parsedValue = IERXRestDelegate.Factory.delegateForClassDescription(entity).objectOfEntityWithID(entity, value, context);
      }
      else {
        throw new IllegalArgumentException("Unknown value type '" + valueTypeName + "'.");
View Full Code Here

  private Object object;

  protected ERXDummyRecord(Object o) {
    object = o;
    EOClassDescription classDescription = classDescriptionForObject(object);
    __setClassDescription(classDescription);
  }
View Full Code Here

    EOEntity entity = EOModelGroup.defaultGroup().entityNamed(entityName);
    /*if (entity != null) {
      pojoModel.removeEntity(entity);
      entity = null;
    }*/
    EOClassDescription classDescription;
    if (entity == null) {
      entity = new EOEntity();
      entity.setName(entityName);
      keys = (keys == null ? fieldNamesFromClass(clazz) : keys);
      for (Enumeration iter = keys.objectEnumerator(); iter.hasMoreElements();) {
View Full Code Here

TOP

Related Classes of com.webobjects.eocontrol.EOClassDescription

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.