Package com.webobjects.eocontrol

Examples of com.webobjects.eocontrol.EOEditingContext


    editingContext.saveChanges();
    return this;
  }

  public WOActionResults addNoNoPal() {
    EOEditingContext editingContext = ERXEC.newEditingContext();
    SPNoNoPal.createSPNoNoPal(editingContext, _event.localInstanceIn(editingContext), _membership.person().localInstanceIn(editingContext), _selectedNoNoPerson.localInstanceIn(editingContext));
    editingContext.saveChanges();
    _selectedNoNoPerson = null;
    return this;
  }
View Full Code Here


        if (useExistingEditingContext) {
            // We just want to use the object's exiting editing context to inspect it
            epi.setObject(object());
            returnedValue = (WOComponent) epi;
        } else {
            EOEditingContext context = ERXEC.newEditingContext();
            //CHECKME ak: I don't remember why we would use a local instance when we just want to inspect...
            context.lock();
            try {
                EOEnterpriseObject localObject = EOUtilities.localInstanceOfObject(context, object());
                epi.setObject(localObject);
                context.hasChanges(); // Ensuring it survives.
                returnedValue = (WOComponent) epi;
            } finally {
                context.unlock();
            }
        }
        return returnedValue;
    }
View Full Code Here

    _event = event;
  }

  public SPEvent event() {
    if (_event == null) {
      EOEditingContext editingContext = ERXEC.newEditingContext();
      _event = SPEvent.createSPEvent(editingContext, Boolean.TRUE, "New Event", _group.localInstanceIn(editingContext));
    }
    return _event;
  }
View Full Code Here

        }
    }


    public WOComponent massModify() {
        EOEditingContext localContext = ERXEC.newEditingContext(false); // we will never validate or save this one
        EOEnterpriseObject newEO = ERXEOControlUtilities.createAndInsertObject(localContext, d2wContext().entity().name());
        EditPageInterface epi=(EditPageInterface)D2W.factory().pageForConfigurationNamed((String)d2wContext().valueForKey("massModificationPageConfiguration"),
                                                                                         session());
        epi.setObject(newEO);
        _MassModificatorConfirmationDelegate cb=new _MassModificatorConfirmationDelegate();
View Full Code Here

    private static class _MassModificatorDelegate extends _MassModificatorConfirmationDelegate {
        @Override
        public WOComponent nextPage(WOComponent sender) {
            WOComponent result=nextPage;
            if (eo.editingContext()!=null) { // save was clicked
                EOEditingContext ec=ERXEC.newEditingContext();
                for (Enumeration ob=list.objectEnumerator(); ob.hasMoreElements();) {
                    EOEnterpriseObject eoItem=(EOEnterpriseObject)ob.nextElement();
                    EOEnterpriseObject localEOItem=EOUtilities.localInstanceOfObject(ec,eoItem);
                    System.out.println(localEOItem);
                    for (Enumeration e= displayPropertyKeys.objectEnumerator(); e.hasMoreElements();) {
                        String key=(String)e.nextElement();
                        Object value=eo.valueForKey(key);
                        if (value!=null) {
                            System.out.println(key+" --> "+value);
                            if (value instanceof EOEnterpriseObject) { // assume it is a rel
                                EOEnterpriseObject localValue=EOUtilities.localInstanceOfObject(ec,(EOEnterpriseObject)value);
                                localEOItem.addObjectToBothSidesOfRelationshipWithKey(localValue,key);
                            } else if (!(value instanceof String) || ((String)value).length()>0)
                                localEOItem.takeValueForKey(value,key);
                        }
                    }
                }
                try {
                    ec.saveChanges();
                } catch (NSValidation.ValidationException e) {
                    String errorMessage = " Could not save your changes: "+e.getMessage()+" ";
                    ErrorPageInterface epf=D2W.factory().errorPage(sender.session());
                    if(epf instanceof ERDErrorPageInterface) {
                      ((ERDErrorPageInterface)epf).setException(e);
View Full Code Here

    protected boolean isAuthenticationRequired() {
      return false;
    }
   
    public WOActionResults sendEmail() {
      EOEditingContext editingContext = ERXEC.newEditingContext();
      SPPerson person = SPPerson.fetchSPPerson(editingContext, SPPerson.EMAIL_ADDRESS.is(_emailAddress));
      if (person != null) {
        SPUtilities.sendResetPasswordEmail(person, context(), session().errors());
      }
      session().notifications().addNotice("An password reset email has been sent to the email address you provided.");
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);
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);
View Full Code Here

    removeAttribute(attribute);
      } else if (p != null) {
    NSLog.out.appendln("attribute "+attribute.name() + " in entity " + name() + " is (now?) an relationship which cannot have a validation rule, deleted from Valididy model");
    removeAttribute(attribute);
      } else {
                EOEditingContext ec = new EOEditingContext();
                ec.lock();
    try {
        if (attribute == null) {
      NSLog.debug.appendln("attribute == null");
        } 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");
        removeAttribute(attribute);
                } catch (Exception e1) {
                   
                } finally {
                    ec.unlock();
                    ec.dispose();
                   
                }
      }
  }
    }
View Full Code Here

   
    private NSArray _list;

    public NSArray list() {
        if (_list==null) {
            EOEditingContext objectContext = object().editingContext();
            NSMutableArray nonSortedLocalList=new NSMutableArray();
            if (choices == null)
                log.warn("Choices was null for the list.  For now this means that an empty list will appear.");
            // FIXME: Might want to just fetch all of the eos if a choice isn't specified.
            NSArray nonLocallist = choices == null ? ERXConstant.EmptyArray : (NSArray)valueForKeyPath(choices);
View Full Code Here

TOP

Related Classes of com.webobjects.eocontrol.EOEditingContext

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.