Set the properties VALIDFROM / VALIDTO programatically

Hi all,
I need to upload a document into KM from a WD with the lifetime properties.
I have the following code:
java.text.Format fo = new SimpleDateFormat("MM/dd/yyyy hh:mm:ss");
PropertyName propertyName =     new PropertyName("http://sapportals.com/xmlns/cm/tbp" , "VALIDFROM");
IProperty property = new Property(propertyName, fo.format(wdContext.currentContextElement().getDataInici()));
The document is correctly uploaded in my repository, but the property "VALIDFROM" and "VALIDTO" is always the date and hour where document has been uploaded.
Is a problem of format of the value I give to the property?
Time-dependent publishing has been enable for the folder where I store the documents.
Any hint?
Thanks!

Hi,
I had provided solution to the similar requirement for one of our customers. Here is the code.
Step 1: You have to create a Portal component of type Repository Framework type.
Step2: Write the following code:
public void received(IEvent event) {
          try {
               IResource createdResource = (IResource) event.getParameter();
               if (createdResource == null)
                    return;
               location.infoT(category,"TBPEventHandler.received():created resource");
               ITimebasedPublishServiceManager tpbService =
                    (ITimebasedPublishServiceManager) ResourceFactory
                         .getInstance()
                         .getServiceFactory()
                         .getRepositoryService(
                              createdResource.getRepositoryManager(),
                              IWcmConst.TIMEBASED_PUBLISH_SERVICE);
               if (tpbService != null
                    && event.getType() == ResourceEvent.CREATE_CHILD) {
               location.infoT(category,"TBPEventHandler.received():tbpservice() not null");
                    // set properties
                    //IResource createdResource = (IResource) event.getParameter();
                    IProperty validFromPropertyName =
                         createdResource.getProperty(
                              new PropertyName(
                                   "http://sapportals.com/xmlns/cm/tbp",
                                   "VALIDFROM"));
                    IProperty validToPropertyName =
                         createdResource.getProperty(
                              new PropertyName(
                                   "http://sapportals.com/xmlns/cm/tbp",
                                   "VALIDTO"));
                    IProperty documentClassPropertyName =
                         createdResource.getProperty(
                              new PropertyName(
                                   "http://ocs.co.uk",
                                   "document_class"));
                    IMutableProperty mutablevalidToPropertyName =
                         (validToPropertyName != null
                              ? validToPropertyName.getMutable()
                              : new Property(
                                   new PropertyName(
                                        "http://sapportals.com/xmlns/cm/tbp",
                                        "VALIDTO"),
                                   new Date())
                                   .getMutable());
                         location.infoT(category,"TBPEventHandler.received():created mutable propertyname VALIDTO");
                         String documentClassAtt =
                         (String) documentClassPropertyName.getValue();
Date validFromAtt = new Date();
                              if (validFromPropertyName != null)
                                   validFromAtt = validFromPropertyName.getDateValue();
                              String validityPeriod = ResourceBundles.getBundle(TBPEventHandler.class.getName()).getString("report.validity");
                              int validityYear = Integer.parseInt(validityPeriod);
                              Calendar fromCal = Calendar.getInstance();
                              fromCal.setTime(validFromAtt);
                              fromCal.add(
                              Calendar.YEAR, validityYear);
                              java.util.Date toDate = fromCal.getTime();
                              mutablevalidToPropertyName.setDateValue(toDate);
                              createdResource.setProperty(mutablevalidToPropertyName);
                              tpbService.saveInvalidDate(createdResource, toDate);
Note: You need to modify the code here and there.
Step 3: Deploy this portal service in Global Services in KM, once deployed select this service for the folders which you want to apply this service.
step 4: Re-start the portal server (without restarting the service will not work)

Similar Messages

  • How to set the properties

    If I want to use java ORB to visit Visibroker ORB , how to set the Properties for init ?? can you help me ?
    thanks !

    System.setProperty("org.omg.CORBA.ORBClass","com.inprise.vbroker.orb.ORB");
    System.setProperty("org.omg.CORBA.ORBSingletonClass","com.inprise.vbroker.orb.ORB");You can get some examples here:
    http://maris.site.lv/ejb.html
    best regards,
    Maris Orbidans

  • Creating a PDF-file with CONVERT_OTF. How to set the properties?

    Gents, Ladies,
    I have an ABAP that uses CONVERT_OTF and creates a pdf-file. This works fine but now the security properties of the pdf-file need to be set to not-modifiable (See File, Document Security in Acrobat's Reader).
    Can any of you help me to set any of the properties of the pdf-file?
    Best regards,
    Tim van Steenbergen.

    Hi tim,
    sorry, it's not possible (see Steff's posting)
    http://www.abapforum.com/forum/viewtopic.php?t=318&highlight=pdf
    grx
    Andreas

  • How to set the properties of plots in XY graph via VI Scripting

    Hi,
    Is there any way out to change the properties of XY graph plots through VI Scripting? 
    From main VI, I create an XY graph in another VI through VI scripting. I now want to change the Plot legend names, and their styles etc. I notice that these properties can be set up in the new VI (See screen shot Graph Property Node in NEW VI.jpg). However, I couldn't see these properties by calling the property node of XY graph reference in main VI (see screen shot ).
    Thanks for the due response.
    Regards
    HB
    Solved!
    Go to Solution.
    Attachments:
    Graph Property Node in NEW VI.jpg ‏1527 KB
    Graph properties in main VI.jpg ‏959 KB

    Hello HB,
    I see plot.names when I scroll down a bit further. No scripting required.
    Hope this helps.
    Uli
    Attachments:
    plot.names.png ‏74 KB

  • Set the properties Editor of Add-in for Outlook 2007

    Hi All,
    I've developed an add-in for outlook 2007, the setup doesn't give any errors but when I open the Outlook the add-in is disabled.
    May be because is the only add-in with <any Author>.
    How can I set this properties in visual studio 2010?
    Thanks,
    Thomas

    Hello Thomas,
    First of all, check out the Trust center settings in Outlook. Are macro security settings applied to add-ins as well? Are only signed add-in allowed to run?
    Microsoft Office applications can disable add-ins that behave unexpectedly. If an application does not load your add-in, the application
    might have hard disabled or soft disabled your add-in.
    Hard disabling can occur when an add-in causes the application to close unexpectedly. It might also occur on your development computer
    if you stop the debugger while the Startup event
    handler in your add-in is executing.
    Soft disabling can occur when an add-in produces an error that does not cause the application to unexpectedly close. For example, an application
    might soft disable an add-in if it throws an unhandled exception while the Startup event
    handler is executing.
    When you re-enable a soft-disabled add-in, the application immediately attempts to load the add-in. If the problem that initially caused
    the application to soft disable the add-in has not been fixed, the application will soft disable the add-in again.
    Read more about that in the How to: Re-enable an Add-in That
    Has Been Disabled article.
    P.S. You need to sing the add-in files with a digital signature to see the author name in Outlook. 

  • Creating Items and setting the properties programtically

    Hi ,
    Can any one provide me some details of how to create item programatically and setting its properties.
    Ex: I have to create a message choice
    set its id, picklist view definition ,picklist display attribute, picklist value attribute, prompt, action type and event
    Regards,
    Krishna

    Hi Krishna,
    OAMessageChoiceBean abc = (OAMessageChoiceBean) createWebBean
    (pageContext, MESSAGE_CHOICE_BEAN);
    abc.setPickListViewUsageName("ListVO");
    abc.setListValueAttribute(" ");
    abc.setListDisplayAttribute(" " );
    abc.setID("ID");
    this wl help u I guess..
    for more details Refer JDev Guide.

  • Cannot set the properties of an itemrenderer in sdk 4

    Hi,
    I have a project working in sdk 3 that creates an item renderer for a grid, and passes the field index to the renderer. In sdk 4, the
    property is null. Is this a bug? (code truncated)
    <?xml version="1.0"?>
    <mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml" horizontalScrollPolicy="off" verticalScrollPolicy="off" horizontalGap="5" paddingLeft="6" implements="mx.core.IFactory">
        <mx:Script>
            <![CDATA[
                [Bindable] public var fieldIndex:int = -1;
                public function newInstance():*
                    return new statusItem();
                override public function set data(value:Object):void { 
                    super.data = value;
                    var status:String = "";
                    var statusImg:String = "";
                    if (value != null && value.length > 0 && fieldIndex > -1)   {
                        status = value[fieldIndex];       
                        if (status != null && status.length > 0) {
                            switch(status.toLowerCase()) {
                                case "open" : img.source = Icon1;
                                            break;
                                case "closed" : img.source = Icon2;
                                    break;
                                default : img.source = Icon9;
                                    break;
                    else {
                        img.source = errorIcon;
            ]]> 
        </mx:Script> 
        <mx:Image id="img" source="{blankIcon}" verticalAlign="middle" width="10" height="10" /> 
        <mx:Label id="lbl" text="{data[fieldIndex]}" /> 
    </mx:HBox> 
    parent code
    var sRenderer:ClassFactory = new ClassFactory(statusItem);
                                                sRenderer.properties = { fieldIndex: x };
                                                dgc.itemRenderer = sRenderer;
    It is simple code that works in version 3, but not in version 4.
    thanks,
    Jon

    Okay, I cant remember whether it was NULL.
    All I know is that it is not being set using SDK 4 and it works perfectly in SDK 3.
    Jon

  • Upon Loading of page, Setting the Top and Left properties of a TextField

    Hello again,
    I would just like to ask for suggestions on how to successfully set the top and left properties of a Textfield as soon as the page is loaded.
    Thru Giri's help, I was able to do this with the push of a button. What I would need to do right now is to set it as soon as the page is loaded.
    Thanks!

    Hi Jim,
    It is not clear what you are trying to do here. If you want to set the top and left properties of a component when the page is loaded all you have to do is set it at design time itself. If the properties need to be set the second time the page loads then the code can be used in the event handler which submits the page.
    It would help if you could explain the use case for setting the properties of a component when the page is loaded.
    Cheers
    Giri

  • JMS Adapter setting the header data of MQ message

    Hi All,
    I need to set the properties in JMS adapter for setting the header data of MQ message.
    JMS_IBM_MQMD_Format = MQFMT_NONE.
    Thanks in advance
    Ravijeet

    Hi All,
    I am stuck in a typical XI issue.......I have a scenario where my input to XI is IDoc and output is xml message going to IBM MQ.
    The IDoc is sending some chineese character which is fine is SXMB_MONI Integration server and also fine in the payload of message monitoring, so feel the message is going fine from XI to MQ.
    But the receiver EDI system which is picking the message from MQ queue says the chinese characters are getting corrupted. They say that you need to set the additional properties in MQ header data
    JMS_IBM_MQMD_Format = MQFMT_NONE.
    How do I do this in communication channel for jms adapter ? How to I set the MQ header data in jms communication channel ?
    Thanks in advance
    Ravijeet
    Edited by: RAVIJEET DAS on May 12, 2009 8:27 AM
    Edited by: RAVIJEET DAS on May 12, 2009 8:27 AM

  • How to make the properties visible for a bean in IDE?

    Hi,
    I have a jpanel and have two buttons ,OK and cancel inside it.
    I made this class as a bean, and put in the component palette of IDE.
    Now when i click and drop that bean in a frame., and try to set the properties, the IDE will be giving me only the outer component which is a JPanel properties,
    I want to work with the properties of inner components OK and Cancel.
    How can i acheive this?

    Yes, Write wrapper methods for the properties you are interested in. Introspection does not examine beans which are declard in a class in IDEs, IT only follows an inheritence tree.
    So if you have a button and want it to be visible in your new bean, you will have to expose the properties of the bean again using wrapper methods. You could use the propertyChange model to notify the button on property changes.

  • Essbase Studio--cannot set essbase properties at parent level

    Hi,
    I have a recurssive hierarchy product dimension.Source is an oracle table something like
    Parent child alias
    P p1 ap1
    p p2 ap2
    p1 p11 ap11
    p1 p12 ap12
    I have an self-join between parent and child column and have no issues related to hierarchy building
    However i am able to set an alias to all other members except the member P.
    Any advice on the issue will be helpful!!!
    Regards,

    Is P the Dimension name?
    For example the dimension is entity and the hierarchy is
    Entity all entities
    Entity Alternate pollup
    All Entities zzz
    If so, you would set the properties directly for the Dimension member
    IF it is not, then can you add where P is a child of the dimension member?
    In recursive hierarchies, you should only be setting the properties on the child members as they should be the parent of other members or the level zero members themselves

  • Problem while setting the property of column in ALV

    Hi ,
    I have created a alv dynamically and setting the properties of the column like column header text but its not getting updated .
    see the below code for ref.
    lr_column_settings ?= lr_config_table.
      data:
        lt_columns type salv_wd_t_column_ref.
      lt_columns = lr_column_settings->get_columns( ).
      data: lr_column      type ref to cl_salv_wd_column,
        lr_header      type ref to cl_salv_wd_column_header,
        ls_column type salv_wd_s_column_ref.
      loop at lt_columns into ls_column.
        case ls_column-id.
          when 'MOIST'.
            lr_column = ls_column-r_column.
        lr_header = lr_column->get_header( ).
        lr_header->set_text( 'Moisture %' ).
    I am able to set the alv properties like  visible row count etc ..
    can anybody help out in this issue
    Regards
    Yash

    I was just able to change my headers with the following:
    data:
        lt_columns     type salv_wd_t_column_ref,
        ls_column      type salv_wd_s_column_ref,
        lr_header      type ref to cl_salv_wd_column_header.
      lt_columns = lo_value->if_salv_wd_column_settings~get_columns( ).
      loop at lt_columns into ls_column.
        lr_column = ls_column-r_column.
        lr_header = lr_column->get_header( ).
        lr_header->set_ddic_binding_field( if_salv_wd_c_column_settings=>ddic_bind_title ).
        lr_header = lr_column->create_header( ).
        case ls_column-id.
          when 'CNT_LINEITEMS'.
            lr_column->r_header->set_text( 'Line Items' ).
          when 'VAL_OPEN'.
            lr_column->r_header->set_text( 'Open Amount' ).
          when others.
        endcase.
    endloop

  • Setting the proxy in the JRE

    Hello all,
    I was just wondering how I can set the proxy I use in the JRE. If possible how I can set the auto configuration script but failing that setting the proxy server and port number would be fine.
    Thanks

    You can set the properties http.proxyHost and http.proxyPort (see http://java.sun.com/j2se/1.4/docs/guide/net/properties.html). If you need to authenticate take a look at http://www.developer.com/java/other/article.php/1551421

  • Setting the height of detail section with RAS SDK

    Hi, all,
    is it possible to locate a section (CrystalDecisions.ReportAppServer.ReportDefModel.Section) in a reportk you and set its maximum height?
    When I find a detail section in question like so section = reportClientDocument.ReportDefController.ReportDefinition.DetailArea.Sections[counter];
    it just gives me the height of one row.
    Is there a way to set a maximum size of it?
    Thank you!

    Hi Jelena,
    see the below sample to add a new section to the report.
    http://scn.sap.com/docs/DOC-6025
    in the sample, see below code how the section properties are set.
    //Set the properties for the section
        boSection.Kind = CrystalDecisions.ReportAppServer.ReportDefModel.CrAreaSectionKindEnum.crAreaSectionKindDetail;
        boSection.Name = "Detail2";
        boSection.Height = 1000;
        boSection.Width = 11520;
    Refer to above sample and write your own code to identify the section and then set the properties.
    Othe RAS SDk samples are here.
    http://scn.sap.com/docs/DOC-28646
    - Bhushan
    Senior Engineer
    SAP Active Global Support
    Follow us on Twitter
    Got Enhancement ideas? Try the SAP Idea Place
    Getting started and moving ahead with Crystal Reports .NET applications.

  • IOS initial setup: can't set wifi properties eg proxy

    Problem:  The wizard that starts for setting up a new IOS device lets you select a wifi point to connect to, for which you'll be prompted to enter a password but it's missing the usual ">" menu where you can enter further settings such as a proxy.
    If proxy settings are mandatory the device cannot connect to the internet to progress through the wizard.

    Div is ver dodgy (doesn't give any line break at all in some email clients)
    Show me an example of code that doesn't give a line break with <div>.  Sorry, I just don't believe this.
    Span is even worse
    But who would use that anyhow?
    Float is an absolute disaster.
    That's not my experience.
    What do you use to attach the inline styles to?
    <p> tags or <div> tags work OK for me.
    We still get templates from our clients (who are big corporations) that are all table-based.
    Then you don't have much choice.  Just make sure that the code is valid before using them.
    I tried it in design view but it just inserts the table - I'm not getting the dialog box where you can set the properties.
    You should be - I don't recall what it is you have to do to retrieve this.  Have you tried uninstalling and reinstalling?

Maybe you are looking for