Showing posts with label Cordys. Show all posts
Showing posts with label Cordys. Show all posts

Thursday, November 1, 2012

Access to XmlStore files from within Ws-App java code


Today I needed to have access from within Java Ws-App code to an XML definition located within the XML Store.
Within a Cordys BPM those webservices are available and can be easily drag and dropped into your BPM, but if you need this within your java code it can be easily accomplished by executing a Soap request.

public class XmlStore
{
    final String NS_CASEMNGT_INST = "http://schemas.cordys.com/casemanagement/instanceadministration/1.0";

    public static int getXMLObject(String userDn, String key)
    {
        int retVal = 0;
        int response = 0;

        try
        {
            // Build up the request to send.
            String[] paramNames = { "key" };
            Object[] paramValues = { key };
            SOAPRequestObject sro = new SOAPRequestObject(NS_CASEMNGT_INST , "GetXMLObject", paramNames, 
                        paramValues);

            // Set the proxy user if passed on
            if (StringUtils.isSet(userDn))
            {
                sro.setUser(userDn);
            }

            // Send the actual request.
            response = sro.sendAndWait();

            // Find the response document
            retVal = XPathHelper.selectSingleNode(response, "//xs:old/*", Constants.xmi);
        }
        catch (Exception e)
        {
            throw new CustomException(e, Messages.ERROR_GETTING_FILE_FROM_XML_STORE, key);
        }
        return retVal;
    }

And in the calling function you have than something like this:
Int xmlstoreObject = XMLStore.getXMLObject(BSF.getUser(), "/nl/project/xmlstore/xmlfile.xml");

Don't forget in your calling code to clean-up the NOM element by using the 'Node.delete(node)' function.
Otherwise memory leaks can be easily introduced.

Retrieval of user details of logged-in Cordys user

Retrieval of the user details of the logged-in user can be easily done using the BSF and LDAP build-in utility functions.

Below an example of a Java function which retrieves the ‘Full User Name’ and ‘email’ adres which is shown within the Cordys User Manager. Furthermore, it retrieves the ‘Full Organization Name’ from the Cordys Organisation Manager.

/**
  * This method returns the raadpleger details of the logged-in user.
  *
  * @return  A string array with 3 values:
  *  - value 1: Full Name of the logged-in user
  *  - value 2: Email of the logged-in user
  *  - value 3: Full Name of the organization of the user
 */
 public static String[] getRaadplegerDetails()
 {
    String[] raadplegerDetails = new String[3];

String userDN = BSF.getUser();

    String orgDN = BSF.getOrganization();
   
LDAPDirectory ldir = LDAPDirectory.getDefaultInstance();
        LDAPEntry userLdapEntry = ldir.read(userDN);
        LDAPEntry orgLdapEntry = ldir.read(orgDN);

        // Check if it's an organizational user or an authenticated one.
        LDAPAttribute attr = userLdapEntry.getAttribute("objectclass");
        String[] classes = attr.getStringValueArray();
        boolean found = false;

        for (String className : classes)
        {
            if ("busorganizationaluser".equals(className))

            {
                found = true;
                break;
            }
}

        // Read the entry of the authenticated user if the passed on DN was of an org user.
if (found)
        {
            String authUser = LDAPUtils.getAttrValue(userLdapEntry, "authenticationuser");
            userLdapEntry = ldir.read(authUser);
}

        // Set the Full User Name
        raadplegerDetails[0] = LDAPUtils.getAttrValue(userLdapEntry, "description");
        // Set the Email
        raadplegerDetails[1] = LDAPUtils.getAttrValue(userLdapEntry, "mail");
        // Set the Full Organization Name
        raadplegerDetails[2] = LDAPUtils.getAttrValue(orgLdapEntry, "description");
    }
       return raadplegerDetails;
   }

Monday, March 28, 2011

Show 'Cordys Management Console' graphically on Linux

Problem:
How to open the 'Cordys Management Console' on a Cordys Linux server in a graphical way.

How: 
In order to achieve this we need 2 tools:
- Xming for Windows
- Putty

Actions:
1. Install XMing for windows with default options
2. Configure Putty with X11 forwarding within your session to your server



3. Login and test using the 'xclock' command

4. Start the 'Cordys Management Console' within putty. This is found within the 
Note: we use Cordys CU-17 and there the cmc.sh file is located within the bin directory of the BOP-4 install.


Wednesday, January 26, 2011

Connect to CARS via external LDAP Client

Problem: How do we connect to Cordys Admin Repository Server (CARS) via an external LDAP client.

How:
Before starting to give a solution for this it is good to know that CARS by default uses one-way SSL for the CARS authentication. This can be changed  of course by adapting the default installation configuration of CARS, but this is not recommended.

Note: changes this can be done by adapting the property: ‘cars.sslmode ‘ withinin the file <instance-name>.properties, which is located within the Cordys install dir.

default CARS settings


Steps to be taken in order to connect to CARS via an external LDAP client

1. First check if you can connect using the Content Manager of the Cordys Management Console into CARS.



2. If step 1 succeeds (login successfull), take over the configuration of the connect screen of the Content Manager and use this information to connect via your external LDAP client (e.g. JXPlorer).



Using this way you are able to connect with your preferred LDAP client to the CARS OpenLDAP implemenation. Another nice LDAP client to use is Apache Directory Studio.

Have fun.

Thursday, December 30, 2010

Cordys: How to update a user interface?

Problem: You want to update a user interface table (e.g. adding of column) which was already generated on top of a database table?


How: This can be easily achieved using the table 'Column Chooser' option
Details:
1) Open the UI screen, and right-click on the user interface table containing all the columns and select “Column Chooser”
 

2) Added database columns will show up within the dialog. The only thing you need to do is select the new column and close the dialog. In case you want to remove columns you can de-select the columns in the same way.





3) You can test the UI (auto publish) using the preview icon () on the top bar.
4) If you want to change the format of a column, you can change this using the ‘Format’ option.








5) There is a bug that Oracle database NUMBER fields are automatically mapped to DOUBLE types within Cordys. Due to this a value of 150 within the database is shown as 150.00 within a Cordys table. This can be easily fixed by changing the “Specific Format” setting of the field to “#”.







6) In order to see the changes of a user interface you have to explicitly clean the cache of your browser. A good tool which is working is dumpcache.exe.