Home » apache-openjpa-1.1.0-source » org.apache.openjpa » kernel » [javadoc | source]
    1   /*
    2    * Licensed to the Apache Software Foundation (ASF) under one
    3    * or more contributor license agreements.  See the NOTICE file
    4    * distributed with this work for additional information
    5    * regarding copyright ownership.  The ASF licenses this file
    6    * to you under the Apache License, Version 2.0 (the
    7    * "License"); you may not use this file except in compliance
    8    * with the License.  You may obtain a copy of the License at
    9    *
   10    * http://www.apache.org/licenses/LICENSE-2.0
   11    *
   12    * Unless required by applicable law or agreed to in writing,
   13    * software distributed under the License is distributed on an
   14    * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
   15    * KIND, either express or implied.  See the License for the
   16    * specific language governing permissions and limitations
   17    * under the License.    
   18    */
   19   package org.apache.openjpa.kernel;
   20   
   21   /**
   22    * Lifecycle state.
   23    * Represents a persistent instance that is participating in the current
   24    * transaction, and has been modified.
   25    *
   26    * @author Abe White
   27    */
   28   class PDirtyState
   29       extends PCState {
   30   
   31       void initialize(StateManagerImpl context) {
   32           context.saveFields(false);
   33       }
   34   
   35       void beforeFlush(StateManagerImpl context, boolean logical,
   36           OpCallbacks call) {
   37           context.preFlush(logical, call);
   38       }
   39   
   40       PCState commit(StateManagerImpl context) {
   41           return HOLLOW;
   42       }
   43   
   44       PCState commitRetain(StateManagerImpl context) {
   45           return PNONTRANS;
   46       }
   47   
   48       PCState rollback(StateManagerImpl context) {
   49           return HOLLOW;
   50       }
   51   
   52       PCState rollbackRestore(StateManagerImpl context) {
   53           context.restoreFields();
   54           return PNONTRANS;
   55       }
   56   
   57       PCState delete(StateManagerImpl context) {
   58           context.preDelete();
   59           return PDELETED;
   60       }
   61   
   62       PCState nontransactional(StateManagerImpl context) {
   63           return error("dirty", context);
   64       }
   65   
   66       PCState release(StateManagerImpl context) {
   67           return error("dirty", context);
   68       }
   69   
   70       boolean isVersionCheckRequired(StateManagerImpl context) {
   71           return !context.isFlushed() || context.isFlushedDirty(); 
   72       }
   73   
   74       PCState afterRefresh() {
   75           return PCLEAN;
   76       }
   77   
   78       PCState afterOptimisticRefresh() {
   79           return PNONTRANS;
   80       }
   81   
   82       boolean isTransactional() {
   83           return true;
   84       }
   85   
   86       boolean isPersistent() {
   87           return true;
   88       }
   89   
   90       boolean isDirty() {
   91           return true;
   92       }
   93   }
   94   

Save This Page
Home » apache-openjpa-1.1.0-source » org.apache.openjpa » kernel » [javadoc | source]