scope.java

来自「CmisJavaApi」· Java 代码 · 共 154 行

JAVA
154
字号
/* * The contents of this file are subject to the Dyade Public License,  * as defined by the file DYADE_PUBLIC_LICENSE.TXT * * You may not use this file except in compliance with the License. You may * obtain a copy of the License on the Dyade web site (www.dyade.fr). * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for * the specific terms governing rights and limitations under the License. * * The Original Code is CmisJava API, including the java package  * fr.dyade.cmis, released September 5, 2000. * * The Initial Developer of the Original Code is Dyade. The Original Code and * portions created by Dyade are Copyright Bull and Copyright INRIA.  * All Rights Reserved. *//*      Copyright 1996-2000 by Institut National de Recherche en Informatique  *                             et en Automatique (INRIA) *          All rights reserved.  See COPYRIGHT in top-level directory. * *      Authors: Laurent Andrey, Eric Dillon, Olivier Festor *///  CVS Info//---------------------------------------------------------------------------//////  $Id: Scope.java,v 1.2 2000/09/05 13:30:59 festor Exp $//  $Source: /local/resedas/CVS-Repository/CmisJavaApi/src/fr/dyade/cmis/api/types/Scope.java,v $//---------------------------------------------------------------------------////  Todo//---------------------------------------------------------------------------////package fr.dyade.cmis.api.types;import java.io.ObjectStreamException;/** ASN1 type for scope parameter.  *  X700 describe 4 cases for operation scope parameter. All  *  all them start the selection from the object specified into a base object parameters.  *  <ol>  *  <li>just take the base object  *  <li>all the objects at the nth level under the base object  *  <li>the base object and all its subordinates down to the nth level  *  <li>the base object and all its subordinates  *  </ol>  *  *  Remark: level 0 is the base object.  *  *  X711, page 25 defines some extra particular cases. Indeed we need only 3 cases:  *  <ol>  *  <li>nth level selection  *  <li>selection down to nth level selection  *  <li>whole subtree selection.  *  </ol>  * For all particular cases we defined constant object that might be instantiated as shown below:<br>  * <code>Scope myScope = Scope.INDIVIDUAL_LEVELS(3)</code> or <br>  * <code>Scope myScope = Scope.FIRSTLEVELONLY</code>.  * <p>  * As a consequence, this class provides only static public constructors.<br>  * <i>Notice that this implementation directly follows the Open Master fmk-C-api <code>ISMc_scope</code>  * implementation.</i>  *  * @see fr.dyade.cmis.api.types.Synchronization  * @verson cvs $id:$  */public class Scope  extends CMISType {      // Scope type code      public static final short SCOPE_INTEGER_CODE = 1;      public static final short SCOPE_INDIVIDUAL_LEVELS_CODE = 2;      public static final short SCOPE_BASE_TO_NTH_LEVEL_CODE = 3;            // Scope value for SCOPE_INTEGER_CODE      public static final int SCOPE_INTEGER_BASEOBJECT = 0;      public static final int SCOPE_INTEGER_FIRSTLEVELONLY = 1;      public static final int SCOPE_INTEGER_WHOLESUBTREE = 2;                  private Scope( short pScopeType, int pScope ) {	 fScopeType = pScopeType; //LA??: see comment about static and fScopeType...	 fScope = pScope;      }            /**	* Scope <code>BASE_OBJECT</code> "singleton"	*/      public static final Scope BASE_OBJECT = new Scope(SCOPE_INTEGER_CODE, SCOPE_INTEGER_BASEOBJECT);                  /**	* Scope <code>FIRSTLEVELONLY</code> "singleton".	*/      public static final Scope FIRSTLEVELONLY = new Scope(SCOPE_INTEGER_CODE, SCOPE_INTEGER_FIRSTLEVELONLY);            /**	* Scope <code>WHOLESUBTREE</code> "singleton".	*/      public static final Scope WHOLESUBTREE = new Scope(SCOPE_INTEGER_CODE, SCOPE_INTEGER_WHOLESUBTREE);            /**	* Creates a new instance of a <code>INDIVIDUAL_LEVELS</code> Scope.	* @param pScope The specified level.	*/      public static final Scope INDIVIDUAL_LEVELS( int pLevelNumber ) {	 return new Scope(SCOPE_INDIVIDUAL_LEVELS_CODE, pLevelNumber);      }            /**	* Creates a new instance of a <code>BASE_TO_NTH_LEVEL</code> Scope.	* @param pScope The specified level.	*/      public static final Scope BASE_TO_NTH_LEVEL( int pLevelNumber ) {	 return new Scope (SCOPE_BASE_TO_NTH_LEVEL_CODE, pLevelNumber);      }            public final short getScopeType() {	 return fScopeType;      }            public final int getScope() {	 return fScope;      }      /** Filtering instance created after deserialization.	* <a HREF="http://www.javasoft.com/products/jdk/1.2/docs/guide/serialization/spec/input.doc6.html">	* Read javasof doc</a> about this method. We are exactly is the example shown here:	* "The readResolve method would be implemented to determine if that symbol was already defined 	* and substitute the preexisting equivalent Symbol object to maintain the identity constraint...",	* where Symbol objects are Scope objects.	*/      public Object readResolve() throws ObjectStreamException {	 switch(fScopeType) {	    case SCOPE_INTEGER_CODE:	       switch (fScope) {		  case SCOPE_INTEGER_BASEOBJECT: return BASE_OBJECT;		  case SCOPE_INTEGER_FIRSTLEVELONLY: return FIRSTLEVELONLY;		  case SCOPE_INTEGER_WHOLESUBTREE: return WHOLESUBTREE;		  default:		     System.err.println("Scope.readResolve: bad scope for SCOPE_INTEGER_CODE");		     return this;	       }	    default: return this;	 }      }      //LA??: remove static declaration which was bullshit from the bull old b'ot'er !      // if we want a static field for ScopeType we need more sub classes and an overriden "getType()" method.      // and then use hiding on the field...      //private static short fScopeType;      private short fScopeType;      private int fScope;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?