Skip to content

Commit

Permalink
report data source impelentation. small refactor for report task hand…
Browse files Browse the repository at this point in the history
…ler..
  • Loading branch information
katkav committed Feb 10, 2015
1 parent d0fd5c8 commit 2b45757
Show file tree
Hide file tree
Showing 44 changed files with 1,725 additions and 78 deletions.
8 changes: 8 additions & 0 deletions build-system/pom.xml
Expand Up @@ -551,6 +551,14 @@
<artifactId>velocity</artifactId>
<version>1.7</version>
</dependency>

<!-- report dependency (needed for microsoft office formats) -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.10.1</version>
</dependency>

</dependencies>
</dependencyManagement>

Expand Down
6 changes: 6 additions & 0 deletions gui/admin-gui/pom.xml
Expand Up @@ -534,6 +534,12 @@
</exclusion>
</exclusions>
</dependency>
<!-- report dependency (needed for microsoft office formats) -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.10.1</version>
</dependency>
<dependency>
<groupId>commons-javaflow</groupId>
<artifactId>commons-javaflow</artifactId>
Expand Down
61 changes: 61 additions & 0 deletions infra/schema/pom.xml
Expand Up @@ -234,6 +234,67 @@
<extraarg>http://www.w3.org/2000/09/xmldsig</extraarg>
</extraargs>
</wsdlOption>
<wsdlOption>
<wsdl>src/main/resources/xml/ns/private/report/reportWrapper.wsdl</wsdl>
<wsdlLocation>classpath:xml/ns/private/report/reportWrapper.wsdl</wsdlLocation>
<catalog>${basedir}/src/main/resources/META-INF/jax-ws-catalog-compile-time.xml</catalog>
<extraargs>
<extraarg>-impl</extraarg>
<extraarg>-verbose</extraarg>
<extraarg>-validate</extraarg>
<extraarg>-xjc-Xts</extraarg>
<extraarg>-xjc-XhashCode</extraarg>
<extraarg>-xjc-Xequals</extraarg>
<extraarg>
-xjc-Xequals-equalsStrategyClass=com.evolveum.midpoint.util.xml.DomAwareEqualsStrategy
</extraarg>
<extraarg>-nexclude</extraarg>
<extraarg>http://prism.evolveum.com/xml/ns/public/types-3</extraarg>
<extraarg>-nexclude</extraarg>
<extraarg>http://prism.evolveum.com/xml/ns/public/annotation-3</extraarg>
<extraarg>-nexclude</extraarg>
<extraarg>http://prism.evolveum.com/xml/ns/public/query-3</extraarg>
<!-- <extraargs>-version</extraargs> -->

<extraarg>-xjc-Xmidpoint</extraarg>
</extraargs>
</wsdlOption>
<wsdlOption>
<!-- Ugly hack. The fake WSDL includes the XSD file we need to compile.
This is the only way I found to skip generating java classes for included
schemas (namely, common-3); we need to use -nexclude parameter that is
available only in wsdl codegen plugin. -->
<wsdl>src/main/resources/xml/ns/private/fake/fakeWrapper-report.wsdl</wsdl>
<catalog>${basedir}/src/main/resources/META-INF/jax-ws-catalog-compile-time.xml</catalog>
<extraargs>
<extraarg>-impl</extraarg>
<extraarg>-verbose</extraarg>
<extraarg>-validate</extraarg>
<extraarg>-xjc-Xts</extraarg>
<extraarg>-xjc-XhashCode</extraarg>
<extraarg>-xjc-Xequals</extraarg>
<extraarg>
-xjc-Xequals-equalsStrategyClass=com.evolveum.midpoint.util.xml.DomAwareEqualsStrategy
</extraarg>
<extraarg>-xjc-Xmidpoint</extraarg>
<extraarg>-nexclude</extraarg>
<extraarg>http://prism.evolveum.com/xml/ns/public/types-3</extraarg>
<extraarg>-nexclude</extraarg>
<extraarg>http://prism.evolveum.com/xml/ns/public/annotation-3</extraarg>
<extraarg>-nexclude</extraarg>
<extraarg>http://prism.evolveum.com/xml/ns/public/query-3</extraarg>
<extraarg>-nexclude</extraarg>
<extraarg>http://midpoint.evolveum.com/xml/ns/public/common/common-3</extraarg>
<extraarg>-nexclude</extraarg>
<extraarg>http://www.w3.org/2001/04/xmlenc</extraarg>
<extraarg>-nexclude</extraarg>
<extraarg>http://www.w3.org/2001/XMLSchema</extraarg>
<extraarg>-nexclude</extraarg>
<extraarg>http://www.w3.org/XML/1998/namespace</extraarg>
<extraarg>-nexclude</extraarg>
<extraarg>http://www.w3.org/2000/09/xmldsig</extraarg>
</extraargs>
</wsdlOption>
<wsdlOption>
<wsdl>src/main/resources/xml/ns/private/model/modelWrapper.wsdl</wsdl>
<wsdlLocation>classpath:xml/ns/private/model/modelWrapper.wsdl</wsdlLocation>
Expand Down
Expand Up @@ -85,11 +85,10 @@ public static <T extends Objectable> ObjectDelta<T> createObjectDelta(ObjectModi

return objectDelta;
}

public static <T extends Objectable> ObjectDelta<T> createObjectDelta(ObjectDeltaType objectDeltaType,
PrismContext prismContext) throws SchemaException {

Validate.notNull(prismContext, "No prismContext in DeltaConvertor.createObjectDelta call");
public static <T extends Objectable> ObjectDelta<T> createObjectDelta(ObjectDeltaType objectDeltaType,
PrismContext prismContext, boolean allowRawValues) throws SchemaException {
Validate.notNull(prismContext, "No prismContext in DeltaConvertor.createObjectDelta call");
QName objectType = objectDeltaType.getObjectType();
if (objectType == null) {
throw new SchemaException("No objectType specified");
Expand All @@ -109,8 +108,10 @@ public static <T extends Objectable> ObjectDelta<T> createObjectDelta(ObjectDelt
ObjectDelta<T> objectDelta = new ObjectDelta<T>(type, ChangeType.MODIFY, prismContext);
objectDelta.setOid(objectDeltaType.getOid());
for (ItemDeltaType propMod : objectDeltaType.getItemDelta()) {
ItemDelta itemDelta = createItemDelta(propMod, objDef);
objectDelta.addModification(itemDelta);
ItemDelta itemDelta = createItemDelta(propMod, objDef, allowRawValues);
if (itemDelta != null){
objectDelta.addModification(itemDelta);
}
}
return objectDelta;
} else if (objectDeltaType.getChangeType() == ChangeTypeType.DELETE) {
Expand All @@ -123,6 +124,13 @@ public static <T extends Objectable> ObjectDelta<T> createObjectDelta(ObjectDelt

}


public static <T extends Objectable> ObjectDelta<T> createObjectDelta(ObjectDeltaType objectDeltaType,
PrismContext prismContext) throws SchemaException {
return createObjectDelta(objectDeltaType, prismContext, false);

}

public static ObjectDeltaOperation createObjectDeltaOperation(ObjectDeltaOperationType objectDeltaOperationType,
PrismContext prismContext) throws SchemaException {
ObjectDeltaOperation retval = new ObjectDeltaOperation(createObjectDelta(objectDeltaOperationType.getObjectDelta(), prismContext));
Expand Down Expand Up @@ -271,8 +279,8 @@ public static <V extends PrismValue> ItemDelta<V> createItemDelta(ItemDeltaType
return createItemDelta(propMod, objectDefinition);
}

public static <V extends PrismValue> ItemDelta<V> createItemDelta(ItemDeltaType propMod, PrismContainerDefinition<?> pcDef) throws
SchemaException {
public static <V extends PrismValue> ItemDelta<V> createItemDelta(ItemDeltaType propMod, PrismContainerDefinition<?> pcDef, boolean allowRawValues) throws
SchemaException {
ItemPathType parentPathType = propMod.getPath();
ItemPath parentPath = null;
if (parentPathType != null){
Expand All @@ -289,6 +297,9 @@ public static <V extends PrismValue> ItemDelta<V> createItemDelta(ItemDeltaType
if (containingPcd == null) {
containerDef = pcDef.findContainerDefinition(parentPath.allUpToLastNamed());
if (containerDef == null){
if (allowRawValues){
return null;
}
throw new SchemaException("No definition for " + parentPath.allUpToLastNamed().lastNamed().getName() + " (while creating delta for " + pcDef + ")");
}
}
Expand All @@ -304,6 +315,12 @@ public static <V extends PrismValue> ItemDelta<V> createItemDelta(ItemDeltaType
}

return itemDelta;

}

public static <V extends PrismValue> ItemDelta<V> createItemDelta(ItemDeltaType propMod, PrismContainerDefinition<?> pcDef) throws
SchemaException {
return createItemDelta(propMod, pcDef, false);
}

/**
Expand Down
Expand Up @@ -126,6 +126,9 @@ private void registerBuiltinSchemas(SchemaRegistry schemaRegistry) throws Schema

schemaRegistry.registerPrismSchemasFromWsdlResource("xml/ns/public/model/model-3.wsdl",
Arrays.asList(com.evolveum.midpoint.xml.ns._public.model.model_3.ObjectFactory.class.getPackage()));

// schemaRegistry.registerPrismSchemasFromWsdlResource("xml/ns/public/report/report-3.wsdl",
// Arrays.asList(com.evolveum.midpoint.xml.ns._public.report.report_3.ObjectFactory.class.getPackage()));

schemaRegistry.registerPrismSchemaResource("xml/ns/public/resource/annotation-3.xsd", "ra");

Expand Down
Expand Up @@ -16,21 +16,28 @@

package com.evolveum.midpoint.schema.util;

import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.util.Collection;

import com.evolveum.midpoint.prism.*;
import javax.xml.namespace.QName;

import org.apache.commons.codec.binary.Base64;
import org.w3c.dom.Element;

import com.evolveum.midpoint.prism.Containerable;
import com.evolveum.midpoint.prism.ItemDefinition;
import com.evolveum.midpoint.prism.PrismContainer;
import com.evolveum.midpoint.prism.PrismContainerDefinition;
import com.evolveum.midpoint.prism.PrismContext;
import com.evolveum.midpoint.prism.PrismObject;
import com.evolveum.midpoint.prism.delta.ItemDelta;
import com.evolveum.midpoint.prism.delta.ObjectDelta;
import com.evolveum.midpoint.prism.path.ItemPath;
import com.evolveum.midpoint.prism.schema.PrismSchema;
import com.evolveum.midpoint.util.exception.SchemaException;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ReportConfigurationType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ReportType;

import org.w3c.dom.Element;

import javax.xml.namespace.QName;

/**
* @author lazyman
*/
Expand Down
Expand Up @@ -71,6 +71,10 @@
<public publicId="http://midpoint.evolveum.com/xml/ns/public/common/fault-3.xsd" uri="../xml/ns/public/common/fault-3.xsd" />
<system systemId="http://midpoint.evolveum.com/xml/ns/public/common/fault-3.xsd" uri="../xml/ns/public/common/fault-3.xsd" />

<!-- Report WSDL location -->
<public publicId="http://midpoint.evolveum.com/xml/ns/public/report/report-3" uri="../xml/ns/public/report/report-3.wsdl" />
<system systemId="http://midpoint.evolveum.com/xml/ns/public/report/report-3" uri="../xml/ns/public/report/report-3.wsdl" />

<!-- Bundled standard schemas -->
<public publicId="datatypes" uri="../xml/ns/standard/datatypes.dtd" />
<system systemId="datatypes" uri="../xml/ns/standard/datatypes.dtd" />
Expand Down
4 changes: 4 additions & 0 deletions infra/schema/src/main/resources/META-INF/catalog-runtime.xml
Expand Up @@ -67,6 +67,10 @@

<public publicId="http://midpoint.evolveum.com/xml/ns/public/common/fault-3.xsd" uri="../xml/ns/public/common/fault-3.xsd" />
<system systemId="http://midpoint.evolveum.com/xml/ns/public/common/fault-3.xsd" uri="../xml/ns/public/common/fault-3.xsd" />

<!-- Report WSDL location -->
<public publicId="http://midpoint.evolveum.com/xml/ns/public/report/report-3" uri="../xml/ns/public/report/report-3.wsdl" />
<system systemId="http://midpoint.evolveum.com/xml/ns/public/report/report-3" uri="../xml/ns/public/report/report-3.wsdl" />

<!-- Bundled standard schemas -->
<public publicId="datatypes" uri="../xml/ns/standard/datatypes.dtd" />
Expand Down
Expand Up @@ -27,6 +27,10 @@

<public publicId="http://midpoint.evolveum.com/xml/ns/public/common/fault-3" uri="../xml/ns/public/common/fault-3.wsdl" />
<system systemId="http://midpoint.evolveum.com/xml/ns/public/common/fault-3" uri="../xml/ns/public/common/fault-3.wsdl" />

<!-- Report WSDL location -->
<public publicId="http://midpoint.evolveum.com/xml/ns/public/report/report-3" uri="../xml/ns/public/report/report-3.wsdl" />
<system systemId="http://midpoint.evolveum.com/xml/ns/public/report/report-3" uri="../xml/ns/public/report/report-3.wsdl" />

<public publicId="http://midpoint.evolveum.com/xml/ns/public/common/api-types-3" uri="../xml/ns/public/common/api-types-3.xsd" />
<system systemId="http://midpoint.evolveum.com/xml/ns/public/common/api-types-3" uri="../xml/ns/public/common/api-types-3.xsd" />
Expand Down
Expand Up @@ -19,6 +19,10 @@

<public publicId="http://midpoint.evolveum.com/xml/ns/public/model/model-3" uri="../xml/ns/public/model/model-3.wsdl" />
<system systemId="http://midpoint.evolveum.com/xml/ns/public/model/model-3" uri="../xml/ns/public/model/model-3.wsdl" />

<!-- Report WSDL location -->
<public publicId="http://midpoint.evolveum.com/xml/ns/public/report/report-3" uri="../xml/ns/public/report/report-3.wsdl" />
<system systemId="http://midpoint.evolveum.com/xml/ns/public/report/report-3" uri="../xml/ns/public/report/report-3.wsdl" />

<!--<public publicId="http://midpoint.evolveum.com/xml/ns/public/common/api-types-3" uri="../xml/ns/public/common/api-types-3.xsd" />-->
<!--<system systemId="http://midpoint.evolveum.com/xml/ns/public/common/api-types-3" uri="../xml/ns/public/common/api-types-3.xsd" />-->
Expand Down
4 changes: 4 additions & 0 deletions infra/schema/src/main/resources/META-INF/jax-ws-catalog.xml
Expand Up @@ -19,6 +19,10 @@
<public publicId="http://midpoint.evolveum.com/xml/ns/public/model/model-3" uri="../xml/ns/public/model/model-3.wsdl" />
<system systemId="http://midpoint.evolveum.com/xml/ns/public/model/model-3" uri="../xml/ns/public/model/model-3.wsdl" />

<!-- Report WSDL location -->
<public publicId="http://midpoint.evolveum.com/xml/ns/public/report/report-3" uri="../xml/ns/public/report/report-3.wsdl" />
<system systemId="http://midpoint.evolveum.com/xml/ns/public/report/report-3" uri="../xml/ns/public/report/report-3.wsdl" />

<public publicId="http://midpoint.evolveum.com/xml/ns/public/common/fault-3" uri="../xml/ns/public/common/fault-3.wsdl" />
<system systemId="http://midpoint.evolveum.com/xml/ns/public/common/fault-3" uri="../xml/ns/public/common/fault-3.wsdl" />

Expand Down
@@ -0,0 +1,95 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2010-2014 Evolveum
~
~ 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.
-->

<definitions name="fake"
targetNamespace="http://midpoint.evolveum.com/xml/ns/private/fake/fake-1-report.wsdl"
xmlns:tns="http://midpoint.evolveum.com/xml/ns/private/fake/fake-1-report.wsdl"
xmlns="http://schemas.xmlsoap.org/wsdl/"

xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">

<documentation>

TODO

</documentation>

<types>
<xsd:schema targetNamespace="http://midpoint.evolveum.com/xml/ns/private/fake/fake-1-report.wsdl">
<xsd:import namespace="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
schemaLocation="../../public/common/common-3.xsd"/>
<xsd:import namespace="http://midpoint.evolveum.com/xml/ns/public/resource/capabilities-3"
schemaLocation="../../public/resource/capabilities-3.xsd"/>
<xsd:import namespace="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/resource-schema-3"
schemaLocation="../../public/connector/icf-1/resource-schema-3.xsd"/>
<xsd:import namespace="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/connector-schema-3"
schemaLocation="../../public/connector/icf-1/connector-schema-3.xsd"/>
<!--
<xsd:import namespace="http://midpoint.evolveum.com/xml/ns/public/communication/workflow-1.xsd"
schemaLocation="../../public/communication/workflow-1.xsd"/>
-->
<xsd:import namespace="http://midpoint.evolveum.com/xml/ns/model/workflow/common-forms-3"
schemaLocation="../../public/model/workflow/common-forms-3.xsd"/>
<xsd:import namespace="http://midpoint.evolveum.com/xml/ns/model/workflow/process-instance-state-3"
schemaLocation="../../public/model/workflow/process-instance-state-3.xsd"/>
<xsd:import namespace="http://midpoint.evolveum.com/xml/ns/public/model/scripting-3"
schemaLocation="../../public/model/scripting/scripting-3.xsd"/>

<xsd:import namespace="http://prism.evolveum.com/xml/ns/public/query-3"
schemaLocation="http://prism.evolveum.com/xml/ns/public/query-3"/>
<xsd:import namespace="http://prism.evolveum.com/xml/ns/public/types-3"
schemaLocation="http://prism.evolveum.com/xml/ns/public/types-3"/>


</xsd:schema>
</types>

<message name="fakeRequest">
<part name="fakePart" type="xsd:string">
</part>
</message>
<message name="fakeResponse">
<part name="fakePart" type="xsd:string">
</part>
</message>

<portType name="fakePortType">

<operation name="fake">
<input name="fakeInput" message="tns:fakeRequest"/>
<output name="fakeOutput" message="tns:fakeResponse"/>
</operation>

</portType>

<binding name="fakeBinding" type="tns:fakePortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="fake">
<soap:operation/>
<input name="fakeInput">
<soap:body use="literal" namespace="http://midpoint.evolveum.com/xml/ns/public/report/report-3"/>
</input>
<output name="fakeOutput">
<soap:body use="literal" namespace="http://midpoint.evolveum.com/xml/ns/public/report/report-3"/>
</output>
</operation>
</binding>
</definitions>



0 comments on commit 2b45757

Please sign in to comment.