Package com.webobjects.eoaccess

Examples of com.webobjects.eoaccess.EOEntity


  protected void fixDuplicateSingleTableInheritanceDropStatements(EOSynchronizationFactory syncFactory, NSMutableDictionary flags, StringBuffer sqlBuffer) {
    if ("YES".equals(flags.valueForKey(EOSchemaGeneration.DropTablesKey))) {
      NSMutableArray dropEntities = new NSMutableArray(_entities);
      for (int entityNum = dropEntities.count() - 1; entityNum >= 0; entityNum--) {
        EOEntity entity = (EOEntity) dropEntities.objectAtIndex(entityNum);
        if (isSingleTableInheritance(entity)) {
          dropEntities.removeObjectAtIndex(entityNum);
        }
      }
      if (dropEntities.count() != _entities.count()) {
View Full Code Here


    }
    EOGlobalID gid = editingContext.globalIDForObject(this);
    if (gid.isTemporary()) {
      init(editingContext);
      if (applyRestrictingQualifierOnInsert()) {
        EOEntity entity = ERXEOAccessUtilities.entityNamed(editingContext, entityName());
        EOQualifier restrictingQualifier = entity.restrictingQualifier();
        if (restrictingQualifier != null) {
          ERXEOControlUtilities.makeQualifierTrue(restrictingQualifier, this);
        }
      }
    }
View Full Code Here

            log.debug("Got raw key: " + rawPK);
          NSArray<String> primaryKeyAttributeNames = primaryKeyAttributeNames();
          _primaryKeyDictionary = new NSDictionary<String, Object>(rawPK instanceof NSArray ? (NSArray<Object>) rawPK : new NSArray<Object>(rawPK), primaryKeyAttributeNames);
        }
        else {
          EOEntity entity = entity();
          NSArray<EOAttribute> primaryKeyAttributes = entity.primaryKeyAttributes();
          // If the entity has a composite primary key, then we are
          // going to make
          // the assumption that we can determine its primary key from
          // the values
          // of the relationships that are bound to its primary key
          // attributes rather
          // than attempting to generate a PK with the plugin.
          if (primaryKeyAttributes.count() > 1) {
            NSMutableDictionary<String, Object> compositePrimaryKey = new NSMutableDictionary<String, Object>();
            boolean incompletePK = false;
            for (EOAttribute primaryKeyAttribute : primaryKeyAttributes) {
              Object value = null;
              for (EORelationship relationship : entity.relationships()) {
                // .. we need to find the relationship that is
                // associated with each PK attribute
                if (relationship._isToOneClassProperty() && relationship.sourceAttributes().contains(primaryKeyAttribute)) {
                  Object obj = valueForKey(relationship.name());
                  if (obj instanceof ERXGenericRecord) {
View Full Code Here

  public ERXEnterpriseObject refetchObjectFromDB() {
    return refetchObjectFromDBinEditingContext(editingContext());
  }

  public ERXEnterpriseObject refetchObjectFromDBinEditingContext(EOEditingContext ec) {
    EOEntity entity = ERXEOAccessUtilities.entityNamed(ec, entityName());
    EOQualifier qual = entity.qualifierForPrimaryKey(primaryKeyDictionary(false));
    EOFetchSpecification fetchSpec = new EOFetchSpecification(entityName(), qual, null);
    fetchSpec.setRefreshesRefetchedObjects(true);
    NSArray results = ec.objectsWithFetchSpecification(fetchSpec);
    ERXEnterpriseObject freshObject = null;
    if (results.count() > 0) {
View Full Code Here

  private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
    takeValueForKey(in.readObject(), D2WModel.SessionKey);
    takeValueForKey(in.readBoolean()?D2WModel.One:D2WModel.Zero, D2WModel.FrameKey);
    takeValueForKey(in.readObject(), D2WModel.TaskKey);
    String entityName = (String) in.readObject();
    EOEntity entity = entityName == null?null:EOModelGroup.defaultGroup().entityNamed(entityName);
    takeValueForKey(entity, D2WModel.EntityKey);
    takeValueForKey(in.readObject(), D2WModel.PropertyKeyKey);
    takeValueForKey(in.readObject(), D2WModel.DynamicPageKey);
    /*
     * The ec must be deserialized before the EO. Otherwise, when the EO is
View Full Code Here

    public ERD2WController controllerForTaskAndEntityNamed(String task, String entityName, WOSession session) {
        myCheckRules();
        D2WContext newContext=ERD2WContext.newContext(session);
        newContext.setTask(task);
        EOEntity newEntity=entityName!=null ? EOModelGroup.defaultGroup().entityNamed(entityName) : null;
        if (newEntity!=null) newContext.setEntity(newEntity);
        String controllerName="__"+task+"__"+entityName;
        // saves 2 significant keys, task and entity!
        newContext.takeValueForKey(controllerName,"controllerName");
View Full Code Here

   */
  @SuppressWarnings({ "unchecked", "cast" })
  public static NSArray<String> readableAttributeNames(EOEnterpriseObject source) {
    // These are cached on EOEntity name as an optimization.

    EOEntity entity = EOUtilities.entityForObject(source.editingContext(), source);
    NSArray<String> attributeNames = EOEnterpriseObjectSerializer.readableAttributeNames.objectForKey(entity.name());
    //AK: should use clientProperties from EM
    if (attributeNames == null) {
      EOEntity currentEntity = entity;
      while (attributeNames == null && currentEntity != null) {
        attributeNames = (NSArray<String>)ERXProperties.arrayForKey("er.ajax.json." + currentEntity.name() + ".attributes");
        currentEntity = currentEntity.parentEntity();
      }
      if (attributeNames == null) {
        //publicAttributes = source.attributeKeys();
        //publicAttributeSet.addObjectsFromArray(publicAttributes);
        //NSArray classProperties = entity.classPropertyNames();
View Full Code Here

   */
  @SuppressWarnings({ "unchecked", "cast" })
  public static NSArray<String> writableAttributeNames(EOEnterpriseObject source) {
    // These are cached on EOEntity name as an optimization.

    EOEntity entity = EOUtilities.entityForObject(source.editingContext(), source);
    NSArray<String> writableNames = EOEnterpriseObjectSerializer.writableAttributeNames.objectForKey(entity.name());
    //AK: should use clientProperties from EM
    if (writableNames == null) {
      EOEntity currentEntity = entity;
      while (writableNames == null && currentEntity != null) {
        writableNames = (NSArray<String>)ERXProperties.arrayForKey("er.ajax.json." + currentEntity.name() + ".writableAttributes");
        currentEntity = currentEntity.parentEntity();
      }
      if (writableNames == null) {
        //publicAttributes = source.attributeKeys();
        //publicAttributeSet.addObjectsFromArray(publicAttributes);
        //NSArray classProperties = entity.classPropertyNames();
View Full Code Here

   */
  @SuppressWarnings({ "unchecked", "cast" })
  public static NSArray<String> includedRelationshipNames(EOEnterpriseObject source) {
    // These are cached on EOEntity name as an optimization.

    EOEntity entity = EOUtilities.entityForObject(source.editingContext(), source);
    NSArray<String> relationshipNames = EOEnterpriseObjectSerializer.includedRelationshipNames.objectForKey(entity.name());
    if (relationshipNames == null) {
      EOEntity currentEntity = entity;
      while (relationshipNames == null && currentEntity != null) {
        relationshipNames = (NSArray<String>)ERXProperties.arrayForKey("er.ajax.json." + currentEntity.name() + ".relationships");
        currentEntity = currentEntity.parentEntity();
      }
      if (relationshipNames == null) {
        relationshipNames = entity.classDescriptionForInstances().toOneRelationshipKeys();
      }
      EOEnterpriseObjectSerializer.includedRelationshipNames.setObjectForKey(relationshipNames, entity.name());
View Full Code Here

        public ERCCore() {
        }

        protected WOComponent pageWithContextTaskEntity(String task, String entityName) {
            D2WModel.defaultModel().checkRules();
            EOEntity eoentity = (entityName == null ? null : EOModelGroup.defaultGroup().entityNamed(entityName));
            if (eoentity == null && entityName != null && !entityName.equals("")
                && !entityName.equals("*all*"))
                throw new IllegalArgumentException("Could not find entity named " + entityName);
            d2wContext().setTask(task);
            d2wContext().setEntity(eoentity);
View Full Code Here

TOP

Related Classes of com.webobjects.eoaccess.EOEntity

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.