Set a dynamic default property when a page is created?

Is there a way to set a default property that is dynamic for a page when it is created? For example, i want to capture a user id from our system and store it in an "author" property when the page is first created. This value can be changed to a different user by the author but in case they don't set it i want to have it default on page creation.
I guess a better question would be, is there somewhere i can put code so that it will be executed when a page is created?
I considered writing a custom widget and putting this in page properties, but that won't actually run unless page properties has been opened.
Thanks

For anyone in the future, here is how i implemented the event handler -
@Component
public class PageCreationObservation implements EventListener {
    Logger log = LoggerFactory.getLogger(this.getClass());
    private Session adminSession;
    @Reference
    SlingRepository repository;
    @Activate
    public void activate(ComponentContext context) throws Exception {
        log.info("Activating PageCreationObservation");
        try {
            String[] nodetypes = {"cq:Page"};
            adminSession = repository.loginAdministrative(null);
            adminSession.getWorkspace().getObservationManager().addEventListener(
                this, //handler
                Event.NODE_ADDED, //binary combination of event types
                "/content/appname", //path
                true, //is Deep?
                null, //uuids filter
                nodetypes, //nodetypes filter
                false
        } catch (RepositoryException e) {
            log.error("Unable to register session",e);
            throw new Exception(e);
    @Deactivate
    public void deactivate(){
        if (adminSession != null) {
            adminSession.logout();
    public void onEvent(EventIterator eventIterator) {
        try {
            while (eventIterator.hasNext()) {
                Event newEvent = eventIterator.nextEvent();
                log.info("something has been added : {}", newEvent.getPath());
                //Check if node exists and it is a content node of the newly created page
                if (adminSession.nodeExists(newEvent.getPath())
                        && adminSession.getNode(newEvent.getPath()).getProperty("jcr:primaryType").getString().equals("cq:PageContent")) {
                    Node contentNode = adminSession.getNode(newEvent.getPath());
                    if (contentNode.getProperty("jcr:createdBy") != null) {
                        contentNode.setProperty("author", contentNode.getProperty("jcr:createdBy").getString());
            adminSession.save();
        } catch(Exception e){
            log.error("Error while treating page creation events",e);

Similar Messages

  • Can we set the dynamic data source when using getReportParameters() ?

    Hello!
    I have a report where one of its parameters refers to a list of values (LOVs). This list of values is an SQL Query type. When the data source used in the report is defined in the BI Publisher server, I'm able to get the report parameters using the getReportParameters() function in my application. However, if the data source is not defined the function throws an exception, which is understandable.
    I decided to dynamically set the data source so that even if the data source used by the report is not defined in the BI Publisher server, it still will be able to get the LOVs for the parameter. I tried setting the JDBCDataSource of the dynamicDataSource for the ReportRequest object that I passed to the getReportParameters() function. Please see the sample code below:
    reportRequest.dynamicDataSource = new BIP10.BIPDataSource();
    reportRequest.dynamicDataSource.JDBCDataSource = new BIP10.JDBCDataSource();
    setReportDataSource(reportRequest.dynamicDataSource.JDBCDataSource, connectstr, jdbc, dc); //function to set the values for JDBCDataSource object
    reportParams = webrs.getReportParameters(reportRequest, uid, pwd); //call the getReportParameters
    I was expecting this to work as this is what I did to dynamically set the data source before calling the runReport function. So, my question is -- can we set the dynamic data source when using getReportParameters() ? I tried this both in versions 10g and 11g. It does not seem to work on both versions.
    Regards,
    Stephanie

    report_id column of apex_application_page_ir_rpt can help us uniquely identify each saved report.
    We can assign this report_id value to a page item and this page item can be put in the Report ID Item text box of the Advanced section of the Report Attributes page of the IR.
    This should load the saved report identified by report_id and you can get rid of javascript
    Regards,
    Vishal
    http://obiee-oracledb.blogspot.com
    http://www.packtpub.com/oracle-apex-4-2-reporting/book
    Kindly mark the reply as helpful/correct if it solves your problem

  • How to make the LV front panel controls the current value through the program is set as the default value when the next time you open?

    How to make the LV front panel controls the current value through the programis set as the default value when the next time you open?
    1110340051 

    Try this: Re: How to make a VI remember the latest control value?
    Jim
    You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice

  • When using Pages to create an EPUB file, how would I force a page brake?

    when using Pages to create an EPUB file, how would I force a page brake?

    Sory Peter but you don't seem to understand.
    If you pick up an e-book by random on the iBook Store, you will see that professional e-books ALWAYS start their chapters at the top of a new page, whatever the reader, the color of the page or the size of the text are.
    I know how to add a new chapter with the use of the appropriate style in Pages but I want to be able to divide SECTIONS as well.
    What I want to to do is to force a page break in between two paragraphs and apparently, this option is not possible with Pages.
    Rémy.

  • OIM 11g - Set a default password when a user is created

    Hi everybody,
    I'm trying to set a default password when I create a user manually but I've got some errors.
    I firstly created a pre-process event handler to generate automatically a login and an email for a user who is created and it worked fine. But now I'm trying to generate a default password (like "ChangeIt" for example) that the user will have to change the first time.
    This is the code I wrote :
    public EventResult execute(long processId, long eventId, Orchestration orchestration) {
    String methodName = "EventREsult execute";
    System.out.println("###### " + className + " - method " + methodName + " - STARTED");
    HashMap<String, Serializable> parameters = orchestration.getParameters();
    System.out.println("###### OK1");
    String firstName = (String)parameters.get(UserManagerConstants.AttributeName.FIRSTNAME.getId());
    System.out.println("###### OK2");
    String lastName = (String)parameters.get(UserManagerConstants.AttributeName.LASTNAME.getId());
    System.out.println("###### OK3");
    String userKey = (String)parameters.get(UserManagerConstants.AttributeName.USER_KEY.getId());
    System.out.println("###### OK4");
    String userLogin = firstName + lastName;
    parameters.put(UserManagerConstants.AttributeName.USER_LOGIN.getId(), userLogin);
    System.out.println("###### OK5");
    parameters.put(UserManagerConstants.AttributeName.EMAIL.getId(), firstName + "." + lastName + "@test.test");
    System.out.println("###### OK6");
    parameters.put(UserManagerConstants.AttributeName.PASSWORD.getId(), "ChangeIt");
    System.out.println("###### " + className + " - method " + methodName + " - ENDED");
    return new EventResult();
    And When I try to create a user, I've got the error : "An error occured. Null input buffer"
    This is what I have in the console :
    <10 mai 2012 16 h 44 CEST> <Error> <oracle.iam.identity.usermgmt.impl> <IAM-3050030> <Exception lors de la rÚalisation de l'opÚration.
    java.lang.IllegalArgumentException: Null input buffer
    at javax.crypto.Cipher.doFinal(DashoA13*..)
    at com.thortech.xl.crypto.tcDefaultDBEncryptionImpl.decrypt(tcDefaultDBEncryptionImpl.java:219)
    at com.thortech.xl.crypto.tcCryptoUtil.decrypt(tcCryptoUtil.java:122)
    at com.thortech.xl.crypto.tcCryptoUtil.decrypt(tcCryptoUtil.java:200)
    at oracle.iam.platform.utils.crypto.CryptoUtil.getDecryptedPassword(CryptoUtil.java:136)
    at oracle.iam.transUI.impl.handlers.user.UpdateUsrPwdFields.updateUserPwdFields(UpdateUsrPwd
    Fields.java:124)
    at oracle.iam.transUI.impl.handlers.user.UpdateUsrPwdFields.execute(UpdateUsrPwdFields.java:
    71)
    at oracle.iam.platform.kernel.impl.OrchProcessData.runPreProcessEvents(OrchProcessData.java:
    898)
    <10 mai 2012 16 h 44 CEST> <Error> <oracle.iam.identitytaskflow.logging> <BEA-000000> <IAM-3060023>
    I know this is something due to the password parameter but I don't understand what is expected for this one ...
    If you someone could help me with this it would be really helpful !
    Thanks,
    Thibault

    Hi, Thanks for your quick answer !
    So it solved half of the problem ! Now I've got an other error : decrypt failed
    And this is the beginning of the error in the console :
    <10 mai 2012 18 h 14 CEST> <Error> <XELLERATE.ACCOUNTMANAGEMENT> <BEA-000000> <Class/Method: tcDefau
    ltDBEncryptionImpl/decrypt encounter some problems: Input length must be multiple of 16 when decrypting with padded cipher
    javax.crypto.IllegalBlockSizeException: Input length must be multiple of 16 when decrypting with pad
    ded cipher
    at com.sun.crypto.provider.SunJCE_f.b(DashoA13*..)
    at com.sun.crypto.provider.SunJCE_f.b(DashoA13*..)
    at com.sun.crypto.provider.AESCipher.engineDoFinal(DashoA13*..)
    at javax.crypto.Cipher.doFinal(DashoA13*..)
    at com.thortech.xl.crypto.tcDefaultDBEncryptionImpl.decrypt(tcDefaultDBEncryptionImpl.java:2
    19)
    at com.thortech.xl.crypto.tcCryptoUtil.decrypt(tcCryptoUtil.java:122)
    at com.thortech.xl.crypto.tcCryptoUtil.decrypt(tcCryptoUtil.java:200)
    at oracle.iam.platform.utils.crypto.CryptoUtil.getDecryptedPassword(CryptoUtil.java:136)
    at oracle.iam.transUI.impl.handlers.user.UpdateUsrPwdFields.updateUserPwdFields(UpdateUsrPwd
    Fields.java:124)
    at oracle.iam.transUI.impl.handlers.user.UpdateUsrPwdFields.execute(UpdateUsrPwdFields.java:
    71)
    at oracle.iam.platform.kernel.impl.OrchProcessData.runPreProcessEvents(OrchProcessData.java:
    898)
    What does it means ? My password must be encrypted or something like this ?
    Thanks if you can help me with this !!
    Thibault

  • [Solve]Set ibus as default IM when use other english language in gnome

    Hello everybody,
    I am satisfied with Arch + Gnome3 + Ibus in English language. With English language, Ibus is already set to default system-input-methods as well as I expected.
    However, today I change language from english to vietnamese, System-input-methods change to other method, not Ibus.
    I looked for programs to change input method such as im-settings, im-chooser and im-switch, but it's not exist in arch package or aur.
    I add "export GTK_IM_MODULE="ibus"" to file ~/.bashrc , I can use Ibus only in firefox, libreoffice. To use Ibus with other programs as gedit, gnome-terminal, I must manual change input method by right click and choose Ibus.
    So, How can I set Ibus as default system IM?
    By the way, I can use Ibus in all Qt applications without trouble after set in qtconfig.
    Thanks for reading.
    Last edited by s8dtvt (2011-06-25 01:56:18)

    Well, I set: LOCALE="vi_VN.UTF-8" instead of LOCALE="en_US.UTF-8" by default in file "/etc/rc.conf" and it's solved.

  • I bought a ringtone from iTunes yesterday and set it to default ringtone when given option however it is not there today, any help please?

    I bought a ringtone from iTunes yesterday and set it to default ringtone at time of purchase. Today it is not there, any ideas on how to get it again?

    http://support.apple.com/en-us/HT204076

  • Adobe Pro fires validation event when new page is created

    Adobe Pro fires validation event when a new page is created on many fields.
    When testing in Livecycle, I can add a new page fine, but with Adobe Pro a large list of errors appears and the fields are highlighted in red.
    The errors don't happen in other versions of Adobe.
    These are valid errors if the user tried to submit a field that is required and has not been entered yet, but the error happens when the page is initially created (added).

    I was able to get my role processor to work.
    EventHandlers.xml
    >
    <?xml version="1.0" encoding="UTF-8"?>
    <eventhandlers xmlns="http://www.oracle.com/schema/oim/platform/kernel"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.oracle.com/schema/oim/platform/kernelorchestration-handlers.xsd">
    <action-handler class="oim11g.code.eventhandler.RoleProcessor" entity-type="Role" operation="ANY" name="RoleProcessor" order="9999" stage="postprocess" sync="TRUE"/>
    </eventhandlers>
    >
    plugin.xml
    >
    <?xml version="1.0" encoding="UTF-8"?>
    <oimplugins xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <plugins pluginpoint="oracle.iam.platform.kernel.spi.EventHandler">
    <plugin pluginclass="oim11g.code.eventhandler.RoleProcessor" version="1.0" name="RoleProcessor"/>
    </plugins>
    </oimplugins >
    >
    Code:
    >
    public EventResult execute(long l, long l2, Orchestration orchestration) {
    String operation=orchestration.getOperation().trim().toString();
    HashMap<String, Serializable> parameters = orchestration.getParameters();
    System.out.println("<---------- Calling " + getClass().getName() + ": Operation[" + operation + "] Execute ---------->");
    System.out.println("<---------- Ending " + getClass().getName() + " Operation[" + operation + "] Execute ---------->");
    return new EventResult();
    >
    When i modified one of my roles, it output the following:
    >
    <---------- Calling oim11g.code.eventhandler.RoleProcessor: Operation[MODIFY] Execute ---------->
    <---------- Ending oim11g.code.eventhandler.RoleProcessor Operation[MODIFY] Execute ---------->
    >
    Hope this helps.
    -Kevin

  • Create folder - setting properties in default property screen

    Hello
    You can create a folder with following url: 'http://com.sap.cm/.?uicommand=new_folder'
    Setting Collection renderer to html renderer.
    This works fine.
    Now, I've got the requirement to modify the standard. I have an own property group which hangs in the default properties structure.
    I need to get a folder upload (with 2 additional input fields) and only my property group (already displayed, so I need to get rid of the link and show the properties).
    To start, I found the [One-Step-Screenflow tutorial|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/com.sap.km.cm.docs/library/netweaver/netweaver-developers-guide-2004s/NetWeaverDevelopersGuide2004s_Documents/KM_articles_new/howto/km/flexui/Implementing%20Flexible%20UI%20One-Step-Screenflow.html].
    But the requirement says we need, just as the standard, the default properties window of our own property group (just this tab) WITH the javascript checks on the mandatory fields.
    Do you have any clue how to achieve this? I looked already in the standard SAP code, but can't figure out how to achieve this one..
    Thanks for hints and tips.. or the solution of course
    Christof

    Hey Robert
    I opened 2 threads because I didn't know which title would attract attention + which solutions are possible. I propose we discuss this matter further in my other thread ( https://forums.sdn.sap.com/thread.jspa?threadID=1207836&tstart=0 ) because it's useless answering plus minus 2 times the same questions But I awarded you the points!
    So I close this one now..
    Christof

  • Though I have Firefox set as my default browser, when I click on the Firefox icon, Bing comes up as my browser. Why is this?

    If I go into my Bookmarks after Bing comes up as my browser and then click on Firefox, it comes back as my browser, but I don't like having to go through this extra step.

    Some free software includes an Ask toolbar.
    Try this:
    (1) Disable any Ask add-on (and all other nonessential or unrecognized add-ons) on these two tabs:
    orange Firefox button (or Tools menu) > Add-ons > Plugins category<br>
    orange Firefox button (or Tools menu) > Add-ons > Extensions category
    If you get a link above a disabled extension to restart Firefox, you can click that as the last step after completing your work on the tab.
    (2) Run the Search Reset extension to switch your search providers back to Google:
    https://addons.mozilla.org/en-US/firefox/addon/searchreset/
    (3) If your home page was changed, see this article: [[How to set the home page]].
    (4) Check for a user.js file that might override your settings the next time you start Firefox. See this article for the steps: [[How to fix preferences that won't save]].
    Does that solve it? Any other vestiges to root out?

  • Setting control to default value when it is a strict type def

    If my subVI has a control that happens to be a strict type defined cluster and I have saved the values in the control as the default values, how can I change them back to the default values of the type def (which are empty).  Because it is a strict type definition, i cannot click on the elements inside the cluster and modify them (e.g. click on an array inside the cluster and do an empty array operation.)
    In the attached screenshot, the control "BLE Meters To Test" is just an array of clusters and I was able to empty the array.  The control "Capture Data" is a strict type def.  I would like to clear the contents of this control without having to delete the control and add it back with a new instance of the same strict type def.
    Solved!
    Go to Solution.
    Attachments:
    screenshot.PNG ‏33 KB

    are you talking about edit mode or run mode?
    You could temporarily add a second instance of the typedef (all empty), then change it to a constant. Whenver you need to reset at run time, write the new digram constant to a local variable of the control.
    glstill wrote:
    Because it is a strict type definition, i cannot click on the elements inside the cluster and modify them (e.g. click on an array inside the cluster and do an empty array operation.)
    Make sure to click on the array container, not on the array elements.
    LabVIEW Champion . Do more with less code and in less time .

  • Template view fine in test browser but not when a page is created from it

    I'm trying to recreate a template page from my site using different code for the drop down menu at the top. The template behaves properly when i test it in Safari vs. 5.0.6 but when i test a page made from that template (using the File>New> Page from Template) it dosen't present with styles. Can anyone see anything wrong with the code? I checked both the code and the CSS using the validators.
    haworth.org/TEST2.html

    I put your HTML page (TEST2.html) and CSS file (body_new.css) on my server and it looks OK.
    http://www.ossiningdesignguild.com/TEST2.html
    It's possible your web server is not properly configured and sends a Content-Type HTTP header that says text/plain instead of text/css for your style sheet file.
    If you're using Apache, have your server admin check the httpd.conf file for MIME type settings.
    Should they need assistance, send them here:
    http://httpd.apache.org/docs/2.2/configuring.html
    This is not a problem with your main site since the CSS is embedded, rather than remote.
    I'll call you after lunch.
    Ken

  • How to change default properties when uploading role

    Hi, all.
    Our env. is like the following.
       EP 6.0 SP9 patch1
       J2EE SP9
       Windows 2003 MS SQL Server
    When we upload a role from R/3 to EP, role is correctly uploaded but the problem is the following default behavior.
    - default property of entryPoint for role is set to "false"
    - default property of GUI type for Transaction iView is dependent on the GUI support of R/3 SE93(Maintain Transaction Codes)
    Is there any way to change these default settings to some other values in EP without modification?
    What we want to do is that when we upload roles, we want to set the following values by default.
    - entryPoint = "true"
    - GUI type = "SAPGUI for Windows"
    One way would be to use Content Administration --> Multiple Property Replacement feature but we want to reduce our operation time more.
    Thanks.

    Hi Sejoon
    Even i'm in the same situation, i tried modifying transaction type in the
    com.sap.portal.appintegrator.sap.bwc.Transaction which is iview template for all the iviews created on import of roles..but it also dint work.
    yeah Multiple replacement is not the best of the option,
    let me know if u have figured out something.
    -Krishna

  • Default property values

    Is there any way of setting system wide default property values in Windows XP? For example, I want to set the extensions directories to point to a common jar directory for all java programs I run on my computer. Or I want to set the JDBC driver properties for all programs. Any easy way of doing this?

    Use some wrapper script?

  • Default valuation type when issuing material or Creating Delivery

    Hi,
      We have some material manage with valuation type  X,   Y,  Z   while creating PO  we are entering Valuation type in PO as per requiremtn   but i want that  whenever we issue the material  with 201   or creating delivery of that material with VL01N or VL02N  default valuation type should be    'Y'  so how to set this as default.
    regards,
    zafar

    You will need to create a stock determination strategy and stock determination rule  and assign it to the material master.
    use TCODE : OSPX.

Maybe you are looking for

  • A/P Invoice Draft convert to actual A/P Invoice Error

    Hi all, I had a problem as of mention in the Subject header. First of all, I am using SBO 2004.2B and 2004 SDK. I had created a small program to read in text file to create A/P Invoice Draft, no problem up till now. However, when I convert the A/P In

  • Transferring apps from blackberry curve to iphone

    my son bought me a new iphone and I was wondering if there was a way I can transfer software programs from the blackberry curve to the iphone? Solved! Go to Solution.

  • This computer is not authorized to play this song

    This message appears to be bugging hundreds (thousands?) of Mac users when they use DRM protected music from iTunes within iMovie & iDVD - I believe Apple are working on the fix - anyone know when its due?

  • Rendering out

    Hello, I am using AE CS 5.5. I created a composition 1440x 1080 that will be shown on closed citcuit TV. Its just animations of various graphics. No live action video. When I was done, I rendered it out, Quality: best, Resolution:full, size: 1440x 10

  • WIM Integration with MS Dynamic CRM

    I have the below query on WIM 9.x 1. How to send the chat transcript or any information to MS Dynamic CRM 2. Search a CRM record from WIM GUI and tag the current chat transcript to CRM Appreciate if anyone can help me on this. Thanks in advance. Rohi