Set component property using top level api

Hi I have a requirement to change the property of a component.
   I can use javax.jcr.node  and use setProperty method.But I want to have the same functionality using sling or wcm api.

Hi Sham ,
     See I want to change the sling:resourceType of the components that are present in pages .So generally we will do
     Node snode= we will convert (/content/www/en/jcr:content/component) to node
  then  If (snode.hasProperty("sling:resourceType){
                snode.setProperty("sling:resourceType","XXXXX");
We will do as mentioned above.
   Now I dont want to do this using JCR api (here javax.jcr.node) . I want to have the same functionality using wcm or sling API.

Similar Messages

  • Example using low level API POI for generating Excel??

    Hi
    is anyone know good URL that teaches generating Excel using low level API using Apache POI?
    The reason is because i want to set the password for either workbook/sheet in high level API but it cant be done.
    the only thing can be done using High level API is protect sheet without password.
    Any idea?
    Thanks

    There is quite a good pack of documentation that ships with HSSF. To answer your question, I have just gone to the how to page and copied the example below, hope it helps.
    short rownum;
    // create a new file
    FileOutputStream out = new FileOutputStream("workbook.xls");
    // create a new workbook
    HSSFWorkbook wb = new HSSFWorkbook();
    // create a new sheet
    HSSFSheet s = wb.createSheet();
    // declare a row object reference
    HSSFRow r = null;
    // declare a cell object reference
    HSSFCell c = null;
    // create 3 cell styles
    HSSFCellStyle cs = wb.createCellStyle();
    HSSFCellStyle cs2 = wb.createCellStyle();
    HSSFCellStyle cs3 = wb.createCellStyle();
    HSSFDataFormat df = wb.createDataFormat();
    // create 2 fonts objects
    HSSFFont f = wb.createFont();
    HSSFFont f2 = wb.createFont();
    //set font 1 to 12 point type
    f.setFontHeightInPoints((short) 12);
    //make it blue
    f.setColor( (short)0xc );
    // make it bold
    //arial is the default font
    f.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
    //set font 2 to 10 point type
    f2.setFontHeightInPoints((short) 10);
    //make it red
    f2.setColor( (short)HSSFFont.COLOR_RED );
    //make it bold
    f2.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
    f2.setStrikeout( true );
    //set cell stlye
    cs.setFont(f);
    //set the cell format
    cs.setDataFormat(df.getFormat("#,##0.0"));
    //set a thin border
    cs2.setBorderBottom(cs2.BORDER_THIN);
    //fill w fg fill color
    cs2.setFillPattern((short) HSSFCellStyle.SOLID_FOREGROUND);
    //set the cell format to text see HSSFDataFormat for a full list
    cs2.setDataFormat(HSSFDataFormat.getBuiltinFormat("text"));
    // set the font
    cs2.setFont(f2);
    // set the sheet name in Unicode
    wb.setSheetName(0, "\u0422\u0435\u0441\u0442\u043E\u0432\u0430\u044F " +
                       "\u0421\u0442\u0440\u0430\u043D\u0438\u0447\u043A\u0430",
                    HSSFWorkbook.ENCODING_UTF_16 );
    // in case of compressed Unicode
    // wb.setSheetName(0, "HSSF Test", HSSFWorkbook.ENCODING_COMPRESSED_UNICODE );
    // create a sheet with 30 rows (0-29)
    for (rownum = (short) 0; rownum < 30; rownum++)
        // create a row
        r = s.createRow(rownum);
        // on every other row
        if ((rownum % 2) == 0)
            // make the row height bigger  (in twips - 1/20 of a point)
            r.setHeight((short) 0x249);
        //r.setRowNum(( short ) rownum);
        // create 10 cells (0-9) (the += 2 becomes apparent later
        for (short cellnum = (short) 0; cellnum < 10; cellnum += 2)
            // create a numeric cell
            c = r.createCell(cellnum);
            // do some goofy math to demonstrate decimals
            c.setCellValue(rownum * 10000 + cellnum
                    + (((double) rownum / 1000)
                    + ((double) cellnum / 10000)));
            String cellValue;
            // create a string cell (see why += 2 in the
            c = r.createCell((short) (cellnum + 1));
            // on every other row
            if ((rownum % 2) == 0)
                // set this cell to the first cell style we defined
                c.setCellStyle(cs);
                // set the cell's string value to "Test"
                c.setEncoding( HSSFCell.ENCODING_COMPRESSED_UNICODE );
                c.setCellValue( "Test" );
            else
                c.setCellStyle(cs2);
                // set the cell's string value to "\u0422\u0435\u0441\u0442"
                c.setEncoding( HSSFCell.ENCODING_UTF_16 );
                c.setCellValue( "\u0422\u0435\u0441\u0442" );
            // make this column a bit wider
            s.setColumnWidth((short) (cellnum + 1), (short) ((50 * 8) / ((double) 1 / 20)));
    //draw a thick black border on the row at the bottom using BLANKS
    // advance 2 rows
    rownum++;
    rownum++;
    r = s.createRow(rownum);
    // define the third style to be the default
    // except with a thick black border at the bottom
    cs3.setBorderBottom(cs3.BORDER_THICK);
    //create 50 cells
    for (short cellnum = (short) 0; cellnum < 50; cellnum++)
        //create a blank type cell (no value)
        c = r.createCell(cellnum);
        // set it to the thick black border style
        c.setCellStyle(cs3);
    //end draw thick black border
    // demonstrate adding/naming and deleting a sheet
    // create a sheet, set its title then delete it
    s = wb.createSheet();
    wb.setSheetName(1, "DeletedSheet");
    wb.removeSheetAt(1);
    //end deleted sheet
    // write the workbook to the output stream
    // close our file (don't blow out our file handles
    wb.write(out);
    out.close();

  • How to stop location bar autocomplete from using top-level domains?

    I love the location bar autocomplete - or at least, I used to. I had it trained to the point where typing one letter was enough to bring up the pages I used most often. But now with Firefox 12, it ignores all that and favors top-level domains.
    For instance: I haven't been to the front page of YouTube in years; there's no reason to go there. When I would type "www.y" into the location bar, it would pop up to the one video I visited most often - and that's exactly what I WANTED it to do. Now it defaults to "YouTube.com" and I have to scroll down to find the actual page I want. Same deal with Wikipedia: I don't want to go to the front page, I want to go to the page I use most often for research.
    So basically, what do I need to change to get the location bar autocomplete to stop giving me top-level domains I don't want, and go back to giving me the subpages I spent years training it to favor? Scrolling down to the right entry is a waste of time when typing one letter and hitting enter should be enough to do it...

    And I meant the actual location bar, not the dropdown menu below it. The dropdown is fine: it's the autocomplete '''in''' the location bar that needs to be fixed...

  • Set trigger property using JDAPI

    Hi.
    I have a couple of forms I need to modify using JDAPI. Among others I need to set trigger property "Fire in enter query mode" from no to yes. But I just cant find the way how to do this.
    Any help would be appreciated.
    Gregor

    This help may have some info..
    http://www.oracle.com/webapps/online-help/forms/10g/
    Please expand the "Programming Oracle Forms with JDAPI" item and look inside.
    http://www.oracle.com/webapps/online-help/forms/10g/state/content/navId.3/navSetId._/vtTopicFile.jdapi%7Cjdapi_subclassobjprops~html/vtTopicId./

  • Using High-Level API, need to use KeyRelease just for Lists

    I'm coding a MIDlet with High-Level API, but I found that is really annoying to press down 30 times in a long List to reach the item you want to select. So I thought "what about pressing right/left and make it working like pressing down/up like 10 times"?
    Something like this:
    Canvas canvas = new Canvas() {
             public void paint(Graphics g) { }
             protected void keyPressed(int keyCode) {
                switch(keyCode) {
                    case -3:mylist.setSelectedIndex(mylist.getSelectedIndex()-10,true);break;
                    case -4:mylist.setSelectedIndex(mylist.getSelectedIndex()+10,true);
          }; // end of anonymous class*/But I have no idea about how to implement this =(

    first of all, is there any particular reason you want to stick to the high-level API?
    Well, I have already nearly 700 lines of code. I don't want to start from 0 :P
    I think the best way to implement this would be to use customItems so you can control the view of the list.
    I think that requires MIDP2.0 I'm trying to make it work in MIDP 1.0
    The best you could do with high level UI is add navigation Commands to the List.
    I have already 2 Commands per List. Not all phones have a button in the center of "cursors", so I use right button for select and left for back/exit.
    Thanks for replies anyway

  • Set system property using -D flag that references another system property

    Hi,
    I'm interested in doing something like the following
    java -Dmy.prop=${user.home}/.tmpdir
    Setting the property in Java code is not an option.
    Can this be done?
    Thanks for helping.

    The only way I think you could do this is to ask the os for this value.
    i.e windows: $HOMEDRIVE\$HOMEPATH
    java -Dmy.prop=$HOMEDRIVE\$HOMEPATH\.tmpdir
    linux: ~
    java -Dmy.prop=~/.tmpdir
    Or to use a small java application to return the value into the command line:
    java -Dmy.prop=$(java HomeDir)/.tmpdir
    class HomeDir {
      public void main (String ... args) {
        System.out.println(System.getProperty("home.dir"));
    }

  • Trouble setting component property

    I'm a Flash newbie trying to build a custom component using
    Flash MX 2004. basically it's an enhanced version of the standard
    label component. Everything seems to work fine except when trying
    to set default text or assigning a text value in the "properties"
    window (the field displays in the properties window, but any value
    typed into it does not appear during movie playback). Currently,
    the text can be seen only in authoring mode, not when the movie
    plays. The only way for the text to displayed during playback is to
    set it up through code. Does anybody know what I'm doing wrong? .as
    file content follows.
    class CustomComponents.FormFields.lblFieldLabel extends
    MovieClip {
    private var objFieldLabel:MovieClip;
    private var strText:String = "";
    function lblFieldLabel() {
    init();
    public function init():Void {
    public function get displaytext():String {
    return strText;
    [Inspectable(defaultValue="display text", type="String")]
    public function set displaytext(val:String):Void {
    strText = val;
    objFieldLabel.text = strText + ":";
    }

    The reason why I do-not want to use a managed bean is that, I want to do this for all the components in my page(It is reasonably big too). So doing this by a managed bean would mean, I need an interface which has as many getter methods as the no of components in the page. Also, we are still in developement which means everytime some-one adds a new component in the page they need to add a new getter method in the interface. Well not just the interface, but also in all the implementing classes...
    The business use-case is that, I have one page in the application which has different levels of visibility(Some components read-only, some not rendered, some editable) based not just on who is logged in but also on other business conditions decided on the page prior to this. So based on these different conditions I build different schemes or themes(I have like 3/4 themes) which decides which components are read-only, which all are editable etc etc... Now I have to apply this 'theme' on to my page :). The way I am trying to do it now, everytime a new component is added, its visibility just need to be set in the property files of different themes.
    Thanks,
    Julian

  • How to set portal context using Java/JPDK api.

    Hi,
    I am in the process of converting pl/sql based database provider contect portlets to Java based JPDK. I ran into issue where the database provider portlet users were getting context auto matically. Now with Java/JPDK portlets , I am receiving no data found error, since the context is not set. The pl/sql is setting wwctx_private_api.set_context ('portal') to set the context. From Java if we call this api, it is taking a toll on the performance and the portlet times out.
    Can any help how to set the context for a web provider using JPDK or any other better solution. Any immediate help is highly appreciated.
    Thanks,
    Rav.

    Hi
    We are trying to access content views for e.g portal.wwsbr_all_items s, portal.wwsbr_all_content_areas c,portal.wwsbr_all_folders f, from aweb provider portlet. When we do a select on those objects , we are getting java sql exception saying "ORA-06510: PL/SQL: unhandled user-defined exception
    ORA-06512: at "PORTAL.WWCTX_SSO", line 1745
    ORA-06510: PL/SQL: unhandled user-defined exception
    ORA-06512: at "PORTAL.WWCTX_SSO", line 1579
    ORA-06502: PL/SQL: numeric or value error
    ORA-06512: at "PORTAL.WWCTX_SSO", line 1834
    ORA-06512: at "PORTAL.WWCTX_API", line 199
    We need to know how to accesss the above views from a jsp based portlet.
    A

  • How to set ListItem Property using COM

    How do I set the CheckoutUser property of a document contained within a document set??  I can get the document, and reference all its properties, just not sure how to go about setting them using C# and the Client Object Model.....

    Hi Andy,
    The
    CheckoutUser field mentioned above should be Person or Group type, you can check if you can assign a User value to this field per the following similar post.
    http://social.msdn.microsoft.com/Forums/en-US/5183e87c-ee1d-4594-9492-0dfdf6616cce/sp2010-client-object-model-how-to-assign-a-value-to-a-peoplepicker-field
    Thanks
    Daniel Yang
    TechNet Community Support

  • How to set readOnly property using javascript

    Hi Folks,
    How do I make an inputtext readOnly using javascript?
    I have tried the following
    var textComp = AdfPage.PAGE.findComponent("textId");
    textComp.setProperty('readOnly', 'true');
    var textComp = AdfPage.PAGE.findComponent("textId");
    textComp.readOnly = true;
    var textComp = AdfPage.PAGE.findComponent("textId");
    textComp.setAttribute('readOnly', 'true');None of the above works. Any idea?
    Thanks
    Vishal

    http://docs.oracle.com/cd/E12839_01/apirefs.1111/e12046/oracle/adf/view/js/component/rich/input/AdfRichInputText.html#getReadOnly__
    Get function for attribute for 'readOnly'. This attribute is secured. You may get it, but you may not set it. Any changes to this attribute will not be transmitted to the server.
    Setting readOnly inputText value using javascript.

  • How does referencing a property of top-level control effect a sub-VI's timing?

    I've got a Graphic User Interface (GUI) with some buttons and text controls. First I bundle the references to these controls into a cluster and send it to a utility sub-VI where the cluster is saved in a switch register (the process called functional global). Then I have a 10 Hz loop in the GUI VI to monitor the controls locally. In a separate loop, I start a sub-VI that eventually leads to the utility sub-VI with the control references. When I use these references with the "Property | Value" it seems to effect the timing of the sub-VI.
    Currently I'm running the entire application using LabVIEW's default priority and execution system. It appears that when the sub-VI encounters the Property Node reference to an external control, the sub-VI loses its place at the head of the CPU queue, thus allowing other VI's to process.
    I'm considering assigning the utility sub-VI a higher priority and/or execution system but I'm not sure of the ramifications. I've read Application Note 114, "Using LabVIEW to Create Multithreaded VIs for Maximum Performance and Reliability", but it's dated July 2000 and does not seem to cover Property Nodes.
    Is there a connection between using Property Nodes for external controls and system timing or is my testing flawed?

    Property nodes and the VIs which use them all are forced to run in the User Interface execution system. This is what causes the change in your VI timing.
    To change the value of an indicator without "moving" the subVI to the UI execution system, try passing the data to the GUI VI by means of a queue. This should allow updates without waiting for the subVI to finish and without causing the slowdown. The Enqueue qnd Dequeue functiosn are quite fast so the added ovehead should have minimal effect on your timing.
    Lynn

  • Setting long property  using jconsole

    On my jmx bean I am able to invoke methods whose parameters are of type string , I added a new set method whihc takes Long as a paramter exposed it through jmx , I tried updating its value and I am getting java.lang.illegalArgument:argument type mismatch
    please advice me how to call set operations on methods whose parameter type is Long ?

    there isn't really anything more you need to do. can you show some code? also, did you make the parameter Long or long? that might make a difference.

  • How to use search REST api to get custom managed property data for anonymous user?

     
    I am trying build a public portal with anonymous access and i am trying to read some
    content from custom managed property using search REST api in sharepoint 2013. I have tried to enable all possible attributes of the managed prop. Like searchable,queryable,safe etc. also i am including queryparametertemplate in my REST api search query. But
    still i am not able to retrieve the managed prop. For an anonymous user. The same query returns the value if i am logged in.
    Any Help is greatly appreciated. 
    Thanks,
    Rakesh
    Thanks, Rakesh

    Hi Rakesh,
    To enable anonymous Search REST queries, we need to create queryparametertemplate.xml and upload it to the correct library in SharePoint.
    From your description I can know that you have created the file, then I recommend to check the things below:
    Please use “QueryTemplatePropertiesUrl” instead of “queryparametertemplate” in the Search REST API query as following: &QueryTemplatePropertiesUrl='spfile://webroot/queryparametertemplate.xml'.
    Make sure that the Query Properties you need have been added to the QueryProperties element in the queryparametertemplate.xml file.
    Make sure that the query parameters you need have been added to the WhiteList element in the
    queryparametertemplate.xml file. For example, if you want to use Refiners in the REST API, then the Refiners should be added to the
    WhiteList element in the queryparametertemplate.xml file as following:
    <a:string>Refiners</a:string>.
    You can also debug setting properties in anonymous Search Rest queries following the link below:
    http://www.mavention.com/blog/debugging-setting-properties-anonymous-search-rest-queries
    More references about anonymous Search REST:
    http://blog.mastykarz.nl/configuring-sharepoint-2013-search-rest-api-anonymous-users/
    http://msdn.microsoft.com/en-us/library/office/jj163876%28v=office.15%29.aspx#bk_AnonymousREST
    Thanks,
    Victoria
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Victoria Xia
    TechNet Community Support

  • I cannot make a top level collection set.

    LR 4 only lists other collection sets as an option or "next to." I have a PC, 16 GIG RAM.

    Shirley Anne Baker wrote:
    When I Click the Plus icon for either Collection or Collection set I get:
    Next to Collection Set (and it lists whatever one I'm on)
    Or
    Inside a Collection Set.
    It depends on your starting point. If you already have a static collection or collection set selected when you press the + icon, I agree you get the options that you've stated. If, however, you do not have any existing static collection or collection set selected (e.g. if you have a folder or even a smart collection selected), when you then press the + icon you will get this:
    So if you're looking to create a new collection set at the top level, either select an existing top level collection (and choose "Next To"), or have no existing static collection/collection set selected and choose "Top Level".

  • HIgh Level API's Vs Low Level API's

    Hi,
    Is it advisable to use High Level API's or Low Level API's for developing a Mobile Application?
    What will be the advantages/disadvantages of using High Level API's over Low Level API's or vice versa?
    Kindly advise.

    Is it advisable to use High Level API's or Low Level API's for developing a Mobile Application?What have you used so far?
    What will be the advantages/disadvantages of using High Level API's over Low Level API's or vice versa?What are your own thoughts on this?
    {color:#0000ff}http://catb.org/~esr/faqs/smart-questions.html{color}
    db

Maybe you are looking for