Wednesday, April 20, 2011

Adobe LiveCycle ES2.5 Migration Woes

So recently I had to migrate LiveCycle ES to ES2 / ES2.5

Surprisingly the install and deployment of the application went smooth. When I got Workbench installed and everything up and running it was time to migrate the old forms over to a new application and get everything working. All was well until I hit the Deploy button.

The resource [resourceUri] is exclusive-locked by user [userId].

When this used to happen in LiveCycle ES there was always an unlock option in the context menu, in ES2.5 it's nowhere to be found. Numerous calls to Adobe Support no help. Until today I stumbled upon Locking a resource using the Java API. I'm not sure where this was before but it contained some valuable information. So I quickly wrote up the source for my server running on WebSphere 6.1.

import java.util.*;

import com.adobe.idp.dsc.clientsdk.ServiceClientFactory;
import com.adobe.idp.dsc.clientsdk.ServiceClientFactoryProperties;
import com.adobe.repository.bindings.dsc.client.ResourceRepositoryClient;
import com.adobe.repository.infomodel.bean.*;

public class UnlockFile {
 public static void main(String[] args) {
  try {
   Properties connectionProps = new Properties();
   connectionProps.setProperty(
     ServiceClientFactoryProperties.DSC_DEFAULT_EJB_ENDPOINT,
     "iiop://myhost:2809");
   connectionProps.setProperty(
     ServiceClientFactoryProperties.DSC_TRANSPORT_PROTOCOL,
     ServiceClientFactoryProperties.DSC_EJB_PROTOCOL);
   connectionProps.setProperty(
     ServiceClientFactoryProperties.DSC_SERVER_TYPE,
     ServiceClientFactoryProperties.DSC_WEBSPHERE_SERVER_TYPE);
   connectionProps.setProperty(
     ServiceClientFactoryProperties.DSC_CREDENTIAL_USERNAME,
     "login");
   connectionProps.setProperty(
     ServiceClientFactoryProperties.DSC_CREDENTIAL_PASSWORD,
     "pass");

   ServiceClientFactory myFactory = ServiceClientFactory
     .createInstance(connectionProps);

   ResourceRepositoryClient repositoryClient = new ResourceRepositoryClient(
     myFactory);

   String resourceUri = "/MyResourceDir/";

   for (Resource resource : (List) repositoryClient
     .listMembers(resourceUri)) {
    repositoryClient.unlockResource(resource.getPath());

   }
  } catch (Exception e) {
   e.printStackTrace();
  }
 }
}


What I did here to make my life easier instead of going through 50 forms 1 by 1 You can pass in their parent directory as a ResourceURI.

Hope this helps. Thanks to the Adobe docs, wish they were much easier to find though. Seems they became better for crawlers recently because I haven't seen these links when I was searching for this a little while ago.

Thursday, April 7, 2011

Sencha Touch Scrolling a Non Touch Blackberry OS 6 Device

This is a follow up to my first post about getting clicking to work on Non-Touch Blackberry OS 6 devices with the Sencha Touch framework.

I have come up with a way to get the components to scroll when you move your mouse to the edges. It is a bit rough around the edges and can use some polish but it's a working example and can be used.

This does not require any hacking of the Sencha Touch library which is both good and bad. The good is that you don't have to mess with the library risking something to get broken the bad is that you have to add this for every panel.

Without further ado here's an example Panel implementing a List:

var scrollList;

app.views.scrollList = Ext.extend(Ext.Panel, {
    listeners: {
        mousemove: {
            element: 'el',
            fn: function (evt, div, el) {
                if (scrollList.scroller.offsetBoundary.top == 0) {
                    scrollList.scroller.updateBoundary();
                }
                var maxOffset = scrollList.scroller.offsetBoundary[1] - 400;
                if (evt.xy[1] > 300 && scrollList.scroller.offset.y >= maxOffset) {
                    var offset = -1 * scrollList.scroller.offset.y + 10;
                    scrollList.scroller.scrollTo({
                        x: 0,
                        y: offset
                    });
                } else if (evt.xy[1] < 60 && scrollList.scroller.offset.y <= 0) {
                    scrollList.scroller.scrollTo({
                        x: 0,
                        y: (-1 * scrollList.scroller.offset.y) - 10
                    });
                }
            }
        }
    },
    dockedItems: [{
        xtype: 'toolbar',
        title: 'Scroll List'
    }],
    items: [{
        xtype: 'list',
        id: 'scrollList',
        height: 275,
        scroll: 'vertical',
        store: app.stores.scrollList,
        itemTpl: '{a}, {b}',
        onItemDisclosure: function (record) {

        }

    }],
    initComponent: function () {
        app.stores.scrollList.load();
        app.views.scrollList.superclass.initComponent.apply(this, arguments);
        scrollList = Ext.getCmp('scrollList');
    }

});
What we do here is we attach a mousemove listener to the underlying panel and call the scrollTo() function on the list's Ext.util.Scroller instance. If anyone has any improvements/suggestions/their own implementation I would love to hear it.
Here's a demo:

Hope this helps those who have hit this problem and hopefully Sencha will implement this the "right" way.