http://git-wip-us.apache.org/repos/asf/syncope/blob/d30c8526/syncope620/core/logic/src/main/resources/report/roleReportlet2fo.xsl ---------------------------------------------------------------------- diff --git a/syncope620/core/logic/src/main/resources/report/roleReportlet2fo.xsl b/syncope620/core/logic/src/main/resources/report/roleReportlet2fo.xsl new file mode 100644 index 0000000..bb319a4 --- /dev/null +++ b/syncope620/core/logic/src/main/resources/report/roleReportlet2fo.xsl @@ -0,0 +1,228 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:fo="http://www.w3.org/1999/XSL/Format" + version="1.0"> + + <xsl:template match="reportlet[@class='org.apache.syncope.core.report.RoleReportlet']"> + + <fo:block font-size="16pt" font-weight="bold" space-after="0.5cm" space-before="5mm">Reportlet: <xsl:value-of select="@name"/></fo:block> + + <xsl:for-each select="role"> + <fo:block font-size="14pt" font-weight="bold" space-before="15mm" space-after="5mm" background-color="(#8888ff)">Role <xsl:value-of select="@name"/></fo:block> + <fo:table table-layout="fixed" space-after="7mm"> + <fo:table-column/> + <fo:table-column/> + <fo:table-body> + <fo:table-row background-color="(#ccccff)"> + <fo:table-cell> + <fo:block>Id:</fo:block> + </fo:table-cell> + <fo:table-cell> + <fo:block font-style="italic"> + <xsl:value-of select="@id"/> + </fo:block> + </fo:table-cell> + </fo:table-row> + <xsl:if test="@roleOwner != 'null'"> + <fo:table-row background-color="(#ccccff)"> + <fo:table-cell> + <fo:block>Role Owner:</fo:block> + </fo:table-cell> + <fo:table-cell> + <fo:block font-style="italic"> + <xsl:value-of select="@roleOwner"/> + </fo:block> + </fo:table-cell> + </fo:table-row> + </xsl:if> + <xsl:if test="@userOwner != 'null'"> + <fo:table-row background-color="(#ccccff)"> + <fo:table-cell> + <fo:block>Last Login Date:</fo:block> + </fo:table-cell> + <fo:table-cell> + <fo:block font-style="italic"> + <xsl:value-of select="@userOwner"/> + </fo:block> + </fo:table-cell> + </fo:table-row> + </xsl:if> + </fo:table-body> + </fo:table> + <xsl:choose> + <xsl:when test="string-length(attributes/attribute) > 0"> + <xsl:call-template name="attributes"> + <xsl:with-param name="label">Attributes</xsl:with-param> + <xsl:with-param name="node" select="attributes/attribute"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <fo:block color="red" font-size="9pt" space-after="3mm">THIS ROLE HASN'T ANY ATTRIBUTE</fo:block> + </xsl:otherwise> + </xsl:choose> + + <xsl:choose> + <xsl:when test="string-length(derivedAttributes/derivedAttribute) > 0"> + <xsl:call-template name="attributes"> + <xsl:with-param name="label">Derived Attributes</xsl:with-param> + <xsl:with-param name="node" select="derivedAttributes/derivedAttribute"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <fo:block color="red" font-size="9pt" space-after="3mm">THIS ROLE HASN'T ANY DERIVED ATTRIBUTE</fo:block> + </xsl:otherwise> + </xsl:choose> + <xsl:choose> + <xsl:when test="string-length(virtualAttributes/virtualAttribute) > 0"> + <xsl:call-template name="attributes"> + <xsl:with-param name="label">Virtual Attributes</xsl:with-param> + <xsl:with-param name="node" select="virtualAttributes/virtualAttribute"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <fo:block color="red" font-size="9pt" space-after="3mm">THIS ROLE HASN'T ANY VIRTUAL ATTRIBUTE</fo:block> + </xsl:otherwise> + </xsl:choose> + + <!--entitlements--> + <xsl:choose> + <xsl:when test="entitlements/entitlement"> + <xsl:call-template name="entitlements"> + <xsl:with-param name="label">Entitlements</xsl:with-param> + <xsl:with-param name="node" select="entitlements/entitlement"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <fo:block color="red" font-size="9pt" space-after="3mm">THIS ROLE HASN'T ANY ENTITLEMENT</fo:block> + </xsl:otherwise> + </xsl:choose> + + <xsl:choose> + <xsl:when test="users/user"> + <fo:block font-size="11pt" font-weight="bold">Users</fo:block> + <xsl:for-each select="users/user"> + <fo:block background-color="(#ccccff)" font-size="9pt" font-weight="bold" space-before="4mm">User: <xsl:value-of select="@userUsername"/> (Id: <xsl:value-of select="@userId"/>)</fo:block> + + </xsl:for-each> + </xsl:when> + <xsl:otherwise> + <fo:block color="red" font-size="9pt" space-after="3mm">THIS ROLE HASN'T ANY USER ASSIGNED TO</fo:block> + </xsl:otherwise> + </xsl:choose> + <xsl:call-template name="roleResources"> + <xsl:with-param name="node" select="resources/resource"/> + </xsl:call-template> + </xsl:for-each> + + </xsl:template> + + <xsl:template name="attributes"> + <xsl:param name="label"/> + <xsl:param name="node"/> + <fo:block font-size="11pt" font-weight="bold" space-after="2mm"> + <xsl:value-of select="$label"/> + </fo:block> + <fo:table table-layout="fixed" space-after="7mm"> + <fo:table-column/> + <fo:table-column/> + <fo:table-header> + <fo:table-row height="7mm" background-color="(#ccccba)"> + <fo:table-cell> + <fo:block font-weight="bold">Schema name</fo:block> + </fo:table-cell> + <fo:table-cell> + <fo:block font-weight="bold">Value(s)</fo:block> + </fo:table-cell> + </fo:table-row> + </fo:table-header> + <fo:table-body> + <xsl:for-each select="$node"> + <xsl:if test="string-length(value/text()) > 0"> + <fo:table-row height="4mm" background-color="(#ccccff)"> + <fo:table-cell> + <fo:block> + <xsl:value-of select="@name"/> + </fo:block> + </fo:table-cell> + <fo:table-cell> + <xsl:for-each select="value"> + <fo:block></fo:block><!-- <fo:block>•</fo:block>--> + <fo:block font-style="italic"> + <xsl:value-of select="text()"/> + </fo:block> + </xsl:for-each> + </fo:table-cell> + </fo:table-row> + </xsl:if> + <fo:table-row> + <fo:table-cell> + <fo:block></fo:block> + </fo:table-cell> + <fo:table-cell> + <fo:block></fo:block> + </fo:table-cell> + </fo:table-row> + </xsl:for-each> + </fo:table-body> + </fo:table> + </xsl:template> + <!--entitlements template--> + <xsl:template name="entitlements"> + <xsl:param name="label"/> + <xsl:param name="node"/> + <fo:block font-size="11pt" font-weight="bold" space-after="2mm" space-before="5mm"> + <xsl:value-of select="$label"/> + </fo:block> + <fo:table table-layout="fixed" space-after="7mm"> + <fo:table-column/> + <!--<fo:table-column/>--> + <fo:table-header> + <fo:table-row height="7mm" background-color="(#ccccba)"> + <fo:table-cell> + <fo:block font-weight="bold">Name</fo:block> + </fo:table-cell> + </fo:table-row> + </fo:table-header> + <fo:table-body> + <xsl:for-each select="$node"> + <fo:table-row height="4mm" background-color="(#ccccff)"> + <fo:table-cell> + <fo:block> + <xsl:value-of select="@id"/> + </fo:block> + </fo:table-cell> + </fo:table-row> + </xsl:for-each> + </fo:table-body> + </fo:table> + </xsl:template> + + <xsl:template name="roleResources"> + <xsl:param name="node"/> + <fo:block font-size="11pt" font-weight="bold" space-after="3mm" space-before="5mm">Role Resources</fo:block> + <xsl:for-each select="$node"> + <fo:block></fo:block> <!-- <fo:block>•</fo:block>--> + <fo:block background-color="(#ccccff)"> + <xsl:value-of select="@name"/> + </fo:block> + </xsl:for-each> + </xsl:template> +</xsl:stylesheet> \ No newline at end of file
http://git-wip-us.apache.org/repos/asf/syncope/blob/d30c8526/syncope620/core/logic/src/main/resources/report/roleReportlet2html.xsl ---------------------------------------------------------------------- diff --git a/syncope620/core/logic/src/main/resources/report/roleReportlet2html.xsl b/syncope620/core/logic/src/main/resources/report/roleReportlet2html.xsl new file mode 100644 index 0000000..9f5825f --- /dev/null +++ b/syncope620/core/logic/src/main/resources/report/roleReportlet2html.xsl @@ -0,0 +1,196 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + version="1.0"> + + <xsl:template match="reportlet[@class='org.apache.syncope.core.report.RoleReportlet']"> + <h2>Reportlet: <xsl:value-of select="@name"/></h2> + <xsl:for-each select="role"> + <h3>Role <xsl:value-of select="@name"/></h3> + + <table style="border: 1px solid black;"> + <tr> + <td>Id:</td> + <td> + <xsl:value-of select="@id"/> + </td> + </tr> + <xsl:if test="@roleOwner != 'null'"> <!--!= null test="not(USER/FIRSTNAME)" --> + <tr> + <td>Role Owner:</td> + <td> + <xsl:value-of select="@roleOwner"/> + </td> + </tr> + </xsl:if> + <xsl:if test="@userOwner != 'null'"> + <tr> + <td>User Owner:</td> + <td> + <xsl:value-of select="@userOwner"/> + </td> + </tr> + </xsl:if> + + </table> + + <xsl:choose> + <xsl:when test="string-length(attributes/attribute) > 0"> + <xsl:call-template name="attributes"> + <xsl:with-param name="label">Attributes</xsl:with-param> + <xsl:with-param name="node" select="attributes/attribute"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <h5>THIS ROLE HASN'T ANY ATTRIBUTE</h5> + </xsl:otherwise> + </xsl:choose> + + <xsl:choose> + <xsl:when test="string-length(derivedAttributes/derivedAttribute) > 0"> + <xsl:call-template name="attributes"> + <xsl:with-param name="label">Derived Attributes</xsl:with-param> + <xsl:with-param name="node" select="derivedAttributes/derivedAttribute"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <h5>THIS ROLE HASN'T ANY DERIVED ATTRIBUTE</h5> + </xsl:otherwise> + </xsl:choose> + <!--</xsl:if>--> + <xsl:choose> + <xsl:when test="string-length(virtualAttributes/virtualAttribute) > 0"> + <xsl:call-template name="attributes"> + <xsl:with-param name="label">Virtual Attributes</xsl:with-param> + <xsl:with-param name="node" select="virtualAttributes/virtualAttribute"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <h5>THIS ROLE HASN'T ANY VIRTUAL ATTRIBUTE</h5> + </xsl:otherwise> + </xsl:choose> + + <xsl:choose> + <xsl:when test="entitlements/entitlement"> + <xsl:call-template name="entitlements"> + <xsl:with-param name="label">Entitlements: </xsl:with-param> + <xsl:with-param name="node" select="entitlements/entitlement"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <h5>THIS ROLE HASN'T ANY ENTITLEMENT</h5> + </xsl:otherwise> + </xsl:choose> + + <xsl:choose> + <xsl:when test="users/user"> + <h4>Users</h4> + <xsl:for-each select="users/user"> + <h5>User: <xsl:value-of select="@userUsername"/> (Id: <xsl:value-of select="@userId"/>)</h5> + </xsl:for-each> + </xsl:when> + <xsl:otherwise> + <h5>THIS ROLE HASN'T ANY USER ASSIGNED TO</h5> + </xsl:otherwise> + </xsl:choose> + + <xsl:call-template name="roleResources"> + <xsl:with-param name="node" select="resources/resource"/> + </xsl:call-template> + <hr/> + + </xsl:for-each> + </xsl:template> + + <!--entitlement template--> + <xsl:template name="entitlements"> + <xsl:param name="label"/> + <xsl:param name="node"/> + + <h4> + <xsl:value-of select="$label"/> + </h4> + + <table> + + <tbody> + <xsl:for-each select="$node"> + <tr> + <td> + <xsl:value-of select="@id"/> + </td> + </tr> + </xsl:for-each> + </tbody> + </table> + </xsl:template> + + + <xsl:template name="attributes"> + <xsl:param name="label"/> + <xsl:param name="node"/> + + <h4> + <xsl:value-of select="$label"/> + </h4> + + <table> + <thead> + <tr> + <th>Schema name</th> + <th>Value(s)</th> + </tr> + </thead> + <tbody> + <xsl:for-each select="$node"> + <xsl:if test="string-length(value/text()) > 0"> + <tr> + <td> + <xsl:value-of select="@name"/> + </td> + <td> + <ul> + <xsl:for-each select="value"> + <li> + <xsl:value-of select="text()"/> + </li> + </xsl:for-each> + </ul> + </td> + </tr> + </xsl:if> + </xsl:for-each> + </tbody> + </table> + </xsl:template> + + <xsl:template name="roleResources"> + <xsl:param name="node"/> + + <h4>Role Resources</h4> + <ul> + <xsl:for-each select="$node"> + <li> + <xsl:value-of select="@name"/> + </li> + </xsl:for-each> + </ul> + </xsl:template> +</xsl:stylesheet> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/syncope/blob/d30c8526/syncope620/core/logic/src/main/resources/report/staticReportlet2csv.xsl ---------------------------------------------------------------------- diff --git a/syncope620/core/logic/src/main/resources/report/staticReportlet2csv.xsl b/syncope620/core/logic/src/main/resources/report/staticReportlet2csv.xsl new file mode 100644 index 0000000..90879d9 --- /dev/null +++ b/syncope620/core/logic/src/main/resources/report/staticReportlet2csv.xsl @@ -0,0 +1,81 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> + + <xsl:variable name="delimiter" select="';'"/> + + <xsl:template match="reportlet[@class='org.apache.syncope.core.report.StaticReportlet']"> + <xsl:call-template name="header"> + <xsl:with-param name="node" select="configurations/staticAttributes"/> + </xsl:call-template> + + <xsl:call-template name="staticAttributes"> + <xsl:with-param name="header" select="configurations/staticAttributes"/> + </xsl:call-template> + </xsl:template> + + <xsl:template name="header"> + <xsl:param name="node"/> + <xsl:for-each select="$node/*"> + <xsl:text>"</xsl:text> + <xsl:value-of select="text()"/> + <xsl:text>"</xsl:text> + <xsl:if test="position() != last()"> + <xsl:value-of select="$delimiter"/> + </xsl:if> + </xsl:for-each> + <xsl:text> </xsl:text> + </xsl:template> + + <xsl:template name="staticAttributes"> + <xsl:param name="header"/> + + <xsl:variable name="attrs" select="."/> + <xsl:for-each select="$header/*"> + <xsl:variable name="nameAttr" select="text()"/> + <xsl:if test="string-length($attrs/*[name(.)=$nameAttr]/text()) > 0 + and count($attrs/*[name(.)=$nameAttr]/*/node()) = 0"> + <xsl:variable name="value" select="$attrs/*[name(.)=$nameAttr]/text()"/> + <xsl:text>"</xsl:text> + <xsl:value-of select="$value"/> + <xsl:text>"</xsl:text> + </xsl:if> + + <xsl:if test="string-length($attrs/*[name(.)=$nameAttr]/*/text()) > 0 + and count($attrs/*[name(.)=$nameAttr]/*/node()) > 0"> + <xsl:text>"</xsl:text> + <xsl:for-each select="$attrs/*[name(.)=$nameAttr]/*"> + <xsl:variable name="value" select="text()"/> + <xsl:text></xsl:text> + <xsl:value-of select="$value"/> + <xsl:if test="position() != last()"> + <xsl:value-of select="$delimiter"/> + </xsl:if> + </xsl:for-each> + <xsl:text>"</xsl:text> + </xsl:if> + + <xsl:if test="position() != last()"> + <xsl:value-of select="$delimiter"/> + </xsl:if> + + </xsl:for-each> + </xsl:template> +</xsl:stylesheet> http://git-wip-us.apache.org/repos/asf/syncope/blob/d30c8526/syncope620/core/logic/src/main/resources/report/staticReportlet2fo.xsl ---------------------------------------------------------------------- diff --git a/syncope620/core/logic/src/main/resources/report/staticReportlet2fo.xsl b/syncope620/core/logic/src/main/resources/report/staticReportlet2fo.xsl new file mode 100644 index 0000000..c123d51 --- /dev/null +++ b/syncope620/core/logic/src/main/resources/report/staticReportlet2fo.xsl @@ -0,0 +1,84 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. + +--> + +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:fo="http://www.w3.org/1999/XSL/Format" + version="1.0"> + + <xsl:template match="reportlet[@class='org.apache.syncope.core.report.StaticReportlet']"> + + <fo:block font-size="14pt" font-weight="bold" space-after="0.5cm">Reportlet: + <xsl:value-of select="@name"/> + </fo:block> + + <xsl:if test="string-length(string/text()) > 0"> + <fo:block font-size="11pt">String value: + <xsl:value-of select="string/text()"/> + </fo:block> + </xsl:if> + + <xsl:if test="string-length(long/text()) > 0"> + <fo:block font-size="11pt">Long value: + <xsl:value-of select="long/text()"/> + </fo:block> + </xsl:if> + + <xsl:if test="string-length(double/text()) > 0"> + <fo:block font-size="11pt">Double value: + <xsl:value-of select="double/text()"/> + </fo:block> + </xsl:if> + + <xsl:if test="string-length(date/text()) > 0"> + <fo:block font-size="11pt">Date value: + <xsl:value-of select="date/text()"/> + </fo:block> + </xsl:if> + + <xsl:if test="string-length(enum/text()) > 0"> + <fo:block font-size="11pt">Enum value: + <xsl:value-of select="enum/text()"/> + </fo:block> + </xsl:if> + + <xsl:if test="string-length(list) > 0"> + <fo:block font-size="11pt">List values:</fo:block> + + <fo:list-block provisional-label-separation="4mm" provisional-distance-between-starts="2mm"> + <xsl:for-each select="list/string"> + <xsl:if test="string-length(string/text()) > 0"> + <fo:list-item> + <fo:list-item-label end-indent="label-end()"> + <fo:block>•</fo:block> + </fo:list-item-label> + <fo:list-item-body start-indent="body-start()"> + <fo:block> + <xsl:value-of select="text()"/> + </fo:block> + </fo:list-item-body> + </fo:list-item> + </xsl:if> + </xsl:for-each> + </fo:list-block> + </xsl:if> + + </xsl:template> +</xsl:stylesheet> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/syncope/blob/d30c8526/syncope620/core/logic/src/main/resources/report/staticReportlet2html.xsl ---------------------------------------------------------------------- diff --git a/syncope620/core/logic/src/main/resources/report/staticReportlet2html.xsl b/syncope620/core/logic/src/main/resources/report/staticReportlet2html.xsl new file mode 100644 index 0000000..da0ba85 --- /dev/null +++ b/syncope620/core/logic/src/main/resources/report/staticReportlet2html.xsl @@ -0,0 +1,74 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. + +--> + +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + version="1.0"> + + <xsl:template match="reportlet[@class='org.apache.syncope.core.report.StaticReportlet']"> + <h2>Reportlet: + <xsl:value-of select="@name"/> + </h2> + + <xsl:if test="string-length(string/text()) > 0"> + <p>String value: + <xsl:value-of select="string/text()"/> + </p> + </xsl:if> + + <xsl:if test="string-length(long/text()) > 0"> + <p>Long value: + <xsl:value-of select="long/text()"/> + </p> + </xsl:if> + + <xsl:if test="string-length(double/text()) > 0"> + <p>Double value: + <xsl:value-of select="double/text()"/> + </p> + </xsl:if> + + <xsl:if test="string-length(date/text()) > 0"> + <p>Date value: + <xsl:value-of select="date/text()"/> + </p> + </xsl:if> + + <xsl:if test="string-length(enum/text()) > 0"> + <p>Enum value: + <xsl:value-of select="enum/text()"/> + </p> + </xsl:if> + + <xsl:if test="string-length(list) > 0"> + <p>List values:</p> + + <ul> + <xsl:for-each select="list/string"> + <xsl:if test="string-length(string/text()) > 0"> + <li> + <xsl:value-of select="text()"/> + </li> + </xsl:if> + </xsl:for-each> + </ul> + </xsl:if> + </xsl:template> +</xsl:stylesheet> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/syncope/blob/d30c8526/syncope620/core/logic/src/main/resources/report/userReportlet2csv.xsl ---------------------------------------------------------------------- diff --git a/syncope620/core/logic/src/main/resources/report/userReportlet2csv.xsl b/syncope620/core/logic/src/main/resources/report/userReportlet2csv.xsl new file mode 100644 index 0000000..87c670f --- /dev/null +++ b/syncope620/core/logic/src/main/resources/report/userReportlet2csv.xsl @@ -0,0 +1,119 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + version="1.0"> + + <xsl:variable name="delimiter" select="';'"/> + + <xsl:template match="reportlet[@class='org.apache.syncope.core.report.UserReportlet']"> + + <xsl:call-template name="header"> + <xsl:with-param name="node" select="configurations/userAttributes"/> + </xsl:call-template> + <xsl:for-each select="user"> + <xsl:call-template name="userAttributes"> + <xsl:with-param name="header" select="../configurations/userAttributes"/> + </xsl:call-template> + <xsl:text> </xsl:text> + </xsl:for-each> + </xsl:template> + + <xsl:template name="header"> + <xsl:param name="node"/> + <xsl:for-each select="$node/*"> + <xsl:text>"</xsl:text> + <xsl:value-of select="text()"/> + <xsl:text>"</xsl:text> + <xsl:if test="position() != last()"> + <xsl:value-of select="$delimiter"/> + </xsl:if> + </xsl:for-each> + <xsl:text> </xsl:text> + </xsl:template> + + <xsl:template name="userAttributes"> + <xsl:param name="header"/> + + <xsl:variable name="attrs" select="."/> + <xsl:for-each select="$header/*"> + <xsl:variable name="nameAttr" select="text()"/> + <xsl:choose> + <xsl:when test="count($attrs/@*[name()=$nameAttr]) > 0"> + <xsl:variable name="userAttr" select="$attrs/@*[name()=$nameAttr]"/> + <xsl:text>"</xsl:text> + <xsl:value-of select="$userAttr/."/> + <xsl:text>"</xsl:text> + </xsl:when> + <xsl:when test="string-length($attrs/*/*[@name=$nameAttr]/value/text()) > 0 + and count($attrs/*/*[@name=$nameAttr]/node()) = 0"> + <xsl:variable name="value" select="$attrs/*/*[@name=$nameAttr]/value/text()"/> + <xsl:text>"</xsl:text> + <xsl:value-of select="$value"/> + <xsl:text>"</xsl:text> + </xsl:when> + <xsl:when test="string-length($attrs/*/*[@name=$nameAttr]/value/text()) > 0 + and count($attrs/*/*[@name=$nameAttr]/node()) > 0"> + <xsl:text>"</xsl:text> + <xsl:for-each select="$attrs/*/*[@name=$nameAttr]/*"> + <xsl:variable name="value" select="$attrs/*/*[@name=$nameAttr]/value/text()"/> + <xsl:value-of select="$value"/> + <xsl:if test="position() != last()"> + <xsl:value-of select="$delimiter"/> + </xsl:if> + </xsl:for-each> + <xsl:text>"</xsl:text> + </xsl:when> + <xsl:when test="name($attrs/*[name(.)=$nameAttr]/*[name(.)='membership']) + and count($attrs/*[name(.)=$nameAttr]/node()) > 0"> + <xsl:text>"</xsl:text> + <xsl:variable name="value" select="@roleName"/> + <xsl:for-each select="$attrs/*/membership"> + <xsl:variable name="value" select="@roleName"/> + <xsl:value-of select="$value"/> + <xsl:if test="position() != last()"> + <xsl:value-of select="$delimiter"/> + </xsl:if> + </xsl:for-each> + <xsl:text>"</xsl:text> + </xsl:when> + <xsl:when test="name($attrs/*[name(.)=$nameAttr]/*[name(.)='resource']) + and count($attrs/*[name(.)=$nameAttr]/node()) > 0"> + <xsl:text>"</xsl:text> + <xsl:variable name="value" select="@name"/> + <xsl:for-each select="$attrs/*/resource"> + <xsl:variable name="value" select="@name"/> + <xsl:value-of select="$value"/> + <xsl:if test="position() != last()"> + <xsl:value-of select="$delimiter"/> + </xsl:if> + </xsl:for-each> + <xsl:text>"</xsl:text> + </xsl:when> + <xsl:otherwise> + <xsl:text>""</xsl:text> + </xsl:otherwise> + </xsl:choose> + <xsl:if test="position() != last()"> + <xsl:value-of select="$delimiter"/> + </xsl:if> + </xsl:for-each> + </xsl:template> + +</xsl:stylesheet> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/syncope/blob/d30c8526/syncope620/core/logic/src/main/resources/report/userReportlet2fo.xsl ---------------------------------------------------------------------- diff --git a/syncope620/core/logic/src/main/resources/report/userReportlet2fo.xsl b/syncope620/core/logic/src/main/resources/report/userReportlet2fo.xsl new file mode 100644 index 0000000..977ef4c --- /dev/null +++ b/syncope620/core/logic/src/main/resources/report/userReportlet2fo.xsl @@ -0,0 +1,247 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:fo="http://www.w3.org/1999/XSL/Format" + version="1.0"> + + <xsl:template match="reportlet[@class='org.apache.syncope.core.report.UserReportlet']"> + + <fo:block font-size="16pt" font-weight="bold" space-after="0.5cm" space-before="5mm">Reportlet: <xsl:value-of select="@name"/></fo:block> + + <xsl:for-each select="user"> + <fo:block font-size="14pt" font-weight="bold" space-before="15mm" space-after="5mm" background-color="(#8888ff)">User <xsl:value-of select="@username"/></fo:block> + <fo:table table-layout="fixed" space-after="7mm"> + <fo:table-column/> + <fo:table-column/> + <fo:table-body> + <fo:table-row background-color="(#ccccff)"> + <fo:table-cell> + <fo:block>Status:</fo:block> + </fo:table-cell> + <fo:table-cell> + <fo:block font-style="italic"> + <xsl:value-of select="@status"/> + </fo:block> + </fo:table-cell> + </fo:table-row> + <xsl:if test="string-length(@creationDate) > 0"> + <fo:table-row background-color="(#ccccff)"> + <fo:table-cell> + <fo:block>Creation Date:</fo:block> + </fo:table-cell> + <fo:table-cell> + <fo:block font-style="italic"> + <xsl:value-of select="@creationDate"/> + </fo:block> + </fo:table-cell> + </fo:table-row> + </xsl:if> + <xsl:if test="string-length(@lastLoginDate) > 0"> + <fo:table-row background-color="(#ccccff)"> + <fo:table-cell> + <fo:block>Last Login Date:</fo:block> + </fo:table-cell> + <fo:table-cell> + <fo:block font-style="italic"> + <xsl:value-of select="@lastLoginDate"/> + </fo:block> + </fo:table-cell> + </fo:table-row> + </xsl:if> + <xsl:if test="string-length(@changePwdDate) > 0"> + <fo:table-row background-color="(#ccccff)"> + <fo:table-cell> + <fo:block>Change Password Date:</fo:block> + </fo:table-cell> + <fo:table-cell> + <fo:block font-style="italic"> + <xsl:value-of select="@changePwdDate"/> + </fo:block> + </fo:table-cell> + </fo:table-row> + </xsl:if> + <xsl:if test="string-length(@passwordHistorySize) > 0"> + <fo:table-row background-color="(#ccccff)"> + <fo:table-cell> + <fo:block>Password History Size:</fo:block> + </fo:table-cell> + <fo:table-cell> + <fo:block font-style="italic"> + <xsl:value-of select="@passwordHistorySize"/> + </fo:block> + </fo:table-cell> + </fo:table-row> + </xsl:if> + <xsl:if test="string-length(@failedLoginCount) > 0"> + <fo:table-row background-color="(#ccccff)"> + <fo:table-cell> + <fo:block>Number of Failed Login Attempts:</fo:block> + </fo:table-cell> + <fo:table-cell> + <fo:block font-style="italic"> + <xsl:value-of select="@failedLoginCount"/> + </fo:block> + </fo:table-cell> + </fo:table-row> + </xsl:if> + </fo:table-body> + </fo:table> + <xsl:call-template name="attributes"> + <xsl:with-param name="label">Attributes</xsl:with-param> + <xsl:with-param name="node" select="attributes/attribute"/> + </xsl:call-template> + <xsl:choose> + <xsl:when test="string-length(derivedAttributes/derivedAttribute) > 0"> + <xsl:call-template name="attributes"> + <xsl:with-param name="label">Derived Attributes</xsl:with-param> + <xsl:with-param name="node" select="derivedAttributes/derivedAttribute"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <fo:block color="red" font-size="9pt" space-after="3mm">THIS USER HASN'T ANY DERIVED ATTRIBUTE</fo:block> + </xsl:otherwise> + </xsl:choose> + <xsl:choose> + <xsl:when test="string-length(virtualAttributes/virtualAttribute) > 0"> + <xsl:call-template name="attributes"> + <xsl:with-param name="label">Virtual Attributes</xsl:with-param> + <xsl:with-param name="node" select="virtualAttributes/virtualAttribute"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <fo:block color="red" font-size="9pt" space-after="3mm">THIS USER HASN'T ANY VIRTUAL ATTRIBUTE</fo:block> + </xsl:otherwise> + </xsl:choose> + <xsl:choose> + <xsl:when test="string-length(memberships/membership) > 0"> + <fo:block font-size="11pt" font-weight="bold">Memberships</fo:block> + <xsl:for-each select="memberships/membership"> + <fo:block font-size="10pt" font-weight="bold" space-before="2mm">Role: <xsl:value-of select="@roleName"/>(<xsl:value-of select="@roleId"/>)</fo:block> + <fo:block start-indent="1cm" space-before="3mm" space-after="0.5cm"> + <xsl:choose> + <xsl:when test="string-length(attributes/attribute) > 0"> + <xsl:call-template name="attributes"> + <xsl:with-param name="label">Attributes</xsl:with-param> + <xsl:with-param name="node" select="attributes/attribute"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <fo:block color="red" font-size="8pt" space-after="2mm">THIS ROLE HASN'T ANY ATTRIBUTE</fo:block> + </xsl:otherwise> + </xsl:choose> + <xsl:choose> + <xsl:when test="string-length(derivedAttributes/derivedAttribute) > 0"> + <xsl:call-template name="attributes"> + <xsl:with-param name="label">Derived Attributes</xsl:with-param> + <xsl:with-param name="node" select="derivedAttributes/derivedAttribute"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <fo:block color="red" font-size="8pt" space-after="2mm">THIS ROLE HASN'T ANY DERIVED ATTRIBUTE</fo:block> + </xsl:otherwise> + </xsl:choose> + <xsl:choose> + <xsl:when test="string-length(virtualAttributes/virtualAttribute) > 0"> + <xsl:call-template name="attributes"> + <xsl:with-param name="label">Virtual Attributes</xsl:with-param> + <xsl:with-param name="node" select="virtualAttributes/virtualAttribute"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <fo:block color="red" font-size="8pt" space-after="2mm">THIS ROLE HASN'T ANY VIRTUAL ATTRIBUTE</fo:block> + </xsl:otherwise> + </xsl:choose> + <!-- 'roleResources" is defined in roleReportlet2fo.xsl --> + <xsl:call-template name="roleResources"> + <xsl:with-param name="node" select="resources/resource"/> + </xsl:call-template> + </fo:block> + </xsl:for-each> + </xsl:when> + <xsl:otherwise> + <fo:block color="red" font-size="9pt" space-after="3mm">THIS USER HASN'T BEEN ASSIGNED TO ANY ROLE</fo:block> + </xsl:otherwise> + </xsl:choose> + <xsl:call-template name="resources"> + <xsl:with-param name="node" select="resources/resource"/> + </xsl:call-template> + </xsl:for-each> + </xsl:template> + <xsl:template name="attributes"> + <xsl:param name="label"/> + <xsl:param name="node"/> + <fo:block font-size="11pt" font-weight="bold" space-after="2mm"> + <xsl:value-of select="$label"/> + </fo:block> + <fo:table table-layout="fixed" space-after="7mm"> + <fo:table-column/> + <fo:table-column/> + <fo:table-header> + <fo:table-row height="7mm" background-color="(#ccccba)"> + <fo:table-cell> + <fo:block font-weight="bold">Schema name</fo:block> + </fo:table-cell> + <fo:table-cell> + <fo:block font-weight="bold">Value(s)</fo:block> + </fo:table-cell> + </fo:table-row> + </fo:table-header> + <fo:table-body> + <xsl:for-each select="$node"> + <xsl:if test="string-length(value/text()) > 0"> + <fo:table-row height="4mm" background-color="(#ccccff)"> + <fo:table-cell> + <fo:block> + <xsl:value-of select="@name"/> + </fo:block> + </fo:table-cell> + <fo:table-cell> + <xsl:for-each select="value"> + <fo:block></fo:block><!-- <fo:block>•</fo:block>--> + <fo:block font-style="italic"> + <xsl:value-of select="text()"/> + </fo:block> + </xsl:for-each> + </fo:table-cell> + </fo:table-row> + </xsl:if> + <fo:table-row> + <fo:table-cell> + <fo:block></fo:block> + </fo:table-cell> + <fo:table-cell> + <fo:block></fo:block> + </fo:table-cell> + </fo:table-row> + </xsl:for-each> + </fo:table-body> + </fo:table> + </xsl:template> + <xsl:template name="resources"> + <xsl:param name="node"/> + <fo:block font-size="11pt" font-weight="bold" space-after="3mm">Resources</fo:block> + <xsl:for-each select="$node"> + <fo:block></fo:block> <!-- <fo:block>•</fo:block>--> + <fo:block background-color="(#ccccff)"> + <xsl:value-of select="@name"/> + </fo:block> + </xsl:for-each> + </xsl:template> +</xsl:stylesheet> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/syncope/blob/d30c8526/syncope620/core/logic/src/main/resources/report/userReportlet2html.xsl ---------------------------------------------------------------------- diff --git a/syncope620/core/logic/src/main/resources/report/userReportlet2html.xsl b/syncope620/core/logic/src/main/resources/report/userReportlet2html.xsl new file mode 100644 index 0000000..751cb4c --- /dev/null +++ b/syncope620/core/logic/src/main/resources/report/userReportlet2html.xsl @@ -0,0 +1,219 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + version="1.0"> + + <xsl:template match="reportlet[@class='org.apache.syncope.core.report.UserReportlet']"> + + <h3>Reportlet: <xsl:value-of select="@name"/></h3> + + <xsl:for-each select="user"> + <h4>User <xsl:value-of select="@username"/></h4> + + <table style="border: 1px solid black;"> + <tr> + <td>Status:</td> + <td> + <xsl:value-of select="@status"/> + </td> + </tr> + <xsl:if test="string-length(@creationDate) > 0"> + <tr> + <td>Creation Date:</td> + <td> + <xsl:value-of select="@creationDate"/> + </td> + </tr> + </xsl:if> + <xsl:if test="string-length(@lastLoginDate) > 0"> + <tr> + <td>Last Login Date:</td> + <td> + <xsl:value-of select="@lastLoginDate"/> + </td> + </tr> + </xsl:if> + <xsl:if test="string-length(@changePwdDate) > 0"> + <tr> + <td>Change Password Date:</td> + <td> + <xsl:value-of select="@changePwdDate"/> + </td> + </tr> + </xsl:if> + <xsl:if test="string-length(@passwordHistorySize) > 0"> + <tr> + <td>Password History Size:</td> + <td> + <xsl:value-of select="@passwordHistorySize"/> + </td> + </tr> + </xsl:if> + <xsl:if test="string-length(@failedLoginCount) > 0"> + <tr> + <td>Number of Failed Login Attempts:</td> + <td> + <xsl:value-of select="@failedLoginCount"/> + </td> + </tr> + </xsl:if> + </table> + + <xsl:call-template name="attributes"> + <xsl:with-param name="label">Attributes</xsl:with-param> + <xsl:with-param name="node" select="attributes/attribute"/> + </xsl:call-template> + + <!--<xsl:if test="string-length(derivedAttributes/derivedAttribute) > 0">--> + <xsl:choose> + <xsl:when test="string-length(derivedAttributes/derivedAttribute) > 0"> + <xsl:call-template name="attributes"> + <xsl:with-param name="label">Derived Attributes</xsl:with-param> + <xsl:with-param name="node" select="derivedAttributes/derivedAttribute"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <h5>THIS USER HASN'T DERIVED ATTRIBUTES</h5> + </xsl:otherwise> + </xsl:choose> + <!--</xsl:if>--> + <xsl:choose> + <xsl:when test="string-length(virtualAttributes/virtualAttribute) > 0"> + <xsl:call-template name="attributes"> + <xsl:with-param name="label">Virtual Attributes</xsl:with-param> + <xsl:with-param name="node" select="virtualAttributes/virtualAttribute"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <h5>THIS USER HASN'T VIRTUAL ATTRIBUTES</h5> + </xsl:otherwise> + </xsl:choose> + + <xsl:choose> + <xsl:when test="string-length(memberships/membership) > 0"> + <h4>Memberships</h4> + <xsl:for-each select="memberships/membership"> + <h5>Role: <xsl:value-of select="@roleName"/>(<xsl:value-of select="@roleId"/>)</h5> + <blockquote> + <xsl:choose> + <xsl:when test="string-length(attributes/attribute) > 0"> + <xsl:call-template name="attributes"> + <xsl:with-param name="label">Attributes</xsl:with-param> + <xsl:with-param name="node" select="attributes/attribute"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <h5>THIS ROLE HASN'T ATTRIBUTES</h5> + </xsl:otherwise> + </xsl:choose> + <xsl:choose> + <xsl:when test="string-length(derivedAttributes/derivedAttribute) > 0"> + <xsl:call-template name="attributes"> + <xsl:with-param name="label">Derived Attributes</xsl:with-param> + <xsl:with-param name="node" select="derivedAttributes/derivedAttribute"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <h5>THIS ROLE HASN'T DERIVED ATTRIBUTES</h5> + </xsl:otherwise> + </xsl:choose> + <xsl:choose> + <xsl:when test="string-length(virtualAttributes/virtualAttribute) > 0"> + <xsl:call-template name="attributes"> + <xsl:with-param name="label">Virtual Attributes</xsl:with-param> + <xsl:with-param name="node" select="virtualAttributes/virtualAttribute"/> + </xsl:call-template> + </xsl:when> + <xsl:otherwise> + <h5>THIS ROLE HASN'T VIRTUAL ATTRIBUTES</h5> + </xsl:otherwise> + </xsl:choose> + <!-- 'roleResources" is defined in roleReportlet2html.xsl --> + <xsl:call-template name="roleResources"> + <xsl:with-param name="node" select="resources/resource"/> + </xsl:call-template> + </blockquote> + </xsl:for-each> + </xsl:when> + <xsl:otherwise> + <h5>THIS USER ISN'T ASSIGNED TO A ROLE</h5> + </xsl:otherwise> + </xsl:choose> + <xsl:if test="string-length(resources) > 0"> + <xsl:call-template name="resources"> + <xsl:with-param name="node" select="resources/resource"/> + </xsl:call-template> + </xsl:if> + <hr/> + </xsl:for-each> + + </xsl:template> + + <xsl:template name="attributes"> + <xsl:param name="label"/> + <xsl:param name="node"/> + + <h4> + <xsl:value-of select="$label"/> + </h4> + + <table> + <thead> + <tr> + <th>Schema name</th> + <th>Value(s)</th> + </tr> + </thead> + <tbody> + <xsl:for-each select="$node"> + <xsl:if test="string-length(value/text()) > 0"> + <tr> + <td> + <xsl:value-of select="@name"/> + </td> + <td> + <ul> + <xsl:for-each select="value"> + <li> + <xsl:value-of select="text()"/> + </li> + </xsl:for-each> + </ul> + </td> + </tr> + </xsl:if> + </xsl:for-each> + </tbody> + </table> + </xsl:template> + + <xsl:template name="resources"> + <xsl:param name="node"/> + + <h4>Resources</h4> + <ul> + <xsl:for-each select="$node"> + <li> + <xsl:value-of select="@name"/> + </li> + </xsl:for-each> + </ul> + </xsl:template> +</xsl:stylesheet> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/syncope/blob/d30c8526/syncope620/core/logic/src/test/java/org/apache/syncope/core/logic/NotificationTest.java ---------------------------------------------------------------------- diff --git a/syncope620/core/logic/src/test/java/org/apache/syncope/core/logic/NotificationTest.java b/syncope620/core/logic/src/test/java/org/apache/syncope/core/logic/NotificationTest.java new file mode 100644 index 0000000..39b79ce --- /dev/null +++ b/syncope620/core/logic/src/test/java/org/apache/syncope/core/logic/NotificationTest.java @@ -0,0 +1,644 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.syncope.core.logic; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import com.icegreen.greenmail.util.GreenMail; +import com.icegreen.greenmail.util.ServerSetup; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Random; +import java.util.Set; +import java.util.UUID; +import javax.annotation.Resource; +import javax.mail.Flags.Flag; +import javax.mail.Folder; +import javax.mail.Message; +import javax.mail.Session; +import javax.mail.Store; +import org.apache.commons.lang3.StringUtils; +import org.apache.syncope.common.lib.SyncopeConstants; +import org.apache.syncope.common.lib.search.RoleFiqlSearchConditionBuilder; +import org.apache.syncope.common.lib.search.UserFiqlSearchConditionBuilder; +import org.apache.syncope.common.lib.to.AttrTO; +import org.apache.syncope.common.lib.to.MembershipTO; +import org.apache.syncope.common.lib.to.NotificationTaskTO; +import org.apache.syncope.common.lib.to.RoleTO; +import org.apache.syncope.common.lib.to.UserTO; +import org.apache.syncope.common.lib.types.AttributableType; +import org.apache.syncope.common.lib.types.IntMappingType; +import org.apache.syncope.common.lib.types.TaskType; +import org.apache.syncope.common.lib.types.TraceLevel; +import org.apache.syncope.core.persistence.api.dao.ConfDAO; +import org.apache.syncope.core.persistence.api.dao.EntitlementDAO; +import org.apache.syncope.core.persistence.api.dao.NotificationDAO; +import org.apache.syncope.core.persistence.api.dao.PlainSchemaDAO; +import org.apache.syncope.core.persistence.api.dao.TaskDAO; +import org.apache.syncope.core.persistence.api.entity.AttributableUtilFactory; +import org.apache.syncope.core.persistence.api.entity.Entitlement; +import org.apache.syncope.core.persistence.api.entity.EntityFactory; +import org.apache.syncope.core.persistence.api.entity.Notification; +import org.apache.syncope.core.persistence.api.entity.conf.CPlainAttr; +import org.apache.syncope.core.persistence.api.entity.conf.CPlainSchema; +import org.apache.syncope.core.persistence.api.entity.task.NotificationTask; +import org.apache.syncope.core.logic.notification.NotificationJob; +import org.apache.syncope.core.provisioning.api.notification.NotificationManager; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.mail.javamail.JavaMailSender; +import org.springframework.mail.javamail.JavaMailSenderImpl; +import org.springframework.security.authentication.TestingAuthenticationToken; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.authority.SimpleGrantedAuthority; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.security.core.userdetails.User; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.transaction.annotation.Transactional; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(locations = { + "classpath:provisioningContext.xml", + "classpath:logicContext.xml", + "classpath:workflowContext.xml", + "classpath:persistenceTest.xml", + "classpath:logicTest.xml" +}) +@Transactional +public class NotificationTest { + + /** + * Logger. + */ + private static final Logger LOG = LoggerFactory.getLogger(NotificationTest.class); + + private static final String SMTP_HOST = "localhost"; + + private static final int SMTP_PORT = 2525; + + private static final String POP3_HOST = "localhost"; + + private static final int POP3_PORT = 1110; + + private static final String MAIL_ADDRESS = "[email protected]"; + + private static final String MAIL_PASSWORD = "password"; + + private static GreenMail greenMail; + + @Resource(name = "adminUser") + private String adminUser; + + @Autowired + private EntitlementDAO entitlementDAO; + + @Autowired + private NotificationDAO notificationDAO; + + @Autowired + private TaskDAO taskDAO; + + @Autowired + private PlainSchemaDAO plainSchemaDAO; + + @Autowired + private ConfDAO confDAO; + + @Autowired + private UserLogic userLogic; + + @Autowired + private RoleLogic roleLogic; + + @Autowired + private TaskLogic taskLogic; + + @Autowired + private NotificationJob notificationJob; + + @Autowired + private NotificationManager notificationManager; + + @Autowired + private JavaMailSender mailSender; + + @Autowired + private EntityFactory entityFactory; + + @Autowired + private AttributableUtilFactory attrUtilFactory; + + @BeforeClass + public static void startGreenMail() { + ServerSetup[] config = new ServerSetup[2]; + config[0] = new ServerSetup(SMTP_PORT, SMTP_HOST, ServerSetup.PROTOCOL_SMTP); + config[1] = new ServerSetup(POP3_PORT, POP3_HOST, ServerSetup.PROTOCOL_POP3); + greenMail = new GreenMail(config); + greenMail.setUser(MAIL_ADDRESS, MAIL_PASSWORD); + greenMail.start(); + } + + @AfterClass + public static void stopGreenMail() { + if (greenMail != null) { + greenMail.stop(); + } + } + + private static UserTO getUniqueSampleTO(final String email) { + return getSampleTO(UUID.randomUUID().toString().substring(0, 8) + email); + } + + private static AttrTO attributeTO(final String schema, final String value) { + AttrTO attr = new AttrTO(); + attr.setSchema(schema); + attr.getValues().add(value); + return attr; + } + + private static UserTO getSampleTO(final String email) { + String uid = email; + UserTO userTO = new UserTO(); + userTO.setPassword("password123"); + userTO.setUsername(uid); + + userTO.getPlainAttrs().add(attributeTO("fullname", uid)); + userTO.getPlainAttrs().add(attributeTO("firstname", uid)); + userTO.getPlainAttrs().add(attributeTO("surname", "surname")); + userTO.getPlainAttrs().add(attributeTO("type", "a type")); + userTO.getPlainAttrs().add(attributeTO("userId", uid)); + userTO.getPlainAttrs().add(attributeTO("email", uid)); + userTO.getPlainAttrs().add(attributeTO("loginDate", new SimpleDateFormat("yyyy-MM-dd").format(new Date()))); + userTO.getDerAttrs().add(attributeTO("cn", null)); + userTO.getVirAttrs().add(attributeTO("virtualdata", "virtualvalue")); + return userTO; + } + + @Before + public void setupSecurity() { + List<GrantedAuthority> authorities = new ArrayList<GrantedAuthority>(); + for (Entitlement entitlement : entitlementDAO.findAll()) { + authorities.add(new SimpleGrantedAuthority(entitlement.getKey())); + } + + UserDetails userDetails = new User(adminUser, "FAKE_PASSWORD", true, true, true, true, authorities); + Authentication authentication = new TestingAuthenticationToken(userDetails, "FAKE_PASSWORD", authorities); + SecurityContextHolder.getContext().setAuthentication(authentication); + } + + @Before + public void setupSMTP() throws Exception { + JavaMailSenderImpl sender = (JavaMailSenderImpl) mailSender; + sender.setDefaultEncoding(SyncopeConstants.DEFAULT_ENCODING); + sender.setHost(SMTP_HOST); + sender.setPort(SMTP_PORT); + } + + private boolean verifyMail(final String sender, final String subject) throws Exception { + LOG.info("Waiting for notification to be sent..."); + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + } + + boolean found = false; + Session session = Session.getDefaultInstance(System.getProperties()); + Store store = session.getStore("pop3"); + store.connect(POP3_HOST, POP3_PORT, MAIL_ADDRESS, MAIL_PASSWORD); + + Folder inbox = store.getFolder("INBOX"); + assertNotNull(inbox); + inbox.open(Folder.READ_WRITE); + + Message[] messages = inbox.getMessages(); + for (int i = 0; i < messages.length; i++) { + if (sender.equals(messages[i].getFrom()[0].toString()) && subject.equals(messages[i].getSubject())) { + found = true; + messages[i].setFlag(Flag.DELETED, true); + } + } + + inbox.close(true); + store.close(); + return found; + } + + @Test + public void notifyByMail() throws Exception { + // 1. create suitable notification for subsequent tests + Notification notification = entityFactory.newEntity(Notification.class); + notification.addEvent("[REST]:[UserLogic]:[]:[create]:[SUCCESS]"); + notification.setUserAbout(new UserFiqlSearchConditionBuilder().hasRoles(7L).query()); + notification.setRecipients(new UserFiqlSearchConditionBuilder().hasRoles(8L).query()); + notification.setSelfAsRecipient(true); + + notification.setRecipientAttrName("email"); + notification.setRecipientAttrType(IntMappingType.UserPlainSchema); + + Random random = new Random(System.currentTimeMillis()); + String sender = "syncopetest-" + random.nextLong() + "@syncope.apache.org"; + notification.setSender(sender); + String subject = "Test notification " + random.nextLong(); + notification.setSubject(subject); + notification.setTemplate("optin"); + + Notification actual = notificationDAO.save(notification); + assertNotNull(actual); + + notificationDAO.flush(); + + // 2. create user + UserTO userTO = getSampleTO(MAIL_ADDRESS); + MembershipTO membershipTO = new MembershipTO(); + membershipTO.setRoleId(7); + userTO.getMemberships().add(membershipTO); + + userLogic.create(userTO, true); + + // 3. force Quartz job execution and verify e-mail + notificationJob.execute(null); + assertTrue(verifyMail(sender, subject)); + + // 4. get NotificationTask id and text body + Long taskId = null; + String textBody = null; + for (NotificationTask task : taskDAO.<NotificationTask>findAll(TaskType.NOTIFICATION)) { + if (sender.equals(task.getSender())) { + taskId = task.getKey(); + textBody = task.getTextBody(); + } + } + assertNotNull(taskId); + assertNotNull(textBody); + assertTrue("Notification mail text doesn't contain expected content.", + textBody.contains("Your email address is [email protected].")); + assertTrue("Notification mail text doesn't contain expected content.", + textBody.contains("Your email address inside a link: " + + "http://localhost/?email=notificationtest%40syncope.apache.org .")); + + // 5. execute Notification task and verify e-mail + taskLogic.execute(taskId, false); + assertTrue(verifyMail(sender, subject)); + } + + @Test + public void issueSYNCOPE192() throws Exception { + // 1. create suitable notification for subsequent tests + Notification notification = entityFactory.newEntity(Notification.class); + notification.addEvent("[REST]:[UserLogic]:[]:[create]:[SUCCESS]"); + notification.setUserAbout(new UserFiqlSearchConditionBuilder().hasRoles(7L).query()); + notification.setRecipients(new UserFiqlSearchConditionBuilder().hasRoles(8L).query()); + notification.setSelfAsRecipient(true); + + notification.setRecipientAttrName("email"); + notification.setRecipientAttrType(IntMappingType.UserPlainSchema); + + Random random = new Random(System.currentTimeMillis()); + String sender = "syncope192-" + random.nextLong() + "@syncope.apache.org"; + notification.setSender(sender); + String subject = "Test notification " + random.nextLong(); + notification.setSubject(subject); + notification.setTemplate("optin"); + notification.setTraceLevel(TraceLevel.NONE); + + Notification actual = notificationDAO.save(notification); + assertNotNull(actual); + + // 2. create user + UserTO userTO = getSampleTO(MAIL_ADDRESS); + MembershipTO membershipTO = new MembershipTO(); + membershipTO.setRoleId(7); + userTO.getMemberships().add(membershipTO); + + userLogic.create(userTO, true); + + // 3. force Quartz job execution and verify e-mail + notificationJob.execute(null); + assertTrue(verifyMail(sender, subject)); + + // 4. get NotificationTask id + Long taskId = null; + for (NotificationTask task : taskDAO.<NotificationTask>findAll(TaskType.NOTIFICATION)) { + if (sender.equals(task.getSender())) { + taskId = task.getKey(); + } + } + assertNotNull(taskId); + + // 5. verify that last exec status was updated + NotificationTaskTO task = (NotificationTaskTO) taskLogic.read(taskId); + assertNotNull(task); + assertTrue(task.getExecutions().isEmpty()); + assertTrue(task.isExecuted()); + assertTrue(StringUtils.isNotBlank(task.getLatestExecStatus())); + } + + @Test + public void notifyByMailEmptyAbout() throws Exception { + // 1. create suitable notification for subsequent tests + Notification notification = entityFactory.newEntity(Notification.class); + notification.addEvent("[REST]:[UserLogic]:[]:[create]:[SUCCESS]"); + notification.setUserAbout(null); + notification.setRecipients(new UserFiqlSearchConditionBuilder().hasRoles(8L).query()); + notification.setSelfAsRecipient(true); + + notification.setRecipientAttrName("email"); + notification.setRecipientAttrType(IntMappingType.UserPlainSchema); + + Random random = new Random(System.currentTimeMillis()); + String sender = "syncopetest-" + random.nextLong() + "@syncope.apache.org"; + notification.setSender(sender); + String subject = "Test notification " + random.nextLong(); + notification.setSubject(subject); + notification.setTemplate("optin"); + + Notification actual = notificationDAO.save(notification); + assertNotNull(actual); + + notificationDAO.flush(); + + // 2. create user + UserTO userTO = getSampleTO(MAIL_ADDRESS); + MembershipTO membershipTO = new MembershipTO(); + membershipTO.setRoleId(7); + userTO.getMemberships().add(membershipTO); + + userLogic.create(userTO, true); + + // 3. force Quartz job execution and verify e-mail + notificationJob.execute(null); + assertTrue(verifyMail(sender, subject)); + + // 4. get NotificationTask id + Long taskId = null; + for (NotificationTask task : taskDAO.<NotificationTask>findAll(TaskType.NOTIFICATION)) { + if (sender.equals(task.getSender())) { + taskId = task.getKey(); + } + } + assertNotNull(taskId); + + // 5. execute Notification task and verify e-mail + taskLogic.execute(taskId, false); + assertTrue(verifyMail(sender, subject)); + } + + @Test + public void notifyByMailWithRetry() throws Exception { + // 1. create suitable notification for subsequent tests + Notification notification = entityFactory.newEntity(Notification.class); + notification.addEvent("[REST]:[UserLogic]:[]:[create]:[SUCCESS]"); + notification.setUserAbout(null); + notification.setRecipients(new UserFiqlSearchConditionBuilder().hasRoles(8L).query()); + notification.setSelfAsRecipient(true); + + notification.setRecipientAttrName("email"); + notification.setRecipientAttrType(IntMappingType.UserPlainSchema); + + Random random = new Random(System.currentTimeMillis()); + String sender = "syncopetest-" + random.nextLong() + "@syncope.apache.org"; + notification.setSender(sender); + String subject = "Test notification " + random.nextLong(); + notification.setSubject(subject); + notification.setTemplate("optin"); + + Notification actual = notificationDAO.save(notification); + assertNotNull(actual); + + notificationDAO.flush(); + + // 2. create user + UserTO userTO = getSampleTO(MAIL_ADDRESS); + MembershipTO membershipTO = new MembershipTO(); + membershipTO.setRoleId(7); + userTO.getMemberships().add(membershipTO); + + userLogic.create(userTO, true); + + // 3. Set number of retries + CPlainAttr maxRetries = entityFactory.newEntity(CPlainAttr.class); + maxRetries.setSchema(plainSchemaDAO.find("notification.maxRetries", CPlainSchema.class)); + maxRetries.addValue("5", attrUtilFactory.getInstance(AttributableType.CONFIGURATION)); + confDAO.save(maxRetries); + confDAO.flush(); + + // 4. Stop mail server to force error sending mail + stopGreenMail(); + + // 5. force Quartz job execution multiple times + for (int i = 0; i < 10; i++) { + notificationJob.execute(null); + } + + // 6. get NotificationTask, count number of executions + NotificationTask foundTask = null; + for (NotificationTask task : taskDAO.<NotificationTask>findAll(TaskType.NOTIFICATION)) { + if (sender.equals(task.getSender())) { + foundTask = task; + } + } + assertNotNull(foundTask); + assertEquals(6, notificationManager.countExecutionsWithStatus(foundTask.getKey(), + NotificationJob.Status.NOT_SENT.name())); + + // 7. start mail server again + startGreenMail(); + + // 8. reset number of retries + maxRetries = entityFactory.newEntity(CPlainAttr.class); + maxRetries.setSchema(plainSchemaDAO.find("notification.maxRetries", CPlainSchema.class)); + maxRetries.addValue("0", attrUtilFactory.getInstance(AttributableType.CONFIGURATION)); + confDAO.save(maxRetries); + confDAO.flush(); + } + + @Test + public void issueSYNCOPE445() throws Exception { + // 1. create suitable notification for subsequent tests + Notification notification = entityFactory.newEntity(Notification.class); + notification.addEvent("[REST]:[UserLogic]:[]:[create]:[SUCCESS]"); + notification.setUserAbout(new UserFiqlSearchConditionBuilder().hasRoles(7L).query()); + notification.setRecipients(new UserFiqlSearchConditionBuilder().hasRoles(8L).query()); + notification.setSelfAsRecipient(true); + + notification.setRecipientAttrName("email"); + notification.setRecipientAttrType(IntMappingType.UserPlainSchema); + + notification.getStaticRecipients().add("[email protected]"); + + Random random = new Random(System.currentTimeMillis()); + String sender = "syncopetest-" + random.nextLong() + "@syncope.apache.org"; + notification.setSender(sender); + String subject = "Test notification " + random.nextLong(); + notification.setSubject(subject); + notification.setTemplate("optin"); + + Notification actual = notificationDAO.save(notification); + assertNotNull(actual); + + notificationDAO.flush(); + + // 2. create user + UserTO userTO = getSampleTO(MAIL_ADDRESS); + MembershipTO membershipTO = new MembershipTO(); + membershipTO.setRoleId(7); + userTO.getMemberships().add(membershipTO); + + userLogic.create(userTO, true); + + // 3. force Quartz job execution and verify e-mail + notificationJob.execute(null); + assertTrue(verifyMail(sender, subject)); + + // 4. get NotificationTask id and text body + Long taskId = null; + String textBody = null; + Set<String> recipients = null; + for (NotificationTask task : taskDAO.<NotificationTask>findAll(TaskType.NOTIFICATION)) { + if (sender.equals(task.getSender())) { + taskId = task.getKey(); + textBody = task.getTextBody(); + recipients = task.getRecipients(); + } + } + + assertNotNull(taskId); + assertNotNull(textBody); + assertTrue(recipients.contains("[email protected]")); + + // 5. execute Notification task and verify e-mail + taskLogic.execute(taskId, false); + assertTrue(verifyMail(sender, subject)); + } + + @Test + public void issueSYNCOPE492() throws Exception { + // 1. create suitable disabled notification for subsequent tests + Notification notification = entityFactory.newEntity(Notification.class); + notification.addEvent("[REST]:[UserLogic]:[]:[create]:[SUCCESS]"); + notification.setUserAbout(new UserFiqlSearchConditionBuilder().hasRoles(7L).query()); + notification.setSelfAsRecipient(true); + + notification.setRecipientAttrName("email"); + notification.setRecipientAttrType(IntMappingType.UserPlainSchema); + + notification.getStaticRecipients().add("[email protected]"); + + Random random = new Random(System.currentTimeMillis()); + String sender = "syncopetest-" + random.nextLong() + "@syncope.apache.org"; + notification.setSender(sender); + String subject = "Test notification " + random.nextLong(); + notification.setSubject(subject); + notification.setTemplate("optin"); + notification.setActive(false); + + Notification actual = notificationDAO.save(notification); + assertNotNull(actual); + + notificationDAO.flush(); + + final int tasksNumberBefore = taskDAO.findAll(TaskType.NOTIFICATION).size(); + + // 2. create user + UserTO userTO = getUniqueSampleTO(MAIL_ADDRESS); + MembershipTO membershipTO = new MembershipTO(); + membershipTO.setRoleId(7); + userTO.getMemberships().add(membershipTO); + + userLogic.create(userTO, true); + + // 3. force Quartz job execution + notificationJob.execute(null); + + // 4. check if number of tasks is not incremented + assertEquals(tasksNumberBefore, taskDAO.findAll(TaskType.NOTIFICATION).size()); + } + + @Test + public void issueSYNCOPE446() throws Exception { + + // 1. create suitable notification for subsequent tests + Notification notification = entityFactory.newEntity(Notification.class); + notification.addEvent("[REST]:[RoleLogic]:[]:[create]:[SUCCESS]"); + notification.setRoleAbout(new RoleFiqlSearchConditionBuilder().is("name").equalTo("role446").query()); + notification.setSelfAsRecipient(false); + + notification.setRecipientAttrName("email"); + notification.setRecipientAttrType(IntMappingType.UserPlainSchema); + + notification.getStaticRecipients().add(MAIL_ADDRESS); + + Random random = new Random(System.currentTimeMillis()); + String sender = "syncopetest-" + random.nextLong() + "@syncope.apache.org"; + notification.setSender(sender); + String subject = "Test notification " + random.nextLong(); + notification.setSubject(subject); + notification.setTemplate("optin"); + + Notification actual = notificationDAO.save(notification); + assertNotNull(actual); + + notificationDAO.flush(); + + // 2. create role + RoleTO roleTO = new RoleTO(); + roleTO.setName("role446"); + roleTO.setParent(1L); + + RoleTO createdRole = roleLogic.create(roleTO); + assertNotNull(createdRole); + + // 3. force Quartz job execution and verify e-mail + notificationJob.execute(null); + assertTrue(verifyMail(sender, subject)); + + // 4. get NotificationTask id and text body + Long taskId = null; + String textBody = null; + Set<String> recipients = null; + for (NotificationTask task : taskDAO.<NotificationTask>findAll(TaskType.NOTIFICATION)) { + if (sender.equals(task.getSender())) { + taskId = task.getKey(); + textBody = task.getTextBody(); + recipients = task.getRecipients(); + } + } + + assertNotNull(taskId); + assertNotNull(textBody); + assertTrue(recipients != null && recipients.contains(MAIL_ADDRESS)); + + // 5. execute Notification task and verify e-mail + taskLogic.execute(taskId, false); + assertTrue(verifyMail(sender, subject)); + } +} http://git-wip-us.apache.org/repos/asf/syncope/blob/d30c8526/syncope620/core/logic/src/test/resources/logicTest.xml ---------------------------------------------------------------------- diff --git a/syncope620/core/logic/src/test/resources/logicTest.xml b/syncope620/core/logic/src/test/resources/logicTest.xml new file mode 100644 index 0000000..3cf0ab0 --- /dev/null +++ b/syncope620/core/logic/src/test/resources/logicTest.xml @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.springframework.org/schema/beans + http://www.springframework.org/schema/beans/spring-beans.xsd"> + + <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> + <property name="locations"> + <list> + <value>classpath:persistence.properties</value> + <value>classpath:security.properties</value> + <value>classpath:connid.properties</value> + <value>classpath:mail.properties</value> + <value>classpath:logic.properties</value> + <value>classpath:workflow.properties</value> + <value>classpath:provisioning.properties</value> + </list> + </property> + <property name="ignoreResourceNotFound" value="true"/> + <property name="ignoreUnresolvablePlaceholders" value="true"/> + </bean> + + <bean id="contentXML" class="org.apache.syncope.core.misc.spring.ResourceWithFallbackLoader"> + <property name="primary" value="file:${conf.directory}/content.xml"/> + <property name="fallback" value="classpath:content.xml"/> + </bean> + +</beans> http://git-wip-us.apache.org/repos/asf/syncope/blob/d30c8526/syncope620/core/misc/pom.xml ---------------------------------------------------------------------- diff --git a/syncope620/core/misc/pom.xml b/syncope620/core/misc/pom.xml new file mode 100644 index 0000000..96ae2d9 --- /dev/null +++ b/syncope620/core/misc/pom.xml @@ -0,0 +1,126 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.syncope</groupId> + <artifactId>syncope-core</artifactId> + <version>2.0.0-SNAPSHOT</version> + </parent> + + <name>Apache Syncope Core Misc</name> + <description>Apache Syncope Core Misc</description> + <groupId>org.apache.syncope.core</groupId> + <artifactId>syncope-core-misc</artifactId> + <packaging>jar</packaging> + + <properties> + <rootpom.basedir>${basedir}/../..</rootpom.basedir> + </properties> + + <dependencies> + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-lang3</artifactId> + </dependency> + <dependency> + <groupId>commons-io</groupId> + <artifactId>commons-io</artifactId> + </dependency> + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-jexl</artifactId> + </dependency> + <dependency> + <groupId>commons-codec</groupId> + <artifactId>commons-codec</artifactId> + </dependency> + + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-core</artifactId> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-databind</artifactId> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.module</groupId> + <artifactId>jackson-module-afterburner</artifactId> + </dependency> + + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-tx</artifactId> + </dependency> + + <dependency> + <groupId>org.jasypt</groupId> + <artifactId>jasypt</artifactId> + </dependency> + + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-aop</artifactId> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-expression</artifactId> + </dependency> + <dependency> + <groupId>org.springframework.security</groupId> + <artifactId>spring-security-core</artifactId> + </dependency> + + <dependency> + <groupId>org.apache.syncope.core</groupId> + <artifactId>syncope-core-provisioning-api</artifactId> + <version>${project.version}</version> + </dependency> + + <!-- TEST --> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-simple</artifactId> + <version>${slf4j.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-checkstyle-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-pmd-plugin</artifactId> + </plugin> + </plugins> + </build> +</project>
