A day lost due to DDE incapabilities

Today I lost a complete development day due to errors related to DDE. After building a project I constantly get errors as followed:

HTTP JVM: com.ibm.xsp.webapp.FacesServlet$ExtendedServletException: javax.faces.el.EvaluationException: java.util.MissingResourceException: Can’t find resource for bundle java.util.PropertyResourceBundle, key strings

and:

HTTP JVM: java.lang.SecurityException: Error verifying signature for resource WEB-INF/classes/se/acme/namis/app/Application.class. For more detailed information, please consult error-log-0.xml located in E:/IBM/Domino/data/domino/workspace/logs

The way I am forced to work now is to clean the project, build the project, sign the complete database, PRAY.

Is there no way to build an XPages project OUTSIDE of DDE?

This is no workable way of developing anymore.

XPexit?

Advertisements

Passing a SSJS function to a custom control

Introduction

I am building a custom control that mimics the viewPanel control but it is a repeat control which data is not a view but a managed bean that returns an arraylist of java objects (representing Notes documents).

I am using a Bootstrap table for display I in a previous post I have demonstrated how I can provide a JSON object to have flexibility in the columns I want to display and the values I want to display.

Next step is the option to provide custom actions to the custom control, in a way that the code under an action button in the custom control is provided via a property. So in one case hitting the button could print all selected documents, in the other case it could remove all documents from the database.

Step 1 – Creating an arraylist of unid’s

Key here is that I have an arraylist of unid’s to work with. The technique how to select documents in a repeat control was demonstrated by David Leedy in Notes in 9 episode 25. Instead of buttons I use a checkboxgroup:

So now I want from my xp:button in my custom control do something with this arraylist of unid’s…

Step 2 – set up the property definition

Next step is to setup the property in the property definition of the custom control:

Not the most common type of class and editor you use for a property.

Step 3 – setup the event handler for the button

In order to have the button to understand that the action to be performed is coming from a action property we need to specify that in the onClick event:

(Note: my property resides in the group property actionButton)

Step 4 – set up the SSJS  function you want to run

So now our button knows it’a action comes from a propert we need to write the SSJS function for the button. I have placed it in a SSJS script library. Here is an example to remove documents from a database:

Step 5 – Add the SSJS to the property

The last step is the most tricky one. In the property you are not allwed to provide any parameters or parentheses for the SSJS function. So our action property becomes as followed:

Result

As a result I have the following UI:

  • A custom control with a button which onClick action is provided via a property on that host xpage.

IBM Champion Nomination

Is this blog-article useful to you? Perhaps you can nominate me as IBM Champion.

A generic approach to display Notes data via a Bootstrap table

This week I became inspired by a question I noticed on Stackoverflow regarding collecting values from Java objects.

For a project we were discussing what to use for display “Notes View data”:

  • jQuery DataTables plugin and use a customRestService via a Java class as data provider for the JSON.
  • a Repeat control and display an Arraylist of Java objects.

Some of the participants liked the jQuery approach because it provides a lot of functionality out of the box (sorting, search, responsiveness,…) and their lack in knowledge regarding Java.

Others were questioning of the Repeat control approach would be flexible enough so we could display easy different sets of data with different number of columns.

So… to the drawing board.

Mostly in Notes views (e.g. via the View Panel control) one column serves as link (often the first) and all others just display data of all kind. In the DataTables plugin the display is flexible because you can define a custom render function for each column which is great. So you could display a button that will call a dialog to interact with the underlying document for example. However this custom render definition resides in a CSJS library so becomes part of the design.

I had already a custom control that could consume properties for the data and how to set a fixed set of columns. So the last part I needed to make flexible.

Because I have an arraylist of Java objects as source for my Repeat control I need to access the fields “on the fly” when rendering the column values. This turned out to be quiet simple because the fields are already in my Java object.

In my approach I provide the columns via a JSON object that could look as followed:

dyntable00

 

And for my columns I repeat it and collect the value from my underlying Java object:

dyntable01

Note: my code is not final, I would to define more types of data and the option to provide a custom render function for each column. So far I only have computation for string and date fields.

I also applied some basic functionality as Pager controls (top + bottom), a Page Sizer control, icon display and row numbering.

Here is what a result might look like:

dyntable001

Nothing special but now now I have just one custom control to display 80% of my tables/views.

Here are the GIST files for the custom control and its configuration xml file.

IBM Champion Nomination

Is this blog-article useful to you? Perhaps you can nominate me as IBM Champion.

Using the beanNamePicker dataProvider for a namepicker

For an application I needed to provide a namepicker with data from a NotesView. Unfortunately I could not use the default dominoViewNamePicker option as the data provider because the column to select from may not be a multi-value field or contain multiple fields. 😕

A search on google provided me an example how to use a beanNamePicker that will read the data from Domino Directories.

I created a GIST for the XPage: https://gist.github.com/PatrickKwinten/0bcc951a8eb1f5ef287c0c9b05a535a3 and for the Java class it uses: https://gist.github.com/PatrickKwinten/4aa15ea09717833bcc9fd1a941d9e5a8 .

Basically here is how you set it up:

<xe:namePicker id=”npDomino” for=”person1″>
<xe:this.dataProvider>
<xe:beanNamePicker dataBean=”org.wordpress.quintessens.demo.app.NamePickerDirectory”
loaded=”true”>
</xe:beanNamePicker>
</xe:this.dataProvider>
</xe:namePicker>

Key is that you return an object of type SimplePickerResult containing a list of objects of type <IPickerEntry>.

For my case I needed to go to a view where all the activities for users for the application where logged. Again I used a similar setup:

<xe:namePicker id=”npDomino” for=”person1″>
<xe:this.dataProvider>
<xe:beanNamePicker dataBean=”org.wordpress.quintessens.demo.app.NamePickerView”
loaded=”true”>
</xe:beanNamePicker>
</xe:this.dataProvider>
</xe:namePicker>

But now I go to a different class which I created a Gist for: https://gist.github.com/PatrickKwinten/c3580344a48704b3589251c0d5bbb8e5 .

Key difference is that my data source has become a Notes view and I check the type of column (columnValue instanceof String, ArrayList, Vector) because I have different type of fields and values in my first column.

So once you understand how you can extend the basic functionality within XPages you gain much flexibility and new opportunities with out of the box controls.

Please IBM provide us with more examples!!!

IBM Champion Nomination

Is this blog-article useful to you? Perhaps you can nominate me as IBM Champion.

 

 

Java and XPages

I still meet Domino developers who want to use XPages in the way IBM told them how to use it. Completely wrong I would say. Now that you have to chance to learn Java skills – EMBRACE IT!

Okay the other way around is sometimes a pain in the ass and complete examples are scarce but it gives you a better way to control your application and it’s behavior. After a while you get better understanding of the underlying technique and there is nothing wrong with that.

At the end it is mostly about creating, reading, updating and deleting stuff.

So for those developers I have setup a simple presentation to get a better understanding of JSF, Java and XPages:

DDE does disruption (4) – xHausting

Yes, DDE is disruptive again!

Today I wanted to copy some code from one application into another, straight via DDE, an a phenomena that I experienced earlier occurred again:

Most XPages and Custom Controls became signed with my Notes ID

With most I mean ALL XPages (20) and most Custom controls (31 out of 34). All other design elements in the NSF (forms, views, pages, agents, script libraries, java design elements, java libraries etc were untouched.

At the moment I had only open: one server-side JavaScript library and one XPage.

Do you have any explanation for this?

I am running 9.0.1 FP 9.

DDE does disruption (3) – Perhaps DDE is not build for it?

I am still complaining about DDE because I am facing the following situation:

I am working with a colleague on a project. Our code resides in a central repository on TFS. We both develop with a local clone and we sync towards our own NSF on a Domino server where we do our development work. The problem  is that she is unable to build the project and have her NSF running. I do not have those problems but perhaps that is because I have written most code lately. When I build HER NSF, the application WILL run.

We have a similar setup (version DDE, installed plugins).

When she performs a clean, build, refresh she does not get errors or anything whatsoever. What might cause that her build process does not succeed or complete?

DDE does disruption (2)

For some reason I was unable to open JavaScript libraries in the JS editor in DDE. It concerned both client- and server-side libraries. LotusScript and Java libraries I could open just fine.

The only thing I could see was this:

The problem was not concerned all databases, but at least the problem was consistent in multiple NSF’s. Building and refreshing the project no effect. Also removing the applications from the workspaces, restarting DDE and re-opening the NSF’s did not change the editor’s behavior.

At this point I was getting a bit annoyed. Colleagues reported similar problems in the past but none had a suggestion other than re-installing the client.

So I let my stubbornness win and installed Feature Pack 9 instead. After 10 minutes (!) the installation was complete so I started DDE and opened the unwilling script library. Hurraaaah! The problem was solved, I could see the code in the editor.

However I noticed some missing in DDE: the nice Swiper 2.0.1 toolbar buttons where gone! So I removed the files from the notes/data/workspace/applications folder, downloaded Swiper from OpenNTF again and installed them. Back to normal. Well not quiet yet.

When working on an XPage I noticed that all the plugins I was using where not recognized anymore. For example the Debug Toolbar plugin. Again, I could not see the plugin disabled under Application Management. So I removed the files, downloaded the plugin from OpenNTF and re-installed it. Now the plugin was visible again in DDE.

So the feeling I am left with is that this Superhuman Software is not so Superhuman anymore.

Adding fontawesome to bootstrap alerts

In an XPages application I wanted to add some house-styling to a validation alert box. By default you do not get icons with Bootstrap alerts as in the IBM’s OneUI messages box.

So what do you when you want to have best of bot worlds? You blend in Fontawesome!

Navigate to any of the icons you want to use from fontawesome and search for the unicode of it. For the exclamation icon http://fontawesome.io/icon/exclamation-circle/ that is f06a.

Next open your style sheet and add the following lines:

ul.text-error {
list-style: none;
padding: 0;
}
ul.text-error > li {
padding-left: 1.3em;
}
ul.text-error > li:before {
content: “\f06a”; /* FontAwesome Unicode */
font-family: FontAwesome;
display: inline-block;
margin-left: -1.3em; /* same as padding-left set on li */
width: 1.3em; /* same as padding-left set on li */
}

For the content property add the unicode as demonstrated above. When you look at the alert in your browser the icon is applied e.g.:

 

DDE Does Disruption

This week we received an incident about an application that was not accessible any longer. It turned out that all the design elements where signed with my Notes ID which has (of course) insufficient rights to run in the Production environment.

The curious case here is that nobody intentionally replaced or refreshed the design of the application.

The application still had the “inherit design from template” option enabled. However the template resides on a different server and there is no replication between the Production and this staging server.

I know I have the two databases somewhere in a Working Set in my Domino Designer so most obvious option for the design refresh must have come from my workstation even though I have not worked with these applications this week .

Have you experienced something similar also? What was the cause?