Package com.webobjects.eocontrol

Examples of com.webobjects.eocontrol.EOEnterpriseObject


            }
            return nextPage();
        }

        public WOComponent nextPage() {
            EOEnterpriseObject newEO = createEO();
            NSDictionary extraValues=currentPageConfiguration!=null ? new NSDictionary(currentPageConfiguration, "pageConfiguration") : null;
            String createPageConfigurationName = (String)ERDirectToWeb.d2wContextValueForKey("createConfigurationName",
                                                                                             entityNameForNewInstances,
                                                                                             extraValues);
            if (log.isDebugEnabled())
View Full Code Here


            if (object!=null && !(object.editingContext().parentObjectStore() instanceof EOObjectStoreCoordinator)) {
                log.warn("Newly created object is in an editing context that will not save to the database");
            }
            localContext = ERXEC.newEditingContext(object.editingContext().parentObjectStore());
            if (log.isDebugEnabled()) log.debug("Creating "+entityNameForNewInstances);
            EOEnterpriseObject newEO = ERXEOControlUtilities.createAndInsertObject(localContext, entityNameForNewInstances);
            // If the object already exists, then hookup the relationship, if not do it after the object is saved.
            if (!((ERXEnterpriseObject)object).isNewObject()) {
                EOEnterpriseObject localEO = EOUtilities.localInstanceOfObject(localContext, object);
                if (localEO != null)
                    localEO.addObjectToBothSidesOfRelationshipWithKey(newEO, key);
            }
            if (preRelationshipKeys != null) {
                for(Enumeration e = preRelationshipKeys.allKeys().objectEnumerator(); e.hasMoreElements();) {
                    String relationshipKey = (String)e.nextElement();
                    String objectKeyPath = (String)preRelationshipKeys.objectForKey(relationshipKey);
                    EOEnterpriseObject localObject = EOUtilities.localInstanceOfObject(localContext, (EOEnterpriseObject)object.valueForKeyPath(objectKeyPath));
                    localObject.addObjectToBothSidesOfRelationshipWithKey(newEO, relationshipKey);
                }
            }
            localContext.hasChanges(); // Make sure the EC survives.
            return newEO;
        }
View Full Code Here

            return followPage;
        }

        public void postProcessing() {
            if (object != null && savedObject != null && key != null) {
                EOEnterpriseObject localEO = EOUtilities.localInstanceOfObject(object.editingContext(), savedObject), localObject;
                // because this might be null, an array, or an EO
                if ((object.valueForKey(key) != null)&&(object.valueForKey(key) instanceof NSArray)&&(!((NSArray)object.valueForKey(key)).containsObject(localEO)))
                    object.addObjectToBothSidesOfRelationshipWithKey(localEO, key);
                if (object.valueForKey(key) == null)
                    object.addObjectToBothSidesOfRelationshipWithKey(localEO, key);
                if (postRelationshipKeys != null) {
                    for(Enumeration e = postRelationshipKeys.allKeys().objectEnumerator(); e.hasMoreElements();) {
                        String relationshipKey = (String)e.nextElement();
                        String objectKeyPath = (String)postRelationshipKeys.objectForKey(relationshipKey);
                        if (objectKeyPath.equals("this")) {
                            localObject = localEO;
                        } else {
                            localObject = (EOEnterpriseObject)localEO.valueForKeyPath(objectKeyPath);
                        }
                        localObject.addObjectToBothSidesOfRelationshipWithKey(savedObject, relationshipKey);
                    }
                }
            }
View Full Code Here

                if (confirmMessageKey() == null)
                    throw new IllegalStateException("You must specify a confirmMessageKey for this pageConfiguration!");
                if (log.isDebugEnabled())
                    log.debug("Setting message: " + message + " for key: " + confirmMessageKey() + " on eos: " + list());
                for (Enumeration e = list().objectEnumerator(); e.hasMoreElements();) {
                    EOEnterpriseObject eo = (EOEnterpriseObject)e.nextElement();
                    eo.takeValueForKeyPath(message, confirmMessageKey());
                }
            }
        } else {
            log.warn("List is zero.  If used in a confirm page template, need to set the object or datasource");
        }
View Full Code Here

  @Override
    public WOComponent editAction() {
    boolean useAjax = ERXValueUtilities.booleanValue(d2wContext().valueForKey(Keys.useAjaxControlsWhenEmbedded));
    if (useAjax) {
        EOEditingContext ec = ERXEC.newEditingContext(object().editingContext());
        EOEnterpriseObject localObj = ERXEOControlUtilities.localInstanceOfObject(ec, object());
        d2wContext().takeValueForKey(localObj, Keys.objectBeingEdited);
        _previousPageConfig = (String)d2wContext().valueForKey(Keys.pageConfiguration);
        _previousTask = (String)d2wContext().valueForKey(Keys.task);
        d2wContext().takeValueForKey("edit", Keys.inlineTask);
        String newConfig = (String)d2wContext().valueForKey(Keys.inlinePageConfiguration);
View Full Code Here

        String primaryKeyString = ERXEOControlUtilities.primaryKeyStringForObject(browserItem);
        return ERXStringUtilities.safeIdentifierName(browserItem.entityName() + primaryKeyString);
    }
   
    public Object toOneDescription() {
        EOEnterpriseObject anEO = browserItem;
        if(anEO != null) {
            String keyWhenRelationship = keyWhenRelationship();
            if(keyWhenRelationship == null || keyWhenRelationship.equals("userPresentableDescription"))
                return anEO.userPresentableDescription();
            else
                return anEO.valueForKeyPath(keyWhenRelationship);
        } else {
            return null;
        }
    }
View Full Code Here

  @Override
    public WOComponent editAction() {
    boolean useAjax = ERXValueUtilities.booleanValue(d2wContext().valueForKey(Keys.useAjaxControlsWhenEmbedded));
    if (useAjax) {
        EOEditingContext ec = ERXEC.newEditingContext(object().editingContext());
        EOEnterpriseObject localObj = ERXEOControlUtilities.localInstanceOfObject(ec, object());
        d2wContext().takeValueForKey(localObj, Keys.objectBeingEdited);
        _previousPageConfig = (String)d2wContext().valueForKey(Keys.pageConfiguration);
        _previousTask = (String)d2wContext().valueForKey(Keys.task);
        d2wContext().takeValueForKey("edit", Keys.inlineTask);
        String newConfig = (String)d2wContext().valueForKey(Keys.inlinePageConfiguration);
View Full Code Here

      return (String) d2wContext().valueForKey("id");
    }

    // actions   
    public WOComponent toOneAction() {
        EOEnterpriseObject anEO = browserItem;
        if(anEO == null) {
            return null;
        } else {
            InspectPageInterface inspectPage = (InspectPageInterface) D2W.factory().pageForConfigurationNamed("Inspect" + anEO.entityName(), session());
            inspectPage.setObject(anEO);
            inspectPage.setNextPage(context().page());
            return (WOComponent)inspectPage;
        }
    }
View Full Code Here

            return (WOComponent)inspectPage;
        }
    }
   
    public void removeFromToManyRelationshipAction() {
        EOEnterpriseObject anEO = browserItem;
        object().removeObjectFromBothSidesOfRelationshipWithKey(anEO, propertyKey());
    }
View Full Code Here

        } else if (attribute.name() == null) {
      NSLog.debug.appendln("attribute.name() == null, attribute = "+attribute);
        } else {
      //NSLog.debug.appendln("checking eo="+eoentity.name()+", attributename="+attribute.name());
      EOClassDescription eoclassdescription = EOClassDescription.classDescriptionForEntityName(eoentity.name());
      EOEnterpriseObject eoenterpriseobject = eoclassdescription.createInstanceWithEditingContext(null, null);
                        eoenterpriseobject.valueForKeyPath(attribute.name());
                       
        }
    } catch (com.webobjects.foundation.NSKeyValueCoding.UnknownKeyException e1) {
        //NSLog.debug.appendln(e1);
        NSLog.out.appendln("attribute "+attribute.name() + " does not exist in entity " + name() + " anymore, deleted from Valididy model");
View Full Code Here

TOP

Related Classes of com.webobjects.eocontrol.EOEnterpriseObject

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.