Archive for July, 2009
Defaulting Query Form Type
The default query form setting out-of-the-box is the expanded "standard" form. New with 10gR3, you also get the Query Builder form that allows non-technical users to build more advanced queries. Query Builder also includes some new advanced options for power users.
One thing you may want to do at some point is change the default query form view. Users can set their preferred query form view in their profile. Once a user sets this in the profile it will override anything you or your admin set as the system default.
To see where all this query form view decision making is happening we will take a quick peek at the "determine_search_form_type" dynamic html include:
<@dynamichtml determine_search_form_type@> <$if not searchFormType$> <$searchFormType = utGetValue("pne_portal", "searchFormType")$> <$endif$> <$if not searchFormType and DefaultSearchFormType$> <$searchFormType = DefaultSearchFormType$> <$endif$> <$if not searchFormType$> <$searchFormType = "standard"$> <$endif$> <$if DisabledSearchFormTypes$> <$DisabledSearchFormTypes = DisabledSearchFormTypes$> <$else$> <$DisabledSearchFormTypes = ""$> <$endif$> <$if DisabledSearchFormTypes like ("*" & searchFormType & "*")$> <$if DefaultSearchFormType$> <$searchFormType = DefaultSearchFormType$> <$else$> <$searchFormType = "standard"$> <$endif$> <$endif$><@end@>
Upon examination of this include you can see that you can use DefaultSearchFormType as a configuration variable in Admin Server or [install]/config/config.cfg to control the default query form view. Also note, they provide a variable to disable a particular query form view, DisabledSearchFormTypes.
Out-of-the-box, possible values we can set are "standard" which is the default, and "queryBuilder".
Announcing Redstone Content Solutions!
Announcing: Redstone Content Solutions
I have been working with my business partner, John Klein, to form a new Advanced Training & Consulting company focused on Oracle products. We work specifically in the Enterprise 2.0 landscape. Please visit our new website to learn more about us and our services. Please feel free to contact us at any time for answers to your questions.
As one might imagine, starting a new company can be a bit of an adventurous undertaking. I wanted to take a moment to thank the various people who offered so much help and advice. So as to protect the innocent, we will not get into names, however, you all know who you are. Thank you so much for reviewing our content, tearing apart the website and answering way too many questions about running a business, accounting, insurance and legal advice.
Press Release: Open For Business
The Blog
The presence of and my involvement and commitment to Redstone Content Solutions will have no negative effect on Core Content Only. I intend to continue posting code samples and giving away free components as time permits. In fact, the possibility of MORE posting and samples is very real as time may actually be more available now that we have opened Redstone Content Solutions.
Belated Anniversary
Nearly one year ago, on July 14th, 2008, I released the first post for Core Content Only. One full, eventful year later I want thank you for visiting my corner of the internet and I appreciate all the feedback presented by my various visitors. I hope you have found the last year as rewarding as I have.
One year has presented 104 posts or approximately 8.6 posts per month as well as 14 free downloadable examples/components. This is a little below my posting target of 10 posts a month while still satisfying my "freebie quota" of one new download per month.
One of the most interesting parts of any public endeavor is monitoring the statistics. The first couple of months were a little slow and it was fun to see the visits and page views spike whenever the blog was mentioned in another public space. Visits and page views have fairly consistently grown by about 10% each month. The download page gets the most traffic by far.
Search UCM (Stellent) With Groovy
In a previous article we talked about using Groovy to execute the PING_SERVER service of our SOA enabled Content Server. Interesting, but fairly useless you might say. Let's see how we can conduct a search using Groovy and then access specific metadata from those search results.
You may want to keep the RIDC JavaDoc link handy as you explore Groovy Integration further.
First, the script, and then some discussion.
The Script
// Import needed classes from Remote Intradoc Jarimport oracle.stellent.ridc.IdcClientManagerimport oracle.stellent.ridc.IdcContext
// Create the client for request/response, connect directly to serverclient = (new IdcClientManager()).createClient("idc://localhost:4444")
// Create a user/security contextuserContext = new IdcContext("sysadmin", "idc")
// Setup the request, search for two pieces of contentreq = client.createBinder()req.putLocal("IdcService", "GET_SEARCH_RESULTS")req.putLocal("QueryText", "")req.putLocal("ResultCount", "2")
// Get the responseresp = client.sendRequest(userContext, req).getResponseAsBinder()
// Dump out the local data of the responseprintln "LocalData:" resp.getLocalData().keySet().each{ println " $it = ${resp.getLocalData().get(it)}"}
// Dump out the names of the resultsets in the responseprintln "\nResultSets:"resp.getResultSetNames().each{ println " $it"}
// Dump out dDocTitle for each piece of content in the responseprintln "\nTitles:"rsSearchResults = resp.getResultSet("SearchResults")rsSearchResults.getRows().each{ println " ${it.get('dDocTitle')}"}
// Wrap it up!println "\nDone"
Closures
The above script makes extensive use of a language feature in Groovy known as a closure. Closures are not specific to Groovy and they are certainly not a new concept. They are found in many other programming languages. One such language you may be very familiar with is JavaScript!
In this particular case we are using the "each" closure function. Here is an excerpt from the sample script:
println "LocalData:"resp.getLocalData().keySet().each{ println " $it = ${resp.getLocalData().get(it)}"}
See that "each" statement in the second line? The word each followed by curly brackets forges the wrapping closure and the code inside is what becomes executed when the closure is invoked. In this case, our closure is invoked for each key in the Key Set of the Local Data collection. Within the closure you can use the "it" variable (as in iterator) to access each key.
If you have something against the name "it" for the variable you can alter the variable name. As an example, let's change the syntax so the variable will be named "key", try this:
println "LocalData:"resp.getLocalData().keySet().each{ key -> println " $key = ${resp.getLocalData().get(key)}"}
This is also very helpful when using a closure within a closure. An example? Sure. What if you wanted to loop the resultsets and print the value for each column for each row of each resultset? You're code might use nested closures and look something like this:
resp.getResultSetNames().each{ println "\nResult Set '$it':" resp.getResultSet(it).getRows().each { row -> resp.getResultSet(it).getFields().each { field -> println "\t${field.getName()} = ${row.get(field.getName())}" } } print("\t----------------")}
Additional Sample Scripts
Here are two additional Groovy Scripts you can download and try out: