ANT target if, then, else if, else - list

I am so very green and new to ANT and have been searching online for an example similar to this to compare for validity but cannot find anything. Thanks in advance for you input.
Can you tell me if it is valid to append _old to arg1?
<for list="${file1.list}" param="file1.property">
<sequential>
<if>
<equals arg1="${#{file1.property}_old}" arg2="${#{file1.property}}"/>
<then>
<!--<echo message="Property #{file1.property} has no change "/>-->
</then>

Related

SailPoint IdentityIQ 8.2 - Return a list of users who have any entitlement(group) in a predetermined list of entitlements

I'm working in an environment where IdentityIQ 8.2 is deployed for access management.
I am attempting to return a list of users, based on if they have any one of the entitlements in the provided "whitelist". (i.e. "Show me any user who has entitlement1 or entitlement2 or entitlement3")
I tried to use the Advanced Analytics search function. This does allow you to search for identities based on entitlement, but it function in an "Exclusive AND" logic style where only users who have every single entitlement on your "whitelist" will be returned. I haven't found a way to change this. The Advanced Search type doesn't support searching by entitlement, from what I can tell.
Is there an out of the box way to accomplish this?
You can create the entitlement search with AND and save the result as a Population. You can then change operation="AND" to operation="OR" using the Debug pages.
Example how to search for users who have either of these two AD group memberships (this is a Population saved from Advanced Analytics):
<GroupDefinition indexed="true" name="x" private="true">
<GroupFilter>
<CompositeFilter operation="AND">
<Filter operation="COLLECTION_CONDITION" property="identityEntitlements">
<CollectionCondition>
<CompositeFilter operation="OR">
<CompositeFilter operation="AND">
<Filter operation="EQ" property="application.name" value="AD"/>
<Filter operation="EQ" property="name" value="memberOf"/>
<Filter operation="EQ" property="value" value="{e4ca3ebf-543e-4f19-aa6d-60ebee9968a7}"/>
</CompositeFilter>
<CompositeFilter operation="AND">
<Filter operation="EQ" property="application.name" value="AD"/>
<Filter operation="EQ" property="name" value="memberOf"/>
<Filter operation="EQ" property="value" value="{b263fcce-26e5-4fc8-9ed3-012df6b4c262}"/>
</CompositeFilter>
</CompositeFilter>
</CollectionCondition>
</Filter>
</CompositeFilter>
</GroupFilter>
<Owner>
<Reference class="sailpoint.object.Identity" name="spadmin"/>
</Owner>
</GroupDefinition>

wso2 dataservice filter null for a dataservice field

in my Dataservice ,in a select statement one of the field has a null value.
It is returned like this
<ROLLNUMBER xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
I want to write a filter and do some logic based on if the value is null or it has some value.
How can do that in WSO2 ESB?
I tried a few XSL expression nothing works
You need to use a filter mediator wherein you need to use xpath expression as //*[local-name()='ROLL_NUMBER']/text(), what this will do is for the element ROLL_NUMBER if there is a value only then the filter condition is satisfied and it goes to then condition if not then it will go to else condition
Try the following
<filter source="boolean(get-property('yourProperty'))" regex="false">
<then> <!-- NULL OR NON EXIST --> </then>
<else> <!-- EXIST --> </else>
</filter>

Index of list item from ant property

I have a ant parameter with list of values as below.
releases=release1,release2
I use the below for loop to process the values.
<for list="${releases}" param="release">
<sequential>
<echo>Processing #{release}</echo>
</sequential>
<for>
I want to do something like, I want to echo the below statement only when the #{release}=release2
<echo>Processing last release</echo>
I am not quite sure how to get the index of the list items or if it is even possible.
Thanks in advance,
Balaji
That's all? And, you're using Ant-Contrib tasks already. Take a look at the PropertyRegEx task. That's the Ant-Contrib task that will do exactly what you want:
<propertyregex property="last.release"
input="${releases}"
regexp=".*,(.*)"
select="\1"/>
This will set ${last.release} to the last release in your string.
Be careful of strings that are null or don't match your regular expression! You can use the Ant-Contrib if task to test for that:
<propertyregex property="last.release"
input="${releases}"
regexp=".*,(.*)"
select="\1"/>
<if>
<isset property="last.release"/>
<then>
<echo>The last release is ${last.release}</echo>
</then>
<else>
<fail>Oops! Something didn't work...</fail>
</else>
</if>

Out Sequence -- Enrich mediator is not working as expected

I trying to build a application which includes service chaining. When i try to merge the responses and do the extra transformation on the merged response.. i see unintended response.I see the response i merged along with my xslt transformation outcome
For example:
If i have added "abc" to my existing outcome using enrich -> sibling to body option, after i do transformation, i still see "abc" getting appended.
Please see my code below
<enrich>
<source clone="false" type="custom" xpath="get-property('poecResp')"/>
<target action="sibling" type="body"/>
</enrich>
<log category="INFO" level="full" separator=","/>
<xslt key="conf:Response_V1.xslt"/>
<log category="INFO" level="full" separator=","/>
in the last log i print i see the sibling i added still remains.
I see the issue is with xslt. i should choose the "Source XPATH". But not sure still why my Enrich component is not working.

Regex to match everything before a word. To be used in nant script

I was writing some build scripts for my project. I wanted a regex pattern which can match everything before a particular word. For eg: My script looks like this
Create Table ABC(
id int(50)
)
--//#UNDO
Drop table ABC
I want to match everything before --//#UNDO using nant regex task. How do I implement it??
I also want it to match everything in the file if --//#UNDO is not present in the file. I am not getting a way around
This is the pattern:
(?'str'.*?)--//#UNDO
The result will be in str.
If you just want to match the text before the string (and not the string itself) you will need to use a lookahead.
.*?(?=--//#UNDO)
Needing to specify Singleline still applies.
This would be the NAnt target:
<target name="go">
<loadfile
file="C:\foo\bar.sql"
property="content" />
<regex
pattern="(?'content'.*)--//#UNDO"
input="${content}"
options="Singleline"
failonerror="false" />
<echo message="${content}" />
</target>
Notice that property content is preset with the complete file content in case that --//#UNDO is not present in file.
This is what I ended up doing
<loadfile file="${filePathAndName}" property="file.contents" />
<property name="fileHasUndo" value="${string::index-of(file.contents, '--//#UNDO')}" />
<choose>
<when test="${fileHasUndo == '-1' }">
<echo file="${file}" append="true" message="${file.contents}" />
</when>
<otherwise>
<regex pattern="(?'sql'[\s\S]*)--\/\/#UNDO[\s\S]*" input="${file.contents}" options="Multiline"/>
<echo file="${file}" append="true" message="${sql}" />
</otherwise>
</choose>
I found the index of --//#UNDO. And depending on its presence I am doing a choose when.. Solved the problem