New Property for Simple Publish portlet

Hi,

Apart from the current fields name, desc, file in the simple publish portlet, I need to create a couple of other properties. Can anyone tell me how to do so?

Also, once the file is uploaded, and I click on the Properties for that file, these new property fields should be there showing the values I entered during initial publish.

Thanks a bunch
Rejo

This can be done by creating a new ‘sub-type’ of the content type. Using the Portlet Developer Wizard, create a new Dynamic Business Object. Add whatever properties you like.

Then, from either the Publish Portlet or the Portal Page Editor, create a new content->Your New DBO and specify whatever properties you added at design time.

Regards,
–mark

Thanks Mark, It works.

Can you also let me know how to make these custom fields searchable?

THanks again
Rejo

In the header, there is a link that will take you to an advanced search screen. From that screen you can choose the type of object (dbo) you’re searching for, and then choose the fields you’d like to query on.

I’ve also created simple html forms that duplicate this so a user wouldn’t have to go to the advanced search.

Hi Mark,

Is there any way I can call this new publish DBO via a URL such that I can define the parent ID where the content will be published?

Right now the user will have to go to Publish, select the custom DBO and then specify the parent and item to publish. We need to avoid the “parent resource selection” step as user might not know the correct location. It is possible by setting the Alias as current.resource, but what if I need to publish to a target which is not the current resource for e.g. within a portlet which has a target(in this case current.resource would be the portlet which is incorrect)

Thanks again
Rejo

Rejo,

You may want to look into using an instance of the ‘PublishContext’ portlet to render a link or button that will pre-fill some of the fields of the Publish portlet for the user.

Hi Enorman,

Thanks for your help; I was able to achieve what I wanted using the Publish Context portlet.

One minor problem though, setting the Finish and Cancel URL does not seem to work for this portlet. Currently it brings it back to the previous page or the the main publish portlet no matter what the URL I put.

Thanks Again
Rejo

Hi

Any update on this issue.
I am facing problem with the cancel and finish url of the portlet.
I want to change it but when currently it brings back to publish portlet page.
Is there any way to change it?

Thanks
Nilesh

That seems strange. I have just tried to use Publish Context portlet and its finish/cancel url worked for me.

Might worth looking at the logs from the point when you click to publish a content and then click finish at the end. When getting logs could you please restart portal in debug mode to get most information by adding “-d” key to the command line params.

<server_name>/bin/run.bat -d

Alex

Hi,

I have used a custom DBO as mentioned and created some custom properties. Now when I Publish using this portlet, I enter the values of the new fields (which i have kept mandatory). But after a while when i click on the Properties for the published content that property is blank.

Do I need to do something to make this property persistent? Is it stored in the database?

Even after I view the Properties and enter a new value and click Apply, it stays for the time being. But after a while the value disappears again.

Thanks

Could you please check that no errors are reported in the MWS logs when you update an object. Also you could simply check the database table for the DBO type if they contain property values you enter. The table name is usually derived from the DBO type name, should be “t_”

Alex

Hi Alex,

I guess that is the problem; I cannot find a table with the format you specified. I have installed the DBO using the Install Administration but the table still does not show up.

Have I missed something?

Thanks Again.

Could you send me your DBO project please: alex.oleynikov@webmethods.com and remind what version of the portal you have in use?

Alex

Thanks!. So I have mistakenly thought you were using 6.5.2 Portal which is uses a different storage way for DBOs. Your DBO is different, it contains generated sql scripts for its storage (you may explore sql/ folder under your source). The table it is storing its properties is named:

tblwPublishe551

Hi Alex,

Thanks for your analysis. I am currently using portal6.5.2. I was able to locate the table. On publish using this custom publish DBO I dont see any data entered into the table. Logs dont show any error either. Is it something wrong with the installation?

Thanks

I have looked again at the DBO and I think there is a problem. Like I have mentioned the DBO itself was made with prior than 6.5.2 version of Portlet Developer (which should work just fine in the 6.5.2 Portal if you do not modify its later), however it looks like later you either upgraded to the new 6.5.2 Portlet Developer and modified this DBO properties. Unfortunately this is not allowed.

What I could recommend you to do is to create a brand new DBO using your latest Designer (of course give it a different name to avoid problems). If you create a DBO please note if it generates sql scripts for you or not - if everything is correct you should not see any sql script generated (6.5.2 does not require them)

Hi Alex,

I created a new DBO type of Type content and it seems to be storing data now.

If I need to re install my old DBO, would it be ok to totally remove from the portal by first uninstall and then using the wm_remove_portlet and finally installing it again?

Thanks

Hi Alex,

I was able to set up a new working version of this DBO with custom properties.

One more question, how can I get these fields to be searchable when you do a normal search?

Thanks

We have actually cloned the existing Search/Advanced Search code. So is it possible, to include these custom fields programmatically in the search.

Thanks

Yes by default any new attributes of the DBO are not indexable. You will need to create a Mechanics class for your DBO and implement ISearchableMechanics interface which allows you to supply an additional stream of indexable tokens to the search service. Below are javadocs for the interfaces you will need to implement:

/**

  • Class ISearchableMechanics is used so portlets and DBO’s may index its custom attributes

/
public interface ISearchableMechanics {
/
*
* This method returns content source for the specified uri. The content source
* will be indexed by search service. May return null
* @param uri
* @return valid content source for the uri or null
* @throws PortalException
*/
IContentSource getContentSource(IURI uri) throws PortalException;

/**
 * Implements additioinal matching for search service. Custom implementation may do
 * additional filtering for item matching the searchQuery. By default should return true
 * @param uri item to be matched
 * @param searchQuery search query to be matched
 * @return
 * @throws PortalException
 */
boolean match(IURI uri, ISearchQuery searchQuery) throws PortalException;

}

public interface IContentSource {
/**
* Returns input stream for content to read data from
* @param releaseStream if true than implementation of content source should keep track of
* opened stream and close it when necessary (usually when its internal state gets released
* on during finalize)
* Set it to false if you want to control when to close stream
*/
public InputStream getInputStream(boolean releaseStream);

/**
 * Gets mime type for the content
 * @return mime type
 */
public String getMimeType();

/**
 * Releases all allocated resources, such as streams, open files.
 */
public void release();

}