Oracle Content Management SDK

oracle.ifs.search
Class ViewSpecification

java.lang.Object
  |
  +--oracle.ifs.search.ViewSpecification
All Implemented Interfaces:
java.io.Serializable

public class ViewSpecification
extends java.lang.Object
implements java.io.Serializable

Use a ViewSpecification to create a SQL View. A SQL View is built from a SearchSpecification. Additional information that can be specifed is the viewName, and the columns to be retrived. After creating a ViewSpecification, use LibrarySession.createView() to create the view. Creation time security is applied to the view based on the session that is creating the view.

 // Usage Examples

 // Let's assume we have already constructed a SearchSpecification.
 SearchSpecification searchSpec;

 // Construct ViewSpecification
 // At this point columns in view are all columns of result classes in search spec.
 // By default this will fail to create a new view if one exists already
 // with the same name.  

 ViewSpecification viewSpec = new ViewSpecification("TestView", searchSpec);

 // Adding columns to the view.
 // List of columns that we want in the result
 String [] columns = new String[] {Document.NAME_ATTRIBUTE, Document.CREATEDATE_ATTRIBUTE};
 // List of aliases (column titles) that we want in the result.
 // A null alias results in column name being used in the view.
 // These aliases are not be confused with aliases in SearchClassSpecification.
 String [] aliases = new String[] {null, "DOC_CREATE_DATE"};
 viewSpec.addClass(m_Session, Document.CLASS_NAME, columns, aliases); 

 // Repeat calls to addClass for each of different result classes as needed.

 // Setting up the view to replace an existing view with the same name

 viewSpec.replaceView(true);
 
 // Supplying bind values for any late bindings in the search spec
 // Note that, bind values are supplied view creation time,
 // and not at the time when the view is used.

 AttributeValue[] bindValues = new AttributeValue[2];
 bindValues[0] = AttributeValue.newAttributeValue("Culinary");
 bindValues[1] = AttributeValue.newAttributeValue("Bind Test%");
 vsp.setBindValues(bindValues);

 

See Also:
Serialized Form

Constructor Summary
ViewSpecification(java.lang.String viewName, SearchSpecification sp)
          Constructs a ViewSpecification object.
ViewSpecification(java.lang.String viewName, SearchSpecification sp, boolean repView)
          Constructs a ViewSpecification object.
 
Method Summary
 void addClass(LibrarySession sess, java.lang.String clsName, java.lang.String[] attrs)
          Let's you add attributes into your view.
 void addClass(LibrarySession sess, java.lang.String clsName, java.lang.String[] attrs, java.lang.String[] aliases)
          Let's you add attributes into your view.
 AttributeValue[] getBindValues()
          Returns Bind Values that are used in this View Specification.
 SearchSpecification getSearchSpecification()
          Returns the SearchSpecification of this view.
 void replaceView(boolean replace)
          Makes this ViewSpec a Create or Replace View operation if replace is true.
 void setBindValues(AttributeValue[] bindVals)
          If the ViewSpecification uses a Late Boudn SearchSpecification, use this function to supply Bind Values.
 void setDirectoryObject(LibrarySession sess, DirectoryObject dObj)
          Let's you set the DirectoryUser associated with the View.
 void setSearchSpecification(SearchSpecification sp)
          Replaces the SearchSpecification of the view.
 void setViewName(java.lang.String viewName)
          Sets the name of this view.
 

Constructor Detail


ViewSpecification

public ViewSpecification(java.lang.String viewName,
                         SearchSpecification sp)
                  throws IfsException
Constructs a ViewSpecification object. All result Classes from the search specification appear in the view by default. If you need to customize the attributes that a view should have, use addClass() method.
Parameters:
String - Name of the View to be created.
SearchSpecification - Use this SearchSpecification to create View.

ViewSpecification

public ViewSpecification(java.lang.String viewName,
                         SearchSpecification sp,
                         boolean repView)
                  throws IfsException
Constructs a ViewSpecification object. All result Classes from the search specification appear in the view by default. If you need to customize the attributes that a view should have, use addClass() method. Last parameter specifies if the new View replaces an existing view or not.
Parameters:
String - Name of the View to be created.
SearchSpecification - Use this SearchSpecification to create View.
bool - If true, it is a Create Or Replace.
Method Detail

addClass

public void addClass(LibrarySession sess,
                     java.lang.String clsName,
                     java.lang.String[] attrs)
              throws IfsException
Let's you add attributes into your view. This is the way to provide the columns that appear in the view. If addClass() is not called, all attributes from ResultClasses of Search Specification will appear in the view. If addClass() method is used, then only those attributes which are specified using addClass() will be prseent in the view.

Calls addClass(LibrarySession, String, String[], String[]).

Parameters:
LibrarySession - CurrentSession
String - iFS Class Name
String[] - List of attributes from the above class
Throws:
IfsException - If the operation fails.

addClass

public void addClass(LibrarySession sess,
                     java.lang.String clsName,
                     java.lang.String[] attrs,
                     java.lang.String[] aliases)
              throws IfsException
Let's you add attributes into your view. This is the way to provide the columns that appear in the view. If addClass() is not called, all attributes from ResultClasses of Search Specification will appear in the view. If addClass() method is used, then only those attributes which are specified using addClass() will be prseent in the view. This function also let's you customize the names of columns appearing in the view by providing Aliases.

Parameters:
LibrarySession - CurrentSession
String - iFS Class Name
String[] - List of attributes from the above class
String[] - List of Aliase for Column names in the view.
Throws:
IfsException - If the operation fails.

setDirectoryObject

public void setDirectoryObject(LibrarySession sess,
                               DirectoryObject dObj)
                        throws IfsException
Let's you set the DirectoryUser associated with the View. Objects that can be discovered by this user will be present in the view.
Parameters:
LibrarySession - handle to the current session.
DirectoryObject - A valid directory object.
Throws:
IfsException - If the operation fails.

setSearchSpecification

public void setSearchSpecification(SearchSpecification sp)
                            throws IfsException
Replaces the SearchSpecification of the view.
Parameters:
SearchSpecification - New non null SearchSpecification.
Throws:
IfsException - If the operation fails.

getSearchSpecification

public SearchSpecification getSearchSpecification()
Returns the SearchSpecification of this view.

setViewName

public void setViewName(java.lang.String viewName)
                 throws IfsException
Sets the name of this view.
Parameters:
String - New Name of the View (cannot be null).

replaceView

public void replaceView(boolean replace)
                 throws IfsException
Makes this ViewSpec a Create or Replace View operation if replace is true.
Parameters:
boolean - If true, operation is Create or Replace.
Throws:
IfsException - if the operation fails.

setBindValues

public void setBindValues(AttributeValue[] bindVals)
                   throws IfsException
If the ViewSpecification uses a Late Boudn SearchSpecification, use this function to supply Bind Values.
Parameters:
AttributeValue[] - Array of Bind values.
Throws:
IfsException - if the operation fails.

getBindValues

public AttributeValue[] getBindValues()
                               throws IfsException
Returns Bind Values that are used in this View Specification.

Oracle Content Management SDK

(c) 2002 Copyright Oracle Corporation. All rights reserved.