Package com.sun.jdo.api.persistence.support

Examples of com.sun.jdo.api.persistence.support.JDOUserException


                "jdo.lifecycle.deleted.accessField")); // NOI18N
    }

    public LifeCycleState transitionWriteField(boolean transactionActive) {
        // Cannot update a deleted object
        throw new JDOUserException(I18NHelper.getMessage(messages,
                "jdo.lifecycle.deleted.accessField")); // NOI18N
    }
View Full Code Here


    }

    public LifeCycleState transitionReadField(boolean optimisitic, boolean nontransactonalRead,
                                              boolean transactionActive) {
        // Cannot read a deleted object
        throw new JDOUserException(I18NHelper.getMessage(messages,
                "jdo.lifecycle.deleted.accessField")); // NOI18N
    }
View Full Code Here

                "jdo.lifecycle.deleted.accessField")); // NOI18N
    }

    public LifeCycleState transitionWriteField(boolean transactionActive) {
        // Cannot update a deleted object
        throw new JDOUserException(I18NHelper.getMessage(messages,
                "jdo.lifecycle.deleted.accessField")); // NOI18N
    }
View Full Code Here

        this.pm = pm;
        this.persistenceCapableClass = persistenceCapableClass;

        // check persistenceCapableClass parameter being null
        if (persistenceCapableClass == null)
            throw new JDOUserException(
                    I18NHelper.getMessage(messages, "jdo.extentcollection.constructor.invalidclass", "null"));// NOI18N
        // check persistence-capable
        if (Model.RUNTIME.getMappingClass(persistenceCapableClass.getName(),
                persistenceCapableClass.getClassLoader()) == null)
            throw new JDOUserException(
                    I18NHelper.getMessage(messages, "jdo.extentcollection.constructor.nonpc", // NOI18N
                            persistenceCapableClass.getName()));

        // subclasses == true is not yet supported
        if (subclasses)
View Full Code Here

     */
    public boolean add(Object o)
    {
        if (allowNulls == false && o == null)
        {
            throw new JDOUserException(I18NHelper.getMessage(messages,
                        "sco.nulls_not_allowed")); // NOI18N
        }

        if (elementType != null && !elementType.isAssignableFrom(o.getClass()))
        {
            throw new JDOUserException(I18NHelper.getMessage(messages,
                                     "sco.classcastexception", elementType.getName()), // NOI18N
                                       new ClassCastException(), new Object[] {o});
        }

        if (owner != null)
View Full Code Here

     */
    public boolean addAll(Collection c)
    {
        if (allowNulls == false && c.contains(null))
        {
            throw new JDOUserException(I18NHelper.getMessage(messages,
                        "sco.nulls_not_allowed")); // NOI18N
        }

        ArrayList errc = new ArrayList();

        if (elementType != null)
        {
            // iterate the collection and make a list of wrong elements.
            Iterator i = c.iterator();
            while (i.hasNext())
            {
                Object o = i.next();
                if (!elementType.isAssignableFrom(o.getClass()))
                    errc.add(o);
            }
        }

        if (errc != null && errc.size() > 0)
        {
            throw new JDOUserException(I18NHelper.getMessage(messages,
                                     "sco.classcastexception", elementType.getName()), // NOI18N
                                       new ClassCastException(), errc.toArray());
        }

        boolean modified = false;
View Full Code Here

     * is not checked or not supported.
     */
    public void setOwner(Object owner, String fieldName, Class elementType) {

        if (this.owner != null) {
            throw new JDOUserException(I18NHelper.getMessage(
                messages1, "core.statemanager.anotherowner"), // NOI18N
                new Object[]{this.owner, this.fieldName});
        }
        if (owner instanceof PersistenceCapable) {
                this.owner = (PersistenceCapable)owner;
View Full Code Here

  if (obj == null)
  {
    if (allowNulls == false)
    {
      throw new JDOUserException(I18NHelper.getMessage(messages,
        "sco.nulls_not_allowed")); // NOI18N
    }
    // It is actualy remove
    this.removeElementAt(index);
  }

  if (elementType == null || elementType.isAssignableFrom(obj.getClass()))
  {
    // Mark the field as dirty
    StateManager stateManager = this.makeDirty();

    Object o = super.elementAt(index);
    super.setElementAt(obj, index);

    if (added.remove(o) == false)
      removed.add(o);

    if (removed.remove(obj) == false)
      added.add(obj);

    // Apply updates
    this.applyUpdates(stateManager, true);

  } else {
    throw new JDOUserException(I18NHelper.getMessage(messages,
                                "sco.classcastexception", elementType.getName()), // NOI18N
         new ClassCastException(), new Object[] {obj});
  }

    }
View Full Code Here

     * @see java.util.Vector
     */ 
    public synchronized void insertElementAt(Object obj, int index) {
  if (allowNulls == false && obj == null)
        {
                throw new JDOUserException(I18NHelper.getMessage(messages,
                        "sco.nulls_not_allowed")); // NOI18N
        }

        if (elementType == null || elementType.isAssignableFrom(obj.getClass()))
        {
    // Mark the field as dirty
    StateManager stateManager = this.makeDirty();

                super.insertElementAt(obj, index);
          if (removed.remove(obj) == false)
      added.add(obj);

    // Apply updates
    this.applyUpdates(stateManager, true);

  } else {
    throw new JDOUserException(I18NHelper.getMessage(messages,
                                "sco.classcastexception", elementType.getName()), // NOI18N
         new ClassCastException(), new Object[] {obj});
  }

    }
View Full Code Here

     * @see java.util.Vector
     */ 
    public synchronized void addElement(Object obj) {
  if (allowNulls == false && obj == null)
        {
                throw new JDOUserException(I18NHelper.getMessage(messages,
                        "sco.nulls_not_allowed")); // NOI18N
        }

        if (elementType == null || elementType.isAssignableFrom(obj.getClass()))
        {
    // Mark the field as dirty
    StateManager stateManager = this.makeDirty();

                super.addElement(obj);
          if (removed.remove(obj) == false)
      added.add(obj);

    // Apply updates
    this.applyUpdates(stateManager, true);

  } else {
    throw new JDOUserException(I18NHelper.getMessage(messages,
                                "sco.classcastexception", elementType.getName()), // NOI18N
         new ClassCastException(), new Object[] {obj});
  }

    }
View Full Code Here

TOP

Related Classes of com.sun.jdo.api.persistence.support.JDOUserException

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.