filteredandscopedoperationimpl.java

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

JAVA
313
字号
/* * 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 *///  $Id: FilteredAndScopedOperationImpl.java,v 1.2 2000/09/05 14:30:45 festor Exp $//  $Src:$//---------------------------------------------------------------------------////  Todo//---------------------------------------------------------------------------//// Rename fObjectInstance to fBaseObjectInstance....package fr.dyade.cmis.impl.operation;import java.util.Enumeration;import fr.dyade.cmis.impl.CMISStackImpl;import fr.dyade.cmis.api.operation.*;import fr.dyade.cmis.api.types.*;/** Basic implementation operation which provides filtering and scoping.  *  * This is a basic implementation for the <code>{@link fr.dyade.cmis.api.operation.FilteredAndScopedOperation}</code>  * Interface. All methods related to cmis parameters   * are <b>final</b> and instance variables are <b>private</b> so   * this class can only be derived by adding some stuff, not by changing the existing one.  * @see FilteredAndScopedIndication  * @version cvs $Id: FilteredAndScopedOperationImpl.java,v 1.2 2000/09/05 14:30:45 festor Exp $  */public abstract class FilteredAndScopedOperationImpl extends CMISRequestImpl    implements FilteredAndScopedOperation {	 	 	 protected FilteredAndScopedOperationImpl( CMISStackImpl pStack, short pTag ) {	    super(pStack, pTag);	 }	 	 public final void setFilter( Filter pFilter ) {     	    fFilter=pFilter;	 }	 	 public final Filter getFilter() {	    return fFilter;	 }	 	 public final void setScope( Scope pScope ) {	    fScope=pScope;	 }	 public final Scope getScope() {	    return fScope;	 }	 	 public final void  setBaseObjectClass( ObjectClass pClass ) {	    fBaseObjectClass=pClass;	 }	 public final ObjectClass getBaseObjectClass(){	    return fBaseObjectClass;	 }	 /** Alias for setBaseObjectInstance method	     TODO: remove it !	   */	 public final void setBaseObject( ObjectInstance pObject ){	    fObjectInstance=pObject;	 }	 /** Set the Base Object Instance parameter.	   */	 public final void setBaseObjectInstance( ObjectInstance pObject ){	    fObjectInstance=pObject;	 }	 /** Alias for getBaseObjectInstance method.	     TODO: remove it !	 */	 public final ObjectInstance getBaseObject(){	    return fObjectInstance;	 }	 public final ObjectInstance getBaseObjectInstance(){	    return fObjectInstance;	 }	 /**  Verification of operation request parameters.	      This implementation of the 	      <a href="cmis.operation.CMISRequest#isReqValid">isReqValid</a> method	      of the <tt>CMISRequest</tt> interface is provided to allow user to	      implemented a bottom-up implementation of it into sub-class (use of	      <tt>super</tt> reference).	      	      @return true if base object class and instance are not null, flase otherwise	 */		 public boolean isReqValid() {	    return (fBaseObjectClass!=null)&&(fObjectInstance!=null)&&super.isReqValid();	 }	 	 public final Synchronization getSynchronization() {	    return fSynchronization;	 }	 	 public final AccessControl getAccessControl()  {	    return fAccessControl;	 }	 	 public final void setAccessControl( AccessControl pAC) {	    fAccessControl = pAC;	 }	 	 public final void setSynchronization(Synchronization pSynchronization) {	    fSynchronization = pSynchronization;;	 }	 /** Errors raised for a possibly linked operation.	   * This accessor is mostly dedicated to (confirmed) requests 	   * involving linked replies.	   * @return An enumeration to access any error replies (confirmation).	   */	 public Enumeration getErrors() {	    return new ErrorsEnumeration(this);	    /* jdk 1.1.* does not properly handle this shit...	       javac fails raising a sun.tools.java.CompilerError: copyInline exception....	       Astonishing, isn't it ?	       	    return new Enumeration() {	       Enumeration e;	       Object idx;	       {		  synchronized (FilteredAndScopedOperationImpl.this){		     e=getReplies();		     nextIdx();		  }	       }	       public boolean hasMoreElements() {		  return idx!=null;	       }	       public Object nextElement() {		  synchronized (FilteredAndScopedOperationImpl.this){		     if (idx!=null) {			Object res=idx;			nextIdx();			return  res;		     }		  }		  throw new java.util.NoSuchElementException("FilteredAndScopedOperationImpl.getErrors Enumeration");	       }	       private void nextIdx(){		  while (e.hasMoreElements()) {		     idx=e.nextElement();		     if ((((CMISConfirmation)idx).getCMISError()!=null) 			 || (((CMISConfirmation)idx).getInternalError()!=null)) {			return;		     }		  }		  idx=null;		  return; 	       }	    };	 	    */	 }	 /** CMIS Errors for a possibly linked operation.	   * @return An enumeration to access any CMIS error replies (confirmation).	   */	 public Enumeration getCMISErrors() {	    return new CMISErrorsEnumeration(this);	 }	 /** Internal  Errors for a possibly linked operation.	   * This accessor is pretty meaningless, usually internal	   * errors occurs only once for a request.	   * @return An enumeration to access any replies (confirmation) featuring an internal 	   * (stack provider) error.	   */	 public Enumeration getInternalErrors() {	    return new InternalErrorsEnumeration(this);	 }  	 private Filter fFilter=null;	 private Scope fScope=null;	 private ObjectClass fBaseObjectClass=null;	 private ObjectInstance fObjectInstance=null; //TO DO: rename BaseObjectInstance => Check C code request native doIt()	 private AccessControl fAccessControl=null;	 private Synchronization fSynchronization=null;	 /* jdk 1.1.* does not handle embedded inner class... */	 class ErrorsEnumeration implements Enumeration {	       Enumeration e;	       Object idx;	       FilteredAndScopedOperationImpl lThis; //Is not dead !!! ;->	       ErrorsEnumeration(FilteredAndScopedOperationImpl pThis){		  synchronized (pThis){		     lThis=pThis;		     e=pThis.getReplies();		     nextIdx();		  }	       }	       public boolean hasMoreElements() {		  return idx!=null;	       }	       public Object nextElement() {		  synchronized (lThis){		     if (idx!=null) {			Object res=idx;			nextIdx();			return  res;		     }		  }		  throw new java.util.NoSuchElementException("FilteredAndScopedOperationImpl.getErrors Enumeration");	       }	       private void nextIdx(){		  while (e.hasMoreElements()) {		     idx=e.nextElement();		     if ((((CMISConfirmation)idx).getCMISError()!=null) 			 || (((CMISConfirmation)idx).getInternalError()!=null)) {			return;		     }		  }		  idx=null;		  return; 	       }	 }	 class CMISErrorsEnumeration implements Enumeration {	       Enumeration e;	       Object idx;	       FilteredAndScopedOperationImpl lThis; //Is not dead !!! ;->	       CMISErrorsEnumeration(FilteredAndScopedOperationImpl pThis){		  synchronized (pThis){		     lThis=pThis;		     e=pThis.getReplies();		     nextIdx();		  }	       }	       public boolean hasMoreElements() {		  return idx!=null;	       }	       public Object nextElement() {		  synchronized (lThis){		     if (idx!=null) {			Object res=idx;			nextIdx();			return  res;		     }		  }		  throw new java.util.NoSuchElementException("FilteredAndScopedOperationImpl.getCMISErrors Enumeration");	       }	       private void nextIdx(){		  while (e.hasMoreElements()) {		     idx=e.nextElement();		     if (((CMISConfirmation)idx).getCMISError()!=null) {			return;		     }		  }		  idx=null;		  return; 	       }	 }	 	 class InternalErrorsEnumeration implements Enumeration {	       Enumeration e;	       Object idx;	       FilteredAndScopedOperationImpl lThis; //Is not dead !!! ;->	       InternalErrorsEnumeration(FilteredAndScopedOperationImpl pThis){		  synchronized (pThis){		     lThis=pThis;		     e=pThis.getReplies();		     nextIdx();		  }	       }	       public boolean hasMoreElements() {		  return idx!=null;	       }	       public Object nextElement() {		  synchronized (lThis){		     if (idx!=null) {			Object res=idx;			nextIdx();			return  res;		     }		  }		  throw new java.util.NoSuchElementException("FilteredAndScopedOperationImpl.getCMISErrors Enumeration");	       }	       private void nextIdx(){		  while (e.hasMoreElements()) {		     idx=e.nextElement();		     if (((CMISConfirmation)idx).getInternalError()!=null) {			return;		     }		  }		  idx=null;		  return; 	       }	 }}

⌨️ 快捷键说明

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