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

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


  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.Vector
     */ 
    public synchronized 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.Vector
     */ 
    public synchronized 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.Vector 
     */  
    public synchronized 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

     * for this database
     */
    public String getSqrt() {
        String s = (String)dbMap.get(SQRT);
        if (s == null) {
           throw new JDOUserException(I18NHelper.getMessage(messages,
               "core.constraint.illegalop", // NOI18N
               "Sqrt"));
        }

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

     * for this database
     */
    public String getAbs() {
        String s = (String)dbMap.get(ABS);
        if (s == null) {
           throw new JDOUserException(I18NHelper.getMessage(messages,
               "core.constraint.illegalop", // NOI18N
               "Abs"));
        }

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

     * for this database
     */
    public String getSubstring() {
        String s = (String)dbMap.get(SUBSTRING);
        if (s == null) {
           throw new JDOUserException(I18NHelper.getMessage(messages,
               "core.constraint.illegalop", // NOI18N
               "substring"));
        }

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

     * for this database
     */
    public String getSubstringFrom() {
        String s = (String)dbMap.get(SUBSTRING_FROM);
        if (s == null) {
           throw new JDOUserException(I18NHelper.getMessage(messages,
               "core.constraint.illegalop", // NOI18N
               "from part of substring"));
        }

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

     * for this database
     */
    public String getSubstringFor() {
        String s = (String)dbMap.get(SUBSTRING_FOR);
        if (s == null) {
           throw new JDOUserException(I18NHelper.getMessage(messages,
               "core.constraint.illegalop", // NOI18N
               "for part of substring"));
        }

        if (logger.isLoggable()) {
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.