You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by il...@apache.org on 2012/03/06 18:29:31 UTC
svn commit: r1297585 [5/5] - in /incubator/syncope/trunk:
client/src/main/java/org/syncope/client/report/
client/src/main/java/org/syncope/client/search/
client/src/main/java/org/syncope/client/to/
console/src/main/java/org/syncope/console/commons/ con...
Modified: incubator/syncope/trunk/console/src/main/resources/org/syncope/console/pages/ReportModalPage_it.properties
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/resources/org/syncope/console/pages/ReportModalPage_it.properties?rev=1297585&r1=1297584&r2=1297585&view=diff
==============================================================================
--- incubator/syncope/trunk/console/src/main/resources/org/syncope/console/pages/ReportModalPage_it.properties (original)
+++ incubator/syncope/trunk/console/src/main/resources/org/syncope/console/pages/ReportModalPage_it.properties Tue Mar 6 17:29:27 2012
@@ -31,3 +31,5 @@ taskExecutions=Esecuzione del task
delete=Rimozione
showMessage=Mostra
chooseForTemplate=Usa Un Template
+reportlets=Reportlets
+create_reportletconf=Aggiungi Reporlet
Added: incubator/syncope/trunk/console/src/main/resources/org/syncope/console/pages/ReportletConfModalPage.html
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/resources/org/syncope/console/pages/ReportletConfModalPage.html?rev=1297585&view=auto
==============================================================================
--- incubator/syncope/trunk/console/src/main/resources/org/syncope/console/pages/ReportletConfModalPage.html (added)
+++ incubator/syncope/trunk/console/src/main/resources/org/syncope/console/pages/ReportletConfModalPage.html Tue Mar 6 17:29:27 2012
@@ -0,0 +1,78 @@
+<!--
+ Licensed 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.
+ under the License.
+-->
+<wicket:extend>
+ <div style="margin:10px">
+ <p class="ui-widget ui-corner-all ui-widget-header"><wicket:message key="title"/></p>
+ <form wicket:id="form">
+ <div id="tabs">
+ <ul>
+ <li class="tabs-selected"><a href="#general"><span><wicket:message key="general"/></span></a></li>
+ <li><a href="#configuration"><span><wicket:message key="configuration"/></span></a></li>
+ </ul>
+ <div id="general">
+ <div id="formtable">
+ <div class="tablerow">
+ <div class="tablecolumn_label short_dynamicsize">
+ <label for="name"><wicket:message key="name"/></label>
+ </div>
+ <div class="tablecolumn_field short_dynamicsize">
+ <span wicket:id="name">[name]</span>
+ </div>
+ </div>
+
+ <div class="tablerow">
+ <div class="tablecolumn_label short_dynamicsize">
+ <label for="reportletClass"><wicket:message key="reportletClass"/></label>
+ </div>
+ <div class="tablecolumn_field">
+ <span wicket:id="reportletClass" style="width: 100%;">[reportletClass]</span>
+ </div>
+ </div>
+ </div>
+
+ <script type="text/javascript">
+ $(function() {
+ $('#general #formtable div.tablerow:even').addClass("alt");
+ });
+ </script>
+ </div>
+ <div id="configuration">
+ <div id="formtable">
+ <span wicket:id="container">
+ <div class="tablerow" wicket:id="propView">
+ <div class="tablecolumn_label short_fixedsize">
+ <span wicket:id="key">[key]</span>
+ </div>
+ <div class="tablecolumn_field medium_dynamicsize">
+ <span wicket:id="value">[value]</span>
+ </div>
+ </div>
+
+ <script type="text/javascript">
+ $(function() {
+ $('#configuration #formtable div.tablerow:even').addClass("alt");
+ });
+ </script>
+ </span>
+ </div>
+ </div>
+ </div>
+
+ <div style="margin: 20px 10px 0">
+ <input type="submit" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" wicket:id="apply"/>
+ </div>
+ </form>
+ </div>
+</wicket:extend>
\ No newline at end of file
Propchange: incubator/syncope/trunk/console/src/main/resources/org/syncope/console/pages/ReportletConfModalPage.html
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/syncope/trunk/console/src/main/resources/org/syncope/console/pages/ReportletConfModalPage.html
------------------------------------------------------------------------------
svn:keywords = Date Revision Author HeadURL Id
Propchange: incubator/syncope/trunk/console/src/main/resources/org/syncope/console/pages/ReportletConfModalPage.html
------------------------------------------------------------------------------
svn:mime-type = text/html
Added: incubator/syncope/trunk/console/src/main/resources/org/syncope/console/pages/ReportletConfModalPage.properties
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/resources/org/syncope/console/pages/ReportletConfModalPage.properties?rev=1297585&view=auto
==============================================================================
--- incubator/syncope/trunk/console/src/main/resources/org/syncope/console/pages/ReportletConfModalPage.properties (added)
+++ incubator/syncope/trunk/console/src/main/resources/org/syncope/console/pages/ReportletConfModalPage.properties Tue Mar 6 17:29:27 2012
@@ -0,0 +1,22 @@
+# 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.
+title=Reportlet
+general=General
+configuration=Configuration
+apply=Save
+name=Name
+reportletClass=Reportlet class
Propchange: incubator/syncope/trunk/console/src/main/resources/org/syncope/console/pages/ReportletConfModalPage.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/syncope/trunk/console/src/main/resources/org/syncope/console/pages/ReportletConfModalPage.properties
------------------------------------------------------------------------------
svn:keywords = Date Revision Author HeadURL Id
Added: incubator/syncope/trunk/console/src/main/resources/org/syncope/console/pages/ReportletConfModalPage_it.properties
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/resources/org/syncope/console/pages/ReportletConfModalPage_it.properties?rev=1297585&view=auto
==============================================================================
--- incubator/syncope/trunk/console/src/main/resources/org/syncope/console/pages/ReportletConfModalPage_it.properties (added)
+++ incubator/syncope/trunk/console/src/main/resources/org/syncope/console/pages/ReportletConfModalPage_it.properties Tue Mar 6 17:29:27 2012
@@ -0,0 +1,22 @@
+# 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.
+title=Reportlet
+general=Generale
+configuration=Configurazione
+apply=Salva
+name=Nome
+reportletClass=Classe Reportlet
Propchange: incubator/syncope/trunk/console/src/main/resources/org/syncope/console/pages/ReportletConfModalPage_it.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/syncope/trunk/console/src/main/resources/org/syncope/console/pages/ReportletConfModalPage_it.properties
------------------------------------------------------------------------------
svn:keywords = Date Revision Author HeadURL Id
Modified: incubator/syncope/trunk/console/src/main/resources/org/syncope/console/pages/WelcomePage.html
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/resources/org/syncope/console/pages/WelcomePage.html?rev=1297585&r1=1297584&r2=1297585&view=diff
==============================================================================
--- incubator/syncope/trunk/console/src/main/resources/org/syncope/console/pages/WelcomePage.html (original)
+++ incubator/syncope/trunk/console/src/main/resources/org/syncope/console/pages/WelcomePage.html Tue Mar 6 17:29:27 2012
@@ -19,7 +19,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta http-equiv="Content-Style-Type" content="text/css"/>
- <title>Syncope - <wicket:message key="welcome"/></title>
+ <title>Apache Syncope - <wicket:message key="welcome"/></title>
<link rel="stylesheet" href="css/style.css" type="text/css" media="all"/>
<style type="text/css">
@@ -50,4 +50,4 @@
</ul>
</div>
</body>
-</html>
\ No newline at end of file
+</html>
Added: incubator/syncope/trunk/console/src/main/resources/org/syncope/console/wicket/markup/html/form/CheckBoxMultipleChoiceFieldPanel.html
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/resources/org/syncope/console/wicket/markup/html/form/CheckBoxMultipleChoiceFieldPanel.html?rev=1297585&view=auto
==============================================================================
--- incubator/syncope/trunk/console/src/main/resources/org/syncope/console/wicket/markup/html/form/CheckBoxMultipleChoiceFieldPanel.html (added)
+++ incubator/syncope/trunk/console/src/main/resources/org/syncope/console/wicket/markup/html/form/CheckBoxMultipleChoiceFieldPanel.html Tue Mar 6 17:29:27 2012
@@ -0,0 +1,19 @@
+<!--
+ Licensed 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.
+ under the License.
+-->
+<html>
+ <wicket:panel>
+ <span wicket:id="checkBoxMultipleChoice" />
+ </wicket:panel>
+</html>
Propchange: incubator/syncope/trunk/console/src/main/resources/org/syncope/console/wicket/markup/html/form/CheckBoxMultipleChoiceFieldPanel.html
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/syncope/trunk/console/src/main/resources/org/syncope/console/wicket/markup/html/form/CheckBoxMultipleChoiceFieldPanel.html
------------------------------------------------------------------------------
svn:keywords = Date Revision Author HeadURL Id
Propchange: incubator/syncope/trunk/console/src/main/resources/org/syncope/console/wicket/markup/html/form/CheckBoxMultipleChoiceFieldPanel.html
------------------------------------------------------------------------------
svn:mime-type = text/html
Added: incubator/syncope/trunk/console/src/main/resources/org/syncope/console/wicket/markup/html/form/SingleColumnPalette.html
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/resources/org/syncope/console/wicket/markup/html/form/SingleColumnPalette.html?rev=1297585&view=auto
==============================================================================
--- incubator/syncope/trunk/console/src/main/resources/org/syncope/console/wicket/markup/html/form/SingleColumnPalette.html (added)
+++ incubator/syncope/trunk/console/src/main/resources/org/syncope/console/wicket/markup/html/form/SingleColumnPalette.html Tue Mar 6 17:29:27 2012
@@ -0,0 +1,56 @@
+<!--
+ 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.
+-->
+<html xmlns:wicket="http://wicket.apache.org">
+ <body>
+ <wicket:panel>
+
+ <div style="display: inline-table;">
+ <input type="hidden" wicket:id="recorder"/>
+ <span wicket:id="availableHeader"/>
+ <span wicket:id="availableHeader"/>
+
+ <div id="choices">
+ <select wicket:id="choices" class="choicesSelect" style="visibility: hidden;width: 0px;">[choices]</select>
+ </div>
+ <div id="selections" style="display: table-cell;">
+ <select class="selectionSelect" wicket:id="selection">[selection]</select>
+ </div>
+
+ <div id="orderingButtons" style="display: table-cell; width: 30px; vertical-align: middle; padding-left: 5px;">
+ <div style="padding-bottom: 5px;">
+ <a wicket:id="moveUpButton"><img src="img/up-icon.png" alt="move up icon"/></a>
+ </div>
+ <div style="padding-top: 5px;">
+ <a wicket:id="moveDownButton"><img src="img/down-icon.png" alt="move down icon"/></a>
+ </div>
+ </div>
+ </div>
+
+ <div id="actionButtons" style="padding-top: 5px;">
+ <div style="padding-left: 35px;float: left;">
+ <a wicket:id="addButton"><img src="img/plus-icon.png" alt="plus icon"/></a>
+ </div>
+ <div style="padding-left: 15px;float: left;">
+ <a wicket:id="editButton"><img src="img/actions/edit.png" alt="edit icon"/></a>
+ </div>
+ <div style="padding-left: 15px;float: left;">
+ <a wicket:id="removeButton"><img src="img/minus-icon.png" alt="minus icon"/></a>
+ </div>
+ </div>
+ </wicket:panel>
+</body>
+</html>
\ No newline at end of file
Propchange: incubator/syncope/trunk/console/src/main/resources/org/syncope/console/wicket/markup/html/form/SingleColumnPalette.html
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/syncope/trunk/console/src/main/resources/org/syncope/console/wicket/markup/html/form/SingleColumnPalette.html
------------------------------------------------------------------------------
svn:keywords = Date Revision Author HeadURL Id
Propchange: incubator/syncope/trunk/console/src/main/resources/org/syncope/console/wicket/markup/html/form/SingleColumnPalette.html
------------------------------------------------------------------------------
svn:mime-type = text/html
Added: incubator/syncope/trunk/console/src/main/webapp/img/down-icon.png
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/webapp/img/down-icon.png?rev=1297585&view=auto
==============================================================================
Binary file - no diff available.
Propchange: incubator/syncope/trunk/console/src/main/webapp/img/down-icon.png
------------------------------------------------------------------------------
svn:mime-type = image/png
Added: incubator/syncope/trunk/console/src/main/webapp/img/up-icon.png
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/webapp/img/up-icon.png?rev=1297585&view=auto
==============================================================================
Binary file - no diff available.
Propchange: incubator/syncope/trunk/console/src/main/webapp/img/up-icon.png
------------------------------------------------------------------------------
svn:mime-type = image/png
Added: incubator/syncope/trunk/console/src/main/webapp/scripts/singlecolumnpalette.js
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/webapp/scripts/singlecolumnpalette.js?rev=1297585&view=auto
==============================================================================
--- incubator/syncope/trunk/console/src/main/webapp/scripts/singlecolumnpalette.js (added)
+++ incubator/syncope/trunk/console/src/main/webapp/scripts/singlecolumnpalette.js Tue Mar 6 17:29:27 2012
@@ -0,0 +1,46 @@
+/*
+ * 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.
+ */
+if (typeof(Syncope) == "undefined") Syncope = { };
+if (typeof(Syncope.SingleColumnPalette) == "undefined") Syncope.SingleColumnPalette = { };
+
+Syncope.SingleColumnPalette.choicesOnFocus=function(choicesId, selectionId, recorderId) {
+ var selection = Wicket.Palette.$(selectionId);
+ var selected;
+ for (var i = 0; i < selection.options.length; i++) {
+ if (selection.options[i].selected) {
+ selected = selection.options[i].value;
+ }
+ }
+
+ if (typeof(selected) == "undefined") {
+ alert("Please select an item first");
+ } else {
+ var recorder = Wicket.Palette.$(recorderId);
+
+ recorder.value=selected + "|";
+ for (var i = 0; i < selection.options.length; i++) {
+ recorder.value=recorder.value+selection.options[i].value;
+ if (i+1<selection.options.length) {
+ recorder.value=recorder.value+",";
+ }
+ }
+
+ if (recorder.onselect != null) {
+ recorder.onselect();
+ }
+ }
+}
Propchange: incubator/syncope/trunk/console/src/main/webapp/scripts/singlecolumnpalette.js
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/syncope/trunk/console/src/main/webapp/scripts/singlecolumnpalette.js
------------------------------------------------------------------------------
svn:keywords = Date Revision Author HeadURL Id
Propchange: incubator/syncope/trunk/console/src/main/webapp/scripts/singlecolumnpalette.js
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: incubator/syncope/trunk/core/src/main/java/org/syncope/core/persistence/beans/ConnInstance.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/syncope/core/persistence/beans/ConnInstance.java?rev=1297585&r1=1297584&r2=1297585&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/syncope/core/persistence/beans/ConnInstance.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/syncope/core/persistence/beans/ConnInstance.java Tue Mar 6 17:29:27 2012
@@ -52,17 +52,15 @@ public class ConnInstance extends Abstra
private String connectorName;
/**
- * ConnectorBundle-Name: Qualified name for the connector bundle. Within a
- * given deployment, the pair (ConnectorBundle-Name,
- * ConnectorBundle-Version) must be unique.
+ * ConnectorBundle-Name: Qualified name for the connector bundle. Within a given deployment, the pair
+ * (ConnectorBundle-Name, ConnectorBundle-Version) must be unique.
*/
@Column(nullable = false)
private String bundleName;
/**
- * ConnectorBundle-Version: The version of the bundle. Within a given
- * deployment, the pair (ConnectorBundle-Name, ConnectorBundle-Version) must
- * be unique.
+ * ConnectorBundle-Version: The version of the bundle. Within a given deployment, the pair (ConnectorBundle-Name,
+ * ConnectorBundle-Version) must be unique.
*/
@Column(nullable = false)
private String version;
@@ -76,13 +74,13 @@ public class ConnInstance extends Abstra
private Set<ConnectorCapability> capabilities;
/**
- * The main configuration for the connector instance. This is directly
- * implemented by the Configuration bean class which contains annotated
- * ConfigurationProperties (@ConfigurationProperty).
+ * The main configuration for the connector instance. This is directly implemented by the Configuration bean class
+ * which contains annotated ConfigurationProperties (@ConfigurationProperty).
*/
@Lob
private String xmlConfiguration;
+ @Column(unique = true)
private String displayName;
/**
Modified: incubator/syncope/trunk/core/src/main/java/org/syncope/core/report/AbstractReportlet.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/syncope/core/report/AbstractReportlet.java?rev=1297585&r1=1297584&r2=1297585&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/syncope/core/report/AbstractReportlet.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/syncope/core/report/AbstractReportlet.java Tue Mar 6 17:29:27 2012
@@ -18,18 +18,63 @@
*/
package org.syncope.core.report;
-import org.syncope.client.report.ReportletConf;
+import java.text.SimpleDateFormat;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.transaction.annotation.Transactional;
+import org.syncope.client.SyncopeConstants;
+import org.syncope.client.report.AbstractReportletConf;
+import static org.syncope.core.scheduling.ReportXMLConst.*;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.AttributesImpl;
-public abstract class AbstractReportlet implements Reportlet {
+public abstract class AbstractReportlet<T extends AbstractReportletConf> implements Reportlet<T> {
- private ReportletConf conf;
+ /**
+ * Logger.
+ */
+ protected static final Logger LOG =
+ LoggerFactory.getLogger(AbstractReportlet.class);
- public ReportletConf getConf() {
+ protected static final ThreadLocal<SimpleDateFormat> DATE_FORMAT = new ThreadLocal<SimpleDateFormat>() {
+
+ @Override
+ protected SimpleDateFormat initialValue() {
+ return new SimpleDateFormat(SyncopeConstants.DEFAULT_DATE_PATTERN);
+ }
+ };
+
+ protected T conf;
+
+ public T getConf() {
return conf;
}
@Override
- public void setConf(final ReportletConf conf) {
+ public void setConf(final T conf) {
this.conf = conf;
}
+
+ protected abstract void doExtract(ContentHandler handler)
+ throws SAXException, ReportException;
+
+ @Override
+ @Transactional(readOnly = true)
+ public void extract(final ContentHandler handler)
+ throws SAXException, ReportException {
+
+ if (conf == null) {
+ throw new ReportException(new IllegalArgumentException("No configuration provided"));
+ }
+
+ AttributesImpl atts = new AttributesImpl();
+ atts.addAttribute("", "", ATTR_NAME, XSD_STRING, conf.getName());
+ atts.addAttribute("", "", ATTR_CLASS, XSD_STRING, getClass().getName());
+ handler.startElement("", "", ELEMENT_REPORTLET, atts);
+
+ doExtract(handler);
+
+ handler.endElement("", "", ELEMENT_REPORTLET);
+ }
}
Modified: incubator/syncope/trunk/core/src/main/java/org/syncope/core/report/Reportlet.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/syncope/core/report/Reportlet.java?rev=1297585&r1=1297584&r2=1297585&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/syncope/core/report/Reportlet.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/syncope/core/report/Reportlet.java Tue Mar 6 17:29:27 2012
@@ -27,14 +27,14 @@ import org.xml.sax.SAXException;
*
* @see org.syncope.core.persistence.beans.Report
*/
-public interface Reportlet {
+public interface Reportlet<T extends ReportletConf> {
/**
* Set this reportlet configuration.
*
* @param conf configuration
*/
- void setConf(ReportletConf conf);
+ void setConf(T conf);
/**
* Actual data extraction for reporting.
Added: incubator/syncope/trunk/core/src/main/java/org/syncope/core/report/ReportletConfClass.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/syncope/core/report/ReportletConfClass.java?rev=1297585&view=auto
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/syncope/core/report/ReportletConfClass.java (added)
+++ incubator/syncope/trunk/core/src/main/java/org/syncope/core/report/ReportletConfClass.java Tue Mar 6 17:29:27 2012
@@ -0,0 +1,32 @@
+/*
+ * 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.syncope.core.report;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import org.syncope.client.report.ReportletConf;
+
+@Target({ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface ReportletConfClass {
+
+ Class<? extends ReportletConf> value();
+}
Propchange: incubator/syncope/trunk/core/src/main/java/org/syncope/core/report/ReportletConfClass.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/syncope/trunk/core/src/main/java/org/syncope/core/report/ReportletConfClass.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: incubator/syncope/trunk/core/src/main/java/org/syncope/core/report/ReportletConfClass.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/syncope/trunk/core/src/main/java/org/syncope/core/report/StaticReportlet.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/syncope/core/report/StaticReportlet.java?rev=1297585&view=auto
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/syncope/core/report/StaticReportlet.java (added)
+++ incubator/syncope/trunk/core/src/main/java/org/syncope/core/report/StaticReportlet.java Tue Mar 6 17:29:27 2012
@@ -0,0 +1,79 @@
+/*
+ * 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.syncope.core.report;
+
+import org.springframework.util.StringUtils;
+import org.syncope.client.report.StaticReportletConf;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.SAXException;
+
+@ReportletConfClass(StaticReportletConf.class)
+public class StaticReportlet extends AbstractReportlet<StaticReportletConf> {
+
+ @Override
+ public void doExtract(final ContentHandler handler)
+ throws SAXException, ReportException {
+
+ if (StringUtils.hasText(conf.getStringField())) {
+ handler.startElement("", "", "string", null);
+ handler.characters(conf.getStringField().toCharArray(), 0, conf.getStringField().length() - 1);
+ handler.endElement("", "", "string");
+ }
+
+ if (conf.getLongField() != null) {
+ handler.startElement("", "", "long", null);
+ String printed = String.valueOf(conf.getLongField());
+ handler.characters(printed.toCharArray(), 0, printed.length() - 1);
+ handler.endElement("", "", "long");
+ }
+
+ if (conf.getDoubleField() != null) {
+ handler.startElement("", "", "double", null);
+ String printed = String.valueOf(conf.getDoubleField());
+ handler.characters(printed.toCharArray(), 0, printed.length() - 1);
+ handler.endElement("", "", "double");
+ }
+
+ if (conf.getDateField() != null) {
+ handler.startElement("", "", "date", null);
+ String printed = DATE_FORMAT.get().format(conf.getDateField());
+ handler.characters(printed.toCharArray(), 0, printed.length() - 1);
+ handler.endElement("", "", "date");
+ }
+
+ if (conf.getTraceLevel() != null) {
+ handler.startElement("", "", "enum", null);
+ String printed = conf.getTraceLevel().name();
+ handler.characters(printed.toCharArray(), 0, printed.length() - 1);
+ handler.endElement("", "", "enum");
+ }
+
+ if (conf.getListField() != null && !conf.getListField().isEmpty()) {
+ handler.startElement("", "", "list", null);
+ for (String item : conf.getListField()) {
+ if (StringUtils.hasText(item)) {
+ handler.startElement("", "", "string", null);
+ handler.characters(item.toCharArray(), 0, item.length() - 1);
+ handler.endElement("", "", "string");
+ }
+ }
+ handler.endElement("", "", "list");
+ }
+ }
+}
Propchange: incubator/syncope/trunk/core/src/main/java/org/syncope/core/report/StaticReportlet.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/syncope/trunk/core/src/main/java/org/syncope/core/report/StaticReportlet.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: incubator/syncope/trunk/core/src/main/java/org/syncope/core/report/StaticReportlet.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: incubator/syncope/trunk/core/src/main/java/org/syncope/core/report/UserReportlet.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/syncope/core/report/UserReportlet.java?rev=1297585&r1=1297584&r2=1297585&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/syncope/core/report/UserReportlet.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/syncope/core/report/UserReportlet.java Tue Mar 6 17:29:27 2012
@@ -18,16 +18,11 @@
*/
package org.syncope.core.report;
-import java.text.SimpleDateFormat;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
-import org.syncope.client.SyncopeConstants;
import org.syncope.client.report.UserReportletConf;
import org.syncope.client.report.UserReportletConf.Feature;
import org.syncope.client.to.AbstractAttributableTO;
@@ -47,26 +42,11 @@ import org.xml.sax.ContentHandler;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.AttributesImpl;
-public class UserReportlet extends AbstractReportlet {
-
- /**
- * Logger.
- */
- private static final Logger LOG =
- LoggerFactory.getLogger(UserReportlet.class);
+@ReportletConfClass(UserReportletConf.class)
+public class UserReportlet extends AbstractReportlet<UserReportletConf> {
private final static int PAGE_SIZE = 10;
- private static final ThreadLocal<SimpleDateFormat> DATE_FORMAT =
- new ThreadLocal<SimpleDateFormat>() {
-
- @Override
- protected SimpleDateFormat initialValue() {
- return new SimpleDateFormat(
- SyncopeConstants.DEFAULT_DATE_PATTERN);
- }
- };
-
@Autowired
private EntitlementDAO entitlementDAO;
@@ -82,21 +62,16 @@ public class UserReportlet extends Abstr
@Autowired
private RoleDataBinder roleDataBinder;
- private List<SyncopeUser> getPagedUsers(final UserReportletConf conf,
- final int page) {
-
- Set<Long> adminRoleIds =
- EntitlementUtil.getRoleIds(entitlementDAO.findAll());
+ private List<SyncopeUser> getPagedUsers(final int page) {
+ Set<Long> adminRoleIds = EntitlementUtil.getRoleIds(entitlementDAO.findAll());
return conf.getMatchingCond() == null
? userDAO.findAll(adminRoleIds, page, PAGE_SIZE)
- : searchDAO.search(adminRoleIds, conf.getMatchingCond(),
- page, PAGE_SIZE);
+ : searchDAO.search(adminRoleIds, conf.getMatchingCond(), page, PAGE_SIZE);
}
- private int count(final UserReportletConf conf) {
- Set<Long> adminRoleIds =
- EntitlementUtil.getRoleIds(entitlementDAO.findAll());
+ private int count() {
+ Set<Long> adminRoleIds = EntitlementUtil.getRoleIds(entitlementDAO.findAll());
return conf.getMatchingCond() == null
? userDAO.count(adminRoleIds)
@@ -225,9 +200,7 @@ public class UserReportlet extends Abstr
}
}
- private void doExtract(final ContentHandler handler,
- final UserReportletConf conf,
- final List<SyncopeUser> users)
+ private void doExtract(final ContentHandler handler, final List<SyncopeUser> users)
throws SAXException, ReportException {
AttributesImpl atts = new AttributesImpl();
@@ -261,28 +234,24 @@ public class UserReportlet extends Abstr
case creationDate:
type = XSD_DATETIME;
value = user.getCreationDate() == null ? ""
- : DATE_FORMAT.get().format(
- user.getCreationDate());
+ : DATE_FORMAT.get().format(user.getCreationDate());
break;
case lastLoginDate:
type = XSD_DATETIME;
value = user.getLastLoginDate() == null ? ""
- : DATE_FORMAT.get().
- format(user.getLastLoginDate());
+ : DATE_FORMAT.get().format(user.getLastLoginDate());
break;
case changePwdDate:
type = XSD_DATETIME;
value = user.getChangePwdDate() == null ? ""
- : DATE_FORMAT.get().format(
- user.getChangePwdDate());
+ : DATE_FORMAT.get().format(user.getChangePwdDate());
break;
case passwordHistorySize:
type = XSD_INT;
- value = String.valueOf(
- user.getPasswordHistory().size());
+ value = String.valueOf(user.getPasswordHistory().size());
break;
case failedLoginCount:
@@ -313,12 +282,9 @@ public class UserReportlet extends Abstr
for (MembershipTO memb : userTO.getMemberships()) {
atts.clear();
- atts.addAttribute("", "", "id", XSD_LONG,
- String.valueOf(memb.getId()));
- atts.addAttribute("", "", "roleId", XSD_LONG,
- String.valueOf(memb.getRoleId()));
- atts.addAttribute("", "", "roleName", XSD_STRING,
- String.valueOf(memb.getRoleName()));
+ atts.addAttribute("", "", "id", XSD_LONG, String.valueOf(memb.getId()));
+ atts.addAttribute("", "", "roleId", XSD_LONG, String.valueOf(memb.getRoleId()));
+ atts.addAttribute("", "", "roleName", XSD_STRING, String.valueOf(memb.getRoleName()));
handler.startElement("", "", "membership", atts);
doExtractAttributes(handler, memb,
@@ -327,11 +293,9 @@ public class UserReportlet extends Abstr
memb.getVirtualAttributeMap().keySet());
if (conf.getFeatures().contains(Feature.resources)) {
- Membership actualMemb =
- user.getMembership(memb.getRoleId());
+ Membership actualMemb = user.getMembership(memb.getRoleId());
if (actualMemb == null) {
- LOG.warn("Unexpected: cannot find membership for "
- + "role {} for user {}",
+ LOG.warn("Unexpected: cannot find membership for role {} for user {}",
memb.getRoleId(), user);
} else {
doExtractResources(handler,
@@ -355,28 +319,11 @@ public class UserReportlet extends Abstr
}
@Override
- @Transactional(readOnly = true)
- public void extract(final ContentHandler handler)
+ protected void doExtract(final ContentHandler handler)
throws SAXException, ReportException {
- if (getConf() == null || !(getConf() instanceof UserReportletConf)) {
- throw new ReportException(
- new IllegalArgumentException("Expected "
- + UserReportletConf.class.getName()
- + ", got " + getConf()));
+ for (int i = 1; i <= (count() / PAGE_SIZE) + 1; i++) {
+ doExtract(handler, getPagedUsers(i));
}
-
- UserReportletConf conf = (UserReportletConf) getConf();
-
- AttributesImpl atts = new AttributesImpl();
- atts.addAttribute("", "", ATTR_NAME, XSD_STRING, getConf().getName());
- atts.addAttribute("", "", ATTR_CLASS, XSD_STRING, getClass().getName());
- handler.startElement("", "", ELEMENT_REPORTLET, atts);
-
- for (int i = 1; i <= (count(conf) / PAGE_SIZE) + 1; i++) {
- doExtract(handler, conf, getPagedUsers(conf, i));
- }
-
- handler.endElement("", "", ELEMENT_REPORTLET);
}
}
Modified: incubator/syncope/trunk/core/src/main/java/org/syncope/core/rest/controller/ReportController.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/syncope/core/rest/controller/ReportController.java?rev=1297585&r1=1297584&r2=1297585&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/syncope/core/rest/controller/ReportController.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/syncope/core/rest/controller/ReportController.java Tue Mar 6 17:29:27 2012
@@ -20,7 +20,6 @@ package org.syncope.core.rest.controller
import java.io.ByteArrayInputStream;
import java.io.IOException;
-import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
@@ -38,15 +37,11 @@ import org.apache.cocoon.sax.SAXPipeline
import org.apache.cocoon.sax.component.XMLGenerator;
import org.apache.cocoon.sax.component.XMLSerializer;
import org.apache.cocoon.sax.component.XSLTTransformer;
-import org.apache.commons.lang.ArrayUtils;
import org.apache.xmlgraphics.util.MimeConstants;
import org.quartz.JobDataMap;
import org.quartz.Scheduler;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.core.io.Resource;
import org.springframework.core.io.support.ResourcePatternResolver;
-import org.springframework.core.type.ClassMetadata;
-import org.springframework.core.type.classreading.CachingMetadataReaderFactory;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.scheduling.quartz.SchedulerFactoryBean;
@@ -59,6 +54,7 @@ import org.springframework.web.bind.anno
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
+import org.syncope.client.report.ReportletConf;
import org.syncope.client.to.ReportExecTO;
import org.syncope.client.to.ReportTO;
import org.syncope.client.validation.SyncopeClientCompositeErrorException;
@@ -68,7 +64,6 @@ import org.syncope.core.persistence.bean
import org.syncope.core.persistence.beans.ReportExec;
import org.syncope.core.persistence.dao.ReportDAO;
import org.syncope.core.persistence.dao.ReportExecDAO;
-import org.syncope.core.report.AbstractReportlet;
import org.syncope.core.report.Reportlet;
import org.syncope.core.rest.data.ReportDataBinder;
import org.syncope.types.ReportExecExportFormat;
@@ -196,33 +191,19 @@ public class ReportController extends Ab
}
@PreAuthorize("hasRole('REPORT_LIST')")
- @RequestMapping(method = RequestMethod.GET, value = "/reportletClasses")
- public ModelAndView getReportletClasses() {
- CachingMetadataReaderFactory cachingMetadataReaderFactory = new CachingMetadataReaderFactory();
-
- Set<String> reportletClasses = new HashSet<String>();
- try {
- for (Resource resource : resResolver.getResources("classpath*:**/*.class")) {
- ClassMetadata metadata = cachingMetadataReaderFactory.getMetadataReader(resource).getClassMetadata();
- if (ArrayUtils.contains(metadata.getInterfaceNames(), Reportlet.class.getName())
- || AbstractReportlet.class.getName().equals(metadata.getSuperClassName())) {
-
- try {
- Class jobClass = Class.forName(metadata.getClassName());
- if (!Modifier.isAbstract(jobClass.getModifiers())) {
- reportletClasses.add(jobClass.getName());
- }
- } catch (ClassNotFoundException e) {
- LOG.error("Could not load class {}", metadata.getClassName(), e);
- }
- }
+ @RequestMapping(method = RequestMethod.GET, value = "/reportletConfClasses")
+ public ModelAndView getReportletConfClasses() {
+ Set<String> reportletConfClasses = new HashSet<String>();
+
+ for (Class<Reportlet> reportletClass : binder.getAllReportletClasses()) {
+ Class<? extends ReportletConf> reportletConfClass = binder.getReportletConfClass(reportletClass);
+ if (reportletConfClass != null) {
+ reportletConfClasses.add(reportletConfClass.getName());
}
- } catch (IOException e) {
- LOG.error("While searching for class implementing {}", Reportlet.class.getName(), e);
}
ModelAndView result = new ModelAndView();
- result.addObject(reportletClasses);
+ result.addObject(reportletConfClasses);
return result;
}
Modified: incubator/syncope/trunk/core/src/main/java/org/syncope/core/rest/data/ReportDataBinder.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/syncope/core/rest/data/ReportDataBinder.java?rev=1297585&r1=1297584&r2=1297585&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/syncope/core/rest/data/ReportDataBinder.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/syncope/core/rest/data/ReportDataBinder.java Tue Mar 6 17:29:27 2012
@@ -18,6 +18,11 @@
*/
package org.syncope.core.rest.data;
+import java.io.IOException;
+import java.lang.reflect.Modifier;
+import java.util.HashSet;
+import java.util.Set;
+import org.apache.commons.lang.ArrayUtils;
import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.quartz.Trigger;
@@ -25,6 +30,10 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.io.Resource;
+import org.springframework.core.io.support.ResourcePatternResolver;
+import org.springframework.core.type.ClassMetadata;
+import org.springframework.core.type.classreading.CachingMetadataReaderFactory;
import org.springframework.scheduling.quartz.SchedulerFactoryBean;
import org.springframework.stereotype.Component;
import org.syncope.client.report.ReportletConf;
@@ -34,6 +43,9 @@ import org.syncope.core.init.JobInstance
import org.syncope.core.persistence.beans.Report;
import org.syncope.core.persistence.beans.ReportExec;
import org.syncope.core.persistence.dao.ReportExecDAO;
+import org.syncope.core.report.AbstractReportlet;
+import org.syncope.core.report.Reportlet;
+import org.syncope.core.report.ReportletConfClass;
@Component
public class ReportDataBinder {
@@ -56,6 +68,59 @@ public class ReportDataBinder {
@Autowired
private SchedulerFactoryBean scheduler;
+ @Autowired
+ private ResourcePatternResolver resResolver;
+
+ public Set<Class<Reportlet>> getAllReportletClasses() {
+ CachingMetadataReaderFactory cachingMetadataReaderFactory = new CachingMetadataReaderFactory();
+
+ Set<Class<Reportlet>> reportletClasses = new HashSet<Class<Reportlet>>();
+ try {
+ for (Resource resource : resResolver.getResources("classpath*:**/*.class")) {
+ ClassMetadata metadata = cachingMetadataReaderFactory.getMetadataReader(resource).getClassMetadata();
+ if (ArrayUtils.contains(metadata.getInterfaceNames(), Reportlet.class.getName())
+ || AbstractReportlet.class.getName().equals(metadata.getSuperClassName())) {
+
+ try {
+ Class jobClass = Class.forName(metadata.getClassName());
+ if (!Modifier.isAbstract(jobClass.getModifiers())) {
+ reportletClasses.add(jobClass);
+ }
+ } catch (ClassNotFoundException e) {
+ LOG.error("Could not load class {}", metadata.getClassName(), e);
+ }
+ }
+ }
+ } catch (IOException e) {
+ LOG.error("While searching for class implementing {}", Reportlet.class.getName(), e);
+ }
+
+ return reportletClasses;
+ }
+
+ public Class<? extends ReportletConf> getReportletConfClass(final Class<Reportlet> reportletClass) {
+ Class<? extends ReportletConf> result = null;
+
+ ReportletConfClass annotation = reportletClass.getAnnotation(ReportletConfClass.class);
+ if (annotation != null) {
+ result = annotation.value();
+ }
+
+ return result;
+ }
+
+ public Class<Reportlet> findReportletClassHavingConfClass(final Class<? extends ReportletConf> reportletConfClass) {
+ Class<Reportlet> result = null;
+ for (Class<Reportlet> reportletClass : getAllReportletClasses()) {
+ Class<? extends ReportletConf> found = getReportletConfClass(reportletClass);
+ if (found != null && found.equals(reportletConfClass)) {
+ result = reportletClass;
+ }
+ }
+
+ return result;
+ }
+
public void getReport(final Report report, final ReportTO reportTO) {
BeanUtils.copyProperties(reportTO, report, IGNORE_REPORT_PROPERTIES);
report.setReportletConfs(null);
Modified: incubator/syncope/trunk/core/src/main/java/org/syncope/core/scheduling/ReportJob.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/java/org/syncope/core/scheduling/ReportJob.java?rev=1297585&r1=1297584&r2=1297585&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/java/org/syncope/core/scheduling/ReportJob.java (original)
+++ incubator/syncope/trunk/core/src/main/java/org/syncope/core/scheduling/ReportJob.java Tue Mar 6 17:29:27 2012
@@ -46,6 +46,7 @@ import org.syncope.core.persistence.dao.
import org.syncope.core.persistence.dao.ReportExecDAO;
import org.syncope.core.report.ReportException;
import org.syncope.core.report.Reportlet;
+import org.syncope.core.rest.data.ReportDataBinder;
import static org.syncope.core.scheduling.ReportXMLConst.ATTR_NAME;
import static org.syncope.core.scheduling.ReportXMLConst.ELEMENT_REPORT;
import static org.syncope.core.scheduling.ReportXMLConst.XSD_STRING;
@@ -61,8 +62,7 @@ public class ReportJob implements Statef
/**
* Logger.
*/
- private static final Logger LOG = LoggerFactory.getLogger(
- ReportJob.class);
+ private static final Logger LOG = LoggerFactory.getLogger(ReportJob.class);
/**
* Report DAO.
@@ -76,6 +76,9 @@ public class ReportJob implements Statef
@Autowired
private ReportExecDAO reportExecDAO;
+ @Autowired
+ private ReportDataBinder dataBinder;
+
/**
* Id, set by the caller, for identifying the report to be executed.
*/
@@ -96,8 +99,7 @@ public class ReportJob implements Statef
Report report = reportDAO.find(reportId);
if (report == null) {
- throw new JobExecutionException(
- "Report " + reportId + " not found");
+ throw new JobExecutionException("Report " + reportId + " not found");
}
// 1. create execution
@@ -114,8 +116,7 @@ public class ReportJob implements Statef
ZipOutputStream zos = new ZipOutputStream(baos);
zos.setLevel(Deflater.BEST_COMPRESSION);
try {
- SAXTransformerFactory transformerFactory =
- (SAXTransformerFactory) SAXTransformerFactory.newInstance();
+ SAXTransformerFactory transformerFactory = (SAXTransformerFactory) SAXTransformerFactory.newInstance();
handler = transformerFactory.newTransformerHandler();
Transformer serializer = handler.getTransformer();
serializer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
@@ -134,9 +135,7 @@ public class ReportJob implements Statef
execution.setStatus(ReportExecStatus.RUNNING);
execution = reportExecDAO.save(execution);
- ConfigurableListableBeanFactory beanFactory =
- ApplicationContextManager.getApplicationContext().
- getBeanFactory();
+ ConfigurableListableBeanFactory beanFactory = ApplicationContextManager.getApplicationContext().getBeanFactory();
// 3. actual report execution
StringBuilder reportExecutionMessage = new StringBuilder();
@@ -150,19 +149,9 @@ public class ReportJob implements Statef
// iterate over reportlet instances defined for this report
for (ReportletConf reportletConf : report.getReportletConfs()) {
- Class reportletClass = null;
- try {
- reportletClass = Class.forName(
- reportletConf.getReportletClassName());
- } catch (ClassNotFoundException e) {
- LOG.error("Reportlet class not found: {}",
- reportletConf.getReportletClassName(), e);
-
- }
-
+ Class<Reportlet> reportletClass = dataBinder.findReportletClassHavingConfClass(reportletConf.getClass());
if (reportletClass != null) {
- Reportlet autowired =
- (Reportlet) beanFactory.createBean(reportletClass,
+ Reportlet autowired = (Reportlet) beanFactory.createBean(reportletClass,
AbstractBeanDefinition.AUTOWIRE_BY_TYPE, false);
autowired.setConf(reportletConf);
@@ -187,9 +176,7 @@ public class ReportJob implements Statef
handler.endElement("", "", ELEMENT_REPORT);
handler.endDocument();
- if (!ReportExecStatus.FAILURE.name().
- equals(execution.getStatus())) {
-
+ if (!ReportExecStatus.FAILURE.name().equals(execution.getStatus())) {
execution.setStatus(ReportExecStatus.SUCCESS);
}
} catch (Exception e) {
Modified: incubator/syncope/trunk/core/src/main/resources/report/report2fo.xsl
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/resources/report/report2fo.xsl?rev=1297585&r1=1297584&r2=1297585&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/resources/report/report2fo.xsl (original)
+++ incubator/syncope/trunk/core/src/main/resources/report/report2fo.xsl Tue Mar 6 17:29:27 2012
@@ -24,6 +24,7 @@ under the License.
version="1.0">
<xsl:import href="userReportlet2fo.xsl"/>
+ <xsl:import href="staticReportlet2fo.xsl"/>
<xsl:param name="status"/>
<xsl:param name="message"/>
@@ -48,7 +49,7 @@ under the License.
<fo:flow flow-name="xsl-region-body">
<fo:block font-size="24pt" font-weight="bold" text-align="center" space-after="1cm">
- Syncope Report - <xsl:value-of select="report/@name"/>
+ Apache Syncope Report - <xsl:value-of select="report/@name"/>
</fo:block>
<fo:table table-layout="fixed" border-width="0.5mm" border-style="solid" width="100%" space-after="1cm">
Modified: incubator/syncope/trunk/core/src/main/resources/report/report2html.xsl
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/resources/report/report2html.xsl?rev=1297585&r1=1297584&r2=1297585&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/main/resources/report/report2html.xsl (original)
+++ incubator/syncope/trunk/core/src/main/resources/report/report2html.xsl Tue Mar 6 17:29:27 2012
@@ -23,6 +23,7 @@ under the License.
version="1.0">
<xsl:import href="userReportlet2html.xsl"/>
+ <xsl:import href="staticReportlet2html.xsl"/>
<xsl:param name="status"/>
<xsl:param name="message"/>
@@ -33,7 +34,7 @@ under the License.
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
- <title>Syncope Report - <xsl:value-of select="report/@name"/></title>
+ <title>Apache Syncope Report - <xsl:value-of select="report/@name"/></title>
</head>
<body>
<table style="border: 1px solid black;">
Added: incubator/syncope/trunk/core/src/main/resources/report/staticReportlet2fo.xsl
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/resources/report/staticReportlet2fo.xsl?rev=1297585&view=auto
==============================================================================
--- incubator/syncope/trunk/core/src/main/resources/report/staticReportlet2fo.xsl (added)
+++ incubator/syncope/trunk/core/src/main/resources/report/staticReportlet2fo.xsl Tue Mar 6 17:29:27 2012
@@ -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.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
Propchange: incubator/syncope/trunk/core/src/main/resources/report/staticReportlet2fo.xsl
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/syncope/trunk/core/src/main/resources/report/staticReportlet2fo.xsl
------------------------------------------------------------------------------
svn:keywords = Date Revision Author HeadURL Id
Propchange: incubator/syncope/trunk/core/src/main/resources/report/staticReportlet2fo.xsl
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: incubator/syncope/trunk/core/src/main/resources/report/staticReportlet2html.xsl
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/main/resources/report/staticReportlet2html.xsl?rev=1297585&view=auto
==============================================================================
--- incubator/syncope/trunk/core/src/main/resources/report/staticReportlet2html.xsl (added)
+++ incubator/syncope/trunk/core/src/main/resources/report/staticReportlet2html.xsl Tue Mar 6 17:29:27 2012
@@ -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.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
Propchange: incubator/syncope/trunk/core/src/main/resources/report/staticReportlet2html.xsl
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/syncope/trunk/core/src/main/resources/report/staticReportlet2html.xsl
------------------------------------------------------------------------------
svn:keywords = Date Revision Author HeadURL Id
Propchange: incubator/syncope/trunk/core/src/main/resources/report/staticReportlet2html.xsl
------------------------------------------------------------------------------
svn:mime-type = text/xml
Modified: incubator/syncope/trunk/core/src/test/java/org/syncope/core/rest/ConnInstanceTestITCase.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/test/java/org/syncope/core/rest/ConnInstanceTestITCase.java?rev=1297585&r1=1297584&r2=1297585&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/test/java/org/syncope/core/rest/ConnInstanceTestITCase.java (original)
+++ incubator/syncope/trunk/core/src/test/java/org/syncope/core/rest/ConnInstanceTestITCase.java Tue Mar 6 17:29:27 2012
@@ -45,13 +45,13 @@ import org.syncope.types.ConnConfPropert
import org.syncope.types.ConnectorCapability;
public class ConnInstanceTestITCase extends AbstractTest {
-
+
private static String connidSoapVersion;
-
+
private static String connidDbTableVersion;
-
+
private static String bundlesDirectory;
-
+
@BeforeClass
public static void init() {
Properties props = new Properties();
@@ -77,15 +77,15 @@ public class ConnInstanceTestITCase exte
assertNotNull(connidSoapVersion);
assertNotNull(bundlesDirectory);
}
-
+
@Test(expected = SyncopeClientCompositeErrorException.class)
public void createWithException() {
ConnInstanceTO connectorTO = new ConnInstanceTO();
-
+
restTemplate.postForObject(BASE_URL + "connector/create.json",
connectorTO, ConnInstanceTO.class);
}
-
+
@Test
public void create() {
ConnInstanceTO connectorTO = new ConnInstanceTO();
@@ -98,12 +98,12 @@ public class ConnInstanceTestITCase exte
// set bundle name
connectorTO.setBundleName("org.connid.bundles.soap");
-
+
connectorTO.setDisplayName("Display name");
// set the connector configuration using PropertyTO
Set<ConnConfProperty> conf = new HashSet<ConnConfProperty>();
-
+
ConnConfPropSchema endpointSchema = new ConnConfPropSchema();
endpointSchema.setName("endpoint");
endpointSchema.setType(String.class.getName());
@@ -112,7 +112,7 @@ public class ConnInstanceTestITCase exte
endpoint.setSchema(endpointSchema);
endpoint.setValues(Collections.singletonList(
"http://localhost:8888/wssample/services"));
-
+
ConnConfPropSchema servicenameSchema = new ConnConfPropSchema();
servicenameSchema.setName("servicename");
servicenameSchema.setType(String.class.getName());
@@ -120,7 +120,7 @@ public class ConnInstanceTestITCase exte
ConnConfProperty servicename = new ConnConfProperty();
servicename.setSchema(servicenameSchema);
servicename.setValues(Collections.singletonList("Provisioning"));
-
+
conf.add(endpoint);
conf.add(servicename);
@@ -131,24 +131,24 @@ public class ConnInstanceTestITCase exte
connectorTO.addCapability(ConnectorCapability.TWO_PHASES_CREATE);
connectorTO.addCapability(ConnectorCapability.ONE_PHASE_CREATE);
connectorTO.addCapability(ConnectorCapability.TWO_PHASES_UPDATE);
-
+
ConnInstanceTO actual = restTemplate.postForObject(
BASE_URL + "connector/create.json",
connectorTO, ConnInstanceTO.class);
-
+
assertNotNull(actual);
-
+
assertEquals(actual.getBundleName(), connectorTO.getBundleName());
assertEquals(actual.getConnectorName(), connectorTO.getConnectorName());
assertEquals(actual.getVersion(), connectorTO.getVersion());
assertEquals("Display name", actual.getDisplayName());
assertEquals(connectorTO.getCapabilities(), actual.getCapabilities());
-
+
Throwable t = null;
// check for the updating
connectorTO.setId(actual.getId());
-
+
connectorTO.removeCapability(ConnectorCapability.TWO_PHASES_UPDATE);
actual = null;
try {
@@ -159,7 +159,7 @@ public class ConnInstanceTestITCase exte
LOG.error("update failed", e);
t = e;
}
-
+
assertNull(t);
assertNotNull(actual);
assertEquals(connectorTO.getCapabilities(), actual.getCapabilities());
@@ -173,7 +173,7 @@ public class ConnInstanceTestITCase exte
LOG.error("delete failed", e);
t = e;
}
-
+
assertNull(t);
// check the non existence
@@ -186,7 +186,7 @@ public class ConnInstanceTestITCase exte
assertEquals(e.getStatusCode(), HttpStatus.NOT_FOUND);
}
}
-
+
@Test
public void update() {
ConnInstanceTO connectorTO = new ConnInstanceTO();
@@ -205,7 +205,7 @@ public class ConnInstanceTestITCase exte
// set the connector configuration using PropertyTO
Set<ConnConfProperty> conf = new HashSet<ConnConfProperty>();
-
+
ConnConfPropSchema endpointSchema = new ConnConfPropSchema();
endpointSchema.setName("endpoint");
endpointSchema.setType(String.class.getName());
@@ -215,7 +215,7 @@ public class ConnInstanceTestITCase exte
endpoint.setValues(
Collections.singletonList(
"http://localhost:8888/wssample/services"));
-
+
ConnConfPropSchema servicenameSchema = new ConnConfPropSchema();
servicenameSchema.setName("servicename");
servicenameSchema.setType(String.class.getName());
@@ -223,30 +223,30 @@ public class ConnInstanceTestITCase exte
ConnConfProperty servicename = new ConnConfProperty();
servicename.setSchema(servicenameSchema);
servicename.setValues(Collections.singletonList("Provisioning"));
-
+
conf.add(endpoint);
conf.add(servicename);
// set connector configuration
connectorTO.setConfiguration(conf);
-
+
ConnInstanceTO actual = (ConnInstanceTO) restTemplate.postForObject(
BASE_URL + "connector/update.json",
connectorTO, ConnInstanceTO.class);
-
+
assertNotNull(actual);
-
+
actual = restTemplate.getForObject(
BASE_URL + "connector/read/{connectorId}",
ConnInstanceTO.class,
String.valueOf(actual.getId()));
-
+
assertNotNull(actual);
assertEquals(actual.getBundleName(), connectorTO.getBundleName());
assertEquals(actual.getConnectorName(), connectorTO.getConnectorName());
assertEquals(actual.getVersion(), connectorTO.getVersion());
}
-
+
@Test
public void issueSYNCOPE10() {
// ----------------------------------
@@ -256,14 +256,14 @@ public class ConnInstanceTestITCase exte
ConnInstanceTO connInstanceTO = restTemplate.getForObject(
BASE_URL + "connector/read/{connectorId}",
ConnInstanceTO.class, 103L);
-
+
assertNotNull(connInstanceTO);
// check for resource
List<ResourceTO> resources = Arrays.asList(restTemplate.getForObject(
BASE_URL + "resource/list.json?connInstanceId=103",
ResourceTO[].class));
-
+
assertEquals(1, resources.size());
// Retrieve a resource TO template.
@@ -274,6 +274,7 @@ public class ConnInstanceTestITCase exte
// Make it new.
connInstanceTO.setId(0);
+ connInstanceTO.setDisplayName("newDisplayName");
// ----------------------------------
// ----------------------------------
@@ -282,10 +283,10 @@ public class ConnInstanceTestITCase exte
connInstanceTO = restTemplate.postForObject(
BASE_URL + "connector/create.json",
connInstanceTO, ConnInstanceTO.class);
-
+
assertNotNull(connInstanceTO);
assertTrue(connInstanceTO.getCapabilities().isEmpty());
-
+
long connId = connInstanceTO.getId();
// Link resourceTO to the new connector instance.
@@ -298,13 +299,13 @@ public class ConnInstanceTestITCase exte
resourceTO = restTemplate.postForObject(
BASE_URL + "resource/create.json",
resourceTO, ResourceTO.class);
-
+
assertNotNull(resourceTO);
-
+
resources = Arrays.asList(restTemplate.getForObject(
BASE_URL + "resource/list.json?connInstanceId=" + connId,
ResourceTO[].class));
-
+
assertEquals(1, resources.size());
// ----------------------------------
@@ -314,7 +315,7 @@ public class ConnInstanceTestITCase exte
ConnInstanceTO connInstanceBean = restTemplate.getForObject(
BASE_URL + "connector/{resourceName}/connectorBean",
ConnInstanceTO.class, resourceTO.getName());
-
+
assertNotNull(connInstanceBean);
assertTrue(connInstanceBean.getCapabilities().isEmpty());
// ----------------------------------
@@ -323,11 +324,11 @@ public class ConnInstanceTestITCase exte
// Check for spring bean update after connector instance update.
// ----------------------------------
connInstanceTO.addCapability(ConnectorCapability.SEARCH);
-
+
ConnInstanceTO actual = (ConnInstanceTO) restTemplate.postForObject(
BASE_URL + "connector/update.json",
connInstanceTO, ConnInstanceTO.class);
-
+
assertNotNull(actual);
assertFalse(connInstanceTO.getCapabilities().isEmpty());
@@ -335,11 +336,11 @@ public class ConnInstanceTestITCase exte
connInstanceBean = restTemplate.getForObject(
BASE_URL + "connector/{resourceName}/connectorBean",
ConnInstanceTO.class, resourceTO.getName());
-
+
assertFalse(connInstanceBean.getCapabilities().isEmpty());
// ----------------------------------
}
-
+
@Test
public void deleteWithException() {
try {
@@ -349,7 +350,7 @@ public class ConnInstanceTestITCase exte
assertEquals(HttpStatus.NOT_FOUND, e.getStatusCode());
}
}
-
+
@Test
public void list() {
List<ConnInstanceTO> connectorInstanceTOs = Arrays.asList(
@@ -361,16 +362,16 @@ public class ConnInstanceTestITCase exte
assertNotNull(instance);
}
}
-
+
@Test
public void read() {
ConnInstanceTO connectorInstanceTO = restTemplate.getForObject(
BASE_URL + "connector/read/{connectorId}.json",
ConnInstanceTO.class, "100");
-
+
assertNotNull(connectorInstanceTO);
}
-
+
@Test
public void getBundles() {
List<ConnBundleTO> bundles = Arrays.asList(
@@ -383,7 +384,7 @@ public class ConnInstanceTestITCase exte
assertNotNull(bundle);
}
}
-
+
@Test
public void getConnectorConfiguration() {
List<ConnConfProperty> props = Arrays.asList(restTemplate.getForObject(
@@ -392,15 +393,15 @@ public class ConnInstanceTestITCase exte
assertNotNull(props);
assertFalse(props.isEmpty());
}
-
+
@Test
public void checkHiddenProperty() {
ConnInstanceTO connInstanceTO = restTemplate.getForObject(
BASE_URL + "connector/read/{connectorId}.json",
ConnInstanceTO.class, "100");
-
+
boolean check = false;
-
+
for (ConnConfProperty prop : connInstanceTO.getConfiguration()) {
if ("receiveTimeout".equals(prop.getSchema().getName())) {
check = true;
@@ -408,7 +409,7 @@ public class ConnInstanceTestITCase exte
}
assertTrue(check);
}
-
+
@Test
public void checkSelectedLanguage() {
// 1. Check Italian
@@ -416,12 +417,12 @@ public class ConnInstanceTestITCase exte
Arrays.asList(restTemplate.getForObject(
BASE_URL + "connector/list.json?lang=it",
ConnInstanceTO[].class));
-
+
Map<String, ConnConfProperty> instanceConfMap;
for (ConnInstanceTO instance : connectorInstanceTOs) {
if ("org.connid.bundles.db.table".equals(
instance.getBundleName())) {
-
+
instanceConfMap = instance.getConfigurationMap();
assertEquals("Utente", instanceConfMap.get("user").
getSchema().getDisplayName());
@@ -433,21 +434,21 @@ public class ConnInstanceTestITCase exte
Arrays.asList(restTemplate.getForObject(
BASE_URL + "connector/list.json",
ConnInstanceTO[].class));
-
+
for (ConnInstanceTO instance : connectorInstanceTOs) {
if ("org.connid.bundles.db.table".equals(
instance.getBundleName())) {
-
+
instanceConfMap = instance.getConfigurationMap();
assertEquals("User", instanceConfMap.get("user").
getSchema().getDisplayName());
}
}
}
-
+
@Test
public void check() {
-
+
ConnInstanceTO connectorTO = new ConnInstanceTO();
// set connector version
@@ -458,12 +459,12 @@ public class ConnInstanceTestITCase exte
// set bundle name
connectorTO.setBundleName("org.connid.bundles.db.table");
-
+
connectorTO.setDisplayName("H2Test");
// set the connector configuration using PropertyTO
Set<ConnConfProperty> conf = new HashSet<ConnConfProperty>();
-
+
ConnConfPropSchema userSchema = new ConnConfPropSchema();
userSchema.setName("user");
userSchema.setType(String.class.getName());
@@ -471,7 +472,7 @@ public class ConnInstanceTestITCase exte
ConnConfProperty user = new ConnConfProperty();
user.setSchema(userSchema);
user.setValues(Collections.singletonList("sa"));
-
+
ConnConfPropSchema keyColumnSchema = new ConnConfPropSchema();
keyColumnSchema.setName("keyColumn");
keyColumnSchema.setType(String.class.getName());
@@ -479,7 +480,7 @@ public class ConnInstanceTestITCase exte
ConnConfProperty keyColumn = new ConnConfProperty();
keyColumn.setSchema(keyColumnSchema);
keyColumn.setValues(Collections.singletonList("id"));
-
+
ConnConfPropSchema jdbcUrlTemplateSchema = new ConnConfPropSchema();
jdbcUrlTemplateSchema.setName("jdbcUrlTemplate");
jdbcUrlTemplateSchema.setType(String.class.getName());
@@ -488,7 +489,7 @@ public class ConnInstanceTestITCase exte
jdbcUrlTemplate.setSchema(jdbcUrlTemplateSchema);
jdbcUrlTemplate.setValues(Collections.singletonList(
"jdbc:h2:tcp://localhost:9092/testdb"));
-
+
ConnConfPropSchema passwordColumnSchema = new ConnConfPropSchema();
passwordColumnSchema.setName("passwordColumn");
passwordColumnSchema.setType(String.class.getName());
@@ -496,7 +497,7 @@ public class ConnInstanceTestITCase exte
ConnConfProperty passwordColumn = new ConnConfProperty();
passwordColumn.setSchema(passwordColumnSchema);
passwordColumn.setValues(Collections.singletonList("password"));
-
+
ConnConfPropSchema tableSchema = new ConnConfPropSchema();
tableSchema.setName("table");
tableSchema.setType(String.class.getName());
@@ -504,7 +505,7 @@ public class ConnInstanceTestITCase exte
ConnConfProperty table = new ConnConfProperty();
table.setSchema(tableSchema);
table.setValues(Collections.singletonList("test"));
-
+
ConnConfPropSchema passwordSchema = new ConnConfPropSchema();
passwordSchema.setName("password");
passwordSchema.setType(GuardedString.class.getName());
@@ -512,7 +513,7 @@ public class ConnInstanceTestITCase exte
ConnConfProperty password = new ConnConfProperty();
password.setSchema(passwordSchema);
password.setValues(Collections.singletonList("sa"));
-
+
ConnConfPropSchema jdbcDriverSchema = new ConnConfPropSchema();
jdbcDriverSchema.setName("jdbcDriver");
jdbcDriverSchema.setType(String.class.getName());
@@ -520,7 +521,7 @@ public class ConnInstanceTestITCase exte
ConnConfProperty jdbcDriver = new ConnConfProperty();
jdbcDriver.setSchema(jdbcDriverSchema);
jdbcDriver.setValues(Collections.singletonList("org.h2.Driver"));
-
+
conf.add(user);
conf.add(keyColumn);
conf.add(jdbcUrlTemplate);
@@ -531,53 +532,53 @@ public class ConnInstanceTestITCase exte
// set connector configuration
connectorTO.setConfiguration(conf);
-
+
Boolean verify = restTemplate.postForObject(
BASE_URL + "connector/check.json",
connectorTO, Boolean.class);
-
+
assertTrue(verify);
-
+
conf.remove(password);
password.setValues(Collections.singletonList("password"));
conf.add(password);
-
+
verify = restTemplate.postForObject(
BASE_URL + "connector/check.json",
connectorTO, Boolean.class);
-
+
assertFalse(verify);
}
-
+
@Test
public void getSchemaNames() {
ConnInstanceTO conn = restTemplate.getForObject(
BASE_URL + "connector/read/{connectorId}.json",
ConnInstanceTO.class, "101");
-
+
List<String> schemaNames = Arrays.asList(restTemplate.postForObject(
BASE_URL + "connector/schema/list?showall=true",
conn, String[].class));
assertNotNull(schemaNames);
assertFalse(schemaNames.isEmpty());
-
+
schemaNames = Arrays.asList(restTemplate.postForObject(
BASE_URL + "connector/schema/list",
conn, String[].class));
assertNotNull(schemaNames);
assertEquals(0, schemaNames.size());
-
+
conn = restTemplate.getForObject(
BASE_URL + "connector/read/{connectorId}.json",
ConnInstanceTO.class, "104");
// to be used with overridden properties
conn.getConfiguration().clear();
-
+
schemaNames = Arrays.asList(restTemplate.postForObject(
BASE_URL + "connector//schema/list?showall=true",
conn, String[].class, conn));
assertNotNull(schemaNames);
assertFalse(schemaNames.isEmpty());
}
-}
\ No newline at end of file
+}
Modified: incubator/syncope/trunk/core/src/test/java/org/syncope/core/rest/ReportTestITCase.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/core/src/test/java/org/syncope/core/rest/ReportTestITCase.java?rev=1297585&r1=1297584&r2=1297585&view=diff
==============================================================================
--- incubator/syncope/trunk/core/src/test/java/org/syncope/core/rest/ReportTestITCase.java (original)
+++ incubator/syncope/trunk/core/src/test/java/org/syncope/core/rest/ReportTestITCase.java Tue Mar 6 17:29:27 2012
@@ -42,7 +42,7 @@ public class ReportTestITCase extends Ab
@Test
public void getReportletClasses() {
Set<String> reportletClasses = restTemplate.getForObject(
- BASE_URL + "report/reportletClasses.json", Set.class);
+ BASE_URL + "report/reportletConfClasses.json", Set.class);
assertNotNull(reportletClasses);
assertFalse(reportletClasses.isEmpty());
}
Modified: incubator/syncope/trunk/parent/pom.xml
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/parent/pom.xml?rev=1297585&r1=1297584&r2=1297585&view=diff
==============================================================================
--- incubator/syncope/trunk/parent/pom.xml (original)
+++ incubator/syncope/trunk/parent/pom.xml Tue Mar 6 17:29:27 2012
@@ -23,7 +23,7 @@ under the License.
<modelVersion>4.0.0</modelVersion>
- <name>Apache Syncope Parent</name>
+ <name>Apache Syncope</name>
<description>Apache Syncope parent POM</description>
<groupId>org.apache.syncope</groupId>