Entitlements columns combined within a row

Hi developers,

Currently we are working on combining columns into single row. we have used many methods to combine the column values into single row but none of them have worked.

Now this is the rule that we’re working on, But it also throws up some parse error.

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE Rule PUBLIC "sailpoint.dtd" "sailpoint.dtd">
<Rule created="1726819185936" id="c0a8006c920e102481920e71b5100210" language="beanshell" modified="1726821579414" name="bundle-com" type="RequestObjectSelector">
  <Source>
        import sailpoint.api.SailPointContext;
        import sailpoint.object.Identity;
        import sailpoint.object.Bundle;
        import java.util.List;
        import java.util.stream.Collectors;
        
        Identity identity = context.getObjectByName(Identity.class, "PRISM ADMIN");

        // Get all bundles for this identity
        List bundles = identity.getBundles();

        // Combine bundle names into a comma-separated string
        if (bundles != null) {
            // Fetch and join bundle names
            String combinedBundles = bundles.stream()
                                      .map(Bundle::getName) // Get the name of the bundle
                                      .collect(Collectors.joining(", "));
            // Return the combined bundle names
            return combinedBundles;
        }
  </Source>
</Rule>

For ex, Shown in the below attached picture, We need the entitlements columns to be combined in a single row for the prism admin user.

Hi @kabi_natarajan,

Can you give some background about the report. Are you generating this entire report from the shared code?

Thanks

Hi @ashutosh08,

First of all thks for replying, We’re actually working on run rule to get the user’s entitlements statically and trying to print all the user’s entitlement values in a single row by using ", ", " (commas) rather than printing them in individual columns.

Thanks

Hi @kabi_natarajan,

I do not think that this is the right way to use Collector.join as if you would try this in some IDE also it will throw the error.

But let’s say if you just want to group your entitlement with respect to account name then you can fetch the details and use any java snippet to merge the rows and then return the details.

I have attached a sample snippet to where only account name and entitlement is being returned.

Let me know if you have any further query.

String query="SELECT lnk.native_identity, GROUP_CONCAT(iden_ent.value) as val\r\n"
				+ "FROM spt_link lnk \r\n"
				+ "JOIN spt_identity_entitlement iden_ent \r\n"
				+ "ON lnk.identity_id = iden_ent.identity_id \r\n"
				+ "GROUP BY lnk.native_identity;";
		Connection con=context.getJdbcConnection();
		PreparedStatement ps=con.prepareStatement(query);

		ResultSet rs=ps.executeQuery();
		HashMap<String,String> userEntMap=new HashMap<String,String>();
		while(rs.next())
		{
			userEntMap.put(rs.getString(1),rs.getString(2));

		}

		IOUtil.closeQuietly(ps);

Thanks

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.