WebCenter Sites Query Content using API

Hi all,
I have created a asset called "TVLContent" and for this asset, I created 2 attributes: "Question" and "Answer".
I need to create a query search using API, to get any content where "Question" or "Answer" attribute contains "Why".
I'm using the line code below, for searching, but doesn't work.
-----Code
Session ses = SessionFactory.getSession();
Condition c1 =ConditionFactory.createCondition("Question", OpTypeEnum.LIKE, "%Why%");
Condition c2 =ConditionFactory.createCondition("Answer", OpTypeEnum.LIKE, "%Why%" );
Query query = new SimpleQuery( "TVLContent", "FAQs", c1.or(c2) , Arrays.asList("name", "id", "Question", "Answer"));
query.getProperties().setIsBasicSearch(true);
AssetDataManager mgr = (AssetDataManager) ses.getManager(AssetDataManager.class.getName());
List<Long> firstResults = new ArrayList<Long>();
for(AssetData data : mgr.read(query)) {
//read data, e.g. data.getAttributeData("Question").getData()
------Code
If I change the query condition to c1 only, the query works fine,
e.g. Query query = new SimpleQuery( "TVLContent", "FAQs", c1 , Arrays.asList("name", "id", "Question", "Answer"));
If I change the query condition to c2 only, the query works fine.
e.g. Query query = new SimpleQuery( "TVLContent", "FAQs", c2 , Arrays.asList("name", "id", "Question", "Answer"));
But when I create a new condition (c1.or(c2)) doesn't work.
e.g. Query query = new SimpleQuery( "TVLContent", "FAQs", c1.or(c2) , Arrays.asList("name", "id", "Question", "Answer"));
How to fix this?
What's the best way to create this query using API?
See below the attribute definition:
Name: Question
Attribute Type: text
Attribute Editor: TVLTextArea
TVLTextArea XML (
<?XML VERSION="1.0"?>
<!DOCTYPE PRESENTATIONOBJECT SYSTEM "presentationobject.dtd">
<PRESENTATIONOBJECT NAME="TEXTAREA">
<TEXTAREA WRAPSTYLE ="SOFT"></TEXTAREA >
</PRESENTATIONOBJECT>
Name: Answer
Attribute Type: text
Attribute Editor: TVLCKEditor
TVLCKEditor XML (
<?XML VERSION="1.0"?>
<!DOCTYPE PRESENTATIONOBJECT SYSTEM "presentationobject.dtd">
<PRESENTATIONOBJECT NAME="TEXTAREA">
<TEXTAREA WRAPSTYLE ="SOFT"></TEXTAREA >
</PRESENTATIONOBJECT>
}

Hello,
Can you share the condition which you are trying to pass?
Try something like this example;
Condition condition = ConditionFactory.createCondition( <ATTRIBUTE NAME>, OpTypeEnum.EQUALS, <ATTRIBUTE VALUE> );
List<String> attributes = new ArrayList<String>();
attributes.add(<ATTRIBUTE NAMES>); // add as many as required
SortOrder sortOrder = new SortOrder(<Attribute Name to sortby>, <ORDER - Ascending or Descending>);
Query query = new SimpleQuery( <Asset Type>, null, condition, attributes, Collections.singletonList(sortOrder));
for( AssetData data : assetDataManager.read( query ) ) {
// get all the data as mentioned here: http://docs.oracle.com/cd/E29542_01/doc.1111/e29634/asset_api_tutorial.htm#WBCSD2395
Note: Import correct classes in your template or CSElement.
Regards,
Guddu

Similar Messages

  • Webcenter sites 11g installation using HSQLDB

    Want to know if its possible to use HSQLDB on Webcenter Sites 11g? I just want a lightweight DB for my development instance and dont want to go with DB2/Oracle/SQL Server. I tried with the following configs:
    OS: Windows 2008 R2
    App server: Tomcat 6.0.35
    DB: HSQLDB 1.8.0
    If someone has tried and successful then do let me know the exact steps and also any inputs will be most welcome. Thanks.

    You might want to give Oracle XE (www.oracle.com/technetwork/products/express-edition/overview/index.html) a try, it is for sure heavier than hsqldb which is one jar, but is free and smaller than full blown Oracle DB. I use it for most of my installs so there is less chance of running into db-specific surprise behaviour.
    I have also installed CS7.6 on H2 (www.h2database.com) which is like hsqldb but smaller still.
    Phil

  • Getting V2 style Step Trigger Content using API

    I have written a C++ code for getting forms trigger text using API. In which, I am not able to get V2 style step trigger text from Forms6/6i API. Can anyone help me to sort this out?
    Thanks
    Kannan M.

    Kannan,
    V2-Trigger-Steps are sub-objects of pl/sql triggers. They are exposed from Forms6i patch 3 (or 4?) and onwards. For an example on how to get to them checkout FormsAPI Master from www.orcl-toolbox.com ... in there you will find a script that does this.
    Regards, Stefan

  • Create Supplier Site with (Accounts) Using API

    Dear All,
    I want to use the API of create/update vendor site < POS_VENDOR_PUB_PKG.CREATE_VENDOR_SITE >
    The problem i'm facing is that, i don't know a way to insert the liability account and down payment account
    the api takes the default account and assign them to all the sites.
    While we have diffrent account for each type of suppliers
    Release R12.1.3
    please advice.

    See http://java.sun.com/developer/technicalArticles/java_warehouse/single_jar/

  • Unable to sync webcenter sites with eclipse using csdt plugin

    Hi Experts,
    using csdt plugin in eclipse IDE we connected to wcs server and we got the WCS perspective in eclipse IDE.. But Unable to get the developed sample web sites(avi sports,firstsiteII,admin site) in sites workspace elements in eclipse even though pressing refresh tree button??? could you please help us on this??

    Hi Sashank,
    Please download javadoc and tagreference zip files from http://docs.oracle.com/cd/E29495_01/index.htm.
    Thanks & Regards
    Parthasarathi Reddy.

  • Webcenter sites integration with ATG

    I have question on Webcenter sites and ATG integration. 
    We have to use webcenter sites as Web content management system that will feed the static content(text, images, videos, and other documents) to ATG. ATG will be acting as front end and host webpages. We have below two possibilities that we can think of
    From Webcenter site we will use its APIs and expose web-services that ATG can consume to get the static contents. (requires lot of effort)
    Webcenter site will publish content on the file system that ATG can link to and show them in a webpages. (relatively less effort)
    Second solution looked good but there is no documentation that says it is possible. Only one document ‘cip_11gr1_for_file_systems_and_ms_sharepoint_administrator_guide.pdf’ explains
    the pulling the data from file-system but it does not mention publishing to file-system.
    Another document (webcenter_sites_11gr1_bp1_admin.pdf) that explains publishing to hard disk is template based publishing meaning, we will have to create templates which not a not intended way. since we don't want to create template just to publish.
    My question is – is it possible that webcenter sites can to publish to file-system? If yes is there any document which can help us achieving that?
    Will appreciate if you can suggest any other approach for integrating these two product.
    Thanks
    Sameer

    Hi Sameer -
    OOTB you can publish assets directly to disk using Export to XML, but you realize that by doing that, you're essentially using Sites as a very expensive GUI over a database.  By using a combination of Java classes and JSPs you can create very rich markup (or XML, or JSON, or whatever you like) and render that, then export that data to disk.  That way you can traverse asset relationships and write much more complex data to disk for consumption by external systems.
    As for your options of #1 vs #2, you need to think carefully about what your goals are for using Sites and for using ATG.  There are a number of other integration options between Sites and ATG, including the reverse of #1, which is to have Sites render most pages and then consume data from ATG in service form.  There is also the efficient and decoupled approach of standing up ATG and Sites side-by-side and selectively integrating components together.  So Sites would drive marketing content and ATG would drive commerce content, and the two would leverage service APIs between the two when needed (for example, to render an ATG promo in Sites, or to render a detailed product description from Sites in ATG).
    Each approach has pros and cons and there is no Correct Way To Integrate ATG and Sites, but there are, as you can see, several common patterns.
    Hope this helps.
    Sincerely,
    Tony Field
    Function1

  • Can we use WebCenter Sites content store in WebCenter Portal

    Hi,
    Can we use WebCenter Sites Content Store as the default content store in WebCenter Portal?
    I need to create website in WebCenter Sites, all the content will be stored in Sites Content Store. I also need to integrate WebCenter Portal with Sites content store to fetch contents from the store and display it in Portal. I do not wish to purchase WebCenter Content.
    Is this possible?
    Regards,
    Syed Rehan Shah

    Well , as suggested by jiri machotka, you can go for version 11.1.1.8.0 version with proper license.
    However,if you are using earlier versions than I must say that-
    It's going to be very very complex and cumbersome development process al-together . (at least for me) .Because why I am telling this is -
    The content repository structure of (webcenter site's CA server )is completely different from UCM (webcenter content server and preferred cms for portal).
    In previous threads ,lot of things are being discussed about this issue.
    In my opinion,you can very well integrate sites content to portal pages via REST API. Documentation is available.
    http://docs.oracle.com/cd/E29495_01/doc.1111/webcenter_sites_11gr1_wem_rest_api_resource_ref.pdf
    Apart from it, you can also do -
    1. Gadgets - You can consume Gadgets from WebCenter Portal, some examples with Google Gadgets are available in OTN.
    2. Widgets - You can build HMTL + Javascript widgets with Sites and embed in WebCenter Portal pages.
    Hope this info helps you out.
    Regards,
    Hoque

  • Spring version with rest api of webcenter sites

    Hi everyone!
    I'm using the rest api of webcenter sites, with this libraries: com.fatwire.wem.api.rest 11.1.1.8.0, com.fatwire.wem-sso-api-cas-11.1.1.8.0, com.fatwire.wem-sso-api-11.1.1.8.0 in a spring application with version 3.2.10.RELEASE. And it's works fine! I'm getting a list of assets and all their attributes, but I need use this application with the spring version 4.0.6.RELEASE, then when I update the spring version the rest api this libraries do not work. This is the method that fails:
    SSOSession ssoSession = SSO.getSSOSession(baseUri);
    multiticket = ssoSession.getMultiTicket(username, password); -> ERROR LINE
    baseResource = baseResource.queryParam("multiticket", multiticket);
    this because the application cannot get a mutiticket. I'm using the same code and the same structure only changes the spring version. Oracle webcenter is updated with all the patches until this date.
    How it's possible solve this?
    Thx

    SOLVED
    private void authenticate() throws RestConnectionException {
       try {
      SSOSession ssoSession = SSO.getSSOSession("CASConfig.xml");
       multiticket = ssoSession.getMultiTicket(username, password);
       baseResource = baseResource.queryParam("multiticket", multiticket);
      } catch (SSOException e) {
       throw new RestConnectionException(e);
    CASConfig.xml
    <beans:beans xmlns="http://www.springframework.org/schema/mvc"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:beans="http://www.springframework.org/schema/beans"
       xmlns:jee="http://www.springframework.org/schema/jee" xmlns:tx="http://www.springframework.org/schema/tx"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
      http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd">
       <beans:bean id="ssoconfig" class="com.fatwire.wem.sso.cas.conf.CASConfig">
       <beans:property name="casUrl" value="http://server:port/cas" />
       <beans:property name="casInternalURL" value="http://server:port/cas"/>
       </beans:bean>
       <beans:bean id="ssoprovider" class="com.fatwire.wem.sso.cas.CASProvider">
       <beans:property name="config" ref="ssoconfig" />
       </beans:bean>
       <!-- Used for ticket validation. In case of cluster with cas server behind
      firewall, it must point to the cas server. -->
    </beans:beans>
    add the casconfig to the classpath in spring, set the server and port in xml and it works!

  • Content query webpart use a part of the URL as filter

    Hey,
    I have on root site in the site collection a list. Now I like to build up a site template (from which the user can create sub sites form the root site in the site collection.
    In this site template I like to bring on the homepage a content query webpart. The content query webpart has to show one item from the list on the start site.
    How can I configure that the content query webpart use a part of the URL as filter?
    Url is like:
    http://Server/SiteCollection/ID/home.aspx
    The ID must be the filter criterion in the content query webpart. How can I do this?
    Thanks for your help
    Stefan
    Viele Grüße Stefan
    Kontakt unter [email protected]

    Hi Stefan,
    You can create your own CQWP by subclassing the default one.
    Then you can override the CAML query to add criteria found in the URL.
    Here is more information and sample:
    http://www.andrewconnell.com/blog/archive/2008/02/18/Subclassing-the-Content-Query-Web-Part-Adding-Dynamic-Filtering.aspx
    http://msmvps.com/blogs/laflour/archive/2008/05/29/subclassing-content-query-web-part-to-override-caml-query.aspx
    Regards,
    Ludovic Caffin

  • Displaying content item -(IContentItem) in portlet using Content Server API

    Hi,
    I am using the latest Content server API in my remote server to get the published content items. I have to display the content item in the JSP portlet.
    So how to display the content item in the portlet, if you have the IContentItem Object retrieved from the content server ? Is there any mechanism to get the HTML code/JSP code that corresponds to the IContentItem object?(All the content item will be an html or jsp )
    Currently we are extracting the publish url and opening an http connection to retrieve the html, which is not a good solution if you have mutiple portlets in the same page. So please suggest how can I display the content item (IContentItem Object) in the portlet.?

    Hi Anand,
    I am facing the same problem on IBM WebSphere Portal 5.1.
    Did you find a solution to your problem ?
    Thanks
    Ganesh

  • Content Server error  post installing webcenter sites

    Hi ,
    I installed webcenter sites and post installation after login when click on "Contributor" link getting Content Server error while Admin mode is working fine.
    On further debug below URL was internally hit which is giving 500 error : http://<hostname>:<port>/cs/ContentServer?pagename=fatwire/ui/controller/controller&elementName=UI/Layout"
    Any pointer to root cause?
    Edited by: 975945 on Dec 11, 2012 5:16 AM

    Drop the database user and reinstall again.

  • Webcenter Sites Vs Webcenter Portal+Webcenter Content

    Hi everyone,
    A question for all those multifaceted webcenter experts out there!
    What is it that, Webcenter Sites does & Webcenter Portal + Webcenter Content couldn't do?
    If both can be equivalent solutions, then why acquisition of FatWire?
    Thanks in advance!
    ~S

    I wouldn't say it is a question of what, but how - some people find Sites more appealing than Portal, or Content's WCM (Site Studio). It's worth to add that Portal has most likely richer features than Sites, but if you want to build B2C internet, Sites seems (and are told) to be a better choice.
    To your question about the acquisition, other reasons could be:
    - ATG; Oracle had acquired ATG some months before Fatwire, which was the front-end technology for many ATG customers
    - customer base
    - etc.
    Edited by: jiri.machotka on Mar 4, 2013 9:48 AM

  • Executing a query using API

    Hi All
    Is there any way to query OIM database using OIM API.
    i mean excuting a custom query.
    Thank you
    sas

    To execute a query, you can use the following:
    tcDataSet tcDS = new tcDataSet();
    tcDS.setQuery(<dbRef>, <queryString>);
    tcDS.executeQuery();
    <dbRef> -> If executing from adapter, you can use tcDataProvider or if invoking from a scheduled task use 'getDataBase()'
    <queryString> -> String containing the query.
    As mentioned in earlier replies, using direct queries is not recommended, you should be using APIs instead. tcUserOperationsIntf.findUsers(Map) wil work. Then on the tcResultSet object returned you can use getRowCOunt() to determine # of rows.
    Hope this helps.
    - Aman

  • Using content management API

    Hi all,
    i'm a beginer in weblogic portal.
    i want to use content management API to publish content, such as add content type, add content, edit content . . .
    can anybody help me or give me document link.
    Thanks!!!

    There used to be a contentSamples App that pretty much did most of this, I cant find this online.
    i have the zip for 9.2 (there shouldnt be many changes between 9.2 and 10) , if you want a copy of this app send me your email

  • Automation Testing on Webcenter Sites

    Hello,
    How do I automate content creation using any automated test tool?
    Thanks,
    Sushanth

    This question can be approached from two perspectives:
    - is your task to create automated tests, or
    - is your task to automate content creation?
    If the former, there is a number of tools (both commercial and open source) which can automate test scenarios on web-based applications. Oracle has one too, called Oracle Application Testing Suite.
    If the latter, there might be better means than generic testing tools. Take a look at this article: http://manifesto.co.uk/using-webcenter-sites-rest-api-part-1/?goback=.gde_142076_member_5809268750695821313#!
    which describes REST API. Also, if you use WebCenter Content as you content repository, you could use Batch Loader, or RIDC interface.

Maybe you are looking for