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

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


     * Returns function name for MOD.
     */
    public String getModFunctionName() {
        String s = (String)dbMap.get(MOD_FUNCTION_NAME);
        if (s == null) {
           throw new JDOUserException(I18NHelper.getMessage(messages,
               "core.constraint.illegalop", // NOI18N
               " % "));
        }

        if (logger.isLoggable()) {
View Full Code Here


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

        if (elementType == null || elementType.isAssignableFrom(element.getClass()))
        {
    // Mark the field as dirty
    StateManager stateManager = this.makeDirty();
       
    Object o = super.set(index, element);

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

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

    // Apply updates
    this.applyUpdates(stateManager, true);
       
          return o;
  } else {
    throw new JDOUserException(I18NHelper.getMessage(messages,
                                "sco.classcastexception", elementType.getName()), // NOI18N
         new ClassCastException(), new Object[] {element});
  }

    }
View Full Code Here

     * @see java.util.ArrayList
     */ 
    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()))
        {
    // Mark the field as dirty
    StateManager stateManager = this.makeDirty();
       
                if (removed.remove(o) == false)
      added.add(o);

          boolean modified = super.add(o);

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

    return modified;

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

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

        if (elementType == null || elementType.isAssignableFrom(element.getClass()))
        {
    // Mark the field as dirty
    StateManager stateManager = this.makeDirty();
       
                super.add(index, element);
                if (removed.remove(element) == false)
                        added.add(element);

    // Apply updates
    this.applyUpdates(stateManager, true);
 
        } else {
                throw new JDOUserException(I18NHelper.getMessage(messages,
                                "sco.classcastexception", elementType.getName()), // NOI18N
         new ClassCastException(), new Object[] {element});
        }

    }
View Full Code Here

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

  java.util.Vector errc = new java.util.Vector();
  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());
  }

  // Mark the field as dirty
View Full Code Here

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

  java.util.Vector errc = new java.util.Vector()
        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());
        }

  // Mark the field as dirty
View Full Code Here

     * is not to be checked.
     */
    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.